@wardic/foldkit 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +59 -2
- package/THIRD_PARTY_NOTICES.md +145 -0
- package/dist/AnimationControls.d.ts +37 -0
- package/dist/AnimationControls.d.ts.map +1 -0
- package/dist/AnimationControls.js +37 -0
- package/dist/AnimationControls.js.map +1 -0
- package/dist/AnimationScope.d.ts +20 -0
- package/dist/AnimationScope.d.ts.map +1 -0
- package/dist/AnimationScope.js +20 -0
- package/dist/AnimationScope.js.map +1 -0
- package/dist/DragControls.d.ts +25 -0
- package/dist/DragControls.d.ts.map +1 -0
- package/dist/DragControls.js +21 -0
- package/dist/DragControls.js.map +1 -0
- package/dist/Features.d.ts +36 -0
- package/dist/Features.d.ts.map +1 -0
- package/dist/Features.js +44 -0
- package/dist/Features.js.map +1 -0
- package/dist/Ward.d.ts +301 -0
- package/dist/Ward.d.ts.map +1 -0
- package/dist/Ward.js +6 -0
- package/dist/Ward.js.map +1 -0
- package/dist/Wardic.d.ts +363 -0
- package/dist/Wardic.d.ts.map +1 -0
- package/dist/Wardic.js +85 -0
- package/dist/Wardic.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/builder.d.ts +8 -0
- package/dist/internal/builder.d.ts.map +1 -0
- package/dist/internal/builder.js +242 -0
- package/dist/internal/builder.js.map +1 -0
- package/dist/internal/commands.d.ts +143 -0
- package/dist/internal/commands.d.ts.map +1 -0
- package/dist/internal/commands.js +242 -0
- package/dist/internal/commands.js.map +1 -0
- package/dist/internal/delivery.d.ts +44 -0
- package/dist/internal/delivery.d.ts.map +1 -0
- package/dist/internal/delivery.js +85 -0
- package/dist/internal/delivery.js.map +1 -0
- package/dist/internal/dev.d.ts +10 -0
- package/dist/internal/dev.d.ts.map +1 -0
- package/dist/internal/dev.js +10 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/dev.production.d.ts +8 -0
- package/dist/internal/dev.production.d.ts.map +1 -0
- package/dist/internal/dev.production.js +8 -0
- package/dist/internal/dev.production.js.map +1 -0
- package/dist/internal/drag.d.ts +66 -0
- package/dist/internal/drag.d.ts.map +1 -0
- package/dist/internal/drag.js +71 -0
- package/dist/internal/drag.js.map +1 -0
- package/dist/internal/element.d.ts +59 -0
- package/dist/internal/element.d.ts.map +1 -0
- package/dist/internal/element.js +582 -0
- package/dist/internal/element.js.map +1 -0
- package/dist/internal/gestures.d.ts +62 -0
- package/dist/internal/gestures.d.ts.map +1 -0
- package/dist/internal/gestures.js +109 -0
- package/dist/internal/gestures.js.map +1 -0
- package/dist/internal/hydrate.d.ts +5 -0
- package/dist/internal/hydrate.d.ts.map +1 -0
- package/dist/internal/hydrate.js +27 -0
- package/dist/internal/hydrate.js.map +1 -0
- package/dist/internal/keys.d.ts +21 -0
- package/dist/internal/keys.d.ts.map +1 -0
- package/dist/internal/keys.js +12 -0
- package/dist/internal/keys.js.map +1 -0
- package/dist/internal/layout.d.ts +29 -0
- package/dist/internal/layout.d.ts.map +1 -0
- package/dist/internal/layout.js +88 -0
- package/dist/internal/layout.js.map +1 -0
- package/dist/internal/mount.d.ts +22 -0
- package/dist/internal/mount.d.ts.map +1 -0
- package/dist/internal/mount.js +100 -0
- package/dist/internal/mount.js.map +1 -0
- package/dist/internal/presence.d.ts +33 -0
- package/dist/internal/presence.d.ts.map +1 -0
- package/dist/internal/presence.js +338 -0
- package/dist/internal/presence.js.map +1 -0
- package/dist/internal/reactivity.d.ts +15 -0
- package/dist/internal/reactivity.d.ts.map +1 -0
- package/dist/internal/reactivity.js +26 -0
- package/dist/internal/reactivity.js.map +1 -0
- package/dist/internal/reorder.d.ts +47 -0
- package/dist/internal/reorder.d.ts.map +1 -0
- package/dist/internal/reorder.js +250 -0
- package/dist/internal/reorder.js.map +1 -0
- package/dist/internal/scope.d.ts +28 -0
- package/dist/internal/scope.d.ts.map +1 -0
- package/dist/internal/scope.js +44 -0
- package/dist/internal/scope.js.map +1 -0
- package/dist/internal/server.d.ts +13 -0
- package/dist/internal/server.d.ts.map +1 -0
- package/dist/internal/server.js +13 -0
- package/dist/internal/server.js.map +1 -0
- package/dist/internal/server.node.d.ts +8 -0
- package/dist/internal/server.node.d.ts.map +1 -0
- package/dist/internal/server.node.js +8 -0
- package/dist/internal/server.node.js.map +1 -0
- package/dist/internal/services.d.ts +222 -0
- package/dist/internal/services.d.ts.map +1 -0
- package/dist/internal/services.js +338 -0
- package/dist/internal/services.js.map +1 -0
- package/dist/internal/tree.d.ts +71 -0
- package/dist/internal/tree.d.ts.map +1 -0
- package/dist/internal/tree.js +207 -0
- package/dist/internal/tree.js.map +1 -0
- package/dist/internal/variant-node.d.ts +62 -0
- package/dist/internal/variant-node.d.ts.map +1 -0
- package/dist/internal/variant-node.js +279 -0
- package/dist/internal/variant-node.js.map +1 -0
- package/dist/internal/view-transition.d.ts +10 -0
- package/dist/internal/view-transition.d.ts.map +1 -0
- package/dist/internal/view-transition.js +36 -0
- package/dist/internal/view-transition.js.map +1 -0
- package/dist/internal/walk.d.ts +26 -0
- package/dist/internal/walk.d.ts.map +1 -0
- package/dist/internal/walk.js +162 -0
- package/dist/internal/walk.js.map +1 -0
- package/package.json +99 -4
- package/src/AnimationControls.ts +46 -0
- package/src/AnimationScope.ts +19 -0
- package/src/DragControls.ts +27 -0
- package/src/Features.ts +45 -0
- package/src/Ward.ts +434 -0
- package/src/Wardic.ts +410 -0
- package/src/index.ts +20 -0
- package/src/internal/builder.ts +262 -0
- package/src/internal/commands.ts +359 -0
- package/src/internal/delivery.ts +116 -0
- package/src/internal/dev.production.ts +7 -0
- package/src/internal/dev.ts +9 -0
- package/src/internal/drag.ts +136 -0
- package/src/internal/element.ts +668 -0
- package/src/internal/gestures.ts +184 -0
- package/src/internal/hydrate.ts +29 -0
- package/src/internal/keys.ts +19 -0
- package/src/internal/layout.ts +109 -0
- package/src/internal/mount.ts +124 -0
- package/src/internal/presence.ts +362 -0
- package/src/internal/reactivity.ts +45 -0
- package/src/internal/reorder.ts +313 -0
- package/src/internal/scope.ts +60 -0
- package/src/internal/server.node.ts +7 -0
- package/src/internal/server.ts +12 -0
- package/src/internal/services.ts +486 -0
- package/src/internal/tree.ts +230 -0
- package/src/internal/variant-node.ts +352 -0
- package/src/internal/view-transition.ts +43 -0
- package/src/internal/walk.ts +211 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant-node.js","sourceRoot":"","sources":["../../src/internal/variant-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,iBAAiB,MAAM,yCAAyC,CAAA;AAE5E,OAAO,KAAK,aAAa,MAAM,qCAAqC,CAAA;AACpE,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAA;AAChE,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAyDjD,qFAAqF;AACrF,MAAM,UAAU,GAAG,GAA8B,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAA;AAUjF;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CACvB,IAAU,EACV,MAAyD,EACzD,SAA4D,EAC5D,MAAkB,EACA,EAAE;IACpB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAA;IACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC1B,MAAM,MAAM,GAAG,GAAG,EAAE,CAAA;IACpB,kGAAkG;IAClG,MAAM,OAAO,GAAG,IAAI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AAA;IACD,OAAO;QACL,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CACjB,IAAI,CAAC,GAAG,CACN,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,EACxH,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAC1F;QACH,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC;QACrC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC;KACtC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Runtime from "foldkit/runtime";
|
|
2
|
+
import type { State } from "./services.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The Handle's `viewTransition` (above): `decide`, with a transitioning decision arming the next pass,
|
|
5
|
+
* whichever asks for it: the observer's delivery of the app's own changes, a `w.LayoutDependency`
|
|
6
|
+
* change, or `Wardic.animateLayout`. Every render decides afresh, so a transitioned render that
|
|
7
|
+
* changed nothing of the layout's leaves no arming behind.
|
|
8
|
+
*/
|
|
9
|
+
export declare const viewTransitionOf: (state: State) => <Model, Message>(decide: Runtime.ViewTransitionConfig<Model, Message>) => Runtime.ViewTransitionConfig<Model, Message>;
|
|
10
|
+
//# sourceMappingURL=view-transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-transition.d.ts","sourceRoot":"","sources":["../../src/internal/view-transition.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAe1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UACnB,KAAK,MACZ,KAAK,EAAE,OAAO,UAAU,OAAO,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAKlH,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View Transitions on Foldkit (ADR-0071 decision 33; P10): `wardic.viewTransition(decide)` wraps the
|
|
3
|
+
* app's `viewTransition` predicate. Foldkit calls it before each live render; when it transitions the
|
|
4
|
+
* render (`true`, or `{ types }`), the wrapper arms the Handle's next layout delivery to run its pass as
|
|
5
|
+
* an Instant change, so layout moves and `layoutId` handovers land at once and the View Transition's
|
|
6
|
+
* morph carries the motion. Retargets in that render animate as usual. Where the document has no
|
|
7
|
+
* `startViewTransition`, Foldkit renders plainly and the wrapper arms nothing, so Wardic animates the
|
|
8
|
+
* moves itself. The decision passes through unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import * as Bool from "effect/Boolean";
|
|
13
|
+
import * as Predicate from "effect/Predicate";
|
|
14
|
+
/** Whether the document can transition a render: feature-detected once, at the first decision, as Foldkit's runtime detects it once. */
|
|
15
|
+
// Module state (#460, Q7): the detection, held once made; `undefined` until a decision asks.
|
|
16
|
+
let supported;
|
|
17
|
+
const isSupported = () => {
|
|
18
|
+
if (Predicate.isNotUndefined(supported))
|
|
19
|
+
return supported;
|
|
20
|
+
supported = Predicate.isFunction(document.startViewTransition);
|
|
21
|
+
return supported;
|
|
22
|
+
};
|
|
23
|
+
/** Whether a decision transitions the render: `true`, or `{ types }`. */
|
|
24
|
+
const transitions = (decision) => decision !== false;
|
|
25
|
+
/**
|
|
26
|
+
* The Handle's `viewTransition` (above): `decide`, with a transitioning decision arming the next pass,
|
|
27
|
+
* whichever asks for it: the observer's delivery of the app's own changes, a `w.LayoutDependency`
|
|
28
|
+
* change, or `Wardic.animateLayout`. Every render decides afresh, so a transitioned render that
|
|
29
|
+
* changed nothing of the layout's leaves no arming behind.
|
|
30
|
+
*/
|
|
31
|
+
export const viewTransitionOf = (state) => (decide) => (context) => {
|
|
32
|
+
const decision = decide(context);
|
|
33
|
+
state.transitioning = Bool.and(transitions(decision), isSupported());
|
|
34
|
+
return decision;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=view-transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-transition.js","sourceRoot":"","sources":["../../src/internal/view-transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAI7C,wIAAwI;AACxI,6FAA6F;AAC7F,IAAI,SAA8B,CAAA;AAElC,MAAM,WAAW,GAAG,GAAY,EAAE;IAChC,IAAI,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IACzD,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAA;IAC9D,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED,yEAAyE;AACzE,MAAM,WAAW,GAAG,CAAC,QAAwC,EAAW,EAAE,CAAC,QAAQ,KAAK,KAAK,CAAA;AAE7F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CAAC,KAAY,EAAE,EAAE,CACjB,CAAiB,MAAoD,EAAgD,EAAE,CACvH,CAAC,OAAO,EAAE,EAAE;IACV,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;IAChC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC,CAAA;IACpE,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type State } from "./services.ts";
|
|
2
|
+
/** A view node's data, as the walk reads and writes it: its style record, its attributes and its props. */
|
|
3
|
+
export interface ViewData {
|
|
4
|
+
style?: Record<string, string> | undefined;
|
|
5
|
+
attrs?: Record<string, string> | undefined;
|
|
6
|
+
props?: Record<string, unknown> | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A Foldkit view node as the walk reads it: its tag, its data and its children. Foldkit's `vdom` isn't
|
|
10
|
+
* an export, so the node is read by this shape alone, through `unknown` at the builder.
|
|
11
|
+
*/
|
|
12
|
+
export interface ViewNode {
|
|
13
|
+
readonly sel?: string | undefined;
|
|
14
|
+
data?: ViewData | undefined;
|
|
15
|
+
children?: ReadonlyArray<ViewNode | string> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Walk the Provider element's subtree from `root`, the Provider element itself: each Wardic element
|
|
19
|
+
* (one carrying a config) is read for it, and a Variant child's inherited Starting style, or a held
|
|
20
|
+
* child's, is written into its node's style. On a server, and on a client while hydration's window is
|
|
21
|
+
* open, each element enters the render's Appear animations, its `animation` written when it plays;
|
|
22
|
+
* what comes back is their CSS on a server, "" for none and on a client, which the Provider element
|
|
23
|
+
* renders in its chunk.
|
|
24
|
+
*/
|
|
25
|
+
export declare const walkProvider: (root: ViewNode, state: State) => string;
|
|
26
|
+
//# sourceMappingURL=walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/internal/walk.ts"],"names":[],"mappings":"AAqDA,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAIjE,2GAA2G;AAC3G,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAG,SAAS,CAAA;CACxD;AA4DD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,SAAU,QAAQ,SAAS,KAAK,KAAG,MAiC3D,CAAA"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The walk at the Provider element's build (#794, Q7; ADR-0071 decision 21's builder-time walk, in
|
|
3
|
+
* place rather than copy-on-write): Foldkit builds children before their parent, so when the Provider
|
|
4
|
+
* element is built its whole subtree exists as view nodes, plain objects with their `data.style`. The
|
|
5
|
+
* walk visits them once per render, top-down, carrying the variant context each Wardic element
|
|
6
|
+
* provides (core's server variant node, pure), whether a `w.Presence({ initial: false })` above holds
|
|
7
|
+
* its children at their `Animate`, and the nearest `w.Config`'s value, and writes each Variant child's
|
|
8
|
+
* inherited Starting style, or a held child's, into its node's style in place, so the server's HTML
|
|
9
|
+
* and the client's hydration render carry what its Mount would otherwise write at its insert. A
|
|
10
|
+
* patched node serialises as patched (probe P-A). The same walk runs on the server and the client: a
|
|
11
|
+
* hydration render must reproduce the server's style attribute, or Foldkit reconciles the mismatch and
|
|
12
|
+
* strips what the client didn't reassert (P-C). An element with the bundle (`w.attributes`) is a Wardic
|
|
13
|
+
* element here as it is to the client's tree: both go by the config it carries, not by the stamp. On
|
|
14
|
+
* the client, a presence's `initial: false` holds its first render's children alone: a child the walk
|
|
15
|
+
* holds at a later render is started at its `Initial` by its Mount, inside the same patch.
|
|
16
|
+
*
|
|
17
|
+
* On a server, the walk is the render's **Appear animations** too (ADR-0044; #794, PR 2, Q3 and Q8):
|
|
18
|
+
* each Wardic element enters dom's server Appear as Solid's server ward does, its slot named by its
|
|
19
|
+
* index path under the Provider element (Q9), the same on the server and the hydration render, and its
|
|
20
|
+
* `animation` written into its node's style when it plays; the CSS comes back for the Provider element
|
|
21
|
+
* to render as its first child, the chunk the client moves into the head before it hydrates
|
|
22
|
+
* (`wardic.hydrate`, PR 3). A Provider element under this one rendered a chunk of its own first:
|
|
23
|
+
* dropped here, so the rules are this walk's alone and the paths the view's (the client reports and
|
|
24
|
+
* ignores a second provider).
|
|
25
|
+
*
|
|
26
|
+
* On a client, the hydration render's walk samples the same way (PR 3, Q9 and Q10), with no explainer and
|
|
27
|
+
* no CSS asked for: each element's slot is named in its style as the server named it, so the inline
|
|
28
|
+
* `animation` the CSS plays through survives hydration for its Mount's Handoff (decision 6) rather than
|
|
29
|
+
* being stripped as a value the client didn't reassert (P-C). So does every render while a Handoff is
|
|
30
|
+
* still under way, which a render before an element's first commit would otherwise strip, cancelling
|
|
31
|
+
* the CSS before its ward took it over; once the last has released, no render samples (the Mounts have
|
|
32
|
+
* the animations), and a render that reorders the view can't hand one element another's.
|
|
33
|
+
*
|
|
34
|
+
* @module
|
|
35
|
+
*/
|
|
36
|
+
import * as AnimationControls from "@wardic/core/unstable/AnimationControls";
|
|
37
|
+
import * as Spine from "@wardic/core/unstable/Spine";
|
|
38
|
+
import * as VariantTree from "@wardic/core/unstable/VariantTree";
|
|
39
|
+
import * as WardicConfigValue from "@wardic/core/unstable/WardicConfigValue";
|
|
40
|
+
import * as Appear from "@wardic/dom/Appear";
|
|
41
|
+
import * as AppearAnimations from "@wardic/dom/unstable/AppearAnimations";
|
|
42
|
+
import * as ElementSetup from "@wardic/dom/unstable/ElementSetup";
|
|
43
|
+
import * as Arr from "effect/Array";
|
|
44
|
+
import * as Bool from "effect/Boolean";
|
|
45
|
+
import { constFalse, constUndefined, identity } from "effect/Function";
|
|
46
|
+
import * as Predicate from "effect/Predicate";
|
|
47
|
+
import * as Rec from "effect/Record";
|
|
48
|
+
import * as Str from "effect/String";
|
|
49
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
50
|
+
import { carriedBy } from "./delivery.js";
|
|
51
|
+
import { configOf, startingStyleFrom } from "./element.js";
|
|
52
|
+
import { holdsInitial } from "./presence.js";
|
|
53
|
+
import { reactivity } from "./reactivity.js";
|
|
54
|
+
import { appearsOn, registryOf } from "./services.js";
|
|
55
|
+
import { configValueUnder } from "./tree.js";
|
|
56
|
+
import { IS_SERVER } from "@wardic/foldkit/internal/server";
|
|
57
|
+
/**
|
|
58
|
+
* Whether the children of an element with `config` are held at their `Animate`: its own `w.Presence`'s
|
|
59
|
+
* word when it carries one (the nearest presence's, as the Mount reads it: a nested presence replaces
|
|
60
|
+
* the one above), else what's above it.
|
|
61
|
+
*/
|
|
62
|
+
const heldUnder = (config, above) => UndefinedOr.match(config.presence, { onUndefined: () => above, onDefined: holdsInitial });
|
|
63
|
+
/** A child's index path under the Provider element (Q9): its parent's path and its index among its parent's children, the Provider element's own "". */
|
|
64
|
+
const pathOf = (parent, index) => Bool.match(Str.isEmpty(parent), { onTrue: () => String(index), onFalse: () => `${parent}-${index}` });
|
|
65
|
+
/** Whether a node is a chunk `<style>` a Provider element under this one rendered (the builder's `prependChunk`). */
|
|
66
|
+
const isChunk = (node) => {
|
|
67
|
+
if (Predicate.isString(node))
|
|
68
|
+
return false;
|
|
69
|
+
return Bool.and(node.sel === "style", UndefinedOr.match(UndefinedOr.map(node.data, (data) => data.attrs), { onUndefined: constFalse, onDefined: (attrs) => Object.hasOwn(attrs, Appear.CHUNK_ATTRIBUTE) }));
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* The render's Appear animations (ADR-0044, decisions 3 and 5; #794, Q3 and Q9): on a server, dom's, from
|
|
73
|
+
* the Handle's `appear` and `nonce` and its config's reduced motion, none with `appear: false`; on a
|
|
74
|
+
* client, while hydration's window is open (the hydration render, and the renders before the last
|
|
75
|
+
* Handoff has released), the same sampling without the explainer (the server said its words) and
|
|
76
|
+
* without a nonce (no chunk is rendered), so each element's slot is named as the server named it; none
|
|
77
|
+
* at any other render.
|
|
78
|
+
*/
|
|
79
|
+
const appearOfRender = (state) => {
|
|
80
|
+
const setting = WardicConfigValue.settingOf(state.rootConfig);
|
|
81
|
+
if (IS_SERVER)
|
|
82
|
+
return AppearAnimations.serverAppearUnder(state.server.appear, setting, state.server.nonce);
|
|
83
|
+
return Bool.match(state.hydrating, { onTrue: () => AppearAnimations.serverAppearUnder(appearsOn(state.server), setting, undefined), onFalse: constUndefined });
|
|
84
|
+
};
|
|
85
|
+
/** The render's CSS: on a server, for the Provider element's chunk; "" on a client, whose rules the server rendered and `wardic.hydrate` moved into the head. */
|
|
86
|
+
const cssOf = (render) => {
|
|
87
|
+
if (IS_SERVER)
|
|
88
|
+
return render.css();
|
|
89
|
+
return "";
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Walk the Provider element's subtree from `root`, the Provider element itself: each Wardic element
|
|
93
|
+
* (one carrying a config) is read for it, and a Variant child's inherited Starting style, or a held
|
|
94
|
+
* child's, is written into its node's style. On a server, and on a client while hydration's window is
|
|
95
|
+
* open, each element enters the render's Appear animations, its `animation` written when it plays;
|
|
96
|
+
* what comes back is their CSS on a server, "" for none and on a client, which the Provider element
|
|
97
|
+
* renders in its chunk.
|
|
98
|
+
*/
|
|
99
|
+
export const walkProvider = (root, state) => {
|
|
100
|
+
const registry = registryOf(state);
|
|
101
|
+
const appear = appearOfRender(state);
|
|
102
|
+
const visitChildren = (parent, above, path) => {
|
|
103
|
+
if (Predicate.isUndefined(parent.children))
|
|
104
|
+
return;
|
|
105
|
+
// A Provider element under this one rendered its chunk first (the builder's `prependChunk`, Q4): dropped
|
|
106
|
+
// before the children are counted, so their paths are the view's, as the client's hydration walk counts
|
|
107
|
+
// them, and the rules are this walk's alone.
|
|
108
|
+
if (Bool.and(Predicate.isNotUndefined(appear), Arr.some(parent.children, isChunk)))
|
|
109
|
+
parent.children = Arr.filter(parent.children, (child) => Bool.not(isChunk(child)));
|
|
110
|
+
Arr.forEach(parent.children, (child, index) => visit(child, above, pathOf(path, index)));
|
|
111
|
+
};
|
|
112
|
+
const visit = (node, above, path) => {
|
|
113
|
+
if (Predicate.isString(node))
|
|
114
|
+
return;
|
|
115
|
+
const carried = carriedBy(UndefinedOr.map(node.data, (data) => data.props));
|
|
116
|
+
// A plain element passes its ancestors' context through, as the client's tree walk does (decision 21).
|
|
117
|
+
if (Predicate.isUndefined(carried)) {
|
|
118
|
+
visitChildren(node, above, path);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// One given Animation controls has no entry yet (#433; #798, Q5): its Starting style, nothing to play.
|
|
122
|
+
const config = AnimationControls.uncontrolledOf(configOf(carried));
|
|
123
|
+
const variant = VariantTree.serverVariantNode(config, above.provided);
|
|
124
|
+
const start = Spine.startOf(config, variant.inherited, above.held, reactivity.untrack);
|
|
125
|
+
if (Bool.or(Predicate.isNotUndefined(variant.inherited), above.held))
|
|
126
|
+
writeStyle(node, startingStyleFrom(node.sel, config, registry, start));
|
|
127
|
+
const configValue = UndefinedOr.match(config.config, { onUndefined: () => above.config, onDefined: (own) => configValueUnder(() => own, above.config) });
|
|
128
|
+
const provided = UndefinedOr.match(appear, {
|
|
129
|
+
onUndefined: () => variant.provided,
|
|
130
|
+
onDefined: (render) => enter(render, { node, config, variant, start, configValue, path }),
|
|
131
|
+
});
|
|
132
|
+
visitChildren(node, { provided, held: heldUnder(config, above.held), config: configValue }, path);
|
|
133
|
+
};
|
|
134
|
+
visit(root, { provided: undefined, held: false, config: state.rootConfig }, "");
|
|
135
|
+
return UndefinedOr.match(appear, { onUndefined: () => "", onDefined: cssOf });
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* The element's entry in the render's Appear animations (ADR-0044; dom's `appearEntryOf`, as Solid's
|
|
139
|
+
* server ward takes it): its config with its Config transition and no Animation controls, as a server
|
|
140
|
+
* reads it; its `animation` written into its node's style when it plays, a style with its own
|
|
141
|
+
* `animation` vetoing it (decision 4); and what its children inherit, the group it leads among it.
|
|
142
|
+
*/
|
|
143
|
+
const enter = (appear, visit) => {
|
|
144
|
+
const read = AnimationControls.uncontrolledOf(WardicConfigValue.withConfigTransition(visit.config, visit.configValue));
|
|
145
|
+
const entry = ElementSetup.appearEntryOf(appear, read, visit.node.sel, visit.start.initialValues, visit.variant, visit.start.quiet, WardicConfigValue.settingOf(visit.configValue), WardicConfigValue.skipAnimationsOf(visit.configValue)(), visit.path);
|
|
146
|
+
Bool.match(AppearAnimations.setsAnimation(visit.config.style), {
|
|
147
|
+
onTrue: () => entry.veto(AppearAnimations.OWN_ANIMATION),
|
|
148
|
+
onFalse: () => UndefinedOr.map(entry.style, (style) => writeStyle(visit.node, style)),
|
|
149
|
+
});
|
|
150
|
+
return entry.provided;
|
|
151
|
+
};
|
|
152
|
+
/** `patch` written into the node's style, over what its own build rendered. */
|
|
153
|
+
const writeStyle = (node, patch) => {
|
|
154
|
+
const data = UndefinedOr.match(node.data, { onUndefined: () => ({}), onDefined: identity });
|
|
155
|
+
const style = UndefinedOr.match(data.style, { onUndefined: () => ({}), onDefined: identity });
|
|
156
|
+
Arr.forEach(Rec.keys(patch), (key) => {
|
|
157
|
+
style[key] = String(patch[key]);
|
|
158
|
+
});
|
|
159
|
+
data.style = style;
|
|
160
|
+
node.data = data;
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=walk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/internal/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,iBAAiB,MAAM,yCAAyC,CA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AAI,CAAA;AAClB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,101 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wardic/foldkit",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Wardic for Foldkit: Motion's animations on Foldkit's views, as Effect.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"animation",
|
|
7
|
+
"motion",
|
|
8
|
+
"foldkit",
|
|
9
|
+
"effect"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://wardic.dev",
|
|
12
|
+
"bugs": "https://github.com/wardiclabs/wardic/issues",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/wardiclabs/wardic.git",
|
|
16
|
+
"directory": "packages/foldkit"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "The Wardic contributors",
|
|
21
|
+
"email": "hello@wardic.dev",
|
|
22
|
+
"url": "https://wardic.dev"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/**/*.js",
|
|
26
|
+
"dist/**/*.d.ts",
|
|
27
|
+
"dist/**/*.map",
|
|
28
|
+
"src",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"THIRD_PARTY_NOTICES.md"
|
|
32
|
+
],
|
|
33
|
+
"type": "module",
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
".": {
|
|
41
|
+
"@wardic/source": "./src/index.ts",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"default": "./dist/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./internal/dev": {
|
|
46
|
+
"development": {
|
|
47
|
+
"@wardic/source": "./src/internal/dev.ts",
|
|
48
|
+
"types": "./dist/internal/dev.d.ts",
|
|
49
|
+
"default": "./dist/internal/dev.js"
|
|
50
|
+
},
|
|
51
|
+
"@wardic/source": "./src/internal/dev.production.ts",
|
|
52
|
+
"types": "./dist/internal/dev.production.d.ts",
|
|
53
|
+
"default": "./dist/internal/dev.production.js"
|
|
54
|
+
},
|
|
55
|
+
"./internal/server": {
|
|
56
|
+
"node": {
|
|
57
|
+
"@wardic/source": "./src/internal/server.node.ts",
|
|
58
|
+
"types": "./dist/internal/server.node.d.ts",
|
|
59
|
+
"default": "./dist/internal/server.node.js"
|
|
60
|
+
},
|
|
61
|
+
"worker": {
|
|
62
|
+
"@wardic/source": "./src/internal/server.node.ts",
|
|
63
|
+
"types": "./dist/internal/server.node.d.ts",
|
|
64
|
+
"default": "./dist/internal/server.node.js"
|
|
65
|
+
},
|
|
66
|
+
"deno": {
|
|
67
|
+
"@wardic/source": "./src/internal/server.node.ts",
|
|
68
|
+
"types": "./dist/internal/server.node.d.ts",
|
|
69
|
+
"default": "./dist/internal/server.node.js"
|
|
70
|
+
},
|
|
71
|
+
"@wardic/source": "./src/internal/server.ts",
|
|
72
|
+
"types": "./dist/internal/server.d.ts",
|
|
73
|
+
"default": "./dist/internal/server.js"
|
|
74
|
+
},
|
|
75
|
+
"./internal/*": null,
|
|
76
|
+
"./*": {
|
|
77
|
+
"@wardic/source": "./src/*.ts",
|
|
78
|
+
"types": "./dist/*.d.ts",
|
|
79
|
+
"default": "./dist/*.js"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"build": "../../node_modules/typescript-7/bin/tsc --build",
|
|
84
|
+
"typecheck": "../../node_modules/typescript-7/bin/tsc --build",
|
|
85
|
+
"typecheck:tests": "../../node_modules/typescript-7/bin/tsc -p tsconfig.test.json"
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"@wardic/core": "1.2.0",
|
|
89
|
+
"@wardic/dom": "1.2.0"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"effect": "^4.1.1",
|
|
93
|
+
"foldkit": "~0.170.0 || ~0.171.0"
|
|
94
|
+
},
|
|
95
|
+
"devDependencies": {
|
|
96
|
+
"@effect/platform-browser": "4.1.4",
|
|
97
|
+
"@wardic/test": "1.2.0",
|
|
98
|
+
"effect": "4.1.4",
|
|
99
|
+
"foldkit": "0.171.0"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Animation controls** on Foldkit (#433, Motion's `useAnimationControls`; #798, Q2–Q4, Q13 and Q18):
|
|
3
|
+
* made apart from any element with {@link make}, at module scope or in the Model's making, and given to
|
|
4
|
+
* any number of `w.*` elements as `w.Animate(controls)` (the bundle's `animate` too). {@link start}
|
|
5
|
+
* animates each to a definition as a change of its `Animate` would, its Variant children following, as
|
|
6
|
+
* an Effect for a Command: it succeeds once they have landed, and interrupting it stops them where
|
|
7
|
+
* they are. `controls.set(definition)` lands them at once and `controls.stop()` ends them where they
|
|
8
|
+
* are, both synchronous, run from `Effect.sync` in a Command. An element hears the controls it mounted
|
|
9
|
+
* with, until it unmounts.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const controls = AnimationControls.make()
|
|
13
|
+
* // in the view
|
|
14
|
+
* w.ul([w.Initial("hidden"), w.Animate(controls), w.Variants(list)], items)
|
|
15
|
+
* // in a Command
|
|
16
|
+
* const Open = Command.define("Open", { messages: [Message.Opened], execute: AnimationControls.start(controls, "visible").pipe(Effect.as(Message.Opened())) })
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import * as CoreControls from "@wardic/core/unstable/AnimationControls"
|
|
21
|
+
import type * as WardConfig from "@wardic/dom/unstable/WardConfig"
|
|
22
|
+
import * as Effect from "effect/Effect"
|
|
23
|
+
|
|
24
|
+
/** The controls: `start(definition, transition?)`, `set(definition)` and `stop()`, over every element given them. */
|
|
25
|
+
export type AnimationControls = CoreControls.WardicAnimationControls
|
|
26
|
+
|
|
27
|
+
/** What a start or set animates to (Motion's): a variant name, or names, a target's values, or a function of the element's `Custom`, values and velocities, called once per element. */
|
|
28
|
+
export type Definition = CoreControls.WardicControlsDefinition
|
|
29
|
+
|
|
30
|
+
/** Makes animation controls (Motion's `useAnimationControls`): needs no element, and outlives the elements given them. */
|
|
31
|
+
export const make: () => AnimationControls = CoreControls.createAnimationControls
|
|
32
|
+
|
|
33
|
+
// #798, Q3, Q13 and Q18: core's promise as an Effect, interruption as the controls' stop. No `Wardic`
|
|
34
|
+
// service: the controls reach elements through their Mounts.
|
|
35
|
+
/**
|
|
36
|
+
* Animates every element given `controls`, and its Variant children, to `definition`, as a change of
|
|
37
|
+
* its `Animate` would (an `Effect` for a Command): `transition`, when given, is the transition of this
|
|
38
|
+
* change over the definition's own, and its stagger. Succeeds once each element and its children have
|
|
39
|
+
* landed, at once with no element given the controls; interrupting it ends every element the controls
|
|
40
|
+
* reach where it is, as `controls.stop()` does.
|
|
41
|
+
*/
|
|
42
|
+
export const start = (controls: AnimationControls, definition: Definition, transition?: WardConfig.WardicTransition): Effect.Effect<void> =>
|
|
43
|
+
Effect.callback<void>((resume) => {
|
|
44
|
+
void controls.start(definition, transition).then(() => resume(Effect.void))
|
|
45
|
+
return Effect.sync(() => controls.stop())
|
|
46
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Animation scopes** on Foldkit (#433, Motion's `useAnimate`'s scope; #798, Q7–Q9): made apart from any
|
|
3
|
+
* element with {@link make}, at module scope or in the Model's making, and given to one `w.*` element as
|
|
4
|
+
* `w.AnimationScope(scope)` (the bundle's `animationScope` too). A Command's `Wardic.animate(subject,
|
|
5
|
+
* values, { scope })`, or `Wardic.animate(sequence, { scope })`, then looks its selectors up inside that
|
|
6
|
+
* element, and the element's release stops the animations started in the scope where they are, each
|
|
7
|
+
* awaiting Command then succeeding with `landed: false`. `scope.element()` is the element while it's
|
|
8
|
+
* mounted. Without a scope, selectors resolve under the `w.Provider()` element, else the document.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const listScope = AnimationScope.make()
|
|
12
|
+
* // in the view
|
|
13
|
+
* w.ul([w.AnimationScope(listScope)], items)
|
|
14
|
+
* // in a Command
|
|
15
|
+
* Wardic.animate("li", { opacity: 1 }, { delay: stagger(0.05), scope: listScope })
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export { type AnimationScope, make } from "./internal/scope.ts"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Drag controls** on Foldkit (#431, Motion's `useDragControls`; #793, Q8): made apart from any element
|
|
3
|
+
* with {@link make}, at module scope or in the Model's making, and given to a `w.*` element as
|
|
4
|
+
* `w.DragControls(controls)`. Its drag then starts from a pointer pressed on the `StartsDrag` element
|
|
5
|
+
* (`w.StartsDrag(controls, options)`), or from `controls.start(event)` wherever a pointer went down;
|
|
6
|
+
* `controls.stop()` ends each drag as a release would, `controls.cancel()` where it is. Add
|
|
7
|
+
* `w.DragListener(false)` when a press on the element itself shouldn't drag it.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const controls = DragControls.make()
|
|
11
|
+
* w.div([w.Drag("y"), w.DragControls(controls), w.DragListener(false)], [
|
|
12
|
+
* w.div([w.StartsDrag(controls), h.Style({ "touch-action": "none" })], ["⋮⋮"]),
|
|
13
|
+
* "a row dragged by its grip",
|
|
14
|
+
* ])
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as DomDragControls from "@wardic/dom/unstable/DragControls"
|
|
19
|
+
|
|
20
|
+
/** The controls: `start(event, options?)`, `stop()` and `cancel()`, over every element given them. */
|
|
21
|
+
export type DragControls = DomDragControls.WardicDragControls
|
|
22
|
+
|
|
23
|
+
/** `start`'s options (Motion's): `snapToCursor` moves the element's centre under the pointer as the drag begins; `distanceThreshold` is how far it moves first, 3 px by default. */
|
|
24
|
+
export type StartOptions = DomDragControls.WardicDragControlsOptions
|
|
25
|
+
|
|
26
|
+
/** Makes drag controls (Motion's `useDragControls`): needs no element, and outlives the elements given them. */
|
|
27
|
+
export const make: () => DragControls = DomDragControls.createDragControls
|
package/src/Features.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **Features** a Handle takes (#511, ADR-0067; ADR-0071 *Amendment (#516)*, and *Amendment (#791)*
|
|
3
|
+
* at slices 2 and 3): `Wardic.make({ env, features: [Features.layout, Features.presence] })`, or a
|
|
4
|
+
* preset, `features: Features.domAnimation`, or a load, `features: () => import("./features.ts").then((m) => m.domMax)`.
|
|
5
|
+
* Without one, a `w.*` element is Slim: a gesture attribute is then a type error naming its Feature,
|
|
6
|
+
* and at runtime warns once in development and does nothing. The DOM's Features are `@wardic/dom`'s;
|
|
7
|
+
* `presence` is the binding's own, since `w.Presence` sits on the shared builder and dom's presence
|
|
8
|
+
* controller would otherwise ship to every Foldkit app.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { DomLive } from "@wardic/dom"
|
|
12
|
+
* import { Features, Wardic } from "@wardic/foldkit"
|
|
13
|
+
*
|
|
14
|
+
* const wardic = Wardic.make({ env: DomLive, features: [Features.domAnimation, Features.presence] })
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as Feature from "@wardic/dom/unstable/Feature"
|
|
19
|
+
import * as PresenceController from "@wardic/dom/unstable/PresenceController"
|
|
20
|
+
import * as Layer from "effect/Layer"
|
|
21
|
+
import { PresenceMaker, type PresenceMakerShape } from "./internal/keys.ts"
|
|
22
|
+
|
|
23
|
+
export { layout } from "@wardic/dom/unstable/features/Layout"
|
|
24
|
+
export { hover } from "@wardic/dom/unstable/features/Hover"
|
|
25
|
+
export { press } from "@wardic/dom/unstable/features/Press"
|
|
26
|
+
export { focus } from "@wardic/dom/unstable/features/Focus"
|
|
27
|
+
export { inView } from "@wardic/dom/unstable/features/InView"
|
|
28
|
+
export { pan } from "@wardic/dom/unstable/features/Pan"
|
|
29
|
+
export { drag } from "@wardic/dom/unstable/features/Drag"
|
|
30
|
+
// #795 (the storefront's part 2): a container's scroll as Live values, which Solid's `createScroll` brings
|
|
31
|
+
// by itself; a Foldkit app names it here, and `Wardic.scroll` reads on it.
|
|
32
|
+
export { scroll } from "@wardic/dom/unstable/features/Scroll"
|
|
33
|
+
export { domAnimation } from "@wardic/dom/unstable/features/DomAnimation"
|
|
34
|
+
export { domMax } from "@wardic/dom/unstable/features/DomMax"
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Presence (ADR-0007; ADR-0071 decision 29): `w.Presence` on a parent keeps each child Foldkit removes
|
|
38
|
+
* on the page while its `w.Exit` plays, in Motion's order, with `mode`, `custom`, `onExitComplete`,
|
|
39
|
+
* `propagate` and the rest of Motion's `AnimatePresence` props.
|
|
40
|
+
*/
|
|
41
|
+
export const presence: Feature.Feature<PresenceMaker, PresenceMakerShape, "presence"> = {
|
|
42
|
+
name: "presence",
|
|
43
|
+
key: PresenceMaker,
|
|
44
|
+
layer: /*#__PURE__*/ Layer.succeed(PresenceMaker)({ make: PresenceController.makePresence, events: PresenceController.exitCompleteEvents, propagateTo: PresenceController.propagateTo }),
|
|
45
|
+
}
|