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.
Files changed (99) hide show
  1. package/README.md +2 -2
  2. package/dist/esm/advanced/index.mjs +1 -1
  3. package/dist/esm/{chunk-FASAEQDR.mjs → chunk-CG37RODK.mjs} +1232 -277
  4. package/dist/esm/{chunk-AEQGC2KM.mjs → chunk-EDFJTT5B.mjs} +2 -1
  5. package/dist/esm/{chunk-MZQG2VMG.mjs → chunk-W7U4A2NK.mjs} +708 -610
  6. package/dist/esm/{chunk-EHS45PIK.mjs → chunk-Y2FP56K5.mjs} +9228 -4275
  7. package/dist/esm/core/index.mjs +3 -3
  8. package/dist/esm/effects/index.mjs +3 -3
  9. package/dist/esm/index.mjs +4 -4
  10. package/dist/esm/notes/index.mjs +347 -9
  11. package/dist/kuinetic.advanced.js +2 -1
  12. package/dist/kuinetic.advanced.min.js +1 -1
  13. package/dist/kuinetic.all.js +9099 -3152
  14. package/dist/kuinetic.all.min.js +4 -2
  15. package/dist/kuinetic.css +2408 -161
  16. package/dist/kuinetic.js +9098 -3151
  17. package/dist/kuinetic.min.css +1 -1
  18. package/dist/kuinetic.min.js +3 -1
  19. package/dist/kuinetic.notes.js +1 -1
  20. package/dist/types/advanced/shaders.d.ts +1 -1
  21. package/dist/types/core/animator.d.ts +61 -2
  22. package/dist/types/core/attrs.d.ts +0 -2
  23. package/dist/types/core/auto-motion.d.ts +139 -0
  24. package/dist/types/core/cadence.d.ts +90 -0
  25. package/dist/types/core/channels.d.ts +5 -1
  26. package/dist/types/core/compile.d.ts +14 -2
  27. package/dist/types/core/deck-viewer.d.ts +2 -0
  28. package/dist/types/core/declarations.d.ts +6 -0
  29. package/dist/types/core/derived/group-gate.d.ts +18 -4
  30. package/dist/types/core/describe.d.ts +1 -1
  31. package/dist/types/core/easing.d.ts +9 -0
  32. package/dist/types/core/effect-context.d.ts +5 -0
  33. package/dist/types/core/element-config.d.ts +5 -4
  34. package/dist/types/core/flip.d.ts +25 -1
  35. package/dist/types/core/gesture.d.ts +5 -0
  36. package/dist/types/core/image-flight.d.ts +23 -0
  37. package/dist/types/core/instances.d.ts +27 -3
  38. package/dist/types/core/js-effect-preparer.d.ts +3 -1
  39. package/dist/types/core/owned-styles.d.ts +2 -1
  40. package/dist/types/core/params.d.ts +2 -3
  41. package/dist/types/core/parse.d.ts +21 -1
  42. package/dist/types/core/pause-scope.d.ts +40 -0
  43. package/dist/types/core/play.d.ts +2 -2
  44. package/dist/types/core/registry.d.ts +17 -2
  45. package/dist/types/core/repeat.d.ts +6 -4
  46. package/dist/types/core/sequence.d.ts +10 -0
  47. package/dist/types/core/stagger-config.d.ts +23 -101
  48. package/dist/types/core/stagger-keys.d.ts +2 -4
  49. package/dist/types/core/stagger.d.ts +12 -21
  50. package/dist/types/core/types.d.ts +76 -19
  51. package/dist/types/effects/auto-motion.d.ts +22 -117
  52. package/dist/types/effects/carousel/archive.d.ts +18 -0
  53. package/dist/types/effects/carousel/coast.d.ts +7 -0
  54. package/dist/types/effects/carousel/deck.d.ts +31 -2
  55. package/dist/types/effects/carousel/drag.d.ts +24 -7
  56. package/dist/types/effects/carousel/glide.d.ts +89 -0
  57. package/dist/types/effects/carousel/line.d.ts +10 -0
  58. package/dist/types/effects/carousel/row-copies.d.ts +13 -0
  59. package/dist/types/effects/carousel/row.d.ts +3 -0
  60. package/dist/types/effects/carousel/shape-fit.d.ts +54 -0
  61. package/dist/types/effects/carousel/sources.d.ts +26 -0
  62. package/dist/types/effects/carousel/sphere.d.ts +23 -0
  63. package/dist/types/effects/carousel/stack.d.ts +2 -1
  64. package/dist/types/effects/catalog/confetti.d.ts +2 -0
  65. package/dist/types/effects/catalog/cursor-trail.d.ts +2 -0
  66. package/dist/types/effects/catalog/curtains.d.ts +2 -0
  67. package/dist/types/effects/catalog/feedback.d.ts +1 -1
  68. package/dist/types/effects/catalog/image-flight.d.ts +2 -0
  69. package/dist/types/effects/catalog/line-boil.d.ts +2 -0
  70. package/dist/types/effects/catalog/media-shared.d.ts +10 -0
  71. package/dist/types/effects/catalog/number-tokens.d.ts +5 -0
  72. package/dist/types/effects/catalog/numbers-shared.d.ts +3 -4
  73. package/dist/types/effects/catalog/pause-scope.d.ts +20 -0
  74. package/dist/types/effects/catalog/text-shared.d.ts +17 -6
  75. package/dist/types/effects/catalog/typewriter-scatter.d.ts +5 -0
  76. package/dist/types/effects/catalog/view-transitions.d.ts +32 -1
  77. package/dist/types/effects/catalog/wobble.d.ts +2 -0
  78. package/dist/types/effects/gestures/drag-options.d.ts +17 -0
  79. package/dist/types/effects/layout/departures.d.ts +21 -0
  80. package/dist/types/effects/motion-path/fit.d.ts +4 -0
  81. package/dist/types/effects/scroll-mechanics/progress-output.d.ts +9 -0
  82. package/dist/types/effects/scroll-mechanics/snap-autoplay.d.ts +20 -0
  83. package/dist/types/effects/step-index.d.ts +19 -1
  84. package/dist/types/effects/step-marking.d.ts +7 -4
  85. package/dist/types/effects/svg/morph-loop.d.ts +7 -0
  86. package/dist/types/effects/svg/text-path.d.ts +2 -0
  87. package/dist/types/effects/three-d/cube.d.ts +2 -0
  88. package/dist/types/effects/tween/index.d.ts +2 -1
  89. package/dist/types/effects/tween/properties.d.ts +1 -1
  90. package/dist/types/effects/tween/toggle.d.ts +6 -0
  91. package/dist/types/effects/tween/waypoints.d.ts +1 -1
  92. package/dist/types/notes/effects.d.ts +1 -0
  93. package/dist/types/notes/index.d.ts +11 -0
  94. package/dist/types/notes/showcase.d.ts +1 -0
  95. package/dist/types/showcase/lightbox-flight.d.ts +11 -0
  96. package/dist/types/showcase/media-source.d.ts +1 -0
  97. package/dist/types/showcase/modal-shell.d.ts +5 -0
  98. package/dist/types/showcase/youtube.d.ts +3 -0
  99. package/package.json +1 -1
