@wardic/solid 0.0.0-stage → 1.0.0-rc.2
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/LICENSE +21 -0
- package/README.md +26 -2
- package/THIRD_PARTY_NOTICES.md +145 -0
- package/dist/browser/animation-controls.js +150 -0
- package/dist/browser/animation-controls.js.map +1 -0
- package/dist/browser/animation-frame.js +29 -0
- package/dist/browser/animation-frame.js.map +1 -0
- package/dist/browser/appear.js +727 -0
- package/dist/browser/appear.js.map +1 -0
- package/dist/browser/arc.js +21 -0
- package/dist/browser/arc.js.map +1 -0
- package/dist/browser/bridge.js +69 -0
- package/dist/browser/bridge.js.map +1 -0
- package/dist/browser/complete.js +30 -0
- package/dist/browser/complete.js.map +1 -0
- package/dist/browser/config.js +2 -0
- package/dist/browser/config.js.map +1 -0
- package/dist/browser/create-animate.js +41 -0
- package/dist/browser/create-animate.js.map +1 -0
- package/dist/browser/create-ward.js +1001 -0
- package/dist/browser/create-ward.js.map +1 -0
- package/dist/browser/cycle-index.js +17 -0
- package/dist/browser/cycle-index.js.map +1 -0
- package/dist/browser/cycle.js +31 -0
- package/dist/browser/cycle.js.map +1 -0
- package/dist/browser/directive.js +80 -0
- package/dist/browser/directive.js.map +1 -0
- package/dist/browser/drag-constraints.js +76 -0
- package/dist/browser/drag-constraints.js.map +1 -0
- package/dist/browser/drag-controls.js +51 -0
- package/dist/browser/drag-controls.js.map +1 -0
- package/dist/browser/drag-samples.js +40 -0
- package/dist/browser/drag-samples.js.map +1 -0
- package/dist/browser/drag-sensor.js +35 -0
- package/dist/browser/drag-sensor.js.map +1 -0
- package/dist/browser/drag-track.js +817 -0
- package/dist/browser/drag-track.js.map +1 -0
- package/dist/browser/drag-transition.js +56 -0
- package/dist/browser/drag-transition.js.map +1 -0
- package/dist/browser/drag.js +44 -0
- package/dist/browser/drag.js.map +1 -0
- package/dist/browser/element-style.js +67 -0
- package/dist/browser/element-style.js.map +1 -0
- package/dist/browser/element.js +353 -0
- package/dist/browser/element.js.map +1 -0
- package/dist/browser/feature-section.js +17 -0
- package/dist/browser/feature-section.js.map +1 -0
- package/dist/browser/feature.js +261 -0
- package/dist/browser/feature.js.map +1 -0
- package/dist/browser/features/all.js +10 -0
- package/dist/browser/features/all.js.map +1 -0
- package/dist/browser/features/colors.js +33 -0
- package/dist/browser/features/colors.js.map +1 -0
- package/dist/browser/features/dom-animation.js +7 -0
- package/dist/browser/features/dom-animation.js.map +1 -0
- package/dist/browser/features/dom-max.js +4 -0
- package/dist/browser/features/dom-max.js.map +1 -0
- package/dist/browser/features/drag.js +28 -0
- package/dist/browser/features/drag.js.map +1 -0
- package/dist/browser/features/focus.js +18 -0
- package/dist/browser/features/focus.js.map +1 -0
- package/dist/browser/features/hover.js +18 -0
- package/dist/browser/features/hover.js.map +1 -0
- package/dist/browser/features/in-view.js +18 -0
- package/dist/browser/features/in-view.js.map +1 -0
- package/dist/browser/features/input.js +30 -0
- package/dist/browser/features/input.js.map +1 -0
- package/dist/browser/features/keys.js +19 -0
- package/dist/browser/features/keys.js.map +1 -0
- package/dist/browser/features/layout.js +33 -0
- package/dist/browser/features/layout.js.map +1 -0
- package/dist/browser/features/pan.js +18 -0
- package/dist/browser/features/pan.js.map +1 -0
- package/dist/browser/features/press.js +12 -0
- package/dist/browser/features/press.js.map +1 -0
- package/dist/browser/focus-sensor.js +23 -0
- package/dist/browser/focus-sensor.js.map +1 -0
- package/dist/browser/frame-time.js +40 -0
- package/dist/browser/frame-time.js.map +1 -0
- package/dist/browser/gesture-callbacks.js +172 -0
- package/dist/browser/gesture-callbacks.js.map +1 -0
- package/dist/browser/gesture-features.js +29 -0
- package/dist/browser/gesture-features.js.map +1 -0
- package/dist/browser/gesture-info.js +43 -0
- package/dist/browser/gesture-info.js.map +1 -0
- package/dist/browser/hover-sensor.js +29 -0
- package/dist/browser/hover-sensor.js.map +1 -0
- package/dist/browser/imperative.js +614 -0
- package/dist/browser/imperative.js.map +1 -0
- package/dist/browser/index.js +165 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/instant.js +51 -0
- package/dist/browser/instant.js.map +1 -0
- package/dist/browser/layout-group.js +27 -0
- package/dist/browser/layout-group.js.map +1 -0
- package/dist/browser/layout-member.js +362 -0
- package/dist/browser/layout-member.js.map +1 -0
- package/dist/browser/layout-projection.js +19 -0
- package/dist/browser/layout-projection.js.map +1 -0
- package/dist/browser/layout.js +91 -0
- package/dist/browser/layout.js.map +1 -0
- package/dist/browser/live-style.js +313 -0
- package/dist/browser/live-style.js.map +1 -0
- package/dist/browser/live-value.js +252 -0
- package/dist/browser/live-value.js.map +1 -0
- package/dist/browser/motion-props.js +172 -0
- package/dist/browser/motion-props.js.map +1 -0
- package/dist/browser/owner-scope.js +29 -0
- package/dist/browser/owner-scope.js.map +1 -0
- package/dist/browser/page-point.js +92 -0
- package/dist/browser/page-point.js.map +1 -0
- package/dist/browser/presence-controller.js +1324 -0
- package/dist/browser/presence-controller.js.map +1 -0
- package/dist/browser/presence-record.js +27 -0
- package/dist/browser/presence-record.js.map +1 -0
- package/dist/browser/presence.js +207 -0
- package/dist/browser/presence.js.map +1 -0
- package/dist/browser/press-sensor.js +30 -0
- package/dist/browser/press-sensor.js.map +1 -0
- package/dist/browser/press.js +24 -0
- package/dist/browser/press.js.map +1 -0
- package/dist/browser/provider.js +445 -0
- package/dist/browser/provider.js.map +1 -0
- package/dist/browser/reactivity.js +9 -0
- package/dist/browser/reactivity.js.map +1 -0
- package/dist/browser/reorder-input.js +46 -0
- package/dist/browser/reorder-input.js.map +1 -0
- package/dist/browser/reorder.js +543 -0
- package/dist/browser/reorder.js.map +1 -0
- package/dist/browser/retarget-legs.js +1019 -0
- package/dist/browser/retarget-legs.js.map +1 -0
- package/dist/browser/runtime.js +249 -0
- package/dist/browser/runtime.js.map +1 -0
- package/dist/browser/sensors.js +172 -0
- package/dist/browser/sensors.js.map +1 -0
- package/dist/browser/server-interpolators.js +20 -0
- package/dist/browser/server-interpolators.js.map +1 -0
- package/dist/browser/server.js +20 -0
- package/dist/browser/server.js.map +1 -0
- package/dist/browser/solid-reactivity.js +26 -0
- package/dist/browser/solid-reactivity.js.map +1 -0
- package/dist/browser/spine.js +2939 -0
- package/dist/browser/spine.js.map +1 -0
- package/dist/browser/stagger.js +13 -0
- package/dist/browser/stagger.js.map +1 -0
- package/dist/browser/unstable/v2/bridge.js +76 -0
- package/dist/browser/unstable/v2/bridge.js.map +1 -0
- package/dist/browser/unstable/v2/complete.js +29 -0
- package/dist/browser/unstable/v2/complete.js.map +1 -0
- package/dist/browser/unstable/v2/config-view.js +111 -0
- package/dist/browser/unstable/v2/config-view.js.map +1 -0
- package/dist/browser/unstable/v2/create-animate.js +102 -0
- package/dist/browser/unstable/v2/create-animate.js.map +1 -0
- package/dist/browser/unstable/v2/cycle.js +30 -0
- package/dist/browser/unstable/v2/cycle.js.map +1 -0
- package/dist/browser/unstable/v2/drag-sensor.js +34 -0
- package/dist/browser/unstable/v2/drag-sensor.js.map +1 -0
- package/dist/browser/unstable/v2/element.js +393 -0
- package/dist/browser/unstable/v2/element.js.map +1 -0
- package/dist/browser/unstable/v2/feature-section.js +27 -0
- package/dist/browser/unstable/v2/feature-section.js.map +1 -0
- package/dist/browser/unstable/v2/focus-sensor.js +23 -0
- package/dist/browser/unstable/v2/focus-sensor.js.map +1 -0
- package/dist/browser/unstable/v2/hover-sensor.js +28 -0
- package/dist/browser/unstable/v2/hover-sensor.js.map +1 -0
- package/dist/browser/unstable/v2/index.js +114 -0
- package/dist/browser/unstable/v2/index.js.map +1 -0
- package/dist/browser/unstable/v2/layout-projection.js +18 -0
- package/dist/browser/unstable/v2/layout-projection.js.map +1 -0
- package/dist/browser/unstable/v2/layout.js +71 -0
- package/dist/browser/unstable/v2/layout.js.map +1 -0
- package/dist/browser/unstable/v2/lifecycle.js +455 -0
- package/dist/browser/unstable/v2/lifecycle.js.map +1 -0
- package/dist/browser/unstable/v2/live-value.js +264 -0
- package/dist/browser/unstable/v2/live-value.js.map +1 -0
- package/dist/browser/unstable/v2/presence-handle.js +146 -0
- package/dist/browser/unstable/v2/presence-handle.js.map +1 -0
- package/dist/browser/unstable/v2/presence-hooks.js +142 -0
- package/dist/browser/unstable/v2/presence-hooks.js.map +1 -0
- package/dist/browser/unstable/v2/presence.js +124 -0
- package/dist/browser/unstable/v2/presence.js.map +1 -0
- package/dist/browser/unstable/v2/press-sensor.js +29 -0
- package/dist/browser/unstable/v2/press-sensor.js.map +1 -0
- package/dist/browser/unstable/v2/provider.js +457 -0
- package/dist/browser/unstable/v2/provider.js.map +1 -0
- package/dist/browser/unstable/v2/reorder.js +663 -0
- package/dist/browser/unstable/v2/reorder.js.map +1 -0
- package/dist/browser/unstable/v2/sensors.js +138 -0
- package/dist/browser/unstable/v2/sensors.js.map +1 -0
- package/dist/browser/unstable/v2/solid-reactivity.js +82 -0
- package/dist/browser/unstable/v2/solid-reactivity.js.map +1 -0
- package/dist/browser/unstable/v2/variant-node.js +395 -0
- package/dist/browser/unstable/v2/variant-node.js.map +1 -0
- package/dist/browser/unstable/v2/w.js +23 -0
- package/dist/browser/unstable/v2/w.js.map +1 -0
- package/dist/browser/unstable/v2/waiters.js +185 -0
- package/dist/browser/unstable/v2/waiters.js.map +1 -0
- package/dist/browser/unstable/v2/ward.js +1620 -0
- package/dist/browser/unstable/v2/ward.js.map +1 -0
- package/dist/browser/unstable/v2/wardic-config.js +40 -0
- package/dist/browser/unstable/v2/wardic-config.js.map +1 -0
- package/dist/browser/unstable/v2/wardic.js +16 -0
- package/dist/browser/unstable/v2/wardic.js.map +1 -0
- package/dist/browser/variant-node.js +308 -0
- package/dist/browser/variant-node.js.map +1 -0
- package/dist/browser/variant-target.js +224 -0
- package/dist/browser/variant-target.js.map +1 -0
- package/dist/browser/variant-tree.js +394 -0
- package/dist/browser/variant-tree.js.map +1 -0
- package/dist/browser/variants.js +43 -0
- package/dist/browser/variants.js.map +1 -0
- package/dist/browser/w.js +25 -0
- package/dist/browser/w.js.map +1 -0
- package/dist/browser/ward-keys.js +2 -0
- package/dist/browser/ward-keys.js.map +1 -0
- package/dist/browser/wardic-component.js +74 -0
- package/dist/browser/wardic-component.js.map +1 -0
- package/dist/browser/wardic-config-value.js +91 -0
- package/dist/browser/wardic-config-value.js.map +1 -0
- package/dist/browser/wardic-config.js +42 -0
- package/dist/browser/wardic-config.js.map +1 -0
- package/dist/browser/wardic.js +31 -0
- package/dist/browser/wardic.js.map +1 -0
- package/dist/server/animation-controls.js +150 -0
- package/dist/server/animation-controls.js.map +1 -0
- package/dist/server/animation-frame.js +29 -0
- package/dist/server/animation-frame.js.map +1 -0
- package/dist/server/appear.js +727 -0
- package/dist/server/appear.js.map +1 -0
- package/dist/server/arc.js +21 -0
- package/dist/server/arc.js.map +1 -0
- package/dist/server/bridge.js +69 -0
- package/dist/server/bridge.js.map +1 -0
- package/dist/server/complete.js +30 -0
- package/dist/server/complete.js.map +1 -0
- package/dist/server/config.js +2 -0
- package/dist/server/config.js.map +1 -0
- package/dist/server/create-animate.js +41 -0
- package/dist/server/create-animate.js.map +1 -0
- package/dist/server/create-ward.js +1001 -0
- package/dist/server/create-ward.js.map +1 -0
- package/dist/server/cycle-index.js +17 -0
- package/dist/server/cycle-index.js.map +1 -0
- package/dist/server/cycle.js +31 -0
- package/dist/server/cycle.js.map +1 -0
- package/dist/server/directive.js +80 -0
- package/dist/server/directive.js.map +1 -0
- package/dist/server/drag-constraints.js +76 -0
- package/dist/server/drag-constraints.js.map +1 -0
- package/dist/server/drag-controls.js +51 -0
- package/dist/server/drag-controls.js.map +1 -0
- package/dist/server/drag-samples.js +40 -0
- package/dist/server/drag-samples.js.map +1 -0
- package/dist/server/drag-sensor.js +35 -0
- package/dist/server/drag-sensor.js.map +1 -0
- package/dist/server/drag-track.js +817 -0
- package/dist/server/drag-track.js.map +1 -0
- package/dist/server/drag-transition.js +56 -0
- package/dist/server/drag-transition.js.map +1 -0
- package/dist/server/drag.js +44 -0
- package/dist/server/drag.js.map +1 -0
- package/dist/server/element-style.js +67 -0
- package/dist/server/element-style.js.map +1 -0
- package/dist/server/element.js +353 -0
- package/dist/server/element.js.map +1 -0
- package/dist/server/feature-section.js +17 -0
- package/dist/server/feature-section.js.map +1 -0
- package/dist/server/feature.js +261 -0
- package/dist/server/feature.js.map +1 -0
- package/dist/server/features/all.js +10 -0
- package/dist/server/features/all.js.map +1 -0
- package/dist/server/features/colors.js +33 -0
- package/dist/server/features/colors.js.map +1 -0
- package/dist/server/features/dom-animation.js +7 -0
- package/dist/server/features/dom-animation.js.map +1 -0
- package/dist/server/features/dom-max.js +4 -0
- package/dist/server/features/dom-max.js.map +1 -0
- package/dist/server/features/drag.js +28 -0
- package/dist/server/features/drag.js.map +1 -0
- package/dist/server/features/focus.js +18 -0
- package/dist/server/features/focus.js.map +1 -0
- package/dist/server/features/hover.js +18 -0
- package/dist/server/features/hover.js.map +1 -0
- package/dist/server/features/in-view.js +18 -0
- package/dist/server/features/in-view.js.map +1 -0
- package/dist/server/features/input.js +30 -0
- package/dist/server/features/input.js.map +1 -0
- package/dist/server/features/keys.js +19 -0
- package/dist/server/features/keys.js.map +1 -0
- package/dist/server/features/layout.js +33 -0
- package/dist/server/features/layout.js.map +1 -0
- package/dist/server/features/pan.js +18 -0
- package/dist/server/features/pan.js.map +1 -0
- package/dist/server/features/press.js +12 -0
- package/dist/server/features/press.js.map +1 -0
- package/dist/server/focus-sensor.js +23 -0
- package/dist/server/focus-sensor.js.map +1 -0
- package/dist/server/frame-time.js +40 -0
- package/dist/server/frame-time.js.map +1 -0
- package/dist/server/gesture-callbacks.js +172 -0
- package/dist/server/gesture-callbacks.js.map +1 -0
- package/dist/server/gesture-features.js +29 -0
- package/dist/server/gesture-features.js.map +1 -0
- package/dist/server/gesture-info.js +43 -0
- package/dist/server/gesture-info.js.map +1 -0
- package/dist/server/hover-sensor.js +29 -0
- package/dist/server/hover-sensor.js.map +1 -0
- package/dist/server/imperative.js +614 -0
- package/dist/server/imperative.js.map +1 -0
- package/dist/server/index.js +165 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/instant.js +51 -0
- package/dist/server/instant.js.map +1 -0
- package/dist/server/layout-group.js +27 -0
- package/dist/server/layout-group.js.map +1 -0
- package/dist/server/layout-member.js +362 -0
- package/dist/server/layout-member.js.map +1 -0
- package/dist/server/layout-projection.js +19 -0
- package/dist/server/layout-projection.js.map +1 -0
- package/dist/server/layout.js +90 -0
- package/dist/server/layout.js.map +1 -0
- package/dist/server/live-style.js +313 -0
- package/dist/server/live-style.js.map +1 -0
- package/dist/server/live-value.js +252 -0
- package/dist/server/live-value.js.map +1 -0
- package/dist/server/motion-props.js +172 -0
- package/dist/server/motion-props.js.map +1 -0
- package/dist/server/owner-scope.js +29 -0
- package/dist/server/owner-scope.js.map +1 -0
- package/dist/server/page-point.js +92 -0
- package/dist/server/page-point.js.map +1 -0
- package/dist/server/presence-controller.js +1324 -0
- package/dist/server/presence-controller.js.map +1 -0
- package/dist/server/presence-record.js +27 -0
- package/dist/server/presence-record.js.map +1 -0
- package/dist/server/presence.js +207 -0
- package/dist/server/presence.js.map +1 -0
- package/dist/server/press-sensor.js +30 -0
- package/dist/server/press-sensor.js.map +1 -0
- package/dist/server/press.js +24 -0
- package/dist/server/press.js.map +1 -0
- package/dist/server/provider.js +439 -0
- package/dist/server/provider.js.map +1 -0
- package/dist/server/reactivity.js +9 -0
- package/dist/server/reactivity.js.map +1 -0
- package/dist/server/reorder-input.js +46 -0
- package/dist/server/reorder-input.js.map +1 -0
- package/dist/server/reorder.js +543 -0
- package/dist/server/reorder.js.map +1 -0
- package/dist/server/retarget-legs.js +1019 -0
- package/dist/server/retarget-legs.js.map +1 -0
- package/dist/server/runtime.js +249 -0
- package/dist/server/runtime.js.map +1 -0
- package/dist/server/sensors.js +172 -0
- package/dist/server/sensors.js.map +1 -0
- package/dist/server/server-interpolators.js +20 -0
- package/dist/server/server-interpolators.js.map +1 -0
- package/dist/server/server.js +20 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/solid-reactivity.js +26 -0
- package/dist/server/solid-reactivity.js.map +1 -0
- package/dist/server/spine.js +2939 -0
- package/dist/server/spine.js.map +1 -0
- package/dist/server/stagger.js +13 -0
- package/dist/server/stagger.js.map +1 -0
- package/dist/server/unstable/v2/bridge.js +76 -0
- package/dist/server/unstable/v2/bridge.js.map +1 -0
- package/dist/server/unstable/v2/complete.js +29 -0
- package/dist/server/unstable/v2/complete.js.map +1 -0
- package/dist/server/unstable/v2/config-view.js +111 -0
- package/dist/server/unstable/v2/config-view.js.map +1 -0
- package/dist/server/unstable/v2/create-animate.js +102 -0
- package/dist/server/unstable/v2/create-animate.js.map +1 -0
- package/dist/server/unstable/v2/cycle.js +30 -0
- package/dist/server/unstable/v2/cycle.js.map +1 -0
- package/dist/server/unstable/v2/drag-sensor.js +34 -0
- package/dist/server/unstable/v2/drag-sensor.js.map +1 -0
- package/dist/server/unstable/v2/element.js +402 -0
- package/dist/server/unstable/v2/element.js.map +1 -0
- package/dist/server/unstable/v2/feature-section.js +27 -0
- package/dist/server/unstable/v2/feature-section.js.map +1 -0
- package/dist/server/unstable/v2/focus-sensor.js +23 -0
- package/dist/server/unstable/v2/focus-sensor.js.map +1 -0
- package/dist/server/unstable/v2/hover-sensor.js +28 -0
- package/dist/server/unstable/v2/hover-sensor.js.map +1 -0
- package/dist/server/unstable/v2/index.js +114 -0
- package/dist/server/unstable/v2/index.js.map +1 -0
- package/dist/server/unstable/v2/layout-projection.js +18 -0
- package/dist/server/unstable/v2/layout-projection.js.map +1 -0
- package/dist/server/unstable/v2/layout.js +88 -0
- package/dist/server/unstable/v2/layout.js.map +1 -0
- package/dist/server/unstable/v2/lifecycle.js +455 -0
- package/dist/server/unstable/v2/lifecycle.js.map +1 -0
- package/dist/server/unstable/v2/live-value.js +264 -0
- package/dist/server/unstable/v2/live-value.js.map +1 -0
- package/dist/server/unstable/v2/presence-handle.js +146 -0
- package/dist/server/unstable/v2/presence-handle.js.map +1 -0
- package/dist/server/unstable/v2/presence-hooks.js +142 -0
- package/dist/server/unstable/v2/presence-hooks.js.map +1 -0
- package/dist/server/unstable/v2/presence.js +142 -0
- package/dist/server/unstable/v2/presence.js.map +1 -0
- package/dist/server/unstable/v2/press-sensor.js +29 -0
- package/dist/server/unstable/v2/press-sensor.js.map +1 -0
- package/dist/server/unstable/v2/provider.js +475 -0
- package/dist/server/unstable/v2/provider.js.map +1 -0
- package/dist/server/unstable/v2/reorder.js +733 -0
- package/dist/server/unstable/v2/reorder.js.map +1 -0
- package/dist/server/unstable/v2/sensors.js +138 -0
- package/dist/server/unstable/v2/sensors.js.map +1 -0
- package/dist/server/unstable/v2/solid-reactivity.js +82 -0
- package/dist/server/unstable/v2/solid-reactivity.js.map +1 -0
- package/dist/server/unstable/v2/variant-node.js +395 -0
- package/dist/server/unstable/v2/variant-node.js.map +1 -0
- package/dist/server/unstable/v2/w.js +23 -0
- package/dist/server/unstable/v2/w.js.map +1 -0
- package/dist/server/unstable/v2/waiters.js +185 -0
- package/dist/server/unstable/v2/waiters.js.map +1 -0
- package/dist/server/unstable/v2/ward.js +1653 -0
- package/dist/server/unstable/v2/ward.js.map +1 -0
- package/dist/server/unstable/v2/wardic-config.js +49 -0
- package/dist/server/unstable/v2/wardic-config.js.map +1 -0
- package/dist/server/unstable/v2/wardic.js +16 -0
- package/dist/server/unstable/v2/wardic.js.map +1 -0
- package/dist/server/variant-node.js +308 -0
- package/dist/server/variant-node.js.map +1 -0
- package/dist/server/variant-target.js +224 -0
- package/dist/server/variant-target.js.map +1 -0
- package/dist/server/variant-tree.js +394 -0
- package/dist/server/variant-tree.js.map +1 -0
- package/dist/server/variants.js +43 -0
- package/dist/server/variants.js.map +1 -0
- package/dist/server/w.js +25 -0
- package/dist/server/w.js.map +1 -0
- package/dist/server/ward-keys.js +2 -0
- package/dist/server/ward-keys.js.map +1 -0
- package/dist/server/wardic-component.js +74 -0
- package/dist/server/wardic-component.js.map +1 -0
- package/dist/server/wardic-config-value.js +91 -0
- package/dist/server/wardic-config-value.js.map +1 -0
- package/dist/server/wardic-config.js +42 -0
- package/dist/server/wardic-config.js.map +1 -0
- package/dist/server/wardic.js +31 -0
- package/dist/server/wardic.js.map +1 -0
- package/dist/solid/animation-controls.d.ts +104 -0
- package/dist/solid/animation-controls.d.ts.map +1 -0
- package/dist/solid/animation-controls.js +129 -0
- package/dist/solid/animation-controls.js.map +1 -0
- package/dist/solid/animation-frame.d.ts +11 -0
- package/dist/solid/animation-frame.d.ts.map +1 -0
- package/dist/solid/animation-frame.js +31 -0
- package/dist/solid/animation-frame.js.map +1 -0
- package/dist/solid/appear.d.ts +205 -0
- package/dist/solid/appear.d.ts.map +1 -0
- package/dist/solid/appear.js +519 -0
- package/dist/solid/appear.js.map +1 -0
- package/dist/solid/arc.d.ts +25 -0
- package/dist/solid/arc.d.ts.map +1 -0
- package/dist/solid/arc.js +21 -0
- package/dist/solid/arc.js.map +1 -0
- package/dist/solid/bridge.d.ts +53 -0
- package/dist/solid/bridge.d.ts.map +1 -0
- package/dist/solid/bridge.js +66 -0
- package/dist/solid/bridge.js.map +1 -0
- package/dist/solid/complete.d.ts +31 -0
- package/dist/solid/complete.d.ts.map +1 -0
- package/dist/solid/complete.js +27 -0
- package/dist/solid/complete.js.map +1 -0
- package/dist/solid/config.d.ts +693 -0
- package/dist/solid/config.d.ts.map +1 -0
- package/dist/solid/config.js +2 -0
- package/dist/solid/config.js.map +1 -0
- package/dist/solid/create-animate.d.ts +17 -0
- package/dist/solid/create-animate.d.ts.map +1 -0
- package/dist/solid/create-animate.js +42 -0
- package/dist/solid/create-animate.js.map +1 -0
- package/dist/solid/create-ward.d.ts +278 -0
- package/dist/solid/create-ward.d.ts.map +1 -0
- package/dist/solid/create-ward.jsx +874 -0
- package/dist/solid/create-ward.jsx.map +1 -0
- package/dist/solid/cycle-index.d.ts +7 -0
- package/dist/solid/cycle-index.d.ts.map +1 -0
- package/dist/solid/cycle-index.js +17 -0
- package/dist/solid/cycle-index.js.map +1 -0
- package/dist/solid/cycle.d.ts +21 -0
- package/dist/solid/cycle.d.ts.map +1 -0
- package/dist/solid/cycle.js +31 -0
- package/dist/solid/cycle.js.map +1 -0
- package/dist/solid/directive.d.ts +21 -0
- package/dist/solid/directive.d.ts.map +1 -0
- package/dist/solid/directive.js +76 -0
- package/dist/solid/directive.js.map +1 -0
- package/dist/solid/drag-constraints.d.ts +46 -0
- package/dist/solid/drag-constraints.d.ts.map +1 -0
- package/dist/solid/drag-constraints.js +49 -0
- package/dist/solid/drag-constraints.js.map +1 -0
- package/dist/solid/drag-controls.d.ts +50 -0
- package/dist/solid/drag-controls.d.ts.map +1 -0
- package/dist/solid/drag-controls.js +51 -0
- package/dist/solid/drag-controls.js.map +1 -0
- package/dist/solid/drag-samples.d.ts +34 -0
- package/dist/solid/drag-samples.d.ts.map +1 -0
- package/dist/solid/drag-samples.js +28 -0
- package/dist/solid/drag-samples.js.map +1 -0
- package/dist/solid/drag-sensor.d.ts +23 -0
- package/dist/solid/drag-sensor.d.ts.map +1 -0
- package/dist/solid/drag-sensor.js +33 -0
- package/dist/solid/drag-sensor.js.map +1 -0
- package/dist/solid/drag-track.d.ts +227 -0
- package/dist/solid/drag-track.d.ts.map +1 -0
- package/dist/solid/drag-track.js +631 -0
- package/dist/solid/drag-track.js.map +1 -0
- package/dist/solid/drag-transition.d.ts +20 -0
- package/dist/solid/drag-transition.d.ts.map +1 -0
- package/dist/solid/drag-transition.js +31 -0
- package/dist/solid/drag-transition.js.map +1 -0
- package/dist/solid/drag.d.ts +23 -0
- package/dist/solid/drag.d.ts.map +1 -0
- package/dist/solid/drag.js +44 -0
- package/dist/solid/drag.js.map +1 -0
- package/dist/solid/element-style.d.ts +60 -0
- package/dist/solid/element-style.d.ts.map +1 -0
- package/dist/solid/element-style.js +50 -0
- package/dist/solid/element-style.js.map +1 -0
- package/dist/solid/element.d.ts +73 -0
- package/dist/solid/element.d.ts.map +1 -0
- package/dist/solid/element.jsx +326 -0
- package/dist/solid/element.jsx.map +1 -0
- package/dist/solid/feature-section.d.ts +18 -0
- package/dist/solid/feature-section.d.ts.map +1 -0
- package/dist/solid/feature-section.js +13 -0
- package/dist/solid/feature-section.js.map +1 -0
- package/dist/solid/feature.d.ts +114 -0
- package/dist/solid/feature.d.ts.map +1 -0
- package/dist/solid/feature.js +248 -0
- package/dist/solid/feature.js.map +1 -0
- package/dist/solid/features/all.d.ts +10 -0
- package/dist/solid/features/all.d.ts.map +1 -0
- package/dist/solid/features/all.js +10 -0
- package/dist/solid/features/all.js.map +1 -0
- package/dist/solid/features/colors.d.ts +12 -0
- package/dist/solid/features/colors.d.ts.map +1 -0
- package/dist/solid/features/colors.js +34 -0
- package/dist/solid/features/colors.js.map +1 -0
- package/dist/solid/features/dom-animation.d.ts +11 -0
- package/dist/solid/features/dom-animation.d.ts.map +1 -0
- package/dist/solid/features/dom-animation.js +7 -0
- package/dist/solid/features/dom-animation.js.map +1 -0
- package/dist/solid/features/dom-max.d.ts +10 -0
- package/dist/solid/features/dom-max.d.ts.map +1 -0
- package/dist/solid/features/dom-max.js +4 -0
- package/dist/solid/features/dom-max.js.map +1 -0
- package/dist/solid/features/drag.d.ts +5 -0
- package/dist/solid/features/drag.d.ts.map +1 -0
- package/dist/solid/features/drag.js +28 -0
- package/dist/solid/features/drag.js.map +1 -0
- package/dist/solid/features/focus.d.ts +5 -0
- package/dist/solid/features/focus.d.ts.map +1 -0
- package/dist/solid/features/focus.js +16 -0
- package/dist/solid/features/focus.js.map +1 -0
- package/dist/solid/features/hover.d.ts +5 -0
- package/dist/solid/features/hover.d.ts.map +1 -0
- package/dist/solid/features/hover.js +16 -0
- package/dist/solid/features/hover.js.map +1 -0
- package/dist/solid/features/in-view.d.ts +5 -0
- package/dist/solid/features/in-view.d.ts.map +1 -0
- package/dist/solid/features/in-view.js +16 -0
- package/dist/solid/features/in-view.js.map +1 -0
- package/dist/solid/features/input.d.ts +26 -0
- package/dist/solid/features/input.d.ts.map +1 -0
- package/dist/solid/features/input.js +31 -0
- package/dist/solid/features/input.js.map +1 -0
- package/dist/solid/features/keys.d.ts +70 -0
- package/dist/solid/features/keys.d.ts.map +1 -0
- package/dist/solid/features/keys.js +26 -0
- package/dist/solid/features/keys.js.map +1 -0
- package/dist/solid/features/layout.d.ts +32 -0
- package/dist/solid/features/layout.d.ts.map +1 -0
- package/dist/solid/features/layout.js +34 -0
- package/dist/solid/features/layout.js.map +1 -0
- package/dist/solid/features/pan.d.ts +5 -0
- package/dist/solid/features/pan.d.ts.map +1 -0
- package/dist/solid/features/pan.js +16 -0
- package/dist/solid/features/pan.js.map +1 -0
- package/dist/solid/features/press.d.ts +11 -0
- package/dist/solid/features/press.d.ts.map +1 -0
- package/dist/solid/features/press.js +10 -0
- package/dist/solid/features/press.js.map +1 -0
- package/dist/solid/focus-sensor.d.ts +19 -0
- package/dist/solid/focus-sensor.d.ts.map +1 -0
- package/dist/solid/focus-sensor.js +23 -0
- package/dist/solid/focus-sensor.js.map +1 -0
- package/dist/solid/frame-time.d.ts +21 -0
- package/dist/solid/frame-time.d.ts.map +1 -0
- package/dist/solid/frame-time.js +41 -0
- package/dist/solid/frame-time.js.map +1 -0
- package/dist/solid/gesture-callbacks.d.ts +53 -0
- package/dist/solid/gesture-callbacks.d.ts.map +1 -0
- package/dist/solid/gesture-callbacks.js +184 -0
- package/dist/solid/gesture-callbacks.js.map +1 -0
- package/dist/solid/gesture-features.d.ts +28 -0
- package/dist/solid/gesture-features.d.ts.map +1 -0
- package/dist/solid/gesture-features.js +29 -0
- package/dist/solid/gesture-features.js.map +1 -0
- package/dist/solid/gesture-info.d.ts +59 -0
- package/dist/solid/gesture-info.d.ts.map +1 -0
- package/dist/solid/gesture-info.js +23 -0
- package/dist/solid/gesture-info.js.map +1 -0
- package/dist/solid/hover-sensor.d.ts +19 -0
- package/dist/solid/hover-sensor.d.ts.map +1 -0
- package/dist/solid/hover-sensor.js +23 -0
- package/dist/solid/hover-sensor.js.map +1 -0
- package/dist/solid/imperative.d.ts +195 -0
- package/dist/solid/imperative.d.ts.map +1 -0
- package/dist/solid/imperative.js +536 -0
- package/dist/solid/imperative.js.map +1 -0
- package/dist/solid/index.d.ts +180 -0
- package/dist/solid/index.d.ts.map +1 -0
- package/dist/solid/index.js +165 -0
- package/dist/solid/index.js.map +1 -0
- package/dist/solid/instant.d.ts +44 -0
- package/dist/solid/instant.d.ts.map +1 -0
- package/dist/solid/instant.js +49 -0
- package/dist/solid/instant.js.map +1 -0
- package/dist/solid/layout-group.d.ts +14 -0
- package/dist/solid/layout-group.d.ts.map +1 -0
- package/dist/solid/layout-group.js +27 -0
- package/dist/solid/layout-group.js.map +1 -0
- package/dist/solid/layout-member.d.ts +117 -0
- package/dist/solid/layout-member.d.ts.map +1 -0
- package/dist/solid/layout-member.js +164 -0
- package/dist/solid/layout-member.js.map +1 -0
- package/dist/solid/layout-projection.d.ts +22 -0
- package/dist/solid/layout-projection.d.ts.map +1 -0
- package/dist/solid/layout-projection.js +19 -0
- package/dist/solid/layout-projection.js.map +1 -0
- package/dist/solid/layout.d.ts +76 -0
- package/dist/solid/layout.d.ts.map +1 -0
- package/dist/solid/layout.jsx +80 -0
- package/dist/solid/layout.jsx.map +1 -0
- package/dist/solid/live-style.d.ts +147 -0
- package/dist/solid/live-style.d.ts.map +1 -0
- package/dist/solid/live-style.js +304 -0
- package/dist/solid/live-style.js.map +1 -0
- package/dist/solid/live-value.d.ts +144 -0
- package/dist/solid/live-value.d.ts.map +1 -0
- package/dist/solid/live-value.js +223 -0
- package/dist/solid/live-value.js.map +1 -0
- package/dist/solid/motion-props.d.ts +75 -0
- package/dist/solid/motion-props.d.ts.map +1 -0
- package/dist/solid/motion-props.js +314 -0
- package/dist/solid/motion-props.js.map +1 -0
- package/dist/solid/owner-scope.d.ts +16 -0
- package/dist/solid/owner-scope.d.ts.map +1 -0
- package/dist/solid/owner-scope.js +31 -0
- package/dist/solid/owner-scope.js.map +1 -0
- package/dist/solid/page-point.d.ts +35 -0
- package/dist/solid/page-point.d.ts.map +1 -0
- package/dist/solid/page-point.js +87 -0
- package/dist/solid/page-point.js.map +1 -0
- package/dist/solid/presence-controller.d.ts +122 -0
- package/dist/solid/presence-controller.d.ts.map +1 -0
- package/dist/solid/presence-controller.js +1207 -0
- package/dist/solid/presence-controller.js.map +1 -0
- package/dist/solid/presence-record.d.ts +167 -0
- package/dist/solid/presence-record.d.ts.map +1 -0
- package/dist/solid/presence-record.js +26 -0
- package/dist/solid/presence-record.js.map +1 -0
- package/dist/solid/presence.d.ts +95 -0
- package/dist/solid/presence.d.ts.map +1 -0
- package/dist/solid/presence.jsx +195 -0
- package/dist/solid/presence.jsx.map +1 -0
- package/dist/solid/press-sensor.d.ts +20 -0
- package/dist/solid/press-sensor.d.ts.map +1 -0
- package/dist/solid/press-sensor.js +24 -0
- package/dist/solid/press-sensor.js.map +1 -0
- package/dist/solid/press.d.ts +24 -0
- package/dist/solid/press.d.ts.map +1 -0
- package/dist/solid/press.js +19 -0
- package/dist/solid/press.js.map +1 -0
- package/dist/solid/provider.d.ts +263 -0
- package/dist/solid/provider.d.ts.map +1 -0
- package/dist/solid/provider.jsx +411 -0
- package/dist/solid/provider.jsx.map +1 -0
- package/dist/solid/reactivity.d.ts +27 -0
- package/dist/solid/reactivity.d.ts.map +1 -0
- package/dist/solid/reactivity.js +9 -0
- package/dist/solid/reactivity.js.map +1 -0
- package/dist/solid/reorder-input.d.ts +22 -0
- package/dist/solid/reorder-input.d.ts.map +1 -0
- package/dist/solid/reorder-input.js +45 -0
- package/dist/solid/reorder-input.js.map +1 -0
- package/dist/solid/reorder.d.ts +241 -0
- package/dist/solid/reorder.d.ts.map +1 -0
- package/dist/solid/reorder.jsx +427 -0
- package/dist/solid/reorder.jsx.map +1 -0
- package/dist/solid/retarget-legs.d.ts +189 -0
- package/dist/solid/retarget-legs.d.ts.map +1 -0
- package/dist/solid/retarget-legs.js +825 -0
- package/dist/solid/retarget-legs.js.map +1 -0
- package/dist/solid/runtime.d.ts +179 -0
- package/dist/solid/runtime.d.ts.map +1 -0
- package/dist/solid/runtime.js +237 -0
- package/dist/solid/runtime.js.map +1 -0
- package/dist/solid/sensors.d.ts +95 -0
- package/dist/solid/sensors.d.ts.map +1 -0
- package/dist/solid/sensors.js +154 -0
- package/dist/solid/sensors.js.map +1 -0
- package/dist/solid/server-interpolators.d.ts +13 -0
- package/dist/solid/server-interpolators.d.ts.map +1 -0
- package/dist/solid/server-interpolators.js +20 -0
- package/dist/solid/server-interpolators.js.map +1 -0
- package/dist/solid/server.d.ts +9 -0
- package/dist/solid/server.d.ts.map +1 -0
- package/dist/solid/server.js +20 -0
- package/dist/solid/server.js.map +1 -0
- package/dist/solid/solid-reactivity.d.ts +3 -0
- package/dist/solid/solid-reactivity.d.ts.map +1 -0
- package/dist/solid/solid-reactivity.js +19 -0
- package/dist/solid/solid-reactivity.js.map +1 -0
- package/dist/solid/spine.d.ts +597 -0
- package/dist/solid/spine.d.ts.map +1 -0
- package/dist/solid/spine.js +2761 -0
- package/dist/solid/spine.js.map +1 -0
- package/dist/solid/stagger.d.ts +29 -0
- package/dist/solid/stagger.d.ts.map +1 -0
- package/dist/solid/stagger.js +13 -0
- package/dist/solid/stagger.js.map +1 -0
- package/dist/solid/unstable/v2/bridge.d.ts +33 -0
- package/dist/solid/unstable/v2/bridge.d.ts.map +1 -0
- package/dist/solid/unstable/v2/bridge.js +76 -0
- package/dist/solid/unstable/v2/bridge.js.map +1 -0
- package/dist/solid/unstable/v2/complete.d.ts +21 -0
- package/dist/solid/unstable/v2/complete.d.ts.map +1 -0
- package/dist/solid/unstable/v2/complete.js +27 -0
- package/dist/solid/unstable/v2/complete.js.map +1 -0
- package/dist/solid/unstable/v2/config-view.d.ts +49 -0
- package/dist/solid/unstable/v2/config-view.d.ts.map +1 -0
- package/dist/solid/unstable/v2/config-view.js +114 -0
- package/dist/solid/unstable/v2/config-view.js.map +1 -0
- package/dist/solid/unstable/v2/create-animate.d.ts +31 -0
- package/dist/solid/unstable/v2/create-animate.d.ts.map +1 -0
- package/dist/solid/unstable/v2/create-animate.js +102 -0
- package/dist/solid/unstable/v2/create-animate.js.map +1 -0
- package/dist/solid/unstable/v2/cycle.d.ts +20 -0
- package/dist/solid/unstable/v2/cycle.d.ts.map +1 -0
- package/dist/solid/unstable/v2/cycle.js +30 -0
- package/dist/solid/unstable/v2/cycle.js.map +1 -0
- package/dist/solid/unstable/v2/drag-sensor.d.ts +23 -0
- package/dist/solid/unstable/v2/drag-sensor.d.ts.map +1 -0
- package/dist/solid/unstable/v2/drag-sensor.js +32 -0
- package/dist/solid/unstable/v2/drag-sensor.js.map +1 -0
- package/dist/solid/unstable/v2/element.d.ts +178 -0
- package/dist/solid/unstable/v2/element.d.ts.map +1 -0
- package/dist/solid/unstable/v2/element.jsx +325 -0
- package/dist/solid/unstable/v2/element.jsx.map +1 -0
- package/dist/solid/unstable/v2/feature-section.d.ts +12 -0
- package/dist/solid/unstable/v2/feature-section.d.ts.map +1 -0
- package/dist/solid/unstable/v2/feature-section.js +23 -0
- package/dist/solid/unstable/v2/feature-section.js.map +1 -0
- package/dist/solid/unstable/v2/focus-sensor.d.ts +13 -0
- package/dist/solid/unstable/v2/focus-sensor.d.ts.map +1 -0
- package/dist/solid/unstable/v2/focus-sensor.js +23 -0
- package/dist/solid/unstable/v2/focus-sensor.js.map +1 -0
- package/dist/solid/unstable/v2/hover-sensor.d.ts +12 -0
- package/dist/solid/unstable/v2/hover-sensor.d.ts.map +1 -0
- package/dist/solid/unstable/v2/hover-sensor.js +22 -0
- package/dist/solid/unstable/v2/hover-sensor.js.map +1 -0
- package/dist/solid/unstable/v2/index.d.ts +131 -0
- package/dist/solid/unstable/v2/index.d.ts.map +1 -0
- package/dist/solid/unstable/v2/index.js +114 -0
- package/dist/solid/unstable/v2/index.js.map +1 -0
- package/dist/solid/unstable/v2/layout-projection.d.ts +21 -0
- package/dist/solid/unstable/v2/layout-projection.d.ts.map +1 -0
- package/dist/solid/unstable/v2/layout-projection.js +18 -0
- package/dist/solid/unstable/v2/layout-projection.js.map +1 -0
- package/dist/solid/unstable/v2/layout.d.ts +47 -0
- package/dist/solid/unstable/v2/layout.d.ts.map +1 -0
- package/dist/solid/unstable/v2/layout.jsx +62 -0
- package/dist/solid/unstable/v2/layout.jsx.map +1 -0
- package/dist/solid/unstable/v2/lifecycle.d.ts +267 -0
- package/dist/solid/unstable/v2/lifecycle.d.ts.map +1 -0
- package/dist/solid/unstable/v2/lifecycle.js +457 -0
- package/dist/solid/unstable/v2/lifecycle.js.map +1 -0
- package/dist/solid/unstable/v2/live-value.d.ts +146 -0
- package/dist/solid/unstable/v2/live-value.d.ts.map +1 -0
- package/dist/solid/unstable/v2/live-value.js +235 -0
- package/dist/solid/unstable/v2/live-value.js.map +1 -0
- package/dist/solid/unstable/v2/presence-handle.d.ts +55 -0
- package/dist/solid/unstable/v2/presence-handle.d.ts.map +1 -0
- package/dist/solid/unstable/v2/presence-handle.js +119 -0
- package/dist/solid/unstable/v2/presence-handle.js.map +1 -0
- package/dist/solid/unstable/v2/presence-hooks.d.ts +51 -0
- package/dist/solid/unstable/v2/presence-hooks.d.ts.map +1 -0
- package/dist/solid/unstable/v2/presence-hooks.js +115 -0
- package/dist/solid/unstable/v2/presence-hooks.js.map +1 -0
- package/dist/solid/unstable/v2/presence.d.ts +89 -0
- package/dist/solid/unstable/v2/presence.d.ts.map +1 -0
- package/dist/solid/unstable/v2/presence.jsx +107 -0
- package/dist/solid/unstable/v2/presence.jsx.map +1 -0
- package/dist/solid/unstable/v2/press-sensor.d.ts +13 -0
- package/dist/solid/unstable/v2/press-sensor.d.ts.map +1 -0
- package/dist/solid/unstable/v2/press-sensor.js +23 -0
- package/dist/solid/unstable/v2/press-sensor.js.map +1 -0
- package/dist/solid/unstable/v2/provider.d.ts +239 -0
- package/dist/solid/unstable/v2/provider.d.ts.map +1 -0
- package/dist/solid/unstable/v2/provider.jsx +423 -0
- package/dist/solid/unstable/v2/provider.jsx.map +1 -0
- package/dist/solid/unstable/v2/reorder.d.ts +292 -0
- package/dist/solid/unstable/v2/reorder.d.ts.map +1 -0
- package/dist/solid/unstable/v2/reorder.jsx +525 -0
- package/dist/solid/unstable/v2/reorder.jsx.map +1 -0
- package/dist/solid/unstable/v2/sensors.d.ts +91 -0
- package/dist/solid/unstable/v2/sensors.d.ts.map +1 -0
- package/dist/solid/unstable/v2/sensors.js +124 -0
- package/dist/solid/unstable/v2/sensors.js.map +1 -0
- package/dist/solid/unstable/v2/solid-reactivity.d.ts +61 -0
- package/dist/solid/unstable/v2/solid-reactivity.d.ts.map +1 -0
- package/dist/solid/unstable/v2/solid-reactivity.js +62 -0
- package/dist/solid/unstable/v2/solid-reactivity.js.map +1 -0
- package/dist/solid/unstable/v2/variant-node.d.ts +51 -0
- package/dist/solid/unstable/v2/variant-node.d.ts.map +1 -0
- package/dist/solid/unstable/v2/variant-node.js +336 -0
- package/dist/solid/unstable/v2/variant-node.js.map +1 -0
- package/dist/solid/unstable/v2/w.d.ts +42 -0
- package/dist/solid/unstable/v2/w.d.ts.map +1 -0
- package/dist/solid/unstable/v2/w.jsx +22 -0
- package/dist/solid/unstable/v2/w.jsx.map +1 -0
- package/dist/solid/unstable/v2/waiters.d.ts +72 -0
- package/dist/solid/unstable/v2/waiters.d.ts.map +1 -0
- package/dist/solid/unstable/v2/waiters.js +175 -0
- package/dist/solid/unstable/v2/waiters.js.map +1 -0
- package/dist/solid/unstable/v2/ward.d.ts +393 -0
- package/dist/solid/unstable/v2/ward.d.ts.map +1 -0
- package/dist/solid/unstable/v2/ward.jsx +1475 -0
- package/dist/solid/unstable/v2/ward.jsx.map +1 -0
- package/dist/solid/unstable/v2/wardic-config.d.ts +68 -0
- package/dist/solid/unstable/v2/wardic-config.d.ts.map +1 -0
- package/dist/solid/unstable/v2/wardic-config.jsx +28 -0
- package/dist/solid/unstable/v2/wardic-config.jsx.map +1 -0
- package/dist/solid/unstable/v2/wardic.d.ts +28 -0
- package/dist/solid/unstable/v2/wardic.d.ts.map +1 -0
- package/dist/solid/unstable/v2/wardic.jsx +16 -0
- package/dist/solid/unstable/v2/wardic.jsx.map +1 -0
- package/dist/solid/variant-node.d.ts +32 -0
- package/dist/solid/variant-node.d.ts.map +1 -0
- package/dist/solid/variant-node.js +257 -0
- package/dist/solid/variant-node.js.map +1 -0
- package/dist/solid/variant-target.d.ts +102 -0
- package/dist/solid/variant-target.d.ts.map +1 -0
- package/dist/solid/variant-target.js +180 -0
- package/dist/solid/variant-target.js.map +1 -0
- package/dist/solid/variant-tree.d.ts +349 -0
- package/dist/solid/variant-tree.d.ts.map +1 -0
- package/dist/solid/variant-tree.js +358 -0
- package/dist/solid/variant-tree.js.map +1 -0
- package/dist/solid/variants.d.ts +21 -0
- package/dist/solid/variants.d.ts.map +1 -0
- package/dist/solid/variants.js +43 -0
- package/dist/solid/variants.js.map +1 -0
- package/dist/solid/w.d.ts +42 -0
- package/dist/solid/w.d.ts.map +1 -0
- package/dist/solid/w.jsx +23 -0
- package/dist/solid/w.jsx.map +1 -0
- package/dist/solid/ward-keys.d.ts +236 -0
- package/dist/solid/ward-keys.d.ts.map +1 -0
- package/dist/solid/ward-keys.js +2 -0
- package/dist/solid/ward-keys.js.map +1 -0
- package/dist/solid/wardic-component.d.ts +50 -0
- package/dist/solid/wardic-component.d.ts.map +1 -0
- package/dist/solid/wardic-component.js +74 -0
- package/dist/solid/wardic-component.js.map +1 -0
- package/dist/solid/wardic-config-value.d.ts +87 -0
- package/dist/solid/wardic-config-value.d.ts.map +1 -0
- package/dist/solid/wardic-config-value.js +106 -0
- package/dist/solid/wardic-config-value.js.map +1 -0
- package/dist/solid/wardic-config.d.ts +69 -0
- package/dist/solid/wardic-config.d.ts.map +1 -0
- package/dist/solid/wardic-config.jsx +30 -0
- package/dist/solid/wardic-config.jsx.map +1 -0
- package/dist/solid/wardic.d.ts +45 -0
- package/dist/solid/wardic.d.ts.map +1 -0
- package/dist/solid/wardic.jsx +31 -0
- package/dist/solid/wardic.jsx.map +1 -0
- package/package.json +98 -4
- package/src/animation-controls.ts +204 -0
- package/src/animation-frame.ts +32 -0
- package/src/appear.ts +804 -0
- package/src/arc.ts +34 -0
- package/src/bridge.ts +98 -0
- package/src/complete.ts +45 -0
- package/src/config.ts +805 -0
- package/src/create-animate.ts +41 -0
- package/src/create-ward.tsx +1271 -0
- package/src/cycle-index.ts +18 -0
- package/src/cycle.ts +34 -0
- package/src/directive.ts +87 -0
- package/src/drag-constraints.ts +103 -0
- package/src/drag-controls.ts +94 -0
- package/src/drag-samples.ts +54 -0
- package/src/drag-sensor.ts +46 -0
- package/src/drag-track.ts +937 -0
- package/src/drag-transition.ts +43 -0
- package/src/drag.ts +58 -0
- package/src/element-style.ts +112 -0
- package/src/element.tsx +400 -0
- package/src/feature-section.ts +33 -0
- package/src/feature.ts +342 -0
- package/src/features/all.ts +18 -0
- package/src/features/colors.ts +36 -0
- package/src/features/dom-animation.ts +15 -0
- package/src/features/dom-max.ts +11 -0
- package/src/features/drag.ts +30 -0
- package/src/features/focus.ts +17 -0
- package/src/features/hover.ts +17 -0
- package/src/features/in-view.ts +17 -0
- package/src/features/input.ts +42 -0
- package/src/features/keys.ts +89 -0
- package/src/features/layout.ts +54 -0
- package/src/features/pan.ts +17 -0
- package/src/features/press.ts +17 -0
- package/src/focus-sensor.ts +32 -0
- package/src/frame-time.ts +45 -0
- package/src/gesture-callbacks.ts +212 -0
- package/src/gesture-features.ts +35 -0
- package/src/gesture-info.ts +81 -0
- package/src/hover-sensor.ts +32 -0
- package/src/imperative.ts +782 -0
- package/src/index.ts +334 -0
- package/src/instant.ts +90 -0
- package/src/layout-group.ts +32 -0
- package/src/layout-member.ts +300 -0
- package/src/layout-projection.ts +28 -0
- package/src/layout.tsx +127 -0
- package/src/live-style.ts +449 -0
- package/src/live-value.ts +378 -0
- package/src/motion-props.ts +325 -0
- package/src/owner-scope.ts +31 -0
- package/src/page-point.ts +98 -0
- package/src/presence-controller.ts +1483 -0
- package/src/presence-record.ts +189 -0
- package/src/presence.tsx +269 -0
- package/src/press-sensor.ts +33 -0
- package/src/press.ts +40 -0
- package/src/provider.tsx +526 -0
- package/src/reactivity.ts +29 -0
- package/src/reorder-input.ts +53 -0
- package/src/reorder.tsx +703 -0
- package/src/retarget-legs.ts +1048 -0
- package/src/runtime.ts +388 -0
- package/src/sensors.ts +189 -0
- package/src/server-interpolators.ts +33 -0
- package/src/server.ts +21 -0
- package/src/solid-reactivity.ts +21 -0
- package/src/spine.ts +3385 -0
- package/src/stagger.ts +31 -0
- package/src/unstable/v2/bridge.ts +79 -0
- package/src/unstable/v2/complete.ts +47 -0
- package/src/unstable/v2/config-view.ts +156 -0
- package/src/unstable/v2/create-animate.ts +123 -0
- package/src/unstable/v2/cycle.ts +33 -0
- package/src/unstable/v2/drag-sensor.ts +44 -0
- package/src/unstable/v2/element.tsx +478 -0
- package/src/unstable/v2/feature-section.ts +32 -0
- package/src/unstable/v2/focus-sensor.ts +31 -0
- package/src/unstable/v2/hover-sensor.ts +30 -0
- package/src/unstable/v2/index.ts +270 -0
- package/src/unstable/v2/layout-projection.ts +27 -0
- package/src/unstable/v2/layout.tsx +89 -0
- package/src/unstable/v2/lifecycle.ts +612 -0
- package/src/unstable/v2/live-value.ts +414 -0
- package/src/unstable/v2/presence-handle.ts +159 -0
- package/src/unstable/v2/presence-hooks.ts +157 -0
- package/src/unstable/v2/presence.tsx +174 -0
- package/src/unstable/v2/press-sensor.ts +31 -0
- package/src/unstable/v2/provider.tsx +524 -0
- package/src/unstable/v2/reorder.tsx +880 -0
- package/src/unstable/v2/sensors.ts +169 -0
- package/src/unstable/v2/solid-reactivity.ts +69 -0
- package/src/unstable/v2/variant-node.ts +446 -0
- package/src/unstable/v2/w.tsx +49 -0
- package/src/unstable/v2/waiters.ts +212 -0
- package/src/unstable/v2/ward.tsx +2068 -0
- package/src/unstable/v2/wardic-config.tsx +84 -0
- package/src/unstable/v2/wardic.tsx +41 -0
- package/src/variant-node.ts +368 -0
- package/src/variant-target.ts +234 -0
- package/src/variant-tree.ts +638 -0
- package/src/variants.ts +47 -0
- package/src/w.tsx +59 -0
- package/src/ward-keys.ts +343 -0
- package/src/wardic-component.ts +96 -0
- package/src/wardic-config-value.ts +150 -0
- package/src/wardic-config.tsx +78 -0
- package/src/wardic.tsx +59 -0
|
@@ -0,0 +1,2068 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ward(config)`: a **Ward** on Solid 2 (`@wardic/solid/unstable/v2`, #209, ADR-0045). It puts one
|
|
3
|
+
* element's motion on the Solid 1 binding's spine (`../../spine.ts`): the same Override stack,
|
|
4
|
+
* Retarget, Base values and flush gate (ADR-0005, ADR-0022, ADR-0034), wired into Solid 2.
|
|
5
|
+
*
|
|
6
|
+
* A ward is a ref that carries its props:
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const card = ward({ animate: () => ({ x: open() ? 100 : 0 }) }) // in the component's body
|
|
10
|
+
* <div {...card} /> // its Starting style in server HTML
|
|
11
|
+
* <div ref={ward({ animate: { opacity: 1 } })} /> // client-only: no Starting style
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* - **It's made once per element, then spread**: in a component's body, a `<For>` callback, a root.
|
|
15
|
+
* Solid 2 runs a spread's expression again on every run of the element's props, so
|
|
16
|
+
* `{...ward(config)}` makes a new ward for the same element each time: the second one to mount
|
|
17
|
+
* it throws, naming the fix. A `ref`'s expression is run with the element's, so
|
|
18
|
+
* `ref={ward(config)}` is fine inline.
|
|
19
|
+
* - **Its props are its own keys.** `ref` (the ward), `style` (a getter) and the Starting style's
|
|
20
|
+
* attributes are enumerable, so a spread applies them; `Provider`, `read` and `atom` aren't.
|
|
21
|
+
* Solid 2's `merge` reads a function source through a memo, calling it with its previous value,
|
|
22
|
+
* so a ward called with anything but an element returns itself.
|
|
23
|
+
* - **Its config is read once, each key through an accessor where it changes** (or getters, as a
|
|
24
|
+
* component's props are): `ward({ animate: () => ({ … }) })`. A whole config as one accessor,
|
|
25
|
+
* `ward(() => ({ … }))`, throws, naming that form.
|
|
26
|
+
* - **It mounts in an effect.** Every primitive is made at setup, under the ward's owner. The ref,
|
|
27
|
+
* called during render, sets the element; an effect's apply mounts it (registers it with the
|
|
28
|
+
* gate, builds its spine) and Retargets on each change of its target or of its `when` gate.
|
|
29
|
+
* Solid 2's apply has no owner, so what a mount makes (a Live value's watch) is made under the
|
|
30
|
+
* ward's.
|
|
31
|
+
* - **Its target is compared by value** (`sameResolution`), as the Solid 1 binding's is (#470): a
|
|
32
|
+
* `style` or `transition` change in its config doesn't Retarget, as Motion's doesn't; a new variant
|
|
33
|
+
* name does, and so does a gesture layer that sets something turning on or off.
|
|
34
|
+
* - **Given to a component** (#349, ADR-0046 *Amendment (#349)*): a Wardic component's `wardRef`
|
|
35
|
+
* takes a ward, and drives its element with a ward of its own for each element, its *driving
|
|
36
|
+
* ward*: on this one's config, variant node and lifecycle, under the component's presence and with
|
|
37
|
+
* its tag. This one follows its driver (`read`, `atom`, a `next`'s gestures) while its element is
|
|
38
|
+
* mounted, one at a time, and is never mounted itself. `ward(config, { parent })` names its
|
|
39
|
+
* variant parent when it's made outside the tree. A ward on two elements on the page at once,
|
|
40
|
+
* given or spread, throws.
|
|
41
|
+
* - **Presence and layout** (PR 2 of #209): under an `<AnimatePresence>` the mount registers its exit
|
|
42
|
+
* record, kept current from its config's `exit`; a `layout`, `layoutId`, `layoutScroll` or
|
|
43
|
+
* `layoutRoot` element registers one projection node (`layout-member.ts`), re-measured when its
|
|
44
|
+
* `layoutDependency` changes. A layout node's Starting style is drawn through its projection at
|
|
45
|
+
* rest, as its first commit draws it (#245).
|
|
46
|
+
*
|
|
47
|
+
* @module
|
|
48
|
+
*/
|
|
49
|
+
import type * as Drag from "@wardic/core/Drag"
|
|
50
|
+
import type * as InputFeed from "@wardic/core/InputFeed"
|
|
51
|
+
import { tapPropagates } from "../../press.ts"
|
|
52
|
+
import * as Report from "@wardic/dom/Report"
|
|
53
|
+
import * as Renderer from "@wardic/core/Renderer"
|
|
54
|
+
import type * as Values from "@wardic/core/Values"
|
|
55
|
+
import * as DomRenderer from "@wardic/dom/DomRenderer"
|
|
56
|
+
import type * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
|
|
57
|
+
import * as Style from "@wardic/dom/Style"
|
|
58
|
+
import * as Svg from "@wardic/dom/Svg"
|
|
59
|
+
import * as Arr from "effect/Array"
|
|
60
|
+
import * as Bool from "effect/Boolean"
|
|
61
|
+
import type * as Context from "effect/Context"
|
|
62
|
+
import * as Cause from "effect/Cause"
|
|
63
|
+
import * as Effect from "effect/Effect"
|
|
64
|
+
import * as Scope from "effect/Scope"
|
|
65
|
+
import { constFalse, constTrue, constUndefined, constVoid, identity, pipe } from "effect/Function"
|
|
66
|
+
import * as Option from "effect/Option"
|
|
67
|
+
import * as Predicate from "effect/Predicate"
|
|
68
|
+
import * as UndefinedOr from "effect/UndefinedOr"
|
|
69
|
+
import { Atom } from "effect/reactivity"
|
|
70
|
+
import { isServer, type JSX, useHead } from "@solidjs/web"
|
|
71
|
+
import {
|
|
72
|
+
type Accessor,
|
|
73
|
+
createEffect,
|
|
74
|
+
createMemo,
|
|
75
|
+
createSignal,
|
|
76
|
+
createUniqueId,
|
|
77
|
+
DEV,
|
|
78
|
+
getOwner,
|
|
79
|
+
isHydrating,
|
|
80
|
+
type Owner,
|
|
81
|
+
onCleanup,
|
|
82
|
+
runWithOwner,
|
|
83
|
+
type Signal,
|
|
84
|
+
untrack,
|
|
85
|
+
} from "solid-js"
|
|
86
|
+
import type { WardConfig as SharedWardConfig, WardicValues } from "../../config.ts"
|
|
87
|
+
import { MOTION_PROPS_V2, type SolidOneCallback } from "../../motion-props.ts"
|
|
88
|
+
import * as OwnerScope from "../../owner-scope.ts"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
import { GESTURE_WORDS, serviceIn } from "../../gesture-features.ts"
|
|
95
|
+
import { inViewOptionsOf } from "../../gesture-callbacks.ts"
|
|
96
|
+
import { projectionIn, type WardicServices } from "../../runtime.ts"
|
|
97
|
+
import type { WardCheckedConfig, WardKey, WardValueOf } from "../../ward-keys.ts"
|
|
98
|
+
import { createElementStyle } from "../../element-style.ts"
|
|
99
|
+
import { createLiveStyle, type LiveSource, readLive, serverRegistryOf, split } from "../../live-style.ts"
|
|
100
|
+
import { dragTransitionOf } from "../../drag-transition.ts"
|
|
101
|
+
import { layoutOptionsOf, registrationOf, wantsLayoutNode } from "../../layout-member.ts"
|
|
102
|
+
import { useLayoutGroupId } from "./layout.tsx"
|
|
103
|
+
import { registerAnimatable } from "../../imperative.ts"
|
|
104
|
+
import { type ControlsChange, controlledConfigOf, controlledElement, isAnimationControls, subscribe, uncontrolledOf, type WardicAnimationControls } from "../../animation-controls.ts"
|
|
105
|
+
import { settingOf, type WardicConfigValue } from "../../wardic-config-value.ts"
|
|
106
|
+
import { type PresenceSeed, presenceBlocksInitial, presenceHold, presenceSeedOf } from "../../presence-record.ts"
|
|
107
|
+
import { handoffOf, setsAnimation } from "../../appear.ts"
|
|
108
|
+
import {
|
|
109
|
+
appearEntryOf,
|
|
110
|
+
applyDragDefaults,
|
|
111
|
+
dragAxisOf,
|
|
112
|
+
dragDefaultsOf,
|
|
113
|
+
draggingWithWillChange,
|
|
114
|
+
drawnAtRest,
|
|
115
|
+
followTemplate,
|
|
116
|
+
heldTransformFor,
|
|
117
|
+
registeredValuesOf,
|
|
118
|
+
type ElementSpine,
|
|
119
|
+
type ElementSpineOptions,
|
|
120
|
+
flagStartingStyle,
|
|
121
|
+
isLayoutNode,
|
|
122
|
+
makeElementSpine,
|
|
123
|
+
makeReuse,
|
|
124
|
+
exitConfigOf,
|
|
125
|
+
exitTargetOf,
|
|
126
|
+
presenceTreeOf,
|
|
127
|
+
NO_EXIT_CONFIG,
|
|
128
|
+
madeWith,
|
|
129
|
+
presenceRecordOf,
|
|
130
|
+
recordFrameOf,
|
|
131
|
+
registryOf,
|
|
132
|
+
releasingAppear,
|
|
133
|
+
type Resolution,
|
|
134
|
+
resolutionOf,
|
|
135
|
+
restingOf,
|
|
136
|
+
sameResolution,
|
|
137
|
+
serverStartingStyle,
|
|
138
|
+
snapshotOf,
|
|
139
|
+
startLinksOf,
|
|
140
|
+
startOf,
|
|
141
|
+
warnDroppedTransform,
|
|
142
|
+
withOnUpdate,
|
|
143
|
+
} from "../../spine.ts"
|
|
144
|
+
import { inheritedContext, serverVariantNode, startsAtAnimate, startsQuiet, type WardicVariantContextValue } from "../../variant-tree.ts"
|
|
145
|
+
import { followAtom } from "./bridge.ts"
|
|
146
|
+
import {
|
|
147
|
+
appearStyle,
|
|
148
|
+
useWardicAppear,
|
|
149
|
+
useWardicGate,
|
|
150
|
+
useWardicPositionalKeys,
|
|
151
|
+
useWardicDefaultTransition,
|
|
152
|
+
useBuiltProjection,
|
|
153
|
+
useWardicReducedMotion,
|
|
154
|
+
useWardicRenderer,
|
|
155
|
+
useWardicRuntime,
|
|
156
|
+
useWardicSkipAnimations,
|
|
157
|
+
useElementFeatures,
|
|
158
|
+
useFeatureRegistry,
|
|
159
|
+
} from "./provider.tsx"
|
|
160
|
+
import { type Feature, type FeatureRegistry, type FeatureSection, LAYOUT_PROPS, missingMessage, unreadColorIn } from "../../feature.ts"
|
|
161
|
+
import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED, CLIENT_ONLY_SYNC, CLIENT_ONLY_SYNC_DEFERRED, reactivityIn } from "./solid-reactivity.ts"
|
|
162
|
+
import { useWardicConfig } from "./wardic-config.tsx"
|
|
163
|
+
import { pointMapOptionOf, transformPagePointOf } from "../../wardic-config-value.ts"
|
|
164
|
+
import { configView, type Fixed, type PerKey, type PerKeyApart } from "./config-view.ts"
|
|
165
|
+
import { Lifecycle, type WardEvent, type WardEvents, type WardPressInfo, type WardSettled } from "./lifecycle.ts"
|
|
166
|
+
import { neverLands, NO_EVENTS, serverWhen } from "./waiters.ts"
|
|
167
|
+
import { usePresenceContext } from "./presence.tsx"
|
|
168
|
+
import { createVariantNode, useVariantContext, type VariantNode, WardicVariantContext } from "./variant-node.ts"
|
|
169
|
+
import type { DragTrack } from "../../drag-track.ts"
|
|
170
|
+
import { DragGesture, FocusGesture, HoverGesture, InViewGesture, PanGesture, PressGesture } from "../../features/keys.ts"
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A Wardic element's `style`: every CSS property and the transform keys (`x`,
|
|
174
|
+
* `scale`, `rotate`…), each a value or a **Live value**: an `effect/reactivity` Atom, or an
|
|
175
|
+
* accessor, uncalled (a signal, a memo, a ward's `read(key)`). A called value is a resting value:
|
|
176
|
+
* the element shows it at rest, and a return goes to where it is then. A Live value reading
|
|
177
|
+
* `undefined` (a ward's `read(key)` for a key with no value) leaves the key where it is.
|
|
178
|
+
*/
|
|
179
|
+
export type WardStyle = { readonly [K in keyof WardicValues]?: WardicValues[K] | LiveSource<number | string | undefined> | undefined }
|
|
180
|
+
|
|
181
|
+
/** A ward's config values: the element's motion, and its `style`. */
|
|
182
|
+
export interface WardConfigValues extends Omit<SharedWardConfig, SolidOneCallback> {
|
|
183
|
+
/**
|
|
184
|
+
* The element's style: Wardic's animated keys go over it, and a key no layer of the Override
|
|
185
|
+
* stack sets returns to it. Its Live values are followed through the gate.
|
|
186
|
+
*/
|
|
187
|
+
readonly style?: WardStyle | string | undefined
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* The config keys whose values are functions: read as they are, never called as accessors (#259).
|
|
192
|
+
* `dragConstraints`' function is its container's accessor (#273), read at each measure; a
|
|
193
|
+
* `transformTemplate` is called by the renderer (#443).
|
|
194
|
+
*/
|
|
195
|
+
type WardCallbackKey = "onUpdate" | "dragConstraints" | "onMeasureDragConstraints" | "transformTemplate" | "onBeforeLayoutMeasure" | "onLayoutMeasure"
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A ward's config: each key a value, or an accessor of it, read per key. A getter,
|
|
199
|
+
* a store's property or a component's prop is tracked as it's read, and an accessor is called as
|
|
200
|
+
* it's read, so a change re-runs only what reads that key; a plain value is a constant. `initial`,
|
|
201
|
+
* `drag` and its settings, and `layout` and the rest of its keys are read once, at setup.
|
|
202
|
+
*/
|
|
203
|
+
export type WardConfig = PerKey<WardConfigValues, WardCallbackKey>
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* A ward's config `C` with its transitions' entries checked against the keys each drives. A wrapper that hands its config on takes `config: WardChecked<C>` for its own
|
|
207
|
+
* `<const C extends WardConfig>`, and passes `C` on: `ward<C>(config)`.
|
|
208
|
+
*/
|
|
209
|
+
export type WardChecked<C> = WardCheckedConfig<C, PerKeyApart<WardConfigValues, WardCallbackKey>>
|
|
210
|
+
|
|
211
|
+
/** Every key a ward reads, its callbacks among them. */
|
|
212
|
+
const WARD_KEYS = [
|
|
213
|
+
"initial",
|
|
214
|
+
"animate",
|
|
215
|
+
"variants",
|
|
216
|
+
"custom",
|
|
217
|
+
"inherit",
|
|
218
|
+
"whileHover",
|
|
219
|
+
"whileTap",
|
|
220
|
+
"whileInView",
|
|
221
|
+
"whileFocus",
|
|
222
|
+
"viewport",
|
|
223
|
+
"drag",
|
|
224
|
+
"whileDrag",
|
|
225
|
+
"dragConstraints",
|
|
226
|
+
"dragElastic",
|
|
227
|
+
"dragMomentum",
|
|
228
|
+
"dragSnapToOrigin",
|
|
229
|
+
"dragTransition",
|
|
230
|
+
"dragPropagation",
|
|
231
|
+
"propagate",
|
|
232
|
+
"dragDirectionLock",
|
|
233
|
+
"dragControls",
|
|
234
|
+
"dragListener",
|
|
235
|
+
"onMeasureDragConstraints",
|
|
236
|
+
"transition",
|
|
237
|
+
"exit",
|
|
238
|
+
"layout",
|
|
239
|
+
"layoutDependency",
|
|
240
|
+
"layoutId",
|
|
241
|
+
"layoutScroll",
|
|
242
|
+
"layoutRoot",
|
|
243
|
+
"layoutAnchor",
|
|
244
|
+
"layoutCrossfade",
|
|
245
|
+
"onUpdate",
|
|
246
|
+
"transformTemplate",
|
|
247
|
+
"onBeforeLayoutMeasure",
|
|
248
|
+
"onLayoutMeasure",
|
|
249
|
+
"appear",
|
|
250
|
+
"style",
|
|
251
|
+
"key",
|
|
252
|
+
] as const satisfies ReadonlyArray<keyof WardConfigValues>
|
|
253
|
+
/** Types only: a key `WardConfigValues` gains and {@link WARD_KEYS} misses fails here. */
|
|
254
|
+
type UnreadKey = Exclude<keyof WardConfigValues, (typeof WARD_KEYS)[number]>
|
|
255
|
+
const everyKeyRead: [UnreadKey] extends [never] ? true : UnreadKey = true
|
|
256
|
+
void everyKeyRead
|
|
257
|
+
/**
|
|
258
|
+
* Types only: a Solid 2 motion prop no ward key reads fails here (#273: `whileInView` and
|
|
259
|
+
* `whileFocus` were split off the element and dropped).
|
|
260
|
+
*/
|
|
261
|
+
type UnreadProp = Exclude<(typeof MOTION_PROPS_V2)[number], (typeof WARD_KEYS)[number]>
|
|
262
|
+
const everyPropRead: [UnreadProp] extends [never] ? true : UnreadProp = true
|
|
263
|
+
void everyPropRead
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The target memo's comparison (#337): {@link sameResolution}, and a change when there's nothing to
|
|
267
|
+
* compare with. Solid 2 calls a memo's `equals` with no previous value when the memo was made inside
|
|
268
|
+
* an action's transaction, as a ward an optimistic write makes is, before anything has committed.
|
|
269
|
+
*/
|
|
270
|
+
const sameTarget = (a: Resolution | undefined, b: Resolution | undefined): boolean => {
|
|
271
|
+
if (Predicate.isUndefined(a)) return false
|
|
272
|
+
if (Predicate.isUndefined(b)) return false
|
|
273
|
+
return sameResolution(a, b)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** A ward's config read per key (#259). */
|
|
277
|
+
const WARD_VIEW = configView<WardConfigValues>(WARD_KEYS, ["onUpdate", "dragConstraints", "onMeasureDragConstraints", "transformTemplate", "onBeforeLayoutMeasure", "onLayoutMeasure"])
|
|
278
|
+
|
|
279
|
+
/** `config` read per key (#259), for a read outside a ward: a `wardic.<tag>`'s props at setup. Internal. */
|
|
280
|
+
export const wardConfigView = (config: WardConfig): WardConfigValues => WARD_VIEW.of(config)
|
|
281
|
+
|
|
282
|
+
/** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
|
|
283
|
+
const WHOLE_ACCESSOR =
|
|
284
|
+
"ward(config) takes its config as an object, read per key (#259): make a key reactive with an accessor " +
|
|
285
|
+
"(`ward({ animate: () => ({ x: x() }) })`), a getter, a store or a component's props, not the whole config " +
|
|
286
|
+
"(`ward(() => ({ … }))`)."
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* {@link Ward.read}: completion offers the keys its config animates, and any other
|
|
290
|
+
* key is accepted; a transform key reads a number, any other the type its config gives it.
|
|
291
|
+
*/
|
|
292
|
+
export interface WardRead<C> {
|
|
293
|
+
<K extends WardKey<C>>(key: K): Accessor<WardValueOf<C, K & string>>
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** The props a spread of a {@link Ward} applies. */
|
|
297
|
+
/**
|
|
298
|
+
* What {@link Ward.with} takes (the Solid 1 ward's `ward({ ref, style })`): the element's own
|
|
299
|
+
* `ref` and `style`, given where the ward is spread.
|
|
300
|
+
*/
|
|
301
|
+
export interface WardWithProps {
|
|
302
|
+
/** Called with the element beside the ward's own ref: a `ref` written after the spread would replace it. */
|
|
303
|
+
readonly ref?: ((element: HTMLElement) => void) | ReadonlyArray<(element: HTMLElement) => void> | undefined
|
|
304
|
+
/** Laid over the config's `style`, key by key: a Live value in it is followed as one in the config is. */
|
|
305
|
+
readonly style?: WardStyle | string | undefined
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** What a ward's spread gives its element: the ward itself as its `ref`, and its `style`. */
|
|
309
|
+
export interface WardProps {
|
|
310
|
+
/** The ward: Solid calls it with the element. */
|
|
311
|
+
readonly ref: (element: HTMLElement) => void
|
|
312
|
+
/**
|
|
313
|
+
* The element's style: the Starting style over the config's `style` until the gate's first
|
|
314
|
+
* commit, then the config's `style` without the keys the gate holds. Never per frame.
|
|
315
|
+
*/
|
|
316
|
+
readonly style: JSX.CSSProperties
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* A ward's mark (#349): what tells a ward given to a component's `wardRef` from a function handed the
|
|
321
|
+
* component's own ward. Internal: its value is the ward's {@link WardShare}.
|
|
322
|
+
*/
|
|
323
|
+
export const WARD: unique symbol = Symbol("wardic.ward")
|
|
324
|
+
|
|
325
|
+
/** Any ward, whatever its config: what `wardRef` takes in, and `parent`. */
|
|
326
|
+
export interface AnyWard {
|
|
327
|
+
readonly [WARD]: unknown
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A ward's own state, read by the members it shares with every other ward (#525): what they need of
|
|
332
|
+
* it, and each member's closure once made.
|
|
333
|
+
*/
|
|
334
|
+
interface WardState {
|
|
335
|
+
readonly shared: () => WardShare
|
|
336
|
+
readonly Provider: (props: { readonly children?: JSX.Element }) => JSX.Element
|
|
337
|
+
readonly read: (key: string) => Accessor<unknown>
|
|
338
|
+
readonly atom: (key: string) => Atom.Atom<unknown>
|
|
339
|
+
readonly with: (own: WardWithProps) => WardProps
|
|
340
|
+
readonly lifecycle: Lifecycle
|
|
341
|
+
settled: Accessor<WardSettled | undefined> | undefined
|
|
342
|
+
tapped: Accessor<WardPressInfo | undefined> | undefined
|
|
343
|
+
next: (<E extends WardEvent>(name: E) => Promise<WardEvents[E]>) | undefined
|
|
344
|
+
each: (<E extends WardEvent>(name: E) => AsyncIterable<WardEvents[E]>) | undefined
|
|
345
|
+
when: (<E extends WardEvent>(name: E) => Accessor<WardEvents[E]>) | undefined
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Where a ward keeps its {@link WardState}: on itself, not enumerable, so a spread never sees it. */
|
|
349
|
+
const WARD_STATE: unique symbol = Symbol("wardic.wardState")
|
|
350
|
+
|
|
351
|
+
/** A ward's {@link WardState}. */
|
|
352
|
+
const stateOf = (ward: object): WardState => (ward as { readonly [WARD_STATE]: WardState })[WARD_STATE]
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* The members every client ward shares (#525): one prototype over `Function.prototype`, so a ward is
|
|
356
|
+
* still a function, Solid's ref. Each is a getter: its closure is made at its first read and kept on
|
|
357
|
+
* that ward, so one taken off the ward still works and one never read is never made. A ward was
|
|
358
|
+
* given each as its own property, a descriptor and most a closure apiece, in one `defineProperties` a
|
|
359
|
+
* ward: the line a Solid 2 mount spent most in. A ward keeps `ref`, `style` and its attributes as its
|
|
360
|
+
* own, enumerable, as a spread and `Object.keys` read them.
|
|
361
|
+
*/
|
|
362
|
+
const WARD_MEMBER_KEYS: PropertyDescriptorMap = {
|
|
363
|
+
[WARD]: {
|
|
364
|
+
get(this: object): WardShare {
|
|
365
|
+
return stateOf(this).shared()
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
Provider: {
|
|
369
|
+
get(this: object): WardState["Provider"] {
|
|
370
|
+
return stateOf(this).Provider
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
read: {
|
|
374
|
+
get(this: object): WardState["read"] {
|
|
375
|
+
return stateOf(this).read
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
atom: {
|
|
379
|
+
get(this: object): WardState["atom"] {
|
|
380
|
+
return stateOf(this).atom
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
with: {
|
|
384
|
+
get(this: object): WardState["with"] {
|
|
385
|
+
return stateOf(this).with
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
settled: {
|
|
389
|
+
get(this: object): Accessor<WardSettled | undefined> {
|
|
390
|
+
const state = stateOf(this)
|
|
391
|
+
if (Predicate.isNotUndefined(state.settled)) return state.settled
|
|
392
|
+
const lifecycle = state.lifecycle
|
|
393
|
+
state.settled = () => lifecycle.read()
|
|
394
|
+
return state.settled
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
tapped: {
|
|
398
|
+
get(this: object): Accessor<WardPressInfo | undefined> {
|
|
399
|
+
const state = stateOf(this)
|
|
400
|
+
if (Predicate.isNotUndefined(state.tapped)) return state.tapped
|
|
401
|
+
const lifecycle = state.lifecycle
|
|
402
|
+
state.tapped = () => lifecycle.tapped()
|
|
403
|
+
return state.tapped
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
next: {
|
|
407
|
+
get(this: object): NonNullable<WardState["next"]> {
|
|
408
|
+
const state = stateOf(this)
|
|
409
|
+
if (Predicate.isNotUndefined(state.next)) return state.next
|
|
410
|
+
const lifecycle = state.lifecycle
|
|
411
|
+
const next = <E extends WardEvent>(name: E): Promise<WardEvents[E]> => lifecycle.wait(name)
|
|
412
|
+
state.next = next
|
|
413
|
+
return next
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
each: {
|
|
417
|
+
get(this: object): NonNullable<WardState["each"]> {
|
|
418
|
+
const state = stateOf(this)
|
|
419
|
+
if (Predicate.isNotUndefined(state.each)) return state.each
|
|
420
|
+
const lifecycle = state.lifecycle
|
|
421
|
+
const each = <E extends WardEvent>(name: E): AsyncIterable<WardEvents[E]> => lifecycle.each(name)
|
|
422
|
+
state.each = each
|
|
423
|
+
return each
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
when: {
|
|
427
|
+
get(this: object): NonNullable<WardState["when"]> {
|
|
428
|
+
const state = stateOf(this)
|
|
429
|
+
if (Predicate.isNotUndefined(state.when)) return state.when
|
|
430
|
+
const lifecycle = state.lifecycle
|
|
431
|
+
const when = <E extends WardEvent>(name: E): Accessor<WardEvents[E]> => lifecycle.when(name)
|
|
432
|
+
state.when = when
|
|
433
|
+
return when
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`. */
|
|
439
|
+
const WARD_MEMBERS: object = /*#__PURE__*/ Object.create(Function.prototype, WARD_MEMBER_KEYS)
|
|
440
|
+
|
|
441
|
+
/** `ward(config, options)`'s options. */
|
|
442
|
+
export interface WardOptions {
|
|
443
|
+
/**
|
|
444
|
+
* Its variant parent, for a ward made outside the tree its element renders in: it
|
|
445
|
+
* inherits that ward's variant names and transition, and joins its stagger and `when`, as an
|
|
446
|
+
* element rendered under it would. Stagger counts children in the order they're made. Left out,
|
|
447
|
+
* it's the one where the ward is made. A ward given to a component with none, under another
|
|
448
|
+
* variant parent it would inherit from, is an error.
|
|
449
|
+
*/
|
|
450
|
+
readonly parent?: AnyWard | undefined
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* One element's motion binding: a ref carrying its props (see the module). Spread it, give it to
|
|
455
|
+
* `ref` (alone, or in an array with your own), or give it to a Wardic component's `wardRef`.
|
|
456
|
+
*/
|
|
457
|
+
export interface Ward<C extends WardConfig = WardConfig> extends WardProps, AnyWard {
|
|
458
|
+
/** Mounts the ward on `element`: Solid calls it as a ref. */
|
|
459
|
+
(element: HTMLElement): void
|
|
460
|
+
/**
|
|
461
|
+
* Its spread's props alone: what Solid 2's `merge` reads when the ward is spread, calling it
|
|
462
|
+
* as a function source. Only `ref`, `style` and the Starting style's attributes, on no prototype, so
|
|
463
|
+
* none of the ward's own names (`name`, `length`, `read`, `next`…) shadows the element's props.
|
|
464
|
+
*/
|
|
465
|
+
(previous?: unknown): WardProps
|
|
466
|
+
/**
|
|
467
|
+
* Hands this element's variant context to the subtree: its Variant children
|
|
468
|
+
* inherit its variant name and transition, and join its stagger and `when`.
|
|
469
|
+
*/
|
|
470
|
+
readonly Provider: (props: { readonly children?: JSX.Element }) => JSX.Element
|
|
471
|
+
/**
|
|
472
|
+
* The element's value for `key`, as an accessor: what Wardic shows
|
|
473
|
+
* for it, whoever moves it, as a number for a transform key (`x`, not its `transform`). At rest
|
|
474
|
+
* outside the gate, its `initial`, else its `style` value, else a transform key's identity. One
|
|
475
|
+
* accessor a key, made at the first ask. Read, not `value` (the Solid 1 ward's name): a spread
|
|
476
|
+
* would give it to `<li>`'s and `<input>`'s `value`. Its keys are typed from the config.
|
|
477
|
+
*/
|
|
478
|
+
readonly read: WardRead<C>
|
|
479
|
+
/** The element's value for `key` as an `effect/reactivity` Atom, `undefined` while the gate doesn't hold the key. */
|
|
480
|
+
readonly atom: <K extends WardKey<C>>(key: K) => Atom.Atom<WardValueOf<C, K & string> | undefined>
|
|
481
|
+
/**
|
|
482
|
+
* The element's last landing, as an async value: `undefined` before the first,
|
|
483
|
+
* ready from its first read, and pending while a Retarget runs, keeping the last landing meanwhile.
|
|
484
|
+
* `isPending(() => card.settled())` is "animating"; `card.settled()?.definition` is what landed:
|
|
485
|
+
* the variant name `animate` changed to, else the target values. Solid 1's
|
|
486
|
+
* `onAnimationStart` / `onAnimationComplete` have no place here.
|
|
487
|
+
*/
|
|
488
|
+
readonly settled: Accessor<WardSettled | undefined>
|
|
489
|
+
/**
|
|
490
|
+
* The element's last tap, as an async value, as {@link settled} is its last
|
|
491
|
+
* landing: `undefined` before the first, ready from its first read, and pending while a press is
|
|
492
|
+
* held, from a pointer or a key (a **Keyboard press**), keeping the last tap meanwhile. So
|
|
493
|
+
* `isPending(() => card.tapped())` is "pressed". A tap resolves it to the tap's event (its `point`,
|
|
494
|
+
* its `input`, its element); a cancel, or a press a drag took over, keeps the last tap. Its first read
|
|
495
|
+
* asks for the press, as `next("tap")` does: the ward runs its recognizer, and its element is made
|
|
496
|
+
* focusable.
|
|
497
|
+
*
|
|
498
|
+
* ```tsx
|
|
499
|
+
* <button {...send}>{isPending(() => send.tapped()) ? "Release to send" : "Send"}</button>
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
readonly tapped: Accessor<WardPressInfo | undefined>
|
|
503
|
+
/**
|
|
504
|
+
* A promise of the element's next `name` after the call, to `await` in a handler
|
|
505
|
+
* or an action:
|
|
506
|
+
* - `"settled"`: its next landing. A Retarget the next one interrupts doesn't land; it waits for
|
|
507
|
+
* one that does.
|
|
508
|
+
* - `"hoverStart"`, `"hoverEnd"`, `"pressStart"`, `"tap"`, `"tapCancel"`: Motion's hover and tap
|
|
509
|
+
* events, with the pointer's `point` in the viewport. A press a drag took over is neither a
|
|
510
|
+
* tap nor a cancel.
|
|
511
|
+
* - `"hover"`: the pointer over the element while it's hovered, its start (after
|
|
512
|
+
* `"hoverStart"`) and each move, as `"drag"` is a drag's. Wardic's own: Motion's hover has only
|
|
513
|
+
* a start and an end.
|
|
514
|
+
* - `"dragStart"`, `"drag"` (its start and each move), `"dragEnd"`: a drag's, with its `point`,
|
|
515
|
+
* `offset`, `delta` and `velocity`; `"dragTransitionEnd"`, its release at rest. A ward that
|
|
516
|
+
* doesn't drag never has one.
|
|
517
|
+
* - `"panSessionStart"` (with its `point`), `"panStart"`, `"pan"`, `"panEnd"`: a pan's, as a
|
|
518
|
+
* drag's. A pan moves nothing; once started, a press it took over is neither a tap nor a cancel.
|
|
519
|
+
*
|
|
520
|
+
* A gesture's event starts its recognizer, if its `while*` hasn't. Rejected with a
|
|
521
|
+
* `DOMException` named `"AbortError"` once the ward is disposed.
|
|
522
|
+
*/
|
|
523
|
+
readonly next: <E extends WardEvent>(name: E) => Promise<WardEvents[E]>
|
|
524
|
+
/**
|
|
525
|
+
* Every `name` from the call on, as an async iterable, for a `for await`: each step waits as
|
|
526
|
+
* `next(name)` does, so one that comes while its body runs is missed; the loop ends once the ward is
|
|
527
|
+
* disposed, with no `AbortError`. To act on each one in an effect, use {@link when}: a memo over
|
|
528
|
+
* `each` misses one between its steps, and on a page rendered on the server it needs
|
|
529
|
+
* `ssrSource: "client"` and a `<Loading>`.
|
|
530
|
+
*/
|
|
531
|
+
readonly each: <E extends WardEvent>(name: E) => AsyncIterable<WardEvents[E]>
|
|
532
|
+
/**
|
|
533
|
+
* Every `name`, as a memo for an effect: pending until the first, so the effect runs at each
|
|
534
|
+
* one and never before, typed as the event, on any page (no `ssrSource`, no `<Loading>`). It hears
|
|
535
|
+
* each one as it's told, so none is lost between steps; several in one flush run the effect once,
|
|
536
|
+
* with the latest. A failure (`"settled"`'s) goes to the effect's `error` arm
|
|
537
|
+
* (`createEffect(card.when("settled"), { effect, error })`); without one, Solid logs it and skips
|
|
538
|
+
* the run. Read it in an effect, not in the element's own JSX, whose region it would wait on. Call
|
|
539
|
+
* it in a component's body, as `createMemo`.
|
|
540
|
+
*
|
|
541
|
+
* ```tsx
|
|
542
|
+
* const card = ward({ drag: "x" })
|
|
543
|
+
* createEffect(card.when("dragEnd"), (release) => {
|
|
544
|
+
* if (Math.abs(release.offset.x) >= 120) dismiss(release.offset.x < 0 ? "left" : "right")
|
|
545
|
+
* })
|
|
546
|
+
* ```
|
|
547
|
+
*/
|
|
548
|
+
readonly when: <E extends WardEvent>(name: E) => Accessor<WardEvents[E]>
|
|
549
|
+
/**
|
|
550
|
+
* The ward's props with the element's own (the Solid 1 ward's `ward({ ref, style })`): its
|
|
551
|
+
* `ref` called beside the ward's, and its `style` over the config's, key by key. For a style made
|
|
552
|
+
* after the ward, a value derived from the ward's own:
|
|
553
|
+
*
|
|
554
|
+
* ```tsx
|
|
555
|
+
* const swipe = ward({ drag: "x", dragSnapToOrigin: true })
|
|
556
|
+
* const opacity = createTransform(swipe.read("x"), [-150, 0, 150], [0, 1, 0])
|
|
557
|
+
* <div {...swipe.with({ style: { opacity } })} />
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
* The latest call's props are the element's. A spread runs it again on every run of the element's
|
|
561
|
+
* props, which makes nothing new: a ward is made once.
|
|
562
|
+
*/
|
|
563
|
+
readonly with: (props: WardWithProps) => WardProps
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/** What a `wardic.*` component or a `<Reorder>` item adds to a ward. Internal. */
|
|
567
|
+
/**
|
|
568
|
+
* The config keys that want a gesture on Solid 2 (#525), as the ward's `wants*` read them: an element
|
|
569
|
+
* given none, its keys fixed, is `gestureless`. Pan is wanted only through the lifecycle.
|
|
570
|
+
*/
|
|
571
|
+
export const GESTURE_KEYS = ["whileHover", "whileTap", "whileInView", "whileFocus"] as const
|
|
572
|
+
|
|
573
|
+
export interface WardInternals {
|
|
574
|
+
/** Its tag, so an SVG element's attribute keys render as attributes. */
|
|
575
|
+
readonly tag?: string | undefined
|
|
576
|
+
/**
|
|
577
|
+
* Its config can never want a gesture (#525): its keys are fixed and it was given none of
|
|
578
|
+
* `GESTURE_KEYS`. It watches for a late one only from its first want through its lifecycle (a
|
|
579
|
+
* `next("tap")`), so a Feature that arrives lazily still starts it.
|
|
580
|
+
*/
|
|
581
|
+
readonly gestureless?: boolean | undefined
|
|
582
|
+
/**
|
|
583
|
+
* Set a drag element's defaults on the element at mount: a `wardic.create(Component)` wrap's,
|
|
584
|
+
* whose component may not pass `style` and `draggable` on (as on the Solid 1 binding).
|
|
585
|
+
*/
|
|
586
|
+
readonly defaultsOnElement?: boolean | undefined
|
|
587
|
+
/**
|
|
588
|
+
* A `<Reorder>` item's drag (ADR-0019 *Amendment (Reorder)*, ADR-0020): the gesture's axis, read
|
|
589
|
+
* at each drag's start and held until its end (`true` = free); it makes the element draggable
|
|
590
|
+
* with no `drag` in its config.
|
|
591
|
+
*/
|
|
592
|
+
readonly dragAxis?: (() => boolean | "x" | "y") | undefined
|
|
593
|
+
/** A `<Reorder>` item's: each drag sample, after its projection write. */
|
|
594
|
+
readonly onDragSample?: ((sample: Drag.Sample) => void) | undefined
|
|
595
|
+
/** A `<Reorder>` item's: its projection node's handle, once registered; what it returns is called at unmount. */
|
|
596
|
+
readonly onLayoutHandle?: ((handle: ProjectionSystem.NodeHandle) => () => void) | undefined
|
|
597
|
+
/** A `<Reorder>` item's: its node raised while dragged. */
|
|
598
|
+
readonly raiseWhileDragged?: boolean | undefined
|
|
599
|
+
/** A `<Reorder>` item's: its Enter and Space are its **Keyboard reorder**'s (ADR-0037), so its press hears no keys (#427). */
|
|
600
|
+
readonly keysTaken?: boolean | undefined
|
|
601
|
+
/** A `<Reorder>` item's: whether a **Keyboard reorder** has it lifted (ADR-0037), which turns its `whileDrag` on. */
|
|
602
|
+
readonly lifted?: Accessor<boolean> | undefined
|
|
603
|
+
/** A `<Reorder>` item's base style (its `touch-action`), under the user's style, over the drag defaults. */
|
|
604
|
+
readonly baseStyle?: (() => object | undefined) | undefined
|
|
605
|
+
/**
|
|
606
|
+
* Told the element at mount, and how to run a watch in its watch Scope (#379), with the ward's
|
|
607
|
+
* `onDefect`: closed at the unmount. What it returns is called at unmount.
|
|
608
|
+
*/
|
|
609
|
+
readonly onMount?: ((element: HTMLElement, watch: (make: (onDefect: InputFeed.OnDefect) => Effect.Effect<void, never, Scope.Scope | WardicServices>) => void) => () => void) | undefined
|
|
610
|
+
/** Values fixed over the config's, read as its own are: a `<Reorder>` item's `layout`, its Layout mode. */
|
|
611
|
+
readonly fixed?: Fixed<WardConfigValues> | undefined
|
|
612
|
+
/** A `<Reorder>` item's group, which `Reorder.Item` checks a given item against (#349). */
|
|
613
|
+
readonly group?: unknown
|
|
614
|
+
/** The component it's made for, named in its errors (#349). */
|
|
615
|
+
readonly name?: string | undefined
|
|
616
|
+
/** Its variant parent, given (`ward(config, { parent })`, #349). */
|
|
617
|
+
readonly parent?: AnyWard | undefined
|
|
618
|
+
/**
|
|
619
|
+
* The ward given to the component this one drives an element for (#349): its config, variant node
|
|
620
|
+
* and lifecycle are this one's, and it follows this one's element while it's mounted.
|
|
621
|
+
*/
|
|
622
|
+
readonly share?: WardShare | undefined
|
|
623
|
+
/** The Features it brings beside its section's (#511): a Complete element's every one. None for a Slim element. */
|
|
624
|
+
readonly brings?: ReadonlyArray<Feature> | undefined
|
|
625
|
+
/** Whether it's a **Complete element** (#511): an error in development under a `strict` section. */
|
|
626
|
+
readonly complete?: boolean | undefined
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* What a ward shares with the wards a component given it makes, one an element (#349). Internal:
|
|
632
|
+
* a ward's {@link WARD} value.
|
|
633
|
+
*/
|
|
634
|
+
export interface WardShare {
|
|
635
|
+
/** Its config, as it was given. */
|
|
636
|
+
readonly config: WardConfig
|
|
637
|
+
/** Its config at setup: what a component reads of it (its Provider, the parent check). */
|
|
638
|
+
readonly setup: WardConfigValues
|
|
639
|
+
/** What made it adds (a `<Reorder>` item's), and its parent. */
|
|
640
|
+
readonly internal: WardInternals
|
|
641
|
+
/** The variant context it was made under, or its given parent's. */
|
|
642
|
+
readonly parent: WardicVariantContextValue | undefined
|
|
643
|
+
/** Whether its parent was given (`ward(config, { parent })`). */
|
|
644
|
+
readonly chosen: boolean
|
|
645
|
+
/**
|
|
646
|
+
* Whether it carries its variants (#398): its config sets `variants` or `inherit`. One that doesn't
|
|
647
|
+
* is a **Listening ward**: the element it's given to builds its own variant node from its own
|
|
648
|
+
* props, where it renders or under the chosen parent.
|
|
649
|
+
*/
|
|
650
|
+
readonly carries: boolean
|
|
651
|
+
/** What its `.Provider` hands down: a child's `parent` given as this ward. */
|
|
652
|
+
readonly provided: WardicVariantContextValue | undefined
|
|
653
|
+
/** The **Layout group** it was made in (#432): its `layoutId`'s namespace, on whatever element it's given to. */
|
|
654
|
+
readonly layoutGroup: string | undefined
|
|
655
|
+
/** Its variant node, on the client: a driving ward's. */
|
|
656
|
+
readonly node: VariantNode | undefined
|
|
657
|
+
/** Its lifecycle, on the client: a driving ward's, so `settled`, `next` and `each` hear it. */
|
|
658
|
+
readonly lifecycle: Lifecycle | undefined
|
|
659
|
+
/**
|
|
660
|
+
* A driving ward's element mounted: this ward follows it until the returned release. One at a
|
|
661
|
+
* time: `name` (the component) is in the error a second one throws.
|
|
662
|
+
*/
|
|
663
|
+
readonly drive: (driver: Driver, name: string) => () => void
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/** A ward driving an element for a given ward (#349): what the given ward's `read`, `atom` and `next` follow. */
|
|
667
|
+
export interface Driver {
|
|
668
|
+
/** Start the recognizers a `next` now asks for, on its element. */
|
|
669
|
+
readonly wanted: () => void
|
|
670
|
+
/** Its `read(key)`'s Atom: what it shows for `key`. */
|
|
671
|
+
readonly readAtom: (key: string) => Atom.Atom<unknown>
|
|
672
|
+
/** Its `atom(key)`: the gate's output for `key`. */
|
|
673
|
+
readonly atom: (key: string) => Atom.Atom<unknown>
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** A ward's share, or `undefined` for anything else (a function handed a component's own ward). */
|
|
677
|
+
export const shareOf = (value: unknown): WardShare | undefined => {
|
|
678
|
+
if (Bool.not(Predicate.hasProperty(value, WARD))) return undefined
|
|
679
|
+
return (value as Record<typeof WARD, WardShare>)[WARD]
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/** A ward driving an element while another is: a ward drives one element at a time (#349's Q5). */
|
|
683
|
+
const secondElement = (name: string): string =>
|
|
684
|
+
`${name}: this ward is already on another element. A ward drives one element at a time: make one for each element, ` +
|
|
685
|
+
"in the <For> callback or a component of its own, rather than giving or spreading the same one twice."
|
|
686
|
+
|
|
687
|
+
/** Whether `other` is an element other than `el` still on the page (#349's Q5). */
|
|
688
|
+
const stillOn = (other: HTMLElement | undefined, el: HTMLElement | undefined): boolean => {
|
|
689
|
+
if (Predicate.isUndefined(other)) return false
|
|
690
|
+
return Bool.and(other !== el, other.isConnected)
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/** What a ward's errors call it: the component it drives an element for, else `ward(config)`. */
|
|
694
|
+
const nameOf = (internal: WardInternals): string => UndefinedOr.match(internal.name, { onUndefined: () => "ward(config)", onDefined: identity })
|
|
695
|
+
|
|
696
|
+
/** What a Slim element tells its ward: it brings no Feature of its own (#511). */
|
|
697
|
+
export const SLIM: WardInternals = {}
|
|
698
|
+
/** A ward's internals from `ward()`'s options: its chosen parent, if any. */
|
|
699
|
+
export const internalsOf = (options: WardOptions | undefined, kind: WardInternals): WardInternals => {
|
|
700
|
+
if (Predicate.isUndefined(options)) return kind
|
|
701
|
+
if (Predicate.isUndefined(options.parent)) return kind
|
|
702
|
+
return { ...kind, parent: options.parent }
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Which gesture layers are on, and on which element: one value, so the target memo reads one signal
|
|
707
|
+
* for the three (#259), recorded on its element, so a ward moved to another reads none there.
|
|
708
|
+
*/
|
|
709
|
+
interface Gestures {
|
|
710
|
+
readonly element: HTMLElement | undefined
|
|
711
|
+
readonly inView: boolean
|
|
712
|
+
readonly focused: boolean
|
|
713
|
+
readonly hovered: boolean
|
|
714
|
+
readonly pressed: boolean
|
|
715
|
+
readonly dragging: boolean
|
|
716
|
+
}
|
|
717
|
+
const NO_GESTURES: Gestures = { element: undefined, inView: false, focused: false, hovered: false, pressed: false, dragging: false }
|
|
718
|
+
/** A gesture layer of {@link Gestures}. */
|
|
719
|
+
type GestureLayer = "inView" | "focused" | "hovered" | "pressed" | "dragging"
|
|
720
|
+
|
|
721
|
+
/** Whether a ward's call is Solid applying it as a ref. */
|
|
722
|
+
const isElement = (value: unknown): value is HTMLElement => Predicate.hasProperty(value, "nodeType")
|
|
723
|
+
|
|
724
|
+
/** A context value as Solid 2's context takes it: `null` for none. */
|
|
725
|
+
const contextOf = (value: WardicVariantContextValue | undefined): WardicVariantContextValue | null => Option.getOrNull(Option.fromUndefinedOr(value))
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Says, once per provider, that a colour of the element's needs the `colors` Feature (#511, ADR-0067
|
|
729
|
+
* decision 7): a value naming a wide-gamut space, while the page reads none, outside a lazy load.
|
|
730
|
+
* Development only (its caller's `DEV`).
|
|
731
|
+
*/
|
|
732
|
+
const warnUnreadColors = (registry: FeatureRegistry, features: FeatureSection, values: () => Values.Values): void => {
|
|
733
|
+
createEffect(
|
|
734
|
+
() => {
|
|
735
|
+
if (features.pending()) return undefined
|
|
736
|
+
return unreadColorIn(values())
|
|
737
|
+
},
|
|
738
|
+
(unread) => {
|
|
739
|
+
if (Predicate.isUndefined(unread)) return
|
|
740
|
+
registry.warnOnce("colors", missingMessage("colors", `The colour \`${unread}\``, "@wardic/solid/unstable/v2"))
|
|
741
|
+
},
|
|
742
|
+
CLIENT_ONLY,
|
|
743
|
+
)
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/** Whether a config carries its variants (#398): it sets `variants` or `inherit`. */
|
|
747
|
+
const carriesVariants = (config: WardConfigValues): boolean => Bool.or(Predicate.isNotUndefined(config.variants), Predicate.isNotUndefined(config.inherit))
|
|
748
|
+
|
|
749
|
+
/** A child made with `{ parent }` naming a Listening ward (#398's Q10). */
|
|
750
|
+
const LISTENING_PARENT =
|
|
751
|
+
"ward(config, { parent }): the parent given carries no variants (no `variants` or `inherit` in its ward({ … })): it only listens, " +
|
|
752
|
+
"and its element's props hold its variants, so a child can't join it by `{ parent }` (#398). Render the child inside that " +
|
|
753
|
+
"ward's element, where it joins through the tree, or put the variants in the parent's ward({ … })."
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* The **Layout group** a ward's `layoutId` goes in (#432): the one it's made in, as its presence and
|
|
757
|
+
* variant parent are; a driving ward's is its given ward's, where that was made, unless the element's
|
|
758
|
+
* own props set the `layoutId` (#398), which is then the element's.
|
|
759
|
+
*/
|
|
760
|
+
const layoutGroupFor = (share: WardShare | undefined, fixed: WardInternals["fixed"]): string | undefined => {
|
|
761
|
+
if (Predicate.isUndefined(share)) return useLayoutGroupId()
|
|
762
|
+
if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return useLayoutGroupId()
|
|
763
|
+
return share.layoutGroup
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* The variant context a ward is made under (#349): a driving ward's given ward's, else its given
|
|
768
|
+
* parent's, else the one around it. A driving ward for a Listening ward (#398) takes the one around
|
|
769
|
+
* its element instead, unless the ward's parent was chosen: its element builds its own node there.
|
|
770
|
+
*/
|
|
771
|
+
const variantParentOf = (internal: WardInternals): WardicVariantContextValue | undefined => {
|
|
772
|
+
const share = internal.share
|
|
773
|
+
if (Predicate.isNotUndefined(share)) {
|
|
774
|
+
if (Bool.or(share.carries, share.chosen)) return share.parent
|
|
775
|
+
return useVariantContext()
|
|
776
|
+
}
|
|
777
|
+
const parent = shareOf(internal.parent)
|
|
778
|
+
if (Predicate.isNotUndefined(parent)) {
|
|
779
|
+
if (Bool.not(parent.carries)) throw new Error(LISTENING_PARENT)
|
|
780
|
+
return parent.provided
|
|
781
|
+
}
|
|
782
|
+
return useVariantContext()
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* A ward's variant node: a driving ward's is its given ward's (#349), unless that ward listens
|
|
787
|
+
* (#398), when its element builds its own from its props; any other ward's is its own, made now.
|
|
788
|
+
*/
|
|
789
|
+
const nodeFor = (
|
|
790
|
+
share: WardShare | undefined,
|
|
791
|
+
cfg: () => WardConfigValues,
|
|
792
|
+
config: WardConfigValues,
|
|
793
|
+
parent: WardicVariantContextValue | undefined,
|
|
794
|
+
change: Accessor<ControlsChange | undefined> | undefined,
|
|
795
|
+
): VariantNode => {
|
|
796
|
+
if (Predicate.isNotUndefined(share)) {
|
|
797
|
+
const node = share.node
|
|
798
|
+
if (Predicate.isNotUndefined(node)) {
|
|
799
|
+
if (share.carries) return node
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
return createVariantNode(cfg, config, parent, change)
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/** A ward's **Animation controls** (#433): the controls, its view with each change as its entry, and the change in effect. */
|
|
806
|
+
interface Controls {
|
|
807
|
+
readonly controls: WardicAnimationControls
|
|
808
|
+
readonly view: WardConfigValues
|
|
809
|
+
readonly change: Accessor<ControlsChange | undefined>
|
|
810
|
+
readonly set: (change: ControlsChange) => void
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/** No change: a ward without Animation controls. */
|
|
814
|
+
const NO_CHANGE: Accessor<ControlsChange | undefined> = constUndefined
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* A ward's config with its `animate` read once, at setup (#433): **Animation controls** make each change
|
|
818
|
+
* they make its entry, over the rest of its keys as given, the view marked controlled; anything else, none.
|
|
819
|
+
*/
|
|
820
|
+
const controlsOf = (given: WardConfigValues, animate: WardConfigValues["animate"]): Controls | undefined => {
|
|
821
|
+
if (Bool.not(isAnimationControls(animate))) return undefined
|
|
822
|
+
const [change, setChange] = createSignal<ControlsChange | undefined>(undefined)
|
|
823
|
+
const view = Object.create(given, {
|
|
824
|
+
animate: { enumerable: true, get: () => UndefinedOr.map(change(), (made) => made.definition) },
|
|
825
|
+
controlled: { enumerable: true, value: true },
|
|
826
|
+
}) as WardConfigValues
|
|
827
|
+
return { controls: animate as WardicAnimationControls, view, change, set: (made) => setChange(() => made) }
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* `view` with its **Config transition** as its own when it gives none (#434, Motion's
|
|
832
|
+
* `{ ...config, ...props }`), read per read as its keys are; `view` itself with no `WardicConfig` above.
|
|
833
|
+
*/
|
|
834
|
+
const configuredView = (view: WardConfigValues, config: WardicConfigValue | undefined): WardConfigValues => {
|
|
835
|
+
if (Predicate.isUndefined(config)) return view
|
|
836
|
+
return Object.create(view, {
|
|
837
|
+
transition: { enumerable: true, get: () => UndefinedOr.match(view.transition, { onUndefined: config.transition, onDefined: identity }) },
|
|
838
|
+
}) as WardConfigValues
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Whether a node's `when` gate lets a Retarget start (ADR-0007), as a memo, so only a flip of it
|
|
843
|
+
* re-runs what reads it. A plain node's gate never shuts (its `canStart` is `constTrue`), so it has
|
|
844
|
+
* none (#525).
|
|
845
|
+
*/
|
|
846
|
+
const gateOf = (node: { readonly canStart: () => boolean }): Accessor<boolean> => {
|
|
847
|
+
if (node.canStart === constTrue) return constTrue
|
|
848
|
+
return createMemo(() => node.canStart(), CLIENT_ONLY)
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/** A ward's lifecycle: a driving ward's is its given ward's (#349), any other its own, made now. */
|
|
852
|
+
const lifecycleFor = (share: WardShare | undefined, owner: Owner | null, want: () => void): Lifecycle => {
|
|
853
|
+
const shared = UndefinedOr.map(share, lifecycleOfShare)
|
|
854
|
+
if (Predicate.isNotUndefined(shared)) return shared
|
|
855
|
+
return new Lifecycle(owner, want)
|
|
856
|
+
}
|
|
857
|
+
const lifecycleOfShare = (share: WardShare): Lifecycle | undefined => share.lifecycle
|
|
858
|
+
/** A mount's element. */
|
|
859
|
+
const elementOfMount = (m: { readonly element: HTMLElement }): HTMLElement => m.element
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* A ward mounting an element another ward left in the same task: a spread's expression
|
|
863
|
+
* (`{...ward(config)}`), which Solid 2 runs again on every run of the element's props, making a new
|
|
864
|
+
* ward each time.
|
|
865
|
+
*/
|
|
866
|
+
const REMADE =
|
|
867
|
+
"ward(config) made a new ward for an element another ward just left: Solid 2 runs a spread's expression " +
|
|
868
|
+
"(`<div {...ward(config)} />`) again on every run of the element's props. Make it once, in the component's body, " +
|
|
869
|
+
"and spread that: `const card = ward(config)` then `<div {...card} />`. Or give it to `ref={ward(config)}`, client-only."
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* The keys a ward reads as it goes, through its target or its style (#257 item 1): one still loading
|
|
873
|
+
* when the ward is made holds its region until it lands. Any other key is fixed at setup.
|
|
874
|
+
*/
|
|
875
|
+
const LOADS_AS_IT_GOES: ReadonlySet<string> = new Set(["animate", "whileHover", "whileTap", "whileFocus", "whileInView", "whileDrag", "transition", "style", "custom"])
|
|
876
|
+
|
|
877
|
+
/** A ward's setup key still loading when it's made (#257 item 1). */
|
|
878
|
+
const loadingAtSetup = (key: string): string =>
|
|
879
|
+
`ward(config): \`${key}\` was still loading when the ward was made. A ward reads it once, when it's made: give it a value, or make the ward once its data is in.`
|
|
880
|
+
|
|
881
|
+
/** A ward that starts at its `animate`, still loading when it's made (#257 item 1). */
|
|
882
|
+
const STARTS_AT_PENDING =
|
|
883
|
+
"ward(config): `animate` was still loading when the ward was made, and with `initial={false}` a ward starts there. Give it an `initial`, or make the ward once its data is in."
|
|
884
|
+
|
|
885
|
+
/** A name list standing for an `animate` still loading at setup, on a ward with `variants` (#257 item 1). */
|
|
886
|
+
const LOADING_NAMES: ReadonlyArray<string> = []
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* The config setup reads: a key still loading that setup fixes is an error (#257 item 1). A loading
|
|
890
|
+
* `animate` names the ward's own variants when it has `variants` (what it can name), and is a target
|
|
891
|
+
* of values otherwise: setup reads it only to tell which.
|
|
892
|
+
*/
|
|
893
|
+
const configAtSetup = (setup: { readonly config: WardConfigValues; readonly pending: ReadonlyArray<string> }): WardConfigValues => {
|
|
894
|
+
if (setup.pending.length === 0) return setup.config
|
|
895
|
+
const fixed = Arr.findFirst(setup.pending, (key) => Bool.not(LOADS_AS_IT_GOES.has(key)))
|
|
896
|
+
if (Option.isSome(fixed)) throw new Error(loadingAtSetup(fixed.value))
|
|
897
|
+
const config = setup.config
|
|
898
|
+
if (Bool.and(Arr.contains(setup.pending, "animate"), Predicate.isNotUndefined(config.variants))) return { ...config, animate: LOADING_NAMES as NonNullable<WardConfigValues["animate"]> }
|
|
899
|
+
return config
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Elements a ward has left in this task: a ward mounting one is {@link REMADE}. Cleared once, at the
|
|
904
|
+
* task's end, by one microtask however many leave (#259: one a ward cost 0.2 ms an unmount of 1,000).
|
|
905
|
+
*/
|
|
906
|
+
// Module state (#460, Q7): the page's one end-of-task batch: cleared by one microtask at the task's end.
|
|
907
|
+
const justLeft = new Set<Element>()
|
|
908
|
+
const forgetJustLeft = (): void => justLeft.clear()
|
|
909
|
+
|
|
910
|
+
/** {@link ward} with a `wardic.<tag>`'s additions. Internal. */
|
|
911
|
+
/**
|
|
912
|
+
* Makes a mounted element's layout node with `arrive` if it was on its way as the element mounted and
|
|
913
|
+
* `services` has `layout` now (#582). A module's function, not a ward's: a ward makes none.
|
|
914
|
+
*/
|
|
915
|
+
const layoutArrivedIn = (arrive: ((projection: ProjectionSystem.Shape) => void) | undefined, services: Context.Context<never>): void => {
|
|
916
|
+
UndefinedOr.map(arrive, (make) => UndefinedOr.map(projectionIn(services), make))
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
export function wardWith(config: WardConfig, internal: WardInternals): Ward {
|
|
920
|
+
if (Predicate.isFunction(config)) throw new Error(WHOLE_ACCESSOR)
|
|
921
|
+
const runtime = useWardicRuntime()
|
|
922
|
+
// Its Features (#511, ADR-0067), a Complete element's every one: what they register, a server
|
|
923
|
+
// render's elements read too (the `colors` Feature's spaces).
|
|
924
|
+
const features = useElementFeatures(internal.brings, internal.complete === true)
|
|
925
|
+
// A server render takes the lean path: the Starting style only, no spine (ADR-0021).
|
|
926
|
+
if (isServer) return serverWard(config, internal)
|
|
927
|
+
const gate = useWardicGate()
|
|
928
|
+
// Its section's projection system, the `layout` Feature's (#511): `undefined` without it. Read now,
|
|
929
|
+
// which builds the Features given to its section at once: the first element to ask builds them.
|
|
930
|
+
const layoutProjection = projectionIn(untrack(features.services))
|
|
931
|
+
// The provider's, once any section has built it: what its values register with.
|
|
932
|
+
const builtProjection = useBuiltProjection()
|
|
933
|
+
const reducedMotion = useWardicReducedMotion()
|
|
934
|
+
// Whether its animations are skipped (#468): its nearest WardicConfig's, read as each starts.
|
|
935
|
+
const skipAnimations = useWardicSkipAnimations()
|
|
936
|
+
// Where its drag's and pan's points are (#443): its nearest WardicConfig's, read as each starts.
|
|
937
|
+
const pagePoint = transformPagePointOf(useWardicConfig())
|
|
938
|
+
const positionalKeys = useWardicPositionalKeys()
|
|
939
|
+
const defaultTransition = useWardicDefaultTransition()
|
|
940
|
+
const owner = getOwner()
|
|
941
|
+
const reactivity = reactivityIn(owner)
|
|
942
|
+
const registry = registryOf(runtime)
|
|
943
|
+
// SSR/hydration-stable: the server ward makes the same one call.
|
|
944
|
+
const id = createUniqueId()
|
|
945
|
+
// Its config, read per key where it's read (#259): a change re-runs only what reads the key. With
|
|
946
|
+
// Animation controls for its `animate` (#433), read once, each change they make is its entry.
|
|
947
|
+
// Under a `WardicConfig`, its Config transition is its own when it gives none (#434).
|
|
948
|
+
const asGiven = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig())
|
|
949
|
+
// The config at setup, a plain copy read untracked: what setup reads, the keys read once among it.
|
|
950
|
+
// A key still loading (#257 item 1) is left out of it: one the ward reads as it goes holds its
|
|
951
|
+
// region until it lands; one setup fixes is an error, naming it. Its `animate` there tells
|
|
952
|
+
// Animation controls; one still loading is none.
|
|
953
|
+
const givenSetup = WARD_VIEW.setupOf(asGiven)
|
|
954
|
+
const controls = controlsOf(asGiven, givenSetup.config.animate)
|
|
955
|
+
const view = UndefinedOr.match(controls, { onUndefined: () => asGiven, onDefined: (c) => c.view })
|
|
956
|
+
const cfg = (): WardConfigValues => view
|
|
957
|
+
const setup = UndefinedOr.match(controls, { onUndefined: () => givenSetup, onDefined: () => WARD_VIEW.setupOf(view) })
|
|
958
|
+
const initialConfig = UndefinedOr.match(controls, { onUndefined: () => configAtSetup(setup), onDefined: () => controlledConfigOf(configAtSetup(setup), undefined) })
|
|
959
|
+
// Its Animation controls' change (#433), read with the Override stack: none without them.
|
|
960
|
+
const ownChange = UndefinedOr.match(controls, { onUndefined: () => NO_CHANGE, onDefined: (c) => c.change })
|
|
961
|
+
|
|
962
|
+
// A ward a component was given (#349), whose element this one drives: its variant node and its
|
|
963
|
+
// lifecycle are that ward's, so its children, stagger and `next` readers are where it was made.
|
|
964
|
+
const share = internal.share
|
|
965
|
+
// Its place in variant orchestration (ADR-0007, #50): where it's made, its given parent's (#349),
|
|
966
|
+
// or its given ward's.
|
|
967
|
+
const parent = variantParentOf(internal)
|
|
968
|
+
const node = nodeFor(share, cfg, initialConfig, parent, UndefinedOr.map(controls, (c) => c.change))
|
|
969
|
+
|
|
970
|
+
// The nearest <AnimatePresence> (ADR-0007), or none.
|
|
971
|
+
const presence = usePresenceContext()
|
|
972
|
+
// The Layout group its `layoutId` goes in (#432): where it's made, or a given ward's.
|
|
973
|
+
const layoutGroup = layoutGroupFor(share, internal.fixed)
|
|
974
|
+
|
|
975
|
+
// The values it starts from, read once (ADR-0003): its `initial`, or the one it inherits, or its
|
|
976
|
+
// `animate` with `initial={false}` (its own, inherited, or its presence's first render, #134).
|
|
977
|
+
const presenceBlocks = presenceBlocksInitial(presence)
|
|
978
|
+
if (Bool.and(Arr.contains(setup.pending, "animate"), startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw new Error(STARTS_AT_PENDING)
|
|
979
|
+
const start = startOf(initialConfig, node.inherited, presenceBlocks, untrack)
|
|
980
|
+
// Read once by the provider (#618, M1).
|
|
981
|
+
const { project } = useWardicRenderer()
|
|
982
|
+
|
|
983
|
+
// The Starting style: the projected `initial`, carried by `style` until the gate's first commit
|
|
984
|
+
// (ADR-0021 decision 6, ADR-0034); an svg-inner tag's attribute keys as attributes. While
|
|
985
|
+
// hydrating, what the server rendered, the DOM's project (the Hydration hold). A layout node's is
|
|
986
|
+
// drawn through its projection at rest, as its first commit draws it (#245).
|
|
987
|
+
const layoutNode = isLayoutNode(initialConfig)
|
|
988
|
+
const drawnStart = drawnAtRest(start.initialValues, layoutNode, initialConfig.transformTemplate)
|
|
989
|
+
const projected = project(drawnStart)
|
|
990
|
+
const hydrating = isHydrating()
|
|
991
|
+
const startingPatch = Bool.match(hydrating, { onTrue: () => DomRenderer.project(drawnStart), onFalse: () => projected })
|
|
992
|
+
if (hydrating) flagStartingStyle(runtime, id, startingPatch, projected)
|
|
993
|
+
const seed = Svg.splitPatchForTag(internal.tag, startingPatch)
|
|
994
|
+
|
|
995
|
+
// Its drag axis and a drag element's defaults (ADR-0004, ADR-0019 *Amendment (Reorder)*), under
|
|
996
|
+
// the user's style: `drag` is read once, as on the Solid 1 binding.
|
|
997
|
+
const dragAxis = dragAxisOf(initialConfig, internal)
|
|
998
|
+
const dragDefaults = dragDefaultsOf(initialConfig, internal)
|
|
999
|
+
|
|
1000
|
+
// Its routed `style` keys (#130, ADR-0043), and its `style`, switched by the gate's hooks.
|
|
1001
|
+
const live = createLiveStyle({ registry: registryOf(runtime), onDroppedTransform: () => warnDroppedTransform(runtime, id), reactivity })
|
|
1002
|
+
const projectStarting = Bool.match(hydrating, { onTrue: () => DomRenderer.project, onFalse: () => project })
|
|
1003
|
+
// The element's style (#264): the config's, with the latest `.with()` style over it, key by key.
|
|
1004
|
+
// `.with()` runs in the spread's computation, an owned scope: it tells `read(key)` through a
|
|
1005
|
+
// signal written there (`ownedWrite`), and never `style`, whose spread would run `.with` again.
|
|
1006
|
+
let given: WardWithProps = NO_WITH
|
|
1007
|
+
// Made at the first `read(key)` or `.with()`: most elements call neither.
|
|
1008
|
+
let withCalls: Signal<undefined> | undefined
|
|
1009
|
+
const withCallsOf = (): Signal<undefined> => {
|
|
1010
|
+
if (Predicate.isUndefined(withCalls)) withCalls = runWithOwner(owner, () => createSignal(undefined, { equals: false, ownedWrite: true }))
|
|
1011
|
+
return withCalls
|
|
1012
|
+
}
|
|
1013
|
+
const userStyle = (): WardStyle | string | undefined => withStyleOver(cfg().style, given.style)
|
|
1014
|
+
const elementStyle = createElementStyle({
|
|
1015
|
+
userStyle,
|
|
1016
|
+
starting: seed.style,
|
|
1017
|
+
startingWith: (routed: Values.Values): Renderer.Patch =>
|
|
1018
|
+
Svg.splitPatchForTag(internal.tag, projectStarting(drawnAtRest({ ...routed, ...start.initialValues }, layoutNode, initialConfig.transformTemplate))).style,
|
|
1019
|
+
live,
|
|
1020
|
+
defaults: dragDefaults,
|
|
1021
|
+
base: internal.baseStyle,
|
|
1022
|
+
reactivity,
|
|
1023
|
+
})
|
|
1024
|
+
|
|
1025
|
+
const snapshot = snapshotOf(start)
|
|
1026
|
+
const reuse = makeReuse()
|
|
1027
|
+
// Where its element starts (#414): the ward's start, or a fresh one for an element given after the
|
|
1028
|
+
// last one left the page, as a mount after the first render's (no presence holds its `initial`
|
|
1029
|
+
// back). Its Snapshot goes back to it, and its Starting style comes back on until its first commit.
|
|
1030
|
+
let begun = start
|
|
1031
|
+
const beginFresh = (): void => {
|
|
1032
|
+
// The config now, a plain copy read untracked, as setup reads it: this runs in the mount effect.
|
|
1033
|
+
const now = WARD_VIEW.setupOf(view).config
|
|
1034
|
+
begun = startOf(now, node.inherited, false, untrack)
|
|
1035
|
+
snapshot.values = { ...begun.initialValues }
|
|
1036
|
+
snapshot.velocities = {}
|
|
1037
|
+
snapshot.drawnAt = {}
|
|
1038
|
+
elementStyle.restart(Svg.splitPatchForTag(internal.tag, project(drawnAtRest(begun.initialValues, layoutNode, now.transformTemplate))).style)
|
|
1039
|
+
}
|
|
1040
|
+
const configNow = (): WardConfigValues => view
|
|
1041
|
+
const styleNow = (): WardStyle | string | undefined => untrack(userStyle)
|
|
1042
|
+
|
|
1043
|
+
// What its exit resolves from under an <AnimatePresence> (#277: its `exit`, `variants`, `custom` and
|
|
1044
|
+
// transition), kept current while it's alive: the presence resolves it as the ward leaves (ADR-0007).
|
|
1045
|
+
const exitConfig = { current: NO_EXIT_CONFIG }
|
|
1046
|
+
if (Predicate.isNotUndefined(presence)) {
|
|
1047
|
+
// Its inherited transition is read untracked here: the effect keeps it current.
|
|
1048
|
+
exitConfig.current = untrack(() => exitConfigOf(initialConfig, node.inherited))
|
|
1049
|
+
createEffect(
|
|
1050
|
+
() => exitConfigOf(cfg(), node.inherited),
|
|
1051
|
+
(config) => {
|
|
1052
|
+
exitConfig.current = config
|
|
1053
|
+
},
|
|
1054
|
+
CLIENT_ONLY_DEFERRED,
|
|
1055
|
+
)
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// Its layout node (ADR-0009): the projection system it registers one with, decided at setup, as
|
|
1059
|
+
// `layout` is read once, and what a release runs on, its Release offset (ADR-0016, *Amendment
|
|
1060
|
+
// (#140)*). Its section's `layout` makes its node (#511): without it, its layout props do nothing,
|
|
1061
|
+
// and development says so once, unless `layout` is on its way.
|
|
1062
|
+
const wantsNode = wantsLayoutNode(initialConfig)
|
|
1063
|
+
if (DEV && wantsNode && Predicate.isUndefined(layoutProjection) && Bool.not(untrack(features.pending))) {
|
|
1064
|
+
useFeatureRegistry().warnOnce("layout", missingMessage("layout", LAYOUT_PROPS, "@wardic/solid/unstable/v2"))
|
|
1065
|
+
}
|
|
1066
|
+
const layoutNodes = Bool.match(wantsNode, { onTrue: () => layoutProjection, onFalse: constUndefined })
|
|
1067
|
+
const dragTransition = dragTransitionOf(initialConfig.dragElastic, initialConfig.dragTransition)
|
|
1068
|
+
|
|
1069
|
+
// The element, set by the ref during render. Its write is the one a ward makes in an owned scope: a
|
|
1070
|
+
// ward called with its element in a component's body (WT2), not given to `ref`.
|
|
1071
|
+
const [element, setElement] = createSignal<HTMLElement | undefined>(undefined, { ownedWrite: true })
|
|
1072
|
+
|
|
1073
|
+
// Its gesture layers' states (ADR-0005), one signal for the three, so the target reads one (#259),
|
|
1074
|
+
// each recorded on its element: the hover and press recognizers, each started on its element the
|
|
1075
|
+
// first time its `while*` target is set (#87, ADR-0040), and the drag's. A write that changes
|
|
1076
|
+
// nothing keeps the same object.
|
|
1077
|
+
const [gestureState, setGestureState] = createSignal<Gestures>(NO_GESTURES)
|
|
1078
|
+
/** Set `layer` on `el`: a state recorded on another element starts again from none. */
|
|
1079
|
+
const setGesture = (el: HTMLElement, layer: GestureLayer, on: boolean): void => {
|
|
1080
|
+
setGestureState((g) => {
|
|
1081
|
+
if (g.element !== el) return Bool.match(on, { onTrue: (): Gestures => ({ ...NO_GESTURES, element: el, [layer]: true }), onFalse: () => g })
|
|
1082
|
+
if (g[layer] === on) return g
|
|
1083
|
+
return { ...g, [layer]: on }
|
|
1084
|
+
})
|
|
1085
|
+
}
|
|
1086
|
+
// The layers on the element mounted now: a state recorded on one the ward has left reads as none, so
|
|
1087
|
+
// a move resets nothing by writing (#257's audit: the reset, written in the mount's effect, fed the
|
|
1088
|
+
// target memo and re-ran the effect, EFFECT_WRITES_OWN_SOURCE). With none recorded there's nothing
|
|
1089
|
+
// to compare, so the element isn't read: its arrival doesn't re-run the target memo (#320).
|
|
1090
|
+
const gestures = (): Gestures => {
|
|
1091
|
+
const g = gestureState()
|
|
1092
|
+
if (g === NO_GESTURES) return g
|
|
1093
|
+
if (g.element === element()) return g
|
|
1094
|
+
return NO_GESTURES
|
|
1095
|
+
}
|
|
1096
|
+
const dragging = (): boolean => gestures().dragging
|
|
1097
|
+
// The keys these read are `GESTURE_KEYS` (#525).
|
|
1098
|
+
const wantsHover = (): boolean => Predicate.isNotUndefined(cfg().whileHover)
|
|
1099
|
+
const wantsPress = (): boolean => Predicate.isNotUndefined(cfg().whileTap)
|
|
1100
|
+
const wantsInView = (): boolean => Predicate.isNotUndefined(cfg().whileInView)
|
|
1101
|
+
const wantsFocus = (): boolean => Predicate.isNotUndefined(cfg().whileFocus)
|
|
1102
|
+
|
|
1103
|
+
// The Override stack, compared by value: a change that resolves the same target doesn't Retarget.
|
|
1104
|
+
// A keyboard lift turns `whileDrag` on, as a drag does (ADR-0037).
|
|
1105
|
+
const lifted = UndefinedOr.match(internal.lifted, { onUndefined: () => constFalse, onDefined: identity })
|
|
1106
|
+
const target = createMemo<Resolution>(
|
|
1107
|
+
() => {
|
|
1108
|
+
const g = gestures()
|
|
1109
|
+
return resolutionOf(
|
|
1110
|
+
cfg(),
|
|
1111
|
+
node.inherited,
|
|
1112
|
+
start.initialLink,
|
|
1113
|
+
{
|
|
1114
|
+
inView: g.inView,
|
|
1115
|
+
focused: g.focused,
|
|
1116
|
+
hovered: g.hovered,
|
|
1117
|
+
pressed: g.pressed,
|
|
1118
|
+
dragged: Bool.or(g.dragging, lifted()),
|
|
1119
|
+
dragging: g.dragging,
|
|
1120
|
+
},
|
|
1121
|
+
snapshot,
|
|
1122
|
+
ownChange(),
|
|
1123
|
+
)
|
|
1124
|
+
},
|
|
1125
|
+
{ equals: sameTarget, transparent: true },
|
|
1126
|
+
)
|
|
1127
|
+
// A colour only the `colors` Feature reads, on a Slim element without it (#511, decision 7): said
|
|
1128
|
+
// once per provider, in development only, and not while a lazy load is on its way.
|
|
1129
|
+
// eslint-disable-next-line solid/reactivity -- read inside the warning's effect, where it tracks
|
|
1130
|
+
if (DEV && internal.complete !== true) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved)
|
|
1131
|
+
// Its gesture states, for what its variant node hands down (#291): bound at setup, before its
|
|
1132
|
+
// children read them. Read from the gestures themselves, not the target: a gesture whose layer
|
|
1133
|
+
// resolves to nothing new leaves the target as it was (`sameResolution`), but is on all the same.
|
|
1134
|
+
// Only a provider has one: a guard, so other wards make nothing here.
|
|
1135
|
+
const bindGestures = node.bindGestures
|
|
1136
|
+
if (Predicate.isNotUndefined(bindGestures)) {
|
|
1137
|
+
// eslint-disable-next-line solid/reactivity -- read inside the variant node's gestures memo, where it tracks
|
|
1138
|
+
bindGestures(() => {
|
|
1139
|
+
const g = gestures()
|
|
1140
|
+
return { inView: g.inView, focused: g.focused, hovered: g.hovered, pressed: g.pressed, dragged: Bool.or(g.dragging, lifted()) }
|
|
1141
|
+
})
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// Its Retargets' starts and landings (#257, ADR-0046): `settled()` and `next("settled")`, each with
|
|
1145
|
+
// the gesture layers its target was resolved with.
|
|
1146
|
+
// A gesture's event asked for starts its recognizer on the mounted element (and on later mounts).
|
|
1147
|
+
// The ward driving an element for this one, given to a component (#349): its `read`, `atom` and
|
|
1148
|
+
// `next` follow that element. Followed through an Atom made at the first `read`, `atom` or drive.
|
|
1149
|
+
let driver: Driver | undefined
|
|
1150
|
+
let driven: Atom.Writable<Driver | undefined> | undefined
|
|
1151
|
+
const drivenAtom = (): Atom.Writable<Driver | undefined> => {
|
|
1152
|
+
if (Predicate.isNotUndefined(driven)) return driven
|
|
1153
|
+
const atom = Atom.make<Driver | undefined>(driver)
|
|
1154
|
+
runWithOwner(owner, () => onCleanup(registry().mount(atom)))
|
|
1155
|
+
driven = atom
|
|
1156
|
+
return atom
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// A driving ward's are its given ward's (#349), whose `next` starts them on the element it drives.
|
|
1160
|
+
const lifecycle = lifecycleFor(share, owner, () => {
|
|
1161
|
+
watchLateGestures()
|
|
1162
|
+
UndefinedOr.map(mounted, startRecognizers)
|
|
1163
|
+
UndefinedOr.map(driver, (d) => d.wanted())
|
|
1164
|
+
})
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
// The mounted element: registered with the gate, its layout node, its spine built over it, and how
|
|
1168
|
+
// to run a watch in its watch Scope (#318, #379): its gesture watches and its drag track.
|
|
1169
|
+
interface Mounted {
|
|
1170
|
+
readonly element: HTMLElement
|
|
1171
|
+
readonly spine: ElementSpine
|
|
1172
|
+
/** Its layout node: made at mount, or as `layout` arrives (#582), which writes it here. */
|
|
1173
|
+
layout: ProjectionSystem.NodeHandle | undefined
|
|
1174
|
+
/** Makes its layout node on a `layout` that arrived after it mounted (#582); absent unless one was on its way. */
|
|
1175
|
+
readonly arriveLayout: ((projection: ProjectionSystem.Shape) => void) | undefined
|
|
1176
|
+
readonly watch: (watch: Effect.Effect<void, never, Scope.Scope | WardicServices>) => void
|
|
1177
|
+
/** Starts its drag track with a `drag` that arrived after it mounted (#551); absent unless one was on its way. */
|
|
1178
|
+
readonly startDrag: ((gesture: DragGesture["Service"]) => void) | undefined
|
|
1179
|
+
hover: boolean
|
|
1180
|
+
press: boolean
|
|
1181
|
+
pan: boolean
|
|
1182
|
+
inView: boolean
|
|
1183
|
+
focus: boolean
|
|
1184
|
+
readonly dispose: () => void
|
|
1185
|
+
}
|
|
1186
|
+
/** A handler's throw, reported as a fiber's failure is (ADR-0030, decision 4); the watch goes on. */
|
|
1187
|
+
const onDefect = (cause: Cause.Cause<never>): void => {
|
|
1188
|
+
runtime.runFork(Report.failure("wardic.ward: a gesture handler failed", cause))
|
|
1189
|
+
}
|
|
1190
|
+
// The provider's Features, for development's word on a missing one (#511).
|
|
1191
|
+
const featureRegistry = useFeatureRegistry()
|
|
1192
|
+
/**
|
|
1193
|
+
* A gesture's service when the element `wanted` it: its section's Feature's (#511), `undefined`
|
|
1194
|
+
* without it, which development says once, unless it's on its way.
|
|
1195
|
+
*/
|
|
1196
|
+
const gestureIn = <I, S>(services: Context.Context<never>, name: keyof typeof GESTURE_WORDS, key: Context.Key<I, S>, wanted: boolean): S | undefined => {
|
|
1197
|
+
if (Bool.not(wanted)) return undefined
|
|
1198
|
+
const service = serviceIn(services, key)
|
|
1199
|
+
if (DEV && Predicate.isUndefined(service) && Bool.not(untrack(features.pending))) {
|
|
1200
|
+
featureRegistry.warnOnce(name, missingMessage(name, GESTURE_WORDS[name], "@wardic/solid/unstable/v2"))
|
|
1201
|
+
}
|
|
1202
|
+
return service
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Start the hover, press and pan recognizers its config or a `next` now wants, each once a mount:
|
|
1206
|
+
* each hover or press transition sets its gesture layer, and every event is told to the lifecycle
|
|
1207
|
+
* for `next` (#257, #273).
|
|
1208
|
+
*/
|
|
1209
|
+
const startRecognizers = (m: Mounted): void => {
|
|
1210
|
+
// Each through its section's Feature (#511), read as it starts: one that arrives lazily starts from
|
|
1211
|
+
// then on, as the effect below runs this again.
|
|
1212
|
+
const services = untrack(features.services)
|
|
1213
|
+
const hover = gestureIn(services, "hover", HoverGesture, Bool.or(untrack(wantsHover), lifecycle.wantsHover))
|
|
1214
|
+
if (Predicate.isNotUndefined(hover) && Bool.not(m.hover)) {
|
|
1215
|
+
m.hover = true
|
|
1216
|
+
m.watch(
|
|
1217
|
+
hover.watch(m.element, {
|
|
1218
|
+
on: (transition) => {
|
|
1219
|
+
setGesture(m.element, "hovered", transition.active)
|
|
1220
|
+
lifecycle.hovered(transition, m.element)
|
|
1221
|
+
},
|
|
1222
|
+
// Each move while it's hovered, for `hover` (#397): told only to a `next` or `when` that asked.
|
|
1223
|
+
onMove: (event) => lifecycle.hoverMoved(event, m.element),
|
|
1224
|
+
onDefect,
|
|
1225
|
+
}),
|
|
1226
|
+
)
|
|
1227
|
+
}
|
|
1228
|
+
const press = gestureIn(services, "press", PressGesture, Bool.or(untrack(wantsPress), lifecycle.wantsPress))
|
|
1229
|
+
if (Predicate.isNotUndefined(press) && Bool.not(m.press)) {
|
|
1230
|
+
m.press = true
|
|
1231
|
+
m.watch(
|
|
1232
|
+
press.watch(
|
|
1233
|
+
m.element,
|
|
1234
|
+
{
|
|
1235
|
+
on: (press) => {
|
|
1236
|
+
setGesture(m.element, "pressed", press.phase === "start")
|
|
1237
|
+
lifecycle.pressed(press, m.element)
|
|
1238
|
+
},
|
|
1239
|
+
onDefect,
|
|
1240
|
+
},
|
|
1241
|
+
internal.keysTaken === true,
|
|
1242
|
+
() => tapPropagates(untrack(cfg).propagate),
|
|
1243
|
+
),
|
|
1244
|
+
)
|
|
1245
|
+
}
|
|
1246
|
+
// A pan sets no layer: only a `next` wants it (#273).
|
|
1247
|
+
const pan = gestureIn(services, "pan", PanGesture, lifecycle.wantsPan)
|
|
1248
|
+
if (Predicate.isNotUndefined(pan) && Bool.not(m.pan)) {
|
|
1249
|
+
m.pan = true
|
|
1250
|
+
m.watch(pan.watch(m.element, { on: (sample) => lifecycle.panned(sample, m.element), onDefect }, { mapPoint: pointMapOptionOf(pagePoint) }))
|
|
1251
|
+
}
|
|
1252
|
+
// In view as its `viewport` says, read when it starts (#273).
|
|
1253
|
+
const inView = gestureIn(services, "inView", InViewGesture, Bool.or(untrack(wantsInView), lifecycle.wantsInView))
|
|
1254
|
+
if (Predicate.isNotUndefined(inView) && Bool.not(m.inView)) {
|
|
1255
|
+
m.inView = true
|
|
1256
|
+
m.watch(
|
|
1257
|
+
inView.watch(m.element, inViewOptionsOf(untrack(cfg).viewport), {
|
|
1258
|
+
on: (transition) => {
|
|
1259
|
+
setGesture(m.element, "inView", transition.active)
|
|
1260
|
+
lifecycle.viewed(transition)
|
|
1261
|
+
},
|
|
1262
|
+
onDefect,
|
|
1263
|
+
}),
|
|
1264
|
+
)
|
|
1265
|
+
}
|
|
1266
|
+
// Focused as the browser shows it (`:focus-visible`, #273).
|
|
1267
|
+
const focus = gestureIn(services, "focus", FocusGesture, untrack(wantsFocus))
|
|
1268
|
+
if (Predicate.isNotUndefined(focus) && Bool.not(m.focus)) {
|
|
1269
|
+
m.focus = true
|
|
1270
|
+
m.watch(focus.watch(m.element, { visible: true }, { on: (focused) => setGesture(m.element, "focused", focused), onDefect }))
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
let mounted: Mounted | undefined
|
|
1274
|
+
// The last two elements given to its ref, for a second one still on the page as it mounts (#349's Q5).
|
|
1275
|
+
let refdLast: HTMLElement | undefined
|
|
1276
|
+
let refdBefore: HTMLElement | undefined
|
|
1277
|
+
// One given after the last one left the page, which enters fresh (#414). Read as the ref is called,
|
|
1278
|
+
// before Solid inserts it: one replacing the last in the same update finds it still on the page.
|
|
1279
|
+
let fresh: HTMLElement | undefined
|
|
1280
|
+
// Inside a child `mode="wait"` holds off the page (#277, ADR-0048), it mounts once the child is on
|
|
1281
|
+
// it: `shown` ticks then, and the mount effect, which reads `ticked`, runs again. Only under a
|
|
1282
|
+
// presence: with none, its compute calls a no-op and makes nothing. `held` cancels the wait.
|
|
1283
|
+
let ticked: () => undefined = constUndefined
|
|
1284
|
+
let shown: (() => void) | undefined
|
|
1285
|
+
if (Predicate.isNotUndefined(presence)) {
|
|
1286
|
+
const [read, tick] = createSignal<undefined>(undefined, { equals: false })
|
|
1287
|
+
ticked = read
|
|
1288
|
+
shown = () => tick(undefined)
|
|
1289
|
+
}
|
|
1290
|
+
let held: (() => void) | undefined
|
|
1291
|
+
const unhold = (): void => {
|
|
1292
|
+
if (Predicate.isUndefined(held)) return
|
|
1293
|
+
held()
|
|
1294
|
+
held = undefined
|
|
1295
|
+
}
|
|
1296
|
+
/** Whether `el` waits off the page for its held child: its mount queued with the presence. */
|
|
1297
|
+
const heldBack = (el: HTMLElement): boolean => {
|
|
1298
|
+
unhold()
|
|
1299
|
+
if (Predicate.isUndefined(shown)) return false
|
|
1300
|
+
held = presenceHold(presence, el, shown)
|
|
1301
|
+
return Predicate.isNotUndefined(held)
|
|
1302
|
+
}
|
|
1303
|
+
const unmount = (): void => {
|
|
1304
|
+
unhold()
|
|
1305
|
+
if (Predicate.isUndefined(mounted)) return
|
|
1306
|
+
const left = mounted.element
|
|
1307
|
+
mounted.dispose()
|
|
1308
|
+
mounted = undefined
|
|
1309
|
+
if (justLeft.size === 0) queueMicrotask(forgetJustLeft)
|
|
1310
|
+
justLeft.add(left)
|
|
1311
|
+
}
|
|
1312
|
+
// Its element's mount goes, and its lifecycle's waits are rejected (#257): one cleanup.
|
|
1313
|
+
// A driving ward's lifecycle is its given ward's, which outlives the element (#349).
|
|
1314
|
+
onCleanup(() => {
|
|
1315
|
+
unmount()
|
|
1316
|
+
if (Predicate.isUndefined(share)) lifecycle.dispose()
|
|
1317
|
+
})
|
|
1318
|
+
|
|
1319
|
+
const mount = (el: HTMLElement): Mounted => {
|
|
1320
|
+
if (justLeft.has(el)) throw new Error(REMADE)
|
|
1321
|
+
// The ward a component was given follows this element while it's mounted (#349): one at a time.
|
|
1322
|
+
let undrive: (() => void) | undefined
|
|
1323
|
+
if (Predicate.isNotUndefined(share)) {
|
|
1324
|
+
undrive = share.drive(
|
|
1325
|
+
{
|
|
1326
|
+
wanted: () => {
|
|
1327
|
+
UndefinedOr.map(mounted, startRecognizers)
|
|
1328
|
+
},
|
|
1329
|
+
readAtom: (key) => readEntry(key).atom,
|
|
1330
|
+
atom: (key) => gate.valueOf(id, key),
|
|
1331
|
+
},
|
|
1332
|
+
nameOf(internal),
|
|
1333
|
+
)
|
|
1334
|
+
}
|
|
1335
|
+
// The gate commits each frame onto the element (ADR-0006, ADR-0034); the hooks switch its
|
|
1336
|
+
// `style`. An element with `onUpdate` at mount is told each committed frame (#233). While
|
|
1337
|
+
// hydrating, its Appear animation is found here, taken over by its first Retarget that starts,
|
|
1338
|
+
// and removed in its first commit (the Handoff, ADR-0044 decision 6).
|
|
1339
|
+
const handoff = Bool.match(hydrating, { onTrue: () => Option.getOrUndefined(handoffOf(el)), onFalse: constUndefined })
|
|
1340
|
+
// Its Transform template (#443), drawn with its first write: the one at mount, then each other one
|
|
1341
|
+
// its config gives.
|
|
1342
|
+
const templateAtMount = configNow().transformTemplate
|
|
1343
|
+
let template = templateAtMount
|
|
1344
|
+
const registered = registeredValuesOf(templateAtMount)
|
|
1345
|
+
const unregister = gate.register(id, releasingAppear(withOnUpdate({ target: el, ...elementStyle.hooks }, configNow().onUpdate, configNow), handoff, el), registered)
|
|
1346
|
+
// Its values, for the projection's flights (ADR-0012 *Amendment (#137)*).
|
|
1347
|
+
// None while no section has `layout`: there's no flight to follow them (#511).
|
|
1348
|
+
const unregisterValues = UndefinedOr.match(builtProjection(), { onUndefined: () => constVoid, onDefined: (projection) => projection.registerValues(el, () => snapshot.values) })
|
|
1349
|
+
const links = startLinksOf(el, styleNow, live)
|
|
1350
|
+
// Its exit record, under an <AnimatePresence>: the presence removes it once the exit settles.
|
|
1351
|
+
const presenceRecord = UndefinedOr.map(presence, (registrar) => {
|
|
1352
|
+
const record = presenceRecordOf(el, begun, (custom, inherited) => exitTargetOf(exitConfig.current, custom, snapshot, inherited), links, presenceTreeOf(initialConfig), snapshot, reducedMotion, skipAnimations)
|
|
1353
|
+
registrar.register(record)
|
|
1354
|
+
return record
|
|
1355
|
+
})
|
|
1356
|
+
const recordFrame = recordFrameOf(presenceRecord)
|
|
1357
|
+
// Its exit is drawn through its template (#443): it rides in its presence record, whose drawn values
|
|
1358
|
+
// the projection reads as it leaves. A later one is written with the values it holds, so the commit
|
|
1359
|
+
// that may take its Starting style off holds them.
|
|
1360
|
+
// Nothing with none (#460): no follow.
|
|
1361
|
+
let unfollowTemplate: () => void = constVoid
|
|
1362
|
+
if (Predicate.isNotUndefined(templateAtMount)) {
|
|
1363
|
+
recordFrame(registered as Values.Values)
|
|
1364
|
+
unfollowTemplate = followTemplate(templateAtMount, () => view.transformTemplate, reactivity.watch, (next) => {
|
|
1365
|
+
template = next
|
|
1366
|
+
gate.write(id, { ...snapshot.values, [DomRenderer.TEMPLATE_KEY]: next })
|
|
1367
|
+
recordFrame({ [DomRenderer.TEMPLATE_KEY]: next } as unknown as Values.Values)
|
|
1368
|
+
})
|
|
1369
|
+
}
|
|
1370
|
+
// Where it starts when its child takes over from a leaver (#286): asked before its layout node
|
|
1371
|
+
// registers, which moves from the leaver's box, and before its first Retarget.
|
|
1372
|
+
const taken = presenceSeedOf(presence, el)
|
|
1373
|
+
// Its one projection node (ADR-0009, ADR-0010), its own `x`/`y` drawn on top of it (#363).
|
|
1374
|
+
// Its layout animations' starts and landings, and its drag's release at rest, go to the lifecycle,
|
|
1375
|
+
// for `next("layoutStart")`, `next("layoutComplete")` and `next("dragTransitionEnd")` (#257, #273):
|
|
1376
|
+
// Solid 2 has no props for them.
|
|
1377
|
+
let layout: ProjectionSystem.NodeHandle | undefined
|
|
1378
|
+
// A `<Reorder>` item's group registers the node, until the unmount.
|
|
1379
|
+
let handedOver: (() => void) | undefined
|
|
1380
|
+
// `layout` on its way as it mounted (#582): its node is made as it arrives (`arriveLayout`), as
|
|
1381
|
+
// Motion's is, and measures from then on; nothing before it is replayed.
|
|
1382
|
+
let arriveLayout: ((projection: ProjectionSystem.Shape) => void) | undefined
|
|
1383
|
+
if (wantsNode) {
|
|
1384
|
+
// `takenNow`: where a child that takes over from a leaver starts, at its mount only (#286).
|
|
1385
|
+
const layoutNodeOn = (projection: ProjectionSystem.Shape, takenNow: PresenceSeed | undefined): void => {
|
|
1386
|
+
const started = (): void => lifecycle.layoutStarted()
|
|
1387
|
+
const completed = (): void => lifecycle.layoutCompleted()
|
|
1388
|
+
const released = (): void => lifecycle.released()
|
|
1389
|
+
const handle = projection.register(
|
|
1390
|
+
registrationOf({
|
|
1391
|
+
...layoutOptionsOf({
|
|
1392
|
+
id,
|
|
1393
|
+
element: el,
|
|
1394
|
+
config: configNow,
|
|
1395
|
+
parent: node.inherited,
|
|
1396
|
+
snapshot,
|
|
1397
|
+
dragTransition,
|
|
1398
|
+
raiseWhileDragged: internal.raiseWhileDragged === true,
|
|
1399
|
+
taken: takenNow,
|
|
1400
|
+
layoutGroup,
|
|
1401
|
+
reducedMotion,
|
|
1402
|
+
skipAnimations,
|
|
1403
|
+
heldTransform: heldTransformFor(snapshot, templateAtMount, () => template),
|
|
1404
|
+
}),
|
|
1405
|
+
onLayoutAnimationStart: () => started,
|
|
1406
|
+
onLayoutAnimationComplete: () => completed,
|
|
1407
|
+
// Its drag's Release offset at rest, for `next("dragTransitionEnd")` (#273).
|
|
1408
|
+
onReleaseEnd: () => released,
|
|
1409
|
+
}),
|
|
1410
|
+
)
|
|
1411
|
+
layout = handle
|
|
1412
|
+
handedOver = UndefinedOr.map(internal.onLayoutHandle, (onHandle) => onHandle(handle))
|
|
1413
|
+
}
|
|
1414
|
+
// Its section's `layout` as it mounts: had at setup, or arrived since (#582).
|
|
1415
|
+
const now = UndefinedOr.match(layoutNodes, { onDefined: identity, onUndefined: () => projectionIn(untrack(features.services)) })
|
|
1416
|
+
if (Predicate.isNotUndefined(now)) layoutNodeOn(now, taken)
|
|
1417
|
+
if (Predicate.isUndefined(layout)) {
|
|
1418
|
+
arriveLayout = (projection) => {
|
|
1419
|
+
if (Predicate.isNotUndefined(layout)) return
|
|
1420
|
+
layoutNodeOn(projection, undefined)
|
|
1421
|
+
// A plain field, not a getter: a getter of its own on every record gave each its own shape (#582).
|
|
1422
|
+
m.layout = layout
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
// Its watch Scope (#318, #379, ADR-0055): its gesture watches and its drag track run in it, each
|
|
1427
|
+
// subscribed at once with no fiber of its own, until the unmount closes it. Made at the first
|
|
1428
|
+
// watch: a ward with no gesture makes and closes none.
|
|
1429
|
+
let watchScope: Scope.Closeable | undefined
|
|
1430
|
+
const watchIn = (watch: Effect.Effect<void, never, Scope.Scope | WardicServices>): void => {
|
|
1431
|
+
if (Predicate.isUndefined(watchScope)) watchScope = OwnerScope.open(runtime)
|
|
1432
|
+
runtime.runSync(watch.pipe(Scope.provide(watchScope)))
|
|
1433
|
+
}
|
|
1434
|
+
if (internal.defaultsOnElement === true) UndefinedOr.map(dragDefaults, (defaults) => applyDragDefaults(el, defaults))
|
|
1435
|
+
// The drag track (ADR-0004): the pointer direct-sets `x`/`y` while the spring drives the rest and
|
|
1436
|
+
// `whileDrag`; on a layout node it feeds the projection (ADR-0016).
|
|
1437
|
+
const locked = initialConfig.dragDirectionLock === true
|
|
1438
|
+
// Its section's `drag` Feature drives it (#511): without it, `drag` does nothing, and development
|
|
1439
|
+
// says so once, unless `drag` is on its way.
|
|
1440
|
+
const dragGesture = gestureIn(untrack(features.services), "drag", DragGesture, Predicate.isNotUndefined(dragAxis))
|
|
1441
|
+
// Whether its track drives its layout node (ADR-0016): the node it has as the track is made, at
|
|
1442
|
+
// mount or as `drag` arrives; a node made later leaves it moving `x`/`y` (#582).
|
|
1443
|
+
let dragProjected = false
|
|
1444
|
+
const driveDrag = (gesture: DragGesture["Service"]): DragTrack => {
|
|
1445
|
+
const axis = UndefinedOr.getOrThrow(dragAxis)
|
|
1446
|
+
dragProjected = Predicate.isNotUndefined(layout)
|
|
1447
|
+
// Motion's `dragConstraints` (#273): a box of numbers, or a container measured against the element.
|
|
1448
|
+
const constraints = gesture.constraintsOf(initialConfig.dragConstraints, el, () => untrack(cfg).onMeasureDragConstraints, pagePoint)
|
|
1449
|
+
return gesture.drive({
|
|
1450
|
+
watch: (track) => watchIn(track(onDefect)),
|
|
1451
|
+
fork: (response) => void runtime.runFork(response),
|
|
1452
|
+
gate,
|
|
1453
|
+
id,
|
|
1454
|
+
element: el,
|
|
1455
|
+
snapshot,
|
|
1456
|
+
recordFrame,
|
|
1457
|
+
// A drag's start turns its `style`'s will-change value on (#443).
|
|
1458
|
+
setDragging: draggingWithWillChange(live, (on: boolean) => setGesture(el, "dragging", on)),
|
|
1459
|
+
mapPoint: pagePoint,
|
|
1460
|
+
skipAnimations,
|
|
1461
|
+
config: {
|
|
1462
|
+
axis,
|
|
1463
|
+
constraints: constraints.constraints,
|
|
1464
|
+
elastic: initialConfig.dragElastic,
|
|
1465
|
+
momentum: initialConfig.dragMomentum,
|
|
1466
|
+
snapToOrigin: initialConfig.dragSnapToOrigin,
|
|
1467
|
+
propagation: initialConfig.dragPropagation,
|
|
1468
|
+
directionLock: initialConfig.dragDirectionLock,
|
|
1469
|
+
transition: dragTransition,
|
|
1470
|
+
listen: initialConfig.dragListener,
|
|
1471
|
+
},
|
|
1472
|
+
container: constraints.container,
|
|
1473
|
+
controls: initialConfig.dragControls,
|
|
1474
|
+
...UndefinedOr.match(layout, { onUndefined: () => ({}), onDefined: (projectionNode) => ({ projection: projectionNode }) }),
|
|
1475
|
+
...UndefinedOr.match(internal.dragAxis, { onUndefined: () => ({}), onDefined: (axisAt) => ({ axisAt }) }),
|
|
1476
|
+
// Its samples to a `<Reorder>` item's group, and to the lifecycle for `next("dragStart")` (#257)
|
|
1477
|
+
// and, with a direction lock, `next("directionLock")` (#273).
|
|
1478
|
+
onSample: UndefinedOr.match(internal.onDragSample, {
|
|
1479
|
+
onUndefined: () => (sample: Drag.Sample) => lifecycle.dragged(sample, locked, el),
|
|
1480
|
+
onDefined: (onSample) => (sample: Drag.Sample) => {
|
|
1481
|
+
onSample(sample)
|
|
1482
|
+
lifecycle.dragged(sample, locked, el)
|
|
1483
|
+
},
|
|
1484
|
+
}),
|
|
1485
|
+
// Its release at rest, for `next("dragTransitionEnd")` (#273).
|
|
1486
|
+
onReleaseEnd: () => lifecycle.released(),
|
|
1487
|
+
})
|
|
1488
|
+
}
|
|
1489
|
+
let dragTrack = UndefinedOr.map(dragGesture, driveDrag)
|
|
1490
|
+
const spineOptions: ElementSpineOptions = {
|
|
1491
|
+
runtime,
|
|
1492
|
+
gate,
|
|
1493
|
+
id,
|
|
1494
|
+
element: el,
|
|
1495
|
+
tag: internal.tag,
|
|
1496
|
+
config: configNow,
|
|
1497
|
+
parent: node.inherited,
|
|
1498
|
+
canStart: node.canStart,
|
|
1499
|
+
extraDelay: node.extraDelay,
|
|
1500
|
+
byName: node.names,
|
|
1501
|
+
onFrame: node.onFrame,
|
|
1502
|
+
reducedMotion,
|
|
1503
|
+
skipAnimations,
|
|
1504
|
+
positionalKeys,
|
|
1505
|
+
defaultTransition,
|
|
1506
|
+
start: begun,
|
|
1507
|
+
snapshot,
|
|
1508
|
+
reuse,
|
|
1509
|
+
links,
|
|
1510
|
+
styleNow,
|
|
1511
|
+
live,
|
|
1512
|
+
presence: presenceRecord,
|
|
1513
|
+
projected: Predicate.isNotUndefined(layout),
|
|
1514
|
+
dragAxis,
|
|
1515
|
+
drag: dragTrack,
|
|
1516
|
+
handoff,
|
|
1517
|
+
animation: lifecycle,
|
|
1518
|
+
}
|
|
1519
|
+
// A `drag` on its way as it mounted (#551): its track starts as the Feature arrives (`startDrag`),
|
|
1520
|
+
// and the spine reads it at each Retarget from then on. Only then is `drag` a getter, so an
|
|
1521
|
+
// element that has it at mount, or never wants it, pays nothing.
|
|
1522
|
+
let startDrag: ((gesture: DragGesture["Service"]) => void) | undefined
|
|
1523
|
+
if (Predicate.isNotUndefined(dragAxis) && Predicate.isUndefined(dragTrack) && untrack(features.pending)) {
|
|
1524
|
+
Object.defineProperty(spineOptions, "drag", { get: () => dragTrack })
|
|
1525
|
+
// Whether that track drives the layout node (#582): until it starts, whether the element has one.
|
|
1526
|
+
Object.defineProperty(spineOptions, "projected", {
|
|
1527
|
+
get: () => UndefinedOr.match(dragTrack, { onUndefined: () => Predicate.isNotUndefined(layout), onDefined: () => dragProjected }),
|
|
1528
|
+
})
|
|
1529
|
+
startDrag = (gesture) => {
|
|
1530
|
+
if (Predicate.isUndefined(dragTrack)) dragTrack = driveDrag(gesture)
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
const spine = makeElementSpine(spineOptions)
|
|
1534
|
+
// A child back under its key starts where its leaver is drawn (#286), before its first Retarget.
|
|
1535
|
+
if (Predicate.isNotUndefined(taken)) spine.seed(taken)
|
|
1536
|
+
// Live values in `style` (#130, ADR-0043): followed from the first routed key on.
|
|
1537
|
+
spine.follow({ resolved: () => untrack(target).resolved, dragging: () => untrack(dragging) })
|
|
1538
|
+
// Its Imperative animations (#433) go through its spine while it's mounted, and its Animation controls reach it.
|
|
1539
|
+
const unregisterAnimatable = registerAnimatable(el, spine)
|
|
1540
|
+
const unsubscribe = UndefinedOr.match(controls, {
|
|
1541
|
+
onUndefined: () => constVoid,
|
|
1542
|
+
onDefined: (c) => subscribe(c.controls, controlledElement(c.set, { custom: () => untrack(() => view.custom), snapshot }, spine.stop)),
|
|
1543
|
+
})
|
|
1544
|
+
const m: Mounted = {
|
|
1545
|
+
element: el,
|
|
1546
|
+
spine,
|
|
1547
|
+
layout,
|
|
1548
|
+
arriveLayout,
|
|
1549
|
+
watch: watchIn,
|
|
1550
|
+
startDrag,
|
|
1551
|
+
hover: false,
|
|
1552
|
+
press: false,
|
|
1553
|
+
pan: false,
|
|
1554
|
+
inView: false,
|
|
1555
|
+
focus: false,
|
|
1556
|
+
dispose: () => {
|
|
1557
|
+
if (Predicate.isNotUndefined(undrive)) undrive()
|
|
1558
|
+
UndefinedOr.map(mountedHook, (end) => end())
|
|
1559
|
+
unregisterAnimatable()
|
|
1560
|
+
unsubscribe()
|
|
1561
|
+
spine.dispose()
|
|
1562
|
+
// Its gesture watches' and drag track's listeners go, a running release stops, and their spans end.
|
|
1563
|
+
UndefinedOr.map(watchScope, (scope) => OwnerScope.close(runtime, scope, "wardic.ward: a finalizer failed"))
|
|
1564
|
+
// The group lets go of the node before it's disposed.
|
|
1565
|
+
UndefinedOr.map(handedOver, (release) => release())
|
|
1566
|
+
UndefinedOr.map(layout, (node) => node.dispose())
|
|
1567
|
+
unfollowTemplate()
|
|
1568
|
+
unregisterValues()
|
|
1569
|
+
unregister()
|
|
1570
|
+
},
|
|
1571
|
+
}
|
|
1572
|
+
startRecognizers(m)
|
|
1573
|
+
const mountedHook = UndefinedOr.map(internal.onMount, (onMount) => onMount(el, (make) => watchIn(make(onDefect))))
|
|
1574
|
+
return m
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
// A `while*` target set after mount starts its recognizer then (#87, ADR-0040). Its compute reads
|
|
1578
|
+
// the two keys, so only their changes re-run it (#259).
|
|
1579
|
+
// Its section's Features are read there too, so a gesture's arriving lazily starts it (#511): each
|
|
1580
|
+
// start checks what's wanted.
|
|
1581
|
+
// An element whose config can never want one (`gestureless`, #525) makes it at its first want
|
|
1582
|
+
// through its lifecycle instead: no computation an element until then.
|
|
1583
|
+
let watchingLate = false
|
|
1584
|
+
const watchLateGestures = (): void => {
|
|
1585
|
+
if (watchingLate) return
|
|
1586
|
+
watchingLate = true
|
|
1587
|
+
runWithOwner(owner, () =>
|
|
1588
|
+
createEffect(
|
|
1589
|
+
() => ({ wanted: Bool.some([wantsHover(), wantsPress(), wantsInView(), wantsFocus()]), services: features.services() }),
|
|
1590
|
+
() => {
|
|
1591
|
+
UndefinedOr.map(mounted, startRecognizers)
|
|
1592
|
+
},
|
|
1593
|
+
CLIENT_ONLY_SYNC_DEFERRED,
|
|
1594
|
+
),
|
|
1595
|
+
)
|
|
1596
|
+
}
|
|
1597
|
+
if (internal.gestureless !== true) watchLateGestures()
|
|
1598
|
+
|
|
1599
|
+
// `layout` on its way (#582): an element mounted before it arrives makes its node then, as its
|
|
1600
|
+
// gestures and drag start theirs; a load that brings none gets development's word then.
|
|
1601
|
+
if (Bool.and(wantsNode, Predicate.isUndefined(layoutProjection)) && untrack(features.pending)) {
|
|
1602
|
+
createEffect(
|
|
1603
|
+
() => ({ services: features.services(), pending: features.pending() }),
|
|
1604
|
+
// Its apply returns nothing: a function returned there would be its cleanup.
|
|
1605
|
+
({ services, pending }) => {
|
|
1606
|
+
UndefinedOr.map(mounted, (m) => layoutArrivedIn(m.arriveLayout, services))
|
|
1607
|
+
if (DEV && Predicate.isUndefined(projectionIn(services)) && Bool.not(pending)) {
|
|
1608
|
+
featureRegistry.warnOnce("layout", missingMessage("layout", LAYOUT_PROPS, "@wardic/solid/unstable/v2"))
|
|
1609
|
+
}
|
|
1610
|
+
},
|
|
1611
|
+
CLIENT_ONLY_DEFERRED,
|
|
1612
|
+
)
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
// A `drag` on its way (#551): an element mounted before it arrives starts its track then, as its
|
|
1616
|
+
// gestures' recognizers do, and nothing before it is replayed; a load that brings none gets
|
|
1617
|
+
// development's word then.
|
|
1618
|
+
if (Predicate.isNotUndefined(dragAxis) && untrack(features.pending)) {
|
|
1619
|
+
createEffect(
|
|
1620
|
+
() => ({ services: features.services(), pending: features.pending() }),
|
|
1621
|
+
// Its apply returns nothing: a function returned there would be its cleanup.
|
|
1622
|
+
({ services, pending }) => {
|
|
1623
|
+
UndefinedOr.match(serviceIn(services, DragGesture), {
|
|
1624
|
+
// A `layout` from the same load makes its node first, so the track drives it (#582).
|
|
1625
|
+
onDefined: (gesture) =>
|
|
1626
|
+
UndefinedOr.map(mounted, (m) => {
|
|
1627
|
+
layoutArrivedIn(m.arriveLayout, services)
|
|
1628
|
+
UndefinedOr.map(m.startDrag, (start) => start(gesture))
|
|
1629
|
+
}),
|
|
1630
|
+
onUndefined: () => {
|
|
1631
|
+
if (DEV && Bool.not(pending)) featureRegistry.warnOnce("drag", missingMessage("drag", GESTURE_WORDS.drag, "@wardic/solid/unstable/v2"))
|
|
1632
|
+
},
|
|
1633
|
+
})
|
|
1634
|
+
},
|
|
1635
|
+
CLIENT_ONLY_DEFERRED,
|
|
1636
|
+
)
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
// A `layoutDependency` change re-measures its layout node (not at mount: it measures as it registers).
|
|
1640
|
+
// Only a change of its value: a memo, since a Solid 2 effect applies on every re-run of its compute,
|
|
1641
|
+
// and `cfg()` is re-read on any of the config's changes (a `style` change re-measured, #209 PR 5's lab).
|
|
1642
|
+
// Its node may be made as `layout` arrives (#582), so it's read at each change.
|
|
1643
|
+
if (wantsNode) {
|
|
1644
|
+
const dependency = createMemo(() => cfg().layoutDependency, CLIENT_ONLY)
|
|
1645
|
+
createEffect(
|
|
1646
|
+
dependency,
|
|
1647
|
+
() => {
|
|
1648
|
+
UndefinedOr.map(UndefinedOr.map(mounted, (m) => m.layout), (node) => node.notify())
|
|
1649
|
+
},
|
|
1650
|
+
CLIENT_ONLY_DEFERRED,
|
|
1651
|
+
)
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// Whether the `when` gate lets a Retarget start (ADR-0007), as a memo: an element with variants of
|
|
1655
|
+
// its own reads its `when` off its config, and only a flip of the gate may re-run the effect.
|
|
1656
|
+
const open = gateOf(node)
|
|
1657
|
+
|
|
1658
|
+
// Mount, then Retarget on each change of the target or of the `when` gate: both are read here,
|
|
1659
|
+
// so a gate's flip re-runs it and releases a held Retarget. Only once the ref has given the
|
|
1660
|
+
// element (#320): until then the effect reads nothing else, so the target is first resolved with
|
|
1661
|
+
// its element, once, and a config that lands before the element (an async one) doesn't run it.
|
|
1662
|
+
createEffect(
|
|
1663
|
+
() => {
|
|
1664
|
+
const el = element()
|
|
1665
|
+
if (Predicate.isUndefined(el)) return undefined
|
|
1666
|
+
return { el, resolution: target(), open: open(), shown: ticked() }
|
|
1667
|
+
},
|
|
1668
|
+
(mounting) => {
|
|
1669
|
+
if (Predicate.isUndefined(mounting)) return
|
|
1670
|
+
const { el, resolution } = mounting
|
|
1671
|
+
if (Predicate.isUndefined(mounted) || mounted.element !== el) {
|
|
1672
|
+
// Another element it was spread on, or the one it's on, still on the page: a ward drives one
|
|
1673
|
+
// element at a time (#349's Q5). One the page has let go of is left behind.
|
|
1674
|
+
if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw new Error(secondElement("ward(config)"))
|
|
1675
|
+
refdBefore = undefined
|
|
1676
|
+
// Held off the page: nothing starts until it's on it.
|
|
1677
|
+
if (heldBack(el)) return
|
|
1678
|
+
// A new element starts with no gesture on, read from its gesture state (#257's audit).
|
|
1679
|
+
unmount()
|
|
1680
|
+
// One that came after the last left the page enters fresh (#414).
|
|
1681
|
+
if (el === fresh) beginFresh()
|
|
1682
|
+
// Its config is read at mount (its layout node's options, its `onUpdate`, its spine's) through
|
|
1683
|
+
// the per-key view (#259): untracked, so said, as the Retarget below.
|
|
1684
|
+
mounted = untrack(() => mount(el))
|
|
1685
|
+
}
|
|
1686
|
+
// The spine reads the variant context (its gates, its stagger, what it inherits) at the
|
|
1687
|
+
// Retarget, once: untracked, so said (Solid 2's dev build warns of a reactive read in an
|
|
1688
|
+
// effect's apply, STRICT_READ_UNTRACKED). The effect's compute is what re-runs it.
|
|
1689
|
+
const spine = mounted.spine
|
|
1690
|
+
untrack(() => spine.retarget(resolution))
|
|
1691
|
+
},
|
|
1692
|
+
CLIENT_ONLY_SYNC,
|
|
1693
|
+
)
|
|
1694
|
+
|
|
1695
|
+
// `<card.Provider>` hands down what this element hands its children (#50).
|
|
1696
|
+
const Provider = (props: { readonly children?: JSX.Element }): JSX.Element => (
|
|
1697
|
+
<WardicVariantContext value={contextOf(node.provided)}>{props.children}</WardicVariantContext>
|
|
1698
|
+
)
|
|
1699
|
+
|
|
1700
|
+
// The element's value per key (#130, ADR-0043 decision 5): the gate's output while it holds the
|
|
1701
|
+
// key, else where the key rests. One accessor a key, made on first ask, under the ward's owner. It
|
|
1702
|
+
// carries its Atom (#209 PR 3's Q2): a `style` given it follows the Atom, set at the gate's write,
|
|
1703
|
+
// so a key derived from it paints in the same frame. Where the key rests is Solid's (the user's
|
|
1704
|
+
// style), mirrored into an Atom of its own.
|
|
1705
|
+
let reads: Map<string, ReadEntry> | undefined
|
|
1706
|
+
const readEntry = (key: string): ReadEntry => {
|
|
1707
|
+
if (Predicate.isUndefined(reads)) reads = new Map()
|
|
1708
|
+
const known = reads.get(key)
|
|
1709
|
+
if (Predicate.isNotUndefined(known)) return known
|
|
1710
|
+
const output = gate.valueOf(id, key)
|
|
1711
|
+
const following = drivenAtom()
|
|
1712
|
+
const entry = runWithOwner(owner, (): ReadEntry => {
|
|
1713
|
+
const resting = createMemo(() => {
|
|
1714
|
+
withCallsOf()[0]()
|
|
1715
|
+
return restingOf(key, start.initialValues, userStyle(), (raw) => live.read(raw))
|
|
1716
|
+
}, CLIENT_ONLY)
|
|
1717
|
+
const restingAtom = Atom.make<unknown>(untrack(resting))
|
|
1718
|
+
onCleanup(registry().mount(restingAtom))
|
|
1719
|
+
createEffect(
|
|
1720
|
+
resting,
|
|
1721
|
+
(value) => {
|
|
1722
|
+
registry().set(restingAtom, value)
|
|
1723
|
+
},
|
|
1724
|
+
CLIENT_ONLY_DEFERRED,
|
|
1725
|
+
)
|
|
1726
|
+
const own = Atom.make((get) => UndefinedOr.match(get(output), { onUndefined: () => get(restingAtom), onDefined: identity }))
|
|
1727
|
+
// Given to a component (#349): what the element it drives shows, while it's there.
|
|
1728
|
+
const atom = Atom.make((get) => UndefinedOr.match(get(following), { onUndefined: () => get(own), onDefined: (d) => get(d.readAtom(key)) }))
|
|
1729
|
+
return { accessor: followAtom(registry(), atom), atom }
|
|
1730
|
+
})
|
|
1731
|
+
reads.set(key, entry)
|
|
1732
|
+
return entry
|
|
1733
|
+
}
|
|
1734
|
+
const read = (key: string): Accessor<unknown> => readEntry(key).accessor
|
|
1735
|
+
// Its `atom(key)`: the gate's output, or, given to a component (#349), the one of the element it drives.
|
|
1736
|
+
const atomOf = (key: string): Atom.Atom<unknown> => {
|
|
1737
|
+
const own = gate.valueOf(id, key)
|
|
1738
|
+
const following = drivenAtom()
|
|
1739
|
+
return Atom.make((get) => UndefinedOr.match(get(following), { onUndefined: () => get(own), onDefined: (d) => get(d.atom(key)) }))
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
// The element's style, read where it renders. The keys still loading at setup (#257 item 1) are
|
|
1743
|
+
// read there too, with the target, so its region holds until they land and Solid retries it: the
|
|
1744
|
+
// Retarget reads `transition` as it starts, untracked, which a pending one would throw out of.
|
|
1745
|
+
// After that a refetch keeps the last value (Solid holds the previous one), and holds nothing.
|
|
1746
|
+
const holdWhileLoading: () => void = Bool.match(setup.pending.length === 0, {
|
|
1747
|
+
onTrue: () => constVoid,
|
|
1748
|
+
onFalse: () => {
|
|
1749
|
+
const config = cfg() as unknown as Readonly<Record<string, unknown>>
|
|
1750
|
+
// Client-only, so transparent to hydration ids as every computation of the binding's is (#618).
|
|
1751
|
+
const loaded = createMemo((): true => {
|
|
1752
|
+
Arr.forEach(setup.pending, (key) => void config[key])
|
|
1753
|
+
target()
|
|
1754
|
+
return true
|
|
1755
|
+
}, CLIENT_ONLY)
|
|
1756
|
+
return () => {
|
|
1757
|
+
loaded()
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
})
|
|
1761
|
+
const renderedStyle = (): JSX.CSSProperties => {
|
|
1762
|
+
holdWhileLoading()
|
|
1763
|
+
return elementStyle.style(userStyle()) as JSX.CSSProperties
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// The ward: a ref, and its own props. Under a presence, its element is told to it as it's made
|
|
1767
|
+
// (#286): its `key`, and whether it's a twin.
|
|
1768
|
+
// What it shares with a component it's given to (#349), made when one asks.
|
|
1769
|
+
let shared: WardShare | undefined
|
|
1770
|
+
const sharedNow = (): WardShare => {
|
|
1771
|
+
if (Predicate.isNotUndefined(shared)) return shared
|
|
1772
|
+
/**
|
|
1773
|
+
* A ward driving an element for this one, given to a component (#349): followed until the release,
|
|
1774
|
+
* its `read` and `atom` Atoms reading the driver's. One at a time, and not while this one is on an
|
|
1775
|
+
* element of its own (#349's Q5).
|
|
1776
|
+
*/
|
|
1777
|
+
const drive = (next: Driver, name: string): (() => void) => {
|
|
1778
|
+
if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw new Error(secondElement(name))
|
|
1779
|
+
driver = next
|
|
1780
|
+
UndefinedOr.map(driven, (atom) => registry().set(atom, next))
|
|
1781
|
+
return () => {
|
|
1782
|
+
if (driver !== next) return
|
|
1783
|
+
driver = undefined
|
|
1784
|
+
UndefinedOr.map(driven, (atom) => registry().set(atom, undefined))
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
shared = {
|
|
1788
|
+
config,
|
|
1789
|
+
setup: initialConfig,
|
|
1790
|
+
internal,
|
|
1791
|
+
parent,
|
|
1792
|
+
chosen: Predicate.isNotUndefined(internal.parent),
|
|
1793
|
+
carries: carriesVariants(initialConfig),
|
|
1794
|
+
provided: node.provided,
|
|
1795
|
+
layoutGroup,
|
|
1796
|
+
node,
|
|
1797
|
+
lifecycle,
|
|
1798
|
+
drive,
|
|
1799
|
+
}
|
|
1800
|
+
return shared
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
const setMade = madeWith(presence, setElement, initialConfig)
|
|
1804
|
+
const self = ((value?: unknown): WardProps | undefined => {
|
|
1805
|
+
if (isElement(value)) {
|
|
1806
|
+
const last = refdLast
|
|
1807
|
+
if (Predicate.isNotUndefined(last)) {
|
|
1808
|
+
if (last !== value) {
|
|
1809
|
+
refdBefore = last
|
|
1810
|
+
if (Bool.not(last.isConnected)) fresh = value
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
refdLast = value
|
|
1814
|
+
setMade(value)
|
|
1815
|
+
return undefined
|
|
1816
|
+
}
|
|
1817
|
+
return spreadNow()
|
|
1818
|
+
}) as Ward
|
|
1819
|
+
// What a spread of the ward reads (#495): its spread's props alone, made at its first spread, so a
|
|
1820
|
+
// ward given only to `ref` makes none, and a Reorder item's keyboard attributes are in it.
|
|
1821
|
+
let spread: WardProps | undefined
|
|
1822
|
+
// Its `style` and its attributes as descriptors, made once (#460): its own keys, its spread and each
|
|
1823
|
+
// `.with()` share them.
|
|
1824
|
+
const styleKey: PropertyDescriptor = { get: renderedStyle, enumerable: true }
|
|
1825
|
+
const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults))
|
|
1826
|
+
const spreadNow = (): WardProps => {
|
|
1827
|
+
if (Predicate.isUndefined(spread)) spread = spreadOfWard(self, { value: self, enumerable: true }, styleKey, attributes)
|
|
1828
|
+
return spread
|
|
1829
|
+
}
|
|
1830
|
+
// Its members are the ones every ward shares (#525), reading this state: its own are `ref`, `style`
|
|
1831
|
+
// and its attributes.
|
|
1832
|
+
const state: WardState = {
|
|
1833
|
+
shared: sharedNow,
|
|
1834
|
+
Provider,
|
|
1835
|
+
read,
|
|
1836
|
+
atom: atomOf,
|
|
1837
|
+
with: (own: WardWithProps): WardProps => {
|
|
1838
|
+
given = own
|
|
1839
|
+
withCallsOf()[1](undefined)
|
|
1840
|
+
return spreadPropsOf({ ref: { value: withRef(own.ref, self), enumerable: true }, style: styleKey, ...attributes })
|
|
1841
|
+
},
|
|
1842
|
+
lifecycle,
|
|
1843
|
+
settled: undefined,
|
|
1844
|
+
tapped: undefined,
|
|
1845
|
+
next: undefined,
|
|
1846
|
+
each: undefined,
|
|
1847
|
+
when: undefined,
|
|
1848
|
+
}
|
|
1849
|
+
Object.setPrototypeOf(self, WARD_MEMBERS)
|
|
1850
|
+
Object.defineProperties(self, {
|
|
1851
|
+
[WARD_STATE]: { value: state },
|
|
1852
|
+
ref: { value: self, enumerable: true },
|
|
1853
|
+
style: styleKey,
|
|
1854
|
+
...attributes,
|
|
1855
|
+
})
|
|
1856
|
+
return self
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
/** A key's `read`: its accessor, and the Atom it follows. */
|
|
1860
|
+
interface ReadEntry {
|
|
1861
|
+
readonly accessor: Accessor<unknown>
|
|
1862
|
+
readonly atom: Atom.Atom<unknown>
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/** No `.with()` props: the config's style alone. */
|
|
1866
|
+
const NO_WITH: WardWithProps = {}
|
|
1867
|
+
|
|
1868
|
+
/** The last `.with()` merge, by its two styles: `style` reads it more than once a run. */
|
|
1869
|
+
// Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
|
|
1870
|
+
const withMerges = new WeakMap<object, { readonly own: unknown; readonly merged: WardStyle | string | undefined }>()
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* The config's `style` with a `.with()` style over it, key by key (#264, `Style.over`): the config's
|
|
1874
|
+
* as it is with none. One merge for the same two styles, so the element's Live values see one object.
|
|
1875
|
+
*/
|
|
1876
|
+
const withStyleOver = (own: WardStyle | string | undefined, extra: WardStyle | string | undefined): WardStyle | string | undefined => {
|
|
1877
|
+
if (Predicate.isUndefined(extra)) return own
|
|
1878
|
+
if (Predicate.isString(extra)) return Style.over(extra, own) as WardStyle
|
|
1879
|
+
return Option.getOrElse(
|
|
1880
|
+
Option.map(Option.filter(Option.fromUndefinedOr(withMerges.get(extra)), (known) => known.own === own), (known) => known.merged),
|
|
1881
|
+
() => {
|
|
1882
|
+
const merged = Style.over(extra, own) as WardStyle
|
|
1883
|
+
withMerges.set(extra, { own, merged })
|
|
1884
|
+
return merged
|
|
1885
|
+
},
|
|
1886
|
+
)
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/** A `.with()` ref beside the ward's own: the user's first, as `refsOf` orders them. */
|
|
1890
|
+
const withRef = (user: WardWithProps["ref"], self: Ward): ((element: HTMLElement) => void) => {
|
|
1891
|
+
if (Predicate.isUndefined(user)) return self
|
|
1892
|
+
const refs = Arr.ensure(user) as ReadonlyArray<(element: HTMLElement) => void>
|
|
1893
|
+
return (element) => {
|
|
1894
|
+
Arr.forEach(refs, (ref) => ref(element))
|
|
1895
|
+
self(element)
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* The Starting style's attributes, and a drag element's default ones when it `drags`, as a ward's own
|
|
1901
|
+
* keys: enumerable, so a spread applies them. Made once a ward (#460), into one map.
|
|
1902
|
+
*/
|
|
1903
|
+
const attributeKeysOf = (attrs: Readonly<Record<string, unknown>>, drags: boolean): PropertyDescriptorMap => {
|
|
1904
|
+
const keys: PropertyDescriptorMap = {}
|
|
1905
|
+
addAttributeKeys(keys, attrs)
|
|
1906
|
+
if (drags) addAttributeKeys(keys, Style.DRAG_DEFAULT_ATTRIBUTES)
|
|
1907
|
+
return keys
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
/** Each of `attrs` as an enumerable key, into `keys`: a later one wins a key both set. */
|
|
1911
|
+
const addAttributeKeys = (keys: PropertyDescriptorMap, attrs: Readonly<Record<string, unknown>>): void =>
|
|
1912
|
+
Arr.forEach(Object.keys(attrs), (key) => {
|
|
1913
|
+
keys[key] = { value: attrs[key], enumerable: true }
|
|
1914
|
+
})
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* A spread's props, reaching no name but their own (#495): what a ward, its `.with()` or a Reorder group
|
|
1918
|
+
* hands an element's spread, and nothing else. Solid 2's `merge` calls a function source and reads each key off
|
|
1919
|
+
* what it returns with `in`, so a ward that returned itself shadowed the element's props with its own
|
|
1920
|
+
* names (`name`, `length`, `read`, `next`…), and an object with a prototype would with
|
|
1921
|
+
* `Object.prototype`'s (`constructor`, `toString`).
|
|
1922
|
+
*/
|
|
1923
|
+
export const spreadPropsOf = <P = WardProps,>(descriptors: PropertyDescriptorMap): P => Object.defineProperties(new SpreadProps(), descriptors) as P
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* What a spread's props are made from (#495): a constructor whose prototype has no prototype and no
|
|
1927
|
+
* names, so its objects reach none but their own. An `Object.create(null)` would too, but V8 keeps it
|
|
1928
|
+
* in dictionary mode: 217 bytes each in Node 24, against 49 (`.tmp/495/spreadmem.mjs`).
|
|
1929
|
+
*/
|
|
1930
|
+
const SpreadProps = function SpreadProps(): void {} as unknown as new () => object
|
|
1931
|
+
SpreadProps.prototype = Object.create(null)
|
|
1932
|
+
|
|
1933
|
+
/** The props a Reorder item adds to its ward's spread (#495): its keyboard attributes. Only items have them. */
|
|
1934
|
+
// Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
|
|
1935
|
+
const SPREAD_EXTRAS = new WeakMap<object, PropertyDescriptorMap>()
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* `ward` with `descriptors` defined on it and added to its spread (#495), for a ward that carries props
|
|
1939
|
+
* of its own kind (a Reorder item's keyboard attributes). Before the ward's first spread.
|
|
1940
|
+
*/
|
|
1941
|
+
export const withSpreadProps = <W extends object>(ward: W, descriptors: PropertyDescriptorMap): W => {
|
|
1942
|
+
SPREAD_EXTRAS.set(ward, descriptors)
|
|
1943
|
+
return Object.defineProperties(ward, descriptors)
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/** A ward's spread: its `ref`, `style` and attributes, and what {@link withSpreadProps} added, on no prototype. Made at its first spread (#460: one map). */
|
|
1947
|
+
const spreadOfWard = (ward: object, ref: PropertyDescriptor, style: PropertyDescriptor, attributes: PropertyDescriptorMap): WardProps => {
|
|
1948
|
+
const extras = SPREAD_EXTRAS.get(ward)
|
|
1949
|
+
if (Predicate.isUndefined(extras)) return spreadPropsOf({ ref, style, ...attributes })
|
|
1950
|
+
return spreadPropsOf({ ref, style, ...attributes, ...extras })
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/** A server's output Atom: nothing is written there, so it stays `undefined`. */
|
|
1954
|
+
const NO_OUTPUT: Atom.Atom<unknown> = Atom.make<unknown>(undefined)
|
|
1955
|
+
|
|
1956
|
+
/** A style value read on a server: an Atom through a server's own registry, an accessor called (#130). */
|
|
1957
|
+
const readServerStyle = (value: unknown): unknown => readLive(value, serverRegistryOf, untrack)
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* {@link wardWith} during a server render (ADR-0021, decisions 1 and 4): the element's Starting
|
|
1961
|
+
* style and attributes, computed purely, and nothing else: no runtime, no spine, no signals. It
|
|
1962
|
+
* makes the client's one `createUniqueId` call, so later hydration keys land where the client's
|
|
1963
|
+
* render puts them, and its `.Provider` renders the same nesting, with the same names and inert
|
|
1964
|
+
* orchestration. No Appear animation yet (PR 4 of #209).
|
|
1965
|
+
*/
|
|
1966
|
+
const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
|
|
1967
|
+
createUniqueId()
|
|
1968
|
+
const view = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig())
|
|
1969
|
+
// A key still loading (#257 item 1): one setup fixes is the client's error here too. One the ward
|
|
1970
|
+
// reads as it goes is read again, throwing Solid's `NotReadyError`: a server waits for it and
|
|
1971
|
+
// renders the component again, so its region streams once the data is in, Appear and all.
|
|
1972
|
+
// Both are checked before the read that waits.
|
|
1973
|
+
const setup = WARD_VIEW.setupOf(view)
|
|
1974
|
+
// Animation controls (#433) set nothing on a server: no entry yet, and controlled, as on the client.
|
|
1975
|
+
const atSetup = uncontrolledOf(configAtSetup(setup))
|
|
1976
|
+
// Where it's made, its given parent's, or its given ward's (#349).
|
|
1977
|
+
const parent = variantParentOf(internal)
|
|
1978
|
+
const presenceBlocks = presenceBlocksInitial(usePresenceContext())
|
|
1979
|
+
if (Bool.and(Arr.contains(setup.pending, "animate"), startsAtAnimate(atSetup, inheritedContext(atSetup, parent), presenceBlocks))) throw new Error(STARTS_AT_PENDING)
|
|
1980
|
+
const c = uncontrolledOf(WARD_VIEW.snapshotOf(view))
|
|
1981
|
+
const node = serverVariantNode(c, parent)
|
|
1982
|
+
const initialValues = startOf(c, node.inherited, presenceBlocks, untrack).initialValues
|
|
1983
|
+
const layoutNode = isLayoutNode(c)
|
|
1984
|
+
const seed = Style.starting(internal.tag, drawnAtRest(initialValues, layoutNode, c.transformTemplate))
|
|
1985
|
+
// Its Appear animation (#48, ADR-0044): its slot in the render's, and the group its Variant
|
|
1986
|
+
// children join when it leads one.
|
|
1987
|
+
const appear = appearEntryOf(useWardicAppear(), c, internal.tag, initialValues, node, startsQuiet(c, node.inherited, presenceBlocks, untrack), settingOf(useWardicConfig()), useWardicSkipAnimations()())
|
|
1988
|
+
// A late chunk's root (#245): the chunk's Appear rules go through the head registry, read once
|
|
1989
|
+
// the chunk has rendered and streamed with it as a head patch. A late element under another late
|
|
1990
|
+
// one registers too: the first read writes the batch, and any other finds it written and adds no
|
|
1991
|
+
// tag, so Solid 1's `within` (which kept a chunk to one `<style>` node) isn't needed.
|
|
1992
|
+
if (appear.chunkRoot) UndefinedOr.map(appear.state, (state) => useHead(appearStyle(state.chunkCss, state.nonce)))
|
|
1993
|
+
const Provider = (props: { readonly children?: JSX.Element }): JSX.Element => (
|
|
1994
|
+
<WardicVariantContext value={contextOf(appear.provided)}>{props.children}</WardicVariantContext>
|
|
1995
|
+
)
|
|
1996
|
+
// Its routed keys' values join the Starting style, under `initial`'s (#130); a `<Reorder>` item's
|
|
1997
|
+
// base style, a drag element's defaults, then its Appear slot go under the user's style. A user
|
|
1998
|
+
// style with its own `animation` keeps it, over the slot, and the slot is left undefined.
|
|
1999
|
+
const dragDefaults = dragDefaultsOf(c, internal)
|
|
2000
|
+
// The element's style for its user style: the config's, or a `.with()` style over it (#264).
|
|
2001
|
+
const styleFor = (user: WardStyle | string | undefined): JSX.CSSProperties => {
|
|
2002
|
+
const parts = split(user)
|
|
2003
|
+
if (setsAnimation(parts.css)) appear.veto("its own style sets an animation")
|
|
2004
|
+
return pipe(
|
|
2005
|
+
serverStartingStyle(internal.tag, seed.style, initialValues, parts.routed, layoutNode, untrack, c.transformTemplate),
|
|
2006
|
+
Style.over(parts.css),
|
|
2007
|
+
Style.over(UndefinedOr.match(internal.baseStyle, { onUndefined: constUndefined, onDefined: (base) => base() })),
|
|
2008
|
+
Style.over(dragDefaults),
|
|
2009
|
+
Style.over(appear.style),
|
|
2010
|
+
) as JSX.CSSProperties
|
|
2011
|
+
}
|
|
2012
|
+
const style = styleFor(c.style)
|
|
2013
|
+
let given: WardWithProps = NO_WITH
|
|
2014
|
+
const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults))
|
|
2015
|
+
// A spread of it reads its spread's props alone, made at its first spread, as the client's (#495).
|
|
2016
|
+
let spread: WardProps | undefined
|
|
2017
|
+
const self = ((): WardProps => {
|
|
2018
|
+
if (Predicate.isUndefined(spread)) spread = spreadOfWard(self, { value: noRef, enumerable: true }, { value: style, enumerable: true }, attributes)
|
|
2019
|
+
return spread
|
|
2020
|
+
}) as Ward
|
|
2021
|
+
// What it shares with a component it's given to (#349): a server's component renders its own.
|
|
2022
|
+
const shared: WardShare = {
|
|
2023
|
+
config,
|
|
2024
|
+
setup: atSetup,
|
|
2025
|
+
internal,
|
|
2026
|
+
parent,
|
|
2027
|
+
chosen: Predicate.isNotUndefined(internal.parent),
|
|
2028
|
+
carries: carriesVariants(atSetup),
|
|
2029
|
+
provided: appear.provided,
|
|
2030
|
+
layoutGroup: useLayoutGroupId(),
|
|
2031
|
+
node: undefined,
|
|
2032
|
+
lifecycle: undefined,
|
|
2033
|
+
drive: () => constVoid,
|
|
2034
|
+
}
|
|
2035
|
+
Object.defineProperties(self, {
|
|
2036
|
+
[WARD]: { value: shared },
|
|
2037
|
+
ref: { value: noRef, enumerable: true },
|
|
2038
|
+
style: { value: style, enumerable: true },
|
|
2039
|
+
...attributes,
|
|
2040
|
+
Provider: { value: Provider },
|
|
2041
|
+
read: { value: (key: string) => () => restingOf(key, initialValues, withStyleOver(c.style, given.style), readServerStyle) },
|
|
2042
|
+
atom: { value: (): Atom.Atom<unknown> => NO_OUTPUT },
|
|
2043
|
+
// Nothing animates on a server: nothing has landed, and nothing will.
|
|
2044
|
+
settled: { value: constUndefined },
|
|
2045
|
+
// Nothing is pressed on a server either.
|
|
2046
|
+
tapped: { value: constUndefined },
|
|
2047
|
+
next: { value: neverLands },
|
|
2048
|
+
each: { value: () => NO_EVENTS },
|
|
2049
|
+
when: { value: serverWhen },
|
|
2050
|
+
// The element's own style over the config's, rendered in its Starting style (#264).
|
|
2051
|
+
with: {
|
|
2052
|
+
value: (own: WardWithProps): WardProps => {
|
|
2053
|
+
given = own
|
|
2054
|
+
return spreadPropsOf({
|
|
2055
|
+
ref: { value: noRef, enumerable: true },
|
|
2056
|
+
style: { value: styleFor(withStyleOver(c.style, own.style)), enumerable: true },
|
|
2057
|
+
...attributes,
|
|
2058
|
+
})
|
|
2059
|
+
},
|
|
2060
|
+
},
|
|
2061
|
+
})
|
|
2062
|
+
return self
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
/** A server render's `ref`: Solid never calls it there. */
|
|
2066
|
+
const noRef = constUndefined
|
|
2067
|
+
|
|
2068
|
+
|