kuinetic 0.2.4 → 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/advanced/index.mjs +1 -1
- package/dist/esm/{chunk-FASAEQDR.mjs → chunk-CG37RODK.mjs} +1232 -277
- package/dist/esm/{chunk-AEQGC2KM.mjs → chunk-EDFJTT5B.mjs} +2 -1
- package/dist/esm/{chunk-MZQG2VMG.mjs → chunk-W7U4A2NK.mjs} +708 -610
- package/dist/esm/{chunk-EHS45PIK.mjs → chunk-Y2FP56K5.mjs} +9228 -4275
- package/dist/esm/core/index.mjs +3 -3
- package/dist/esm/effects/index.mjs +3 -3
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/notes/index.mjs +347 -9
- package/dist/kuinetic.advanced.js +2 -1
- package/dist/kuinetic.advanced.min.js +1 -1
- package/dist/kuinetic.all.js +9099 -3152
- package/dist/kuinetic.all.min.js +4 -2
- package/dist/kuinetic.css +2408 -161
- package/dist/kuinetic.js +9098 -3151
- package/dist/kuinetic.min.css +1 -1
- package/dist/kuinetic.min.js +3 -1
- package/dist/kuinetic.notes.js +1 -1
- package/dist/types/advanced/shaders.d.ts +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 +5 -1
- 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/easing.d.ts +9 -0
- package/dist/types/core/effect-context.d.ts +5 -0
- package/dist/types/core/element-config.d.ts +5 -4
- package/dist/types/core/flip.d.ts +25 -1
- package/dist/types/core/gesture.d.ts +5 -0
- package/dist/types/core/image-flight.d.ts +23 -0
- package/dist/types/core/instances.d.ts +27 -3
- package/dist/types/core/js-effect-preparer.d.ts +3 -1
- package/dist/types/core/owned-styles.d.ts +2 -1
- package/dist/types/core/params.d.ts +2 -3
- package/dist/types/core/parse.d.ts +21 -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 +17 -2
- 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 +76 -19
- package/dist/types/effects/auto-motion.d.ts +22 -117
- package/dist/types/effects/carousel/archive.d.ts +18 -0
- package/dist/types/effects/carousel/coast.d.ts +7 -0
- package/dist/types/effects/carousel/deck.d.ts +31 -2
- package/dist/types/effects/carousel/drag.d.ts +24 -7
- package/dist/types/effects/carousel/glide.d.ts +89 -0
- package/dist/types/effects/carousel/line.d.ts +10 -0
- package/dist/types/effects/carousel/row-copies.d.ts +13 -0
- package/dist/types/effects/carousel/row.d.ts +3 -0
- package/dist/types/effects/carousel/shape-fit.d.ts +54 -0
- package/dist/types/effects/carousel/sources.d.ts +26 -0
- package/dist/types/effects/carousel/sphere.d.ts +23 -0
- package/dist/types/effects/carousel/stack.d.ts +2 -1
- package/dist/types/effects/catalog/confetti.d.ts +2 -0
- package/dist/types/effects/catalog/cursor-trail.d.ts +2 -0
- package/dist/types/effects/catalog/curtains.d.ts +2 -0
- package/dist/types/effects/catalog/feedback.d.ts +1 -1
- package/dist/types/effects/catalog/image-flight.d.ts +2 -0
- package/dist/types/effects/catalog/line-boil.d.ts +2 -0
- package/dist/types/effects/catalog/media-shared.d.ts +10 -0
- package/dist/types/effects/catalog/number-tokens.d.ts +5 -0
- package/dist/types/effects/catalog/numbers-shared.d.ts +3 -4
- package/dist/types/effects/catalog/pause-scope.d.ts +20 -0
- package/dist/types/effects/catalog/text-shared.d.ts +17 -6
- package/dist/types/effects/catalog/typewriter-scatter.d.ts +5 -0
- package/dist/types/effects/catalog/view-transitions.d.ts +32 -1
- package/dist/types/effects/catalog/wobble.d.ts +2 -0
- package/dist/types/effects/gestures/drag-options.d.ts +17 -0
- package/dist/types/effects/layout/departures.d.ts +21 -0
- package/dist/types/effects/motion-path/fit.d.ts +4 -0
- package/dist/types/effects/scroll-mechanics/progress-output.d.ts +9 -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/step-marking.d.ts +7 -4
- package/dist/types/effects/svg/morph-loop.d.ts +7 -0
- package/dist/types/effects/svg/text-path.d.ts +2 -0
- package/dist/types/effects/three-d/cube.d.ts +2 -0
- package/dist/types/effects/tween/index.d.ts +2 -1
- package/dist/types/effects/tween/properties.d.ts +1 -1
- package/dist/types/effects/tween/toggle.d.ts +6 -0
- package/dist/types/effects/tween/waypoints.d.ts +1 -1
- package/dist/types/notes/effects.d.ts +1 -0
- package/dist/types/notes/index.d.ts +11 -0
- package/dist/types/notes/showcase.d.ts +1 -0
- package/dist/types/showcase/lightbox-flight.d.ts +11 -0
- package/dist/types/showcase/media-source.d.ts +1 -0
- package/dist/types/showcase/modal-shell.d.ts +5 -0
- package/dist/types/showcase/youtube.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLedgerSet
|
|
3
|
+
} from "./chunk-EDFJTT5B.mjs";
|
|
4
|
+
|
|
1
5
|
// src/core/target.ts
|
|
2
6
|
function selectorBreadth(selector, doc) {
|
|
3
7
|
try {
|
|
@@ -42,6 +46,41 @@ function queryControls(el, ctx, selector) {
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
// src/core/event-sources.ts
|
|
49
|
+
var NATIVE_CONTROLS = "button, input, select, textarea, a[href], summary, audio[controls], video[controls]";
|
|
50
|
+
var NESTED_CONTROLS = `${NATIVE_CONTROLS}, [tabindex], [contenteditable], [role="button"], [role="link"], [role="checkbox"], [role="radio"], [role="switch"], [role="textbox"], [role="combobox"], [role="slider"], [role="tab"], [role^="menuitem"]`;
|
|
51
|
+
function bindButtonKeys(source) {
|
|
52
|
+
const button = source;
|
|
53
|
+
if (!source.matches('[role="button"][tabindex]') || typeof button.click !== "function" || source.matches(NATIVE_CONTROLS)) return;
|
|
54
|
+
let space = false;
|
|
55
|
+
const blur = () => {
|
|
56
|
+
space = false;
|
|
57
|
+
};
|
|
58
|
+
const eligible = (event) => {
|
|
59
|
+
const control2 = event.composedPath().find((target) => target === source || target.matches?.(NESTED_CONTROLS));
|
|
60
|
+
return !event.defaultPrevented && source.hasAttribute("tabindex") && source.matches(":focus") && !source.matches(':disabled, [disabled], [aria-disabled="true"]') && control2 === source;
|
|
61
|
+
};
|
|
62
|
+
const down = (event) => {
|
|
63
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
64
|
+
if (!eligible(event)) return;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
if (event.repeat) return;
|
|
67
|
+
if (event.key === "Enter") button.click();
|
|
68
|
+
else space = true;
|
|
69
|
+
};
|
|
70
|
+
const up = (event) => {
|
|
71
|
+
if (event.key !== " " || !space) return;
|
|
72
|
+
blur();
|
|
73
|
+
if (!event.repeat && eligible(event)) button.click();
|
|
74
|
+
};
|
|
75
|
+
button.addEventListener("keydown", down);
|
|
76
|
+
button.addEventListener("keyup", up);
|
|
77
|
+
button.addEventListener("blur", blur);
|
|
78
|
+
return () => {
|
|
79
|
+
button.removeEventListener("keydown", down);
|
|
80
|
+
button.removeEventListener("keyup", up);
|
|
81
|
+
button.removeEventListener("blur", blur);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
45
84
|
function createEventSourceBindings() {
|
|
46
85
|
const bindings = /* @__PURE__ */ new Map();
|
|
47
86
|
function retain(source, type, run) {
|
|
@@ -56,7 +95,7 @@ function createEventSourceBindings() {
|
|
|
56
95
|
const listener = () => {
|
|
57
96
|
for (const callback of [...runs]) callback();
|
|
58
97
|
};
|
|
59
|
-
binding = { listener, runs };
|
|
98
|
+
binding = { listener, runs, releaseKeys: type === "click" ? bindButtonKeys(source) : void 0 };
|
|
60
99
|
types.set(type, binding);
|
|
61
100
|
source.addEventListener(type, listener, { passive: true });
|
|
62
101
|
}
|
|
@@ -68,6 +107,7 @@ function createEventSourceBindings() {
|
|
|
68
107
|
binding.runs.delete(run);
|
|
69
108
|
if (binding.runs.size > 0) return;
|
|
70
109
|
source.removeEventListener(type, binding.listener);
|
|
110
|
+
binding.releaseKeys?.();
|
|
71
111
|
types?.delete(type);
|
|
72
112
|
if (types?.size === 0) bindings.delete(source);
|
|
73
113
|
};
|
|
@@ -84,7 +124,10 @@ function createEventSourceBindings() {
|
|
|
84
124
|
},
|
|
85
125
|
destroy() {
|
|
86
126
|
for (const [source, types] of bindings) {
|
|
87
|
-
for (const [type, binding] of types)
|
|
127
|
+
for (const [type, binding] of types) {
|
|
128
|
+
source.removeEventListener(type, binding.listener);
|
|
129
|
+
binding.releaseKeys?.();
|
|
130
|
+
}
|
|
88
131
|
}
|
|
89
132
|
bindings.clear();
|
|
90
133
|
}
|
|
@@ -416,7 +459,6 @@ function sideOf(entry) {
|
|
|
416
459
|
}
|
|
417
460
|
function createActivationBinder(options = {}) {
|
|
418
461
|
const observers = /* @__PURE__ */ new Map();
|
|
419
|
-
const callbacks = /* @__PURE__ */ new WeakMap();
|
|
420
462
|
const eventBindings = createEventSourceBindings();
|
|
421
463
|
const createObserver = options.createObserver ?? defaultObserverFactory();
|
|
422
464
|
const travel = createTravelTracker();
|
|
@@ -427,16 +469,21 @@ function createActivationBinder(options = {}) {
|
|
|
427
469
|
const key = String(ratio);
|
|
428
470
|
const existing = observers.get(key);
|
|
429
471
|
if (existing) return { key, shared: existing };
|
|
472
|
+
const callbacks = /* @__PURE__ */ new WeakMap();
|
|
430
473
|
const observer = createObserver(
|
|
431
474
|
(entries) => {
|
|
432
475
|
for (const entry of entries) {
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
476
|
+
const bindings = callbacks.get(entry.target);
|
|
477
|
+
if (!bindings) continue;
|
|
478
|
+
const from = travel.arrivedFrom(entry.time);
|
|
479
|
+
for (const binding of [...bindings]) {
|
|
480
|
+
if (bindings.has(binding)) deliverEntry(binding, entry, ratio, from);
|
|
481
|
+
}
|
|
435
482
|
}
|
|
436
483
|
},
|
|
437
484
|
{ threshold: ratio }
|
|
438
485
|
);
|
|
439
|
-
const shared = { observer, count: 0 };
|
|
486
|
+
const shared = { observer, callbacks, count: 0 };
|
|
440
487
|
observers.set(key, shared);
|
|
441
488
|
return { key, shared };
|
|
442
489
|
}
|
|
@@ -449,19 +496,23 @@ function createActivationBinder(options = {}) {
|
|
|
449
496
|
const { key, shared } = binding;
|
|
450
497
|
const tracksTravel = Boolean(spec.onCross);
|
|
451
498
|
if (tracksTravel) travel.retain();
|
|
499
|
+
const bindings = shared.callbacks.get(el) ?? /* @__PURE__ */ new Set();
|
|
452
500
|
let active = true;
|
|
453
501
|
const release = () => {
|
|
454
502
|
if (!active) return;
|
|
455
503
|
active = false;
|
|
456
504
|
if (tracksTravel) travel.release();
|
|
457
|
-
|
|
458
|
-
|
|
505
|
+
bindings.delete(observed);
|
|
506
|
+
if (bindings.size === 0) {
|
|
507
|
+
shared.callbacks.delete(el);
|
|
508
|
+
shared.observer.unobserve(el);
|
|
509
|
+
}
|
|
459
510
|
shared.count--;
|
|
460
511
|
if (shared.count > 0) return;
|
|
461
512
|
shared.observer.disconnect();
|
|
462
513
|
observers.delete(key);
|
|
463
514
|
};
|
|
464
|
-
|
|
515
|
+
const observed = {
|
|
465
516
|
onEnter: spec.onEnter,
|
|
466
517
|
onLeave: spec.onLeave,
|
|
467
518
|
...spec.onCross ? { onCross: spec.onCross } : {},
|
|
@@ -471,9 +522,13 @@ function createActivationBinder(options = {}) {
|
|
|
471
522
|
reporter,
|
|
472
523
|
sawIntersecting: false,
|
|
473
524
|
thresholdWarned: false
|
|
474
|
-
}
|
|
525
|
+
};
|
|
526
|
+
bindings.add(observed);
|
|
475
527
|
shared.count++;
|
|
476
|
-
|
|
528
|
+
if (bindings.size === 1) {
|
|
529
|
+
shared.callbacks.set(el, bindings);
|
|
530
|
+
shared.observer.observe(el);
|
|
531
|
+
}
|
|
477
532
|
return release;
|
|
478
533
|
}
|
|
479
534
|
return {
|
|
@@ -590,9 +645,7 @@ var ATTR = {
|
|
|
590
645
|
normalized: "data-kui-fx",
|
|
591
646
|
state: "data-kui-state",
|
|
592
647
|
on: "data-kui-on",
|
|
593
|
-
timeline: "data-kui-timeline",
|
|
594
648
|
threshold: "data-kui-threshold",
|
|
595
|
-
stagger: "data-kui-stagger",
|
|
596
649
|
cloak: "data-kui-cloak",
|
|
597
650
|
/** Reduced-motion policy, stamped from the primitive so the CSS layer can act on it. */
|
|
598
651
|
rm: "data-kui-rm",
|
|
@@ -645,8 +698,10 @@ function inertInstance(destroy = () => {
|
|
|
645
698
|
}
|
|
646
699
|
var SEGMENT_HOIST_KEYS = [
|
|
647
700
|
"activation",
|
|
701
|
+
"via",
|
|
648
702
|
"actions",
|
|
649
703
|
"timeline",
|
|
704
|
+
"range",
|
|
650
705
|
"threshold",
|
|
651
706
|
"cascade",
|
|
652
707
|
"spread",
|
|
@@ -659,6 +714,7 @@ var SEGMENT_HOIST_KEYS = [
|
|
|
659
714
|
var Registry = class {
|
|
660
715
|
primitives = /* @__PURE__ */ new Map();
|
|
661
716
|
presets = /* @__PURE__ */ new Map();
|
|
717
|
+
splitProviders = /* @__PURE__ */ new Map();
|
|
662
718
|
/** Sorted-name key → preset that renders that combination as one tested keyframe. */
|
|
663
719
|
combos = /* @__PURE__ */ new Map();
|
|
664
720
|
registerPrimitive(primitive) {
|
|
@@ -695,6 +751,13 @@ var Registry = class {
|
|
|
695
751
|
for (const primitive of primitives) this.registerPrimitive(primitive);
|
|
696
752
|
return this;
|
|
697
753
|
}
|
|
754
|
+
registerSplitProvider(unit, install) {
|
|
755
|
+
this.splitProviders.set(unit, install);
|
|
756
|
+
return this;
|
|
757
|
+
}
|
|
758
|
+
getSplitProvider(unit) {
|
|
759
|
+
return this.splitProviders.get(unit);
|
|
760
|
+
}
|
|
698
761
|
/**
|
|
699
762
|
* Declare that a set of effect names has a purpose-built single-keyframe implementation.
|
|
700
763
|
* Checked before channel conflict analysis, so `fade-up` + `blur-in` can resolve to the
|
|
@@ -1156,16 +1219,23 @@ function round(value) {
|
|
|
1156
1219
|
// src/core/repeat.ts
|
|
1157
1220
|
var INFINITE = "infinite";
|
|
1158
1221
|
var COUNT_RE = /^(?:\d+(?:\.\d+)?|\.\d+)$/;
|
|
1222
|
+
var GAP_RE = /^(\d+(?:\.\d+)?|\.\d+)(ms|s)$/;
|
|
1159
1223
|
var PROGRESS_DRIVEN = /* @__PURE__ */ new Set(["view", "scroll", "pin"]);
|
|
1160
|
-
var PLAYBACK_KEYS = /* @__PURE__ */ new Set(["repeat", "yoyo"]);
|
|
1224
|
+
var PLAYBACK_KEYS = /* @__PURE__ */ new Set(["repeat", "repeat-delay", "yoyo"]);
|
|
1161
1225
|
function isPlaybackKey(key) {
|
|
1162
1226
|
return PLAYBACK_KEYS.has(key);
|
|
1163
1227
|
}
|
|
1164
1228
|
function applyPlayback(spec, key, value, context) {
|
|
1165
|
-
|
|
1229
|
+
const field = key === "repeat-delay" ? "repeatDelay" : key;
|
|
1230
|
+
if (spec[field] !== void 0) {
|
|
1166
1231
|
context.warn(`duplicate parameter "${key}" in "${context.segment}"`);
|
|
1167
1232
|
}
|
|
1168
|
-
if (key === "
|
|
1233
|
+
if (key === "repeat-delay") {
|
|
1234
|
+
const match = GAP_RE.exec(value);
|
|
1235
|
+
const ms = Number(match?.[1]) * (match?.[2] === "s" ? 1e3 : 1);
|
|
1236
|
+
if (Number.isFinite(ms)) spec.repeatDelay = ms;
|
|
1237
|
+
else context.warn(`"repeat-delay:${value}" in "${context.segment}" needs a nonnegative literal time in ms or s`);
|
|
1238
|
+
} else if (key === "yoyo") applyYoyo(spec, value, context);
|
|
1169
1239
|
else applyRepeat(spec, value, context);
|
|
1170
1240
|
}
|
|
1171
1241
|
function applyRepeat(spec, value, context) {
|
|
@@ -1202,7 +1272,7 @@ function countRefusal(value, segment) {
|
|
|
1202
1272
|
function resolvePlayback(input) {
|
|
1203
1273
|
const warnings = [];
|
|
1204
1274
|
if (input.repeat === void 0 && input.yoyo === void 0) return { warnings };
|
|
1205
|
-
if (input.renderer !== "css-keyframes") return
|
|
1275
|
+
if (input.renderer !== "css-keyframes") return resolveJsPlayback(input);
|
|
1206
1276
|
if (input.repeat === INFINITE && PROGRESS_DRIVEN.has(input.timeline)) {
|
|
1207
1277
|
warnings.push(infiniteTimelineRefusal(input.name, input.timeline));
|
|
1208
1278
|
return { yoyo: input.yoyo, warnings };
|
|
@@ -1211,6 +1281,31 @@ function resolvePlayback(input) {
|
|
|
1211
1281
|
if (hidden) warnings.push(hidden);
|
|
1212
1282
|
return { repeat: input.repeat, yoyo: input.yoyo, warnings };
|
|
1213
1283
|
}
|
|
1284
|
+
function resolveJsPlayback(input) {
|
|
1285
|
+
if (input.repeatable !== true) return { warnings: [rendererRefusal(input)] };
|
|
1286
|
+
const warnings = [];
|
|
1287
|
+
let repeat = input.repeat;
|
|
1288
|
+
if (repeat !== void 0 && repeat !== INFINITE) {
|
|
1289
|
+
const count = Number(repeat);
|
|
1290
|
+
if (count === 0) {
|
|
1291
|
+
warnings.push(
|
|
1292
|
+
`"${input.name}" has repeat:0, which would never start. Dropping the repeat so it plays once \u2014 remove the key, or write repeat:infinite to loop.`
|
|
1293
|
+
);
|
|
1294
|
+
repeat = void 0;
|
|
1295
|
+
} else if (!Number.isInteger(count)) {
|
|
1296
|
+
warnings.push(
|
|
1297
|
+
`"${input.name}" has repeat:${repeat}, but a JS-rendered effect repeats whole runs. Dropping the repeat so it plays once \u2014 use a whole number such as repeat:3.`
|
|
1298
|
+
);
|
|
1299
|
+
repeat = void 0;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
if (input.yoyo !== void 0) {
|
|
1303
|
+
warnings.push(
|
|
1304
|
+
`"${input.name}" is rendered in JavaScript, which has no playhead to run backwards, so yoyo:${input.yoyo} has nothing to alternate and is ignored. repeat: still replays it.`
|
|
1305
|
+
);
|
|
1306
|
+
}
|
|
1307
|
+
return { repeat, warnings };
|
|
1308
|
+
}
|
|
1214
1309
|
function endsHidden(input) {
|
|
1215
1310
|
if (!input.cloak || input.yoyo !== true) return null;
|
|
1216
1311
|
const count = repeatCount(input.repeat);
|
|
@@ -1222,7 +1317,7 @@ function rendererRefusal(input) {
|
|
|
1222
1317
|
input.repeat === void 0 ? "" : `repeat:${input.repeat}`,
|
|
1223
1318
|
input.yoyo === void 0 ? "" : `yoyo:${input.yoyo}`
|
|
1224
1319
|
].filter(Boolean).join(" and ");
|
|
1225
|
-
return `"${input.name}" is rendered in JavaScript and compiles no animation-iteration-count, so ${authored} does nothing \u2014 it plays once.
|
|
1320
|
+
return `"${input.name}" is rendered in JavaScript and compiles no animation-iteration-count, so ${authored} does nothing \u2014 it plays once. Finite JS effects such as slat-assemble, count-up and split-text can repeat; this one is continuous or stateful, so a replay would mean nothing. A CSS effect repeats and yoyos natively.`;
|
|
1226
1321
|
}
|
|
1227
1322
|
function infiniteTimelineRefusal(name, timeline) {
|
|
1228
1323
|
const because = timeline === "pin" ? `a pin scrubs a single playthrough with a negative animation-delay, so no iteration past the first is ever reachable` : `a "${timeline}" timeline is a finite range driven by scroll position rather than a clock, and an infinite iteration count collapses the animation's active duration to zero there \u2014 the element renders frozen at its end state`;
|
|
@@ -1238,10 +1333,11 @@ function isInfiniteRepeat(repeat) {
|
|
|
1238
1333
|
function directionValue(yoyo) {
|
|
1239
1334
|
return yoyo ? "alternate" : "normal";
|
|
1240
1335
|
}
|
|
1241
|
-
function playbackExpression(duration, repeat) {
|
|
1336
|
+
function playbackExpression(duration, repeat, gap) {
|
|
1242
1337
|
const count = repeatCount(repeat);
|
|
1243
1338
|
if (count === void 0 || count === 1) return duration;
|
|
1244
|
-
|
|
1339
|
+
const holds = gap ? ` + ${gap * (count - 1)}ms` : "";
|
|
1340
|
+
return `${duration} * ${count}${holds}`;
|
|
1245
1341
|
}
|
|
1246
1342
|
|
|
1247
1343
|
// src/core/toggle-actions.ts
|
|
@@ -1417,7 +1513,7 @@ function splitPair(token) {
|
|
|
1417
1513
|
else if (char === ":" && depth === 0) {
|
|
1418
1514
|
const key = token.slice(0, i).trim();
|
|
1419
1515
|
const value = unquote(token.slice(i + 1).trim());
|
|
1420
|
-
return key && value ? [key, value] : null;
|
|
1516
|
+
return key && (value || key === "split" || key === "values") ? [key, value] : null;
|
|
1421
1517
|
}
|
|
1422
1518
|
}
|
|
1423
1519
|
return null;
|
|
@@ -1480,12 +1576,16 @@ function parseSegment(segment, result) {
|
|
|
1480
1576
|
}
|
|
1481
1577
|
const spec = { name, params: {} };
|
|
1482
1578
|
let timeCount = 0;
|
|
1483
|
-
const sink =
|
|
1579
|
+
const sink = hasGroupTarget(tokens) ? { specs: [], warnings: [] } : null;
|
|
1484
1580
|
for (const raw of tokens) {
|
|
1485
1581
|
const token = classify(raw);
|
|
1486
1582
|
if (token.kind === "time") timeCount = applyTime(spec, token.value, timeCount, result.warnings);
|
|
1487
1583
|
else applyToken(token, spec, { segment, result, sink });
|
|
1488
1584
|
}
|
|
1585
|
+
if (spec.split === "tiles" && spec.params.rows !== void 0) {
|
|
1586
|
+
spec.rows = spec.params.rows;
|
|
1587
|
+
delete spec.params.rows;
|
|
1588
|
+
}
|
|
1489
1589
|
attachSegmentHoists(spec, sink, result);
|
|
1490
1590
|
return spec;
|
|
1491
1591
|
}
|
|
@@ -1495,8 +1595,11 @@ function attachSegmentHoists(spec, sink, result) {
|
|
|
1495
1595
|
const hoists = collectHoists(sink);
|
|
1496
1596
|
if (hoists) spec.hoists = hoists;
|
|
1497
1597
|
}
|
|
1498
|
-
function
|
|
1499
|
-
return tokens.some((
|
|
1598
|
+
function hasGroupTarget(tokens) {
|
|
1599
|
+
return tokens.some((token) => {
|
|
1600
|
+
const pair = splitPair(token);
|
|
1601
|
+
return pair?.[0] === "target" || pair?.[0] === "split" && ["chars", "words", "tiles"].includes(pair[1]);
|
|
1602
|
+
});
|
|
1500
1603
|
}
|
|
1501
1604
|
function collectHoists(sink) {
|
|
1502
1605
|
const hoists = {};
|
|
@@ -1511,8 +1614,10 @@ function collectHoists(sink) {
|
|
|
1511
1614
|
}
|
|
1512
1615
|
var SEGMENT_SCOPABLE_HOISTS = /* @__PURE__ */ new Set([
|
|
1513
1616
|
"on",
|
|
1617
|
+
"via",
|
|
1514
1618
|
"actions",
|
|
1515
1619
|
"timeline",
|
|
1620
|
+
"range",
|
|
1516
1621
|
"threshold",
|
|
1517
1622
|
"cascade",
|
|
1518
1623
|
"spread",
|
|
@@ -1537,6 +1642,11 @@ var GROUP_ONLY_HOISTS = /* @__PURE__ */ new Set([
|
|
|
1537
1642
|
"cols",
|
|
1538
1643
|
"along"
|
|
1539
1644
|
]);
|
|
1645
|
+
function isGroupOnly(parsed) {
|
|
1646
|
+
if (parsed.specs.length > 0) return false;
|
|
1647
|
+
for (const key of GROUP_ONLY_HOISTS) if (Object.hasOwn(parsed, key)) return true;
|
|
1648
|
+
return false;
|
|
1649
|
+
}
|
|
1540
1650
|
function applyTime(spec, value, seen, warnings) {
|
|
1541
1651
|
if (seen === 0) spec.duration = value;
|
|
1542
1652
|
else if (seen === 1) spec.delay = value;
|
|
@@ -1575,6 +1685,11 @@ function applyEasing(value, spec, segment, result) {
|
|
|
1575
1685
|
}
|
|
1576
1686
|
function applyLifted(key, value, spec, context) {
|
|
1577
1687
|
const { segment, result } = context;
|
|
1688
|
+
if (key === "split") {
|
|
1689
|
+
if (value === "chars" || value === "words" || value === "tiles") spec.split = value;
|
|
1690
|
+
else result.warnings.push(`invalid value "${value}" for "split:" \u2014 expected "chars", "words", or "tiles"`);
|
|
1691
|
+
return true;
|
|
1692
|
+
}
|
|
1578
1693
|
if (key === "at") {
|
|
1579
1694
|
if (spec.at !== void 0) result.warnings.push(`duplicate parameter "at" in "${segment}"`);
|
|
1580
1695
|
spec.at = value;
|
|
@@ -1641,9 +1756,15 @@ var HOISTS = {
|
|
|
1641
1756
|
}
|
|
1642
1757
|
assignOnce(result, "activation", value, "activations");
|
|
1643
1758
|
},
|
|
1759
|
+
via(result, value) {
|
|
1760
|
+
assignOnce(result, "via", value, "activation sources");
|
|
1761
|
+
},
|
|
1644
1762
|
timeline(result, value) {
|
|
1645
1763
|
assignOnce(result, "timeline", value, "timelines");
|
|
1646
1764
|
},
|
|
1765
|
+
range(result, value) {
|
|
1766
|
+
assignOnce(result, "range", value, "ranges");
|
|
1767
|
+
},
|
|
1647
1768
|
/**
|
|
1648
1769
|
* What to do at each of a scroll trigger's four crossings —
|
|
1649
1770
|
* `actions:play/pause/resume/reset`, in the order enter, leave, enter-back, leave-back.
|
|
@@ -1667,10 +1788,8 @@ var HOISTS = {
|
|
|
1667
1788
|
assignOnce(result, "threshold", value, "thresholds");
|
|
1668
1789
|
},
|
|
1669
1790
|
/**
|
|
1670
|
-
* Deliberately unvalidated here
|
|
1671
|
-
*
|
|
1672
|
-
* two spellings have to accept the same values or "move it into `data-kui`" would silently be a
|
|
1673
|
-
* narrowing. `stagger.ts` owns the one screen both spellings get.
|
|
1791
|
+
* Deliberately unvalidated here so `var(--speed)` and `calc(90ms * 2)` work.
|
|
1792
|
+
* `stagger-config.ts` screens the step before it reaches `--kui-stagger`.
|
|
1674
1793
|
*/
|
|
1675
1794
|
cascade(result, value) {
|
|
1676
1795
|
warnStepMode(result, "spread", "cascade", value);
|
|
@@ -1713,7 +1832,7 @@ var HOISTS = {
|
|
|
1713
1832
|
* Spelled `along:` rather than GSAP's `axis:` for the same reason `order:` is not `from:`: `axis`
|
|
1714
1833
|
* is a parameter on four primitives (`parallax`, `slat-assemble`, and both draggables) and a
|
|
1715
1834
|
* hoisted key never reaches `spec.params`, so lifting the word element-wide would make
|
|
1716
|
-
* `data-kui="parallax-y axis:x"` unwritable.
|
|
1835
|
+
* `data-kui="parallax-y axis:x"` unwritable.
|
|
1717
1836
|
*/
|
|
1718
1837
|
along(result, value) {
|
|
1719
1838
|
assignOnce(result, "along", value, "stagger axes");
|
|
@@ -1755,8 +1874,31 @@ var HOISTS = {
|
|
|
1755
1874
|
*/
|
|
1756
1875
|
func(result, value) {
|
|
1757
1876
|
assignOnce(result, "func", value, "callbacks");
|
|
1877
|
+
},
|
|
1878
|
+
/**
|
|
1879
|
+
* Replay cadence — `every:2.6s` performs one demonstration step per period while the element is
|
|
1880
|
+
* on screen and nothing pauses it (the runtime lives in `animator.ts`/`cadence.ts`).
|
|
1881
|
+
*
|
|
1882
|
+
* Element-wide always: it is deliberately absent from `SEGMENT_SCOPABLE_HOISTS`, because one
|
|
1883
|
+
* element has one cadence whatever its `target:` groups do — the `rm:`/`func:` rule. Validated
|
|
1884
|
+
* here as a non-negative time token, since the value is only ever a period; the floor that stops
|
|
1885
|
+
* a 50ms loop is a runtime concern and warns there. The word is `every` rather than
|
|
1886
|
+
* `loop`/`interval`/`autoplay`/`pause`/`hold`/`rest` because every one of those is already a
|
|
1887
|
+
* primitive parameter, and a hoisted key never reaches `spec.params` — hoisting one would make
|
|
1888
|
+
* those effects unwritable (the `from:`→`order:` collision above).
|
|
1889
|
+
*/
|
|
1890
|
+
every(result, value) {
|
|
1891
|
+
if (!TIME_RE.test(value) || value.startsWith("-")) {
|
|
1892
|
+
result.warnings.push(`unrecognised "every:${value}" \u2014 expected a positive time such as 2.6s or 900ms`);
|
|
1893
|
+
return;
|
|
1894
|
+
}
|
|
1895
|
+
assignOnce(result, "every", value, "replay cadences");
|
|
1758
1896
|
}
|
|
1759
1897
|
};
|
|
1898
|
+
var ELEMENT_HOIST_KEYS = Object.keys(HOISTS);
|
|
1899
|
+
function tokenKind(token) {
|
|
1900
|
+
return classify(token).kind;
|
|
1901
|
+
}
|
|
1760
1902
|
function warnStepMode(result, other, key, value) {
|
|
1761
1903
|
const written = result[other];
|
|
1762
1904
|
if (written === void 0) return;
|
|
@@ -1838,22 +1980,56 @@ function toAttributeValue(effect, options = {}) {
|
|
|
1838
1980
|
}
|
|
1839
1981
|
return parts.join(" ");
|
|
1840
1982
|
}
|
|
1983
|
+
function mergeAuthoredStep(source, effect, fallback) {
|
|
1984
|
+
const steps = splitTopLevel(source, ",");
|
|
1985
|
+
const step = steps.find((candidate) => splitTopLevel(candidate, " ")[0] === effect);
|
|
1986
|
+
if (!step) return fallback;
|
|
1987
|
+
const [, ...overrides] = splitTopLevel(fallback, " ");
|
|
1988
|
+
if (overrides.length === 0) return steps.length === 1 ? source : step;
|
|
1989
|
+
const [, ...authored] = splitTopLevel(step, " ");
|
|
1990
|
+
const timeSlots = ["duration", "delay"];
|
|
1991
|
+
let overrideTime = 0;
|
|
1992
|
+
const replacements = new Map(overrides.map((token) => {
|
|
1993
|
+
const kind = tokenKind(token);
|
|
1994
|
+
if (kind === "time") return [timeSlots[overrideTime++] ?? Symbol(), token];
|
|
1995
|
+
if (kind === "easing") return ["ease", token];
|
|
1996
|
+
if (kind === "pair") return [token.split(":", 1)[0], token];
|
|
1997
|
+
return [Symbol(), token];
|
|
1998
|
+
}));
|
|
1999
|
+
const overridden = new Set(replacements.keys());
|
|
2000
|
+
const hasDuration = overridden.has("duration") || authored.some((token) => tokenKind(token) === "time");
|
|
2001
|
+
const delay = replacements.get("delay");
|
|
2002
|
+
if (hasDuration && delay?.startsWith("delay:")) replacements.set("delay", delay.slice("delay:".length));
|
|
2003
|
+
let authoredTime = 0;
|
|
2004
|
+
const merged = authored.flatMap((token) => {
|
|
2005
|
+
const kind = tokenKind(token);
|
|
2006
|
+
if (kind === "pair") return overridden.has(token.split(":", 1)[0]) ? [] : [token];
|
|
2007
|
+
let key;
|
|
2008
|
+
if (kind === "time") key = timeSlots[authoredTime++];
|
|
2009
|
+
if (kind === "easing") key = "ease";
|
|
2010
|
+
if (key === void 0 || !overridden.has(key)) return [token];
|
|
2011
|
+
const replacement = replacements.get(key);
|
|
2012
|
+
replacements.delete(key);
|
|
2013
|
+
return replacement === void 0 ? [] : [replacement];
|
|
2014
|
+
});
|
|
2015
|
+
return [effect, ...merged, ...replacements.values()].join(" ");
|
|
2016
|
+
}
|
|
1841
2017
|
function play(request, options = {}) {
|
|
1842
2018
|
const { animator, root, target, effect } = request;
|
|
1843
2019
|
const elements = resolveTargets(target, root);
|
|
1844
2020
|
const stagger = time(options.stagger);
|
|
1845
|
-
const
|
|
2021
|
+
const fallback = toAttributeValue(effect, options);
|
|
1846
2022
|
for (const [index, el] of elements.entries()) {
|
|
1847
2023
|
if (stagger) {
|
|
1848
2024
|
;
|
|
1849
2025
|
el.style.setProperty("--kui-stagger", stagger);
|
|
1850
2026
|
el.style.setProperty("--kui-i", String(index));
|
|
1851
2027
|
}
|
|
1852
|
-
|
|
2028
|
+
const authored = el.getAttribute(ATTR.source);
|
|
2029
|
+
const source = mergeAuthoredStep(authored ?? "", effect, fallback);
|
|
1853
2030
|
if (!el.hasAttribute(ATTR.on)) el.setAttribute(ATTR.on, "manual");
|
|
1854
|
-
el.setAttribute(ATTR.source, source);
|
|
1855
|
-
animator.
|
|
1856
|
-
animator.activate(el);
|
|
2031
|
+
if (source !== authored) el.setAttribute(ATTR.source, source);
|
|
2032
|
+
animator.replay(el);
|
|
1857
2033
|
}
|
|
1858
2034
|
const instancesOf = (el) => [el, ...animator.derivedOf(el)].flatMap((each) => animator.stateOf(each)?.instances ?? []);
|
|
1859
2035
|
const finished = Promise.all(
|
|
@@ -2085,6 +2261,36 @@ function timingContractOf(primitive) {
|
|
|
2085
2261
|
return primitive.prepare ? CONTRACTS.get(primitive.prepare) : void 0;
|
|
2086
2262
|
}
|
|
2087
2263
|
|
|
2264
|
+
// src/core/deck-viewer.ts
|
|
2265
|
+
var provided = null;
|
|
2266
|
+
function provideDeckViewer(viewer) {
|
|
2267
|
+
provided = viewer;
|
|
2268
|
+
}
|
|
2269
|
+
function attachDeckViewer(request) {
|
|
2270
|
+
return provided ? provided(request) : null;
|
|
2271
|
+
}
|
|
2272
|
+
var VIEWER_EVENT = "kui:viewer";
|
|
2273
|
+
function announceViewer(doc, opener, open) {
|
|
2274
|
+
const Ctor = doc.defaultView?.CustomEvent ?? CustomEvent;
|
|
2275
|
+
const source = opener.isConnected ? opener : doc;
|
|
2276
|
+
source.dispatchEvent(new Ctor(VIEWER_EVENT, { bubbles: true, detail: { open } }));
|
|
2277
|
+
}
|
|
2278
|
+
var DECK_LIGHTBOX_PARAM = {
|
|
2279
|
+
type: "keyword",
|
|
2280
|
+
default: "false",
|
|
2281
|
+
cssProperty: "--kui-deck-lightbox",
|
|
2282
|
+
keywords: ["true", "false"]
|
|
2283
|
+
};
|
|
2284
|
+
function deckLightbox(enabled, request, warn) {
|
|
2285
|
+
if (!enabled) return () => {
|
|
2286
|
+
};
|
|
2287
|
+
const release = attachDeckViewer(request);
|
|
2288
|
+
if (release) return release;
|
|
2289
|
+
warn("lightbox:true needs the showcase module (the lightbox gallery), which is not loaded; cards will not open");
|
|
2290
|
+
return () => {
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2088
2294
|
// src/core/params.ts
|
|
2089
2295
|
var DANGEROUS = /[;<]|\/\*|url\s*\(|expression\s*\(|@import|image-set\s*\(/i;
|
|
2090
2296
|
var ABSOLUTE_OR_PROTOCOL_RELATIVE = /^(?:[a-z][a-z0-9+.-]*:|[/\\]{2})/i;
|
|
@@ -2286,13 +2492,14 @@ var EASING_FUNCTION = /^(?:cubic-bezier|steps|linear|spring)\([^()]*\)$/i;
|
|
|
2286
2492
|
var UNION_GRAMMARS = {
|
|
2287
2493
|
"number|percentage": ["number", "percentage"],
|
|
2288
2494
|
"length|percentage": ["length", "percentage"],
|
|
2289
|
-
"angle|keyword": ["angle"]
|
|
2495
|
+
"angle|keyword": ["angle"],
|
|
2496
|
+
"number|keyword": ["number"]
|
|
2290
2497
|
};
|
|
2291
2498
|
function grammarsFor(type) {
|
|
2292
2499
|
return UNION_GRAMMARS[type] ?? [type];
|
|
2293
2500
|
}
|
|
2294
|
-
var CALC_TYPES = /* @__PURE__ */ new Set(["length", "percentage", "number"]);
|
|
2295
|
-
var BOUNDED_TYPES = /* @__PURE__ */ new Set(["number", "number|percentage"]);
|
|
2501
|
+
var CALC_TYPES = /* @__PURE__ */ new Set(["length", "percentage", "number", "angle"]);
|
|
2502
|
+
var BOUNDED_TYPES = /* @__PURE__ */ new Set(["number", "number|percentage", "number|keyword"]);
|
|
2296
2503
|
var CALC_CHARACTER = /^[\d.\s+\-*/%a-z,]$/i;
|
|
2297
2504
|
var CUSTOM_PROPERTY_NAME = /^--[\w-]+$/;
|
|
2298
2505
|
function validate(raw, spec) {
|
|
@@ -2308,7 +2515,7 @@ function validate(raw, spec) {
|
|
|
2308
2515
|
return reject(spec, `not a valid ${describeType(spec)}`);
|
|
2309
2516
|
}
|
|
2310
2517
|
function checkKeywordHalf(value, spec) {
|
|
2311
|
-
if (spec.type !== "keyword" && spec.type !== "angle|keyword") return null;
|
|
2518
|
+
if (spec.type !== "keyword" && spec.type !== "angle|keyword" && spec.type !== "number|keyword") return null;
|
|
2312
2519
|
if (spec.keywords?.includes(value)) return { value, ok: true };
|
|
2313
2520
|
if (spec.type !== "keyword") return null;
|
|
2314
2521
|
return reject(spec, `expected one of ${spec.keywords?.join(", ") || "(none declared)"}`);
|
|
@@ -2364,11 +2571,11 @@ function isAcceptable(value, type) {
|
|
|
2364
2571
|
const grammars = grammarsFor(type);
|
|
2365
2572
|
if (grammars.some((grammar) => PATTERNS[grammar]?.test(value))) return true;
|
|
2366
2573
|
if (!grammars.some((grammar) => CALC_TYPES.has(grammar))) return false;
|
|
2367
|
-
return
|
|
2574
|
+
return (value.startsWith("calc(") || value.startsWith("var(")) && nextCalcToken(value, 0, value.length) === value.length;
|
|
2368
2575
|
}
|
|
2369
2576
|
function describeType(spec) {
|
|
2370
|
-
if (spec.type === "angle|keyword") {
|
|
2371
|
-
return
|
|
2577
|
+
if (spec.type === "angle|keyword" || spec.type === "number|keyword") {
|
|
2578
|
+
return `${spec.type.split("|")[0]} or one of ${spec.keywords?.join(", ") || "(none declared)"}`;
|
|
2372
2579
|
}
|
|
2373
2580
|
return spec.type.replace("|", " or ");
|
|
2374
2581
|
}
|
|
@@ -2381,8 +2588,8 @@ function isSameOriginPath(value) {
|
|
|
2381
2588
|
function checkNumericConstraints(value, spec) {
|
|
2382
2589
|
if (!BOUNDED_TYPES.has(spec.type)) return { value, ok: true };
|
|
2383
2590
|
const numeric = Number(value);
|
|
2384
|
-
|
|
2385
|
-
if (
|
|
2591
|
+
const rejection = checkConcreteNumber(numeric, spec);
|
|
2592
|
+
if (rejection) return rejection;
|
|
2386
2593
|
if (spec.minimum !== void 0 && numeric < spec.minimum) {
|
|
2387
2594
|
return reject(spec, `expected at least ${spec.minimum}`);
|
|
2388
2595
|
}
|
|
@@ -2391,32 +2598,48 @@ function checkNumericConstraints(value, spec) {
|
|
|
2391
2598
|
}
|
|
2392
2599
|
return { value, ok: true };
|
|
2393
2600
|
}
|
|
2601
|
+
function checkConcreteNumber(numeric, spec) {
|
|
2602
|
+
if (spec.finite && !Number.isFinite(numeric)) return reject(spec, "expected a finite number");
|
|
2603
|
+
if (spec.integer && !Number.isInteger(numeric)) return reject(spec, "expected an integer");
|
|
2604
|
+
if (hasUnresolvedBounds(numeric, spec)) {
|
|
2605
|
+
return reject(spec, "expected a number for numeric bounds");
|
|
2606
|
+
}
|
|
2607
|
+
return null;
|
|
2608
|
+
}
|
|
2609
|
+
function hasUnresolvedBounds(numeric, spec) {
|
|
2610
|
+
return Number.isNaN(numeric) && (spec.minimum !== void 0 || spec.maximum !== void 0);
|
|
2611
|
+
}
|
|
2394
2612
|
function reject(spec, reason) {
|
|
2395
2613
|
return { value: spec.default, ok: false, reason };
|
|
2396
2614
|
}
|
|
2397
|
-
function
|
|
2398
|
-
if (!value.startsWith("calc(") || !value.endsWith(")")) return false;
|
|
2399
|
-
const end = value.length - 1;
|
|
2400
|
-
let index = "calc(".length;
|
|
2615
|
+
function consumeCalcBody(value, index, end) {
|
|
2401
2616
|
while (index < end) {
|
|
2617
|
+
if (value[index] === ")") return index + 1;
|
|
2402
2618
|
index = nextCalcToken(value, index, end);
|
|
2403
|
-
if (index < 0) return
|
|
2619
|
+
if (index < 0) return -1;
|
|
2404
2620
|
}
|
|
2405
|
-
return
|
|
2621
|
+
return -1;
|
|
2406
2622
|
}
|
|
2407
2623
|
function nextCalcToken(value, index, end) {
|
|
2408
2624
|
if (value.startsWith("var(", index)) return consumeVar(value, index, end);
|
|
2625
|
+
if (value.startsWith("calc(", index)) {
|
|
2626
|
+
const start = index + "calc(".length;
|
|
2627
|
+
const close = consumeCalcBody(value, start, end);
|
|
2628
|
+
return close > 0 && isWellFormedCalc(value, start, close - 1) ? close : -1;
|
|
2629
|
+
}
|
|
2409
2630
|
return CALC_CHARACTER.test(value[index]) ? index + 1 : -1;
|
|
2410
2631
|
}
|
|
2411
2632
|
function consumeVar(value, start, end) {
|
|
2412
|
-
const
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2633
|
+
const nameStart = start + "var(".length;
|
|
2634
|
+
let index = nameStart;
|
|
2635
|
+
while (index < end && value[index] !== "," && value[index] !== ")") index++;
|
|
2636
|
+
if (index === end || !CUSTOM_PROPERTY_NAME.test(value.slice(nameStart, index).trim())) return -1;
|
|
2637
|
+
if (value[index] === ")") return index + 1;
|
|
2638
|
+
return consumeCalcBody(value, index + 1, end);
|
|
2416
2639
|
}
|
|
2417
|
-
function isWellFormedCalc(value) {
|
|
2418
|
-
|
|
2419
|
-
return
|
|
2640
|
+
function isWellFormedCalc(value, start, end) {
|
|
2641
|
+
while (end > start && /\s/.test(value[end - 1])) end--;
|
|
2642
|
+
return end > start && !/[+\-*/]/.test(value[end - 1]);
|
|
2420
2643
|
}
|
|
2421
2644
|
function resolveParams(authored, schema, warn) {
|
|
2422
2645
|
const out = {};
|
|
@@ -2430,9 +2653,9 @@ function resolveParams(authored, schema, warn) {
|
|
|
2430
2653
|
const result = validate(raw, spec);
|
|
2431
2654
|
if (!result.ok) {
|
|
2432
2655
|
warn(`parameter "${key}": ${result.reason} \u2014 got "${raw}", using default "${spec.default}"`);
|
|
2433
|
-
|
|
2656
|
+
} else if (spec.cssProperty) {
|
|
2657
|
+
out[spec.cssProperty] = cssValueFor(result.value, spec, key, warn);
|
|
2434
2658
|
}
|
|
2435
|
-
out[spec.cssProperty] = cssValueFor(result.value, spec, key, warn);
|
|
2436
2659
|
}
|
|
2437
2660
|
return out;
|
|
2438
2661
|
}
|
|
@@ -2555,223 +2778,398 @@ function readEffectParams(authored, schema, warn, timing = {}) {
|
|
|
2555
2778
|
return createParams(readParams(authored, schema, warn), timing);
|
|
2556
2779
|
}
|
|
2557
2780
|
|
|
2558
|
-
// src/core/
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
};
|
|
2781
|
+
// src/core/stagger-keys.ts
|
|
2782
|
+
var GROUP_KEY_NAMES = ["cascade", "spread", "order", "cols", "along"];
|
|
2783
|
+
function collectKeys(lookup) {
|
|
2784
|
+
const keys = {};
|
|
2785
|
+
for (const name of GROUP_KEY_NAMES) {
|
|
2786
|
+
const value = lookup(name);
|
|
2787
|
+
if (value !== void 0) keys[name] = value;
|
|
2566
2788
|
}
|
|
2567
|
-
return
|
|
2568
|
-
|
|
2569
|
-
|
|
2789
|
+
return Object.keys(keys).length > 0 ? keys : void 0;
|
|
2790
|
+
}
|
|
2791
|
+
function elementStaggerKeys(parsed) {
|
|
2792
|
+
return collectKeys((name) => parsed[name]);
|
|
2793
|
+
}
|
|
2794
|
+
function staggerKeysFor(scoped, elementWide) {
|
|
2795
|
+
return collectKeys((name) => scoped?.[name] ?? elementWide?.[name]);
|
|
2796
|
+
}
|
|
2797
|
+
function isGroupedKeys(keys) {
|
|
2798
|
+
return keys?.cascade !== void 0 || keys?.spread !== void 0 || keys?.order !== void 0;
|
|
2799
|
+
}
|
|
2800
|
+
var TARGET_GROUP_HOSTS = /* @__PURE__ */ new WeakMap();
|
|
2801
|
+
function claimTargetGroupHost(host) {
|
|
2802
|
+
TARGET_GROUP_HOSTS.set(host, (TARGET_GROUP_HOSTS.get(host) ?? 0) + 1);
|
|
2803
|
+
let released = false;
|
|
2804
|
+
return () => {
|
|
2805
|
+
if (released) return;
|
|
2806
|
+
released = true;
|
|
2807
|
+
const remaining = TARGET_GROUP_HOSTS.get(host) - 1;
|
|
2808
|
+
if (remaining > 0) TARGET_GROUP_HOSTS.set(host, remaining);
|
|
2809
|
+
else TARGET_GROUP_HOSTS.delete(host);
|
|
2570
2810
|
};
|
|
2571
2811
|
}
|
|
2572
|
-
function
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2812
|
+
function isTargetGroupHost(el) {
|
|
2813
|
+
return TARGET_GROUP_HOSTS.has(el);
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
// src/core/stagger-config.ts
|
|
2817
|
+
var FROM_KEYWORDS = /* @__PURE__ */ new Set(["start", "end", "center", "edges", "random"]);
|
|
2818
|
+
var AXIS_VALUES = /* @__PURE__ */ new Set(["x", "y"]);
|
|
2819
|
+
var ORIGIN_RE = /^(\d+(?:\.\d+)?|\.\d+)\/(\d+(?:\.\d+)?|\.\d+)$/;
|
|
2820
|
+
var COLS_RE = /^\d{1,9}$/;
|
|
2821
|
+
var INDEX_RE = /^-?\d{1,9}$/;
|
|
2822
|
+
function parseCols(raw, warnings) {
|
|
2823
|
+
const value = raw.trim();
|
|
2824
|
+
if (value === "auto") return "auto";
|
|
2825
|
+
if (COLS_RE.test(value) && Number(value) > 0) return Number(value);
|
|
2826
|
+
warnings.push(`unrecognised "cols:${raw}" \u2014 expected a column count or "auto"`);
|
|
2827
|
+
return void 0;
|
|
2828
|
+
}
|
|
2829
|
+
function parseAxis(raw, warnings) {
|
|
2830
|
+
const value = raw.trim();
|
|
2831
|
+
if (AXIS_VALUES.has(value)) return value;
|
|
2832
|
+
warnings.push(`unrecognised "along:${raw}" \u2014 expected x or y`);
|
|
2833
|
+
return void 0;
|
|
2834
|
+
}
|
|
2835
|
+
function resolveStaggerConfig(source, warnings = []) {
|
|
2836
|
+
return resolveStaggerConfigFrom(inlineGroupKeys(source), warnings);
|
|
2837
|
+
}
|
|
2838
|
+
function resolveStaggerConfigFrom(keys, warnings = []) {
|
|
2839
|
+
if (keys === void 0) return void 0;
|
|
2840
|
+
const config = { from: keys.order === void 0 ? "start" : parseFrom(keys.order, warnings) };
|
|
2841
|
+
if (keepValue("step", keys.cascade, warnings)) config.step = keys.cascade;
|
|
2842
|
+
if (keepValue("spread", keys.spread, warnings)) config.spread = keys.spread;
|
|
2843
|
+
const cols = keys.cols === void 0 ? void 0 : parseCols(keys.cols, warnings);
|
|
2844
|
+
if (cols !== void 0) config.cols = cols;
|
|
2845
|
+
const along = keys.along === void 0 ? void 0 : parseAxis(keys.along, warnings);
|
|
2846
|
+
if (along !== void 0) config.along = along;
|
|
2847
|
+
return oneStepMode(config, warnings);
|
|
2848
|
+
}
|
|
2849
|
+
function oneStepMode(config, warnings) {
|
|
2850
|
+
if (config.spread === void 0 || config.step === void 0) return config;
|
|
2851
|
+
warnings.push(
|
|
2852
|
+
`stagger step "${config.step}" is ignored \u2014 "spread:${config.spread}" already budgets the whole group, and the step is what it divides out`
|
|
2853
|
+
);
|
|
2854
|
+
const budgeted = { ...config };
|
|
2855
|
+
delete budgeted.step;
|
|
2856
|
+
return budgeted;
|
|
2857
|
+
}
|
|
2858
|
+
function inlineGroupKeys(source) {
|
|
2859
|
+
if (!hasGroupKey(source)) return void 0;
|
|
2860
|
+
const { cascade, spread, order, cols, along } = parse(source);
|
|
2861
|
+
const keys = { cascade, spread, order, cols, along };
|
|
2862
|
+
return Object.values(keys).some((value) => value !== void 0) ? keys : void 0;
|
|
2863
|
+
}
|
|
2864
|
+
function keepValue(label, value, warnings) {
|
|
2865
|
+
if (value === void 0) return false;
|
|
2866
|
+
if (isSafeCssValue(value)) return true;
|
|
2867
|
+
warnings.push(`stagger ${label} "${value}" contains disallowed CSS syntax \u2014 ignored`);
|
|
2868
|
+
return false;
|
|
2869
|
+
}
|
|
2870
|
+
function hasGroupKey(source) {
|
|
2871
|
+
return GROUP_KEY_PREFIXES.some((prefix) => source.includes(prefix));
|
|
2872
|
+
}
|
|
2873
|
+
var GROUP_KEY_PREFIXES = [
|
|
2874
|
+
"cascade:",
|
|
2875
|
+
"spread:",
|
|
2876
|
+
"order:",
|
|
2877
|
+
"cols:",
|
|
2878
|
+
"along:"
|
|
2879
|
+
];
|
|
2880
|
+
function parseFrom(raw, warnings) {
|
|
2881
|
+
const value = raw.trim();
|
|
2882
|
+
if (FROM_KEYWORDS.has(value)) return value;
|
|
2883
|
+
if (INDEX_RE.test(value)) return Number(value);
|
|
2884
|
+
const origin = ORIGIN_RE.exec(value);
|
|
2885
|
+
if (origin) return { x: clamp012(Number(origin[1]), value, warnings), y: clamp012(Number(origin[2]), value, warnings) };
|
|
2886
|
+
warnings.push(
|
|
2887
|
+
`unrecognised "order:${raw}" \u2014 expected start, end, center, edges, random, a child index, or an "x/y" point in a grid`
|
|
2888
|
+
);
|
|
2889
|
+
return "start";
|
|
2890
|
+
}
|
|
2891
|
+
function clamp012(value, source, warnings) {
|
|
2892
|
+
if (value >= 0 && value <= 1) return value;
|
|
2893
|
+
warnings.push(`stagger order "${source}" is outside the grid (0 to 1 on each axis) \u2014 clamped`);
|
|
2894
|
+
return Math.min(Math.max(value, 0), 1);
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
// src/core/stagger.ts
|
|
2898
|
+
var RANK_PRECISION = 1e3;
|
|
2899
|
+
var RANDOM_SALT = 2654435761;
|
|
2900
|
+
var COUNT_SALT = 2246822507;
|
|
2901
|
+
var MIX_A = 569420461;
|
|
2902
|
+
var MIX_B = 1935289751;
|
|
2903
|
+
function resolveStep(config, maxRank) {
|
|
2904
|
+
if (config.spread === void 0) return config.step;
|
|
2905
|
+
if (maxRank <= 0) return "0ms";
|
|
2906
|
+
return `calc((${config.spread}) / ${String(maxRank)})`;
|
|
2907
|
+
}
|
|
2908
|
+
function staggerRanks(count, from, warnings = [], layout) {
|
|
2909
|
+
if (count <= 0) return [];
|
|
2910
|
+
if (from === "random") return randomRanks(count);
|
|
2911
|
+
if (layout) return gridRanks(count, from, layout, warnings);
|
|
2912
|
+
if (typeof from === "object") {
|
|
2913
|
+
warnings.push(
|
|
2914
|
+
`stagger order "${String(from.x)}/${String(from.y)}" is a point in a grid, but this group has no "cols:" \u2014 add one, or name an edge with start/end/center/edges`
|
|
2915
|
+
);
|
|
2916
|
+
return staggerRanks(count, "start", warnings);
|
|
2917
|
+
}
|
|
2918
|
+
const last = count - 1;
|
|
2919
|
+
if (from === "edges") {
|
|
2920
|
+
return Array.from({ length: count }, (_, index) => Math.min(index, last - index));
|
|
2921
|
+
}
|
|
2922
|
+
const origin = originOf(from, last, warnings);
|
|
2923
|
+
return Array.from({ length: count }, (_, index) => Math.floor(Math.abs(index - origin)));
|
|
2924
|
+
}
|
|
2925
|
+
function originOf(from, last, warnings) {
|
|
2926
|
+
if (from === "start") return 0;
|
|
2927
|
+
if (from === "end") return last;
|
|
2928
|
+
if (from === "center") return last / 2;
|
|
2929
|
+
return clampIndex(from, last, warnings);
|
|
2930
|
+
}
|
|
2931
|
+
function clampIndex(index, last, warnings) {
|
|
2932
|
+
if (index < 0 || index > last) {
|
|
2933
|
+
warnings.push(`stagger order "${String(index)}" is outside the group (0 to ${String(last)}) \u2014 clamped`);
|
|
2934
|
+
}
|
|
2935
|
+
return Math.min(Math.max(index, 0), last);
|
|
2936
|
+
}
|
|
2937
|
+
function gridRanks(count, from, layout, warnings) {
|
|
2938
|
+
const cols = Math.min(Math.max(1, layout.cols), count);
|
|
2939
|
+
const rows = Math.ceil(count / cols);
|
|
2940
|
+
if (from === "edges") {
|
|
2941
|
+
const inward = gridRanks(count, "center", layout, warnings);
|
|
2942
|
+
let furthest = 0;
|
|
2943
|
+
for (const rank of inward) furthest = Math.max(furthest, rank);
|
|
2944
|
+
return inward.map((rank) => round2(furthest - rank));
|
|
2945
|
+
}
|
|
2946
|
+
const origin = gridOrigin(from, { cols, rows, last: count - 1 }, warnings);
|
|
2947
|
+
return Array.from({ length: count }, (_, index) => {
|
|
2948
|
+
const dx = index % cols - origin.x;
|
|
2949
|
+
const dy = Math.floor(index / cols) - origin.y;
|
|
2950
|
+
if (layout.along === "x") return round2(Math.abs(dx));
|
|
2951
|
+
if (layout.along === "y") return round2(Math.abs(dy));
|
|
2952
|
+
return round2(Math.hypot(dx, dy));
|
|
2953
|
+
});
|
|
2954
|
+
}
|
|
2955
|
+
function gridOrigin(from, grid, warnings) {
|
|
2956
|
+
const { cols, rows, last } = grid;
|
|
2957
|
+
if (typeof from === "object") return { x: from.x * (cols - 1), y: from.y * (rows - 1) };
|
|
2958
|
+
if (from === "start") return { x: 0, y: 0 };
|
|
2959
|
+
if (from === "end") return { x: cols - 1, y: rows - 1 };
|
|
2960
|
+
if (from === "center") return { x: (cols - 1) / 2, y: (rows - 1) / 2 };
|
|
2961
|
+
const index = clampIndex(from, last, warnings);
|
|
2962
|
+
return { x: index % cols, y: Math.floor(index / cols) };
|
|
2963
|
+
}
|
|
2964
|
+
function round2(value) {
|
|
2965
|
+
return Math.round(value * RANK_PRECISION) / RANK_PRECISION;
|
|
2966
|
+
}
|
|
2967
|
+
function randomRanks(count) {
|
|
2968
|
+
const order = Array.from({ length: count }, (_, index) => index);
|
|
2969
|
+
order.sort((a, b) => scatterKey(a, count) - scatterKey(b, count));
|
|
2970
|
+
const ranks = new Array(count);
|
|
2971
|
+
for (const [rank, index] of order.entries()) ranks[index] = rank;
|
|
2972
|
+
return ranks;
|
|
2973
|
+
}
|
|
2974
|
+
function scatterKey(index, count) {
|
|
2975
|
+
let hash = (Math.imul(index, RANDOM_SALT) ^ Math.imul(count, COUNT_SALT)) >>> 0;
|
|
2976
|
+
hash ^= hash >>> 16;
|
|
2977
|
+
hash = Math.imul(hash, MIX_A) >>> 0;
|
|
2978
|
+
hash ^= hash >>> 15;
|
|
2979
|
+
hash = Math.imul(hash, MIX_B) >>> 0;
|
|
2980
|
+
hash ^= hash >>> 15;
|
|
2981
|
+
return hash >>> 0;
|
|
2982
|
+
}
|
|
2983
|
+
function indexStaggerGroup(group, reporter) {
|
|
2984
|
+
const warnings = [];
|
|
2985
|
+
const ledgers = reopenLedger(group);
|
|
2986
|
+
const config = resolveStaggerConfig(group.getAttribute(ATTR.source) ?? "", warnings) ?? { from: "start" };
|
|
2987
|
+
const children = animatedChildren(group);
|
|
2988
|
+
const ranks = staggerRanks(children.length, config.from, warnings, resolveLayout(config, children, warnings));
|
|
2989
|
+
let maxRank = 0;
|
|
2990
|
+
for (const [index, child] of children.entries()) {
|
|
2991
|
+
const rank = ranks[index];
|
|
2992
|
+
ledgers.style(child).set("--kui-i", String(rank));
|
|
2993
|
+
GROUP_OF_CHILD.set(child, group);
|
|
2994
|
+
if (rank > maxRank) maxRank = rank;
|
|
2995
|
+
}
|
|
2996
|
+
const step = resolveStep(config, maxRank);
|
|
2997
|
+
if (step) ledgers.style(group).set("--kui-stagger", step);
|
|
2998
|
+
ledgers.style(group).set("--kui-stagger-count", String(round2(maxRank + 1)));
|
|
2999
|
+
indexNestedStagger(group, { children, ranks, maxRank, ledgers }, reporter);
|
|
3000
|
+
for (const warning of warnings) reporter?.warn(warning, group);
|
|
3001
|
+
}
|
|
3002
|
+
var GROUP_LEDGERS = /* @__PURE__ */ new WeakMap();
|
|
3003
|
+
var NESTED_STAGGER = /* @__PURE__ */ new WeakMap();
|
|
3004
|
+
function indexNestedStagger(group, { children, ranks, maxRank, ledgers }, reporter) {
|
|
3005
|
+
const inherited = NESTED_STAGGER.get(group);
|
|
3006
|
+
const outer = GROUP_LEDGERS.get(group.parentElement) === inherited?.owner ? inherited : void 0;
|
|
3007
|
+
const [base, outerSpan, depth] = outer ? [outer.offset, outer.span, outer.depth + 1] : ["0ms", "0ms", 0];
|
|
3008
|
+
const step = `--kui-stagger-step-${depth}`;
|
|
3009
|
+
const span = `calc(${outerSpan} + ${maxRank} * var(${step}))`;
|
|
3010
|
+
const nestedGroups = new Set([...group.children].filter(declaresGroup));
|
|
3011
|
+
if (!outer && !nestedGroups.size) return;
|
|
3012
|
+
ledgers.style(group).set(step, "var(--kui-stagger, 0ms)");
|
|
3013
|
+
for (const [index, child] of children.entries()) {
|
|
3014
|
+
const nested = nestedGroups.has(child);
|
|
3015
|
+
if (!outer && !nested) continue;
|
|
3016
|
+
const offset = `calc(${base} + ${ranks[index]} * var(${step}))`;
|
|
3017
|
+
ledgers.style(child).set("--kui-stagger-offset", offset);
|
|
3018
|
+
ledgers.style(child).set("--kui-stagger-span", span);
|
|
3019
|
+
NESTED_STAGGER.set(child, { owner: ledgers, depth, offset, span });
|
|
3020
|
+
}
|
|
3021
|
+
for (const nested of nestedGroups) indexStaggerGroup(nested, reporter);
|
|
3022
|
+
}
|
|
3023
|
+
var GROUP_OF_CHILD = /* @__PURE__ */ new WeakMap();
|
|
3024
|
+
function restageAfterRemoval(removed, reporter) {
|
|
3025
|
+
const groups = /* @__PURE__ */ new Set();
|
|
3026
|
+
for (const el of removed) {
|
|
3027
|
+
const group = GROUP_OF_CHILD.get(el);
|
|
3028
|
+
if (group) groups.add(group);
|
|
3029
|
+
}
|
|
3030
|
+
for (const group of groups) restageOne(group, reporter);
|
|
3031
|
+
}
|
|
3032
|
+
function reopenLedger(group) {
|
|
3033
|
+
GROUP_LEDGERS.get(group)?.restore();
|
|
3034
|
+
const ledgers = createLedgerSet(group);
|
|
3035
|
+
GROUP_LEDGERS.set(group, ledgers);
|
|
3036
|
+
return ledgers;
|
|
3037
|
+
}
|
|
3038
|
+
function releaseStaggerGroup(group) {
|
|
3039
|
+
GROUP_LEDGERS.get(group)?.restore();
|
|
3040
|
+
GROUP_LEDGERS.delete(group);
|
|
3041
|
+
}
|
|
3042
|
+
function releaseStagger(root) {
|
|
3043
|
+
const selector = `[${ATTR.source}]`;
|
|
3044
|
+
if (root instanceof Element && root.matches(selector)) releaseStaggerGroup(root);
|
|
3045
|
+
for (const el of root.querySelectorAll(selector)) releaseStaggerGroup(el);
|
|
3046
|
+
}
|
|
3047
|
+
function restageAround(el, reporter) {
|
|
3048
|
+
const parent = el.parentElement;
|
|
3049
|
+
const parentIsGroup = parent !== null && declaresGroup(parent);
|
|
3050
|
+
if (parent) restageOne(parent, reporter);
|
|
3051
|
+
if (declaresGroup(el)) {
|
|
3052
|
+
if (!parentIsGroup) indexStaggerGroup(el, reporter);
|
|
3053
|
+
return;
|
|
2581
3054
|
}
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
3055
|
+
releaseStaggerGroup(el);
|
|
3056
|
+
const nested = [...el.children].filter((child) => NESTED_STAGGER.has(child) && declaresGroup(child));
|
|
3057
|
+
for (const child of nested) indexStaggerGroup(child, reporter);
|
|
3058
|
+
}
|
|
3059
|
+
function restageOne(el, reporter) {
|
|
3060
|
+
if (declaresGroup(el)) indexStaggerGroup(el, reporter);
|
|
3061
|
+
else releaseStaggerGroup(el);
|
|
3062
|
+
}
|
|
3063
|
+
function indexTargetGroup(request) {
|
|
3064
|
+
const { host, splitLayer, matches, styleOf, keys, reporter } = request;
|
|
3065
|
+
const warnings = [];
|
|
3066
|
+
const config = (keys ? resolveStaggerConfigFrom(keys, warnings) : resolveStaggerConfig(host.getAttribute(ATTR.source) ?? "", warnings)) ?? { from: "start" };
|
|
3067
|
+
const buckets = splitLayer || config.cols === void 0 ? [matches] : bucketByParent(matches).values();
|
|
3068
|
+
const maxRank = rankBuckets(buckets, config, styleOf, warnings);
|
|
3069
|
+
const timing = styleOf(splitLayer ?? host);
|
|
3070
|
+
const step = resolveStep(config, maxRank);
|
|
3071
|
+
if (step) timing.set("--kui-stagger", step);
|
|
3072
|
+
timing.set("--kui-stagger-count", String(round2(maxRank + 1)));
|
|
3073
|
+
for (const warning of warnings) reporter?.warn(warning, host);
|
|
3074
|
+
}
|
|
3075
|
+
function bucketByParent(matches) {
|
|
3076
|
+
const byParent = /* @__PURE__ */ new Map();
|
|
3077
|
+
for (const match of matches) {
|
|
3078
|
+
const siblings = byParent.get(match.parentElement);
|
|
3079
|
+
if (siblings) siblings.push(match);
|
|
3080
|
+
else byParent.set(match.parentElement, [match]);
|
|
3081
|
+
}
|
|
3082
|
+
return byParent;
|
|
3083
|
+
}
|
|
3084
|
+
function rankBuckets(buckets, config, styleOf, warnings) {
|
|
3085
|
+
let maxRank = 0;
|
|
3086
|
+
for (const siblings of buckets) {
|
|
3087
|
+
const layout = resolveLayout(config, siblings, warnings);
|
|
3088
|
+
const ranks = staggerRanks(siblings.length, config.from, warnings, layout);
|
|
3089
|
+
for (const [index, match] of siblings.entries()) {
|
|
3090
|
+
const rank = ranks[index];
|
|
3091
|
+
styleOf(match).set("--kui-i", String(rank));
|
|
3092
|
+
if (rank > maxRank) maxRank = rank;
|
|
2589
3093
|
}
|
|
2590
3094
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
3095
|
+
return maxRank;
|
|
3096
|
+
}
|
|
3097
|
+
function resolveLayout(config, members, warnings) {
|
|
3098
|
+
if (config.cols === void 0) {
|
|
3099
|
+
if (config.along !== void 0) {
|
|
3100
|
+
warnings.push(
|
|
3101
|
+
`"along:${config.along}" names an axis of a grid this group has not declared \u2014 add "cols:" (a column count, or "auto")`
|
|
3102
|
+
);
|
|
3103
|
+
}
|
|
3104
|
+
return void 0;
|
|
3105
|
+
}
|
|
3106
|
+
const cols = config.cols === "auto" ? measureColumns(members, warnings) : config.cols;
|
|
3107
|
+
if (cols === void 0) return void 0;
|
|
3108
|
+
return config.along === void 0 ? { cols } : { cols, along: config.along };
|
|
3109
|
+
}
|
|
3110
|
+
function measureColumns(members, warnings) {
|
|
3111
|
+
if (members.length < 2) return 1;
|
|
3112
|
+
const lefts = [];
|
|
3113
|
+
let laidOut = false;
|
|
3114
|
+
for (const member of members) {
|
|
3115
|
+
const box = member.getBoundingClientRect();
|
|
3116
|
+
if (box.width !== 0 || box.height !== 0) laidOut = true;
|
|
3117
|
+
lefts.push(box.left);
|
|
3118
|
+
}
|
|
3119
|
+
if (!laidOut) {
|
|
3120
|
+
warnings.push(
|
|
3121
|
+
`"cols:auto" could not measure this group \u2014 none of its children have been laid out yet (display:none, or detached), so the stagger falls back to DOM order`
|
|
2601
3122
|
);
|
|
2602
|
-
|
|
2603
|
-
return entry;
|
|
3123
|
+
return void 0;
|
|
2604
3124
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
3125
|
+
const direction = Math.sign(lefts[1] - lefts[0]);
|
|
3126
|
+
if (direction === 0) return 1;
|
|
3127
|
+
let cols = 1;
|
|
3128
|
+
for (let index = 1; index < lefts.length; index++) {
|
|
3129
|
+
if (Math.sign(lefts[index] - lefts[index - 1]) !== direction) break;
|
|
3130
|
+
cols = index + 1;
|
|
2609
3131
|
}
|
|
2610
|
-
return
|
|
2611
|
-
subscribe(root, onFrame) {
|
|
2612
|
-
const entry = attach(root);
|
|
2613
|
-
entry.subscribers.add(onFrame);
|
|
2614
|
-
schedule(entry);
|
|
2615
|
-
return () => {
|
|
2616
|
-
entry.subscribers.delete(onFrame);
|
|
2617
|
-
release(entry);
|
|
2618
|
-
};
|
|
2619
|
-
},
|
|
2620
|
-
invalidate() {
|
|
2621
|
-
epoch++;
|
|
2622
|
-
schedule();
|
|
2623
|
-
},
|
|
2624
|
-
rootCount: () => entries.size,
|
|
2625
|
-
destroy() {
|
|
2626
|
-
if (pending !== null) deps.cancelFrame(pending);
|
|
2627
|
-
pending = null;
|
|
2628
|
-
for (const entry of entries.values()) {
|
|
2629
|
-
entry.subscribers.clear();
|
|
2630
|
-
for (const detach of entry.detach) detach();
|
|
2631
|
-
}
|
|
2632
|
-
entries.clear();
|
|
2633
|
-
}
|
|
2634
|
-
};
|
|
3132
|
+
return cols;
|
|
2635
3133
|
}
|
|
2636
|
-
function
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
viewportTop: 0,
|
|
2645
|
-
viewportLeft: 0
|
|
2646
|
-
}),
|
|
2647
|
-
onScroll: (handler) => listen(win, "scroll", handler),
|
|
2648
|
-
/*
|
|
2649
|
-
* The document's own height counts as a resize, not just the window's.
|
|
2650
|
-
*
|
|
2651
|
-
* `elementScrollRoot` has observed its element's size since it was written, for the reason
|
|
2652
|
-
* stated three doc comments down: "images loading, fonts swapping, a container changing size,
|
|
2653
|
-
* or content being inserted". Every one of those applies at least as strongly to the page
|
|
2654
|
-
* itself, and the page root was the one that only listened for `window.resize` — so on any
|
|
2655
|
-
* document with lazy-loaded media below the fold, every cached content offset silently drifted
|
|
2656
|
-
* by however much the page grew after it was measured, with no epoch bump to correct it.
|
|
2657
|
-
*
|
|
2658
|
-
* Measured on `demo/scroll.html` (32,000px of lazy screenshots): the horizontal track's stage
|
|
2659
|
-
* moved ~840px between page load and reaching it, which is a third of that effect's whole
|
|
2660
|
-
* scroll range. Nothing was wrong with the maths; the number it was doing the maths on was
|
|
2661
|
-
* taken before forty images existed.
|
|
2662
|
-
*/
|
|
2663
|
-
onResize: (handler) => observeSize(win.document.documentElement, win, handler)
|
|
2664
|
-
};
|
|
3134
|
+
function animatedChildren(group) {
|
|
3135
|
+
const children = [];
|
|
3136
|
+
for (const child of group.children) {
|
|
3137
|
+
const source = child.getAttribute(ATTR.source);
|
|
3138
|
+
if (source === null || hasGroupKey(source) && isGroupOnly(parse(source))) continue;
|
|
3139
|
+
children.push(child);
|
|
3140
|
+
}
|
|
3141
|
+
return children;
|
|
2665
3142
|
}
|
|
2666
|
-
function
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
viewportWidth: el.clientWidth,
|
|
2675
|
-
viewportHeight: el.clientHeight,
|
|
2676
|
-
viewportTop: rect.top,
|
|
2677
|
-
viewportLeft: rect.left
|
|
2678
|
-
};
|
|
2679
|
-
},
|
|
2680
|
-
onScroll: (handler) => listen(el, "scroll", handler),
|
|
2681
|
-
// Window resize alone misses the cases that actually invalidate a nested scroller: images
|
|
2682
|
-
// loading, fonts swapping, a container changing size, or content being inserted.
|
|
2683
|
-
onResize: (handler) => observeSize(el, win, handler)
|
|
2684
|
-
};
|
|
3143
|
+
function applyStagger(root, reporter) {
|
|
3144
|
+
const selector = `[${ATTR.source}]`;
|
|
3145
|
+
if (root instanceof Element && root.matches(selector)) restageOne(root, reporter);
|
|
3146
|
+
for (const group of root.querySelectorAll(selector)) {
|
|
3147
|
+
const parent = group.parentElement;
|
|
3148
|
+
if (parent && root.contains(parent) && declaresGroup(parent) && declaresGroup(group)) continue;
|
|
3149
|
+
restageOne(group, reporter);
|
|
3150
|
+
}
|
|
2685
3151
|
}
|
|
2686
|
-
function
|
|
2687
|
-
|
|
2688
|
-
|
|
3152
|
+
function declaresGroup(el) {
|
|
3153
|
+
if (el.hasAttribute(ATTR.define)) return false;
|
|
3154
|
+
if (isTargetGroupHost(el)) return false;
|
|
3155
|
+
return resolveStaggerConfig(el.getAttribute(ATTR.source) ?? "") !== void 0;
|
|
2689
3156
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
3157
|
+
|
|
3158
|
+
// src/core/time-scale.ts
|
|
3159
|
+
var TIME_SCALE_ATTR = "data-kui-time-scale";
|
|
3160
|
+
function timeScaleOf(el) {
|
|
3161
|
+
const host = el.closest(`[${TIME_SCALE_ATTR}]`);
|
|
3162
|
+
const value = host?.getAttribute(TIME_SCALE_ATTR)?.trim();
|
|
3163
|
+
if (!value) return 1;
|
|
3164
|
+
const parsed = Number(value);
|
|
3165
|
+
if (!Number.isFinite(parsed)) return 1;
|
|
3166
|
+
return Math.min(4, Math.max(0.05, parsed));
|
|
2699
3167
|
}
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
function
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2705
|
-
const id = String(++nextRootId);
|
|
2706
|
-
rootIds.set(el, id);
|
|
2707
|
-
return id;
|
|
2708
|
-
}
|
|
2709
|
-
function createRootResolver(options) {
|
|
2710
|
-
const { win } = options;
|
|
2711
|
-
const isScrollable = options.isScrollable ?? defaultIsScrollable(win);
|
|
2712
|
-
const windowRoot = windowScrollRoot(win);
|
|
2713
|
-
return (el) => {
|
|
2714
|
-
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
2715
|
-
if (scrollsTheViewport(node, win)) return windowRoot;
|
|
2716
|
-
if (isScrollable(node)) return elementScrollRoot(node, win);
|
|
2717
|
-
}
|
|
2718
|
-
return windowRoot;
|
|
2719
|
-
};
|
|
2720
|
-
}
|
|
2721
|
-
function scrollsTheViewport(node, win) {
|
|
2722
|
-
const root = win.document.documentElement;
|
|
2723
|
-
if (node === root) return true;
|
|
2724
|
-
if (node !== win.document.body) return false;
|
|
2725
|
-
const rootStyle = win.getComputedStyle(root);
|
|
2726
|
-
return !CLIPPING_OVERFLOW.has(rootStyle.overflowX) && !CLIPPING_OVERFLOW.has(rootStyle.overflowY);
|
|
2727
|
-
}
|
|
2728
|
-
var CLIPPING_OVERFLOW = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
|
|
2729
|
-
var SCROLLABLE_OVERFLOW = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
2730
|
-
function defaultIsScrollable(win) {
|
|
2731
|
-
return (el) => {
|
|
2732
|
-
const style = win.getComputedStyle(el);
|
|
2733
|
-
const vertical = SCROLLABLE_OVERFLOW.has(style.overflowY) && el.scrollHeight > el.clientHeight;
|
|
2734
|
-
const horizontal = SCROLLABLE_OVERFLOW.has(style.overflowX) && el.scrollWidth > el.clientWidth;
|
|
2735
|
-
return vertical || horizontal;
|
|
2736
|
-
};
|
|
2737
|
-
}
|
|
2738
|
-
function clamp012(value) {
|
|
2739
|
-
if (Number.isNaN(value)) return 0;
|
|
2740
|
-
return Math.min(1, Math.max(0, value));
|
|
2741
|
-
}
|
|
2742
|
-
function createMeasureCache(measure) {
|
|
2743
|
-
let cachedEpoch = -1;
|
|
2744
|
-
let cached;
|
|
2745
|
-
return {
|
|
2746
|
-
read(epoch) {
|
|
2747
|
-
if (cachedEpoch !== epoch || cached === void 0) {
|
|
2748
|
-
cached = measure();
|
|
2749
|
-
cachedEpoch = epoch;
|
|
2750
|
-
}
|
|
2751
|
-
return cached;
|
|
2752
|
-
},
|
|
2753
|
-
clear() {
|
|
2754
|
-
cachedEpoch = -1;
|
|
2755
|
-
cached = void 0;
|
|
2756
|
-
}
|
|
2757
|
-
};
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
// src/core/time-scale.ts
|
|
2761
|
-
var TIME_SCALE_ATTR = "data-kui-time-scale";
|
|
2762
|
-
function timeScaleOf(el) {
|
|
2763
|
-
const host = el.closest(`[${TIME_SCALE_ATTR}]`);
|
|
2764
|
-
const value = host?.getAttribute(TIME_SCALE_ATTR)?.trim();
|
|
2765
|
-
if (!value) return 1;
|
|
2766
|
-
const parsed = Number(value);
|
|
2767
|
-
if (!Number.isFinite(parsed)) return 1;
|
|
2768
|
-
return Math.min(4, Math.max(0.05, parsed));
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
// src/core/instances.ts
|
|
2772
|
-
function animationsOf(el) {
|
|
2773
|
-
const getAnimations = el.getAnimations;
|
|
2774
|
-
return typeof getAnimations === "function" ? getAnimations.call(el) : [];
|
|
3168
|
+
|
|
3169
|
+
// src/core/instances.ts
|
|
3170
|
+
function animationsOf(el) {
|
|
3171
|
+
const getAnimations = el.getAnimations;
|
|
3172
|
+
return typeof getAnimations === "function" ? getAnimations.call(el) : [];
|
|
2775
3173
|
}
|
|
2776
3174
|
function ownedAnimationsOf(el, names) {
|
|
2777
3175
|
return animationsOf(el).filter((animation) => {
|
|
@@ -2795,18 +3193,18 @@ function watchCompletion(animations, settle) {
|
|
|
2795
3193
|
}
|
|
2796
3194
|
void Promise.all(animations.map((a) => a.finished.catch(() => void 0))).then(() => settle());
|
|
2797
3195
|
}
|
|
2798
|
-
function startCssAnimations(el, ledger, ownedNames,
|
|
2799
|
-
|
|
2800
|
-
if (!activatedBefore) {
|
|
3196
|
+
function startCssAnimations(el, ledger, ownedNames, restart) {
|
|
3197
|
+
if (restart) {
|
|
2801
3198
|
restartCssAnimation(el, ledger);
|
|
2802
3199
|
ledger.set("animation-play-state", "running");
|
|
2803
|
-
|
|
3200
|
+
const animations2 = ownedAnimationsOf(el, ownedNames);
|
|
2804
3201
|
const scale = timeScaleOf(el);
|
|
2805
3202
|
if (scale !== 1) {
|
|
2806
|
-
for (const animation of
|
|
3203
|
+
for (const animation of animations2) animation.playbackRate = scale;
|
|
2807
3204
|
}
|
|
2808
|
-
return
|
|
3205
|
+
return animations2;
|
|
2809
3206
|
}
|
|
3207
|
+
const animations = ownedAnimationsOf(el, ownedNames);
|
|
2810
3208
|
const stale = animations.filter((animation) => animation.playState === "finished");
|
|
2811
3209
|
if (stale.length > 0) {
|
|
2812
3210
|
for (const animation of stale) animation.reverse();
|
|
@@ -2815,7 +3213,8 @@ function startCssAnimations(el, ledger, ownedNames, activatedBefore) {
|
|
|
2815
3213
|
}
|
|
2816
3214
|
return animations;
|
|
2817
3215
|
}
|
|
2818
|
-
function createCssInstance(el, ledger, animationNames,
|
|
3216
|
+
function createCssInstance(el, ledger, animationNames, mode = false, repeatDelays) {
|
|
3217
|
+
const scrubbed = mode === true;
|
|
2819
3218
|
const ownedNames = new Set(animationNames);
|
|
2820
3219
|
let settle;
|
|
2821
3220
|
let finished = new Promise((resolve) => {
|
|
@@ -2823,6 +3222,33 @@ function createCssInstance(el, ledger, animationNames, scrubbed = false) {
|
|
|
2823
3222
|
});
|
|
2824
3223
|
let activatedBefore = false;
|
|
2825
3224
|
const watch = (animations) => watchCompletion(animations, () => settle?.());
|
|
3225
|
+
const gaps = repeatDelays && { tracks: repeatDelays, timed: /* @__PURE__ */ new WeakSet() };
|
|
3226
|
+
function applyRepeatDelays(animations) {
|
|
3227
|
+
if (!gaps || animations.every((animation) => gaps.timed.has(animation))) return;
|
|
3228
|
+
const names = flushComputedAnimationName(el).split(",").map((name) => name.trim());
|
|
3229
|
+
const indices = /* @__PURE__ */ new Map();
|
|
3230
|
+
for (const animation of animations) {
|
|
3231
|
+
const name = animation.animationName;
|
|
3232
|
+
const index = names.indexOf(name, indices.get(name) ?? 0);
|
|
3233
|
+
indices.set(name, index + 1);
|
|
3234
|
+
const gap = gaps.tracks.get(index);
|
|
3235
|
+
if (gap === void 0 || gaps.timed.has(animation)) continue;
|
|
3236
|
+
const effect = animation.effect;
|
|
3237
|
+
if (!effect) continue;
|
|
3238
|
+
const { duration, iterations, direction } = effect.getTiming();
|
|
3239
|
+
if (typeof duration !== "number" || iterations <= 1) continue;
|
|
3240
|
+
const cycle = duration + gap;
|
|
3241
|
+
const lead = Number(direction === "alternate") * (gap / 2);
|
|
3242
|
+
effect.updateTiming({
|
|
3243
|
+
duration: cycle,
|
|
3244
|
+
iterationStart: lead / cycle,
|
|
3245
|
+
iterations: iterations - gap / cycle,
|
|
3246
|
+
easing: `linear(0 0% ${100 * (lead / cycle)}%, 1 ${100 * ((lead + duration) / cycle)}% 100%)`
|
|
3247
|
+
});
|
|
3248
|
+
gaps.timed.add(animation);
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
if (gaps) applyRepeatDelays(ownedAnimationsOf(el, ownedNames));
|
|
2826
3252
|
function drive(rate) {
|
|
2827
3253
|
if (scrubbed) return;
|
|
2828
3254
|
const animations = ownedAnimationsOf(el, ownedNames);
|
|
@@ -2851,7 +3277,8 @@ function createCssInstance(el, ledger, animationNames, scrubbed = false) {
|
|
|
2851
3277
|
settle?.();
|
|
2852
3278
|
return;
|
|
2853
3279
|
}
|
|
2854
|
-
const animations = startCssAnimations(el, ledger, ownedNames, activatedBefore);
|
|
3280
|
+
const animations = startCssAnimations(el, ledger, ownedNames, !activatedBefore || mode === "restart");
|
|
3281
|
+
applyRepeatDelays(animations);
|
|
2855
3282
|
activatedBefore = true;
|
|
2856
3283
|
watch(animations);
|
|
2857
3284
|
},
|
|
@@ -2888,6 +3315,7 @@ function deferredInstance(setup) {
|
|
|
2888
3315
|
let running;
|
|
2889
3316
|
let settle;
|
|
2890
3317
|
let finished = Promise.resolve();
|
|
3318
|
+
let finite = false;
|
|
2891
3319
|
const teardown = () => {
|
|
2892
3320
|
cleanupOf(running)?.();
|
|
2893
3321
|
running = void 0;
|
|
@@ -2897,12 +3325,14 @@ function deferredInstance(setup) {
|
|
|
2897
3325
|
activate() {
|
|
2898
3326
|
if (running !== void 0) teardown();
|
|
2899
3327
|
running = setup();
|
|
3328
|
+
finite = typeof running === "object" && "finished" in running;
|
|
2900
3329
|
if (typeof running === "function" || "continuous" in running) return;
|
|
2901
3330
|
const work = running.finished;
|
|
2902
|
-
finished = new Promise((
|
|
2903
|
-
settle =
|
|
3331
|
+
finished = new Promise((resolve2) => {
|
|
3332
|
+
settle = resolve2;
|
|
2904
3333
|
});
|
|
2905
|
-
|
|
3334
|
+
const resolve = settle;
|
|
3335
|
+
void work.then(() => resolve?.());
|
|
2906
3336
|
},
|
|
2907
3337
|
cancel: teardown,
|
|
2908
3338
|
finish() {
|
|
@@ -2913,7 +3343,8 @@ function deferredInstance(setup) {
|
|
|
2913
3343
|
finished: () => finished,
|
|
2914
3344
|
// Only an explicit marker counts. A bare `Cleanup` deliberately does not — see
|
|
2915
3345
|
// `ContinuousSetup` above for why the two cannot be told apart by shape.
|
|
2916
|
-
continuous: () => typeof running === "object" && "continuous" in running
|
|
3346
|
+
continuous: () => typeof running === "object" && "continuous" in running,
|
|
3347
|
+
finite: () => finite
|
|
2917
3348
|
});
|
|
2918
3349
|
}
|
|
2919
3350
|
function deferPrepare(setup) {
|
|
@@ -2946,12 +3377,510 @@ function createJsInstance(hooks) {
|
|
|
2946
3377
|
get continuous() {
|
|
2947
3378
|
return hooks.continuous?.() ?? false;
|
|
2948
3379
|
},
|
|
3380
|
+
get finite() {
|
|
3381
|
+
return hooks.finite?.();
|
|
3382
|
+
},
|
|
2949
3383
|
destroy() {
|
|
2950
3384
|
active = false;
|
|
2951
3385
|
hooks.destroy();
|
|
2952
3386
|
}
|
|
2953
3387
|
};
|
|
2954
3388
|
}
|
|
3389
|
+
function nextFrame(win, fn) {
|
|
3390
|
+
if (typeof win.requestAnimationFrame === "function") {
|
|
3391
|
+
const id2 = win.requestAnimationFrame(fn);
|
|
3392
|
+
return { cancel: () => win.cancelAnimationFrame?.(id2) };
|
|
3393
|
+
}
|
|
3394
|
+
const id = setTimeout(fn, 16);
|
|
3395
|
+
return { cancel: () => clearTimeout(id) };
|
|
3396
|
+
}
|
|
3397
|
+
function repeatedInstance(inner, repeat, win) {
|
|
3398
|
+
const total = isInfiniteRepeat(repeat) ? Infinity : Number(repeat);
|
|
3399
|
+
let generation = 0;
|
|
3400
|
+
let stopped = true;
|
|
3401
|
+
let pending;
|
|
3402
|
+
let finished = Promise.resolve();
|
|
3403
|
+
let settle;
|
|
3404
|
+
const halt = () => {
|
|
3405
|
+
generation++;
|
|
3406
|
+
pending?.cancel();
|
|
3407
|
+
pending = void 0;
|
|
3408
|
+
};
|
|
3409
|
+
const stop = () => {
|
|
3410
|
+
stopped = true;
|
|
3411
|
+
halt();
|
|
3412
|
+
settle?.();
|
|
3413
|
+
};
|
|
3414
|
+
const run = (done, gen) => {
|
|
3415
|
+
inner.activate();
|
|
3416
|
+
void inner.finished.then(() => {
|
|
3417
|
+
if (gen !== generation || stopped) return;
|
|
3418
|
+
if (inner.finite !== true || done + 1 >= total) return stop();
|
|
3419
|
+
pending = nextFrame(win, () => {
|
|
3420
|
+
pending = void 0;
|
|
3421
|
+
if (gen === generation && !stopped) run(done + 1, gen);
|
|
3422
|
+
});
|
|
3423
|
+
});
|
|
3424
|
+
};
|
|
3425
|
+
return {
|
|
3426
|
+
activate() {
|
|
3427
|
+
halt();
|
|
3428
|
+
if (!stopped) inner.cancel();
|
|
3429
|
+
settle?.();
|
|
3430
|
+
stopped = false;
|
|
3431
|
+
finished = new Promise((resolve) => {
|
|
3432
|
+
settle = resolve;
|
|
3433
|
+
});
|
|
3434
|
+
run(0, generation);
|
|
3435
|
+
},
|
|
3436
|
+
cancel: () => {
|
|
3437
|
+
stop();
|
|
3438
|
+
inner.cancel();
|
|
3439
|
+
},
|
|
3440
|
+
finish: () => {
|
|
3441
|
+
stop();
|
|
3442
|
+
inner.finish();
|
|
3443
|
+
},
|
|
3444
|
+
destroy: () => {
|
|
3445
|
+
stop();
|
|
3446
|
+
inner.destroy();
|
|
3447
|
+
},
|
|
3448
|
+
get finished() {
|
|
3449
|
+
return finished;
|
|
3450
|
+
},
|
|
3451
|
+
get continuous() {
|
|
3452
|
+
return inner.continuous;
|
|
3453
|
+
},
|
|
3454
|
+
get finite() {
|
|
3455
|
+
return inner.finite;
|
|
3456
|
+
},
|
|
3457
|
+
replaceOnActivate: inner.replaceOnActivate
|
|
3458
|
+
};
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
// src/core/scroll-scheduler.ts
|
|
3462
|
+
function defaultDeps() {
|
|
3463
|
+
const raf = globalThis.requestAnimationFrame;
|
|
3464
|
+
if (typeof raf !== "function") {
|
|
3465
|
+
return {
|
|
3466
|
+
requestFrame: (callback) => globalThis.setTimeout(callback, 16),
|
|
3467
|
+
cancelFrame: (handle) => globalThis.clearTimeout(handle)
|
|
3468
|
+
};
|
|
3469
|
+
}
|
|
3470
|
+
return {
|
|
3471
|
+
requestFrame: (callback) => raf(callback),
|
|
3472
|
+
cancelFrame: (handle) => globalThis.cancelAnimationFrame(handle)
|
|
3473
|
+
};
|
|
3474
|
+
}
|
|
3475
|
+
function createScrollScheduler(deps = defaultDeps()) {
|
|
3476
|
+
const entries = /* @__PURE__ */ new Map();
|
|
3477
|
+
let epoch = 0;
|
|
3478
|
+
let pending = null;
|
|
3479
|
+
function schedule(entry) {
|
|
3480
|
+
if (entry) entry.dirty = true;
|
|
3481
|
+
else for (const other of entries.values()) other.dirty = true;
|
|
3482
|
+
if (pending !== null) return;
|
|
3483
|
+
pending = deps.requestFrame(runFrame);
|
|
3484
|
+
}
|
|
3485
|
+
function runFrame() {
|
|
3486
|
+
pending = null;
|
|
3487
|
+
for (const entry of entries.values()) {
|
|
3488
|
+
if (!entry.dirty || entry.subscribers.size === 0) continue;
|
|
3489
|
+
entry.dirty = false;
|
|
3490
|
+
const frame = { metrics: entry.root.metrics(), epoch };
|
|
3491
|
+
for (const subscriber of [...entry.subscribers]) subscriber(frame);
|
|
3492
|
+
}
|
|
3493
|
+
}
|
|
3494
|
+
function attach(root) {
|
|
3495
|
+
const existing = entries.get(root.key);
|
|
3496
|
+
if (existing) return existing;
|
|
3497
|
+
const entry = { root, subscribers: /* @__PURE__ */ new Set(), detach: [], dirty: false };
|
|
3498
|
+
entry.detach.push(root.onScroll(() => schedule(entry)));
|
|
3499
|
+
entry.detach.push(
|
|
3500
|
+
root.onResize(() => {
|
|
3501
|
+
epoch++;
|
|
3502
|
+
schedule();
|
|
3503
|
+
})
|
|
3504
|
+
);
|
|
3505
|
+
entries.set(root.key, entry);
|
|
3506
|
+
return entry;
|
|
3507
|
+
}
|
|
3508
|
+
function release(entry) {
|
|
3509
|
+
if (entry.subscribers.size > 0) return;
|
|
3510
|
+
for (const detach of entry.detach) detach();
|
|
3511
|
+
entries.delete(entry.root.key);
|
|
3512
|
+
}
|
|
3513
|
+
return {
|
|
3514
|
+
subscribe(root, onFrame) {
|
|
3515
|
+
const entry = attach(root);
|
|
3516
|
+
entry.subscribers.add(onFrame);
|
|
3517
|
+
schedule(entry);
|
|
3518
|
+
return () => {
|
|
3519
|
+
entry.subscribers.delete(onFrame);
|
|
3520
|
+
release(entry);
|
|
3521
|
+
};
|
|
3522
|
+
},
|
|
3523
|
+
invalidate() {
|
|
3524
|
+
epoch++;
|
|
3525
|
+
schedule();
|
|
3526
|
+
},
|
|
3527
|
+
rootCount: () => entries.size,
|
|
3528
|
+
destroy() {
|
|
3529
|
+
if (pending !== null) deps.cancelFrame(pending);
|
|
3530
|
+
pending = null;
|
|
3531
|
+
for (const entry of entries.values()) {
|
|
3532
|
+
entry.subscribers.clear();
|
|
3533
|
+
for (const detach of entry.detach) detach();
|
|
3534
|
+
}
|
|
3535
|
+
entries.clear();
|
|
3536
|
+
}
|
|
3537
|
+
};
|
|
3538
|
+
}
|
|
3539
|
+
function windowScrollRoot(win) {
|
|
3540
|
+
return {
|
|
3541
|
+
key: "window",
|
|
3542
|
+
metrics: () => ({
|
|
3543
|
+
scrollTop: win.scrollY,
|
|
3544
|
+
scrollLeft: win.scrollX,
|
|
3545
|
+
viewportWidth: win.innerWidth,
|
|
3546
|
+
viewportHeight: win.innerHeight,
|
|
3547
|
+
viewportTop: 0,
|
|
3548
|
+
viewportLeft: 0
|
|
3549
|
+
}),
|
|
3550
|
+
onScroll: (handler) => listen(win, "scroll", handler),
|
|
3551
|
+
/*
|
|
3552
|
+
* The document's own height counts as a resize, not just the window's.
|
|
3553
|
+
*
|
|
3554
|
+
* `elementScrollRoot` has observed its element's size since it was written, for the reason
|
|
3555
|
+
* stated three doc comments down: "images loading, fonts swapping, a container changing size,
|
|
3556
|
+
* or content being inserted". Every one of those applies at least as strongly to the page
|
|
3557
|
+
* itself, and the page root was the one that only listened for `window.resize` — so on any
|
|
3558
|
+
* document with lazy-loaded media below the fold, every cached content offset silently drifted
|
|
3559
|
+
* by however much the page grew after it was measured, with no epoch bump to correct it.
|
|
3560
|
+
*
|
|
3561
|
+
* Measured on `demo/scroll.html` (32,000px of lazy screenshots): the horizontal track's stage
|
|
3562
|
+
* moved ~840px between page load and reaching it, which is a third of that effect's whole
|
|
3563
|
+
* scroll range. Nothing was wrong with the maths; the number it was doing the maths on was
|
|
3564
|
+
* taken before forty images existed.
|
|
3565
|
+
*/
|
|
3566
|
+
onResize: (handler) => observeSize(win.document.documentElement, win, handler)
|
|
3567
|
+
};
|
|
3568
|
+
}
|
|
3569
|
+
function elementScrollRoot(el, win) {
|
|
3570
|
+
return {
|
|
3571
|
+
key: `el:${rootId(el)}`,
|
|
3572
|
+
metrics: () => {
|
|
3573
|
+
const rect = el.getBoundingClientRect();
|
|
3574
|
+
return {
|
|
3575
|
+
scrollTop: el.scrollTop,
|
|
3576
|
+
scrollLeft: el.scrollLeft,
|
|
3577
|
+
viewportWidth: el.clientWidth,
|
|
3578
|
+
viewportHeight: el.clientHeight,
|
|
3579
|
+
viewportTop: rect.top,
|
|
3580
|
+
viewportLeft: rect.left
|
|
3581
|
+
};
|
|
3582
|
+
},
|
|
3583
|
+
onScroll: (handler) => listen(el, "scroll", handler),
|
|
3584
|
+
// Window resize alone misses the cases that actually invalidate a nested scroller: images
|
|
3585
|
+
// loading, fonts swapping, a container changing size, or content being inserted.
|
|
3586
|
+
onResize: (handler) => observeSize(el, win, handler)
|
|
3587
|
+
};
|
|
3588
|
+
}
|
|
3589
|
+
function listen(target, type, handler) {
|
|
3590
|
+
target.addEventListener(type, handler, { passive: true });
|
|
3591
|
+
return () => target.removeEventListener(type, handler);
|
|
3592
|
+
}
|
|
3593
|
+
function observeSize(el, win, handler) {
|
|
3594
|
+
const stopWindow = listen(win, "resize", handler);
|
|
3595
|
+
if (typeof ResizeObserver === "undefined") return stopWindow;
|
|
3596
|
+
const observer = new ResizeObserver(handler);
|
|
3597
|
+
observer.observe(el);
|
|
3598
|
+
return () => {
|
|
3599
|
+
stopWindow();
|
|
3600
|
+
observer.disconnect();
|
|
3601
|
+
};
|
|
3602
|
+
}
|
|
3603
|
+
var nextRootId = 0;
|
|
3604
|
+
var rootIds = /* @__PURE__ */ new WeakMap();
|
|
3605
|
+
function rootId(el) {
|
|
3606
|
+
const existing = rootIds.get(el);
|
|
3607
|
+
if (existing) return existing;
|
|
3608
|
+
const id = String(++nextRootId);
|
|
3609
|
+
rootIds.set(el, id);
|
|
3610
|
+
return id;
|
|
3611
|
+
}
|
|
3612
|
+
function createRootResolver(options) {
|
|
3613
|
+
const { win } = options;
|
|
3614
|
+
const isScrollable = options.isScrollable ?? defaultIsScrollable(win);
|
|
3615
|
+
const windowRoot = windowScrollRoot(win);
|
|
3616
|
+
return (el) => {
|
|
3617
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
3618
|
+
if (scrollsTheViewport(node, win)) return windowRoot;
|
|
3619
|
+
if (isScrollable(node)) return elementScrollRoot(node, win);
|
|
3620
|
+
}
|
|
3621
|
+
return windowRoot;
|
|
3622
|
+
};
|
|
3623
|
+
}
|
|
3624
|
+
function scrollsTheViewport(node, win) {
|
|
3625
|
+
const root = win.document.documentElement;
|
|
3626
|
+
if (node === root) return true;
|
|
3627
|
+
if (node !== win.document.body) return false;
|
|
3628
|
+
const rootStyle = win.getComputedStyle(root);
|
|
3629
|
+
return !CLIPPING_OVERFLOW.has(rootStyle.overflowX) && !CLIPPING_OVERFLOW.has(rootStyle.overflowY);
|
|
3630
|
+
}
|
|
3631
|
+
var CLIPPING_OVERFLOW = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
|
|
3632
|
+
var SCROLLABLE_OVERFLOW = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
3633
|
+
function defaultIsScrollable(win) {
|
|
3634
|
+
return (el) => {
|
|
3635
|
+
const style = win.getComputedStyle(el);
|
|
3636
|
+
const vertical = SCROLLABLE_OVERFLOW.has(style.overflowY) && el.scrollHeight > el.clientHeight;
|
|
3637
|
+
const horizontal = SCROLLABLE_OVERFLOW.has(style.overflowX) && el.scrollWidth > el.clientWidth;
|
|
3638
|
+
return vertical || horizontal;
|
|
3639
|
+
};
|
|
3640
|
+
}
|
|
3641
|
+
function clamp013(value) {
|
|
3642
|
+
if (Number.isNaN(value)) return 0;
|
|
3643
|
+
return Math.min(1, Math.max(0, value));
|
|
3644
|
+
}
|
|
3645
|
+
function createMeasureCache(measure) {
|
|
3646
|
+
let cachedEpoch = -1;
|
|
3647
|
+
let cached;
|
|
3648
|
+
return {
|
|
3649
|
+
read(epoch) {
|
|
3650
|
+
if (cachedEpoch !== epoch || cached === void 0) {
|
|
3651
|
+
cached = measure();
|
|
3652
|
+
cachedEpoch = epoch;
|
|
3653
|
+
}
|
|
3654
|
+
return cached;
|
|
3655
|
+
},
|
|
3656
|
+
clear() {
|
|
3657
|
+
cachedEpoch = -1;
|
|
3658
|
+
cached = void 0;
|
|
3659
|
+
}
|
|
3660
|
+
};
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3663
|
+
// src/core/pause-scope.ts
|
|
3664
|
+
var PAUSE_SCOPE_ATTR = "data-kui-paused";
|
|
3665
|
+
var PAUSE_SCOPE_EVENT = "kui:pausescope";
|
|
3666
|
+
function isPausedByScope(el) {
|
|
3667
|
+
return el.closest(`[${PAUSE_SCOPE_ATTR}]`) !== null;
|
|
3668
|
+
}
|
|
3669
|
+
function announcePauseScope(doc, source) {
|
|
3670
|
+
const Ctor = doc.defaultView?.CustomEvent ?? CustomEvent;
|
|
3671
|
+
const target = source.isConnected ? source : doc;
|
|
3672
|
+
target.dispatchEvent(new Ctor(PAUSE_SCOPE_EVENT, { bubbles: true }));
|
|
3673
|
+
}
|
|
3674
|
+
function watchPauseScope(el, doc, onChange) {
|
|
3675
|
+
let last = isPausedByScope(el);
|
|
3676
|
+
const listener = () => {
|
|
3677
|
+
const now = isPausedByScope(el);
|
|
3678
|
+
if (now === last) return;
|
|
3679
|
+
last = now;
|
|
3680
|
+
onChange(now);
|
|
3681
|
+
};
|
|
3682
|
+
doc.addEventListener(PAUSE_SCOPE_EVENT, listener);
|
|
3683
|
+
return () => doc.removeEventListener(PAUSE_SCOPE_EVENT, listener);
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
// src/core/auto-motion.ts
|
|
3687
|
+
var MIN_PERIOD_MS = 2e3;
|
|
3688
|
+
var MAX_FRAME_MS = 100;
|
|
3689
|
+
function clampPeriod(ms) {
|
|
3690
|
+
if (!Number.isFinite(ms) || ms === 0) return 0;
|
|
3691
|
+
return Math.sign(ms) * Math.max(MIN_PERIOD_MS, Math.abs(ms));
|
|
3692
|
+
}
|
|
3693
|
+
function cyclesFor(dtMs, periodMs) {
|
|
3694
|
+
return Math.min(Math.max(dtMs, 0), MAX_FRAME_MS) / periodMs;
|
|
3695
|
+
}
|
|
3696
|
+
function isKeyboardFocus(target) {
|
|
3697
|
+
const node = target;
|
|
3698
|
+
if (typeof node?.matches !== "function") return true;
|
|
3699
|
+
try {
|
|
3700
|
+
return node.matches(":focus-visible");
|
|
3701
|
+
} catch {
|
|
3702
|
+
return true;
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
function createAutoMotion(request) {
|
|
3706
|
+
const { el, ctx, spinMs, autoplayMs, settleMs, advance, step, setSpinning, onPausedChange } = request;
|
|
3707
|
+
const pauseOnHover = request.pauseOnHover ?? true;
|
|
3708
|
+
const enabled = spinMs !== 0 || autoplayMs !== 0;
|
|
3709
|
+
if (!enabled) {
|
|
3710
|
+
return {
|
|
3711
|
+
enabled,
|
|
3712
|
+
interrupt() {
|
|
3713
|
+
},
|
|
3714
|
+
hold() {
|
|
3715
|
+
},
|
|
3716
|
+
toggle() {
|
|
3717
|
+
},
|
|
3718
|
+
release() {
|
|
3719
|
+
}
|
|
3720
|
+
};
|
|
3721
|
+
}
|
|
3722
|
+
const win = ctx.win;
|
|
3723
|
+
request.onAutoplayProgress?.(0);
|
|
3724
|
+
let userPaused = ctx.reducedMotion || request.startPaused === true;
|
|
3725
|
+
let hovered = false;
|
|
3726
|
+
let focused = false;
|
|
3727
|
+
let onscreen = true;
|
|
3728
|
+
let gesture = false;
|
|
3729
|
+
let held = false;
|
|
3730
|
+
let scopePaused = isPausedByScope(el);
|
|
3731
|
+
let viewing = false;
|
|
3732
|
+
let viewerOpen = false;
|
|
3733
|
+
let focusBeforeViewer = false;
|
|
3734
|
+
let frame = 0;
|
|
3735
|
+
let lastFrameAt = null;
|
|
3736
|
+
let timer = null;
|
|
3737
|
+
let holdTimer = null;
|
|
3738
|
+
let spinning = false;
|
|
3739
|
+
const active = () => !userPaused && !hovered && !focused && onscreen && !gesture && !held && !viewing && !scopePaused && !ctx.doc.hidden;
|
|
3740
|
+
const requestFrame = (callback) => typeof win.requestAnimationFrame === "function" ? win.requestAnimationFrame(callback) : win.setTimeout(() => callback(Date.now()), 16);
|
|
3741
|
+
const cancelFrame = (handle) => {
|
|
3742
|
+
if (typeof win.cancelAnimationFrame === "function") win.cancelAnimationFrame(handle);
|
|
3743
|
+
else win.clearTimeout(handle);
|
|
3744
|
+
};
|
|
3745
|
+
const publishSpinning = (next) => {
|
|
3746
|
+
if (next === spinning) return;
|
|
3747
|
+
spinning = next;
|
|
3748
|
+
setSpinning(next);
|
|
3749
|
+
};
|
|
3750
|
+
const tick = (now) => {
|
|
3751
|
+
frame = 0;
|
|
3752
|
+
if (!active()) return;
|
|
3753
|
+
if (lastFrameAt !== null) advance(cyclesFor(now - lastFrameAt, spinMs));
|
|
3754
|
+
lastFrameAt = now;
|
|
3755
|
+
frame = requestFrame(tick);
|
|
3756
|
+
};
|
|
3757
|
+
const startSpin = () => {
|
|
3758
|
+
if (frame !== 0) return;
|
|
3759
|
+
publishSpinning(true);
|
|
3760
|
+
lastFrameAt = null;
|
|
3761
|
+
frame = requestFrame(tick);
|
|
3762
|
+
};
|
|
3763
|
+
const stopSpin = () => {
|
|
3764
|
+
if (frame !== 0) cancelFrame(frame);
|
|
3765
|
+
frame = 0;
|
|
3766
|
+
publishSpinning(false);
|
|
3767
|
+
};
|
|
3768
|
+
const armAutoplay = () => {
|
|
3769
|
+
if (timer !== null) return;
|
|
3770
|
+
timer = win.setTimeout(() => {
|
|
3771
|
+
clearAutoplay();
|
|
3772
|
+
step(autoplayMs > 0 ? 1 : -1);
|
|
3773
|
+
update();
|
|
3774
|
+
}, Math.abs(autoplayMs));
|
|
3775
|
+
if (request.onAutoplayProgress) {
|
|
3776
|
+
const startedAt = Date.now();
|
|
3777
|
+
const tickTimer = () => {
|
|
3778
|
+
request.onAutoplayProgress(Math.max(0, Math.min(1, (Date.now() - startedAt) / Math.abs(autoplayMs))));
|
|
3779
|
+
frame = requestFrame(tickTimer);
|
|
3780
|
+
};
|
|
3781
|
+
tickTimer();
|
|
3782
|
+
}
|
|
3783
|
+
};
|
|
3784
|
+
const clearAutoplay = () => {
|
|
3785
|
+
if (timer === null) return;
|
|
3786
|
+
win.clearTimeout(timer);
|
|
3787
|
+
timer = null;
|
|
3788
|
+
if (request.onAutoplayProgress) {
|
|
3789
|
+
cancelFrame(frame);
|
|
3790
|
+
frame = 0;
|
|
3791
|
+
request.onAutoplayProgress(0);
|
|
3792
|
+
}
|
|
3793
|
+
};
|
|
3794
|
+
function update() {
|
|
3795
|
+
const running = active();
|
|
3796
|
+
if (spinMs !== 0) (running ? startSpin : stopSpin)();
|
|
3797
|
+
if (autoplayMs !== 0) (running ? armAutoplay : clearAutoplay)();
|
|
3798
|
+
}
|
|
3799
|
+
const onEnter = () => {
|
|
3800
|
+
hovered = true;
|
|
3801
|
+
update();
|
|
3802
|
+
};
|
|
3803
|
+
const onLeave = () => {
|
|
3804
|
+
hovered = false;
|
|
3805
|
+
update();
|
|
3806
|
+
};
|
|
3807
|
+
const onFocusIn = (event) => {
|
|
3808
|
+
focused = (!viewerOpen || focusBeforeViewer) && isKeyboardFocus(event.target);
|
|
3809
|
+
update();
|
|
3810
|
+
};
|
|
3811
|
+
const onFocusOut = (event) => {
|
|
3812
|
+
if (!viewerOpen) focusBeforeViewer = focused;
|
|
3813
|
+
const next = event.relatedTarget;
|
|
3814
|
+
focused = next !== null && el.contains(next) && isKeyboardFocus(next);
|
|
3815
|
+
update();
|
|
3816
|
+
};
|
|
3817
|
+
const onVisibility = () => update();
|
|
3818
|
+
const onViewer = (event) => {
|
|
3819
|
+
const open = event.detail?.open === true;
|
|
3820
|
+
viewerOpen = open;
|
|
3821
|
+
viewing = open && el.contains(event.target);
|
|
3822
|
+
update();
|
|
3823
|
+
};
|
|
3824
|
+
if (pauseOnHover) {
|
|
3825
|
+
el.addEventListener("pointerenter", onEnter);
|
|
3826
|
+
el.addEventListener("pointerleave", onLeave);
|
|
3827
|
+
}
|
|
3828
|
+
el.addEventListener("focusin", onFocusIn);
|
|
3829
|
+
el.addEventListener("focusout", onFocusOut);
|
|
3830
|
+
ctx.doc.addEventListener("visibilitychange", onVisibility);
|
|
3831
|
+
ctx.doc.addEventListener(VIEWER_EVENT, onViewer);
|
|
3832
|
+
const unwatchScope = watchPauseScope(el, ctx.doc, (paused) => {
|
|
3833
|
+
scopePaused = paused;
|
|
3834
|
+
update();
|
|
3835
|
+
});
|
|
3836
|
+
const Observer = win.IntersectionObserver;
|
|
3837
|
+
const observer = Observer ? new Observer((entries) => {
|
|
3838
|
+
for (const entry of entries) onscreen = entry.isIntersecting;
|
|
3839
|
+
update();
|
|
3840
|
+
}) : null;
|
|
3841
|
+
observer?.observe(el);
|
|
3842
|
+
onPausedChange(userPaused);
|
|
3843
|
+
update();
|
|
3844
|
+
return {
|
|
3845
|
+
enabled,
|
|
3846
|
+
interrupt() {
|
|
3847
|
+
held = true;
|
|
3848
|
+
if (holdTimer !== null) win.clearTimeout(holdTimer);
|
|
3849
|
+
holdTimer = win.setTimeout(() => {
|
|
3850
|
+
holdTimer = null;
|
|
3851
|
+
held = false;
|
|
3852
|
+
update();
|
|
3853
|
+
}, Math.max(0, settleMs));
|
|
3854
|
+
update();
|
|
3855
|
+
},
|
|
3856
|
+
hold(holding) {
|
|
3857
|
+
gesture = holding;
|
|
3858
|
+
update();
|
|
3859
|
+
},
|
|
3860
|
+
toggle() {
|
|
3861
|
+
userPaused = !userPaused;
|
|
3862
|
+
onPausedChange(userPaused);
|
|
3863
|
+
update();
|
|
3864
|
+
},
|
|
3865
|
+
release() {
|
|
3866
|
+
if (frame !== 0) cancelFrame(frame);
|
|
3867
|
+
frame = 0;
|
|
3868
|
+
if (timer !== null) win.clearTimeout(timer);
|
|
3869
|
+
if (holdTimer !== null) win.clearTimeout(holdTimer);
|
|
3870
|
+
timer = null;
|
|
3871
|
+
holdTimer = null;
|
|
3872
|
+
observer?.disconnect();
|
|
3873
|
+
el.removeEventListener("pointerenter", onEnter);
|
|
3874
|
+
el.removeEventListener("pointerleave", onLeave);
|
|
3875
|
+
el.removeEventListener("focusin", onFocusIn);
|
|
3876
|
+
el.removeEventListener("focusout", onFocusOut);
|
|
3877
|
+
ctx.doc.removeEventListener("visibilitychange", onVisibility);
|
|
3878
|
+
ctx.doc.removeEventListener(VIEWER_EVENT, onViewer);
|
|
3879
|
+
unwatchScope();
|
|
3880
|
+
publishSpinning(false);
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3883
|
+
}
|
|
2955
3884
|
|
|
2956
3885
|
export {
|
|
2957
3886
|
selectorBreadth,
|
|
@@ -2977,6 +3906,7 @@ export {
|
|
|
2977
3906
|
defaultSpringDeps,
|
|
2978
3907
|
cssEasingValue,
|
|
2979
3908
|
waapiEasingValue,
|
|
3909
|
+
customEasing,
|
|
2980
3910
|
resolvePlayback,
|
|
2981
3911
|
repeatCount,
|
|
2982
3912
|
isInfiniteRepeat,
|
|
@@ -2990,9 +3920,11 @@ export {
|
|
|
2990
3920
|
SUBTREE_CHANNEL,
|
|
2991
3921
|
inertInstance,
|
|
2992
3922
|
SEGMENT_HOIST_KEYS,
|
|
3923
|
+
EASING_KEYWORDS,
|
|
2993
3924
|
splitTopLevel,
|
|
2994
3925
|
parseActivationAttribute,
|
|
2995
3926
|
parse,
|
|
3927
|
+
isGroupOnly,
|
|
2996
3928
|
assignOnce,
|
|
2997
3929
|
Registry,
|
|
2998
3930
|
timingProperty,
|
|
@@ -3003,6 +3935,15 @@ export {
|
|
|
3003
3935
|
control,
|
|
3004
3936
|
KUI_EVENT,
|
|
3005
3937
|
emitLifecycle,
|
|
3938
|
+
provideDeckViewer,
|
|
3939
|
+
announceViewer,
|
|
3940
|
+
DECK_LIGHTBOX_PARAM,
|
|
3941
|
+
deckLightbox,
|
|
3942
|
+
PAUSE_SCOPE_ATTR,
|
|
3943
|
+
announcePauseScope,
|
|
3944
|
+
MIN_PERIOD_MS,
|
|
3945
|
+
clampPeriod,
|
|
3946
|
+
createAutoMotion,
|
|
3006
3947
|
validate,
|
|
3007
3948
|
decimalNumber,
|
|
3008
3949
|
isSafeCssValue,
|
|
@@ -3014,16 +3955,30 @@ export {
|
|
|
3014
3955
|
readEffectTiming,
|
|
3015
3956
|
effectDurationMs,
|
|
3016
3957
|
readEffectParams,
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3958
|
+
elementStaggerKeys,
|
|
3959
|
+
staggerKeysFor,
|
|
3960
|
+
isGroupedKeys,
|
|
3961
|
+
claimTargetGroupHost,
|
|
3962
|
+
staggerRanks,
|
|
3963
|
+
restageAfterRemoval,
|
|
3964
|
+
releaseStaggerGroup,
|
|
3965
|
+
releaseStagger,
|
|
3966
|
+
restageAround,
|
|
3967
|
+
indexTargetGroup,
|
|
3968
|
+
applyStagger,
|
|
3021
3969
|
TIME_SCALE_ATTR,
|
|
3022
3970
|
timeScaleOf,
|
|
3023
3971
|
createCssInstance,
|
|
3024
3972
|
continuousSetup,
|
|
3025
3973
|
deferredInstance,
|
|
3026
3974
|
deferPrepare,
|
|
3975
|
+
createJsInstance,
|
|
3976
|
+
repeatedInstance,
|
|
3977
|
+
createScrollScheduler,
|
|
3978
|
+
windowScrollRoot,
|
|
3979
|
+
createRootResolver,
|
|
3980
|
+
clamp013 as clamp01,
|
|
3981
|
+
createMeasureCache,
|
|
3027
3982
|
ALL_TIMING_TOKENS,
|
|
3028
3983
|
declareTimingContract,
|
|
3029
3984
|
inheritTimingContract,
|