kuinetic 0.3.0 → 0.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/README.md +2 -2
- package/dist/esm/{chunk-7NW4OLOC.mjs → chunk-CG37RODK.mjs} +906 -428
- package/dist/esm/{chunk-DAVDOYOS.mjs → chunk-W7U4A2NK.mjs} +625 -124
- package/dist/esm/{chunk-4QKMEDM4.mjs → chunk-Y2FP56K5.mjs} +2501 -1694
- package/dist/esm/core/index.mjs +2 -2
- package/dist/esm/effects/index.mjs +2 -2
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/notes/index.mjs +75 -8
- package/dist/kuinetic.all.js +3977 -2221
- package/dist/kuinetic.all.min.js +4 -2
- package/dist/kuinetic.css +1248 -46
- package/dist/kuinetic.js +3976 -2220
- package/dist/kuinetic.min.css +1 -1
- package/dist/kuinetic.min.js +3 -1
- package/dist/kuinetic.notes.js +1 -1
- package/dist/types/core/animator.d.ts +61 -2
- package/dist/types/core/attrs.d.ts +0 -2
- package/dist/types/core/auto-motion.d.ts +139 -0
- package/dist/types/core/cadence.d.ts +90 -0
- package/dist/types/core/channels.d.ts +4 -0
- package/dist/types/core/compile.d.ts +14 -2
- package/dist/types/core/deck-viewer.d.ts +2 -0
- package/dist/types/core/declarations.d.ts +6 -0
- package/dist/types/core/derived/group-gate.d.ts +18 -4
- package/dist/types/core/describe.d.ts +1 -1
- package/dist/types/core/element-config.d.ts +3 -4
- package/dist/types/core/instances.d.ts +27 -3
- package/dist/types/core/params.d.ts +1 -2
- package/dist/types/core/parse.d.ts +20 -1
- package/dist/types/core/pause-scope.d.ts +40 -0
- package/dist/types/core/play.d.ts +2 -2
- package/dist/types/core/registry.d.ts +16 -1
- package/dist/types/core/repeat.d.ts +6 -4
- package/dist/types/core/sequence.d.ts +10 -0
- package/dist/types/core/stagger-config.d.ts +23 -101
- package/dist/types/core/stagger-keys.d.ts +2 -4
- package/dist/types/core/stagger.d.ts +12 -21
- package/dist/types/core/types.d.ts +65 -18
- package/dist/types/effects/auto-motion.d.ts +20 -123
- package/dist/types/effects/carousel/deck.d.ts +5 -0
- package/dist/types/effects/carousel/drag.d.ts +5 -0
- package/dist/types/effects/carousel/row-copies.d.ts +3 -0
- package/dist/types/effects/carousel/shape-fit.d.ts +8 -0
- package/dist/types/effects/catalog/feedback.d.ts +1 -1
- package/dist/types/effects/catalog/media-shared.d.ts +10 -0
- package/dist/types/effects/catalog/pause-scope.d.ts +20 -0
- package/dist/types/effects/catalog/text-shared.d.ts +4 -0
- package/dist/types/effects/scroll-mechanics/snap-autoplay.d.ts +20 -0
- package/dist/types/effects/step-index.d.ts +19 -1
- package/dist/types/effects/svg/morph-loop.d.ts +2 -0
- package/dist/types/effects/tween/waypoints.d.ts +1 -1
- package/dist/types/showcase/media-source.d.ts +1 -0
- package/dist/types/showcase/youtube.d.ts +3 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
BREAKPOINT_NAMES,
|
|
5
5
|
EASING_KEYWORDS,
|
|
6
6
|
KUI_EVENT,
|
|
7
|
+
MIN_PERIOD_MS,
|
|
7
8
|
Registry,
|
|
8
9
|
SEGMENT_HOIST_KEYS,
|
|
9
10
|
applyStagger,
|
|
@@ -11,8 +12,10 @@ import {
|
|
|
11
12
|
assignOnce,
|
|
12
13
|
breakpointsIn,
|
|
13
14
|
claimTargetGroupHost,
|
|
15
|
+
clampPeriod,
|
|
14
16
|
control,
|
|
15
17
|
createActivationBinder,
|
|
18
|
+
createAutoMotion,
|
|
16
19
|
createCssInstance,
|
|
17
20
|
createGateWatcher,
|
|
18
21
|
createRootResolver,
|
|
@@ -27,9 +30,11 @@ import {
|
|
|
27
30
|
gatedAnimationName,
|
|
28
31
|
gatesOverlap,
|
|
29
32
|
indexTargetGroup,
|
|
33
|
+
isGroupOnly,
|
|
30
34
|
isGroupedKeys,
|
|
31
35
|
isInfiniteRepeat,
|
|
32
36
|
isOneShot,
|
|
37
|
+
isSafeCssValue,
|
|
33
38
|
parse,
|
|
34
39
|
parseActivationAttribute,
|
|
35
40
|
parseToggleActions,
|
|
@@ -39,13 +44,16 @@ import {
|
|
|
39
44
|
readEffectParams,
|
|
40
45
|
readEffectTiming,
|
|
41
46
|
releaseStagger,
|
|
47
|
+
releaseStaggerGroup,
|
|
42
48
|
repeatCount,
|
|
49
|
+
repeatedInstance,
|
|
43
50
|
resolveActivationSpec,
|
|
44
51
|
resolveParams,
|
|
45
52
|
resolvePlayback,
|
|
46
53
|
restageAfterRemoval,
|
|
47
54
|
restageAround,
|
|
48
55
|
selectorBreadth,
|
|
56
|
+
splitTopLevel,
|
|
49
57
|
staggerKeysFor,
|
|
50
58
|
startKindOf,
|
|
51
59
|
suggest,
|
|
@@ -55,19 +63,22 @@ import {
|
|
|
55
63
|
validate,
|
|
56
64
|
warnAboutActivation,
|
|
57
65
|
warnAboutToggleActions
|
|
58
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-CG37RODK.mjs";
|
|
59
67
|
import {
|
|
60
68
|
createLedgerSet
|
|
61
69
|
} from "./chunk-EDFJTT5B.mjs";
|
|
62
70
|
|
|
63
71
|
// src/core/bundles.ts
|
|
64
|
-
var HOIST_KEYS = ["activation", "timeline", "threshold", "rm", "func"];
|
|
72
|
+
var HOIST_KEYS = ["activation", "via", "timeline", "range", "threshold", "rm", "func", "every"];
|
|
65
73
|
var HOIST_LABELS = {
|
|
66
74
|
activation: "on",
|
|
75
|
+
via: "via",
|
|
67
76
|
timeline: "timeline",
|
|
77
|
+
range: "range",
|
|
68
78
|
threshold: "threshold",
|
|
69
79
|
rm: "rm",
|
|
70
|
-
func: "func"
|
|
80
|
+
func: "func",
|
|
81
|
+
every: "every"
|
|
71
82
|
};
|
|
72
83
|
var BundleTable = class {
|
|
73
84
|
/**
|
|
@@ -255,8 +266,11 @@ function overlay(member, ref) {
|
|
|
255
266
|
delay: ref.delay ?? member.delay,
|
|
256
267
|
easing: ref.easing ?? member.easing,
|
|
257
268
|
at: ref.at ?? member.at,
|
|
269
|
+
split: ref.split ?? member.split,
|
|
270
|
+
rows: ref.rows ?? member.rows,
|
|
258
271
|
gate: ref.gate ?? member.gate,
|
|
259
272
|
repeat: ref.repeat ?? member.repeat,
|
|
273
|
+
repeatDelay: ref.repeatDelay ?? member.repeatDelay,
|
|
260
274
|
yoyo: ref.yoyo ?? member.yoyo,
|
|
261
275
|
params: { ...member.params, ...ref.params },
|
|
262
276
|
hoists: overlayHoists(member.hoists, ref.hoists)
|
|
@@ -303,46 +317,6 @@ function resolveGlobalFunction(el, name) {
|
|
|
303
317
|
return typeof candidate === "function" ? candidate : void 0;
|
|
304
318
|
}
|
|
305
319
|
|
|
306
|
-
// src/core/capabilities.ts
|
|
307
|
-
function supports(property, value) {
|
|
308
|
-
if (typeof CSS === "undefined" || typeof CSS.supports !== "function") return false;
|
|
309
|
-
try {
|
|
310
|
-
return CSS.supports(property, value);
|
|
311
|
-
} catch {
|
|
312
|
-
return false;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
var cached;
|
|
316
|
-
function detect(force = false) {
|
|
317
|
-
if (cached && !force) return cached;
|
|
318
|
-
cached = {
|
|
319
|
-
viewTimeline: supports("animation-timeline", "view()"),
|
|
320
|
-
scrollTimeline: supports("animation-timeline", "scroll()"),
|
|
321
|
-
animationRange: supports("animation-range", "entry 0% cover 30%"),
|
|
322
|
-
// `translate`/`rotate`/`scale` as independent properties is what makes the channel model
|
|
323
|
-
// possible at all — under the `transform` shorthand every effect would collide.
|
|
324
|
-
individualTransforms: supports("translate", "0 10px") && supports("scale", "1.1"),
|
|
325
|
-
scrollTimelineName: supports("scroll-timeline-name", "--x"),
|
|
326
|
-
viewTransitions: typeof document !== "undefined" && "startViewTransition" in document,
|
|
327
|
-
intersectionObserver: typeof IntersectionObserver !== "undefined",
|
|
328
|
-
reducedMotion: typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
329
|
-
motionPath: supports("offset-path", 'path("M 0 0")')
|
|
330
|
-
};
|
|
331
|
-
return cached;
|
|
332
|
-
}
|
|
333
|
-
var CHANNEL_REQUIREMENTS = [
|
|
334
|
-
{
|
|
335
|
-
channel: "offset",
|
|
336
|
-
capability: "motionPath",
|
|
337
|
-
message: "this browser does not support CSS Motion Path (offset-path), so the element will not travel \u2014 the animation still runs and completes, it just has no path to follow"
|
|
338
|
-
}
|
|
339
|
-
];
|
|
340
|
-
function unsupportedChannelWarnings(channels, capabilities) {
|
|
341
|
-
return CHANNEL_REQUIREMENTS.filter(
|
|
342
|
-
(entry) => channels.includes(entry.channel) && !capabilities[entry.capability]
|
|
343
|
-
).map((entry) => entry.message);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
320
|
// src/core/channels.ts
|
|
347
321
|
var INDEPENDENT_PHASES = /* @__PURE__ */ new Set(["entrance|state", "exit|state"]);
|
|
348
322
|
function phasePair(a, b) {
|
|
@@ -358,8 +332,11 @@ var CHANNEL_COMPOSITION = {
|
|
|
358
332
|
function additiveChannels(channels) {
|
|
359
333
|
return channels.length > 0 && channels.every((channel) => CHANNEL_COMPOSITION[channel] === "add");
|
|
360
334
|
}
|
|
335
|
+
function claimsOverlap(a, b) {
|
|
336
|
+
return gatesOverlap(a.gate, b.gate) && !independentPhases(a, b) && !a.follows?.has(b) && !b.follows?.has(a);
|
|
337
|
+
}
|
|
361
338
|
function contestsChannel(a, b, contested) {
|
|
362
|
-
return
|
|
339
|
+
return claimsOverlap(a, b) && a.channels.some((channel) => contested.has(channel) && b.channels.includes(channel));
|
|
363
340
|
}
|
|
364
341
|
function additiveResolution(claims, conflicts) {
|
|
365
342
|
if (conflicts.some((conflict) => conflict.effects[0] === conflict.effects[1])) return void 0;
|
|
@@ -383,7 +360,7 @@ function findConflicts(claims) {
|
|
|
383
360
|
// Same effect name twice in one list claims the channel against itself; still a conflict,
|
|
384
361
|
// and a more likely author typo than a deliberate choice. Phase cannot exempt that pair
|
|
385
362
|
// either, because a phase is only ever independent of a *different* one.
|
|
386
|
-
(other) =>
|
|
363
|
+
(other) => claimsOverlap(other, claim)
|
|
387
364
|
);
|
|
388
365
|
if (clash) conflicts.push({ channel, effects: [clash.name, claim.name] });
|
|
389
366
|
claimants.push(claim);
|
|
@@ -449,6 +426,43 @@ function refusalReason(value) {
|
|
|
449
426
|
}
|
|
450
427
|
return `at:"${value}" is not a position \u2014 expected at:with, at:after, or a signed time such as at:-200ms, at:+100ms or at:with+150ms`;
|
|
451
428
|
}
|
|
429
|
+
function startsAfter(earlier, later) {
|
|
430
|
+
const { member } = earlier;
|
|
431
|
+
if (isInfiniteRepeat(member.repeat)) return false;
|
|
432
|
+
if (earlier.stagger !== later.stagger) {
|
|
433
|
+
const first = timeMs(earlier.stagger ?? "");
|
|
434
|
+
const second = timeMs(later.stagger ?? "");
|
|
435
|
+
if (first === void 0 || second === void 0 || second < first) return false;
|
|
436
|
+
}
|
|
437
|
+
const duration = durationExpression(member.duration, member.primitiveId);
|
|
438
|
+
const end = `${earlier.step.delayExpr} + ${playbackExpression(duration, member.repeat, member.repeatDelay)}`;
|
|
439
|
+
const vars = /* @__PURE__ */ new Map();
|
|
440
|
+
const lowerBound = accumulateTime(later.step.delayExpr, 1, vars) + accumulateTime(end, -1, vars);
|
|
441
|
+
return lowerBound >= 0 && [...vars].every(
|
|
442
|
+
([term, weight]) => weight === 0 || weight > 0 && term.startsWith("var(") && term.includes("-duration,")
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
function accumulateTime(expression, direction, vars) {
|
|
446
|
+
const parts = splitTopLevel(expression, " ");
|
|
447
|
+
let total = 0;
|
|
448
|
+
for (let i = 0, sign = direction; i < parts.length; ) {
|
|
449
|
+
const term = parts[i++];
|
|
450
|
+
if (term === "+" || term === "-") {
|
|
451
|
+
sign = direction * Number(`${term}1`);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
const multiplied = parts[i] === "*";
|
|
455
|
+
const weight = multiplied ? sign * Number(parts[i + 1]) : sign;
|
|
456
|
+
i += 2 * Number(multiplied);
|
|
457
|
+
const ms = timeMs(term);
|
|
458
|
+
if (ms !== void 0) {
|
|
459
|
+
total += weight * ms;
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
vars.set(term, (vars.get(term) ?? 0) + weight);
|
|
463
|
+
}
|
|
464
|
+
return total;
|
|
465
|
+
}
|
|
452
466
|
function resolveSequence(members, timeline, warn) {
|
|
453
467
|
const chain = { members, steps: [], warn };
|
|
454
468
|
let warnedAboutTimeline = false;
|
|
@@ -522,11 +536,13 @@ function follow(chain, index, position, own) {
|
|
|
522
536
|
}
|
|
523
537
|
const played = playbackExpression(
|
|
524
538
|
durationExpression(previous.duration, previous.primitiveId),
|
|
525
|
-
previous.repeat
|
|
539
|
+
previous.repeat,
|
|
540
|
+
previous.repeatDelay
|
|
526
541
|
);
|
|
542
|
+
const count = repeatCount(previous.repeat) ?? 1;
|
|
527
543
|
return {
|
|
528
544
|
delayExpr: `${anchor.delayExpr} + ${played}${position.term}`,
|
|
529
|
-
delayMs: anchor.delayMs + durationMs * (
|
|
545
|
+
delayMs: anchor.delayMs + durationMs * count + (previous.repeatDelay ?? 0) * (count - 1) + position.offsetMs,
|
|
530
546
|
sequenced: true
|
|
531
547
|
};
|
|
532
548
|
}
|
|
@@ -547,7 +563,7 @@ function refuseEndless(chain, index, own) {
|
|
|
547
563
|
return own;
|
|
548
564
|
}
|
|
549
565
|
function timelineRefusal(timeline) {
|
|
550
|
-
return `at: compiles to an animation-delay, and a "${timeline}" timeline is driven by scroll position rather than a clock, so it ignores one \u2014 position a scroll-driven effect with
|
|
566
|
+
return `at: compiles to an animation-delay, and a "${timeline}" timeline is driven by scroll position rather than a clock, so it ignores one \u2014 position a scroll-driven effect with timeline:${timeline} range:'${timeline === "scroll" ? "0% 100%" : "entry 0% cover 60%"}'. The delay still applies where the browser has no scroll-driven animations and the effect degrades to a clock.`;
|
|
551
567
|
}
|
|
552
568
|
function timeMs(value) {
|
|
553
569
|
const ms = toMilliseconds(value, Number.NaN);
|
|
@@ -565,8 +581,10 @@ function emptyTracks() {
|
|
|
565
581
|
durations: [],
|
|
566
582
|
delays: [],
|
|
567
583
|
ends: [],
|
|
584
|
+
staggerSpans: [],
|
|
568
585
|
easings: [],
|
|
569
586
|
iterationCounts: [],
|
|
587
|
+
fillModes: [],
|
|
570
588
|
directions: [],
|
|
571
589
|
compositions: []
|
|
572
590
|
};
|
|
@@ -575,31 +593,43 @@ function keyframesFor(entry) {
|
|
|
575
593
|
const { preset } = entry.resolved;
|
|
576
594
|
return entry.variant?.keyframes ?? [preset.keyframes ?? `kui-${preset.name}`];
|
|
577
595
|
}
|
|
578
|
-
function
|
|
579
|
-
return
|
|
596
|
+
function iterationsFor(entry) {
|
|
597
|
+
return entry.spec.repeat ?? (entry.handoffEnd ? "1" : `var(--kui-fx-${entry.resolved.preset.name}-iterations, 1)`);
|
|
580
598
|
}
|
|
581
599
|
function pushTrack(tracks, entry, step) {
|
|
582
600
|
const { spec, resolved } = entry;
|
|
583
601
|
const id = resolved.primitive.id;
|
|
584
602
|
const duration = durationExpression(spec.duration, id);
|
|
585
|
-
const delay = staggerDelay(step.delayExpr);
|
|
586
|
-
const
|
|
603
|
+
const delay = staggerDelay(step.delayExpr, entry.stagger);
|
|
604
|
+
const staggerSpan = entry.stagger === void 0 ? FLAT_SPAN : `(var(--kui-stagger-count, 1) - 1) * (${entry.stagger})`;
|
|
605
|
+
const end = `${step.delayExpr} + ${playbackExpression(duration, spec.repeat, spec.repeatDelay)}`;
|
|
587
606
|
const easing = easingValue(spec.easing, id);
|
|
588
|
-
const iterations =
|
|
607
|
+
const iterations = iterationsFor(entry);
|
|
589
608
|
const direction = directionValue(spec.yoyo);
|
|
590
609
|
const composition = entry.composite ?? "replace";
|
|
591
|
-
for (const name of keyframesFor(entry)) {
|
|
610
|
+
for (const [index, name] of keyframesFor(entry).entries()) {
|
|
611
|
+
if (spec.repeatDelay) {
|
|
612
|
+
tracks.repeatDelays ??= /* @__PURE__ */ new Map();
|
|
613
|
+
tracks.repeatDelays.set(tracks.names.length, spec.repeatDelay);
|
|
614
|
+
}
|
|
592
615
|
tracks.names.push(gatedAnimationName(name, spec.gate));
|
|
593
616
|
tracks.keyframes.push(name);
|
|
594
617
|
tracks.durations.push(duration);
|
|
595
618
|
tracks.delays.push(delay);
|
|
596
619
|
tracks.ends.push(end);
|
|
620
|
+
tracks.staggerSpans.push(staggerSpan);
|
|
597
621
|
tracks.easings.push(easing);
|
|
598
622
|
tracks.iterationCounts.push(iterations);
|
|
623
|
+
tracks.fillModes.push(fillFor(entry, index));
|
|
599
624
|
tracks.directions.push(direction);
|
|
600
625
|
tracks.compositions.push(composition);
|
|
601
626
|
}
|
|
602
627
|
}
|
|
628
|
+
function fillFor(entry, index) {
|
|
629
|
+
const channel = entry.variant?.channels?.[index];
|
|
630
|
+
const follows = channel === void 0 ? entry.handoff?.size : entry.handoff?.has(channel);
|
|
631
|
+
return follows ? "forwards" : "both";
|
|
632
|
+
}
|
|
603
633
|
function pushTransitions(segments, owners, entry, warnings) {
|
|
604
634
|
const { spec, resolved } = entry;
|
|
605
635
|
const { preset, primitive } = resolved;
|
|
@@ -626,7 +656,7 @@ function declarationsFor(tracks, timeline) {
|
|
|
626
656
|
"animation-delay": delays.join(", "),
|
|
627
657
|
"animation-timing-function": tracks.easings.join(", "),
|
|
628
658
|
"animation-iteration-count": tracks.iterationCounts.join(", "),
|
|
629
|
-
"animation-fill-mode": tracks.
|
|
659
|
+
"animation-fill-mode": tracks.fillModes.join(", ")
|
|
630
660
|
};
|
|
631
661
|
if (tracks.directions.some((value) => value !== "normal")) {
|
|
632
662
|
declarations["animation-direction"] = tracks.directions.join(", ");
|
|
@@ -636,16 +666,23 @@ function declarationsFor(tracks, timeline) {
|
|
|
636
666
|
}
|
|
637
667
|
return declarations;
|
|
638
668
|
}
|
|
639
|
-
|
|
640
|
-
|
|
669
|
+
var FLAT_STAGGER = "var(--kui-i, 0) * var(--kui-stagger, 0ms)";
|
|
670
|
+
var FLAT_SPAN = "(var(--kui-stagger-count, 1) - 1) * var(--kui-stagger, 0ms)";
|
|
671
|
+
function staggerDelay(base, step) {
|
|
672
|
+
const offset = step === void 0 ? FLAT_STAGGER : `var(--kui-i, 0) * (${step})`;
|
|
673
|
+
return `${base} + ${offset}`;
|
|
674
|
+
}
|
|
675
|
+
function withNestedStagger(delay) {
|
|
676
|
+
return delay.replaceAll(FLAT_STAGGER, `var(--kui-stagger-offset, ${FLAT_STAGGER})`).replaceAll(FLAT_SPAN, `var(--kui-stagger-span, ${FLAT_SPAN})`);
|
|
641
677
|
}
|
|
642
678
|
function wrapped(sum) {
|
|
643
679
|
return `calc(${sum})`;
|
|
644
680
|
}
|
|
645
681
|
function pinnedDelays(tracks) {
|
|
646
|
-
const
|
|
682
|
+
const sharedSpan = tracks.staggerSpans.every((span2) => span2 === tracks.staggerSpans[0]);
|
|
683
|
+
const ends = [...new Set(sharedSpan ? tracks.ends : tracks.ends.map((end, i) => `${end} + ${tracks.staggerSpans[i]}`))];
|
|
647
684
|
const span = ends.length === 1 ? ends[0] : `max(${ends.join(", ")})`;
|
|
648
|
-
const head = `${span} +
|
|
685
|
+
const head = sharedSpan ? `${span} + ${tracks.staggerSpans[0]}` : span;
|
|
649
686
|
return tracks.delays.map((delay) => wrapped(`${delay} - var(--kui-progress, 0) * (${head})`));
|
|
650
687
|
}
|
|
651
688
|
function easingValue(easing, primitiveId) {
|
|
@@ -659,12 +696,11 @@ function readAttributes(el) {
|
|
|
659
696
|
return {
|
|
660
697
|
source: el.getAttribute(ATTR.source) ?? "",
|
|
661
698
|
on: el.getAttribute(ATTR.on),
|
|
662
|
-
timeline: el.getAttribute(ATTR.timeline),
|
|
663
699
|
threshold: el.getAttribute(ATTR.threshold)
|
|
664
700
|
};
|
|
665
701
|
}
|
|
666
702
|
function resolveConfig(attributes, parsed) {
|
|
667
|
-
const rawTimeline = parsed.timeline ??
|
|
703
|
+
const rawTimeline = parsed.timeline ?? "time";
|
|
668
704
|
const [head = "time", ...rest] = rawTimeline.trim().split(/\s+/);
|
|
669
705
|
const longhand = parseActivationAttribute(attributes.on);
|
|
670
706
|
const authored = parsed.activation ?? longhand.activation;
|
|
@@ -678,15 +714,15 @@ function resolveConfig(attributes, parsed) {
|
|
|
678
714
|
// `actions:` refines `on:` and has only the inline spelling.
|
|
679
715
|
...parsed.actions === void 0 ? {} : { actions: parseToggleActions(parsed.actions) },
|
|
680
716
|
timeline: TIMELINES.has(head) ? head : "time",
|
|
681
|
-
...timelineOptions(rest),
|
|
717
|
+
...timelineOptions(rest, parsed.range),
|
|
682
718
|
threshold: parsed.threshold ?? attributes.threshold ?? "0%"
|
|
683
719
|
};
|
|
684
720
|
}
|
|
685
|
-
function timelineOptions(tokens) {
|
|
721
|
+
function timelineOptions(tokens, range) {
|
|
686
722
|
const timelineAxis = /^(block|inline|x|y)$/.test(tokens[0] ?? "") ? tokens.shift() : void 0;
|
|
687
723
|
const timelineName = /^--[\w-]+$/.test(tokens[0] ?? "") ? tokens.shift() : void 0;
|
|
688
724
|
return {
|
|
689
|
-
range: tokens.join(" "),
|
|
725
|
+
range: range ?? tokens.join(" "),
|
|
690
726
|
...timelineAxis ? { timelineAxis } : {},
|
|
691
727
|
...timelineName ? { timelineName } : {}
|
|
692
728
|
};
|
|
@@ -704,14 +740,16 @@ function resolveGroupConfig(base, hoists) {
|
|
|
704
740
|
activation: authored ?? base.activation,
|
|
705
741
|
activationAuthored: authored !== void 0 || base.activationAuthored
|
|
706
742
|
};
|
|
743
|
+
if (hoists.via !== void 0) config.activationSource = hoists.via;
|
|
707
744
|
if (hoists.actions !== void 0) config.actions = parseToggleActions(hoists.actions);
|
|
708
745
|
if (hoists.timeline !== void 0) {
|
|
709
|
-
const [head
|
|
746
|
+
const [head, ...rest] = hoists.timeline.trim().split(/\s+/);
|
|
710
747
|
config.timeline = TIMELINES.has(head) ? head : base.timeline;
|
|
711
748
|
delete config.timelineAxis;
|
|
712
749
|
delete config.timelineName;
|
|
713
750
|
Object.assign(config, timelineOptions(rest));
|
|
714
751
|
}
|
|
752
|
+
config.range = hoists.range ?? config.range;
|
|
715
753
|
if (hoists.threshold !== void 0) config.threshold = hoists.threshold;
|
|
716
754
|
return config;
|
|
717
755
|
}
|
|
@@ -719,6 +757,7 @@ function sourceFromLonghand({
|
|
|
719
757
|
parsed,
|
|
720
758
|
longhand
|
|
721
759
|
}) {
|
|
760
|
+
if (parsed.via !== void 0) return { activationSource: parsed.via };
|
|
722
761
|
if (parsed.activation !== void 0 || longhand.from === void 0) return {};
|
|
723
762
|
return { activationSource: longhand.from };
|
|
724
763
|
}
|
|
@@ -788,7 +827,8 @@ function schemaFor(entry) {
|
|
|
788
827
|
if (!extra) return entry.resolved.primitive.parameters;
|
|
789
828
|
return { ...entry.resolved.primitive.parameters, ...extra };
|
|
790
829
|
}
|
|
791
|
-
function compileTargets(parsed, registry, timeline) {
|
|
830
|
+
function compileTargets(parsed, registry, timeline, repeatDelaySupport = true) {
|
|
831
|
+
if (parsed.specs.some((spec) => spec.split !== void 0)) parsed = scopeHoists(parsed, registry);
|
|
792
832
|
const warnings = [...parsed.warnings];
|
|
793
833
|
const unquoted = findUnquotedSelectors(parsed.specs, registry);
|
|
794
834
|
for (const found of unquoted) warnings.push(unquotedSelectorWarning(found));
|
|
@@ -801,17 +841,30 @@ function compileTargets(parsed, registry, timeline) {
|
|
|
801
841
|
...suspects
|
|
802
842
|
};
|
|
803
843
|
}
|
|
804
|
-
const
|
|
805
|
-
(entry) =>
|
|
806
|
-
);
|
|
844
|
+
const scopedTimelines = new Map(entries.flatMap(
|
|
845
|
+
(entry) => entry.spec.hoists?.timeline === void 0 ? [] : [[groupKeyOf(entry), entry.spec.hoists.timeline]]
|
|
846
|
+
).reverse());
|
|
847
|
+
const sanitized = entries.map((entry) => refusePlayback(
|
|
848
|
+
refuseContainerGate(entry, warnings),
|
|
849
|
+
entry.spec.repeatDelay ? resolveTimelineHead(scopedTimelines.get(groupKeyOf(entry)), timeline) : timeline,
|
|
850
|
+
repeatDelaySupport,
|
|
851
|
+
warnings
|
|
852
|
+
));
|
|
807
853
|
const steps = resolveSequence(sanitized.map(memberFor), timeline, (m) => warnings.push(m));
|
|
808
854
|
const sequenced = sanitized.map((entry, index) => ({ ...entry, step: steps[index] }));
|
|
809
855
|
warnCrossGroupSequencing(sequenced, parsed.activation, warnings);
|
|
810
|
-
const targets = partitionByTarget(sequenced).map(({
|
|
856
|
+
const targets = partitionByTarget(sequenced).map(({ entries: group, ...identity }) => {
|
|
811
857
|
const groupWarnings = [];
|
|
812
|
-
|
|
858
|
+
if (identity.split || identity.selector) applyTrackStagger(group, parsed.spread);
|
|
813
859
|
const groupHoists = mergeGroupHoists(group, groupWarnings);
|
|
860
|
+
const [rows, ...conflicts] = new Set(group.flatMap(
|
|
861
|
+
({ spec }) => spec.split === "tiles" && spec.rows !== void 0 ? [spec.rows] : []
|
|
862
|
+
));
|
|
863
|
+
for (const conflict of conflicts) {
|
|
864
|
+
groupWarnings.push(`conflicting tile row counts "${rows}" and "${conflict}" in one split:tiles group \u2014 the first wins`);
|
|
865
|
+
}
|
|
814
866
|
const groupTimeline = resolveTimelineHead(groupHoists?.timeline, timeline);
|
|
867
|
+
const composed = resolveComposition(group, registry, groupWarnings, groupTimeline);
|
|
815
868
|
const plan = buildPlan(composed, groupTimeline, unknown, groupWarnings);
|
|
816
869
|
plan.defaultActivation = resolveDefaultActivation(
|
|
817
870
|
composed.map((entry) => ({
|
|
@@ -819,7 +872,8 @@ function compileTargets(parsed, registry, timeline) {
|
|
|
819
872
|
defaultActivation: entry.resolved.primitive.defaultActivation
|
|
820
873
|
}))
|
|
821
874
|
);
|
|
822
|
-
|
|
875
|
+
const tileFit = group.find((entry) => entry.tileFit)?.tileFit;
|
|
876
|
+
return { ...identity, ...rows === void 0 ? {} : { rows }, ...tileFit && { tileFit }, hoists: groupHoists, specs: group.map((entry) => entry.spec), plan };
|
|
823
877
|
});
|
|
824
878
|
mergeHostFacts(targets);
|
|
825
879
|
const reducedMotion = resolvedPolicy(targets[0].plan.reducedMotion, parsed.rm, warnings);
|
|
@@ -827,31 +881,42 @@ function compileTargets(parsed, registry, timeline) {
|
|
|
827
881
|
return { targets, warnings, ...suspects };
|
|
828
882
|
}
|
|
829
883
|
function scopeHoists(parsed, registry) {
|
|
830
|
-
|
|
884
|
+
const ignoreSplit = parsed.specs.some((spec) => spec.split !== void 0) && parsed.specs.some((spec) => Object.hasOwn(spec.params, "target"));
|
|
885
|
+
if (!ignoreSplit && !parsed.specs.some((spec) => spec.hoists)) return parsed;
|
|
831
886
|
const warnings = [...parsed.warnings];
|
|
887
|
+
if (ignoreSplit) warnings.push('cannot combine "split:" with "target:" on one element \u2014 ignoring "split:"');
|
|
832
888
|
const folded = { ...parsed, warnings };
|
|
833
889
|
const specs = parsed.specs.map((spec) => {
|
|
834
|
-
if (!
|
|
835
|
-
for (const key of SEGMENT_HOIST_KEYS) {
|
|
836
|
-
const value = spec.hoists[key];
|
|
837
|
-
if (value === void 0) continue;
|
|
838
|
-
assignOnce(folded, key, value, HOIST_LABELS2[key]);
|
|
839
|
-
}
|
|
890
|
+
if (!ignoreSplit && !spec.hoists) return spec;
|
|
840
891
|
const rest = { ...spec };
|
|
841
|
-
|
|
892
|
+
if (ignoreSplit) {
|
|
893
|
+
delete rest.split;
|
|
894
|
+
delete rest.rows;
|
|
895
|
+
}
|
|
896
|
+
if (rest.hoists && staysOnHost(rest, registry)) {
|
|
897
|
+
for (const key of SEGMENT_HOIST_KEYS) {
|
|
898
|
+
const value = rest.hoists[key];
|
|
899
|
+
if (value !== void 0) assignOnce(folded, key, value, HOIST_LABELS2[key]);
|
|
900
|
+
}
|
|
901
|
+
delete rest.hoists;
|
|
902
|
+
}
|
|
842
903
|
return rest;
|
|
843
904
|
});
|
|
844
905
|
return { ...folded, specs };
|
|
845
906
|
}
|
|
846
907
|
function staysOnHost(spec, registry) {
|
|
908
|
+
if (spec.split !== void 0) return false;
|
|
909
|
+
if (!spec.params.target) return true;
|
|
847
910
|
const resolved = registry.resolve(spec.name);
|
|
848
911
|
if (!resolved) return true;
|
|
849
912
|
return Object.hasOwn(resolved.primitive.parameters, "target");
|
|
850
913
|
}
|
|
851
914
|
var HOIST_LABELS2 = {
|
|
852
915
|
activation: "activations",
|
|
916
|
+
via: "activation sources",
|
|
853
917
|
actions: "crossing actions",
|
|
854
918
|
timeline: "timelines",
|
|
919
|
+
range: "ranges",
|
|
855
920
|
threshold: "thresholds",
|
|
856
921
|
cascade: "stagger steps",
|
|
857
922
|
spread: "stagger budgets",
|
|
@@ -859,21 +924,32 @@ var HOIST_LABELS2 = {
|
|
|
859
924
|
cols: "stagger column counts",
|
|
860
925
|
along: "stagger axes"
|
|
861
926
|
};
|
|
927
|
+
function applyTrackStagger(entries, fallbackSpread) {
|
|
928
|
+
if (entries.length < 2) return;
|
|
929
|
+
const spread = entries.map(({ spec }) => spec.hoists?.spread).find((value) => value !== void 0) ?? fallbackSpread;
|
|
930
|
+
if (spread !== void 0 && isSafeCssValue(spread)) return;
|
|
931
|
+
for (const entry of entries) {
|
|
932
|
+
const cascade = entry.spec.hoists?.cascade;
|
|
933
|
+
if (cascade !== void 0 && isSafeCssValue(cascade) && entry.resolved.primitive.renderer === "css-keyframes") {
|
|
934
|
+
entry.stagger = cascade;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
862
938
|
function mergeGroupHoists(entries, warnings) {
|
|
863
939
|
let merged;
|
|
864
940
|
for (const entry of entries) {
|
|
865
941
|
if (!entry.spec.hoists) continue;
|
|
866
|
-
merged = absorbGroupHoists(merged ?? {}, entry.spec.hoists, warnings);
|
|
942
|
+
merged = absorbGroupHoists(merged ?? {}, entry.spec.hoists, warnings, entry.stagger !== void 0);
|
|
867
943
|
}
|
|
868
944
|
return merged;
|
|
869
945
|
}
|
|
870
|
-
function absorbGroupHoists(merged, hoists, warnings) {
|
|
946
|
+
function absorbGroupHoists(merged, hoists, warnings, rendersCascade) {
|
|
871
947
|
for (const key of SEGMENT_HOIST_KEYS) {
|
|
872
948
|
const value = hoists[key];
|
|
873
949
|
if (value === void 0) continue;
|
|
874
950
|
const current = merged[key];
|
|
875
951
|
if (current === void 0) merged[key] = value;
|
|
876
|
-
else if (current !== value) {
|
|
952
|
+
else if (current !== value && (key !== "cascade" || !rendersCascade)) {
|
|
877
953
|
warnings.push(
|
|
878
954
|
`conflicting ${HOIST_LABELS2[key]} "${current}" and "${value}" in one target: group \u2014 the first wins`
|
|
879
955
|
);
|
|
@@ -896,6 +972,7 @@ function warnCrossGroupSequencing(sequenced, elementActivation, warnings) {
|
|
|
896
972
|
}
|
|
897
973
|
}
|
|
898
974
|
function groupKeyOf(entry) {
|
|
975
|
+
if (entry.spec.split !== void 0) return `split ${entry.spec.split}`;
|
|
899
976
|
return `${entry.scope ?? "self"} ${entry.target ?? ""}`;
|
|
900
977
|
}
|
|
901
978
|
function partitionByTarget(entries) {
|
|
@@ -904,16 +981,18 @@ function partitionByTarget(entries) {
|
|
|
904
981
|
for (const entry of entries) {
|
|
905
982
|
const selector = entry.target ?? "";
|
|
906
983
|
const scope = entry.scope ?? "self";
|
|
907
|
-
const key =
|
|
984
|
+
const key = groupKeyOf(entry);
|
|
908
985
|
let group = byKey.get(key);
|
|
909
986
|
if (!group) {
|
|
910
987
|
group = { selector, scope, entries: [] };
|
|
988
|
+
if (entry.spec.split !== void 0) group.split = entry.spec.split;
|
|
911
989
|
byKey.set(key, group);
|
|
912
990
|
order.push(group);
|
|
913
991
|
}
|
|
992
|
+
if (entry.mountTargets) group.mountTargets ??= entry.mountTargets;
|
|
914
993
|
group.entries.push(entry);
|
|
915
994
|
}
|
|
916
|
-
const hostIndex = order.findIndex((group) => group.selector === "");
|
|
995
|
+
const hostIndex = order.findIndex((group) => group.selector === "" && group.split === void 0);
|
|
917
996
|
if (hostIndex > 0) {
|
|
918
997
|
const [host] = order.splice(hostIndex, 1);
|
|
919
998
|
order.unshift(host);
|
|
@@ -939,6 +1018,7 @@ function emptyPlan(unknown, warnings) {
|
|
|
939
1018
|
function resolveEntries(specs, registry, warnings) {
|
|
940
1019
|
const entries = [];
|
|
941
1020
|
const unknown = [];
|
|
1021
|
+
let split;
|
|
942
1022
|
for (const spec of specs) {
|
|
943
1023
|
const resolved = registry.resolve(spec.name);
|
|
944
1024
|
if (!resolved) {
|
|
@@ -946,14 +1026,28 @@ function resolveEntries(specs, registry, warnings) {
|
|
|
946
1026
|
warnUnknownEffect(spec.name, registry, warnings);
|
|
947
1027
|
continue;
|
|
948
1028
|
}
|
|
1029
|
+
if (spec.split !== void 0) {
|
|
1030
|
+
split ??= spec.split;
|
|
1031
|
+
if (spec.split !== split) {
|
|
1032
|
+
warnings.push(`cannot combine "split:${split}" with "split:${spec.split}" \u2014 skipping "${spec.name}"`);
|
|
1033
|
+
continue;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
949
1036
|
entries.push(entryFor(spec, resolved, warnings));
|
|
950
1037
|
}
|
|
951
1038
|
return { entries, unknown };
|
|
952
1039
|
}
|
|
953
1040
|
function entryFor(spec, resolved, warnings) {
|
|
1041
|
+
const tileFit = spec.split === "tiles" && spec.params.fit === "stretch" ? "stretch" : void 0;
|
|
1042
|
+
if (tileFit) {
|
|
1043
|
+
spec = { ...spec, params: { ...spec.params } };
|
|
1044
|
+
delete spec.params.fit;
|
|
1045
|
+
}
|
|
954
1046
|
const lifted = liftTarget(spec, resolved, warnings);
|
|
955
1047
|
const variant = resolved.primitive.variantFor?.(lifted.spec, (m) => warnings.push(m));
|
|
956
1048
|
const entry = variant ? { spec: lifted.spec, resolved, variant } : { spec: lifted.spec, resolved };
|
|
1049
|
+
if (tileFit) entry.tileFit = tileFit;
|
|
1050
|
+
if (lifted.mountTargets) entry.mountTargets = lifted.mountTargets;
|
|
957
1051
|
if (lifted.target !== void 0) {
|
|
958
1052
|
entry.target = lifted.target;
|
|
959
1053
|
entry.scope = lifted.scope;
|
|
@@ -966,6 +1060,20 @@ function warnUnknownEffect(name, registry, warnings) {
|
|
|
966
1060
|
warnings.push(`unknown effect "${name}"${suffix}`);
|
|
967
1061
|
}
|
|
968
1062
|
function liftTarget(spec, resolved, warnings) {
|
|
1063
|
+
const generator = resolved.preset.generatedTargets;
|
|
1064
|
+
const values = spec.params.values;
|
|
1065
|
+
if (generator && values !== void 0) {
|
|
1066
|
+
const params = { ...spec.params };
|
|
1067
|
+
delete params.values;
|
|
1068
|
+
delete params.target;
|
|
1069
|
+
delete params.scope;
|
|
1070
|
+
return {
|
|
1071
|
+
spec: { ...spec, params, split: void 0 },
|
|
1072
|
+
target: generator.selector,
|
|
1073
|
+
scope: "self",
|
|
1074
|
+
mountTargets: (host, warn) => generator.mount(host, values, warn)
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
969
1077
|
if (Object.hasOwn(resolved.primitive.parameters, "target")) return { spec };
|
|
970
1078
|
const target = spec.params.target;
|
|
971
1079
|
if (!target) return { spec };
|
|
@@ -994,19 +1102,34 @@ function refuseContainerGate(entry, warnings) {
|
|
|
994
1102
|
const gate = above || below ? { above, below } : void 0;
|
|
995
1103
|
return { ...entry, spec: { ...spec, gate } };
|
|
996
1104
|
}
|
|
997
|
-
function
|
|
1105
|
+
function entryPolicy(entry) {
|
|
1106
|
+
const declared = entry.variant?.reducedMotion ?? entry.resolved.primitive.reducedMotion;
|
|
1107
|
+
return entry.spec.repeat === "infinite" ? strictestPolicy(declared, "disable") : declared;
|
|
1108
|
+
}
|
|
1109
|
+
function refusePlayback(entry, timeline, repeatDelaySupport, warnings) {
|
|
998
1110
|
const { spec, resolved } = entry;
|
|
999
|
-
if (spec.repeat === void 0 && spec.yoyo === void 0) return entry;
|
|
1111
|
+
if (spec.repeat === void 0 && spec.yoyo === void 0 && spec.repeatDelay === void 0) return entry;
|
|
1000
1112
|
const { repeat, yoyo, warnings: raised } = resolvePlayback({
|
|
1001
1113
|
name: resolved.preset.name,
|
|
1002
1114
|
renderer: resolved.primitive.renderer,
|
|
1003
1115
|
cloak: resolved.preset.cloak,
|
|
1004
1116
|
timeline,
|
|
1005
1117
|
repeat: spec.repeat,
|
|
1006
|
-
yoyo: spec.yoyo
|
|
1118
|
+
yoyo: spec.yoyo,
|
|
1119
|
+
repeatable: resolved.primitive.repeatable === true
|
|
1007
1120
|
});
|
|
1008
1121
|
warnings.push(...raised);
|
|
1009
|
-
return { ...entry, spec: { ...spec, repeat, yoyo } };
|
|
1122
|
+
if (!spec.repeatDelay) return { ...entry, spec: { ...spec, repeat, yoyo } };
|
|
1123
|
+
const count = Number(repeat);
|
|
1124
|
+
const wholeRepeat = repeat === "infinite" || Number.isInteger(count) && count > 1;
|
|
1125
|
+
const keyframeTrack = resolved.primitive.renderer === "css-keyframes" && entry.variant?.keyframes?.length !== 0;
|
|
1126
|
+
const eligible = timeline === "time" && wholeRepeat && keyframeTrack;
|
|
1127
|
+
const reason = eligible ? "this browser lacks the required animation timing support" : "it needs a time-driven CSS keyframe track with an explicit whole repeat count above one or repeat:infinite";
|
|
1128
|
+
if (!eligible || repeatDelaySupport === false) {
|
|
1129
|
+
warnings.push(`"${spec.name}" ignores repeat-delay: ${reason}`);
|
|
1130
|
+
}
|
|
1131
|
+
const repeatDelay = eligible && repeatDelaySupport === true ? spec.repeatDelay : void 0;
|
|
1132
|
+
return { ...entry, spec: { ...spec, repeat, yoyo, repeatDelay } };
|
|
1010
1133
|
}
|
|
1011
1134
|
function phaseOf(entry) {
|
|
1012
1135
|
if (entry.spec.repeat === "infinite") return "idle";
|
|
@@ -1020,7 +1143,7 @@ function additivelyComposable(entry) {
|
|
|
1020
1143
|
if (entry.variant?.keyframes) return false;
|
|
1021
1144
|
return additiveChannels(channelsFor(entry));
|
|
1022
1145
|
}
|
|
1023
|
-
function resolveComposition(entries, registry, warnings) {
|
|
1146
|
+
function resolveComposition(entries, registry, warnings, timeline) {
|
|
1024
1147
|
if (entries.length <= 1) return entries;
|
|
1025
1148
|
const claims = entries.map((e) => ({
|
|
1026
1149
|
name: e.spec.name,
|
|
@@ -1034,22 +1157,82 @@ function resolveComposition(entries, registry, warnings) {
|
|
|
1034
1157
|
// the tracks. Only the losing side of a delivery clobber has to say what it is.
|
|
1035
1158
|
inlineAnimation: e.resolved.primitive.renderer === "css-keyframes"
|
|
1036
1159
|
}));
|
|
1160
|
+
const shared = timeline === "time" ? resolveHandoffs(entries, claims) : [];
|
|
1037
1161
|
const conflicts = findConflicts(claims);
|
|
1038
|
-
const clobbers = deliveryClobbers(claims);
|
|
1039
|
-
if (conflicts.length === 0 && clobbers.length === 0) return entries;
|
|
1162
|
+
const clobbers = [...deliveryClobbers(claims), ...shared];
|
|
1163
|
+
if (conflicts.length === 0 && clobbers.length === 0) return orderHandoffs(entries, claims);
|
|
1040
1164
|
if (clobbers.length === 0) {
|
|
1041
1165
|
const additive = additiveResolution(claims, conflicts);
|
|
1042
|
-
if (additive) return entries.map((e, i) => additive.has(i) ? { ...e, composite: "add" } : e);
|
|
1166
|
+
if (additive) return orderHandoffs(entries.map((e, i) => additive.has(i) ? { ...e, composite: "add" } : e), claims);
|
|
1043
1167
|
}
|
|
1044
1168
|
const combo = registry.findCombo(entries.map((e) => e.spec.name));
|
|
1045
1169
|
const remedy = combo ? `Use the "${combo.preset.name}" effect instead.` : "Apply them to nested elements, or register a combined effect.";
|
|
1046
1170
|
const kept = entries[0].spec.name;
|
|
1047
1171
|
const dropped = entries.slice(1).map((entry) => `"${entry.spec.name}"`);
|
|
1048
1172
|
const loss = `Dropped ${dropped.join(", ")} \u2014 only "${kept}" will run.`;
|
|
1049
|
-
const diagnosis = [
|
|
1173
|
+
const diagnosis = [describeConflicts(conflicts), ...clobbers].filter(Boolean);
|
|
1050
1174
|
warnings.push(`cannot compose: ${diagnosis.join("; ")}. ${loss} ${remedy}`);
|
|
1051
1175
|
return [entries[0]];
|
|
1052
1176
|
}
|
|
1177
|
+
function resolveHandoffs(entries, claims) {
|
|
1178
|
+
const windows = entries.map((entry) => ({ step: entry.step, member: memberFor(entry), stagger: entry.stagger }));
|
|
1179
|
+
const shared = [];
|
|
1180
|
+
claims.forEach((claim, i) => {
|
|
1181
|
+
if (!claim.inlineAnimation) return;
|
|
1182
|
+
claims.slice(0, i).forEach((other, j) => {
|
|
1183
|
+
if (!other.inlineAnimation || !claimsOverlap(other, claim)) return;
|
|
1184
|
+
if (!other.channels.some((channel) => claim.channels.includes(channel))) return;
|
|
1185
|
+
const first = { entry: entries[j], claim: other, window: windows[j] };
|
|
1186
|
+
const second = { entry: entries[i], claim, window: windows[i] };
|
|
1187
|
+
const diagnosis = recordHandoff(first, second);
|
|
1188
|
+
if (diagnosis) shared.push(diagnosis);
|
|
1189
|
+
});
|
|
1190
|
+
});
|
|
1191
|
+
return shared;
|
|
1192
|
+
}
|
|
1193
|
+
function recordHandoff(first, second) {
|
|
1194
|
+
const forward = startsAfter(first.window, second.window);
|
|
1195
|
+
if (!forward && !startsAfter(second.window, first.window)) return;
|
|
1196
|
+
const before = forward ? first : second;
|
|
1197
|
+
const after = forward ? second : first;
|
|
1198
|
+
after.claim.follows ??= /* @__PURE__ */ new Set();
|
|
1199
|
+
after.claim.follows.add(before.claim);
|
|
1200
|
+
const earlier = keyframeInputs(before.entry);
|
|
1201
|
+
const later = keyframeInputs(after.entry);
|
|
1202
|
+
const clobbered = [...earlier].find(([key, value]) => later.has(key) && later.get(key) !== value);
|
|
1203
|
+
if (clobbered) return `"${first.claim.name}" and "${second.claim.name}" have disjoint playback but share the keyframe input ${clobbered[0]}`;
|
|
1204
|
+
}
|
|
1205
|
+
function keyframeInputs(entry) {
|
|
1206
|
+
const authored = authoredParams(entry);
|
|
1207
|
+
const isTween = entry.spec.name === "tween" || entry.spec.name === "tween-from";
|
|
1208
|
+
const schema = schemaFor(entry);
|
|
1209
|
+
const keys = isTween ? [.../* @__PURE__ */ new Set([...Object.keys(entry.variant?.schema ?? {}), ...Object.keys(authored)])] : Object.keys(schema);
|
|
1210
|
+
return new Map(keys.flatMap((key) => {
|
|
1211
|
+
const param = Object.hasOwn(schema, key) ? schema[key] : void 0;
|
|
1212
|
+
if (!param?.cssProperty) return [];
|
|
1213
|
+
const fallback = isTween ? "" : param.default;
|
|
1214
|
+
return [[param.cssProperty, authored[key] ?? entry.resolved.preset.params?.[key] ?? fallback]];
|
|
1215
|
+
}));
|
|
1216
|
+
}
|
|
1217
|
+
function orderHandoffs(entries, claims) {
|
|
1218
|
+
const remaining = new Map(claims.map((claim, i) => [claim, entries[i]]));
|
|
1219
|
+
const earlier = new Set(claims.flatMap((claim) => [...claim.follows ?? []]));
|
|
1220
|
+
if (earlier.size === 0) return entries;
|
|
1221
|
+
const ordered = [];
|
|
1222
|
+
for (const claim of claims) append(claim);
|
|
1223
|
+
return ordered;
|
|
1224
|
+
function append(claim) {
|
|
1225
|
+
const entry = remaining.get(claim);
|
|
1226
|
+
if (!entry) return;
|
|
1227
|
+
remaining.delete(claim);
|
|
1228
|
+
const handoff = /* @__PURE__ */ new Set();
|
|
1229
|
+
for (const previous of claim.follows ?? []) {
|
|
1230
|
+
append(previous);
|
|
1231
|
+
for (const channel of previous.channels) if (claim.channels.includes(channel)) handoff.add(channel);
|
|
1232
|
+
}
|
|
1233
|
+
ordered.push({ ...entry, handoff, handoffEnd: earlier.has(claim) });
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1053
1236
|
function buildPlan(entries, timeline, unknown, warnings) {
|
|
1054
1237
|
const plan = emptyPlan(unknown, warnings);
|
|
1055
1238
|
const tracks = emptyTracks();
|
|
@@ -1062,7 +1245,7 @@ function buildPlan(entries, timeline, unknown, warnings) {
|
|
|
1062
1245
|
const { preset, primitive } = entry.resolved;
|
|
1063
1246
|
const step = entry.step;
|
|
1064
1247
|
plan.fxNames.push(preset.name);
|
|
1065
|
-
plan.reducedMotion = strictestPolicy(plan.reducedMotion, entry
|
|
1248
|
+
plan.reducedMotion = strictestPolicy(plan.reducedMotion, entryPolicy(entry));
|
|
1066
1249
|
activations = intersect(activations, primitive.supportedActivations);
|
|
1067
1250
|
plan.activationClaims.push({
|
|
1068
1251
|
supported: primitive.supportedActivations,
|
|
@@ -1081,6 +1264,7 @@ function buildPlan(entries, timeline, unknown, warnings) {
|
|
|
1081
1264
|
}
|
|
1082
1265
|
Object.assign(plan.declarations, declarationsFor(tracks, timeline));
|
|
1083
1266
|
plan.keyframeNames = tracks.keyframes;
|
|
1267
|
+
if (tracks.repeatDelays) plan.repeatDelays = tracks.repeatDelays;
|
|
1084
1268
|
if (transitionSegments.length > 0) plan.transition = transitionSegments.join(", ");
|
|
1085
1269
|
plan.supportedActivations = activations;
|
|
1086
1270
|
plan.supportedTimelines = timelines;
|
|
@@ -1099,7 +1283,8 @@ function memberFor(entry) {
|
|
|
1099
1283
|
duration: spec.duration,
|
|
1100
1284
|
cascadeDelay: cascadeValue(authored, preset, primitive.parameters, "delay"),
|
|
1101
1285
|
cascadeDuration: cascadeValue(authored, preset, primitive.parameters, "duration"),
|
|
1102
|
-
repeat: spec.repeat,
|
|
1286
|
+
repeat: spec.repeat ?? (primitive.renderer === "css-keyframes" && preset.phase === "idle" ? "infinite" : void 0),
|
|
1287
|
+
repeatDelay: spec.repeatDelay,
|
|
1103
1288
|
// A `css-keyframes` segment is always positionable — it compiles to an `animation-delay` and
|
|
1104
1289
|
// the browser honours it. A JavaScript-rendered one is positionable only if it declares the
|
|
1105
1290
|
// parameter, which is the single compile-time signal that it reads a delay at all.
|
|
@@ -1121,6 +1306,108 @@ function warnUnsupportedTimeline(name, supported, timeline, warnings) {
|
|
|
1121
1306
|
);
|
|
1122
1307
|
}
|
|
1123
1308
|
|
|
1309
|
+
// src/core/cadence.ts
|
|
1310
|
+
function createCadence(request) {
|
|
1311
|
+
const { el, periodMs, host, tick, warn } = request;
|
|
1312
|
+
const period = clampPeriod(periodMs);
|
|
1313
|
+
if (period === 0) {
|
|
1314
|
+
warn("every: needs a period above zero, such as every:3s; no cadence started");
|
|
1315
|
+
return { release() {
|
|
1316
|
+
} };
|
|
1317
|
+
}
|
|
1318
|
+
if (period !== periodMs) {
|
|
1319
|
+
warn(`every: minimum is ${MIN_PERIOD_MS / 1e3}s; clamped to ${period / 1e3}s`);
|
|
1320
|
+
}
|
|
1321
|
+
const motion = createAutoMotion({
|
|
1322
|
+
el,
|
|
1323
|
+
ctx: host,
|
|
1324
|
+
spinMs: 0,
|
|
1325
|
+
autoplayMs: period,
|
|
1326
|
+
settleMs: 0,
|
|
1327
|
+
pauseOnHover: false,
|
|
1328
|
+
step: () => tick(),
|
|
1329
|
+
onPausedChange: () => {
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
return { release: () => motion.release() };
|
|
1333
|
+
}
|
|
1334
|
+
function everyToMs(every) {
|
|
1335
|
+
const token = every.trim();
|
|
1336
|
+
const milliseconds = token.endsWith("ms");
|
|
1337
|
+
if (!milliseconds && !token.endsWith("s")) return Number.NaN;
|
|
1338
|
+
const value = Number(token.slice(0, milliseconds ? -2 : -1));
|
|
1339
|
+
return value * (milliseconds ? 1 : 1e3);
|
|
1340
|
+
}
|
|
1341
|
+
function cycleThunks(el, document2, warn) {
|
|
1342
|
+
const doc = el.ownerDocument;
|
|
1343
|
+
const ctx = { doc, win: doc.defaultView ?? globalThis, warn };
|
|
1344
|
+
const thunks = [];
|
|
1345
|
+
const host = document2.targets.find((target) => target.selector === "");
|
|
1346
|
+
for (const entry of host?.plan.jsEffects ?? []) {
|
|
1347
|
+
const cycle = entry.resolved.primitive.cycle;
|
|
1348
|
+
if (!cycle) continue;
|
|
1349
|
+
const params = readEffectParams(
|
|
1350
|
+
{ ...entry.resolved.preset.params, ...authoredParams(entry) },
|
|
1351
|
+
schemaFor(entry),
|
|
1352
|
+
warn
|
|
1353
|
+
);
|
|
1354
|
+
const name = entry.spec.name;
|
|
1355
|
+
thunks.push(() => {
|
|
1356
|
+
try {
|
|
1357
|
+
cycle.call(entry.resolved.primitive, el, params, ctx);
|
|
1358
|
+
} catch (error) {
|
|
1359
|
+
warn(`"${name}" failed to cycle: ${String(error)}`);
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
return thunks;
|
|
1364
|
+
}
|
|
1365
|
+
function hasGroupedCycle(document2) {
|
|
1366
|
+
return document2.targets.some(
|
|
1367
|
+
(target) => target.selector !== "" && target.plan.jsEffects.some((entry) => entry.resolved.primitive.cycle)
|
|
1368
|
+
);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// src/core/capabilities.ts
|
|
1372
|
+
function supports(property, value) {
|
|
1373
|
+
if (typeof CSS === "undefined" || typeof CSS.supports !== "function") return false;
|
|
1374
|
+
try {
|
|
1375
|
+
return CSS.supports(property, value);
|
|
1376
|
+
} catch {
|
|
1377
|
+
return false;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
var cached;
|
|
1381
|
+
function detect(force = false) {
|
|
1382
|
+
if (cached && !force) return cached;
|
|
1383
|
+
cached = {
|
|
1384
|
+
viewTimeline: supports("animation-timeline", "view()"),
|
|
1385
|
+
scrollTimeline: supports("animation-timeline", "scroll()"),
|
|
1386
|
+
animationRange: supports("animation-range", "entry 0% cover 30%"),
|
|
1387
|
+
// `translate`/`rotate`/`scale` as independent properties is what makes the channel model
|
|
1388
|
+
// possible at all — under the `transform` shorthand every effect would collide.
|
|
1389
|
+
individualTransforms: supports("translate", "0 10px") && supports("scale", "1.1"),
|
|
1390
|
+
scrollTimelineName: supports("scroll-timeline-name", "--x"),
|
|
1391
|
+
viewTransitions: typeof document !== "undefined" && "startViewTransition" in document,
|
|
1392
|
+
intersectionObserver: typeof IntersectionObserver !== "undefined",
|
|
1393
|
+
reducedMotion: typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
1394
|
+
motionPath: supports("offset-path", 'path("M 0 0")')
|
|
1395
|
+
};
|
|
1396
|
+
return cached;
|
|
1397
|
+
}
|
|
1398
|
+
var CHANNEL_REQUIREMENTS = [
|
|
1399
|
+
{
|
|
1400
|
+
channel: "offset",
|
|
1401
|
+
capability: "motionPath",
|
|
1402
|
+
message: "this browser does not support CSS Motion Path (offset-path), so the element will not travel \u2014 the animation still runs and completes, it just has no path to follow"
|
|
1403
|
+
}
|
|
1404
|
+
];
|
|
1405
|
+
function unsupportedChannelWarnings(channels, capabilities) {
|
|
1406
|
+
return CHANNEL_REQUIREMENTS.filter(
|
|
1407
|
+
(entry) => channels.includes(entry.channel) && !capabilities[entry.capability]
|
|
1408
|
+
).map((entry) => entry.message);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1124
1411
|
// src/core/derived/book.ts
|
|
1125
1412
|
function createDerivedBook() {
|
|
1126
1413
|
return {
|
|
@@ -1303,7 +1590,7 @@ function effectiveActivation(config) {
|
|
|
1303
1590
|
// src/core/derived/group-gate.ts
|
|
1304
1591
|
function groupGateOwner(port, context, target) {
|
|
1305
1592
|
const keys = staggerKeysFor(target.hoists, elementStaggerKeys(context.parsed));
|
|
1306
|
-
return isGroupedKeys(keys) ? context.host : void 0;
|
|
1593
|
+
return target.split || isGroupedKeys(keys) ? context.host : void 0;
|
|
1307
1594
|
}
|
|
1308
1595
|
function skipsOwnBinding(state) {
|
|
1309
1596
|
return state.gateOwner !== void 0;
|
|
@@ -1415,6 +1702,7 @@ function formerHostOf(book, match) {
|
|
|
1415
1702
|
return FORMER_HOST.get(book)?.get(match);
|
|
1416
1703
|
}
|
|
1417
1704
|
function targetKey(target) {
|
|
1705
|
+
if (target.split) return `split ${target.split}`;
|
|
1418
1706
|
return `${target.scope} ${target.selector}`;
|
|
1419
1707
|
}
|
|
1420
1708
|
function matchKey(targets) {
|
|
@@ -1428,13 +1716,16 @@ function groupConfigFor(port, context, target, cache) {
|
|
|
1428
1716
|
cache.set(target, config);
|
|
1429
1717
|
return config;
|
|
1430
1718
|
}
|
|
1431
|
-
function resolveGroups(port, context, targets, cache) {
|
|
1719
|
+
function resolveGroups(port, context, { targets, pieces }, cache) {
|
|
1432
1720
|
const live = [];
|
|
1433
1721
|
const resolved = [];
|
|
1434
1722
|
const unmatched = [];
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1723
|
+
const mounted = new Map(targets.flatMap((target) => target.mountTargets ? [[target, target.mountTargets(context.host, (message) => port.reporter.warn(message, context.host))]] : []));
|
|
1724
|
+
if (targets.every((target) => mounted.get(target)?.length === 0)) return void 0;
|
|
1725
|
+
for (const target of targets.filter((group) => group.split ? pieces.length > 0 : group.selector !== "")) {
|
|
1726
|
+
const marks = mounted.get(target);
|
|
1727
|
+
if (marks?.length === 0) continue;
|
|
1728
|
+
const matches = marks ?? (target.split ? pieces : port.resolveGroupMatches(context.host, target));
|
|
1438
1729
|
if (matches.length === 0) unmatched.push(target.selector);
|
|
1439
1730
|
resolved.push({ target, matches });
|
|
1440
1731
|
live.push({
|
|
@@ -1444,7 +1735,7 @@ function resolveGroups(port, context, targets, cache) {
|
|
|
1444
1735
|
members: []
|
|
1445
1736
|
});
|
|
1446
1737
|
}
|
|
1447
|
-
return { live, resolved, unmatched };
|
|
1738
|
+
return { live, resolved, unmatched, generated: [...mounted.values()].flat() };
|
|
1448
1739
|
}
|
|
1449
1740
|
function buildContext(request) {
|
|
1450
1741
|
const baseConfig = request.baseConfig;
|
|
@@ -1478,6 +1769,8 @@ function finalizeInstall(port, context, input) {
|
|
|
1478
1769
|
registerCleanup2(port, host, claimTargetGroupHost(host));
|
|
1479
1770
|
restageTargets(port, host);
|
|
1480
1771
|
bindGroups(port, host);
|
|
1772
|
+
if (input.restoreSplit) registerCleanup2(port, host, input.restoreSplit);
|
|
1773
|
+
if (input.generated.length) registerCleanup2(port, host, () => input.generated.forEach((el) => el.remove()));
|
|
1481
1774
|
for (const [match, targets] of input.claims) {
|
|
1482
1775
|
warnNested3d(port, host, match, installedTargetFor(port, context, targets));
|
|
1483
1776
|
}
|
|
@@ -1486,20 +1779,60 @@ function finalizeInstall(port, context, input) {
|
|
|
1486
1779
|
}
|
|
1487
1780
|
function installWithTargets(port, request) {
|
|
1488
1781
|
const context = buildContext(request);
|
|
1782
|
+
const { host } = context;
|
|
1783
|
+
const { targets } = request.document;
|
|
1784
|
+
const group = targets.find((target) => target.split);
|
|
1785
|
+
const stage = makeSplitStage(port, host, group);
|
|
1489
1786
|
const cache = /* @__PURE__ */ new Map();
|
|
1490
|
-
const
|
|
1787
|
+
const groups = resolveGroups(port, context, { targets, pieces: stage.cells }, cache);
|
|
1788
|
+
if (!groups) return;
|
|
1789
|
+
const { live, resolved, unmatched, generated } = groups;
|
|
1491
1790
|
port.book.contexts.set(context.host, context);
|
|
1492
1791
|
port.book.groups.set(context.host, live);
|
|
1493
1792
|
const claims = claimMatches(port, context.host, resolved);
|
|
1494
|
-
const own =
|
|
1495
|
-
if (!own && claims.size === 0) {
|
|
1793
|
+
const own = targets.find((target) => target.selector === "" && !target.split);
|
|
1794
|
+
if (!own && claims.size === 0 && !stage.onReady) {
|
|
1496
1795
|
context.host.setAttribute(ATTR.state, "failed");
|
|
1497
1796
|
markUnmatched(context.host, [...unmatched, ...request.document.suspectSelectors ?? []]);
|
|
1498
1797
|
return;
|
|
1499
1798
|
}
|
|
1500
1799
|
installDerivedMatches(port, context, claims, cache);
|
|
1501
1800
|
installHostGroup(port, request, own);
|
|
1502
|
-
finalizeInstall(port, context, { claims, resolved, unmatched, suspects: request.document.suspectSelectors });
|
|
1801
|
+
finalizeInstall(port, context, { claims, resolved, unmatched, suspects: request.document.suspectSelectors, restoreSplit: stage.restore, generated });
|
|
1802
|
+
if (stage.onReady) {
|
|
1803
|
+
const state = port.stateOf(host);
|
|
1804
|
+
if (!own && claims.size === 0) port.writeStatus(host, state, "pending");
|
|
1805
|
+
armSplitGroup(port, context, { stage, target: group, cache });
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
function makeSplitStage(port, host, group) {
|
|
1809
|
+
if (!group?.split) return { cells: [] };
|
|
1810
|
+
const install = port.registry.getSplitProvider(group.split);
|
|
1811
|
+
if (!install) {
|
|
1812
|
+
port.reporter.warn(`split:${group.split} is unavailable \u2014 no split provider is registered`, host);
|
|
1813
|
+
return { cells: [] };
|
|
1814
|
+
}
|
|
1815
|
+
return install(host, group, port.reporter) ?? { cells: [] };
|
|
1816
|
+
}
|
|
1817
|
+
function armSplitGroup(port, context, { stage, target, cache }) {
|
|
1818
|
+
const { host } = context;
|
|
1819
|
+
const root = host.getRootNode();
|
|
1820
|
+
const state = port.stateOf(host);
|
|
1821
|
+
stage.onReady?.((cells) => {
|
|
1822
|
+
if (port.stateOf(host) !== state || host.getRootNode() !== root) return;
|
|
1823
|
+
const group = {
|
|
1824
|
+
target,
|
|
1825
|
+
config: groupConfigFor(port, context, target, cache),
|
|
1826
|
+
gateOwner: groupGateOwner(port, context, target),
|
|
1827
|
+
members: []
|
|
1828
|
+
};
|
|
1829
|
+
port.book.groups.get(host).push(group);
|
|
1830
|
+
const claims = claimMatches(port, host, [{ target, matches: cells }]);
|
|
1831
|
+
installDerivedMatches(port, context, claims, cache);
|
|
1832
|
+
restageTargets(port, host);
|
|
1833
|
+
if (group.gateOwner === host) bindOneGroup(port, host, group);
|
|
1834
|
+
syncAggregate(port, host);
|
|
1835
|
+
});
|
|
1503
1836
|
}
|
|
1504
1837
|
function releaseMatch(port, host, match) {
|
|
1505
1838
|
const { book } = port;
|
|
@@ -1527,7 +1860,7 @@ function releaseDerived(port, el) {
|
|
|
1527
1860
|
releaseMatch(port, host, el);
|
|
1528
1861
|
return;
|
|
1529
1862
|
}
|
|
1530
|
-
if (port.book.derived.has(el)) releaseHost(port, el);
|
|
1863
|
+
if (port.book.derived.has(el) || port.book.cleanups.has(el)) releaseHost(port, el);
|
|
1531
1864
|
}
|
|
1532
1865
|
function restageAfterTreeRelease(port, removed) {
|
|
1533
1866
|
const formerHosts = /* @__PURE__ */ new Set();
|
|
@@ -1628,13 +1961,16 @@ function restageTargets(port, host) {
|
|
|
1628
1961
|
const hostState = port.stateOf(host);
|
|
1629
1962
|
if (!context || !live || !hostState) return;
|
|
1630
1963
|
const elementWide = elementStaggerKeys(context.parsed);
|
|
1631
|
-
const styleOf = (el) => el === host ? hostState.ledgers.style(host) : port.stateOf(el).ledgers.style(el);
|
|
1632
1964
|
for (const group of live) {
|
|
1633
1965
|
if (group.members.length === 0) continue;
|
|
1966
|
+
const splitLayer = group.target.split ? group.members[0].closest(`[${ATTR.part}="split"]`) ?? void 0 : void 0;
|
|
1967
|
+
const styleOf = (el) => el === host || el === splitLayer ? hostState.ledgers.style(el) : port.stateOf(el).ledgers.style(el);
|
|
1968
|
+
if (splitLayer) styleOf(splitLayer).set("--kui-stagger", "0ms");
|
|
1634
1969
|
indexTargetGroup({
|
|
1635
1970
|
host,
|
|
1636
1971
|
matches: group.members,
|
|
1637
1972
|
styleOf,
|
|
1973
|
+
splitLayer,
|
|
1638
1974
|
keys: staggerKeysFor(group.target.hoists, elementWide),
|
|
1639
1975
|
reporter: port.reporter
|
|
1640
1976
|
});
|
|
@@ -1646,14 +1982,14 @@ var ANCESTOR_WALK_BOUND2 = 64;
|
|
|
1646
1982
|
function newMatchesFor(node, host, target) {
|
|
1647
1983
|
const candidates = [...node.querySelectorAll(target.selector)];
|
|
1648
1984
|
if (node.matches(target.selector)) candidates.unshift(node);
|
|
1649
|
-
return candidates.filter((el) => host.contains(el) && el !== host && !el.hasAttribute(ATTR.part));
|
|
1985
|
+
return candidates.filter((el) => host.contains(el) && el !== host && !el.hasAttribute(ATTR.part) && !el.closest(`[${ATTR.part}="split"]`));
|
|
1650
1986
|
}
|
|
1651
1987
|
function resolveNewGroups(node, host, groups) {
|
|
1652
1988
|
const resolved = [];
|
|
1653
1989
|
const before = /* @__PURE__ */ new Map();
|
|
1654
1990
|
for (const group of groups) {
|
|
1655
1991
|
before.set(group, group.members.length);
|
|
1656
|
-
if (group.target.scope !== "self") continue;
|
|
1992
|
+
if (group.target.scope !== "self" || group.target.split) continue;
|
|
1657
1993
|
const matches = newMatchesFor(node, host, group.target);
|
|
1658
1994
|
if (matches.length > 0) resolved.push({ target: group.target, matches });
|
|
1659
1995
|
}
|
|
@@ -1689,7 +2025,7 @@ function adoptIntoHost(port, node, host) {
|
|
|
1689
2025
|
restageTargets(port, host);
|
|
1690
2026
|
}
|
|
1691
2027
|
function adoptLateMatches(port, node) {
|
|
1692
|
-
if (node.hasAttribute(ATTR.part)) return;
|
|
2028
|
+
if (node.hasAttribute(ATTR.part) || node.closest(`[${ATTR.part}="split"]`)) return;
|
|
1693
2029
|
let ancestor = node.parentElement;
|
|
1694
2030
|
let depth = 0;
|
|
1695
2031
|
while (ancestor && depth < ANCESTOR_WALK_BOUND2) {
|
|
@@ -1749,10 +2085,7 @@ function createDomWatcher(options) {
|
|
|
1749
2085
|
subtree: true,
|
|
1750
2086
|
childList: true,
|
|
1751
2087
|
attributes: true,
|
|
1752
|
-
|
|
1753
|
-
// group, and an edit to either has to re-rank the group. Its absence here meant editing
|
|
1754
|
-
// `data-kui-stagger` produced no record at all — not a missed handler, no mutation.
|
|
1755
|
-
attributeFilter: [ATTR.source, ATTR.on, ATTR.timeline, ATTR.threshold, ATTR.stagger]
|
|
2088
|
+
attributeFilter: [ATTR.source, ATTR.on, ATTR.threshold]
|
|
1756
2089
|
});
|
|
1757
2090
|
},
|
|
1758
2091
|
destroy() {
|
|
@@ -1805,6 +2138,10 @@ function sequencedTiming(entry, warn) {
|
|
|
1805
2138
|
if (entry.sequencedDelayMs !== void 0) timing.delayMs = entry.sequencedDelayMs;
|
|
1806
2139
|
return timing;
|
|
1807
2140
|
}
|
|
2141
|
+
function withRepeat(instance, repeat, ctx) {
|
|
2142
|
+
if (repeat === void 0 || repeat === "1" || ctx.reducedMotion) return instance;
|
|
2143
|
+
return repeatedInstance(instance, repeat, ctx.win);
|
|
2144
|
+
}
|
|
1808
2145
|
function createJsEffectPreparer(options) {
|
|
1809
2146
|
const { scheduler, rootResolver, capabilities, reporter, respectReducedMotion } = options;
|
|
1810
2147
|
function contextFor(el, { signal, ledger, timeline, cancel }) {
|
|
@@ -1841,7 +2178,7 @@ function createJsEffectPreparer(options) {
|
|
|
1841
2178
|
sequencedTiming(entry, warn)
|
|
1842
2179
|
);
|
|
1843
2180
|
try {
|
|
1844
|
-
instances.push(prepare(el, params, ctx));
|
|
2181
|
+
instances.push(withRepeat(prepare(el, params, ctx), spec.repeat, ctx));
|
|
1845
2182
|
} catch (error) {
|
|
1846
2183
|
reporter.warn(`"${spec.name}" failed to initialise: ${String(error)}`, el);
|
|
1847
2184
|
}
|
|
@@ -1877,7 +2214,7 @@ function collectingReporter() {
|
|
|
1877
2214
|
// src/core/animator.ts
|
|
1878
2215
|
var CLOAK_WATCHDOG_MS = 3e3;
|
|
1879
2216
|
function fingerprintOf(attributes) {
|
|
1880
|
-
return [attributes.source, attributes.on, attributes.
|
|
2217
|
+
return [attributes.source, attributes.on, attributes.threshold].join("\0");
|
|
1881
2218
|
}
|
|
1882
2219
|
function isElementNode(node) {
|
|
1883
2220
|
return typeof Element !== "undefined" && node instanceof Element;
|
|
@@ -1955,10 +2292,22 @@ var Animator = class {
|
|
|
1955
2292
|
*/
|
|
1956
2293
|
gateWatcher;
|
|
1957
2294
|
started = false;
|
|
2295
|
+
/**
|
|
2296
|
+
* Live `every:` cadences, one per element that authors one.
|
|
2297
|
+
*
|
|
2298
|
+
* Deliberately NOT part of `InstanceState`: `replay()` is `reset()` → `process()` → `activate()`,
|
|
2299
|
+
* and `reset()` releases that state. A cadence stored there would kill itself on the first tick
|
|
2300
|
+
* that replays. Reconciled by `syncCadence` on every `process()` and dropped only when the
|
|
2301
|
+
* element is removed, its `every:` goes away, or the animator is destroyed — never in `release()`.
|
|
2302
|
+
* `thunks` is replaced on each reconcile so a recompile's fresh cycle hooks are the ones a later
|
|
2303
|
+
* tick calls, while the scheduler (and its one IntersectionObserver) is kept.
|
|
2304
|
+
*/
|
|
2305
|
+
cadences = /* @__PURE__ */ new Map();
|
|
1958
2306
|
/** This animator's derived-host bookkeeping — see `DerivedBook`. */
|
|
1959
2307
|
book = createDerivedBook();
|
|
1960
2308
|
/** The narrow window the `derived/*` modules get onto this animator — see `AnimatorPort`. */
|
|
1961
2309
|
port;
|
|
2310
|
+
repeatDelaySupport;
|
|
1962
2311
|
constructor(options = {}) {
|
|
1963
2312
|
const resolved = resolveCollaborators(options);
|
|
1964
2313
|
this.registry = resolved.registry;
|
|
@@ -1973,6 +2322,8 @@ var Animator = class {
|
|
|
1973
2322
|
this.domWatcher = resolved.domWatcher;
|
|
1974
2323
|
this.respectReducedMotion = resolved.respectReducedMotion;
|
|
1975
2324
|
this.shouldObserve = resolved.shouldObserve;
|
|
2325
|
+
const canHold = typeof globalThis.Element?.prototype.getAnimations === "function" && typeof globalThis.KeyframeEffect?.prototype.updateTiming === "function" && globalThis.CSS?.supports("animation-timing-function", "linear(0, 1 80% 100%)") === true;
|
|
2326
|
+
this.repeatDelaySupport = canHold && (this.respectReducedMotion && this.capabilities.reducedMotion ? "reduced" : true);
|
|
1976
2327
|
this.port = {
|
|
1977
2328
|
registry: this.registry,
|
|
1978
2329
|
reporter: this.reporter,
|
|
@@ -2032,7 +2383,9 @@ var Animator = class {
|
|
|
2032
2383
|
const defined = this.bundles.collect(root, this.reporter);
|
|
2033
2384
|
const selector = `[${ATTR.source}]`;
|
|
2034
2385
|
if (isElementNode(root) && root.matches(selector)) this.process(root);
|
|
2035
|
-
for (const el of root.querySelectorAll(selector))
|
|
2386
|
+
for (const el of root.querySelectorAll(selector)) {
|
|
2387
|
+
if (root.contains(el)) this.process(el);
|
|
2388
|
+
}
|
|
2036
2389
|
applyStagger(root, this.reporter);
|
|
2037
2390
|
if (defined > 0 && root !== this.root) this.retryPending();
|
|
2038
2391
|
return this;
|
|
@@ -2066,18 +2419,129 @@ var Animator = class {
|
|
|
2066
2419
|
if (existing?.fingerprint === fingerprint) return;
|
|
2067
2420
|
if (existing) this.release(el);
|
|
2068
2421
|
const parsed = scopeHoists(this.bundles.expand(parse(attributes.source)), this.registry);
|
|
2422
|
+
if (isGroupOnly(parsed) || !el.hasAttribute(ATTR.source)) {
|
|
2423
|
+
parsed.warnings.forEach((warning) => this.reporter.warn(warning, el));
|
|
2424
|
+
el.removeAttribute(ATTR.state);
|
|
2425
|
+
this.dropCadence(el);
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2069
2428
|
const baseConfig = resolveConfig(attributes, parsed);
|
|
2070
2429
|
const config = { ...baseConfig };
|
|
2071
|
-
const document2 = compileTargets(parsed, this.registry, baseConfig.timeline);
|
|
2430
|
+
const document2 = compileTargets(parsed, this.registry, baseConfig.timeline, this.repeatDelaySupport);
|
|
2072
2431
|
const facts = document2.targets[0].plan;
|
|
2073
2432
|
this.applyViewportGates(el, document2);
|
|
2074
2433
|
config.activation = this.resolveActivation(el, baseConfig, facts);
|
|
2075
2434
|
this.reportCompiled(el, document2);
|
|
2076
2435
|
if (document2.targets.every((target) => target.plan.fxNames.length === 0)) {
|
|
2077
2436
|
el.setAttribute(ATTR.state, facts.unknown.length > 0 ? "pending" : "failed");
|
|
2437
|
+
this.dropCadence(el);
|
|
2078
2438
|
return;
|
|
2079
2439
|
}
|
|
2080
2440
|
this.install({ el, fingerprint, parsed, config, baseConfig, document: document2 });
|
|
2441
|
+
this.syncCadence(el, parsed, baseConfig, document2);
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Make this element's `every:` cadence match what its attribute now says.
|
|
2445
|
+
*
|
|
2446
|
+
* Runs after `install` on every `process()`, including the one `replay()` triggers — which is why
|
|
2447
|
+
* an unchanged `every:` keeps the running scheduler (and its observer) and only swaps in the fresh
|
|
2448
|
+
* cycle hooks; see `cadences`. Refusals warn and leave no cadence: a scroll-driven element is
|
|
2449
|
+
* already driven by scroll (an `every:` replays clock time), and an element whose every effect is
|
|
2450
|
+
* `repeat:infinite` never finishes, so every tick would be skipped.
|
|
2451
|
+
*
|
|
2452
|
+
* @complexity O(e) time in composed effects; O(1) space.
|
|
2453
|
+
* @overallScore 100
|
|
2454
|
+
*/
|
|
2455
|
+
syncCadence(el, parsed, config, document2) {
|
|
2456
|
+
const every = parsed.every;
|
|
2457
|
+
if (every === void 0) {
|
|
2458
|
+
this.dropCadence(el);
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
const warn = (message) => this.reporter.warn(message, el);
|
|
2462
|
+
const refusal = cadenceRefusal(config, document2);
|
|
2463
|
+
if (refusal) {
|
|
2464
|
+
this.dropCadence(el);
|
|
2465
|
+
warn(refusal);
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
const thunks = document2.targets.some((target) => target.split) ? [] : cycleThunks(el, document2, warn);
|
|
2469
|
+
const existing = this.cadences.get(el);
|
|
2470
|
+
if (existing && existing.every === every) {
|
|
2471
|
+
existing.thunks = thunks;
|
|
2472
|
+
return;
|
|
2473
|
+
}
|
|
2474
|
+
this.dropCadence(el);
|
|
2475
|
+
if (hasGroupedCycle(document2)) {
|
|
2476
|
+
warn("every: cycles only the host element's own effects; a target: group with a cycle hook replays instead");
|
|
2477
|
+
}
|
|
2478
|
+
const win = el.ownerDocument.defaultView ?? globalThis;
|
|
2479
|
+
const { release } = createCadence({
|
|
2480
|
+
el,
|
|
2481
|
+
periodMs: everyToMs(every),
|
|
2482
|
+
host: { win, doc: el.ownerDocument, reducedMotion: this.respectReducedMotion && this.capabilities.reducedMotion },
|
|
2483
|
+
tick: () => this.cadenceTick(el, entry.thunks),
|
|
2484
|
+
warn
|
|
2485
|
+
});
|
|
2486
|
+
const entry = { every, release, thunks };
|
|
2487
|
+
this.cadences.set(el, entry);
|
|
2488
|
+
}
|
|
2489
|
+
/** Release and forget one element's cadence, if it has one. O(1). */
|
|
2490
|
+
dropCadence(el) {
|
|
2491
|
+
const entry = this.cadences.get(el);
|
|
2492
|
+
if (!entry) return;
|
|
2493
|
+
this.cadences.delete(el);
|
|
2494
|
+
entry.release();
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* One `every:` step. In order, and exactly one of them:
|
|
2498
|
+
*
|
|
2499
|
+
* 1. never activated (`ready`, e.g. `on:manual`) → `activate`. A tick never both activates and
|
|
2500
|
+
* cycles: a FLIP watcher needs its first snapshot before a reorder means anything.
|
|
2501
|
+
* 2. any composed primitive has a cycle hook → run them all. A DOM state change the primitive's
|
|
2502
|
+
* own watcher animates; replaying would reset the very state being demonstrated.
|
|
2503
|
+
* 3. still `running` → skip. A tick never interrupts a run in progress.
|
|
2504
|
+
* 4. otherwise → `replay`, the route `play()` shares.
|
|
2505
|
+
*
|
|
2506
|
+
* A state that is none of those (`pending`/`failed`, or no state because the element was
|
|
2507
|
+
* recompiled away) skips: there is nothing installed to step.
|
|
2508
|
+
*
|
|
2509
|
+
* @complexity O(c) time in cycle hooks; O(1) space.
|
|
2510
|
+
* @overallScore 100
|
|
2511
|
+
*/
|
|
2512
|
+
cadenceTick(el, thunks) {
|
|
2513
|
+
const status = this.states.get(el)?.status;
|
|
2514
|
+
if (status === "ready") {
|
|
2515
|
+
this.activate(el);
|
|
2516
|
+
return;
|
|
2517
|
+
}
|
|
2518
|
+
if (status === void 0 || status === "pending" || status === "failed") return;
|
|
2519
|
+
if (thunks.length > 0) {
|
|
2520
|
+
for (const thunk of thunks) thunk();
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2523
|
+
if (status === "running") return;
|
|
2524
|
+
this.replay(el);
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* Run an element's effects again from their from-state: reset, recompile, activate.
|
|
2528
|
+
*
|
|
2529
|
+
* The remounting replay route. A local toggle can reverse on a second `activate()`, and
|
|
2530
|
+
* `process()` short-circuits on an unchanged fingerprint. `play()` and the `every:` cadence
|
|
2531
|
+
* share it so "replay" cannot mean two things. The cadence survives the round trip because it
|
|
2532
|
+
* lives outside the state `reset()` releases (see `cadences`).
|
|
2533
|
+
*
|
|
2534
|
+
* Restores whatever the effects wrote, so a JS-rendered effect that restores on finish
|
|
2535
|
+
* (`slat-assemble`) starts again from the author's own markup. A cycle hook's DOM change is the
|
|
2536
|
+
* exception: it is a state change the author asked for, and nothing here undoes it.
|
|
2537
|
+
*
|
|
2538
|
+
* @complexity O(e) time in composed effects; O(e) space for the recompiled plan.
|
|
2539
|
+
* @overallScore 100
|
|
2540
|
+
*/
|
|
2541
|
+
replay(el) {
|
|
2542
|
+
this.reset(el);
|
|
2543
|
+
this.process(el);
|
|
2544
|
+
this.activate(el);
|
|
2081
2545
|
}
|
|
2082
2546
|
/**
|
|
2083
2547
|
* Report everything a finished compile has to say about one element.
|
|
@@ -2194,10 +2658,9 @@ var Animator = class {
|
|
|
2194
2658
|
this.release(el);
|
|
2195
2659
|
this.process(el);
|
|
2196
2660
|
}
|
|
2197
|
-
/** Route
|
|
2198
|
-
* when it did (a derived install's own `document` never carries one, so this cannot recurse). */
|
|
2661
|
+
/** Route selector and split groups through the derived-host path, once per authored host. */
|
|
2199
2662
|
installedAsHost(request) {
|
|
2200
|
-
if (!request.document.targets.some((t) => t.selector !== "")) return false;
|
|
2663
|
+
if (request.host || !request.document.targets.some((t) => t.selector !== "" || t.split)) return false;
|
|
2201
2664
|
installWithTargets(this.port, request);
|
|
2202
2665
|
return true;
|
|
2203
2666
|
}
|
|
@@ -2319,6 +2782,8 @@ var Animator = class {
|
|
|
2319
2782
|
const hasCssAnimation = Object.keys(stylePlan.properties).some(
|
|
2320
2783
|
(property) => property.startsWith("animation-")
|
|
2321
2784
|
);
|
|
2785
|
+
const delay = stylePlan.properties["animation-delay"];
|
|
2786
|
+
if (delay && !context.state.host) stylePlan.properties["animation-delay"] = withNestedStagger(delay);
|
|
2322
2787
|
const writes = { target, stylePlan, hasCssAnimation };
|
|
2323
2788
|
for (const match of matches) this.installMatch(match, writes, context);
|
|
2324
2789
|
}
|
|
@@ -2346,8 +2811,16 @@ var Animator = class {
|
|
|
2346
2811
|
matchLedger.claim("animation-play-state");
|
|
2347
2812
|
if (hasCssAnimation) {
|
|
2348
2813
|
const scrubbed = stylePlan.gate === "scrubbed";
|
|
2814
|
+
const trigger = stylePlan.activation && resolveActivationSpec(stylePlan.activation);
|
|
2815
|
+
const restart = trigger && trigger.end === void 0 && trigger.start.kind === "events" && (context.config.activationSource !== void 0 || target.split && trigger.source === "hover");
|
|
2349
2816
|
state.instances.push(
|
|
2350
|
-
createCssInstance(
|
|
2817
|
+
createCssInstance(
|
|
2818
|
+
match,
|
|
2819
|
+
matchLedger,
|
|
2820
|
+
target.plan.keyframeNames,
|
|
2821
|
+
restart ? "restart" : scrubbed,
|
|
2822
|
+
target.plan.repeatDelays
|
|
2823
|
+
)
|
|
2351
2824
|
);
|
|
2352
2825
|
}
|
|
2353
2826
|
state.instances.push(
|
|
@@ -2944,6 +3417,7 @@ var Animator = class {
|
|
|
2944
3417
|
const candidates = [node, ...node.querySelectorAll("*")];
|
|
2945
3418
|
for (const el of candidates) {
|
|
2946
3419
|
if (this.liveElements.has(el)) this.release(el);
|
|
3420
|
+
this.dropCadence(el);
|
|
2947
3421
|
}
|
|
2948
3422
|
restageAfterRemoval(candidates, this.reporter);
|
|
2949
3423
|
restageAfterTreeRelease(this.port, candidates);
|
|
@@ -2951,6 +3425,7 @@ var Animator = class {
|
|
|
2951
3425
|
destroy() {
|
|
2952
3426
|
this.domWatcher?.destroy();
|
|
2953
3427
|
releaseStagger(this.root);
|
|
3428
|
+
for (const el of [...this.cadences.keys()]) this.dropCadence(el);
|
|
2954
3429
|
for (const el of [...this.liveElements]) this.release(el);
|
|
2955
3430
|
this.gateWatcher?.destroy();
|
|
2956
3431
|
this.binder.destroy();
|
|
@@ -2976,6 +3451,7 @@ var Animator = class {
|
|
|
2976
3451
|
},
|
|
2977
3452
|
onElementRemoved: (el) => this.releaseTree(el),
|
|
2978
3453
|
onAttributeChanged: (el) => {
|
|
3454
|
+
releaseStaggerGroup(el);
|
|
2979
3455
|
this.process(el);
|
|
2980
3456
|
restageAround(el, this.reporter);
|
|
2981
3457
|
}
|
|
@@ -3025,6 +3501,21 @@ function defaultRootResolver(root) {
|
|
|
3025
3501
|
const win = doc?.defaultView ?? globalThis;
|
|
3026
3502
|
return createRootResolver({ win });
|
|
3027
3503
|
}
|
|
3504
|
+
function cadenceRefusal(config, document2) {
|
|
3505
|
+
if (config.timeline !== "time") {
|
|
3506
|
+
return "every: needs a clock timeline; a scroll-driven element is already driven by scroll, so no cadence started";
|
|
3507
|
+
}
|
|
3508
|
+
const eventDriven = document2.targets.some(({ plan, hoists }) => {
|
|
3509
|
+
const group = resolveGroupConfig(config, hoists);
|
|
3510
|
+
const activation = group.activationAuthored ? group.activation : plan.defaultActivation ?? group.activation;
|
|
3511
|
+
const { start, end } = resolveActivationSpec(activation);
|
|
3512
|
+
return start.kind === "events" || end?.kind === "events";
|
|
3513
|
+
});
|
|
3514
|
+
if (eventDriven) return "every: cannot replay a DOM-event trigger; no cadence started and the authored trigger still works";
|
|
3515
|
+
if (document2.targets.every(({ specs }) => specs.every(({ repeat }) => isInfiniteRepeat(repeat)))) {
|
|
3516
|
+
return "every: has nothing to replay; every effect is repeat:infinite and never finishes, so no cadence started";
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3028
3519
|
function isDirectional(instance) {
|
|
3029
3520
|
return !instance.setupOnly && instance.play !== void 0 && instance.reverse !== void 0;
|
|
3030
3521
|
}
|
|
@@ -3133,8 +3624,11 @@ function writtenArgs(spec) {
|
|
|
3133
3624
|
function writtenStepKeys(spec) {
|
|
3134
3625
|
const written = {};
|
|
3135
3626
|
if (spec.at !== void 0) written.at = spec.at;
|
|
3627
|
+
if (spec.split !== void 0) written.split = spec.split;
|
|
3628
|
+
if (spec.rows !== void 0) written.rows = spec.rows;
|
|
3136
3629
|
Object.assign(written, spec.gate);
|
|
3137
3630
|
if (spec.repeat !== void 0) written.repeat = spec.repeat;
|
|
3631
|
+
if (spec.repeatDelay !== void 0) written["repeat-delay"] = `${spec.repeatDelay}ms`;
|
|
3138
3632
|
if (spec.yoyo !== void 0) written.yoyo = String(spec.yoyo);
|
|
3139
3633
|
for (const [field, value] of Object.entries(spec.hoists ?? {})) {
|
|
3140
3634
|
written[ELEMENT_KEYS[field].key] = value;
|
|
@@ -3162,8 +3656,10 @@ var TIMELINES2 = Object.keys({ time: 0, view: 0, scroll: 0, pointer: 0, pin: 0 }
|
|
|
3162
3656
|
var RM_POLICIES = Object.keys({ shorten: 0, crossfade: 0, disable: 0 });
|
|
3163
3657
|
var ELEMENT_KEYS = {
|
|
3164
3658
|
activation: { key: "on", type: "text", default: "", spellings: ["enter", "load", "hover", "click", "hover/unhover"] },
|
|
3659
|
+
via: { key: "via", type: "text", default: "", spellings: ["#play"] },
|
|
3165
3660
|
actions: { key: "actions", type: "text", default: "", spellings: ["play/pause/resume/reset", "play/none/none/reset"] },
|
|
3166
3661
|
timeline: { key: "timeline", type: "keyword", default: "", spellings: TIMELINES2, keywords: TIMELINES2 },
|
|
3662
|
+
range: { key: "range", type: "text", default: "", spellings: ["'entry 0% cover 60%'", "'0% 100%'"] },
|
|
3167
3663
|
threshold: { key: "threshold", type: "percentage", default: "", spellings: ["0%", "25%"] },
|
|
3168
3664
|
cascade: { key: "cascade", type: "time", default: "", spellings: ["90ms", "0.09s"] },
|
|
3169
3665
|
spread: { key: "spread", type: "time", default: "", spellings: ["600ms", "0.6s"] },
|
|
@@ -3171,7 +3667,8 @@ var ELEMENT_KEYS = {
|
|
|
3171
3667
|
cols: { key: "cols", type: "text", default: "", spellings: ["auto", "4"] },
|
|
3172
3668
|
along: { key: "along", type: "keyword", default: "", spellings: ["x", "y"], keywords: ["x", "y"] },
|
|
3173
3669
|
rm: { key: "rm", type: "keyword", default: "", spellings: RM_POLICIES, keywords: RM_POLICIES },
|
|
3174
|
-
func: { key: "func", type: "text", default: "", spellings: ["onRevealDone"] }
|
|
3670
|
+
func: { key: "func", type: "text", default: "", spellings: ["onRevealDone"] },
|
|
3671
|
+
every: { key: "every", type: "time", default: "", spellings: ["2.6s", "900ms"] }
|
|
3175
3672
|
};
|
|
3176
3673
|
var gateKey = (key) => ({
|
|
3177
3674
|
key,
|
|
@@ -3182,8 +3679,11 @@ var gateKey = (key) => ({
|
|
|
3182
3679
|
});
|
|
3183
3680
|
var STEP_KEYS = {
|
|
3184
3681
|
at: { key: "at", type: "text", default: "", spellings: ["after", "with", "-200ms", "with+100ms"] },
|
|
3682
|
+
split: { key: "split", type: "keyword", default: "", spellings: ["chars", "words", "tiles"], keywords: ["chars", "words", "tiles"] },
|
|
3683
|
+
rows: { key: "rows", type: "number", default: "", spellings: ["5"] },
|
|
3185
3684
|
gate: { above: gateKey("above"), below: gateKey("below"), wide: gateKey("wide"), narrow: gateKey("narrow") },
|
|
3186
3685
|
repeat: { key: "repeat", type: "text", default: "", spellings: ["infinite", "3"] },
|
|
3686
|
+
repeatDelay: { key: "repeat-delay", type: "time", default: "", spellings: ["300ms", "0.3s"] },
|
|
3187
3687
|
yoyo: { key: "yoyo", type: "keyword", default: "", spellings: ["true", "false"], keywords: ["true", "false"] }
|
|
3188
3688
|
};
|
|
3189
3689
|
var STEP_KEY_LIST = Object.values(STEP_KEYS).flatMap(
|
|
@@ -3203,6 +3703,7 @@ function spellingsFor(spec, fallback = spec.default) {
|
|
|
3203
3703
|
var EXAMPLES = {
|
|
3204
3704
|
angle: (value) => angleForms(value),
|
|
3205
3705
|
"angle|keyword": (value, keywords) => [...angleForms(keywords.includes(value) ? "" : value), ...keywords],
|
|
3706
|
+
"number|keyword": (value, keywords) => [keywords.includes(value) ? "1" : value || "1", ...keywords],
|
|
3206
3707
|
keyword: (_, keywords) => [...keywords],
|
|
3207
3708
|
time: timeForms,
|
|
3208
3709
|
number: (value) => [value || "1"],
|