@wardic/solid 1.0.1 → 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
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import type * as Box from "@wardic/core/Box"
|
|
25
25
|
import type * as DefaultTransition from "@wardic/core/DefaultTransition"
|
|
26
26
|
import * as Frame from "@wardic/core/Frame"
|
|
27
|
+
import * as Spans from "@wardic/core/Spans"
|
|
27
28
|
import type * as FrameLoop from "@wardic/core/FrameLoop"
|
|
28
29
|
import * as InterpolatorRegistry from "@wardic/core/InterpolatorRegistry"
|
|
29
30
|
import type * as ReducedMotion from "@wardic/core/ReducedMotion"
|
|
@@ -32,7 +33,7 @@ import * as Values from "@wardic/core/Values"
|
|
|
32
33
|
import * as Machine from "@wardic/core/Machine"
|
|
33
34
|
import * as Microtask from "@wardic/core/Microtask"
|
|
34
35
|
import * as Velocity from "@wardic/core/Velocity"
|
|
35
|
-
import
|
|
36
|
+
import * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
|
|
36
37
|
import * as DomRenderer from "@wardic/dom/DomRenderer"
|
|
37
38
|
import * as MeasuredPair from "@wardic/dom/MeasuredPair"
|
|
38
39
|
import * as Report from "@wardic/dom/Report"
|
|
@@ -72,7 +73,7 @@ const LONE: PresenceTree = { joins: false, provides: false, twin: false }
|
|
|
72
73
|
const treeOf = (rec: PresenceRecord): PresenceTree => UndefinedOr.match(rec.tree, { onUndefined: () => LONE, onDefined: identity })
|
|
73
74
|
|
|
74
75
|
/** No elements: a leaving child with none inside it exiting. */
|
|
75
|
-
const NO_PARTS: ReadonlyArray<
|
|
76
|
+
const NO_PARTS: ReadonlyArray<Element> = []
|
|
76
77
|
|
|
77
78
|
/** No records: nothing registered inside a leaving child. */
|
|
78
79
|
const NO_RECORDS: ReadonlyArray<PresenceRecord | undefined> = []
|
|
@@ -154,7 +155,7 @@ const measuredInto =
|
|
|
154
155
|
*/
|
|
155
156
|
const exitRunOf = (
|
|
156
157
|
leg: Leg,
|
|
157
|
-
el:
|
|
158
|
+
el: Element,
|
|
158
159
|
commitFrame: FrameLoop.Sink<Frame.Frame<Values.Values>>,
|
|
159
160
|
velocities: Record<string, number>,
|
|
160
161
|
): Effect.Effect<unknown, never, WardicServices> => {
|
|
@@ -209,7 +210,7 @@ const NO_DELAY: DelayOf = () => 0
|
|
|
209
210
|
|
|
210
211
|
/** An element's exit made ready to run (#297's PR 2): its node, where it starts, what each frame commits, and its velocities. */
|
|
211
212
|
interface PreparedExit {
|
|
212
|
-
readonly el:
|
|
213
|
+
readonly el: Element
|
|
213
214
|
readonly from: Values.Values
|
|
214
215
|
/** Its Keyframes of more than two stops (#429), `from` at their first. */
|
|
215
216
|
readonly stops: StopsByKey | undefined
|
|
@@ -222,10 +223,10 @@ interface PreparedExit {
|
|
|
222
223
|
* end-of-task batch, but a key with Keyframes of more than two stops (`stops`, #460). `undefined` with
|
|
223
224
|
* none, nearly every exit.
|
|
224
225
|
*/
|
|
225
|
-
const exitMeasuredOf = (element:
|
|
226
|
+
const exitMeasuredOf = (element: Element, from: Values.Values, to: Values.Values, stops: StopsByKey | undefined): MeasuredPairs | undefined => {
|
|
226
227
|
const pairs = Rec.filter(to, (target, key) => Bool.and(Bool.and(Object.hasOwn(from, key), Bool.not(hasManyStops(stops, key))), keepsMeasured(key, from[key], target)))
|
|
227
228
|
if (Rec.isEmptyRecord(pairs)) return undefined
|
|
228
|
-
return MeasuredPair.measure(element, Rec.map(pairs, (target, key) => ({ from: UndefinedOr.getOrThrow(from[key]), to: target })), from)
|
|
229
|
+
return MeasuredPair.measure(castForDom(element), Rec.map(pairs, (target, key) => ({ from: UndefinedOr.getOrThrow(from[key]), to: target })), from)
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
/** Whether a start and a target make a Measured pair (#430). */
|
|
@@ -250,21 +251,44 @@ const transitionOfName = (exit: PresenceExit, name: string | undefined): WardicT
|
|
|
250
251
|
})
|
|
251
252
|
}
|
|
252
253
|
|
|
253
|
-
/**
|
|
254
|
+
/**
|
|
255
|
+
* Whether a resolved child is a presence child (#702): any element, HTML, SVG or MathML; text never.
|
|
256
|
+
* Only called on the client, where `Element` exists.
|
|
257
|
+
*/
|
|
258
|
+
const isPresenceChild = (node: unknown): node is Element => node instanceof Element
|
|
259
|
+
|
|
260
|
+
/** Whether an element is an HTML one, which `popLayout` measures by its offsets (#277, Motion's). */
|
|
254
261
|
const isHTMLElement = (node: unknown): node is HTMLElement => node instanceof HTMLElement
|
|
255
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Whether an element is an outermost `<svg>` (#744): the one SVG element with a CSS box in the HTML
|
|
265
|
+
* flow, which `popLayout` pops too, beyond Motion's. The elements inside an `<svg>`, an inner `<svg>`
|
|
266
|
+
* included, have no flow to leave.
|
|
267
|
+
*/
|
|
268
|
+
const isSvgRoot = (node: Element): node is SVGSVGElement => {
|
|
269
|
+
if (node instanceof SVGSVGElement) return Predicate.isNull(node.ownerSVGElement)
|
|
270
|
+
return false
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* An element as dom's projection and Measured pairs take it (#702): typed for HTML elements, they read
|
|
275
|
+
* only what an SVG element has too (lookups by element, `contains`, its box and its inline style), so an
|
|
276
|
+
* SVG presence child goes through as one, as the bindings' SVG Wardic elements already do.
|
|
277
|
+
*/
|
|
278
|
+
const castForDom = (el: Element): HTMLElement => el as HTMLElement
|
|
279
|
+
|
|
256
280
|
/** The elements of what a binding's `children()` resolved: one node, a flat array, or none. */
|
|
257
|
-
const elementsOf = (resolved: unknown): ReadonlyArray<
|
|
281
|
+
const elementsOf = (resolved: unknown): ReadonlyArray<Element> => Arr.filter(Arr.ensure(resolved), isPresenceChild)
|
|
258
282
|
|
|
259
283
|
/** A child present at the last change: its element, and where it was then, to put it back as it leaves. */
|
|
260
284
|
interface Placed {
|
|
261
|
-
readonly el:
|
|
285
|
+
readonly el: Element
|
|
262
286
|
readonly parent: ParentNode | undefined
|
|
263
287
|
readonly next: ChildNode | undefined
|
|
264
288
|
}
|
|
265
289
|
|
|
266
290
|
/** Where `el` is now. */
|
|
267
|
-
const placedOf = (el:
|
|
291
|
+
const placedOf = (el: Element): Placed => ({
|
|
268
292
|
el,
|
|
269
293
|
parent: Option.getOrUndefined(Option.fromNullOr(el.parentNode)),
|
|
270
294
|
next: Option.getOrUndefined(Option.fromNullOr(el.nextSibling)),
|
|
@@ -275,9 +299,12 @@ const placedOf = (el: HTMLElement): Placed => ({
|
|
|
275
299
|
* measures it: its size (`getComputedStyle`, so its own `box-sizing` reads it back), and its margin
|
|
276
300
|
* box's offset from its containing block's padding edge on the two edges its anchors name (#442):
|
|
277
301
|
* the top or the bottom, and its inline start or end (Motion's `anchorX` `"left"` or `"right"`, which
|
|
278
|
-
* a right-to-left one flips).
|
|
302
|
+
* a right-to-left one flips). An HTML one's offsets are whole pixels, the DOM's `offsetTop`; an
|
|
303
|
+
* `<svg>` root's are fractional, from rects (#744).
|
|
279
304
|
*/
|
|
280
305
|
interface PopBox {
|
|
306
|
+
/** The element it pins: an HTML one, or an outermost `<svg>` (#744). No other SVG element is popped (#702). */
|
|
307
|
+
readonly el: HTMLElement | SVGSVGElement
|
|
281
308
|
readonly width: number
|
|
282
309
|
readonly height: number
|
|
283
310
|
readonly y: "top" | "bottom"
|
|
@@ -292,6 +319,17 @@ export interface PopAnchors {
|
|
|
292
319
|
readonly y: "top" | "bottom"
|
|
293
320
|
}
|
|
294
321
|
|
|
322
|
+
/**
|
|
323
|
+
* A leaver's border box's gap from its containing block's padding edge on each side, in the block's
|
|
324
|
+
* own pixels (#744): what an HTML one reads from its offsets, and an `<svg>` root from rects.
|
|
325
|
+
*/
|
|
326
|
+
interface EdgeGaps {
|
|
327
|
+
readonly left: number
|
|
328
|
+
readonly top: number
|
|
329
|
+
readonly right: number
|
|
330
|
+
readonly bottom: number
|
|
331
|
+
}
|
|
332
|
+
|
|
295
333
|
/** The size of the padding box `el`'s offsets are from: its offset parent's, or the viewport's. */
|
|
296
334
|
const containerOf = (el: HTMLElement): { readonly width: number; readonly height: number } => {
|
|
297
335
|
const parent = el.offsetParent
|
|
@@ -307,33 +345,111 @@ const pxOf = (value: string): number => {
|
|
|
307
345
|
}
|
|
308
346
|
|
|
309
347
|
/**
|
|
310
|
-
* Where `el` is now, to pop it (#277): `undefined` for one
|
|
311
|
-
*
|
|
348
|
+
* Where `el` is now, to pop it (#277): `undefined` for one that isn't popped: an SVG element inside an
|
|
349
|
+
* `<svg>`, which runs its exit in place (#702), as Motion's, and one with no size of its own. An outermost
|
|
350
|
+
* `<svg>` is popped (#744), beyond Motion's.
|
|
351
|
+
*/
|
|
352
|
+
const popBoxOf = (el: Element, anchors: PopAnchors): PopBox | undefined => {
|
|
353
|
+
if (isHTMLElement(el)) return pinBoxOf(el, anchors, htmlGapsOf)
|
|
354
|
+
if (isSvgRoot(el)) return pinBoxOf(el, anchors, svgGapsOf)
|
|
355
|
+
return undefined
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Where `el` is now, to pop it, from its gaps as its kind reads them (`gapsOf`): `undefined` for one
|
|
360
|
+
* with no size of its own (an inline element, or an empty one), or whose gaps can't be read.
|
|
312
361
|
*/
|
|
313
|
-
const
|
|
362
|
+
const pinBoxOf = <E extends HTMLElement | SVGSVGElement>(el: E, anchors: PopAnchors, gapsOf: (el: E) => EdgeGaps | undefined): PopBox | undefined => {
|
|
314
363
|
const style = getComputedStyle(el)
|
|
315
364
|
const width = Number.parseFloat(style.width)
|
|
316
365
|
const height = Number.parseFloat(style.height)
|
|
317
366
|
if (Bool.not(Bool.and(width > 0, height > 0))) return undefined
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
367
|
+
return UndefinedOr.map(gapsOf(el), (gaps) => {
|
|
368
|
+
// Positioned by its margin box, as its gaps are its border box's. `anchorX` names the inline start
|
|
369
|
+
// (`"left"`) or end, which a right-to-left one flips, as Motion's.
|
|
370
|
+
const x = Bool.match((anchors.x === "right") !== (style.direction === "rtl"), { onTrue: (): PopBox["x"] => "right", onFalse: (): PopBox["x"] => "left" })
|
|
371
|
+
const xAt = Bool.match(x === "right", {
|
|
372
|
+
onTrue: () => gaps.right - pxOf(style.marginRight),
|
|
373
|
+
onFalse: () => gaps.left - pxOf(style.marginLeft),
|
|
374
|
+
})
|
|
375
|
+
const yAt = Bool.match(anchors.y === "bottom", {
|
|
376
|
+
onTrue: () => gaps.bottom - pxOf(style.marginBottom),
|
|
377
|
+
onFalse: () => gaps.top - pxOf(style.marginTop),
|
|
378
|
+
})
|
|
379
|
+
return { el, width, height, y: anchors.y, yAt, x, xAt }
|
|
330
380
|
})
|
|
331
|
-
return { width, height, y: anchors.y, yAt, x, xAt }
|
|
332
381
|
}
|
|
333
382
|
|
|
383
|
+
/** An HTML element's gaps (#277), from its offsets: whole pixels, against its offset parent's padding box or the viewport. */
|
|
384
|
+
const htmlGapsOf = (el: HTMLElement): EdgeGaps => {
|
|
385
|
+
const container = containerOf(el)
|
|
386
|
+
return {
|
|
387
|
+
left: el.offsetLeft,
|
|
388
|
+
top: el.offsetTop,
|
|
389
|
+
right: container.width - el.offsetLeft - el.offsetWidth,
|
|
390
|
+
bottom: container.height - el.offsetTop - el.offsetHeight,
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* A filler's style (#744): absolutely positioned and filling its containing block's padding box, over
|
|
396
|
+
* any rule of the page's (`all: initial`, each `important`).
|
|
397
|
+
*/
|
|
398
|
+
const FILLER_STYLE = "all: initial !important; display: block !important; position: absolute !important; inset: 0 !important"
|
|
399
|
+
|
|
400
|
+
/** A containing block's padding box (#744): its rect as drawn, scrolled and transformed, and its own size. */
|
|
401
|
+
interface PaddingBox {
|
|
402
|
+
readonly rect: DOMRect
|
|
403
|
+
readonly width: number
|
|
404
|
+
readonly height: number
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* The padding box of the containing block an absolutely positioned `el` has (#744): the browser's own,
|
|
409
|
+
* which a filler put right after `el`, absolutely positioned with `inset: 0`, fills. It's read and
|
|
410
|
+
* removed at once. `undefined` for an `el` with no parent.
|
|
411
|
+
*/
|
|
412
|
+
const paddingBoxOf = (el: Element): PaddingBox | undefined => {
|
|
413
|
+
const parent = el.parentNode
|
|
414
|
+
if (Predicate.isNull(parent)) return undefined
|
|
415
|
+
const filler = document.createElement("wardic-filler")
|
|
416
|
+
filler.style.cssText = FILLER_STYLE
|
|
417
|
+
parent.insertBefore(filler, el.nextSibling)
|
|
418
|
+
try {
|
|
419
|
+
const style = getComputedStyle(filler)
|
|
420
|
+
return { rect: filler.getBoundingClientRect(), width: Number.parseFloat(style.width), height: Number.parseFloat(style.height) }
|
|
421
|
+
} finally {
|
|
422
|
+
filler.remove()
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/** How much a drawn length is of its own (#744): `drawn` over `own`, `1` for a box with no size. */
|
|
427
|
+
const scaleOf = (drawn: number, own: number): number => Bool.match(own > 0, { onTrue: () => drawn / own, onFalse: () => 1 })
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* An outermost `<svg>`'s gaps (#744, ADR-0048 *Amendment (#744)*), from rects, as it has no `offsetTop`,
|
|
431
|
+
* `offsetLeft` or `offsetParent`: its box, read without its own inline `transform` (Wardic's), less its
|
|
432
|
+
* containing block's padding box (`paddingBoxOf`), divided by that block's scale on each axis (a layout
|
|
433
|
+
* animation's on it). Fractional. A rotated or skewed ancestor puts them off, as rects undo only
|
|
434
|
+
* translation and scale, and so does a transform of its own from the page's CSS (a `rotate`, or a
|
|
435
|
+
* stylesheet's `transform`). `undefined` for one with no parent.
|
|
436
|
+
*/
|
|
437
|
+
const svgGapsOf = (el: SVGSVGElement): EdgeGaps | undefined =>
|
|
438
|
+
UndefinedOr.map(paddingBoxOf(el), (block) => {
|
|
439
|
+
const own = ProjectionSystem.measureLayoutBox(castForDom(el))
|
|
440
|
+
const sx = scaleOf(block.rect.width, block.width)
|
|
441
|
+
const sy = scaleOf(block.rect.height, block.height)
|
|
442
|
+
return {
|
|
443
|
+
left: (own.left - block.rect.left) / sx,
|
|
444
|
+
top: (own.top - block.rect.top) / sy,
|
|
445
|
+
right: (block.rect.right - own.right) / sx,
|
|
446
|
+
bottom: (block.rect.bottom - own.bottom) / sy,
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
|
|
334
450
|
/** Pin a leaver where `box` measured it, out of the flow, over any style of its own. */
|
|
335
|
-
const pin = (
|
|
336
|
-
const style = el.style
|
|
451
|
+
const pin = (box: PopBox): void => {
|
|
452
|
+
const style = box.el.style
|
|
337
453
|
style.setProperty("position", "absolute", "important")
|
|
338
454
|
style.setProperty("width", `${box.width}px`, "important")
|
|
339
455
|
style.setProperty("height", `${box.height}px`, "important")
|
|
@@ -348,8 +464,8 @@ const pin = (el: HTMLElement, box: PopBox): void => {
|
|
|
348
464
|
* A popped leaver moved by `by` in the page from where `box` pinned it (ADR-0048 *Amendment (#480)*):
|
|
349
465
|
* each pinned edge by its axis's move, a right or bottom one against it.
|
|
350
466
|
*/
|
|
351
|
-
const movePin = (
|
|
352
|
-
const style = el.style
|
|
467
|
+
const movePin = (box: PopBox, by: { readonly x: number; readonly y: number }): void => {
|
|
468
|
+
const style = box.el.style
|
|
353
469
|
style.setProperty(box.y, `${box.yAt + EDGE_BY[box.y] * by.y}px`, "important")
|
|
354
470
|
style.setProperty(box.x, `${box.xAt + EDGE_BY[box.x] * by.x}px`, "important")
|
|
355
471
|
}
|
|
@@ -374,7 +490,7 @@ const parentElementOf = (placed: ReadonlyArray<Placed>): Element | undefined =>
|
|
|
374
490
|
* be after a leaver put back after another child: `[a, b, c, d]`, b and d leaving, then `[c, a]`, is
|
|
375
491
|
* `[c, a, d, b]`, where "after the child it followed" would be `[c, d, a, b]`.
|
|
376
492
|
*/
|
|
377
|
-
const orderOf = (before: ReadonlyArray<
|
|
493
|
+
const orderOf = (before: ReadonlyArray<Element>, now: ReadonlyArray<Element>): ReadonlyArray<Element> => {
|
|
378
494
|
const at = new Map(Arr.map(now, (el, i) => [el, i] as const))
|
|
379
495
|
return Arr.reduce(before, { order: [...now], next: 0, back: 0 }, (acc, el) =>
|
|
380
496
|
UndefinedOr.match(at.get(el), {
|
|
@@ -393,7 +509,7 @@ const orderOf = (before: ReadonlyArray<HTMLElement>, now: ReadonlyArray<HTMLElem
|
|
|
393
509
|
* place, never against a leaver that isn't yet, as the nearest neighbour on the page might be (#561's
|
|
394
510
|
* P19).
|
|
395
511
|
*/
|
|
396
|
-
const backPlaceOf = (placed: Placed, cursor:
|
|
512
|
+
const backPlaceOf = (placed: Placed, cursor: Element | undefined, anchor: ChildNode | undefined): Placed =>
|
|
397
513
|
UndefinedOr.match(cursor, {
|
|
398
514
|
onDefined: (at) => ({ ...placedOf(at), el: placed.el }),
|
|
399
515
|
onUndefined: () =>
|
|
@@ -409,7 +525,7 @@ const backPlaceOf = (placed: Placed, cursor: HTMLElement | undefined, anchor: Ch
|
|
|
409
525
|
* `cursor`, text between them left be; with none, the anchor itself, the first of the order on the
|
|
410
526
|
* page; with neither, on the page.
|
|
411
527
|
*/
|
|
412
|
-
const isInPlace = (el:
|
|
528
|
+
const isInPlace = (el: Element, cursor: Element | undefined, anchor: ChildNode | undefined): boolean =>
|
|
413
529
|
UndefinedOr.match(cursor, {
|
|
414
530
|
onDefined: (at) => at.nextElementSibling === el,
|
|
415
531
|
onUndefined: () =>
|
|
@@ -550,11 +666,15 @@ export const exitCompleteEvents = (runtime: WardicRuntime, onExitComplete: () =>
|
|
|
550
666
|
},
|
|
551
667
|
})
|
|
552
668
|
|
|
553
|
-
/**
|
|
554
|
-
type
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
669
|
+
/** A projection method that takes an HTML element first, taking any element. */
|
|
670
|
+
type TakingAnyElement<F> = F extends (...args: infer P) => infer A ? P extends [HTMLElement, ...infer R] ? (el: Element, ...rest: R) => A : F : F
|
|
671
|
+
|
|
672
|
+
/** What a presence asks of the projection system, of any presence child (#702). */
|
|
673
|
+
type PresenceProjection = {
|
|
674
|
+
readonly [K in "notify" | "handleLeave" | "handBackWithin" | "keepLeaving" | "awaitsTwin" | "keepSeen" | "registerValues" | "rootBoxOf" | "dropLeaver"]: TakingAnyElement<
|
|
675
|
+
ProjectionSystem.Shape[K]
|
|
676
|
+
>
|
|
677
|
+
}
|
|
558
678
|
|
|
559
679
|
/**
|
|
560
680
|
* The projection system as a presence asks it (#511): the provider's once its `layout` Feature is
|
|
@@ -567,14 +687,14 @@ const presenceProjectionOf = (projection: () => ProjectionSystem.Shape | undefin
|
|
|
567
687
|
const call = <A>(use: (system: ProjectionSystem.Shape) => A, none: () => A): A => UndefinedOr.match(projection(), { onUndefined: none, onDefined: use })
|
|
568
688
|
return {
|
|
569
689
|
notify: () => call((system) => system.notify(), constVoid),
|
|
570
|
-
handleLeave: (el, onDone) => call((system) => system.handleLeave(el, onDone), constFalse),
|
|
571
|
-
handBackWithin: (el, onDone) => call((system) => system.handBackWithin(el, onDone), Option.none),
|
|
572
|
-
keepLeaving: (el, taken) => call((system) => system.keepLeaving(el, taken), () => constVoid),
|
|
573
|
-
awaitsTwin: (el) => call((system) => system.awaitsTwin(el), constFalse),
|
|
574
|
-
keepSeen: (el, move) => call((system) => system.keepSeen(el, move), constVoid),
|
|
690
|
+
handleLeave: (el, onDone) => call((system) => system.handleLeave(castForDom(el), onDone), constFalse),
|
|
691
|
+
handBackWithin: (el, onDone) => call((system) => system.handBackWithin(castForDom(el), onDone), Option.none),
|
|
692
|
+
keepLeaving: (el, taken) => call((system) => system.keepLeaving(castForDom(el), taken), () => constVoid),
|
|
693
|
+
awaitsTwin: (el) => call((system) => system.awaitsTwin(castForDom(el)), constFalse),
|
|
694
|
+
keepSeen: (el, move) => call((system) => system.keepSeen(castForDom(el), move), constVoid),
|
|
575
695
|
registerValues: (el, read) => call((system) => system.registerValues(el, read), () => constVoid),
|
|
576
|
-
rootBoxOf: (el) => call((system) => system.rootBoxOf(el), Option.none),
|
|
577
|
-
dropLeaver: (el) => call((system) => system.dropLeaver(el), Option.none),
|
|
696
|
+
rootBoxOf: (el) => call((system) => system.rootBoxOf(castForDom(el)), Option.none),
|
|
697
|
+
dropLeaver: (el) => call((system) => system.dropLeaver(castForDom(el)), Option.none),
|
|
578
698
|
}
|
|
579
699
|
}
|
|
580
700
|
|
|
@@ -595,50 +715,50 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
595
715
|
// The registry of live child records, keyed by their DOM element. Filled by
|
|
596
716
|
// register() (called from the child's spine on mount), drained as children
|
|
597
717
|
// leave (after their exit settles).
|
|
598
|
-
const registry = new Map<
|
|
718
|
+
const registry = new Map<Element, PresenceRecord>()
|
|
599
719
|
|
|
600
720
|
// In-flight exit fibers keyed by the leaving node, so a re-entry (or this
|
|
601
721
|
// component's own teardown) can interrupt them. A Map, not Effect's `FiberMap` (#618): an exit's
|
|
602
722
|
// entry goes from inside its own `ensuring`, before its fiber has ended, and is checked right after;
|
|
603
723
|
// `FiberMap.remove` interrupts the fiber it removes, and its own removal waits for the fiber's end.
|
|
604
|
-
const exiting = new Map<
|
|
724
|
+
const exiting = new Map<Element, Fiber.Fiber<void, never>>()
|
|
605
725
|
|
|
606
726
|
// A leaving child's parts still running (ADR-0010 *Amendment (#181)*): its exit, and the handovers
|
|
607
727
|
// of the twins it handed back. It goes when the count reaches 0. Every retained child that runs its
|
|
608
728
|
// own exit is here; a twin presence left to the projection isn't.
|
|
609
|
-
const pending = new Map<
|
|
729
|
+
const pending = new Map<Element, number>()
|
|
610
730
|
// The handed-back twins of a leaving child, by it: the call that drops them, for an interrupted exit.
|
|
611
|
-
const handovers = new Map<
|
|
731
|
+
const handovers = new Map<Element, () => void>()
|
|
612
732
|
// What lets go of the twins each leaving child keeps for a late take-over (#402): called as it goes.
|
|
613
|
-
const lates = new Map<
|
|
733
|
+
const lates = new Map<Element, () => void>()
|
|
614
734
|
// The unregistration of each exit's values with the projection.
|
|
615
|
-
const exitValues = new Map<
|
|
735
|
+
const exitValues = new Map<Element, () => void>()
|
|
616
736
|
// The Wardic elements exiting inside each leaving child (#290), dropped with it.
|
|
617
|
-
const exitParts = new Map<
|
|
737
|
+
const exitParts = new Map<Element, ReadonlyArray<Element>>()
|
|
618
738
|
|
|
619
739
|
// `initial={false}` (#134): the children set up with this first render start at their
|
|
620
740
|
// `animate`; one that enters after it animates in.
|
|
621
741
|
let firstRender = true
|
|
622
742
|
|
|
623
743
|
// The children exiting now, each told once at its end (#257): completed, or interrupted.
|
|
624
|
-
const leaving = new Set<
|
|
744
|
+
const leaving = new Set<Element>()
|
|
625
745
|
// Each retained child's place when it left (#277): a framework that clears its nodes wholesale (a
|
|
626
746
|
// list emptied clears its parent) takes it out mid-exit, and it goes back there.
|
|
627
|
-
const places = new Map<
|
|
747
|
+
const places = new Map<Element, Placed>()
|
|
628
748
|
const events = options.events
|
|
629
749
|
|
|
630
750
|
// The presence hooks registered (#277's PR 5b), each told at its child's leave.
|
|
631
751
|
const watches = new Set<PresenceWatch>()
|
|
632
752
|
// The hooks each leaving child told it left, while its exit runs: told if it's cut short (#665, Q46).
|
|
633
|
-
const toldHooks = new Map<
|
|
753
|
+
const toldHooks = new Map<Element, ReadonlyArray<PresenceWatch>>()
|
|
634
754
|
|
|
635
755
|
// The children `mode="wait"` holds off the page now (#277), and the start of each ward inside one,
|
|
636
756
|
// by its element, called once the child is on the page.
|
|
637
|
-
let held: ReadonlyArray<
|
|
638
|
-
const starts = new Map<
|
|
757
|
+
let held: ReadonlyArray<Element> = []
|
|
758
|
+
const starts = new Map<Element, () => void>()
|
|
639
759
|
// `popLayout`'s leavers (#277), each where it was measured before the change: popped as it leaves,
|
|
640
760
|
// and kept until it's gone. Whether this change popped one, so the projection is told.
|
|
641
|
-
const pops = new Map<
|
|
761
|
+
const pops = new Map<Element, PopBox>()
|
|
642
762
|
let popped = false
|
|
643
763
|
// Whether this change moved a leaver from an earlier one to its place (#675), so the projection is
|
|
644
764
|
// told: a twin leaver crossfading in the flow is drawn on its Lead from where it now is.
|
|
@@ -648,25 +768,25 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
648
768
|
// child's key is known before what goes on the page is decided.
|
|
649
769
|
const made = new WeakMap<Element, Made>()
|
|
650
770
|
// The latest child exiting under each key: a child back under it takes over from that one.
|
|
651
|
-
const keyedLeavers = new Map<string | number,
|
|
771
|
+
const keyedLeavers = new Map<string | number, Element>()
|
|
652
772
|
// What each element exiting has drawn, kept by its exit's frames.
|
|
653
|
-
const draws = new Map<
|
|
773
|
+
const draws = new Map<Element, Drawn>()
|
|
654
774
|
// The children entering now that take over from a leaver, each with that leaver: taken over at
|
|
655
775
|
// the first of their wards' mounts, or the presence's next look, whichever comes first.
|
|
656
|
-
const takeovers = new Map<
|
|
776
|
+
const takeovers = new Map<Element, Element>()
|
|
657
777
|
// Where each Wardic element in a child that took over starts: read once, at its mount.
|
|
658
778
|
const seeds = new WeakMap<Element, Drawn>()
|
|
659
779
|
// The keyed leavers crossfading as twins (ADR-0010), the projection's: one taken over ends its
|
|
660
780
|
// leaving Follower at once (Q8: D).
|
|
661
|
-
const crossfades = new Set<
|
|
781
|
+
const crossfades = new Set<Element>()
|
|
662
782
|
// Where each leaver taken over painted, it and the Wardic elements inside it, in the Root frame:
|
|
663
783
|
// read as the take-over is found, before the change moves anything.
|
|
664
|
-
const leaverBoxes = new Map<
|
|
784
|
+
const leaverBoxes = new Map<Element, ReadonlyMap<Element, Box.Box>>()
|
|
665
785
|
// Whether any keyed element was made: until then, no change looks for a take-over.
|
|
666
786
|
let keyed = false
|
|
667
787
|
|
|
668
788
|
/** A child's exit starts: told, and `exiting` turns on with the first. */
|
|
669
|
-
const leaveStarts = (el:
|
|
789
|
+
const leaveStarts = (el: Element): void => {
|
|
670
790
|
leaving.add(el)
|
|
671
791
|
if (Predicate.isUndefined(events)) return
|
|
672
792
|
if (leaving.size === 1) events.exiting(true)
|
|
@@ -677,7 +797,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
677
797
|
* A child's exit ended: with the last, `exiting` turns off, a completion is told, and the children
|
|
678
798
|
* `mode="wait"` held go on the page (#277), as Motion renders them after its `onExitComplete`.
|
|
679
799
|
*/
|
|
680
|
-
const leaveEnds = (el:
|
|
800
|
+
const leaveEnds = (el: Element, completed: boolean): void => {
|
|
681
801
|
if (Bool.not(leaving.delete(el))) return
|
|
682
802
|
if (leaving.size > 0) return
|
|
683
803
|
UndefinedOr.map(events, (told) => {
|
|
@@ -702,7 +822,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
702
822
|
}
|
|
703
823
|
|
|
704
824
|
/** Whether `el` is inside a child held off the page (#277). */
|
|
705
|
-
const isHeld = (el:
|
|
825
|
+
const isHeld = (el: Element): boolean => Arr.some(held, (child) => child.contains(el))
|
|
706
826
|
|
|
707
827
|
const ctx: PresenceContextValue = {
|
|
708
828
|
register: (rec) => {
|
|
@@ -736,14 +856,14 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
736
856
|
}
|
|
737
857
|
|
|
738
858
|
// Commit a projected value-map onto a retained node via the Renderer.
|
|
739
|
-
const commitValues = (el:
|
|
859
|
+
const commitValues = (el: Element, values: Values.Values): void => {
|
|
740
860
|
const patch: Renderer.Patch = project(values)
|
|
741
861
|
commit(el, patch)
|
|
742
862
|
}
|
|
743
863
|
|
|
744
864
|
// Remove a retained node from the DOM + drop its registration + clear its
|
|
745
865
|
// in-flight fiber bookkeeping. Idempotent. `completed`: its exit ended on its own (#257).
|
|
746
|
-
const finishExit = (el:
|
|
866
|
+
const finishExit = (el: Element, completed = true): void => {
|
|
747
867
|
exiting.delete(el)
|
|
748
868
|
toldHooks.delete(el)
|
|
749
869
|
registry.delete(el)
|
|
@@ -781,7 +901,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
781
901
|
|
|
782
902
|
// One of a leaving child's parts ended (#181): it goes with the last. A child already removed
|
|
783
903
|
// (an interrupted exit's fiber ending after) is ignored.
|
|
784
|
-
const partDone = (el:
|
|
904
|
+
const partDone = (el: Element): void => {
|
|
785
905
|
const left = pending.get(el)
|
|
786
906
|
if (Predicate.isUndefined(left)) return
|
|
787
907
|
if (left > 1) {
|
|
@@ -793,7 +913,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
793
913
|
|
|
794
914
|
// Interrupt an in-flight exit for `el` (re-entry / teardown) and remove the
|
|
795
915
|
// retained node, the twins it handed back dropped with it. Idempotent.
|
|
796
|
-
const interruptExit = (el:
|
|
916
|
+
const interruptExit = (el: Element): void => {
|
|
797
917
|
// Told first, as interrupted: the exit's fiber, interrupted below, ends at once through
|
|
798
918
|
// `partDone`, which would tell it completed (#257).
|
|
799
919
|
leaveEnds(el, false)
|
|
@@ -819,7 +939,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
819
939
|
// A leaving child that isn't a twin (ADR-0010 *Amendment (#181)*): it hands back the twins inside
|
|
820
940
|
// it, then runs its own exit and the exits inside it, and goes once all have ended. A plain child
|
|
821
941
|
// (not a Wardic element, no `rec`) runs only those inside it (#392), as Motion's presence child does.
|
|
822
|
-
const leave = (el:
|
|
942
|
+
const leave = (el: Element, rec: PresenceRecord | undefined, custom: unknown, inside: ReadonlyArray<PresenceWatch>, holds: number): void => {
|
|
823
943
|
// A keyed one is what a child back under its key takes over from (#286), the latest the one.
|
|
824
944
|
UndefinedOr.map(keyOf(el), (key) => keyedLeavers.set(key, el))
|
|
825
945
|
const drop = projection.handBackWithin(el, () => partDone(el))
|
|
@@ -839,7 +959,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
839
959
|
// A twin in a leaving child taken over late (ADR-0010 *Amendment (#402)*): one more of its parts,
|
|
840
960
|
// ended with that handover, and dropped with its others by an interrupted exit. Its own exit runs on:
|
|
841
961
|
// the handover draws the twin over it.
|
|
842
|
-
const takenLate = (el:
|
|
962
|
+
const takenLate = (el: Element, drop: () => void): (() => void) => {
|
|
843
963
|
const left = pending.get(el)
|
|
844
964
|
if (Predicate.isUndefined(left)) {
|
|
845
965
|
drop()
|
|
@@ -859,15 +979,15 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
859
979
|
* The Wardic elements inside a leaving child (#290), in document order, each running its own exit
|
|
860
980
|
* with the child's: every registered one but a twin, whose crossfade replaces its exit (#181).
|
|
861
981
|
*/
|
|
862
|
-
const partsOf = (el:
|
|
982
|
+
const partsOf = (el: Element): ReadonlyArray<PresenceRecord> => Arr.filter(registeredWithin(el), isPart)
|
|
863
983
|
|
|
864
984
|
/**
|
|
865
985
|
* The records of the elements inside `el`, in document order, `undefined` for one not registered:
|
|
866
986
|
* found by walking its own elements (#392), as many steps as it has, not as the presence has records.
|
|
867
987
|
*/
|
|
868
|
-
const registeredWithin = (el:
|
|
988
|
+
const registeredWithin = (el: Element): ReadonlyArray<PresenceRecord | undefined> => {
|
|
869
989
|
if (registry.size === 0) return NO_RECORDS
|
|
870
|
-
return Arr.map(Arr.fromIterable(el.getElementsByTagName("*")), (inner) => registry.get(inner
|
|
990
|
+
return Arr.map(Arr.fromIterable(el.getElementsByTagName("*")), (inner) => registry.get(inner))
|
|
871
991
|
}
|
|
872
992
|
|
|
873
993
|
/** A registered element but a twin. */
|
|
@@ -880,14 +1000,14 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
880
1000
|
* Whether a leaving child stays to exit (#392): a Wardic element, or a plain one with something
|
|
881
1001
|
* inside it to wait for, a Wardic element (an exit to run, a twin to hand back) or a hook's hold.
|
|
882
1002
|
*/
|
|
883
|
-
const retains = (el:
|
|
1003
|
+
const retains = (el: Element): boolean => {
|
|
884
1004
|
if (registry.has(el)) return true
|
|
885
1005
|
if (holdsIn(el)) return true
|
|
886
1006
|
return registersWithin(el)
|
|
887
1007
|
}
|
|
888
1008
|
|
|
889
1009
|
/** Whether a Wardic element made under this presence is inside `el`. */
|
|
890
|
-
const registersWithin = (el:
|
|
1010
|
+
const registersWithin = (el: Element): boolean => Arr.some(registeredWithin(el), Predicate.isNotUndefined)
|
|
891
1011
|
|
|
892
1012
|
/**
|
|
893
1013
|
* A leaving child's exit, and the exits inside it (#290), as Motion's `animateVariant` runs them:
|
|
@@ -896,7 +1016,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
896
1016
|
* A plain child (no `rec`) has no exit of its own: the elements inside it are the roots (#392).
|
|
897
1017
|
* The child goes once all of them, and the handovers of the twins it handed back, have ended.
|
|
898
1018
|
*/
|
|
899
|
-
const driveExit = (el:
|
|
1019
|
+
const driveExit = (el: Element, rec: PresenceRecord | undefined, custom: unknown): void => {
|
|
900
1020
|
const parts = partsOf(el)
|
|
901
1021
|
exitParts.set(el, Arr.map(parts, (part) => part.element))
|
|
902
1022
|
const own = UndefinedOr.match(rec, { onUndefined: () => NO_OWN, onDefined: Arr.of })
|
|
@@ -936,12 +1056,8 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
936
1056
|
Effect.all(Arr.map(roots, (root) => runOf(root, NO_DELAY)), { concurrency: "unbounded", discard: true }).pipe(
|
|
937
1057
|
Effect.tapCause((cause) => Report.failure("wardic.presence: an exit failed", cause)),
|
|
938
1058
|
Effect.ensuring(Effect.sync(() => partDone(el))),
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
{ attributes: { parts: parts.length + own.length } },
|
|
942
|
-
// No call-site stack (ADR-0040, decision 2): pipeable, it's the third argument.
|
|
943
|
-
{ captureStackTrace: false },
|
|
944
|
-
),
|
|
1059
|
+
// The app's to give, with no call-site stack (#746; ADR-0040, decision 2).
|
|
1060
|
+
Spans.withSpan("wardic.presence.exit", { attributes: { parts: parts.length + own.length } }),
|
|
945
1061
|
),
|
|
946
1062
|
)
|
|
947
1063
|
exiting.set(el, fiber)
|
|
@@ -1087,7 +1203,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1087
1203
|
// The children present at the last change, and where each was, to retain one as it leaves.
|
|
1088
1204
|
let previous: ReadonlyArray<Placed> = []
|
|
1089
1205
|
// The children as the last change left them (#486): those on the page, the leavers among them.
|
|
1090
|
-
let rendered: ReadonlyArray<
|
|
1206
|
+
let rendered: ReadonlyArray<Element> = []
|
|
1091
1207
|
|
|
1092
1208
|
// Teardown: interrupt every in-flight exit + remove retained nodes, the twins they handed back
|
|
1093
1209
|
// dropped with them (no leaks). Every child running its own exit is in `pending`.
|
|
@@ -1107,21 +1223,21 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1107
1223
|
}
|
|
1108
1224
|
|
|
1109
1225
|
/** Whether a hook inside `el` holds it as it leaves (#277's PR 5b). */
|
|
1110
|
-
const holdsIn = (el:
|
|
1226
|
+
const holdsIn = (el: Element): boolean => Arr.some(watchesIn(el), (watch) => watch.holds)
|
|
1111
1227
|
|
|
1112
1228
|
/** A record whose element is off the page, dropped; a leaver's is put back first, so it stays. */
|
|
1113
|
-
const dropDetached = (el:
|
|
1229
|
+
const dropDetached = (el: Element): void => {
|
|
1114
1230
|
if (el.isConnected) return
|
|
1115
1231
|
registry.delete(el)
|
|
1116
1232
|
}
|
|
1117
1233
|
|
|
1118
1234
|
/** Pop a leaver `popLayout` measured. */
|
|
1119
|
-
const popOut = (el:
|
|
1235
|
+
const popOut = (el: Element): void => {
|
|
1120
1236
|
const box = pops.get(el)
|
|
1121
1237
|
if (Predicate.isUndefined(box)) return
|
|
1122
|
-
pin(
|
|
1238
|
+
pin(box)
|
|
1123
1239
|
// Where it was seen, through the page's scroll at this change: a router's to the top (#480).
|
|
1124
|
-
projection.keepSeen(el, (by) => movePin(
|
|
1240
|
+
projection.keepSeen(box.el, (by) => movePin(box, by))
|
|
1125
1241
|
popped = true
|
|
1126
1242
|
}
|
|
1127
1243
|
|
|
@@ -1157,9 +1273,9 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1157
1273
|
* between them. So each change places them all again, as Motion's presence renders every exiting child
|
|
1158
1274
|
* at its place.
|
|
1159
1275
|
*/
|
|
1160
|
-
const placeLeavers = (order: ReadonlyArray<
|
|
1276
|
+
const placeLeavers = (order: ReadonlyArray<Element>, kept: ReadonlySet<Element>, gone: ReadonlyMap<Element, Placed>): void => {
|
|
1161
1277
|
const anchor = anchorOf(order, gone)
|
|
1162
|
-
Arr.reduce<
|
|
1278
|
+
Arr.reduce<Element, Element | undefined>(order, undefined, (cursor, el) => {
|
|
1163
1279
|
UndefinedOr.match(gone.get(el), {
|
|
1164
1280
|
onDefined: (placed) => left(placed, backPlaceOf(placed, cursor, anchor)),
|
|
1165
1281
|
onUndefined: () => {
|
|
@@ -1177,15 +1293,15 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1177
1293
|
* the page. Solid empties a list beside a sibling around its leavers, its own nodes gone, and that's
|
|
1178
1294
|
* the sibling. With neither, `undefined`: nothing of theirs is left, as when Solid clears the parent.
|
|
1179
1295
|
*/
|
|
1180
|
-
const anchorOf = (order: ReadonlyArray<
|
|
1296
|
+
const anchorOf = (order: ReadonlyArray<Element>, gone: ReadonlyMap<Element, Placed>): ChildNode | undefined =>
|
|
1181
1297
|
Option.getOrUndefined(Option.orElse(Arr.findFirst(order, isOnPage), () => Arr.findFirst(Arr.map(order, (el) => lastNextOf(el, gone)), isOnPage)))
|
|
1182
1298
|
|
|
1183
1299
|
/** The node after a child at its last place: as the last change left it, or, an earlier leaver, as it left. */
|
|
1184
|
-
const lastNextOf = (el:
|
|
1300
|
+
const lastNextOf = (el: Element, gone: ReadonlyMap<Element, Placed>): ChildNode | undefined =>
|
|
1185
1301
|
UndefinedOr.map(UndefinedOr.match(gone.get(el), { onDefined: identity, onUndefined: () => places.get(el) }), (placed) => placed.next)
|
|
1186
1302
|
|
|
1187
1303
|
/** A leaver from an earlier change, still retained, moved to its place in the walk (#675) unless it's there already. */
|
|
1188
|
-
const moveBack = (el:
|
|
1304
|
+
const moveBack = (el: Element, cursor: Element | undefined, anchor: ChildNode | undefined): void => {
|
|
1189
1305
|
if (isInPlace(el, cursor, anchor)) return
|
|
1190
1306
|
UndefinedOr.map(places.get(el), (placed) => {
|
|
1191
1307
|
const back = backPlaceOf(placed, cursor, anchor)
|
|
@@ -1235,7 +1351,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1235
1351
|
}
|
|
1236
1352
|
|
|
1237
1353
|
/** A leave decided at the task's end (#482): kept as `exiting`, so a re-entry or the teardown interrupts it. */
|
|
1238
|
-
const decideAtTaskEnd = (el:
|
|
1354
|
+
const decideAtTaskEnd = (el: Element, decide: () => void): void => {
|
|
1239
1355
|
const fiber = runtime.runFork(
|
|
1240
1356
|
Microtask.next.pipe(
|
|
1241
1357
|
Effect.andThen(
|
|
@@ -1250,7 +1366,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1250
1366
|
}
|
|
1251
1367
|
|
|
1252
1368
|
/** What a retained leaver does: crossfade onto its twin, or run its exit, or hand back the twins inside it. */
|
|
1253
|
-
const decideLeave = (el:
|
|
1369
|
+
const decideLeave = (el: Element, rec: PresenceRecord | undefined, inside: ReadonlyArray<PresenceWatch>, holds: number): void => {
|
|
1254
1370
|
// A plain child (#392): retained, as Motion's presence child, until the exits inside it, the
|
|
1255
1371
|
// handovers of its twins and the hooks holding it (#277's PR 5b) have all ended.
|
|
1256
1372
|
if (Predicate.isUndefined(rec)) {
|
|
@@ -1295,7 +1411,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1295
1411
|
}
|
|
1296
1412
|
|
|
1297
1413
|
/** The presence hooks inside `el` (#277's PR 5b): those whose element it holds, in the order they were added. */
|
|
1298
|
-
const watchesIn = (el:
|
|
1414
|
+
const watchesIn = (el: Element): ReadonlyArray<PresenceWatch> => {
|
|
1299
1415
|
if (Predicate.isUndefined(watchesWithin)) {
|
|
1300
1416
|
const index = new Map<Element, Array<PresenceWatch>>()
|
|
1301
1417
|
Iter.forEach(watches, (watch) => UndefinedOr.map(watch.element(), (at) => indexUp(index, at, watch)))
|
|
@@ -1309,7 +1425,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1309
1425
|
* `counted`, each that holds it is one of its parts, ended by its release (once). A callback that
|
|
1310
1426
|
* throws is reported, and lets the child go.
|
|
1311
1427
|
*/
|
|
1312
|
-
const tellLeave = (el:
|
|
1428
|
+
const tellLeave = (el: Element, inside: ReadonlyArray<PresenceWatch>, counted: boolean): void => {
|
|
1313
1429
|
const custom = customNow()
|
|
1314
1430
|
if (Bool.and(counted, inside.length > 0)) toldHooks.set(el, inside)
|
|
1315
1431
|
Arr.forEach(inside, (watch) => {
|
|
@@ -1338,7 +1454,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1338
1454
|
/** A hook whose element left the page some other way, dropped (#277's PR 5b): not one a held child holds. */
|
|
1339
1455
|
const dropDetachedWatch = (watch: PresenceWatch): void => {
|
|
1340
1456
|
UndefinedOr.map(watch.element(), (at) => {
|
|
1341
|
-
if (Bool.or(at.isConnected, isHeld(at
|
|
1457
|
+
if (Bool.or(at.isConnected, isHeld(at))) return
|
|
1342
1458
|
watches.delete(watch)
|
|
1343
1459
|
watch.gone()
|
|
1344
1460
|
})
|
|
@@ -1363,7 +1479,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1363
1479
|
})
|
|
1364
1480
|
|
|
1365
1481
|
/** The Wardic elements made under this presence inside `el`, in document order, but the twins (#181). */
|
|
1366
|
-
const madeWithin = (el:
|
|
1482
|
+
const madeWithin = (el: Element): ReadonlyArray<Element> =>
|
|
1367
1483
|
Arr.filter(Arr.fromIterable(el.querySelectorAll("*")), (inner) =>
|
|
1368
1484
|
UndefinedOr.match(made.get(inner), { onUndefined: constFalse, onDefined: (m) => Bool.not(m.twin) }))
|
|
1369
1485
|
|
|
@@ -1394,7 +1510,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1394
1510
|
}
|
|
1395
1511
|
|
|
1396
1512
|
/** Where a leaver and the Wardic elements inside it paint now, in the Root frame: each one on the page. */
|
|
1397
|
-
const boxesOf = (leaver:
|
|
1513
|
+
const boxesOf = (leaver: Element): ReadonlyMap<Element, Box.Box> => {
|
|
1398
1514
|
const boxes = new Map<Element, Box.Box>()
|
|
1399
1515
|
Arr.forEach([leaver, ...Arr.map(partsOf(leaver), (part) => part.element)], (el) =>
|
|
1400
1516
|
Option.map(projection.rootBoxOf(el), (box) => boxes.set(el, box)))
|
|
@@ -1410,7 +1526,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1410
1526
|
}
|
|
1411
1527
|
|
|
1412
1528
|
// Children taken over in the change they left in: they never start an exit.
|
|
1413
|
-
const takenOver = new WeakSet<
|
|
1529
|
+
const takenOver = new WeakSet<Element>()
|
|
1414
1530
|
|
|
1415
1531
|
/**
|
|
1416
1532
|
* `el` takes over from `leaver`: each Wardic element in it starts where the one it pairs with in
|
|
@@ -1419,7 +1535,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1419
1535
|
* one's exit ends, uncompleted, as an interrupted one's does (Motion tells no completion for a key
|
|
1420
1536
|
* back); one leaving in this change never starts its exit, nor are its hooks told it left.
|
|
1421
1537
|
*/
|
|
1422
|
-
const takeOver = (el:
|
|
1538
|
+
const takeOver = (el: Element, leaver: Element): void => {
|
|
1423
1539
|
const from = registry.get(leaver)
|
|
1424
1540
|
// Gone since (its exit ended): the child enters as any other.
|
|
1425
1541
|
if (Predicate.isUndefined(from)) return
|
|
@@ -1522,7 +1638,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1522
1638
|
* the last change is leaving now and stays to exit (a Wardic element, or a plain one with something
|
|
1523
1639
|
* inside it to wait for, #392).
|
|
1524
1640
|
*/
|
|
1525
|
-
const waits = (kept: ReadonlySet<
|
|
1641
|
+
const waits = (kept: ReadonlySet<Element>): boolean =>
|
|
1526
1642
|
Bool.or(
|
|
1527
1643
|
leaving.size > 0,
|
|
1528
1644
|
Arr.some(previous, (placed) => {
|