@wardic/solid 1.1.3 → 2.0.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 +3 -3
- package/dist/browser/batch-appear-here.js +2 -3
- package/dist/browser/batch-appear-here.js.map +1 -1
- package/dist/browser/batch-reorder-group.js +130 -207
- package/dist/browser/batch-reorder-group.js.map +1 -1
- package/dist/browser/bridge.js +33 -24
- package/dist/browser/bridge.js.map +1 -1
- package/dist/browser/complete.js +19 -20
- package/dist/browser/complete.js.map +1 -1
- package/dist/browser/config-view.js.map +1 -0
- package/dist/browser/create-animate.js +37 -11
- package/dist/browser/create-animate.js.map +1 -1
- package/dist/browser/create-batch.js +84 -60
- package/dist/browser/create-batch.js.map +1 -1
- package/dist/browser/create-wardic.js +6 -6
- package/dist/browser/create-wardic.js.map +1 -1
- package/dist/browser/cycle.js +3 -2
- package/dist/browser/cycle.js.map +1 -1
- package/dist/browser/drag-sensor.js +12 -13
- package/dist/browser/drag-sensor.js.map +1 -1
- package/dist/browser/element.js +344 -301
- package/dist/browser/element.js.map +1 -1
- package/dist/browser/feature-section.js +22 -12
- package/dist/browser/feature-section.js.map +1 -1
- package/dist/browser/flights.js.map +1 -0
- package/dist/browser/focus-sensor.js +8 -8
- package/dist/browser/focus-sensor.js.map +1 -1
- package/dist/browser/hover-sensor.js +8 -9
- package/dist/browser/hover-sensor.js.map +1 -1
- package/dist/browser/index.js +61 -113
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/layout-projection.js +3 -11
- package/dist/browser/layout-projection.js.map +1 -1
- package/dist/browser/layout.js +32 -51
- package/dist/browser/layout.js.map +1 -1
- package/dist/browser/lifecycle.js.map +1 -0
- package/dist/browser/live-scroll.js +38 -24
- package/dist/browser/live-scroll.js.map +1 -1
- package/dist/browser/live-value.js +69 -70
- package/dist/browser/live-value.js.map +1 -1
- package/dist/browser/presence-handle.js.map +1 -0
- package/dist/browser/presence-hooks.js.map +1 -0
- package/dist/browser/presence.js +63 -145
- package/dist/browser/presence.js.map +1 -1
- package/dist/browser/press-sensor.js +9 -10
- package/dist/browser/press-sensor.js.map +1 -1
- package/dist/browser/provider.js +198 -179
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/reorder.js +518 -390
- package/dist/browser/reorder.js.map +1 -1
- package/dist/browser/runtime.js +1 -1
- package/dist/browser/sensors.js +66 -100
- package/dist/browser/sensors.js.map +1 -1
- package/dist/browser/solid-reactivity.js +76 -11
- package/dist/browser/solid-reactivity.js.map +1 -1
- package/dist/browser/unstable/v2/index.js +87 -113
- package/dist/browser/unstable/v2/index.js.map +1 -1
- package/dist/{server/unstable/v2 → browser/v1}/batch-appear-here.js +3 -2
- package/dist/browser/v1/batch-appear-here.js.map +1 -0
- package/dist/browser/v1/batch-reorder-group.js +371 -0
- package/dist/browser/v1/batch-reorder-group.js.map +1 -0
- package/dist/browser/v1/bridge.js +69 -0
- package/dist/browser/v1/bridge.js.map +1 -0
- package/dist/browser/v1/complete.js +30 -0
- package/dist/browser/v1/complete.js.map +1 -0
- package/dist/browser/v1/create-animate.js +43 -0
- package/dist/browser/v1/create-animate.js.map +1 -0
- package/dist/browser/v1/create-batch.js +120 -0
- package/dist/browser/v1/create-batch.js.map +1 -0
- package/dist/browser/{create-ward.js → v1/create-ward.js} +10 -8
- package/dist/browser/v1/create-ward.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/v1}/create-wardic.js +6 -6
- package/dist/browser/v1/create-wardic.js.map +1 -0
- package/dist/browser/{unstable/v2 → v1}/cycle.js +4 -3
- package/dist/browser/v1/cycle.js.map +1 -0
- package/dist/browser/{directive.js → v1/directive.js} +1 -1
- package/dist/browser/v1/directive.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/v1}/drag-sensor.js +14 -13
- package/dist/browser/v1/drag-sensor.js.map +1 -0
- package/dist/browser/v1/drag.js.map +1 -0
- package/dist/browser/v1/element.js +362 -0
- package/dist/browser/v1/element.js.map +1 -0
- package/dist/browser/v1/feature-section.js +17 -0
- package/dist/browser/v1/feature-section.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/v1}/focus-sensor.js +8 -8
- package/dist/browser/v1/focus-sensor.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/v1}/hover-sensor.js +9 -8
- package/dist/browser/v1/hover-sensor.js.map +1 -0
- package/dist/browser/v1/index.js +259 -0
- package/dist/browser/v1/index.js.map +1 -0
- package/dist/browser/v1/layout-projection.js +26 -0
- package/dist/browser/v1/layout-projection.js.map +1 -0
- package/dist/browser/v1/layout.js +90 -0
- package/dist/browser/v1/layout.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/v1}/live-scroll.js +25 -39
- package/dist/browser/v1/live-scroll.js.map +1 -0
- package/dist/browser/{unstable/v2 → v1}/live-value.js +70 -69
- package/dist/browser/v1/live-value.js.map +1 -0
- package/dist/browser/v1/presence.js +206 -0
- package/dist/browser/v1/presence.js.map +1 -0
- package/dist/browser/{unstable/v2 → v1}/press-sensor.js +10 -9
- package/dist/browser/v1/press-sensor.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/v1}/provider.js +192 -229
- package/dist/browser/v1/provider.js.map +1 -0
- package/dist/browser/v1/reorder.js +540 -0
- package/dist/browser/v1/reorder.js.map +1 -0
- package/dist/browser/v1/sensors.js +172 -0
- package/dist/browser/v1/sensors.js.map +1 -0
- package/dist/browser/{server.js → v1/server.js} +1 -1
- package/dist/browser/v1/server.js.map +1 -0
- package/dist/browser/v1/solid-reactivity.js +26 -0
- package/dist/browser/v1/solid-reactivity.js.map +1 -0
- package/dist/browser/v1/variant-node.js +308 -0
- package/dist/browser/v1/variant-node.js.map +1 -0
- package/dist/browser/v1/variants.js.map +1 -0
- package/dist/browser/v1/w.js +24 -0
- package/dist/browser/v1/w.js.map +1 -0
- package/dist/browser/{unstable/v2 → v1}/wardic-config.js +14 -12
- package/dist/browser/v1/wardic-config.js.map +1 -0
- package/dist/browser/v1/wardic-instance.js.map +1 -0
- package/dist/browser/v1/wardic.js +31 -0
- package/dist/browser/v1/wardic.js.map +1 -0
- package/dist/browser/variant-node.js +176 -87
- package/dist/browser/variant-node.js.map +1 -1
- package/dist/browser/w.js +11 -13
- package/dist/browser/w.js.map +1 -1
- package/dist/browser/waiters.js.map +1 -0
- package/dist/browser/{unstable/v2/ward.js → ward.js} +10 -8
- package/dist/browser/ward.js.map +1 -0
- package/dist/browser/wardic-config.js +12 -14
- package/dist/browser/wardic-config.js.map +1 -1
- package/dist/browser/wardic.js +5 -20
- package/dist/browser/wardic.js.map +1 -1
- package/dist/server/batch-appear-here.js +2 -3
- package/dist/server/batch-appear-here.js.map +1 -1
- package/dist/server/batch-reorder-group.js +284 -246
- package/dist/server/batch-reorder-group.js.map +1 -1
- package/dist/server/bridge.js +33 -24
- package/dist/server/bridge.js.map +1 -1
- package/dist/server/complete.js +19 -20
- package/dist/server/complete.js.map +1 -1
- package/dist/server/config-view.js.map +1 -0
- package/dist/server/create-animate.js +37 -11
- package/dist/server/create-animate.js.map +1 -1
- package/dist/server/create-batch.js +84 -60
- package/dist/server/create-batch.js.map +1 -1
- package/dist/server/create-wardic.js +6 -6
- package/dist/server/create-wardic.js.map +1 -1
- package/dist/server/cycle.js +3 -2
- package/dist/server/cycle.js.map +1 -1
- package/dist/server/drag-sensor.js +12 -13
- package/dist/server/drag-sensor.js.map +1 -1
- package/dist/server/element.js +353 -301
- package/dist/server/element.js.map +1 -1
- package/dist/server/feature-section.js +22 -12
- package/dist/server/feature-section.js.map +1 -1
- package/dist/server/flights.js.map +1 -0
- package/dist/server/focus-sensor.js +8 -8
- package/dist/server/focus-sensor.js.map +1 -1
- package/dist/server/hover-sensor.js +8 -9
- package/dist/server/hover-sensor.js.map +1 -1
- package/dist/server/index.js +61 -113
- package/dist/server/index.js.map +1 -1
- package/dist/server/layout-projection.js +3 -11
- package/dist/server/layout-projection.js.map +1 -1
- package/dist/server/layout.js +54 -55
- package/dist/server/layout.js.map +1 -1
- package/dist/server/lifecycle.js.map +1 -0
- package/dist/server/live-scroll.js +38 -24
- package/dist/server/live-scroll.js.map +1 -1
- package/dist/server/live-value.js +69 -70
- package/dist/server/live-value.js.map +1 -1
- package/dist/server/presence-handle.js.map +1 -0
- package/dist/server/presence-hooks.js.map +1 -0
- package/dist/server/presence.js +90 -154
- package/dist/server/presence.js.map +1 -1
- package/dist/server/press-sensor.js +9 -10
- package/dist/server/press-sensor.js.map +1 -1
- package/dist/server/provider.js +226 -183
- package/dist/server/provider.js.map +1 -1
- package/dist/server/reorder.js +598 -400
- package/dist/server/reorder.js.map +1 -1
- package/dist/server/runtime.js +1 -1
- package/dist/server/sensors.js +66 -100
- package/dist/server/sensors.js.map +1 -1
- package/dist/server/solid-reactivity.js +76 -11
- package/dist/server/solid-reactivity.js.map +1 -1
- package/dist/server/unstable/v2/index.js +87 -113
- package/dist/server/unstable/v2/index.js.map +1 -1
- package/dist/{browser/unstable/v2 → server/v1}/batch-appear-here.js +3 -2
- package/dist/server/v1/batch-appear-here.js.map +1 -0
- package/dist/server/v1/batch-reorder-group.js +367 -0
- package/dist/server/v1/batch-reorder-group.js.map +1 -0
- package/dist/server/v1/bridge.js +69 -0
- package/dist/server/v1/bridge.js.map +1 -0
- package/dist/server/v1/complete.js +30 -0
- package/dist/server/v1/complete.js.map +1 -0
- package/dist/server/v1/create-animate.js +43 -0
- package/dist/server/v1/create-animate.js.map +1 -0
- package/dist/server/v1/create-batch.js +120 -0
- package/dist/server/v1/create-batch.js.map +1 -0
- package/dist/server/{create-ward.js → v1/create-ward.js} +10 -8
- package/dist/server/v1/create-ward.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/v1}/create-wardic.js +6 -6
- package/dist/server/v1/create-wardic.js.map +1 -0
- package/dist/server/{unstable/v2 → v1}/cycle.js +4 -3
- package/dist/server/v1/cycle.js.map +1 -0
- package/dist/server/{directive.js → v1/directive.js} +1 -1
- package/dist/server/v1/directive.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/v1}/drag-sensor.js +14 -13
- package/dist/server/v1/drag-sensor.js.map +1 -0
- package/dist/server/v1/drag.js.map +1 -0
- package/dist/server/v1/element.js +362 -0
- package/dist/server/v1/element.js.map +1 -0
- package/dist/server/v1/feature-section.js +17 -0
- package/dist/server/v1/feature-section.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/v1}/focus-sensor.js +8 -8
- package/dist/server/v1/focus-sensor.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/v1}/hover-sensor.js +9 -8
- package/dist/server/v1/hover-sensor.js.map +1 -0
- package/dist/server/v1/index.js +259 -0
- package/dist/server/v1/index.js.map +1 -0
- package/dist/server/v1/layout-projection.js +26 -0
- package/dist/server/v1/layout-projection.js.map +1 -0
- package/dist/server/v1/layout.js +89 -0
- package/dist/server/v1/layout.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/v1}/live-scroll.js +25 -39
- package/dist/server/v1/live-scroll.js.map +1 -0
- package/dist/server/{unstable/v2 → v1}/live-value.js +70 -69
- package/dist/server/v1/live-value.js.map +1 -0
- package/dist/server/v1/presence.js +206 -0
- package/dist/server/v1/presence.js.map +1 -0
- package/dist/server/{unstable/v2 → v1}/press-sensor.js +10 -9
- package/dist/server/v1/press-sensor.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/v1}/provider.js +176 -201
- package/dist/server/v1/provider.js.map +1 -0
- package/dist/server/v1/reorder.js +540 -0
- package/dist/server/v1/reorder.js.map +1 -0
- package/dist/server/v1/sensors.js +172 -0
- package/dist/server/v1/sensors.js.map +1 -0
- package/dist/server/{server.js → v1/server.js} +1 -1
- package/dist/server/v1/server.js.map +1 -0
- package/dist/server/v1/solid-reactivity.js +26 -0
- package/dist/server/v1/solid-reactivity.js.map +1 -0
- package/dist/server/v1/variant-node.js +308 -0
- package/dist/server/v1/variant-node.js.map +1 -0
- package/dist/server/v1/variants.js.map +1 -0
- package/dist/server/v1/w.js +24 -0
- package/dist/server/v1/w.js.map +1 -0
- package/dist/server/v1/wardic-config.js +42 -0
- package/dist/server/v1/wardic-config.js.map +1 -0
- package/dist/server/v1/wardic-instance.js.map +1 -0
- package/dist/server/v1/wardic.js +31 -0
- package/dist/server/v1/wardic.js.map +1 -0
- package/dist/server/variant-node.js +176 -87
- package/dist/server/variant-node.js.map +1 -1
- package/dist/server/w.js +11 -13
- package/dist/server/w.js.map +1 -1
- package/dist/server/waiters.js.map +1 -0
- package/dist/server/{unstable/v2/ward.js → ward.js} +10 -8
- package/dist/server/ward.js.map +1 -0
- package/dist/server/wardic-config.js +32 -25
- package/dist/server/wardic-config.js.map +1 -1
- package/dist/server/wardic.js +5 -20
- package/dist/server/wardic.js.map +1 -1
- package/dist/solid/batch-appear-here.d.ts.map +1 -1
- package/dist/solid/batch-appear-here.jsx +2 -3
- package/dist/solid/batch-appear-here.jsx.map +1 -1
- package/dist/solid/batch-reorder-group.d.ts +18 -18
- package/dist/solid/batch-reorder-group.d.ts.map +1 -1
- package/dist/solid/batch-reorder-group.jsx +103 -166
- package/dist/solid/batch-reorder-group.jsx.map +1 -1
- package/dist/solid/bridge.d.ts +10 -27
- package/dist/solid/bridge.d.ts.map +1 -1
- package/dist/solid/bridge.jsx +33 -21
- package/dist/solid/bridge.jsx.map +1 -1
- package/dist/solid/complete.d.ts +13 -23
- package/dist/solid/complete.d.ts.map +1 -1
- package/dist/solid/complete.jsx +20 -20
- package/dist/solid/complete.jsx.map +1 -1
- package/dist/solid/config-view.d.ts.map +1 -0
- package/dist/solid/config-view.js.map +1 -0
- package/dist/solid/create-animate.d.ts +19 -5
- package/dist/solid/create-animate.d.ts.map +1 -1
- package/dist/solid/create-animate.jsx +27 -11
- package/dist/solid/create-animate.jsx.map +1 -1
- package/dist/solid/create-batch.d.ts +48 -36
- package/dist/solid/create-batch.d.ts.map +1 -1
- package/dist/solid/create-batch.jsx +83 -57
- package/dist/solid/create-batch.jsx.map +1 -1
- package/dist/solid/create-wardic.d.ts +9 -8
- package/dist/solid/create-wardic.d.ts.map +1 -1
- package/dist/solid/create-wardic.jsx +6 -6
- package/dist/solid/create-wardic.jsx.map +1 -1
- package/dist/solid/cycle.d.ts +2 -2
- package/dist/solid/cycle.d.ts.map +1 -1
- package/dist/solid/cycle.js +3 -2
- package/dist/solid/cycle.js.map +1 -1
- package/dist/solid/drag-sensor.d.ts +8 -8
- package/dist/solid/drag-sensor.d.ts.map +1 -1
- package/dist/solid/drag-sensor.jsx +12 -13
- package/dist/solid/drag-sensor.jsx.map +1 -1
- package/dist/solid/element.d.ts +178 -57
- package/dist/solid/element.d.ts.map +1 -1
- package/dist/solid/element.jsx +276 -274
- package/dist/solid/element.jsx.map +1 -1
- package/dist/solid/feature-section.d.ts +6 -12
- package/dist/solid/feature-section.d.ts.map +1 -1
- package/dist/solid/feature-section.js +20 -10
- package/dist/solid/feature-section.js.map +1 -1
- package/dist/solid/flights.d.ts.map +1 -0
- package/dist/solid/flights.js.map +1 -0
- package/dist/solid/focus-sensor.d.ts +6 -12
- package/dist/solid/focus-sensor.d.ts.map +1 -1
- package/dist/solid/focus-sensor.jsx +8 -8
- package/dist/solid/focus-sensor.jsx.map +1 -1
- package/dist/solid/hover-sensor.d.ts +6 -13
- package/dist/solid/hover-sensor.d.ts.map +1 -1
- package/dist/solid/hover-sensor.jsx +8 -9
- package/dist/solid/hover-sensor.jsx.map +1 -1
- package/dist/solid/index.d.ts +75 -131
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.jsx +61 -113
- package/dist/solid/index.jsx.map +1 -1
- package/dist/solid/layout-projection.d.ts +3 -10
- package/dist/solid/layout-projection.d.ts.map +1 -1
- package/dist/solid/layout-projection.jsx +3 -11
- package/dist/solid/layout-projection.jsx.map +1 -1
- package/dist/solid/layout.d.ts +9 -38
- package/dist/solid/layout.d.ts.map +1 -1
- package/dist/solid/layout.jsx +27 -44
- package/dist/solid/layout.jsx.map +1 -1
- package/dist/solid/lifecycle.d.ts.map +1 -0
- package/dist/solid/lifecycle.js.map +1 -0
- package/dist/solid/live-scroll.d.ts.map +1 -1
- package/dist/solid/live-scroll.jsx +29 -18
- package/dist/solid/live-scroll.jsx.map +1 -1
- package/dist/solid/live-value.d.ts +9 -7
- package/dist/solid/live-value.d.ts.map +1 -1
- package/dist/solid/live-value.jsx +74 -72
- package/dist/solid/live-value.jsx.map +1 -1
- package/dist/solid/presence-handle.d.ts.map +1 -0
- package/dist/solid/presence-handle.js.map +1 -0
- package/dist/solid/presence-hooks.d.ts.map +1 -0
- package/dist/solid/presence-hooks.jsx.map +1 -0
- package/dist/solid/presence.d.ts +33 -37
- package/dist/solid/presence.d.ts.map +1 -1
- package/dist/solid/presence.jsx +60 -147
- package/dist/solid/presence.jsx.map +1 -1
- package/dist/solid/press-sensor.d.ts +7 -14
- package/dist/solid/press-sensor.d.ts.map +1 -1
- package/dist/solid/press-sensor.jsx +9 -10
- package/dist/solid/press-sensor.jsx.map +1 -1
- package/dist/solid/provider.d.ts +31 -55
- package/dist/solid/provider.d.ts.map +1 -1
- package/dist/solid/provider.jsx +181 -160
- package/dist/solid/provider.jsx.map +1 -1
- package/dist/solid/reorder.d.ts +193 -142
- package/dist/solid/reorder.d.ts.map +1 -1
- package/dist/solid/reorder.jsx +411 -309
- package/dist/solid/reorder.jsx.map +1 -1
- package/dist/solid/runtime.d.ts +1 -1
- package/dist/solid/runtime.js +1 -1
- package/dist/solid/sensors.d.ts +45 -49
- package/dist/solid/sensors.d.ts.map +1 -1
- package/dist/solid/sensors.jsx +59 -89
- package/dist/solid/sensors.jsx.map +1 -1
- package/dist/solid/solid-reactivity.d.ts +66 -1
- package/dist/solid/solid-reactivity.d.ts.map +1 -1
- package/dist/solid/solid-reactivity.js +61 -9
- package/dist/solid/solid-reactivity.js.map +1 -1
- package/dist/solid/unstable/v2/index.d.ts +497 -131
- package/dist/solid/unstable/v2/index.d.ts.map +1 -1
- package/dist/solid/unstable/v2/index.jsx +169 -113
- package/dist/solid/unstable/v2/index.jsx.map +1 -1
- package/dist/solid/v1/batch-appear-here.d.ts.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/batch-appear-here.jsx +3 -2
- package/dist/solid/v1/batch-appear-here.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/batch-reorder-group.d.ts +20 -20
- package/dist/solid/v1/batch-reorder-group.d.ts.map +1 -0
- package/dist/solid/v1/batch-reorder-group.jsx +301 -0
- package/dist/solid/v1/batch-reorder-group.jsx.map +1 -0
- package/dist/solid/v1/bridge.d.ts +53 -0
- package/dist/solid/v1/bridge.d.ts.map +1 -0
- package/dist/solid/v1/bridge.jsx +66 -0
- package/dist/solid/v1/bridge.jsx.map +1 -0
- package/dist/solid/v1/complete.d.ts +31 -0
- package/dist/solid/v1/complete.d.ts.map +1 -0
- package/dist/solid/v1/complete.jsx +27 -0
- package/dist/solid/v1/complete.jsx.map +1 -0
- package/dist/solid/v1/create-animate.d.ts +17 -0
- package/dist/solid/v1/create-animate.d.ts.map +1 -0
- package/dist/solid/v1/create-animate.jsx +44 -0
- package/dist/solid/v1/create-animate.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/create-batch.d.ts +36 -48
- package/dist/solid/v1/create-batch.d.ts.map +1 -0
- package/dist/solid/v1/create-batch.jsx +109 -0
- package/dist/solid/v1/create-batch.jsx.map +1 -0
- package/dist/solid/{create-ward.d.ts → v1/create-ward.d.ts} +1 -1
- package/dist/solid/v1/create-ward.d.ts.map +1 -0
- package/dist/solid/{create-ward.jsx → v1/create-ward.jsx} +10 -8
- package/dist/solid/v1/create-ward.jsx.map +1 -0
- package/dist/solid/v1/create-wardic.d.ts +24 -0
- package/dist/solid/v1/create-wardic.d.ts.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/create-wardic.jsx +6 -6
- package/dist/solid/v1/create-wardic.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/cycle.d.ts +4 -3
- package/dist/solid/v1/cycle.d.ts.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/cycle.js +4 -3
- package/dist/solid/v1/cycle.js.map +1 -0
- package/dist/solid/v1/directive.d.ts.map +1 -0
- package/dist/solid/{directive.jsx → v1/directive.jsx} +1 -1
- package/dist/solid/v1/directive.jsx.map +1 -0
- package/dist/solid/v1/drag-sensor.d.ts +23 -0
- package/dist/solid/v1/drag-sensor.d.ts.map +1 -0
- package/dist/solid/v1/drag-sensor.jsx +33 -0
- package/dist/solid/v1/drag-sensor.jsx.map +1 -0
- package/dist/solid/{drag.d.ts → v1/drag.d.ts} +1 -1
- package/dist/solid/v1/drag.d.ts.map +1 -0
- package/dist/solid/v1/drag.jsx.map +1 -0
- package/dist/solid/v1/element.d.ts +92 -0
- package/dist/solid/v1/element.d.ts.map +1 -0
- package/dist/solid/v1/element.jsx +334 -0
- package/dist/solid/v1/element.jsx.map +1 -0
- package/dist/solid/v1/feature-section.d.ts +18 -0
- package/dist/solid/v1/feature-section.d.ts.map +1 -0
- package/dist/solid/v1/feature-section.js +13 -0
- package/dist/solid/v1/feature-section.js.map +1 -0
- package/dist/solid/v1/focus-sensor.d.ts +19 -0
- package/dist/solid/v1/focus-sensor.d.ts.map +1 -0
- package/dist/solid/v1/focus-sensor.jsx +23 -0
- package/dist/solid/v1/focus-sensor.jsx.map +1 -0
- package/dist/solid/v1/hover-sensor.d.ts +19 -0
- package/dist/solid/v1/hover-sensor.d.ts.map +1 -0
- package/dist/solid/v1/hover-sensor.jsx +23 -0
- package/dist/solid/v1/hover-sensor.jsx.map +1 -0
- package/dist/solid/v1/index.d.ts +647 -0
- package/dist/solid/v1/index.d.ts.map +1 -0
- package/dist/solid/v1/index.jsx +343 -0
- package/dist/solid/v1/index.jsx.map +1 -0
- package/dist/solid/v1/layout-projection.d.ts +28 -0
- package/dist/solid/v1/layout-projection.d.ts.map +1 -0
- package/dist/solid/v1/layout-projection.jsx +26 -0
- package/dist/solid/v1/layout-projection.jsx.map +1 -0
- package/dist/solid/v1/layout.d.ts +76 -0
- package/dist/solid/v1/layout.d.ts.map +1 -0
- package/dist/solid/v1/layout.jsx +79 -0
- package/dist/solid/v1/layout.jsx.map +1 -0
- package/dist/solid/v1/live-scroll.d.ts.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/live-scroll.jsx +19 -30
- package/dist/solid/v1/live-scroll.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/live-value.d.ts +7 -9
- package/dist/solid/v1/live-value.d.ts.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/live-value.jsx +72 -74
- package/dist/solid/v1/live-value.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/presence.d.ts +37 -33
- package/dist/solid/v1/presence.d.ts.map +1 -0
- package/dist/solid/v1/presence.jsx +194 -0
- package/dist/solid/v1/presence.jsx.map +1 -0
- package/dist/solid/v1/press-sensor.d.ts +20 -0
- package/dist/solid/v1/press-sensor.d.ts.map +1 -0
- package/dist/solid/v1/press-sensor.jsx +24 -0
- package/dist/solid/v1/press-sensor.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/provider.d.ts +55 -31
- package/dist/solid/v1/provider.d.ts.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/provider.jsx +163 -184
- package/dist/solid/v1/provider.jsx.map +1 -0
- package/dist/solid/v1/reorder.d.ts +246 -0
- package/dist/solid/v1/reorder.d.ts.map +1 -0
- package/dist/solid/v1/reorder.jsx +429 -0
- package/dist/solid/v1/reorder.jsx.map +1 -0
- package/dist/solid/v1/sensors.d.ts +95 -0
- package/dist/solid/v1/sensors.d.ts.map +1 -0
- package/dist/solid/v1/sensors.jsx +154 -0
- package/dist/solid/v1/sensors.jsx.map +1 -0
- package/dist/solid/v1/server.d.ts.map +1 -0
- package/dist/solid/{server.js → v1/server.js} +1 -1
- package/dist/solid/v1/server.js.map +1 -0
- package/dist/solid/v1/solid-reactivity.d.ts +3 -0
- package/dist/solid/v1/solid-reactivity.d.ts.map +1 -0
- package/dist/solid/v1/solid-reactivity.js +19 -0
- package/dist/solid/v1/solid-reactivity.js.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/variant-node.d.ts +5 -24
- package/dist/solid/v1/variant-node.d.ts.map +1 -0
- package/dist/solid/v1/variant-node.js +257 -0
- package/dist/solid/v1/variant-node.js.map +1 -0
- package/dist/solid/v1/variants.d.ts.map +1 -0
- package/dist/solid/v1/variants.js.map +1 -0
- package/dist/solid/v1/w.d.ts +57 -0
- package/dist/solid/v1/w.d.ts.map +1 -0
- package/dist/solid/v1/w.jsx +24 -0
- package/dist/solid/v1/w.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/wardic-config.d.ts +4 -3
- package/dist/solid/v1/wardic-config.d.ts.map +1 -0
- package/dist/solid/v1/wardic-config.jsx +30 -0
- package/dist/solid/v1/wardic-config.jsx.map +1 -0
- package/dist/solid/{unstable/v2 → v1}/wardic-instance.d.ts +10 -11
- package/dist/solid/v1/wardic-instance.d.ts.map +1 -0
- package/dist/solid/v1/wardic-instance.js.map +1 -0
- package/dist/solid/v1/wardic.d.ts +45 -0
- package/dist/solid/v1/wardic.d.ts.map +1 -0
- package/dist/solid/v1/wardic.jsx +31 -0
- package/dist/solid/v1/wardic.jsx.map +1 -0
- package/dist/solid/variant-node.d.ts +24 -5
- package/dist/solid/variant-node.d.ts.map +1 -1
- package/dist/solid/variant-node.js +161 -80
- package/dist/solid/variant-node.js.map +1 -1
- package/dist/solid/w.d.ts +42 -25
- package/dist/solid/w.d.ts.map +1 -1
- package/dist/solid/w.jsx +10 -14
- package/dist/solid/w.jsx.map +1 -1
- package/dist/solid/waiters.d.ts.map +1 -0
- package/dist/solid/waiters.js.map +1 -0
- package/dist/solid/{unstable/v2/ward.d.ts → ward.d.ts} +4 -4
- package/dist/solid/ward.d.ts.map +1 -0
- package/dist/solid/{unstable/v2/ward.jsx → ward.jsx} +10 -8
- package/dist/solid/ward.jsx.map +1 -0
- package/dist/solid/wardic-config.d.ts +3 -4
- package/dist/solid/wardic-config.d.ts.map +1 -1
- package/dist/solid/wardic-config.jsx +11 -13
- package/dist/solid/wardic-config.jsx.map +1 -1
- package/dist/solid/wardic-instance.d.ts +11 -10
- package/dist/solid/wardic-instance.d.ts.map +1 -1
- package/dist/solid/wardic.d.ts +10 -27
- package/dist/solid/wardic.d.ts.map +1 -1
- package/dist/solid/wardic.jsx +5 -20
- package/dist/solid/wardic.jsx.map +1 -1
- package/package.json +20 -10
- package/src/batch-appear-here.tsx +2 -3
- package/src/batch-reorder-group.tsx +142 -256
- package/src/bridge.tsx +32 -49
- package/src/complete.tsx +33 -31
- package/src/create-animate.tsx +47 -12
- package/src/create-batch.tsx +134 -87
- package/src/create-wardic.tsx +10 -9
- package/src/cycle.ts +3 -2
- package/src/drag-sensor.tsx +13 -15
- package/src/element.tsx +441 -336
- package/src/feature-section.ts +16 -17
- package/src/focus-sensor.tsx +8 -9
- package/src/hover-sensor.tsx +8 -10
- package/src/index.tsx +153 -223
- package/src/layout-projection.tsx +3 -13
- package/src/layout.tsx +31 -68
- package/src/live-scroll.tsx +50 -35
- package/src/live-value.tsx +113 -104
- package/src/presence.tsx +70 -162
- package/src/press-sensor.tsx +9 -11
- package/src/provider.tsx +201 -193
- package/src/reorder.tsx +671 -483
- package/src/runtime.ts +1 -1
- package/src/sensors.tsx +90 -110
- package/src/solid-reactivity.ts +70 -11
- package/src/unstable/v2/index.tsx +407 -208
- package/src/{unstable/v2 → v1}/batch-appear-here.tsx +3 -2
- package/src/v1/batch-reorder-group.tsx +523 -0
- package/src/v1/bridge.tsx +99 -0
- package/src/v1/complete.tsx +45 -0
- package/src/v1/create-animate.tsx +43 -0
- package/src/v1/create-batch.tsx +201 -0
- package/src/{create-ward.tsx → v1/create-ward.tsx} +12 -9
- package/src/{unstable/v2 → v1}/create-wardic.tsx +9 -10
- package/src/{unstable/v2 → v1}/cycle.ts +6 -5
- package/src/{directive.tsx → v1/directive.tsx} +1 -1
- package/src/{unstable/v2 → v1}/drag-sensor.tsx +16 -14
- package/src/{drag.tsx → v1/drag.tsx} +1 -1
- package/src/v1/element.tsx +437 -0
- package/src/v1/feature-section.ts +33 -0
- package/src/{unstable/v2 → v1}/focus-sensor.tsx +9 -8
- package/src/v1/hover-sensor.tsx +32 -0
- package/src/v1/index.tsx +730 -0
- package/src/{unstable/v2 → v1}/layout-projection.tsx +13 -3
- package/src/v1/layout.tsx +126 -0
- package/src/{unstable/v2 → v1}/live-scroll.tsx +36 -51
- package/src/{unstable/v2 → v1}/live-value.tsx +104 -113
- package/src/v1/presence.tsx +267 -0
- package/src/v1/press-sensor.tsx +33 -0
- package/src/{unstable/v2 → v1}/provider.tsx +196 -204
- package/src/v1/reorder.tsx +705 -0
- package/src/v1/sensors.tsx +189 -0
- package/src/{server.ts → v1/server.ts} +1 -1
- package/src/v1/solid-reactivity.ts +21 -0
- package/src/{unstable/v2 → v1}/variant-node.ts +96 -175
- package/src/v1/w.tsx +77 -0
- package/src/{unstable/v2 → v1}/wardic-config.tsx +10 -16
- package/src/{unstable/v2 → v1}/wardic-instance.ts +11 -12
- package/src/v1/wardic.tsx +59 -0
- package/src/variant-node.ts +175 -96
- package/src/w.tsx +52 -43
- package/src/{unstable/v2/ward.tsx → ward.tsx} +14 -11
- package/src/wardic-config.tsx +16 -10
- package/src/wardic-instance.ts +12 -11
- package/src/wardic.tsx +22 -40
- package/dist/browser/create-ward.js.map +0 -1
- package/dist/browser/directive.js.map +0 -1
- package/dist/browser/drag.js.map +0 -1
- package/dist/browser/page-point.js +0 -92
- package/dist/browser/page-point.js.map +0 -1
- package/dist/browser/server.js.map +0 -1
- package/dist/browser/unstable/v2/batch-appear-here.js.map +0 -1
- package/dist/browser/unstable/v2/batch-reorder-group.js +0 -294
- package/dist/browser/unstable/v2/batch-reorder-group.js.map +0 -1
- package/dist/browser/unstable/v2/bridge.js +0 -78
- package/dist/browser/unstable/v2/bridge.js.map +0 -1
- package/dist/browser/unstable/v2/complete.js +0 -29
- package/dist/browser/unstable/v2/complete.js.map +0 -1
- package/dist/browser/unstable/v2/config-view.js.map +0 -1
- package/dist/browser/unstable/v2/create-animate.js +0 -69
- package/dist/browser/unstable/v2/create-animate.js.map +0 -1
- package/dist/browser/unstable/v2/create-batch.js +0 -144
- package/dist/browser/unstable/v2/create-batch.js.map +0 -1
- package/dist/browser/unstable/v2/create-wardic.js.map +0 -1
- package/dist/browser/unstable/v2/cycle.js.map +0 -1
- package/dist/browser/unstable/v2/drag-sensor.js.map +0 -1
- package/dist/browser/unstable/v2/element.js +0 -405
- package/dist/browser/unstable/v2/element.js.map +0 -1
- package/dist/browser/unstable/v2/feature-section.js +0 -27
- package/dist/browser/unstable/v2/feature-section.js.map +0 -1
- package/dist/browser/unstable/v2/flights.js.map +0 -1
- package/dist/browser/unstable/v2/focus-sensor.js.map +0 -1
- package/dist/browser/unstable/v2/hover-sensor.js.map +0 -1
- package/dist/browser/unstable/v2/layout-projection.js +0 -18
- package/dist/browser/unstable/v2/layout-projection.js.map +0 -1
- package/dist/browser/unstable/v2/layout.js +0 -71
- package/dist/browser/unstable/v2/layout.js.map +0 -1
- package/dist/browser/unstable/v2/lifecycle.js.map +0 -1
- package/dist/browser/unstable/v2/live-scroll.js.map +0 -1
- package/dist/browser/unstable/v2/live-value.js.map +0 -1
- package/dist/browser/unstable/v2/presence-handle.js.map +0 -1
- package/dist/browser/unstable/v2/presence-hooks.js.map +0 -1
- package/dist/browser/unstable/v2/presence.js +0 -124
- package/dist/browser/unstable/v2/presence.js.map +0 -1
- package/dist/browser/unstable/v2/press-sensor.js.map +0 -1
- package/dist/browser/unstable/v2/provider.js.map +0 -1
- package/dist/browser/unstable/v2/reorder.js +0 -668
- package/dist/browser/unstable/v2/reorder.js.map +0 -1
- package/dist/browser/unstable/v2/sensors.js +0 -138
- package/dist/browser/unstable/v2/sensors.js.map +0 -1
- package/dist/browser/unstable/v2/solid-reactivity.js +0 -91
- package/dist/browser/unstable/v2/solid-reactivity.js.map +0 -1
- package/dist/browser/unstable/v2/variant-node.js +0 -397
- package/dist/browser/unstable/v2/variant-node.js.map +0 -1
- package/dist/browser/unstable/v2/w.js +0 -22
- package/dist/browser/unstable/v2/w.js.map +0 -1
- package/dist/browser/unstable/v2/waiters.js.map +0 -1
- package/dist/browser/unstable/v2/ward.js.map +0 -1
- package/dist/browser/unstable/v2/wardic-config.js.map +0 -1
- package/dist/browser/unstable/v2/wardic-instance.js.map +0 -1
- package/dist/browser/unstable/v2/wardic.js +0 -16
- package/dist/browser/unstable/v2/wardic.js.map +0 -1
- package/dist/browser/variants.js.map +0 -1
- package/dist/server/create-ward.js.map +0 -1
- package/dist/server/directive.js.map +0 -1
- package/dist/server/drag.js.map +0 -1
- package/dist/server/page-point.js +0 -92
- package/dist/server/page-point.js.map +0 -1
- package/dist/server/server.js.map +0 -1
- package/dist/server/unstable/v2/batch-appear-here.js.map +0 -1
- package/dist/server/unstable/v2/batch-reorder-group.js +0 -405
- package/dist/server/unstable/v2/batch-reorder-group.js.map +0 -1
- package/dist/server/unstable/v2/bridge.js +0 -78
- package/dist/server/unstable/v2/bridge.js.map +0 -1
- package/dist/server/unstable/v2/complete.js +0 -29
- package/dist/server/unstable/v2/complete.js.map +0 -1
- package/dist/server/unstable/v2/config-view.js.map +0 -1
- package/dist/server/unstable/v2/create-animate.js +0 -69
- package/dist/server/unstable/v2/create-animate.js.map +0 -1
- package/dist/server/unstable/v2/create-batch.js +0 -144
- package/dist/server/unstable/v2/create-batch.js.map +0 -1
- package/dist/server/unstable/v2/create-wardic.js.map +0 -1
- package/dist/server/unstable/v2/cycle.js.map +0 -1
- package/dist/server/unstable/v2/drag-sensor.js.map +0 -1
- package/dist/server/unstable/v2/element.js +0 -414
- package/dist/server/unstable/v2/element.js.map +0 -1
- package/dist/server/unstable/v2/feature-section.js +0 -27
- package/dist/server/unstable/v2/feature-section.js.map +0 -1
- package/dist/server/unstable/v2/flights.js.map +0 -1
- package/dist/server/unstable/v2/focus-sensor.js.map +0 -1
- package/dist/server/unstable/v2/hover-sensor.js.map +0 -1
- package/dist/server/unstable/v2/layout-projection.js +0 -18
- package/dist/server/unstable/v2/layout-projection.js.map +0 -1
- package/dist/server/unstable/v2/layout.js +0 -88
- package/dist/server/unstable/v2/layout.js.map +0 -1
- package/dist/server/unstable/v2/lifecycle.js.map +0 -1
- package/dist/server/unstable/v2/live-scroll.js.map +0 -1
- package/dist/server/unstable/v2/live-value.js.map +0 -1
- package/dist/server/unstable/v2/presence-handle.js.map +0 -1
- package/dist/server/unstable/v2/presence-hooks.js.map +0 -1
- package/dist/server/unstable/v2/presence.js +0 -142
- package/dist/server/unstable/v2/presence.js.map +0 -1
- package/dist/server/unstable/v2/press-sensor.js.map +0 -1
- package/dist/server/unstable/v2/provider.js.map +0 -1
- package/dist/server/unstable/v2/reorder.js +0 -738
- package/dist/server/unstable/v2/reorder.js.map +0 -1
- package/dist/server/unstable/v2/sensors.js +0 -138
- package/dist/server/unstable/v2/sensors.js.map +0 -1
- package/dist/server/unstable/v2/solid-reactivity.js +0 -91
- package/dist/server/unstable/v2/solid-reactivity.js.map +0 -1
- package/dist/server/unstable/v2/variant-node.js +0 -397
- package/dist/server/unstable/v2/variant-node.js.map +0 -1
- package/dist/server/unstable/v2/w.js +0 -22
- package/dist/server/unstable/v2/w.js.map +0 -1
- package/dist/server/unstable/v2/waiters.js.map +0 -1
- package/dist/server/unstable/v2/ward.js.map +0 -1
- package/dist/server/unstable/v2/wardic-config.js +0 -49
- package/dist/server/unstable/v2/wardic-config.js.map +0 -1
- package/dist/server/unstable/v2/wardic-instance.js.map +0 -1
- package/dist/server/unstable/v2/wardic.js +0 -16
- package/dist/server/unstable/v2/wardic.js.map +0 -1
- package/dist/server/variants.js.map +0 -1
- package/dist/solid/create-ward.d.ts.map +0 -1
- package/dist/solid/create-ward.jsx.map +0 -1
- package/dist/solid/directive.d.ts.map +0 -1
- package/dist/solid/directive.jsx.map +0 -1
- package/dist/solid/drag.d.ts.map +0 -1
- package/dist/solid/drag.jsx.map +0 -1
- package/dist/solid/page-point.d.ts +0 -35
- package/dist/solid/page-point.d.ts.map +0 -1
- package/dist/solid/page-point.js +0 -87
- package/dist/solid/page-point.js.map +0 -1
- package/dist/solid/server.d.ts.map +0 -1
- package/dist/solid/server.js.map +0 -1
- package/dist/solid/unstable/v2/batch-appear-here.d.ts.map +0 -1
- package/dist/solid/unstable/v2/batch-appear-here.jsx.map +0 -1
- package/dist/solid/unstable/v2/batch-reorder-group.d.ts.map +0 -1
- package/dist/solid/unstable/v2/batch-reorder-group.jsx +0 -238
- package/dist/solid/unstable/v2/batch-reorder-group.jsx.map +0 -1
- package/dist/solid/unstable/v2/bridge.d.ts +0 -36
- package/dist/solid/unstable/v2/bridge.d.ts.map +0 -1
- package/dist/solid/unstable/v2/bridge.jsx +0 -78
- package/dist/solid/unstable/v2/bridge.jsx.map +0 -1
- package/dist/solid/unstable/v2/complete.d.ts +0 -21
- package/dist/solid/unstable/v2/complete.d.ts.map +0 -1
- package/dist/solid/unstable/v2/complete.jsx +0 -27
- package/dist/solid/unstable/v2/complete.jsx.map +0 -1
- package/dist/solid/unstable/v2/config-view.d.ts.map +0 -1
- package/dist/solid/unstable/v2/config-view.js.map +0 -1
- package/dist/solid/unstable/v2/create-animate.d.ts +0 -31
- package/dist/solid/unstable/v2/create-animate.d.ts.map +0 -1
- package/dist/solid/unstable/v2/create-animate.jsx +0 -60
- package/dist/solid/unstable/v2/create-animate.jsx.map +0 -1
- package/dist/solid/unstable/v2/create-batch.d.ts.map +0 -1
- package/dist/solid/unstable/v2/create-batch.jsx +0 -135
- package/dist/solid/unstable/v2/create-batch.jsx.map +0 -1
- package/dist/solid/unstable/v2/create-wardic.d.ts +0 -25
- package/dist/solid/unstable/v2/create-wardic.d.ts.map +0 -1
- package/dist/solid/unstable/v2/create-wardic.jsx.map +0 -1
- package/dist/solid/unstable/v2/cycle.d.ts.map +0 -1
- package/dist/solid/unstable/v2/cycle.js.map +0 -1
- package/dist/solid/unstable/v2/drag-sensor.d.ts +0 -23
- package/dist/solid/unstable/v2/drag-sensor.d.ts.map +0 -1
- package/dist/solid/unstable/v2/drag-sensor.jsx +0 -32
- package/dist/solid/unstable/v2/drag-sensor.jsx.map +0 -1
- package/dist/solid/unstable/v2/element.d.ts +0 -213
- package/dist/solid/unstable/v2/element.d.ts.map +0 -1
- package/dist/solid/unstable/v2/element.jsx +0 -336
- package/dist/solid/unstable/v2/element.jsx.map +0 -1
- package/dist/solid/unstable/v2/feature-section.d.ts +0 -12
- package/dist/solid/unstable/v2/feature-section.d.ts.map +0 -1
- package/dist/solid/unstable/v2/feature-section.js +0 -23
- package/dist/solid/unstable/v2/feature-section.js.map +0 -1
- package/dist/solid/unstable/v2/flights.d.ts.map +0 -1
- package/dist/solid/unstable/v2/flights.js.map +0 -1
- package/dist/solid/unstable/v2/focus-sensor.d.ts +0 -13
- package/dist/solid/unstable/v2/focus-sensor.d.ts.map +0 -1
- package/dist/solid/unstable/v2/focus-sensor.jsx +0 -23
- package/dist/solid/unstable/v2/focus-sensor.jsx.map +0 -1
- package/dist/solid/unstable/v2/hover-sensor.d.ts +0 -12
- package/dist/solid/unstable/v2/hover-sensor.d.ts.map +0 -1
- package/dist/solid/unstable/v2/hover-sensor.jsx +0 -22
- package/dist/solid/unstable/v2/hover-sensor.jsx.map +0 -1
- package/dist/solid/unstable/v2/layout-projection.d.ts +0 -21
- package/dist/solid/unstable/v2/layout-projection.d.ts.map +0 -1
- package/dist/solid/unstable/v2/layout-projection.jsx +0 -18
- package/dist/solid/unstable/v2/layout-projection.jsx.map +0 -1
- package/dist/solid/unstable/v2/layout.d.ts +0 -47
- package/dist/solid/unstable/v2/layout.d.ts.map +0 -1
- package/dist/solid/unstable/v2/layout.jsx +0 -62
- package/dist/solid/unstable/v2/layout.jsx.map +0 -1
- package/dist/solid/unstable/v2/lifecycle.d.ts.map +0 -1
- package/dist/solid/unstable/v2/lifecycle.js.map +0 -1
- package/dist/solid/unstable/v2/live-scroll.d.ts.map +0 -1
- package/dist/solid/unstable/v2/live-scroll.jsx.map +0 -1
- package/dist/solid/unstable/v2/live-value.d.ts.map +0 -1
- package/dist/solid/unstable/v2/live-value.jsx.map +0 -1
- package/dist/solid/unstable/v2/presence-handle.d.ts.map +0 -1
- package/dist/solid/unstable/v2/presence-handle.js.map +0 -1
- package/dist/solid/unstable/v2/presence-hooks.d.ts.map +0 -1
- package/dist/solid/unstable/v2/presence-hooks.jsx.map +0 -1
- package/dist/solid/unstable/v2/presence.d.ts.map +0 -1
- package/dist/solid/unstable/v2/presence.jsx +0 -107
- package/dist/solid/unstable/v2/presence.jsx.map +0 -1
- package/dist/solid/unstable/v2/press-sensor.d.ts +0 -13
- package/dist/solid/unstable/v2/press-sensor.d.ts.map +0 -1
- package/dist/solid/unstable/v2/press-sensor.jsx +0 -23
- package/dist/solid/unstable/v2/press-sensor.jsx.map +0 -1
- package/dist/solid/unstable/v2/provider.d.ts.map +0 -1
- package/dist/solid/unstable/v2/provider.jsx.map +0 -1
- package/dist/solid/unstable/v2/reorder.d.ts +0 -297
- package/dist/solid/unstable/v2/reorder.d.ts.map +0 -1
- package/dist/solid/unstable/v2/reorder.jsx +0 -531
- package/dist/solid/unstable/v2/reorder.jsx.map +0 -1
- package/dist/solid/unstable/v2/sensors.d.ts +0 -91
- package/dist/solid/unstable/v2/sensors.d.ts.map +0 -1
- package/dist/solid/unstable/v2/sensors.jsx +0 -124
- package/dist/solid/unstable/v2/sensors.jsx.map +0 -1
- package/dist/solid/unstable/v2/solid-reactivity.d.ts +0 -68
- package/dist/solid/unstable/v2/solid-reactivity.d.ts.map +0 -1
- package/dist/solid/unstable/v2/solid-reactivity.js +0 -71
- package/dist/solid/unstable/v2/solid-reactivity.js.map +0 -1
- package/dist/solid/unstable/v2/variant-node.d.ts.map +0 -1
- package/dist/solid/unstable/v2/variant-node.js +0 -338
- package/dist/solid/unstable/v2/variant-node.js.map +0 -1
- package/dist/solid/unstable/v2/w.d.ts +0 -74
- package/dist/solid/unstable/v2/w.d.ts.map +0 -1
- package/dist/solid/unstable/v2/w.jsx +0 -20
- package/dist/solid/unstable/v2/w.jsx.map +0 -1
- package/dist/solid/unstable/v2/waiters.d.ts.map +0 -1
- package/dist/solid/unstable/v2/waiters.js.map +0 -1
- package/dist/solid/unstable/v2/ward.d.ts.map +0 -1
- package/dist/solid/unstable/v2/ward.jsx.map +0 -1
- package/dist/solid/unstable/v2/wardic-config.d.ts.map +0 -1
- package/dist/solid/unstable/v2/wardic-config.jsx +0 -28
- package/dist/solid/unstable/v2/wardic-config.jsx.map +0 -1
- package/dist/solid/unstable/v2/wardic-instance.d.ts.map +0 -1
- package/dist/solid/unstable/v2/wardic-instance.js.map +0 -1
- package/dist/solid/unstable/v2/wardic.d.ts +0 -28
- package/dist/solid/unstable/v2/wardic.d.ts.map +0 -1
- package/dist/solid/unstable/v2/wardic.jsx +0 -16
- package/dist/solid/unstable/v2/wardic.jsx.map +0 -1
- package/dist/solid/variants.d.ts.map +0 -1
- package/dist/solid/variants.js.map +0 -1
- package/src/page-point.ts +0 -98
- package/src/unstable/v2/batch-reorder-group.tsx +0 -409
- package/src/unstable/v2/bridge.tsx +0 -82
- package/src/unstable/v2/complete.tsx +0 -47
- package/src/unstable/v2/create-animate.tsx +0 -78
- package/src/unstable/v2/create-batch.tsx +0 -248
- package/src/unstable/v2/element.tsx +0 -542
- package/src/unstable/v2/feature-section.ts +0 -32
- package/src/unstable/v2/hover-sensor.tsx +0 -30
- package/src/unstable/v2/layout.tsx +0 -89
- package/src/unstable/v2/presence.tsx +0 -175
- package/src/unstable/v2/press-sensor.tsx +0 -31
- package/src/unstable/v2/reorder.tsx +0 -893
- package/src/unstable/v2/sensors.tsx +0 -169
- package/src/unstable/v2/solid-reactivity.ts +0 -80
- package/src/unstable/v2/w.tsx +0 -86
- package/src/unstable/v2/wardic.tsx +0 -41
- /package/dist/browser/{unstable/v2/config-view.js → config-view.js} +0 -0
- /package/dist/browser/{unstable/v2/flights.js → flights.js} +0 -0
- /package/dist/browser/{unstable/v2/lifecycle.js → lifecycle.js} +0 -0
- /package/dist/browser/{unstable/v2/presence-handle.js → presence-handle.js} +0 -0
- /package/dist/browser/{unstable/v2/presence-hooks.js → presence-hooks.js} +0 -0
- /package/dist/browser/{drag.js → v1/drag.js} +0 -0
- /package/dist/browser/{variants.js → v1/variants.js} +0 -0
- /package/dist/browser/{unstable/v2 → v1}/wardic-instance.js +0 -0
- /package/dist/browser/{unstable/v2/waiters.js → waiters.js} +0 -0
- /package/dist/server/{unstable/v2/config-view.js → config-view.js} +0 -0
- /package/dist/server/{unstable/v2/flights.js → flights.js} +0 -0
- /package/dist/server/{unstable/v2/lifecycle.js → lifecycle.js} +0 -0
- /package/dist/server/{unstable/v2/presence-handle.js → presence-handle.js} +0 -0
- /package/dist/server/{unstable/v2/presence-hooks.js → presence-hooks.js} +0 -0
- /package/dist/server/{drag.js → v1/drag.js} +0 -0
- /package/dist/server/{variants.js → v1/variants.js} +0 -0
- /package/dist/server/{unstable/v2 → v1}/wardic-instance.js +0 -0
- /package/dist/server/{unstable/v2/waiters.js → waiters.js} +0 -0
- /package/dist/solid/{unstable/v2/config-view.d.ts → config-view.d.ts} +0 -0
- /package/dist/solid/{unstable/v2/config-view.js → config-view.js} +0 -0
- /package/dist/solid/{unstable/v2/flights.d.ts → flights.d.ts} +0 -0
- /package/dist/solid/{unstable/v2/flights.js → flights.js} +0 -0
- /package/dist/solid/{unstable/v2/lifecycle.d.ts → lifecycle.d.ts} +0 -0
- /package/dist/solid/{unstable/v2/lifecycle.js → lifecycle.js} +0 -0
- /package/dist/solid/{unstable/v2/presence-handle.d.ts → presence-handle.d.ts} +0 -0
- /package/dist/solid/{unstable/v2/presence-handle.js → presence-handle.js} +0 -0
- /package/dist/solid/{unstable/v2/presence-hooks.d.ts → presence-hooks.d.ts} +0 -0
- /package/dist/solid/{unstable/v2/presence-hooks.jsx → presence-hooks.jsx} +0 -0
- /package/dist/solid/{unstable/v2 → v1}/batch-appear-here.d.ts +0 -0
- /package/dist/solid/{directive.d.ts → v1/directive.d.ts} +0 -0
- /package/dist/solid/{drag.jsx → v1/drag.jsx} +0 -0
- /package/dist/solid/{unstable/v2 → v1}/live-scroll.d.ts +0 -0
- /package/dist/solid/{server.d.ts → v1/server.d.ts} +0 -0
- /package/dist/solid/{variants.d.ts → v1/variants.d.ts} +0 -0
- /package/dist/solid/{variants.js → v1/variants.js} +0 -0
- /package/dist/solid/{unstable/v2 → v1}/wardic-instance.js +0 -0
- /package/dist/solid/{unstable/v2/waiters.d.ts → waiters.d.ts} +0 -0
- /package/dist/solid/{unstable/v2/waiters.js → waiters.js} +0 -0
- /package/src/{unstable/v2/config-view.ts → config-view.ts} +0 -0
- /package/src/{unstable/v2/flights.ts → flights.ts} +0 -0
- /package/src/{unstable/v2/lifecycle.ts → lifecycle.ts} +0 -0
- /package/src/{unstable/v2/presence-handle.ts → presence-handle.ts} +0 -0
- /package/src/{unstable/v2/presence-hooks.tsx → presence-hooks.tsx} +0 -0
- /package/src/{variants.ts → v1/variants.ts} +0 -0
- /package/src/{unstable/v2/waiters.ts → waiters.ts} +0 -0
package/src/reorder.tsx
CHANGED
|
@@ -1,66 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `<Reorder>`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* plain element) reorders the same way; `Reorder.Group` / `Reorder.Item` are built on
|
|
6
|
-
* them.
|
|
2
|
+
* `<Reorder>` on Solid 2 (#209 PR 3b, ADR-0020, ADR-0037, ADR-0045): drag items to reorder a list,
|
|
3
|
+
* or reorder it by keyboard. `reorderGroup(config)` and `reorderItem(list, config)` are refs that
|
|
4
|
+
* carry their props, as a ward is; `Reorder.Group` and `Reorder.Item` are built on them.
|
|
7
5
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const list = reorderGroup({ values: items, onReorder: setItems })
|
|
8
|
+
* <ul {...list}>
|
|
9
|
+
* <For each={items()}>
|
|
10
|
+
* {(item) => {
|
|
11
|
+
* const row = reorderItem(list, { value: item, whileDrag: { scale: 1.05 } })
|
|
12
|
+
* return <li {...row}>{item.name}</li>
|
|
13
|
+
* }}
|
|
14
|
+
* </For>
|
|
15
|
+
* </ul>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* The **Reorder group** is `@wardic/dom`'s `ReorderController` (core's `Reorder.Group` underneath),
|
|
19
|
+
* as on the Solid 1 binding: it reads each item's slot and drag offset from its projection node,
|
|
20
|
+
* runs the **Crossover** on each drag sample, calls the app's `onReorder`, runs **Auto-scroll**,
|
|
21
|
+
* detects the axis after every Measure pass, and speaks the **Keyboard reorder** through the
|
|
22
|
+
* Environment's `Announcer`. This file adds Solid 2's half: the reactive config, the lifecycle, the
|
|
23
|
+
* props and the components. The app owns `values` and keys its items with `<For>`. The group flushes
|
|
24
|
+
* Solid right after the app's `onReorder`, so the DOM follows within the controller's call, as
|
|
25
|
+
* Solid 1's synchronous updates have it.
|
|
17
26
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
27
|
+
* - **The group** spreads `overflow-anchor: none` under the config's `style` (Motion's
|
|
28
|
+
* Group.tsx:187-195 at 16c6122), so the browser's scroll anchoring doesn't shift the page as items
|
|
29
|
+
* move; given to `ref` alone it sets it on the element. `list.move(value, toIndex)` moves a value
|
|
30
|
+
* in code, announced.
|
|
31
|
+
* - **An item** is a ward (`row.read`, `row.atom`, `row.Provider`): a `layout` node whose drag the
|
|
32
|
+
* group's axis decides per gesture, raised while dragged, whose `touch-action` follows the group's
|
|
33
|
+
* axis. Its `value` is read once. Its spread carries the keyboard reorder's `tabindex="0"` and
|
|
34
|
+
* `aria-describedby` (the group's instructions); an app's own `tabindex` and `aria-describedby`
|
|
35
|
+
* go in the item's config, as a ward's `style` does: its `tabindex` wins, its ids come first
|
|
36
|
+
* (#209 PR 3b's R2). Written in JSX after the spread, they'd replace the item's (Solid's rule).
|
|
23
37
|
*
|
|
24
|
-
*
|
|
25
|
-
* runtime (cold path: once per reorder, wait, gesture, edge or axis change, never per
|
|
26
|
-
* sample); this file logs nothing.
|
|
38
|
+
* @module
|
|
27
39
|
*/
|
|
28
40
|
import * as InputSource from "@wardic/core/InputSource"
|
|
29
|
-
import * as CoreReorder from "@wardic/core/Reorder"
|
|
41
|
+
import type * as CoreReorder from "@wardic/core/Reorder"
|
|
30
42
|
import * as DomAnnouncer from "@wardic/dom/DomAnnouncer"
|
|
31
43
|
import * as ReorderController from "@wardic/dom/ReorderController"
|
|
32
44
|
import * as Style from "@wardic/dom/Style"
|
|
33
|
-
import
|
|
45
|
+
import * as Arr from "effect/Array"
|
|
34
46
|
import * as Bool from "effect/Boolean"
|
|
35
47
|
import * as Effect from "effect/Effect"
|
|
36
48
|
import { constUndefined, identity, pipe } from "effect/Function"
|
|
49
|
+
import * as Match from "effect/Match"
|
|
37
50
|
import * as Option from "effect/Option"
|
|
38
51
|
import * as Predicate from "effect/Predicate"
|
|
39
52
|
import * as Scope from "effect/Scope"
|
|
40
53
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
type Component,
|
|
45
|
-
createContext,
|
|
46
|
-
createEffect,
|
|
47
|
-
createMemo,
|
|
48
|
-
createSignal,
|
|
49
|
-
createUniqueId,
|
|
50
|
-
type JSX,
|
|
51
|
-
mergeProps,
|
|
52
|
-
on,
|
|
53
|
-
onCleanup,
|
|
54
|
-
splitProps,
|
|
55
|
-
untrack,
|
|
56
|
-
useContext,
|
|
57
|
-
} from "solid-js"
|
|
58
|
-
import { Dynamic } from "solid-js/web"
|
|
59
|
-
import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
|
|
60
|
-
import { runWatch, useBrought, useWardicGate, useWardicRuntime } from "./provider.tsx"
|
|
61
|
-
import { useLayoutServices } from "./layout-projection.tsx"
|
|
62
|
-
import { watchItemInput } from "@wardic/dom/unstable/ReorderInput"
|
|
63
|
-
import { plainOrder } from "./reorder-values.ts"
|
|
54
|
+
import { isServer, type JSX } from "@solidjs/web"
|
|
55
|
+
import { $PROXY, type Accessor, type Component, createContext, createEffect, createMemo, createSignal, flush, omit, onCleanup, untrack, useContext } from "solid-js"
|
|
56
|
+
import { MOTION_PROPS_V2 as MOTION_PROPS, type WardicMotionPropsV2 as WardicMotionProps } from "./motion-props.ts"
|
|
64
57
|
import type * as Feature from "@wardic/dom/unstable/Feature"
|
|
65
58
|
import * as Drag from "@wardic/dom/unstable/features/Drag"
|
|
66
59
|
import * as Focus from "@wardic/dom/unstable/features/Focus"
|
|
@@ -70,87 +63,161 @@ import * as Layout from "@wardic/dom/unstable/features/Layout"
|
|
|
70
63
|
import * as Pan from "@wardic/dom/unstable/features/Pan"
|
|
71
64
|
import * as Press from "@wardic/dom/unstable/features/Press"
|
|
72
65
|
import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures"
|
|
73
|
-
import
|
|
74
|
-
import {
|
|
75
|
-
import
|
|
76
|
-
import { isServer } from "./server.ts"
|
|
77
|
-
import { createVariantNode } from "./variant-node.ts"
|
|
78
|
-
import * as Spine from "@wardic/core/unstable/Spine"
|
|
66
|
+
import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
|
|
67
|
+
import { watchItemInput } from "@wardic/dom/unstable/ReorderInput"
|
|
68
|
+
import { plainOrder } from "./reorder-values.ts"
|
|
79
69
|
import * as VariantTree from "@wardic/core/unstable/VariantTree"
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
70
|
+
import { configView, type PerKey } from "./config-view.ts"
|
|
71
|
+
import { useBrought, useWardicRuntime } from "./provider.tsx"
|
|
72
|
+
import { useLayoutServices } from "./layout-projection.tsx"
|
|
73
|
+
import { type AnyWard, spreadPropsOf, type Ward, withSpreadProps, type WardConfig, type WardConfigValues, wardConfigView, type WardOptions, type WardShare, type WardStyle, wardWith } from "./ward.tsx"
|
|
74
|
+
import { drivenWard, type GivenWard, givenOf, handOver, listOf, refsOf, sets, setKeysOf, staticElementOf, type WardicBeside, type WardicMotion, type WardRefCallback, type WardSetKey } from "./element.tsx"
|
|
83
75
|
import { w } from "./w.tsx"
|
|
76
|
+
import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED } from "./solid-reactivity.ts"
|
|
77
|
+
import { eachOf, neverLands, NO_EVENTS, serverWhen, Waiters, whenOf } from "./waiters.ts"
|
|
84
78
|
import { BatchGroup, BatchItem } from "./batch-reorder-group.tsx"
|
|
85
79
|
|
|
86
|
-
export type { ReorderBatchColumnSize, ReorderBatchGap, ReorderBatchGroupProps, ReorderBatchItemProps, ReorderBatchItemSize, ReorderBatchSizing } from "./batch-reorder-group.tsx"
|
|
80
|
+
export type { ReorderBatchColumnSize, ReorderBatchGap, ReorderBatchGroup, ReorderBatchGroupProps, ReorderBatchItemProps, ReorderBatchItemSize, ReorderBatchSizing } from "./batch-reorder-group.tsx"
|
|
87
81
|
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
* from. Give an accessor of it for values that change.
|
|
91
|
-
*/
|
|
92
|
-
export interface ReorderGroupConfig<V> {
|
|
82
|
+
/** A Reorder group's config, each key read as a value. */
|
|
83
|
+
export interface ReorderGroupConfigValues<V> {
|
|
93
84
|
/** The list's values, in order. Your app owns them. */
|
|
94
85
|
readonly values: ReadonlyArray<V>
|
|
95
86
|
/** Given each new order, as an item crosses another: set `values` from it. */
|
|
96
87
|
readonly onReorder: (values: Array<V>) => void
|
|
97
|
-
/**
|
|
98
|
-
* Called once at the end of a reorder that changed the order: a drag let go, or a keyboard lift
|
|
99
|
-
* dropped, with the order, the item that moved, and its index `from` and `to`. What an app saves.
|
|
100
|
-
* Not called for a keyboard cancel, nor for `move`.
|
|
101
|
-
*/
|
|
102
|
-
// #257 item 3.
|
|
103
|
-
readonly onReorderEnd?: (end: ReorderController.End<V>) => void
|
|
104
|
-
/**
|
|
105
|
-
* Called as an item is taken in hand, by a drag starting (past its threshold, not at the press) or a
|
|
106
|
-
* keyboard lift, with its index then.
|
|
107
|
-
*/
|
|
108
|
-
// A Reorder hold's start (#348, ADR-0020 *Amendment (#348)*).
|
|
109
|
-
readonly onHoldStart?: (start: ReorderController.HoldStart<V>) => void
|
|
110
|
-
/**
|
|
111
|
-
* Called once as an item in hand is let go, however: let go or dropped (`how: "drop"`), put back with
|
|
112
|
-
* Escape (`"cancel"`), or unmounted (`"unmount"`). After `onReorderEnd` when it moved.
|
|
113
|
-
*/
|
|
114
|
-
// A Reorder hold's end (#348).
|
|
115
|
-
readonly onHoldEnd?: (end: ReorderController.HoldEnd<V>) => void
|
|
116
88
|
/** 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. */
|
|
117
|
-
readonly axis?: CoreReorder.Axis
|
|
89
|
+
readonly axis?: CoreReorder.Axis | undefined
|
|
118
90
|
/** The keyboard reorder: on unless `false`. Off, the items have no keys, no tab stop and no instructions. */
|
|
119
91
|
// ADR-0037.
|
|
120
|
-
readonly keyboard?: boolean
|
|
92
|
+
readonly keyboard?: boolean | undefined
|
|
121
93
|
/**
|
|
122
94
|
* What a screen reader hears at each step of a keyboard reorder, over the English defaults: `lift`,
|
|
123
95
|
* `step`, `drop`, `cancel`, and `move` for a move in code, each a function of the item's `label`,
|
|
124
96
|
* `position` and the list's `count`.
|
|
125
97
|
*/
|
|
126
|
-
readonly announcements?: Partial<CoreReorder.Announcements<V>>
|
|
98
|
+
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
127
99
|
/** What each item's `aria-describedby` reads, over the English default. */
|
|
128
|
-
readonly instructions?: string
|
|
100
|
+
readonly instructions?: string | undefined
|
|
101
|
+
/** The list element's style, over `overflow-anchor: none`. */
|
|
102
|
+
readonly style?: JSX.CSSProperties | string | undefined
|
|
129
103
|
}
|
|
130
104
|
|
|
131
|
-
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
105
|
+
/**
|
|
106
|
+
* A Reorder group's config: its `values` in order, `onReorder`, given each new order to set them from,
|
|
107
|
+
* 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` is a function.
|
|
109
|
+
*/
|
|
110
|
+
// Read per key (#259).
|
|
111
|
+
export type ReorderGroupConfig<V> = PerKey<ReorderGroupConfigValues<V>, "onReorder">
|
|
112
|
+
|
|
113
|
+
/** 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
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A group's config as made, and the layer a `Reorder.Group` it's given to lays its element's props in
|
|
120
|
+
* (#398): empty until then, each key it fixes read through the element's prop.
|
|
121
|
+
*/
|
|
122
|
+
interface GroupLayer {
|
|
123
|
+
readonly config: object
|
|
124
|
+
readonly beside: object
|
|
135
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>()
|
|
128
|
+
|
|
129
|
+
/** A Reorder group's events, as a ward's: `list.next(name)`, `list.each(name)` and `list.when(name)`. */
|
|
130
|
+
// #257 item 3, ADR-0046.
|
|
131
|
+
export interface ReorderGroupEvents<V> {
|
|
132
|
+
/**
|
|
133
|
+
* Once at the end of a reorder that changed the order: a drag let go, or a keyboard lift dropped,
|
|
134
|
+
* with the order, the item that moved, and its index `from` and `to`. What an app saves. Not for a
|
|
135
|
+
* keyboard cancel, nor for `list.move`.
|
|
136
|
+
*/
|
|
137
|
+
readonly reorderEnd: ReorderController.End<V>
|
|
138
|
+
/**
|
|
139
|
+
* As an item is taken in hand, by a drag starting (past its threshold, not at the press) or a
|
|
140
|
+
* keyboard lift, with its index then.
|
|
141
|
+
*/
|
|
142
|
+
// A Reorder hold's start (#348, ADR-0020 *Amendment (#348)*).
|
|
143
|
+
readonly holdStart: ReorderController.HoldStart<V>
|
|
144
|
+
/**
|
|
145
|
+
* Once as an item in hand is let go, however: let go or dropped (`how: "drop"`), put back with Escape
|
|
146
|
+
* (`"cancel"`), or unmounted (`"unmount"`). After `reorderEnd` when it moved.
|
|
147
|
+
*/
|
|
148
|
+
// A Reorder hold's end (#348).
|
|
149
|
+
readonly holdEnd: ReorderController.HoldEnd<V>
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** The `AbortError`'s message for a group's `next` its disposal cut off. */
|
|
153
|
+
const GROUP_GONE = "The Reorder group was disposed before its next event."
|
|
136
154
|
|
|
137
155
|
/** What a group's spread gives its element: its `ref`, and its `style` over `overflow-anchor: none`. */
|
|
138
|
-
export interface
|
|
139
|
-
|
|
156
|
+
export interface ReorderGroupProps {
|
|
157
|
+
/** The group: Solid calls it with the element. */
|
|
158
|
+
readonly ref: (element: HTMLElement) => void
|
|
159
|
+
/** The config's `style` over `overflow-anchor: none`. */
|
|
140
160
|
readonly style: JSX.CSSProperties
|
|
141
161
|
}
|
|
142
162
|
|
|
143
163
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
164
|
+
* A **Reorder group**'s mark (#349): what tells a group given to `Reorder.Group`'s `groupRef` from a
|
|
165
|
+
* function handed the component's own. Internal.
|
|
166
|
+
*/
|
|
167
|
+
export const REORDER_GROUP: unique symbol = Symbol("wardic.reorderGroup")
|
|
168
|
+
|
|
169
|
+
/** A Reorder group of `V`, whatever its config: what `Reorder.Group`'s `groupRef` takes. */
|
|
170
|
+
// #349.
|
|
171
|
+
export interface AnyReorderGroup<V> {
|
|
172
|
+
readonly [REORDER_GROUP]: V
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* `reorderGroup()`'s group: spread it on the list's element, `<ul {...list}>`, or give it to `ref`.
|
|
177
|
+
* Its items join it, and it gives its direction, `move`, and its events.
|
|
146
178
|
*/
|
|
147
|
-
export
|
|
179
|
+
export interface ReorderGroup<V> extends ReorderGroupProps, AnyReorderGroup<V> {
|
|
180
|
+
/** Attaches the group to `element`: Solid calls it as a ref. */
|
|
181
|
+
(element: HTMLElement): void
|
|
182
|
+
/**
|
|
183
|
+
* Its spread's props alone (#495): what Solid 2's `merge` reads when the group is spread, calling it
|
|
184
|
+
* as a function source, on no prototype, so none of the group's own names shadows the element's props.
|
|
185
|
+
*/
|
|
186
|
+
(previous?: unknown): ReorderGroupProps
|
|
148
187
|
/** The group's state: `@wardic/core`'s `Reorder.Group`. */
|
|
149
188
|
readonly group: CoreReorder.Group<V>
|
|
150
189
|
/** The list's direction: the config's, else the one found from the items' boxes. */
|
|
151
190
|
readonly axis: Accessor<CoreReorder.Axis>
|
|
152
191
|
/** Moves `value` to `toIndex`, as a button of your own would, and announces it to a screen reader. */
|
|
153
192
|
readonly move: (value: V, toIndex: number) => void
|
|
193
|
+
/** A promise of the group's next `name` after the call. It rejects with an `AbortError` once the group is gone. */
|
|
194
|
+
readonly next: <E extends keyof ReorderGroupEvents<V>>(name: E) => Promise<ReorderGroupEvents<V>[E]>
|
|
195
|
+
/**
|
|
196
|
+
* Every `name` from the call on, as an async iterable, for a `for await`: each step waits for the
|
|
197
|
+
* next one, so one that comes while a step's work runs is missed. It ends once the group is gone. To
|
|
198
|
+
* act on each one in an effect, use {@link when}.
|
|
199
|
+
*/
|
|
200
|
+
readonly each: <E extends keyof ReorderGroupEvents<V>>(name: E) => AsyncIterable<ReorderGroupEvents<V>[E]>
|
|
201
|
+
/**
|
|
202
|
+
* Every `name`, as a memo for an effect, as a ward's `when` is: pending until the first, so the
|
|
203
|
+
* effect runs at each one, on any page. An optimistic save at each reorder:
|
|
204
|
+
*
|
|
205
|
+
* ```tsx
|
|
206
|
+
* const [tasks, setTasks] = createOptimisticStore<Task[]>(() => api.listTasks(), [])
|
|
207
|
+
* const [order, setOrder] = createSignal(() => [...tasks]) // follows tasks; the drag writes it
|
|
208
|
+
* const save = action(function* (ids: string[]) {
|
|
209
|
+
* setTasks((list) => ids.map((id) => list.find((task) => task.id === id)!)) // optimistic
|
|
210
|
+
* yield api.saveOrder(ids)
|
|
211
|
+
* refresh(tasks)
|
|
212
|
+
* })
|
|
213
|
+
* const list = reorderGroup({ values: order, onReorder: setOrder })
|
|
214
|
+
* const reordered = list.when("reorderEnd")
|
|
215
|
+
* createEffect(() => reordered().values.map((task) => task.id), (ids) => {
|
|
216
|
+
* save(ids).catch(setSaveError)
|
|
217
|
+
* })
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
readonly when: <E extends keyof ReorderGroupEvents<V>>(name: E) => Accessor<ReorderGroupEvents<V>[E]>
|
|
154
221
|
/** Whether the items reorder from the keyboard. */
|
|
155
222
|
readonly keyboard: Accessor<boolean>
|
|
156
223
|
/** The instructions the items' `aria-describedby` reads. */
|
|
@@ -167,525 +234,646 @@ export type ReorderGroup<V> = ((userProps?: ReorderGroupUserProps) => ReorderGro
|
|
|
167
234
|
export type ReorderItemLayout = true | "position"
|
|
168
235
|
|
|
169
236
|
/**
|
|
170
|
-
* A `<Reorder>` item's config: its `value`, its `layout
|
|
171
|
-
* prop but `layoutId` and
|
|
237
|
+
* A `<Reorder>` item's config: its `value`, read once, its `layout`, your own `tabindex` and
|
|
238
|
+
* `aria-describedby`, kept beside the keyboard reorder's, and any motion prop but `layoutId` and
|
|
239
|
+
* `drag`, which the group sets.
|
|
172
240
|
*/
|
|
173
|
-
export type ReorderItemConfig<V> =
|
|
241
|
+
export type ReorderItemConfig<V> =
|
|
242
|
+
& PerKey<ReorderItemOwn<V>>
|
|
243
|
+
& Omit<WardConfig, "layout" | "layoutId" | "drag">
|
|
244
|
+
|
|
245
|
+
/** A `<Reorder>` item's own keys, beside a ward's. */
|
|
246
|
+
interface ReorderItemOwn<V> {
|
|
247
|
+
/** Its value in the group's `values`. Read once. */
|
|
248
|
+
readonly value: V
|
|
249
|
+
/** `true`, its place and size animating (the default), or `"position"`, its place alone. */
|
|
250
|
+
readonly layout?: ReorderItemLayout
|
|
251
|
+
/** The app's own tab stop (Solid 2's attribute spelling): it wins over the keyboard reorder's `0`. */
|
|
252
|
+
readonly tabindex?: number | undefined
|
|
253
|
+
/** The app's own ids: kept, before the instructions'. */
|
|
254
|
+
readonly "aria-describedby"?: string | undefined
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** An item's own keys read per key (#259); the rest are its ward's, which reads them itself. */
|
|
258
|
+
/**
|
|
259
|
+
* What an item brings (ADR-0067 decision 12), whatever its section has (#511): its layout node, its
|
|
260
|
+
* drag, and every other gesture, so `whileHover` or `whileTap` on an item works as on Motion's, for
|
|
261
|
+
* about 0.5 KB gzipped beside the drag's.
|
|
262
|
+
*/
|
|
263
|
+
const ITEM_BRINGS: ReadonlyArray<Feature.Feature> = [Layout.layout, Drag.drag, Hover.hover, Press.press, Focus.focus, InView.inView, Pan.pan]
|
|
264
|
+
|
|
265
|
+
const ITEM_VIEW = configView<ReorderItemOwn<unknown>>(["value", "layout", "tabindex", "aria-describedby"], [])
|
|
174
266
|
|
|
175
267
|
/** An item's `layout` as its Layout mode: `"position"`, else `true` (ADR-0009, *Amendment (#42)*). */
|
|
176
268
|
const itemLayoutOf = (layout: unknown): ReorderItemLayout =>
|
|
177
269
|
Bool.match(layout === "position", { onTrue: (): ReorderItemLayout => "position", onFalse: (): ReorderItemLayout => true })
|
|
178
270
|
|
|
179
|
-
/**
|
|
180
|
-
const
|
|
271
|
+
/** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
|
|
272
|
+
const WHOLE_GROUP_ACCESSOR =
|
|
273
|
+
"reorderGroup(config) takes its config as an object, read per key (#259): make a key reactive with an accessor " +
|
|
274
|
+
"(`reorderGroup({ values: items, onReorder: setItems })`), a getter, a store or a component's props."
|
|
275
|
+
const WHOLE_ITEM_ACCESSOR =
|
|
276
|
+
"reorderItem(list, config) takes its config as an object, read per key (#259): `reorderItem(list, { value })`, " +
|
|
277
|
+
"a key made reactive with an accessor, a getter, a store or a component's props."
|
|
278
|
+
|
|
279
|
+
/** Whether a call is Solid applying a ref. */
|
|
280
|
+
const isElement = (value: unknown): value is HTMLElement => Predicate.hasProperty(value, "nodeType")
|
|
281
|
+
|
|
282
|
+
/** The group's keyboard reorder settings, as accessors (ADR-0037). */
|
|
283
|
+
const keyboardOf = <V,>(cfg: Accessor<ReorderGroupConfigValues<V>>) => ({
|
|
284
|
+
keyboard: (): boolean => ReorderController.keyboardOn(cfg().keyboard),
|
|
285
|
+
instructions: (): string => ReorderController.instructionsOf(cfg().instructions),
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
/** The group element's style: the config's over `overflow-anchor: none`. */
|
|
289
|
+
const groupStyleOf = (style: JSX.CSSProperties | string | undefined): JSX.CSSProperties =>
|
|
290
|
+
pipe(style, Style.over(ReorderController.GROUP_STYLE)) as JSX.CSSProperties
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* A ref carrying `props` and `reads`: `props` enumerable (a spread applies them), `reads` not. Called
|
|
294
|
+
* with nothing, as Solid 2's `merge` calls a spread's function source, it gives `ref` and `props` alone
|
|
295
|
+
* (#495), so none of its own names (`name`, `length`, its reads) shadows the element's props.
|
|
296
|
+
*/
|
|
297
|
+
const refCarrying = <G,>(attach: (element: HTMLElement) => void, props: PropertyDescriptorMap, reads: object): G => {
|
|
298
|
+
const self = ((value?: unknown): object | undefined => {
|
|
299
|
+
if (isElement(value)) {
|
|
300
|
+
attach(value)
|
|
301
|
+
return undefined
|
|
302
|
+
}
|
|
303
|
+
return spread
|
|
304
|
+
}) as unknown as G
|
|
305
|
+
const spreadProps: PropertyDescriptorMap = { ref: { value: self, enumerable: true }, ...props }
|
|
306
|
+
const spread = spreadPropsOf<object>(spreadProps)
|
|
307
|
+
Object.defineProperties(self, { [REORDER_GROUP]: { value: true }, ...spreadProps })
|
|
308
|
+
return Object.assign(self as object, reads) as G
|
|
309
|
+
}
|
|
181
310
|
|
|
182
311
|
/**
|
|
183
312
|
* Makes a list of your own elements reorderable, by dragging or from the keyboard: spread the group on
|
|
184
|
-
* the list's element, and make each item with `
|
|
185
|
-
* `values`, and sets them from `onReorder
|
|
186
|
-
*
|
|
313
|
+
* the list's element, and make each item with `reorderItem`, keyed with `<For>`. Your app owns
|
|
314
|
+
* `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` is built on it.
|
|
187
316
|
*
|
|
188
317
|
* @example
|
|
189
|
-
* const list =
|
|
190
|
-
* <ul {...list
|
|
318
|
+
* const list = reorderGroup({ values: items, onReorder: setItems })
|
|
319
|
+
* <ul {...list}>
|
|
191
320
|
* <For each={items()}>
|
|
192
321
|
* {(item) => {
|
|
193
|
-
* const row =
|
|
194
|
-
* return <li {...row
|
|
322
|
+
* const row = reorderItem(list, { value: item })
|
|
323
|
+
* return <li {...row}>{item.name}</li>
|
|
195
324
|
* }}
|
|
196
325
|
* </For>
|
|
197
326
|
* </ul>
|
|
198
327
|
* @see https://wardic.dev/reference/solid/reorder/reorder-group
|
|
199
328
|
*/
|
|
200
|
-
// ADR-0020. `
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
//
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
329
|
+
// ADR-0020. Given to `ref` alone, it's client-only. Its axis is the config's, else detected from the
|
|
330
|
+
// items' boxes after every Measure pass (for their touch-action); a drag resolves its own at its start.
|
|
331
|
+
// A `values` change re-measures. On a server it renders the element's style and nothing else: no
|
|
332
|
+
// controller, no runtime; its `group`, `move` and `controller` do nothing (ADR-0021).
|
|
333
|
+
export function reorderGroup<V>(config: ReorderGroupConfig<V>): ReorderGroup<V> {
|
|
334
|
+
if (Predicate.isFunction(config)) throw new Error(WHOLE_GROUP_ACCESSOR)
|
|
335
|
+
const beside = {}
|
|
336
|
+
const view = groupViewOf(config, beside)
|
|
337
|
+
const cfg = (): ReorderGroupConfigValues<V> => view
|
|
338
|
+
const runtime = useWardicRuntime()
|
|
339
|
+
if (isServer) return layered(serverReorderGroup(cfg), config, beside)
|
|
211
340
|
const [detected, setDetected] = createSignal<CoreReorder.Axis>("y")
|
|
212
|
-
// The order as a plain array (#721): a store's copied, so a store changed in place is a new order
|
|
341
|
+
// The order as a plain array (#721): a store's copied, so a store changed in place is a new order, read
|
|
342
|
+
// untracked by the controller and tracked by the effect below.
|
|
213
343
|
const values = (): ReadonlyArray<V> => plainOrder(cfg().values, $PROXY)
|
|
214
|
-
|
|
344
|
+
// Its events (#257 item 3), ended with it.
|
|
345
|
+
const events = new Waiters<ReorderGroupEvents<V>>(GROUP_GONE)
|
|
346
|
+
onCleanup(() => events.dispose())
|
|
347
|
+
// Whether the app's `move` is the call under way: its reorder isn't flushed.
|
|
348
|
+
let moving = false
|
|
215
349
|
// The group's controller, over the provider's projection system and the Environment's channel to
|
|
216
|
-
// assistive technology (ADR-0037), in a Scope of the group's own, closed
|
|
217
|
-
//
|
|
350
|
+
// assistive technology (ADR-0037), in a Scope of the group's own, closed with its owner: set before
|
|
351
|
+
// the controller is built, so one that fails as it's built leaves nothing (#618).
|
|
218
352
|
const scope = OwnerScope.open(runtime)
|
|
219
353
|
onCleanup(() => OwnerScope.close(runtime, scope, CLOSE_FAILED))
|
|
220
354
|
const controller = runtime.runSync(
|
|
221
355
|
ReorderController.make<V>({
|
|
222
356
|
values: () => untrack(values),
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
357
|
+
// The DOM follows a reorder within the controller's call, as on Solid 1, whose updates are
|
|
358
|
+
// synchronous: the controller keeps focus on a lifted item right after (moving a focused node
|
|
359
|
+
// can blur it), and Solid 2 would otherwise move the node at its next flush, after that.
|
|
360
|
+
// A `move` the app calls doesn't: nothing reads the DOM after it, and the app may call it inside
|
|
361
|
+
// an `action`, where Solid refuses a flush (FLUSH_IN_ACTION, #257 item 12).
|
|
362
|
+
onReorder: (values) => {
|
|
363
|
+
const onReorder = untrack(() => cfg().onReorder)
|
|
364
|
+
if (moving) return onReorder(values)
|
|
365
|
+
flush(() => onReorder(values))
|
|
366
|
+
},
|
|
367
|
+
onReorderEnd: (end) => events.tell("reorderEnd", () => end),
|
|
368
|
+
onHoldStart: (start) => events.tell("holdStart", () => start),
|
|
369
|
+
onHoldEnd: (end) => events.tell("holdEnd", () => end),
|
|
370
|
+
axis: () => Option.fromUndefinedOr(untrack(() => cfg().axis)),
|
|
228
371
|
onAxis: setDetected,
|
|
229
372
|
keyedWith: "<For>",
|
|
230
|
-
keyboard: () =>
|
|
231
|
-
announcements: () => Option.fromUndefinedOr(untrack(cfg).announcements),
|
|
373
|
+
keyboard: () => untrack(() => cfg().keyboard) !== false,
|
|
374
|
+
announcements: () => Option.fromUndefinedOr(untrack(() => cfg().announcements)),
|
|
232
375
|
}).pipe(Effect.provide(useLayoutServices()), Scope.provide(scope)),
|
|
233
376
|
)
|
|
234
377
|
// The app's axis, else the detected one. When the app's is cleared, detected here, from the boxes the
|
|
235
|
-
// engine holds, so the items' touch-action follows in the same
|
|
236
|
-
// detected it wrote a signal the items read a
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
378
|
+
// engine holds, so the items' touch-action follows in the same flush (#257's audit: an effect that
|
|
379
|
+
// 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 a given group's `axis` beside it, laid
|
|
381
|
+
// over its config by the `Reorder.Group` the items render in, is the one it tracks (#398).
|
|
382
|
+
const axis: Accessor<CoreReorder.Axis> = createMemo(
|
|
383
|
+
() =>
|
|
384
|
+
UndefinedOr.match(cfg().axis, {
|
|
385
|
+
onDefined: identity,
|
|
386
|
+
onUndefined: () => {
|
|
387
|
+
detected()
|
|
388
|
+
return controller.detect()
|
|
389
|
+
},
|
|
390
|
+
}),
|
|
391
|
+
AXIS_MEMO,
|
|
245
392
|
)
|
|
246
393
|
|
|
247
|
-
// A `values` change re-measures, so the items animate to their new slots whoever
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
ref: mergeRefs(userProps.ref, (el: HTMLElement) => controller.attach(el)),
|
|
253
|
-
get style() {
|
|
254
|
-
return pipe(userProps.style, Style.over(ReorderController.GROUP_STYLE)) as JSX.CSSProperties
|
|
394
|
+
// A `values` change re-measures, so the items animate to their new slots whoever reordered them.
|
|
395
|
+
createEffect(
|
|
396
|
+
values,
|
|
397
|
+
() => {
|
|
398
|
+
controller.valuesChanged()
|
|
255
399
|
},
|
|
256
|
-
|
|
400
|
+
CLIENT_ONLY_DEFERRED,
|
|
401
|
+
)
|
|
257
402
|
|
|
258
|
-
const
|
|
259
|
-
|
|
403
|
+
const attach = (element: HTMLElement): void => {
|
|
404
|
+
// Given to `ref` alone, the element has no spread's style: the group sets its own.
|
|
405
|
+
if (element.style.getPropertyValue("overflow-anchor") === "") element.style.setProperty("overflow-anchor", "none")
|
|
406
|
+
controller.attach(element)
|
|
407
|
+
}
|
|
408
|
+
return layered(refCarrying<ReorderGroup<V>>(
|
|
409
|
+
attach,
|
|
410
|
+
{ style: { get: () => groupStyleOf(cfg().style), enumerable: true } },
|
|
411
|
+
{
|
|
412
|
+
group: controller.group,
|
|
413
|
+
axis,
|
|
414
|
+
move: (value: V, toIndex: number) => {
|
|
415
|
+
moving = true
|
|
416
|
+
try {
|
|
417
|
+
controller.move(value, toIndex)
|
|
418
|
+
} finally {
|
|
419
|
+
moving = false
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
next: <E extends keyof ReorderGroupEvents<V>>(name: E) => events.wait(name),
|
|
423
|
+
each: <E extends keyof ReorderGroupEvents<V>>(name: E) => eachOf<ReorderGroupEvents<V>, E>(events, name),
|
|
424
|
+
when: <E extends keyof ReorderGroupEvents<V>>(name: E) => whenOf<ReorderGroupEvents<V>, E>(events, name),
|
|
425
|
+
controller,
|
|
426
|
+
...keyboardOf(cfg),
|
|
427
|
+
},
|
|
428
|
+
), config, beside)
|
|
260
429
|
}
|
|
261
430
|
|
|
262
|
-
/**
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
431
|
+
/** The group's axis memo's options: client-only, and lazy (#398). */
|
|
432
|
+
const AXIS_MEMO = { ...CLIENT_ONLY, lazy: true } as const
|
|
433
|
+
|
|
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
|
+
}
|
|
267
439
|
|
|
268
440
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* group, raised while dragged, whose drag takes the group's axis at each start and
|
|
272
|
-
* feeds the controller its samples, and whose `touch-action` follows the group's axis.
|
|
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.
|
|
273
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
|
+
/** What a group's Scope reports when one of its finalizers fails as its owner goes. */
|
|
459
|
+
const CLOSE_FAILED = "wardic.reorder: a finalizer failed"
|
|
460
|
+
|
|
274
461
|
/**
|
|
275
|
-
*
|
|
276
|
-
* axis
|
|
277
|
-
* parameters, so `ItemGroup<never>` accepts a group of any value type.
|
|
462
|
+
* {@link reorderGroup} during a server render (ADR-0021): the group element's style and the app's
|
|
463
|
+
* axis, else `"y"`; its `group`, `move` and `controller` do nothing.
|
|
278
464
|
*/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
465
|
+
const serverReorderGroup = <V,>(cfg: Accessor<ReorderGroupConfigValues<V>>): ReorderGroup<V> => {
|
|
466
|
+
const controller = ReorderController.inert as unknown as ReorderController.ReorderController<V>
|
|
467
|
+
const axis = (): CoreReorder.Axis => UndefinedOr.match(cfg().axis, { onUndefined: (): CoreReorder.Axis => "y", onDefined: identity })
|
|
468
|
+
return refCarrying<ReorderGroup<V>>(
|
|
469
|
+
constUndefined,
|
|
470
|
+
{ style: { value: groupStyleOf(untrack(() => cfg().style)), enumerable: true } },
|
|
471
|
+
{ group: controller.group, axis, move: constUndefined, next: neverLands, each: () => NO_EVENTS, when: serverWhen, controller, ...keyboardOf(cfg) },
|
|
472
|
+
)
|
|
284
473
|
}
|
|
285
474
|
|
|
475
|
+
/** A Reorder item's drag axis for its gesture's axis: a grid's `xy` is a free drag. Built once, at module load. */
|
|
476
|
+
const dragAxisFor: (axis: CoreReorder.Axis) => true | "x" | "y" = Match.type<CoreReorder.Axis>().pipe(
|
|
477
|
+
Match.when("xy", (): true => true),
|
|
478
|
+
Match.orElse((axis) => axis as "x" | "y"),
|
|
479
|
+
)
|
|
480
|
+
|
|
286
481
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
482
|
+
* What an item adds to its spread for the keyboard reorder (ADR-0037): `tabindex="0"` while the
|
|
483
|
+
* group's keyboard is on and the app gave no `tabindex`, and `aria-describedby` with the group's
|
|
484
|
+
* instructions (`describedBy`, set on the client) after the app's own ids.
|
|
290
485
|
*/
|
|
291
|
-
const
|
|
292
|
-
|
|
486
|
+
const keyboardAttributes = <V,>(
|
|
487
|
+
list: Pick<ReorderGroup<V>, "keyboard">,
|
|
488
|
+
cfg: Accessor<ReorderItemOwn<V>>,
|
|
489
|
+
describedBy: Accessor<string | undefined>,
|
|
490
|
+
): PropertyDescriptorMap => ({
|
|
491
|
+
tabindex: {
|
|
492
|
+
get: (): number | undefined =>
|
|
493
|
+
UndefinedOr.match(cfg().tabindex, {
|
|
494
|
+
onDefined: identity,
|
|
495
|
+
onUndefined: () => Bool.match(list.keyboard(), { onTrue: () => 0, onFalse: constUndefined }),
|
|
496
|
+
}),
|
|
497
|
+
enumerable: true,
|
|
498
|
+
},
|
|
499
|
+
"aria-describedby": {
|
|
500
|
+
get: (): string | undefined => {
|
|
501
|
+
const ids = Arr.filter([cfg()["aria-describedby"], Bool.match(list.keyboard(), { onTrue: describedBy, onFalse: constUndefined })], Predicate.isNotUndefined)
|
|
502
|
+
return Bool.match(ids.length === 0, { onTrue: constUndefined, onFalse: () => ids.join(" ") })
|
|
503
|
+
},
|
|
504
|
+
enumerable: true,
|
|
505
|
+
},
|
|
506
|
+
})
|
|
293
507
|
|
|
294
508
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
509
|
+
* Makes an element an item of a Reorder group: a ward, spread on the element, `<li {...row}>`, or given
|
|
510
|
+
* to `Reorder.Item`'s `wardRef`. `value` is its value in the group's `values`, read once; the rest is a
|
|
511
|
+
* ward's config, but `layout` (`true` or `"position"`), `layoutId` and `drag`, which the group sets. It's
|
|
512
|
+
* a tab stop for the keyboard reorder: your own `tabindex` and `aria-describedby` go in its config.
|
|
513
|
+
* Call it where you'd make a signal: in a `<For>` callback.
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* const row = reorderItem(list, { value: item, whileDrag: { scale: 1.05 } })
|
|
517
|
+
* <li {...row}>{item.name}</li>
|
|
518
|
+
* @see https://wardic.dev/reference/solid/reorder/reorder-item
|
|
298
519
|
*/
|
|
299
|
-
|
|
520
|
+
// ADR-0020. Given to `ref` alone, it's client-only. The element takes the drag defaults, with the
|
|
521
|
+
// group's axis's touch-action, which its `style` can override.
|
|
522
|
+
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), undefined) as unknown as ReorderItem<V, C>
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** A `<Reorder>` item's mark (#349): the group it's in. Internal. */
|
|
527
|
+
export const REORDER_ITEM: unique symbol = Symbol("wardic.reorderItem")
|
|
528
|
+
|
|
529
|
+
/** A `<Reorder>` item of `V`, whatever its config: what `Reorder.Item`'s `wardRef` takes. */
|
|
530
|
+
// #349.
|
|
531
|
+
export interface AnyReorderItem<V> extends AnyWard {
|
|
532
|
+
readonly [REORDER_ITEM]: V
|
|
533
|
+
}
|
|
300
534
|
|
|
301
|
-
|
|
535
|
+
/**
|
|
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`.
|
|
538
|
+
*/
|
|
539
|
+
export type ReorderItem<V, C extends ReorderItemConfig<V> = ReorderItemConfig<V>> = Ward<C> & AnyReorderItem<V>
|
|
540
|
+
|
|
541
|
+
/** {@link reorderItem} for `tag` (`Reorder.Item`'s `as`). Internal. */
|
|
542
|
+
const reorderItemWith = <V,>(list: ReorderGroup<V>, config: ReorderItemConfig<V>, parent: AnyWard | undefined, tag: string | undefined): Ward => {
|
|
543
|
+
if (Predicate.isFunction(config)) throw new Error(WHOLE_ITEM_ACCESSOR)
|
|
544
|
+
// Its own keys read per key (#259); the rest are its ward's config, read by the ward. Its `layout`
|
|
545
|
+
// is its Layout mode, `true` or `"position"` whatever the config gives, read at each layout
|
|
546
|
+
// animation's start as any ward's is (ADR-0009, *Amendment (#42)*).
|
|
547
|
+
const own = ITEM_VIEW.of(config) as ReorderItemOwn<V>
|
|
548
|
+
const cfg = (): ReorderItemOwn<V> => own
|
|
549
|
+
const fixed = { layout: (): ReorderItemLayout => itemLayoutOf(own.layout) }
|
|
550
|
+
const wardConfig = config as unknown as WardConfig
|
|
551
|
+
// Its group's axis's `touch-action`, under its style: none when its own presses don't drag it
|
|
552
|
+
// (`dragListener={false}`, #431), as with its other drag defaults, so a list dragged by handles scrolls by touch.
|
|
553
|
+
const touchAction = Bool.match(untrack(() => wardConfig.dragListener) !== false, {
|
|
554
|
+
onTrue: () => (): object => ({ "touch-action": Style.reorderTouchAction(list.axis()) }),
|
|
555
|
+
onFalse: constUndefined,
|
|
556
|
+
})
|
|
557
|
+
// On a server the item renders the drag defaults with its group's touch-action, and joins no
|
|
558
|
+
// controller (ADR-0021); the instructions element exists on the client only.
|
|
559
|
+
if (isServer) {
|
|
560
|
+
const row = wardWith(wardConfig, { tag, brings: ITEM_BRINGS, dragAxis: () => true, baseStyle: touchAction, fixed, group: list, parent })
|
|
561
|
+
return withSpreadProps(Object.defineProperties(row, { [REORDER_ITEM]: { value: list } }), keyboardAttributes(list, cfg, constUndefined))
|
|
562
|
+
}
|
|
563
|
+
const runtime = useWardicRuntime()
|
|
302
564
|
// Its keys' input, the `drag` Feature's it brings (#511).
|
|
303
565
|
const services = useBrought(ITEM_BRINGS)
|
|
566
|
+
const value = untrack(() => own.value)
|
|
304
567
|
// A keyboard lift turns the item's `whileDrag` on (ADR-0037).
|
|
305
568
|
const [lifted, setLifted] = createSignal(false)
|
|
306
|
-
|
|
569
|
+
let element: HTMLElement | undefined
|
|
570
|
+
const driver = list.controller.item(value, () => Option.fromUndefinedOr(element), setLifted)
|
|
307
571
|
// An item unmounted mid-gesture gets no end sample: its disposal ends the gesture (and a lift).
|
|
308
572
|
onCleanup(driver.dispose)
|
|
309
|
-
//
|
|
310
|
-
//
|
|
573
|
+
// The instructions' id (ADR-0037), derived, so the element is rendered with its `aria-describedby`:
|
|
574
|
+
// the page's document's, until the element's own replaces it (an iframe's). An effect adds the
|
|
575
|
+
// instructions element, writing nothing. An effect that wrote the id after the mount relayed
|
|
576
|
+
// through four effects, each flush showing the item without it (#320).
|
|
577
|
+
const [document, setDocument] = createSignal<Document>(globalThis.document)
|
|
578
|
+
const describedBy = createMemo(() => DomAnnouncer.instructionsIdOf(document(), list.instructions()), CLIENT_ONLY)
|
|
311
579
|
createEffect(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
Effect.provideService(watchItemInput(el, driver, (effect) => void runtime.runFork(effect), onDefect), InputSource.InputSource, GestureFeatures.inputIn(services())),
|
|
316
|
-
)
|
|
317
|
-
}
|
|
318
|
-
}),
|
|
580
|
+
() => ({ doc: document(), text: list.instructions() }),
|
|
581
|
+
({ doc, text }) => DomAnnouncer.showInstructions(doc, text),
|
|
582
|
+
CLIENT_ONLY,
|
|
319
583
|
)
|
|
320
|
-
|
|
584
|
+
const row = wardWith(wardConfig, {
|
|
585
|
+
tag,
|
|
321
586
|
brings: ITEM_BRINGS,
|
|
322
|
-
|
|
587
|
+
fixed,
|
|
588
|
+
group: list,
|
|
589
|
+
parent,
|
|
590
|
+
dragAxis: () => dragAxisFor(driver.dragAxis()),
|
|
323
591
|
onDragSample: driver.onSample,
|
|
324
|
-
onLayoutHandle:
|
|
592
|
+
onLayoutHandle: driver.register,
|
|
325
593
|
raiseWhileDragged: true,
|
|
326
594
|
keysTaken: true,
|
|
327
595
|
lifted,
|
|
328
|
-
baseStyle:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
596
|
+
baseStyle: touchAction,
|
|
597
|
+
onMount: (el, watch) => {
|
|
598
|
+
element = el
|
|
599
|
+
setDocument(DomAnnouncer.documentOf(el))
|
|
600
|
+
// Its keys, blurs and presses (ADR-0037), watched in the ward's watch Scope, with no fiber at rest (#379).
|
|
601
|
+
watch((onDefect) => Effect.provideService(watchItemInput(el, driver, (effect) => void runtime.runFork(effect), onDefect), InputSource.InputSource, GestureFeatures.inputIn(services())))
|
|
602
|
+
return () => {
|
|
603
|
+
element = undefined
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
})
|
|
607
|
+
// eslint-disable-next-line solid/reactivity -- handed to getters, which read it where the spread tracks them
|
|
608
|
+
return withSpreadProps(Object.defineProperties(row, { [REORDER_ITEM]: { value: list } }), keyboardAttributes(list, cfg, describedBy))
|
|
340
609
|
}
|
|
341
610
|
|
|
342
|
-
|
|
343
|
-
* What an item adds to its element for the keyboard reorder (ADR-0037): `tabindex="0"` while the
|
|
344
|
-
* group's keyboard is on and the app gave no `tabIndex` of its own, and `aria-describedby` with
|
|
345
|
-
* the group's instructions (`describedBy`, set on the client) after the app's own ids.
|
|
346
|
-
*/
|
|
347
|
-
const keyboardAttributes = (group: ItemGroup<never>, user: ReorderItemUserProps = NO_ITEM_PROPS, describedBy: Accessor<string | undefined>) => ({
|
|
348
|
-
get tabindex() {
|
|
349
|
-
return UndefinedOr.match(user.tabIndex, { onDefined: identity, onUndefined: () => ReorderController.tabStopOf(group.keyboard(), false) })
|
|
350
|
-
},
|
|
351
|
-
get "aria-describedby"() {
|
|
352
|
-
return ReorderController.describedByOf(user["aria-describedby"], Bool.match(group.keyboard(), { onTrue: describedBy, onFalse: constUndefined }))
|
|
353
|
-
},
|
|
354
|
-
})
|
|
611
|
+
// --- Components (ADR-0020: built on the factories) ---------------------------------------------
|
|
355
612
|
|
|
356
|
-
/**
|
|
357
|
-
|
|
358
|
-
* wins over the keyboard reorder's, and its own `aria-describedby` ids, kept before the instructions'.
|
|
359
|
-
*/
|
|
360
|
-
export type ReorderItemUserProps = WardUserProps & {
|
|
361
|
-
readonly tabIndex?: number | undefined
|
|
362
|
-
readonly "aria-describedby"?: string | undefined
|
|
363
|
-
}
|
|
613
|
+
/** The nearest `Reorder.Group`'s group, for its items: `null` for none (Solid 2's contexts). */
|
|
614
|
+
const GroupContext = createContext<ReorderGroup<unknown> | null>(null)
|
|
364
615
|
|
|
365
|
-
/**
|
|
366
|
-
export type
|
|
367
|
-
readonly tabindex?: number | undefined
|
|
368
|
-
readonly "aria-describedby"?: string | undefined
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/** {@link createReorderItem}'s result: call it to spread onto the item's element, as a `Ward`. */
|
|
372
|
-
export type ReorderItemWard = ((userProps?: ReorderItemUserProps) => ReorderItemSpread) & Pick<Ward, "Provider">
|
|
616
|
+
/** An element tag a `<Reorder>` group or item can render. */
|
|
617
|
+
export type ReorderElementTag = keyof JSX.IntrinsicElements
|
|
373
618
|
|
|
374
619
|
/**
|
|
375
|
-
*
|
|
376
|
-
* `
|
|
377
|
-
*
|
|
378
|
-
* the keyboard reorder: give your own `tabIndex` and `aria-describedby` in the spread's props.
|
|
379
|
-
*
|
|
380
|
-
* @example
|
|
381
|
-
* const row = createReorderItem(list, { value: item, whileDrag: { scale: 1.05 } })
|
|
382
|
-
* <li {...row()}>{item.name}</li>
|
|
383
|
-
* @see https://wardic.dev/reference/solid/reorder/reorder-item
|
|
620
|
+
* `Reorder.Group`'s group: its config as props, `groupRef` handing the group out, or a group made with
|
|
621
|
+
* `reorderGroup` given to `groupRef`, with the options its config doesn't set beside it. A key given
|
|
622
|
+
* both ways is an error.
|
|
384
623
|
*/
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
export
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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.
|
|
626
|
+
export type ReorderGroupOf<V> =
|
|
627
|
+
| {
|
|
628
|
+
readonly values: ReadonlyArray<V>
|
|
629
|
+
readonly onReorder: (values: Array<V>) => void
|
|
630
|
+
readonly axis?: CoreReorder.Axis | undefined
|
|
631
|
+
readonly keyboard?: boolean | undefined
|
|
632
|
+
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
633
|
+
readonly instructions?: string | undefined
|
|
634
|
+
/**
|
|
635
|
+
* Given the group once, as it's made, as `wardRef` is given a ward: for its `next(name)`,
|
|
636
|
+
* `when(name)` and `move`.
|
|
637
|
+
*/
|
|
638
|
+
readonly groupRef?: GroupRefCallback<V> | undefined
|
|
639
|
+
}
|
|
640
|
+
| {
|
|
641
|
+
/**
|
|
642
|
+
* A group made with `reorderGroup`, which the component renders, with the options its config
|
|
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
|
|
400
652
|
}
|
|
401
|
-
// The item's element, for Auto-scroll's held scroll shift.
|
|
402
|
-
// The user's style is passed on as a getter, so a live one stays live (WardUserProps).
|
|
403
|
-
const item = (userProps: ReorderItemUserProps = NO_ITEM_PROPS): ReorderItemSpread =>
|
|
404
|
-
mergeProps(
|
|
405
|
-
ward({
|
|
406
|
-
ref: mergeRefs(userProps.ref, setElement),
|
|
407
|
-
get style() {
|
|
408
|
-
return userProps.style
|
|
409
|
-
},
|
|
410
|
-
}),
|
|
411
|
-
keyboardAttributes(group as unknown as ItemGroup<never>, userProps, describedBy),
|
|
412
|
-
)
|
|
413
|
-
return Object.assign(item, {
|
|
414
|
-
Provider: ward.Provider,
|
|
415
|
-
})
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
const noop = (): void => {}
|
|
419
653
|
|
|
420
|
-
/** A
|
|
421
|
-
|
|
422
|
-
const NO_ITEM_PROPS: ReorderItemUserProps = {}
|
|
654
|
+
/** A function `groupRef` gives the component's group: never a group, which it would take instead. */
|
|
655
|
+
export type GroupRefCallback<V> = ((list: ReorderGroup<V>) => void) & { readonly [REORDER_GROUP]?: never }
|
|
423
656
|
|
|
424
657
|
/**
|
|
425
|
-
* {@link
|
|
426
|
-
*
|
|
427
|
-
* `move` and `controller` do nothing.
|
|
658
|
+
* `Reorder.Group`'s props: its group ({@link ReorderGroupOf}), `as`, the element it renders (`"ul"` by
|
|
659
|
+
* default, read once), and that element's own props and motion props.
|
|
428
660
|
*/
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const axis = (): CoreReorder.Axis => UndefinedOr.match(cfg().axis, { onUndefined: () => "y" as const, onDefined: (a: CoreReorder.Axis) => a })
|
|
436
|
-
return Object.assign(spread, { group: controller.group, axis, move: noop, controller, ...keyboardOf(cfg) })
|
|
437
|
-
}
|
|
661
|
+
export type ReorderGroupComponentProps<V, Tag extends ReorderElementTag = "ul"> =
|
|
662
|
+
& ReorderGroupOf<V>
|
|
663
|
+
& { readonly as?: Tag }
|
|
664
|
+
& Omit<JSX.IntrinsicElements[Tag], "style" | "onReorder">
|
|
665
|
+
& { readonly style?: WardStyle | string | undefined }
|
|
666
|
+
& WardicMotion
|
|
438
667
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
return rest
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/** `use:reorderItem`'s value: the item's `group` and its `value`, and its motion props. */
|
|
445
|
-
// The group of any value type, as an `ItemGroup<never>`.
|
|
446
|
-
export type ReorderItemDirectiveValue = {
|
|
447
|
-
readonly group: ItemGroup<never>
|
|
448
|
-
readonly value: unknown
|
|
449
|
-
readonly layout?: ReorderItemLayout
|
|
450
|
-
} & Omit<WardConfig.WardConfig, "layout" | "layoutId" | "drag">
|
|
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">
|
|
451
670
|
|
|
452
671
|
/**
|
|
453
|
-
* `
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
* item takes `createReorderItem` or `Reorder.Item`. Import `reorderItem` in the module that uses it.
|
|
457
|
-
*
|
|
458
|
-
* @see https://wardic.dev/reference/solid/reorder/reorder-item
|
|
672
|
+
* `Reorder.Item`'s item: its `value`, its `layout` and its motion props, `wardRef` handing its ward out,
|
|
673
|
+
* or an item made with `reorderItem` given to `wardRef`, with the keys its config `C` doesn't set
|
|
674
|
+
* beside it, as beside a ward: never `value`, which an item is made with.
|
|
459
675
|
*/
|
|
460
|
-
//
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
return { ...rest, layout: itemLayoutOf(rest.layout) }
|
|
468
|
-
})
|
|
469
|
-
// As `use:wardic`: a Variant child joins the nearest variant context; it provides none (#50).
|
|
470
|
-
const node = createVariantNode(cfg, useVariantContext(), UndefinedOr.map(controls, (c) => c.change))
|
|
471
|
-
const runtime = useWardicRuntime()
|
|
472
|
-
const group = first.group as ItemGroup<unknown>
|
|
473
|
-
// The keyboard reorder's tab stop and instructions (ADR-0037), on the element itself: the app's
|
|
474
|
-
// own `tabindex` wins, and its `aria-describedby` ids are kept.
|
|
475
|
-
createEffect(() => {
|
|
476
|
-
if (Bool.not(group.keyboard())) return
|
|
477
|
-
if (!el.hasAttribute("tabindex")) el.setAttribute("tabindex", "0")
|
|
478
|
-
const id = DomAnnouncer.instructionsId(DomAnnouncer.documentOf(el), group.instructions())
|
|
479
|
-
const ids = Option.getOrElse(Option.fromNullishOr(el.getAttribute("aria-describedby")), () => "").split(" ").filter((t) => t !== "")
|
|
480
|
-
if (!ids.includes(id)) el.setAttribute("aria-describedby", [...ids, id].join(" "))
|
|
676
|
+
// #349, #398.
|
|
677
|
+
export type ReorderItemOf<V, C = {}> =
|
|
678
|
+
| (ItemMotionProps & {
|
|
679
|
+
/** Its value in the group's `values`, of any type, not its element's `value` attribute. Read once. */
|
|
680
|
+
readonly value: V
|
|
681
|
+
readonly layout?: ReorderItemLayout
|
|
682
|
+
readonly wardRef?: WardRefCallback | undefined
|
|
481
683
|
})
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
controls,
|
|
489
|
-
parent: node.inherited,
|
|
490
|
-
extraDelay: node.extraDelay,
|
|
491
|
-
byName: node.names,
|
|
492
|
-
canStart: node.canStart,
|
|
493
|
-
bindGestures: node.bindGestures,
|
|
494
|
-
onFrame: node.onFrame,
|
|
495
|
-
makeSink: (element) => ({ target: element }),
|
|
496
|
-
internal: itemInternals(group, first.value, () => el, runtime, first.dragListener !== false),
|
|
684
|
+
| (WardicBeside<C, ItemMotionProps> & {
|
|
685
|
+
readonly wardRef: AnyReorderItem<V> & GivenWard<C>
|
|
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
|
|
497
690
|
})
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
declare module "solid-js" {
|
|
501
|
-
// biome-ignore lint/style/useNamingConvention: augmenting Solid's JSX namespace.
|
|
502
|
-
namespace JSX {
|
|
503
|
-
interface Directives {
|
|
504
|
-
reorderItem: ReorderItemDirectiveValue
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// --- Components (ADR-0020, D8: built on the headless API) --------------------------
|
|
510
|
-
|
|
511
|
-
const GroupContext = createContext<ReorderGroup<unknown>>()
|
|
512
|
-
|
|
513
|
-
/** An element tag a `<Reorder>` group or item can render. */
|
|
514
|
-
export type ReorderElementTag = keyof JSX.IntrinsicElements
|
|
515
691
|
|
|
516
692
|
/**
|
|
517
|
-
* `Reorder.
|
|
518
|
-
* props
|
|
693
|
+
* `Reorder.Item`'s props: its item ({@link ReorderItemOf}), `as`, the element it renders (`"li"` by
|
|
694
|
+
* default, read once), and that element's own props, but its `value` attribute: `value` is the item's (#748).
|
|
519
695
|
*/
|
|
520
|
-
export type
|
|
521
|
-
|
|
522
|
-
readonly
|
|
523
|
-
|
|
524
|
-
readonly
|
|
525
|
-
/** Called once at the end of a reorder that changed the order, with the order and the item that moved: what an app saves. */
|
|
526
|
-
readonly onReorderEnd?: ((end: ReorderController.End<V>) => void) | undefined
|
|
527
|
-
/** Called as an item is taken in hand, by a drag starting or a keyboard lift. */
|
|
528
|
-
readonly onHoldStart?: ((start: ReorderController.HoldStart<V>) => void) | undefined
|
|
529
|
-
/** Called once as an item in hand is let go, however; after `onReorderEnd` when it moved. */
|
|
530
|
-
readonly onHoldEnd?: ((end: ReorderController.HoldEnd<V>) => void) | undefined
|
|
531
|
-
/** 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. */
|
|
532
|
-
readonly axis?: CoreReorder.Axis | undefined
|
|
533
|
-
/** The keyboard reorder: on unless `false`. */
|
|
534
|
-
readonly keyboard?: boolean | undefined
|
|
535
|
-
/** What a screen reader hears at each step of a keyboard reorder, over the English defaults. */
|
|
536
|
-
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
537
|
-
/** What each item's `aria-describedby` reads, over the English default. */
|
|
538
|
-
readonly instructions?: string | undefined
|
|
539
|
-
/** The element it renders: `"ul"` by default. Read once. */
|
|
540
|
-
readonly as?: Tag
|
|
541
|
-
} & Omit<WardicProps<Tag>, "onReorder">
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* `Reorder.Item`'s props: its `value`, `as`, its `layout`, and the props of the element it renders,
|
|
545
|
-
* motion props included, but `layoutId` and `drag`, which the group sets, and its `value` attribute:
|
|
546
|
-
* `value` is the item's (#748).
|
|
547
|
-
*/
|
|
548
|
-
export type ReorderItemProps<V, Tag extends ReorderElementTag = "li"> = {
|
|
549
|
-
/** Its value in the group's `values`, of any type, not its element's `value` attribute. Read once. */
|
|
550
|
-
readonly value: V
|
|
551
|
-
/** The element it renders: `"li"` by default. Read once. */
|
|
552
|
-
readonly as?: Tag
|
|
553
|
-
/** `true`, its place and size animating (the default), or `"position"`, its place alone. */
|
|
554
|
-
readonly layout?: ReorderItemLayout
|
|
555
|
-
} & Omit<WardicProps<Tag>, "layout" | "layoutId" | "drag" | "value">
|
|
696
|
+
export type ReorderItemComponentProps<V, Tag extends ReorderElementTag = "li", C = {}> =
|
|
697
|
+
& ReorderItemOf<V, C>
|
|
698
|
+
& { readonly as?: Tag }
|
|
699
|
+
& Omit<JSX.IntrinsicElements[Tag], "style" | "value">
|
|
700
|
+
& { readonly style?: WardStyle | string | undefined }
|
|
556
701
|
|
|
557
702
|
/**
|
|
558
|
-
* The props a component body reads, as plain records: instantiating the public prop
|
|
559
|
-
*
|
|
560
|
-
* type checker build a union of every element's props, which a consumer's checker
|
|
561
|
-
* can run out of memory on.
|
|
703
|
+
* The props a component body reads, as plain records: instantiating the public prop types over
|
|
704
|
+
* every element tag makes a type checker build a union of every element's props.
|
|
562
705
|
*/
|
|
563
706
|
interface GroupLocal<V> {
|
|
564
707
|
readonly values: ReadonlyArray<V>
|
|
565
708
|
readonly onReorder: (values: Array<V>) => void
|
|
566
|
-
readonly
|
|
567
|
-
readonly onHoldStart?: ((start: ReorderController.HoldStart<V>) => void) | undefined
|
|
568
|
-
readonly onHoldEnd?: ((end: ReorderController.HoldEnd<V>) => void) | undefined
|
|
709
|
+
readonly groupRef?: unknown
|
|
569
710
|
readonly axis?: CoreReorder.Axis | undefined
|
|
570
711
|
readonly keyboard?: boolean | undefined
|
|
571
712
|
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
572
713
|
readonly instructions?: string | undefined
|
|
573
714
|
readonly as?: string | undefined
|
|
574
|
-
readonly ref?:
|
|
575
|
-
readonly style?:
|
|
715
|
+
readonly ref?: unknown
|
|
716
|
+
readonly style?: WardStyle | string | undefined
|
|
576
717
|
readonly children?: JSX.Element
|
|
577
718
|
}
|
|
578
719
|
interface ItemLocal<V> {
|
|
579
720
|
readonly value: V
|
|
580
721
|
readonly as?: string | undefined
|
|
581
|
-
readonly ref?:
|
|
582
|
-
readonly style?:
|
|
722
|
+
readonly ref?: unknown
|
|
723
|
+
readonly style?: WardStyle | string | undefined
|
|
583
724
|
readonly children?: JSX.Element
|
|
584
|
-
readonly
|
|
725
|
+
readonly tabindex?: number | undefined
|
|
585
726
|
readonly "aria-describedby"?: string | undefined
|
|
727
|
+
readonly wardRef?: unknown
|
|
586
728
|
}
|
|
587
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
|
+
|
|
588
739
|
/**
|
|
589
|
-
* The Wardic element for `tag`,
|
|
590
|
-
*
|
|
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.
|
|
591
742
|
*/
|
|
592
743
|
const wardicTag = (tag: string): Component<Record<string, unknown>> =>
|
|
593
744
|
UndefinedOr.getOrThrow((w as unknown as Record<string, Component<Record<string, unknown>> | undefined>)[tag])
|
|
594
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
|
+
|
|
595
752
|
/**
|
|
596
753
|
* A list put in order by dragging its items, or from the keyboard, rendered as `as`, `"ul"` by
|
|
597
|
-
* default. Your app owns `values`, and sets them from `onReorder
|
|
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>`.
|
|
598
756
|
*
|
|
599
757
|
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
600
758
|
*/
|
|
601
|
-
// ADR-0020: a `
|
|
602
|
-
function Group<V, Tag extends ReorderElementTag = "ul">(props:
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
])
|
|
618
|
-
const group = createReorderGroup<V>(() => ({
|
|
619
|
-
values: local.values,
|
|
620
|
-
onReorder: local.onReorder,
|
|
621
|
-
...UndefinedOr.match(local.onReorderEnd, { onUndefined: () => ({}), onDefined: (onReorderEnd) => ({ onReorderEnd }) }),
|
|
622
|
-
...UndefinedOr.match(local.onHoldStart, { onUndefined: () => ({}), onDefined: (onHoldStart) => ({ onHoldStart }) }),
|
|
623
|
-
...UndefinedOr.match(local.onHoldEnd, { onUndefined: () => ({}), onDefined: (onHoldEnd) => ({ onHoldEnd }) }),
|
|
624
|
-
...UndefinedOr.match(local.axis, { onUndefined: () => ({}), onDefined: (axis) => ({ axis }) }),
|
|
625
|
-
...UndefinedOr.match(local.keyboard, { onUndefined: () => ({}), onDefined: (keyboard) => ({ keyboard }) }),
|
|
626
|
-
...UndefinedOr.match(local.announcements, { onUndefined: () => ({}), onDefined: (announcements) => ({ announcements }) }),
|
|
627
|
-
...UndefinedOr.match(local.instructions, { onUndefined: () => ({}), onDefined: (instructions) => ({ instructions }) }),
|
|
628
|
-
}))
|
|
629
|
-
const Tag = wardicTag(UndefinedOr.match(untrack(() => local.as), { onUndefined: () => "ul", onDefined: identity }))
|
|
630
|
-
const userRef = local.ref
|
|
631
|
-
const spread = group({
|
|
632
|
-
...UndefinedOr.match(userRef, { onUndefined: () => ({}), onDefined: (ref) => ({ ref }) }),
|
|
633
|
-
get style() {
|
|
634
|
-
return local.style
|
|
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
|
|
635
775
|
},
|
|
636
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
|
+
})
|
|
637
784
|
return (
|
|
638
|
-
<GroupContext
|
|
639
|
-
<Tag {...rest} {
|
|
785
|
+
<GroupContext value={list as ReorderGroup<unknown>}>
|
|
786
|
+
<Tag {...rest} style={styleOf()} ref={refsOf(local, [list])}>
|
|
640
787
|
{local.children}
|
|
641
788
|
</Tag>
|
|
642
|
-
</GroupContext
|
|
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
|
+
),
|
|
643
819
|
)
|
|
820
|
+
return { row, keys, setup }
|
|
644
821
|
}
|
|
645
822
|
|
|
646
823
|
/**
|
|
647
|
-
* An item of the `Reorder.Group` around it, rendered as `as`, `"li"` by default
|
|
648
|
-
* throws, as Motion's does.
|
|
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.
|
|
649
826
|
*
|
|
650
827
|
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
651
828
|
*/
|
|
652
|
-
// ADR-0020: a `
|
|
653
|
-
function Item<V, Tag extends ReorderElementTag = "li">(props:
|
|
654
|
-
const
|
|
655
|
-
if (Predicate.
|
|
656
|
-
|
|
657
|
-
// omits them), so none reaches the DOM.
|
|
658
|
-
const [local, motion, rest] = splitProps(
|
|
659
|
-
props as unknown as ItemLocal<V> & WardicMotionProps & Record<string, unknown>,
|
|
660
|
-
["value", "as", "ref", "style", "children", "tabIndex", "aria-describedby"],
|
|
661
|
-
MOTION_PROPS,
|
|
662
|
-
)
|
|
663
|
-
const config = configOfMotion(motion as WardicMotionProps)
|
|
664
|
-
const item = createReorderItem<V>(group, () => ({ ...config(), layout: itemLayoutOf(config().layout), value: local.value }))
|
|
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
|
|
665
834
|
const tag = UndefinedOr.match(untrack(() => local.as), { onUndefined: () => "li", onDefined: identity })
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
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
|
+
}
|
|
674
857
|
},
|
|
675
|
-
|
|
676
|
-
|
|
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
|
+
}
|
|
677
869
|
},
|
|
678
870
|
})
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
// them (#50), as every Wardic element does; any other renders none.
|
|
686
|
-
return Bool.match(VariantTree.changesContext(untrack(config)), {
|
|
687
|
-
onFalse: element,
|
|
688
|
-
onTrue: () => <item.Provider>{element()}</item.Provider>,
|
|
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>,
|
|
689
877
|
})
|
|
690
878
|
}
|
|
691
879
|
|