@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
package/src/ward.tsx
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
* @module
|
|
48
48
|
*/
|
|
49
49
|
import type * as Drag from "@wardic/core/Drag"
|
|
50
|
+
import * as InputSource from "@wardic/core/InputSource"
|
|
50
51
|
import type * as InputFeed from "@wardic/core/InputFeed"
|
|
51
52
|
import * as Press from "@wardic/dom/unstable/Press"
|
|
52
53
|
import * as Report from "@wardic/dom/Report"
|
|
@@ -79,6 +80,7 @@ import {
|
|
|
79
80
|
isHydrating,
|
|
80
81
|
type Owner,
|
|
81
82
|
onCleanup,
|
|
83
|
+
refresh,
|
|
82
84
|
runWithOwner,
|
|
83
85
|
type Signal,
|
|
84
86
|
untrack,
|
|
@@ -92,6 +94,7 @@ import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
|
|
|
92
94
|
|
|
93
95
|
|
|
94
96
|
import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures"
|
|
97
|
+
import { misuse, report } from "./diagnostics.ts"
|
|
95
98
|
import { inViewOptionsOf } from "./gesture-callbacks.ts"
|
|
96
99
|
import type { WardicRuntime, WardicServices } from "./runtime.ts"
|
|
97
100
|
import * as Keys from "@wardic/dom/unstable/features/Keys"
|
|
@@ -129,7 +132,7 @@ import * as Feature from "@wardic/dom/unstable/Feature"
|
|
|
129
132
|
import type * as All from "@wardic/dom/unstable/features/All"
|
|
130
133
|
import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED, CLIENT_ONLY_SYNC, CLIENT_ONLY_SYNC_DEFERRED, firstCallOwnerHere, reactivityIn } from "./solid-reactivity.ts"
|
|
131
134
|
import { useWardicConfig } from "./wardic-config.tsx"
|
|
132
|
-
import { configView, type Fixed, type PerKey, type PerKeyApart } from "./config-view.ts"
|
|
135
|
+
import { configView, type Fixed, fixedOver, fixMore, type PerKey, type PerKeyApart } from "./config-view.ts"
|
|
133
136
|
import { type EventNeeds, Lifecycle, type WardEvent, type WardEvents, type WardPressInfo, type WardSettled } from "./lifecycle.ts"
|
|
134
137
|
import { neverLands, NO_EVENTS, serverWhen } from "./waiters.ts"
|
|
135
138
|
import { usePresenceContext } from "./presence.tsx"
|
|
@@ -148,6 +151,22 @@ export type WardStyle = { readonly [K in keyof DomWardConfig.WardicValues]?: Dom
|
|
|
148
151
|
/** The entry a missing Feature's message tells the app to import it from: this binding's (#566). */
|
|
149
152
|
const ENTRY = "@wardic/solid"
|
|
150
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Development's word on a missing Feature (#511), with how a Solid 2 app adds it: dom's default names
|
|
156
|
+
* `<LazyWardic>`, Solid 1's still, deleted from Solid 2 (probe: behaviour-runes, after the scopes round).
|
|
157
|
+
*/
|
|
158
|
+
const missingMessage = (feature: string, what: string): string =>
|
|
159
|
+
Feature.missingMessage(
|
|
160
|
+
feature,
|
|
161
|
+
what,
|
|
162
|
+
ENTRY,
|
|
163
|
+
`which this element's WardicProvider doesn't have. Add it: \`import { ${feature} } from "${ENTRY}"\`, then \`<WardicProvider features={[${feature}]}>\`, or give it to \`makeWard({ features })\`.`,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
/** Development's word on a missing Feature, once a provider, as its coded diagnostic (solid-next). */
|
|
167
|
+
const warnMissing = (registry: Feature.FeatureRegistry, feature: string, what: string): void =>
|
|
168
|
+
registry.warnOnce(feature, missingMessage(feature, what), "WARDIC_FEATURE_MISSING")
|
|
169
|
+
|
|
151
170
|
/** A ward's config values: the element's motion, and its `style`. */
|
|
152
171
|
export interface WardConfigValues extends Omit<DomWardConfig.WardConfig, SolidOneCallback> {
|
|
153
172
|
/**
|
|
@@ -251,7 +270,7 @@ export const wardConfigView = (config: WardConfig): WardConfigValues => WARD_VIE
|
|
|
251
270
|
|
|
252
271
|
/** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
|
|
253
272
|
const WHOLE_ACCESSOR =
|
|
254
|
-
"ward(config) takes its config as an object, read per key
|
|
273
|
+
"ward(config) takes its config as an object, read per key: make a key reactive with an accessor " +
|
|
255
274
|
"(`ward({ animate: () => ({ x: x() }) })`), a getter, a store or a component's props, not the whole config " +
|
|
256
275
|
"(`ward(() => ({ … }))`)."
|
|
257
276
|
|
|
@@ -312,11 +331,31 @@ interface WardState {
|
|
|
312
331
|
readonly element: Accessor<HTMLElement | undefined>
|
|
313
332
|
/** Reads its config's keys still loading at setup: a `held` read holds its boundary while one is (#884). */
|
|
314
333
|
readonly hold: () => void
|
|
334
|
+
/** Its config as it's written, before a Config transition or Animation controls are over it: where more is fixed later ({@link fixLater}). */
|
|
335
|
+
readonly written: WardConfigValues
|
|
336
|
+
/**
|
|
337
|
+
* Its target, worked out from its config: worked out again when more of that is fixed later ({@link targetAgain}).
|
|
338
|
+
* None for a function rune's ward ({@link holderWard}), which has no config.
|
|
339
|
+
*/
|
|
340
|
+
readonly target: Parameters<typeof refresh>[0] | undefined
|
|
341
|
+
/** The names it hands its Variant children, where it hands any down: read from its config's `animate` too, and read again with its target. */
|
|
342
|
+
readonly handsDown: Parameters<typeof refresh>[0] | undefined
|
|
343
|
+
/**
|
|
344
|
+
* What its exit resolves from under a presence above it, and how that's read of its config: read
|
|
345
|
+
* again with its target ({@link targetAgain}). No reader with no presence above it.
|
|
346
|
+
*/
|
|
347
|
+
readonly exitConfig: { current: Spine.ExitConfig }
|
|
348
|
+
readonly exitNow: (() => Spine.ExitConfig) | undefined
|
|
315
349
|
settled: Accessor<WardSettled | undefined> | undefined
|
|
316
350
|
tapped: Accessor<WardPressInfo | undefined> | undefined
|
|
317
351
|
next: (<E extends WardEvent>(name: E) => Promise<WardEvents[E]>) | undefined
|
|
318
352
|
each: (<E extends WardEvent>(name: E) => AsyncIterable<WardEvents[E]>) | undefined
|
|
319
353
|
when: (<E extends WardEvent>(name: E) => Accessor<WardEvents[E]>) | undefined
|
|
354
|
+
/**
|
|
355
|
+
* What the hooks keep of a ward they made (probe: hooks-first): theirs to write and to read, by
|
|
356
|
+
* the members they share ({@link shareMembers}). None for a ward they didn't make.
|
|
357
|
+
*/
|
|
358
|
+
hooks: unknown
|
|
320
359
|
}
|
|
321
360
|
|
|
322
361
|
/** Where a ward keeps its {@link WardState}: on itself, not enumerable, so a spread never sees it. */
|
|
@@ -407,7 +446,9 @@ const WARD_MEMBER_KEYS: PropertyDescriptorMap = {
|
|
|
407
446
|
return state.tapped
|
|
408
447
|
},
|
|
409
448
|
},
|
|
449
|
+
// `next`, `each` and `when` can be given again: the hooks' own take their place ({@link shareMembers}).
|
|
410
450
|
next: {
|
|
451
|
+
configurable: true,
|
|
411
452
|
get(this: object): NonNullable<WardState["next"]> {
|
|
412
453
|
const state = stateOf(this)
|
|
413
454
|
if (Predicate.isNotUndefined(state.next)) return state.next
|
|
@@ -418,6 +459,7 @@ const WARD_MEMBER_KEYS: PropertyDescriptorMap = {
|
|
|
418
459
|
},
|
|
419
460
|
},
|
|
420
461
|
each: {
|
|
462
|
+
configurable: true,
|
|
421
463
|
get(this: object): NonNullable<WardState["each"]> {
|
|
422
464
|
const state = stateOf(this)
|
|
423
465
|
if (Predicate.isNotUndefined(state.each)) return state.each
|
|
@@ -428,6 +470,7 @@ const WARD_MEMBER_KEYS: PropertyDescriptorMap = {
|
|
|
428
470
|
},
|
|
429
471
|
},
|
|
430
472
|
when: {
|
|
473
|
+
configurable: true,
|
|
431
474
|
get(this: object): NonNullable<WardState["when"]> {
|
|
432
475
|
const state = stateOf(this)
|
|
433
476
|
if (Predicate.isNotUndefined(state.when)) return state.when
|
|
@@ -439,9 +482,76 @@ const WARD_MEMBER_KEYS: PropertyDescriptorMap = {
|
|
|
439
482
|
},
|
|
440
483
|
}
|
|
441
484
|
|
|
442
|
-
/**
|
|
485
|
+
/**
|
|
486
|
+
* {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`.
|
|
487
|
+
*
|
|
488
|
+
* Module state (#460, Q7): made once, and added to once more where the hooks are loaded
|
|
489
|
+
* ({@link shareMembers}), with their own members for every ward.
|
|
490
|
+
*/
|
|
443
491
|
const WARD_MEMBERS: object = /*#__PURE__*/ Object.create(Function.prototype, WARD_MEMBER_KEYS)
|
|
444
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Whether `ward` has a state of its own, as a client's has and a server's hasn't: where the hooks
|
|
495
|
+
* keep what they know of it (probe: hooks-first). True of nothing but a ward made here.
|
|
496
|
+
*/
|
|
497
|
+
export const keepsState = (ward: object): boolean => Predicate.hasProperty(ward, WARD_STATE)
|
|
498
|
+
|
|
499
|
+
/** What the hooks keep of `ward`, one with a state of its own ({@link keepsState}): none until they've kept something. */
|
|
500
|
+
export const hooksOf = (ward: object): unknown => stateOf(ward).hooks
|
|
501
|
+
|
|
502
|
+
/** Keeps `kept` of `ward` for the hooks, one with a state of its own ({@link keepsState}). */
|
|
503
|
+
export const keepForHooks = (ward: object, kept: unknown): void => {
|
|
504
|
+
stateOf(ward).hooks = kept
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Fixes more of `ward`'s config from here on (probe: hooks-first), a ward with a state of its own:
|
|
509
|
+
* what a presence that takes it after it's made has its `animate`, `exit` and `custom` read
|
|
510
|
+
* through, with nothing set up for it on a ward no presence takes. Read in the config's place at
|
|
511
|
+
* the next read of each key; {@link targetAgain} makes that read happen.
|
|
512
|
+
*/
|
|
513
|
+
export const fixLater = (ward: object, fixed: Readonly<Record<string, unknown>>): void => {
|
|
514
|
+
fixMore(stateOf(ward).written, fixed as Fixed<WardConfigValues>)
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Works `ward`'s target out again (probe: hooks-first): after {@link fixLater}, since what read those
|
|
519
|
+
* keys read them before they were fixed, and follows nothing that says so. From then on it follows
|
|
520
|
+
* whatever the fixed values read. Not in a component's body or a computation, where Solid allows no
|
|
521
|
+
* refresh: at the settle.
|
|
522
|
+
*/
|
|
523
|
+
export const targetAgain = (ward: object): void => {
|
|
524
|
+
const state = stateOf(ward)
|
|
525
|
+
const target = state.target
|
|
526
|
+
if (Predicate.isNotUndefined(target)) void refresh(target)
|
|
527
|
+
// The names it hands its followers come from its `animate` too: a leader a presence takes hands
|
|
528
|
+
// down the name it leaves by.
|
|
529
|
+
const handsDown = state.handsDown
|
|
530
|
+
if (Predicate.isNotUndefined(handsDown)) void refresh(handsDown)
|
|
531
|
+
// And what a presence above it leaves it by: its `exit`, kept current by an effect that read it
|
|
532
|
+
// before more was fixed, and isn't told. A ward a presence of the hooks takes keeps its `exit` for
|
|
533
|
+
// that presence, so one above it runs none for it (HP30). Read here; the effect follows whatever it
|
|
534
|
+
// followed, and reads through what's fixed the next time it runs.
|
|
535
|
+
const exitNow = state.exitNow
|
|
536
|
+
if (Predicate.isNotUndefined(exitNow)) state.exitConfig.current = untrack(exitNow)
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* More members for the prototype every client ward shares (probe: hooks-first): the hooks' own, a
|
|
541
|
+
* ward's reads and whether it's shown, given once as the hooks load. Each a getter over what the
|
|
542
|
+
* hooks keep of the ward ({@link hooksOf}), as the members here are over its state, so a ward
|
|
543
|
+
* carries nothing for them. One given a name that's here already takes its place.
|
|
544
|
+
*/
|
|
545
|
+
export const shareMembers = (keys: PropertyDescriptorMap): void => {
|
|
546
|
+
Object.defineProperties(WARD_MEMBERS, keys)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/** A member every client ward shares, as it's read of `ward`: for one that takes its place for some wards ({@link shareMembers}). */
|
|
550
|
+
export const sharedMember = (name: "when" | "next" | "each"): ((this: object) => (event: string) => unknown) => {
|
|
551
|
+
const descriptor = Object.getOwnPropertyDescriptor(WARD_MEMBERS, name) as PropertyDescriptor
|
|
552
|
+
return descriptor.get as (this: object) => (event: string) => unknown
|
|
553
|
+
}
|
|
554
|
+
|
|
445
555
|
/** `ward(config, options)`'s options. */
|
|
446
556
|
export interface WardOptions {
|
|
447
557
|
/**
|
|
@@ -611,6 +721,11 @@ export interface WardInternals {
|
|
|
611
721
|
readonly onLayoutHandle?: ((handle: ProjectionSystem.NodeHandle) => () => void) | undefined
|
|
612
722
|
/** A `<Reorder>` item's: its node raised while dragged. */
|
|
613
723
|
readonly raiseWhileDragged?: boolean | undefined
|
|
724
|
+
/**
|
|
725
|
+
* A hooks ward's grips' (probe: behaviour-runes): which of its presses drag it, asked of each down, over
|
|
726
|
+
* its config's `dragListener`: a press on one of its grips while it has any, and any while it has none.
|
|
727
|
+
*/
|
|
728
|
+
readonly dragListen?: ((down: InputSource.PointerLikeEvent) => boolean) | undefined
|
|
614
729
|
/** A `<Reorder>` item's: its Enter and Space are its **Keyboard reorder**'s (ADR-0037), so its press hears no keys (#427). */
|
|
615
730
|
readonly keysTaken?: boolean | undefined
|
|
616
731
|
/** A `<Reorder>` item's: whether a **Keyboard reorder** has it lifted (ADR-0037), which turns its `whileDrag` on. */
|
|
@@ -622,7 +737,23 @@ export interface WardInternals {
|
|
|
622
737
|
* `onDefect`: closed at the unmount. What it returns is called at unmount.
|
|
623
738
|
*/
|
|
624
739
|
readonly onMount?: ((element: HTMLElement, watch: (make: (onDefect: InputFeed.OnDefect) => Effect.Effect<void, never, Scope.Scope | WardicServices>) => void) => () => void) | undefined
|
|
625
|
-
/**
|
|
740
|
+
/**
|
|
741
|
+
* A hooks ward's: told the element once it's mounted, its first Retarget done (probe: behaviour-runes,
|
|
742
|
+
* the cheap `ref`). Outside `untrack`, so a signal read there is one Solid reports, and after the mount
|
|
743
|
+
* is kept, so a throw there leaves nothing of it unended. What it returns is called at unmount, once
|
|
744
|
+
* the binding's own end has run: before the next element's, or after its lifecycle's end.
|
|
745
|
+
*/
|
|
746
|
+
readonly afterMount?: ((element: HTMLElement) => () => void) | undefined
|
|
747
|
+
/**
|
|
748
|
+
* Told the element and its gestures' input once both are there (probe: behaviour-runes): at its
|
|
749
|
+
* mount, or as a gesture Feature that brings the input arrives after it. Once a mount, with how to run
|
|
750
|
+
* a watch in its watch Scope and how to fork a response: a behaviour's keys, blur and press.
|
|
751
|
+
*/
|
|
752
|
+
readonly onInput?: ((element: HTMLElement, input: InputSource.InputSource["Service"], watch: (make: (onDefect: InputFeed.OnDefect) => Effect.Effect<void, never, Scope.Scope | WardicServices>) => void, fork: (effect: Effect.Effect<void>) => void, runtime: WardicRuntime) => void) | undefined
|
|
753
|
+
/**
|
|
754
|
+
* Values fixed over the config's, read as its own are: a `<Reorder>` item's `layout`, its Layout mode.
|
|
755
|
+
* More is fixed over a ward that's made with {@link fixLater}.
|
|
756
|
+
*/
|
|
626
757
|
readonly fixed?: Fixed<WardConfigValues> | undefined
|
|
627
758
|
/** A `<Reorder>` item's group, which `Reorder.Item` checks a given item against (#349). */
|
|
628
759
|
readonly group?: unknown
|
|
@@ -641,6 +772,62 @@ export interface WardInternals {
|
|
|
641
772
|
readonly instance?: Feature.InstanceFeatures | undefined
|
|
642
773
|
/** Whether it's a **Complete element** (#511): an error in development under a `strict` section. */
|
|
643
774
|
readonly complete?: boolean | undefined
|
|
775
|
+
/**
|
|
776
|
+
* Told each target it runs, as resolved, just before it's run: for a ward that asks for its Features
|
|
777
|
+
* as it uses them (the hooks' `auto`), so a colour only the `colors` Feature reads, shown by an
|
|
778
|
+
* accessor only after the ward is made, still asks for it (the scopes round's CL1).
|
|
779
|
+
*/
|
|
780
|
+
readonly targeted?: ((values: Readonly<Record<string, unknown>>) => void) | undefined
|
|
781
|
+
/**
|
|
782
|
+
* Its own settings over the config around it (probe: behaviour-runes, the scopes round's Q10): a hook
|
|
783
|
+
* ward's `reducedMotion`, `skipAnimations` and `transformPagePoint`, laid over its nearest
|
|
784
|
+
* `WardicConfig`'s and read in its place. None for a ward that gives none of them.
|
|
785
|
+
*/
|
|
786
|
+
readonly wardicConfig?: WardicConfigValue.WardicConfigValue | undefined
|
|
787
|
+
/**
|
|
788
|
+
* The **Layout group** its `layoutId` goes in, where its maker chose one (probe: behaviour-runes, the
|
|
789
|
+
* scopes round's Q44): a hook ward given a layout group as a rune, its id resolved where the ward is
|
|
790
|
+
* made. Read in place of the group around it. None, and it's in the one it's made in.
|
|
791
|
+
*/
|
|
792
|
+
readonly layoutGroup?: { readonly id: string | undefined } | undefined
|
|
793
|
+
/**
|
|
794
|
+
* Whether an element given to it now enters afresh, from its config's `initial` as it is then, as
|
|
795
|
+
* one given after the last left the page does (#414). The hooks' presence (probe: hooks-first), for
|
|
796
|
+
* a value that came after the page opened or after another: read as its ref is called, of the ward
|
|
797
|
+
* itself, so one function answers for every ward and none is made ward by ward.
|
|
798
|
+
*/
|
|
799
|
+
readonly entersFresh?: ((ward: object) => boolean) | undefined
|
|
800
|
+
/**
|
|
801
|
+
* Told each element it's handed, as Solid calls it as a ref (probe: hooks-first): how the hooks keep
|
|
802
|
+
* which ward each element was last handed to, for a leaving row to find the wards inside it. Left out,
|
|
803
|
+
* nothing is told, and a component's ward keeps nothing for it.
|
|
804
|
+
*/
|
|
805
|
+
readonly handed?: ((element: Element, ward: Ward) => void) | undefined
|
|
806
|
+
/**
|
|
807
|
+
* Told the presence it's made under, where there's one (probe: hooks-first): what a hook ward watches
|
|
808
|
+
* its child's leave by, found where the ward looks it up already. Left out, nothing is told.
|
|
809
|
+
*/
|
|
810
|
+
readonly madeUnder?: ((ward: Ward, presence: PresenceRecord.PresenceContextValue<Element>) => void) | undefined
|
|
811
|
+
/**
|
|
812
|
+
* Told, in development alone, each time an element's props first read the ward's `style` (probe:
|
|
813
|
+
* hooks-first, the gap grill's Q29): how the hooks see a ward spread on a component that never calls
|
|
814
|
+
* its `ref`. Left out, or in a production build, nothing is told.
|
|
815
|
+
*/
|
|
816
|
+
readonly styled?: ((ward: Ward) => void) | undefined
|
|
817
|
+
/**
|
|
818
|
+
* Whether the ward is a **Variant child** by its own word (probe: hooks-first, the gap grill's Q26):
|
|
819
|
+
* core's `variantChild`, set on the config its variant node and spine read, so a follower naming
|
|
820
|
+
* gesture variants of its own still joins the ward it follows, and hands its names down. Left out,
|
|
821
|
+
* nothing is set.
|
|
822
|
+
*/
|
|
823
|
+
readonly variantChild?: boolean | undefined
|
|
824
|
+
/**
|
|
825
|
+
* Whether it carries its variants whatever its config sets (probe: behaviour-runes, the follow grill's
|
|
826
|
+
* Q1): a hook ward's. Its config is all its runes, so its own variant node is always the one a ward
|
|
827
|
+
* that follows it joins, however it names its states, and it's never a **Listening ward** (#398), whose
|
|
828
|
+
* element builds a node of its own from its props. Left out, it carries them by its config alone.
|
|
829
|
+
*/
|
|
830
|
+
readonly carries?: boolean | undefined
|
|
644
831
|
}
|
|
645
832
|
|
|
646
833
|
|
|
@@ -655,6 +842,12 @@ export interface WardShare {
|
|
|
655
842
|
readonly setup: WardConfigValues
|
|
656
843
|
/** What made it adds (a `<Reorder>` item's), and its parent. */
|
|
657
844
|
readonly internal: WardInternals
|
|
845
|
+
/**
|
|
846
|
+
* What's fixed over its config as it is now: what made it fixed (`internal.fixed`), and whatever
|
|
847
|
+
* was fixed over it since ({@link fixLater}). A ward driving an element for it reads through the
|
|
848
|
+
* same: a ward a presence of the hooks took leaves by its `animate` on a component too (HP31).
|
|
849
|
+
*/
|
|
850
|
+
readonly fixed: () => WardInternals["fixed"]
|
|
658
851
|
/** The variant context it was made under, or its given parent's. */
|
|
659
852
|
readonly parent: VariantTree.WardicVariantContextValue | undefined
|
|
660
853
|
/** Whether its parent was given (`ward(config, { parent })`). */
|
|
@@ -769,7 +962,7 @@ const warnUnreadColors = (registry: Feature.FeatureRegistry, features: Feature.F
|
|
|
769
962
|
},
|
|
770
963
|
(unread) => {
|
|
771
964
|
if (Predicate.isUndefined(unread)) return
|
|
772
|
-
registry
|
|
965
|
+
warnMissing(registry, "colors", `The colour \`${unread}\``)
|
|
773
966
|
},
|
|
774
967
|
CLIENT_ONLY,
|
|
775
968
|
)
|
|
@@ -778,20 +971,31 @@ const warnUnreadColors = (registry: Feature.FeatureRegistry, features: Feature.F
|
|
|
778
971
|
/** Whether a config carries its variants (#398): it sets `variants` or `inherit`. */
|
|
779
972
|
const carriesVariants = (config: WardConfigValues): boolean => Bool.or(Predicate.isNotUndefined(config.variants), Predicate.isNotUndefined(config.inherit))
|
|
780
973
|
|
|
974
|
+
/** Whether a ward made with `internal` and `config` carries its variants (#398): by its config, or by its maker's word (a hook ward's). */
|
|
975
|
+
const carriesFor = (internal: WardInternals, config: WardConfigValues): boolean => Bool.or(internal.carries === true, carriesVariants(config))
|
|
976
|
+
|
|
781
977
|
/** A child made with `{ parent }` naming a Listening ward (#398's Q10). */
|
|
782
978
|
const LISTENING_PARENT =
|
|
783
979
|
"ward(config, { parent }): the parent given carries no variants (no `variants` or `inherit` in its ward({ … })): it only listens, " +
|
|
784
|
-
"and its element's props hold its variants, so a child can't join it by `{ parent }
|
|
980
|
+
"and its element's props hold its variants, so a child can't join it by `{ parent }`. Render the child inside that " +
|
|
785
981
|
"ward's element, where it joins through the tree, or put the variants in the parent's ward({ … })."
|
|
786
982
|
|
|
983
|
+
/** The **Layout group** a ward made here with `internal` is in: its maker's choice, else the one around it. */
|
|
984
|
+
const groupOf = (internal: WardInternals): string | undefined => {
|
|
985
|
+
const chosen = internal.layoutGroup
|
|
986
|
+
if (Predicate.isNotUndefined(chosen)) return chosen.id
|
|
987
|
+
return useLayoutGroupId()
|
|
988
|
+
}
|
|
989
|
+
|
|
787
990
|
/**
|
|
788
991
|
* The **Layout group** a ward's `layoutId` goes in (#432): the one it's made in, as its presence and
|
|
789
|
-
* variant parent are; a driving ward's is its given ward's, where that was made,
|
|
790
|
-
* own props set the `layoutId` (#398), which is then the element's.
|
|
992
|
+
* variant parent are, or its maker's choice; a driving ward's is its given ward's, where that was made,
|
|
993
|
+
* unless the element's own props set the `layoutId` (#398), which is then the element's.
|
|
791
994
|
*/
|
|
792
|
-
const layoutGroupFor = (share: WardShare | undefined,
|
|
793
|
-
if (Predicate.isUndefined(share)) return
|
|
794
|
-
|
|
995
|
+
const layoutGroupFor = (share: WardShare | undefined, internal: WardInternals): string | undefined => {
|
|
996
|
+
if (Predicate.isUndefined(share)) return groupOf(internal)
|
|
997
|
+
const fixed = internal.fixed
|
|
998
|
+
if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return groupOf(internal)
|
|
795
999
|
return share.layoutGroup
|
|
796
1000
|
}
|
|
797
1001
|
|
|
@@ -808,7 +1012,7 @@ const variantParentOf = (internal: WardInternals): VariantTree.WardicVariantCont
|
|
|
808
1012
|
}
|
|
809
1013
|
const parent = shareOf(internal.parent)
|
|
810
1014
|
if (Predicate.isNotUndefined(parent)) {
|
|
811
|
-
if (Bool.not(parent.carries)) throw
|
|
1015
|
+
if (Bool.not(parent.carries)) throw misuse("WARDIC_PARENT_WITHOUT_VARIANTS", LISTENING_PARENT)
|
|
812
1016
|
return parent.provided
|
|
813
1017
|
}
|
|
814
1018
|
return useVariantContext()
|
|
@@ -861,6 +1065,13 @@ const controlsOf = (given: WardConfigValues, animate: WardConfigValues["animate"
|
|
|
861
1065
|
return { controls, view, change, set: (made) => setChange(() => made) }
|
|
862
1066
|
}
|
|
863
1067
|
|
|
1068
|
+
/** A ward's config settings: its own over its nearest `WardicConfig`'s, where it has any (`wardicConfig`), else that config's. */
|
|
1069
|
+
const configOf = (internal: WardInternals): WardicConfigValue.WardicConfigValue | undefined => {
|
|
1070
|
+
const own = internal.wardicConfig
|
|
1071
|
+
if (Predicate.isNotUndefined(own)) return own
|
|
1072
|
+
return useWardicConfig()
|
|
1073
|
+
}
|
|
1074
|
+
|
|
864
1075
|
/**
|
|
865
1076
|
* `view` with its **Config transition** as its own when it gives none (#434, Motion's
|
|
866
1077
|
* `{ ...config, ...props }`), read per read as its keys are; `view` itself with no `WardicConfig` above.
|
|
@@ -893,6 +1104,11 @@ const lifecycleOfShare = (share: WardShare): Lifecycle | undefined => share.life
|
|
|
893
1104
|
const runCleanup = (cleanup: () => void): void => cleanup()
|
|
894
1105
|
/** A mount's element. */
|
|
895
1106
|
const elementOfMount = (m: { readonly element: HTMLElement }): HTMLElement => m.element
|
|
1107
|
+
/** Where an element entering fresh starts (#414): its start, and the Starting style that draws it. */
|
|
1108
|
+
interface FreshStart {
|
|
1109
|
+
readonly from: Spine.Start
|
|
1110
|
+
readonly starting: Renderer.Patch
|
|
1111
|
+
}
|
|
896
1112
|
|
|
897
1113
|
/**
|
|
898
1114
|
* A ward mounting an element another ward left in the same task: a spread's expression
|
|
@@ -926,10 +1142,20 @@ const LOADING_NAMES: ReadonlyArray<string> = []
|
|
|
926
1142
|
* `animate` names the ward's own variants when it has `variants` (what it can name), and is a target
|
|
927
1143
|
* of values otherwise: setup reads it only to tell which.
|
|
928
1144
|
*/
|
|
1145
|
+
/**
|
|
1146
|
+
* `config` a **Variant child** by its own word, where its internals say so (probe: hooks-first, the
|
|
1147
|
+
* gap grill's Q26): core's `variantChild` set on the copy its variant decisions read. As it is for
|
|
1148
|
+
* every other ward, a component's among them.
|
|
1149
|
+
*/
|
|
1150
|
+
const variantChildBy = <C extends WardConfigValues>(internal: WardInternals, config: C): C => {
|
|
1151
|
+
if (internal.variantChild !== true) return config
|
|
1152
|
+
return { ...config, variantChild: true }
|
|
1153
|
+
}
|
|
1154
|
+
|
|
929
1155
|
export const configAtSetup = (setup: { readonly config: WardConfigValues; readonly pending: ReadonlyArray<string> }): WardConfigValues => {
|
|
930
1156
|
if (setup.pending.length === 0) return setup.config
|
|
931
1157
|
const fixed = Arr.findFirst(setup.pending, (key) => Bool.not(LOADS_AS_IT_GOES.has(key)))
|
|
932
|
-
if (Option.isSome(fixed)) throw
|
|
1158
|
+
if (Option.isSome(fixed)) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", loadingAtSetup(fixed.value))
|
|
933
1159
|
const config = setup.config
|
|
934
1160
|
if (Bool.and(Arr.contains(setup.pending, "animate"), Predicate.isNotUndefined(config.variants))) return { ...config, animate: LOADING_NAMES as NonNullable<WardConfigValues["animate"]> }
|
|
935
1161
|
return config
|
|
@@ -952,8 +1178,9 @@ const layoutArrivedIn = (arrive: ((projection: ProjectionSystem.Shape) => void)
|
|
|
952
1178
|
UndefinedOr.map(arrive, (make) => UndefinedOr.map(Keys.projectionIn(services), make))
|
|
953
1179
|
}
|
|
954
1180
|
|
|
1181
|
+
|
|
955
1182
|
export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
956
|
-
if (Predicate.isFunction(config)) throw
|
|
1183
|
+
if (Predicate.isFunction(config)) throw misuse("WARDIC_CONFIG_AS_ACCESSOR", WHOLE_ACCESSOR)
|
|
957
1184
|
const runtime = useWardicRuntime()
|
|
958
1185
|
// Its Features (#511, ADR-0067), a Complete element's every one: what they register, a server
|
|
959
1186
|
// render's elements read too (the `colors` Feature's spaces).
|
|
@@ -966,11 +1193,14 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
966
1193
|
const layoutProjection = Keys.projectionIn(untrack(features.services))
|
|
967
1194
|
// The provider's, once any section has built it: what its values register with.
|
|
968
1195
|
const builtProjection = useBuiltProjection()
|
|
969
|
-
|
|
1196
|
+
// Its config's settings: its own over its nearest WardicConfig's, where a hook ward gives any
|
|
1197
|
+
// (probe: behaviour-runes), else that config's.
|
|
1198
|
+
const wardicConfig = configOf(internal)
|
|
1199
|
+
const reducedMotion = useWardicReducedMotion(wardicConfig)
|
|
970
1200
|
// Whether its animations are skipped (#468): its nearest WardicConfig's, read as each starts.
|
|
971
|
-
const skipAnimations = useWardicSkipAnimations()
|
|
1201
|
+
const skipAnimations = useWardicSkipAnimations(wardicConfig)
|
|
972
1202
|
// Where its drag's and pan's points are (#443): its nearest WardicConfig's, read as each starts.
|
|
973
|
-
const pagePoint = WardicConfigValue.transformPagePointOf(
|
|
1203
|
+
const pagePoint = WardicConfigValue.transformPagePointOf(wardicConfig)
|
|
974
1204
|
const positionalKeys = useWardicPositionalKeys()
|
|
975
1205
|
const defaultTransition = useWardicDefaultTransition()
|
|
976
1206
|
// How a value is read in the Environment's own terms (#672).
|
|
@@ -987,7 +1217,8 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
987
1217
|
// Its config, read per key where it's read (#259): a change re-runs only what reads the key. With
|
|
988
1218
|
// Animation controls for its `animate` (#433), read once, each change they make is its entry.
|
|
989
1219
|
// Under a `WardicConfig`, its Config transition is its own when it gives none (#434).
|
|
990
|
-
const
|
|
1220
|
+
const written = WARD_VIEW.of(config, internal.fixed)
|
|
1221
|
+
const asGiven = configuredView(written, wardicConfig)
|
|
991
1222
|
// The config at setup, a plain copy read untracked: what setup reads, the keys read once among it.
|
|
992
1223
|
// A key still loading (#257 item 1) is left out of it: one the ward reads as it goes holds its
|
|
993
1224
|
// region until it lands; one setup fixes is an error, naming it. Its `animate` there tells
|
|
@@ -997,7 +1228,10 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
997
1228
|
const view = UndefinedOr.match(controls, { onUndefined: () => asGiven, onDefined: (c) => c.view })
|
|
998
1229
|
const cfg = (): WardConfigValues => view
|
|
999
1230
|
const setup = UndefinedOr.match(controls, { onUndefined: () => givenSetup, onDefined: () => WARD_VIEW.setupOf(view) })
|
|
1000
|
-
const initialConfig =
|
|
1231
|
+
const initialConfig = variantChildBy(
|
|
1232
|
+
internal,
|
|
1233
|
+
UndefinedOr.match(controls, { onUndefined: () => configAtSetup(setup), onDefined: () => AnimationControls.controlledConfigOf(configAtSetup(setup), undefined) }),
|
|
1234
|
+
)
|
|
1001
1235
|
// Its Animation controls' change (#433), read with the Override stack: none without them.
|
|
1002
1236
|
const ownChange = UndefinedOr.match(controls, { onUndefined: () => NO_CHANGE, onDefined: (c) => c.change })
|
|
1003
1237
|
|
|
@@ -1015,13 +1249,15 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1015
1249
|
// The nearest <AnimatePresence> (ADR-0007), or none.
|
|
1016
1250
|
const presence = usePresenceContext()
|
|
1017
1251
|
// The Layout group its `layoutId` goes in (#432): where it's made, or a given ward's.
|
|
1018
|
-
const layoutGroup = layoutGroupFor(share, internal
|
|
1252
|
+
const layoutGroup = layoutGroupFor(share, internal)
|
|
1019
1253
|
|
|
1020
1254
|
// The values it starts from, read once (ADR-0003): its `initial`, or the one it inherits, or its
|
|
1021
1255
|
// `animate` with `initial={false}` (its own, inherited, or its presence's first render, #134).
|
|
1022
1256
|
const presenceBlocks = PresenceRecord.presenceBlocksInitial(presence)
|
|
1023
|
-
if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw
|
|
1024
|
-
|
|
1257
|
+
if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", STARTS_AT_PENDING)
|
|
1258
|
+
// Untracked as a whole: a target that's a store's (a store given as a hook's rune) is read here,
|
|
1259
|
+
// in the component's body, for its values now.
|
|
1260
|
+
const start = untrack(() => Spine.startOf(initialConfig, node.inherited, presenceBlocks, untrack))
|
|
1025
1261
|
// A variant whose resolver throws is this element's alone: reported once until it resolves, the element
|
|
1026
1262
|
// keeping its last target (#979; ADR-0074).
|
|
1027
1263
|
Spine.reportStart(variantFailures, start)
|
|
@@ -1076,15 +1312,25 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1076
1312
|
// last one left the page, as a mount after the first render's (no presence holds its `initial`
|
|
1077
1313
|
// back). Its Snapshot goes back to it, and its Starting style comes back on until its first commit.
|
|
1078
1314
|
let begun = start
|
|
1079
|
-
|
|
1080
|
-
|
|
1315
|
+
// A fresh start and the Starting style it draws, from the config now: a plain copy read untracked,
|
|
1316
|
+
// as setup reads it. Read in the mount effect, and by an element's first read of its style.
|
|
1317
|
+
const freshStart = (): FreshStart => {
|
|
1081
1318
|
const now = WARD_VIEW.setupOf(view).config
|
|
1082
|
-
|
|
1319
|
+
const from = Spine.startOf(now, node.inherited, false, untrack)
|
|
1320
|
+
return { from, starting: Svg.splitPatchForTag(internal.tag, project(ElementSetup.drawnAtRest(from.initialValues, layoutNode, now.transformTemplate))).style }
|
|
1321
|
+
}
|
|
1322
|
+
const freshStarting = (): Renderer.Patch => freshStart().starting
|
|
1323
|
+
const beginFresh = (): void => {
|
|
1324
|
+
const fresh = freshStart()
|
|
1325
|
+
begun = fresh.from
|
|
1326
|
+
// As the first start (#979): its variant's resolver that throws is reported, here where it begins.
|
|
1083
1327
|
Spine.reportStart(variantFailures, begun)
|
|
1084
1328
|
snapshot.values = { ...begun.initialValues }
|
|
1085
1329
|
snapshot.velocities = {}
|
|
1086
1330
|
snapshot.drawnAt = {}
|
|
1087
|
-
|
|
1331
|
+
// Its element read this Starting style as it was made, where it was seen coming, so that read
|
|
1332
|
+
// isn't run again: any other read of its style is.
|
|
1333
|
+
elementStyle.restart(fresh.starting)
|
|
1088
1334
|
}
|
|
1089
1335
|
const configNow = (): WardConfigValues => view
|
|
1090
1336
|
const styleNow = (): WardStyle | string | undefined => untrack(userStyle)
|
|
@@ -1092,11 +1338,16 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1092
1338
|
// What its exit resolves from under an <AnimatePresence> (#277: its `exit`, `variants`, `custom` and
|
|
1093
1339
|
// transition), kept current while it's alive: the presence resolves it as the ward leaves (ADR-0007).
|
|
1094
1340
|
const exitConfig = { current: Spine.NO_EXIT_CONFIG }
|
|
1341
|
+
// How it's read of its config, under a presence: none with no presence above it, and nothing
|
|
1342
|
+
// made for it then. Mapped from the presence, a function was made for every ward to make it by.
|
|
1343
|
+
let exitNow: (() => Spine.ExitConfig) | undefined
|
|
1095
1344
|
if (Predicate.isNotUndefined(presence)) {
|
|
1345
|
+
const now = (): Spine.ExitConfig => Spine.exitConfigOf(cfg(), node.inherited)
|
|
1346
|
+
exitNow = now
|
|
1096
1347
|
// Its inherited transition is read untracked here: the effect keeps it current.
|
|
1097
1348
|
exitConfig.current = untrack(() => Spine.exitConfigOf(initialConfig, node.inherited))
|
|
1098
1349
|
createEffect(
|
|
1099
|
-
|
|
1350
|
+
now,
|
|
1100
1351
|
(config) => {
|
|
1101
1352
|
exitConfig.current = config
|
|
1102
1353
|
},
|
|
@@ -1109,8 +1360,18 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1109
1360
|
// (#140)*). Its section's `layout` makes its node (#511): without it, its layout props do nothing,
|
|
1110
1361
|
// and development says so once, unless `layout` is on its way.
|
|
1111
1362
|
const wantsNode = Feature.wantsLayoutNode(initialConfig)
|
|
1363
|
+
/**
|
|
1364
|
+
* Whether its drag waits for its layout node (probe: behaviour-runes): it wants one, has none yet, and a
|
|
1365
|
+
* Feature is still on its way (`pending`, read now where not given). A hook row's lazy `layout` that came
|
|
1366
|
+
* after `drag` was left out of the track (#582), so a behaviour's `measured()` never saw the drag.
|
|
1367
|
+
*/
|
|
1368
|
+
const holdsForNode = (wants: boolean, node: unknown, pending?: boolean): boolean => {
|
|
1369
|
+
if (Bool.not(wants)) return false
|
|
1370
|
+
if (Predicate.isNotUndefined(node)) return false
|
|
1371
|
+
return UndefinedOr.match(pending, { onUndefined: () => untrack(features.pending), onDefined: identity })
|
|
1372
|
+
}
|
|
1112
1373
|
if (DEV && wantsNode && Predicate.isUndefined(layoutProjection) && Bool.not(untrack(features.pending))) {
|
|
1113
|
-
useFeatureRegistry()
|
|
1374
|
+
warnMissing(useFeatureRegistry(), "layout", Feature.LAYOUT_PROPS)
|
|
1114
1375
|
}
|
|
1115
1376
|
const layoutNodes = Bool.match(wantsNode, { onTrue: () => layoutProjection, onFalse: constUndefined })
|
|
1116
1377
|
const dragTransition = DragTransition.dragTransitionOf(initialConfig.dragElastic, initialConfig.dragTransition)
|
|
@@ -1181,9 +1442,12 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1181
1442
|
{ equals: sameTarget, transparent: true },
|
|
1182
1443
|
)
|
|
1183
1444
|
// A colour only the `colors` Feature reads, on a Slim element without it (#511, decision 7): said
|
|
1184
|
-
// once per provider, in development only, and not while a lazy load is on its way.
|
|
1445
|
+
// once per provider, in development only, and not while a lazy load is on its way. Not of a ward that
|
|
1446
|
+
// asks for its Features as it uses them (`targeted`, the hooks'): it asks for `colors` a microtask after
|
|
1447
|
+
// a colour shows, when this had already found none on its way, and said so wrongly (AS2, CL1; seen once
|
|
1448
|
+
// it was coded, where it had gone to Effect's log unread).
|
|
1185
1449
|
// eslint-disable-next-line solid/reactivity -- read inside the warning's effect, where it tracks
|
|
1186
|
-
if (DEV && internal.complete !== true) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved)
|
|
1450
|
+
if (DEV && Bool.and(internal.complete !== true, Predicate.isUndefined(internal.targeted))) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved)
|
|
1187
1451
|
// Its gesture states, for what its variant node hands down (#291): bound at setup, before its
|
|
1188
1452
|
// children read them. Read from the gestures themselves, not the target: a gesture whose layer
|
|
1189
1453
|
// resolves to nothing new leaves the target as it was (`sameResolution`), but is on all the same.
|
|
@@ -1244,6 +1508,10 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1244
1508
|
pan: boolean
|
|
1245
1509
|
inView: boolean
|
|
1246
1510
|
focus: boolean
|
|
1511
|
+
/** Whether `onInput` was told (probe: behaviour-runes). */
|
|
1512
|
+
input: boolean
|
|
1513
|
+
/** What `afterMount` returned, called once the mount has ended (probe: behaviour-runes). */
|
|
1514
|
+
afterUnmount: () => void
|
|
1247
1515
|
readonly dispose: () => void
|
|
1248
1516
|
}
|
|
1249
1517
|
/** A handler's throw, reported as a fiber's failure is (ADR-0030, decision 4); the watch goes on. */
|
|
@@ -1260,7 +1528,7 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1260
1528
|
if (Bool.not(wanted)) return undefined
|
|
1261
1529
|
const service = GestureFeatures.serviceIn(services, key)
|
|
1262
1530
|
if (DEV && Predicate.isUndefined(service) && Bool.not(untrack(features.pending))) {
|
|
1263
|
-
featureRegistry
|
|
1531
|
+
warnMissing(featureRegistry, name, GestureFeatures.GESTURE_WORDS[name])
|
|
1264
1532
|
}
|
|
1265
1533
|
return service
|
|
1266
1534
|
}
|
|
@@ -1332,6 +1600,14 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1332
1600
|
m.focus = true
|
|
1333
1601
|
m.watch(focus.watch(m.element, { visible: true }, { on: (focused) => setGesture(m.element, "focused", focused), onDefect }))
|
|
1334
1602
|
}
|
|
1603
|
+
// A behaviour's input (probe: behaviour-runes): told once a mount, once its gestures' input is there.
|
|
1604
|
+
const onInput = internal.onInput
|
|
1605
|
+
if (Predicate.isNotUndefined(onInput) && Bool.not(m.input)) {
|
|
1606
|
+
UndefinedOr.map(GestureFeatures.serviceIn(services, InputSource.InputSource), (input) => {
|
|
1607
|
+
m.input = true
|
|
1608
|
+
onInput(m.element, input, (make) => m.watch(make(onDefect)), (effect) => void runtime.runFork(effect), runtime)
|
|
1609
|
+
})
|
|
1610
|
+
}
|
|
1335
1611
|
}
|
|
1336
1612
|
let mounted: Mounted | undefined
|
|
1337
1613
|
// The last two elements given to its ref, for a second one still on the page as it mounts (#349's Q5).
|
|
@@ -1363,26 +1639,33 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1363
1639
|
held = PresenceRecord.presenceHold(presence, el, shown)
|
|
1364
1640
|
return Predicate.isNotUndefined(held)
|
|
1365
1641
|
}
|
|
1366
|
-
|
|
1642
|
+
/**
|
|
1643
|
+
* Its element's mount ended, and what `afterMount` gave it handed back to be called once the caller's
|
|
1644
|
+
* own work is done (probe: behaviour-runes): a rune's undoing that throws ends nothing of the binding's.
|
|
1645
|
+
*/
|
|
1646
|
+
const unmount = (): (() => void) => {
|
|
1367
1647
|
unhold()
|
|
1368
|
-
if (Predicate.isUndefined(mounted)) return
|
|
1648
|
+
if (Predicate.isUndefined(mounted)) return constVoid
|
|
1369
1649
|
const left = mounted.element
|
|
1650
|
+
const afterUnmount = mounted.afterUnmount
|
|
1370
1651
|
mounted.dispose()
|
|
1371
1652
|
mounted = undefined
|
|
1372
1653
|
if (justLeft.size === 0) queueMicrotask(forgetJustLeft)
|
|
1373
1654
|
justLeft.add(left)
|
|
1655
|
+
return afterUnmount
|
|
1374
1656
|
}
|
|
1375
1657
|
// Its element's mount goes, and its lifecycle's waits are rejected (#257): one cleanup, which ends
|
|
1376
1658
|
// what its accessors mounted at their first calls too (#566).
|
|
1377
1659
|
// A driving ward's lifecycle is its given ward's, which outlives the element (#349).
|
|
1378
1660
|
onCleanup(() => {
|
|
1379
|
-
unmount()
|
|
1661
|
+
const afterUnmount = unmount()
|
|
1380
1662
|
if (Predicate.isUndefined(share)) lifecycle.dispose()
|
|
1381
1663
|
UndefinedOr.map(cleanups, (all) => Arr.forEach(all, runCleanup))
|
|
1664
|
+
afterUnmount()
|
|
1382
1665
|
})
|
|
1383
1666
|
|
|
1384
1667
|
const mount = (el: HTMLElement): Mounted => {
|
|
1385
|
-
if (justLeft.has(el)) throw
|
|
1668
|
+
if (justLeft.has(el)) throw misuse("WARDIC_WARD_MADE_IN_SPREAD", REMADE)
|
|
1386
1669
|
// The ward a component was given follows this element while it's mounted (#349): one at a time.
|
|
1387
1670
|
let undrive: (() => void) | undefined
|
|
1388
1671
|
if (Predicate.isNotUndefined(share)) {
|
|
@@ -1537,7 +1820,7 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1537
1820
|
propagation: initialConfig.dragPropagation,
|
|
1538
1821
|
directionLock: initialConfig.dragDirectionLock,
|
|
1539
1822
|
transition: dragTransition,
|
|
1540
|
-
listen: initialConfig.dragListener,
|
|
1823
|
+
listen: UndefinedOr.match(internal.dragListen, { onUndefined: () => initialConfig.dragListener, onDefined: identity }),
|
|
1541
1824
|
},
|
|
1542
1825
|
container: constraints.container,
|
|
1543
1826
|
controls: initialConfig.dragControls,
|
|
@@ -1556,7 +1839,11 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1556
1839
|
onReleaseEnd: () => lifecycle.released(),
|
|
1557
1840
|
})
|
|
1558
1841
|
}
|
|
1559
|
-
|
|
1842
|
+
// One that wants a layout node whose `layout` is still on its way holds its drag back until the node
|
|
1843
|
+
// is made, so its track drives the node (probe: behaviour-runes): a hook row's Features come as its
|
|
1844
|
+
// config asks, `drag` before `layout` as often as not, and a node made after the track was left out
|
|
1845
|
+
// of it (#582), so a behaviour's `measured()` never saw the drag.
|
|
1846
|
+
let dragTrack = Bool.match(holdsForNode(wantsNode, layout), { onTrue: constUndefined, onFalse: () => UndefinedOr.map(dragGesture, driveDrag) })
|
|
1560
1847
|
const spineOptions: Spine.SubjectSpineOptions = {
|
|
1561
1848
|
runtime,
|
|
1562
1849
|
gate,
|
|
@@ -1629,6 +1916,8 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1629
1916
|
pan: false,
|
|
1630
1917
|
inView: false,
|
|
1631
1918
|
focus: false,
|
|
1919
|
+
input: false,
|
|
1920
|
+
afterUnmount: constVoid,
|
|
1632
1921
|
dispose: () => {
|
|
1633
1922
|
if (Predicate.isNotUndefined(undrive)) undrive()
|
|
1634
1923
|
UndefinedOr.map(mountedHook, (end) => end())
|
|
@@ -1679,9 +1968,10 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1679
1968
|
() => ({ services: features.services(), pending: features.pending() }),
|
|
1680
1969
|
// Its apply returns nothing: a function returned there would be its cleanup.
|
|
1681
1970
|
({ services, pending }) => {
|
|
1682
|
-
|
|
1971
|
+
// Its node reads its config's options (its `layoutId`, an accessor's): untracked, as at its mount, so said.
|
|
1972
|
+
UndefinedOr.map(mounted, (m) => untrack(() => layoutArrivedIn(m.arriveLayout, services)))
|
|
1683
1973
|
if (DEV && Predicate.isUndefined(Keys.projectionIn(services)) && Bool.not(pending)) {
|
|
1684
|
-
featureRegistry
|
|
1974
|
+
warnMissing(featureRegistry, "layout", Feature.LAYOUT_PROPS)
|
|
1685
1975
|
}
|
|
1686
1976
|
},
|
|
1687
1977
|
CLIENT_ONLY_DEFERRED,
|
|
@@ -1700,11 +1990,14 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1700
1990
|
// A `layout` from the same load makes its node first, so the track drives it (#582).
|
|
1701
1991
|
onDefined: (gesture) =>
|
|
1702
1992
|
UndefinedOr.map(mounted, (m) => {
|
|
1703
|
-
layoutArrivedIn(m.arriveLayout, services)
|
|
1704
|
-
|
|
1993
|
+
untrack(() => layoutArrivedIn(m.arriveLayout, services))
|
|
1994
|
+
// One that wants a node starts its drag once it has one, or once nothing more is coming.
|
|
1995
|
+
if (Bool.not(holdsForNode(wantsNode, m.layout, pending))) UndefinedOr.map(m.startDrag, (start) => start(gesture))
|
|
1996
|
+
// Its input with it, for a behaviour's keys (probe: behaviour-runes).
|
|
1997
|
+
startRecognizers(m)
|
|
1705
1998
|
}),
|
|
1706
1999
|
onUndefined: () => {
|
|
1707
|
-
if (DEV && Bool.not(pending)) featureRegistry
|
|
2000
|
+
if (DEV && Bool.not(pending)) warnMissing(featureRegistry, "drag", GestureFeatures.GESTURE_WORDS.drag)
|
|
1708
2001
|
},
|
|
1709
2002
|
})
|
|
1710
2003
|
},
|
|
@@ -1744,26 +2037,40 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1744
2037
|
(mounting) => {
|
|
1745
2038
|
if (Predicate.isUndefined(mounting)) return
|
|
1746
2039
|
const { el, resolution } = mounting
|
|
2040
|
+
let mountedNow = false
|
|
2041
|
+
// What the last element's `afterMount` gave, called once this one is mounted and aimed.
|
|
2042
|
+
let afterLast: () => void = constVoid
|
|
1747
2043
|
if (Predicate.isUndefined(mounted) || mounted.element !== el) {
|
|
1748
2044
|
// Another element it was spread on, or the one it's on, still on the page: a ward drives one
|
|
1749
2045
|
// element at a time (#349's Q5). One the page has let go of is left behind.
|
|
1750
|
-
if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw
|
|
2046
|
+
if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement("ward(config)"))
|
|
1751
2047
|
refdBefore = undefined
|
|
1752
2048
|
// Held off the page: nothing starts until it's on it.
|
|
1753
2049
|
if (heldBack(el)) return
|
|
1754
2050
|
// A new element starts with no gesture on, read from its gesture state (#257's audit).
|
|
1755
|
-
unmount()
|
|
1756
|
-
// One that came after the last left the page enters fresh (#414).
|
|
1757
|
-
|
|
2051
|
+
afterLast = unmount()
|
|
2052
|
+
// One that came after the last left the page enters fresh (#414). One that doesn't, read as
|
|
2053
|
+
// one that would, reads its style again.
|
|
2054
|
+
Bool.match(el === fresh, { onTrue: beginFresh, onFalse: elementStyle.notFresh })
|
|
1758
2055
|
// Its config is read at mount (its layout node's options, its `onUpdate`, its spine's) through
|
|
1759
2056
|
// the per-key view (#259): untracked, so said, as the Retarget below.
|
|
1760
2057
|
mounted = untrack(() => mount(el))
|
|
2058
|
+
mountedNow = true
|
|
1761
2059
|
}
|
|
1762
2060
|
// The spine reads the variant context (its gates, its stagger, what it inherits) at the
|
|
1763
2061
|
// Retarget, once: untracked, so said (Solid 2's dev build warns of a reactive read in an
|
|
1764
2062
|
// effect's apply, STRICT_READ_UNTRACKED). The effect's compute is what re-runs it.
|
|
1765
|
-
const
|
|
2063
|
+
const m = mounted
|
|
2064
|
+
const spine = m.spine
|
|
2065
|
+
// What it resolved to, told to a ward that asks for its Features as it uses them (`targeted`).
|
|
2066
|
+
const targeted = internal.targeted
|
|
2067
|
+
if (Predicate.isNotUndefined(targeted)) targeted(resolution.resolved)
|
|
1766
2068
|
untrack(() => spine.retarget(resolution))
|
|
2069
|
+
// A hooks ward's runes' `ref`s, once it's mounted and aimed (probe: behaviour-runes): the last
|
|
2070
|
+
// element's undone, then this one's run. Not untracked, which is the `ref`'s author's to say.
|
|
2071
|
+
afterLast()
|
|
2072
|
+
const afterMount = internal.afterMount
|
|
2073
|
+
if (mountedNow && Predicate.isNotUndefined(afterMount)) m.afterUnmount = afterMount(el)
|
|
1767
2074
|
},
|
|
1768
2075
|
CLIENT_ONLY_SYNC,
|
|
1769
2076
|
)
|
|
@@ -1834,9 +2141,45 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1834
2141
|
}
|
|
1835
2142
|
},
|
|
1836
2143
|
})
|
|
2144
|
+
// Whether its presence says the next element it's given enters afresh (probe: hooks-first).
|
|
2145
|
+
const presenceSaysFresh = (): boolean => {
|
|
2146
|
+
const enters = internal.entersFresh
|
|
2147
|
+
if (Predicate.isUndefined(enters)) return false
|
|
2148
|
+
return enters(self)
|
|
2149
|
+
}
|
|
2150
|
+
// Whether the element a first read of its style is for enters fresh (#414), told before its mount
|
|
2151
|
+
// begins it: its ref has decided it for one given and not yet mounted, and will say this of the next.
|
|
2152
|
+
const comesFresh = (): boolean => {
|
|
2153
|
+
const last = refdLast
|
|
2154
|
+
if (Predicate.isUndefined(last)) return presenceSaysFresh()
|
|
2155
|
+
if (UndefinedOr.map(mounted, elementOfMount) !== last) return fresh === last
|
|
2156
|
+
return Bool.or(Bool.not(last.isConnected), presenceSaysFresh())
|
|
2157
|
+
}
|
|
2158
|
+
// Each computation that has read its style: one for each element it's on, the same at every run of
|
|
2159
|
+
// that element's props. So a first read is an element's being made.
|
|
2160
|
+
const styleReaders = new WeakSet<Owner>()
|
|
1837
2161
|
const renderedStyle = (): JSX.CSSProperties => {
|
|
1838
2162
|
holdWhileLoading()
|
|
1839
|
-
|
|
2163
|
+
const user = userStyle()
|
|
2164
|
+
const reader = getOwner()
|
|
2165
|
+
// Read outside a computation, or by one that has read it before: as the gate has it.
|
|
2166
|
+
if (Predicate.isNull(reader)) return elementStyle.style(user) as JSX.CSSProperties
|
|
2167
|
+
if (styleReaders.has(reader)) return elementStyle.style(user) as JSX.CSSProperties
|
|
2168
|
+
// An element that enters fresh reads its Starting style here, derived from what its ref goes by.
|
|
2169
|
+
// Its mount begins the entry once the ref has given it, and doesn't run this read again: told
|
|
2170
|
+
// of the restart afterwards, a spread re-ran on a write its own effect had led to, through the
|
|
2171
|
+
// ref it calls (EFFECT_WRITES_OWN_SOURCE).
|
|
2172
|
+
const style = Bool.match(comesFresh(), {
|
|
2173
|
+
onTrue: () => elementStyle.entering(user, untrack(freshStarting)),
|
|
2174
|
+
onFalse: () => elementStyle.style(user),
|
|
2175
|
+
})
|
|
2176
|
+
styleReaders.add(reader)
|
|
2177
|
+
// Told to the hooks, where they made it, in development alone (probe: hooks-first, Q29).
|
|
2178
|
+
if (DEV) {
|
|
2179
|
+
const styled = internal.styled
|
|
2180
|
+
if (Predicate.isNotUndefined(styled)) styled(self)
|
|
2181
|
+
}
|
|
2182
|
+
return style as JSX.CSSProperties
|
|
1840
2183
|
}
|
|
1841
2184
|
|
|
1842
2185
|
// The ward: a ref, and its own props. Under a presence, its element is told to it as it's made
|
|
@@ -1851,7 +2194,7 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1851
2194
|
* element of its own (#349's Q5).
|
|
1852
2195
|
*/
|
|
1853
2196
|
const drive = (next: Driver, name: string): (() => void) => {
|
|
1854
|
-
if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw
|
|
2197
|
+
if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement(name))
|
|
1855
2198
|
driver = next
|
|
1856
2199
|
UndefinedOr.map(driven, (atom) => registry().set(atom, next))
|
|
1857
2200
|
return () => {
|
|
@@ -1864,9 +2207,10 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1864
2207
|
config,
|
|
1865
2208
|
setup: initialConfig,
|
|
1866
2209
|
internal,
|
|
2210
|
+
fixed: () => fixedOver(written),
|
|
1867
2211
|
parent,
|
|
1868
2212
|
chosen: Predicate.isNotUndefined(internal.parent),
|
|
1869
|
-
carries:
|
|
2213
|
+
carries: carriesFor(internal, initialConfig),
|
|
1870
2214
|
provided: node.provided,
|
|
1871
2215
|
layoutGroup,
|
|
1872
2216
|
node,
|
|
@@ -1879,6 +2223,10 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1879
2223
|
const setMade = Spine.madeWith(presence, setElement, initialConfig)
|
|
1880
2224
|
const self = ((value?: unknown): WardProps | undefined => {
|
|
1881
2225
|
if (isElement(value)) {
|
|
2226
|
+
// Told to the hooks, where they made it (probe: hooks-first): what a leaving row finds inside it.
|
|
2227
|
+
// No callback made for it: this runs for every element of every ward.
|
|
2228
|
+
const handed = internal.handed
|
|
2229
|
+
if (Predicate.isNotUndefined(handed)) handed(value, self)
|
|
1882
2230
|
const last = refdLast
|
|
1883
2231
|
if (Predicate.isNotUndefined(last)) {
|
|
1884
2232
|
if (last !== value) {
|
|
@@ -1886,12 +2234,21 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1886
2234
|
if (Bool.not(last.isConnected)) fresh = value
|
|
1887
2235
|
}
|
|
1888
2236
|
}
|
|
2237
|
+
// A presence's next value (probe: hooks-first): its element enters afresh though the last may
|
|
2238
|
+
// still be on the page, and so does the first one of a value that came after the page opened.
|
|
2239
|
+
if (Bool.and(last !== value, presenceSaysFresh())) fresh = value
|
|
1889
2240
|
refdLast = value
|
|
1890
2241
|
setMade(value)
|
|
1891
2242
|
return undefined
|
|
1892
2243
|
}
|
|
1893
2244
|
return spreadNow()
|
|
1894
2245
|
}) as Ward
|
|
2246
|
+
// The presence it's made under, for a hook ward to watch its child's leave by (probe: hooks-first).
|
|
2247
|
+
// No callback made for it: this runs for every ward under a presence, each row of a list.
|
|
2248
|
+
if (Predicate.isNotUndefined(presence)) {
|
|
2249
|
+
const madeUnder = internal.madeUnder
|
|
2250
|
+
if (Predicate.isNotUndefined(madeUnder)) madeUnder(self, presence)
|
|
2251
|
+
}
|
|
1895
2252
|
// What a spread of the ward reads (#495): its spread's props alone, made at its first spread, so a
|
|
1896
2253
|
// ward given only to `ref` makes none, and a Reorder item's keyboard attributes are in it.
|
|
1897
2254
|
let spread: WardProps | undefined
|
|
@@ -1918,11 +2275,17 @@ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
|
1918
2275
|
lifecycle,
|
|
1919
2276
|
element,
|
|
1920
2277
|
hold: holdWhileLoading,
|
|
2278
|
+
written,
|
|
2279
|
+
target,
|
|
2280
|
+
handsDown: node.handsDown as Parameters<typeof refresh>[0] | undefined,
|
|
2281
|
+
exitConfig,
|
|
2282
|
+
exitNow,
|
|
1921
2283
|
settled: undefined,
|
|
1922
2284
|
tapped: undefined,
|
|
1923
2285
|
next: undefined,
|
|
1924
2286
|
each: undefined,
|
|
1925
2287
|
when: undefined,
|
|
2288
|
+
hooks: undefined,
|
|
1926
2289
|
}
|
|
1927
2290
|
Object.setPrototypeOf(self, WARD_MEMBERS)
|
|
1928
2291
|
Object.defineProperties(self, {
|
|
@@ -2045,19 +2408,19 @@ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
|
2045
2408
|
// A server's own values: the DOM's, its context's constant (#672).
|
|
2046
2409
|
const ownValues = ElementSetup.valueReadsOf(useWardicValueReads()).ownValues
|
|
2047
2410
|
createUniqueId()
|
|
2048
|
-
const view = configuredView(WARD_VIEW.of(config, internal.fixed),
|
|
2411
|
+
const view = configuredView(WARD_VIEW.of(config, internal.fixed), configOf(internal))
|
|
2049
2412
|
// A key still loading (#257 item 1): one setup fixes is the client's error here too. One the ward
|
|
2050
2413
|
// reads as it goes is read again, throwing Solid's `NotReadyError`: a server waits for it and
|
|
2051
2414
|
// renders the component again, so its region streams once the data is in, Appear and all.
|
|
2052
2415
|
// Both are checked before the read that waits.
|
|
2053
2416
|
const setup = WARD_VIEW.setupOf(view)
|
|
2054
2417
|
// Animation controls (#433) set nothing on a server: no entry yet, and controlled, as on the client.
|
|
2055
|
-
const atSetup = AnimationControls.uncontrolledOf(configAtSetup(setup))
|
|
2418
|
+
const atSetup = variantChildBy(internal, AnimationControls.uncontrolledOf(configAtSetup(setup)))
|
|
2056
2419
|
// Where it's made, its given parent's, or its given ward's (#349).
|
|
2057
2420
|
const parent = variantParentOf(internal)
|
|
2058
2421
|
const presenceBlocks = PresenceRecord.presenceBlocksInitial(usePresenceContext())
|
|
2059
|
-
if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(atSetup, VariantTree.inheritedContext(atSetup, parent), presenceBlocks))) throw
|
|
2060
|
-
const c = AnimationControls.uncontrolledOf(WARD_VIEW.snapshotOf(view))
|
|
2422
|
+
if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(atSetup, VariantTree.inheritedContext(atSetup, parent), presenceBlocks))) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", STARTS_AT_PENDING)
|
|
2423
|
+
const c = variantChildBy(internal, AnimationControls.uncontrolledOf(WARD_VIEW.snapshotOf(view)))
|
|
2061
2424
|
const node = VariantTree.serverVariantNode(c, parent)
|
|
2062
2425
|
const serverStart = Spine.startOf(c, node.inherited, presenceBlocks, untrack)
|
|
2063
2426
|
// A variant that throws leaves its values out of the markup, logged on the server (#979).
|
|
@@ -2092,13 +2455,19 @@ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
|
2092
2455
|
Style.over(appear.style),
|
|
2093
2456
|
) as JSX.CSSProperties
|
|
2094
2457
|
}
|
|
2095
|
-
|
|
2458
|
+
// Worked out at its first read, a spread's (probe: behaviour-runes): what's made after the ward and
|
|
2459
|
+
// before its element renders still counts, a hooks row's grip, which takes its `touch-action` away.
|
|
2460
|
+
let style: JSX.CSSProperties | undefined
|
|
2461
|
+
const styleNow = (): JSX.CSSProperties => {
|
|
2462
|
+
if (Predicate.isUndefined(style)) style = styleFor(c.style)
|
|
2463
|
+
return style
|
|
2464
|
+
}
|
|
2096
2465
|
let given: WardWithProps = NO_WITH
|
|
2097
2466
|
const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults))
|
|
2098
2467
|
// A spread of it reads its spread's props alone, made at its first spread, as the client's (#495).
|
|
2099
2468
|
let spread: WardProps | undefined
|
|
2100
2469
|
const self = ((): WardProps => {
|
|
2101
|
-
if (Predicate.isUndefined(spread)) spread = spreadOfWard(self, { value: noRef, enumerable: true }, {
|
|
2470
|
+
if (Predicate.isUndefined(spread)) spread = spreadOfWard(self, { value: noRef, enumerable: true }, { get: styleNow, enumerable: true }, attributes)
|
|
2102
2471
|
return spread
|
|
2103
2472
|
}) as Ward
|
|
2104
2473
|
// What it shares with a component it's given to (#349): a server's component renders its own.
|
|
@@ -2106,11 +2475,12 @@ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
|
2106
2475
|
config,
|
|
2107
2476
|
setup: atSetup,
|
|
2108
2477
|
internal,
|
|
2478
|
+
fixed: () => internal.fixed,
|
|
2109
2479
|
parent,
|
|
2110
2480
|
chosen: Predicate.isNotUndefined(internal.parent),
|
|
2111
|
-
carries:
|
|
2481
|
+
carries: carriesFor(internal, atSetup),
|
|
2112
2482
|
provided: appear.provided,
|
|
2113
|
-
layoutGroup:
|
|
2483
|
+
layoutGroup: groupOf(internal),
|
|
2114
2484
|
node: undefined,
|
|
2115
2485
|
lifecycle: undefined,
|
|
2116
2486
|
drive: () => constVoid,
|
|
@@ -2118,7 +2488,7 @@ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
|
2118
2488
|
Object.defineProperties(self, {
|
|
2119
2489
|
[WARD]: { value: shared },
|
|
2120
2490
|
ref: { value: noRef, enumerable: true },
|
|
2121
|
-
style: {
|
|
2491
|
+
style: { get: styleNow, enumerable: true },
|
|
2122
2492
|
...attributes,
|
|
2123
2493
|
Provider: { value: Provider },
|
|
2124
2494
|
read: { value: (key: string) => () => ElementSetup.restingOf(key, initialValues, withStyleOver(c.style, given.style), readServerStyle) },
|
|
@@ -2130,8 +2500,11 @@ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
|
2130
2500
|
next: { value: neverLands },
|
|
2131
2501
|
each: { value: () => NO_EVENTS },
|
|
2132
2502
|
when: { value: serverWhen },
|
|
2133
|
-
// The element's own style over the config's, rendered in its Starting style (#264).
|
|
2503
|
+
// The element's own style over the config's, rendered in its Starting style (#264). Configurable,
|
|
2504
|
+
// as a client's is by being a shared member: so what makes a ward of this one can give it a
|
|
2505
|
+
// `with` of its own, on a server as in a browser (the hooks', for what their runes add to a spread).
|
|
2134
2506
|
with: {
|
|
2507
|
+
configurable: true,
|
|
2135
2508
|
value: (own: WardWithProps): WardProps => {
|
|
2136
2509
|
given = own
|
|
2137
2510
|
return spreadPropsOf({
|
|
@@ -2148,4 +2521,265 @@ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
|
2148
2521
|
/** A server render's `ref`: Solid never calls it there. */
|
|
2149
2522
|
const noRef = constUndefined
|
|
2150
2523
|
|
|
2524
|
+
/** No values: what a function rune's ward rests at, having no config ({@link holderWard}). */
|
|
2525
|
+
const NO_VALUES: Values.Values = {}
|
|
2526
|
+
/** A function rune's ward's config, as it's written and at setup: none. */
|
|
2527
|
+
const NO_WRITTEN: WardConfigValues = Object.freeze({})
|
|
2528
|
+
/** A function rune's ward's exit: none, never read again, as it has no `exitNow`. */
|
|
2529
|
+
const NO_EXIT: { current: Spine.ExitConfig } = Object.freeze({ current: Spine.NO_EXIT_CONFIG })
|
|
2530
|
+
|
|
2531
|
+
/** What a function rune's ward hands on to its finished ward, by name, in the words development uses. */
|
|
2532
|
+
type HandedOn = "Provider" | "with" | "the ward as a ref or a spread" | "style"
|
|
2533
|
+
|
|
2534
|
+
/**
|
|
2535
|
+
* What development says of `member` used in a function rune's body (the ward split's Q7): it's the
|
|
2536
|
+
* finished ward's, and that ward isn't made yet.
|
|
2537
|
+
*/
|
|
2538
|
+
const usedEarly = (member: HandedOn): string =>
|
|
2539
|
+
`createRune(fn): ${member} was used in the rune's body, before its ward is made. It's the ward's, and the ward ` +
|
|
2540
|
+
"doesn't exist until every rune has run: use it where the ward is rendered, or in an effect or a callback."
|
|
2541
|
+
|
|
2542
|
+
// Module state (#460, Q7): what development has said, each member once.
|
|
2543
|
+
const SAID_EARLY = new Set<HandedOn>()
|
|
2544
|
+
|
|
2545
|
+
/** Says {@link usedEarly} of `member`, once, in development. */
|
|
2546
|
+
const sayEarly = (member: HandedOn): void => {
|
|
2547
|
+
if (Predicate.isUndefined(DEV)) return
|
|
2548
|
+
if (SAID_EARLY.has(member)) return
|
|
2549
|
+
SAID_EARLY.add(member)
|
|
2550
|
+
report("WARDIC_RUNE_READ_TOO_EARLY", usedEarly(member))
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/** The finished ward each function rune's ward hands on to, told it by {@link holderFinished}. */
|
|
2554
|
+
// Module state (#460, Q7): held weakly by the function rune's ward.
|
|
2555
|
+
const FINISHING = new WeakMap<object, (ward: Ward) => void>()
|
|
2556
|
+
|
|
2557
|
+
/** Tells `holder`, a function rune's ward ({@link holderWard}), the ward it's part of, now that it's made. */
|
|
2558
|
+
export const holderFinished = (holder: object, ward: Ward): void => {
|
|
2559
|
+
UndefinedOr.map(FINISHING.get(holder), (finish) => finish(ward))
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
/**
|
|
2563
|
+
* A function rune's ward (probe: behaviour-runes, the ward split's Q6–Q8, Q11), made before the ward it's
|
|
2564
|
+
* part of, since every rune runs before that ward is: a lifecycle and what the hooks keep, with no config,
|
|
2565
|
+
* no variant node and no mount. The finished ward adopts its lifecycle through its share, as a ward given
|
|
2566
|
+
* to a component does (#349), and drives its `read` and `atom` while it's on an element: as the second
|
|
2567
|
+
* binding ward this replaces did, at a fraction of its cost. What only the finished ward has, its
|
|
2568
|
+
* `Provider`, its spread and `with`, its `style` and its element, it hands on to that ward once
|
|
2569
|
+
* {@link holderFinished} says which: used in the rune's body, before then, development says so. It takes
|
|
2570
|
+
* no hydration id, on a server or in a browser.
|
|
2571
|
+
*/
|
|
2572
|
+
export const holderWard = (internal: WardInternals): Ward => {
|
|
2573
|
+
// Where it's made: the variant context and Layout group its finished ward takes through its share.
|
|
2574
|
+
const parent = variantParentOf(internal)
|
|
2575
|
+
const layoutGroup = groupOf(internal)
|
|
2576
|
+
if (isServer) return serverHolder(internal, parent, layoutGroup)
|
|
2577
|
+
return clientHolder(internal, parent, layoutGroup)
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
/** A function rune's ward in a browser ({@link holderWard}). */
|
|
2581
|
+
const clientHolder = (internal: WardInternals, parent: VariantTree.WardicVariantContextValue | undefined, layoutGroup: string | undefined): Ward => {
|
|
2582
|
+
const registry = Spine.registryOf(useWardicRuntime())
|
|
2583
|
+
const firstCallOwner = firstCallOwnerHere()
|
|
2584
|
+
let finished: Ward | undefined
|
|
2585
|
+
// The finished ward on its element (#349's driver): what its `read`, `atom` and `next` follow.
|
|
2586
|
+
let driver: Driver | undefined
|
|
2587
|
+
let driven: Atom.Writable<Driver | undefined> | undefined
|
|
2588
|
+
let cleanups: Array<() => void> | undefined
|
|
2589
|
+
const addCleanup = (cleanup: () => void): void => {
|
|
2590
|
+
if (Predicate.isUndefined(cleanups)) cleanups = []
|
|
2591
|
+
cleanups.push(cleanup)
|
|
2592
|
+
}
|
|
2593
|
+
const drivenAtom = (): Atom.Writable<Driver | undefined> => {
|
|
2594
|
+
if (Predicate.isNotUndefined(driven)) return driven
|
|
2595
|
+
const atom = Atom.make<Driver | undefined>(driver)
|
|
2596
|
+
addCleanup(registry().mount(atom))
|
|
2597
|
+
driven = atom
|
|
2598
|
+
return atom
|
|
2599
|
+
}
|
|
2600
|
+
// Its gestures are its finished ward's: a `next` that asks for one starts it on that ward's element.
|
|
2601
|
+
const lifecycle = new Lifecycle(firstCallOwner, () => {
|
|
2602
|
+
UndefinedOr.map(driver, (d) => d.wanted())
|
|
2603
|
+
})
|
|
2604
|
+
onCleanup(() => {
|
|
2605
|
+
lifecycle.dispose()
|
|
2606
|
+
UndefinedOr.map(cleanups, (all) => Arr.forEach(all, runCleanup))
|
|
2607
|
+
})
|
|
2608
|
+
// A key's value: the finished ward's element's, while it drives this one; where nothing rests, else.
|
|
2609
|
+
let reads: Map<string, Accessor<unknown>> | undefined
|
|
2610
|
+
const read = (key: string): Accessor<unknown> => {
|
|
2611
|
+
if (Predicate.isUndefined(reads)) reads = new Map()
|
|
2612
|
+
const known = reads.get(key)
|
|
2613
|
+
if (Predicate.isNotUndefined(known)) return known
|
|
2614
|
+
const following = drivenAtom()
|
|
2615
|
+
const resting = ElementSetup.restingOf(key, NO_VALUES, undefined, identity)
|
|
2616
|
+
const atom = Atom.make((get) => UndefinedOr.match(get(following), { onUndefined: () => resting, onDefined: (d) => get(d.readAtom(key)) }))
|
|
2617
|
+
const accessor = runWithOwner(firstCallOwner, () => followAtom(registry(), atom, addCleanup))
|
|
2618
|
+
reads.set(key, accessor)
|
|
2619
|
+
return accessor
|
|
2620
|
+
}
|
|
2621
|
+
const atomOf = (key: string): Atom.Atom<unknown> => {
|
|
2622
|
+
const following = drivenAtom()
|
|
2623
|
+
return Atom.make((get) => UndefinedOr.match(get(following), { onUndefined: constUndefined, onDefined: (d) => get(d.atom(key)) }))
|
|
2624
|
+
}
|
|
2625
|
+
// Followed by one finished ward at a time (#349's Q5).
|
|
2626
|
+
const drive = (next: Driver, name: string): (() => void) => {
|
|
2627
|
+
if (Predicate.isNotUndefined(driver)) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement(name))
|
|
2628
|
+
driver = next
|
|
2629
|
+
UndefinedOr.map(driven, (atom) => registry().set(atom, next))
|
|
2630
|
+
return () => {
|
|
2631
|
+
if (driver !== next) return
|
|
2632
|
+
driver = undefined
|
|
2633
|
+
UndefinedOr.map(driven, (atom) => registry().set(atom, undefined))
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
const shared: WardShare = {
|
|
2637
|
+
config: NO_WRITTEN,
|
|
2638
|
+
setup: NO_WRITTEN,
|
|
2639
|
+
internal,
|
|
2640
|
+
fixed: () => internal.fixed,
|
|
2641
|
+
parent,
|
|
2642
|
+
chosen: Predicate.isNotUndefined(internal.parent),
|
|
2643
|
+
carries: false,
|
|
2644
|
+
provided: undefined,
|
|
2645
|
+
layoutGroup,
|
|
2646
|
+
node: undefined,
|
|
2647
|
+
lifecycle,
|
|
2648
|
+
drive,
|
|
2649
|
+
}
|
|
2650
|
+
const self = ((value?: unknown): unknown =>
|
|
2651
|
+
UndefinedOr.match(finished, {
|
|
2652
|
+
onUndefined: (): unknown => {
|
|
2653
|
+
sayEarly("the ward as a ref or a spread")
|
|
2654
|
+
return undefined
|
|
2655
|
+
},
|
|
2656
|
+
onDefined: (to): unknown => to(value as HTMLElement),
|
|
2657
|
+
})) as Ward
|
|
2658
|
+
const state: WardState = {
|
|
2659
|
+
shared: () => shared,
|
|
2660
|
+
Provider: (props) =>
|
|
2661
|
+
UndefinedOr.match(finished, {
|
|
2662
|
+
onUndefined: () => {
|
|
2663
|
+
sayEarly("Provider")
|
|
2664
|
+
return props.children
|
|
2665
|
+
},
|
|
2666
|
+
onDefined: (to) => to.Provider(props),
|
|
2667
|
+
}),
|
|
2668
|
+
read,
|
|
2669
|
+
atom: atomOf,
|
|
2670
|
+
with: (own) =>
|
|
2671
|
+
UndefinedOr.match(finished, {
|
|
2672
|
+
onUndefined: () => {
|
|
2673
|
+
sayEarly("with")
|
|
2674
|
+
return spreadPropsOf({})
|
|
2675
|
+
},
|
|
2676
|
+
onDefined: (to) => to.with(own),
|
|
2677
|
+
}),
|
|
2678
|
+
lifecycle,
|
|
2679
|
+
element: () =>
|
|
2680
|
+
UndefinedOr.match(finished, {
|
|
2681
|
+
onUndefined: constUndefined,
|
|
2682
|
+
onDefined: (to) => UndefinedOr.match(sensedOf(to), { onUndefined: constUndefined, onDefined: (sensed) => sensed.element() }),
|
|
2683
|
+
}),
|
|
2684
|
+
hold: () => {
|
|
2685
|
+
UndefinedOr.map(finished, (to) => stateOf(to).hold())
|
|
2686
|
+
},
|
|
2687
|
+
written: NO_WRITTEN,
|
|
2688
|
+
target: undefined,
|
|
2689
|
+
handsDown: undefined,
|
|
2690
|
+
exitConfig: NO_EXIT,
|
|
2691
|
+
exitNow: undefined,
|
|
2692
|
+
settled: undefined,
|
|
2693
|
+
tapped: undefined,
|
|
2694
|
+
next: undefined,
|
|
2695
|
+
each: undefined,
|
|
2696
|
+
when: undefined,
|
|
2697
|
+
hooks: undefined,
|
|
2698
|
+
}
|
|
2699
|
+
FINISHING.set(self, (ward) => {
|
|
2700
|
+
finished = ward
|
|
2701
|
+
})
|
|
2702
|
+
Object.setPrototypeOf(self, WARD_MEMBERS)
|
|
2703
|
+
Object.defineProperties(self, {
|
|
2704
|
+
[WARD_STATE]: { value: state },
|
|
2705
|
+
ref: { value: self, enumerable: true },
|
|
2706
|
+
style: { get: () => styleOf(finished), enumerable: true },
|
|
2707
|
+
})
|
|
2708
|
+
return self
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
/** A function rune's ward's `style`: its finished ward's. */
|
|
2712
|
+
const styleOf = (finished: Ward | undefined): JSX.CSSProperties =>
|
|
2713
|
+
UndefinedOr.match(finished, {
|
|
2714
|
+
onUndefined: (): JSX.CSSProperties => {
|
|
2715
|
+
sayEarly("style")
|
|
2716
|
+
return {}
|
|
2717
|
+
},
|
|
2718
|
+
onDefined: (to) => to.style as JSX.CSSProperties,
|
|
2719
|
+
})
|
|
2720
|
+
|
|
2721
|
+
/** A function rune's ward on a server ({@link holderWard}): a server ward's members, and its share. Nothing hears anything there. */
|
|
2722
|
+
const serverHolder = (internal: WardInternals, parent: VariantTree.WardicVariantContextValue | undefined, layoutGroup: string | undefined): Ward => {
|
|
2723
|
+
let finished: Ward | undefined
|
|
2724
|
+
const self = ((): WardProps | undefined =>
|
|
2725
|
+
UndefinedOr.match(finished, {
|
|
2726
|
+
onUndefined: (): WardProps | undefined => {
|
|
2727
|
+
sayEarly("the ward as a ref or a spread")
|
|
2728
|
+
return undefined
|
|
2729
|
+
},
|
|
2730
|
+
onDefined: (to) => to(),
|
|
2731
|
+
})) as Ward
|
|
2732
|
+
const shared: WardShare = {
|
|
2733
|
+
config: NO_WRITTEN,
|
|
2734
|
+
setup: NO_WRITTEN,
|
|
2735
|
+
internal,
|
|
2736
|
+
fixed: () => internal.fixed,
|
|
2737
|
+
parent,
|
|
2738
|
+
chosen: Predicate.isNotUndefined(internal.parent),
|
|
2739
|
+
carries: false,
|
|
2740
|
+
provided: undefined,
|
|
2741
|
+
layoutGroup,
|
|
2742
|
+
node: undefined,
|
|
2743
|
+
lifecycle: undefined,
|
|
2744
|
+
drive: () => constVoid,
|
|
2745
|
+
}
|
|
2746
|
+
FINISHING.set(self, (ward) => {
|
|
2747
|
+
finished = ward
|
|
2748
|
+
})
|
|
2749
|
+
Object.defineProperties(self, {
|
|
2750
|
+
[WARD]: { value: shared },
|
|
2751
|
+
ref: { value: noRef, enumerable: true },
|
|
2752
|
+
style: { get: () => styleOf(finished), enumerable: true },
|
|
2753
|
+
Provider: {
|
|
2754
|
+
value: (props: { readonly children?: JSX.Element }): JSX.Element =>
|
|
2755
|
+
UndefinedOr.match(finished, {
|
|
2756
|
+
onUndefined: () => {
|
|
2757
|
+
sayEarly("Provider")
|
|
2758
|
+
return props.children
|
|
2759
|
+
},
|
|
2760
|
+
onDefined: (to) => to.Provider(props),
|
|
2761
|
+
}),
|
|
2762
|
+
},
|
|
2763
|
+
read: { value: (key: string) => () => ElementSetup.restingOf(key, NO_VALUES, undefined, identity) },
|
|
2764
|
+
atom: { value: (): Atom.Atom<unknown> => NO_OUTPUT },
|
|
2765
|
+
settled: { value: constUndefined },
|
|
2766
|
+
tapped: { value: constUndefined },
|
|
2767
|
+
next: { value: neverLands },
|
|
2768
|
+
each: { value: () => NO_EVENTS },
|
|
2769
|
+
when: { value: serverWhen },
|
|
2770
|
+
with: {
|
|
2771
|
+
configurable: true,
|
|
2772
|
+
value: (own: WardWithProps): WardProps =>
|
|
2773
|
+
UndefinedOr.match(finished, {
|
|
2774
|
+
onUndefined: () => {
|
|
2775
|
+
sayEarly("with")
|
|
2776
|
+
return spreadPropsOf({})
|
|
2777
|
+
},
|
|
2778
|
+
onDefined: (to) => to.with(own),
|
|
2779
|
+
}),
|
|
2780
|
+
},
|
|
2781
|
+
})
|
|
2782
|
+
return self
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2151
2785
|
|