@@ -1,12 +1,23 @@
1
- import type { Preset, Primitive } from './types.js';
1
+ import type { CompiledTarget } from './compile.js';
2
+ import type { Reporter } from './reporter.js';
3
+ import type { Cleanup, EffectSpec, Preset, Primitive } from './types.js';
2
4
  export interface ResolvedEffect {
3
5
  preset: Preset;
4
6
  primitive: Primitive;
5
7
  }
8
+ type SplitUnit = NonNullable<EffectSpec['split']>;
9
+ export interface SplitStage {
10
+ /** Pieces available to claim immediately. */
11
+ cells: Element[];
12
+ restore?: Cleanup;
13
+ /** For a delayed stage, leave `cells` empty and deliver them here once ready. */
14
+ onReady?(install: (cells: Element[]) => void): void;
15
+ }
16
+ type SplitProvider = (host: Element, group: CompiledTarget, reporter: Reporter) => SplitStage | undefined;
6
17
  /**
7
18
  * Name → primitive alias table.
8
19
  *
9
- * The catalog's 302 names come from 159 primitives; 143 of the names are aliases — the
20
+ * The catalog's 305 names come from 160 primitives; 145 of the names are aliases — the
10
21
  * same primitive with different parameter defaults. Presets are therefore data rows, not
11
22
  * code, and adding a name in a later release costs a table entry. See docs/catalog.md.
12
23
  *
@@ -20,12 +31,15 @@ export interface ResolvedEffect {
20
31
  export declare class Registry {
21
32
  private primitives;
22
33
  private presets;
34
+ private splitProviders;
23
35
  /** Sorted-name key → preset that renders that combination as one tested keyframe. */
24
36
  private combos;
25
37
  registerPrimitive(primitive: Primitive): this;
26
38
  registerPreset(preset: Preset): this;
27
39
  registerPresets(presets: Preset[]): this;
28
40
  registerPrimitives(primitives: Primitive[]): this;
41
+ registerSplitProvider(unit: SplitUnit, install: SplitProvider): this;
42
+ getSplitProvider(unit: SplitUnit): SplitProvider | undefined;
29
43
  /**
30
44
  * Declare that a set of effect names has a purpose-built single-keyframe implementation.
31
45
  * Checked before channel conflict analysis, so `fade-up` + `blur-in` can resolve to the
@@ -43,3 +57,4 @@ export declare class Registry {
43
57
  export declare function timingProperty(primitiveId: string, name: string): string;
44
58
  /** Levenshtein-lite suggestion for unknown effect names. Dev-mode ergonomics only. */
45
59
  export declare function suggest(name: string, candidates: string[]): string | undefined;
60
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { EffectSpec, Renderer, Timeline } from './types.js';
2
- export type PlaybackKey = 'repeat' | 'yoyo';
2
+ export type PlaybackKey = 'repeat' | 'repeat-delay' | 'yoyo';
3
3
  /**
4
4
  * Whether a `key:value` key is one this module owns, so `parse.ts` can dispatch with one lookup
5
5
  * rather than a growing `||` chain against its own complexity ceiling.
@@ -14,9 +14,9 @@ export interface PlaybackContext {
14
14
  warn: (message: string) => void;
15
15
  }
16
16
  /**
17
- * Validate and lift one `repeat:`/`yoyo:` token onto the spec being built.
17
+ * Validate and lift one playback token onto the spec being built.
18
18
  *
19
- * Validated here, at parse time, for the reason `rm:` is: both are closed value sets with no
19
+ * Validated here, at parse time, for the reason `rm:` is: they are closed value sets with no
20
20
  * expression forms, so there is nothing a later stage could know that this one does not, and the
21
21
  * author is owed the diagnostic next to every other grammar diagnostic. The *timeline*-dependent
22
22
  * refusals are the opposite case and live in {@link resolvePlayback}, which runs where the
@@ -40,6 +40,8 @@ export interface PlaybackInput {
40
40
  timeline: Timeline;
41
41
  repeat?: string;
42
42
  yoyo?: boolean;
43
+ /** Whether a JS primitive declares it can replay from its from-state. See `Primitive.repeatable`. */
44
+ repeatable?: boolean;
43
45
  }
44
46
  /** The playback settings that survived, plus anything the author needs told. */
