@wardic/dom 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/Appear.d.ts +3 -2
  2. package/dist/Appear.d.ts.map +1 -1
  3. package/dist/Appear.js +4 -3
  4. package/dist/Appear.js.map +1 -1
  5. package/dist/FlushGate.d.ts.map +1 -1
  6. package/dist/FlushGate.js +4 -3
  7. package/dist/FlushGate.js.map +1 -1
  8. package/dist/TimelineValue.d.ts +18 -0
  9. package/dist/TimelineValue.d.ts.map +1 -0
  10. package/dist/TimelineValue.js +20 -0
  11. package/dist/TimelineValue.js.map +1 -0
  12. package/dist/index.d.ts +13 -5
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +10 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/internal/appear.d.ts +10 -4
  17. package/dist/internal/appear.d.ts.map +1 -1
  18. package/dist/internal/appear.js +18 -8
  19. package/dist/internal/appear.js.map +1 -1
  20. package/dist/internal/drag-defaults.js +4 -1
  21. package/dist/internal/drag-defaults.js.map +1 -1
  22. package/dist/internal/gate.d.ts +11 -0
  23. package/dist/internal/gate.d.ts.map +1 -1
  24. package/dist/internal/gate.js +114 -2
  25. package/dist/internal/gate.js.map +1 -1
  26. package/dist/internal/projection.d.ts.map +1 -1
  27. package/dist/internal/projection.js +8 -7
  28. package/dist/internal/projection.js.map +1 -1
  29. package/dist/internal/renderer.d.ts +13 -0
  30. package/dist/internal/renderer.d.ts.map +1 -1
  31. package/dist/internal/renderer.js +21 -0
  32. package/dist/internal/renderer.js.map +1 -1
  33. package/dist/internal/runner.d.ts +4 -3
  34. package/dist/internal/runner.d.ts.map +1 -1
  35. package/dist/internal/runner.js +19 -5
  36. package/dist/internal/runner.js.map +1 -1
  37. package/dist/internal/scroll.d.ts +17 -0
  38. package/dist/internal/scroll.d.ts.map +1 -1
  39. package/dist/internal/scroll.js +23 -15
  40. package/dist/internal/scroll.js.map +1 -1
  41. package/dist/internal/timeline.d.ts +56 -0
  42. package/dist/internal/timeline.d.ts.map +1 -0
  43. package/dist/internal/timeline.js +389 -0
  44. package/dist/internal/timeline.js.map +1 -0
  45. package/package.json +3 -3
  46. package/src/Appear.ts +4 -2
  47. package/src/FlushGate.ts +4 -3
  48. package/src/TimelineValue.ts +19 -0
  49. package/src/index.ts +15 -5
  50. package/src/internal/appear.ts +20 -8
  51. package/src/internal/drag-defaults.ts +4 -4
  52. package/src/internal/gate.ts +110 -2
  53. package/src/internal/projection.ts +8 -7
  54. package/src/internal/renderer.ts +22 -0
  55. package/src/internal/runner.ts +20 -6
  56. package/src/internal/scroll.ts +32 -15
  57. package/src/internal/timeline.ts +480 -0
