@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/reorder.tsx
CHANGED
|
@@ -49,11 +49,12 @@ import { constUndefined, identity, pipe } from "effect/Function"
|
|
|
49
49
|
import * as Match from "effect/Match"
|
|
50
50
|
import * as Option from "effect/Option"
|
|
51
51
|
import * as Predicate from "effect/Predicate"
|
|
52
|
+
import * as Rec from "effect/Record"
|
|
52
53
|
import * as Scope from "effect/Scope"
|
|
53
54
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
54
55
|
import { isServer, type JSX } from "@solidjs/web"
|
|
55
|
-
import { $PROXY, type Accessor,
|
|
56
|
-
import {
|
|
56
|
+
import { $PROXY, type Accessor, createEffect, createMemo, createSignal, flush, onCleanup, untrack } from "solid-js"
|
|
57
|
+
import type { WardicMotionPropsV2 as WardicMotionProps } from "./motion-props.ts"
|
|
57
58
|
import type * as Feature from "@wardic/dom/unstable/Feature"
|
|
58
59
|
import * as Drag from "@wardic/dom/unstable/features/Drag"
|
|
59
60
|
import * as Focus from "@wardic/dom/unstable/features/Focus"
|
|
@@ -66,16 +67,14 @@ import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures"
|
|
|
66
67
|
import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
|
|
67
68
|
import { watchItemInput } from "@wardic/dom/unstable/ReorderInput"
|
|
68
69
|
import { plainOrder } from "./reorder-values.ts"
|
|
69
|
-
import
|
|
70
|
+
import { misuse } from "./diagnostics.ts"
|
|
70
71
|
import { configView, type PerKey } from "./config-view.ts"
|
|
71
72
|
import { useBrought, useWardicRuntime } from "./provider.tsx"
|
|
72
73
|
import { useLayoutServices } from "./layout-projection.tsx"
|
|
73
|
-
import { type AnyWard, spreadPropsOf, type Ward, withSpreadProps, type WardConfig, type
|
|
74
|
-
import
|
|
75
|
-
import { w } from "./w.tsx"
|
|
74
|
+
import { type AnyWard, spreadPropsOf, type Ward, withSpreadProps, type WardConfig, type WardInternals, type WardOptions, type WardStyle, wardWith } from "./ward.tsx"
|
|
75
|
+
import type { WardicMotion, WardRefCallback } from "./element.tsx"
|
|
76
76
|
import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED } from "./solid-reactivity.ts"
|
|
77
77
|
import { eachOf, neverLands, NO_EVENTS, serverWhen, Waiters, whenOf } from "./waiters.ts"
|
|
78
|
-
import { BatchGroup, BatchItem } from "./batch-reorder-group.tsx"
|
|
79
78
|
|
|
80
79
|
export type { ReorderBatchColumnSize, ReorderBatchGap, ReorderBatchGroup, ReorderBatchGroupProps, ReorderBatchItemProps, ReorderBatchItemSize, ReorderBatchSizing } from "./batch-reorder-group.tsx"
|
|
81
80
|
|
|
@@ -85,6 +84,13 @@ export interface ReorderGroupConfigValues<V> {
|
|
|
85
84
|
readonly values: ReadonlyArray<V>
|
|
86
85
|
/** Given each new order, as an item crosses another: set `values` from it. */
|
|
87
86
|
readonly onReorder: (values: Array<V>) => void
|
|
87
|
+
/**
|
|
88
|
+
* What makes two of `values` one item, where your app makes them again (a refetch, a store's copy):
|
|
89
|
+
* matched by it, an item made again keeps its place, its drag and its keyboard lift, and the group's
|
|
90
|
+
* events hand the item as `values` holds it now. Left out, values match by identity. Read once.
|
|
91
|
+
*/
|
|
92
|
+
// Probe: hooks-first, the Reorder round.
|
|
93
|
+
readonly key?: ((value: V) => unknown) | undefined
|
|
88
94
|
/** The list's direction: `"y"`, a column, `"x"`, a row, or `"xy"`, a grid that wraps. Left out, it's found from the items' boxes. */
|
|
89
95
|
readonly axis?: CoreReorder.Axis | undefined
|
|
90
96
|
/** The keyboard reorder: on unless `false`. Off, the items have no keys, no tab stop and no instructions. */
|
|
@@ -105,26 +111,19 @@ export interface ReorderGroupConfigValues<V> {
|
|
|
105
111
|
/**
|
|
106
112
|
* A Reorder group's config: its `values` in order, `onReorder`, given each new order to set them from,
|
|
107
113
|
* and its options. Each key is a value or an accessor of it, such as a signal, a getter, a store's
|
|
108
|
-
* property or a component's prop; `onReorder`
|
|
114
|
+
* property or a component's prop; `onReorder` and `key` are functions.
|
|
109
115
|
*/
|
|
110
116
|
// Read per key (#259).
|
|
111
|
-
export type ReorderGroupConfig<V> = PerKey<ReorderGroupConfigValues<V>, "onReorder">
|
|
117
|
+
export type ReorderGroupConfig<V> = PerKey<ReorderGroupConfigValues<V>, "onReorder" | "key">
|
|
112
118
|
|
|
113
119
|
/** A group's config read per key (#259). */
|
|
114
|
-
const GROUP_VIEW = configView<ReorderGroupConfigValues<unknown>>(["values", "onReorder", "axis", "keyboard", "announcements", "instructions", "style"], ["onReorder"])
|
|
115
|
-
/** A group's config as a view of `config`. */
|
|
116
|
-
const groupViewOf = <V,>(config: ReorderGroupConfig<V>, beside: object): ReorderGroupConfigValues<V> => GROUP_VIEW.of(config, beside) as ReorderGroupConfigValues<V>
|
|
117
|
-
|
|
120
|
+
const GROUP_VIEW = configView<ReorderGroupConfigValues<unknown>>(["values", "onReorder", "key", "axis", "keyboard", "announcements", "instructions", "style"], ["onReorder", "key"])
|
|
118
121
|
/**
|
|
119
|
-
* A group's config as
|
|
120
|
-
* (#398)
|
|
122
|
+
* A group's config as a view of `config`, nothing beside it: a `Reorder.Group` given a group laid its
|
|
123
|
+
* element's props there (#398), a form gone with today's components (probe: hooks-first, the Reorder
|
|
124
|
+
* round's Q6).
|
|
121
125
|
*/
|
|
122
|
-
|
|
123
|
-
readonly config: object
|
|
124
|
-
readonly beside: object
|
|
125
|
-
}
|
|
126
|
-
// Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
|
|
127
|
-
const GROUP_LAYERS = new WeakMap<object, GroupLayer>()
|
|
126
|
+
const groupViewOf = <V,>(config: ReorderGroupConfig<V>): ReorderGroupConfigValues<V> => GROUP_VIEW.of(config, {}) as ReorderGroupConfigValues<V>
|
|
128
127
|
|
|
129
128
|
/** A Reorder group's events, as a ward's: `list.next(name)`, `list.each(name)` and `list.when(name)`. */
|
|
130
129
|
// #257 item 3, ADR-0046.
|
|
@@ -161,12 +160,12 @@ export interface ReorderGroupProps {
|
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
/**
|
|
164
|
-
* A **Reorder group**'s mark (#349): what tells a group
|
|
165
|
-
*
|
|
163
|
+
* A **Reorder group**'s mark (#349): what tells a group from a function, so `Reorder.Group`'s `groupRef`
|
|
164
|
+
* refuses one in its type ({@link GroupRefCallback}). Internal.
|
|
166
165
|
*/
|
|
167
166
|
export const REORDER_GROUP: unique symbol = Symbol("wardic.reorderGroup")
|
|
168
167
|
|
|
169
|
-
/** A Reorder group of `V`, whatever its config
|
|
168
|
+
/** A Reorder group of `V`, whatever its config. */
|
|
170
169
|
// #349.
|
|
171
170
|
export interface AnyReorderGroup<V> {
|
|
172
171
|
readonly [REORDER_GROUP]: V
|
|
@@ -260,7 +259,7 @@ interface ReorderItemOwn<V> {
|
|
|
260
259
|
* drag, and every other gesture, so `whileHover` or `whileTap` on an item works as on Motion's, for
|
|
261
260
|
* about 0.5 KB gzipped beside the drag's.
|
|
262
261
|
*/
|
|
263
|
-
const ITEM_BRINGS: ReadonlyArray<Feature.Feature> = [Layout.layout, Drag.drag, Hover.hover, Press.press, Focus.focus, InView.inView, Pan.pan]
|
|
262
|
+
export const ITEM_BRINGS: ReadonlyArray<Feature.Feature> = [Layout.layout, Drag.drag, Hover.hover, Press.press, Focus.focus, InView.inView, Pan.pan]
|
|
264
263
|
|
|
265
264
|
const ITEM_VIEW = configView<ReorderItemOwn<unknown>>(["value", "layout", "tabindex", "aria-describedby"], [])
|
|
266
265
|
|
|
@@ -270,10 +269,10 @@ const itemLayoutOf = (layout: unknown): ReorderItemLayout =>
|
|
|
270
269
|
|
|
271
270
|
/** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
|
|
272
271
|
const WHOLE_GROUP_ACCESSOR =
|
|
273
|
-
"reorderGroup(config) takes its config as an object, read per key
|
|
272
|
+
"reorderGroup(config) takes its config as an object, read per key: make a key reactive with an accessor " +
|
|
274
273
|
"(`reorderGroup({ values: items, onReorder: setItems })`), a getter, a store or a component's props."
|
|
275
274
|
const WHOLE_ITEM_ACCESSOR =
|
|
276
|
-
"reorderItem(list, config) takes its config as an object, read per key
|
|
275
|
+
"reorderItem(list, config) takes its config as an object, read per key: `reorderItem(list, { value })`, " +
|
|
277
276
|
"a key made reactive with an accessor, a getter, a store or a component's props."
|
|
278
277
|
|
|
279
278
|
/** Whether a call is Solid applying a ref. */
|
|
@@ -305,14 +304,18 @@ const refCarrying = <G,>(attach: (element: HTMLElement) => void, props: Property
|
|
|
305
304
|
const spreadProps: PropertyDescriptorMap = { ref: { value: self, enumerable: true }, ...props }
|
|
306
305
|
const spread = spreadPropsOf<object>(spreadProps)
|
|
307
306
|
Object.defineProperties(self, { [REORDER_GROUP]: { value: true }, ...spreadProps })
|
|
308
|
-
|
|
307
|
+
// Its reads aren't enumerable. Solid calls a spread's function source for its props, `{...list}`; a
|
|
308
|
+
// group that's a member of another object, `{...made.list}`, it reads as an object, key by key, and
|
|
309
|
+
// each read was written to the element as an attribute: `group`, `axis`, `move`, `controller`.
|
|
310
|
+
const hidden = Rec.map(Object.getOwnPropertyDescriptors(reads) as Record<string, PropertyDescriptor>, (descriptor) => ({ ...descriptor, enumerable: false }))
|
|
311
|
+
return Object.defineProperties(self as object, hidden) as G
|
|
309
312
|
}
|
|
310
313
|
|
|
311
314
|
/**
|
|
312
315
|
* Makes a list of your own elements reorderable, by dragging or from the keyboard: spread the group on
|
|
313
316
|
* the list's element, and make each item with `reorderItem`, keyed with `<For>`. Your app owns
|
|
314
317
|
* `values`, and sets them from `onReorder`; a reorder it makes itself animates too. Call it where you'd
|
|
315
|
-
* make a signal, under a `WardicProvider`. `Reorder.Group`
|
|
318
|
+
* make a signal, under a `WardicProvider`. `createReorder`, and `Reorder.Group` over it, are built on it.
|
|
316
319
|
*
|
|
317
320
|
* @example
|
|
318
321
|
* const list = reorderGroup({ values: items, onReorder: setItems })
|
|
@@ -331,12 +334,11 @@ const refCarrying = <G,>(attach: (element: HTMLElement) => void, props: Property
|
|
|
331
334
|
// A `values` change re-measures. On a server it renders the element's style and nothing else: no
|
|
332
335
|
// controller, no runtime; its `group`, `move` and `controller` do nothing (ADR-0021).
|
|
333
336
|
export function reorderGroup<V>(config: ReorderGroupConfig<V>): ReorderGroup<V> {
|
|
334
|
-
if (Predicate.isFunction(config)) throw
|
|
335
|
-
const
|
|
336
|
-
const view = groupViewOf(config, beside)
|
|
337
|
+
if (Predicate.isFunction(config)) throw misuse("WARDIC_CONFIG_AS_ACCESSOR", WHOLE_GROUP_ACCESSOR)
|
|
338
|
+
const view = groupViewOf(config)
|
|
337
339
|
const cfg = (): ReorderGroupConfigValues<V> => view
|
|
338
340
|
const runtime = useWardicRuntime()
|
|
339
|
-
if (isServer) return
|
|
341
|
+
if (isServer) return serverReorderGroup(cfg)
|
|
340
342
|
const [detected, setDetected] = createSignal<CoreReorder.Axis>("y")
|
|
341
343
|
// The order as a plain array (#721): a store's copied, so a store changed in place is a new order, read
|
|
342
344
|
// untracked by the controller and tracked by the effect below.
|
|
@@ -367,6 +369,7 @@ export function reorderGroup<V>(config: ReorderGroupConfig<V>): ReorderGroup<V>
|
|
|
367
369
|
onReorderEnd: (end) => events.tell("reorderEnd", () => end),
|
|
368
370
|
onHoldStart: (start) => events.tell("holdStart", () => start),
|
|
369
371
|
onHoldEnd: (end) => events.tell("holdEnd", () => end),
|
|
372
|
+
key: untrack(() => cfg().key),
|
|
370
373
|
axis: () => Option.fromUndefinedOr(untrack(() => cfg().axis)),
|
|
371
374
|
onAxis: setDetected,
|
|
372
375
|
keyedWith: "<For>",
|
|
@@ -377,8 +380,8 @@ export function reorderGroup<V>(config: ReorderGroupConfig<V>): ReorderGroup<V>
|
|
|
377
380
|
// The app's axis, else the detected one. When the app's is cleared, detected here, from the boxes the
|
|
378
381
|
// engine holds, so the items' touch-action follows in the same flush (#257's audit: an effect that
|
|
379
382
|
// detected it wrote a signal the items read a flush late, EFFECT_RELAY_TEAR). A Measure pass's change
|
|
380
|
-
// comes through `onAxis`. Lazy: read first by an item, so
|
|
381
|
-
//
|
|
383
|
+
// comes through `onAxis`. Lazy: read first by an item, so the `axis` it tracks is the config's as the
|
|
384
|
+
// items read it (#398).
|
|
382
385
|
const axis: Accessor<CoreReorder.Axis> = createMemo(
|
|
383
386
|
() =>
|
|
384
387
|
UndefinedOr.match(cfg().axis, {
|
|
@@ -405,7 +408,7 @@ export function reorderGroup<V>(config: ReorderGroupConfig<V>): ReorderGroup<V>
|
|
|
405
408
|
if (element.style.getPropertyValue("overflow-anchor") === "") element.style.setProperty("overflow-anchor", "none")
|
|
406
409
|
controller.attach(element)
|
|
407
410
|
}
|
|
408
|
-
return
|
|
411
|
+
return refCarrying<ReorderGroup<V>>(
|
|
409
412
|
attach,
|
|
410
413
|
{ style: { get: () => groupStyleOf(cfg().style), enumerable: true } },
|
|
411
414
|
{
|
|
@@ -425,36 +428,12 @@ export function reorderGroup<V>(config: ReorderGroupConfig<V>): ReorderGroup<V>
|
|
|
425
428
|
controller,
|
|
426
429
|
...keyboardOf(cfg),
|
|
427
430
|
},
|
|
428
|
-
)
|
|
431
|
+
)
|
|
429
432
|
}
|
|
430
433
|
|
|
431
434
|
/** The group's axis memo's options: client-only, and lazy (#398). */
|
|
432
435
|
const AXIS_MEMO = { ...CLIENT_ONLY, lazy: true } as const
|
|
433
436
|
|
|
434
|
-
/** `group`, its config and its layer kept for a `Reorder.Group` it's given to (#398). */
|
|
435
|
-
const layered = <G extends object,>(group: G, config: object, beside: object): G => {
|
|
436
|
-
GROUP_LAYERS.set(group, { config, beside })
|
|
437
|
-
return group
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* A given group's element props (#398): each config key its `Reorder.Group` sets, laid over the
|
|
442
|
-
* group's config, read through the element's prop. A key the group's config sets too is an error.
|
|
443
|
-
*/
|
|
444
|
-
const besideGroup = (local: object, group: object): void => {
|
|
445
|
-
const layer = UndefinedOr.getOrThrow(GROUP_LAYERS.get(group))
|
|
446
|
-
const given = setKeysOf(local, GROUP_CONFIG)
|
|
447
|
-
const twice = setKeysOf(layer.config, given)
|
|
448
|
-
if (twice.length > 0) {
|
|
449
|
-
throw new Error(
|
|
450
|
-
`Reorder.Group: ${listOf(twice)} set both in the group given to groupRef and on the element (#398). ` +
|
|
451
|
-
"Set each key in one place: in reorderGroup({ … }), or on the element.",
|
|
452
|
-
)
|
|
453
|
-
}
|
|
454
|
-
Arr.forEach(given, (key) =>
|
|
455
|
-
Object.defineProperty(layer.beside, key, { enumerable: true, configurable: true, get: () => (local as Readonly<Record<string, unknown>>)[key] }))
|
|
456
|
-
}
|
|
457
|
-
|
|
458
437
|
/** What a group's Scope reports when one of its finalizers fails as its owner goes. */
|
|
459
438
|
const CLOSE_FAILED = "wardic.reorder: a finalizer failed"
|
|
460
439
|
|
|
@@ -507,7 +486,7 @@ const keyboardAttributes = <V,>(
|
|
|
507
486
|
|
|
508
487
|
/**
|
|
509
488
|
* Makes an element an item of a Reorder group: a ward, spread on the element, `<li {...row}>`, or given
|
|
510
|
-
* to
|
|
489
|
+
* to its `ref`. `value` is its value in the group's `values`, read once; the rest is a
|
|
511
490
|
* ward's config, but `layout` (`true` or `"position"`), `layoutId` and `drag`, which the group sets. It's
|
|
512
491
|
* a tab stop for the keyboard reorder: your own `tabindex` and `aria-describedby` go in its config.
|
|
513
492
|
* Call it where you'd make a signal: in a `<For>` callback.
|
|
@@ -520,33 +499,39 @@ const keyboardAttributes = <V,>(
|
|
|
520
499
|
// ADR-0020. Given to `ref` alone, it's client-only. The element takes the drag defaults, with the
|
|
521
500
|
// group's axis's touch-action, which its `style` can override.
|
|
522
501
|
export function reorderItem<V, const C extends ReorderItemConfig<V>>(list: ReorderGroup<V>, config: C, options?: WardOptions): ReorderItem<V, C> {
|
|
523
|
-
return reorderItemWith(list, config as ReorderItemConfig<V>, UndefinedOr.map(options, (o) => o.parent)
|
|
502
|
+
return reorderItemWith(list, config as ReorderItemConfig<V>, { parent: UndefinedOr.map(options, (o) => o.parent) }) as unknown as ReorderItem<V, C>
|
|
524
503
|
}
|
|
525
504
|
|
|
526
505
|
/** A `<Reorder>` item's mark (#349): the group it's in. Internal. */
|
|
527
506
|
export const REORDER_ITEM: unique symbol = Symbol("wardic.reorderItem")
|
|
528
507
|
|
|
529
|
-
/** A `<Reorder>` item of `V`, whatever its config
|
|
508
|
+
/** A `<Reorder>` item of `V`, whatever its config. */
|
|
530
509
|
// #349.
|
|
531
510
|
export interface AnyReorderItem<V> extends AnyWard {
|
|
532
511
|
readonly [REORDER_ITEM]: V
|
|
533
512
|
}
|
|
534
513
|
|
|
535
514
|
/**
|
|
536
|
-
* `reorderItem()`'s item: a ward in its group. Spread it on the item's element, or give it to
|
|
537
|
-
* `Reorder.Item`'s `wardRef`.
|
|
515
|
+
* `reorderItem()`'s item: a ward in its group. Spread it on the item's element, or give it to its `ref`.
|
|
538
516
|
*/
|
|
539
517
|
export type ReorderItem<V, C extends ReorderItemConfig<V> = ReorderItemConfig<V>> = Ward<C> & AnyReorderItem<V>
|
|
540
518
|
|
|
541
|
-
/**
|
|
542
|
-
|
|
543
|
-
|
|
519
|
+
/**
|
|
520
|
+
* {@link reorderItem} over `internal`, the internals its ward was given: its parent and its tag
|
|
521
|
+
* (`Reorder.Item`'s `as`, a hook row's `tag`), and a hook row's own besides (what the hooks are told of a
|
|
522
|
+
* ward they made, a function rune's shared lifecycle, a Variant child by its own word, a ward that names
|
|
523
|
+
* no gesture, the keys the hooks fix over its config), each kept under what an item sets itself. Internal.
|
|
524
|
+
*/
|
|
525
|
+
// The Reorder round's RF1: an item took its parent and its tag alone, so a hook row's function rune
|
|
526
|
+
// never heard its row, its lifecycle unshared.
|
|
527
|
+
export const reorderItemWith = <V,>(list: ReorderGroup<V>, config: ReorderItemConfig<V>, internal: WardInternals): Ward => {
|
|
528
|
+
if (Predicate.isFunction(config)) throw misuse("WARDIC_CONFIG_AS_ACCESSOR", WHOLE_ITEM_ACCESSOR)
|
|
544
529
|
// Its own keys read per key (#259); the rest are its ward's config, read by the ward. Its `layout`
|
|
545
530
|
// is its Layout mode, `true` or `"position"` whatever the config gives, read at each layout
|
|
546
531
|
// animation's start as any ward's is (ADR-0009, *Amendment (#42)*).
|
|
547
532
|
const own = ITEM_VIEW.of(config) as ReorderItemOwn<V>
|
|
548
533
|
const cfg = (): ReorderItemOwn<V> => own
|
|
549
|
-
const fixed = { layout: (): ReorderItemLayout => itemLayoutOf(own.layout) }
|
|
534
|
+
const fixed = { ...internal.fixed, layout: (): ReorderItemLayout => itemLayoutOf(own.layout) }
|
|
550
535
|
const wardConfig = config as unknown as WardConfig
|
|
551
536
|
// Its group's axis's `touch-action`, under its style: none when its own presses don't drag it
|
|
552
537
|
// (`dragListener={false}`, #431), as with its other drag defaults, so a list dragged by handles scrolls by touch.
|
|
@@ -557,7 +542,7 @@ const reorderItemWith = <V,>(list: ReorderGroup<V>, config: ReorderItemConfig<V>
|
|
|
557
542
|
// On a server the item renders the drag defaults with its group's touch-action, and joins no
|
|
558
543
|
// controller (ADR-0021); the instructions element exists on the client only.
|
|
559
544
|
if (isServer) {
|
|
560
|
-
const row = wardWith(wardConfig, {
|
|
545
|
+
const row = wardWith(wardConfig, { ...internal, brings: ITEM_BRINGS, dragAxis: () => true, baseStyle: touchAction, fixed, group: list })
|
|
561
546
|
return withSpreadProps(Object.defineProperties(row, { [REORDER_ITEM]: { value: list } }), keyboardAttributes(list, cfg, constUndefined))
|
|
562
547
|
}
|
|
563
548
|
const runtime = useWardicRuntime()
|
|
@@ -582,11 +567,10 @@ const reorderItemWith = <V,>(list: ReorderGroup<V>, config: ReorderItemConfig<V>
|
|
|
582
567
|
CLIENT_ONLY,
|
|
583
568
|
)
|
|
584
569
|
const row = wardWith(wardConfig, {
|
|
585
|
-
|
|
570
|
+
...internal,
|
|
586
571
|
brings: ITEM_BRINGS,
|
|
587
572
|
fixed,
|
|
588
573
|
group: list,
|
|
589
|
-
parent,
|
|
590
574
|
dragAxis: () => dragAxisFor(driver.dragAxis()),
|
|
591
575
|
onDragSample: driver.onSample,
|
|
592
576
|
onLayoutHandle: driver.register,
|
|
@@ -608,25 +592,21 @@ const reorderItemWith = <V,>(list: ReorderGroup<V>, config: ReorderItemConfig<V>
|
|
|
608
592
|
return withSpreadProps(Object.defineProperties(row, { [REORDER_ITEM]: { value: list } }), keyboardAttributes(list, cfg, describedBy))
|
|
609
593
|
}
|
|
610
594
|
|
|
611
|
-
// ---
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
const GroupContext = createContext<ReorderGroup<unknown> | null>(null)
|
|
595
|
+
// --- The components' props (ADR-0020). The components are the hooks' utilities over `createReorder`
|
|
596
|
+
// (`reorder-components.tsx`, probe: hooks-first, the Reorder round), and today's built on the factories
|
|
597
|
+
// here went with the swap. ---------------------------------------------------------------------------
|
|
615
598
|
|
|
616
599
|
/** An element tag a `<Reorder>` group or item can render. */
|
|
617
600
|
export type ReorderElementTag = keyof JSX.IntrinsicElements
|
|
618
601
|
|
|
619
|
-
/**
|
|
620
|
-
|
|
621
|
-
* `reorderGroup` given to `groupRef`, with the options its config doesn't set beside it. A key given
|
|
622
|
-
* both ways is an error.
|
|
623
|
-
*/
|
|
624
|
-
// #349, #398. A key set twice is caught at setup; in the types only for `values` and `onReorder`, which
|
|
625
|
-
// every group sets: a group's type doesn't carry its config.
|
|
602
|
+
/** `Reorder.Group`'s group: its config as props, `groupRef` handing the group out. */
|
|
603
|
+
// #349, #398.
|
|
626
604
|
export type ReorderGroupOf<V> =
|
|
627
|
-
|
|
605
|
+
{
|
|
628
606
|
readonly values: ReadonlyArray<V>
|
|
629
607
|
readonly onReorder: (values: Array<V>) => void
|
|
608
|
+
/** What makes two of `values` one item, where your app makes them again: see the group config's `key`. Read once. */
|
|
609
|
+
readonly key?: ((value: V) => unknown) | undefined
|
|
630
610
|
readonly axis?: CoreReorder.Axis | undefined
|
|
631
611
|
readonly keyboard?: boolean | undefined
|
|
632
612
|
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
@@ -637,19 +617,9 @@ export type ReorderGroupOf<V> =
|
|
|
637
617
|
*/
|
|
638
618
|
readonly groupRef?: GroupRefCallback<V> | undefined
|
|
639
619
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
* doesn't set beside it: never `values` or `onReorder`, which a group is made with.
|
|
644
|
-
*/
|
|
645
|
-
readonly groupRef: AnyReorderGroup<V>
|
|
646
|
-
readonly values?: never
|
|
647
|
-
readonly onReorder?: never
|
|
648
|
-
readonly axis?: CoreReorder.Axis | undefined
|
|
649
|
-
readonly keyboard?: boolean | undefined
|
|
650
|
-
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
651
|
-
readonly instructions?: string | undefined
|
|
652
|
-
}
|
|
620
|
+
// A group made with `reorderGroup` given to `groupRef` to drive was a form of the component's too: no
|
|
621
|
+
// more since `Reorder.Group` is the hooks' utility over `createReorder` (probe: hooks-first, the Reorder
|
|
622
|
+
// round's Q6), which makes its own.
|
|
653
623
|
|
|
654
624
|
/** A function `groupRef` gives the component's group: never a group, which it would take instead. */
|
|
655
625
|
export type GroupRefCallback<V> = ((list: ReorderGroup<V>) => void) & { readonly [REORDER_GROUP]?: never }
|
|
@@ -663,231 +633,43 @@ export type ReorderGroupComponentProps<V, Tag extends ReorderElementTag = "ul">
|
|
|
663
633
|
& { readonly as?: Tag }
|
|
664
634
|
& Omit<JSX.IntrinsicElements[Tag], "style" | "onReorder">
|
|
665
635
|
& { readonly style?: WardStyle | string | undefined }
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
/** A `<Reorder>` item's motion props: any but `layoutId` and `drag`, its `layout` a Layout mode. */
|
|
669
|
-
type ItemMotionProps = Omit<WardicMotionProps, "layout" | "layoutId" | "drag">
|
|
636
|
+
// Not a ward's presence `key`: the group's, a function of a value (probe: hooks-first, the Reorder round).
|
|
637
|
+
& Omit<WardicMotion, "key">
|
|
670
638
|
|
|
671
639
|
/**
|
|
672
|
-
*
|
|
673
|
-
* or
|
|
674
|
-
* beside it, as beside a ward: never `value`, which an item is made with.
|
|
640
|
+
* A `<Reorder>` item's motion props: any but `layoutId` and `drag`, its `layout` a Layout mode. Not
|
|
641
|
+
* `dragControls` or `dragListener`: a `<Reorder.Grip>` inside it is their way (probe: behaviour-runes, Q29).
|
|
675
642
|
*/
|
|
643
|
+
type ItemMotionProps = Omit<WardicMotionProps, "layout" | "layoutId" | "drag" | "dragControls" | "dragListener">
|
|
644
|
+
|
|
645
|
+
/** `Reorder.Item`'s item: its `value`, its `layout` and its motion props, `wardRef` handing its ward out. */
|
|
676
646
|
// #349, #398.
|
|
677
|
-
export type ReorderItemOf<V
|
|
678
|
-
|
|
647
|
+
export type ReorderItemOf<V> =
|
|
648
|
+
ItemMotionProps & {
|
|
679
649
|
/** Its value in the group's `values`, of any type, not its element's `value` attribute. Read once. */
|
|
680
650
|
readonly value: V
|
|
681
651
|
readonly layout?: ReorderItemLayout
|
|
682
652
|
readonly wardRef?: WardRefCallback | undefined
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
readonly value?: never
|
|
687
|
-
readonly layout?: "layout" extends WardSetKey<C> ? never : ReorderItemLayout
|
|
688
|
-
readonly tabindex?: "tabindex" extends WardSetKey<C> ? never : number
|
|
689
|
-
readonly "aria-describedby"?: "aria-describedby" extends WardSetKey<C> ? never : string
|
|
690
|
-
})
|
|
653
|
+
}
|
|
654
|
+
// An item made with `reorderItem` given to `wardRef` to drive was a form of the component's too, of its
|
|
655
|
+
// config's type: no more since `Reorder.Item` is the hooks' utility (probe: hooks-first, the Reorder round's Q6).
|
|
691
656
|
|
|
692
657
|
/**
|
|
693
658
|
* `Reorder.Item`'s props: its item ({@link ReorderItemOf}), `as`, the element it renders (`"li"` by
|
|
694
659
|
* default, read once), and that element's own props, but its `value` attribute: `value` is the item's (#748).
|
|
695
660
|
*/
|
|
696
|
-
export type ReorderItemComponentProps<V, Tag extends ReorderElementTag = "li"
|
|
697
|
-
& ReorderItemOf<V
|
|
661
|
+
export type ReorderItemComponentProps<V, Tag extends ReorderElementTag = "li"> =
|
|
662
|
+
& ReorderItemOf<V>
|
|
698
663
|
& { readonly as?: Tag }
|
|
699
664
|
& Omit<JSX.IntrinsicElements[Tag], "style" | "value">
|
|
700
665
|
& { readonly style?: WardStyle | string | undefined }
|
|
701
666
|
|
|
702
667
|
/**
|
|
703
|
-
*
|
|
704
|
-
*
|
|
668
|
+
* `Reorder.Grip`'s props (probe: behaviour-runes, Q29, Q33): `as`, the element it renders (a
|
|
669
|
+
* `<button type="button">` by default, read once), that element's own props, and its motion props.
|
|
705
670
|
*/
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
readonly
|
|
711
|
-
readonly keyboard?: boolean | undefined
|
|
712
|
-
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
713
|
-
readonly instructions?: string | undefined
|
|
714
|
-
readonly as?: string | undefined
|
|
715
|
-
readonly ref?: unknown
|
|
716
|
-
readonly style?: WardStyle | string | undefined
|
|
717
|
-
readonly children?: JSX.Element
|
|
718
|
-
}
|
|
719
|
-
interface ItemLocal<V> {
|
|
720
|
-
readonly value: V
|
|
721
|
-
readonly as?: string | undefined
|
|
722
|
-
readonly ref?: unknown
|
|
723
|
-
readonly style?: WardStyle | string | undefined
|
|
724
|
-
readonly children?: JSX.Element
|
|
725
|
-
readonly tabindex?: number | undefined
|
|
726
|
-
readonly "aria-describedby"?: string | undefined
|
|
727
|
-
readonly wardRef?: unknown
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
const GROUP_OWN = ["values", "onReorder", "axis", "keyboard", "announcements", "instructions", "as", "ref", "style", "children", "groupRef"] as const
|
|
731
|
-
const ITEM_OWN = [...MOTION_PROPS, "value", "as", "ref", "style", "children", "tabindex", "aria-describedby", "wardRef"] as const
|
|
732
|
-
/** A group's config keys: beside a given group, each it doesn't set (#398). */
|
|
733
|
-
const GROUP_CONFIG = ["values", "onReorder", "axis", "keyboard", "announcements", "instructions"] as const
|
|
734
|
-
/** An item's config keys, its motion props and its own: beside a given item, each it doesn't set (#398). */
|
|
735
|
-
const ITEM_CONFIG = [...MOTION_PROPS, "value", "tabindex", "aria-describedby"] as const
|
|
736
|
-
/** A `<Reorder>` item's keyboard reorder attributes (ADR-0037), which a given item's element carries (#349). */
|
|
737
|
-
const KEYBOARD_ATTRIBUTES = ["tabindex", "aria-describedby"] as const
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* The Wardic element for `tag`, as a plain component: a Slim element's (`w[tag]`, #511), so a Reorder
|
|
741
|
-
* brings no Feature but its own (ADR-0067 decision 12) and renders under a `strict` section.
|
|
742
|
-
*/
|
|
743
|
-
const wardicTag = (tag: string): Component<Record<string, unknown>> =>
|
|
744
|
-
UndefinedOr.getOrThrow((w as unknown as Record<string, Component<Record<string, unknown>> | undefined>)[tag])
|
|
745
|
-
|
|
746
|
-
/** The group given to `groupRef` (#349), or `undefined` for a function or none: read once, untracked, as `ref` is. */
|
|
747
|
-
const givenGroupOf = <V,>(local: GroupLocal<V>): ReorderGroup<V> | undefined => {
|
|
748
|
-
const ref = untrack(() => local.groupRef)
|
|
749
|
-
return Bool.match(Predicate.hasProperty(ref, REORDER_GROUP), { onTrue: () => ref as ReorderGroup<V>, onFalse: constUndefined })
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
/**
|
|
753
|
-
* A list put in order by dragging its items, or from the keyboard, rendered as `as`, `"ul"` by
|
|
754
|
-
* default. Your app owns `values`, and sets them from `onReorder`; or give it a group made with
|
|
755
|
-
* `reorderGroup` as `groupRef`. Key its `Reorder.Item`s with `<For>`.
|
|
756
|
-
*
|
|
757
|
-
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
758
|
-
*/
|
|
759
|
-
// ADR-0020, #349: a `reorderGroup` on `w[as]`, the group in context for its items.
|
|
760
|
-
function Group<V, Tag extends ReorderElementTag = "ul">(props: ReorderGroupComponentProps<V, Tag>): JSX.Element {
|
|
761
|
-
const local = props as unknown as GroupLocal<V>
|
|
762
|
-
const given = givenGroupOf(local)
|
|
763
|
-
const list = UndefinedOr.match(given, {
|
|
764
|
-
onUndefined: () => {
|
|
765
|
-
// Its props are its config, read per key (#259).
|
|
766
|
-
const made = reorderGroup<V>(local as unknown as ReorderGroupConfig<V>)
|
|
767
|
-
// The group, to its `groupRef` (#257 item 3), read once, untracked, as `ref` is.
|
|
768
|
-
const give = untrack(() => local.groupRef)
|
|
769
|
-
if (Predicate.isFunction(give)) give(made)
|
|
770
|
-
return made
|
|
771
|
-
},
|
|
772
|
-
onDefined: (group) => {
|
|
773
|
-
besideGroup(local, group)
|
|
774
|
-
return group
|
|
775
|
-
},
|
|
776
|
-
})
|
|
777
|
-
const Tag = wardicTag(UndefinedOr.match(untrack(() => local.as), { onUndefined: () => "ul", onDefined: identity }))
|
|
778
|
-
const rest = omit(props as unknown as Record<string, unknown>, ...GROUP_OWN)
|
|
779
|
-
// Its element's style over the group's: `overflow-anchor: none`, under a given group's config (#349).
|
|
780
|
-
const styleOf: () => JSX.CSSProperties = UndefinedOr.match(given, {
|
|
781
|
-
onUndefined: () => () => pipe(local.style, Style.over(ReorderController.GROUP_STYLE)) as JSX.CSSProperties,
|
|
782
|
-
onDefined: (group) => () => pipe(local.style, Style.over(group.style)) as JSX.CSSProperties,
|
|
783
|
-
})
|
|
784
|
-
return (
|
|
785
|
-
<GroupContext value={list as ReorderGroup<unknown>}>
|
|
786
|
-
<Tag {...rest} style={styleOf()} ref={refsOf(local, [list])}>
|
|
787
|
-
{local.children}
|
|
788
|
-
</Tag>
|
|
789
|
-
</GroupContext>
|
|
790
|
-
)
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
* A `<Reorder>` item given to `Reorder.Item`'s `wardRef` (#349): one of `list`'s, made with
|
|
795
|
-
* {@link reorderItem}. Its element is driven by a ward of the component's, and carries the item's
|
|
796
|
-
* keyboard reorder attributes.
|
|
797
|
-
*/
|
|
798
|
-
const givenItem = <V,>(list: ReorderGroup<V>, local: ItemLocal<V>, share: WardShare, tag: string): { readonly row: Ward; readonly keys: object; readonly setup: WardConfigValues } => {
|
|
799
|
-
if (Predicate.isUndefined(share.internal.group)) {
|
|
800
|
-
throw new Error("Reorder.Item: the ward in wardRef isn't a Reorder item (#349). Make it with reorderItem(list, { value }), list the group it's in.")
|
|
801
|
-
}
|
|
802
|
-
if (share.internal.group !== list) {
|
|
803
|
-
throw new Error("Reorder.Item: the item in wardRef is another group's (#349). Make it with reorderItem(list, …), list the Reorder.Group it renders in.")
|
|
804
|
-
}
|
|
805
|
-
const item = untrack(() => local.wardRef) as object
|
|
806
|
-
const { ward: row, setup } = drivenWard("Reorder.Item", local, share, { tag }, ITEM_CONFIG)
|
|
807
|
-
// Its keyboard attributes: the item's, or the element's where it sets one the item doesn't (#398).
|
|
808
|
-
const keys = Object.defineProperties(
|
|
809
|
-
{},
|
|
810
|
-
Object.fromEntries(
|
|
811
|
-
Arr.map(KEYBOARD_ATTRIBUTES, (key) => [
|
|
812
|
-
key,
|
|
813
|
-
Bool.match(sets(local, key), {
|
|
814
|
-
onTrue: (): PropertyDescriptor => ({ enumerable: true, get: () => (local as unknown as Readonly<Record<string, unknown>>)[key] }),
|
|
815
|
-
onFalse: () => UndefinedOr.getOrThrow(Object.getOwnPropertyDescriptor(item, key)),
|
|
816
|
-
}),
|
|
817
|
-
]),
|
|
818
|
-
),
|
|
819
|
-
)
|
|
820
|
-
return { row, keys, setup }
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* An item of the `Reorder.Group` around it, rendered as `as`, `"li"` by default: made from its props,
|
|
825
|
-
* or an item made with `reorderItem` given as `wardRef`. Outside a group it throws, as Motion's does.
|
|
826
|
-
*
|
|
827
|
-
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
828
|
-
*/
|
|
829
|
-
// ADR-0020, #349: a `reorderItem` on the nearest group.
|
|
830
|
-
function Item<V, Tag extends ReorderElementTag = "li", C = {}>(props: ReorderItemComponentProps<V, Tag, C>): JSX.Element {
|
|
831
|
-
const list = useContext(GroupContext) as ReorderGroup<V> | null
|
|
832
|
-
if (Predicate.isNull(list)) throw new Error("Reorder.Item must be a child of Reorder.Group")
|
|
833
|
-
const local = props as unknown as ItemLocal<V> & WardicMotionProps
|
|
834
|
-
const tag = UndefinedOr.match(untrack(() => local.as), { onUndefined: () => "li", onDefined: identity })
|
|
835
|
-
const given = givenOf(local)
|
|
836
|
-
// One plain element a tag, as every Wardic element's (#618, M3).
|
|
837
|
-
const Element = staticElementOf(tag)
|
|
838
|
-
const rest = omit(props as unknown as Record<string, unknown>, ...ITEM_OWN)
|
|
839
|
-
const element = UndefinedOr.match(given, {
|
|
840
|
-
onUndefined: () => {
|
|
841
|
-
// Its props are its config, read per key (#259); its `layout` is read as a Layout mode.
|
|
842
|
-
const row = reorderItemWith<V>(list, local as unknown as ReorderItemConfig<V>, undefined, tag)
|
|
843
|
-
// Its ward, to the item's `wardRef` (#257).
|
|
844
|
-
handOver(local, row)
|
|
845
|
-
// The ward's spread props, as an object: spread as the function it is, it's a source `merge`
|
|
846
|
-
// calls in a computation, whose keys `spread` can't know, so it inserts children too (#525, #618 M3).
|
|
847
|
-
const rowProps = row()
|
|
848
|
-
return {
|
|
849
|
-
row,
|
|
850
|
-
setup: undefined,
|
|
851
|
-
render: (): JSX.Element => (
|
|
852
|
-
<Element {...rest} {...rowProps} ref={refsOf(local, [row])}>
|
|
853
|
-
{local.children}
|
|
854
|
-
</Element>
|
|
855
|
-
),
|
|
856
|
-
}
|
|
857
|
-
},
|
|
858
|
-
onDefined: (share) => {
|
|
859
|
-
const { row, keys, setup } = givenItem(list, local, share, tag)
|
|
860
|
-
return {
|
|
861
|
-
row,
|
|
862
|
-
setup,
|
|
863
|
-
render: (): JSX.Element => (
|
|
864
|
-
<Element {...rest} {...row.with({ style: local.style })} {...keys} ref={refsOf(local, [row])}>
|
|
865
|
-
{local.children}
|
|
866
|
-
</Element>
|
|
867
|
-
),
|
|
868
|
-
}
|
|
869
|
-
},
|
|
870
|
-
})
|
|
871
|
-
// An item that changes what its children read renders its variant context's Provider around them
|
|
872
|
-
// (#50), as every Wardic element does; any other renders none.
|
|
873
|
-
const config = UndefinedOr.match(element.setup, { onUndefined: () => wardConfigView(local as unknown as WardConfig), onDefined: identity })
|
|
874
|
-
return Bool.match(untrack(() => VariantTree.changesContext(config)), {
|
|
875
|
-
onFalse: element.render,
|
|
876
|
-
onTrue: () => <element.row.Provider>{element.render()}</element.row.Provider>,
|
|
877
|
-
})
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* A list put in order by dragging its items, or from the keyboard: `Reorder.Group` and `Reorder.Item`.
|
|
882
|
-
* Your app owns the order: the group takes it as `values`, and `onReorder` hands each new one back.
|
|
883
|
-
* Motion's `Reorder`. A long list of items of one size reorders as one Batch: `Reorder.BatchGroup` and
|
|
884
|
-
* `Reorder.BatchItem`.
|
|
885
|
-
*
|
|
886
|
-
* @example
|
|
887
|
-
* <Reorder.Group values={items()} onReorder={setItems}>
|
|
888
|
-
* <For each={items()}>{(item) => <Reorder.Item value={item}>{item}</Reorder.Item>}</For>
|
|
889
|
-
* </Reorder.Group>
|
|
890
|
-
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
891
|
-
*/
|
|
892
|
-
// ADR-0020; the Batch pair, ADR-0072 (#712).
|
|
893
|
-
export const Reorder = { Group, Item, BatchGroup, BatchItem } as const
|
|
671
|
+
export type ReorderGripComponentProps<Tag extends ReorderElementTag = "button"> =
|
|
672
|
+
& ItemMotionProps
|
|
673
|
+
& { readonly as?: Tag }
|
|
674
|
+
& Omit<JSX.IntrinsicElements[Tag], "style">
|
|
675
|
+
& { readonly style?: WardStyle | string | undefined }
|