45
47
  export interface PlaybackResolution {
@@ -88,4 +90,4 @@ export declare function directionValue(yoyo: boolean | undefined): string;
88
90
  * @complexity O(n) time in the expression's length; O(1) space.
89
91
  * @overallScore 100
90
92
  */
91
- export declare function playbackExpression(duration: string, repeat: string | undefined): string;
93
+ export declare function playbackExpression(duration: string, repeat: string | undefined, gap?: number): string;
@@ -62,6 +62,7 @@ export interface SequenceMember {
62
62
  * rather than multiplied — see `refuseEndless`.
63
63
  */
64
64
  repeat?: string;
65
+ repeatDelay?: number;
65
66
  /**
66
67
  * Whether this segment's renderer can act on a computed delay at all.
67
68
  *
@@ -93,6 +94,15 @@ export interface SequenceStep {
93
94
  /** Whether `at:` actually moved this segment, as opposed to being refused or absent. */
94
95
  sequenced: boolean;
95
96
  }
97
+ /** Can this track start at or after the earlier track's end at every nonnegative member rank? */
98
+ export declare function startsAfter(earlier: {
99
+ step: SequenceStep;
100
+ member: SequenceMember;
101
+ stagger?: string;
102
+ }, later: {
103
+ step: SequenceStep;
104
+ stagger?: string;
105
+ }): boolean;
96
106
  /**
97
107
  * Resolve every segment's start position, in authoring order.
98
108
  *
@@ -1,24 +1,14 @@
1
- /**
2
- * The stagger *grammar* — what an author's two attributes mean, with no DOM anywhere in sight.
3
- *
4
- * Split from `stagger.ts` when the 2D orderings landed and the module went past its line budget,
5
- * and split along the seam `activation.ts` already uses for the same reason: vocabulary first as
6
- * pure functions over text, machinery second. Everything here turns `data-kui-stagger` and the
7
- * hoisted `cascade:`/`spread:`/`order:`/`cols:`/`along:` keys into one {@link StaggerConfig};
8
- * nothing here ranks a child or touches an element. `stagger.ts` does both, and re-exports this
9
- * module's public names so the split is invisible to every caller.
10
- */
11
1
  /**
12
2
  * Where a group's stagger starts from, as a rank over DOM order.
13
3
  *
14
- * A number is a child index — `from:2` blooms outward from the third child.
4
+ * A number is a child index — `order:2` blooms outward from the third child.
15
5
  *
16
6
  * Every keyword except `random` is the same rule under a different origin: *rank = distance from
17
7
  * a reference point*. `start` is distance from child 0, `end` from the last child, `center` from
18
8
  * the middle, a number from that index, and `edges` from whichever of the two ends is nearer.
19
9
  * That is deliberately the whole set. GSAP's is `center | edges | random | <index>`; `start` is
20
10
  * added because the default behaviour needs a name an author can write down, and `end` because it
21
- * is the one ordering that is otherwise impossible to express — `from:<count-1>` requires knowing
11
+ * is the one ordering that is otherwise impossible to express — `order:<count-1>` requires knowing
22
12
  * a count the author cannot see from the markup.
23
13
  *
24
14
  * `slat-assemble`'s `alternate` (a zig-zag, see `slatOrder` in `effects/catalog/media-shared.ts`)
@@ -63,12 +53,11 @@ export interface StaggerLayout {
63
53
  }
64
54
  /** How many columns a group has: an authored count, or `auto` to measure the laid-out children. */
65
55
  export type StaggerColumns = number | 'auto';
66
- /** Parsed form of the `data-kui-stagger` value. */
56
+ /** Resolved group timing and ordering. */
67
57
  export interface StaggerConfig {
68
58
  /**
69
- * The raw step, written to `--kui-stagger` verbatim. Never validated here: the attribute has
70
- * always been passed straight through, so `data-kui-stagger="var(--speed)"` and
71
- * `calc(90ms * 2)` work today, and narrowing this to a `<time>` literal would break them.
59
+ * The raw step, written to `--kui-stagger` verbatim after the CSS escape screen.
60
+ * CSS expressions such as `var(--speed)` and `calc(90ms * 2)` are allowed.
72
61
  */
73
62
  step?: string;
74
63
  /**
@@ -98,91 +87,10 @@ export interface StaggerConfig {
98
87
  */
99
88
  along?: StaggerAxis;
100
89
  }
101
- /**
102
- * Parse `data-kui-stagger`.
103
- *
104
- * The grammar is the smallest thing that could carry an ordering without a new attribute:
105
- *
106
- * value := [step] key:value*
107
- *
108
- * — the step positional and first, exactly as `duration` is positional and first in `data-kui`.
109
- * So `data-kui-stagger="90ms"` (every use in the repo today) parses unchanged, and
110
- * `data-kui-stagger="90ms from:center"` adds the ordering.
111
- *
112
- * This attribute is no longer the only home for a group declaration — `data-kui` now carries the
113
- * same two settings as `cascade:` and `order:` (see `HOISTS` in `parse.ts`, and
114
- * `resolveStaggerConfig` below for how the two spellings merge). What has not changed is *why the
115
- * words differ between the two attributes*, and the reasoning is worth keeping because it is what
116
- * fixes the names:
117
- *
118
- * 1. The group parent usually has no `data-kui` at all — it is a bare `<div class="grid">` in
119
- * every one of the demo pages. So this attribute cannot be retired: a hoist-only design would
120
- * force an author to invent an effect for a wrapper that is not animating.
121
- * 2. `data-kui`'s grammar is per-*effect*: `data-kui="fade-up, zoom-in"` is two specs. Ordering
122
- * is a property of the group, not of an effect, which is why the `data-kui` spelling had to be
123
- * an element-wide hoist rather than an ordinary parameter.
124
- * 3. `from:` is already taken inside `data-kui`, by eighteen primitives. `count-up from:0`,
125
- * `scale-in from:1`, `gradient-shift from:#f00`, `path-morph from:...` — it is one of the most
126
- * common parameter names in the catalog. A group ordering spelled `from:` there would be
127
- * ambiguous with all of them and unresolvable, because `resolveParams` cannot know whether the
128
- * author meant the effect's parameter or the group's order. That is an argument about the
129
- * *word*, not the attribute, so the hoisted spelling is `order:` and this attribute keeps
130
- * `from:` — and now accepts `order:` too, so one word works in both places.
131
- *
132
- * Warnings rather than silence, because the failure is invisible otherwise: an unparsed token
133
- * lands in `--kui-stagger` as garbage, CSS drops the declaration, and the group animates as one
134
- * block with nothing in the console to say why.
135
- *
136
- * @param value - Raw attribute text. `''` for a bare `data-kui-stagger` with no value.
137
- * @param warnings - Sink for diagnostics. Optional so a pure parse can ignore them.
138
- * @returns The step (absent when the author wrote only an ordering) and the ordering.
139
- * @complexity O(n) time in the attribute length; O(n) space for the tokens.
140
- * @overallScore 100
141
- */
142
- export declare function parseStaggerAttribute(value: string, warnings?: string[]): StaggerConfig;
143
- /**
144
- * Merge the two spellings of a group declaration into one config.
145
- *
146
- * `data-kui-stagger="90ms from:center"` and `data-kui="cascade:90ms order:center"` are the same
147
- * request written two ways, and both have to keep working — the longhand appears on 77 group
148
- * elements in the demo pages alone and predates the hoist.
149
- *
150
- * **Merged per key, not per attribute.** `data-kui-stagger="90ms"` on a grid whose `data-kui` says
151
- * `order:center` is a perfectly coherent thing to have written while migrating, and blanking the
152
- * step because the *other* attribute happened to mention ordering would be a silent regression of
153
- * exactly the kind this module keeps warning about. So each key is resolved on its own and only a
154
- * genuine disagreement about the same key is a conflict.
155
- *
156
- * **Where they disagree, `data-kui` wins and the longhand is named.** Not a coin toss:
157
- * `element-config.ts` already resolves `on:`/`timeline:`/`threshold:` this way — "values written
158
- * inline are a convenience that takes precedence over the longhand attribute" — and a fourth and
159
- * fifth key that resolved the *other* way would make the precedence rule something an author has
160
- * to memorise per key instead of learn once. Naming the loser by value is what turns "why is my
161
- * stagger 90ms when I wrote 200ms" into a one-line answer.
162
- *
163
- * @param attribute - Raw `data-kui-stagger` text, or `null` when the element has none.
164
- * @param source - Raw `data-kui` text; only its hoisted `cascade:`/`order:` keys are read.
165
- * @param warnings - Sink for conflict and grammar diagnostics.
166
- * @returns The resolved group config, or `undefined` when neither attribute declares a group at
167
- * all — which is how `applyStagger` tells a group element from any other animated element.
168
- * @complexity O(n) time in the two attributes' combined length; O(n) space for their tokens.
169
- * @overallScore 100
170
- */
171
- export declare function resolveStaggerConfig(attribute: string | null, source: string, warnings?: string[]): StaggerConfig | undefined;
172
- /**
173
- * Same resolution as {@link resolveStaggerConfig}, from already-known group keys instead of a
174
- * re-parse of raw `data-kui` — the path a `target:` group uses, since its keys live on
175
- * `CompiledTarget.hoists` (P1), which a raw re-parse of the host's `data-kui` never sees (a group's
176
- * `cascade:`/`order:` may have been authored on a *targeted* segment, which `parse.ts` scopes to
177
- * `spec.hoists` rather than folding element-wide — see `types.ts`'s `SegmentHoists`).
178
- *
179
- * @param attribute - Raw `data-kui-stagger` text, or `null` when the element has none.
180
- * @param inline - The group's already-resolved hoisted keys, or `undefined` when it has none.
181
- * @param warnings - Sink for conflict and grammar diagnostics.
182
- * @complexity O(n) time in the attribute's length; O(n) space for its tokens.
183
- * @overallScore 100
184
- */
185
- export declare function resolveStaggerConfigFrom(attribute: string | null, inline: StaggerGroupKeys | undefined, warnings?: string[]): StaggerConfig | undefined;
90
+ /** Resolve the hoisted group keys in raw `data-kui`. */
91
+ export declare function resolveStaggerConfig(source: string, warnings?: string[]): StaggerConfig | undefined;
92
+ /** Resolve the effective group keys, including keys scoped to a `target:` group. */
93
+ export declare function resolveStaggerConfigFrom(keys: StaggerGroupKeys | undefined, warnings?: string[]): StaggerConfig | undefined;
186
94
  /**
187
95
  * The hoisted group keys, exactly as `parse()` returns them — a `target:` group's own effective
188
96
  * keys, too (3a's `staggerKeysFor`/`elementStaggerKeys`), which is why this is exported rather than
@@ -197,3 +105,17 @@ export interface StaggerGroupKeys {
197
105
  cols?: string;
198
106
  along?: string;
199
107
  }
108
+ /**
109
+ * Whether a `data-kui` value could contain a hoisted group key.
110
+ *
111
+ * A substring test, not the grammar: `border:` ends in `order:` and `tween cascade:...` is not a
112
+ * thing, so this over-matches by design and `parse()` makes the real decision. Over-matching costs
113
+ * one wasted parse; under-matching would silently drop a group, so a cleverer regex with a
114
+ * word-boundary guard is the wrong trade here — it would have to agree with `splitTopLevel`'s
115
+ * quote- and paren-aware tokenizer in every case, and where it did not the failure would be an
116
+ * animation that just does not stagger, with nothing in the console.
117
+ *
118
+ * @complexity O(n) time in the attribute length; O(1) space.
119
+ * @overallScore 100
120
+ */
121
+ export declare function hasGroupKey(source: string): boolean;
@@ -13,9 +13,7 @@ import type { StaggerGroupKeys } from './stagger-config.js';
13
13
  export declare function elementStaggerKeys(parsed: ParsedValue): StaggerGroupKeys | undefined;
14
14
  /**
15
15
  * One `target:` group's effective stagger keys: its own scoped hoists (from `CompiledTarget.hoists`)
16
- * override the host's element-wide keys per key, not per attribute (D-B.3) — the same "each key
17
- * decided on its own" rule `resolveStaggerConfigFrom` already applies to the two *attributes*,
18
- * extended to the two *scopes* a `target:` group adds.
16
+ * override the host's element-wide keys per key, not per group (D-B.3).
19
17
  *
20
18
  * @param scoped - The group's own hoisted keys (`CompiledTarget.hoists`), or `undefined` when the
21
19
  * targeted segment hoisted none of its own.
@@ -30,7 +28,7 @@ export declare function staggerKeysFor(scoped: SegmentHoists | undefined, elemen
30
28
  * host fans out to every member, rather than each member binding its own gate. `cascade:`,
31
29
  * `spread:` and `order:` all imply it — any key that only makes sense read across the whole group
32
30
  * at once. `cols:`/`along:` alone do not: a column count or an axis is meaningless without an
33
- * ordering to apply it to (see `stagger-config.ts`'s own `along:`-without-`cols:` warning for the
31
+ * ordering to apply it to (see `stagger.ts`'s own `along:`-without-`cols:` warning for the
34
32
  * same asymmetry the other way), so neither one by itself is a request for a shared binding.
35
33
  *
36
34
  * @param keys - A group's effective keys, from {@link staggerKeysFor}.
@@ -1,7 +1,7 @@
1
1
  import type { StyleLedger } from './owned-styles.js';
2
2
  import type { Reporter } from './reporter.js';
3
3
  import type { StaggerFrom, StaggerGroupKeys, StaggerLayout } from './stagger-config.js';
4
- export { parseStaggerAttribute, resolveStaggerConfig } from './stagger-config.js';
4
+ export { resolveStaggerConfig } from './stagger-config.js';
5
5
  export type { StaggerFrom, StaggerGroupKeys, StaggerLayout, } from './stagger-config.js';
6
6
  /**
7
7
  * Rank every child of a group of `count` animated children.
@@ -49,7 +49,7 @@ export declare function staggerRanks(count: number, from: StaggerFrom, warnings?
49
49
  * Index the animated children of one stagger group.
50
50
  *
51
51
  * Only the index is written; the offset arithmetic stays in the CSS `calc()` so the browser
52
- * applies it, rather than JS recomputing a delay per element. `from:` changes which index a child
52
+ * applies it, rather than JS recomputing a delay per element. `order:` changes which index a child
53
53
  * gets and nothing else — the delay formula in `compile.ts` is untouched by ordering.
54
54
  *
55
55
  * No new custom property is introduced, deliberately. `--kui-i` inherits and does not stop at the
@@ -59,8 +59,7 @@ export declare function staggerRanks(count: number, from: StaggerFrom, warnings?
59
59
  * `--kui-order` or `--kui-from` would have needed its own reset and would have been one more thing
60
60
  * to remember.
61
61
  *
62
- * @param group - Element carrying `data-kui-stagger`, or a `data-kui` with `cascade:`/`spread:`/
63
- * `order:`.
62
+ * @param group - Element carrying group keys in `data-kui`.
64
63
  * @param reporter - Diagnostic sink for a malformed attribute. Optional, so the two-argument
65
64
  * contract every existing caller uses keeps working.
66
65
  * @complexity O(n) time in the number of children; O(n) space for the ranks.
@@ -120,15 +119,11 @@ export declare function releaseStagger(root: ParentNode): void;
120
119
  /**
121
120
  * Re-index the groups one element's attribute change can have altered.
122
121
  *
123
- * Two of them, because both spellings of "this is a stagger group" now reach here. The element
124
- * itself may declare one — `data-kui-stagger`, or `cascade:`/`spread:`/`order:` inside `data-kui`
125
- * — and it may equally be a *member* of its parent's, since `animatedChildren` counts exactly the
126
- * children carrying `data-kui`, so gaining or losing that attribute changes every sibling's rank
127
- * and the group's published `--kui-stagger-count`.
122
+ * The element itself may declare a group, and an edit may also change whether it counts
123
+ * as an animated member of its parent's group.
128
124
  *
129
- * Two named elements rather than a subtree walk: an attribute change is delivered per element, and
130
- * re-scanning each changed element's whole subtree would cost O(subtree) per change against a
131
- * frame budget of a hundred of them.
125
+ * Re-index only the affected groups and their nested cascades, so descendants pick up changed
126
+ * ancestor offsets without scanning unrelated subtrees.
132
127
  *
133
128
  * @param el - The element whose watched attribute changed.
134
129
  * @param reporter - Diagnostic sink, threaded through to each group.
@@ -146,13 +141,8 @@ export declare function restageAround(el: Element, reporter?: Reporter): void;
146
141
  * the way an ordinary stagger group is — `--kui-i` has to be assigned right where the matches are
147
142
  * resolved.
148
143
  *
149
- * **Per-parent, not flat document order** — settled as D7 in `docs/plan-scope-page.md`, matching
150
- * `createStepMarker`'s own numbering (`effects/step-marking.ts`) for the same reason that function
151
- * gives: a target naming two parallel groups — copy lines and the dots that track them — should
152
- * read 0..n-1 in each, not 0..2n-1 across both. Unlike that function, this one has to know each
153
- * parent-group's full size before it can rank anything (`center`/`edges`/`random` all measure from
154
- * a size-dependent origin — see {@link staggerRanks}), so matches are bucketed by parent first and
155
- * ranked bucket by bucket, rather than counted in one streaming pass.
144
+ * Selector matches form one list in document order unless `cols:` declares a grid. Grids rank
145
+ * within each parent so separate layouts keep their own column counts and origins.
156
146
  *
157
147
  * **Writes through `ledgers`, never `element.style` directly** — the one place this deliberately
158
148
  * does *not* follow {@link indexStaggerGroup}, whose direct `style.setProperty` calls are a
@@ -167,13 +157,14 @@ export declare function restageAround(el: Element, reporter?: Reporter): void;
167
157
  */
168
158
  export interface TargetGroupIndexRequest {
169
159
  host: Element;
160
+ /** Generated text is ranked as one list and inherits timing from this layer, not the host. */
161
+ splitLayer?: Element;
170
162
  /** Document order. */
171
163
  matches: Element[];
172
164
  /** The style ledger to write through for `el` — the host (`--kui-stagger`, `--kui-stagger-count`)
173
165
  * or a match (`--kui-i`). HEAD passed one LedgerSet for all; derived hosts pass each match's own. */
174
166
  styleOf: (el: Element) => StyleLedger;
175
- /** The group's effective stagger keys. Absent → HEAD behaviour: re-read the host's
176
- * `data-kui-stagger` + raw `data-kui`. */
167
+ /** The group's effective stagger keys. If absent, read the host's inline group keys. */
177
168
  keys?: StaggerGroupKeys;
178
169
  reporter?: Reporter;
179
170
  }
@@ -181,8 +181,7 @@ export type ScalarParamType = 'length' | 'time' | 'number' | 'percentage' | 'ang
181
181
  * **This list is deliberately closed and deliberately short.** The alternative — a per-property
182
182
  * table of CSS grammars, so any parameter can declare any combination — is a second CSS parser to
183
183
  * own and keep correct, and every entry in it is a new way for an authored value to be accepted
184
- * into a declaration nobody checked. Three unions cover the properties the catalog actually has.
185
- * Adding a fourth should be a considered decision with a parameter that needs it, not a default.
184
+ * into a declaration nobody checked. Add a union only when a catalog parameter needs it.
186
185
  *
187
186
  * The member order is the order the grammars are tried, which matters only for
188
187
  * {@link ScalarParamType} overlaps; today there are none.
@@ -211,7 +210,9 @@ export type UnionParamType =
211
210
  * the bare and `d`-suffixed spellings every `angle` parameter takes; the keyword half is
212
211
  * {@link KeywordParamSpec.keywords}, which is closed exactly as it is for `'keyword'` itself.
213
212
  */
214
- | 'angle|keyword';
213
+ | 'angle|keyword'
214
+ /** A number or a closed set of words, as in the stack's `travel:auto`. */
215
+ | 'number|keyword';
215
216
  export type ParamType = ScalarParamType | UnionParamType;
216
217
  /** Everything a parameter declares regardless of which grammar it accepts. */
217
218
  interface ParamSpecBase {
@@ -277,7 +278,7 @@ export interface ParamNoteDetail {
277
278
  }
278
279
  /**
279
280
  * A parameter with a keyword half: either nothing but words (`'keyword'`), or words beside a
280
- * value grammar (`'angle|keyword'`).
281
+ * value grammar (`'angle|keyword'` or `'number|keyword'`).
281
282
  *
282
283
  * `keywords` is **required**, not optional. A keyword parameter with no list accepts nothing at
283
284
  * all and can only ever fall back to its default, which is a declaration bug that used to compile
@@ -285,11 +286,10 @@ export interface ParamNoteDetail {
285
286
  * the type checker.
286
287
  */
287
288
  export interface KeywordParamSpec extends ParamSpecBase {
288
- type: 'keyword' | 'angle|keyword';
289
+ type: 'keyword' | 'angle|keyword' | 'number|keyword';
289
290
  /**
290
291
  * The complete set of words this parameter accepts. **Closed** — a value that is not in this
291
- * list is rejected, and for `'angle|keyword'` is then tried against the angle grammar and
292
- * nothing else.
292
+ * list is tried only against the other half of the grammar, if any.
293
293
  *
294
294
  * This field replaced `values`, which meant a closed set on `'keyword'` and *additive* extra
295
295
  * literals on every other type. One key with two meanings validated nothing on the second
@@ -307,7 +307,7 @@ export interface KeywordParamSpec extends ParamSpecBase {
307
307
  * to a numeric parameter a compile error rather than a silent no-op.
308
308
  */
309
309
  export interface ValueParamSpec extends ParamSpecBase {
310
- type: Exclude<ParamType, 'keyword' | 'angle|keyword'>;
310
+ type: Exclude<ParamType, KeywordParamSpec['type']>;
311
311
  keywords?: never;
312
312
  }
313
313
  /**
@@ -332,6 +332,10 @@ export type Cleanup = () => void;
332
332
  * cancellation — is enforced here rather than re-implemented per renderer.
333
333
  */
334
334
  export interface EffectInstance {
335
+ /** Prepares a CSS effect's geometry or parts without adding a separate playhead. */
336
+ readonly setupOnly?: true;
337
+ /** Opt-in finite decoration: a new activation cancels and replaces the current run. */
338
+ readonly replaceOnActivate?: boolean;
335
339
  /** Start. Called by the animator once its gate opens, never by `prepare`. */
336
340
  activate(): void;
337
341
  /**
@@ -387,6 +391,16 @@ export interface EffectInstance {
387
391
  * once it has actually run.
388
392
  */
389
393
  readonly continuous?: boolean;
394
+ /**
395
+ * Whether the run that `activate()` started was a bounded one that will resolve `finished` and
396
+ * can be started again from its from-state — set after `activate()` by deferred JS instances,
397
+ * `true` only when the setup returned a timed handle.
398
+ *
399
+ * Exists for the `repeat:` decorator: a setup that took an early "nothing to do" bail-out (a bare
400
+ * cleanup, `finished` already resolved) is indistinguishable by shape from a real finite run, and
401
+ * looping it would spin. Absent means "not known to be finite", never "infinite".
402
+ */
403
+ readonly finite?: boolean;
390
404
  /** Release every listener, observer, subscription, and inserted node. */
391
405
  destroy(): void;
392
406
  }
@@ -474,6 +488,8 @@ export interface EffectParams {
474
488
  */
475
489
  readonly timing: EffectTiming;
476
490
  }
491
+ /** What a {@link Primitive.cycle} hook may touch: the host's window and document, and the warning sink. */
492
+ export type CycleContext = Pick<PrepareContext, 'win' | 'doc' | 'warn'>;
477
493
  /**
478
494
  * A primitive's refinement of itself for one authored spec.
479
495
  *
@@ -490,9 +506,13 @@ export interface EffectParams {
490
506
  * exists to prevent. So the primitive is asked, once per spec, instead.
491
507
  *
492
508
  * Every field is optional, and an absent field means "use the primitive's own declaration". A
493
- * primitive with no `variantFor` at all — which is all but two of them — is unaffected.
509
+ * primitive with no `variantFor` at all is unaffected.
494
510
  */
495
511
  export interface EffectVariant {
512
+ /** Reduced-motion behavior for this explicitly selected variant. */
513
+ reducedMotion?: ReducedMotionPolicy;
514
+ /** Setup needed only by this opt-in variant. */
515
+ prepare?: Primitive['prepare'];
496
516
  /**
497
517
  * Channels this spec writes, unioned with the primitive's own declared list.
498
518
  *
@@ -501,6 +521,8 @@ export interface EffectVariant {
501
521
  * conflict detection, which is exactly backwards.
502
522
  */
503
523
  channels?: Channel[];
524
+ /** Extra transition properties for the channels this spec adds. */
525
+ transitions?: TransitionSegment[];
504
526
  /**
505
527
  * Keyframe blocks to compile, one animation track each, replacing the preset's single
506
528
  * `keyframes` name. Empty means this spec animates nothing and emits no `animation` declaration.
@@ -598,6 +620,25 @@ export interface Primitive {
598
620
  * DOM nodes for a whole debugging session.
599
621
  */
600
622
  restoresOnFinish?: boolean;
623
+ /**
624
+ * A finite JS primitive whose setup, re-run after it completes, starts again from its from-state —
625
+ * so `repeat:` is honoured by replaying it (see `repeatedInstance`).
626
+ *
627
+ * Declared, not inferred: whether a setup returns a timed handle is only knowable at runtime, and
628
+ * compile must decide statically so the refusal warning for a continuous effect is truthful.
629
+ * Meaningless for `css-keyframes` primitives, which repeat through `animation-iteration-count`.
630
+ */
631
+ repeatable?: true;
632
+ /**
633
+ * What one demonstration step of this primitive changes — called by an `every:` cadence instead of
634
+ * replaying the element, for primitives whose animation is driven by a DOM state change (a FLIP
635
+ * container's reorder, a discrete `*-open` toggle).
636
+ *
637
+ * The hook performs the same DOM write the author's page would (re-append children, toggle
638
+ * `data-open`); the primitive's own watcher animates it. Cycles are state changes the author asked
639
+ * for: `reset()` does not undo them.
640
+ */
641
+ cycle?(el: Element, params: EffectParams, ctx: CycleContext): void;
601
642
  /**
602
643
  * JS-side setup. Returns a lifecycle handle, **not** a teardown function.
603
644
  *
@@ -724,6 +765,11 @@ export type DeliveryMechanism = 'stylesheet-animation';
724
765
  export interface Preset {
725
766
  name: string;
726
767
  primitive: string;
768
+ /** Internal: turn `values:` into a local group of generated targets. */
769
+ generatedTargets?: {
770
+ selector: string;
771
+ mount(host: Element, values: string, warn: (message: string) => void): Element[];
772
+ };
727
773
  /** Parameter overrides that differentiate this name from its primitive's defaults. */
728
774
  params?: Record<string, string>;
729
775
  /** CSS `@keyframes` name this preset animates, when renderer is `css-keyframes`. */
@@ -829,6 +875,8 @@ export interface EffectSpec {
829
875
  duration?: string;
830
876
  delay?: string;
831
877
  easing?: string;
878
+ split?: 'chars' | 'words' | 'tiles';
879
+ rows?: string;
832
880
  /**
833
881
  * Authored `at:` position — where this segment starts relative to the one before it in the comma
834
882
  * list. Untrusted and unparsed; `core/sequence.ts` owns the grammar and every diagnostic.
@@ -876,6 +924,8 @@ export interface EffectSpec {
876
924
  * a repeat the compiled output cannot honour, with a warning, before the plan is built.
877
925
  */
878
926
  repeat?: string;
927
+ /** Authored gap in milliseconds, validated against the track before sequencing. */
928
+ repeatDelay?: number;
879
929
  /**
880
930
  * Authored `yoyo:` — whether this segment alternates direction between iterations, compiling to
881
931
  * `animation-direction: alternate`. Spelled `yoyo` and not `direction` because `direction` is
@@ -885,7 +935,7 @@ export interface EffectSpec {
885
935
  params: Record<string, string>;
886
936
  /**
887
937
  * Segment-scoped hoists — see {@link SegmentHoists}. Present only when this segment carries a
888
- * `target:` token and wrote at least one of these keys; `compile.ts`'s `scopeHoists` consumes
938
+ * `target:` or valid `split:` token and wrote at least one of these keys; `compile.ts`'s `scopeHoists` consumes
889
939
  * and clears it (for a declaring/unknown name) before anything else reads `EffectSpec`.
890
940
  */
891
941
  hoists?: SegmentHoists;
@@ -901,7 +951,7 @@ export interface EffectSpec {
901
951
  * `rm:`/`func:` excluded on purpose — they stay element-wide always (D-B.3): one element has one
902
952
  * reduced-motion policy and one completion callback, whatever it targets.
903
953
  */
904
- export type SegmentHoists = Pick<ParsedValue, 'activation' | 'actions' | 'timeline' | 'threshold' | 'cascade' | 'spread' | 'order' | 'cols' | 'along'>;
954
+ export type SegmentHoists = Pick<ParsedValue, 'activation' | 'via' | 'actions' | 'timeline' | 'range' | 'threshold' | 'cascade' | 'spread' | 'order' | 'cols' | 'along'>;
905
955
  /**
906
956
  * The keys {@link SegmentHoists} carries, as a runtime-iterable tuple — the one place enumerating
907
957
  * them, so `compile.ts` and `bundles.ts` cannot drift into two different lists.
@@ -910,19 +960,20 @@ export type SegmentHoists = Pick<ParsedValue, 'activation' | 'actions' | 'timeli
910
960
  * the field `activation`. `parse.ts` needs the surface-word spelling instead and keeps its own
911
961
  * local set for that (see its own comment).
912
962
  */
913
- export declare const SEGMENT_HOIST_KEYS: readonly ["activation", "actions", "timeline", "threshold", "cascade", "spread", "order", "cols", "along"];
963
+ export declare const SEGMENT_HOIST_KEYS: readonly ["activation", "via", "actions", "timeline", "range", "threshold", "cascade", "spread", "order", "cols", "along"];
914
964
  export type SegmentHoistKey = (typeof SEGMENT_HOIST_KEYS)[number];
915
965
  /** The full parse of one element's `data-kui` attribute. */
916
966
  export interface ParsedValue {
917
967
  specs: EffectSpec[];
918
968
  /**
919
- * Hoisted from the reserved `on:` / `actions:` / `timeline:` / `threshold:` / `cascade:` /
969
+ * Hoisted from the reserved `on:` / `actions:` / `timeline:` / `range:` / `threshold:` / `cascade:` /
920
970
  * `spread:` / `order:` / `cols:` / `along:` / `rm:` / `func:` keys. Element-scoped: one element
921
971
  * has one activation, one timeline, one stagger group, one reduced-motion policy and one
922
972
  * completion — so none of these can sensibly differ between the comma-separated segments of a
923
973
  * single attribute, and all of them are lifted out of the per-effect `params`.
924
974
  */
925
975
  activation?: Activation;
976
+ via?: string;
926
977
  /**
927
978
  * What to do at each of the scroll trigger's four crossings, verbatim —
928
979
  * `play/pause/resume/reset`, in the order enter, leave, enter-back, leave-back.
@@ -933,12 +984,11 @@ export interface ParsedValue {
933
984
  */
934
985
  actions?: string;
935
986
  timeline?: string;
987
+ range?: string;
936
988
  threshold?: string;
937
989
  /**
938
- * Stagger step for this element's animated children — the `data-kui` spelling of
939
- * `data-kui-stagger`'s positional step. Raw text, deliberately unvalidated here: `stagger.ts`
940
- * owns the grammar for both spellings and has always passed the step through verbatim so
941
- * `var(--speed)` and `calc(90ms * 2)` keep working.
990
+ * Step between group members. Raw text so expressions such as `var(--speed)`
991
+ * and `calc(90ms * 2)` work.
942
992
  */
943
993
  cascade?: string;
944
994
  /**
@@ -950,7 +1000,7 @@ export interface ParsedValue {
950
1000
  * to `--kui-stagger`, and `var(--speed)` divides exactly as well as `600ms` does.
951
1001
  */
952
1002
  spread?: string;
953
- /** Where the stagger wave starts — `data-kui-stagger`'s `from:`, under a name `data-kui` can hold. */
1003
+ /** Where the stagger wave starts. */
954
1004
  order?: string;
955
1005
  /**
956
1006
  * The stagger group's column count, or `auto` to measure it — what turns `order:` from a rank
@@ -963,7 +1013,7 @@ export interface ParsedValue {
963
1013
  /**
964
1014
  * Restrict a grid stagger to one axis — `x` or `y`. Spelled `along:` rather than GSAP's `axis:`
965
1015
  * because `axis` is already a parameter on four primitives and a hoisted key never reaches
966
- * `spec.params`; `data-kui-stagger` accepts both words.
1016
+ * `spec.params`.
967
1017
  */
968
1018
  along?: string;
969
1019
  /**
@@ -982,6 +1032,13 @@ export interface ParsedValue {
982
1032
  * the note on why this key must not be built from untrusted input.
983
1033
  */
984
1034
  func?: string;
1035
+ /**
1036
+ * Replay cadence from the reserved `every:` key — a time token, verbatim (`2.6s`, `900ms`).
1037
+ * "While this element is on screen and nothing pauses it, perform one demonstration step every
1038
+ * period." Element-wide always, like `rm:`/`func:` (never in `SEGMENT_HOIST_KEYS`): one element
1039
+ * has one cadence, whatever its `target:` groups do. The animator owns the clamp and the runtime.
1040
+ */
1041
+ every?: string;
985
1042
  warnings: string[];
986
1043
  }
987
1044
  /** Runtime truth. Attributes are for CSS and debugging; they make a poor state machine. */