dialkit 1.3.0 → 1.4.1
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 +433 -3
- package/dist/icons.d.ts +5 -1
- package/dist/icons.js +18 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +3222 -479
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +274 -6
- package/dist/index.d.ts +274 -6
- package/dist/index.js +3154 -416
- package/dist/index.js.map +1 -1
- package/dist/solid/index.d.ts +225 -3
- package/dist/solid/index.js +5761 -2500
- package/dist/solid/index.js.map +1 -1
- package/dist/store/index.cjs +57 -16
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +14 -2
- package/dist/store/index.d.ts +14 -2
- package/dist/store/index.js +52 -16
- package/dist/store/index.js.map +1 -1
- package/dist/styles.css +788 -0
- package/dist/svelte/components/ControlRenderer.svelte +5 -2
- package/dist/svelte/components/ControlRenderer.svelte.d.ts +2 -0
- package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -1
- package/dist/svelte/components/DialRoot.svelte +43 -6
- package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -1
- package/dist/svelte/components/Panel.svelte +7 -1
- package/dist/svelte/components/Panel.svelte.d.ts +2 -0
- package/dist/svelte/components/Panel.svelte.d.ts.map +1 -1
- package/dist/svelte/components/Timeline/ClipPopover.svelte +206 -0
- package/dist/svelte/components/Timeline/ClipPopover.svelte.d.ts +26 -0
- package/dist/svelte/components/Timeline/ClipPopover.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Timeline/DialTimeline.svelte +125 -0
- package/dist/svelte/components/Timeline/DialTimeline.svelte.d.ts +13 -0
- package/dist/svelte/components/Timeline/DialTimeline.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Timeline/TimelineClip.svelte +233 -0
- package/dist/svelte/components/Timeline/TimelineClip.svelte.d.ts +24 -0
- package/dist/svelte/components/Timeline/TimelineClip.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Timeline/TimelineSection.svelte +803 -0
- package/dist/svelte/components/Timeline/TimelineSection.svelte.d.ts +12 -0
- package/dist/svelte/components/Timeline/TimelineSection.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Timeline/TimelineToggleButton.svelte +25 -0
- package/dist/svelte/components/Timeline/TimelineToggleButton.svelte.d.ts +4 -0
- package/dist/svelte/components/Timeline/TimelineToggleButton.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TransitionControl.svelte +26 -11
- package/dist/svelte/components/TransitionControl.svelte.d.ts +9 -0
- package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -1
- package/dist/svelte/createDialTimeline.svelte.d.ts +4 -0
- package/dist/svelte/createDialTimeline.svelte.d.ts.map +1 -0
- package/dist/svelte/createDialTimeline.svelte.js +73 -0
- package/dist/svelte/index.d.ts +4 -0
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +3 -0
- package/dist/svelte/theme-css.d.ts +1 -1
- package/dist/svelte/theme-css.d.ts.map +1 -1
- package/dist/svelte/theme-css.js +788 -0
- package/dist/timeline/index.cjs +1288 -0
- package/dist/timeline/index.cjs.map +1 -0
- package/dist/timeline/index.d.cts +443 -0
- package/dist/timeline/index.d.ts +443 -0
- package/dist/timeline/index.js +1233 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/vue/index.d.ts +273 -7
- package/dist/vue/index.js +4116 -1517
- package/dist/vue/index.js.map +1 -1
- package/package.json +23 -13
- package/dist/solid/index.cjs +0 -3536
- package/dist/solid/index.cjs.map +0 -1
- package/dist/solid/index.d.cts +0 -295
- package/dist/vue/index.cjs +0 -3497
- package/dist/vue/index.cjs.map +0 -1
- package/dist/vue/index.d.cts +0 -722
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
type SpringConfig = {
|
|
2
|
+
type: 'spring';
|
|
3
|
+
stiffness?: number;
|
|
4
|
+
damping?: number;
|
|
5
|
+
mass?: number;
|
|
6
|
+
visualDuration?: number;
|
|
7
|
+
bounce?: number;
|
|
8
|
+
};
|
|
9
|
+
type EasingConfig = {
|
|
10
|
+
type: 'easing';
|
|
11
|
+
duration: number;
|
|
12
|
+
ease: [number, number, number, number];
|
|
13
|
+
};
|
|
14
|
+
type TransitionConfig = SpringConfig | EasingConfig;
|
|
15
|
+
type ActionConfig = {
|
|
16
|
+
type: 'action';
|
|
17
|
+
label?: string;
|
|
18
|
+
};
|
|
19
|
+
type SelectConfig = {
|
|
20
|
+
type: 'select';
|
|
21
|
+
options: (string | {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
})[];
|
|
25
|
+
default?: string;
|
|
26
|
+
};
|
|
27
|
+
type ColorConfig = {
|
|
28
|
+
type: 'color';
|
|
29
|
+
default?: string;
|
|
30
|
+
};
|
|
31
|
+
type TextConfig = {
|
|
32
|
+
type: 'text';
|
|
33
|
+
default?: string;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
};
|
|
36
|
+
type DialValue = number | boolean | string | SpringConfig | EasingConfig | ActionConfig | SelectConfig | ColorConfig | TextConfig;
|
|
37
|
+
type DialConfig = {
|
|
38
|
+
[key: string]: DialValue | [number, number, number, number?] | DialConfig;
|
|
39
|
+
};
|
|
40
|
+
type ResolvedValues<T extends DialConfig> = {
|
|
41
|
+
[K in keyof T]: T[K] extends [number, number, number, number?] ? number : T[K] extends SpringConfig ? TransitionConfig : T[K] extends EasingConfig ? TransitionConfig : T[K] extends SelectConfig ? string : T[K] extends ColorConfig ? string : T[K] extends TextConfig ? string : T[K] extends DialConfig ? ResolvedValues<T[K]> : T[K];
|
|
42
|
+
};
|
|
43
|
+
type DialKitPersistOptions = boolean | {
|
|
44
|
+
key?: string;
|
|
45
|
+
storage?: 'localStorage' | 'sessionStorage';
|
|
46
|
+
presets?: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type TimelineClipTrackMeta = {
|
|
50
|
+
prop: string;
|
|
51
|
+
/** Step folder keys when the track is a sequence. */
|
|
52
|
+
stepKeys?: string[];
|
|
53
|
+
};
|
|
54
|
+
type TimelineClipMeta = {
|
|
55
|
+
key: string;
|
|
56
|
+
label: string;
|
|
57
|
+
color: string;
|
|
58
|
+
/** Code-defined playback behavior; intentionally not exposed as a dial. */
|
|
59
|
+
loop: 'off' | 'repeat';
|
|
60
|
+
/** Group key when the clip lives inside a nested layer, e.g. "circle". */
|
|
61
|
+
group?: string;
|
|
62
|
+
/** Step folder keys for sequence clips, e.g. ["step1", "step2"]. */
|
|
63
|
+
stepKeys?: string[];
|
|
64
|
+
/** Independent property tracks of a props clip — full rows when expanded. */
|
|
65
|
+
tracks?: TimelineClipTrackMeta[];
|
|
66
|
+
};
|
|
67
|
+
type TimelineMeta = {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
duration: number;
|
|
71
|
+
loop: boolean;
|
|
72
|
+
/** Loop wraps back to this time, not 0 — clips before it play once
|
|
73
|
+
* (intro-then-idle). 0 loops the whole timeline. */
|
|
74
|
+
loopStart: number;
|
|
75
|
+
clips: TimelineClipMeta[];
|
|
76
|
+
};
|
|
77
|
+
type TimelineTransport = {
|
|
78
|
+
time: number;
|
|
79
|
+
playing: boolean;
|
|
80
|
+
duration: number;
|
|
81
|
+
/** Completed loop passes — keeps looping clips phase-continuous across
|
|
82
|
+
* timeline wraps. Reset by seek/replay so scrubbing stays deterministic. */
|
|
83
|
+
wraps: number;
|
|
84
|
+
};
|
|
85
|
+
type Listener$1 = () => void;
|
|
86
|
+
/** Length of the repeating span — the whole timeline unless a loop region
|
|
87
|
+
* narrows it. Degenerate regions (start ≥ duration) fall back to the whole
|
|
88
|
+
* timeline so a bad `from` never stalls the clock. */
|
|
89
|
+
declare function loopSpan(duration: number, loopStart: number): number;
|
|
90
|
+
/** Folds an over-run playhead back into the loop region, reporting how many
|
|
91
|
+
* spans were crossed so continuous time (wraps × span + time) never jumps. */
|
|
92
|
+
declare function foldLoopTime(time: number, duration: number, loopStart?: number): {
|
|
93
|
+
time: number;
|
|
94
|
+
wraps: number;
|
|
95
|
+
};
|
|
96
|
+
declare const TIMELINE_CLIP_COLORS: string[];
|
|
97
|
+
declare class TimelineStoreClass {
|
|
98
|
+
private timelines;
|
|
99
|
+
private transports;
|
|
100
|
+
private listeners;
|
|
101
|
+
private globalListeners;
|
|
102
|
+
private registrationCounts;
|
|
103
|
+
private listCache;
|
|
104
|
+
private rafId;
|
|
105
|
+
private lastTick;
|
|
106
|
+
register(meta: TimelineMeta, options: {
|
|
107
|
+
autoplay: boolean;
|
|
108
|
+
}): void;
|
|
109
|
+
update(meta: TimelineMeta): void;
|
|
110
|
+
unregister(id: string): void;
|
|
111
|
+
play(id: string): void;
|
|
112
|
+
pause(id: string): void;
|
|
113
|
+
replay(id: string): void;
|
|
114
|
+
seek(id: string, time: number): void;
|
|
115
|
+
getTransport(id: string): TimelineTransport;
|
|
116
|
+
getTimeline(id: string): TimelineMeta | undefined;
|
|
117
|
+
getTimelines(): TimelineMeta[];
|
|
118
|
+
subscribe(id: string, listener: Listener$1): () => void;
|
|
119
|
+
subscribeGlobal(listener: Listener$1): () => void;
|
|
120
|
+
private applyMeta;
|
|
121
|
+
private ensureLoop;
|
|
122
|
+
private tick;
|
|
123
|
+
private notify;
|
|
124
|
+
private notifyGlobal;
|
|
125
|
+
}
|
|
126
|
+
declare const TimelineStore: TimelineStoreClass;
|
|
127
|
+
|
|
128
|
+
type SpringParams = {
|
|
129
|
+
stiffness: number;
|
|
130
|
+
damping: number;
|
|
131
|
+
mass: number;
|
|
132
|
+
};
|
|
133
|
+
declare function clamp(value: number, min: number, max: number): number;
|
|
134
|
+
|
|
135
|
+
type TimelineClipLoop = 'off' | 'repeat';
|
|
136
|
+
type TimelineStepValues = {
|
|
137
|
+
[key: string]: DialConfig[string] | undefined;
|
|
138
|
+
};
|
|
139
|
+
type TimelineStepConfig = {
|
|
140
|
+
duration?: number;
|
|
141
|
+
to?: TimelineStepValues;
|
|
142
|
+
transition?: TransitionConfig;
|
|
143
|
+
};
|
|
144
|
+
type TimelinePropStepConfig = {
|
|
145
|
+
duration?: number;
|
|
146
|
+
to?: number | string;
|
|
147
|
+
transition?: TransitionConfig;
|
|
148
|
+
};
|
|
149
|
+
type TimelinePropConfig = {
|
|
150
|
+
from?: number | string;
|
|
151
|
+
to?: number | string;
|
|
152
|
+
duration?: number;
|
|
153
|
+
/** Offset from the clip's `at` in seconds. */
|
|
154
|
+
delay?: number;
|
|
155
|
+
transition?: TransitionConfig;
|
|
156
|
+
steps?: TimelinePropStepConfig[];
|
|
157
|
+
};
|
|
158
|
+
type TimelineClipBase = {
|
|
159
|
+
at: number;
|
|
160
|
+
duration?: number;
|
|
161
|
+
transition?: TransitionConfig;
|
|
162
|
+
loop?: boolean | TimelineClipLoop;
|
|
163
|
+
};
|
|
164
|
+
type TimelineClipConfig = TimelineClipBase & ({
|
|
165
|
+
from?: DialConfig;
|
|
166
|
+
to?: DialConfig;
|
|
167
|
+
steps?: never;
|
|
168
|
+
props?: never;
|
|
169
|
+
} | {
|
|
170
|
+
from?: DialConfig;
|
|
171
|
+
to?: never;
|
|
172
|
+
/** Sequential legs on one row — a segmented bar; boundaries retime legs. */
|
|
173
|
+
steps: TimelineStepConfig[];
|
|
174
|
+
props?: never;
|
|
175
|
+
} | {
|
|
176
|
+
from?: never;
|
|
177
|
+
to?: never;
|
|
178
|
+
steps?: never;
|
|
179
|
+
/** Independent per-property tracks — mutually exclusive with from/to/steps. */
|
|
180
|
+
props: {
|
|
181
|
+
[prop: string]: TimelinePropConfig;
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
/** Nested keys group clips into a collapsible layer — purely presentational. */
|
|
185
|
+
type TimelineGroupConfig = {
|
|
186
|
+
[key: string]: TimelineClipConfig;
|
|
187
|
+
};
|
|
188
|
+
type TimelineConfig = {
|
|
189
|
+
/** Total timeline length in seconds. Inferred from the last clip when omitted. */
|
|
190
|
+
duration?: number;
|
|
191
|
+
} & {
|
|
192
|
+
[key: string]: TimelineClipConfig | TimelineGroupConfig | number | undefined;
|
|
193
|
+
};
|
|
194
|
+
/** CSS-friendly output for consumers not using Motion — spread into a style. */
|
|
195
|
+
type TimelineClipCss = {
|
|
196
|
+
transitionDuration: string;
|
|
197
|
+
transitionTimingFunction: string;
|
|
198
|
+
};
|
|
199
|
+
type TimelineClipValues<C extends TimelineClipConfig = TimelineClipConfig> = {
|
|
200
|
+
at: number;
|
|
201
|
+
duration: number;
|
|
202
|
+
/** Effective code-defined loop mode. */
|
|
203
|
+
loop: TimelineClipLoop;
|
|
204
|
+
/** Playhead is at or past the clip start. */
|
|
205
|
+
started: boolean;
|
|
206
|
+
/** Playhead is inside the clip — for looping clips, inside any cycle. */
|
|
207
|
+
active: boolean;
|
|
208
|
+
/** Playhead is past the clip end (for looping clips, past the timeline end). */
|
|
209
|
+
done: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* 0–1 position of the playhead within the clip — cycle progress (a
|
|
212
|
+
* sawtooth) for looping clips, sequence progress for steps clips.
|
|
213
|
+
*/
|
|
214
|
+
progress: number;
|
|
215
|
+
/** Index of the leg under the playhead, for sequence clips. */
|
|
216
|
+
step: C['steps'] extends TimelineStepConfig[] ? number : undefined;
|
|
217
|
+
from: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
218
|
+
[K in keyof C['props']]: number | string;
|
|
219
|
+
} : C['from'] extends DialConfig ? ResolvedValues<C['from']> : undefined;
|
|
220
|
+
to: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
221
|
+
[K in keyof C['props']]: number | string;
|
|
222
|
+
} : C['steps'] extends TimelineStepConfig[] ? C['from'] extends DialConfig ? ResolvedValues<C['from']> : Record<string, number | string> : C['to'] extends DialConfig ? ResolvedValues<C['to']> : undefined;
|
|
223
|
+
/** `to` once the clip has started, `from` before — hand it to Motion's animate.
|
|
224
|
+
* For sequences this is the final merged state; for props clips, per-track
|
|
225
|
+
* endpoint records. */
|
|
226
|
+
animate: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
227
|
+
[K in keyof C['props']]: number | string;
|
|
228
|
+
} : C['steps'] extends TimelineStepConfig[] ? C['from'] extends DialConfig ? ResolvedValues<C['from']> : Record<string, number | string> | undefined : C['to'] extends DialConfig ? C['from'] extends DialConfig ? ResolvedValues<C['from']> | ResolvedValues<C['to']> : ResolvedValues<C['to']> | undefined : undefined;
|
|
229
|
+
/** The clip's editable curve — single-curve clips only. */
|
|
230
|
+
transition: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
|
|
231
|
+
transition: TransitionConfig;
|
|
232
|
+
} | {
|
|
233
|
+
from: DialConfig;
|
|
234
|
+
} | {
|
|
235
|
+
to: DialConfig;
|
|
236
|
+
} ? TransitionConfig : undefined;
|
|
237
|
+
/** Duration + timing-function for native CSS transitions — single-curve clips only. */
|
|
238
|
+
css: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
|
|
239
|
+
transition: TransitionConfig;
|
|
240
|
+
} | {
|
|
241
|
+
from: DialConfig;
|
|
242
|
+
} | {
|
|
243
|
+
to: DialConfig;
|
|
244
|
+
} ? TimelineClipCss : undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Values interpolated through the clip's curves at the current playhead —
|
|
247
|
+
* bind to style for true scrubbing: the element is exactly at this point
|
|
248
|
+
* in time whether playing, paused, or scrubbing. Sequence clips report the
|
|
249
|
+
* merged state of all legs (declare every animated property in `from`);
|
|
250
|
+
* props clips report every track's value.
|
|
251
|
+
*/
|
|
252
|
+
current: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
253
|
+
[K in keyof C['props']]: number | string;
|
|
254
|
+
} : C['steps'] extends TimelineStepConfig[] ? C['from'] extends DialConfig ? ResolvedValues<C['from']> : Record<string, number | string> : C['to'] extends DialConfig ? C['from'] extends DialConfig ? ResolvedValues<C['from']> | ResolvedValues<C['to']> : undefined : undefined;
|
|
255
|
+
};
|
|
256
|
+
type TimelineGroupValues<G extends TimelineGroupConfig> = {
|
|
257
|
+
[K in keyof G as G[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<G[K], TimelineClipConfig>>;
|
|
258
|
+
};
|
|
259
|
+
type DialTimelineValues<T extends TimelineConfig> = {
|
|
260
|
+
time: number;
|
|
261
|
+
playing: boolean;
|
|
262
|
+
duration: number;
|
|
263
|
+
play: () => void;
|
|
264
|
+
pause: () => void;
|
|
265
|
+
replay: () => void;
|
|
266
|
+
seek: (time: number) => void;
|
|
267
|
+
} & {
|
|
268
|
+
[K in keyof T as T[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<T[K], TimelineClipConfig>>;
|
|
269
|
+
} & {
|
|
270
|
+
[K in keyof T as T[K] extends TimelineClipConfig ? never : T[K] extends TimelineGroupConfig ? K : never]: TimelineGroupValues<Extract<T[K], TimelineGroupConfig>>;
|
|
271
|
+
};
|
|
272
|
+
declare const TIMELINE_MIN_CLIP_DURATION = 0.05;
|
|
273
|
+
type ParsedTimeline = {
|
|
274
|
+
duration: number;
|
|
275
|
+
dialConfig: DialConfig;
|
|
276
|
+
clips: TimelineClipMeta[];
|
|
277
|
+
};
|
|
278
|
+
declare function parseTimelineConfig(config: TimelineConfig): ParsedTimeline;
|
|
279
|
+
type CurveStatic = {
|
|
280
|
+
duration: number;
|
|
281
|
+
spring?: SpringParams;
|
|
282
|
+
settle?: number;
|
|
283
|
+
ease?: [number, number, number, number];
|
|
284
|
+
};
|
|
285
|
+
type TimelineStepStatic = {
|
|
286
|
+
key: string | null;
|
|
287
|
+
offset: number;
|
|
288
|
+
duration: number;
|
|
289
|
+
isPhysics: boolean;
|
|
290
|
+
/** Full property state at step start — the hold rule made concrete. */
|
|
291
|
+
start: Record<string, unknown>;
|
|
292
|
+
/** Targets this step animates; untouched properties hold `start`. */
|
|
293
|
+
to: Record<string, unknown>;
|
|
294
|
+
curve: CurveStatic;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* One track: a step chain with its own cycle length and phase offset from
|
|
298
|
+
* the clip's `at`. This is the unified runtime model — a shared-timing clip
|
|
299
|
+
* is exactly one track (prop unset, delay 0) whose steps carry the full
|
|
300
|
+
* property record; a props clip is one single-property track per entry.
|
|
301
|
+
*/
|
|
302
|
+
type TimelineTrackStatic = {
|
|
303
|
+
/** Set for a props clip's single-property tracks; unset for the shared track. */
|
|
304
|
+
prop?: string;
|
|
305
|
+
delay: number;
|
|
306
|
+
duration: number;
|
|
307
|
+
steps: TimelineStepStatic[];
|
|
308
|
+
};
|
|
309
|
+
type TimelineClipStatic = {
|
|
310
|
+
key: string;
|
|
311
|
+
childKey: string;
|
|
312
|
+
group?: string;
|
|
313
|
+
at: number;
|
|
314
|
+
/** Effective total duration — the bar length (one cycle for looping clips;
|
|
315
|
+
* the widest track extent for props clips). */
|
|
316
|
+
duration: number;
|
|
317
|
+
loop: TimelineClipLoop;
|
|
318
|
+
/** Where the clip stops affecting values: at + duration, or the timeline end when looping. */
|
|
319
|
+
end: number;
|
|
320
|
+
isPhysics: boolean;
|
|
321
|
+
/** Motion-ready transition, its duration injected from the bar — single-curve clips only. */
|
|
322
|
+
transition?: TransitionConfig;
|
|
323
|
+
css?: TimelineClipCss;
|
|
324
|
+
from?: Record<string, unknown>;
|
|
325
|
+
/** Final merged state (the last leg's landing values for sequences). */
|
|
326
|
+
to?: Record<string, unknown>;
|
|
327
|
+
/** Every animating clip is tracks; empty for markers. */
|
|
328
|
+
tracks: TimelineTrackStatic[];
|
|
329
|
+
explicitSteps: boolean;
|
|
330
|
+
/** Union of every property the clip touches. */
|
|
331
|
+
props?: string[];
|
|
332
|
+
};
|
|
333
|
+
declare function computeStaticClips(parsed: ParsedTimeline, flatValues: Record<string, DialValue>): TimelineClipStatic[];
|
|
334
|
+
type TimelineStaticState = {
|
|
335
|
+
duration: number;
|
|
336
|
+
clips: TimelineClipStatic[];
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* Resolves the editable clip model and grows the timeline when a live value
|
|
340
|
+
* creates content beyond its authored window. This is most important for
|
|
341
|
+
* physics springs: changing stiffness/damping changes their emergent length.
|
|
342
|
+
* The parsed duration remains the minimum, so shortening a clip never removes
|
|
343
|
+
* the original editing room.
|
|
344
|
+
*/
|
|
345
|
+
declare function computeStaticTimeline(parsed: ParsedTimeline, flatValues: Record<string, DialValue>): TimelineStaticState;
|
|
346
|
+
/** The dock's resolver: the same static model the hook animates with,
|
|
347
|
+
* rebuilt from flat stored values — bars, popovers, and playback can never
|
|
348
|
+
* disagree about geometry. */
|
|
349
|
+
declare function computeClipStaticFromValues(values: Record<string, DialValue>, clip: TimelineClipMeta, timelineDuration: number): TimelineClipStatic;
|
|
350
|
+
/**
|
|
351
|
+
* `time` is the playhead (what the dock shows); `cycleTime` is continuous
|
|
352
|
+
* time across timeline wraps (wraps × duration + time). Looping clips fold
|
|
353
|
+
* against `cycleTime`, so a looping timeline never snaps their phase — the
|
|
354
|
+
* window is a viewport onto animations that repeat forever. Scrubbing seeks
|
|
355
|
+
* with cycleTime === time, which is the deterministic first-pass state.
|
|
356
|
+
*/
|
|
357
|
+
declare function computeClipState(clip: TimelineClipStatic, time: number, cycleTime?: number): Record<string, unknown>;
|
|
358
|
+
declare function transitionToCss(transition: TransitionConfig | undefined): TimelineClipCss | undefined;
|
|
359
|
+
/** Popover display values: swap stored shape-only transitions for their
|
|
360
|
+
* effective configs (duration injected from the bar/segment) so the curve
|
|
361
|
+
* editor shows the transition as it actually runs. */
|
|
362
|
+
declare function timelinePopoverDisplayValues(values: Record<string, DialValue>, clipKey: string, stepKeys?: string[], stepKey?: string): Record<string, DialValue>;
|
|
363
|
+
/** Dragging a track bar edits the property's phase offset. */
|
|
364
|
+
declare function clampTrackDelay(delay: number, at: number, trackDuration: number, timelineDuration: number): number;
|
|
365
|
+
declare function clampClipMove(at: number, duration: number, timelineDuration: number): number;
|
|
366
|
+
declare function clampClipResizeEnd(duration: number, at: number, timelineDuration: number): number;
|
|
367
|
+
declare function clampClipResizeStart(newAt: number, at: number, duration: number): {
|
|
368
|
+
at: number;
|
|
369
|
+
duration: number;
|
|
370
|
+
};
|
|
371
|
+
/** Resizing one leg of a sequence: the other legs keep their length, the
|
|
372
|
+
* whole bar must still fit the timeline. */
|
|
373
|
+
declare function clampStepResize(duration: number, at: number, otherStepsTotal: number, timelineDuration: number): number;
|
|
374
|
+
/** Copy-for-agent export: strip editor-only state, normalize shape-only
|
|
375
|
+
* transitions, resolve physics durations, and drop zero-value defaults. */
|
|
376
|
+
declare function normalizeTimelineValuesForCopy(values: Record<string, DialValue>, clips: TimelineClipMeta[]): Record<string, DialValue>;
|
|
377
|
+
declare function formatClock(time: number, tenths?: boolean): string;
|
|
378
|
+
declare function formatSeconds(value: number): string;
|
|
379
|
+
declare function formatStepLabel(stepKey: string): string;
|
|
380
|
+
|
|
381
|
+
interface DialTimelineOptions {
|
|
382
|
+
id?: string;
|
|
383
|
+
persist?: DialKitPersistOptions;
|
|
384
|
+
/** Start playing on mount. Defaults to true. */
|
|
385
|
+
autoplay?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Loop when the playhead reaches the end. `true` restarts the whole
|
|
388
|
+
* timeline; `{ from }` wraps back to that time instead, so clips before it
|
|
389
|
+
* play once and looping clips keep cycling forever. Defaults to false.
|
|
390
|
+
*/
|
|
391
|
+
loop?: boolean | {
|
|
392
|
+
from: number;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
type TimelineActions = {
|
|
396
|
+
play: () => void;
|
|
397
|
+
pause: () => void;
|
|
398
|
+
replay: () => void;
|
|
399
|
+
seek: (time: number) => void;
|
|
400
|
+
};
|
|
401
|
+
/** One resolution of the public loop option, shared by every adapter. */
|
|
402
|
+
declare function resolveTimelineLoop(loop: DialTimelineOptions['loop']): {
|
|
403
|
+
enabled: boolean;
|
|
404
|
+
start: number;
|
|
405
|
+
};
|
|
406
|
+
declare function buildTimelineMeta(id: string, name: string, duration: number, parsed: ParsedTimeline, loop: DialTimelineOptions['loop']): TimelineMeta;
|
|
407
|
+
/**
|
|
408
|
+
* Framework-neutral frame pass. Adapters only own lifecycle and reactivity;
|
|
409
|
+
* the value shape and loop-cycle math stay identical everywhere.
|
|
410
|
+
*/
|
|
411
|
+
declare function buildTimelineValues<T extends TimelineConfig>(staticClips: TimelineClipStatic[], transport: TimelineTransport, timelineDuration: number, loopStart: number, actions: TimelineActions): DialTimelineValues<T>;
|
|
412
|
+
|
|
413
|
+
type Listener = () => void;
|
|
414
|
+
type VisibilityController = {
|
|
415
|
+
visible?: boolean;
|
|
416
|
+
defaultVisible: boolean;
|
|
417
|
+
onVisibilityChange?: (visible: boolean) => void;
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* UI-only state shared by the toolkit root and the timeline portal.
|
|
421
|
+
* Playback deliberately lives elsewhere: hiding the editor must never pause
|
|
422
|
+
* or otherwise change the animation it is inspecting.
|
|
423
|
+
*/
|
|
424
|
+
declare class TimelineUiStoreClass {
|
|
425
|
+
private visible;
|
|
426
|
+
private initialized;
|
|
427
|
+
private controllers;
|
|
428
|
+
private listeners;
|
|
429
|
+
getVisible(): boolean;
|
|
430
|
+
registerController(id: symbol, controller: VisibilityController): () => void;
|
|
431
|
+
updateController(id: symbol, controller: VisibilityController): void;
|
|
432
|
+
requestVisible(visible: boolean): void;
|
|
433
|
+
toggle(): void;
|
|
434
|
+
subscribe(listener: Listener): () => void;
|
|
435
|
+
private notify;
|
|
436
|
+
}
|
|
437
|
+
declare const TimelineUiStore: TimelineUiStoreClass;
|
|
438
|
+
|
|
439
|
+
declare function buildCopyInstruction(hookName: string, panelName: string, values: Record<string, DialValue>): string;
|
|
440
|
+
|
|
441
|
+
declare const isDevDefault: boolean;
|
|
442
|
+
|
|
443
|
+
export { type DialTimelineOptions, type DialTimelineValues, type ParsedTimeline, TIMELINE_CLIP_COLORS, TIMELINE_MIN_CLIP_DURATION, type TimelineActions, type TimelineClipConfig, type TimelineClipCss, type TimelineClipLoop, type TimelineClipMeta, type TimelineClipStatic, type TimelineClipTrackMeta, type TimelineClipValues, type TimelineConfig, type TimelineGroupConfig, type TimelineGroupValues, type TimelineMeta, type TimelinePropConfig, type TimelinePropStepConfig, type TimelineStaticState, type TimelineStepConfig, type TimelineStepStatic, type TimelineStepValues, TimelineStore, type TimelineTrackStatic, type TimelineTransport, TimelineUiStore, buildCopyInstruction, buildTimelineMeta, buildTimelineValues, clamp, clampClipMove, clampClipResizeEnd, clampClipResizeStart, clampStepResize, clampTrackDelay, computeClipState, computeClipStaticFromValues, computeStaticClips, computeStaticTimeline, foldLoopTime, formatClock, formatSeconds, formatStepLabel, isDevDefault, loopSpan, normalizeTimelineValuesForCopy, parseTimelineConfig, resolveTimelineLoop, timelinePopoverDisplayValues, transitionToCss };
|