@wardic/solid 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +132 -212
- package/dist/browser/batch-reorder-group.js.map +1 -1
- package/dist/browser/batch-reorder.js +4 -15
- package/dist/browser/batch-reorder.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 +7 -7
- 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/{unstable/v2/flights.js → flights.js} +7 -4
- 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/gesture-callbacks.js +11 -164
- package/dist/browser/gesture-callbacks.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 +197 -182
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/reorder.js +515 -401
- 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/{unstable/v2 → v1}/bridge.js +24 -31
- 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} +16 -23
- package/dist/browser/v1/create-ward.js.map +1 -0
- package/dist/browser/{unstable/v2 → v1}/create-wardic.js +7 -7
- 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/browser/{unstable/v2 → v1}/live-scroll.js +25 -39
- package/dist/browser/v1/live-scroll.js.map +1 -0
- package/dist/{server/unstable/v2 → browser/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 -233
- 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} +35 -18
- 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 +286 -251
- package/dist/server/batch-reorder-group.js.map +1 -1
- package/dist/server/batch-reorder.js +4 -15
- package/dist/server/batch-reorder.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 +7 -7
- 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/{unstable/v2/flights.js → flights.js} +7 -4
- 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/gesture-callbacks.js +11 -164
- package/dist/server/gesture-callbacks.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 +225 -186
- package/dist/server/provider.js.map +1 -1
- package/dist/server/reorder.js +595 -411
- 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/{unstable/v2 → v1}/bridge.js +24 -31
- 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} +16 -23
- package/dist/server/v1/create-ward.js.map +1 -0
- package/dist/server/{unstable/v2 → v1}/create-wardic.js +7 -7
- 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/server/{unstable/v2 → v1}/live-scroll.js +25 -39
- package/dist/server/v1/live-scroll.js.map +1 -0
- package/dist/{browser/unstable/v2 → server/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 -205
- 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} +35 -18
- 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 +105 -168
- package/dist/solid/batch-reorder-group.jsx.map +1 -1
- package/dist/solid/batch-reorder.d.ts +1 -4
- package/dist/solid/batch-reorder.d.ts.map +1 -1
- package/dist/solid/batch-reorder.js +4 -9
- package/dist/solid/batch-reorder.js.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 +7 -7
- 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/{unstable/v2/flights.d.ts → flights.d.ts} +5 -2
- package/dist/solid/flights.d.ts.map +1 -0
- package/dist/solid/{unstable/v2/flights.js → flights.js} +7 -4
- 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/gesture-callbacks.d.ts +10 -37
- package/dist/solid/gesture-callbacks.d.ts.map +1 -1
- package/dist/solid/gesture-callbacks.js +11 -178
- package/dist/solid/gesture-callbacks.js.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 +180 -163
- 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 +408 -314
- 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} +16 -23
- 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 +7 -7
- 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 -186
- 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} +36 -18
- 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 +25 -15
- package/src/batch-appear-here.tsx +2 -3
- package/src/batch-reorder-group.tsx +144 -258
- package/src/batch-reorder.ts +4 -10
- 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 +11 -10
- 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/{unstable/v2/flights.ts → flights.ts} +8 -5
- package/src/focus-sensor.tsx +8 -9
- package/src/gesture-callbacks.ts +21 -190
- 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 +200 -196
- package/src/reorder.tsx +668 -492
- 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} +18 -25
- package/src/{unstable/v2 → v1}/create-wardic.tsx +10 -11
- 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 -205
- 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} +39 -21
- 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/instance-features.js +0 -66
- package/dist/browser/instance-features.js.map +0 -1
- package/dist/browser/page-point.js +0 -92
- package/dist/browser/page-point.js.map +0 -1
- package/dist/browser/reorder-input.js +0 -117
- package/dist/browser/reorder-input.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 -297
- package/dist/browser/unstable/v2/batch-reorder-group.js.map +0 -1
- 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 -671
- 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 -82
- 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/instance-features.js +0 -66
- package/dist/server/instance-features.js.map +0 -1
- package/dist/server/page-point.js +0 -92
- package/dist/server/page-point.js.map +0 -1
- package/dist/server/reorder-input.js +0 -117
- package/dist/server/reorder-input.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 -408
- package/dist/server/unstable/v2/batch-reorder-group.js.map +0 -1
- 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 -741
- 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 -82
- 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/instance-features.d.ts +0 -7
- package/dist/solid/instance-features.d.ts.map +0 -1
- package/dist/solid/instance-features.js +0 -63
- package/dist/solid/instance-features.js.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/reorder-input.d.ts +0 -43
- package/dist/solid/reorder-input.d.ts.map +0 -1
- package/dist/solid/reorder-input.js +0 -113
- package/dist/solid/reorder-input.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 -34
- package/dist/solid/unstable/v2/bridge.d.ts.map +0 -1
- package/dist/solid/unstable/v2/bridge.jsx +0 -76
- 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 -61
- package/dist/solid/unstable/v2/solid-reactivity.d.ts.map +0 -1
- package/dist/solid/unstable/v2/solid-reactivity.js +0 -62
- 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/instance-features.ts +0 -76
- package/src/page-point.ts +0 -98
- package/src/reorder-input.ts +0 -140
- package/src/unstable/v2/batch-reorder-group.tsx +0 -409
- package/src/unstable/v2/bridge.tsx +0 -80
- 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 -69
- 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/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/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/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/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,36 +1,47 @@
|
|
|
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 { mergeRefs } from "@solid-primitives/refs"
|
|
34
45
|
import * as Arr from "effect/Array"
|
|
35
46
|
import * as Bool from "effect/Boolean"
|
|
36
47
|
import * as Effect from "effect/Effect"
|
|
@@ -40,29 +51,9 @@ import * as Option from "effect/Option"
|
|
|
40
51
|
import * as Predicate from "effect/Predicate"
|
|
41
52
|
import * as Scope from "effect/Scope"
|
|
42
53
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type Component,
|
|
47
|
-
createContext,
|
|
48
|
-
createEffect,
|
|
49
|
-
createMemo,
|
|
50
|
-
createSignal,
|
|
51
|
-
createUniqueId,
|
|
52
|
-
type JSX,
|
|
53
|
-
mergeProps,
|
|
54
|
-
on,
|
|
55
|
-
onCleanup,
|
|
56
|
-
splitProps,
|
|
57
|
-
untrack,
|
|
58
|
-
useContext,
|
|
59
|
-
} from "solid-js"
|
|
60
|
-
import { Dynamic } from "solid-js/web"
|
|
61
|
-
import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
|
|
62
|
-
import { runWatch, useBrought, useWardicGate, useWardicRuntime } from "./provider.tsx"
|
|
63
|
-
import { useLayoutServices } from "./layout-projection.tsx"
|
|
64
|
-
import { watchItemInput } from "./reorder-input.ts"
|
|
65
|
-
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"
|
|
66
57
|
import type * as Feature from "@wardic/dom/unstable/Feature"
|
|
67
58
|
import * as Drag from "@wardic/dom/unstable/features/Drag"
|
|
68
59
|
import * as Focus from "@wardic/dom/unstable/features/Focus"
|
|
@@ -72,87 +63,161 @@ import * as Layout from "@wardic/dom/unstable/features/Layout"
|
|
|
72
63
|
import * as Pan from "@wardic/dom/unstable/features/Pan"
|
|
73
64
|
import * as Press from "@wardic/dom/unstable/features/Press"
|
|
74
65
|
import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures"
|
|
75
|
-
import
|
|
76
|
-
import {
|
|
77
|
-
import
|
|
78
|
-
import { isServer } from "./server.ts"
|
|
79
|
-
import { createVariantNode } from "./variant-node.ts"
|
|
80
|
-
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"
|
|
81
69
|
import * as VariantTree from "@wardic/core/unstable/VariantTree"
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
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"
|
|
85
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"
|
|
86
78
|
import { BatchGroup, BatchItem } from "./batch-reorder-group.tsx"
|
|
87
79
|
|
|
88
|
-
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"
|
|
89
81
|
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
* from. Give an accessor of it for values that change.
|
|
93
|
-
*/
|
|
94
|
-
export interface ReorderGroupConfig<V> {
|
|
82
|
+
/** A Reorder group's config, each key read as a value. */
|
|
83
|
+
export interface ReorderGroupConfigValues<V> {
|
|
95
84
|
/** The list's values, in order. Your app owns them. */
|
|
96
85
|
readonly values: ReadonlyArray<V>
|
|
97
86
|
/** Given each new order, as an item crosses another: set `values` from it. */
|
|
98
87
|
readonly onReorder: (values: Array<V>) => void
|
|
99
|
-
/**
|
|
100
|
-
* Called once at the end of a reorder that changed the order: a drag let go, or a keyboard lift
|
|
101
|
-
* dropped, with the order, the item that moved, and its index `from` and `to`. What an app saves.
|
|
102
|
-
* Not called for a keyboard cancel, nor for `move`.
|
|
103
|
-
*/
|
|
104
|
-
// #257 item 3.
|
|
105
|
-
readonly onReorderEnd?: (end: ReorderController.End<V>) => void
|
|
106
|
-
/**
|
|
107
|
-
* Called as an item is taken in hand, by a drag starting (past its threshold, not at the press) or a
|
|
108
|
-
* keyboard lift, with its index then.
|
|
109
|
-
*/
|
|
110
|
-
// A Reorder hold's start (#348, ADR-0020 *Amendment (#348)*).
|
|
111
|
-
readonly onHoldStart?: (start: ReorderController.HoldStart<V>) => void
|
|
112
|
-
/**
|
|
113
|
-
* Called once as an item in hand is let go, however: let go or dropped (`how: "drop"`), put back with
|
|
114
|
-
* Escape (`"cancel"`), or unmounted (`"unmount"`). After `onReorderEnd` when it moved.
|
|
115
|
-
*/
|
|
116
|
-
// A Reorder hold's end (#348).
|
|
117
|
-
readonly onHoldEnd?: (end: ReorderController.HoldEnd<V>) => void
|
|
118
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. */
|
|
119
|
-
readonly axis?: CoreReorder.Axis
|
|
89
|
+
readonly axis?: CoreReorder.Axis | undefined
|
|
120
90
|
/** The keyboard reorder: on unless `false`. Off, the items have no keys, no tab stop and no instructions. */
|
|
121
91
|
// ADR-0037.
|
|
122
|
-
readonly keyboard?: boolean
|
|
92
|
+
readonly keyboard?: boolean | undefined
|
|
123
93
|
/**
|
|
124
94
|
* What a screen reader hears at each step of a keyboard reorder, over the English defaults: `lift`,
|
|
125
95
|
* `step`, `drop`, `cancel`, and `move` for a move in code, each a function of the item's `label`,
|
|
126
96
|
* `position` and the list's `count`.
|
|
127
97
|
*/
|
|
128
|
-
readonly announcements?: Partial<CoreReorder.Announcements<V>>
|
|
98
|
+
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
129
99
|
/** What each item's `aria-describedby` reads, over the English default. */
|
|
130
|
-
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
|
|
131
103
|
}
|
|
132
104
|
|
|
133
|
-
/**
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
|
137
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."
|
|
138
154
|
|
|
139
155
|
/** What a group's spread gives its element: its `ref`, and its `style` over `overflow-anchor: none`. */
|
|
140
|
-
export interface
|
|
141
|
-
|
|
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`. */
|
|
142
160
|
readonly style: JSX.CSSProperties
|
|
143
161
|
}
|
|
144
162
|
|
|
145
163
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
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.
|
|
148
166
|
*/
|
|
149
|
-
export
|
|
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.
|
|
178
|
+
*/
|
|
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
|
|
150
187
|
/** The group's state: `@wardic/core`'s `Reorder.Group`. */
|
|
151
188
|
readonly group: CoreReorder.Group<V>
|
|
152
189
|
/** The list's direction: the config's, else the one found from the items' boxes. */
|
|
153
190
|
readonly axis: Accessor<CoreReorder.Axis>
|
|
154
191
|
/** Moves `value` to `toIndex`, as a button of your own would, and announces it to a screen reader. */
|
|
155
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]>
|
|
156
221
|
/** Whether the items reorder from the keyboard. */
|
|
157
222
|
readonly keyboard: Accessor<boolean>
|
|
158
223
|
/** The instructions the items' `aria-describedby` reads. */
|
|
@@ -169,535 +234,646 @@ export type ReorderGroup<V> = ((userProps?: ReorderGroupUserProps) => ReorderGro
|
|
|
169
234
|
export type ReorderItemLayout = true | "position"
|
|
170
235
|
|
|
171
236
|
/**
|
|
172
|
-
* A `<Reorder>` item's config: its `value`, its `layout
|
|
173
|
-
* 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.
|
|
174
240
|
*/
|
|
175
|
-
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"], [])
|
|
176
266
|
|
|
177
267
|
/** An item's `layout` as its Layout mode: `"position"`, else `true` (ADR-0009, *Amendment (#42)*). */
|
|
178
268
|
const itemLayoutOf = (layout: unknown): ReorderItemLayout =>
|
|
179
269
|
Bool.match(layout === "position", { onTrue: (): ReorderItemLayout => "position", onFalse: (): ReorderItemLayout => true })
|
|
180
270
|
|
|
181
|
-
/**
|
|
182
|
-
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
|
+
}
|
|
183
310
|
|
|
184
311
|
/**
|
|
185
312
|
* Makes a list of your own elements reorderable, by dragging or from the keyboard: spread the group on
|
|
186
|
-
* the list's element, and make each item with `
|
|
187
|
-
* `values`, and sets them from `onReorder
|
|
188
|
-
*
|
|
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.
|
|
189
316
|
*
|
|
190
317
|
* @example
|
|
191
|
-
* const list =
|
|
192
|
-
* <ul {...list
|
|
318
|
+
* const list = reorderGroup({ values: items, onReorder: setItems })
|
|
319
|
+
* <ul {...list}>
|
|
193
320
|
* <For each={items()}>
|
|
194
321
|
* {(item) => {
|
|
195
|
-
* const row =
|
|
196
|
-
* return <li {...row
|
|
322
|
+
* const row = reorderItem(list, { value: item })
|
|
323
|
+
* return <li {...row}>{item.name}</li>
|
|
197
324
|
* }}
|
|
198
325
|
* </For>
|
|
199
326
|
* </ul>
|
|
200
327
|
* @see https://wardic.dev/reference/solid/reorder/reorder-group
|
|
201
328
|
*/
|
|
202
|
-
// ADR-0020. `
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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)
|
|
213
340
|
const [detected, setDetected] = createSignal<CoreReorder.Axis>("y")
|
|
214
|
-
// 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.
|
|
215
343
|
const values = (): ReadonlyArray<V> => plainOrder(cfg().values, $PROXY)
|
|
216
|
-
|
|
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
|
|
217
349
|
// The group's controller, over the provider's projection system and the Environment's channel to
|
|
218
|
-
// assistive technology (ADR-0037), in a Scope of the group's own, closed
|
|
219
|
-
//
|
|
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).
|
|
220
352
|
const scope = OwnerScope.open(runtime)
|
|
221
353
|
onCleanup(() => OwnerScope.close(runtime, scope, CLOSE_FAILED))
|
|
222
354
|
const controller = runtime.runSync(
|
|
223
355
|
ReorderController.make<V>({
|
|
224
356
|
values: () => untrack(values),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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)),
|
|
230
371
|
onAxis: setDetected,
|
|
231
372
|
keyedWith: "<For>",
|
|
232
|
-
keyboard: () => untrack(cfg).keyboard !== false,
|
|
233
|
-
announcements: () => Option.fromUndefinedOr(untrack(cfg).announcements),
|
|
373
|
+
keyboard: () => untrack(() => cfg().keyboard) !== false,
|
|
374
|
+
announcements: () => Option.fromUndefinedOr(untrack(() => cfg().announcements)),
|
|
234
375
|
}).pipe(Effect.provide(useLayoutServices()), Scope.provide(scope)),
|
|
235
376
|
)
|
|
236
377
|
// The app's axis, else the detected one. When the app's is cleared, detected here, from the boxes the
|
|
237
|
-
// engine holds, so the items' touch-action follows in the same
|
|
238
|
-
// detected it wrote a signal the items read a
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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,
|
|
247
392
|
)
|
|
248
393
|
|
|
249
|
-
// A `values` change re-measures, so the items animate to their new slots whoever
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
ref: mergeRefs(userProps.ref, (el: HTMLElement) => controller.attach(el)),
|
|
255
|
-
get style() {
|
|
256
|
-
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()
|
|
257
399
|
},
|
|
258
|
-
|
|
400
|
+
CLIENT_ONLY_DEFERRED,
|
|
401
|
+
)
|
|
259
402
|
|
|
260
|
-
const
|
|
261
|
-
|
|
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)
|
|
262
429
|
}
|
|
263
430
|
|
|
264
|
-
/**
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
+
}
|
|
269
439
|
|
|
270
440
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* group, raised while dragged, whose drag takes the group's axis at each start and
|
|
274
|
-
* 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.
|
|
275
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
|
+
|
|
276
461
|
/**
|
|
277
|
-
*
|
|
278
|
-
* axis
|
|
279
|
-
* 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.
|
|
280
464
|
*/
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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
|
+
)
|
|
286
473
|
}
|
|
287
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
|
+
|
|
288
481
|
/**
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
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.
|
|
292
485
|
*/
|
|
293
|
-
const
|
|
294
|
-
|
|
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
|
+
})
|
|
295
507
|
|
|
296
508
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
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
|
|
300
519
|
*/
|
|
301
|
-
|
|
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
|
+
}
|
|
302
534
|
|
|
303
|
-
|
|
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()
|
|
304
564
|
// Its keys' input, the `drag` Feature's it brings (#511).
|
|
305
565
|
const services = useBrought(ITEM_BRINGS)
|
|
566
|
+
const value = untrack(() => own.value)
|
|
306
567
|
// A keyboard lift turns the item's `whileDrag` on (ADR-0037).
|
|
307
568
|
const [lifted, setLifted] = createSignal(false)
|
|
308
|
-
|
|
569
|
+
let element: HTMLElement | undefined
|
|
570
|
+
const driver = list.controller.item(value, () => Option.fromUndefinedOr(element), setLifted)
|
|
309
571
|
// An item unmounted mid-gesture gets no end sample: its disposal ends the gesture (and a lift).
|
|
310
572
|
onCleanup(driver.dispose)
|
|
311
|
-
//
|
|
312
|
-
//
|
|
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)
|
|
313
579
|
createEffect(
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
Effect.provideService(watchItemInput(el, driver, (effect) => void runtime.runFork(effect), onDefect), InputSource.InputSource, GestureFeatures.inputIn(services())),
|
|
318
|
-
)
|
|
319
|
-
}
|
|
320
|
-
}),
|
|
580
|
+
() => ({ doc: document(), text: list.instructions() }),
|
|
581
|
+
({ doc, text }) => DomAnnouncer.showInstructions(doc, text),
|
|
582
|
+
CLIENT_ONLY,
|
|
321
583
|
)
|
|
322
|
-
|
|
584
|
+
const row = wardWith(wardConfig, {
|
|
585
|
+
tag,
|
|
323
586
|
brings: ITEM_BRINGS,
|
|
587
|
+
fixed,
|
|
588
|
+
group: list,
|
|
589
|
+
parent,
|
|
324
590
|
dragAxis: () => dragAxisFor(driver.dragAxis()),
|
|
325
591
|
onDragSample: driver.onSample,
|
|
326
|
-
onLayoutHandle:
|
|
592
|
+
onLayoutHandle: driver.register,
|
|
327
593
|
raiseWhileDragged: true,
|
|
328
594
|
keysTaken: true,
|
|
329
595
|
lifted,
|
|
330
|
-
baseStyle:
|
|
331
|
-
|
|
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))
|
|
332
609
|
}
|
|
333
610
|
|
|
334
|
-
|
|
335
|
-
* An item's internals: on a server, the drag defaults with its group's touch-action, joining no
|
|
336
|
-
* controller (ADR-0021); on the client, `itemInternals`. A plain `if`, so a client build drops the
|
|
337
|
-
* server's (#518).
|
|
338
|
-
*/
|
|
339
|
-
const internalsOf = <V,>(group: ItemGroup<V>, value: V, element: Accessor<HTMLElement | undefined>, listens: boolean): SpineInternals => {
|
|
340
|
-
if (isServer) return { brings: ITEM_BRINGS, dragAxis: () => true, baseStyle: touchActionOf(group, listens) }
|
|
341
|
-
return itemInternals(group, value, element, useWardicRuntime(), listens)
|
|
342
|
-
}
|
|
611
|
+
// --- Components (ADR-0020: built on the factories) ---------------------------------------------
|
|
343
612
|
|
|
344
|
-
/**
|
|
345
|
-
|
|
346
|
-
* group's keyboard is on and the app gave no `tabIndex` of its own, and `aria-describedby` with
|
|
347
|
-
* the group's instructions (`describedBy`, set on the client) after the app's own ids.
|
|
348
|
-
*/
|
|
349
|
-
const keyboardAttributes = (group: ItemGroup<never>, user: ReorderItemUserProps = NO_ITEM_PROPS, describedBy: Accessor<string | undefined>) => ({
|
|
350
|
-
get tabindex() {
|
|
351
|
-
return UndefinedOr.match(user.tabIndex, {
|
|
352
|
-
onDefined: identity,
|
|
353
|
-
onUndefined: () => Bool.match(group.keyboard(), { onTrue: () => 0, onFalse: constUndefined }),
|
|
354
|
-
})
|
|
355
|
-
},
|
|
356
|
-
get "aria-describedby"() {
|
|
357
|
-
const ids = Arr.filter([user["aria-describedby"], Bool.match(group.keyboard(), { onTrue: describedBy, onFalse: constUndefined })], Predicate.isNotUndefined)
|
|
358
|
-
return Bool.match(ids.length === 0, { onTrue: () => undefined, onFalse: () => ids.join(" ") })
|
|
359
|
-
},
|
|
360
|
-
})
|
|
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)
|
|
361
615
|
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
* wins over the keyboard reorder's, and its own `aria-describedby` ids, kept before the instructions'.
|
|
365
|
-
*/
|
|
366
|
-
export type ReorderItemUserProps = WardUserProps & {
|
|
367
|
-
readonly tabIndex?: number | undefined
|
|
368
|
-
readonly "aria-describedby"?: string | undefined
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/** A `<Reorder>` item's spread: a {@link WardProps}, plus its keyboard reorder's `tabindex` and `aria-describedby`. */
|
|
372
|
-
export type ReorderItemSpread = WardProps & {
|
|
373
|
-
readonly tabindex?: number | undefined
|
|
374
|
-
readonly "aria-describedby"?: string | undefined
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/** {@link createReorderItem}'s result: call it to spread onto the item's element, as a `Ward`. */
|
|
378
|
-
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
|
|
379
618
|
|
|
380
619
|
/**
|
|
381
|
-
*
|
|
382
|
-
* `
|
|
383
|
-
*
|
|
384
|
-
* the keyboard reorder: give your own `tabIndex` and `aria-describedby` in the spread's props.
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* const row = createReorderItem(list, { value: item, whileDrag: { scale: 1.05 } })
|
|
388
|
-
* <li {...row()}>{item.name}</li>
|
|
389
|
-
* @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.
|
|
390
623
|
*/
|
|
391
|
-
//
|
|
392
|
-
//
|
|
393
|
-
export
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
|
406
652
|
}
|
|
407
|
-
// The item's element, for Auto-scroll's held scroll shift.
|
|
408
|
-
// The user's style is passed on as a getter, so a live one stays live (WardUserProps).
|
|
409
|
-
const item = (userProps: ReorderItemUserProps = NO_ITEM_PROPS): ReorderItemSpread =>
|
|
410
|
-
mergeProps(
|
|
411
|
-
ward({
|
|
412
|
-
ref: mergeRefs(userProps.ref, setElement),
|
|
413
|
-
get style() {
|
|
414
|
-
return userProps.style
|
|
415
|
-
},
|
|
416
|
-
}),
|
|
417
|
-
keyboardAttributes(group as unknown as ItemGroup<never>, userProps, describedBy),
|
|
418
|
-
)
|
|
419
|
-
return Object.assign(item, {
|
|
420
|
-
Provider: ward.Provider,
|
|
421
|
-
})
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
const noop = (): void => {}
|
|
425
653
|
|
|
426
|
-
/** A
|
|
427
|
-
|
|
428
|
-
const NO_ITEM_PROPS: ReorderItemUserProps = {}
|
|
429
|
-
|
|
430
|
-
/** A Reorder item's drag axis for its gesture's axis: a grid's `xy` is a free drag. Built once, at module load. */
|
|
431
|
-
const dragAxisFor: (axis: CoreReorder.Axis) => true | "x" | "y" = Match.type<CoreReorder.Axis>().pipe(
|
|
432
|
-
Match.when("xy", (): true => true),
|
|
433
|
-
Match.orElse((axis) => axis as "x" | "y"),
|
|
434
|
-
)
|
|
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 }
|
|
435
656
|
|
|
436
657
|
/**
|
|
437
|
-
* {@link
|
|
438
|
-
*
|
|
439
|
-
* `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.
|
|
440
660
|
*/
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const axis = (): CoreReorder.Axis => UndefinedOr.match(cfg().axis, { onUndefined: () => "y" as const, onDefined: (a: CoreReorder.Axis) => a })
|
|
448
|
-
return Object.assign(spread, { group: controller.group, axis, move: noop, controller, ...keyboardOf(cfg) })
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
const withoutValue = <V,>(config: ReorderItemConfig<V>): WardConfig.WardConfig => {
|
|
452
|
-
const { value: _value, ...rest } = config
|
|
453
|
-
return rest
|
|
454
|
-
}
|
|
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
|
|
455
667
|
|
|
456
|
-
/**
|
|
457
|
-
|
|
458
|
-
export type ReorderItemDirectiveValue = {
|
|
459
|
-
readonly group: ItemGroup<never>
|
|
460
|
-
readonly value: unknown
|
|
461
|
-
readonly layout?: ReorderItemLayout
|
|
462
|
-
} & 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">
|
|
463
670
|
|
|
464
671
|
/**
|
|
465
|
-
* `
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* item takes `createReorderItem` or `Reorder.Item`. Import `reorderItem` in the module that uses it.
|
|
469
|
-
*
|
|
470
|
-
* @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.
|
|
471
675
|
*/
|
|
472
|
-
//
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
return { ...rest, layout: itemLayoutOf(rest.layout) }
|
|
480
|
-
})
|
|
481
|
-
// As `use:wardic`: a Variant child joins the nearest variant context; it provides none (#50).
|
|
482
|
-
const node = createVariantNode(cfg, useVariantContext(), UndefinedOr.map(controls, (c) => c.change))
|
|
483
|
-
const runtime = useWardicRuntime()
|
|
484
|
-
const group = first.group as ItemGroup<unknown>
|
|
485
|
-
// The keyboard reorder's tab stop and instructions (ADR-0037), on the element itself: the app's
|
|
486
|
-
// own `tabindex` wins, and its `aria-describedby` ids are kept.
|
|
487
|
-
createEffect(() => {
|
|
488
|
-
if (Bool.not(group.keyboard())) return
|
|
489
|
-
if (!el.hasAttribute("tabindex")) el.setAttribute("tabindex", "0")
|
|
490
|
-
const id = DomAnnouncer.instructionsId(DomAnnouncer.documentOf(el), group.instructions())
|
|
491
|
-
const ids = Option.getOrElse(Option.fromNullishOr(el.getAttribute("aria-describedby")), () => "").split(" ").filter((t) => t !== "")
|
|
492
|
-
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
|
|
493
683
|
})
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
controls,
|
|
501
|
-
parent: node.inherited,
|
|
502
|
-
extraDelay: node.extraDelay,
|
|
503
|
-
byName: node.names,
|
|
504
|
-
canStart: node.canStart,
|
|
505
|
-
bindGestures: node.bindGestures,
|
|
506
|
-
onFrame: node.onFrame,
|
|
507
|
-
makeSink: (element) => ({ target: element }),
|
|
508
|
-
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
|
|
509
690
|
})
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
declare module "solid-js" {
|
|
513
|
-
// biome-ignore lint/style/useNamingConvention: augmenting Solid's JSX namespace.
|
|
514
|
-
namespace JSX {
|
|
515
|
-
interface Directives {
|
|
516
|
-
reorderItem: ReorderItemDirectiveValue
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// --- Components (ADR-0020, D8: built on the headless API) --------------------------
|
|
522
|
-
|
|
523
|
-
const GroupContext = createContext<ReorderGroup<unknown>>()
|
|
524
|
-
|
|
525
|
-
/** An element tag a `<Reorder>` group or item can render. */
|
|
526
|
-
export type ReorderElementTag = keyof JSX.IntrinsicElements
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* `Reorder.Group`'s props: its group's config, `as`, and the props of the element it renders, motion
|
|
530
|
-
* props included.
|
|
531
|
-
*/
|
|
532
|
-
export type ReorderGroupProps<V, Tag extends ReorderElementTag = "ul"> = {
|
|
533
|
-
/** The list's values, in order. Your app owns them. */
|
|
534
|
-
readonly values: ReadonlyArray<V>
|
|
535
|
-
/** Given each new order, as an item crosses another: set `values` from it. */
|
|
536
|
-
readonly onReorder: (values: Array<V>) => void
|
|
537
|
-
/** Called once at the end of a reorder that changed the order, with the order and the item that moved: what an app saves. */
|
|
538
|
-
readonly onReorderEnd?: ((end: ReorderController.End<V>) => void) | undefined
|
|
539
|
-
/** Called as an item is taken in hand, by a drag starting or a keyboard lift. */
|
|
540
|
-
readonly onHoldStart?: ((start: ReorderController.HoldStart<V>) => void) | undefined
|
|
541
|
-
/** Called once as an item in hand is let go, however; after `onReorderEnd` when it moved. */
|
|
542
|
-
readonly onHoldEnd?: ((end: ReorderController.HoldEnd<V>) => void) | undefined
|
|
543
|
-
/** 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. */
|
|
544
|
-
readonly axis?: CoreReorder.Axis | undefined
|
|
545
|
-
/** The keyboard reorder: on unless `false`. */
|
|
546
|
-
readonly keyboard?: boolean | undefined
|
|
547
|
-
/** What a screen reader hears at each step of a keyboard reorder, over the English defaults. */
|
|
548
|
-
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
549
|
-
/** What each item's `aria-describedby` reads, over the English default. */
|
|
550
|
-
readonly instructions?: string | undefined
|
|
551
|
-
/** The element it renders: `"ul"` by default. Read once. */
|
|
552
|
-
readonly as?: Tag
|
|
553
|
-
} & Omit<WardicProps<Tag>, "onReorder">
|
|
554
691
|
|
|
555
692
|
/**
|
|
556
|
-
* `Reorder.Item`'s props: its
|
|
557
|
-
*
|
|
558
|
-
* `value` is the item's (#748).
|
|
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).
|
|
559
695
|
*/
|
|
560
|
-
export type
|
|
561
|
-
|
|
562
|
-
readonly
|
|
563
|
-
|
|
564
|
-
readonly
|
|
565
|
-
/** `true`, its place and size animating (the default), or `"position"`, its place alone. */
|
|
566
|
-
readonly layout?: ReorderItemLayout
|
|
567
|
-
} & 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 }
|
|
568
701
|
|
|
569
702
|
/**
|
|
570
|
-
* The props a component body reads, as plain records: instantiating the public prop
|
|
571
|
-
*
|
|
572
|
-
* type checker build a union of every element's props, which a consumer's checker
|
|
573
|
-
* 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.
|
|
574
705
|
*/
|
|
575
706
|
interface GroupLocal<V> {
|
|
576
707
|
readonly values: ReadonlyArray<V>
|
|
577
708
|
readonly onReorder: (values: Array<V>) => void
|
|
578
|
-
readonly
|
|
579
|
-
readonly onHoldStart?: ((start: ReorderController.HoldStart<V>) => void) | undefined
|
|
580
|
-
readonly onHoldEnd?: ((end: ReorderController.HoldEnd<V>) => void) | undefined
|
|
709
|
+
readonly groupRef?: unknown
|
|
581
710
|
readonly axis?: CoreReorder.Axis | undefined
|
|
582
711
|
readonly keyboard?: boolean | undefined
|
|
583
712
|
readonly announcements?: Partial<CoreReorder.Announcements<V>> | undefined
|
|
584
713
|
readonly instructions?: string | undefined
|
|
585
714
|
readonly as?: string | undefined
|
|
586
|
-
readonly ref?:
|
|
587
|
-
readonly style?:
|
|
715
|
+
readonly ref?: unknown
|
|
716
|
+
readonly style?: WardStyle | string | undefined
|
|
588
717
|
readonly children?: JSX.Element
|
|
589
718
|
}
|
|
590
719
|
interface ItemLocal<V> {
|
|
591
720
|
readonly value: V
|
|
592
721
|
readonly as?: string | undefined
|
|
593
|
-
readonly ref?:
|
|
594
|
-
readonly style?:
|
|
722
|
+
readonly ref?: unknown
|
|
723
|
+
readonly style?: WardStyle | string | undefined
|
|
595
724
|
readonly children?: JSX.Element
|
|
596
|
-
readonly
|
|
725
|
+
readonly tabindex?: number | undefined
|
|
597
726
|
readonly "aria-describedby"?: string | undefined
|
|
727
|
+
readonly wardRef?: unknown
|
|
598
728
|
}
|
|
599
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
|
+
|
|
600
739
|
/**
|
|
601
|
-
* The Wardic element for `tag`,
|
|
602
|
-
*
|
|
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.
|
|
603
742
|
*/
|
|
604
743
|
const wardicTag = (tag: string): Component<Record<string, unknown>> =>
|
|
605
744
|
UndefinedOr.getOrThrow((w as unknown as Record<string, Component<Record<string, unknown>> | undefined>)[tag])
|
|
606
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
|
+
|
|
607
752
|
/**
|
|
608
753
|
* A list put in order by dragging its items, or from the keyboard, rendered as `as`, `"ul"` by
|
|
609
|
-
* 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>`.
|
|
610
756
|
*
|
|
611
757
|
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
612
758
|
*/
|
|
613
|
-
// ADR-0020: a `
|
|
614
|
-
function Group<V, Tag extends ReorderElementTag = "ul">(props:
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
])
|
|
630
|
-
const group = createReorderGroup<V>(() => ({
|
|
631
|
-
values: local.values,
|
|
632
|
-
onReorder: local.onReorder,
|
|
633
|
-
...UndefinedOr.match(local.onReorderEnd, { onUndefined: () => ({}), onDefined: (onReorderEnd) => ({ onReorderEnd }) }),
|
|
634
|
-
...UndefinedOr.match(local.onHoldStart, { onUndefined: () => ({}), onDefined: (onHoldStart) => ({ onHoldStart }) }),
|
|
635
|
-
...UndefinedOr.match(local.onHoldEnd, { onUndefined: () => ({}), onDefined: (onHoldEnd) => ({ onHoldEnd }) }),
|
|
636
|
-
...UndefinedOr.match(local.axis, { onUndefined: () => ({}), onDefined: (axis) => ({ axis }) }),
|
|
637
|
-
...UndefinedOr.match(local.keyboard, { onUndefined: () => ({}), onDefined: (keyboard) => ({ keyboard }) }),
|
|
638
|
-
...UndefinedOr.match(local.announcements, { onUndefined: () => ({}), onDefined: (announcements) => ({ announcements }) }),
|
|
639
|
-
...UndefinedOr.match(local.instructions, { onUndefined: () => ({}), onDefined: (instructions) => ({ instructions }) }),
|
|
640
|
-
}))
|
|
641
|
-
const Tag = wardicTag(UndefinedOr.match(untrack(() => local.as), { onUndefined: () => "ul", onDefined: identity }))
|
|
642
|
-
const userRef = local.ref
|
|
643
|
-
const spread = group({
|
|
644
|
-
...UndefinedOr.match(userRef, { onUndefined: () => ({}), onDefined: (ref) => ({ ref }) }),
|
|
645
|
-
get style() {
|
|
646
|
-
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
|
|
647
775
|
},
|
|
648
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
|
+
})
|
|
649
784
|
return (
|
|
650
|
-
<GroupContext
|
|
651
|
-
<Tag {...rest} {
|
|
785
|
+
<GroupContext value={list as ReorderGroup<unknown>}>
|
|
786
|
+
<Tag {...rest} style={styleOf()} ref={refsOf(local, [list])}>
|
|
652
787
|
{local.children}
|
|
653
788
|
</Tag>
|
|
654
|
-
</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
|
+
),
|
|
655
819
|
)
|
|
820
|
+
return { row, keys, setup }
|
|
656
821
|
}
|
|
657
822
|
|
|
658
823
|
/**
|
|
659
|
-
* An item of the `Reorder.Group` around it, rendered as `as`, `"li"` by default
|
|
660
|
-
* 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.
|
|
661
826
|
*
|
|
662
827
|
* @see https://wardic.dev/reference/solid/reorder/reorder
|
|
663
828
|
*/
|
|
664
|
-
// ADR-0020: a `
|
|
665
|
-
function Item<V, Tag extends ReorderElementTag = "li">(props:
|
|
666
|
-
const
|
|
667
|
-
if (Predicate.
|
|
668
|
-
|
|
669
|
-
// omits them), so none reaches the DOM.
|
|
670
|
-
const [local, motion, rest] = splitProps(
|
|
671
|
-
props as unknown as ItemLocal<V> & WardicMotionProps & Record<string, unknown>,
|
|
672
|
-
["value", "as", "ref", "style", "children", "tabIndex", "aria-describedby"],
|
|
673
|
-
MOTION_PROPS,
|
|
674
|
-
)
|
|
675
|
-
const config = configOfMotion(motion as WardicMotionProps)
|
|
676
|
-
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
|
|
677
834
|
const tag = UndefinedOr.match(untrack(() => local.as), { onUndefined: () => "li", onDefined: identity })
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
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
|
+
}
|
|
686
857
|
},
|
|
687
|
-
|
|
688
|
-
|
|
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
|
+
}
|
|
689
869
|
},
|
|
690
870
|
})
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
// them (#50), as every Wardic element does; any other renders none.
|
|
698
|
-
return Bool.match(VariantTree.changesContext(untrack(config)), {
|
|
699
|
-
onFalse: element,
|
|
700
|
-
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>,
|
|
701
877
|
})
|
|
702
878
|
}
|
|
703
879
|
|