@wardic/dom 1.3.1 → 1.4.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/MeasuredPair.d.ts +14 -1
- package/dist/MeasuredPair.d.ts.map +1 -1
- package/dist/MeasuredPair.js +11 -13
- package/dist/MeasuredPair.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/appear.d.ts +6 -0
- package/dist/internal/appear.d.ts.map +1 -1
- package/dist/internal/appear.js +20 -2
- package/dist/internal/appear.js.map +1 -1
- package/dist/internal/batch-handoff.d.ts.map +1 -1
- package/dist/internal/batch-handoff.js +25 -15
- package/dist/internal/batch-handoff.js.map +1 -1
- package/dist/internal/batch-writer.d.ts +1 -1
- package/dist/internal/batch-writer.d.ts.map +1 -1
- package/dist/internal/batch-writer.js +32 -16
- package/dist/internal/batch-writer.js.map +1 -1
- package/dist/internal/clock.d.ts +6 -0
- package/dist/internal/clock.d.ts.map +1 -1
- package/dist/internal/clock.js +27 -0
- package/dist/internal/clock.js.map +1 -1
- package/dist/internal/default-transition.d.ts +3 -2
- package/dist/internal/default-transition.d.ts.map +1 -1
- package/dist/internal/default-transition.js +28 -3
- package/dist/internal/default-transition.js.map +1 -1
- package/dist/internal/failing.d.ts +9 -0
- package/dist/internal/failing.d.ts.map +1 -0
- package/dist/internal/failing.js +33 -0
- package/dist/internal/failing.js.map +1 -0
- package/dist/internal/length-keys.d.ts +19 -0
- package/dist/internal/length-keys.d.ts.map +1 -0
- package/dist/internal/length-keys.js +77 -0
- package/dist/internal/length-keys.js.map +1 -0
- package/dist/internal/measured-pairs.d.ts +3 -2
- package/dist/internal/measured-pairs.d.ts.map +1 -1
- package/dist/internal/measured-pairs.js +60 -23
- package/dist/internal/measured-pairs.js.map +1 -1
- package/dist/internal/own-values.d.ts.map +1 -1
- package/dist/internal/own-values.js +2 -2
- package/dist/internal/own-values.js.map +1 -1
- package/dist/internal/positional-keys.d.ts +1 -1
- package/dist/internal/positional-keys.d.ts.map +1 -1
- package/dist/internal/positional-keys.js +4 -2
- package/dist/internal/positional-keys.js.map +1 -1
- package/dist/internal/projection.d.ts.map +1 -1
- package/dist/internal/projection.js +180 -46
- package/dist/internal/projection.js.map +1 -1
- package/dist/internal/renderer.d.ts +59 -27
- package/dist/internal/renderer.d.ts.map +1 -1
- package/dist/internal/renderer.js +241 -207
- package/dist/internal/renderer.js.map +1 -1
- package/dist/internal/scroll.d.ts.map +1 -1
- package/dist/internal/scroll.js +26 -2
- package/dist/internal/scroll.js.map +1 -1
- package/dist/internal/starting-style.js +5 -5
- package/dist/internal/transform-keys.d.ts +23 -0
- package/dist/internal/transform-keys.d.ts.map +1 -0
- package/dist/internal/transform-keys.js +55 -0
- package/dist/internal/transform-keys.js.map +1 -0
- package/dist/unstable/AppearAnimations.d.ts +2 -1
- package/dist/unstable/AppearAnimations.d.ts.map +1 -1
- package/dist/unstable/AppearAnimations.js +73 -22
- package/dist/unstable/AppearAnimations.js.map +1 -1
- package/dist/unstable/BatchMembers.d.ts +2 -2
- package/dist/unstable/BatchMembers.d.ts.map +1 -1
- package/dist/unstable/BatchMembers.js +30 -7
- package/dist/unstable/BatchMembers.js.map +1 -1
- package/dist/unstable/DomValues.js +1 -1
- package/dist/unstable/DomValues.js.map +1 -1
- package/dist/unstable/DragTrack.d.ts +2 -2
- package/dist/unstable/DragTrack.d.ts.map +1 -1
- package/dist/unstable/DragTrack.js +37 -10
- package/dist/unstable/DragTrack.js.map +1 -1
- package/dist/unstable/ElementSetup.d.ts.map +1 -1
- package/dist/unstable/ElementSetup.js +3 -2
- package/dist/unstable/ElementSetup.js.map +1 -1
- package/dist/unstable/GestureFeatures.d.ts +8 -2
- package/dist/unstable/GestureFeatures.d.ts.map +1 -1
- package/dist/unstable/GestureFeatures.js +26 -40
- package/dist/unstable/GestureFeatures.js.map +1 -1
- package/dist/unstable/GestureInfo.d.ts +11 -0
- package/dist/unstable/GestureInfo.d.ts.map +1 -1
- package/dist/unstable/GestureInfo.js +8 -0
- package/dist/unstable/GestureInfo.js.map +1 -1
- package/dist/unstable/Imperative.d.ts +1 -1
- package/dist/unstable/Imperative.d.ts.map +1 -1
- package/dist/unstable/Imperative.js.map +1 -1
- package/dist/unstable/LiveStyle.d.ts +28 -2
- package/dist/unstable/LiveStyle.d.ts.map +1 -1
- package/dist/unstable/LiveStyle.js +8 -32
- package/dist/unstable/LiveStyle.js.map +1 -1
- package/dist/unstable/MemberHold.js +3 -3
- package/dist/unstable/MemberHold.js.map +1 -1
- package/dist/unstable/PointerValues.d.ts.map +1 -1
- package/dist/unstable/PointerValues.js +82 -8
- package/dist/unstable/PointerValues.js.map +1 -1
- package/dist/unstable/PresenceController.d.ts +5 -2
- package/dist/unstable/PresenceController.d.ts.map +1 -1
- package/dist/unstable/PresenceController.js +82 -55
- package/dist/unstable/PresenceController.js.map +1 -1
- package/dist/unstable/ReorderInput.d.ts +2 -2
- package/dist/unstable/ReorderInput.js +2 -2
- package/dist/unstable/WardConfig.d.ts +18 -9
- package/dist/unstable/WardConfig.d.ts.map +1 -1
- package/dist/unstable/WardConfig.js.map +1 -1
- package/dist/unstable/features/TimelineKeys.d.ts.map +1 -1
- package/dist/unstable/features/TimelineKeys.js +19 -3
- package/dist/unstable/features/TimelineKeys.js.map +1 -1
- package/package.json +3 -3
- package/src/MeasuredPair.ts +21 -1
- package/src/index.ts +4 -1
- package/src/internal/appear.ts +20 -2
- package/src/internal/batch-handoff.ts +19 -11
- package/src/internal/batch-writer.ts +32 -16
- package/src/internal/clock.ts +28 -0
- package/src/internal/default-transition.ts +28 -4
- package/src/internal/failing.ts +37 -0
- package/src/internal/length-keys.ts +80 -0
- package/src/internal/measured-pairs.ts +58 -22
- package/src/internal/own-values.ts +2 -2
- package/src/internal/positional-keys.ts +4 -2
- package/src/internal/projection.ts +190 -44
- package/src/internal/renderer.ts +272 -198
- package/src/internal/scroll.ts +24 -2
- package/src/internal/starting-style.ts +5 -5
- package/src/internal/transform-keys.ts +59 -0
- package/src/unstable/AppearAnimations.ts +73 -24
- package/src/unstable/BatchMembers.ts +33 -9
- package/src/unstable/DomValues.ts +1 -1
- package/src/unstable/DragTrack.ts +49 -14
- package/src/unstable/ElementSetup.ts +3 -2
- package/src/unstable/GestureFeatures.ts +38 -47
- package/src/unstable/GestureInfo.ts +24 -0
- package/src/unstable/Imperative.ts +1 -0
- package/src/unstable/LiveStyle.ts +12 -8
- package/src/unstable/MemberHold.ts +3 -3
- package/src/unstable/PointerValues.ts +73 -8
- package/src/unstable/PresenceController.ts +80 -54
- package/src/unstable/ReorderInput.ts +2 -2
- package/src/unstable/WardConfig.ts +22 -10
- package/src/unstable/features/TimelineKeys.ts +20 -3
|
@@ -24,8 +24,8 @@ const isPress = (event) => Bool.and(event.type === "down", InputSource.isPrimary
|
|
|
24
24
|
* keys inside their dispatch, so the reorder's `handle()` (the page's `preventDefault`) counts. A blur
|
|
25
25
|
* is judged after this task's own work, one scheduler hop on (#318): a reorder can blur the node it
|
|
26
26
|
* moves and puts focus back after (the driver's `keepFocus`). So `fork` runs that hop on the provider
|
|
27
|
-
* runtime, only when a blur happens, and a blur whose judging fails is reported. A
|
|
28
|
-
* driver inside an event goes to `onDefect
|
|
27
|
+
* runtime, only when a blur happens, and a blur whose judging fails is reported. A run of throws from
|
|
28
|
+
* the driver inside an event goes to `onDefect` at its first.
|
|
29
29
|
*/
|
|
30
30
|
export const watchItemInput = (el, driver, fork, onDefect) => {
|
|
31
31
|
const judgeBlur = judgedBlurOf(driver);
|
|
@@ -17,7 +17,7 @@ import type * as ProjectionSystem from "../ProjectionSystem.ts";
|
|
|
17
17
|
import type { WardicDragConstraints, WardicMeasureDragConstraints } from "./DragConstraints.ts";
|
|
18
18
|
import type { WardicDragControls } from "./DragControls.ts";
|
|
19
19
|
import type * as Feature from "./Feature.ts";
|
|
20
|
-
import type { WardicDragInfo, WardicPointInfo, WardicPressEvent, WardicPressInfo } from "./GestureInfo.ts";
|
|
20
|
+
import type { WardicDragEndInfo, WardicDragInfo, WardicPointInfo, WardicPressEvent, WardicPressInfo } from "./GestureInfo.ts";
|
|
21
21
|
/** What "in view" means: an element's `viewport`, and `createInView`'s. Motion's `viewport` and `useInView` options. */
|
|
22
22
|
export interface WardicViewport {
|
|
23
23
|
/** Stays in view after its first entry. */
|
|
@@ -42,6 +42,11 @@ export interface CSSProperties extends CSS.PropertiesHyphen {
|
|
|
42
42
|
* is used verbatim).
|
|
43
43
|
*/
|
|
44
44
|
export interface WardicTransformShorthands {
|
|
45
|
+
/**
|
|
46
|
+
* The element's own depth, Motion's `transformPerspective`: a `perspective()` at the head of its
|
|
47
|
+
* transform, a bare number in px. Its children's depth is the `perspective` property's.
|
|
48
|
+
*/
|
|
49
|
+
readonly transformPerspective?: number | string;
|
|
45
50
|
readonly x?: number | string;
|
|
46
51
|
readonly y?: number | string;
|
|
47
52
|
readonly z?: number | string;
|
|
@@ -51,6 +56,8 @@ export interface WardicTransformShorthands {
|
|
|
51
56
|
readonly scale?: number | string;
|
|
52
57
|
readonly scaleX?: number | string;
|
|
53
58
|
readonly scaleY?: number | string;
|
|
59
|
+
/** The scale along the element's depth, CSS's `scaleZ()`: seen only beside a turn out of its plane. */
|
|
60
|
+
readonly scaleZ?: number | string;
|
|
54
61
|
readonly rotate?: number | string;
|
|
55
62
|
readonly rotateX?: number | string;
|
|
56
63
|
readonly rotateY?: number | string;
|
|
@@ -102,8 +109,8 @@ export type WardicValues = Omit<CSSProperties, keyof WardicTransformShorthands |
|
|
|
102
109
|
/**
|
|
103
110
|
* The CSS lengths a value takes a bare number on, drawn in `px` (#522, Motion's `animate={{ height: 200 }}`):
|
|
104
111
|
* the DOM renderer's `LENGTH_KEYS`, so a number typechecks only where it's drawn as a length. Every
|
|
105
|
-
* other length takes `csstype`'s value, `0` or a string.
|
|
106
|
-
*
|
|
112
|
+
* other length takes `csstype`'s value, `0` or a string. In an element's `style`, a number on one of these
|
|
113
|
+
* is drawn by Wardic too, in px, so `style={{ width: 200 }}` is 200px.
|
|
107
114
|
*/
|
|
108
115
|
export type WardicLengths = {
|
|
109
116
|
readonly [K in DomRenderer.LengthKey]?: number | CSSProperties[K];
|
|
@@ -245,7 +252,7 @@ export interface WardBaseConfig {
|
|
|
245
252
|
*/
|
|
246
253
|
readonly variants?: Config.WardicVariants;
|
|
247
254
|
/**
|
|
248
|
-
* The value passed to this element's
|
|
255
|
+
* The value passed to this element's dynamic variants. When it changes, they're resolved again,
|
|
249
256
|
* and the element animates to what they give. A leaving element uses `<AnimatePresence custom>`
|
|
250
257
|
* instead, if given.
|
|
251
258
|
*/
|
|
@@ -273,7 +280,9 @@ export interface WardBaseConfig {
|
|
|
273
280
|
readonly transition?: WardicTransition;
|
|
274
281
|
/**
|
|
275
282
|
* Where the element animates as it leaves an `<AnimatePresence>`: values or a `variants` name. The
|
|
276
|
-
* element stays on the page until it has played.
|
|
283
|
+
* element stays on the page until it has played. A dynamic variant that throws as the element
|
|
284
|
+
* leaves, alone or in a list, is reported, and the element leaves at once, without its exit; the
|
|
285
|
+
* others leaving beside it exit.
|
|
277
286
|
*
|
|
278
287
|
* @example <w.div exit={{ opacity: 0, scale: 0.9 }} />
|
|
279
288
|
*/
|
|
@@ -392,8 +401,8 @@ export interface WardPanConfig {
|
|
|
392
401
|
readonly onPanStart?: (event: PointerEvent, info: WardicDragInfo) => void;
|
|
393
402
|
/** Called as the pan moves: at its start, and each move after. Solid 1; Solid 2's ward gives `"pan"`. */
|
|
394
403
|
readonly onPan?: (event: PointerEvent, info: WardicDragInfo) => void;
|
|
395
|
-
/** Called when a pan that started ends, or is cancelled. Solid 1; Solid 2's ward gives `"panEnd"`. */
|
|
396
|
-
readonly onPanEnd?: (event: PointerEvent, info:
|
|
404
|
+
/** Called when a pan that started ends, or is cancelled, its info saying how (`endedBy`, #1042). Solid 1; Solid 2's ward gives `"panEnd"`. */
|
|
405
|
+
readonly onPanEnd?: (event: PointerEvent, info: WardicDragEndInfo) => void;
|
|
397
406
|
}
|
|
398
407
|
/** The motion props the `drag` Feature reads: {@link WardConfig}'s `drag` group (#516). */
|
|
399
408
|
export interface WardDragConfig {
|
|
@@ -463,8 +472,8 @@ export interface WardDragConfig {
|
|
|
463
472
|
readonly onDragStart?: (event: PointerEvent, info: WardicDragInfo) => void;
|
|
464
473
|
/** Called as the drag moves: at its start, and each move after. Solid 1; Solid 2's ward gives `"drag"`. */
|
|
465
474
|
readonly onDrag?: (event: PointerEvent, info: WardicDragInfo) => void;
|
|
466
|
-
/** Called when the drag
|
|
467
|
-
readonly onDragEnd?: (event: PointerEvent, info:
|
|
475
|
+
/** Called when the drag ends, its info saying how: let go, or taken away (`endedBy`, #1042). Solid 1; Solid 2's ward gives `"dragEnd"`. */
|
|
476
|
+
readonly onDragEnd?: (event: PointerEvent, info: WardicDragEndInfo) => void;
|
|
468
477
|
/** Called when the element comes to rest after it's let go. Not when a new grab stops it. Solid 1; Solid 2's ward gives `"dragTransitionEnd"`. */
|
|
469
478
|
readonly onDragTransitionEnd?: () => void;
|
|
470
479
|
/** With `dragDirectionLock`: called with the axis a drag locked to, before `onDragStart`. Solid 1; Solid 2's ward gives `"directionLock"`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardConfig.d.ts","sourceRoot":"","sources":["../../src/unstable/WardConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,MAAM,8BAA8B,CAAA;AAC3D,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,KAAK,WAAW,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AAC/F,O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,CAAC,EAAE,MAAM,IAAI,CAAA;IAC/C,yFAAyF;IAEzF,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3C;;;OAGG;IAEH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,GAAG,SAAS,KAAK,IAAI,CAAA;CAC7F;AAED;;;;;GAKG;AACH,MAAM,WAAW,UACf,SAAQ,MAAM,CAAC,WAAW,EACxB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,gBAAgB;CAAG;AAEvB;;;;GAIG;AAGH,MAAM,WAAW,kBAAmB,SAAQ,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7E,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardConfig.js","sourceRoot":"","sources":["../../src/unstable/WardConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WardConfig.js","sourceRoot":"","sources":["../../src/unstable/WardConfig.ts"],"names":[],"mappings":"AAkKA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineKeys.d.ts","sourceRoot":"","sources":["../../../src/unstable/features/TimelineKeys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TimelineKeys.d.ts","sourceRoot":"","sources":["../../../src/unstable/features/TimelineKeys.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,KAAK,SAAS,MAAM,iCAAiC,CAAA;AAcjE;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,SAAS,CAAC,SAAS,CAAC,SAAS,CAY7D,CAAA"}
|
|
@@ -12,8 +12,11 @@
|
|
|
12
12
|
// Unstable: ADR-0071, decision 5. #672 (PR6-Q1): solid's `features/timeline-keys.ts`, moved to dom with the Features, for
|
|
13
13
|
// every DOM binding.
|
|
14
14
|
import * as LiveValue from "@wardic/core/LiveValue";
|
|
15
|
+
import * as Report from "@wardic/core/unstable/Report";
|
|
15
16
|
import * as TimelineValue from "../../TimelineValue.js";
|
|
16
17
|
import * as Bool from "effect/Boolean";
|
|
18
|
+
import * as Effect from "effect/Effect";
|
|
19
|
+
import * as Exit from "effect/Exit";
|
|
17
20
|
import * as Option from "effect/Option";
|
|
18
21
|
import * as Predicate from "effect/Predicate";
|
|
19
22
|
/**
|
|
@@ -33,6 +36,9 @@ export const makeTimelines = () => {
|
|
|
33
36
|
},
|
|
34
37
|
};
|
|
35
38
|
};
|
|
39
|
+
// #979 (ADR-0074, row 7): a make calls the app's code, an `ease` or an interpolator, at each point its
|
|
40
|
+
// keyframes sample, some the frame path never reads. Its throw came out of the binding, a Solid 2 halt.
|
|
41
|
+
const TIMELINE_FAILED = "wardic.timeline: a Timeline value failed";
|
|
36
42
|
/**
|
|
37
43
|
* An element's keys. `shown` runs at each write of a key's Live value, so per frame while it moves: a key
|
|
38
44
|
* shown already from the same source is left as it is, with nothing read but its source, statements and
|
|
@@ -41,14 +47,18 @@ export const makeTimelines = () => {
|
|
|
41
47
|
const elementKeysOf = (options, unmounted) => {
|
|
42
48
|
const { runtime, gate, id, live } = options;
|
|
43
49
|
// #672: the spine hands its Subject; a DOM binding's is its element, which a Timeline value follows.
|
|
44
|
-
const element = options.
|
|
50
|
+
const element = options.subject;
|
|
45
51
|
const made = new Map();
|
|
46
52
|
// The keys that show their Live value, whatever runs them, each with the Atom it was shown from (none
|
|
47
53
|
// for a plain accessor's): the ones `recheck` looks at again.
|
|
48
54
|
const showing = new Map();
|
|
49
55
|
// The keys whose Timeline value the gate has, each with it.
|
|
50
56
|
const running = new Map();
|
|
51
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* `key`'s Timeline value now, made again when its derivation changed; `undefined` for none. A make that
|
|
59
|
+
* throws is reported and makes none, so the gate draws the key, and it's kept as made: tried again only
|
|
60
|
+
* for a new derivation.
|
|
61
|
+
*/
|
|
52
62
|
const timelineOf = (key) => {
|
|
53
63
|
const atom = live.atomOf(key);
|
|
54
64
|
if (Predicate.isUndefined(atom))
|
|
@@ -61,7 +71,13 @@ const elementKeysOf = (options, unmounted) => {
|
|
|
61
71
|
if (last.derivation === derivation)
|
|
62
72
|
return last.timeline;
|
|
63
73
|
}
|
|
64
|
-
const timeline =
|
|
74
|
+
const timeline = Exit.match(runtime.runSyncExit(TimelineValue.make(derivation, element, key)), {
|
|
75
|
+
onSuccess: Option.getOrUndefined,
|
|
76
|
+
onFailure: (cause) => {
|
|
77
|
+
runtime.runFork(Report.failure(TIMELINE_FAILED, cause).pipe(Effect.annotateLogs({ key })));
|
|
78
|
+
return undefined;
|
|
79
|
+
},
|
|
80
|
+
});
|
|
65
81
|
made.set(key, { derivation, timeline });
|
|
66
82
|
return timeline;
|
|
67
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineKeys.js","sourceRoot":"","sources":["../../../src/unstable/features/TimelineKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,0HAA0H;AAC1H,qBAAqB;AACrB,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAA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AAG,CAAC,GAAG,CAAC,CAAC,CAAA;QACvC,CAAC;QACD,OAAO,EAAE,SAAS;KACnB,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wardic/dom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The browser environment for Wardic: its clock, renderer, input, probe and projection system, as Effect Layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animation",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"typecheck:tests": "../../node_modules/typescript-7/bin/tsc -p tsconfig.test.json"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@wardic/core": "1.
|
|
58
|
+
"@wardic/core": "1.4.0",
|
|
59
59
|
"csstype": "^3.1.0",
|
|
60
60
|
"culori": "^4.0.2"
|
|
61
61
|
},
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"effect": "^4.1.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@wardic/test": "1.
|
|
66
|
+
"@wardic/test": "1.4.0"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/src/MeasuredPair.ts
CHANGED
|
@@ -12,4 +12,24 @@
|
|
|
12
12
|
*/
|
|
13
13
|
// **Measured pairs** (#430, CONTEXT.md, Motion's `DOMKeyframesResolver`). `@wardic/dom/MeasuredPair`: for
|
|
14
14
|
// binding authors.
|
|
15
|
-
|
|
15
|
+
import type * as Values from "@wardic/core/Values"
|
|
16
|
+
import { measure as measureFor, measured, type Requested } from "./internal/measured-pairs.ts"
|
|
17
|
+
|
|
18
|
+
export { measured, type Measured, needs, type Requested } from "./internal/measured-pairs.ts"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Measures `pairs` on `element` at the end of this task, with every other element's in the same batch:
|
|
22
|
+
* each pair, as asked, {@link measured} before the next tick. `values` are what the element draws now,
|
|
23
|
+
* its other transforms among them. If writing them throws (a Transform template among `values`), its
|
|
24
|
+
* pairs are never measured, the throw is reported to the page as an uncaught one is, and the rest of the
|
|
25
|
+
* batch goes on.
|
|
26
|
+
*/
|
|
27
|
+
// #979, row 8 (ADR-0074): Wardic's own askers tell the batch's throw to their runtime (`DomValues`' port).
|
|
28
|
+
export const measure = (
|
|
29
|
+
element: HTMLElement,
|
|
30
|
+
pairs: Readonly<Record<string, { readonly from: number | string; readonly to: number | string }>>,
|
|
31
|
+
values: Values.Values,
|
|
32
|
+
): Readonly<Record<string, Requested>> => measureFor(element, pairs, values, reportToPage)
|
|
33
|
+
|
|
34
|
+
/** A request's throw, with no runtime to tell: the page's. */
|
|
35
|
+
const reportToPage = (defect: unknown): void => globalThis.reportError(defect)
|
package/src/index.ts
CHANGED
|
@@ -37,8 +37,9 @@ import * as DomInterpolators from "./DomInterpolators.ts"
|
|
|
37
37
|
import * as DomPositionalKeys from "./DomPositionalKeys.ts"
|
|
38
38
|
import * as DomProbe from "./DomProbe.ts"
|
|
39
39
|
import * as DomRenderer from "./DomRenderer.ts"
|
|
40
|
+
import { LateFramesDomLive } from "./internal/clock.ts"
|
|
40
41
|
|
|
41
|
-
export const VERSION = "1.
|
|
42
|
+
export const VERSION = "1.4.0"
|
|
42
43
|
|
|
43
44
|
export * as DomBatch from "./DomBatch.ts"
|
|
44
45
|
export * as DomClock from "./DomClock.ts"
|
|
@@ -123,6 +124,8 @@ export const DomLive: Layer.Layer<
|
|
|
123
124
|
| Announcer.Announcer
|
|
124
125
|
| AtomRegistry.AtomRegistry
|
|
125
126
|
> = FrameLoop.layer.pipe(
|
|
127
|
+
// A frame a long task delayed, told by when its callback ran (#1026): its lateness left out of a new run's first steps.
|
|
128
|
+
Layer.provide(LateFramesDomLive),
|
|
126
129
|
Layer.provideMerge(
|
|
127
130
|
Layer.mergeAll(DomClock.layer, DomRenderer.layer, DomProbe.layer, DomInterpolators.layer, DomPositionalKeys.layer, DomDefaultTransition.layer, DomAnnouncer.layer),
|
|
128
131
|
),
|
package/src/internal/appear.ts
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* @module
|
|
17
17
|
*/
|
|
18
18
|
import * as Batch from "@wardic/core/Batch"
|
|
19
|
-
import * as BaseValue from "@wardic/core/BaseValue"
|
|
20
19
|
import type * as Frame from "@wardic/core/Frame"
|
|
21
20
|
import * as Machine from "@wardic/core/Machine"
|
|
22
21
|
import * as Projection from "@wardic/core/Projection"
|
|
@@ -35,6 +34,7 @@ import { spacesRegistered } from "./colors.ts"
|
|
|
35
34
|
import { drawnUnitOf, project, TEMPLATE_KEY, TRANSFORM_FUNCS, type TransformTemplate, unitOf } from "./renderer.ts"
|
|
36
35
|
import { PREFIX } from "./appear-slot.ts"
|
|
37
36
|
import { dashCase, isPathKey, isSvgInnerTag, splitPatchForTag, svgAttrNameOf } from "./svg.ts"
|
|
37
|
+
import * as TransformKeys from "./transform-keys.ts"
|
|
38
38
|
|
|
39
39
|
/** An element's mount animation, as its binding describes it. */
|
|
40
40
|
export interface Spec {
|
|
@@ -245,7 +245,7 @@ const toleranceFor = (key: string, svgInner: boolean, bare: boolean, unit: strin
|
|
|
245
245
|
/** A bare number's tolerance, by the unit `project` draws `key` in. */
|
|
246
246
|
const bareTolerance = (key: string): number =>
|
|
247
247
|
Bool.match(drawnUnitOf(key) === "", {
|
|
248
|
-
onTrue: () => Bool.match(
|
|
248
|
+
onTrue: () => Bool.match(TransformKeys.TRANSFORM_IDENTITY[key] === 1, { onTrue: () => 0.001, onFalse: () => 0.002 }),
|
|
249
249
|
onFalse: () => 0.1,
|
|
250
250
|
})
|
|
251
251
|
|
|
@@ -796,6 +796,21 @@ const batchNameOf = (spec: BatchSpec, columns: ReadonlyArray<Column>): string =>
|
|
|
796
796
|
// Module state (#460, Q7): a cache keyed by what it caches.
|
|
797
797
|
const batchCache = /*#__PURE__*/ new Map<string, Result.Result<Keyframes, string>>()
|
|
798
798
|
|
|
799
|
+
/**
|
|
800
|
+
* Why a rule can't stand in for an element's own depth that moves: CSS blends two `perspective()`s by
|
|
801
|
+
* decomposing their matrices, linear in 1/depth (CSS Transforms 2, §14), so 100px to 1000px reads 181.8px
|
|
802
|
+
* halfway, where Wardic's frame reads 550px. A depth that doesn't move is drawn the same in every stop.
|
|
803
|
+
*/
|
|
804
|
+
// #887 (ADR-0073, *Amendment (#887)*, Q13), as Timeline values leave `perspective()` out (`timeline.ts`).
|
|
805
|
+
export const DEPTH_MOVES_REASON = `${TransformKeys.PERSPECTIVE} moves, and CSS blends a depth by its inverse, not as Wardic draws it`
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Why a Batch's rule can't draw its members' depths: a member's is at or below 0, which Wardic leaves out,
|
|
809
|
+
* and CSS draws as 1px, or refuses with the stop's whole `transform`.
|
|
810
|
+
*/
|
|
811
|
+
// #887: a rule draws a depth its members hold in every stop, each one's own as a custom property.
|
|
812
|
+
const DEPTH_AT_FLOOR_REASON = `${TransformKeys.PERSPECTIVE} at or below 0 on a member, which CSS draws unlike Wardic`
|
|
813
|
+
|
|
799
814
|
/** A spec's first key with a start or target that isn't a finite number: a rule can't write it. */
|
|
800
815
|
const unfiniteKeyOf = (spec: BatchSpec): Option.Option<string> =>
|
|
801
816
|
Arr.findFirst(spec.keys, (_, k) => Arr.some(Arr.appendAll(spec.starts, spec.targets), (values) => Bool.not(Number.isFinite(values[k] as number))))
|
|
@@ -812,7 +827,10 @@ export const batchKeyframes = (spec: BatchSpec): Result.Result<BatchKeyframes, s
|
|
|
812
827
|
if (Option.isSome(unfinite)) return Result.fail(`a start or target that isn't a finite number (${unfinite.value})`)
|
|
813
828
|
const movers = moversOf(spec)
|
|
814
829
|
const columns = columnsOf(spec.keys, movers)
|
|
830
|
+
if (Arr.some(columns, (column) => Bool.and(column.key === TransformKeys.PERSPECTIVE, column.moves))) return Result.fail(DEPTH_MOVES_REASON)
|
|
815
831
|
const written = writtenOf(movers, columns)
|
|
832
|
+
const depth = Arr.findFirst(written.transform, (column) => column.key === TransformKeys.PERSPECTIVE)
|
|
833
|
+
if (Option.isSome(depth) && Arr.some(movers.targets, (values) => Bool.not(TransformKeys.drawsDepth(values[depth.value.k])))) return Result.fail(DEPTH_AT_FLOOR_REASON)
|
|
816
834
|
if (Bool.and(Arr.isReadonlyArrayEmpty(written.transform), Option.isNone(written.opacity))) return Result.fail("no key moves")
|
|
817
835
|
const name = batchNameOf(spec, columns)
|
|
818
836
|
const rule = Option.getOrElse(Option.fromUndefinedOr(batchCache.get(name)), () => remember(batchCache, name, sampleBatch(spec, columns, written, name)))
|
|
@@ -43,6 +43,9 @@ const MISMATCH = /*#__PURE__*/ Effect.logDebug("wardic.hydration: a Batch member
|
|
|
43
43
|
*/
|
|
44
44
|
export const startAtOf = (members: HandoffMembers): ((slot: number) => number) => {
|
|
45
45
|
let times: Map<number, number> | undefined = undefined
|
|
46
|
+
// Each member whose read threw, by slot: its own start throws it, for its Batch to report, and it plays
|
|
47
|
+
// its change from its start; every other member keeps its time (#977).
|
|
48
|
+
const failures = new Map<number, unknown>()
|
|
46
49
|
/** Every such member's time, read at once. */
|
|
47
50
|
const timesNow = (): Map<number, number> => {
|
|
48
51
|
const read = new Map<number, number>()
|
|
@@ -50,16 +53,20 @@ export const startAtOf = (members: HandoffMembers): ((slot: number) => number) =
|
|
|
50
53
|
const keyOf = members.keyOf
|
|
51
54
|
// Once a Handoff, over its members (#665's per-member site): reads alone.
|
|
52
55
|
Iter.forEach(members.appearing, (slot) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
checked.
|
|
60
|
-
|
|
56
|
+
try {
|
|
57
|
+
const el = members.elementOf(slot)
|
|
58
|
+
if (Predicate.isUndefined(el)) return
|
|
59
|
+
const animation = AppearAnimations.pageAnimationsOf(el).get(el)
|
|
60
|
+
if (Predicate.isUndefined(animation)) return
|
|
61
|
+
const name = (animation as Animation & { readonly animationName: string }).animationName
|
|
62
|
+
if (Predicate.isNotUndefined(keyOf) && !checked.has(name)) {
|
|
63
|
+
checked.add(name)
|
|
64
|
+
if (!Option.exists(keyOf(slot), (key) => Appear.matchesBatch(animation, key))) members.runtime.runFork(MISMATCH)
|
|
65
|
+
}
|
|
66
|
+
read.set(slot, Appear.elapsedOf(animation))
|
|
67
|
+
} catch (defect) {
|
|
68
|
+
failures.set(slot, defect)
|
|
61
69
|
}
|
|
62
|
-
read.set(slot, Appear.elapsedOf(animation))
|
|
63
70
|
})
|
|
64
71
|
// Every one let go once this step's starts are done, a member it didn't move among them.
|
|
65
72
|
queueMicrotask(members.release)
|
|
@@ -69,7 +76,8 @@ export const startAtOf = (members: HandoffMembers): ((slot: number) => number) =
|
|
|
69
76
|
return (slot) => {
|
|
70
77
|
if (Predicate.isUndefined(times)) times = timesNow()
|
|
71
78
|
const time = times.get(slot)
|
|
72
|
-
if (Predicate.
|
|
73
|
-
|
|
79
|
+
if (Predicate.isNotUndefined(time)) return time
|
|
80
|
+
if (failures.has(slot)) throw failures.get(slot)
|
|
81
|
+
return Number.NaN
|
|
74
82
|
}
|
|
75
83
|
}
|
|
@@ -13,7 +13,8 @@ import * as Bool from "effect/Boolean"
|
|
|
13
13
|
import * as Option from "effect/Option"
|
|
14
14
|
import * as Predicate from "effect/Predicate"
|
|
15
15
|
import * as Result from "effect/Result"
|
|
16
|
-
import {
|
|
16
|
+
import { DEPTH_FUNC, TRANSFORM_FUNCS } from "./renderer.ts"
|
|
17
|
+
import * as TransformKeys from "./transform-keys.ts"
|
|
17
18
|
|
|
18
19
|
/** A transform function a Batch writes: its key's index in the Batch, what goes either side of its value, and its identity. */
|
|
19
20
|
interface Part {
|
|
@@ -23,23 +24,26 @@ interface Part {
|
|
|
23
24
|
readonly identity: number
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The transform functions a member draws, each with what goes either side of its value and its identity: the
|
|
29
|
+
* renderer's, less a path's turn, which an arc's element draws (#438). What `forKeys` and `styleOf` draw.
|
|
30
|
+
*/
|
|
27
31
|
const FUNCS = Arr.filter(TRANSFORM_FUNCS, (func) => func.key !== "pathRotation")
|
|
28
32
|
|
|
29
33
|
/** The keys the DOM's writer draws: those transform keys and `opacity`. */
|
|
30
34
|
const DRAWS: ReadonlySet<string> = new Set([...Arr.map(FUNCS, (func) => func.key), "opacity"])
|
|
31
35
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
/** What a member's write walks: every part but the element's own depth, which it writes ahead of them. */
|
|
37
|
+
// #887 (ADR-0073, *Amendment (#887)*, Q8), as the renderer's walk.
|
|
38
|
+
const WALKED_PARTS = Arr.filter(FUNCS, (part) => part.key !== TransformKeys.PERSPECTIVE)
|
|
39
|
+
|
|
40
|
+
/** What goes either side of a member's own depth in its write. */
|
|
41
|
+
const DEPTH_OPEN = DEPTH_FUNC.open
|
|
42
|
+
const DEPTH_CLOSE = DEPTH_FUNC.close
|
|
39
43
|
|
|
40
44
|
/** A Batch's write, for its keys in their order: built once, when the Batch is made. */
|
|
41
45
|
const forKeys = (keys: ReadonlyArray<string>): ((el: Element, positions: Float64Array, base: number) => void) => {
|
|
42
|
-
const parts: ReadonlyArray<Part> = Arr.filterMap(
|
|
46
|
+
const parts: ReadonlyArray<Part> = Arr.filterMap(WALKED_PARTS, (part) =>
|
|
43
47
|
Option.match(Arr.findFirstIndex(keys, (key) => key === part.key), {
|
|
44
48
|
onNone: () => Result.failVoid,
|
|
45
49
|
onSome: (k) => Result.succeed({ k, open: part.open, close: part.close, identity: part.identity }),
|
|
@@ -47,14 +51,23 @@ const forKeys = (keys: ReadonlyArray<string>): ((el: Element, positions: Float64
|
|
|
47
51
|
const count = parts.length
|
|
48
52
|
// Its index for the per-frame write, or -1 for none: a plain read there (ADR-0025, the per-frame path).
|
|
49
53
|
const opacityAt = Option.getOrElse(Arr.findFirstIndex(keys, (key) => key === "opacity"), () => -1)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//
|
|
54
|
+
const depthAt = Option.getOrElse(Arr.findFirstIndex(keys, (key) => key === TransformKeys.PERSPECTIVE), () => -1)
|
|
55
|
+
const writesTransform = Bool.or(count > 0, depthAt !== -1)
|
|
56
|
+
// Per frame, per moving member (ADR-0025, *Amendment (#69)*): its own depth first, then a counted loop
|
|
57
|
+
// over its transform functions in the renderer's order, each left out at its identity, the string built
|
|
58
|
+
// by concatenation as the renderer's is (ADR-0034); `none` when every one is left out (ADR-0023).
|
|
53
59
|
return (el, positions, base) => {
|
|
54
60
|
const style = (el as HTMLElement).style
|
|
55
|
-
if (
|
|
61
|
+
if (writesTransform) {
|
|
56
62
|
let transform = ""
|
|
57
63
|
let separator = ""
|
|
64
|
+
if (depthAt !== -1) {
|
|
65
|
+
const depth = positions[base + depthAt]
|
|
66
|
+
if (TransformKeys.drawsDepth(depth)) {
|
|
67
|
+
transform = DEPTH_OPEN + depth + DEPTH_CLOSE
|
|
68
|
+
separator = " "
|
|
69
|
+
}
|
|
70
|
+
}
|
|
58
71
|
for (let p = 0; p < count; p++) {
|
|
59
72
|
const part = parts[p]
|
|
60
73
|
const value = positions[base + part.k]
|
|
@@ -71,15 +84,18 @@ const forKeys = (keys: ReadonlyArray<string>): ((el: Element, positions: Float64
|
|
|
71
84
|
|
|
72
85
|
/**
|
|
73
86
|
* A member's style as a server writes it (#665's PR 6, Q63): `values`' `transform` and `opacity`, the
|
|
74
|
-
* strings `forKeys`' write draws them with, each left out
|
|
87
|
+
* strings `forKeys`' write draws them with, each left out as there. What the client then writes
|
|
75
88
|
* at the member's arrival is the same, so its element doesn't move at hydration.
|
|
76
89
|
*/
|
|
77
90
|
export const styleOf = (values: Readonly<Record<string, number>>): Readonly<Record<string, string>> => {
|
|
78
91
|
const style: Record<string, string> = {}
|
|
79
92
|
// Once a member on a server: in the renderer's order, as `forKeys`' write.
|
|
80
|
-
const functions = Arr.filterMap(
|
|
93
|
+
const functions = Arr.filterMap(FUNCS, (part) => {
|
|
81
94
|
const value = values[part.key]
|
|
82
95
|
if (Bool.or(Predicate.isUndefined(value), value === part.identity)) return Result.failVoid
|
|
96
|
+
if (part.key === TransformKeys.PERSPECTIVE) {
|
|
97
|
+
if (Bool.not(TransformKeys.drawsDepth(value))) return Result.failVoid
|
|
98
|
+
}
|
|
83
99
|
return Result.succeed(part.open + value + part.close)
|
|
84
100
|
})
|
|
85
101
|
if (functions.length > 0) style.transform = functions.join(" ")
|
package/src/internal/clock.ts
CHANGED
|
@@ -46,3 +46,31 @@ const frames: Layer.Layer<RefreshFrameSource.RefreshFrameSource> = Layer.effect(
|
|
|
46
46
|
export const ClockDomLive: Layer.Layer<Clock.Clock | RefreshFrameSource.RefreshFrameSource> = Clock.layer.pipe(
|
|
47
47
|
Layer.provideMerge(frames),
|
|
48
48
|
)
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The DOM's late frames, for its Frame loop (`Clock.LateFrames`): `requestAnimationFrame`'s timestamps are on
|
|
52
|
+
* `performance.now()`'s timebase, the Clock's `now()`, so a frame whose callback ran more than 25 ms after its
|
|
53
|
+
* timestamp was delayed by a long task.
|
|
54
|
+
*/
|
|
55
|
+
// #1026; 25 ms since #1028 (Q11), 40 before, Motion's line for "main thread work" (`MAX_START_DELAY`,
|
|
56
|
+
// motion-dom 14.6 `resolve-start-time.mjs`). ADR-0027 *Amendment (#1028)* has the sources (Chromium's
|
|
57
|
+
// `time_clamper.cc` and `page_animator.cc`, Firefox's `Performance.cpp` and `nsRFPService.cpp`, Brave's
|
|
58
|
+
// `time_clamper.cc`, Tor Browser's base profile).
|
|
59
|
+
// - On time, a frame's callback reads less than 3 ms after its timestamp in Chrome, Safari and Brave, and in
|
|
60
|
+
// Firefox at its defaults or with its fingerprinting protection. With `privacy.resistFingerprinting` (Tor
|
|
61
|
+
// Browser's), both clocks sit on a 16.7 ms grid with jitter: 16.7 ms often, 33.3 rarely (late, at 25), never
|
|
62
|
+
// 50. Only a 100 ms clamp misreads past 40 (resistFingerprinting before Firefox 102, or a raised
|
|
63
|
+
// `privacy.reduceTimerPrecision.microseconds`), which 40 didn't guard against either.
|
|
64
|
+
// - Why 25: past resistFingerprinting's common 16.7 ms reading, and short of two 60 Hz frames (33.3 ms) by
|
|
65
|
+
// more than a frame's jitter.
|
|
66
|
+
// - What 25 catches (measured in Chromium at 60 Hz): the frame after a held one is stamped at the last vsync
|
|
67
|
+
// the held one ran past. A frame held 33.3–40 ms, past two frames, is followed by one whose dt holds a frame
|
|
68
|
+
// of the task's time, which a new row's fade took at its second frame at 40, 0.06 → 0.17 (Solid's HL3). One
|
|
69
|
+
// held 25–33 ms is followed by one stamped a frame after it, whose dt holds none. Faster displays' two frames
|
|
70
|
+
// are shorter, so there a 25–33 ms hold hitches too, and 25 catches it.
|
|
71
|
+
// - What 25 costs: nothing at 60 Hz or faster, since the rule leaves a step of a 60 Hz frame or less alone.
|
|
72
|
+
// Slower, a misread trims one step of a new run to 1/60 s: no jump, it lands half a frame later. Telling a
|
|
73
|
+
// frame late is the line's one use: since #1050 a frame a long task delayed is told by its gap too (core's
|
|
74
|
+
// `FirstSteps.lateByGap`), which WebKit and Gecko need, stamping a late frame near when it ran, so that it
|
|
75
|
+
// never reads late. Before, the line also trimmed a run that waited past it for its first frame (#1048).
|
|
76
|
+
export const LateFramesDomLive = Layer.succeed(Clock.LateFrames, { ranAfter: 25 })
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* The DOM Environment's Default transition (CONTEXT.md; ADR-0051, #357): Motion's, by value
|
|
3
3
|
* (`.reference/motion` at 16c6122, `motion-dom/src/animation/utils/default-transitions.ts`,
|
|
4
4
|
* `getDefaultTransition`):
|
|
5
|
-
* - a transform but a scale
|
|
5
|
+
* - a transform but a scale, the DOM's own among them (`translateX`, `rotate`, `skewX`, the element's
|
|
6
|
+
* own depth `transformPerspective`…): a spring, 500 / 25, at rest under 10 px/s;
|
|
6
7
|
* - `scale`, `scaleX`, `scaleY`: a spring, 550, critically damped toward 0 (2·√550), else 30;
|
|
7
8
|
* - anything else (opacity, colours, a box's size, a filter): a 0.3 s tween on
|
|
8
9
|
* `cubic-bezier(0.25, 0.1, 0.35, 1)`, "a slightly shallower version of the browser's default ease".
|
|
@@ -16,13 +17,36 @@
|
|
|
16
17
|
*/
|
|
17
18
|
// #882 (ADR-0073, *Amendment (#882)*, Q2): core's table, `DefaultTransition.byKey`, the same objects.
|
|
18
19
|
import * as DefaultTransition from "@wardic/core/DefaultTransition"
|
|
19
|
-
import
|
|
20
|
+
import * as Layer from "effect/Layer"
|
|
21
|
+
import * as Predicate from "effect/Predicate"
|
|
22
|
+
import * as TransformKeys from "./transform-keys.ts"
|
|
20
23
|
|
|
21
24
|
/** The transition through more than two keyframes, as Motion's `keyframesTransition`: a 0.8 s tween, eased out. */
|
|
22
25
|
export const keyframes: DefaultTransition.KeyframesTransition = DefaultTransition.KEYFRAMES_TWEEN
|
|
23
26
|
|
|
27
|
+
/**
|
|
28
|
+
* The key of core's each of the DOM's own transform keys runs as: its twin, a translation's or a turn's.
|
|
29
|
+
* The element's own depth runs as a turn's, so a depth and a turn leaving together decay in step.
|
|
30
|
+
*/
|
|
31
|
+
// #887 (ADR-0073, *Amendment (#887)*, Q10): core's `byKey` knows core's transforms; the DOM's own take a
|
|
32
|
+
// twin's, the same object. #1002 (*Amendment (#1002)*, Q3): the six core named until then.
|
|
33
|
+
const RUNS_AS: ReadonlyMap<string, string> = new Map([
|
|
34
|
+
["translateX", "x"],
|
|
35
|
+
["translateY", "y"],
|
|
36
|
+
["translateZ", "z"],
|
|
37
|
+
["rotate", "rotateZ"],
|
|
38
|
+
["skewX", "rotateZ"],
|
|
39
|
+
["skewY", "rotateZ"],
|
|
40
|
+
[TransformKeys.PERSPECTIVE, "rotateY"],
|
|
41
|
+
])
|
|
42
|
+
|
|
24
43
|
/** The transition `key` runs on toward `target` when its own isn't defined, in the DOM: Motion's. */
|
|
25
|
-
|
|
44
|
+
// Per key per Retarget: statements (docs/agents/effect-first.md, the hot path).
|
|
45
|
+
export const transitionFor = (key: string, target: number | string): DefaultTransition.Transition => {
|
|
46
|
+
const twin = RUNS_AS.get(key)
|
|
47
|
+
if (Predicate.isUndefined(twin)) return DefaultTransition.byKey(key, target)
|
|
48
|
+
return DefaultTransition.byKey(twin, target)
|
|
49
|
+
}
|
|
26
50
|
|
|
27
51
|
/** The DOM Environment's `DefaultTransition.DefaultTransition`. */
|
|
28
|
-
export const DefaultTransitionDomLive: Layer.Layer<DefaultTransition.DefaultTransition> = DefaultTransition.
|
|
52
|
+
export const DefaultTransitionDomLive: Layer.Layer<DefaultTransition.DefaultTransition> = /*#__PURE__*/ Layer.succeed(DefaultTransition.DefaultTransition, { transitionFor, keyframes })
|