@wardic/solid 2.1.2 → 3.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -18
- package/dist/browser/batch-reorder-places.js +3 -3
- package/dist/browser/batch-reorder.js +8 -5
- package/dist/browser/batch-reorder.js.map +1 -1
- package/dist/browser/config-view.js +33 -5
- package/dist/browser/config-view.js.map +1 -1
- package/dist/browser/create-animation-controls.js +22 -0
- package/dist/browser/create-animation-controls.js.map +1 -0
- package/dist/browser/create-batch.js +1 -1
- package/dist/browser/element-style.js +61 -7
- package/dist/browser/element-style.js.map +1 -1
- package/dist/browser/element.js +19 -2
- package/dist/browser/element.js.map +1 -1
- package/dist/browser/feature-section.js +5 -13
- package/dist/browser/feature-section.js.map +1 -1
- package/dist/browser/gesture-callbacks.js +3 -1
- package/dist/browser/gesture-callbacks.js.map +1 -1
- package/dist/browser/hooks/auto.js +270 -0
- package/dist/browser/hooks/auto.js.map +1 -0
- package/dist/browser/hooks/config-scope.js +120 -0
- package/dist/browser/hooks/config-scope.js.map +1 -0
- package/dist/browser/hooks/config.js +37 -0
- package/dist/browser/hooks/config.js.map +1 -0
- package/dist/browser/hooks/drag.js +632 -0
- package/dist/browser/hooks/drag.js.map +1 -0
- package/dist/browser/hooks/elements.js +183 -0
- package/dist/browser/hooks/elements.js.map +1 -0
- package/dist/browser/hooks/group.js +28 -0
- package/dist/browser/hooks/group.js.map +1 -0
- package/dist/browser/hooks/index.js +10 -0
- package/dist/browser/hooks/index.js.map +1 -0
- package/dist/browser/hooks/kept.js +32 -0
- package/dist/browser/hooks/kept.js.map +1 -0
- package/dist/browser/hooks/layout-group-of.js +39 -0
- package/dist/browser/hooks/layout-group-of.js.map +1 -0
- package/dist/browser/hooks/layout-group.js +92 -0
- package/dist/browser/hooks/layout-group.js.map +1 -0
- package/dist/browser/hooks/make-ward.js +157 -0
- package/dist/browser/hooks/make-ward.js.map +1 -0
- package/dist/browser/hooks/presence-scope.js +87 -0
- package/dist/browser/hooks/presence-scope.js.map +1 -0
- package/dist/browser/hooks/presence.js +24 -0
- package/dist/browser/hooks/presence.js.map +1 -0
- package/dist/browser/hooks/props.js +148 -0
- package/dist/browser/hooks/props.js.map +1 -0
- package/dist/browser/hooks/reads.js +241 -0
- package/dist/browser/hooks/reads.js.map +1 -0
- package/dist/browser/hooks/refs.js +87 -0
- package/dist/browser/hooks/refs.js.map +1 -0
- package/dist/browser/hooks/reorder-elements.js +268 -0
- package/dist/browser/hooks/reorder-elements.js.map +1 -0
- package/dist/browser/hooks/reorder.js +176 -0
- package/dist/browser/hooks/reorder.js.map +1 -0
- package/dist/browser/hooks/rune.js +799 -0
- package/dist/browser/hooks/rune.js.map +1 -0
- package/dist/browser/hooks/server-features.client.js +2 -0
- package/dist/browser/hooks/server-features.client.js.map +1 -0
- package/dist/browser/hooks/server-features.js +13 -0
- package/dist/browser/hooks/server-features.js.map +1 -0
- package/dist/browser/hooks/settings.js +29 -0
- package/dist/browser/hooks/settings.js.map +1 -0
- package/dist/browser/hooks/setup.js +154 -0
- package/dist/browser/hooks/setup.js.map +1 -0
- package/dist/browser/hooks/stage.js +117 -0
- package/dist/browser/hooks/stage.js.map +1 -0
- package/dist/browser/hooks/ward.js +2193 -0
- package/dist/browser/hooks/ward.js.map +1 -0
- package/dist/browser/hooks/wardic-provider.js +29 -0
- package/dist/browser/hooks/wardic-provider.js.map +1 -0
- package/dist/browser/hooks/wardic-scope.js +68 -0
- package/dist/browser/hooks/wardic-scope.js.map +1 -0
- package/dist/browser/hooks/wards.js +562 -0
- package/dist/browser/hooks/wards.js.map +1 -0
- package/dist/browser/index.js +24 -12
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/layout.js +7 -58
- package/dist/browser/layout.js.map +1 -1
- package/dist/browser/lazy-batch-gestures.js +1 -1
- package/dist/browser/lifecycle.js +59 -13
- package/dist/browser/lifecycle.js.map +1 -1
- package/dist/browser/motion-props.js +1 -1
- package/dist/browser/presence-handle.js +28 -12
- package/dist/browser/presence-handle.js.map +1 -1
- package/dist/browser/presence.js +3 -1
- package/dist/browser/presence.js.map +1 -1
- package/dist/browser/provider.js +85 -70
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/reorder-components.js +50 -0
- package/dist/browser/reorder-components.js.map +1 -0
- package/dist/browser/reorder.js +46 -274
- package/dist/browser/reorder.js.map +1 -1
- package/dist/browser/stage-ward.js +2 -2
- package/dist/browser/stage-ward.js.map +1 -1
- package/dist/browser/stage.js.map +1 -1
- package/dist/browser/unstable/v2/index.js +0 -8
- package/dist/browser/unstable/v2/index.js.map +1 -1
- package/dist/browser/v1/batch-reorder-group.js +4 -4
- package/dist/browser/v1/create-ward.js +3 -3
- package/dist/browser/v1/create-ward.js.map +1 -1
- package/dist/browser/v1/index.js +1 -1
- package/dist/browser/v1/index.js.map +1 -1
- package/dist/browser/v1/presence.js +1 -1
- package/dist/browser/v1/presence.js.map +1 -1
- package/dist/browser/variant-node.js +4 -2
- package/dist/browser/variant-node.js.map +1 -1
- package/dist/browser/w.js +33 -3
- package/dist/browser/w.js.map +1 -1
- package/dist/browser/ward.js +579 -52
- package/dist/browser/ward.js.map +1 -1
- package/dist/browser/wardic-config.js +62 -29
- package/dist/browser/wardic-config.js.map +1 -1
- package/dist/browser/wardic-context.js +23 -0
- package/dist/browser/wardic-context.js.map +1 -0
- package/dist/browser/wardic.js +3 -0
- package/dist/browser/wardic.js.map +1 -1
- package/dist/server/batch-reorder-places.js +3 -3
- package/dist/server/batch-reorder.js +8 -5
- package/dist/server/batch-reorder.js.map +1 -1
- package/dist/server/config-view.js +33 -5
- package/dist/server/config-view.js.map +1 -1
- package/dist/server/create-animation-controls.js +22 -0
- package/dist/server/create-animation-controls.js.map +1 -0
- package/dist/server/create-batch.js +1 -1
- package/dist/server/element-style.js +61 -7
- package/dist/server/element-style.js.map +1 -1
- package/dist/server/element.js +19 -2
- package/dist/server/element.js.map +1 -1
- package/dist/server/feature-section.js +5 -13
- package/dist/server/feature-section.js.map +1 -1
- package/dist/server/gesture-callbacks.js +3 -1
- package/dist/server/gesture-callbacks.js.map +1 -1
- package/dist/server/hooks/auto.js +270 -0
- package/dist/server/hooks/auto.js.map +1 -0
- package/dist/server/hooks/config-scope.js +120 -0
- package/dist/server/hooks/config-scope.js.map +1 -0
- package/dist/server/hooks/config.js +37 -0
- package/dist/server/hooks/config.js.map +1 -0
- package/dist/server/hooks/drag.js +632 -0
- package/dist/server/hooks/drag.js.map +1 -0
- package/dist/server/hooks/elements.js +192 -0
- package/dist/server/hooks/elements.js.map +1 -0
- package/dist/server/hooks/group.js +28 -0
- package/dist/server/hooks/group.js.map +1 -0
- package/dist/server/hooks/index.js +10 -0
- package/dist/server/hooks/index.js.map +1 -0
- package/dist/server/hooks/kept.js +32 -0
- package/dist/server/hooks/kept.js.map +1 -0
- package/dist/server/hooks/layout-group-of.js +39 -0
- package/dist/server/hooks/layout-group-of.js.map +1 -0
- package/dist/server/hooks/layout-group.js +109 -0
- package/dist/server/hooks/layout-group.js.map +1 -0
- package/dist/server/hooks/make-ward.js +157 -0
- package/dist/server/hooks/make-ward.js.map +1 -0
- package/dist/server/hooks/presence-scope.js +86 -0
- package/dist/server/hooks/presence-scope.js.map +1 -0
- package/dist/server/hooks/presence.js +24 -0
- package/dist/server/hooks/presence.js.map +1 -0
- package/dist/server/hooks/props.js +148 -0
- package/dist/server/hooks/props.js.map +1 -0
- package/dist/server/hooks/reads.js +241 -0
- package/dist/server/hooks/reads.js.map +1 -0
- package/dist/server/hooks/refs.js +87 -0
- package/dist/server/hooks/refs.js.map +1 -0
- package/dist/server/hooks/reorder-elements.js +308 -0
- package/dist/server/hooks/reorder-elements.js.map +1 -0
- package/dist/server/hooks/reorder.js +176 -0
- package/dist/server/hooks/reorder.js.map +1 -0
- package/dist/server/hooks/rune.js +799 -0
- package/dist/server/hooks/rune.js.map +1 -0
- package/dist/server/hooks/server-features.client.js +2 -0
- package/dist/server/hooks/server-features.client.js.map +1 -0
- package/dist/server/hooks/server-features.js +13 -0
- package/dist/server/hooks/server-features.js.map +1 -0
- package/dist/server/hooks/settings.js +29 -0
- package/dist/server/hooks/settings.js.map +1 -0
- package/dist/server/hooks/setup.js +154 -0
- package/dist/server/hooks/setup.js.map +1 -0
- package/dist/server/hooks/stage.js +117 -0
- package/dist/server/hooks/stage.js.map +1 -0
- package/dist/server/hooks/ward.js +2193 -0
- package/dist/server/hooks/ward.js.map +1 -0
- package/dist/server/hooks/wardic-provider.js +29 -0
- package/dist/server/hooks/wardic-provider.js.map +1 -0
- package/dist/server/hooks/wardic-scope.js +68 -0
- package/dist/server/hooks/wardic-scope.js.map +1 -0
- package/dist/server/hooks/wards.js +562 -0
- package/dist/server/hooks/wards.js.map +1 -0
- package/dist/server/index.js +24 -12
- package/dist/server/index.js.map +1 -1
- package/dist/server/layout.js +7 -75
- package/dist/server/layout.js.map +1 -1
- package/dist/server/lazy-batch-gestures.js +1 -1
- package/dist/server/lifecycle.js +59 -13
- package/dist/server/lifecycle.js.map +1 -1
- package/dist/server/motion-props.js +1 -1
- package/dist/server/presence-handle.js +28 -12
- package/dist/server/presence-handle.js.map +1 -1
- package/dist/server/presence.js +3 -1
- package/dist/server/presence.js.map +1 -1
- package/dist/server/provider.js +86 -80
- package/dist/server/provider.js.map +1 -1
- package/dist/server/reorder-components.js +50 -0
- package/dist/server/reorder-components.js.map +1 -0
- package/dist/server/reorder.js +46 -344
- package/dist/server/reorder.js.map +1 -1
- package/dist/server/stage-ward.js +2 -2
- package/dist/server/stage-ward.js.map +1 -1
- package/dist/server/stage.js.map +1 -1
- package/dist/server/unstable/v2/index.js +0 -8
- package/dist/server/unstable/v2/index.js.map +1 -1
- package/dist/server/v1/batch-reorder-group.js +4 -4
- package/dist/server/v1/create-ward.js +3 -3
- package/dist/server/v1/create-ward.js.map +1 -1
- package/dist/server/v1/index.js +1 -1
- package/dist/server/v1/index.js.map +1 -1
- package/dist/server/v1/presence.js +1 -1
- package/dist/server/v1/presence.js.map +1 -1
- package/dist/server/variant-node.js +4 -2
- package/dist/server/variant-node.js.map +1 -1
- package/dist/server/w.js +33 -3
- package/dist/server/w.js.map +1 -1
- package/dist/server/ward.js +579 -52
- package/dist/server/ward.js.map +1 -1
- package/dist/server/wardic-config.js +63 -30
- package/dist/server/wardic-config.js.map +1 -1
- package/dist/server/wardic-context.js +23 -0
- package/dist/server/wardic-context.js.map +1 -0
- package/dist/server/wardic.js +3 -0
- package/dist/server/wardic.js.map +1 -1
- package/dist/solid/batch-reorder-group.d.ts +1 -1
- package/dist/solid/batch-reorder-places.js +3 -3
- package/dist/solid/batch-reorder.d.ts +1 -1
- package/dist/solid/batch-reorder.d.ts.map +1 -1
- package/dist/solid/batch-reorder.js +8 -5
- package/dist/solid/batch-reorder.js.map +1 -1
- package/dist/solid/config-view.d.ts +11 -0
- package/dist/solid/config-view.d.ts.map +1 -1
- package/dist/solid/config-view.js +29 -6
- package/dist/solid/config-view.js.map +1 -1
- package/dist/solid/create-animation-controls.d.ts +20 -0
- package/dist/solid/create-animation-controls.d.ts.map +1 -0
- package/dist/solid/create-animation-controls.js +22 -0
- package/dist/solid/create-animation-controls.js.map +1 -0
- package/dist/solid/create-batch.jsx +1 -1
- package/dist/solid/element-style.d.ts +16 -2
- package/dist/solid/element-style.d.ts.map +1 -1
- package/dist/solid/element-style.js +61 -7
- package/dist/solid/element-style.js.map +1 -1
- package/dist/solid/element.d.ts +3 -1
- package/dist/solid/element.d.ts.map +1 -1
- package/dist/solid/element.jsx +21 -2
- package/dist/solid/element.jsx.map +1 -1
- package/dist/solid/feature-section.d.ts +0 -7
- package/dist/solid/feature-section.d.ts.map +1 -1
- package/dist/solid/feature-section.js +5 -13
- package/dist/solid/feature-section.js.map +1 -1
- package/dist/solid/gesture-callbacks.d.ts.map +1 -1
- package/dist/solid/gesture-callbacks.js +2 -0
- package/dist/solid/gesture-callbacks.js.map +1 -1
- package/dist/solid/hooks/auto.d.ts +44 -0
- package/dist/solid/hooks/auto.d.ts.map +1 -0
- package/dist/solid/hooks/auto.js +269 -0
- package/dist/solid/hooks/auto.js.map +1 -0
- package/dist/solid/hooks/config-scope.d.ts +84 -0
- package/dist/solid/hooks/config-scope.d.ts.map +1 -0
- package/dist/solid/hooks/config-scope.jsx +128 -0
- package/dist/solid/hooks/config-scope.jsx.map +1 -0
- package/dist/solid/hooks/config.d.ts +28 -0
- package/dist/solid/hooks/config.d.ts.map +1 -0
- package/dist/solid/hooks/config.jsx +37 -0
- package/dist/solid/hooks/config.jsx.map +1 -0
- package/dist/solid/hooks/drag.d.ts +220 -0
- package/dist/solid/hooks/drag.d.ts.map +1 -0
- package/dist/solid/hooks/drag.js +585 -0
- package/dist/solid/hooks/drag.js.map +1 -0
- package/dist/solid/hooks/elements.d.ts +11 -0
- package/dist/solid/hooks/elements.d.ts.map +1 -0
- package/dist/solid/hooks/elements.jsx +218 -0
- package/dist/solid/hooks/elements.jsx.map +1 -0
- package/dist/solid/hooks/group.d.ts +46 -0
- package/dist/solid/hooks/group.d.ts.map +1 -0
- package/dist/solid/hooks/group.jsx +25 -0
- package/dist/solid/hooks/group.jsx.map +1 -0
- package/dist/solid/hooks/index.d.ts +28 -0
- package/dist/solid/hooks/index.d.ts.map +1 -0
- package/dist/solid/hooks/index.js +10 -0
- package/dist/solid/hooks/index.js.map +1 -0
- package/dist/solid/hooks/kept.d.ts +60 -0
- package/dist/solid/hooks/kept.d.ts.map +1 -0
- package/dist/solid/hooks/kept.js +33 -0
- package/dist/solid/hooks/kept.js.map +1 -0
- package/dist/solid/hooks/layout-group-of.d.ts +27 -0
- package/dist/solid/hooks/layout-group-of.d.ts.map +1 -0
- package/dist/solid/hooks/layout-group-of.js +39 -0
- package/dist/solid/hooks/layout-group-of.js.map +1 -0
- package/dist/solid/hooks/layout-group.d.ts +60 -0
- package/dist/solid/hooks/layout-group.d.ts.map +1 -0
- package/dist/solid/hooks/layout-group.jsx +80 -0
- package/dist/solid/hooks/layout-group.jsx.map +1 -0
- package/dist/solid/hooks/make-ward.d.ts +123 -0
- package/dist/solid/hooks/make-ward.d.ts.map +1 -0
- package/dist/solid/hooks/make-ward.js +147 -0
- package/dist/solid/hooks/make-ward.js.map +1 -0
- package/dist/solid/hooks/presence-scope.d.ts +84 -0
- package/dist/solid/hooks/presence-scope.d.ts.map +1 -0
- package/dist/solid/hooks/presence-scope.jsx +62 -0
- package/dist/solid/hooks/presence-scope.jsx.map +1 -0
- package/dist/solid/hooks/presence.d.ts +51 -0
- package/dist/solid/hooks/presence.d.ts.map +1 -0
- package/dist/solid/hooks/presence.jsx +26 -0
- package/dist/solid/hooks/presence.jsx.map +1 -0
- package/dist/solid/hooks/props.d.ts +52 -0
- package/dist/solid/hooks/props.d.ts.map +1 -0
- package/dist/solid/hooks/props.js +140 -0
- package/dist/solid/hooks/props.js.map +1 -0
- package/dist/solid/hooks/reads.d.ts +38 -0
- package/dist/solid/hooks/reads.d.ts.map +1 -0
- package/dist/solid/hooks/reads.js +218 -0
- package/dist/solid/hooks/reads.js.map +1 -0
- package/dist/solid/hooks/refs.d.ts +25 -0
- package/dist/solid/hooks/refs.d.ts.map +1 -0
- package/dist/solid/hooks/refs.js +89 -0
- package/dist/solid/hooks/refs.js.map +1 -0
- package/dist/solid/hooks/reorder-elements.d.ts +23 -0
- package/dist/solid/hooks/reorder-elements.d.ts.map +1 -0
- package/dist/solid/hooks/reorder-elements.jsx +273 -0
- package/dist/solid/hooks/reorder-elements.jsx.map +1 -0
- package/dist/solid/hooks/reorder.d.ts +55 -0
- package/dist/solid/hooks/reorder.d.ts.map +1 -0
- package/dist/solid/hooks/reorder.js +152 -0
- package/dist/solid/hooks/reorder.js.map +1 -0
- package/dist/solid/hooks/rune.d.ts +885 -0
- package/dist/solid/hooks/rune.d.ts.map +1 -0
- package/dist/solid/hooks/rune.js +816 -0
- package/dist/solid/hooks/rune.js.map +1 -0
- package/dist/solid/hooks/server-features.client.d.ts +10 -0
- package/dist/solid/hooks/server-features.client.d.ts.map +1 -0
- package/dist/solid/hooks/server-features.client.js +2 -0
- package/dist/solid/hooks/server-features.client.js.map +1 -0
- package/dist/solid/hooks/server-features.d.ts +10 -0
- package/dist/solid/hooks/server-features.d.ts.map +1 -0
- package/dist/solid/hooks/server-features.js +13 -0
- package/dist/solid/hooks/server-features.js.map +1 -0
- package/dist/solid/hooks/settings.d.ts +11 -0
- package/dist/solid/hooks/settings.d.ts.map +1 -0
- package/dist/solid/hooks/settings.js +31 -0
- package/dist/solid/hooks/settings.js.map +1 -0
- package/dist/solid/hooks/setup.d.ts +31 -0
- package/dist/solid/hooks/setup.d.ts.map +1 -0
- package/dist/solid/hooks/setup.js +155 -0
- package/dist/solid/hooks/setup.js.map +1 -0
- package/dist/solid/hooks/stage.d.ts +187 -0
- package/dist/solid/hooks/stage.d.ts.map +1 -0
- package/dist/solid/hooks/stage.js +117 -0
- package/dist/solid/hooks/stage.js.map +1 -0
- package/dist/solid/hooks/ward.d.ts +394 -0
- package/dist/solid/hooks/ward.d.ts.map +1 -0
- package/dist/solid/hooks/ward.js +2237 -0
- package/dist/solid/hooks/ward.js.map +1 -0
- package/dist/solid/hooks/wardic-provider.d.ts +32 -0
- package/dist/solid/hooks/wardic-provider.d.ts.map +1 -0
- package/dist/solid/hooks/wardic-provider.jsx +29 -0
- package/dist/solid/hooks/wardic-provider.jsx.map +1 -0
- package/dist/solid/hooks/wardic-scope.d.ts +49 -0
- package/dist/solid/hooks/wardic-scope.d.ts.map +1 -0
- package/dist/solid/hooks/wardic-scope.jsx +63 -0
- package/dist/solid/hooks/wardic-scope.jsx.map +1 -0
- package/dist/solid/hooks/wards.d.ts +157 -0
- package/dist/solid/hooks/wards.d.ts.map +1 -0
- package/dist/solid/hooks/wards.js +522 -0
- package/dist/solid/hooks/wards.js.map +1 -0
- package/dist/solid/index.d.ts +25 -17
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.jsx +24 -12
- package/dist/solid/index.jsx.map +1 -1
- package/dist/solid/layout.d.ts +2 -44
- package/dist/solid/layout.d.ts.map +1 -1
- package/dist/solid/layout.jsx +7 -49
- package/dist/solid/layout.jsx.map +1 -1
- package/dist/solid/lazy-batch-gestures.js +1 -1
- package/dist/solid/lazy-batch-gestures.js.map +1 -1
- package/dist/solid/lifecycle.d.ts +32 -5
- package/dist/solid/lifecycle.d.ts.map +1 -1
- package/dist/solid/lifecycle.js +60 -21
- package/dist/solid/lifecycle.js.map +1 -1
- package/dist/solid/motion-props.js +1 -1
- package/dist/solid/presence-handle.d.ts +13 -6
- package/dist/solid/presence-handle.d.ts.map +1 -1
- package/dist/solid/presence-handle.js +30 -12
- package/dist/solid/presence-handle.js.map +1 -1
- package/dist/solid/presence.d.ts +3 -1
- package/dist/solid/presence.d.ts.map +1 -1
- package/dist/solid/presence.jsx +3 -1
- package/dist/solid/presence.jsx.map +1 -1
- package/dist/solid/provider.d.ts +25 -32
- package/dist/solid/provider.d.ts.map +1 -1
- package/dist/solid/provider.jsx +86 -62
- package/dist/solid/provider.jsx.map +1 -1
- package/dist/solid/reorder-components.d.ts +32 -0
- package/dist/solid/reorder-components.d.ts.map +1 -0
- package/dist/solid/reorder-components.jsx +49 -0
- package/dist/solid/reorder-components.jsx.map +1 -0
- package/dist/solid/reorder.d.ts +50 -76
- package/dist/solid/reorder.d.ts.map +1 -1
- package/dist/solid/reorder.jsx +40 -202
- package/dist/solid/reorder.jsx.map +1 -1
- package/dist/solid/stage-ward.jsx +2 -2
- package/dist/solid/stage-ward.jsx.map +1 -1
- package/dist/solid/stage.d.ts +14 -0
- package/dist/solid/stage.d.ts.map +1 -1
- package/dist/solid/stage.js.map +1 -1
- package/dist/solid/unstable/v2/index.d.ts +6 -26
- package/dist/solid/unstable/v2/index.d.ts.map +1 -1
- package/dist/solid/unstable/v2/index.jsx +0 -16
- package/dist/solid/unstable/v2/index.jsx.map +1 -1
- package/dist/solid/v1/batch-reorder-group.jsx +4 -4
- package/dist/solid/v1/create-ward.jsx +3 -3
- package/dist/solid/v1/create-ward.jsx.map +1 -1
- package/dist/solid/v1/index.d.ts +3 -1
- package/dist/solid/v1/index.d.ts.map +1 -1
- package/dist/solid/v1/index.jsx +1 -1
- package/dist/solid/v1/index.jsx.map +1 -1
- package/dist/solid/v1/presence.jsx +1 -1
- package/dist/solid/variant-node.d.ts +6 -0
- package/dist/solid/variant-node.d.ts.map +1 -1
- package/dist/solid/variant-node.js +2 -0
- package/dist/solid/variant-node.js.map +1 -1
- package/dist/solid/w.d.ts +9 -3
- package/dist/solid/w.d.ts.map +1 -1
- package/dist/solid/w.jsx +36 -3
- package/dist/solid/w.jsx.map +1 -1
- package/dist/solid/ward.d.ts +134 -7
- package/dist/solid/ward.d.ts.map +1 -1
- package/dist/solid/ward.jsx +549 -51
- package/dist/solid/ward.jsx.map +1 -1
- package/dist/solid/wardic-config.d.ts +17 -12
- package/dist/solid/wardic-config.d.ts.map +1 -1
- package/dist/solid/wardic-config.jsx +68 -22
- package/dist/solid/wardic-config.jsx.map +1 -1
- package/dist/solid/wardic-context.d.ts +15 -0
- package/dist/solid/wardic-context.d.ts.map +1 -0
- package/dist/solid/wardic-context.js +23 -0
- package/dist/solid/wardic-context.js.map +1 -0
- package/dist/solid/wardic-instance.d.ts +6 -4
- package/dist/solid/wardic-instance.d.ts.map +1 -1
- package/dist/solid/wardic.d.ts +3 -0
- package/dist/solid/wardic.d.ts.map +1 -1
- package/dist/solid/wardic.jsx +3 -0
- package/dist/solid/wardic.jsx.map +1 -1
- package/package.json +26 -6
- package/src/batch-reorder-group.tsx +1 -1
- package/src/batch-reorder-places.ts +3 -3
- package/src/batch-reorder.ts +9 -6
- package/src/config-view.ts +30 -6
- package/src/create-animation-controls.ts +22 -0
- package/src/create-batch.tsx +1 -1
- package/src/element-style.ts +77 -9
- package/src/element.tsx +25 -4
- package/src/feature-section.ts +5 -15
- package/src/gesture-callbacks.ts +2 -0
- package/src/hooks/auto.ts +303 -0
- package/src/hooks/config-scope.tsx +215 -0
- package/src/hooks/config.tsx +54 -0
- package/src/hooks/drag.ts +740 -0
- package/src/hooks/elements.tsx +234 -0
- package/src/hooks/group.tsx +55 -0
- package/src/hooks/index.ts +41 -0
- package/src/hooks/kept.ts +89 -0
- package/src/hooks/layout-group-of.ts +46 -0
- package/src/hooks/layout-group.tsx +111 -0
- package/src/hooks/make-ward.ts +218 -0
- package/src/hooks/presence-scope.tsx +155 -0
- package/src/hooks/presence.tsx +67 -0
- package/src/hooks/props.ts +190 -0
- package/src/hooks/reads.ts +258 -0
- package/src/hooks/refs.ts +114 -0
- package/src/hooks/reorder-elements.tsx +321 -0
- package/src/hooks/reorder.ts +205 -0
- package/src/hooks/rune.ts +1755 -0
- package/src/hooks/server-features.client.ts +10 -0
- package/src/hooks/server-features.ts +12 -0
- package/src/hooks/settings.ts +44 -0
- package/src/hooks/setup.ts +184 -0
- package/src/hooks/stage.ts +359 -0
- package/src/hooks/ward.ts +2563 -0
- package/src/hooks/wardic-provider.tsx +51 -0
- package/src/hooks/wardic-scope.tsx +112 -0
- package/src/hooks/wards.ts +679 -0
- package/src/index.tsx +31 -17
- package/src/layout.tsx +7 -74
- package/src/lazy-batch-gestures.ts +1 -1
- package/src/lifecycle.ts +72 -24
- package/src/motion-props.ts +1 -1
- package/src/presence-handle.ts +39 -20
- package/src/presence.tsx +3 -1
- package/src/provider.tsx +96 -71
- package/src/reorder-components.tsx +61 -0
- package/src/reorder.tsx +84 -303
- package/src/stage-ward.tsx +3 -3
- package/src/stage.ts +15 -0
- package/src/unstable/v2/index.tsx +6 -26
- package/src/v1/batch-reorder-group.tsx +4 -4
- package/src/v1/create-ward.tsx +4 -4
- package/src/v1/index.tsx +3 -1
- package/src/v1/presence.tsx +1 -1
- package/src/variant-node.ts +8 -0
- package/src/w.tsx +38 -5
- package/src/ward.tsx +679 -53
- package/src/wardic-config.tsx +68 -21
- package/src/wardic-context.ts +26 -0
- package/src/wardic-instance.ts +6 -4
- package/src/wardic.tsx +3 -0
- package/dist/browser/create-wardic.js +0 -36
- package/dist/browser/create-wardic.js.map +0 -1
- package/dist/browser/presence-hooks.js +0 -144
- package/dist/browser/presence-hooks.js.map +0 -1
- package/dist/server/create-wardic.js +0 -36
- package/dist/server/create-wardic.js.map +0 -1
- package/dist/server/presence-hooks.js +0 -144
- package/dist/server/presence-hooks.js.map +0 -1
- package/dist/solid/create-wardic.d.ts +0 -25
- package/dist/solid/create-wardic.d.ts.map +0 -1
- package/dist/solid/create-wardic.jsx +0 -34
- package/dist/solid/create-wardic.jsx.map +0 -1
- package/dist/solid/presence-hooks.d.ts +0 -53
- package/dist/solid/presence-hooks.d.ts.map +0 -1
- package/dist/solid/presence-hooks.jsx +0 -117
- package/dist/solid/presence-hooks.jsx.map +0 -1
- package/src/create-wardic.tsx +0 -46
- package/src/presence-hooks.tsx +0 -159
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hook ward's reads (probe: hooks-first): its gestures and its motion as state, on the ward itself.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* const card = createWard({ whileHover: lift })
|
|
6
|
+
* <article {...card}>{card.hovering() ? "Over" : "Away"}</article>
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* - `hovering()`, `pressing()`, `dragging()`, `viewing()` and `focusing()` are the gestures: each is
|
|
10
|
+
* what the sensor of that gesture reads when it's given the ward (`createHover(card)` and the rest),
|
|
11
|
+
* reached from the ward. The sensors stay, for an element with no ward and for a drag's samples.
|
|
12
|
+
* - `animating()` is whether an animation of its own is on its way: `isPending(() => card.settled())`.
|
|
13
|
+
*
|
|
14
|
+
* **Nothing is made until one is first read.** Each is a getter, the same function for every ward. At
|
|
15
|
+
* its first read it makes one signal and listens to the ward's own events, as a sensor given the ward
|
|
16
|
+
* does, so nothing listens to its element twice; and it asks for its gesture's Feature, as a first
|
|
17
|
+
* listener does, so a ward that brings what its config uses reads `hovering()` with no `whileHover`.
|
|
18
|
+
* The accessor is kept, so `const over = card.hovering` is the same one read anywhere.
|
|
19
|
+
*
|
|
20
|
+
* On a server each is `false`.
|
|
21
|
+
*
|
|
22
|
+
* The six getters are on the prototype every client ward shares, where `settled` and `tapped` are
|
|
23
|
+
* (`SHARED`, `ward.ts`), and a ward carries nothing for them. A ward with no state of its own, a
|
|
24
|
+
* server's or a Stage's, is given them as its own.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import { isServer } from "@solidjs/web"
|
|
29
|
+
import type * as Feature from "@wardic/dom/unstable/Feature"
|
|
30
|
+
import * as Keys from "@wardic/dom/unstable/features/Keys"
|
|
31
|
+
import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures"
|
|
32
|
+
import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
|
|
33
|
+
import * as Report from "@wardic/dom/Report"
|
|
34
|
+
import type * as Cause from "effect/Cause"
|
|
35
|
+
import { constFalse, constVoid } from "effect/Function"
|
|
36
|
+
import * as Predicate from "effect/Predicate"
|
|
37
|
+
import * as Scope from "effect/Scope"
|
|
38
|
+
import { type Accessor, createEffect, createMemo, createSignal, isPending, type Owner, runWithOwner } from "solid-js"
|
|
39
|
+
import type { Lifecycle } from "../lifecycle.ts"
|
|
40
|
+
import { useInstanceFeatures, useWardicRuntime } from "../provider.tsx"
|
|
41
|
+
import { CLIENT_ONLY, onSettledClientOnly } from "../solid-reactivity.ts"
|
|
42
|
+
import type { Listener } from "../waiters.ts"
|
|
43
|
+
import { type AnyWard, sensedOf, type Ward } from "../ward.tsx"
|
|
44
|
+
import type { AutoFeature } from "./auto.ts"
|
|
45
|
+
import { keptFor } from "./kept.ts"
|
|
46
|
+
|
|
47
|
+
/** The reads a hook ward has, by name. */
|
|
48
|
+
export interface WardReads {
|
|
49
|
+
/** `true` while the pointer is over its element (`createHover(ward)`'s reading). A touch never hovers. */
|
|
50
|
+
readonly hovering: Accessor<boolean>
|
|
51
|
+
/**
|
|
52
|
+
* `true` while a press is held on its element, a pointer's or the keyboard's, until its tap, its
|
|
53
|
+
* cancel, or a drag taking it over (`createPress(ward)`'s reading).
|
|
54
|
+
*/
|
|
55
|
+
readonly pressing: Accessor<boolean>
|
|
56
|
+
/** `true` from a drag's start to its release. Its samples are `createDrag(ward)`'s. */
|
|
57
|
+
readonly dragging: Accessor<boolean>
|
|
58
|
+
/** `true` while its element is in view, by its own `viewport`. */
|
|
59
|
+
readonly viewing: Accessor<boolean>
|
|
60
|
+
/** `true` while its element has the focus (`createFocus(ward)`'s reading). */
|
|
61
|
+
readonly focusing: Accessor<boolean>
|
|
62
|
+
/** `true` while an animation of its own is on its way: `isPending(() => ward.settled())`. */
|
|
63
|
+
readonly animating: Accessor<boolean>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type Read = keyof WardReads
|
|
67
|
+
|
|
68
|
+
/** What a read needs of the ward the hooks made: how it asks for a Feature, its own Features, and its owner. */
|
|
69
|
+
interface ReadsOf {
|
|
70
|
+
readonly ask: (name: AutoFeature) => void
|
|
71
|
+
readonly instance: Feature.InstanceFeatures
|
|
72
|
+
readonly owner: Owner | null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* What `ward`'s reads go by, of what the hooks keep of it (`kept.ts`): none for a ward they didn't
|
|
77
|
+
* make, or one with no Features of its own. For a ward with a state of its own, a client's.
|
|
78
|
+
*/
|
|
79
|
+
const readsOf = (ward: object): ReadsOf | undefined => {
|
|
80
|
+
const kept = keptFor(ward)
|
|
81
|
+
if (Predicate.isUndefined(kept)) return undefined
|
|
82
|
+
const ask = kept.ask
|
|
83
|
+
const instance = kept.instance
|
|
84
|
+
if (Predicate.isUndefined(ask) || Predicate.isUndefined(instance)) return undefined
|
|
85
|
+
return { ask, instance, owner: kept.owner }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Module state (#460, Q7): each ward's reads made so far, held weakly by the ward.
|
|
89
|
+
const MADE = new WeakMap<object, Partial<Record<Read, Accessor<boolean>>>>()
|
|
90
|
+
|
|
91
|
+
// Module state (#460, Q7): the finished ward each function rune's ward is part of, held weakly by the rune's.
|
|
92
|
+
const DRIVEN = new WeakMap<object, AnyWard>()
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Says which ward a function rune's ward is part of. The two share a lifecycle, so the rune's hears
|
|
96
|
+
* every event; what it isn't told is the element, which is the finished ward's alone, and `focusing`
|
|
97
|
+
* watches the element.
|
|
98
|
+
*/
|
|
99
|
+
export const drivenBy = (rune: object, ward: AnyWard): void => {
|
|
100
|
+
DRIVEN.set(rune, ward)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The ward whose element `ward` reads, and whose leave it holds: the one it's part of, or itself. */
|
|
104
|
+
export const onOf = (ward: AnyWard): AnyWard => {
|
|
105
|
+
const by = DRIVEN.get(ward)
|
|
106
|
+
if (Predicate.isUndefined(by)) return ward
|
|
107
|
+
return by
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The element `ward` is on: its own, or the one the ward it's part of is on. Read where it's tracked. */
|
|
111
|
+
const elementOf = (ward: AnyWard): HTMLElement | undefined => {
|
|
112
|
+
const sensed = sensedOf(onOf(ward))
|
|
113
|
+
if (Predicate.isUndefined(sensed)) return undefined
|
|
114
|
+
return sensed.element()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A ward event's listener for a read: each told as `on` has it, the ward's end ending nothing more. */
|
|
118
|
+
const heard = <E>(on: (event: E) => void): Listener<E> => ({ next: on, error: constVoid })
|
|
119
|
+
|
|
120
|
+
/** `ward`'s `name`, made by `make` the first time it's read and kept. */
|
|
121
|
+
const kept = (ward: object, name: Read, make: () => Accessor<boolean>): Accessor<boolean> => {
|
|
122
|
+
const known = MADE.get(ward)
|
|
123
|
+
if (Predicate.isNotUndefined(known)) {
|
|
124
|
+
const read = known[name]
|
|
125
|
+
if (Predicate.isNotUndefined(read)) return read
|
|
126
|
+
}
|
|
127
|
+
const read = make()
|
|
128
|
+
MADE.set(ward, { ...known, [name]: read })
|
|
129
|
+
return read
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A gesture's read over the ward's own events: `false` until `listen` says otherwise. Listening to the
|
|
134
|
+
* ward's lifecycle starts its recognizer, as `when` would, and `feature` is asked for as a listener asks.
|
|
135
|
+
*/
|
|
136
|
+
const gesture = (ward: AnyWard, name: Read, feature: AutoFeature | undefined, listen: (lifecycle: Lifecycle, set: (now: boolean) => void) => void): Accessor<boolean> => {
|
|
137
|
+
// A build-time flag: a server's ward has no lifecycle, and rests at `false`.
|
|
138
|
+
if (isServer) return constFalse
|
|
139
|
+
return kept(ward, name, () => {
|
|
140
|
+
const sensed = sensedOf(ward)
|
|
141
|
+
if (Predicate.isUndefined(sensed)) return constFalse
|
|
142
|
+
const of = readsOf(ward)
|
|
143
|
+
if (Predicate.isNotUndefined(of) && Predicate.isNotUndefined(feature)) of.ask(feature)
|
|
144
|
+
const [value, setValue] = createSignal(false)
|
|
145
|
+
listen(sensed.lifecycle, (now) => void setValue(now))
|
|
146
|
+
return value
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* `focusing`: a ward tells no focus events, so its element is watched by the Focus gesture of the ward's
|
|
152
|
+
* own Features, once that Feature and the element are both there, and again on another element.
|
|
153
|
+
*/
|
|
154
|
+
const focus = (ward: AnyWard, of: ReadsOf): Accessor<boolean> => {
|
|
155
|
+
of.ask("focus")
|
|
156
|
+
const [value, setValue] = createSignal(false)
|
|
157
|
+
runWithOwner(of.owner, () => {
|
|
158
|
+
const runtime = useWardicRuntime()
|
|
159
|
+
const own = useInstanceFeatures(of.instance)
|
|
160
|
+
const onDefect = (cause: Cause.Cause<never>): void => {
|
|
161
|
+
runtime.runFork(Report.failure("wardic.createWard: its focus read failed", cause))
|
|
162
|
+
}
|
|
163
|
+
// Its gesture through a memo: an effect runs again whenever what it reads does, the same answer
|
|
164
|
+
// or not, and its ward's services change as each of its other Features arrives. Watched again
|
|
165
|
+
// then, it began at `false` with the focus still on its element.
|
|
166
|
+
const watching = createMemo(() => GestureFeatures.serviceIn(own.services(), Keys.FocusGesture), CLIENT_ONLY)
|
|
167
|
+
// Begun at the settle, as what needs an element on the page is: a function rune may take the read
|
|
168
|
+
// off its ward before the ward it's part of exists, and whose element it reads is known by then
|
|
169
|
+
// (`drivenBy`, which nothing follows). Begun as the read was made, it looked the element up on its
|
|
170
|
+
// own ward, and found the right one only when its services happened to change afterwards.
|
|
171
|
+
onSettledClientOnly(() => {
|
|
172
|
+
runWithOwner(of.owner, () => {
|
|
173
|
+
createEffect(
|
|
174
|
+
() => ({ element: elementOf(ward), watch: watching() }),
|
|
175
|
+
({ element, watch }) => {
|
|
176
|
+
if (Predicate.isUndefined(element)) return undefined
|
|
177
|
+
if (Predicate.isUndefined(watch)) return undefined
|
|
178
|
+
const scope = OwnerScope.open(runtime)
|
|
179
|
+
runtime.runSync(watch.watch(element, {}, { on: (now) => void setValue(now), onDefect }).pipe(Scope.provide(scope)))
|
|
180
|
+
// Its cleanup: before the next element's watch, and as the ward ends.
|
|
181
|
+
return () => {
|
|
182
|
+
OwnerScope.close(runtime, scope, "wardic.createWard: its focus read's finalizer failed")
|
|
183
|
+
setValue(false)
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
CLIENT_ONLY,
|
|
187
|
+
)
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
return value
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Each getter is one function for every ward: `this` is the ward it's read on.
|
|
195
|
+
|
|
196
|
+
function hovering(this: AnyWard): Accessor<boolean> {
|
|
197
|
+
return gesture(this, "hovering", "hover", (lifecycle, set) => {
|
|
198
|
+
lifecycle.listen("hoverStart", heard(() => set(true)))
|
|
199
|
+
lifecycle.listen("hoverEnd", heard(() => set(false)))
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function pressing(this: AnyWard): Accessor<boolean> {
|
|
204
|
+
return gesture(this, "pressing", "press", (lifecycle, set) => {
|
|
205
|
+
lifecycle.listen("pressStart", heard(() => set(true)))
|
|
206
|
+
lifecycle.listen("tap", heard(() => set(false)))
|
|
207
|
+
lifecycle.listen("tapCancel", heard(() => set(false)))
|
|
208
|
+
// A press a drag took over tells neither of the two above.
|
|
209
|
+
lifecycle.listen("dragStart", heard(() => set(false)))
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function dragging(this: AnyWard): Accessor<boolean> {
|
|
214
|
+
// Nothing is asked for: a ward drags by its config's `drag`, which brought the Feature.
|
|
215
|
+
return gesture(this, "dragging", undefined, (lifecycle, set) => {
|
|
216
|
+
lifecycle.listen("dragStart", heard(() => set(true)))
|
|
217
|
+
lifecycle.listen("dragEnd", heard(() => set(false)))
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function viewing(this: AnyWard): Accessor<boolean> {
|
|
222
|
+
return gesture(this, "viewing", "inView", (lifecycle, set) => {
|
|
223
|
+
lifecycle.listen("viewportEnter", heard(() => set(true)))
|
|
224
|
+
lifecycle.listen("viewportLeave", heard(() => set(false)))
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function focusing(this: AnyWard): Accessor<boolean> {
|
|
229
|
+
if (isServer) return constFalse
|
|
230
|
+
return kept(this, "focusing", () => {
|
|
231
|
+
if (Predicate.isUndefined(sensedOf(this))) return constFalse
|
|
232
|
+
const of = readsOf(this)
|
|
233
|
+
// A ward with no Features of its own to ask (a Reorder's row): not read in this probe.
|
|
234
|
+
if (Predicate.isUndefined(of)) return constFalse
|
|
235
|
+
return focus(this, of)
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function animating(this: AnyWard): Accessor<boolean> {
|
|
240
|
+
if (isServer) return constFalse
|
|
241
|
+
return kept(this, "animating", () => {
|
|
242
|
+
const ward = this as unknown as Ward
|
|
243
|
+
return () => isPending(() => ward.settled())
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The six reads, as getters: shared by every client ward (`SHARED`, `ward.ts`), and a ward's own
|
|
249
|
+
* properties where it has no state to share them by. Not enumerable, so a spread never sees them.
|
|
250
|
+
*/
|
|
251
|
+
export const READS: { readonly [K in Read]: PropertyDescriptor } = {
|
|
252
|
+
hovering: { get: hovering, configurable: true },
|
|
253
|
+
pressing: { get: pressing, configurable: true },
|
|
254
|
+
dragging: { get: dragging, configurable: true },
|
|
255
|
+
viewing: { get: viewing, configurable: true },
|
|
256
|
+
focusing: { get: focusing, configurable: true },
|
|
257
|
+
animating: { get: animating, configurable: true },
|
|
258
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A rune's `ref` at work (probe: hooks-first): each rune's `ref` handed its ward's Subject while that's
|
|
3
|
+
* on show, and undone once it isn't (`RuneRef`, `rune.ts`). The same for every Environment: what its
|
|
4
|
+
* hooks give is the Subject on show, the page's an element and a Stage's what its Environment draws.
|
|
5
|
+
*
|
|
6
|
+
* - **A memo of the Subject on show, and one effect over it,** made only for a ward whose runes give a
|
|
7
|
+
* `ref` and that goes by a `show` or a presence's word. The memo is what makes the same Subject,
|
|
8
|
+
* still on show, no change: an effect runs again whenever what it reads does, whatever the answer,
|
|
9
|
+
* and a `ref` would run again on a Subject it has.
|
|
10
|
+
* - **The effect's own cleanup is the refs' undoing.** Solid runs it before the next Subject's refs,
|
|
11
|
+
* and as the owner the ward was made under ends.
|
|
12
|
+
* - **Once the Subject is on show:** the page's in the page by then, where Solid's own `ref` has it
|
|
13
|
+
* before. A page ward with no `show` has its binding run them as it mounts its element, its first
|
|
14
|
+
* target written, and undo them as it lets the element go, with nothing of their own made for them
|
|
15
|
+
* (`ward.ts`'s cheap `ref`, probe: behaviour-runes), until a presence takes it. A `show` ward's, and
|
|
16
|
+
* a taken one's, run after the flush that put the Subject on show, as an effect is. So within one
|
|
17
|
+
* flush the first kind's run before the second's, whatever their order on the page (the owner's yes,
|
|
18
|
+
* 2026-11-30); a ward's own runes' are in the order they were given, either way.
|
|
19
|
+
* - **Each `ref` is called as it is, and so is its undoing.** A signal either one reads as it runs is
|
|
20
|
+
* read once, and Solid reports it (`STRICT_READ_UNTRACKED`), as it reports one read in a `ref` of
|
|
21
|
+
* its own: the read won't update. The hooks called both under `untrack` at first, which kept a
|
|
22
|
+
* row's `ref` that read its `item` quiet, and kept as quiet a `ref` that meant to follow a signal
|
|
23
|
+
* and never would. A value read once on purpose is read outside the `ref`, or under `untrack`
|
|
24
|
+
* there, by whoever means it.
|
|
25
|
+
* - **Wherever its Subject is on show.** The page's hooks call this in a browser alone, nothing being
|
|
26
|
+
* on show on a server, and once the page has settled (`ward.ts`'s `refsAtWork`), or as a presence
|
|
27
|
+
* takes a ward whose binding ran them till then; a Stage's as its ward is made, wherever its Stage
|
|
28
|
+
* runs, which needn't be a browser. What's made here takes none of Solid's hydration ids.
|
|
29
|
+
* - **Nothing here writes a signal.** A memo derives, and an effect's callback calls the refs: what a
|
|
30
|
+
* `ref` writes is its own author's, from a listener.
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
33
|
+
*/
|
|
34
|
+
import * as Arr from "effect/Array"
|
|
35
|
+
import * as Bool from "effect/Boolean"
|
|
36
|
+
import * as MutableRef from "effect/MutableRef"
|
|
37
|
+
import * as Option from "effect/Option"
|
|
38
|
+
import * as Predicate from "effect/Predicate"
|
|
39
|
+
import * as UndefinedOr from "effect/UndefinedOr"
|
|
40
|
+
import { type Accessor, createEffect, createMemo, onCleanup } from "solid-js"
|
|
41
|
+
import { CLIENT_ONLY } from "../solid-reactivity.ts"
|
|
42
|
+
import type { RuneRef } from "./rune.ts"
|
|
43
|
+
|
|
44
|
+
/** A `ref` of any rune's, whatever its Subject: its ward's hooks hand it the Subject it's typed for. */
|
|
45
|
+
export type AnyRef = RuneRef<never>
|
|
46
|
+
|
|
47
|
+
const isRef = (value: unknown): value is AnyRef => Predicate.isFunction(value)
|
|
48
|
+
|
|
49
|
+
/** What a `ref` gave back to undo it: nothing, for one with nothing to undo. */
|
|
50
|
+
const isUndoing = (value: void | (() => void)): value is () => void => Predicate.isFunction(value)
|
|
51
|
+
|
|
52
|
+
const undo = (undoing: () => void): void => undoing()
|
|
53
|
+
|
|
54
|
+
/** Every rune's `ref` among a ward's `configs`, in the order its runes were given. */
|
|
55
|
+
export const runeRefsOf = (configs: ReadonlyArray<object>): ReadonlyArray<AnyRef> =>
|
|
56
|
+
Arr.filter(
|
|
57
|
+
Arr.map(configs, (config) => (config as { readonly ref?: unknown }).ref),
|
|
58
|
+
isRef,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
/** `refs` on a Subject, and what undoes them: what `attending` hands over from its first run. */
|
|
62
|
+
export interface Attended<Subject> {
|
|
63
|
+
readonly subject: Subject
|
|
64
|
+
readonly undo: () => void
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Each of `refs` run on `subject` in turn, and what undoes them: what they gave back, in the reverse. */
|
|
68
|
+
export const refsRun = <Subject extends object>(refs: ReadonlyArray<AnyRef>, subject: Subject): (() => void) => {
|
|
69
|
+
const undoings = Arr.filter(
|
|
70
|
+
Arr.map(refs as ReadonlyArray<RuneRef<Subject>>, (ref) => ref(subject)),
|
|
71
|
+
isUndoing,
|
|
72
|
+
)
|
|
73
|
+
return () => Arr.forEach(Arr.reverse(undoings), undo)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* `refs` run on what `subjectOnShow` gives, each time it gives another: the Subject its ward is on
|
|
78
|
+
* while that's on show, and nothing while it's hidden or gone. Each `ref` in turn, and what they gave
|
|
79
|
+
* back in the reverse once the Subject is on show no more.
|
|
80
|
+
*
|
|
81
|
+
* `already`, where they're on a Subject already, run there by its ward's mount (the cheap `ref`, `ward.ts`)
|
|
82
|
+
* until a presence took the ward: kept, not run again, while that's the Subject on show, and undone once
|
|
83
|
+
* it isn't. Undone too where the ward ends before this has run.
|
|
84
|
+
*/
|
|
85
|
+
export const attending = <Subject extends object>(refs: ReadonlyArray<AnyRef>, subjectOnShow: Accessor<Subject | undefined>, already: Option.Option<Attended<Subject>> = Option.none()): void => {
|
|
86
|
+
if (Arr.isReadonlyArrayEmpty(refs)) return
|
|
87
|
+
// Held till the effect's first run takes it.
|
|
88
|
+
const handed = MutableRef.make(already)
|
|
89
|
+
if (Option.isSome(already)) onCleanup(() => void Option.map(MutableRef.getAndSet(handed, Option.none()), undoAttended))
|
|
90
|
+
const subject = createMemo(subjectOnShow, CLIENT_ONLY)
|
|
91
|
+
createEffect(subject, (now) => onShowFrom(refs, MutableRef.getAndSet(handed, Option.none()), now), CLIENT_ONLY)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const undoAttended = <Subject>(attended: Attended<Subject>): void => attended.undo()
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `refs` on `now`, the Subject on show, and what undoes them: kept as they are where `handed` has them
|
|
98
|
+
* on it already, else what `handed` has undone first. Nothing with nothing on show.
|
|
99
|
+
*/
|
|
100
|
+
const onShowFrom = <Subject extends object>(refs: ReadonlyArray<AnyRef>, handed: Option.Option<Attended<Subject>>, now: Subject | undefined): (() => void) | undefined =>
|
|
101
|
+
Option.match(handed, {
|
|
102
|
+
onNone: () => refsOn(refs, now),
|
|
103
|
+
onSome: (was) =>
|
|
104
|
+
Bool.match(now === was.subject, {
|
|
105
|
+
onTrue: () => was.undo,
|
|
106
|
+
onFalse: () => {
|
|
107
|
+
was.undo()
|
|
108
|
+
return refsOn(refs, now)
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
/** `refs` run on `now`, where something's on show. */
|
|
114
|
+
const refsOn = <Subject extends object>(refs: ReadonlyArray<AnyRef>, now: Subject | undefined): (() => void) | undefined => UndefinedOr.map(now, (subject) => refsRun(refs, subject))
|