@wardic/solid 1.0.0 → 1.1.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 +5 -2
- package/dist/browser/appear.js +42 -3
- package/dist/browser/appear.js.map +1 -1
- package/dist/browser/batch-handoff.js +2 -17
- package/dist/browser/batch-handoff.js.map +1 -1
- package/dist/browser/batch-reorder-group.js +40 -11
- package/dist/browser/batch-reorder-group.js.map +1 -1
- package/dist/browser/batch-reorder-places.js +517 -50
- package/dist/browser/batch-reorder-places.js.map +1 -1
- package/dist/browser/batch-reorder.js +284 -42
- package/dist/browser/batch-reorder.js.map +1 -1
- package/dist/browser/batch.js +4 -4
- package/dist/browser/batch.js.map +1 -1
- package/dist/browser/create-ward.js +28 -10
- package/dist/browser/create-ward.js.map +1 -1
- package/dist/browser/create-wardic.js +44 -0
- package/dist/browser/create-wardic.js.map +1 -0
- package/dist/browser/element.js +12 -3
- package/dist/browser/element.js.map +1 -1
- package/dist/browser/feature.js +57 -22
- package/dist/browser/feature.js.map +1 -1
- package/dist/browser/features/all.js +8 -0
- package/dist/browser/features/all.js.map +1 -1
- package/dist/browser/features/colors.js.map +1 -1
- package/dist/browser/features/dom-animation.js +8 -0
- package/dist/browser/features/dom-animation.js.map +1 -1
- package/dist/browser/features/dom-max.js +6 -0
- package/dist/browser/features/dom-max.js.map +1 -1
- package/dist/browser/features/drag.js.map +1 -1
- package/dist/browser/features/focus.js.map +1 -1
- package/dist/browser/features/hover.js.map +1 -1
- package/dist/browser/features/in-view.js.map +1 -1
- package/dist/browser/features/keys.js +6 -0
- package/dist/browser/features/keys.js.map +1 -1
- package/dist/browser/features/layout.js +14 -3
- package/dist/browser/features/layout.js.map +1 -1
- package/dist/browser/features/pan.js.map +1 -1
- package/dist/browser/features/press.js.map +1 -1
- package/dist/browser/features/scroll.js +10 -3
- package/dist/browser/features/scroll.js.map +1 -1
- package/dist/browser/features/timeline-keys.js +100 -0
- package/dist/browser/features/timeline-keys.js.map +1 -0
- package/dist/browser/imperative.js +182 -4
- package/dist/browser/imperative.js.map +1 -1
- package/dist/browser/index.js +2 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/instance-features.js +66 -0
- package/dist/browser/instance-features.js.map +1 -0
- package/dist/browser/layout-member.js +0 -2
- package/dist/browser/layout-member.js.map +1 -1
- package/dist/browser/layout-projection.js +8 -1
- package/dist/browser/layout-projection.js.map +1 -1
- package/dist/browser/layout.js +5 -6
- package/dist/browser/layout.js.map +1 -1
- package/dist/browser/live-scroll.js +29 -21
- package/dist/browser/live-scroll.js.map +1 -1
- package/dist/browser/live-style.js +10 -0
- package/dist/browser/live-style.js.map +1 -1
- package/dist/browser/live-value.js +11 -2
- package/dist/browser/live-value.js.map +1 -1
- package/dist/browser/member-hold.js +37 -7
- package/dist/browser/member-hold.js.map +1 -1
- package/dist/browser/messages.js +20 -0
- package/dist/browser/messages.js.map +1 -0
- package/dist/browser/presence-controller.js +136 -44
- package/dist/browser/presence-controller.js.map +1 -1
- package/dist/browser/presence-record.js.map +1 -1
- package/dist/browser/presence.js.map +1 -1
- package/dist/browser/provider.js +57 -11
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/reorder.js.map +1 -1
- package/dist/browser/runtime.js +15 -9
- package/dist/browser/runtime.js.map +1 -1
- package/dist/browser/scroll-values.js +46 -0
- package/dist/browser/scroll-values.js.map +1 -0
- package/dist/browser/spans-check.js +25 -0
- package/dist/browser/spans-check.js.map +1 -0
- package/dist/browser/spine.js +149 -207
- package/dist/browser/spine.js.map +1 -1
- package/dist/browser/timelines.js +9 -0
- package/dist/browser/timelines.js.map +1 -0
- package/dist/browser/unstable/v2/batch-reorder-group.js +36 -6
- package/dist/browser/unstable/v2/batch-reorder-group.js.map +1 -1
- package/dist/browser/unstable/v2/create-wardic.js +45 -0
- package/dist/browser/unstable/v2/create-wardic.js.map +1 -0
- package/dist/browser/unstable/v2/element.js +12 -2
- package/dist/browser/unstable/v2/element.js.map +1 -1
- package/dist/browser/unstable/v2/index.js +1 -0
- package/dist/browser/unstable/v2/index.js.map +1 -1
- package/dist/browser/unstable/v2/lifecycle.js +2 -0
- package/dist/browser/unstable/v2/lifecycle.js.map +1 -1
- package/dist/browser/unstable/v2/live-scroll.js +22 -13
- package/dist/browser/unstable/v2/live-scroll.js.map +1 -1
- package/dist/browser/unstable/v2/live-value.js +9 -1
- package/dist/browser/unstable/v2/live-value.js.map +1 -1
- package/dist/browser/unstable/v2/presence.js.map +1 -1
- package/dist/browser/unstable/v2/provider.js +60 -13
- package/dist/browser/unstable/v2/provider.js.map +1 -1
- package/dist/browser/unstable/v2/reorder.js.map +1 -1
- package/dist/browser/unstable/v2/w.js +7 -8
- package/dist/browser/unstable/v2/w.js.map +1 -1
- package/dist/browser/unstable/v2/ward.js +27 -9
- package/dist/browser/unstable/v2/ward.js.map +1 -1
- package/dist/browser/unstable/v2/wardic-instance.js +2 -0
- package/dist/browser/unstable/v2/wardic-instance.js.map +1 -0
- package/dist/browser/w.js +8 -9
- package/dist/browser/w.js.map +1 -1
- package/dist/browser/wardic-instance.js +2 -0
- package/dist/browser/wardic-instance.js.map +1 -0
- package/dist/server/appear.js +42 -3
- package/dist/server/appear.js.map +1 -1
- package/dist/server/batch-handoff.js +2 -17
- package/dist/server/batch-handoff.js.map +1 -1
- package/dist/server/batch-reorder-group.js +40 -11
- package/dist/server/batch-reorder-group.js.map +1 -1
- package/dist/server/batch-reorder-places.js +517 -50
- package/dist/server/batch-reorder-places.js.map +1 -1
- package/dist/server/batch-reorder.js +284 -42
- package/dist/server/batch-reorder.js.map +1 -1
- package/dist/server/batch.js +4 -4
- package/dist/server/batch.js.map +1 -1
- package/dist/server/create-ward.js +28 -10
- package/dist/server/create-ward.js.map +1 -1
- package/dist/server/create-wardic.js +44 -0
- package/dist/server/create-wardic.js.map +1 -0
- package/dist/server/element.js +12 -3
- package/dist/server/element.js.map +1 -1
- package/dist/server/feature.js +57 -22
- package/dist/server/feature.js.map +1 -1
- package/dist/server/features/all.js +8 -0
- package/dist/server/features/all.js.map +1 -1
- package/dist/server/features/colors.js.map +1 -1
- package/dist/server/features/dom-animation.js +8 -0
- package/dist/server/features/dom-animation.js.map +1 -1
- package/dist/server/features/dom-max.js +6 -0
- package/dist/server/features/dom-max.js.map +1 -1
- package/dist/server/features/drag.js.map +1 -1
- package/dist/server/features/focus.js.map +1 -1
- package/dist/server/features/hover.js.map +1 -1
- package/dist/server/features/in-view.js.map +1 -1
- package/dist/server/features/keys.js +6 -0
- package/dist/server/features/keys.js.map +1 -1
- package/dist/server/features/layout.js +14 -3
- package/dist/server/features/layout.js.map +1 -1
- package/dist/server/features/pan.js.map +1 -1
- package/dist/server/features/press.js.map +1 -1
- package/dist/server/features/scroll.js +10 -3
- package/dist/server/features/scroll.js.map +1 -1
- package/dist/server/features/timeline-keys.js +100 -0
- package/dist/server/features/timeline-keys.js.map +1 -0
- package/dist/server/imperative.js +182 -4
- package/dist/server/imperative.js.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/instance-features.js +66 -0
- package/dist/server/instance-features.js.map +1 -0
- package/dist/server/layout-member.js +0 -2
- package/dist/server/layout-member.js.map +1 -1
- package/dist/server/layout-projection.js +8 -1
- package/dist/server/layout-projection.js.map +1 -1
- package/dist/server/layout.js +5 -6
- package/dist/server/layout.js.map +1 -1
- package/dist/server/live-scroll.js +29 -21
- package/dist/server/live-scroll.js.map +1 -1
- package/dist/server/live-style.js +10 -0
- package/dist/server/live-style.js.map +1 -1
- package/dist/server/live-value.js +11 -2
- package/dist/server/live-value.js.map +1 -1
- package/dist/server/member-hold.js +37 -7
- package/dist/server/member-hold.js.map +1 -1
- package/dist/server/messages.js +20 -0
- package/dist/server/messages.js.map +1 -0
- package/dist/server/presence-controller.js +136 -44
- package/dist/server/presence-controller.js.map +1 -1
- package/dist/server/presence-record.js.map +1 -1
- package/dist/server/presence.js.map +1 -1
- package/dist/server/provider.js +57 -11
- package/dist/server/provider.js.map +1 -1
- package/dist/server/reorder.js.map +1 -1
- package/dist/server/runtime.js +15 -9
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/scroll-values.js +46 -0
- package/dist/server/scroll-values.js.map +1 -0
- package/dist/server/spans-check.js +25 -0
- package/dist/server/spans-check.js.map +1 -0
- package/dist/server/spine.js +149 -207
- package/dist/server/spine.js.map +1 -1
- package/dist/server/timelines.js +9 -0
- package/dist/server/timelines.js.map +1 -0
- package/dist/server/unstable/v2/batch-reorder-group.js +36 -6
- package/dist/server/unstable/v2/batch-reorder-group.js.map +1 -1
- package/dist/server/unstable/v2/create-wardic.js +45 -0
- package/dist/server/unstable/v2/create-wardic.js.map +1 -0
- package/dist/server/unstable/v2/element.js +12 -2
- package/dist/server/unstable/v2/element.js.map +1 -1
- package/dist/server/unstable/v2/index.js +1 -0
- package/dist/server/unstable/v2/index.js.map +1 -1
- package/dist/server/unstable/v2/lifecycle.js +2 -0
- package/dist/server/unstable/v2/lifecycle.js.map +1 -1
- package/dist/server/unstable/v2/live-scroll.js +22 -13
- package/dist/server/unstable/v2/live-scroll.js.map +1 -1
- package/dist/server/unstable/v2/live-value.js +9 -1
- package/dist/server/unstable/v2/live-value.js.map +1 -1
- package/dist/server/unstable/v2/presence.js.map +1 -1
- package/dist/server/unstable/v2/provider.js +60 -13
- package/dist/server/unstable/v2/provider.js.map +1 -1
- package/dist/server/unstable/v2/reorder.js.map +1 -1
- package/dist/server/unstable/v2/w.js +7 -8
- package/dist/server/unstable/v2/w.js.map +1 -1
- package/dist/server/unstable/v2/ward.js +27 -9
- package/dist/server/unstable/v2/ward.js.map +1 -1
- package/dist/server/unstable/v2/wardic-instance.js +2 -0
- package/dist/server/unstable/v2/wardic-instance.js.map +1 -0
- package/dist/server/w.js +8 -9
- package/dist/server/w.js.map +1 -1
- package/dist/server/wardic-instance.js +2 -0
- package/dist/server/wardic-instance.js.map +1 -0
- package/dist/solid/appear.d.ts +15 -2
- package/dist/solid/appear.d.ts.map +1 -1
- package/dist/solid/appear.js +43 -2
- package/dist/solid/appear.js.map +1 -1
- package/dist/solid/batch-handoff.d.ts.map +1 -1
- package/dist/solid/batch-handoff.js +2 -15
- package/dist/solid/batch-handoff.js.map +1 -1
- package/dist/solid/batch-reorder-group.d.ts +17 -15
- package/dist/solid/batch-reorder-group.d.ts.map +1 -1
- package/dist/solid/batch-reorder-group.jsx +37 -7
- package/dist/solid/batch-reorder-group.jsx.map +1 -1
- package/dist/solid/batch-reorder-places.d.ts +184 -23
- package/dist/solid/batch-reorder-places.d.ts.map +1 -1
- package/dist/solid/batch-reorder-places.js +397 -41
- package/dist/solid/batch-reorder-places.js.map +1 -1
- package/dist/solid/batch-reorder.d.ts +30 -1
- package/dist/solid/batch-reorder.d.ts.map +1 -1
- package/dist/solid/batch-reorder.js +298 -37
- package/dist/solid/batch-reorder.js.map +1 -1
- package/dist/solid/batch.d.ts.map +1 -1
- package/dist/solid/batch.js +4 -4
- package/dist/solid/batch.js.map +1 -1
- package/dist/solid/config.d.ts +141 -103
- package/dist/solid/config.d.ts.map +1 -1
- package/dist/solid/create-ward.d.ts +3 -1
- package/dist/solid/create-ward.d.ts.map +1 -1
- package/dist/solid/create-ward.jsx +29 -9
- package/dist/solid/create-ward.jsx.map +1 -1
- package/dist/solid/create-wardic.d.ts +24 -0
- package/dist/solid/create-wardic.d.ts.map +1 -0
- package/dist/solid/create-wardic.jsx +42 -0
- package/dist/solid/create-wardic.jsx.map +1 -0
- package/dist/solid/element.d.ts +26 -8
- package/dist/solid/element.d.ts.map +1 -1
- package/dist/solid/element.jsx +13 -5
- package/dist/solid/element.jsx.map +1 -1
- package/dist/solid/feature.d.ts +91 -3
- package/dist/solid/feature.d.ts.map +1 -1
- package/dist/solid/feature.js +48 -19
- package/dist/solid/feature.js.map +1 -1
- package/dist/solid/features/all.d.ts +9 -2
- package/dist/solid/features/all.d.ts.map +1 -1
- package/dist/solid/features/all.js +18 -1
- package/dist/solid/features/all.js.map +1 -1
- package/dist/solid/features/colors.d.ts +1 -1
- package/dist/solid/features/colors.d.ts.map +1 -1
- package/dist/solid/features/colors.js.map +1 -1
- package/dist/solid/features/dom-animation.d.ts +5 -2
- package/dist/solid/features/dom-animation.d.ts.map +1 -1
- package/dist/solid/features/dom-animation.js +8 -0
- package/dist/solid/features/dom-animation.js.map +1 -1
- package/dist/solid/features/dom-max.d.ts +2 -2
- package/dist/solid/features/dom-max.d.ts.map +1 -1
- package/dist/solid/features/dom-max.js +6 -0
- package/dist/solid/features/dom-max.js.map +1 -1
- package/dist/solid/features/drag.d.ts +1 -1
- package/dist/solid/features/drag.d.ts.map +1 -1
- package/dist/solid/features/drag.js.map +1 -1
- package/dist/solid/features/focus.d.ts +1 -1
- package/dist/solid/features/focus.d.ts.map +1 -1
- package/dist/solid/features/focus.js.map +1 -1
- package/dist/solid/features/hover.d.ts +1 -1
- package/dist/solid/features/hover.d.ts.map +1 -1
- package/dist/solid/features/hover.js.map +1 -1
- package/dist/solid/features/in-view.d.ts +1 -1
- package/dist/solid/features/in-view.d.ts.map +1 -1
- package/dist/solid/features/in-view.js.map +1 -1
- package/dist/solid/features/keys.d.ts +16 -1
- package/dist/solid/features/keys.d.ts.map +1 -1
- package/dist/solid/features/keys.js +7 -0
- package/dist/solid/features/keys.js.map +1 -1
- package/dist/solid/features/layout.d.ts +7 -1
- package/dist/solid/features/layout.d.ts.map +1 -1
- package/dist/solid/features/layout.js +14 -4
- package/dist/solid/features/layout.js.map +1 -1
- package/dist/solid/features/pan.d.ts +1 -1
- package/dist/solid/features/pan.d.ts.map +1 -1
- package/dist/solid/features/pan.js.map +1 -1
- package/dist/solid/features/press.d.ts +1 -1
- package/dist/solid/features/press.d.ts.map +1 -1
- package/dist/solid/features/press.js.map +1 -1
- package/dist/solid/features/scroll.d.ts +5 -3
- package/dist/solid/features/scroll.d.ts.map +1 -1
- package/dist/solid/features/scroll.js +12 -3
- package/dist/solid/features/scroll.js.map +1 -1
- package/dist/solid/features/timeline-keys.d.ts +7 -0
- package/dist/solid/features/timeline-keys.d.ts.map +1 -0
- package/dist/solid/features/timeline-keys.js +97 -0
- package/dist/solid/features/timeline-keys.js.map +1 -0
- package/dist/solid/imperative.d.ts +3 -3
- package/dist/solid/imperative.d.ts.map +1 -1
- package/dist/solid/imperative.js +146 -4
- package/dist/solid/imperative.js.map +1 -1
- package/dist/solid/index.d.ts +4 -2
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.jsx +2 -1
- package/dist/solid/index.jsx.map +1 -1
- package/dist/solid/instance-features.d.ts +7 -0
- package/dist/solid/instance-features.d.ts.map +1 -0
- package/dist/solid/instance-features.js +63 -0
- package/dist/solid/instance-features.js.map +1 -0
- package/dist/solid/layout-member.d.ts +0 -2
- package/dist/solid/layout-member.d.ts.map +1 -1
- package/dist/solid/layout-member.js +0 -2
- package/dist/solid/layout-member.js.map +1 -1
- package/dist/solid/layout-projection.d.ts +6 -0
- package/dist/solid/layout-projection.d.ts.map +1 -1
- package/dist/solid/layout-projection.jsx +8 -1
- package/dist/solid/layout-projection.jsx.map +1 -1
- package/dist/solid/layout.d.ts +4 -3
- package/dist/solid/layout.d.ts.map +1 -1
- package/dist/solid/layout.jsx +5 -6
- package/dist/solid/layout.jsx.map +1 -1
- package/dist/solid/live-scroll.d.ts +4 -0
- package/dist/solid/live-scroll.d.ts.map +1 -1
- package/dist/solid/live-scroll.jsx +29 -19
- package/dist/solid/live-scroll.jsx.map +1 -1
- package/dist/solid/live-style.d.ts +11 -0
- package/dist/solid/live-style.d.ts.map +1 -1
- package/dist/solid/live-style.js +10 -0
- package/dist/solid/live-style.js.map +1 -1
- package/dist/solid/live-value.d.ts +1 -0
- package/dist/solid/live-value.d.ts.map +1 -1
- package/dist/solid/live-value.jsx +12 -3
- package/dist/solid/live-value.jsx.map +1 -1
- package/dist/solid/member-hold.d.ts +5 -19
- package/dist/solid/member-hold.d.ts.map +1 -1
- package/dist/solid/member-hold.js +42 -7
- package/dist/solid/member-hold.js.map +1 -1
- package/dist/solid/messages.d.ts +20 -0
- package/dist/solid/messages.d.ts.map +1 -0
- package/dist/solid/messages.js +22 -0
- package/dist/solid/messages.js.map +1 -0
- package/dist/solid/presence-controller.d.ts +1 -1
- package/dist/solid/presence-controller.d.ts.map +1 -1
- package/dist/solid/presence-controller.js +125 -34
- package/dist/solid/presence-controller.js.map +1 -1
- package/dist/solid/presence-record.d.ts +3 -3
- package/dist/solid/presence-record.d.ts.map +1 -1
- package/dist/solid/presence-record.js.map +1 -1
- package/dist/solid/presence.d.ts +3 -1
- package/dist/solid/presence.d.ts.map +1 -1
- package/dist/solid/presence.jsx.map +1 -1
- package/dist/solid/provider.d.ts +17 -3
- package/dist/solid/provider.d.ts.map +1 -1
- package/dist/solid/provider.jsx +55 -7
- package/dist/solid/provider.jsx.map +1 -1
- package/dist/solid/reorder.d.ts +5 -4
- package/dist/solid/reorder.d.ts.map +1 -1
- package/dist/solid/reorder.jsx.map +1 -1
- package/dist/solid/runtime.d.ts +10 -2
- package/dist/solid/runtime.d.ts.map +1 -1
- package/dist/solid/runtime.js +15 -9
- package/dist/solid/runtime.js.map +1 -1
- package/dist/solid/scroll-values.d.ts +30 -0
- package/dist/solid/scroll-values.d.ts.map +1 -0
- package/dist/solid/scroll-values.js +44 -0
- package/dist/solid/scroll-values.js.map +1 -0
- package/dist/solid/spans-check.d.ts +4 -0
- package/dist/solid/spans-check.d.ts.map +1 -0
- package/dist/solid/spans-check.js +23 -0
- package/dist/solid/spans-check.js.map +1 -0
- package/dist/solid/spine.d.ts +144 -13
- package/dist/solid/spine.d.ts.map +1 -1
- package/dist/solid/spine.js +131 -183
- package/dist/solid/spine.js.map +1 -1
- package/dist/solid/timelines.d.ts +44 -0
- package/dist/solid/timelines.d.ts.map +1 -0
- package/dist/solid/timelines.js +10 -0
- package/dist/solid/timelines.js.map +1 -0
- package/dist/solid/unstable/v2/batch-reorder-group.d.ts +18 -17
- package/dist/solid/unstable/v2/batch-reorder-group.d.ts.map +1 -1
- package/dist/solid/unstable/v2/batch-reorder-group.jsx +32 -5
- package/dist/solid/unstable/v2/batch-reorder-group.jsx.map +1 -1
- package/dist/solid/unstable/v2/create-wardic.d.ts +25 -0
- package/dist/solid/unstable/v2/create-wardic.d.ts.map +1 -0
- package/dist/solid/unstable/v2/create-wardic.jsx +43 -0
- package/dist/solid/unstable/v2/create-wardic.jsx.map +1 -0
- package/dist/solid/unstable/v2/element.d.ts +52 -18
- package/dist/solid/unstable/v2/element.d.ts.map +1 -1
- package/dist/solid/unstable/v2/element.jsx +13 -4
- package/dist/solid/unstable/v2/element.jsx.map +1 -1
- package/dist/solid/unstable/v2/index.d.ts +3 -1
- package/dist/solid/unstable/v2/index.d.ts.map +1 -1
- package/dist/solid/unstable/v2/index.jsx +1 -0
- package/dist/solid/unstable/v2/index.jsx.map +1 -1
- package/dist/solid/unstable/v2/lifecycle.d.ts +29 -0
- package/dist/solid/unstable/v2/lifecycle.d.ts.map +1 -1
- package/dist/solid/unstable/v2/lifecycle.js +2 -0
- package/dist/solid/unstable/v2/lifecycle.js.map +1 -1
- package/dist/solid/unstable/v2/live-scroll.d.ts +4 -0
- package/dist/solid/unstable/v2/live-scroll.d.ts.map +1 -1
- package/dist/solid/unstable/v2/live-scroll.jsx +22 -11
- package/dist/solid/unstable/v2/live-scroll.jsx.map +1 -1
- package/dist/solid/unstable/v2/live-value.d.ts +1 -0
- package/dist/solid/unstable/v2/live-value.d.ts.map +1 -1
- package/dist/solid/unstable/v2/live-value.jsx +10 -1
- package/dist/solid/unstable/v2/live-value.jsx.map +1 -1
- package/dist/solid/unstable/v2/presence.d.ts +3 -1
- package/dist/solid/unstable/v2/presence.d.ts.map +1 -1
- package/dist/solid/unstable/v2/presence.jsx.map +1 -1
- package/dist/solid/unstable/v2/provider.d.ts +17 -3
- package/dist/solid/unstable/v2/provider.d.ts.map +1 -1
- package/dist/solid/unstable/v2/provider.jsx +58 -10
- package/dist/solid/unstable/v2/provider.jsx.map +1 -1
- package/dist/solid/unstable/v2/reorder.d.ts +4 -3
- package/dist/solid/unstable/v2/reorder.d.ts.map +1 -1
- package/dist/solid/unstable/v2/reorder.jsx.map +1 -1
- package/dist/solid/unstable/v2/w.d.ts +41 -10
- package/dist/solid/unstable/v2/w.d.ts.map +1 -1
- package/dist/solid/unstable/v2/w.jsx +5 -7
- package/dist/solid/unstable/v2/w.jsx.map +1 -1
- package/dist/solid/unstable/v2/ward.d.ts +15 -8
- package/dist/solid/unstable/v2/ward.d.ts.map +1 -1
- package/dist/solid/unstable/v2/ward.jsx +28 -8
- package/dist/solid/unstable/v2/ward.jsx.map +1 -1
- package/dist/solid/unstable/v2/wardic-instance.d.ts +47 -0
- package/dist/solid/unstable/v2/wardic-instance.d.ts.map +1 -0
- package/dist/solid/unstable/v2/wardic-instance.js +2 -0
- package/dist/solid/unstable/v2/wardic-instance.js.map +1 -0
- package/dist/solid/w.d.ts +24 -10
- package/dist/solid/w.d.ts.map +1 -1
- package/dist/solid/w.jsx +8 -7
- package/dist/solid/w.jsx.map +1 -1
- package/dist/solid/ward-keys.d.ts +22 -3
- package/dist/solid/ward-keys.d.ts.map +1 -1
- package/dist/solid/wardic-instance.d.ts +46 -0
- package/dist/solid/wardic-instance.d.ts.map +1 -0
- package/dist/solid/wardic-instance.js +2 -0
- package/dist/solid/wardic-instance.js.map +1 -0
- package/package.json +4 -4
- package/src/appear.ts +56 -2
- package/src/batch-handoff.ts +2 -16
- package/src/batch-reorder-group.tsx +47 -21
- package/src/batch-reorder-places.ts +566 -54
- package/src/batch-reorder.ts +333 -40
- package/src/batch.ts +4 -4
- package/src/config.ts +177 -123
- package/src/create-ward.tsx +32 -8
- package/src/create-wardic.tsx +45 -0
- package/src/element.tsx +52 -16
- package/src/feature.ts +157 -25
- package/src/features/all.ts +11 -2
- package/src/features/colors.ts +1 -1
- package/src/features/dom-animation.ts +2 -2
- package/src/features/dom-max.ts +1 -2
- package/src/features/drag.ts +1 -1
- package/src/features/focus.ts +1 -1
- package/src/features/hover.ts +1 -1
- package/src/features/in-view.ts +1 -1
- package/src/features/keys.ts +18 -1
- package/src/features/layout.ts +17 -5
- package/src/features/pan.ts +1 -1
- package/src/features/press.ts +1 -1
- package/src/features/scroll.ts +14 -4
- package/src/features/timeline-keys.ts +109 -0
- package/src/imperative.ts +168 -10
- package/src/index.tsx +6 -1
- package/src/instance-features.ts +88 -0
- package/src/layout-member.ts +0 -4
- package/src/layout-projection.tsx +10 -1
- package/src/layout.tsx +7 -6
- package/src/live-scroll.tsx +30 -22
- package/src/live-style.ts +21 -0
- package/src/live-value.tsx +12 -2
- package/src/member-hold.ts +45 -26
- package/src/messages.ts +27 -0
- package/src/presence-controller.ts +222 -106
- package/src/presence-record.ts +3 -3
- package/src/presence.tsx +3 -1
- package/src/provider.tsx +62 -7
- package/src/reorder.tsx +5 -4
- package/src/runtime.ts +17 -10
- package/src/scroll-values.ts +53 -0
- package/src/spans-check.ts +25 -0
- package/src/spine.ts +219 -187
- package/src/timelines.ts +46 -0
- package/src/unstable/v2/batch-reorder-group.tsx +42 -18
- package/src/unstable/v2/create-wardic.tsx +46 -0
- package/src/unstable/v2/element.tsx +85 -24
- package/src/unstable/v2/index.tsx +5 -0
- package/src/unstable/v2/lifecycle.ts +35 -0
- package/src/unstable/v2/live-scroll.tsx +22 -11
- package/src/unstable/v2/live-value.tsx +10 -0
- package/src/unstable/v2/presence.tsx +3 -1
- package/src/unstable/v2/provider.tsx +65 -9
- package/src/unstable/v2/reorder.tsx +9 -4
- package/src/unstable/v2/w.tsx +49 -13
- package/src/unstable/v2/ward.tsx +48 -13
- package/src/unstable/v2/wardic-instance.ts +50 -0
- package/src/w.tsx +33 -16
- package/src/ward-keys.ts +38 -17
- package/src/wardic-instance.ts +49 -0
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
* A **Batch Reorder group**'s places (#712, ADR-0072 decisions 3 and 4), Solid-free and DOM-free but for
|
|
3
3
|
* the style strings: where each item goes, from its index, and how the group and its items are styled.
|
|
4
4
|
*
|
|
5
|
-
* - **Places**:
|
|
6
|
-
*
|
|
5
|
+
* - **Places**: `axis` picks the shape, a column (`"y"`), a row (`"x"`) or a wrapping grid (`"xy"`), `gap`
|
|
6
|
+
* apart. Every item one size: a grid's `columns`, else as many as the group's width holds (Q36). Each its
|
|
7
|
+
* own size, a function's (#714, *Amendment (#714)*): each place after the sizes before it, a grid's rows
|
|
8
|
+
* breaking where the next item doesn't fit the group's width, each item at its row's top.
|
|
9
|
+
* - **A column's items may take the group's content width** (#714, Q10), exact on the server too: `100%` in
|
|
10
|
+
* flow; placed, their padding box less the group's padding, once it's read; before, `100cqi`, the group a
|
|
11
|
+
* size container ({@link groupWidthOf}).
|
|
7
12
|
* - **The items' origin is their static position**: each item is `position: absolute` with no `top` or
|
|
8
13
|
* `left`, so it sits where it would in flow, at the start of the group's content box, its padding kept;
|
|
9
14
|
* right to left, at its right edge, the places going leftward from there (Q35).
|
|
10
15
|
* - **A grid whose width isn't read yet** (a server's, Q37; a client's until its first read) is laid out by
|
|
11
|
-
* CSS
|
|
16
|
+
* CSS, each item in flow, at the same places: CSS grid for one size, `flex-wrap` for each its own (#714, Q5).
|
|
12
17
|
*
|
|
13
18
|
* @module
|
|
14
19
|
*/
|
|
@@ -19,18 +24,76 @@ import * as Arr from "effect/Array"
|
|
|
19
24
|
import * as Bool from "effect/Boolean"
|
|
20
25
|
import * as Equivalence from "effect/Equivalence"
|
|
21
26
|
import { identity } from "effect/Function"
|
|
27
|
+
import * as Iter from "effect/Iterable"
|
|
22
28
|
import * as Match from "effect/Match"
|
|
23
29
|
import * as Predicate from "effect/Predicate"
|
|
24
30
|
import * as Rec from "effect/Record"
|
|
25
31
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
26
32
|
import { fail } from "./batch.ts"
|
|
27
33
|
|
|
28
|
-
/**
|
|
34
|
+
/** An item's size in a Batch Reorder group, in px. */
|
|
29
35
|
export interface ReorderBatchItemSize {
|
|
30
36
|
readonly width: number
|
|
31
37
|
readonly height: number
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
/**
|
|
41
|
+
* An item's size in a column (`axis="y"`), in px: its height, and its width, or, left out, the group's
|
|
42
|
+
* content width, padding and border inside it (#714, Q10).
|
|
43
|
+
*/
|
|
44
|
+
export interface ReorderBatchColumnSize {
|
|
45
|
+
readonly width?: number | undefined
|
|
46
|
+
readonly height: number
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A group's shape and its items' sizes (#714, ADR-0072 *Amendment (#714)*): one size for every item, or
|
|
51
|
+
* a function giving each item's. In a column (`"y"`, the default) a size may leave out `width`: the item
|
|
52
|
+
* takes the group's content width. `columns` goes only with one size: a function's rows break at the
|
|
53
|
+
* group's width (Q9).
|
|
54
|
+
*/
|
|
55
|
+
export type ReorderBatchSizing<V> =
|
|
56
|
+
| {
|
|
57
|
+
/** The list's shape: `"y"`, a column (the default), `"x"`, a row, or `"xy"`, a grid that wraps. */
|
|
58
|
+
readonly axis?: CoreReorder.Axis | undefined
|
|
59
|
+
/**
|
|
60
|
+
* Every item's size, in px, or a function giving each item's from it and its index, called for every
|
|
61
|
+
* item at each change of the list and tracked: what it reads places every item again. In a column,
|
|
62
|
+
* `width` left out is the group's content width.
|
|
63
|
+
*/
|
|
64
|
+
readonly itemSize: ReorderBatchItemSize
|
|
65
|
+
/** A grid's columns: how many items a row holds. Left out, as many as the group's width holds, read again as it's resized. */
|
|
66
|
+
readonly columns?: number | undefined
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
readonly axis?: "y" | undefined
|
|
70
|
+
readonly itemSize: ReorderBatchColumnSize
|
|
71
|
+
readonly columns?: number | undefined
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
readonly axis?: CoreReorder.Axis | undefined
|
|
75
|
+
readonly itemSize: (item: V, i: number) => ReorderBatchItemSize
|
|
76
|
+
/** Only with one size: a function's rows break at the group's width. */
|
|
77
|
+
readonly columns?: undefined
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
readonly axis?: "y" | undefined
|
|
81
|
+
readonly itemSize: (item: V, i: number) => ReorderBatchColumnSize
|
|
82
|
+
readonly columns?: undefined
|
|
83
|
+
}
|
|
84
|
+
| {
|
|
85
|
+
readonly axis?: CoreReorder.Axis | undefined
|
|
86
|
+
/** Left out, each item's size is read from the page: its own content's, a column's items as wide as the group. */
|
|
87
|
+
readonly itemSize?: undefined
|
|
88
|
+
readonly columns?: undefined
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A group's `itemSize` as its places read it, whatever its shape: one size, a function of each item, or
|
|
93
|
+
* none, each item's read from the page (#714).
|
|
94
|
+
*/
|
|
95
|
+
export type BatchReorderItemSizes = ReorderBatchColumnSize | ((item: never, i: number) => ReorderBatchColumnSize) | undefined
|
|
96
|
+
|
|
34
97
|
/** A point, or a length on each axis, in px. */
|
|
35
98
|
export interface XY {
|
|
36
99
|
readonly x: number
|
|
@@ -43,18 +106,38 @@ export type ReorderBatchGap = number | XY
|
|
|
43
106
|
/** A group's direction: its places from its content box's left, or, right to left, from its right. */
|
|
44
107
|
export type BatchReorderDirection = "ltr" | "rtl"
|
|
45
108
|
|
|
46
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* What the group reads of its element once it's on the page (Q35, Q36): the direction it inherits, its
|
|
111
|
+
* content box's width, and its edges.
|
|
112
|
+
*/
|
|
47
113
|
export interface BatchReorderRead {
|
|
48
114
|
readonly direction: BatchReorderDirection
|
|
49
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Its content width, read where its places come from it, a grid with no `columns`, of one size or each
|
|
117
|
+
* its own (#714); `undefined` for any other.
|
|
118
|
+
*/
|
|
50
119
|
readonly width: number | undefined
|
|
120
|
+
/**
|
|
121
|
+
* What its own `width` and `height` hold besides its content box, on each axis (#714): its padding and
|
|
122
|
+
* border when it's `border-box`, as a CSS reset makes it; none when it's `content-box`.
|
|
123
|
+
*/
|
|
124
|
+
readonly edges: XY
|
|
125
|
+
/**
|
|
126
|
+
* Its horizontal padding (#714): what an absolutely placed item's `100%`, its padding box's width, holds
|
|
127
|
+
* besides its content box's.
|
|
128
|
+
*/
|
|
129
|
+
readonly padding: number
|
|
51
130
|
}
|
|
52
131
|
|
|
53
|
-
/** Whether two reads of a group's element are alike: the same direction and
|
|
132
|
+
/** Whether two reads of a group's element are alike: the same direction, width, edges and padding. */
|
|
54
133
|
export const sameRead = (a: BatchReorderRead | undefined, b: BatchReorderRead | undefined): boolean =>
|
|
55
134
|
UndefinedOr.match(a, {
|
|
56
135
|
onUndefined: () => Predicate.isUndefined(b),
|
|
57
|
-
onDefined: (x) =>
|
|
136
|
+
onDefined: (x) =>
|
|
137
|
+
UndefinedOr.match(b, {
|
|
138
|
+
onUndefined: () => false,
|
|
139
|
+
onDefined: (y) => Bool.every([x.direction === y.direction, x.width === y.width, x.edges.x === y.edges.x, x.edges.y === y.edges.y, x.padding === y.padding]),
|
|
140
|
+
}),
|
|
58
141
|
})
|
|
59
142
|
|
|
60
143
|
/**
|
|
@@ -63,17 +146,21 @@ export const sameRead = (a: BatchReorderRead | undefined, b: BatchReorderRead |
|
|
|
63
146
|
*/
|
|
64
147
|
export interface BatchReorderGeometry {
|
|
65
148
|
readonly axis: CoreReorder.Axis
|
|
66
|
-
readonly itemSize:
|
|
149
|
+
readonly itemSize: BatchReorderItemSizes
|
|
67
150
|
readonly gap: ReorderBatchGap | undefined
|
|
68
151
|
readonly columns: number | undefined
|
|
69
152
|
readonly direction: BatchReorderDirection
|
|
70
153
|
readonly width: number | undefined
|
|
154
|
+
/** What its own size holds besides its content box (#714): none before it's read, a server's. */
|
|
155
|
+
readonly edges: XY
|
|
156
|
+
/** Its horizontal padding (#714): `undefined` before it's read, a server's. */
|
|
157
|
+
readonly padding: number | undefined
|
|
71
158
|
}
|
|
72
159
|
|
|
73
160
|
/** What a group's props give its geometry, as either binding reads them. */
|
|
74
161
|
export interface BatchReorderProps {
|
|
75
162
|
readonly axis?: CoreReorder.Axis | undefined
|
|
76
|
-
readonly itemSize
|
|
163
|
+
readonly itemSize?: BatchReorderItemSizes
|
|
77
164
|
readonly gap?: ReorderBatchGap | undefined
|
|
78
165
|
readonly columns?: number | undefined
|
|
79
166
|
readonly direction?: BatchReorderDirection | undefined
|
|
@@ -106,23 +193,67 @@ export const geometryOf = (props: BatchReorderProps, read: BatchReorderRead | un
|
|
|
106
193
|
onDefined: identity,
|
|
107
194
|
}),
|
|
108
195
|
width: UndefinedOr.match(read, { onUndefined: () => undefined, onDefined: (r) => r.width }),
|
|
196
|
+
edges: UndefinedOr.match(read, { onUndefined: () => NO_EDGES, onDefined: (r) => r.edges }),
|
|
197
|
+
padding: UndefinedOr.match(read, { onUndefined: () => undefined, onDefined: (r) => r.padding }),
|
|
109
198
|
})
|
|
110
199
|
|
|
200
|
+
/** No edges: a `content-box` group's, and a group's before its first read. */
|
|
201
|
+
const NO_EDGES: XY = { x: 0, y: 0 }
|
|
202
|
+
|
|
111
203
|
/**
|
|
112
204
|
* A group's places, resolved from its geometry once a change: how many a row holds, the step from one to
|
|
113
205
|
* the next on each axis, which way the columns go (right to left, leftward from the right edge), every
|
|
114
|
-
* item's size, and the group's width.
|
|
206
|
+
* item's size, and the group's width; or, its items each their own size, each one's place and size.
|
|
115
207
|
*/
|
|
116
208
|
export interface BatchReorderPlaces {
|
|
117
209
|
readonly columns: number
|
|
118
210
|
readonly stepX: number
|
|
119
211
|
readonly stepY: number
|
|
120
212
|
readonly signX: number
|
|
213
|
+
/** Every item's size; `NO_SIZE` when each is its own (`each`). */
|
|
121
214
|
readonly itemSize: ReorderBatchItemSize
|
|
122
|
-
/** The group's width: its places', or, its
|
|
215
|
+
/** The group's width: its places', or, its width the app's, what it read of it (0 before). */
|
|
123
216
|
readonly width: number
|
|
124
|
-
/** Whether its columns
|
|
125
|
-
readonly
|
|
217
|
+
/** Whether its width is the app's (its columns or its rows from its width, Q36; a column of its width, #714): it sets none. */
|
|
218
|
+
readonly appsWidth: boolean
|
|
219
|
+
/** Whether any item takes the group's content width (#714, Q10): {@link groupWidthOf}'s. */
|
|
220
|
+
readonly takesWidth: boolean
|
|
221
|
+
/** Each item's place and size, its items each their own size (#714); `undefined` when they're one. */
|
|
222
|
+
readonly each: ItemPlaces | undefined
|
|
223
|
+
/** Whether its items' sizes are read from the page (#714): never written on them. */
|
|
224
|
+
readonly sizesRead: boolean
|
|
225
|
+
/**
|
|
226
|
+
* Whether its items are laid out in flow by CSS, each at no place: a grid whose rows break at a width it
|
|
227
|
+
* hasn't read (Q37), or items whose sizes it hasn't read yet (#714, decision 4).
|
|
228
|
+
*/
|
|
229
|
+
readonly inFlow: boolean
|
|
230
|
+
/** The width an item that takes the group's content width is given ({@link groupWidthOf}). */
|
|
231
|
+
readonly groupWidth: string
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* What a group has read of its items' sizes, their sizes left out of `itemSize` (#714): each one's, by its
|
|
236
|
+
* value, and whether its first came in. Until then its items are in flow.
|
|
237
|
+
*/
|
|
238
|
+
export interface SizesRead {
|
|
239
|
+
/** An item's border box, as last read; `undefined` until it's read. */
|
|
240
|
+
readonly sizeOf: (item: unknown) => ReorderBatchItemSize | undefined
|
|
241
|
+
readonly arrived: boolean
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** No sizes read: a server's, and a client's before its first. */
|
|
245
|
+
export const NONE_READ: SizesRead = { sizeOf: () => undefined, arrived: false }
|
|
246
|
+
|
|
247
|
+
/** Each item's place, from the start of the group's content box, and its size, in the list's order (#714). */
|
|
248
|
+
export interface ItemPlaces {
|
|
249
|
+
readonly xs: Float64Array
|
|
250
|
+
readonly ys: Float64Array
|
|
251
|
+
/** Each one's width: `NaN` for one that takes the group's content width (Q10). */
|
|
252
|
+
readonly widths: Float64Array
|
|
253
|
+
readonly heights: Float64Array
|
|
254
|
+
/** The group's size: its places' far edges. */
|
|
255
|
+
readonly width: number
|
|
256
|
+
readonly height: number
|
|
126
257
|
}
|
|
127
258
|
|
|
128
259
|
const ORIGIN: XY = { x: 0, y: 0 }
|
|
@@ -134,6 +265,12 @@ const gapsOf: (gap: ReorderBatchGap) => XY = Match.type<ReorderBatchGap>().pipe(
|
|
|
134
265
|
Match.orElse((gap) => gap as XY),
|
|
135
266
|
)
|
|
136
267
|
|
|
268
|
+
/** A geometry's gap on each axis: none when it gives none. */
|
|
269
|
+
const gapOf = (geometry: BatchReorderGeometry): XY => UndefinedOr.match(geometry.gap, { onUndefined: () => ORIGIN, onDefined: gapsOf })
|
|
270
|
+
|
|
271
|
+
/** The content width a group read of its element: 0 before it's read (a server's, a client's before its first read). */
|
|
272
|
+
const readWidthOf = (geometry: BatchReorderGeometry): number => UndefinedOr.match(geometry.width, { onUndefined: () => 0, onDefined: identity })
|
|
273
|
+
|
|
137
274
|
/** Whether a grid's `columns` is a whole number, 1 or more. */
|
|
138
275
|
const isColumnCount = (columns: number): boolean => Bool.and(Number.isInteger(columns), columns >= 1)
|
|
139
276
|
|
|
@@ -157,81 +294,368 @@ const columnsBy: (axis: CoreReorder.Axis) => (geometry: BatchReorderGeometry, n:
|
|
|
157
294
|
),
|
|
158
295
|
)
|
|
159
296
|
|
|
160
|
-
/** A grid whose
|
|
297
|
+
/** A grid whose rows break at its width: `"xy"` with no `columns`, its items one size (Q36) or each their own (#714). */
|
|
161
298
|
export const isFromWidth = (geometry: BatchReorderGeometry): boolean => Bool.and(geometry.axis === "xy", Predicate.isUndefined(geometry.columns))
|
|
162
299
|
|
|
163
|
-
/** Whether a group's items are laid out in flow by CSS
|
|
300
|
+
/** Whether a group's items are laid out in flow by CSS: its rows from a width it hasn't read. */
|
|
164
301
|
export const inGridFlow = (geometry: BatchReorderGeometry): boolean => Bool.and(isFromWidth(geometry), Predicate.isUndefined(geometry.width))
|
|
165
302
|
|
|
303
|
+
/** Whether a group reads its items' sizes from the page: its `itemSize` left out (#714). */
|
|
304
|
+
export const readsSizes = (geometry: BatchReorderGeometry): boolean => Predicate.isUndefined(geometry.itemSize)
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Whether a group's items are in flow, its first sizes `arrived` or not: a grid's width unread, or its items'
|
|
308
|
+
* sizes, read from the page (#714).
|
|
309
|
+
*/
|
|
310
|
+
export const itemsInFlow = (geometry: BatchReorderGeometry, arrived: boolean): boolean => {
|
|
311
|
+
// Per element at mount, by the hot path's rules: statements.
|
|
312
|
+
if (inGridFlow(geometry)) return true
|
|
313
|
+
return readsSizes(geometry) && !arrived
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** Whether `places` are of items each their own size given by a function (#714): those written on their elements. */
|
|
317
|
+
export const writesSizes = (places: BatchReorderPlaces): boolean => Bool.and(Predicate.isNotUndefined(places.each), Bool.not(places.sizesRead))
|
|
318
|
+
|
|
166
319
|
/** Each direction's way along a row: rightward, or leftward from the right edge. */
|
|
167
320
|
const SIGN_X: Readonly<Record<BatchReorderDirection, number>> = { ltr: 1, rtl: -1 }
|
|
168
321
|
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
322
|
+
/** A function `itemSize` as the places call it. */
|
|
323
|
+
type SizeOf = (item: unknown, i: number) => ReorderBatchColumnSize
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* `geometry`'s places for `values`: every item one size, each its own, a function's, or each its own as
|
|
327
|
+
* `read` from the page (#714). An error names a grid's `columns` that isn't a whole number.
|
|
328
|
+
*/
|
|
329
|
+
export const resolvePlaces = (geometry: BatchReorderGeometry, values: ReadonlyArray<unknown>, read: SizesRead = NONE_READ): BatchReorderPlaces => {
|
|
330
|
+
const itemSize = geometry.itemSize
|
|
331
|
+
if (Predicate.isUndefined(itemSize)) return resolveRead(geometry, values, read)
|
|
332
|
+
if (Predicate.isFunction(itemSize)) return resolveEach(geometry, values, itemSize as SizeOf)
|
|
333
|
+
return resolveOne(geometry, values.length, itemSize)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** Places for `n` items of one size, a column's width the group's when it gives none (#714, Q10): never read, 0 here. */
|
|
337
|
+
const resolveOne = (geometry: BatchReorderGeometry, n: number, size: ReorderBatchColumnSize): BatchReorderPlaces => {
|
|
338
|
+
const gap = gapOf(geometry)
|
|
339
|
+
const inFlow = inGridFlow(geometry)
|
|
340
|
+
const takesWidth = Predicate.isUndefined(size.width)
|
|
341
|
+
const itemSize: ReorderBatchItemSize = { width: UndefinedOr.match(size.width, { onUndefined: () => readWidthOf(geometry), onDefined: identity }), height: size.height }
|
|
342
|
+
const stepX = itemSize.width + gap.x
|
|
173
343
|
const columns = columnsBy(geometry.axis)(geometry, n, stepX, gap.x)
|
|
174
|
-
const
|
|
344
|
+
const appsWidth = Bool.or(isFromWidth(geometry), takesWidth)
|
|
175
345
|
const used = Math.min(columns, Math.max(n, 1))
|
|
176
|
-
const placesWidth = Bool.match(n === 0, { onTrue: () => 0, onFalse: () => (used - 1) * stepX +
|
|
346
|
+
const placesWidth = Bool.match(n === 0, { onTrue: () => 0, onFalse: () => (used - 1) * stepX + itemSize.width })
|
|
177
347
|
return {
|
|
178
348
|
columns,
|
|
179
349
|
stepX,
|
|
180
|
-
stepY:
|
|
350
|
+
stepY: itemSize.height + gap.y,
|
|
351
|
+
signX: SIGN_X[geometry.direction],
|
|
352
|
+
itemSize,
|
|
353
|
+
width: Bool.match(appsWidth, { onTrue: () => UndefinedOr.match(geometry.width, { onUndefined: () => placesWidth, onDefined: identity }), onFalse: () => placesWidth }),
|
|
354
|
+
appsWidth,
|
|
355
|
+
takesWidth,
|
|
356
|
+
each: undefined,
|
|
357
|
+
sizesRead: false,
|
|
358
|
+
inFlow,
|
|
359
|
+
groupWidth: groupWidthOf(geometry, inFlow),
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Places for `values`, each its own size, `sizeOf`'s (#714): laid out by the group's axis. */
|
|
364
|
+
const resolveEach = (geometry: BatchReorderGeometry, values: ReadonlyArray<unknown>, sizeOf: SizeOf): BatchReorderPlaces => {
|
|
365
|
+
const inFlow = inGridFlow(geometry)
|
|
366
|
+
const widths = new Float64Array(values.length)
|
|
367
|
+
const heights = new Float64Array(values.length)
|
|
368
|
+
let takesWidth = false
|
|
369
|
+
// Per item at a change: statements.
|
|
370
|
+
Arr.forEach(values, (item, i) => {
|
|
371
|
+
const size = sizeOf(item, i)
|
|
372
|
+
heights[i] = size.height
|
|
373
|
+
if (Predicate.isNotUndefined(size.width)) {
|
|
374
|
+
widths[i] = size.width
|
|
375
|
+
return
|
|
376
|
+
}
|
|
377
|
+
widths[i] = Number.NaN
|
|
378
|
+
takesWidth = true
|
|
379
|
+
})
|
|
380
|
+
const each = layoutBy(geometry.axis)(widths, heights, gapOf(geometry), geometry.width)
|
|
381
|
+
const appsWidth = Bool.or(isFromWidth(geometry), takesWidth)
|
|
382
|
+
return {
|
|
383
|
+
columns: 1,
|
|
384
|
+
stepX: 0,
|
|
385
|
+
stepY: 0,
|
|
181
386
|
signX: SIGN_X[geometry.direction],
|
|
182
|
-
itemSize:
|
|
183
|
-
width: Bool.match(
|
|
184
|
-
|
|
387
|
+
itemSize: NO_SIZE,
|
|
388
|
+
width: Bool.match(appsWidth, { onTrue: () => readWidthOf(geometry), onFalse: () => each.width }),
|
|
389
|
+
appsWidth,
|
|
390
|
+
takesWidth,
|
|
391
|
+
each,
|
|
392
|
+
sizesRead: false,
|
|
393
|
+
inFlow,
|
|
394
|
+
groupWidth: groupWidthOf(geometry, inFlow),
|
|
185
395
|
}
|
|
186
396
|
}
|
|
187
397
|
|
|
398
|
+
/** A size not read yet: none, its place from the sizes before it. A column's, its width the group's. */
|
|
399
|
+
const UNREAD: ReorderBatchColumnSize = { width: 0, height: 0 }
|
|
400
|
+
const UNREAD_IN_COLUMN: ReorderBatchColumnSize = { width: undefined, height: 0 }
|
|
401
|
+
|
|
402
|
+
/** Each item's size as read, a column's height alone: its width is the group's (Q6). */
|
|
403
|
+
const readInColumn = (read: SizesRead): SizeOf => (item) => {
|
|
404
|
+
// Per item at a change: statements.
|
|
405
|
+
const size = read.sizeOf(item)
|
|
406
|
+
if (Predicate.isUndefined(size)) return UNREAD_IN_COLUMN
|
|
407
|
+
return { width: undefined, height: size.height }
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** Each item's size as read: its width and height its own (Q6). */
|
|
411
|
+
const readOwn = (read: SizesRead): SizeOf => (item) => {
|
|
412
|
+
// Per item at a change: statements.
|
|
413
|
+
const size = read.sizeOf(item)
|
|
414
|
+
if (Predicate.isUndefined(size)) return UNREAD
|
|
415
|
+
return size
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** Each axis's reading of an item's size. Built once, at module load. */
|
|
419
|
+
const readBy: (axis: CoreReorder.Axis) => (read: SizesRead) => SizeOf = Match.type<CoreReorder.Axis>().pipe(
|
|
420
|
+
Match.when("y", () => readInColumn),
|
|
421
|
+
Match.orElse(() => readOwn),
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Places for `values`, each its own size as `read` from the page (#714): laid out as a function's sizes are.
|
|
426
|
+
* In flow, before its first sizes or a grid's width, every item at no place, where CSS has it.
|
|
427
|
+
*/
|
|
428
|
+
const resolveRead = (geometry: BatchReorderGeometry, values: ReadonlyArray<unknown>, read: SizesRead): BatchReorderPlaces => {
|
|
429
|
+
const places = resolveEach(geometry, values, readBy(geometry.axis)(read))
|
|
430
|
+
const inFlow = itemsInFlow(geometry, read.arrived)
|
|
431
|
+
// A column's items take its width, whether it has any or not (Q6).
|
|
432
|
+
const takesWidth = geometry.axis === "y"
|
|
433
|
+
const appsWidth = Bool.or(isFromWidth(geometry), takesWidth)
|
|
434
|
+
const each = UndefinedOr.getOrThrow(places.each)
|
|
435
|
+
return {
|
|
436
|
+
...places,
|
|
437
|
+
sizesRead: true,
|
|
438
|
+
inFlow,
|
|
439
|
+
groupWidth: groupWidthOf(geometry, inFlow),
|
|
440
|
+
takesWidth,
|
|
441
|
+
appsWidth,
|
|
442
|
+
width: Bool.match(appsWidth, { onTrue: () => readWidthOf(geometry), onFalse: () => each.width }),
|
|
443
|
+
each: Bool.match(inFlow, { onTrue: () => atNoPlace(each), onFalse: () => each }),
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** `each` with every item at no place: in flow, where CSS has it; the group's size its flow's. */
|
|
448
|
+
const atNoPlace = (each: ItemPlaces): ItemPlaces => ({ ...each, xs: new Float64Array(each.xs.length), ys: new Float64Array(each.ys.length), width: 0, height: 0 })
|
|
449
|
+
|
|
450
|
+
/** A layout of items each their own size: their places from their sizes, the gap and the group's content width. */
|
|
451
|
+
type EachLayout = (widths: Float64Array, heights: Float64Array, gap: XY, width: number | undefined) => ItemPlaces
|
|
452
|
+
|
|
453
|
+
/** A column: each item below the one before, a gap apart; as wide as the widest, those that take the group's width aside. */
|
|
454
|
+
const columnLayout: EachLayout = (widths, heights, gap) => {
|
|
455
|
+
const ys = new Float64Array(heights.length)
|
|
456
|
+
let y = 0
|
|
457
|
+
let width = 0
|
|
458
|
+
// Per item at a change: statements.
|
|
459
|
+
Iter.forEach(heights, (height, i) => {
|
|
460
|
+
ys[i] = y
|
|
461
|
+
y = y + height + gap.y
|
|
462
|
+
if (widths[i] > width) width = widths[i]
|
|
463
|
+
})
|
|
464
|
+
return { xs: new Float64Array(heights.length), ys, widths, heights, width, height: Math.max(0, y - gap.y) }
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** A row: each item after the one before, a gap apart, at the row's top; as tall as the tallest. */
|
|
468
|
+
const rowLayout: EachLayout = (widths, heights, gap) => {
|
|
469
|
+
const xs = new Float64Array(widths.length)
|
|
470
|
+
let x = 0
|
|
471
|
+
let height = 0
|
|
472
|
+
// Per item at a change: statements.
|
|
473
|
+
Iter.forEach(widths, (width, i) => {
|
|
474
|
+
xs[i] = x
|
|
475
|
+
x = x + width + gap.x
|
|
476
|
+
if (heights[i] > height) height = heights[i]
|
|
477
|
+
})
|
|
478
|
+
return { xs, ys: new Float64Array(widths.length), widths, heights, width: Math.max(0, x - gap.x), height }
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/** How far past the group's width an item may reach and still fit its row: a hundredth of a px, for sums that round. */
|
|
482
|
+
const FIT_SLACK = 0.01
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Rows, as CSS `flex-wrap` with `align-items: flex-start` (Q2): items left to right while they fit the
|
|
486
|
+
* group's content width, the next row below the tallest of the one before, each item at its row's top.
|
|
487
|
+
* Before the width is read, every item at no place: in flow, where `flex-wrap` has it (Q5).
|
|
488
|
+
*/
|
|
489
|
+
const rowsLayout: EachLayout = (widths, heights, gap, width) => {
|
|
490
|
+
const n = widths.length
|
|
491
|
+
const xs = new Float64Array(n)
|
|
492
|
+
const ys = new Float64Array(n)
|
|
493
|
+
if (Predicate.isUndefined(width)) return { xs, ys, widths, heights, width: 0, height: 0 }
|
|
494
|
+
let x = 0
|
|
495
|
+
let rowY = 0
|
|
496
|
+
let rowHeight = 0
|
|
497
|
+
let widest = 0
|
|
498
|
+
// Per item at a change: statements.
|
|
499
|
+
Iter.forEach(widths, (itemWidth, i) => {
|
|
500
|
+
if (x > 0 && x + itemWidth - width > FIT_SLACK) {
|
|
501
|
+
rowY = rowY + rowHeight + gap.y
|
|
502
|
+
x = 0
|
|
503
|
+
rowHeight = 0
|
|
504
|
+
}
|
|
505
|
+
xs[i] = x
|
|
506
|
+
ys[i] = rowY
|
|
507
|
+
x = x + itemWidth + gap.x
|
|
508
|
+
if (x - gap.x > widest) widest = x - gap.x
|
|
509
|
+
if (heights[i] > rowHeight) rowHeight = heights[i]
|
|
510
|
+
})
|
|
511
|
+
return { xs, ys, widths, heights, width: widest, height: rowY + rowHeight }
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/** Each axis's layout of items each their own size. Built once, at module load. */
|
|
515
|
+
const layoutBy: (axis: CoreReorder.Axis) => EachLayout = Match.type<CoreReorder.Axis>().pipe(
|
|
516
|
+
Match.when("y", () => columnLayout),
|
|
517
|
+
Match.when("x", () => rowLayout),
|
|
518
|
+
Match.orElse(() => rowsLayout),
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
/** Whether two arrays of numbers hold the same numbers in the same order. */
|
|
522
|
+
const sameNumbers = (a: Float64Array, b: Float64Array): boolean => {
|
|
523
|
+
if (a.length !== b.length) return false
|
|
524
|
+
return Bool.not(Iter.some(a, (x, i) => x !== b[i]))
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/** Whether two resolutions of items each their own size place every item alike. */
|
|
528
|
+
const sameEach = (a: ItemPlaces | undefined, b: ItemPlaces | undefined): boolean => {
|
|
529
|
+
if (Predicate.isUndefined(a)) return Predicate.isUndefined(b)
|
|
530
|
+
if (Predicate.isUndefined(b)) return false
|
|
531
|
+
if (Bool.not(sameNumbers(a.xs, b.xs))) return false
|
|
532
|
+
return sameNumbers(a.ys, b.ys)
|
|
533
|
+
}
|
|
534
|
+
|
|
188
535
|
/** Whether two resolutions place every item alike. */
|
|
189
|
-
export const samePlaces = (a: BatchReorderPlaces, b: BatchReorderPlaces): boolean =>
|
|
190
|
-
Bool.every([a.columns === b.columns, a.stepX === b.stepX, a.stepY === b.stepY, a.signX === b.signX])
|
|
536
|
+
export const samePlaces = (a: BatchReorderPlaces, b: BatchReorderPlaces): boolean => {
|
|
537
|
+
if (Bool.not(Bool.every([a.columns === b.columns, a.stepX === b.stepX, a.stepY === b.stepY, a.signX === b.signX]))) return false
|
|
538
|
+
return sameEach(a.each, b.each)
|
|
539
|
+
}
|
|
191
540
|
|
|
192
|
-
/** Item `i`'s place among `places`: its column and row, a step apart, from its static position. */
|
|
193
|
-
export const placeOf = (places: BatchReorderPlaces, i: number): XY =>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
541
|
+
/** Item `i`'s place among `places`: its column and row, a step apart, or its own (#714), from its static position. */
|
|
542
|
+
export const placeOf = (places: BatchReorderPlaces, i: number): XY => {
|
|
543
|
+
// Per item at a change: statements.
|
|
544
|
+
const each = places.each
|
|
545
|
+
if (Predicate.isNotUndefined(each)) return { x: places.signX * each.xs[i], y: each.ys[i] }
|
|
546
|
+
return { x: places.signX * (i % places.columns) * places.stepX, y: Math.floor(i / places.columns) * places.stepY }
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Item `i`'s width among `places`: one taking the group's content width has none, its width the group's by
|
|
551
|
+
* CSS and never read (#714): a column's crossover reads its places' `y` alone.
|
|
552
|
+
*/
|
|
553
|
+
export const widthAt = (places: BatchReorderPlaces, i: number): number => {
|
|
554
|
+
// Per item, per drag sample: statements.
|
|
555
|
+
const each = places.each
|
|
556
|
+
if (Predicate.isUndefined(each)) return places.itemSize.width
|
|
557
|
+
const width = each.widths[i]
|
|
558
|
+
if (Number.isNaN(width)) return places.width
|
|
559
|
+
return width
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/** Item `i`'s height among `places`. */
|
|
563
|
+
export const heightAt = (places: BatchReorderPlaces, i: number): number => {
|
|
564
|
+
// Per item, per drag sample: statements.
|
|
565
|
+
const each = places.each
|
|
566
|
+
if (Predicate.isUndefined(each)) return places.itemSize.height
|
|
567
|
+
return each.heights[i]
|
|
568
|
+
}
|
|
197
569
|
|
|
198
570
|
/** The group's size for `n` items: its width, and its places' height, the last row's far edge. */
|
|
199
571
|
export const extentOf = (places: BatchReorderPlaces, n: number): ReorderBatchItemSize =>
|
|
200
572
|
Bool.match(n === 0, {
|
|
201
573
|
onTrue: () => NO_SIZE,
|
|
202
|
-
onFalse: () =>
|
|
574
|
+
onFalse: () =>
|
|
575
|
+
UndefinedOr.match(places.each, {
|
|
576
|
+
onUndefined: () => ({ width: places.width, height: (Math.ceil(n / places.columns) - 1) * places.stepY + places.itemSize.height }),
|
|
577
|
+
onDefined: (each) => ({ width: places.width, height: each.height }),
|
|
578
|
+
}),
|
|
203
579
|
})
|
|
204
580
|
|
|
205
581
|
/** `px`. */
|
|
206
582
|
export const px = (n: number): string => `${n}px`
|
|
207
583
|
|
|
584
|
+
/** A size container's whole inline size: its content box's. */
|
|
585
|
+
const CONTAINER_WIDTH = "100cqi"
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The width of an item that takes the group's content width (#714, Q10), `inFlow` or not, its padding and
|
|
589
|
+
* border inside it (border-box). In flow, `100%`: its content box's. Placed, once the group's padding is
|
|
590
|
+
* read, its padding box's (an absolutely placed box's `100%`) less that padding: a resize of the group is
|
|
591
|
+
* then a layout alone. Before, a server's, all of a size container's inline size, the group being one
|
|
592
|
+
* ({@link containsWidth}): exact, at a style recalc of every item each time the group's width changes.
|
|
593
|
+
*/
|
|
594
|
+
export const groupWidthOf = (geometry: BatchReorderGeometry, inFlow: boolean): string =>
|
|
595
|
+
Bool.match(inFlow, {
|
|
596
|
+
onTrue: () => "100%",
|
|
597
|
+
onFalse: () =>
|
|
598
|
+
UndefinedOr.match(geometry.padding, {
|
|
599
|
+
onUndefined: () => CONTAINER_WIDTH,
|
|
600
|
+
onDefined: (padding) => Bool.match(padding === 0, { onTrue: () => "100%", onFalse: () => `calc(100% - ${px(padding)})` }),
|
|
601
|
+
}),
|
|
602
|
+
})
|
|
603
|
+
|
|
604
|
+
/** The style of an item that takes the group's content width, `width`: that width, its padding and border inside it. */
|
|
605
|
+
const groupWidthStyle = (width: string): Readonly<Record<string, string>> => ({ width, "box-sizing": "border-box" })
|
|
606
|
+
|
|
607
|
+
/** Whether `places`' group is its items' size container: they take its width, out of flow, its padding not read. */
|
|
608
|
+
const containsWidth = (places: BatchReorderPlaces, geometry: BatchReorderGeometry): boolean =>
|
|
609
|
+
Bool.every([places.takesWidth, Bool.not(places.inFlow), Predicate.isUndefined(geometry.padding)])
|
|
610
|
+
|
|
611
|
+
/** What makes a group whose items take its content width their query container: on its inline axis alone. */
|
|
612
|
+
const SIZE_CONTAINER: Readonly<Record<string, string>> = { "container-type": "inline-size" }
|
|
613
|
+
|
|
208
614
|
/**
|
|
209
615
|
* The group element's style for `places`, `geometry` and `n` items, under `own`: positioned, its direction,
|
|
210
|
-
* and sized to its places, or, a grid whose width isn't read yet, laid out by CSS
|
|
211
|
-
* the server and the client, so
|
|
616
|
+
* and sized to its places, or, a grid whose width isn't read yet, laid out by CSS (Q37; #714, Q5): CSS grid
|
|
617
|
+
* for items of one size, `flex-wrap` for each their own, the same on the server and the client, so
|
|
618
|
+
* hydrating keeps the markup. Items that take its content width have it as their query container until its
|
|
619
|
+
* padding is read, out of flow (#714).
|
|
212
620
|
*/
|
|
213
621
|
export const groupStyleOf = (places: BatchReorderPlaces, n: number, geometry: BatchReorderGeometry, own: Style.Input): Style.Style => {
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
display: "grid",
|
|
219
|
-
"grid-template-columns": `repeat(auto-fill, ${px(places.itemSize.width)})`,
|
|
220
|
-
"column-gap": px(places.stepX - places.itemSize.width),
|
|
221
|
-
"row-gap": px(places.stepY - places.itemSize.height),
|
|
222
|
-
}),
|
|
622
|
+
const positioned = { ...ReorderController.GROUP_STYLE, position: "relative", direction: geometry.direction }
|
|
623
|
+
const base: Readonly<Record<string, string>> = Bool.match(containsWidth(places, geometry), { onTrue: () => ({ ...positioned, ...SIZE_CONTAINER }), onFalse: () => positioned })
|
|
624
|
+
const sized: Readonly<Record<string, string>> = Bool.match(places.inFlow, {
|
|
625
|
+
onTrue: () => flowStyleOf(places, geometry, base),
|
|
223
626
|
onFalse: () => {
|
|
224
627
|
const extent = extentOf(places, n)
|
|
225
|
-
// Its
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
628
|
+
// Its width the app's (Q36; #714). Its own size holds its edges too, a `border-box` group's (#714).
|
|
629
|
+
const height = px(extent.height + geometry.edges.y)
|
|
630
|
+
return Bool.match(places.appsWidth, {
|
|
631
|
+
onTrue: () => ({ ...base, height }),
|
|
632
|
+
onFalse: () => ({ ...base, width: px(extent.width + geometry.edges.x), height }),
|
|
229
633
|
})
|
|
230
634
|
},
|
|
231
635
|
})
|
|
232
636
|
return Style.over(own, sized)
|
|
233
637
|
}
|
|
234
638
|
|
|
639
|
+
/** A grid in flow's style: CSS grid's columns for items of one size, `flex-wrap`'s rows for each their own (#714, Q5). */
|
|
640
|
+
const flowStyleOf = (places: BatchReorderPlaces, geometry: BatchReorderGeometry, base: Readonly<Record<string, string>>): Readonly<Record<string, string>> => {
|
|
641
|
+
const gap = gapOf(geometry)
|
|
642
|
+
return Bool.match(Predicate.isUndefined(places.each), {
|
|
643
|
+
onTrue: () => ({ ...base, display: "grid", "grid-template-columns": `repeat(auto-fill, ${px(places.itemSize.width)})`, "column-gap": px(gap.x), "row-gap": px(gap.y) }),
|
|
644
|
+
onFalse: () => ({ ...base, ...eachFlowBy(geometry.axis)(gap) }),
|
|
645
|
+
})
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Each axis's flow for items each their own size (#714, decision 4), where their places would put them: a
|
|
650
|
+
* column, its items as wide as its content box; a row at its items' tops, as wide as they are, so it's as
|
|
651
|
+
* wide as its places make it; rows that wrap. Built once, at module load.
|
|
652
|
+
*/
|
|
653
|
+
const eachFlowBy: (axis: CoreReorder.Axis) => (gap: XY) => Readonly<Record<string, string>> = Match.type<CoreReorder.Axis>().pipe(
|
|
654
|
+
Match.when("y", () => (gap: XY) => ({ display: "flex", "flex-direction": "column", "row-gap": px(gap.y) })),
|
|
655
|
+
Match.when("x", () => (gap: XY) => ({ display: "flex", "flex-direction": "row", "align-items": "flex-start", "column-gap": px(gap.x), width: "max-content" })),
|
|
656
|
+
Match.orElse(() => (gap: XY) => ({ display: "flex", "flex-wrap": "wrap", "align-items": "flex-start", "column-gap": px(gap.x), "row-gap": px(gap.y) })),
|
|
657
|
+
)
|
|
658
|
+
|
|
235
659
|
/** A Reorder item's drag axis for its group's: a grid's `xy` is a free drag. Built once, at module load. */
|
|
236
660
|
const dragAxisFor: (axis: CoreReorder.Axis) => true | "x" | "y" = Match.type<CoreReorder.Axis>().pipe(
|
|
237
661
|
Match.when("xy", (): true => true),
|
|
@@ -239,12 +663,100 @@ const dragAxisFor: (axis: CoreReorder.Axis) => true | "x" | "y" = Match.type<Cor
|
|
|
239
663
|
)
|
|
240
664
|
|
|
241
665
|
/**
|
|
242
|
-
* An item's own style under its group's:
|
|
243
|
-
*
|
|
666
|
+
* An item's own style under its group's, `inFlow` or not: a drag element's defaults; sized, its items one
|
|
667
|
+
* size; a column's items read from the page as wide as the group (#714, Q6); and, unless its group lays it out
|
|
668
|
+
* in flow, absolute at its static position (no `top` or `left`): the start of the group's content box. Items
|
|
669
|
+
* each their own size, a function's, are sized each by {@link sizeStyleOf} (#714).
|
|
244
670
|
*/
|
|
245
|
-
export const itemBaseOf = (geometry: BatchReorderGeometry): Readonly<Record<string, string>> => {
|
|
246
|
-
const
|
|
247
|
-
|
|
671
|
+
export const itemBaseOf = (geometry: BatchReorderGeometry, inFlow: boolean): Readonly<Record<string, string>> => {
|
|
672
|
+
const drag = Style.dragDefaults(dragAxisFor(geometry.axis))
|
|
673
|
+
const base = sizedBy(geometry, drag, groupWidthOf(geometry, inFlow))
|
|
674
|
+
return Bool.match(inFlow, { onTrue: () => ({ ...base, ...IN_FLOW }), onFalse: () => ({ ...base, position: "absolute" }) })
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* `drag` with every item's size, its group's one size; the group's width, `groupWidth`, a column's read from the
|
|
679
|
+
* page; or none.
|
|
680
|
+
*/
|
|
681
|
+
const sizedBy = (geometry: BatchReorderGeometry, drag: Readonly<Record<string, string>>, groupWidth: string): Readonly<Record<string, string>> => {
|
|
682
|
+
// Per element at mount, by the hot path's rules: statements.
|
|
683
|
+
const itemSize = geometry.itemSize
|
|
684
|
+
if (Predicate.isUndefined(itemSize)) {
|
|
685
|
+
if (geometry.axis !== "y") return drag
|
|
686
|
+
return { ...drag, ...groupWidthStyle(groupWidth) }
|
|
687
|
+
}
|
|
688
|
+
if (Predicate.isFunction(itemSize)) return drag
|
|
689
|
+
return { ...drag, ...sizeStyle(itemSize.width, itemSize.height, groupWidth) }
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** An item in flow's own: unshrunk, as wide as at its place, its row breaking where its place's does (#714). */
|
|
693
|
+
const IN_FLOW: Readonly<Record<string, string>> = { "flex-shrink": "0" }
|
|
694
|
+
|
|
695
|
+
/** An item's size as style: its width, or the group's content width, `groupWidth`, border-box (#714, Q10); and its height. */
|
|
696
|
+
const sizeStyle = (width: number | undefined, height: number, groupWidth: string): Readonly<Record<string, string>> =>
|
|
697
|
+
UndefinedOr.match(width, {
|
|
698
|
+
onUndefined: () => ({ ...groupWidthStyle(groupWidth), height: px(height) }),
|
|
699
|
+
onDefined: (w) => ({ width: px(w), height: px(height) }),
|
|
700
|
+
})
|
|
701
|
+
|
|
702
|
+
/** Item `i`'s own size as style, its items each their own size (#714): `width` and `height`, or none. */
|
|
703
|
+
export const sizeStyleOf = (places: BatchReorderPlaces, i: number): Readonly<Record<string, string>> => {
|
|
704
|
+
// Per element at mount, by the hot path's rules: statements.
|
|
705
|
+
const each = places.each
|
|
706
|
+
if (Predicate.isUndefined(each) || places.sizesRead) return NO_STYLE
|
|
707
|
+
const width = each.widths[i]
|
|
708
|
+
if (Number.isNaN(width)) return { ...groupWidthStyle(places.groupWidth), height: px(each.heights[i]) }
|
|
709
|
+
return { width: px(width), height: px(each.heights[i]) }
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
const NO_STYLE: Readonly<Record<string, string>> = {}
|
|
713
|
+
|
|
714
|
+
/** A size last written on an item's element (#714): its width and height as written, and whether the width was the group's. */
|
|
715
|
+
export interface WrittenSize {
|
|
716
|
+
readonly width: string
|
|
717
|
+
readonly height: string
|
|
718
|
+
readonly tookGroupWidth: boolean
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/** An element whose width was the group's, `was`, written no longer: its own `box-sizing` back (#714). */
|
|
722
|
+
export const releaseGroupWidth = (el: HTMLElement, was: WrittenSize | undefined): void => {
|
|
723
|
+
// Per item at a change: statements.
|
|
724
|
+
if (Predicate.isNotUndefined(was) && was.tookGroupWidth) el.style.removeProperty("box-sizing")
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* `el`'s own size as `was` written, taken back where its style is still that: its items' sizes read from the
|
|
729
|
+
* page now (#714). A width that was the group's stays, a column's read from the page being the group's too.
|
|
730
|
+
*/
|
|
731
|
+
export const unwriteSizeOn = (el: HTMLElement, was: WrittenSize | undefined): void => {
|
|
732
|
+
// Per item at a change: statements.
|
|
733
|
+
if (Predicate.isUndefined(was)) return
|
|
734
|
+
if (el.style.height === was.height) el.style.removeProperty("height")
|
|
735
|
+
if (!was.tookGroupWidth && el.style.width === was.width) el.style.removeProperty("width")
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Item `i`'s own size written on `el`, its items each their own size (#714), where it isn't already: what
|
|
740
|
+
* `written` holds, by element, is what was last written.
|
|
741
|
+
*/
|
|
742
|
+
export const writeSizeOn = (el: HTMLElement, places: BatchReorderPlaces, i: number, written: WeakMap<Element, WrittenSize>): void => {
|
|
743
|
+
// Per item at a change: statements.
|
|
744
|
+
const each = places.each
|
|
745
|
+
if (Predicate.isUndefined(each) || places.sizesRead) return
|
|
746
|
+
const tookGroupWidth = Number.isNaN(each.widths[i])
|
|
747
|
+
let width = places.groupWidth
|
|
748
|
+
if (!tookGroupWidth) width = px(each.widths[i])
|
|
749
|
+
const height = px(each.heights[i])
|
|
750
|
+
const was = written.get(el)
|
|
751
|
+
if (Predicate.isNotUndefined(was) && was.width === width && was.height === height) return
|
|
752
|
+
written.set(el, { width, height, tookGroupWidth })
|
|
753
|
+
el.style.setProperty("height", height)
|
|
754
|
+
el.style.setProperty("width", width)
|
|
755
|
+
if (tookGroupWidth) {
|
|
756
|
+
el.style.setProperty("box-sizing", "border-box")
|
|
757
|
+
return
|
|
758
|
+
}
|
|
759
|
+
releaseGroupWidth(el, was)
|
|
248
760
|
}
|
|
249
761
|
|
|
250
762
|
/**
|