@@ -0,0 +1,389 @@
1
+ import * as LiveValue from "@wardic/core/LiveValue";
2
+ import * as Projection from "@wardic/core/Projection";
3
+ import * as Arr from "effect/Array";
4
+ import * as Bool from "effect/Boolean";
5
+ import * as Effect from "effect/Effect";
6
+ import { constant, constTrue } from "effect/Function";
7
+ import * as Num from "effect/Number";
8
+ import * as Option from "effect/Option";
9
+ import * as Order from "effect/Order";
10
+ import * as Predicate from "effect/Predicate";
11
+ import * as Rec from "effect/Record";
12
+ import * as Str from "effect/String";
13
+ import * as UndefinedOr from "effect/UndefinedOr";
14
+ import { addsToTransform, project, transformFunctionOf } from "./renderer.js";
15
+ import { clientLengthOf, isHTMLElement, offsetOf, pageOf, positionOf, resolvesOn } from "./scroll.js";
16
+ /** The points sampled inside each eased stretch, so the browser blends only between near neighbours. */
17
+ const SAMPLES = 64;
18
+ /** How far a keyframe segment's middle may sit off its ends' blend: a share of that number's range across the keyframes. */
19
+ const MIDDLE_TOLERANCE = 1e-3;
20
+ /** What a middle may sit off its ends' blend where its number doesn't change: floating point's rounding. */
21
+ const ROUNDING = 1e-9;
22
+ /**
23
+ * The properties a Timeline value draws, as the gate's patch names them, each to its keyframe name, and
24
+ * the CSS functions a value of it may hold: those CSS blends argument by argument, as the registry
25
+ * blends numbers. Not `matrix()`, `matrix3d()`, `rotate3d()` or `perspective()`, which CSS blends by
26
+ * decomposing; not `drop-shadow()`, whose colour CSS blends premultiplied.
27
+ */
28
+ const PROPERTIES = {
29
+ opacity: { name: "opacity", functions: new Set() },
30
+ transform: {
31
+ name: "transform",
32
+ functions: new Set(["translate", "translateX", "translateY", "translateZ", "translate3d", "scale", "scaleX", "scaleY", "scaleZ", "scale3d", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY"]),
33
+ },
34
+ filter: { name: "filter", functions: new Set(["blur", "brightness", "contrast", "grayscale", "hue-rotate", "invert", "opacity", "saturate", "sepia"]) },
35
+ clipPath: { name: "clipPath", functions: new Set(["inset", "circle", "ellipse", "polygon"]) },
36
+ "clip-path": { name: "clipPath", functions: new Set(["inset", "circle", "ellipse", "polygon"]) },
37
+ };
38
+ /** A number in a CSS value, for its shape. */
39
+ const NUMBER = /-?\d*\.?\d+(?:e[+-]?\d+)?/gi;
40
+ /** A CSS function's name in a value. */
41
+ const FUNCTION = /([a-z][a-z0-9-]*)\(/gi;
42
+ // Module state (#460, Q7): a cache keyed by what it caches, held weakly. One `ScrollTimeline` a
43
+ // container and an axis, shared by every value on it, as Motion's `get-timeline.ts`.
44
+ const scrollTimelines = new WeakMap();
45
+ // Module state (#460, Q7): a cache keyed by what it caches, held weakly. One `ViewTimeline` a target and
46
+ // an axis: its scroller is the target's own.
47
+ const viewTimelines = new WeakMap();
48
+ /** `cache`'s native timeline for `element` on `axis`, made by `make` the first time. */
49
+ const cachedTimeline = (cache, element, axis, make) => {
50
+ const byAxis = UndefinedOr.match(cache.get(element), {
51
+ onDefined: (known) => known,
52
+ onUndefined: () => {
53
+ const made = {};
54
+ cache.set(element, made);
55
+ return made;
56
+ },
57
+ });
58
+ return UndefinedOr.match(byAxis[axis], {
59
+ onDefined: (known) => known,
60
+ onUndefined: () => {
61
+ const made = make();
62
+ byAxis[axis] = made;
63
+ return made;
64
+ },
65
+ });
66
+ };
67
+ const scrollTimelineOf = (container, axis) => cachedTimeline(scrollTimelines, container, axis, () => new ScrollTimeline({ source: container, axis }));
68
+ // `inset: 0px`: the range is the scrollport's, as Wardic measures it, whatever the container's `scroll-padding`.
69
+ const viewTimelineOf = (target, axis) => cachedTimeline(viewTimelines, target, axis, () => new ViewTimeline({ subject: target, axis, inset: "0px" }));
70
+ /** Whether the browser has the native timeline a source needs: a `ViewTimeline` for a target, a `ScrollTimeline` for the rest. */
71
+ const supports = (name) => Predicate.hasProperty(globalThis, name);
72
+ /** Whether the browser runs an animation over a range of its native timeline (`rangeStart`, `rangeEnd`), not the whole of it. */
73
+ const supportsRanges = () => Predicate.hasProperty(Animation.prototype, "rangeStart");
74
+ /**
75
+ * A stop's {@link Intersection}: its position is linear in the target's and the container's lengths, so
76
+ * probing it gives them (Motion's `toIntersection`). `None` in a viewport unit, which can resolve to 0px.
77
+ */
78
+ const intersectionOf = (stop) => Bool.match(Str.includes("v")(String(stop)), {
79
+ onTrue: () => Option.none(),
80
+ onFalse: () => {
81
+ const px = positionOf(stop, 0, 0, 0);
82
+ return Option.some([positionOf(stop, 0, 1, 0) - px, px - positionOf(stop, 1, 0, 0), px]);
83
+ },
84
+ });
85
+ /** A stop's named range offset: a target fraction crossing the container's end (`entry-crossing`) or start (`exit-crossing`), with no px. */
86
+ const crossingOf = ([t, c, px]) => Bool.match(Bool.and(px === 0, Bool.or(c === 0, c === 1)), {
87
+ onTrue: () => Option.some(`${Bool.match(c === 1, { onTrue: () => "entry", onFalse: () => "exit" })}-crossing ${t * 100}%`),
88
+ onFalse: () => Option.none(),
89
+ });
90
+ /**
91
+ * An offset's `ViewTimeline` range (Motion 14's `offsetToViewTimelineRange`): its two stops' named
92
+ * offsets, and `a`, `b`, with which it runs forwards while `a × target length + b × container length`
93
+ * isn't below 0. `None` for any other offset.
94
+ */
95
+ const rangeOfOffset = (offset) => {
96
+ if (offset.length !== 2)
97
+ return Option.none();
98
+ return Option.flatMap(Option.all([intersectionOf(offset[0]), intersectionOf(offset[1])]), ([start, end]) => Option.flatMap(Option.all([crossingOf(start), crossingOf(end)]), (points) => {
99
+ const a = end[0] - start[0];
100
+ const b = start[1] - end[1];
101
+ return Bool.match(Bool.or(a !== 0, b !== 0), { onTrue: () => Option.some({ points, a, b }), onFalse: () => Option.none() });
102
+ }));
103
+ };
104
+ /**
105
+ * Whether a target's `ViewTimeline` measures it as Wardic does: neither fixed nor sticky, with no
106
+ * border or scrollbar on `axis` (a `ViewTimeline` measures the border box, Wardic the client size),
107
+ * its timeline's scroller the container. Read once, as it's made: a target that changes after reads as
108
+ * it was.
109
+ */
110
+ const measuresAsWardic = (target, container, axis) => {
111
+ const position = getComputedStyle(target).position;
112
+ if (Bool.or(position === "fixed", position === "sticky"))
113
+ return false;
114
+ const outer = Bool.match(axis === "y", { onTrue: () => target.offsetHeight, onFalse: () => target.offsetWidth });
115
+ if (outer !== clientLengthOf(target, axis))
116
+ return false;
117
+ // Made here, and kept for its start: a target's one `ViewTimeline` an axis.
118
+ return viewTimelineOf(target, axis).source === container;
119
+ };
120
+ /** The plan for a value read through a target's offset on its own axis: a `ViewTimeline`, where one measures it as Wardic does. */
121
+ const viewPlanOf = (scroll, container, axis) => {
122
+ // Each check reads what the one before allows: no native timeline is made in a browser with none.
123
+ const subject = Option.filter(Option.fromUndefinedOr(scroll.target), isHTMLElement);
124
+ if (Option.isNone(subject))
125
+ return Option.none();
126
+ const target = subject.value;
127
+ if (Bool.not(supports("ViewTimeline")))
128
+ return Option.none();
129
+ if (Bool.not(supportsRanges()))
130
+ return Option.none();
131
+ const range = rangeOfOffset(offsetOf(scroll));
132
+ if (Option.isNone(range))
133
+ return Option.none();
134
+ if (Bool.not(measuresAsWardic(target, container, axis)))
135
+ return Option.none();
136
+ const { points, a, b } = range.value;
137
+ // Its direction depends on the sizes only where a and b pull apart (Motion's `All`, a target shorter
138
+ // or longer than the container); `Any`'s never changes.
139
+ const flips = a * b < 0;
140
+ return Option.some({
141
+ from: 0,
142
+ to: 1,
143
+ nativeTimeline: () => viewTimelineOf(target, axis),
144
+ range: Option.some(points),
145
+ reversed: () => a * clientLengthOf(target, axis) + b * clientLengthOf(container, axis) < 0,
146
+ watch: Bool.match(flips, { onTrue: () => [target, container], onFalse: () => [] }),
147
+ watchesWindow: Bool.and(flips, container === pageOf()),
148
+ });
149
+ };
150
+ const FORWARDS = constant(false);
151
+ /** A `ScrollTimeline` plan over `from` to `to`, on `range`, where the browser has what it needs. */
152
+ const scrollPlanOf = (container, axis, from, to, range) => {
153
+ if (Bool.not(supports("ScrollTimeline")))
154
+ return Option.none();
155
+ if (Bool.and(Option.isSome(range), Bool.not(supportsRanges())))
156
+ return Option.none();
157
+ return Option.some({ from, to, nativeTimeline: () => scrollTimelineOf(container, axis), range, reversed: FORWARDS, watch: [], watchesWindow: false });
158
+ };
159
+ /** Where `derivation`'s keyframes run, over `stops` (its transform's input), or `None` where no native timeline can run it. */
160
+ const planOf = (derivation, stops) => {
161
+ const { scroll, read, axis } = derivation;
162
+ const container = UndefinedOr.match(scroll.container, { onUndefined: pageOf, onDefined: (given) => given });
163
+ if (read === "current") {
164
+ // How far it's scrolled, through a transform: a px range over the stops, from the scroll's start.
165
+ if (Arr.isReadonlyArrayEmpty(stops))
166
+ return Option.none();
167
+ const from = Math.max(0, Math.min(...stops));
168
+ const to = Math.max(...stops);
169
+ if (to <= from)
170
+ return Option.none();
171
+ return scrollPlanOf(container, axis, from, to, Option.some([`${from}px`, `${to}px`]));
172
+ }
173
+ // A progress through offsets on its own axis needs a target; else it's the container's plain progress.
174
+ return Bool.match(resolvesOn(scroll, axis), {
175
+ onTrue: () => viewPlanOf(scroll, container, axis),
176
+ onFalse: () => scrollPlanOf(container, axis, 0, 1, Option.none()),
177
+ });
178
+ };
179
+ /** Whether `input` only rises or only falls, two stops or more. */
180
+ const isMonotonic = (input) => {
181
+ if (input.length < 2)
182
+ return false;
183
+ const steps = Arr.zipWith(input, Arr.drop(input, 1), (a, b) => b - a);
184
+ if (Arr.every(steps, Num.isGreaterThan(0)))
185
+ return true;
186
+ return Arr.every(steps, Num.isLessThan(0));
187
+ };
188
+ /** Whether a native timeline can hold `step`: it clamps, the registry blends its outputs, numbers or strings, one a stop, and its input only rises or only falls. */
189
+ const isRunnable = (step) => {
190
+ if (Bool.or(Bool.not(step.clamp), step.mixed))
191
+ return false;
192
+ if (step.input.length !== step.output.length)
193
+ return false;
194
+ if (Bool.not(Arr.every(step.output, Predicate.or(Predicate.isNumber, Predicate.isString))))
195
+ return false;
196
+ return isMonotonic(step.input);
197
+ };
198
+ const ITSELF = { stops: [], eased: false, at: (v) => v };
199
+ /** `derivation`'s value at each point it reads: the source itself, or its one transform, which the registry blends. `None` for a chain, or a transform a native timeline can't hold. */
200
+ const valueOfDerivation = Effect.fnUntraced(function* (derivation) {
201
+ const { transforms, read } = derivation;
202
+ if (transforms.length === 0) {
203
+ // A scroll distance itself grows with the content: only its progress, 0 to 1, runs on its own.
204
+ if (read === "current")
205
+ return Option.none();
206
+ return Option.some(ITSELF);
207
+ }
208
+ if (transforms.length > 1)
209
+ return Option.none();
210
+ const step = transforms[0];
211
+ if (Bool.not(isRunnable(step)))
212
+ return Option.none();
213
+ const options = Option.match(step.ease, { onNone: () => ({}), onSome: (ease) => ({ ease }) });
214
+ const at = yield* LiveValue.interpolate(step.input, step.output, options);
215
+ return Option.some({ stops: step.input, eased: Option.isSome(step.ease), at });
216
+ });
217
+ /** The points a value's keyframes sit at: the domain's ends, each stop inside it, and through each eased stretch, {@link SAMPLES} more. */
218
+ const pointsOf = (plan, { stops, eased }) => {
219
+ const sorted = Arr.sort(stops, Order.Number);
220
+ const inner = Bool.match(eased, {
221
+ onTrue: () => Arr.flatMap(Arr.zip(sorted, Arr.drop(sorted, 1)), ([a, b]) => Arr.makeBy(SAMPLES, (k) => a + ((b - a) * (k + 1)) / (SAMPLES + 1))),
222
+ onFalse: () => [],
223
+ });
224
+ return Arr.dedupe(Arr.sort(Arr.filter([plan.from, plan.to, ...sorted, ...inner], Num.between({ minimum: plan.from, maximum: plan.to })), Order.Number));
225
+ };
226
+ /** A value's shape: what's left with its numbers taken out. */
227
+ const shapeOf = (css) => String(css).replace(NUMBER, "#");
228
+ /** A value's numbers, in order. */
229
+ const numbersOf = (css) => Arr.map(Arr.fromIterable(String(css).matchAll(NUMBER)), (m) => Number(m[0]));
230
+ /** Whether every CSS function in `css` is one `functions` holds. */
231
+ const holdsOnly = (functions, css) => Arr.every(Arr.fromIterable(String(css).matchAll(FUNCTION)), (m) => functions.has(m[1]));
232
+ /**
233
+ * `key`'s value `v` as a keyframe draws it: its property and its CSS. A transform key as its own
234
+ * function (`translateX(0px)`, never `none`), anything else as the gate projects it. `None` for a
235
+ * property a Timeline value doesn't draw.
236
+ */
237
+ const drawnOf = (key, v) => Option.match(transformFunctionOf(key, v), {
238
+ onSome: (css) => Option.some(["transform", css]),
239
+ onNone: () => {
240
+ const patch = project({ [key]: v });
241
+ const properties = Rec.keys(patch);
242
+ if (properties.length !== 1)
243
+ return Option.none();
244
+ const property = properties[0];
245
+ return Option.map(Rec.get(PROPERTIES, property), () => [property, patch[property]]);
246
+ },
247
+ });
248
+ /**
249
+ * Whether the browser, blending each pair of neighbouring keyframes, draws what Wardic does between
250
+ * them: every value holds only the functions CSS blends argument by argument for its property; Wardic's
251
+ * own value halfway is the same shape as its ends; and each of its numbers is the ends' average, within
252
+ * {@link MIDDLE_TOLERANCE} of that number's range. A blend the registry makes otherwise (a switch between
253
+ * `0px` and `50%`) or a curve too sharp for the samples (an elastic) fails it.
254
+ */
255
+ const blendsAsWardic = (functions, values, middles) => {
256
+ const all = [...values, ...middles];
257
+ if (Bool.not(Arr.every(all, (css) => holdsOnly(functions, css))))
258
+ return false;
259
+ const shape = shapeOf(values[0]);
260
+ if (Bool.not(Arr.every(all, (css) => shapeOf(css) === shape)))
261
+ return false;
262
+ const numbers = Arr.map(values, numbersOf);
263
+ const spans = Arr.map(numbers[0], (_, k) => {
264
+ const column = Arr.map(numbers, (ns) => ns[k]);
265
+ return Math.max(...column) - Math.min(...column);
266
+ });
267
+ return Arr.every(middles, (middle, i) => Arr.every(numbersOf(middle), (n, k) => Math.abs(n - (numbers[i][k] + numbers[i + 1][k]) / 2) <= MIDDLE_TOLERANCE * spans[k] + ROUNDING));
268
+ };
269
+ /**
270
+ * The keyframes for `key`: Wardic's value at each point, as {@link drawnOf} draws it, and the property
271
+ * they draw. `None` when the values draw more than one property, or one a Timeline value doesn't draw,
272
+ * or when the browser's blend between them isn't Wardic's ({@link blendsAsWardic}).
273
+ */
274
+ const keyframesOf = (key, plan, points, at) => Option.flatMap(Option.all(Arr.map(points, (p) => drawnOf(key, at(p)))), (drawn) => {
275
+ const properties = Arr.dedupe(Arr.map(drawn, ([property]) => property));
276
+ if (properties.length !== 1)
277
+ return Option.none();
278
+ const property = PROPERTIES[properties[0]];
279
+ const values = Arr.map(drawn, ([, css]) => css);
280
+ const middles = Option.all(Arr.map(Arr.zip(points, Arr.drop(points, 1)), ([a, b]) => drawnOf(key, at((a + b) / 2))));
281
+ if (Option.isNone(middles))
282
+ return Option.none();
283
+ if (Bool.not(Arr.every(middles.value, ([middle]) => PROPERTIES[middle] === property)))
284
+ return Option.none();
285
+ if (Bool.not(blendsAsWardic(property.functions, values, Arr.map(middles.value, ([, css]) => css))))
286
+ return Option.none();
287
+ const keyframes = Arr.map(points, (p, i) => ({ offset: (p - plan.from) / (plan.to - plan.from), [property.name]: values[i] }));
288
+ return Option.some({ property: property.name, keyframes });
289
+ });
290
+ /** Whether nothing but `key` adds to `transform` among `values`. Per flush: statements. */
291
+ const transformAloneOf = (key) => (values) => {
292
+ for (const other in values) {
293
+ if (other !== key && addsToTransform(other, values[other]))
294
+ return false;
295
+ }
296
+ return true;
297
+ };
298
+ /** Whether no projection draws the element: its Crossfade's opacity is the projection's. Per flush. */
299
+ const noProjection = (values) => !Object.hasOwn(values, Projection.KEY);
300
+ /** Whether nothing but `key` adds to `property` among `values`, by property: the rest have no other writer. Chosen once a value. */
301
+ const ALONE = {
302
+ transform: transformAloneOf,
303
+ opacity: constant(noProjection),
304
+ };
305
+ const aloneOf = (property, key) => Option.match(Rec.get(ALONE, property), { onNone: () => constTrue, onSome: (alone) => alone(key) });
306
+ /**
307
+ * A Timeline value for `key` on `element`, as `derivation` derives it from a scroll: its native
308
+ * animation, started by its first `sync`. `None` where it can't run on a native timeline as Wardic draws
309
+ * it (above): a browser with no scroll timelines or ranges, an element that isn't an HTML element, a key,
310
+ * a source or a derivation it doesn't take.
311
+ */
312
+ export const make = Effect.fnUntraced(function* (derivation, element, key) {
313
+ if (Bool.not(isHTMLElement(element)))
314
+ return Option.none();
315
+ const value = yield* valueOfDerivation(derivation);
316
+ if (Option.isNone(value))
317
+ return Option.none();
318
+ const plan = planOf(derivation, value.value.stops);
319
+ if (Option.isNone(plan))
320
+ return Option.none();
321
+ const drawn = keyframesOf(key, plan.value, pointsOf(plan.value, value.value), value.value.at);
322
+ if (Option.isNone(drawn))
323
+ return Option.none();
324
+ return Option.some(timelineValueOf(element, key, plan.value, drawn.value.keyframes, aloneOf(drawn.value.property, key)));
325
+ });
326
+ /** The Timeline value itself: its animation, started and stopped by `sync`, started again the other way where its direction flips. */
327
+ const timelineValueOf = (element, key, plan, keyframes, alone) => {
328
+ let animation;
329
+ let reversed = false;
330
+ let sizes;
331
+ const animate = () => {
332
+ reversed = plan.reversed();
333
+ const options = {
334
+ timeline: plan.nativeTimeline(),
335
+ fill: "both",
336
+ direction: Bool.match(reversed, { onTrue: () => "reverse", onFalse: () => "normal" }),
337
+ };
338
+ // Reversed, its range runs from the second stop to the first, with progress played backwards (Motion's).
339
+ if (Option.isSome(plan.range)) {
340
+ const [start, end] = plan.range.value;
341
+ options.rangeStart = Bool.match(reversed, { onTrue: () => end, onFalse: () => start });
342
+ options.rangeEnd = Bool.match(reversed, { onTrue: () => start, onFalse: () => end });
343
+ }
344
+ animation = element.animate(keyframes, options);
345
+ };
346
+ /** A resize that flips its direction starts it again, the other way. */
347
+ const recheck = () => {
348
+ if (Predicate.isUndefined(animation))
349
+ return;
350
+ if (plan.reversed() === reversed)
351
+ return;
352
+ animation.cancel();
353
+ animate();
354
+ };
355
+ const start = () => {
356
+ animate();
357
+ if (plan.watchesWindow)
358
+ window.addEventListener("resize", recheck);
359
+ if (Arr.isReadonlyArrayEmpty(plan.watch))
360
+ return;
361
+ const watch = new ResizeObserver(recheck);
362
+ Arr.forEach(plan.watch, (box) => watch.observe(box));
363
+ sizes = watch;
364
+ };
365
+ const cancel = () => {
366
+ if (Predicate.isNotUndefined(sizes))
367
+ sizes.disconnect();
368
+ sizes = undefined;
369
+ if (plan.watchesWindow)
370
+ window.removeEventListener("resize", recheck);
371
+ if (Predicate.isNotUndefined(animation))
372
+ animation.cancel();
373
+ animation = undefined;
374
+ };
375
+ return {
376
+ key,
377
+ sync: (values) => {
378
+ if (alone(values)) {
379
+ if (Predicate.isUndefined(animation))
380
+ start();
381
+ return;
382
+ }
383
+ if (Predicate.isNotUndefined(animation))
384
+ cancel();
385
+ },
386
+ cancel,
387
+ };
388
+ };
389
+ //# sourceMappingURL=timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/internal/timeline.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAA;AAErD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OA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MAAM,GAAG,GAAS,EAAE;QACxB,IAAI,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC;YAAE,KAAK,CAAC,UAAU,EAAE,CAAA;QACvD,KAAK,GAAG,SAAS,CAAA;QACjB,IAAI,IAAI,CAAC,aAAa;YAAE,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACrE,IAAI,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC;YAAE,SAAS,CAAC,MAAM,EAAE,CAAA;QAC3D,SAAS,GAAG,SAAS,CAAA;IACvB,CAAC,CAAA;IACD,OAAO;QACL,GAAG;QACH,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;YACf,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClB,IAAI,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC;oBAAE,KAAK,EAAE,CAAA;gBAC7C,OAAM;YACR,CAAC;YACD,IAAI,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC;gBAAE,MAAM,EAAE,CAAA;QACnD,CAAC;QACD,MAAM;KACP,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wardic/dom",
3
- "version": "1.0.0",
3
+ "version": "1.1.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,13 +55,13 @@
55
55
  "typecheck:tests": "../../node_modules/typescript-7/bin/tsc -p tsconfig.test.json"
56
56
  },
57
57
  "dependencies": {
58
- "@wardic/core": "1.0.0",
58
+ "@wardic/core": "1.1.0",
59
59
  "culori": "^4.0.2"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "effect": "^4.1.4"
63
63
  },
64
64
  "devDependencies": {
65
- "@wardic/test": "1.0.0"
65
+ "@wardic/test": "1.1.0"
66
66
  }
67
67
  }
package/src/Appear.ts CHANGED
@@ -8,7 +8,8 @@
8
8
  * timing is defined.
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
- * first frame.
11
+ * first frame. Elements that hydrate together read their page once, with `findAll`, and each looks its
12
+ * own up in that read with `findIn`.
12
13
  * - **A Batch's members** (#706): `batchKeyframes` samples one rule for every member on one set of
13
14
  * transitions, each member's own values read from custom properties; a sheet's `batch` gives them one
14
15
  * slot, and each member its style. At the Handoff, `findAll` reads every member's animation in one call,
@@ -25,7 +26,7 @@
25
26
  * // At mount:
26
27
  * const elapsed = Option.map(Appear.find(element), Appear.elapsedOf)
27
28
  */
28
- // #48, ADR-0044: the **Handoff**. `@wardic/dom/Appear` (ADR-0041).
29
+ // #48, ADR-0044: the **Handoff**. `@wardic/dom/Appear` (ADR-0041). One read a page for a hydration's elements: #724.
29
30
  export {
30
31
  adoptChunks,
31
32
  animationOf,
@@ -39,6 +40,7 @@ export {
39
40
  elapsedOf,
40
41
  find,
41
42
  findAll,
43
+ findIn,
42
44
  keyframes,
43
45
  type Keyframes,
44
46
  matches,
package/src/FlushGate.ts CHANGED
@@ -60,7 +60,7 @@ export const layer = (options: Options): Layer.Layer<FlushGate, never, Services>
60
60
  const noop = (): void => {}
61
61
 
62
62
  /** What `inert`'s `valueOf` gives: an Atom that stays `undefined`, since nothing is committed on a server. */
63
- const NO_VALUE: Atom.Atom<unknown> = Atom.make<unknown>(undefined)
63
+ const NO_VALUE: Atom.Atom<unknown> = /*#__PURE__*/ Atom.make<unknown>(undefined)
64
64
 
65
65
  /**
66
66
  * The gate a server render gets: it flushes nothing, so `register` returns an unregister that does
@@ -68,14 +68,15 @@ const NO_VALUE: Atom.Atom<unknown> = Atom.make<unknown>(undefined)
68
68
  * at setup and uses it after mount keeps working on a server.
69
69
  */
70
70
  // ADR-0021, decision 9.
71
- export const inert: Shape = Object.freeze({
71
+ export const inert: Shape = /*#__PURE__*/ Object.freeze({
72
72
  register: () => noop,
73
73
  write: noop,
74
74
  flushPass: noop,
75
75
  release: noop,
76
76
  valueOf: () => NO_VALUE,
77
77
  afterFlush: noop,
78
+ timeline: noop,
78
79
  })
79
80
 
80
81
  /** `inert` as a Layer, for a binding whose server render runs an Effect program. */
81
- export const layerInert: Layer.Layer<FlushGate> = Layer.succeed(FlushGate, inert)
82
+ export const layerInert: Layer.Layer<FlushGate> = /*#__PURE__*/ Layer.succeed(FlushGate, inert)
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Timeline values: a Live value derived from a container's scroll by ranges alone, which the
3
+ * browser draws with the scroll itself, on a native `ScrollTimeline` or `ViewTimeline`, so it doesn't
4
+ * trail a scroll the browser runs off the main thread. The gate goes on writing the key: the animation
5
+ * draws over it, and where the timeline can't (a container that doesn't overflow) the gate's value shows.
6
+ *
7
+ * A binding makes one for a key whose Live value core describes (`LiveValue.scrollDerivationOf`), and
8
+ * hands it to the gate while the key shows it (`FlushGate`'s `timeline`). It's built only where it draws
9
+ * what the gate would: `make` gives `None` for anything else, which the gate draws as ever.
10
+ *
11
+ * @example
12
+ * import * as TimelineValue from "@wardic/dom/TimelineValue"
13
+ *
14
+ * const derivation = Option.getOrThrow(LiveValue.scrollDerivationOf(opacity))
15
+ * const timeline = yield* TimelineValue.make(derivation, element, "opacity")
16
+ */
17
+ // `@wardic/dom/TimelineValue` (ADR-0041's names; CONTEXT.md's **Timeline value**), #240, ADR-0043
18
+ // *Amendment (#240)*. Only the `scroll` Feature's code imports it.
19
+ export { make, type TimelineValue } from "./internal/timeline.ts"
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * binding authors, Wardic's own and any other, and it's Effect-typed.
4
4
  *
5
5
  * - **An app** imports {@link DomLive}, the composed Environment it hands its binding,
6
- * {@link CheckFrames}, to check its Frames in development, and {@link FrameLoopMetrics}, to record the
7
- * Frame loop's metrics.
6
+ * {@link CheckFrames}, to check its Frames in development, {@link FrameLoopMetrics}, to record the
7
+ * Frame loop's metrics, and {@link WardicSpans}, to open Wardic's spans.
8
8
  * - **A binding** imports each module by its subpath, as a namespace
9
9
  * (`import * as FlushGate from "@wardic/dom/FlushGate"`), and the root re-exports each one:
10
10
  * - the DOM's implementations of core's services, each with its `layer` (Effect's platform
@@ -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
- * `KeyboardPress` and `Report`.
15
+ * `ReorderController`, `Style`, `Svg`, `Color`, `Variables`, `ScrollOffset`, `TimelineValue`,
16
+ * `Appear`, `OwnValues`, `KeyboardPress` and `Report`.
17
17
  *
18
18
  * Everything under `internal/` is dom's own and not exported.
19
19
  */
@@ -38,7 +38,7 @@ import * as DomPositionalKeys from "./DomPositionalKeys.ts"
38
38
  import * as DomProbe from "./DomProbe.ts"
39
39
  import * as DomRenderer from "./DomRenderer.ts"
40
40
 
41
- export const VERSION = "1.0.0"
41
+ export const VERSION = "1.1.0"
42
42
 
43
43
  export * as DomBatch from "./DomBatch.ts"
44
44
  export * as DomClock from "./DomClock.ts"
@@ -60,6 +60,7 @@ export * as Svg from "./Svg.ts"
60
60
  export * as Color from "./Color.ts"
61
61
  export * as Variables from "./Variables.ts"
62
62
  export * as ScrollOffset from "./ScrollOffset.ts"
63
+ export * as TimelineValue from "./TimelineValue.ts"
63
64
  export * as Appear from "./Appear.ts"
64
65
  export * as OwnValues from "./OwnValues.ts"
65
66
  export * as KeyboardPress from "./KeyboardPress.ts"
@@ -84,6 +85,15 @@ export { CheckFrames } from "@wardic/core/FrameLoop"
84
85
  // #518, ADR-0067 *Amendment (#518)*, decision 2: opt-in, re-exported here for an app, as `CheckFrames` is.
85
86
  export { layerMetrics as FrameLoopMetrics } from "@wardic/core/FrameLoop"
86
87
 
88
+ /**
89
+ * Core's spans (`Spans.layer`), here for an app. Merged beside {@link DomLive} with a tracer installed
90
+ * (the devtools', an OpenTelemetry exporter's), each animation, burst of frames, gesture and layout
91
+ * pass opens its span. Without it, Wardic opens none, and an app ships none of their code: see
92
+ * https://wardic.dev/guides/observability.
93
+ */
94
+ // #746, ADR-0067 *Amendment (#746)*, decision 8: opt-in, as `FrameLoopMetrics` is.
95
+ export { layer as WardicSpans } from "@wardic/core/Spans"
96
+
87
97
  /**
88
98
  * The browser Environment, composed: the DOM's services, core's interpolators with the DOM's Key
89
99
  * rules, and the Frame loop over the DOM's Clock, needing nothing else. Hand it to `WardicProvider`'s
@@ -1093,21 +1093,33 @@ export const find = (element: Element): Option.Option<Animation> =>
1093
1093
  })
1094
1094
 
1095
1095
  /**
1096
- * A document's Appear animations by element, running or finished and filling: one `getAnimations()` for
1097
- * the page, for a Handoff of many elements at once, a Batch's members (#706). Each element's first: a
1098
- * member's Batch rule, or the one `find` gets.
1096
+ * A page's Appear animations by element, running or finished and filling: one `getAnimations()` for every
1097
+ * element on it, for a Handoff of many elements at once. Each element's first: a member's Batch rule, or
1098
+ * the one `find` gets. The page is a document, or a shadow root: a document's read doesn't reach into its
1099
+ * shadow trees, so an element there is in its own root's (`element.getRootNode()`).
1099
1100
  */
1100
- // #706, Q3: measured at a Batch's 1,000 members in one list, Chromium's `Element.getAnimations()` cost
1101
- // about a whole document's each (5.6 s for every member; the document's, 5.6 ms); Firefox's, alike either way.
1102
- export const findAll = (doc: Document): ReadonlyMap<Element, Animation> => {
1101
+ // #706 Q3, #724: Chromium's `Element.getAnimations()` costs about a whole document's read each (1,000 Appear
1102
+ // elements in one parent: 5.4 s for all of them, the document's 15 ms). Firefox's and WebKit's are cheaper
1103
+ // than their document's (6.8 against 8.4 ms, 12 against 16), so they pay a little more for one read.
1104
+ export const findAll = (root: Document | ShadowRoot): ReadonlyMap<Element, Animation> => {
1103
1105
  const byElement = new Map<Element, Animation>()
1104
- if (Bool.not(Predicate.hasProperty(doc, "getAnimations"))) return byElement
1106
+ if (Bool.not(Predicate.hasProperty(root, "getAnimations"))) return byElement
1105
1107
  // Once a Handoff, over the page's animations: the first per element, as `find`'s.
1106
- Arr.forEach(Arr.filter(doc.getAnimations(), isAppearAnimation), (animation) =>
1108
+ Arr.forEach(Arr.filter(root.getAnimations(), isAppearAnimation), (animation) =>
1107
1109
  Option.map(Option.filter(targetOf(animation), (target) => Bool.not(byElement.has(target))), (target) => byElement.set(target, animation)))
1108
1110
  return byElement
1109
1111
  }
1110
1112
 
1113
+ /**
1114
+ * The element's own Appear animation in a page's read (`findAll`'s): the one `find` gets, with no read of
1115
+ * its own. A Batch's rule on a member's element isn't one.
1116
+ */
1117
+ // #724: the element Handoff's lookup, every element hydrating in a pass from one read of its page. An
1118
+ // element runs one Appear animation at most, its inline slot's (a member's Batch rule vetoes its own, #706),
1119
+ // so `findAll`'s first is the one `find` would get.
1120
+ export const findIn = (animations: ReadonlyMap<Element, Animation>, element: Element): Option.Option<Animation> =>
1121
+ Option.filter(Option.fromUndefinedOr(animations.get(element)), isElementAppearAnimation)
1122
+
1111
1123
  /** Whether `animation` is `spec`'s: the rule the server sampled from the same spec. */
1112
1124
  export const matches = (animation: Animation, spec: Pick<Spec, "key" | "tag" | "infinite" | "projected">): boolean =>
1113
1125
  Option.exists(nameOfAnimation(animation), (name) => name === nameOf(spec))
@@ -44,10 +44,10 @@ export const dragDefaultStyle: (axis: boolean | "x" | "y") => DragDefaultStyle =
44
44
  * row vertical panning, and a grid none.
45
45
  */
46
46
  // A **Reorder group**.
47
- export const reorderTouchAction: (axis: "x" | "y" | "xy") => string = Match.type<"x" | "y" | "xy">().pipe(
48
- Match.when("y", () => "pan-x"),
49
- Match.when("x", () => "pan-y"),
50
- Match.orElse(() => "none"),
47
+ export const reorderTouchAction: (axis: "x" | "y" | "xy") => string = /*#__PURE__*/ Match.type<"x" | "y" | "xy">().pipe(
48
+ /*#__PURE__*/ Match.when("y", () => "pan-x"),
49
+ /*#__PURE__*/ Match.when("x", () => "pan-y"),
50
+ /*#__PURE__*/ Match.orElse(() => "none"),
51
51
  )
52
52
 
53
53
  /** The attribute every drag element gets: no native drag of the element or its content. */