@wardic/solid 2.2.0 → 3.0.0-next.1
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 +39 -18
- package/dist/browser/animation-frame.js +1 -1
- package/dist/browser/animation-frame.js.map +1 -1
- package/dist/browser/config-view.js +35 -6
- package/dist/browser/config-view.js.map +1 -1
- package/dist/browser/create-batch.js +1 -1
- package/dist/browser/diagnostic-codes.js +216 -0
- package/dist/browser/diagnostic-codes.js.map +1 -0
- package/dist/browser/diagnostics.js +79 -0
- package/dist/browser/diagnostics.js.map +1 -0
- package/dist/browser/element-style.js +61 -7
- package/dist/browser/element-style.js.map +1 -1
- package/dist/browser/element.js +24 -6
- 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/frame-effect.js +1 -1
- package/dist/browser/frame-effect.js.map +1 -1
- package/dist/browser/gesture-callbacks.js +1 -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 +633 -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 +88 -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 +269 -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 +800 -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 +2212 -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 +563 -0
- package/dist/browser/hooks/wards.js.map +1 -0
- package/dist/browser/index.js +23 -11
- 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 +37 -0
- package/dist/browser/lifecycle.js.map +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 +124 -90
- 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 +51 -278
- package/dist/browser/reorder.js.map +1 -1
- package/dist/browser/runtime.js +26 -15
- package/dist/browser/runtime.js.map +1 -1
- package/dist/browser/spans-check.js +8 -3
- package/dist/browser/spans-check.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/index.js +1 -1
- package/dist/browser/v1/index.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 +594 -61
- 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/animation-frame.js +1 -1
- package/dist/server/animation-frame.js.map +1 -1
- package/dist/server/config-view.js +35 -6
- package/dist/server/config-view.js.map +1 -1
- package/dist/server/create-batch.js +1 -1
- package/dist/server/diagnostic-codes.js +216 -0
- package/dist/server/diagnostic-codes.js.map +1 -0
- package/dist/server/diagnostics.js +79 -0
- package/dist/server/diagnostics.js.map +1 -0
- package/dist/server/element-style.js +61 -7
- package/dist/server/element-style.js.map +1 -1
- package/dist/server/element.js +24 -6
- 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/frame-effect.js +1 -1
- package/dist/server/frame-effect.js.map +1 -1
- package/dist/server/gesture-callbacks.js +1 -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 +633 -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 +87 -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 +309 -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 +800 -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 +2212 -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 +563 -0
- package/dist/server/hooks/wards.js.map +1 -0
- package/dist/server/index.js +23 -11
- 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 +37 -0
- package/dist/server/lifecycle.js.map +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 +125 -100
- 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 +51 -348
- package/dist/server/reorder.js.map +1 -1
- package/dist/server/runtime.js +26 -15
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/spans-check.js +8 -3
- package/dist/server/spans-check.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/index.js +1 -1
- package/dist/server/v1/index.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 +594 -61
- 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/animation-frame.js +1 -1
- package/dist/solid/animation-frame.js.map +1 -1
- package/dist/solid/batch-reorder-group.d.ts +1 -1
- package/dist/solid/batch-reorder.d.ts +1 -1
- package/dist/solid/batch-reorder.d.ts.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 +31 -7
- package/dist/solid/config-view.js.map +1 -1
- package/dist/solid/create-batch.jsx +1 -1
- package/dist/solid/diagnostic-codes.d.ts +10 -0
- package/dist/solid/diagnostic-codes.d.ts.map +1 -0
- package/dist/solid/diagnostic-codes.js +246 -0
- package/dist/solid/diagnostic-codes.js.map +1 -0
- package/dist/solid/diagnostics.d.ts +33 -0
- package/dist/solid/diagnostics.d.ts.map +1 -0
- package/dist/solid/diagnostics.js +76 -0
- package/dist/solid/diagnostics.js.map +1 -0
- 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 +27 -8
- 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/frame-effect.jsx +1 -1
- package/dist/solid/frame-effect.jsx.map +1 -1
- package/dist/solid/gesture-callbacks.js +1 -1
- 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 +586 -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 +63 -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 +274 -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 +817 -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 +2258 -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 +523 -0
- package/dist/solid/hooks/wards.js.map +1 -0
- package/dist/solid/index.d.ts +21 -14
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.jsx +23 -11
- 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 +19 -0
- package/dist/solid/lifecycle.d.ts.map +1 -1
- package/dist/solid/lifecycle.js +40 -0
- package/dist/solid/lifecycle.js.map +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 +126 -82
- 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 +45 -206
- package/dist/solid/reorder.jsx.map +1 -1
- package/dist/solid/runtime.d.ts +20 -7
- package/dist/solid/runtime.d.ts.map +1 -1
- package/dist/solid/runtime.js +25 -14
- package/dist/solid/runtime.js.map +1 -1
- package/dist/solid/spans-check.d.ts +5 -1
- package/dist/solid/spans-check.d.ts.map +1 -1
- package/dist/solid/spans-check.js +8 -3
- package/dist/solid/spans-check.js.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 +2 -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/index.d.ts +1 -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/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 +564 -60
- 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 +29 -7
- package/skills/wardic-diagnostics/SKILL.md +472 -0
- package/skills/wardic-migrate/SKILL.md +204 -0
- package/skills/wardic-solid/SKILL.md +60 -0
- package/skills/wardic-solid/events.md +70 -0
- package/skills/wardic-solid/from-motion.md +59 -0
- package/skills/wardic-solid/lists-and-presence.md +110 -0
- package/skills/wardic-solid/reorder-and-grips.md +88 -0
- package/skills/wardic-solid/runes.md +151 -0
- package/skills/wardic-solid/scopes-and-settings.md +75 -0
- package/src/animation-frame.ts +1 -1
- package/src/batch-reorder-group.tsx +1 -1
- package/src/batch-reorder.ts +1 -1
- package/src/config-view.ts +35 -7
- package/src/create-batch.tsx +1 -1
- package/src/diagnostic-codes.ts +254 -0
- package/src/diagnostics.ts +88 -0
- package/src/element-style.ts +77 -9
- package/src/element.tsx +36 -12
- package/src/feature-section.ts +5 -15
- package/src/frame-effect.tsx +1 -1
- package/src/gesture-callbacks.ts +1 -1
- 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 +741 -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 +156 -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 +323 -0
- package/src/hooks/reorder.ts +205 -0
- package/src/hooks/rune.ts +1756 -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 +2587 -0
- package/src/hooks/wardic-provider.tsx +51 -0
- package/src/hooks/wardic-scope.tsx +112 -0
- package/src/hooks/wards.ts +681 -0
- package/src/index.tsx +27 -15
- package/src/layout.tsx +7 -74
- package/src/lazy-batch-gestures.ts +1 -1
- package/src/lifecycle.ts +40 -0
- package/src/presence-handle.ts +39 -20
- package/src/presence.tsx +3 -1
- package/src/provider.tsx +136 -88
- package/src/reorder-components.tsx +61 -0
- package/src/reorder.tsx +89 -307
- package/src/runtime.ts +43 -13
- package/src/spans-check.ts +12 -3
- package/src/stage.ts +15 -0
- package/src/unstable/v2/index.tsx +2 -26
- package/src/v1/index.tsx +1 -1
- package/src/variant-node.ts +8 -0
- package/src/w.tsx +38 -5
- package/src/ward.tsx +694 -60
- 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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `#server-features` in a browser build (solid-next): no Feature. A client render never reads it, as
|
|
3
|
+
* `auto.ts` gives every Feature on a server alone; its own are each loaded the first time a ward asks
|
|
4
|
+
* for one. See `server-features.ts`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type * as Feature from "@wardic/dom/unstable/Feature"
|
|
9
|
+
|
|
10
|
+
export const ALL: ReadonlyArray<Feature.Feature> = []
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every Feature, for a server render of the hooks (solid-next): what `#server-features` is in any build
|
|
3
|
+
* but a browser's (`package.json`'s `imports`). A browser build resolves it to
|
|
4
|
+
* `server-features.client.ts`, which has none, so no Feature is in a page's first chunk: each is a chunk of
|
|
5
|
+
* its own, fetched the first time a ward asks for it (`auto.ts`).
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
// A bundler that keeps a module a dead branch imports (Vite 8's Rolldown, where `isServer` folds after
|
|
10
|
+
// the chunks are made) put every Feature in the first chunk when `auto.ts` imported `features/All` itself:
|
|
11
|
+
// 133.5 KB gzip against 109.7 for the pack check's compiled fixture. Vite 6's Rollup drops it first.
|
|
12
|
+
export { ALL } from "@wardic/dom/unstable/features/All"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hook ward's own config settings (probe: behaviour-runes, the scopes round's Q10): `reducedMotion`,
|
|
3
|
+
* `skipAnimations` and `transformPagePoint`, given by its runes, a config scope's among them, laid over
|
|
4
|
+
* the config around it as one core `WardicConfigValue`, which the base ward reads in that config's
|
|
5
|
+
* place (`WardInternals.wardicConfig`). Its `transition` is a ward's key already, read by its view.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as ReducedMotion from "@wardic/core/ReducedMotion"
|
|
10
|
+
import type * as Config from "@wardic/core/unstable/Config"
|
|
11
|
+
import * as WardicConfigValue from "@wardic/core/unstable/WardicConfigValue"
|
|
12
|
+
import * as Arr from "effect/Array"
|
|
13
|
+
import * as Predicate from "effect/Predicate"
|
|
14
|
+
|
|
15
|
+
/** The keys a ward's own settings are given under. */
|
|
16
|
+
const SETTING_KEYS = ["reducedMotion", "skipAnimations", "transformPagePoint"] as const
|
|
17
|
+
|
|
18
|
+
/** Whether any of a ward's runes gives one of its own settings, asked of them by `has`. */
|
|
19
|
+
export const givesSettings = (has: (key: string) => boolean): boolean => Arr.some(SETTING_KEYS, has)
|
|
20
|
+
|
|
21
|
+
/** Whether one plain rune gives one of a ward's own settings. */
|
|
22
|
+
export const runeGivesSettings = (rune: object): boolean => Arr.some(SETTING_KEYS, (key) => key in rune)
|
|
23
|
+
|
|
24
|
+
const transitionOf = (parent: WardicConfigValue.WardicConfigValue | undefined): Config.WardicTransition | undefined => {
|
|
25
|
+
if (Predicate.isUndefined(parent)) return undefined
|
|
26
|
+
return parent.transition()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const isValidPropOf = (parent: WardicConfigValue.WardicConfigValue | undefined): ((key: string) => boolean) | undefined => {
|
|
30
|
+
if (Predicate.isUndefined(parent)) return undefined
|
|
31
|
+
return parent.isValidProp()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A ward's own settings, `value` of each as its runes join it now, laid over `parent`: each its own,
|
|
36
|
+
* else the config's around it, read where that config's would be.
|
|
37
|
+
*/
|
|
38
|
+
export const settingsOver = (parent: WardicConfigValue.WardicConfigValue | undefined, value: (key: string) => unknown): WardicConfigValue.WardicConfigValue => ({
|
|
39
|
+
transition: () => transitionOf(parent),
|
|
40
|
+
reducedMotion: () => WardicConfigValue.configReducedMotionOf(value("reducedMotion") as ReducedMotion.Config | undefined, parent),
|
|
41
|
+
skipAnimations: () => WardicConfigValue.configSkipAnimationsOf(value("skipAnimations") as boolean | undefined, parent),
|
|
42
|
+
isValidProp: () => isValidPropOf(parent),
|
|
43
|
+
transformPagePoint: () => WardicConfigValue.configTransformPagePointOf(value("transformPagePoint") as Config.WardicTransformPoint | undefined, parent),
|
|
44
|
+
})
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page's context (probe: hooks-first): Wardic for a page with no `<WardicProvider>`. With nothing
|
|
3
|
+
* set up it is the DOM's Environment, `DomLive`, and every setting at its default; `makeWard` gives
|
|
4
|
+
* its own, with what the provider took: its `env`, and `strict`, `reducedMotion`, `appear`, `nonce` or
|
|
5
|
+
* `scaleCorrectors`. Every hook, `w.*` element and presence with no provider above it then
|
|
6
|
+
* runs on the page's one runtime, built the first time one of them asks and kept for the page's life.
|
|
7
|
+
* A provider above still wins, so a test or a second Environment keeps its own.
|
|
8
|
+
*
|
|
9
|
+
* On a server:
|
|
10
|
+
*
|
|
11
|
+
* - **Each render gets its own context**, keyed on the render's own hydration writer
|
|
12
|
+
* (`@solidjs/web`'s `getHydrationWriter`, one a render), so two requests never share their Appear
|
|
13
|
+
* animations' rules. A render with none (no hydration) plays no Appear animation.
|
|
14
|
+
* - **The head's `<style>` is registered where each ward is made.** A provider registers it once,
|
|
15
|
+
* at the shell, where it renders; a page with none has no such place, and the render's first ward
|
|
16
|
+
* may be under a `<Loading>` still waiting, whose head tags wait with it. So each owner that asks
|
|
17
|
+
* registers the same style, in `useHead`'s function form, and the first one the server writes gets
|
|
18
|
+
* it: the shell's own, when it has one, since the shell is written first.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import { getHydrationWriter, type HeadTag, isServer, useHead } from "@solidjs/web"
|
|
23
|
+
import * as WardicConfigValue from "@wardic/core/unstable/WardicConfigValue"
|
|
24
|
+
import { DomLive } from "@wardic/dom"
|
|
25
|
+
import type * as WardConfig from "@wardic/dom/unstable/WardConfig"
|
|
26
|
+
import * as Bool from "effect/Boolean"
|
|
27
|
+
import { constUndefined, constVoid } from "effect/Function"
|
|
28
|
+
import * as Predicate from "effect/Predicate"
|
|
29
|
+
import { DEV, getOwner } from "solid-js"
|
|
30
|
+
import { appearStyle, pageContextOf, setPageContext } from "../provider.tsx"
|
|
31
|
+
import { setPageConfig } from "../wardic-config.tsx"
|
|
32
|
+
import { type WardicContextValue, whenIdle } from "../runtime.ts"
|
|
33
|
+
import { warnWithoutSpans } from "../spans-check.ts"
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A page's settings: `<WardicProvider>`'s props, without its children and its `features`, which a
|
|
37
|
+
* `makeWard`'s wards bring themselves.
|
|
38
|
+
*/
|
|
39
|
+
export type PageOptions = Omit<Parameters<typeof pageContextOf>[0], "features">
|
|
40
|
+
|
|
41
|
+
/** One server render's context, and what registers its Appear `<style>` where it's asked from. */
|
|
42
|
+
interface Render {
|
|
43
|
+
readonly value: WardicContextValue
|
|
44
|
+
readonly register: () => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const NO_TAGS: Array<HeadTag> = []
|
|
48
|
+
|
|
49
|
+
/** A server render's context: its Appear `<style>` registered by each owner that reads it, written once. */
|
|
50
|
+
const renderOf = (options: PageOptions): Render => {
|
|
51
|
+
const value = pageContextOf(options)
|
|
52
|
+
const appear = value.appear
|
|
53
|
+
if (Predicate.isUndefined(appear)) return { value, register: constVoid }
|
|
54
|
+
const style = appearStyle(() => appear.css(), options.nonce)
|
|
55
|
+
// Written by the first registration the server commits; the rest give nothing.
|
|
56
|
+
let written = false
|
|
57
|
+
const once = (): Array<HeadTag> => {
|
|
58
|
+
if (written) return NO_TAGS
|
|
59
|
+
written = true
|
|
60
|
+
return style()
|
|
61
|
+
}
|
|
62
|
+
let last: unknown
|
|
63
|
+
return {
|
|
64
|
+
value,
|
|
65
|
+
register: () => {
|
|
66
|
+
if (written) return
|
|
67
|
+
const owner = getOwner()
|
|
68
|
+
if (owner === last) return
|
|
69
|
+
last = owner
|
|
70
|
+
useHead(once)
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Module state (#460, Q7): whether the page has a context to fall back to, a `makeWard`'s or the default.
|
|
76
|
+
let set = false
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A page's settings for its wards (probe: behaviour-runes, the scopes round's Q41), read where a
|
|
80
|
+
* `WardicConfig`'s are: the outermost config, under every one an app nests. `transition` and
|
|
81
|
+
* `skipAnimations` are a value or an accessor, read at each animation's start. `transformPagePoint` is
|
|
82
|
+
* the function itself, called at each drag or pan start, so it follows whatever it reads: an accessor
|
|
83
|
+
* of one would be a function too, and couldn't be told from it.
|
|
84
|
+
*/
|
|
85
|
+
export interface PageConfigSettings {
|
|
86
|
+
/** The **Config transition** of every ward on the page that gives none of its own. */
|
|
87
|
+
readonly transition?: WardConfig.WardicVariantTransition | (() => WardConfig.WardicVariantTransition | undefined) | undefined
|
|
88
|
+
/** Every animation on the page lands at its end on the next frame: for end-to-end and visual tests. */
|
|
89
|
+
readonly skipAnimations?: boolean | (() => boolean | undefined) | undefined
|
|
90
|
+
/** Where the points a drag or a pan on the page uses are: handed each in the viewport's coordinates. */
|
|
91
|
+
readonly transformPagePoint?: WardConfig.WardicTransformPoint | undefined
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const NO_CONFIG: PageConfigSettings = {}
|
|
95
|
+
|
|
96
|
+
/** A setting given as a value or an accessor, as it is now. */
|
|
97
|
+
const settingOf = <A>(given: A | (() => A | undefined) | undefined): A | undefined => {
|
|
98
|
+
if (Predicate.isFunction(given)) return (given as () => A | undefined)()
|
|
99
|
+
return given as A | undefined
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The page's config out of its settings, each read at its use: none when none is given, so a page that
|
|
104
|
+
* sets none reads as it did. Its transition is worked out again only when what's given changes, so
|
|
105
|
+
* the wards on the page share one, as a `WardicConfig`'s memo has them do.
|
|
106
|
+
*/
|
|
107
|
+
const pageConfigOf = (settings: PageConfigSettings): WardicConfigValue.WardicConfigValue | undefined => {
|
|
108
|
+
const given = Bool.or(Predicate.isNotUndefined(settings.transition), Bool.or(Predicate.isNotUndefined(settings.skipAnimations), Predicate.isNotUndefined(settings.transformPagePoint)))
|
|
109
|
+
if (Bool.not(given)) return undefined
|
|
110
|
+
let from: WardConfig.WardicVariantTransition | undefined
|
|
111
|
+
let made: ReturnType<typeof WardicConfigValue.configTransitionOf>
|
|
112
|
+
return {
|
|
113
|
+
transition: () => {
|
|
114
|
+
const now = settingOf(settings.transition)
|
|
115
|
+
if (now !== from) {
|
|
116
|
+
from = now
|
|
117
|
+
made = WardicConfigValue.configTransitionOf(now, undefined)
|
|
118
|
+
}
|
|
119
|
+
return made
|
|
120
|
+
},
|
|
121
|
+
reducedMotion: constUndefined,
|
|
122
|
+
skipAnimations: () => settingOf(settings.skipAnimations),
|
|
123
|
+
isValidProp: constUndefined,
|
|
124
|
+
transformPagePoint: () => settings.transformPagePoint,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Sets Wardic up for the page: its Environment and settings, with no provider to render. */
|
|
129
|
+
export const setupPage = (options: PageOptions, config: PageConfigSettings = NO_CONFIG): void => {
|
|
130
|
+
set = true
|
|
131
|
+
const value = pageConfigOf(config)
|
|
132
|
+
setPageConfig(() => value)
|
|
133
|
+
install(options)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The page's context when no `makeWard` gave one: the DOM's Environment, and every setting at its
|
|
138
|
+
* default. Called as the hooks' module loads, so a page that only imports `createWard` has nothing to
|
|
139
|
+
* set up; a `makeWard` after it gives its own.
|
|
140
|
+
*/
|
|
141
|
+
export const setupDefaultPage = (): void => {
|
|
142
|
+
if (set) return
|
|
143
|
+
setupPage({ env: DomLive })
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const install = (options: PageOptions): void => {
|
|
147
|
+
// A build-time flag in a plain `if`: a client build drops the server's half.
|
|
148
|
+
if (isServer) {
|
|
149
|
+
// Module state (#460, Q7): each render's context, held weakly by the render's writer.
|
|
150
|
+
const renders = new WeakMap<object, Render>()
|
|
151
|
+
let plain: WardicContextValue | undefined
|
|
152
|
+
setPageContext(() => {
|
|
153
|
+
const writer = getHydrationWriter()
|
|
154
|
+
if (Predicate.isUndefined(writer)) {
|
|
155
|
+
if (Predicate.isUndefined(plain)) plain = pageContextOf({ ...options, appear: false })
|
|
156
|
+
return plain
|
|
157
|
+
}
|
|
158
|
+
let render = renders.get(writer)
|
|
159
|
+
if (Predicate.isUndefined(render)) {
|
|
160
|
+
render = renderOf(options)
|
|
161
|
+
renders.set(writer, render)
|
|
162
|
+
}
|
|
163
|
+
render.register()
|
|
164
|
+
return render.value
|
|
165
|
+
})
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
let page: WardicContextValue | undefined
|
|
169
|
+
setPageContext(() => {
|
|
170
|
+
if (Predicate.isUndefined(page)) {
|
|
171
|
+
page = pageContextOf(options)
|
|
172
|
+
// A tracer that reads no Wardic span, development's word at the page as at a scope (the gap grill's
|
|
173
|
+
// Q45), at the browser's idle time once the page's first ward has asked. The page lives as long as
|
|
174
|
+
// the page: nothing cancels it.
|
|
175
|
+
if (DEV) warnAtIdle(page)
|
|
176
|
+
}
|
|
177
|
+
return page
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Development's word on `value`'s tracer, at the browser's idle time. */
|
|
182
|
+
const warnAtIdle = (value: WardicContextValue): void => {
|
|
183
|
+
whenIdle(() => warnWithoutSpans(value.runtime))
|
|
184
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hooks over a Stage (probe: hooks-first): `createWard`, `createWards` and `createPresence` whose
|
|
3
|
+
* wards are a Stage's, on its Subjects, where the page's are on elements. What says the hooks aren't
|
|
4
|
+
* the DOM's alone: a second Environment gets the same hooks by handing them the thing that makes its
|
|
5
|
+
* wards. Nothing here is the page's: no element, no style, no Feature, no server render.
|
|
6
|
+
*
|
|
7
|
+
* const { createWard, createWards } = stageHooksOf(stage)
|
|
8
|
+
* const crate = createWard(mesh, lift, { animate: { x: 2 } })
|
|
9
|
+
*
|
|
10
|
+
* - **What carries over as it is:** runes and how they join, `show` with its exit and `mounted()`,
|
|
11
|
+
* `enter: false`, a list's rows kept until their exit lands, and one value at a time.
|
|
12
|
+
* - **A Subject is a rune's `subject`,** or given first. A row's is a function of the row, since each
|
|
13
|
+
* item has its own: `createWards(list, (row) => ({ subject: row.item.mesh }), config)`.
|
|
14
|
+
* - **What doesn't:** `follow` (a Stage's variants pass down its scene's graph, and its ward takes no
|
|
15
|
+
* parent), `pop` and hiding (the page's CSS), a function rune (`createRune(fn)`), and `props`
|
|
16
|
+
* (a Subject is its app's own object, with no markup to spread into: a rune's `ref` sets what it
|
|
17
|
+
* sets on one).
|
|
18
|
+
* - **Its types say which:** a Stage's rune is the keys of Wardic's its ward carries, its drag and its
|
|
19
|
+
* Subject ({@link StageRune}). A rune written for the page fits when every key it has is one of
|
|
20
|
+
* those; a key that isn't, a focus's or a view's or one of the page's own, is an error where the
|
|
21
|
+
* rune is given, as most are errors already when the ward is made.
|
|
22
|
+
* - **A target names what its Subject takes.** Its values are its Environment's, by their names,
|
|
23
|
+
* each with what it takes: a material's `roughness`, a light's `intensity`, and no element's
|
|
24
|
+
* `width`. An Environment's package says what each Subject takes (`StageTargetValues`, in the
|
|
25
|
+
* Stage's own types) and every name at once (`StageValues`). A ward given its Subject is checked
|
|
26
|
+
* by that Subject's own ({@link SubjectValues}): one that may be either of two kinds takes what
|
|
27
|
+
* both do, and one no Environment says anything of takes any name. A rune written alone may name
|
|
28
|
+
* what any Stage's Subject takes, and is checked again by the ward it's given to. An editor
|
|
29
|
+
* offers a ward's Subject's own names inside a target; in what a function of a row gives, every
|
|
30
|
+
* Stage's, though a name its row's Subject hasn't is still an error there.
|
|
31
|
+
* - **A presence takes runes here, not a ward.** A Stage's ward moves its Subject from the moment it's
|
|
32
|
+
* made, with no element to wait to be given, so one made only to be a pattern would move it too.
|
|
33
|
+
* - **A rune's `ref` is handed its Subject** while that's on show (`refs.ts`), as on the page: at
|
|
34
|
+
* once, the ward having it from the start, and again for each one an accessor gives.
|
|
35
|
+
*
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
import * as Predicate from "effect/Predicate"
|
|
39
|
+
import { type Accessor, createEffect } from "solid-js"
|
|
40
|
+
import type * as Config from "@wardic/core/unstable/Config"
|
|
41
|
+
import type { Stage, StageDragConfig, StageSubject, StageSubjectOf, StageTargetValues, StageValues, StageWardConfig } from "../stage.ts"
|
|
42
|
+
import type { Ward } from "../ward.tsx"
|
|
43
|
+
import {
|
|
44
|
+
type ApiFor,
|
|
45
|
+
type CarriedRune,
|
|
46
|
+
createRuneWith,
|
|
47
|
+
fixedRunes,
|
|
48
|
+
type FitRune,
|
|
49
|
+
type GivenRune,
|
|
50
|
+
isFunctionRune,
|
|
51
|
+
joined,
|
|
52
|
+
madeRune,
|
|
53
|
+
type MadeRune,
|
|
54
|
+
type Rune,
|
|
55
|
+
type RuneConfig,
|
|
56
|
+
type RuneRef,
|
|
57
|
+
type RunesGiven,
|
|
58
|
+
type RunesTaken,
|
|
59
|
+
type RuneWith,
|
|
60
|
+
type TransitionKey,
|
|
61
|
+
type WardicKeys,
|
|
62
|
+
} from "./rune.ts"
|
|
63
|
+
import { attending, runeRefsOf } from "./refs.ts"
|
|
64
|
+
import { type HookWard, type HookWardOf, showing, type ShowState, showState, type WardMaker, withMounted } from "./ward.ts"
|
|
65
|
+
import { hookWardsOf, oneAtATime, type RowRune, type RowRunesGiven, type RowWard, type StagePresenceSource, type WardsSource, type WardsValue } from "./wards.ts"
|
|
66
|
+
|
|
67
|
+
/** What of a Stage its hooks need: what makes its wards, and what tells a Subject from a rune. */
|
|
68
|
+
export type HookStage = Pick<Stage, "ward" | "isSubject">
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Wardic's keys a Stage's ward carries: all but a focus's and a view's, which no scene tells of, and
|
|
72
|
+
* `follow` with `followers`, since a scene's variants pass down its graph. With a Stage's own they're
|
|
73
|
+
* the keys its ward takes (`stage-ward.tsx`'s), and the three the hooks read for it: `exit`, `show`
|
|
74
|
+
* and `enter`.
|
|
75
|
+
*/
|
|
76
|
+
type CarriedKey = Exclude<keyof WardicKeys, "whileFocus" | "whileInView" | "follow" | "followers">
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A Stage's own keys, beside Wardic's: a scene's drag and how that's set, in the page's place, with
|
|
80
|
+
* what its Environment adds to them (`@wardic/three/solid`'s `dragPlane`), and its Subject.
|
|
81
|
+
*/
|
|
82
|
+
export interface StageKeys extends Pick<StageWardConfig, keyof StageDragConfig> {
|
|
83
|
+
/** The Subject it moves, or an accessor of it: a mesh, an object, what its Environment draws. */
|
|
84
|
+
readonly subject?: StageSubject | Accessor<StageSubject | undefined> | undefined
|
|
85
|
+
/** What this rune does to its Subject beside moving it (`RuneRef`): on a Stage, what its Environment draws. */
|
|
86
|
+
readonly ref?: RuneRef<StageSubject> | undefined
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Each of a union's members, as one: `{ a } | { b }` as `{ a } & { b }`. */
|
|
90
|
+
type Intersected<U> = (U extends unknown ? (each: U) => void : never) extends (all: infer I) => void ? I : never
|
|
91
|
+
|
|
92
|
+
/** Any name at all: the values of a Subject nothing says anything of. */
|
|
93
|
+
type AnyValues = Readonly<Record<string, unknown>>
|
|
94
|
+
|
|
95
|
+
/** What the Environments say one kind of Subject takes in a target, as one (`StageTargetValues`). */
|
|
96
|
+
type Declared<S> = [keyof StageTargetValues<S>] extends [never] ? {} : Intersected<StageTargetValues<S>[keyof StageTargetValues<S>]>
|
|
97
|
+
|
|
98
|
+
/** One kind of Subject's values: what's said of it, and any name where nothing is. */
|
|
99
|
+
type KindValues<S> = [keyof Declared<S>] extends [never] ? AnyValues : Declared<S>
|
|
100
|
+
|
|
101
|
+
/** Each kind's values, of a Subject that may be one of several. */
|
|
102
|
+
type EachKind<S> = S extends unknown ? KindValues<S> : never
|
|
103
|
+
|
|
104
|
+
/** What each kind takes for one name, each held apart: a kind's own choice of two isn't taken apart with the kinds'. */
|
|
105
|
+
type HeldFor<S, Name extends PropertyKey> = S extends unknown ? readonly [KindValues<S>[Name & keyof KindValues<S>]] : never
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* What a Stage's Subject `S` takes in a target, by name: what its Environment says of it. Given a
|
|
109
|
+
* Subject that may be one of several kinds, only the names every kind takes, each with only what
|
|
110
|
+
* every kind takes for it: a ward moves whichever it's handed. Any name where no Environment says
|
|
111
|
+
* anything of it.
|
|
112
|
+
*/
|
|
113
|
+
export type SubjectValues<S, Name extends PropertyKey = keyof EachKind<S>> = {
|
|
114
|
+
readonly [N in Name]: Intersected<HeldFor<S, N>> extends infer Every ? Every[0 & keyof Every] : never
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Every name some Stage's Subject takes, each with what it takes (`StageValues`): what a rune
|
|
119
|
+
* written with no Subject may name. Any name where no Environment has said.
|
|
120
|
+
*/
|
|
121
|
+
export type EveryStageValue = [keyof StageValues] extends [never] ? AnyValues : StageValues
|
|
122
|
+
|
|
123
|
+
/** A value, or an accessor of it: how a ward's config gives each key. */
|
|
124
|
+
type OrAccessor<T> = T | Accessor<T>
|
|
125
|
+
|
|
126
|
+
/** A target's values over `V`, what each name takes: each a value or its Keyframes. */
|
|
127
|
+
type TargetValues<V> = { readonly [K in keyof V]?: V[K] | Config.WardicKeyframes<Exclude<V[K], undefined>> }
|
|
128
|
+
|
|
129
|
+
/** An entry under any name: a transition's, for a Subject that takes any name. What's under one is checked where it's written (`rune.ts`'s `CheckedTransition`). */
|
|
130
|
+
type AnyEntry = { readonly [name: string]: unknown }
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A transition with an entry for each of `V`'s names, and `default`. Not for a name that's one of a
|
|
134
|
+
* transition's own keys: an inertia has a `power`, as a three.js light has, and in a transition
|
|
135
|
+
* it's the inertia's. Where `V` is any name, any entry: typed as one for every name, it was one
|
|
136
|
+
* for a transition's own keys too.
|
|
137
|
+
*/
|
|
138
|
+
type TransitionOver<V> = string extends keyof V
|
|
139
|
+
? Config.WardicTransitionWith<{ readonly default?: Config.WardicValueTransition }> & AnyEntry
|
|
140
|
+
: Config.WardicTransitionWith<Config.WardicValueEntries<Exclude<keyof V & string, TransitionKey>>>
|
|
141
|
+
|
|
142
|
+
/** A target on a Stage, over the values `V`: each under its name, the transition it runs on, and its Transition end. */
|
|
143
|
+
export type StageTarget<V> = TargetValues<V> & {
|
|
144
|
+
readonly transition?: (TransitionOver<V> & Config.WardicInherit) | undefined
|
|
145
|
+
readonly transitionEnd?: { readonly [K in keyof V]?: V[K] } | undefined
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* One variant on a Stage: a target, or a function of `custom` that gives one, or another's name. As
|
|
150
|
+
* core's `WardicVariantResolver`, over a Stage's values.
|
|
151
|
+
*/
|
|
152
|
+
// `custom` is `any` as core's and Motion's is: a resolver declares its own (`(angle: number) => …`).
|
|
153
|
+
export type StageVariant<V> = StageTarget<V> | ((custom: any, current: Readonly<Record<string, number | string>>, velocity: Readonly<Record<string, number>>) => StageTarget<V> | string)
|
|
154
|
+
|
|
155
|
+
/** A target, or the name of a variant, or a list of them. */
|
|
156
|
+
type TargetOrNames<V> = StageTarget<V> | Config.WardicVariantLabels
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Wardic's keys that name values, as a Stage's ward takes them: each target's names are its
|
|
160
|
+
* Subject's, `V`, where the page's are an element's.
|
|
161
|
+
*/
|
|
162
|
+
interface StageValued<V> {
|
|
163
|
+
readonly initial?: OrAccessor<TargetOrNames<V> | false | undefined> | undefined
|
|
164
|
+
readonly animate?: OrAccessor<TargetOrNames<V> | Config.WardicAnimationControls | undefined> | undefined
|
|
165
|
+
readonly exit?: OrAccessor<TargetOrNames<V> | undefined> | undefined
|
|
166
|
+
readonly whileHover?: OrAccessor<TargetOrNames<V> | undefined> | undefined
|
|
167
|
+
readonly whileTap?: OrAccessor<TargetOrNames<V> | undefined> | undefined
|
|
168
|
+
readonly whileDrag?: OrAccessor<TargetOrNames<V> | undefined> | undefined
|
|
169
|
+
readonly transition?: OrAccessor<TransitionOver<V> | undefined> | undefined
|
|
170
|
+
readonly variants?: Readonly<Record<string, StageVariant<V>>> | undefined
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* A rune's config on a Stage, over the values `V` its Subject takes: the keys of Wardic's its ward
|
|
175
|
+
* carries, those that name values typed by `V`, and a Stage's own.
|
|
176
|
+
*/
|
|
177
|
+
export interface StageRuneWith<V> extends StageValued<V>, Pick<WardicKeys, Exclude<CarriedKey, keyof StageValued<unknown>>>, StageKeys {}
|
|
178
|
+
|
|
179
|
+
/** A rune's config on a Stage, written with no Subject: it may name what any Stage's Subject takes. */
|
|
180
|
+
export type StageRune = StageRuneWith<EveryStageValue>
|
|
181
|
+
|
|
182
|
+
/** What a function rune is told where a Stage's ward is given one, as its `createWard` throws for one. */
|
|
183
|
+
export type NoFunctionRune = "a function rune (`createRune(fn)`) isn't carried on a Stage"
|
|
184
|
+
|
|
185
|
+
/** What a ward on a Stage takes, over the values `V` its Subject does: a Stage's rune, and no function rune. */
|
|
186
|
+
interface OnAStageWith<V extends object, EveryName extends PropertyKey> extends RunesTaken {
|
|
187
|
+
readonly config: StageRuneWith<V>
|
|
188
|
+
readonly whose: "a ward on a Stage"
|
|
189
|
+
readonly functionRune: NoFunctionRune
|
|
190
|
+
readonly values: V
|
|
191
|
+
readonly everyName: EveryName
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** What a ward on a Stage takes where its Subject isn't known: a rune written alone, checked by every Stage's values. */
|
|
195
|
+
export type OnAStage = OnAStageWith<EveryStageValue, never>
|
|
196
|
+
|
|
197
|
+
/** Every Stage value's name, for telling one a Subject hasn't from one no Stage has; none where any name goes. */
|
|
198
|
+
type EveryStageName = string extends keyof EveryStageValue ? never : keyof EveryStageValue
|
|
199
|
+
|
|
200
|
+
/** What a ward on a Stage takes where its Subject is `S`: its runes checked by what `S` takes. */
|
|
201
|
+
export type OnAStageOf<S> = OnAStageWith<SubjectValues<S>, EveryStageName>
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* `createRune(config)` on a Stage: a rune of a Stage's keys, checked where it's written, its type the
|
|
205
|
+
* keys it has. It takes no function of its ward: a Stage's ward carries none.
|
|
206
|
+
*/
|
|
207
|
+
export type StageRuneOf = <P extends object>(config: GivenRune<P, OnAStage>) => MadeRune<P, OnAStage>
|
|
208
|
+
|
|
209
|
+
/** The config itself, fixed once made, as the page's `createRune(config)` is: only its type is a Stage's. */
|
|
210
|
+
const stageRune = ((config: object): object => madeRune(config)) as StageRuneOf
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* `createRuneWith(rune, api)` on a Stage (the rune-with grill's Q14): a rune of a Stage's keys, checked where
|
|
214
|
+
* it's written, carrying an API, its members named like none of a Stage's rune keys. A config alone: a
|
|
215
|
+
* Stage's ward carries no function rune.
|
|
216
|
+
*/
|
|
217
|
+
export type StageRuneWithApiOf = <P extends object, A extends object>(rune: GivenRune<P, OnAStage>, api: ApiFor<A, OnAStage>) => RuneWith<MadeRune<P, OnAStage>, A> & CarriedRune
|
|
218
|
+
|
|
219
|
+
/** The page's own: only its type is a Stage's. */
|
|
220
|
+
const stageRuneWithApi = createRuneWith as unknown as StageRuneWithApiOf
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* What a Stage's ward is given first: its Subject as it is, else a rune. Not an accessor of its
|
|
224
|
+
* Subject, which is a rune's `subject`: a Stage tells a Subject from a rune (`isSubject`), and a
|
|
225
|
+
* function is neither to it.
|
|
226
|
+
*/
|
|
227
|
+
type SubjectOrFit<X, Taken extends RunesTaken> = X extends StageSubject ? X : FitRune<X, Taken>
|
|
228
|
+
|
|
229
|
+
/** The Subject a rune gives as its `subject`: itself, or what an accessor of it gives. None for a rune with no `subject`. */
|
|
230
|
+
type SubjectIn<X> = X extends { readonly subject: infer Given } ? NonNullable<StageSubjectOf<Given>> : never
|
|
231
|
+
|
|
232
|
+
/** The Subject a ward is given: first, as it is; else as one of its runes' `subject`. */
|
|
233
|
+
type SubjectGiven<A extends ReadonlyArray<unknown>> = A extends readonly [infer First, ...ReadonlyArray<unknown>]
|
|
234
|
+
? First extends StageSubject
|
|
235
|
+
? First
|
|
236
|
+
: { readonly [I in keyof A]: SubjectIn<A[I]> }[number]
|
|
237
|
+
: never
|
|
238
|
+
|
|
239
|
+
/** What a ward on a Stage takes, given its Subject: that Subject's values, and every Stage's where it has none in its types. */
|
|
240
|
+
type TakenBy<Subject> = [Subject] extends [never] ? OnAStage : OnAStageOf<Subject>
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* `createWard(subject, ...runes)` on a Stage: its Subject first, or as a rune's `subject`, so it's
|
|
244
|
+
* given one thing at least. One signature for both, so an error is the rune's own: with one overload
|
|
245
|
+
* for each, the checker told only the last one's, which blamed the Subject for a rune's key.
|
|
246
|
+
*
|
|
247
|
+
* What's given first is a type of its own, apart from the runes after it: an editor asked what a
|
|
248
|
+
* target may name knows the Subject by then, and offers that Subject's values. With the Subject and
|
|
249
|
+
* its runes one list, the list wasn't known until the rune being written was, and every Stage's
|
|
250
|
+
* values were offered for any Subject.
|
|
251
|
+
*/
|
|
252
|
+
export type StageWardOf = <First extends object, Rest extends ReadonlyArray<object>>(
|
|
253
|
+
first: SubjectOrFit<First, TakenBy<SubjectGiven<readonly [First, ...Rest]>>>,
|
|
254
|
+
...runes: RunesGiven<Rest, TakenBy<SubjectGiven<readonly [First, ...Rest]>>>
|
|
255
|
+
) => HookWard
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The Subject a list's rows are given: a rune's own `subject`, or the one in what a function of the
|
|
259
|
+
* row gives. None where neither says, and the rows take what any Stage's Subject does.
|
|
260
|
+
*/
|
|
261
|
+
type RowSubject<A extends ReadonlyArray<unknown>> = { readonly [I in keyof A]: A[I] extends (...args: never) => infer Gives ? SubjectIn<Gives> : SubjectIn<A[I]> }[number]
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* `createWards(list, ...runes)` on a Stage: its rows' runes checked as its ward's are, key by key,
|
|
265
|
+
* and the values they name by their rows' Subject.
|
|
266
|
+
*/
|
|
267
|
+
export type StageWardsOf = <T, A extends ReadonlyArray<unknown>>(
|
|
268
|
+
source: Accessor<ReadonlyArray<T>> | WardsSource<T> | WardsValue<T>,
|
|
269
|
+
...runes: RowRunesGiven<T, A, TakenBy<RowSubject<A>>>
|
|
270
|
+
) => Accessor<ReadonlyArray<RowWard<T>>>
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* `createPresence(value, ...runes)` on a Stage: the ward of the value there, the one leaving until it
|
|
274
|
+
* has gone. Its runes are a row's, checked as a list's are.
|
|
275
|
+
*/
|
|
276
|
+
export type StagePresenceOf = <T, A extends ReadonlyArray<unknown>>(
|
|
277
|
+
source: Accessor<T> | StagePresenceSource<T>,
|
|
278
|
+
...runes: RowRunesGiven<NonNullable<T>, A, TakenBy<RowSubject<A>>>
|
|
279
|
+
) => Accessor<RowWard<NonNullable<T>> | undefined>
|
|
280
|
+
|
|
281
|
+
/** The keys a Stage's ward doesn't take, which the hooks read for it: where a `show` ward leaves to. */
|
|
282
|
+
const OMITTED: ReadonlySet<string> = new Set(["exit"])
|
|
283
|
+
|
|
284
|
+
const NO_SUBJECT = "createWard on a Stage: give it its Subject, first (`createWard(mesh, …)`) or as a rune's `subject`."
|
|
285
|
+
const NO_FOLLOW = "createWard on a Stage: `follow` isn't carried there. A Stage's variants pass down its scene's graph, to the ward nearest above a Subject."
|
|
286
|
+
const NO_FUNCTION_RUNE = "createWard on a Stage: a function rune (`createRune(fn)`) isn't carried there in this probe."
|
|
287
|
+
const NO_PROPS = "createWard on a Stage: `props` isn't carried there. A Stage's Subject is its app's own object, with nothing to spread into: a rune sets what it sets on one in its `ref`."
|
|
288
|
+
const NO_TAG = "createWard on a Stage: `tag` isn't carried there. It names the element a page's ward is spread on, and a Stage's Subject is no element."
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* A Stage ward's Subject while it's on show, followed: the one it was given, or what its accessor
|
|
292
|
+
* gives now, and none once its exit has landed. What its runes' `ref`s go by (`refs.ts`). A Subject
|
|
293
|
+
* is told from an accessor of one as the Stage's ward tells them, a function being an accessor.
|
|
294
|
+
*/
|
|
295
|
+
const subjectOnShow =
|
|
296
|
+
(given: unknown, state: ShowState) =>
|
|
297
|
+
(): object | undefined => {
|
|
298
|
+
if (!state.mounted()) return undefined
|
|
299
|
+
if (Predicate.isFunction(given)) return (given as Accessor<object | undefined>)()
|
|
300
|
+
return given as object
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** `createWard(...runes)` over `stage`'s own ward, a rune's `subject` its Subject. */
|
|
304
|
+
const stageWardOf =
|
|
305
|
+
(stage: HookStage): WardMaker =>
|
|
306
|
+
(...written) => {
|
|
307
|
+
// Each rune fixed as the ward is made of it, as the page's are.
|
|
308
|
+
const runes = fixedRunes(written)
|
|
309
|
+
if (runes.some(isFunctionRune)) throw new Error(NO_FUNCTION_RUNE)
|
|
310
|
+
const state = showState()
|
|
311
|
+
// `show`'s wiring without the page's half: a Stage's Subject has no style to hide by.
|
|
312
|
+
const made = joined(
|
|
313
|
+
runes as ReadonlyArray<RuneConfig>,
|
|
314
|
+
(all) => {
|
|
315
|
+
const wiring = showing(state)(all)
|
|
316
|
+
if (Predicate.isUndefined(wiring)) return undefined
|
|
317
|
+
return { animate: wiring.animate }
|
|
318
|
+
},
|
|
319
|
+
OMITTED,
|
|
320
|
+
)
|
|
321
|
+
if (Predicate.isNotUndefined(made.follow)) throw new Error(NO_FOLLOW)
|
|
322
|
+
if (made.has("props")) throw new Error(NO_PROPS)
|
|
323
|
+
if (made.has("tag")) throw new Error(NO_TAG)
|
|
324
|
+
const subject = made.own("subject")
|
|
325
|
+
if (Predicate.isUndefined(subject)) throw new Error(NO_SUBJECT)
|
|
326
|
+
const ward = stage.ward(subject, made.config as StageWardConfig) as unknown as Ward
|
|
327
|
+
if (Predicate.isNotUndefined(made.show)) createEffect(ward.when("settled"), state.landed)
|
|
328
|
+
// Each rune's `ref`, handed its Subject while that's on show.
|
|
329
|
+
attending(runeRefsOf(runes), subjectOnShow(subject, state))
|
|
330
|
+
return withMounted(ward, state.mounted, state.shown)
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** The hooks whose wards are `stage`'s. */
|
|
334
|
+
export const stageHooksOf = (
|
|
335
|
+
stage: HookStage,
|
|
336
|
+
): {
|
|
337
|
+
readonly createRune: StageRuneOf
|
|
338
|
+
readonly createRuneWith: StageRuneWithApiOf
|
|
339
|
+
readonly createWard: StageWardOf
|
|
340
|
+
readonly createWards: StageWardsOf
|
|
341
|
+
readonly createPresence: StagePresenceOf
|
|
342
|
+
} => {
|
|
343
|
+
const raw = stageWardOf(stage) as HookWardOf
|
|
344
|
+
// Its Subject first, as `ward(subject, config)` takes it: read as the rune that gives it. What's
|
|
345
|
+
// given after it are runes, a Stage's by their types, and joined as every rune is, by their keys.
|
|
346
|
+
const createWard = ((...given: ReadonlyArray<object>): HookWard => {
|
|
347
|
+
const [first, ...rest] = given
|
|
348
|
+
const runes = rest as ReadonlyArray<Rune>
|
|
349
|
+
if (stage.isSubject(first)) return raw({ subject: first }, ...runes)
|
|
350
|
+
return raw(first as Rune, ...runes)
|
|
351
|
+
}) as StageWardOf
|
|
352
|
+
// Its rows' runes are a Stage's by their types too: the list's own helpers join them by their keys.
|
|
353
|
+
const createPresence = <T>(source: Accessor<T> | StagePresenceSource<T>, ...runes: ReadonlyArray<unknown>): Accessor<RowWard<NonNullable<T>> | undefined> => {
|
|
354
|
+
const rows = oneAtATime(raw, source, runes as ReadonlyArray<RowRune<NonNullable<T>>>)
|
|
355
|
+
return () => rows()[0]
|
|
356
|
+
}
|
|
357
|
+
// The list's own hook, its rows' runes typed by their Subject where the page's are by the page.
|
|
358
|
+
return { createRune: stageRune, createRuneWith: stageRuneWithApi, createWard, createWards: hookWardsOf<OnAStage>(raw) as StageWardsOf, createPresence }
|
|
359
|
+
}
|