@wardic/solid 2.2.0 → 3.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -18
- package/dist/browser/config-view.js +33 -5
- package/dist/browser/config-view.js.map +1 -1
- package/dist/browser/create-batch.js +1 -1
- package/dist/browser/element-style.js +61 -7
- package/dist/browser/element-style.js.map +1 -1
- package/dist/browser/element.js +19 -2
- package/dist/browser/element.js.map +1 -1
- package/dist/browser/feature-section.js +5 -13
- package/dist/browser/feature-section.js.map +1 -1
- package/dist/browser/hooks/auto.js +270 -0
- package/dist/browser/hooks/auto.js.map +1 -0
- package/dist/browser/hooks/config-scope.js +120 -0
- package/dist/browser/hooks/config-scope.js.map +1 -0
- package/dist/browser/hooks/config.js +37 -0
- package/dist/browser/hooks/config.js.map +1 -0
- package/dist/browser/hooks/drag.js +632 -0
- package/dist/browser/hooks/drag.js.map +1 -0
- package/dist/browser/hooks/elements.js +183 -0
- package/dist/browser/hooks/elements.js.map +1 -0
- package/dist/browser/hooks/group.js +28 -0
- package/dist/browser/hooks/group.js.map +1 -0
- package/dist/browser/hooks/index.js +10 -0
- package/dist/browser/hooks/index.js.map +1 -0
- package/dist/browser/hooks/kept.js +32 -0
- package/dist/browser/hooks/kept.js.map +1 -0
- package/dist/browser/hooks/layout-group-of.js +39 -0
- package/dist/browser/hooks/layout-group-of.js.map +1 -0
- package/dist/browser/hooks/layout-group.js +92 -0
- package/dist/browser/hooks/layout-group.js.map +1 -0
- package/dist/browser/hooks/make-ward.js +157 -0
- package/dist/browser/hooks/make-ward.js.map +1 -0
- package/dist/browser/hooks/presence-scope.js +87 -0
- package/dist/browser/hooks/presence-scope.js.map +1 -0
- package/dist/browser/hooks/presence.js +24 -0
- package/dist/browser/hooks/presence.js.map +1 -0
- package/dist/browser/hooks/props.js +148 -0
- package/dist/browser/hooks/props.js.map +1 -0
- package/dist/browser/hooks/reads.js +241 -0
- package/dist/browser/hooks/reads.js.map +1 -0
- package/dist/browser/hooks/refs.js +87 -0
- package/dist/browser/hooks/refs.js.map +1 -0
- package/dist/browser/hooks/reorder-elements.js +268 -0
- package/dist/browser/hooks/reorder-elements.js.map +1 -0
- package/dist/browser/hooks/reorder.js +176 -0
- package/dist/browser/hooks/reorder.js.map +1 -0
- package/dist/browser/hooks/rune.js +799 -0
- package/dist/browser/hooks/rune.js.map +1 -0
- package/dist/browser/hooks/server-features.client.js +2 -0
- package/dist/browser/hooks/server-features.client.js.map +1 -0
- package/dist/browser/hooks/server-features.js +13 -0
- package/dist/browser/hooks/server-features.js.map +1 -0
- package/dist/browser/hooks/settings.js +29 -0
- package/dist/browser/hooks/settings.js.map +1 -0
- package/dist/browser/hooks/setup.js +154 -0
- package/dist/browser/hooks/setup.js.map +1 -0
- package/dist/browser/hooks/stage.js +117 -0
- package/dist/browser/hooks/stage.js.map +1 -0
- package/dist/browser/hooks/ward.js +2193 -0
- package/dist/browser/hooks/ward.js.map +1 -0
- package/dist/browser/hooks/wardic-provider.js +29 -0
- package/dist/browser/hooks/wardic-provider.js.map +1 -0
- package/dist/browser/hooks/wardic-scope.js +68 -0
- package/dist/browser/hooks/wardic-scope.js.map +1 -0
- package/dist/browser/hooks/wards.js +562 -0
- package/dist/browser/hooks/wards.js.map +1 -0
- package/dist/browser/index.js +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 +85 -70
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/reorder-components.js +50 -0
- package/dist/browser/reorder-components.js.map +1 -0
- package/dist/browser/reorder.js +46 -274
- package/dist/browser/reorder.js.map +1 -1
- package/dist/browser/stage.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 +576 -49
- 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/config-view.js +33 -5
- package/dist/server/config-view.js.map +1 -1
- package/dist/server/create-batch.js +1 -1
- package/dist/server/element-style.js +61 -7
- package/dist/server/element-style.js.map +1 -1
- package/dist/server/element.js +19 -2
- package/dist/server/element.js.map +1 -1
- package/dist/server/feature-section.js +5 -13
- package/dist/server/feature-section.js.map +1 -1
- package/dist/server/hooks/auto.js +270 -0
- package/dist/server/hooks/auto.js.map +1 -0
- package/dist/server/hooks/config-scope.js +120 -0
- package/dist/server/hooks/config-scope.js.map +1 -0
- package/dist/server/hooks/config.js +37 -0
- package/dist/server/hooks/config.js.map +1 -0
- package/dist/server/hooks/drag.js +632 -0
- package/dist/server/hooks/drag.js.map +1 -0
- package/dist/server/hooks/elements.js +192 -0
- package/dist/server/hooks/elements.js.map +1 -0
- package/dist/server/hooks/group.js +28 -0
- package/dist/server/hooks/group.js.map +1 -0
- package/dist/server/hooks/index.js +10 -0
- package/dist/server/hooks/index.js.map +1 -0
- package/dist/server/hooks/kept.js +32 -0
- package/dist/server/hooks/kept.js.map +1 -0
- package/dist/server/hooks/layout-group-of.js +39 -0
- package/dist/server/hooks/layout-group-of.js.map +1 -0
- package/dist/server/hooks/layout-group.js +109 -0
- package/dist/server/hooks/layout-group.js.map +1 -0
- package/dist/server/hooks/make-ward.js +157 -0
- package/dist/server/hooks/make-ward.js.map +1 -0
- package/dist/server/hooks/presence-scope.js +86 -0
- package/dist/server/hooks/presence-scope.js.map +1 -0
- package/dist/server/hooks/presence.js +24 -0
- package/dist/server/hooks/presence.js.map +1 -0
- package/dist/server/hooks/props.js +148 -0
- package/dist/server/hooks/props.js.map +1 -0
- package/dist/server/hooks/reads.js +241 -0
- package/dist/server/hooks/reads.js.map +1 -0
- package/dist/server/hooks/refs.js +87 -0
- package/dist/server/hooks/refs.js.map +1 -0
- package/dist/server/hooks/reorder-elements.js +308 -0
- package/dist/server/hooks/reorder-elements.js.map +1 -0
- package/dist/server/hooks/reorder.js +176 -0
- package/dist/server/hooks/reorder.js.map +1 -0
- package/dist/server/hooks/rune.js +799 -0
- package/dist/server/hooks/rune.js.map +1 -0
- package/dist/server/hooks/server-features.client.js +2 -0
- package/dist/server/hooks/server-features.client.js.map +1 -0
- package/dist/server/hooks/server-features.js +13 -0
- package/dist/server/hooks/server-features.js.map +1 -0
- package/dist/server/hooks/settings.js +29 -0
- package/dist/server/hooks/settings.js.map +1 -0
- package/dist/server/hooks/setup.js +154 -0
- package/dist/server/hooks/setup.js.map +1 -0
- package/dist/server/hooks/stage.js +117 -0
- package/dist/server/hooks/stage.js.map +1 -0
- package/dist/server/hooks/ward.js +2193 -0
- package/dist/server/hooks/ward.js.map +1 -0
- package/dist/server/hooks/wardic-provider.js +29 -0
- package/dist/server/hooks/wardic-provider.js.map +1 -0
- package/dist/server/hooks/wardic-scope.js +68 -0
- package/dist/server/hooks/wardic-scope.js.map +1 -0
- package/dist/server/hooks/wards.js +562 -0
- package/dist/server/hooks/wards.js.map +1 -0
- package/dist/server/index.js +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 +86 -80
- package/dist/server/provider.js.map +1 -1
- package/dist/server/reorder-components.js +50 -0
- package/dist/server/reorder-components.js.map +1 -0
- package/dist/server/reorder.js +46 -344
- package/dist/server/reorder.js.map +1 -1
- package/dist/server/stage.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 +576 -49
- package/dist/server/ward.js.map +1 -1
- package/dist/server/wardic-config.js +63 -30
- package/dist/server/wardic-config.js.map +1 -1
- package/dist/server/wardic-context.js +23 -0
- package/dist/server/wardic-context.js.map +1 -0
- package/dist/server/wardic.js +3 -0
- package/dist/server/wardic.js.map +1 -1
- package/dist/solid/batch-reorder-group.d.ts +1 -1
- package/dist/solid/batch-reorder.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 +29 -6
- package/dist/solid/config-view.js.map +1 -1
- package/dist/solid/create-batch.jsx +1 -1
- package/dist/solid/element-style.d.ts +16 -2
- package/dist/solid/element-style.d.ts.map +1 -1
- package/dist/solid/element-style.js +61 -7
- package/dist/solid/element-style.js.map +1 -1
- package/dist/solid/element.d.ts +3 -1
- package/dist/solid/element.d.ts.map +1 -1
- package/dist/solid/element.jsx +21 -2
- package/dist/solid/element.jsx.map +1 -1
- package/dist/solid/feature-section.d.ts +0 -7
- package/dist/solid/feature-section.d.ts.map +1 -1
- package/dist/solid/feature-section.js +5 -13
- package/dist/solid/feature-section.js.map +1 -1
- package/dist/solid/hooks/auto.d.ts +44 -0
- package/dist/solid/hooks/auto.d.ts.map +1 -0
- package/dist/solid/hooks/auto.js +269 -0
- package/dist/solid/hooks/auto.js.map +1 -0
- package/dist/solid/hooks/config-scope.d.ts +84 -0
- package/dist/solid/hooks/config-scope.d.ts.map +1 -0
- package/dist/solid/hooks/config-scope.jsx +128 -0
- package/dist/solid/hooks/config-scope.jsx.map +1 -0
- package/dist/solid/hooks/config.d.ts +28 -0
- package/dist/solid/hooks/config.d.ts.map +1 -0
- package/dist/solid/hooks/config.jsx +37 -0
- package/dist/solid/hooks/config.jsx.map +1 -0
- package/dist/solid/hooks/drag.d.ts +220 -0
- package/dist/solid/hooks/drag.d.ts.map +1 -0
- package/dist/solid/hooks/drag.js +585 -0
- package/dist/solid/hooks/drag.js.map +1 -0
- package/dist/solid/hooks/elements.d.ts +11 -0
- package/dist/solid/hooks/elements.d.ts.map +1 -0
- package/dist/solid/hooks/elements.jsx +218 -0
- package/dist/solid/hooks/elements.jsx.map +1 -0
- package/dist/solid/hooks/group.d.ts +46 -0
- package/dist/solid/hooks/group.d.ts.map +1 -0
- package/dist/solid/hooks/group.jsx +25 -0
- package/dist/solid/hooks/group.jsx.map +1 -0
- package/dist/solid/hooks/index.d.ts +28 -0
- package/dist/solid/hooks/index.d.ts.map +1 -0
- package/dist/solid/hooks/index.js +10 -0
- package/dist/solid/hooks/index.js.map +1 -0
- package/dist/solid/hooks/kept.d.ts +60 -0
- package/dist/solid/hooks/kept.d.ts.map +1 -0
- package/dist/solid/hooks/kept.js +33 -0
- package/dist/solid/hooks/kept.js.map +1 -0
- package/dist/solid/hooks/layout-group-of.d.ts +27 -0
- package/dist/solid/hooks/layout-group-of.d.ts.map +1 -0
- package/dist/solid/hooks/layout-group-of.js +39 -0
- package/dist/solid/hooks/layout-group-of.js.map +1 -0
- package/dist/solid/hooks/layout-group.d.ts +60 -0
- package/dist/solid/hooks/layout-group.d.ts.map +1 -0
- package/dist/solid/hooks/layout-group.jsx +80 -0
- package/dist/solid/hooks/layout-group.jsx.map +1 -0
- package/dist/solid/hooks/make-ward.d.ts +123 -0
- package/dist/solid/hooks/make-ward.d.ts.map +1 -0
- package/dist/solid/hooks/make-ward.js +147 -0
- package/dist/solid/hooks/make-ward.js.map +1 -0
- package/dist/solid/hooks/presence-scope.d.ts +84 -0
- package/dist/solid/hooks/presence-scope.d.ts.map +1 -0
- package/dist/solid/hooks/presence-scope.jsx +62 -0
- package/dist/solid/hooks/presence-scope.jsx.map +1 -0
- package/dist/solid/hooks/presence.d.ts +51 -0
- package/dist/solid/hooks/presence.d.ts.map +1 -0
- package/dist/solid/hooks/presence.jsx +26 -0
- package/dist/solid/hooks/presence.jsx.map +1 -0
- package/dist/solid/hooks/props.d.ts +52 -0
- package/dist/solid/hooks/props.d.ts.map +1 -0
- package/dist/solid/hooks/props.js +140 -0
- package/dist/solid/hooks/props.js.map +1 -0
- package/dist/solid/hooks/reads.d.ts +38 -0
- package/dist/solid/hooks/reads.d.ts.map +1 -0
- package/dist/solid/hooks/reads.js +218 -0
- package/dist/solid/hooks/reads.js.map +1 -0
- package/dist/solid/hooks/refs.d.ts +25 -0
- package/dist/solid/hooks/refs.d.ts.map +1 -0
- package/dist/solid/hooks/refs.js +89 -0
- package/dist/solid/hooks/refs.js.map +1 -0
- package/dist/solid/hooks/reorder-elements.d.ts +23 -0
- package/dist/solid/hooks/reorder-elements.d.ts.map +1 -0
- package/dist/solid/hooks/reorder-elements.jsx +273 -0
- package/dist/solid/hooks/reorder-elements.jsx.map +1 -0
- package/dist/solid/hooks/reorder.d.ts +55 -0
- package/dist/solid/hooks/reorder.d.ts.map +1 -0
- package/dist/solid/hooks/reorder.js +152 -0
- package/dist/solid/hooks/reorder.js.map +1 -0
- package/dist/solid/hooks/rune.d.ts +885 -0
- package/dist/solid/hooks/rune.d.ts.map +1 -0
- package/dist/solid/hooks/rune.js +816 -0
- package/dist/solid/hooks/rune.js.map +1 -0
- package/dist/solid/hooks/server-features.client.d.ts +10 -0
- package/dist/solid/hooks/server-features.client.d.ts.map +1 -0
- package/dist/solid/hooks/server-features.client.js +2 -0
- package/dist/solid/hooks/server-features.client.js.map +1 -0
- package/dist/solid/hooks/server-features.d.ts +10 -0
- package/dist/solid/hooks/server-features.d.ts.map +1 -0
- package/dist/solid/hooks/server-features.js +13 -0
- package/dist/solid/hooks/server-features.js.map +1 -0
- package/dist/solid/hooks/settings.d.ts +11 -0
- package/dist/solid/hooks/settings.d.ts.map +1 -0
- package/dist/solid/hooks/settings.js +31 -0
- package/dist/solid/hooks/settings.js.map +1 -0
- package/dist/solid/hooks/setup.d.ts +31 -0
- package/dist/solid/hooks/setup.d.ts.map +1 -0
- package/dist/solid/hooks/setup.js +155 -0
- package/dist/solid/hooks/setup.js.map +1 -0
- package/dist/solid/hooks/stage.d.ts +187 -0
- package/dist/solid/hooks/stage.d.ts.map +1 -0
- package/dist/solid/hooks/stage.js +117 -0
- package/dist/solid/hooks/stage.js.map +1 -0
- package/dist/solid/hooks/ward.d.ts +394 -0
- package/dist/solid/hooks/ward.d.ts.map +1 -0
- package/dist/solid/hooks/ward.js +2237 -0
- package/dist/solid/hooks/ward.js.map +1 -0
- package/dist/solid/hooks/wardic-provider.d.ts +32 -0
- package/dist/solid/hooks/wardic-provider.d.ts.map +1 -0
- package/dist/solid/hooks/wardic-provider.jsx +29 -0
- package/dist/solid/hooks/wardic-provider.jsx.map +1 -0
- package/dist/solid/hooks/wardic-scope.d.ts +49 -0
- package/dist/solid/hooks/wardic-scope.d.ts.map +1 -0
- package/dist/solid/hooks/wardic-scope.jsx +63 -0
- package/dist/solid/hooks/wardic-scope.jsx.map +1 -0
- package/dist/solid/hooks/wards.d.ts +157 -0
- package/dist/solid/hooks/wards.d.ts.map +1 -0
- package/dist/solid/hooks/wards.js +522 -0
- package/dist/solid/hooks/wards.js.map +1 -0
- package/dist/solid/index.d.ts +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 +86 -62
- package/dist/solid/provider.jsx.map +1 -1
- package/dist/solid/reorder-components.d.ts +32 -0
- package/dist/solid/reorder-components.d.ts.map +1 -0
- package/dist/solid/reorder-components.jsx +49 -0
- package/dist/solid/reorder-components.jsx.map +1 -0
- package/dist/solid/reorder.d.ts +50 -76
- package/dist/solid/reorder.d.ts.map +1 -1
- package/dist/solid/reorder.jsx +40 -202
- package/dist/solid/reorder.jsx.map +1 -1
- package/dist/solid/stage.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 +546 -48
- package/dist/solid/ward.jsx.map +1 -1
- package/dist/solid/wardic-config.d.ts +17 -12
- package/dist/solid/wardic-config.d.ts.map +1 -1
- package/dist/solid/wardic-config.jsx +68 -22
- package/dist/solid/wardic-config.jsx.map +1 -1
- package/dist/solid/wardic-context.d.ts +15 -0
- package/dist/solid/wardic-context.d.ts.map +1 -0
- package/dist/solid/wardic-context.js +23 -0
- package/dist/solid/wardic-context.js.map +1 -0
- package/dist/solid/wardic-instance.d.ts +6 -4
- package/dist/solid/wardic-instance.d.ts.map +1 -1
- package/dist/solid/wardic.d.ts +3 -0
- package/dist/solid/wardic.d.ts.map +1 -1
- package/dist/solid/wardic.jsx +3 -0
- package/dist/solid/wardic.jsx.map +1 -1
- package/package.json +26 -6
- package/src/batch-reorder-group.tsx +1 -1
- package/src/batch-reorder.ts +1 -1
- package/src/config-view.ts +30 -6
- package/src/create-batch.tsx +1 -1
- package/src/element-style.ts +77 -9
- package/src/element.tsx +25 -4
- package/src/feature-section.ts +5 -15
- package/src/hooks/auto.ts +303 -0
- package/src/hooks/config-scope.tsx +215 -0
- package/src/hooks/config.tsx +54 -0
- package/src/hooks/drag.ts +740 -0
- package/src/hooks/elements.tsx +234 -0
- package/src/hooks/group.tsx +55 -0
- package/src/hooks/index.ts +41 -0
- package/src/hooks/kept.ts +89 -0
- package/src/hooks/layout-group-of.ts +46 -0
- package/src/hooks/layout-group.tsx +111 -0
- package/src/hooks/make-ward.ts +218 -0
- package/src/hooks/presence-scope.tsx +155 -0
- package/src/hooks/presence.tsx +67 -0
- package/src/hooks/props.ts +190 -0
- package/src/hooks/reads.ts +258 -0
- package/src/hooks/refs.ts +114 -0
- package/src/hooks/reorder-elements.tsx +321 -0
- package/src/hooks/reorder.ts +205 -0
- package/src/hooks/rune.ts +1755 -0
- package/src/hooks/server-features.client.ts +10 -0
- package/src/hooks/server-features.ts +12 -0
- package/src/hooks/settings.ts +44 -0
- package/src/hooks/setup.ts +184 -0
- package/src/hooks/stage.ts +359 -0
- package/src/hooks/ward.ts +2563 -0
- package/src/hooks/wardic-provider.tsx +51 -0
- package/src/hooks/wardic-scope.tsx +112 -0
- package/src/hooks/wards.ts +679 -0
- package/src/index.tsx +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 +96 -71
- package/src/reorder-components.tsx +61 -0
- package/src/reorder.tsx +84 -303
- 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 +674 -48
- package/src/wardic-config.tsx +68 -21
- package/src/wardic-context.ts +26 -0
- package/src/wardic-instance.ts +6 -4
- package/src/wardic.tsx +3 -0
- package/dist/browser/create-wardic.js +0 -36
- package/dist/browser/create-wardic.js.map +0 -1
- package/dist/browser/presence-hooks.js +0 -144
- package/dist/browser/presence-hooks.js.map +0 -1
- package/dist/server/create-wardic.js +0 -36
- package/dist/server/create-wardic.js.map +0 -1
- package/dist/server/presence-hooks.js +0 -144
- package/dist/server/presence-hooks.js.map +0 -1
- package/dist/solid/create-wardic.d.ts +0 -25
- package/dist/solid/create-wardic.d.ts.map +0 -1
- package/dist/solid/create-wardic.jsx +0 -34
- package/dist/solid/create-wardic.jsx.map +0 -1
- package/dist/solid/presence-hooks.d.ts +0 -53
- package/dist/solid/presence-hooks.d.ts.map +0 -1
- package/dist/solid/presence-hooks.jsx +0 -117
- package/dist/solid/presence-hooks.jsx.map +0 -1
- package/src/create-wardic.tsx +0 -46
- package/src/presence-hooks.tsx +0 -159
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `w.<tag>` (probe: hooks-first, the gap grill's Q27): an element with a ward on it, built from what
|
|
3
|
+
* the hooks' entry exports alone, as an app would build one. A utility, not a primitive: `createWard`
|
|
4
|
+
* is the primitive, and this is the shorthand today's elements were.
|
|
5
|
+
*
|
|
6
|
+
* - Its motion props, the ones it was made with, are one rune: each key read through its prop, so a
|
|
7
|
+
* prop that changes is followed, and a key given only later isn't one (Q27: its keys are fixed as
|
|
8
|
+
* it's made, as every ward's are). `style` is in it too, laid over the ward's own.
|
|
9
|
+
* - `runes`, beside them, and, for an SVG element, its `tag`, routing its attributes as attributes (Q22).
|
|
10
|
+
* - The user's `ref` beside the ward's, and `wardRef`, handed the ward once it's made.
|
|
11
|
+
* - `ward.Provider` round its children where its props change what they read (its own `variants`, a
|
|
12
|
+
* name on a variant prop, or `inherit: false`), so the wards inside it follow its names without a
|
|
13
|
+
* `follow` of their own: the one place they do.
|
|
14
|
+
*
|
|
15
|
+
* What it doesn't do, each a decision of the gap grill's: a ward given to `wardRef` to drive, a
|
|
16
|
+
* `WardicConfig`'s `isValidProp`, and `forwardMotionProps` (Q28).
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { dynamic, isServer, type JSX, SVGElements } from "@solidjs/web"
|
|
21
|
+
import * as Arr from "effect/Array"
|
|
22
|
+
import * as Bool from "effect/Boolean"
|
|
23
|
+
import * as Predicate from "effect/Predicate"
|
|
24
|
+
import { $PROXY, type Component, createMemo, createRoot, isHydrating, omit, runWithOwner, untrack } from "solid-js"
|
|
25
|
+
import { useConfigScope } from "./config-scope.tsx"
|
|
26
|
+
import type { Rune } from "./rune.ts"
|
|
27
|
+
import type { HookWardOf } from "./ward.ts"
|
|
28
|
+
|
|
29
|
+
/** Every motion prop a Solid 2 element takes: today's, read off its props into its rune. */
|
|
30
|
+
const MOTION_KEYS: ReadonlyArray<string> = [
|
|
31
|
+
"initial",
|
|
32
|
+
"animate",
|
|
33
|
+
"variants",
|
|
34
|
+
"custom",
|
|
35
|
+
"inherit",
|
|
36
|
+
"whileHover",
|
|
37
|
+
"whileTap",
|
|
38
|
+
"propagate",
|
|
39
|
+
"whileFocus",
|
|
40
|
+
"whileInView",
|
|
41
|
+
"viewport",
|
|
42
|
+
"exit",
|
|
43
|
+
"drag",
|
|
44
|
+
"whileDrag",
|
|
45
|
+
"dragConstraints",
|
|
46
|
+
"dragElastic",
|
|
47
|
+
"dragMomentum",
|
|
48
|
+
"dragSnapToOrigin",
|
|
49
|
+
"dragTransition",
|
|
50
|
+
"dragPropagation",
|
|
51
|
+
"dragDirectionLock",
|
|
52
|
+
"dragControls",
|
|
53
|
+
"dragListener",
|
|
54
|
+
"onMeasureDragConstraints",
|
|
55
|
+
"layout",
|
|
56
|
+
"layoutDependency",
|
|
57
|
+
"layoutId",
|
|
58
|
+
"layoutScroll",
|
|
59
|
+
"layoutRoot",
|
|
60
|
+
"layoutAnchor",
|
|
61
|
+
"layoutCrossfade",
|
|
62
|
+
"onUpdate",
|
|
63
|
+
"transformTemplate",
|
|
64
|
+
"onBeforeLayoutMeasure",
|
|
65
|
+
"onLayoutMeasure",
|
|
66
|
+
"appear",
|
|
67
|
+
"transition",
|
|
68
|
+
"key",
|
|
69
|
+
"style",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
/** What an element keeps for itself: its motion props, and its `ref`, `runes` and `wardRef`. */
|
|
73
|
+
const KEPT_KEYS: ReadonlyArray<string> = [...MOTION_KEYS, "ref", "runes", "wardRef"]
|
|
74
|
+
|
|
75
|
+
/** The variant props a name on which changes what an element's children read. */
|
|
76
|
+
const NAMED_KEYS: ReadonlyArray<string> = ["initial", "animate", "exit", "whileHover", "whileTap", "whileFocus", "whileInView", "whileDrag"]
|
|
77
|
+
|
|
78
|
+
/** A variant name, or a list of them. */
|
|
79
|
+
const isName = (value: unknown): boolean => Predicate.isString(value) || Array.isArray(value)
|
|
80
|
+
|
|
81
|
+
/** The props an element takes beside its tag's own. */
|
|
82
|
+
interface ElementProps {
|
|
83
|
+
readonly ref?: unknown
|
|
84
|
+
readonly runes?: Rune | ReadonlyArray<Rune> | undefined
|
|
85
|
+
readonly wardRef?: ((ward: unknown) => void) | undefined
|
|
86
|
+
readonly inherit?: boolean | undefined
|
|
87
|
+
readonly children?: JSX.Element
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The keys whose value is a function as it's given, never an accessor of it (the hooks' `AS_GIVEN`), and
|
|
92
|
+
* `custom`, which a variant's resolver may take as a function: each read through its prop as it is.
|
|
93
|
+
*/
|
|
94
|
+
const AS_GIVEN: ReadonlySet<string> = new Set(["onUpdate", "dragConstraints", "onMeasureDragConstraints", "transformTemplate", "onBeforeLayoutMeasure", "onLayoutMeasure", "custom"])
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `props`' motion props, the ones it has now, as one rune, written as the hooks read a rune fastest: a
|
|
98
|
+
* prop given as a value, its value; one that follows a signal (a getter of Solid's), an accessor of it,
|
|
99
|
+
* read where the ward reads it. A key read through a getter was read again for each look the ward took
|
|
100
|
+
* at it, and a retarget cost a tenth more than the same ward spread on an element (the gap grill's Q27).
|
|
101
|
+
* A function a key takes as its value, and props a parent spread whose keys can change (Solid's proxy),
|
|
102
|
+
* are read through their getters, as they were.
|
|
103
|
+
*/
|
|
104
|
+
const runeOf = (props: Readonly<Record<string, unknown>>, tag: string): Rune => {
|
|
105
|
+
// Its tag where it routes keys: an SVG element's, as `dynamic()` tells one (Solid's `SVGElements`). An
|
|
106
|
+
// HTML element's routes as none does, and a rune naming one is joined, not taken as it's written: a
|
|
107
|
+
// `w.div` cost a fifth more to unmount than the same ward spread on an element.
|
|
108
|
+
const rune: Record<string, unknown> = Bool.match(SVGElements.has(tag), { onTrue: () => ({ tag }), onFalse: () => ({}) })
|
|
109
|
+
const proxied = $PROXY in props
|
|
110
|
+
Arr.forEach(MOTION_KEYS, (key) => {
|
|
111
|
+
if (!(key in props)) return
|
|
112
|
+
// A prop given as a value: its value.
|
|
113
|
+
if (Bool.and(Bool.not(proxied), isGivenAsValue(Object.getOwnPropertyDescriptor(props, key)))) {
|
|
114
|
+
rune[key] = props[key]
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
// One that follows a signal: an accessor of it, where a function is read as one.
|
|
118
|
+
if (Bool.and(Bool.not(proxied), Bool.not(AS_GIVEN.has(key)))) {
|
|
119
|
+
rune[key] = () => props[key]
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
Object.defineProperty(rune, key, { enumerable: true, get: () => props[key] })
|
|
123
|
+
})
|
|
124
|
+
return rune as Rune
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Whether a prop is a value as it's given, not a getter of Solid's that follows a signal. */
|
|
128
|
+
const isGivenAsValue = (given: PropertyDescriptor | undefined): boolean => Predicate.isNotUndefined(given) && Bool.not(Predicate.isFunction(given.get))
|
|
129
|
+
|
|
130
|
+
/** Whether an element's props, as it's made (`given`, read once), change what its children read: so its ward's Provider goes round them. */
|
|
131
|
+
const changesWhatChildrenRead = (given: Readonly<Record<string, unknown>>): boolean => {
|
|
132
|
+
if ("variants" in given) return true
|
|
133
|
+
if (given["inherit"] === false) return true
|
|
134
|
+
return Arr.some(NAMED_KEYS, (key) => isName(given[key]))
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The element's refs: the user's, one or a list, then the ward's. Read once, as Solid reads a `ref`.
|
|
139
|
+
*/
|
|
140
|
+
const refsOf = (given: unknown, ward: unknown): ReadonlyArray<unknown> => Arr.append(Arr.filter(Arr.flatten([Arr.ensure(given)]), Predicate.isNotUndefined), ward)
|
|
141
|
+
|
|
142
|
+
/** `ward`'s enumerable own keys, each with its descriptor, so its `style` stays a getter: what a spread of it reads. */
|
|
143
|
+
const spreadOf = (ward: object): Readonly<Record<string, unknown>> => {
|
|
144
|
+
const spread: Record<string, unknown> = {}
|
|
145
|
+
Arr.forEach(Object.keys(ward), (key) => {
|
|
146
|
+
const descriptor = Object.getOwnPropertyDescriptor(ward, key)
|
|
147
|
+
if (Predicate.isNotUndefined(descriptor)) Object.defineProperty(spread, key, descriptor)
|
|
148
|
+
})
|
|
149
|
+
return spread
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* A tag's plain element, made once and kept: its tag never changes, so a static `dynamic()` makes no
|
|
154
|
+
* memo over it. A server's render holds what it renders in a memo of its own, so a pending child waits
|
|
155
|
+
* there; a browser hydrating renders under a plain owner, which takes the hydration id the server's
|
|
156
|
+
* memo took. A browser not hydrating takes no id, and renders under the component's own owner: an owner
|
|
157
|
+
* more an element cost its unmount (the gap grill's Q27).
|
|
158
|
+
*/
|
|
159
|
+
const plainElementOf = (tag: string): Component<Record<string, unknown>> => {
|
|
160
|
+
const render = dynamic(() => tag, { static: true })
|
|
161
|
+
return (props) => {
|
|
162
|
+
if (isServer) return createMemo(() => render(props)) as unknown as JSX.Element
|
|
163
|
+
if (isHydrating()) return createRoot(() => render(props))
|
|
164
|
+
return render(props)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Its props without those the config scope around keeps off it (the scopes round's Q7): those its
|
|
170
|
+
* `isValidProp` refuses, never one starting with `on`. Asked once, as the element is made, for the props
|
|
171
|
+
* it has then, as today's `wardic.<tag>` asks; none kept off where no scope is around, or it refuses none.
|
|
172
|
+
*/
|
|
173
|
+
const shownOf = (rest: Record<string, unknown>): Record<string, unknown> => {
|
|
174
|
+
const scope = useConfigScope()
|
|
175
|
+
if (Predicate.isUndefined(scope)) return rest
|
|
176
|
+
const valid = untrack(scope.isValidProp)
|
|
177
|
+
if (Predicate.isUndefined(valid)) return rest
|
|
178
|
+
// Never asked of a prop starting with `on`: checked first, in an `if`, as `Bool.and` would read both.
|
|
179
|
+
const refused = untrack(() =>
|
|
180
|
+
Arr.filter(Object.keys(rest), (key) => {
|
|
181
|
+
if (key.startsWith("on")) return false
|
|
182
|
+
return Bool.not(valid(key))
|
|
183
|
+
}),
|
|
184
|
+
)
|
|
185
|
+
if (Arr.isReadonlyArrayEmpty(refused)) return rest
|
|
186
|
+
return omit(rest, ...refused)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** `w.<tag>`: the element named `tag`, its ward made by `createWard`. */
|
|
190
|
+
const elementOf = (tag: string, createWard: HookWardOf): Component<Record<string, unknown>> => {
|
|
191
|
+
const Element = plainElementOf(tag)
|
|
192
|
+
// Its runes are made as it renders, whatever its tag: a ward of them.
|
|
193
|
+
const wardOf = createWard as unknown as (...runes: ReadonlyArray<Rune>) => ReturnType<HookWardOf>
|
|
194
|
+
return (props) => {
|
|
195
|
+
const own = props as ElementProps & Readonly<Record<string, unknown>>
|
|
196
|
+
const given = untrack(() => own.runes)
|
|
197
|
+
const runes = Arr.filter(Arr.ensure(given), Predicate.isNotUndefined) as ReadonlyArray<Rune>
|
|
198
|
+
const ward = untrack(() => wardOf(runeOf(props, tag), ...runes))
|
|
199
|
+
const wardRef = untrack(() => own.wardRef)
|
|
200
|
+
if (Predicate.isFunction(wardRef)) wardRef(ward)
|
|
201
|
+
// Its own keys as they're spread, `style` a getter still: what `{...ward}` puts on an element. Its
|
|
202
|
+
// enumerable ones alone: a function's own `name` and `length` aren't, and would land on the element.
|
|
203
|
+
const spread = spreadOf(ward)
|
|
204
|
+
const rest = shownOf(omit(props, ...KEPT_KEYS))
|
|
205
|
+
const refs = refsOf(untrack(() => own.ref), ward)
|
|
206
|
+
const element = (): JSX.Element => <Element {...rest} {...spread} ref={refs} />
|
|
207
|
+
return Bool.match(untrack(() => changesWhatChildrenRead(props)), {
|
|
208
|
+
onFalse: element,
|
|
209
|
+
onTrue: () => <ward.Provider>{element()}</ward.Provider>,
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Every tag's element, each made by `createWard` as it's first used: what a `w` gives as `w.<tag>`. */
|
|
215
|
+
export type ElementsOf = Readonly<Record<string, Component<Record<string, unknown>>>>
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* `w.<tag>` for every tag, each element's ward made by `createWard`: the hooks' own, or a `makeWard`'s.
|
|
219
|
+
* Each tag's component is made on its first use and kept, outside any owner, so a server's later
|
|
220
|
+
* requests and a page's hydration count the same ids.
|
|
221
|
+
*/
|
|
222
|
+
export const elementsOf = (createWard: HookWardOf): ElementsOf => {
|
|
223
|
+
const made = new Map<string, Component<Record<string, unknown>>>()
|
|
224
|
+
return new Proxy({} as ElementsOf, {
|
|
225
|
+
get(_, prop) {
|
|
226
|
+
if (!Predicate.isString(prop)) return undefined
|
|
227
|
+
const known = made.get(prop)
|
|
228
|
+
if (Predicate.isNotUndefined(known)) return known
|
|
229
|
+
const component = runWithOwner(null, () => elementOf(prop, createWard))
|
|
230
|
+
made.set(prop, component)
|
|
231
|
+
return component
|
|
232
|
+
},
|
|
233
|
+
})
|
|
234
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<LayoutGroup>` (probe: behaviour-runes, the scopes round, the gap grill's Q44): a utility over
|
|
3
|
+
* `createLayoutGroup`, built from the hooks' public names alone (HU1), as an app could write it. Its `id`
|
|
4
|
+
* and `inherit` are read once, as it mounts; its `layoutDependency` is followed; what it's around is built
|
|
5
|
+
* inside the group's `within`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { JSX } from "@solidjs/web"
|
|
10
|
+
import { untrack } from "solid-js"
|
|
11
|
+
import { createLayoutGroup, type LayoutGroupOptions } from "./layout-group.tsx"
|
|
12
|
+
|
|
13
|
+
/** `<LayoutGroup>`'s props, as Solid 1's. */
|
|
14
|
+
export interface LayoutGroupProps {
|
|
15
|
+
readonly children?: JSX.Element
|
|
16
|
+
/**
|
|
17
|
+
* An id put before every `layoutId` made under it: under `<LayoutGroup id="tabs">`, a
|
|
18
|
+
* `layoutId="underline"` is `tabs-underline`, so two copies of a component that uses a `layoutId`
|
|
19
|
+
* keep their own. Read once, as it mounts.
|
|
20
|
+
*/
|
|
21
|
+
readonly id?: string | undefined
|
|
22
|
+
/**
|
|
23
|
+
* Whether it joins the id of the group it's in: `true` (the default) and `"id"` both do, making
|
|
24
|
+
* `outer-inner`, or taking the outer id when it has none of its own; `false` starts afresh. Read
|
|
25
|
+
* once, as it mounts.
|
|
26
|
+
*/
|
|
27
|
+
// Motion's `true` also joins the outer group's re-measure, which every Measure pass here already is:
|
|
28
|
+
// it reads the whole tree.
|
|
29
|
+
readonly inherit?: LayoutGroupOptions["inherit"]
|
|
30
|
+
/** A value whose change has every layout element measured again, for a change nothing else sees. */
|
|
31
|
+
readonly layoutDependency?: unknown
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Puts an id before every `layoutId` made under it, so two copies of a component that uses a
|
|
36
|
+
* `layoutId` keep their own: under `<LayoutGroup id="tabs">`, `layoutId="underline"` is
|
|
37
|
+
* `tabs-underline`. Its `layoutDependency` has every layout element measured again when it changes.
|
|
38
|
+
* Motion's `LayoutGroup`.
|
|
39
|
+
*
|
|
40
|
+
* A ward is in the group it's made under: one made in a component body, and given to an element
|
|
41
|
+
* inside a `<LayoutGroup>` there, is outside it. Make it in a component under the group, or give it
|
|
42
|
+
* the group as a rune (`createLayoutGroup`).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <LayoutGroup id="tabs">
|
|
46
|
+
* <Tabs />
|
|
47
|
+
* </LayoutGroup>
|
|
48
|
+
* @see https://wardic.dev/reference/solid/layout/layout-group
|
|
49
|
+
*/
|
|
50
|
+
export function LayoutGroup(props: LayoutGroupProps): JSX.Element {
|
|
51
|
+
// Its id and `inherit`, read once as it mounts; its dependency read where the group follows it.
|
|
52
|
+
const group = untrack(() => createLayoutGroup(props.id, { inherit: props.inherit, layoutDependency: () => props.layoutDependency }))
|
|
53
|
+
// eslint-disable-next-line solid/reactivity -- read inside `within`'s JSX, where it tracks, as today's `{props.children}` was
|
|
54
|
+
return group.within(() => props.children)
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hooks-first API for Solid 2 (probe: hooks-first), in one entry: `createWard`, `createWards` and
|
|
3
|
+
* `createPresence`, which need nothing set up; the layout hooks; `createRune`; `<Presence>`, the one
|
|
4
|
+
* boundary, with `createPresenceRef` for its exits; and `makeWard`, for a page that
|
|
5
|
+
* gives its own settings or Features, with `elements` for one that returns `w` too. Not in the
|
|
6
|
+
* package's `exports`: an app in this repo reaches it by an alias to this file.
|
|
7
|
+
*
|
|
8
|
+
* A ward is made where its Subject is drawn, in a component's body or a row's callback, and a rune
|
|
9
|
+
* once, for what it describes: an app's hooks hold state and give runes, never a ward (`createWard`,
|
|
10
|
+
* `createRune`).
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
export type { AutoFeature } from "./auto.ts"
|
|
15
|
+
export { type ConfigScope, type ConfigScopeApi, type ConfigSettings, createConfigScope, useConfigScope } from "./config-scope.tsx"
|
|
16
|
+
export { createGrip, type DraggingWard, type KeyOptions, type Measured, type WardDrag } from "./drag.ts"
|
|
17
|
+
export {
|
|
18
|
+
createInstantLayoutTransition,
|
|
19
|
+
createPresence,
|
|
20
|
+
createResetProjection,
|
|
21
|
+
createWard,
|
|
22
|
+
createWards,
|
|
23
|
+
type Elements,
|
|
24
|
+
elements,
|
|
25
|
+
type MadeWard,
|
|
26
|
+
makeWard,
|
|
27
|
+
type MakeWardOptions,
|
|
28
|
+
type MakeWardSettings,
|
|
29
|
+
setupWard,
|
|
30
|
+
useAnimateLayout,
|
|
31
|
+
} from "./make-ward.ts"
|
|
32
|
+
export { createLayoutGroup, type HookLayoutGroup, type LayoutGroupApi, type LayoutGroupOptions } from "./layout-group.tsx"
|
|
33
|
+
export { createWardicScope, type WardicScope, type WardicScopeOptions } from "./wardic-scope.tsx"
|
|
34
|
+
export { createRune, createRuneWith, type Followers, type FunctionRune, type PageKeys, type Rune, type RuneConfig, type RuneVariant, type RuneWard, type RuneWith, type PopCorner, type WardicKeys } from "./rune.ts"
|
|
35
|
+
export { Presence, type PresenceProps } from "./presence.tsx"
|
|
36
|
+
export { createPresenceRef, createPresenceScope, type PresenceRef, type PresenceScope, type PresenceScopeOptions } from "./presence-scope.tsx"
|
|
37
|
+
export type { WardReads } from "./reads.ts"
|
|
38
|
+
export { createReorder, type HookReorderOf, type ReorderList, type ReorderSource } from "./reorder.ts"
|
|
39
|
+
export type { PageOptions } from "./setup.ts"
|
|
40
|
+
export type { ExitEvent, ExitEvents, HookWard, HookWardOf } from "./ward.ts"
|
|
41
|
+
export type { AffectsLayout, HookPresenceOf, HookWardsOf, Leaving, PresenceSource, Row, RowRune, RowWard, StagePresenceSource, WardsSource, WardsValue } from "./wards.ts"
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the hooks keep of a ward they made (probe: hooks-first): one record a ward, on the ward's own
|
|
3
|
+
* state, read by the members every ward shares.
|
|
4
|
+
*
|
|
5
|
+
* A ward was given each of those members as a property of its own, twelve to a ward, by whichever
|
|
6
|
+
* hook made it: `mounted`, `shown` and `exiting`, its six reads, and its own `when`, `next` and
|
|
7
|
+
* `each`. They're now on the prototype every client ward has (`shareMembers`, `ward.tsx`), each a
|
|
8
|
+
* getter over this record, so a ward carries nothing for them and what's never read is never made.
|
|
9
|
+
*
|
|
10
|
+
* A ward with no state of its own has no record and keeps them as its own properties, as every
|
|
11
|
+
* ward did: a server's, and a Stage's.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type * as Feature from "@wardic/dom/unstable/Feature"
|
|
16
|
+
import * as Predicate from "effect/Predicate"
|
|
17
|
+
import type { Accessor, Owner } from "solid-js"
|
|
18
|
+
import { hooksOf, keepForHooks } from "../ward.tsx"
|
|
19
|
+
import type { AutoFeature } from "./auto.ts"
|
|
20
|
+
import type { Ready, ShowState, Takeable, Watched } from "./ward.ts"
|
|
21
|
+
|
|
22
|
+
/** A ward with no `show` that no presence has taken: on the page, and shown. */
|
|
23
|
+
export const ALWAYS: Accessor<boolean> = () => true
|
|
24
|
+
|
|
25
|
+
/** One of a ward's `when`, `next` and `each`, as the hooks give it. */
|
|
26
|
+
export type Listening = (event: string) => unknown
|
|
27
|
+
|
|
28
|
+
/** What the hooks keep of one ward. Every field is there from the start, so every record has one shape. */
|
|
29
|
+
export interface Kept {
|
|
30
|
+
/** Whether its element belongs on the page. */
|
|
31
|
+
mounted: Accessor<boolean>
|
|
32
|
+
/** Whether it's shown. */
|
|
33
|
+
shown: Accessor<boolean>
|
|
34
|
+
/** `exiting`, made at its first read. */
|
|
35
|
+
exiting: Accessor<boolean> | undefined
|
|
36
|
+
/** How it asks for a Feature as one is first used: none for a ward with no Features of its own (a Reorder's row). */
|
|
37
|
+
ask: ((name: AutoFeature) => void) | undefined
|
|
38
|
+
/** Its own Features, with `ask`. */
|
|
39
|
+
instance: Feature.InstanceFeatures | undefined
|
|
40
|
+
/** The owner it was made under: what a read or its readiness makes later goes under it. */
|
|
41
|
+
owner: Owner | null
|
|
42
|
+
/** Its own `when`, made at its first read; `next` and `each` the same. */
|
|
43
|
+
when: Listening | undefined
|
|
44
|
+
next: Listening | undefined
|
|
45
|
+
each: Listening | undefined
|
|
46
|
+
/** Its readiness, made the first time `"ready"` is asked for. */
|
|
47
|
+
ready: Ready | undefined
|
|
48
|
+
/** What a presence takes it by, once: for a ward one may take. */
|
|
49
|
+
take: Takeable | undefined
|
|
50
|
+
/** Its `hold`, made at its first read. */
|
|
51
|
+
hold: (() => () => void) | undefined
|
|
52
|
+
/** Brings its exits up to date, where they're told. */
|
|
53
|
+
exits: (() => void) | undefined
|
|
54
|
+
/** Its `show`'s state, where it has one. */
|
|
55
|
+
show: ShowState | undefined
|
|
56
|
+
/** Whether the next element it's given enters afresh, from its `initial`: said by the presence that took it. */
|
|
57
|
+
fresh: boolean
|
|
58
|
+
/** What it hears of its child's leave from the presence it was made under, where it was (`watchedUnder`). */
|
|
59
|
+
watched: Watched | undefined
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** What the hooks keep of `ward`, one with a state of its own: none for a ward they didn't make. */
|
|
63
|
+
export const keptFor = (ward: object): Kept | undefined => hooksOf(ward) as Kept | undefined
|
|
64
|
+
|
|
65
|
+
/** What the hooks keep of `ward`, one with a state of its own: begun here the first time, for a ward they're making. */
|
|
66
|
+
export const keptOf = (ward: object): Kept => {
|
|
67
|
+
const known = keptFor(ward)
|
|
68
|
+
if (Predicate.isNotUndefined(known)) return known
|
|
69
|
+
const kept: Kept = {
|
|
70
|
+
mounted: ALWAYS,
|
|
71
|
+
shown: ALWAYS,
|
|
72
|
+
exiting: undefined,
|
|
73
|
+
ask: undefined,
|
|
74
|
+
instance: undefined,
|
|
75
|
+
owner: null,
|
|
76
|
+
when: undefined,
|
|
77
|
+
next: undefined,
|
|
78
|
+
each: undefined,
|
|
79
|
+
ready: undefined,
|
|
80
|
+
take: undefined,
|
|
81
|
+
hold: undefined,
|
|
82
|
+
exits: undefined,
|
|
83
|
+
show: undefined,
|
|
84
|
+
fresh: false,
|
|
85
|
+
watched: undefined,
|
|
86
|
+
}
|
|
87
|
+
keepForHooks(ward, kept)
|
|
88
|
+
return kept
|
|
89
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which layout group a hook ward is in (probe: behaviour-runes, the scopes round's Q44): each group's id
|
|
3
|
+
* and `inherit`, kept by the group `createLayoutGroup` makes (`layout-group.tsx`), and found among a
|
|
4
|
+
* ward's runes as it's made. Apart from the group's own module, so what every hook ward imports is no JSX
|
|
5
|
+
* and no projection system: tree-shaking dropped a group's `within` either way (measured), and this keeps
|
|
6
|
+
* the ward's import graph from depending on it.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import * as DomLayoutGroup from "@wardic/dom/unstable/LayoutGroup"
|
|
11
|
+
import * as Arr from "effect/Array"
|
|
12
|
+
import * as Predicate from "effect/Predicate"
|
|
13
|
+
import { untrack } from "solid-js"
|
|
14
|
+
import { useLayoutGroupId } from "../layout.tsx"
|
|
15
|
+
|
|
16
|
+
/** A group as it's made: its own id, and how it joins the one around. */
|
|
17
|
+
export interface Group {
|
|
18
|
+
readonly id: string | undefined
|
|
19
|
+
readonly inherit: DomLayoutGroup.LayoutGroupInherit | undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Module state (#460, Q7): each layout group's id and `inherit`, held weakly by the group: how a ward
|
|
23
|
+
// given it as a rune finds it.
|
|
24
|
+
const GROUPS = new WeakMap<object, Group>()
|
|
25
|
+
|
|
26
|
+
/** `made` kept as the layout group `group` is. */
|
|
27
|
+
export const keepGroup = (made: object, group: Group): void => {
|
|
28
|
+
GROUPS.set(made, group)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** `group`'s id, joined to the group around the caller. */
|
|
32
|
+
export const idHere = (group: Group): string | undefined => untrack(() => DomLayoutGroup.layoutGroupIdOf(useLayoutGroupId(), group.id, group.inherit))
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The Layout group a ward of `runes`, as they're written, is in where one of them is a layout group: the
|
|
36
|
+
* last one given, its id joined to the group around the ward where it's made. None where no rune is one.
|
|
37
|
+
*/
|
|
38
|
+
export const layoutGroupIn = (runes: ReadonlyArray<unknown>): { readonly id: string | undefined } | undefined => {
|
|
39
|
+
const group = Arr.reduce(runes, undefined as Group | undefined, (found, rune) => {
|
|
40
|
+
const given = GROUPS.get(rune as object)
|
|
41
|
+
if (Predicate.isUndefined(given)) return found
|
|
42
|
+
return given
|
|
43
|
+
})
|
|
44
|
+
if (Predicate.isUndefined(group)) return undefined
|
|
45
|
+
return { id: idHere(group) }
|
|
46
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createLayoutGroup(id, options)` (probe: behaviour-runes, the scopes round, the gap grill's Q44): a
|
|
3
|
+
* **Layout group** as a value an app holds, a namespace for the `layoutId`s of its wards, so two copies
|
|
4
|
+
* of a component that uses one keep their own. One value is two things:
|
|
5
|
+
*
|
|
6
|
+
* - **A rune.** Given to a ward, it puts that ward's `layoutId` in the group: a ward made in the same
|
|
7
|
+
* body as the group can't be inside its `within`, and takes it this way.
|
|
8
|
+
* - **`within(build)`**, which builds `build()` in it: every ward made there, at any depth, is in it, as
|
|
9
|
+
* one under today's `<LayoutGroup>` is.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* function TabBar() {
|
|
13
|
+
* const tabs = createLayoutGroup("tabs")
|
|
14
|
+
* // This ward's `layoutId` is `tabs-underline`; and every ward made in `within` is in the group.
|
|
15
|
+
* const underline = createWard(tabs, { layoutId: "underline" })
|
|
16
|
+
* return (
|
|
17
|
+
* <nav>
|
|
18
|
+
* {tabs.within(() => <Tabs />)}
|
|
19
|
+
* <span {...underline} />
|
|
20
|
+
* </nav>
|
|
21
|
+
* )
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* The value is the only way into a group: no key names one. Its id is joined to the group around where
|
|
26
|
+
* it's used, a ward's where that ward is made and `within`'s where it's called, as `inherit` says.
|
|
27
|
+
* Page-only: a Stage's ward takes none.
|
|
28
|
+
*
|
|
29
|
+
* @module
|
|
30
|
+
*/
|
|
31
|
+
import { isServer, type JSX } from "@solidjs/web"
|
|
32
|
+
import type * as DomLayoutGroup from "@wardic/dom/unstable/LayoutGroup"
|
|
33
|
+
import * as Bool from "effect/Boolean"
|
|
34
|
+
import * as Option from "effect/Option"
|
|
35
|
+
import * as Predicate from "effect/Predicate"
|
|
36
|
+
import { type Accessor, createEffect, createMemo } from "solid-js"
|
|
37
|
+
import { LayoutGroupProvider, useLayoutGroupId } from "../layout.tsx"
|
|
38
|
+
import { useWardicProjection } from "../layout-projection.tsx"
|
|
39
|
+
import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED } from "../solid-reactivity.ts"
|
|
40
|
+
import { type Group, idHere, keepGroup } from "./layout-group-of.ts"
|
|
41
|
+
import { type CarriedRune, createRuneWith, type PageOnly } from "./rune.ts"
|
|
42
|
+
|
|
43
|
+
/** How a layout group is made, beside its id. */
|
|
44
|
+
export interface LayoutGroupOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Whether it joins the id of the group it's in: `true` (the default) and `"id"` both do, making
|
|
47
|
+
* `outer-inner`, or taking the outer id when it has none of its own; `false` starts afresh.
|
|
48
|
+
*/
|
|
49
|
+
readonly inherit?: DomLayoutGroup.LayoutGroupInherit | undefined
|
|
50
|
+
/**
|
|
51
|
+
* A value whose change has every layout element measured again, for a change nothing else sees: an
|
|
52
|
+
* accessor, followed inside `within`, as `<LayoutGroup layoutDependency>` is.
|
|
53
|
+
*/
|
|
54
|
+
readonly layoutDependency?: Accessor<unknown> | undefined
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** What a layout group carries beside its rune. */
|
|
58
|
+
export interface LayoutGroupApi {
|
|
59
|
+
/** Builds `build()` in the group: every ward made there is in it. */
|
|
60
|
+
readonly within: (build: () => JSX.Element) => JSX.Element
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** A layout group: a rune, the page's alone, that carries {@link LayoutGroupApi}. */
|
|
64
|
+
export type HookLayoutGroup = CarriedRune & PageOnly & LayoutGroupApi
|
|
65
|
+
|
|
66
|
+
const NO_OPTIONS: LayoutGroupOptions = {}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Every layout element measured again as `dependency`'s value changes, from where it's called: today's
|
|
70
|
+
* `<LayoutGroup layoutDependency>`'s. A server render has no projection system to re-measure (ADR-0021).
|
|
71
|
+
* Not at mount: nodes measure themselves as they register.
|
|
72
|
+
*/
|
|
73
|
+
const remeasuredOn = (dependency: Accessor<unknown>): void => {
|
|
74
|
+
if (isServer) return
|
|
75
|
+
const projection = useWardicProjection()
|
|
76
|
+
// Compared before it measures, as Motion's is: an effect never compares (#618).
|
|
77
|
+
const value = createMemo(dependency, CLIENT_ONLY)
|
|
78
|
+
createEffect(
|
|
79
|
+
value,
|
|
80
|
+
() => {
|
|
81
|
+
projection.notify()
|
|
82
|
+
},
|
|
83
|
+
CLIENT_ONLY_DEFERRED,
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `build()` in `group`: today's `<LayoutGroup>`'s body, so its markup and hydration keys are the same. */
|
|
88
|
+
const withinOf =
|
|
89
|
+
(group: Group, dependency: Accessor<unknown> | undefined) =>
|
|
90
|
+
(build: () => JSX.Element): JSX.Element => {
|
|
91
|
+
const outer = useLayoutGroupId()
|
|
92
|
+
const id = idHere(group)
|
|
93
|
+
if (Predicate.isNotUndefined(dependency)) remeasuredOn(dependency)
|
|
94
|
+
// What it builds is read in JSX, where it tracks. A group that keeps the id around provides none,
|
|
95
|
+
// so its markup and hydration keys are as they were (#432).
|
|
96
|
+
return Bool.match(id === outer, {
|
|
97
|
+
onTrue: () => <>{build()}</>,
|
|
98
|
+
onFalse: () => <LayoutGroupProvider value={Option.getOrNull(Option.fromUndefinedOr(id))}>{build()}</LayoutGroupProvider>,
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A **Layout group**, `id` put before every `layoutId` in it: a rune for a ward made beside it, and
|
|
104
|
+
* `within` for every ward made inside what it builds. With no `id`, it keeps the one around. See the module.
|
|
105
|
+
*/
|
|
106
|
+
export const createLayoutGroup = (id?: string, options: LayoutGroupOptions = NO_OPTIONS): HookLayoutGroup => {
|
|
107
|
+
const group: Group = { id, inherit: options.inherit }
|
|
108
|
+
const made = createRuneWith({}, { within: withinOf(group, options.layoutDependency) }) as unknown as HookLayoutGroup
|
|
109
|
+
keepGroup(made, group)
|
|
110
|
+
return made
|
|
111
|
+
}
|