kuinetic 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/esm/{chunk-7NW4OLOC.mjs → chunk-CG37RODK.mjs} +906 -428
- package/dist/esm/{chunk-DAVDOYOS.mjs → chunk-W7U4A2NK.mjs} +625 -124
- package/dist/esm/{chunk-4QKMEDM4.mjs → chunk-Y2FP56K5.mjs} +2501 -1694
- package/dist/esm/core/index.mjs +2 -2
- package/dist/esm/effects/index.mjs +2 -2
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/notes/index.mjs +75 -8
- package/dist/kuinetic.all.js +3977 -2221
- package/dist/kuinetic.all.min.js +4 -2
- package/dist/kuinetic.css +1248 -46
- package/dist/kuinetic.js +3976 -2220
- package/dist/kuinetic.min.css +1 -1
- package/dist/kuinetic.min.js +3 -1
- package/dist/kuinetic.notes.js +1 -1
- package/dist/types/core/animator.d.ts +61 -2
- package/dist/types/core/attrs.d.ts +0 -2
- package/dist/types/core/auto-motion.d.ts +139 -0
- package/dist/types/core/cadence.d.ts +90 -0
- package/dist/types/core/channels.d.ts +4 -0
- package/dist/types/core/compile.d.ts +14 -2
- package/dist/types/core/deck-viewer.d.ts +2 -0
- package/dist/types/core/declarations.d.ts +6 -0
- package/dist/types/core/derived/group-gate.d.ts +18 -4
- package/dist/types/core/describe.d.ts +1 -1
- package/dist/types/core/element-config.d.ts +3 -4
- package/dist/types/core/instances.d.ts +27 -3
- package/dist/types/core/params.d.ts +1 -2
- package/dist/types/core/parse.d.ts +20 -1
- package/dist/types/core/pause-scope.d.ts +40 -0
- package/dist/types/core/play.d.ts +2 -2
- package/dist/types/core/registry.d.ts +16 -1
- package/dist/types/core/repeat.d.ts +6 -4
- package/dist/types/core/sequence.d.ts +10 -0
- package/dist/types/core/stagger-config.d.ts +23 -101
- package/dist/types/core/stagger-keys.d.ts +2 -4
- package/dist/types/core/stagger.d.ts +12 -21
- package/dist/types/core/types.d.ts +65 -18
- package/dist/types/effects/auto-motion.d.ts +20 -123
- package/dist/types/effects/carousel/deck.d.ts +5 -0
- package/dist/types/effects/carousel/drag.d.ts +5 -0
- package/dist/types/effects/carousel/row-copies.d.ts +3 -0
- package/dist/types/effects/carousel/shape-fit.d.ts +8 -0
- package/dist/types/effects/catalog/feedback.d.ts +1 -1
- package/dist/types/effects/catalog/media-shared.d.ts +10 -0
- package/dist/types/effects/catalog/pause-scope.d.ts +20 -0
- package/dist/types/effects/catalog/text-shared.d.ts +4 -0
- package/dist/types/effects/scroll-mechanics/snap-autoplay.d.ts +20 -0
- package/dist/types/effects/step-index.d.ts +19 -1
- package/dist/types/effects/svg/morph-loop.d.ts +2 -0
- package/dist/types/effects/tween/waypoints.d.ts +1 -1
- package/dist/types/showcase/media-source.d.ts +1 -0
- package/dist/types/showcase/youtube.d.ts +3 -0
- package/package.json +1 -1
|
@@ -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
|
|
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:
|
|
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 — `
|
|
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 — `
|
|
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
|
-
/**
|
|
56
|
+
/** Resolved group timing and ordering. */
|
|
67
57
|
export interface StaggerConfig {
|
|
68
58
|
/**
|
|
69
|
-
* The raw step, written to `--kui-stagger` verbatim
|
|
70
|
-
*
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
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
|
|
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 {
|
|
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. `
|
|
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
|
|
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
|
-
*
|
|
124
|
-
*
|
|
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
|
-
*
|
|
130
|
-
*
|
|
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
|
-
*
|
|
150
|
-
*
|
|
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.
|
|
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.
|
|
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
|
|
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, '
|
|
310
|
+
type: Exclude<ParamType, KeywordParamSpec['type']>;
|
|
311
311
|
keywords?: never;
|
|
312
312
|
}
|
|
313
313
|
/**
|
|
@@ -391,6 +391,16 @@ export interface EffectInstance {
|
|
|
391
391
|
* once it has actually run.
|
|
392
392
|
*/
|
|
393
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;
|
|
394
404
|
/** Release every listener, observer, subscription, and inserted node. */
|
|
395
405
|
destroy(): void;
|
|
396
406
|
}
|
|
@@ -478,6 +488,8 @@ export interface EffectParams {
|
|
|
478
488
|
*/
|
|
479
489
|
readonly timing: EffectTiming;
|
|
480
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'>;
|
|
481
493
|
/**
|
|
482
494
|
* A primitive's refinement of itself for one authored spec.
|
|
483
495
|
*
|
|
@@ -608,6 +620,25 @@ export interface Primitive {
|
|
|
608
620
|
* DOM nodes for a whole debugging session.
|
|
609
621
|
*/
|
|
610
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;
|
|
611
642
|
/**
|
|
612
643
|
* JS-side setup. Returns a lifecycle handle, **not** a teardown function.
|
|
613
644
|
*
|
|
@@ -734,6 +765,11 @@ export type DeliveryMechanism = 'stylesheet-animation';
|
|
|
734
765
|
export interface Preset {
|
|
735
766
|
name: string;
|
|
736
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
|
+
};
|
|
737
773
|
/** Parameter overrides that differentiate this name from its primitive's defaults. */
|
|
738
774
|
params?: Record<string, string>;
|
|
739
775
|
/** CSS `@keyframes` name this preset animates, when renderer is `css-keyframes`. */
|
|
@@ -839,6 +875,8 @@ export interface EffectSpec {
|
|
|
839
875
|
duration?: string;
|
|
840
876
|
delay?: string;
|
|
841
877
|
easing?: string;
|
|
878
|
+
split?: 'chars' | 'words' | 'tiles';
|
|
879
|
+
rows?: string;
|
|
842
880
|
/**
|
|
843
881
|
* Authored `at:` position — where this segment starts relative to the one before it in the comma
|
|
844
882
|
* list. Untrusted and unparsed; `core/sequence.ts` owns the grammar and every diagnostic.
|
|
@@ -886,6 +924,8 @@ export interface EffectSpec {
|
|
|
886
924
|
* a repeat the compiled output cannot honour, with a warning, before the plan is built.
|
|
887
925
|
*/
|
|
888
926
|
repeat?: string;
|
|
927
|
+
/** Authored gap in milliseconds, validated against the track before sequencing. */
|
|
928
|
+
repeatDelay?: number;
|
|
889
929
|
/**
|
|
890
930
|
* Authored `yoyo:` — whether this segment alternates direction between iterations, compiling to
|
|
891
931
|
* `animation-direction: alternate`. Spelled `yoyo` and not `direction` because `direction` is
|
|
@@ -895,7 +935,7 @@ export interface EffectSpec {
|
|
|
895
935
|
params: Record<string, string>;
|
|
896
936
|
/**
|
|
897
937
|
* Segment-scoped hoists — see {@link SegmentHoists}. Present only when this segment carries a
|
|
898
|
-
* `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
|
|
899
939
|
* and clears it (for a declaring/unknown name) before anything else reads `EffectSpec`.
|
|
900
940
|
*/
|
|
901
941
|
hoists?: SegmentHoists;
|
|
@@ -911,7 +951,7 @@ export interface EffectSpec {
|
|
|
911
951
|
* `rm:`/`func:` excluded on purpose — they stay element-wide always (D-B.3): one element has one
|
|
912
952
|
* reduced-motion policy and one completion callback, whatever it targets.
|
|
913
953
|
*/
|
|
914
|
-
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'>;
|
|
915
955
|
/**
|
|
916
956
|
* The keys {@link SegmentHoists} carries, as a runtime-iterable tuple — the one place enumerating
|
|
917
957
|
* them, so `compile.ts` and `bundles.ts` cannot drift into two different lists.
|
|
@@ -920,19 +960,20 @@ export type SegmentHoists = Pick<ParsedValue, 'activation' | 'actions' | 'timeli
|
|
|
920
960
|
* the field `activation`. `parse.ts` needs the surface-word spelling instead and keeps its own
|
|
921
961
|
* local set for that (see its own comment).
|
|
922
962
|
*/
|
|
923
|
-
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"];
|
|
924
964
|
export type SegmentHoistKey = (typeof SEGMENT_HOIST_KEYS)[number];
|
|
925
965
|
/** The full parse of one element's `data-kui` attribute. */
|
|
926
966
|
export interface ParsedValue {
|
|
927
967
|
specs: EffectSpec[];
|
|
928
968
|
/**
|
|
929
|
-
* Hoisted from the reserved `on:` / `actions:` / `timeline:` / `threshold:` / `cascade:` /
|
|
969
|
+
* Hoisted from the reserved `on:` / `actions:` / `timeline:` / `range:` / `threshold:` / `cascade:` /
|
|
930
970
|
* `spread:` / `order:` / `cols:` / `along:` / `rm:` / `func:` keys. Element-scoped: one element
|
|
931
971
|
* has one activation, one timeline, one stagger group, one reduced-motion policy and one
|
|
932
972
|
* completion — so none of these can sensibly differ between the comma-separated segments of a
|
|
933
973
|
* single attribute, and all of them are lifted out of the per-effect `params`.
|
|
934
974
|
*/
|
|
935
975
|
activation?: Activation;
|
|
976
|
+
via?: string;
|
|
936
977
|
/**
|
|
937
978
|
* What to do at each of the scroll trigger's four crossings, verbatim —
|
|
938
979
|
* `play/pause/resume/reset`, in the order enter, leave, enter-back, leave-back.
|
|
@@ -943,12 +984,11 @@ export interface ParsedValue {
|
|
|
943
984
|
*/
|
|
944
985
|
actions?: string;
|
|
945
986
|
timeline?: string;
|
|
987
|
+
range?: string;
|
|
946
988
|
threshold?: string;
|
|
947
989
|
/**
|
|
948
|
-
*
|
|
949
|
-
* `
|
|
950
|
-
* owns the grammar for both spellings and has always passed the step through verbatim so
|
|
951
|
-
* `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.
|
|
952
992
|
*/
|
|
953
993
|
cascade?: string;
|
|
954
994
|
/**
|
|
@@ -960,7 +1000,7 @@ export interface ParsedValue {
|
|
|
960
1000
|
* to `--kui-stagger`, and `var(--speed)` divides exactly as well as `600ms` does.
|
|
961
1001
|
*/
|
|
962
1002
|
spread?: string;
|
|
963
|
-
/** Where the stagger wave starts
|
|
1003
|
+
/** Where the stagger wave starts. */
|
|
964
1004
|
order?: string;
|
|
965
1005
|
/**
|
|
966
1006
|
* The stagger group's column count, or `auto` to measure it — what turns `order:` from a rank
|
|
@@ -973,7 +1013,7 @@ export interface ParsedValue {
|
|
|
973
1013
|
/**
|
|
974
1014
|
* Restrict a grid stagger to one axis — `x` or `y`. Spelled `along:` rather than GSAP's `axis:`
|
|
975
1015
|
* because `axis` is already a parameter on four primitives and a hoisted key never reaches
|
|
976
|
-
* `spec.params
|
|
1016
|
+
* `spec.params`.
|
|
977
1017
|
*/
|
|
978
1018
|
along?: string;
|
|
979
1019
|
/**
|
|
@@ -992,6 +1032,13 @@ export interface ParsedValue {
|
|
|
992
1032
|
* the note on why this key must not be built from untrusted input.
|
|
993
1033
|
*/
|
|
994
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;
|
|
995
1042
|
warnings: string[];
|
|
996
1043
|
}
|
|
997
1044
|
/** Runtime truth. Attributes are for CSS and debugging; they make a poor state machine. */
|