| Copyright | (C) 2016-2026 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <code@dmj.io> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Native.Element.List.Event
Description
Synopsis
- onScroll :: (ScrollEvent -> action) -> Attribute model action
- onScrollWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action
- onScrollMain :: (ScrollEvent -> action) -> EventHandler model action
- onScrollMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action
- onScrollToUpper :: (ScrollEvent -> action) -> Attribute model action
- onScrollToUpperWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action
- onScrollToUpperMain :: (ScrollEvent -> action) -> EventHandler model action
- onScrollToUpperMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action
- onScrollToLower :: (ScrollEvent -> action) -> Attribute model action
- onScrollToLowerWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action
- onScrollToLowerMain :: (ScrollEvent -> action) -> EventHandler model action
- onScrollToLowerMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action
- onScrollStateChange :: (ScrollStateChange -> action) -> Attribute model action
- onScrollStateChangeWith :: (ScrollStateChange -> DOMRef -> action) -> Attribute model action
- onScrollStateChangeMain :: (ScrollStateChange -> action) -> EventHandler model action
- onScrollStateChangeMainWith :: (ScrollStateChange -> model -> DOMRef -> action) -> EventHandler model action
- onLayoutComplete :: (LayoutCompleteEvent -> action) -> Attribute model action
- onLayoutCompleteWith :: (LayoutCompleteEvent -> DOMRef -> action) -> Attribute model action
- onLayoutCompleteMain :: (LayoutCompleteEvent -> action) -> EventHandler model action
- onLayoutCompleteMainWith :: (LayoutCompleteEvent -> model -> DOMRef -> action) -> EventHandler model action
- onSnap :: (SnapEvent -> action) -> Attribute model action
- onSnapWith :: (SnapEvent -> DOMRef -> action) -> Attribute model action
- onSnapMain :: (SnapEvent -> action) -> EventHandler model action
- onSnapMainWith :: (SnapEvent -> model -> DOMRef -> action) -> EventHandler model action
- data ScrollEvent = ScrollEvent {
- deltaX :: Double
- deltaY :: Double
- scrollLeft :: Double
- scrollTop :: Double
- scrollWidth :: Double
- scrollHeight :: Double
- listWidth :: Double
- listHeight :: Double
- listEventSource :: ListEventSource
- attachedCells :: [Cell]
- data SnapEvent = SnapEvent {}
- data LayoutCompleteEvent = LayoutCompleteEvent {
- layoutId :: Double
- scrollInfo :: ScrollEvent
- diffResult :: Maybe DiffResult
- visibleCellsAfterUpdate :: [ListItemInfo]
- visibleCellsBeforeUpdate :: [ListItemInfo]
- data DiffResult = DiffResult {}
- data ListEventSource
- data Cell = Cell {
- cellId :: MisoString
- cellItemKey :: MisoString
- cellIndex :: Double
- cellLeft :: Double
- cellTop :: Double
- cellRight :: Double
- cellBottom :: Double
- data ScrollStateChange
- scrollDecoder :: Decoder ScrollEvent
- snapDecoder :: Decoder SnapEvent
- layoutCompleteDecoder :: Decoder LayoutCompleteEvent
- listEvents :: Events
Event
onScroll :: (ScrollEvent -> action) -> Attribute model action Source #
https://lynxjs.org/api/elements/built-in/list.html#scroll
<list> scroll event.
data Action = HandleScroll ScrollEvent
view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScroll HandleScroll ] [ ]
update :: Action -> Effect props Model Action
update (HandleScroll ScrollEvent {..}) =
io_ (consoleLog "handled scroll event")
onScrollWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action Source #
onScrollMain :: (ScrollEvent -> action) -> EventHandler model action Source #
Like onScroll, but dispatched on the Lynx main thread (MTS).
Runs imperatively on the MTS (no VDOM diff). Meant to be used with
-XStaticPointers.
data Action = HandleScroll ScrollEvent view_ [ event (static (onScrollMain HandleScroll)) ] [ "some view" ]
onScrollMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action Source #
Like onScrollMain, but the handler also receives read-only access to the
model and the target element's DOMRef (for imperative MTS mutation).
data Action = HandleScroll ScrollEvent Model DOMRef view_ [ event (static (onScrollMainWith HandleScroll)) ] [ "some view" ]
onScrollToUpper :: (ScrollEvent -> action) -> Attribute model action Source #
https://lynxjs.org/api/elements/built-in/list.html#scrolltoupper
Callback triggered when scrolling to the top of <list>. The trigger
position of this callback can be controlled by upperThresholdItemCount.
data Action = HandleScroll ScrollEvent
view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScrollToUpper HandleScroll ] [ ]
update :: Action -> Effect props Model Action
update (HandleScroll ScrollEvent {..}) =
io_ (consoleLog "handled scroll event")
onScrollToUpperWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action Source #
Like onScrollToUpper, but the handler also receives the target element's DOMRef.
Use for main-thread (MTS) handlers that imperatively mutate the element.
onScrollToUpperMain :: (ScrollEvent -> action) -> EventHandler model action Source #
Like onScrollToUpper, but dispatched on the Lynx main thread (MTS).
Runs imperatively on the MTS (no VDOM diff). Meant to be used with
-XStaticPointers.
data Action = HandleScroll ScrollEvent view_ [ event (static (onScrollToUpperMain HandleScroll)) ] [ "some view" ]
onScrollToUpperMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action Source #
Like onScrollToUpperMain, but the handler also receives read-only access
to the model and the target element's DOMRef (for imperative MTS mutation).
data Action = HandleScroll ScrollEvent Model DOMRef view_ [ event (static (onScrollToUpperMainWith HandleScroll)) ] [ "some view" ]
onScrollToLower :: (ScrollEvent -> action) -> Attribute model action Source #
https://lynxjs.org/api/elements/built-in/list.html#scrolltolower
Callback triggered when scrolling to the bottom of <list>. The trigger
position of this callback can be controlled by lowerThresholdItemCount_
data Action = HandleScroll ScrollEvent
view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onScrollToLower HandleScroll ] [ ]
update :: Action -> Effect props Model Action
update (HandleScroll ScrollEvent {..}) =
io_ (consoleLog "handled scroll event")
onScrollToLowerWith :: (ScrollEvent -> DOMRef -> action) -> Attribute model action Source #
Like onScrollToLower, but the handler also receives the target element's DOMRef.
Use for main-thread (MTS) handlers that imperatively mutate the element.
onScrollToLowerMain :: (ScrollEvent -> action) -> EventHandler model action Source #
Like onScrollToLower, but dispatched on the Lynx main thread (MTS).
Runs imperatively on the MTS (no VDOM diff). Meant to be used with
-XStaticPointers.
data Action = HandleScroll ScrollEvent view_ [ event (static (onScrollToLowerMain HandleScroll)) ] [ "some view" ]
onScrollToLowerMainWith :: (ScrollEvent -> model -> DOMRef -> action) -> EventHandler model action Source #
Like onScrollToLowerMain, but the handler also receives read-only access
to the model and the target element's DOMRef (for imperative MTS mutation).
data Action = HandleScroll ScrollEvent Model DOMRef view_ [ event (static (onScrollToLowerMainWith HandleScroll)) ] [ "some view" ]
onScrollStateChange :: (ScrollStateChange -> action) -> Attribute model action Source #
https://lynxjs.org/api/elements/built-in/list.html#scrollstatechange
Callback triggered when the scroll state of <list> changes. The state field in the event parameter's detail indicates the scroll state: * 1 for stationary * 2 for dragging * 3 for inertial scrolling * 4 for smooth animation scrolling.
data Action = HandleScrollState ScrollStateChange view :: context -> props -> Model -> View context Action view _ _ model = list_ defaultListOptions [ onScrollStateChange HandleScrollState ] [ ] update :: Action -> Effect props Model Action update (HandleScroll Stationary) = io_ (consoleLog "Received Stationary scroll state change") update _ = pure ()
onScrollStateChangeWith :: (ScrollStateChange -> DOMRef -> action) -> Attribute model action Source #
Like onScrollStateChange, but the handler also receives the target element's DOMRef.
Use for main-thread (MTS) handlers that imperatively mutate the element.
onScrollStateChangeMain :: (ScrollStateChange -> action) -> EventHandler model action Source #
Like onScrollStateChange, but dispatched on the Lynx main thread (MTS).
Runs imperatively on the MTS (no VDOM diff). Meant to be used with
-XStaticPointers.
data Action = HandleScrollState ScrollStateChange view_ [ event (static (onScrollStateChangeMain HandleScrollState)) ] [ "some view" ]
onScrollStateChangeMainWith :: (ScrollStateChange -> model -> DOMRef -> action) -> EventHandler model action Source #
Like onScrollStateChangeMain, but the handler also receives read-only
access to the model and the target element's DOMRef (for imperative MTS
mutation).
data Action = HandleScrollState ScrollStateChange Model DOMRef view_ [ event (static (onScrollStateChangeMainWith HandleScrollState)) ] [ "some view" ]
onLayoutComplete :: (LayoutCompleteEvent -> action) -> Attribute model action Source #
https://lynxjs.org/api/elements/built-in/list.html#layoutcomplete
Callback triggered after <list> layout is complete.
data Action = HandleLayout LayoutCompleteEvent
view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onLayoutComplete HandleLayout ] [ ]
update :: Action -> Effect props Model Action
update (HandleLayout LayoutCompleteEvent {..}) =
io_ (consoleLog "Received LayoutCompleteEvent")
onLayoutCompleteWith :: (LayoutCompleteEvent -> DOMRef -> action) -> Attribute model action Source #
Like onLayoutComplete, but the handler also receives the target element's DOMRef.
Use for main-thread (MTS) handlers that imperatively mutate the element.
onLayoutCompleteMain :: (LayoutCompleteEvent -> action) -> EventHandler model action Source #
Like onLayoutComplete, but dispatched on the Lynx main thread (MTS).
Runs imperatively on the MTS (no VDOM diff). Meant to be used with
-XStaticPointers.
data Action = HandleLayout LayoutCompleteEvent view_ [ event (static (onLayoutCompleteMain HandleLayout)) ] [ "some view" ]
onLayoutCompleteMainWith :: (LayoutCompleteEvent -> model -> DOMRef -> action) -> EventHandler model action Source #
Like onLayoutCompleteMain, but the handler also receives read-only access
to the model and the target element's DOMRef (for imperative MTS mutation).
data Action = HandleLayout LayoutCompleteEvent Model DOMRef view_ [ event (static (onLayoutCompleteMainWith HandleLayout)) ] [ "some view" ]
onSnap :: (SnapEvent -> action) -> Attribute model action Source #
https://lynxjs.org/api/elements/built-in/list.html#snap
Callback when pagination scrolling is about to occur.
data Action = HandleSnap SnapEvent
view :: context -> props -> Model -> View context Action
view _ _ model = list_ defaultListOptions [ onSnap HandleSnap ] [ ]
update :: Action -> Effect props Model Action
update (HandleSnap SnapEvent {..}) =
io_ (consoleLog "Received SnapEvent")
onSnapMain :: (SnapEvent -> action) -> EventHandler model action Source #
Like onSnap, but dispatched on the Lynx main thread (MTS).
Runs imperatively on the MTS (no VDOM diff). Meant to be used with
-XStaticPointers.
data Action = HandleSnap SnapEvent view_ [ event (static (onSnapMain HandleSnap)) ] [ "some view" ]
onSnapMainWith :: (SnapEvent -> model -> DOMRef -> action) -> EventHandler model action Source #
Like onSnapMain, but the handler also receives read-only access to the
model and the target element's DOMRef (for imperative MTS mutation).
data Action = HandleSnap SnapEvent Model DOMRef view_ [ event (static (onSnapMainWith HandleSnap)) ] [ "some view" ]
Types
data ScrollEvent Source #
Constructors
| ScrollEvent | |
Fields
| |
Instances
| Show ScrollEvent Source # | |
Defined in Miso.Native.Element.List.Event Methods showsPrec :: Int -> ScrollEvent -> ShowS # show :: ScrollEvent -> String # showList :: [ScrollEvent] -> ShowS # | |
| Eq ScrollEvent Source # | |
Defined in Miso.Native.Element.List.Event | |
| FromJSON ScrollEvent Source # | |
Defined in Miso.Native.Element.List.Event | |
Constructors
| SnapEvent | |
Fields
| |
data LayoutCompleteEvent Source #
https://lynxjs.org/api/elements/built-in/list.html#layoutcomplete
Enable needLayoutCompleteInfo to use.
Constructors
| LayoutCompleteEvent | |
Fields
| |
Instances
| Show LayoutCompleteEvent Source # | |
Defined in Miso.Native.Element.List.Event Methods showsPrec :: Int -> LayoutCompleteEvent -> ShowS # show :: LayoutCompleteEvent -> String # showList :: [LayoutCompleteEvent] -> ShowS # | |
| Eq LayoutCompleteEvent Source # | |
Defined in Miso.Native.Element.List.Event Methods (==) :: LayoutCompleteEvent -> LayoutCompleteEvent -> Bool # (/=) :: LayoutCompleteEvent -> LayoutCompleteEvent -> Bool # | |
data DiffResult Source #
Constructors
| DiffResult | |
Instances
| Show DiffResult Source # | |
Defined in Miso.Native.Element.List.Event Methods showsPrec :: Int -> DiffResult -> ShowS # show :: DiffResult -> String # showList :: [DiffResult] -> ShowS # | |
| Eq DiffResult Source # | |
Defined in Miso.Native.Element.List.Event | |
| FromJSON DiffResult Source # | |
Defined in Miso.Native.Element.List.Event | |
data ListEventSource Source #
Instances
| Enum ListEventSource Source # | |
Defined in Miso.Native.Element.List.Event Methods succ :: ListEventSource -> ListEventSource # pred :: ListEventSource -> ListEventSource # toEnum :: Int -> ListEventSource # fromEnum :: ListEventSource -> Int # enumFrom :: ListEventSource -> [ListEventSource] # enumFromThen :: ListEventSource -> ListEventSource -> [ListEventSource] # enumFromTo :: ListEventSource -> ListEventSource -> [ListEventSource] # enumFromThenTo :: ListEventSource -> ListEventSource -> ListEventSource -> [ListEventSource] # | |
| Show ListEventSource Source # | |
Defined in Miso.Native.Element.List.Event Methods showsPrec :: Int -> ListEventSource -> ShowS # show :: ListEventSource -> String # showList :: [ListEventSource] -> ShowS # | |
| Eq ListEventSource Source # | |
Defined in Miso.Native.Element.List.Event Methods (==) :: ListEventSource -> ListEventSource -> Bool # (/=) :: ListEventSource -> ListEventSource -> Bool # | |
| FromJSON ListEventSource Source # | |
Defined in Miso.Native.Element.List.Event | |
Constructors
| Cell | |
Fields
| |
data ScrollStateChange Source #
Constructors
| Stationary | |
| Dragging | |
| InertialScrolling | |
| SmoothAnimationScrolling |
Instances
Decoder
Event Map
listEvents :: Events Source #