Safe Haskell | None |
---|---|
Language | Haskell98 |
This is a builder to be used on the client side. It can be run in two modes:
- in "hydration mode", reusing DOM nodes already in the page (as produced
by
renderStatic
) - in "immediate mode", creating and appending DOM nodes as required
In "hydration mode", the preexisting DOM must contain what the builder will expect at switchover time (the time at which parity with the static renderer is reached, and the time after which the page is "live").
For example, displaying the current time as text should be done inside
prerender
to ensure that we don't attempt to hydrate the incorrect text.
The server will prerender a text node with time A, and the client will expect
a text node with time B. Barring a miracle, time A and time B will not match,
and hydration will fail.
Synopsis
- newtype HydrationDomBuilderT s t m a = HydrationDomBuilderT {
- unHydrationDomBuilderT :: ReaderT (HydrationDomBuilderEnv t m) (DomRenderHookT t m) a
- data HydrationDomBuilderEnv t m = HydrationDomBuilderEnv {
- _hydrationDomBuilderEnv_document :: !Document
- _hydrationDomBuilderEnv_parent :: !(Either Node (IORef Node))
- _hydrationDomBuilderEnv_unreadyChildren :: !(IORef Word)
- _hydrationDomBuilderEnv_commitAction :: !(JSM ())
- _hydrationDomBuilderEnv_hydrationMode :: !(IORef HydrationMode)
- _hydrationDomBuilderEnv_switchover :: !(Event t ())
- _hydrationDomBuilderEnv_delayed :: !(IORef (HydrationRunnerT t m ()))
- data HydrationMode
- newtype HydrationRunnerT t m a = HydrationRunnerT {
- unHydrationRunnerT :: StateT HydrationState (ReaderT Node (DomRenderHookT t m)) a
- runHydrationRunnerT :: (MonadRef m, Ref m ~ IORef, Monad m, PerformEvent t m, MonadFix m, MonadReflexCreateTrigger t m, MonadJSM m, MonadJSM (Performable m)) => HydrationRunnerT t m a -> Maybe Node -> Node -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a
- type ImmediateDomBuilderT = HydrationDomBuilderT GhcjsDomSpace
- runHydrationDomBuilderT :: (MonadFix m, PerformEvent t m, MonadReflexCreateTrigger t m, MonadJSM m, MonadJSM (Performable m), MonadRef m, Ref m ~ IORef) => HydrationDomBuilderT s t m a -> HydrationDomBuilderEnv t m -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a
- getHydrationMode :: MonadIO m => HydrationDomBuilderT s t m HydrationMode
- addHydrationStep :: MonadIO m => HydrationRunnerT t m () -> HydrationDomBuilderT s t m ()
- addHydrationStepWithSetup :: (Adjustable t m, MonadIO m) => m a -> (a -> HydrationRunnerT t m ()) -> HydrationDomBuilderT s t m ()
- setPreviousNode :: Monad m => Maybe Node -> HydrationRunnerT t m ()
- insertAfterPreviousNode :: (Monad m, MonadJSM m) => IsNode node => node -> HydrationRunnerT t m ()
- hydrateComment :: (MonadJSM m, Reflex t, MonadFix m) => Document -> Text -> Maybe (Event t Text) -> HydrationRunnerT t m Comment
- askParent :: Monad m => HydrationRunnerT t m Node
- askEvents :: Monad m => HydrationDomBuilderT s t m (Chan [DSum (EventTriggerRef t) TriggerInvocation])
- append :: MonadJSM m => Node -> HydrationDomBuilderT s t m ()
- textNodeInternal :: (Adjustable t m, MonadHold t m, MonadJSM m, MonadFix m, Reflex t) => TextNodeConfig t -> HydrationDomBuilderT HydrationDomSpace t m (TextNode HydrationDomSpace t)
- removeSubsequentNodes :: (MonadJSM m, IsNode n) => n -> m ()
- deleteBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m ()
- extractBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => DocumentFragment -> start -> end -> m ()
- deleteUpTo :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m ()
- extractUpTo :: (MonadJSM m, IsNode start, IsNode end) => DocumentFragment -> start -> end -> m ()
- type SupportsHydrationDomBuilder t m = (Reflex t, MonadJSM m, MonadHold t m, MonadFix m, MonadReflexCreateTrigger t m, MonadRef m, Ref m ~ Ref JSM, Adjustable t m, PrimMonad m, PerformEvent t m, MonadJSM (Performable m))
- collectUpTo :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m DocumentFragment
- collectUpToGivenParent :: (MonadJSM m, IsNode parent, IsNode start, IsNode end) => parent -> start -> end -> m DocumentFragment
- newtype EventTriggerRef t a = EventTriggerRef {
- unEventTriggerRef :: IORef (Maybe (EventTrigger t a))
- newtype EventFilterTriggerRef t er (en :: EventTag) = EventFilterTriggerRef (IORef (Maybe (EventTrigger t (er en))))
- wrap :: forall s m er t. (Reflex t, MonadJSM m, MonadReflexCreateTrigger t m, DomRenderHook t m, EventSpec s ~ GhcjsEventSpec) => Chan [DSum (EventTriggerRef t) TriggerInvocation] -> Element -> RawElementConfig er t s -> m (DMap EventName (EventFilterTriggerRef t er))
- elementInternal :: (MonadJSM m, Reflex t, MonadReflexCreateTrigger t m, MonadFix m) => Text -> ElementConfig er t HydrationDomSpace -> HydrationDomBuilderT HydrationDomSpace t m a -> HydrationDomBuilderT HydrationDomSpace t m (Element er HydrationDomSpace t, a)
- data HydrationDomSpace
- data GhcjsDomSpace
- newtype GhcjsDomHandler a b = GhcjsDomHandler {
- unGhcjsDomHandler :: a -> JSM b
- newtype GhcjsDomHandler1 a b = GhcjsDomHandler1 {
- unGhcjsDomHandler1 :: forall (x :: EventTag). a x -> JSM (b x)
- newtype GhcjsDomEvent en = GhcjsDomEvent {
- unGhcjsDomEvent :: EventType en
- newtype GhcjsEventFilter er en = GhcjsEventFilter (GhcjsDomEvent en -> JSM (EventFlags, JSM (Maybe (er en))))
- data Pair1 (f :: k -> *) (g :: k -> *) (a :: k) = Pair1 (f a) (g a)
- data Maybe1 f a
- data GhcjsEventSpec er = GhcjsEventSpec {}
- class Monad m => HasDocument m where
- ghcjsEventSpec_filters :: forall er. Lens' (GhcjsEventSpec er) (DMap EventName (GhcjsEventFilter er))
- ghcjsEventSpec_handler :: forall er. Lens' (GhcjsEventSpec er) (GhcjsEventHandler er)
- newtype GhcjsEventHandler er = GhcjsEventHandler {
- unGhcjsEventHandler :: forall en. (EventName en, GhcjsDomEvent en) -> JSM (Maybe (er en))
- drawChildUpdate :: (MonadJSM m, Reflex t) => HydrationDomBuilderEnv t m -> (IORef (ChildReadyState k) -> JSM ()) -> HydrationDomBuilderT s t m (f a) -> DomRenderHookT t m (Compose (TraverseChild t m k) f a)
- data ChildReadyState a
- mkHasFocus :: (HasDocument m, MonadJSM m, IsNode (RawElement d), MonadHold t m, Reflex t, IsDocumentOrShadowRoot (RawDocument (DomBuilderSpace m))) => Element er d t -> m (Dynamic t Bool)
- insertBefore :: (MonadJSM m, IsNode new, IsNode existing) => new -> existing -> m ()
- type family EventType en where ...
- defaultDomEventHandler :: IsElement e => e -> EventName en -> EventM e (EventType en) (Maybe (EventResult en))
- defaultDomWindowEventHandler :: Window -> EventName en -> EventM Window (EventType en) (Maybe (EventResult en))
- withIsEvent :: EventName en -> (IsEvent (EventType en) => r) -> r
- showEventName :: EventName en -> String
- elementOnEventName :: IsElement e => EventName en -> e -> EventM e (EventType en) () -> JSM (JSM ())
- windowOnEventName :: EventName en -> Window -> EventM Window (EventType en) () -> JSM (JSM ())
- wrapDomEvent :: (TriggerEvent t m, MonadJSM m) => e -> (e -> EventM e event () -> JSM (JSM ())) -> EventM e event a -> m (Event t a)
- subscribeDomEvent :: (EventM e event () -> JSM (JSM ())) -> EventM e event (Maybe a) -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> EventTrigger t a -> JSM (JSM ())
- wrapDomEventMaybe :: (TriggerEvent t m, MonadJSM m) => e -> (e -> EventM e event () -> JSM (JSM ())) -> EventM e event (Maybe a) -> m (Event t a)
- wrapDomEventsMaybe :: (MonadJSM m, MonadReflexCreateTrigger t m) => e -> (forall en. IsEvent (EventType en) => EventName en -> EventM e (EventType en) (Maybe (f en))) -> (forall en. EventName en -> e -> EventM e (EventType en) () -> JSM (JSM ())) -> ImmediateDomBuilderT t m (EventSelector t (WrapArg f EventName))
- getKeyEvent :: EventM e KeyboardEvent Word
- getMouseEventCoords :: EventM e MouseEvent (Int, Int)
- getTouchEvent :: EventM e TouchEvent TouchEventResult
- data WindowConfig t = WindowConfig
- data Window t = Window {}
- wrapWindow :: (MonadJSM m, MonadReflexCreateTrigger t m) => Window -> WindowConfig t -> HydrationDomBuilderT GhcjsDomSpace t m (Window t)
- traverseDMapWithKeyWithAdjust' :: forall s t m (k :: * -> *) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a)) -> DMap k v -> Event t (PatchDMap k v) -> HydrationDomBuilderT s t m (DMap k v', Event t (PatchDMap k v'))
- hoistTraverseWithKeyWithAdjust :: (Adjustable t m, MonadHold t m, GCompare k, MonadIO m, MonadJSM m, PrimMonad m, MonadFix m, Patch (p k v), Patch (p k (Constant Int)), PatchTarget (p k (Constant Int)) ~ DMap k (Constant Int), Patch (p k (Compose (TraverseChild t m (Some k)) v')), PatchTarget (p k (Compose (TraverseChild t m (Some k)) v')) ~ DMap k (Compose (TraverseChild t m (Some k)) v'), Monoid (p k (Compose (TraverseChild t m (Some k)) v')), RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => (forall vv vv'. (forall a. k a -> vv a -> DomRenderHookT t m (vv' a)) -> DMap k vv -> Event t (p k vv) -> DomRenderHookT t m (DMap k vv', Event t (p k vv'))) -> (forall vv vv'. (forall a. vv a -> vv' a) -> p k vv -> p k vv') -> (p k (Compose (TraverseChild t m (Some k)) v') -> DMap k (Constant (IORef (ChildReadyState (Some k)))) -> IO (DMap k (Constant (IORef (ChildReadyState (Some k)))))) -> (IORef (Map (Some k) Text) -> Text -> p k (Compose (TraverseChild t m (Some k)) v') -> JSM ()) -> (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a)) -> DMap k v -> Event t (p k v) -> HydrationDomBuilderT s t m (DMap k v', Event t (p k v'))
- traverseIntMapWithKeyWithAdjust' :: forall s t m v v'. (Adjustable t m, MonadJSM m, MonadFix m, PrimMonad m, MonadHold t m, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => (Key -> v -> HydrationDomBuilderT s t m v') -> IntMap v -> Event t (PatchIntMap v) -> HydrationDomBuilderT s t m (IntMap v', Event t (PatchIntMap v'))
- hoistTraverseIntMapWithKeyWithAdjust :: (Adjustable t m, MonadHold t m, MonadJSM m, MonadFix m, PrimMonad m, Monoid (p (TraverseChild t m Int v')), Functor p, PatchTarget (p (HydrationRunnerT t m ())) ~ IntMap (HydrationRunnerT t m ()), PatchTarget (p (TraverseChild t m Int v')) ~ IntMap (TraverseChild t m Int v'), Patch (p (HydrationRunnerT t m ())), Patch (p (TraverseChild t m Int v')), RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => ((Key -> v -> DomRenderHookT t m (TraverseChild t m Int v')) -> IntMap v -> Event t (p v) -> DomRenderHookT t m (IntMap (TraverseChild t m Int v'), Event t (p (TraverseChild t m Int v')))) -> (p (TraverseChild t m Int v') -> IntMap (IORef (ChildReadyState Int)) -> IO (IntMap (IORef (ChildReadyState Int)))) -> (IORef (IntMap Text) -> Text -> p (TraverseChild t m Int v') -> JSM ()) -> (Key -> v -> HydrationDomBuilderT s t m v') -> IntMap v -> Event t (p v) -> HydrationDomBuilderT s t m (IntMap v', Event t (p v'))
Documentation
newtype HydrationDomBuilderT s t m a Source #
A monad for DomBuilder which just gets the results of children and pushes
work into an action that is delayed until after postBuild (to match the
static builder). The action runs in HydrationRunnerT
, which performs the
DOM takeover and sets up the events, after which point this monad will
continue in the vein of ImmediateDomBuilderT
.
HydrationDomBuilderT | |
|
Instances
data HydrationDomBuilderEnv t m Source #
HydrationDomBuilderEnv | |
|
data HydrationMode Source #
HydrationMode_Hydrating | The time from initial load to parity with static builder |
HydrationMode_Immediate | After hydration |
Instances
Eq HydrationMode Source # | |
Defined in Reflex.Dom.Builder.Immediate (==) :: HydrationMode -> HydrationMode -> Bool # (/=) :: HydrationMode -> HydrationMode -> Bool # | |
Ord HydrationMode Source # | |
Defined in Reflex.Dom.Builder.Immediate compare :: HydrationMode -> HydrationMode -> Ordering # (<) :: HydrationMode -> HydrationMode -> Bool # (<=) :: HydrationMode -> HydrationMode -> Bool # (>) :: HydrationMode -> HydrationMode -> Bool # (>=) :: HydrationMode -> HydrationMode -> Bool # max :: HydrationMode -> HydrationMode -> HydrationMode # min :: HydrationMode -> HydrationMode -> HydrationMode # | |
Show HydrationMode Source # | |
Defined in Reflex.Dom.Builder.Immediate showsPrec :: Int -> HydrationMode -> ShowS # show :: HydrationMode -> String # showList :: [HydrationMode] -> ShowS # |
newtype HydrationRunnerT t m a Source #
The monad which performs the delayed actions to reuse prerendered nodes and set up events. State contains reference to the previous node sibling, if any, and the reader contains reference to the parent node.
HydrationRunnerT | |
|
Instances
runHydrationRunnerT :: (MonadRef m, Ref m ~ IORef, Monad m, PerformEvent t m, MonadFix m, MonadReflexCreateTrigger t m, MonadJSM m, MonadJSM (Performable m)) => HydrationRunnerT t m a -> Maybe Node -> Node -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a Source #
runHydrationDomBuilderT :: (MonadFix m, PerformEvent t m, MonadReflexCreateTrigger t m, MonadJSM m, MonadJSM (Performable m), MonadRef m, Ref m ~ IORef) => HydrationDomBuilderT s t m a -> HydrationDomBuilderEnv t m -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> m a Source #
getHydrationMode :: MonadIO m => HydrationDomBuilderT s t m HydrationMode Source #
addHydrationStep :: MonadIO m => HydrationRunnerT t m () -> HydrationDomBuilderT s t m () Source #
Add a hydration step
addHydrationStepWithSetup :: (Adjustable t m, MonadIO m) => m a -> (a -> HydrationRunnerT t m ()) -> HydrationDomBuilderT s t m () Source #
Add a hydration step which depends on some computation that should only be
done *before* the switchover to immediate mode - this is most likely some
form of hold
which we want to remove after hydration is done
setPreviousNode :: Monad m => Maybe Node -> HydrationRunnerT t m () Source #
insertAfterPreviousNode :: (Monad m, MonadJSM m) => IsNode node => node -> HydrationRunnerT t m () Source #
hydrateComment :: (MonadJSM m, Reflex t, MonadFix m) => Document -> Text -> Maybe (Event t Text) -> HydrationRunnerT t m Comment Source #
askEvents :: Monad m => HydrationDomBuilderT s t m (Chan [DSum (EventTriggerRef t) TriggerInvocation]) Source #
textNodeInternal :: (Adjustable t m, MonadHold t m, MonadJSM m, MonadFix m, Reflex t) => TextNodeConfig t -> HydrationDomBuilderT HydrationDomSpace t m (TextNode HydrationDomSpace t) Source #
removeSubsequentNodes :: (MonadJSM m, IsNode n) => n -> m () Source #
Remove all nodes after given node
deleteBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m () Source #
s and e must both be children of the same node and s must precede e; all nodes between s and e will be removed, but s and e will not be removed
extractBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => DocumentFragment -> start -> end -> m () Source #
s and e must both be children of the same node and s must precede e; all nodes between s and e will be moved into the given DocumentFragment, but s and e will not be moved
deleteUpTo :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m () Source #
s and e must both be children of the same node and s must precede e; s and all nodes between s and e will be removed, but e will not be removed
extractUpTo :: (MonadJSM m, IsNode start, IsNode end) => DocumentFragment -> start -> end -> m () Source #
type SupportsHydrationDomBuilder t m = (Reflex t, MonadJSM m, MonadHold t m, MonadFix m, MonadReflexCreateTrigger t m, MonadRef m, Ref m ~ Ref JSM, Adjustable t m, PrimMonad m, PerformEvent t m, MonadJSM (Performable m)) Source #
collectUpTo :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m DocumentFragment Source #
collectUpToGivenParent :: (MonadJSM m, IsNode parent, IsNode start, IsNode end) => parent -> start -> end -> m DocumentFragment Source #
newtype EventTriggerRef t a #
A reference to an EventTrigger
suitable for firing with TriggerEventT
.
EventTriggerRef | |
|
newtype EventFilterTriggerRef t er (en :: EventTag) Source #
EventFilterTriggerRef (IORef (Maybe (EventTrigger t (er en)))) |
wrap :: forall s m er t. (Reflex t, MonadJSM m, MonadReflexCreateTrigger t m, DomRenderHook t m, EventSpec s ~ GhcjsEventSpec) => Chan [DSum (EventTriggerRef t) TriggerInvocation] -> Element -> RawElementConfig er t s -> m (DMap EventName (EventFilterTriggerRef t er)) Source #
This wrap
is only partial: it doesn't create the EventSelector
itself
elementInternal :: (MonadJSM m, Reflex t, MonadReflexCreateTrigger t m, MonadFix m) => Text -> ElementConfig er t HydrationDomSpace -> HydrationDomBuilderT HydrationDomSpace t m a -> HydrationDomBuilderT HydrationDomSpace t m (Element er HydrationDomSpace t, a) Source #
data HydrationDomSpace Source #
Instances
data GhcjsDomSpace Source #
Instances
newtype GhcjsDomHandler a b Source #
GhcjsDomHandler | |
|
newtype GhcjsDomHandler1 a b Source #
GhcjsDomHandler1 | |
|
newtype GhcjsDomEvent en Source #
newtype GhcjsEventFilter er en Source #
GhcjsEventFilter (GhcjsDomEvent en -> JSM (EventFlags, JSM (Maybe (er en)))) |
data GhcjsEventSpec er Source #
Instances
er ~ EventResult => Default (GhcjsEventSpec er) Source # | |
Defined in Reflex.Dom.Builder.Immediate def :: GhcjsEventSpec er # |
class Monad m => HasDocument m where Source #
askDocument :: m (RawDocument (DomBuilderSpace m)) Source #
askDocument :: (m ~ f m', RawDocument (DomBuilderSpace m) ~ RawDocument (DomBuilderSpace m'), MonadTrans f, Monad m', HasDocument m') => m (RawDocument (DomBuilderSpace m)) Source #
Instances
ghcjsEventSpec_filters :: forall er. Lens' (GhcjsEventSpec er) (DMap EventName (GhcjsEventFilter er)) Source #
ghcjsEventSpec_handler :: forall er. Lens' (GhcjsEventSpec er) (GhcjsEventHandler er) Source #
newtype GhcjsEventHandler er Source #
GhcjsEventHandler | |
|
drawChildUpdate :: (MonadJSM m, Reflex t) => HydrationDomBuilderEnv t m -> (IORef (ChildReadyState k) -> JSM ()) -> HydrationDomBuilderT s t m (f a) -> DomRenderHookT t m (Compose (TraverseChild t m k) f a) Source #
data ChildReadyState a Source #
Instances
mkHasFocus :: (HasDocument m, MonadJSM m, IsNode (RawElement d), MonadHold t m, Reflex t, IsDocumentOrShadowRoot (RawDocument (DomBuilderSpace m))) => Element er d t -> m (Dynamic t Bool) Source #
type family EventType en where ... Source #
defaultDomEventHandler :: IsElement e => e -> EventName en -> EventM e (EventType en) (Maybe (EventResult en)) Source #
defaultDomWindowEventHandler :: Window -> EventName en -> EventM Window (EventType en) (Maybe (EventResult en)) Source #
showEventName :: EventName en -> String Source #
elementOnEventName :: IsElement e => EventName en -> e -> EventM e (EventType en) () -> JSM (JSM ()) Source #
windowOnEventName :: EventName en -> Window -> EventM Window (EventType en) () -> JSM (JSM ()) Source #
wrapDomEvent :: (TriggerEvent t m, MonadJSM m) => e -> (e -> EventM e event () -> JSM (JSM ())) -> EventM e event a -> m (Event t a) Source #
subscribeDomEvent :: (EventM e event () -> JSM (JSM ())) -> EventM e event (Maybe a) -> Chan [DSum (EventTriggerRef t) TriggerInvocation] -> EventTrigger t a -> JSM (JSM ()) Source #
wrapDomEventMaybe :: (TriggerEvent t m, MonadJSM m) => e -> (e -> EventM e event () -> JSM (JSM ())) -> EventM e event (Maybe a) -> m (Event t a) Source #
wrapDomEventsMaybe :: (MonadJSM m, MonadReflexCreateTrigger t m) => e -> (forall en. IsEvent (EventType en) => EventName en -> EventM e (EventType en) (Maybe (f en))) -> (forall en. EventName en -> e -> EventM e (EventType en) () -> JSM (JSM ())) -> ImmediateDomBuilderT t m (EventSelector t (WrapArg f EventName)) Source #
getMouseEventCoords :: EventM e MouseEvent (Int, Int) Source #
data WindowConfig t Source #
Instances
Default (WindowConfig t) Source # | |
Defined in Reflex.Dom.Builder.Immediate def :: WindowConfig t # |
wrapWindow :: (MonadJSM m, MonadReflexCreateTrigger t m) => Window -> WindowConfig t -> HydrationDomBuilderT GhcjsDomSpace t m (Window t) Source #
Internal
traverseDMapWithKeyWithAdjust' :: forall s t m (k :: * -> *) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a)) -> DMap k v -> Event t (PatchDMap k v) -> HydrationDomBuilderT s t m (DMap k v', Event t (PatchDMap k v')) Source #
hoistTraverseWithKeyWithAdjust Source #
:: (Adjustable t m, MonadHold t m, GCompare k, MonadIO m, MonadJSM m, PrimMonad m, MonadFix m, Patch (p k v), Patch (p k (Constant Int)), PatchTarget (p k (Constant Int)) ~ DMap k (Constant Int), Patch (p k (Compose (TraverseChild t m (Some k)) v')), PatchTarget (p k (Compose (TraverseChild t m (Some k)) v')) ~ DMap k (Compose (TraverseChild t m (Some k)) v'), Monoid (p k (Compose (TraverseChild t m (Some k)) v')), RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) | |
=> (forall vv vv'. (forall a. k a -> vv a -> DomRenderHookT t m (vv' a)) -> DMap k vv -> Event t (p k vv) -> DomRenderHookT t m (DMap k vv', Event t (p k vv'))) | The base monad's traversal |
-> (forall vv vv'. (forall a. vv a -> vv' a) -> p k vv -> p k vv') | A way of mapping over the patch type |
-> (p k (Compose (TraverseChild t m (Some k)) v') -> DMap k (Constant (IORef (ChildReadyState (Some k)))) -> IO (DMap k (Constant (IORef (ChildReadyState (Some k)))))) | Given a patch for the children DOM elements, produce a patch for the childrens' unreadiness state |
-> (IORef (Map (Some k) Text) -> Text -> p k (Compose (TraverseChild t m (Some k)) v') -> JSM ()) | Apply a patch to the DOM |
-> (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a)) | |
-> DMap k v | |
-> Event t (p k v) | |
-> HydrationDomBuilderT s t m (DMap k v', Event t (p k v')) |
traverseIntMapWithKeyWithAdjust' :: forall s t m v v'. (Adjustable t m, MonadJSM m, MonadFix m, PrimMonad m, MonadHold t m, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) => (Key -> v -> HydrationDomBuilderT s t m v') -> IntMap v -> Event t (PatchIntMap v) -> HydrationDomBuilderT s t m (IntMap v', Event t (PatchIntMap v')) Source #
hoistTraverseIntMapWithKeyWithAdjust Source #
:: (Adjustable t m, MonadHold t m, MonadJSM m, MonadFix m, PrimMonad m, Monoid (p (TraverseChild t m Int v')), Functor p, PatchTarget (p (HydrationRunnerT t m ())) ~ IntMap (HydrationRunnerT t m ()), PatchTarget (p (TraverseChild t m Int v')) ~ IntMap (TraverseChild t m Int v'), Patch (p (HydrationRunnerT t m ())), Patch (p (TraverseChild t m Int v')), RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document) | |
=> ((Key -> v -> DomRenderHookT t m (TraverseChild t m Int v')) -> IntMap v -> Event t (p v) -> DomRenderHookT t m (IntMap (TraverseChild t m Int v'), Event t (p (TraverseChild t m Int v')))) | The base monad's traversal |
-> (p (TraverseChild t m Int v') -> IntMap (IORef (ChildReadyState Int)) -> IO (IntMap (IORef (ChildReadyState Int)))) | Given a patch for the children DOM elements, produce a patch for the childrens' unreadiness state |
-> (IORef (IntMap Text) -> Text -> p (TraverseChild t m Int v') -> JSM ()) | Apply a patch to the DOM |
-> (Key -> v -> HydrationDomBuilderT s t m v') | |
-> IntMap v | |
-> Event t (p v) | |
-> HydrationDomBuilderT s t m (IntMap v', Event t (p v')) |