import { ScrollDirection } from '../../components/scroll/scroll.types' ; import { namespacedWireCommit } from '../../wiring/namespaced-wires.factory' ; import { WirePayload } from '../../wiring/wiring.types' ; import { createWiring } from '../../wiring/wiring.utils' ; const moduleName = 'scroll' ; const wireCommit = namespacedWireCommit ( moduleName ) ; public export const setScrollPositionWire = wireCommit ( 'setScrollComponentState' , ( { metadata , eventPayload } ) => ( { newState : { position : eventPayload } , id : metadata . id as string } ) ) ; public export const setScrollDirectionWire = wireCommit ( 'setScrollComponentState' , ( { metadata , eventPayload } ) => ( { newState : { direction : eventPayload } , id : metadata . id ! } ) ) ; public export const setScrollHasAlmostReachedEndWire = wireCommit ( 'setScrollComponentState' , ( { metadata , eventPayload } ) => ( { newState : { hasAlmostReachedEnd : eventPayload } , id : metadata . id as string } ) ) ; public export const setScrollHasReachedEndWire = wireCommit ( 'setScrollComponentState' , ( { metadata , eventPayload } ) => ( { newState : { hasReachedEnd : eventPayload } , id : metadata . id as string } ) ) ; public export const setScrollHasReachedStartWire = wireCommit ( 'setScrollComponentState' , ( { metadata , eventPayload } ) => ( { newState : { hasReachedStart : eventPayload } , id : metadata . id as string } ) ) ; public export const setPendingScrollToWire = wireCommit ( 'setPendingScrollTo' , ( { eventPayload : { scroll } } ) => scroll ) ; public export const clearPendingScrollToWire = wireCommit ( 'setPendingScrollTo' , '' ) ; /**
 * Wiring configuration for the  ScrollXModule .
 *
 *  internal export const scrollWiring = createWiring ( { UserScrolled : { setScrollPositionWire } , UserChangedScrollDirection : { setScrollDirectionWire } , UserReachedScrollStart : { setScrollHasReachedStartWire } , UserAlmostReachedScrollEnd : { setScrollHasAlmostReachedEndWire } , UserReachedScrollEnd : { setScrollHasReachedEndWire } , ParamsLoadedFromUrl : { setPendingScrollToWire } , ScrollRestoreSucceeded : { clearPendingScrollToWire } , ScrollRestoreFailed : { clearPendingScrollToWire } } ) ;