@wardic/dom 1.0.0-rc.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Appear.d.ts +7 -1
- package/dist/Appear.d.ts.map +1 -1
- package/dist/Appear.js +7 -1
- package/dist/Appear.js.map +1 -1
- package/dist/DomBatch.d.ts +20 -0
- package/dist/DomBatch.d.ts.map +1 -0
- package/dist/DomBatch.js +23 -0
- package/dist/DomBatch.js.map +1 -0
- package/dist/DomInput.d.ts +2 -1
- package/dist/DomInput.d.ts.map +1 -1
- package/dist/DomInput.js +3 -1
- package/dist/DomInput.js.map +1 -1
- package/dist/KeyboardPress.d.ts +16 -0
- package/dist/KeyboardPress.d.ts.map +1 -0
- package/dist/KeyboardPress.js +17 -0
- package/dist/KeyboardPress.js.map +1 -0
- package/dist/ReorderController.d.ts +24 -4
- package/dist/ReorderController.d.ts.map +1 -1
- package/dist/ReorderController.js +38 -4
- package/dist/ReorderController.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/appear-slot.d.ts +23 -0
- package/dist/internal/appear-slot.d.ts.map +1 -0
- package/dist/internal/appear-slot.js +29 -0
- package/dist/internal/appear-slot.js.map +1 -0
- package/dist/internal/appear.d.ts +84 -16
- package/dist/internal/appear.d.ts.map +1 -1
- package/dist/internal/appear.js +302 -61
- package/dist/internal/appear.js.map +1 -1
- package/dist/internal/batch-writer.d.ts +16 -0
- package/dist/internal/batch-writer.d.ts.map +1 -0
- package/dist/internal/batch-writer.js +77 -0
- package/dist/internal/batch-writer.js.map +1 -0
- package/dist/internal/gate.d.ts +3 -2
- package/dist/internal/gate.d.ts.map +1 -1
- package/dist/internal/gate.js +5 -1
- package/dist/internal/gate.js.map +1 -1
- package/dist/internal/input.d.ts +0 -6
- package/dist/internal/input.d.ts.map +1 -1
- package/dist/internal/input.js +205 -23
- package/dist/internal/input.js.map +1 -1
- package/dist/internal/keyboard-press.d.ts +7 -0
- package/dist/internal/keyboard-press.d.ts.map +1 -0
- package/dist/internal/keyboard-press.js +45 -0
- package/dist/internal/keyboard-press.js.map +1 -0
- package/dist/internal/measure.js +1 -1
- package/dist/internal/measure.js.map +1 -1
- package/dist/internal/projection.js +1 -1
- package/dist/internal/projection.js.map +1 -1
- package/dist/internal/renderer.d.ts +18 -0
- package/dist/internal/renderer.d.ts.map +1 -1
- package/dist/internal/renderer.js +4 -2
- package/dist/internal/renderer.js.map +1 -1
- package/dist/internal/reorder.d.ts +28 -13
- package/dist/internal/reorder.d.ts.map +1 -1
- package/dist/internal/reorder.js +55 -26
- package/dist/internal/reorder.js.map +1 -1
- package/dist/internal/reveal.d.ts +7 -3
- package/dist/internal/reveal.d.ts.map +1 -1
- package/dist/internal/reveal.js +8 -3
- package/dist/internal/reveal.js.map +1 -1
- package/package.json +4 -4
- package/src/Appear.ts +12 -3
- package/src/DomBatch.ts +22 -0
- package/src/DomInput.ts +2 -1
- package/src/KeyboardPress.ts +16 -0
- package/src/ReorderController.ts +54 -4
- package/src/index.ts +5 -3
- package/src/internal/appear-slot.ts +32 -0
- package/src/internal/appear.ts +462 -67
- package/src/internal/batch-writer.ts +95 -0
- package/src/internal/gate.ts +7 -3
- package/src/internal/input.ts +209 -25
- package/src/internal/keyboard-press.ts +45 -0
- package/src/internal/measure.ts +1 -1
- package/src/internal/projection.ts +1 -1
- package/src/internal/renderer.ts +4 -2
- package/src/internal/reorder.ts +85 -39
- package/src/internal/reveal.ts +10 -4
package/dist/Appear.d.ts
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* - **At mount:** `find` the element's animation, check it `matches` the client's own spec, start the run
|
|
10
10
|
* `elapsedOf` it in (`Machine.startAt`), and `release` the element in the task that writes the engine's
|
|
11
11
|
* first frame.
|
|
12
|
+
* - **A Batch's members** (#706): `batchKeyframes` samples one rule for every member on one set of
|
|
13
|
+
* transitions, each member's own values read from custom properties; a sheet's `batch` gives them one
|
|
14
|
+
* slot, and each member its style. At the Handoff, `findAll` reads every member's animation in one call,
|
|
15
|
+
* each `matchesBatch` the client's key, and its change starts `elapsedOf` it in (`Batch.retarget`'s
|
|
16
|
+
* `startAt`).
|
|
12
17
|
*
|
|
13
18
|
* @example
|
|
14
19
|
* import * as Appear from "@wardic/dom/Appear"
|
|
@@ -20,5 +25,6 @@
|
|
|
20
25
|
* // At mount:
|
|
21
26
|
* const elapsed = Option.map(Appear.find(element), Appear.elapsedOf)
|
|
22
27
|
*/
|
|
23
|
-
export { adoptChunks, animationOf, CHUNK_ATTRIBUTE, chunkStyle, delayOf, elapsedOf, find, keyframes, type Keyframes, matches, MAX_SECONDS, nameOf,
|
|
28
|
+
export { adoptChunks, animationOf, batchKeyframes, type BatchKeyframes, type BatchSlot, type BatchSpec, CHUNK_ATTRIBUTE, chunkStyle, delayOf, elapsedOf, find, findAll, keyframes, type Keyframes, matches, matchesBatch, MAX_SECONDS, nameOf, type Play, sheet, type Sheet, type Slot, type Spec, } from "./internal/appear.ts";
|
|
29
|
+
export { pending, PREFIX, release } from "./internal/appear-slot.ts";
|
|
24
30
|
//# sourceMappingURL=Appear.d.ts.map
|
package/dist/Appear.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Appear.d.ts","sourceRoot":"","sources":["../src/Appear.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Appear.d.ts","sourceRoot":"","sources":["../src/Appear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,WAAW,EACX,WAAW,EACX,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,eAAe,EACf,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,OAAO,EACP,SAAS,EACT,KAAK,SAAS,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,MAAM,EACN,KAAK,IAAI,EACT,KAAK,EACL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,GACV,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA"}
|
package/dist/Appear.js
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* - **At mount:** `find` the element's animation, check it `matches` the client's own spec, start the run
|
|
10
10
|
* `elapsedOf` it in (`Machine.startAt`), and `release` the element in the task that writes the engine's
|
|
11
11
|
* first frame.
|
|
12
|
+
* - **A Batch's members** (#706): `batchKeyframes` samples one rule for every member on one set of
|
|
13
|
+
* transitions, each member's own values read from custom properties; a sheet's `batch` gives them one
|
|
14
|
+
* slot, and each member its style. At the Handoff, `findAll` reads every member's animation in one call,
|
|
15
|
+
* each `matchesBatch` the client's key, and its change starts `elapsedOf` it in (`Batch.retarget`'s
|
|
16
|
+
* `startAt`).
|
|
12
17
|
*
|
|
13
18
|
* @example
|
|
14
19
|
* import * as Appear from "@wardic/dom/Appear"
|
|
@@ -21,5 +26,6 @@
|
|
|
21
26
|
* const elapsed = Option.map(Appear.find(element), Appear.elapsedOf)
|
|
22
27
|
*/
|
|
23
28
|
// #48, ADR-0044: the **Handoff**. `@wardic/dom/Appear` (ADR-0041).
|
|
24
|
-
export { adoptChunks, animationOf, CHUNK_ATTRIBUTE, chunkStyle, delayOf, elapsedOf, find, keyframes, matches, MAX_SECONDS, nameOf,
|
|
29
|
+
export { adoptChunks, animationOf, batchKeyframes, CHUNK_ATTRIBUTE, chunkStyle, delayOf, elapsedOf, find, findAll, keyframes, matches, matchesBatch, MAX_SECONDS, nameOf, sheet, } from "./internal/appear.js";
|
|
30
|
+
export { pending, PREFIX, release } from "./internal/appear-slot.js";
|
|
25
31
|
//# sourceMappingURL=Appear.js.map
|
package/dist/Appear.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Appear.js","sourceRoot":"","sources":["../src/Appear.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Appear.js","sourceRoot":"","sources":["../src/Appear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,mEAAmE;AACnE,OAAO,EACL,WAAW,EACX,WAAW,EACX,cAAc,EAId,eAAe,EACf,UAAU,EACV,OAAO,EACP,SAAS,EACT,IAAI,EACJ,OAAO,EACP,SAAS,EAET,OAAO,EACP,YAAY,EACZ,WAAW,EACX,MAAM,EAEN,KAAK,GAIN,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM's writer for a Batch: each moving member's `transform` and `opacity`, written onto its
|
|
3
|
+
* element's style as Wardic's renderer draws the same values. A Batch's keys on the DOM are the
|
|
4
|
+
* transform keys (`x`, `y`, `z`, `translateX/Y/Z`, `scale`, `scaleX/Y`, `rotate`, `rotateX/Y/Z`,
|
|
5
|
+
* `skewX/Y`) and `opacity`, as numbers. A server renders a member's start with `styleOf`, the strings
|
|
6
|
+
* the writer draws it with.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as Batch from "@wardic/core/Batch"
|
|
10
|
+
* import * as DomBatch from "@wardic/dom/DomBatch"
|
|
11
|
+
*
|
|
12
|
+
* const grid = Batch.make({ keys: ["x", "y", "opacity"], writer: DomBatch.writer, transition: { type: "spring" } })
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import * as DomBatch from "@wardic/dom/DomBatch"
|
|
16
|
+
*
|
|
17
|
+
* DomBatch.styleOf({ x: 10, opacity: 0 }) // { transform: "translateX(10px)", opacity: "0" }
|
|
18
|
+
*/
|
|
19
|
+
export { styleOf, writer } from "./internal/batch-writer.ts";
|
|
20
|
+
//# sourceMappingURL=DomBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomBatch.d.ts","sourceRoot":"","sources":["../src/DomBatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA"}
|
package/dist/DomBatch.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DOM's writer for a Batch: each moving member's `transform` and `opacity`, written onto its
|
|
3
|
+
* element's style as Wardic's renderer draws the same values. A Batch's keys on the DOM are the
|
|
4
|
+
* transform keys (`x`, `y`, `z`, `translateX/Y/Z`, `scale`, `scaleX/Y`, `rotate`, `rotateX/Y/Z`,
|
|
5
|
+
* `skewX/Y`) and `opacity`, as numbers. A server renders a member's start with `styleOf`, the strings
|
|
6
|
+
* the writer draws it with.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as Batch from "@wardic/core/Batch"
|
|
10
|
+
* import * as DomBatch from "@wardic/dom/DomBatch"
|
|
11
|
+
*
|
|
12
|
+
* const grid = Batch.make({ keys: ["x", "y", "opacity"], writer: DomBatch.writer, transition: { type: "spring" } })
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import * as DomBatch from "@wardic/dom/DomBatch"
|
|
16
|
+
*
|
|
17
|
+
* DomBatch.styleOf({ x: 10, opacity: 0 }) // { transform: "translateX(10px)", opacity: "0" }
|
|
18
|
+
*/
|
|
19
|
+
// `@wardic/dom/DomBatch` (#665, ADR-0070 *Amendment (#665)*): the DOM's implementation of core's
|
|
20
|
+
// `Batch.Writer`, Dom-prefixed as `DomRenderer` is, its member without the module's noun (ADR-0041).
|
|
21
|
+
// Not in `DomLive`: a binding's `createBatch` imports it, so an app that never makes a Batch ships none.
|
|
22
|
+
export { styleOf, writer } from "./internal/batch-writer.js";
|
|
23
|
+
//# sourceMappingURL=DomBatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomBatch.js","sourceRoot":"","sources":["../src/DomBatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,iGAAiG;AACjG,qGAAqG;AACrG,yGAAyG;AACzG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA"}
|
package/dist/DomInput.d.ts
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
* DomInput.keyOf("ArrowLeft") // "left"
|
|
10
10
|
* DomInput.buttonOf(2) // "secondary"
|
|
11
11
|
*/
|
|
12
|
-
export { InputDomLive as layer, keyOf, kindOf,
|
|
12
|
+
export { InputDomLive as layer, keyOf, kindOf, buttonOf, toPointer, type Where, } from "./internal/input.ts";
|
|
13
|
+
export { makeFocusable } from "./internal/keyboard-press.ts";
|
|
13
14
|
//# sourceMappingURL=DomInput.d.ts.map
|
package/dist/DomInput.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomInput.d.ts","sourceRoot":"","sources":["../src/DomInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,YAAY,IAAI,KAAK,EACrB,KAAK,EACL,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"DomInput.d.ts","sourceRoot":"","sources":["../src/DomInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,YAAY,IAAI,KAAK,EACrB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,KAAK,GACX,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA"}
|
package/dist/DomInput.js
CHANGED
|
@@ -11,5 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
// `@wardic/dom/DomInput` (#132, ADR-0041): ADR-0019, ADR-0036 *Amendment (#189)*, ADR-0037. Not in
|
|
13
13
|
// `DomLive`: #511, ADR-0067 decision 14.
|
|
14
|
-
export { InputDomLive as layer, keyOf, kindOf,
|
|
14
|
+
export { InputDomLive as layer, keyOf, kindOf, buttonOf, toPointer, } from "./internal/input.js";
|
|
15
|
+
// The Keyboard press's own module's (#709): `KeyboardPress.makeFocusable`, the same function.
|
|
16
|
+
export { makeFocusable } from "./internal/keyboard-press.js";
|
|
15
17
|
//# sourceMappingURL=DomInput.js.map
|
package/dist/DomInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomInput.js","sourceRoot":"","sources":["../src/DomInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,mGAAmG;AACnG,yCAAyC;AACzC,OAAO,EACL,YAAY,IAAI,KAAK,EACrB,KAAK,EACL,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"DomInput.js","sourceRoot":"","sources":["../src/DomInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,mGAAmG;AACnG,yCAAyC;AACzC,OAAO,EACL,YAAY,IAAI,KAAK,EACrB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,GAEV,MAAM,qBAAqB,CAAA;AAC5B,8FAA8F;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Keyboard press's focusability: `makeFocusable` gives an HTML element that doesn't take the
|
|
3
|
+
* keyboard's focus of itself `tabindex="0"`, so Enter and Space can press it, as Motion's press does. A
|
|
4
|
+
* control, a link with its `href`, an editable region, an element given a `tabindex` and an SVG element
|
|
5
|
+
* are left as they are. `DomInput.makeFocusable` is the same function, here apart from the DOM's input,
|
|
6
|
+
* so a binding calls it as each pressable element mounts without loading the input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as KeyboardPress from "@wardic/dom/KeyboardPress"
|
|
10
|
+
*
|
|
11
|
+
* const tile = document.createElement("div")
|
|
12
|
+
* KeyboardPress.makeFocusable(tile)
|
|
13
|
+
* // tile.getAttribute("tabindex") === "0"
|
|
14
|
+
*/
|
|
15
|
+
export { makeFocusable } from "./internal/keyboard-press.ts";
|
|
16
|
+
//# sourceMappingURL=KeyboardPress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardPress.d.ts","sourceRoot":"","sources":["../src/KeyboardPress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Keyboard press's focusability: `makeFocusable` gives an HTML element that doesn't take the
|
|
3
|
+
* keyboard's focus of itself `tabindex="0"`, so Enter and Space can press it, as Motion's press does. A
|
|
4
|
+
* control, a link with its `href`, an editable region, an element given a `tabindex` and an SVG element
|
|
5
|
+
* are left as they are. `DomInput.makeFocusable` is the same function, here apart from the DOM's input,
|
|
6
|
+
* so a binding calls it as each pressable element mounts without loading the input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import * as KeyboardPress from "@wardic/dom/KeyboardPress"
|
|
10
|
+
*
|
|
11
|
+
* const tile = document.createElement("div")
|
|
12
|
+
* KeyboardPress.makeFocusable(tile)
|
|
13
|
+
* // tile.getAttribute("tabindex") === "0"
|
|
14
|
+
*/
|
|
15
|
+
// `@wardic/dom/KeyboardPress` (#709, Q2; ADR-0056, *Amendment (#709)*): ADR-0041's module per concern.
|
|
16
|
+
export { makeFocusable } from "./internal/keyboard-press.js";
|
|
17
|
+
//# sourceMappingURL=KeyboardPress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardPress.js","sourceRoot":"","sources":["../src/KeyboardPress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,uGAAuG;AACvG,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A Reorder group on the DOM: the group, its items' drags, its keyboard and its announcements, one
|
|
3
|
-
* controller a group. `make` builds one over the context's Projection system and `Announcer
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* controller a group. `make` builds one over the context's Projection system and `Announcer`, for items
|
|
4
|
+
* that are layout nodes; `makePlaced` one over the `Announcer` alone, for a Batch Reorder group's items,
|
|
5
|
+
* placed from their index and never measured. A binding attaches its group element, gets a driver for
|
|
6
|
+
* each item, and closing the Scope ends the controller. A server render gets `inert`.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* import * as ReorderController from "@wardic/dom/ReorderController"
|
|
@@ -10,6 +11,10 @@
|
|
|
10
11
|
* const controller = yield* ReorderController.make({ values: () => items, onReorder: (next) => (items = next) })
|
|
11
12
|
* controller.attach(list)
|
|
12
13
|
* const driver = controller.item(item, () => Option.some(element))
|
|
14
|
+
*
|
|
15
|
+
* // Items placed from their index: placed() once they're laid out in a new order.
|
|
16
|
+
* const placedGroup = yield* ReorderController.makePlaced({ values: () => items, onReorder: (next) => (items = next) })
|
|
17
|
+
* placedGroup.placed()
|
|
13
18
|
*/
|
|
14
19
|
import * as Announcer from "@wardic/core/Announcer";
|
|
15
20
|
import * as Effect from "effect/Effect";
|
|
@@ -17,7 +22,7 @@ import type * as Scope from "effect/Scope";
|
|
|
17
22
|
import { PassEnds } from "./internal/pass-ends.ts";
|
|
18
23
|
import * as internal from "./internal/reorder.ts";
|
|
19
24
|
import * as ProjectionSystem from "./ProjectionSystem.ts";
|
|
20
|
-
export { type ReorderEnd as End, type ReorderHoldEnd as HoldEnd, type ReorderHoldHow as HoldHow, type ReorderHoldStart as HoldStart, type ReorderItemDriver as ItemDriver, DEFAULT_REORDER_INSTRUCTIONS as DEFAULT_INSTRUCTIONS, REORDER_GROUP_STYLE as GROUP_STYLE, } from "./internal/reorder.ts";
|
|
25
|
+
export { type ReorderEnd as End, type ReorderHoldEnd as HoldEnd, type ReorderHoldHow as HoldHow, type ReorderHoldStart as HoldStart, type ReorderItemDriver as ItemDriver, type ReorderItemHandle as ItemHandle, DEFAULT_REORDER_INSTRUCTIONS as DEFAULT_INSTRUCTIONS, REORDER_GROUP_STYLE as GROUP_STYLE, } from "./internal/reorder.ts";
|
|
21
26
|
/** A **Reorder group** on the DOM: what a binding attaches its group element and items to. */
|
|
22
27
|
export type ReorderController<V> = Omit<internal.ReorderController<V>, "dispose">;
|
|
23
28
|
/** What a binding hands its group: the app's values, its axis, its keyboard and its announcements. */
|
|
@@ -33,6 +38,21 @@ export type Services = ProjectionSystem.ProjectionSystem | PassEnds | Announcer.
|
|
|
33
38
|
* `Announcer`, in the current Scope: closing it ends the controller.
|
|
34
39
|
*/
|
|
35
40
|
export declare const make: <V>(options: Options<V>) => Effect.Effect<ReorderController<V>, never, Services | Scope.Scope>;
|
|
41
|
+
/**
|
|
42
|
+
* A **Batch Reorder group**'s controller, whose items are placed from their index, never measured: `placed`
|
|
43
|
+
* tells it the binding has laid its items out in a new order, as a Measure pass's end tells `make`'s.
|
|
44
|
+
*/
|
|
45
|
+
export interface Placed<V> extends ReorderController<V> {
|
|
46
|
+
/** The binding has placed its items in the new order: their layout's turn, a stepped item revealed. */
|
|
47
|
+
readonly placed: () => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build a group's controller for items placed rather than measured, a Batch Reorder group's, announcing
|
|
51
|
+
* through the context's `Announcer`, in the current Scope: closing it ends the controller. It needs no
|
|
52
|
+
* projection system: each item registers a handle whose box is its place, raising its box's version as
|
|
53
|
+
* it's placed, and the binding calls `placed` once it has placed a new order.
|
|
54
|
+
*/
|
|
55
|
+
export declare const makePlaced: <V>(options: Options<V>) => Effect.Effect<Placed<V>, never, Announcer.Announcer | Scope.Scope>;
|
|
36
56
|
/**
|
|
37
57
|
* The controller a server render gets: its group has no values, so every operation on it does nothing,
|
|
38
58
|
* its axis is `"y"`, and an item's driver does nothing too.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderController.d.ts","sourceRoot":"","sources":["../src/ReorderController.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ReorderController.d.ts","sourceRoot":"","sources":["../src/ReorderController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EACL,KAAK,UAAU,IAAI,GAAG,EACtB,KAAK,cAAc,IAAI,OAAO,EAC9B,KAAK,cAAc,IAAI,OAAO,EAC9B,KAAK,gBAAgB,IAAI,SAAS,EAClC,KAAK,iBAAiB,IAAI,UAAU,EACpC,KAAK,iBAAiB,IAAI,UAAU,EACpC,4BAA4B,IAAI,oBAAoB,EACpD,mBAAmB,IAAI,WAAW,GACnC,MAAM,uBAAuB,CAAA;AAE9B,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;AAEjF,sGAAsG;AACtG,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAA;AAE7D;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAA;AAEzF;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,KAAK,CAW5G,CAAA;AAEJ;;;GAGG;AAEH,MAAM,WAAW,MAAM,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IACrD,uGAAuG;IACvG,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAC5B;AAED;;;;;GAKG;AAEH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAsBlH,CAAA;AAEJ;;;GAGG;AAEH,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAqC,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A Reorder group on the DOM: the group, its items' drags, its keyboard and its announcements, one
|
|
3
|
-
* controller a group. `make` builds one over the context's Projection system and `Announcer
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* controller a group. `make` builds one over the context's Projection system and `Announcer`, for items
|
|
4
|
+
* that are layout nodes; `makePlaced` one over the `Announcer` alone, for a Batch Reorder group's items,
|
|
5
|
+
* placed from their index and never measured. A binding attaches its group element, gets a driver for
|
|
6
|
+
* each item, and closing the Scope ends the controller. A server render gets `inert`.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* import * as ReorderController from "@wardic/dom/ReorderController"
|
|
@@ -10,14 +11,21 @@
|
|
|
10
11
|
* const controller = yield* ReorderController.make({ values: () => items, onReorder: (next) => (items = next) })
|
|
11
12
|
* controller.attach(list)
|
|
12
13
|
* const driver = controller.item(item, () => Option.some(element))
|
|
14
|
+
*
|
|
15
|
+
* // Items placed from their index: placed() once they're laid out in a new order.
|
|
16
|
+
* const placedGroup = yield* ReorderController.makePlaced({ values: () => items, onReorder: (next) => (items = next) })
|
|
17
|
+
* placedGroup.placed()
|
|
13
18
|
*/
|
|
14
19
|
// A **Reorder group**'s controller (ADR-0019 *Amendment (Reorder)*, ADR-0037); a server render's `inert`
|
|
15
20
|
// (ADR-0021). `@wardic/dom/ReorderController` (#132, ADR-0041). A scoped constructor, one per group (#132's
|
|
16
21
|
// PR 3): `make` logs its `wardic.reorder:` events through the context's Logger, and ends with its Scope,
|
|
17
22
|
// which stops its listening to Measure passes, resets its Auto-scroll and clears a pending announcement.
|
|
23
|
+
// `makePlaced` (#712, ADR-0072) is the same controller wired to its binding's placing: no projection system,
|
|
24
|
+
// and `placed` where `make`'s hears a Measure pass's end.
|
|
18
25
|
// Its items' drivers stay plain, each with its own `dispose`, since one is made per element.
|
|
19
26
|
import * as Announcer from "@wardic/core/Announcer";
|
|
20
27
|
import * as Effect from "effect/Effect";
|
|
28
|
+
import { constVoid } from "effect/Function";
|
|
21
29
|
import { PassEnds } from "./internal/pass-ends.js";
|
|
22
30
|
import * as internal from "./internal/reorder.js";
|
|
23
31
|
import { makeRunner } from "./internal/runner.js";
|
|
@@ -31,10 +39,36 @@ export const make = Effect.fnUntraced(function* (options) {
|
|
|
31
39
|
const projection = yield* ProjectionSystem.ProjectionSystem;
|
|
32
40
|
const passEnds = yield* PassEnds;
|
|
33
41
|
const announcer = yield* Announcer.Announcer;
|
|
34
|
-
const controller = internal.makeReorderController({ runtime: yield* makeRunner(), projection, announce: announcer.announce,
|
|
42
|
+
const controller = internal.makeReorderController({ runtime: yield* makeRunner(), layOut: () => projection.notify(), announce: announcer.announce, onLaidOut: passEnds.onPassEnd }, options);
|
|
35
43
|
yield* Effect.addFinalizer(() => Effect.sync(controller.dispose));
|
|
36
44
|
return controller;
|
|
37
45
|
});
|
|
46
|
+
/**
|
|
47
|
+
* Build a group's controller for items placed rather than measured, a Batch Reorder group's, announcing
|
|
48
|
+
* through the context's `Announcer`, in the current Scope: closing it ends the controller. It needs no
|
|
49
|
+
* projection system: each item registers a handle whose box is its place, raising its box's version as
|
|
50
|
+
* it's placed, and the binding calls `placed` once it has placed a new order.
|
|
51
|
+
*/
|
|
52
|
+
// #712, ADR-0072 decision 6: the same controller, wired to its binding's placing.
|
|
53
|
+
export const makePlaced = Effect.fnUntraced(function* (options) {
|
|
54
|
+
const announcer = yield* Announcer.Announcer;
|
|
55
|
+
// What hears the binding's placing: the controller's own, once, until it's disposed.
|
|
56
|
+
let laidOut = constVoid;
|
|
57
|
+
const controller = internal.makeReorderController({
|
|
58
|
+
runtime: yield* makeRunner(),
|
|
59
|
+
// The binding places its items on a change of `values` itself.
|
|
60
|
+
layOut: constVoid,
|
|
61
|
+
announce: announcer.announce,
|
|
62
|
+
onLaidOut: (listener) => {
|
|
63
|
+
laidOut = listener;
|
|
64
|
+
return () => {
|
|
65
|
+
laidOut = constVoid;
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
}, options);
|
|
69
|
+
yield* Effect.addFinalizer(() => Effect.sync(controller.dispose));
|
|
70
|
+
return { ...controller, placed: () => laidOut() };
|
|
71
|
+
});
|
|
38
72
|
/**
|
|
39
73
|
* The controller a server render gets: its group has no values, so every operation on it does nothing,
|
|
40
74
|
* its axis is `"y"`, and an item's driver does nothing too.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderController.js","sourceRoot":"","sources":["../src/ReorderController.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ReorderController.js","sourceRoot":"","sources":["../src/ReorderController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,yGAAyG;AACzG,4GAA4G;AAC5G,yGAAyG;AACzG,yGAAyG;AACzG,6GAA6G;AAC7G,0DAA0D;AAC1D,6FAA6F;AAC7F,OAAO,KAAK,SAA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CACzI,QAAQ,CAAC,EAAK,OAAmB;IAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAC5C,qFAAqF;IACrF,IAAI,OAAO,GAAe,SAAS,CAAA;IACnC,MAAM,UAAU,GAAG,QAAQ,CAAC,qBAAqB,CAC/C;QACE,OAAO,EAAE,KAAK,CAAC,CAAC,UAAU,EAAS;QACnC,+DAA+D;QAC/D,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE;YACtB,OAAO,GAAG,QAAQ,CAAA;YAClB,OAAO,GAAG,EAAE;gBACV,OAAO,GAAG,SAAS,CAAA;YACrB,CAAC,CAAA;QACH,CAAC;KACF,EACD,OAAO,CACR,CAAA;IACD,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IACjE,OAAO,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CAAA;AACnD,CAAC,CAAC,CAAA;AAEJ;;;GAGG;AACH,YAAY;AACZ,MAAM,CAAC,MAAM,KAAK,GAA6B,QAAQ,CAAC,wBAAwB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* `DomInterpolators`, `DomPositionalKeys`, `DomDefaultTransition`), and `DomKeyRules`, the Key
|
|
13
13
|
* rules `DomInterpolators.layer` installs, which has none of its own;
|
|
14
14
|
* - dom's own concepts, by the glossary's names: `FlushGate`, `ProjectionSystem`,
|
|
15
|
-
* `ReorderController`, `Style`, `Svg`, `Color`, `Variables`, `ScrollOffset`, `Appear`, `OwnValues
|
|
16
|
-
* and `Report`.
|
|
15
|
+
* `ReorderController`, `Style`, `Svg`, `Color`, `Variables`, `ScrollOffset`, `Appear`, `OwnValues`,
|
|
16
|
+
* `KeyboardPress` and `Report`.
|
|
17
17
|
*
|
|
18
18
|
* Everything under `internal/` is dom's own and not exported.
|
|
19
19
|
*/
|
|
@@ -28,7 +28,8 @@ import type * as RefreshFrameSource from "@wardic/core/RefreshFrameSource";
|
|
|
28
28
|
import type * as Renderer from "@wardic/core/Renderer";
|
|
29
29
|
import * as Layer from "effect/Layer";
|
|
30
30
|
import * as AtomRegistry from "effect/reactivity/AtomRegistry";
|
|
31
|
-
export declare const VERSION = "1.0.0
|
|
31
|
+
export declare const VERSION = "1.0.0";
|
|
32
|
+
export * as DomBatch from "./DomBatch.ts";
|
|
32
33
|
export * as DomClock from "./DomClock.ts";
|
|
33
34
|
export * as DomInput from "./DomInput.ts";
|
|
34
35
|
export * as DomProbe from "./DomProbe.ts";
|
|
@@ -50,6 +51,7 @@ export * as Variables from "./Variables.ts";
|
|
|
50
51
|
export * as ScrollOffset from "./ScrollOffset.ts";
|
|
51
52
|
export * as Appear from "./Appear.ts";
|
|
52
53
|
export * as OwnValues from "./OwnValues.ts";
|
|
54
|
+
export * as KeyboardPress from "./KeyboardPress.ts";
|
|
53
55
|
export * as Report from "./Report.ts";
|
|
54
56
|
/**
|
|
55
57
|
* Core's development check for Frames that aren't finite (`FrameLoop.CheckFrames`), here for an app,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,KAAK,oBAAoB,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,KAAK,iBAAiB,MAAM,gCAAgC,CAAA;AACxE,OAAO,KA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GACzC,aAAa,CAAC,cAAc,GAC5B,iBAAiB,CAAC,iBAAiB,GACnC,SAAS,CAAC,SAAS,GACnB,YAAY,CAAC,YAAY,CAM5B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,8 @@ import * as DomInterpolators from "./DomInterpolators.js";
|
|
|
8
8
|
import * as DomPositionalKeys from "./DomPositionalKeys.js";
|
|
9
9
|
import * as DomProbe from "./DomProbe.js";
|
|
10
10
|
import * as DomRenderer from "./DomRenderer.js";
|
|
11
|
-
export const VERSION = "1.0.0
|
|
11
|
+
export const VERSION = "1.0.0";
|
|
12
|
+
export * as DomBatch from "./DomBatch.js";
|
|
12
13
|
export * as DomClock from "./DomClock.js";
|
|
13
14
|
export * as DomInput from "./DomInput.js";
|
|
14
15
|
export * as DomProbe from "./DomProbe.js";
|
|
@@ -30,6 +31,7 @@ export * as Variables from "./Variables.js";
|
|
|
30
31
|
export * as ScrollOffset from "./ScrollOffset.js";
|
|
31
32
|
export * as Appear from "./Appear.js";
|
|
32
33
|
export * as OwnValues from "./OwnValues.js";
|
|
34
|
+
export * as KeyboardPress from "./KeyboardPress.js";
|
|
33
35
|
export * as Report from "./Report.js";
|
|
34
36
|
/**
|
|
35
37
|
* Core's development check for Frames that aren't finite (`FrameLoop.CheckFrames`), here for an app,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAQnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAA;AAC9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CA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KAAK,CAAC,CACvC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An Appear animation's slot on its element (#48, ADR-0044), as a page's code reads it before any Handoff:
|
|
3
|
+
* whether the element's animation still runs, and the Handoff's last step, its removal. Kept apart from the
|
|
4
|
+
* sampler and the Handoff's reads (`appear.ts`), so code that only asks, or lets one go, ships neither: a
|
|
5
|
+
* Batch's, whose reads load at its first Handoff (#706, Q11).
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/** The prefix every Appear rule's name starts with. */
|
|
10
|
+
export declare const PREFIX = "wardic-";
|
|
11
|
+
/**
|
|
12
|
+
* Whether `element`'s Appear animation is running, not yet handed over: its inline style still names its
|
|
13
|
+
* slot, which `release` removes. A layout measure asks it of each node, so a running animation's
|
|
14
|
+
* transform, which beats the inline one, stays out of the box it reads.
|
|
15
|
+
*/
|
|
16
|
+
export declare const pending: (element: ElementCSSInlineStyle) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The handover's last step: the element's inline `animation` removed, in the task that writes the
|
|
19
|
+
* engine's first frame, so no paint falls between. While it ran, its value beat the inline style the
|
|
20
|
+
* engine writes; removing it ends the CSS animation at that task's style update.
|
|
21
|
+
*/
|
|
22
|
+
export declare const release: (element: ElementCSSInlineStyle) => void;
|
|
23
|
+
//# sourceMappingURL=appear-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appear-slot.d.ts","sourceRoot":"","sources":["../../src/internal/appear-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uDAAuD;AACvD,eAAO,MAAM,MAAM,YAAY,CAAA;AAK/B;;;;GAIG;AAEH,eAAO,MAAM,OAAO,YAAa,qBAAqB,KAAG,OAA8E,CAAA;AAEvI;;;;GAIG;AAEH,eAAO,MAAM,OAAO,YAAa,qBAAqB,KAAG,IAExD,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An Appear animation's slot on its element (#48, ADR-0044), as a page's code reads it before any Handoff:
|
|
3
|
+
* whether the element's animation still runs, and the Handoff's last step, its removal. Kept apart from the
|
|
4
|
+
* sampler and the Handoff's reads (`appear.ts`), so code that only asks, or lets one go, ships neither: a
|
|
5
|
+
* Batch's, whose reads load at its first Handoff (#706, Q11).
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/** The prefix every Appear rule's name starts with. */
|
|
10
|
+
export const PREFIX = "wardic-";
|
|
11
|
+
/** What a slot's inline `animation` starts with: `var(--wardic-a`. */
|
|
12
|
+
const SLOT_PREFIX = `var(--${PREFIX}a`;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `element`'s Appear animation is running, not yet handed over: its inline style still names its
|
|
15
|
+
* slot, which `release` removes. A layout measure asks it of each node, so a running animation's
|
|
16
|
+
* transform, which beats the inline one, stays out of the box it reads.
|
|
17
|
+
*/
|
|
18
|
+
// #245: a Measure pass; a string read, no style resolved.
|
|
19
|
+
export const pending = (element) => element.style.getPropertyValue("animation").startsWith(SLOT_PREFIX);
|
|
20
|
+
/**
|
|
21
|
+
* The handover's last step: the element's inline `animation` removed, in the task that writes the
|
|
22
|
+
* engine's first frame, so no paint falls between. While it ran, its value beat the inline style the
|
|
23
|
+
* engine writes; removing it ends the CSS animation at that task's style update.
|
|
24
|
+
*/
|
|
25
|
+
// The **Handoff** (ADR-0044, decision 6). A `cancel()` too changed nothing (a mutation, #48's PR 1).
|
|
26
|
+
export const release = (element) => {
|
|
27
|
+
element.style.removeProperty("animation");
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=appear-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appear-slot.js","sourceRoot":"","sources":["../../src/internal/appear-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAA;AAE/B,sEAAsE;AACtE,MAAM,WAAW,GAAG,SAAS,MAAM,GAAG,CAAA;AAEtC;;;;GAIG;AACH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAA8B,EAAW,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAEvI;;;;GAIG;AACH,qGAAqG;AACrG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAA8B,EAAQ,EAAE;IAC9D,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAC3C,CAAC,CAAA"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appear animations (#48, ADR-0044): a server-rendered mount animation played in CSS from first
|
|
3
|
+
* paint, which the client takes over at mount (the **Handoff**). The DOM's half, framework-free:
|
|
4
|
+
*
|
|
5
|
+
* - **The sampler** steps a binding's mount animation through core's machines, as a 60 Hz client
|
|
6
|
+
* would (`Machine.CATCH_UP_DT`), projects each Frame with the DOM's `project`, and writes it as one
|
|
7
|
+
* `@keyframes` rule, thinned to the stops a straight line can't stand in for, within a tolerance
|
|
8
|
+
* per key below what a screen shows (decision 9). One rule a spec, cached across requests by it.
|
|
9
|
+
* - **A sheet** collects one render's rules. An element's inline style names only a custom
|
|
10
|
+
* property, `animation: var(--wardic-aN)`, which the sheet defines in `:root` once the render
|
|
11
|
+
* knows its timing (decision 5); undefined, it leaves the element at its Starting style.
|
|
12
|
+
* - **The Handoff's reads:** the element's `wardic-…` animation and how far it has got. Its removal,
|
|
13
|
+
* written in the same task as the engine's first frame (decision 6), is `appear-slot.ts`'s, with
|
|
14
|
+
* `pending`: what a page's code asks before any Handoff, kept out of this module.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as Batch from "@wardic/core/Batch";
|
|
1
19
|
import type * as Frame from "@wardic/core/Frame";
|
|
2
20
|
import * as Machine from "@wardic/core/Machine";
|
|
3
21
|
import type * as Values from "@wardic/core/Values";
|
|
4
|
-
import type
|
|
22
|
+
import { type LazyArg } from "effect/Function";
|
|
5
23
|
import * as Option from "effect/Option";
|
|
6
24
|
import * as Result from "effect/Result";
|
|
7
25
|
import { type TransformTemplate } from "./renderer.ts";
|
|
@@ -62,8 +80,6 @@ export interface Play {
|
|
|
62
80
|
/** Seconds before it starts: its orchestration's, and any delay on the whole element. */
|
|
63
81
|
readonly delay: number;
|
|
64
82
|
}
|
|
65
|
-
/** The prefix every Appear rule's name starts with. */
|
|
66
|
-
export declare const PREFIX = "wardic-";
|
|
67
83
|
/** The longest mount animation sampled, in seconds; a longer one keeps its Starting style. */
|
|
68
84
|
export declare const MAX_SECONDS = 60;
|
|
69
85
|
/** The rule's name for a spec: its key, tag, repeat and projection, hashed. */
|
|
@@ -99,6 +115,42 @@ export declare const keyframes: (spec: Spec) => Result.Result<Keyframes, string>
|
|
|
99
115
|
* rule's first stop for a rule that moves from it.
|
|
100
116
|
*/
|
|
101
117
|
export declare const animationOf: (rule: Keyframes, delay: number) => string;
|
|
118
|
+
/**
|
|
119
|
+
* A Batch's entrance, as its binding describes it: its members on one set of transitions, each with its
|
|
120
|
+
* own start and target. One rule plays them all, each member's own values read from custom properties
|
|
121
|
+
* on its element (#706).
|
|
122
|
+
*/
|
|
123
|
+
export interface BatchSpec {
|
|
124
|
+
/**
|
|
125
|
+
* Its transitions, key by key, and whether motion is reduced, as one string the binding writes the
|
|
126
|
+
* same on the server and the client: the rule's name starts with its hash, which a client checks
|
|
127
|
+
* ({@link matchesBatch}) before it takes a member over.
|
|
128
|
+
*/
|
|
129
|
+
readonly key: string;
|
|
130
|
+
/** The Batch's keys, in its order: the DOM's transform keys and `opacity`. */
|
|
131
|
+
readonly keys: ReadonlyArray<string>;
|
|
132
|
+
/** How its keys move, as `Batch.make` takes it. */
|
|
133
|
+
readonly transition: Batch.Transitions;
|
|
134
|
+
/** Each member's start, a number a key, in `keys`' order. */
|
|
135
|
+
readonly starts: ReadonlyArray<ReadonlyArray<number>>;
|
|
136
|
+
/** Each member's target, as `starts`. */
|
|
137
|
+
readonly targets: ReadonlyArray<ReadonlyArray<number>>;
|
|
138
|
+
}
|
|
139
|
+
/** A Batch's rule, and each member's own values for it. */
|
|
140
|
+
export interface BatchKeyframes extends Keyframes {
|
|
141
|
+
/**
|
|
142
|
+
* A member's own values as the custom properties the rule reads (`--wardic-x1: 120px`), by its index
|
|
143
|
+
* in the spec; `undefined` for a member none of whose keys moves, which plays nothing.
|
|
144
|
+
*/
|
|
145
|
+
readonly memberStyle: (member: number) => Readonly<Record<string, string>> | undefined;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A Batch's rule for its members' entrance, or why it has none: one `@keyframes` for every member, each
|
|
149
|
+
* key's stops sampled from the Batch's own spring or tween at 60 Hz and thinned within its tolerance at
|
|
150
|
+
* its longest move. A key whose start and target every member that moves shares is written as it is;
|
|
151
|
+
* one whose values differ, as each member's custom properties and its progress between them.
|
|
152
|
+
*/
|
|
153
|
+
export declare const batchKeyframes: (spec: BatchSpec) => Result.Result<BatchKeyframes, string>;
|
|
102
154
|
/** One element's place in a sheet. */
|
|
103
155
|
export interface Slot {
|
|
104
156
|
/** The element's inline `animation`: `var(--wardic-aN)`, which the sheet defines once `define` is called. */
|
|
@@ -114,10 +166,24 @@ export interface Slot {
|
|
|
114
166
|
*/
|
|
115
167
|
readonly define: (play: Play, reduced?: Play | undefined, supports?: ReadonlyArray<string>) => Result.Result<void, string>;
|
|
116
168
|
}
|
|
169
|
+
/** A Batch's members' place in a sheet: one slot for every member on one rule (#706). */
|
|
170
|
+
export interface BatchSlot {
|
|
171
|
+
/**
|
|
172
|
+
* A member's inline style, by its index in the rule's spec: its own values, and its `animation`, the slot
|
|
173
|
+
* and, when it waits (its stagger), its delay after it. `undefined` for a member that doesn't move.
|
|
174
|
+
*/
|
|
175
|
+
readonly styleOf: (member: number, delay: number) => Readonly<Record<string, string>> | undefined;
|
|
176
|
+
}
|
|
117
177
|
/** One render's Appear rules: a slot per element, and the `<style>` text for the head and each late chunk. */
|
|
118
178
|
export interface Sheet {
|
|
119
179
|
/** A slot for the next element. */
|
|
120
180
|
readonly slot: () => Slot;
|
|
181
|
+
/**
|
|
182
|
+
* A slot for a Batch's members on `play`'s rule, and under `prefers-reduced-motion: reduce` `reduced`'s
|
|
183
|
+
* when given (a provider's `"user"`): both rules, and the slot's `:root` lines naming each with no delay,
|
|
184
|
+
* since each member gives its own.
|
|
185
|
+
*/
|
|
186
|
+
readonly batch: (play: BatchKeyframes, reduced?: BatchKeyframes | undefined) => BatchSlot;
|
|
121
187
|
/**
|
|
122
188
|
* The CSS since the last call: each rule this render hasn't written yet, and the custom property of
|
|
123
189
|
* each slot defined since, the reduced ones under the media query. Called once for the head, and again
|
|
@@ -146,24 +212,26 @@ export declare const chunkStyle: (css: string, nonce?: string) => string;
|
|
|
146
212
|
* observer a document.
|
|
147
213
|
*/
|
|
148
214
|
export declare const adoptChunks: (doc: Document) => void;
|
|
149
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* The element's Appear animation: its `wardic-…` CSS animation, running, or finished and filling. A
|
|
217
|
+
* Batch's rule on a member's element isn't one (#706): its Batch takes it over, not a Wardic element there.
|
|
218
|
+
*/
|
|
150
219
|
export declare const find: (element: Element) => Option.Option<Animation>;
|
|
220
|
+
/**
|
|
221
|
+
* A document's Appear animations by element, running or finished and filling: one `getAnimations()` for
|
|
222
|
+
* the page, for a Handoff of many elements at once, a Batch's members (#706). Each element's first: a
|
|
223
|
+
* member's Batch rule, or the one `find` gets.
|
|
224
|
+
*/
|
|
225
|
+
export declare const findAll: (doc: Document) => ReadonlyMap<Element, Animation>;
|
|
151
226
|
/** Whether `animation` is `spec`'s: the rule the server sampled from the same spec. */
|
|
152
227
|
export declare const matches: (animation: Animation, spec: Pick<Spec, "key" | "tag" | "infinite" | "projected">) => boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Whether `animation` is a Batch rule for a spec's `key`: its name starts with the key's prefix, so the
|
|
230
|
+
* server's transitions and reduced motion are the client's. Its members' values aren't checked (#706, Q9).
|
|
231
|
+
*/
|
|
232
|
+
export declare const matchesBatch: (animation: Animation, key: string) => boolean;
|
|
153
233
|
/** How far `animation` has got, in seconds since it started (its delay included): 0 before it has. */
|
|
154
234
|
export declare const elapsedOf: (animation: Animation) => number;
|
|
155
235
|
/** The delay `animation` started after, in seconds: what its element's `animation-delay` holds. */
|
|
156
236
|
export declare const delayOf: (animation: Animation) => number;
|
|
157
|
-
/**
|
|
158
|
-
* Whether `element`'s Appear animation is running, not yet handed over: its inline style still names its
|
|
159
|
-
* slot, which `release` removes. A layout measure asks it of each node, so a running animation's
|
|
160
|
-
* transform, which beats the inline one, stays out of the box it reads.
|
|
161
|
-
*/
|
|
162
|
-
export declare const pending: (element: ElementCSSInlineStyle) => boolean;
|
|
163
|
-
/**
|
|
164
|
-
* The handover's last step: the element's inline `animation` removed, in the task that writes the
|
|
165
|
-
* engine's first frame, so no paint falls between. While it ran, its value beat the inline style the
|
|
166
|
-
* engine writes; removing it ends the CSS animation at that task's style update.
|
|
167
|
-
*/
|
|
168
|
-
export declare const release: (element: ElementCSSInlineStyle) => void;
|
|
169
237
|
//# sourceMappingURL=appear.d.ts.map
|