dialkit 1.3.0 → 1.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 +433 -3
- package/dist/icons.d.ts +4 -1
- package/dist/icons.js +13 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +3118 -480
- 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 +3050 -417
- package/dist/index.js.map +1 -1
- package/dist/solid/index.d.ts +225 -3
- package/dist/solid/index.js +5697 -2508
- 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 +704 -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 +76 -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 +756 -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 +704 -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 +2867 -361
- 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
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
type SpringConfig = {
|
|
@@ -76,8 +77,9 @@ type PanelConfig = {
|
|
|
76
77
|
controls: ControlMeta[];
|
|
77
78
|
values: Record<string, DialValue>;
|
|
78
79
|
shortcuts: Record<string, ShortcutConfig>;
|
|
80
|
+
kind?: 'timeline';
|
|
79
81
|
};
|
|
80
|
-
type Listener = () => void;
|
|
82
|
+
type Listener$1 = () => void;
|
|
81
83
|
type ActionListener = (action: string) => void;
|
|
82
84
|
type Preset = {
|
|
83
85
|
id: string;
|
|
@@ -92,9 +94,13 @@ type DialKitPersistOptions = boolean | {
|
|
|
92
94
|
type DialStorePanelOptions = {
|
|
93
95
|
retainOnUnmount?: boolean;
|
|
94
96
|
persist?: DialKitPersistOptions;
|
|
97
|
+
kind?: 'timeline';
|
|
95
98
|
};
|
|
96
99
|
declare class DialStoreClass {
|
|
97
100
|
private panels;
|
|
101
|
+
private panelsSnapshot;
|
|
102
|
+
private standardPanelsSnapshot;
|
|
103
|
+
private timelinePanelsSnapshot;
|
|
98
104
|
private listeners;
|
|
99
105
|
private globalListeners;
|
|
100
106
|
private snapshots;
|
|
@@ -118,10 +124,10 @@ declare class DialStoreClass {
|
|
|
118
124
|
getTransitionMode(panelId: string, path: string): 'easing' | 'simple' | 'advanced';
|
|
119
125
|
getValue(panelId: string, path: string): DialValue | undefined;
|
|
120
126
|
getValues(panelId: string): Record<string, DialValue>;
|
|
121
|
-
getPanels(): PanelConfig[];
|
|
127
|
+
getPanels(kind?: 'panel' | 'timeline'): PanelConfig[];
|
|
122
128
|
getPanel(id: string): PanelConfig | undefined;
|
|
123
|
-
subscribe(panelId: string, listener: Listener): () => void;
|
|
124
|
-
subscribeGlobal(listener: Listener): () => void;
|
|
129
|
+
subscribe(panelId: string, listener: Listener$1): () => void;
|
|
130
|
+
subscribeGlobal(listener: Listener$1): () => void;
|
|
125
131
|
subscribeActions(panelId: string, listener: ActionListener): () => void;
|
|
126
132
|
triggerAction(panelId: string, path: string): void;
|
|
127
133
|
savePreset(panelId: string, name: string): string;
|
|
@@ -200,6 +206,258 @@ interface DialRootProps {
|
|
|
200
206
|
}
|
|
201
207
|
declare function DialRoot({ position, defaultOpen, mode, theme, productionEnabled, onOpenChange }: DialRootProps): react_jsx_runtime.JSX.Element | null;
|
|
202
208
|
|
|
209
|
+
type TimelineClipTrackMeta = {
|
|
210
|
+
prop: string;
|
|
211
|
+
/** Step folder keys when the track is a sequence. */
|
|
212
|
+
stepKeys?: string[];
|
|
213
|
+
};
|
|
214
|
+
type TimelineClipMeta = {
|
|
215
|
+
key: string;
|
|
216
|
+
label: string;
|
|
217
|
+
color: string;
|
|
218
|
+
/** Code-defined playback behavior; intentionally not exposed as a dial. */
|
|
219
|
+
loop: 'off' | 'repeat';
|
|
220
|
+
/** Group key when the clip lives inside a nested layer, e.g. "circle". */
|
|
221
|
+
group?: string;
|
|
222
|
+
/** Step folder keys for sequence clips, e.g. ["step1", "step2"]. */
|
|
223
|
+
stepKeys?: string[];
|
|
224
|
+
/** Independent property tracks of a props clip — full rows when expanded. */
|
|
225
|
+
tracks?: TimelineClipTrackMeta[];
|
|
226
|
+
};
|
|
227
|
+
type TimelineMeta = {
|
|
228
|
+
id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
duration: number;
|
|
231
|
+
loop: boolean;
|
|
232
|
+
/** Loop wraps back to this time, not 0 — clips before it play once
|
|
233
|
+
* (intro-then-idle). 0 loops the whole timeline. */
|
|
234
|
+
loopStart: number;
|
|
235
|
+
clips: TimelineClipMeta[];
|
|
236
|
+
};
|
|
237
|
+
type TimelineTransport = {
|
|
238
|
+
time: number;
|
|
239
|
+
playing: boolean;
|
|
240
|
+
duration: number;
|
|
241
|
+
/** Completed loop passes — keeps looping clips phase-continuous across
|
|
242
|
+
* timeline wraps. Reset by seek/replay so scrubbing stays deterministic. */
|
|
243
|
+
wraps: number;
|
|
244
|
+
};
|
|
245
|
+
type Listener = () => void;
|
|
246
|
+
declare class TimelineStoreClass {
|
|
247
|
+
private timelines;
|
|
248
|
+
private transports;
|
|
249
|
+
private listeners;
|
|
250
|
+
private globalListeners;
|
|
251
|
+
private registrationCounts;
|
|
252
|
+
private listCache;
|
|
253
|
+
private rafId;
|
|
254
|
+
private lastTick;
|
|
255
|
+
register(meta: TimelineMeta, options: {
|
|
256
|
+
autoplay: boolean;
|
|
257
|
+
}): void;
|
|
258
|
+
update(meta: TimelineMeta): void;
|
|
259
|
+
unregister(id: string): void;
|
|
260
|
+
play(id: string): void;
|
|
261
|
+
pause(id: string): void;
|
|
262
|
+
replay(id: string): void;
|
|
263
|
+
seek(id: string, time: number): void;
|
|
264
|
+
getTransport(id: string): TimelineTransport;
|
|
265
|
+
getTimeline(id: string): TimelineMeta | undefined;
|
|
266
|
+
getTimelines(): TimelineMeta[];
|
|
267
|
+
subscribe(id: string, listener: Listener): () => void;
|
|
268
|
+
subscribeGlobal(listener: Listener): () => void;
|
|
269
|
+
private applyMeta;
|
|
270
|
+
private ensureLoop;
|
|
271
|
+
private tick;
|
|
272
|
+
private notify;
|
|
273
|
+
private notifyGlobal;
|
|
274
|
+
}
|
|
275
|
+
declare const TimelineStore: TimelineStoreClass;
|
|
276
|
+
|
|
277
|
+
type TimelineClipLoop = 'off' | 'repeat';
|
|
278
|
+
type TimelineStepValues = {
|
|
279
|
+
[key: string]: DialConfig[string] | undefined;
|
|
280
|
+
};
|
|
281
|
+
type TimelineStepConfig = {
|
|
282
|
+
duration?: number;
|
|
283
|
+
to?: TimelineStepValues;
|
|
284
|
+
transition?: TransitionConfig;
|
|
285
|
+
};
|
|
286
|
+
type TimelinePropStepConfig = {
|
|
287
|
+
duration?: number;
|
|
288
|
+
to?: number | string;
|
|
289
|
+
transition?: TransitionConfig;
|
|
290
|
+
};
|
|
291
|
+
type TimelinePropConfig = {
|
|
292
|
+
from?: number | string;
|
|
293
|
+
to?: number | string;
|
|
294
|
+
duration?: number;
|
|
295
|
+
/** Offset from the clip's `at` in seconds. */
|
|
296
|
+
delay?: number;
|
|
297
|
+
transition?: TransitionConfig;
|
|
298
|
+
steps?: TimelinePropStepConfig[];
|
|
299
|
+
};
|
|
300
|
+
type TimelineClipBase = {
|
|
301
|
+
at: number;
|
|
302
|
+
duration?: number;
|
|
303
|
+
transition?: TransitionConfig;
|
|
304
|
+
loop?: boolean | TimelineClipLoop;
|
|
305
|
+
};
|
|
306
|
+
type TimelineClipConfig = TimelineClipBase & ({
|
|
307
|
+
from?: DialConfig;
|
|
308
|
+
to?: DialConfig;
|
|
309
|
+
steps?: never;
|
|
310
|
+
props?: never;
|
|
311
|
+
} | {
|
|
312
|
+
from?: DialConfig;
|
|
313
|
+
to?: never;
|
|
314
|
+
/** Sequential legs on one row — a segmented bar; boundaries retime legs. */
|
|
315
|
+
steps: TimelineStepConfig[];
|
|
316
|
+
props?: never;
|
|
317
|
+
} | {
|
|
318
|
+
from?: never;
|
|
319
|
+
to?: never;
|
|
320
|
+
steps?: never;
|
|
321
|
+
/** Independent per-property tracks — mutually exclusive with from/to/steps. */
|
|
322
|
+
props: {
|
|
323
|
+
[prop: string]: TimelinePropConfig;
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
/** Nested keys group clips into a collapsible layer — purely presentational. */
|
|
327
|
+
type TimelineGroupConfig = {
|
|
328
|
+
[key: string]: TimelineClipConfig;
|
|
329
|
+
};
|
|
330
|
+
type TimelineConfig = {
|
|
331
|
+
/** Total timeline length in seconds. Inferred from the last clip when omitted. */
|
|
332
|
+
duration?: number;
|
|
333
|
+
} & {
|
|
334
|
+
[key: string]: TimelineClipConfig | TimelineGroupConfig | number | undefined;
|
|
335
|
+
};
|
|
336
|
+
/** CSS-friendly output for consumers not using Motion — spread into a style. */
|
|
337
|
+
type TimelineClipCss = {
|
|
338
|
+
transitionDuration: string;
|
|
339
|
+
transitionTimingFunction: string;
|
|
340
|
+
};
|
|
341
|
+
type TimelineClipValues<C extends TimelineClipConfig = TimelineClipConfig> = {
|
|
342
|
+
at: number;
|
|
343
|
+
duration: number;
|
|
344
|
+
/** Effective code-defined loop mode. */
|
|
345
|
+
loop: TimelineClipLoop;
|
|
346
|
+
/** Playhead is at or past the clip start. */
|
|
347
|
+
started: boolean;
|
|
348
|
+
/** Playhead is inside the clip — for looping clips, inside any cycle. */
|
|
349
|
+
active: boolean;
|
|
350
|
+
/** Playhead is past the clip end (for looping clips, past the timeline end). */
|
|
351
|
+
done: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* 0–1 position of the playhead within the clip — cycle progress (a
|
|
354
|
+
* sawtooth) for looping clips, sequence progress for steps clips.
|
|
355
|
+
*/
|
|
356
|
+
progress: number;
|
|
357
|
+
/** Index of the leg under the playhead, for sequence clips. */
|
|
358
|
+
step: C['steps'] extends TimelineStepConfig[] ? number : undefined;
|
|
359
|
+
from: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
360
|
+
[K in keyof C['props']]: number | string;
|
|
361
|
+
} : C['from'] extends DialConfig ? ResolvedValues<C['from']> : undefined;
|
|
362
|
+
to: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
363
|
+
[K in keyof C['props']]: number | string;
|
|
364
|
+
} : C['steps'] extends TimelineStepConfig[] ? C['from'] extends DialConfig ? ResolvedValues<C['from']> : Record<string, number | string> : C['to'] extends DialConfig ? ResolvedValues<C['to']> : undefined;
|
|
365
|
+
/** `to` once the clip has started, `from` before — hand it to Motion's animate.
|
|
366
|
+
* For sequences this is the final merged state; for props clips, per-track
|
|
367
|
+
* endpoint records. */
|
|
368
|
+
animate: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
369
|
+
[K in keyof C['props']]: number | string;
|
|
370
|
+
} : 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;
|
|
371
|
+
/** The clip's editable curve — single-curve clips only. */
|
|
372
|
+
transition: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
|
|
373
|
+
transition: TransitionConfig;
|
|
374
|
+
} | {
|
|
375
|
+
from: DialConfig;
|
|
376
|
+
} | {
|
|
377
|
+
to: DialConfig;
|
|
378
|
+
} ? TransitionConfig : undefined;
|
|
379
|
+
/** Duration + timing-function for native CSS transitions — single-curve clips only. */
|
|
380
|
+
css: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
|
|
381
|
+
transition: TransitionConfig;
|
|
382
|
+
} | {
|
|
383
|
+
from: DialConfig;
|
|
384
|
+
} | {
|
|
385
|
+
to: DialConfig;
|
|
386
|
+
} ? TimelineClipCss : undefined;
|
|
387
|
+
/**
|
|
388
|
+
* Values interpolated through the clip's curves at the current playhead —
|
|
389
|
+
* bind to style for true scrubbing: the element is exactly at this point
|
|
390
|
+
* in time whether playing, paused, or scrubbing. Sequence clips report the
|
|
391
|
+
* merged state of all legs (declare every animated property in `from`);
|
|
392
|
+
* props clips report every track's value.
|
|
393
|
+
*/
|
|
394
|
+
current: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
395
|
+
[K in keyof C['props']]: number | string;
|
|
396
|
+
} : 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;
|
|
397
|
+
};
|
|
398
|
+
type TimelineGroupValues<G extends TimelineGroupConfig> = {
|
|
399
|
+
[K in keyof G as G[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<G[K], TimelineClipConfig>>;
|
|
400
|
+
};
|
|
401
|
+
type DialTimelineValues<T extends TimelineConfig> = {
|
|
402
|
+
time: number;
|
|
403
|
+
playing: boolean;
|
|
404
|
+
duration: number;
|
|
405
|
+
play: () => void;
|
|
406
|
+
pause: () => void;
|
|
407
|
+
replay: () => void;
|
|
408
|
+
seek: (time: number) => void;
|
|
409
|
+
} & {
|
|
410
|
+
[K in keyof T as T[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<T[K], TimelineClipConfig>>;
|
|
411
|
+
} & {
|
|
412
|
+
[K in keyof T as T[K] extends TimelineClipConfig ? never : T[K] extends TimelineGroupConfig ? K : never]: TimelineGroupValues<Extract<T[K], TimelineGroupConfig>>;
|
|
413
|
+
};
|
|
414
|
+
declare function formatClock(time: number, tenths?: boolean): string;
|
|
415
|
+
|
|
416
|
+
interface DialTimelineOptions {
|
|
417
|
+
id?: string;
|
|
418
|
+
persist?: DialKitPersistOptions;
|
|
419
|
+
/** Start playing on mount. Defaults to true. */
|
|
420
|
+
autoplay?: boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Loop when the playhead reaches the end. `true` restarts the whole
|
|
423
|
+
* timeline; `{ from }` wraps back to that time instead, so clips before it
|
|
424
|
+
* play once and looping clips keep cycling forever. Defaults to false.
|
|
425
|
+
*/
|
|
426
|
+
loop?: boolean | {
|
|
427
|
+
from: number;
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
type UseDialTimelineOptions = DialTimelineOptions;
|
|
432
|
+
declare function useDialTimeline<T extends TimelineConfig>(name: string, config: T, options?: UseDialTimelineOptions): DialTimelineValues<T>;
|
|
433
|
+
|
|
434
|
+
interface DialTimelineProps {
|
|
435
|
+
theme?: DialTheme;
|
|
436
|
+
/** Initial dock visibility. Expansion is controlled separately by defaultOpen. */
|
|
437
|
+
defaultVisible?: boolean;
|
|
438
|
+
/** Controlled dock visibility. */
|
|
439
|
+
visible?: boolean;
|
|
440
|
+
onVisibilityChange?: (visible: boolean) => void;
|
|
441
|
+
defaultOpen?: boolean;
|
|
442
|
+
productionEnabled?: boolean;
|
|
443
|
+
}
|
|
444
|
+
declare const DialTimeline: react.NamedExoticComponent<DialTimelineProps>;
|
|
445
|
+
|
|
446
|
+
interface ControlRendererProps {
|
|
447
|
+
panelId: string;
|
|
448
|
+
controls: ControlMeta[];
|
|
449
|
+
values: Record<string, DialValue>;
|
|
450
|
+
/** Optional timeline-owned duration rendered inside the transition editor. */
|
|
451
|
+
transitionDuration?: {
|
|
452
|
+
value: number;
|
|
453
|
+
onChange: (value: number) => void;
|
|
454
|
+
min?: number;
|
|
455
|
+
max?: number;
|
|
456
|
+
step?: number;
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
declare function ControlRenderer({ panelId, controls, values, transitionDuration }: ControlRendererProps): react_jsx_runtime.JSX.Element;
|
|
460
|
+
|
|
203
461
|
interface SliderProps {
|
|
204
462
|
label: string;
|
|
205
463
|
value: number;
|
|
@@ -263,8 +521,18 @@ interface TransitionControlProps {
|
|
|
263
521
|
label: string;
|
|
264
522
|
value: TransitionConfig;
|
|
265
523
|
onChange: (value: TransitionConfig) => void;
|
|
524
|
+
/** Hide duration sliders when something else owns the duration (e.g. a timeline clip bar). */
|
|
525
|
+
hideDuration?: boolean;
|
|
526
|
+
/** Route duration edits through an external owner while keeping this control's layout. */
|
|
527
|
+
durationControl?: {
|
|
528
|
+
value: number;
|
|
529
|
+
onChange: (value: number) => void;
|
|
530
|
+
min?: number;
|
|
531
|
+
max?: number;
|
|
532
|
+
step?: number;
|
|
533
|
+
};
|
|
266
534
|
}
|
|
267
|
-
declare function TransitionControl({ panelId, path, label, value, onChange }: TransitionControlProps): react_jsx_runtime.JSX.Element;
|
|
535
|
+
declare function TransitionControl({ panelId, path, label, value, onChange, hideDuration, durationControl, }: TransitionControlProps): react_jsx_runtime.JSX.Element;
|
|
268
536
|
|
|
269
537
|
interface EasingVisualizationProps {
|
|
270
538
|
easing: EasingConfig;
|
|
@@ -311,4 +579,4 @@ interface ShortcutsMenuProps {
|
|
|
311
579
|
}
|
|
312
580
|
declare function ShortcutsMenu({ panelId }: ShortcutsMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
313
581
|
|
|
314
|
-
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialKitController, type DialKitPersistOptions, type DialKitValueUpdates, type DialMode, type DialPosition, DialRoot, DialStore, type DialTheme, type DialValue, type EasingConfig, EasingVisualization, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, type ShortcutConfig, type ShortcutInteraction, type ShortcutMode, ShortcutsMenu, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type TransitionConfig, TransitionControl, type UseDialOptions, useDialKit, useDialKitController };
|
|
582
|
+
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, ControlRenderer, type DialConfig, type DialKitController, type DialKitPersistOptions, type DialKitValueUpdates, type DialMode, type DialPosition, DialRoot, DialStore, type DialTheme, DialTimeline, type DialTimelineProps, type DialTimelineValues, type DialValue, type EasingConfig, EasingVisualization, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, type ShortcutConfig, type ShortcutInteraction, type ShortcutMode, ShortcutsMenu, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, type TimelineClipConfig, type TimelineClipCss, type TimelineClipLoop, type TimelineClipMeta, type TimelineClipTrackMeta, type TimelineClipValues, type TimelineConfig, type TimelineGroupConfig, type TimelineGroupValues, type TimelineMeta, type TimelinePropConfig, type TimelinePropStepConfig, type TimelineStepConfig, type TimelineStepValues, TimelineStore, type TimelineTransport, Toggle, type TransitionConfig, TransitionControl, type UseDialOptions, type UseDialTimelineOptions, formatClock, useDialKit, useDialKitController, useDialTimeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
type SpringConfig = {
|
|
@@ -76,8 +77,9 @@ type PanelConfig = {
|
|
|
76
77
|
controls: ControlMeta[];
|
|
77
78
|
values: Record<string, DialValue>;
|
|
78
79
|
shortcuts: Record<string, ShortcutConfig>;
|
|
80
|
+
kind?: 'timeline';
|
|
79
81
|
};
|
|
80
|
-
type Listener = () => void;
|
|
82
|
+
type Listener$1 = () => void;
|
|
81
83
|
type ActionListener = (action: string) => void;
|
|
82
84
|
type Preset = {
|
|
83
85
|
id: string;
|
|
@@ -92,9 +94,13 @@ type DialKitPersistOptions = boolean | {
|
|
|
92
94
|
type DialStorePanelOptions = {
|
|
93
95
|
retainOnUnmount?: boolean;
|
|
94
96
|
persist?: DialKitPersistOptions;
|
|
97
|
+
kind?: 'timeline';
|
|
95
98
|
};
|
|
96
99
|
declare class DialStoreClass {
|
|
97
100
|
private panels;
|
|
101
|
+
private panelsSnapshot;
|
|
102
|
+
private standardPanelsSnapshot;
|
|
103
|
+
private timelinePanelsSnapshot;
|
|
98
104
|
private listeners;
|
|
99
105
|
private globalListeners;
|
|
100
106
|
private snapshots;
|
|
@@ -118,10 +124,10 @@ declare class DialStoreClass {
|
|
|
118
124
|
getTransitionMode(panelId: string, path: string): 'easing' | 'simple' | 'advanced';
|
|
119
125
|
getValue(panelId: string, path: string): DialValue | undefined;
|
|
120
126
|
getValues(panelId: string): Record<string, DialValue>;
|
|
121
|
-
getPanels(): PanelConfig[];
|
|
127
|
+
getPanels(kind?: 'panel' | 'timeline'): PanelConfig[];
|
|
122
128
|
getPanel(id: string): PanelConfig | undefined;
|
|
123
|
-
subscribe(panelId: string, listener: Listener): () => void;
|
|
124
|
-
subscribeGlobal(listener: Listener): () => void;
|
|
129
|
+
subscribe(panelId: string, listener: Listener$1): () => void;
|
|
130
|
+
subscribeGlobal(listener: Listener$1): () => void;
|
|
125
131
|
subscribeActions(panelId: string, listener: ActionListener): () => void;
|
|
126
132
|
triggerAction(panelId: string, path: string): void;
|
|
127
133
|
savePreset(panelId: string, name: string): string;
|
|
@@ -200,6 +206,258 @@ interface DialRootProps {
|
|
|
200
206
|
}
|
|
201
207
|
declare function DialRoot({ position, defaultOpen, mode, theme, productionEnabled, onOpenChange }: DialRootProps): react_jsx_runtime.JSX.Element | null;
|
|
202
208
|
|
|
209
|
+
type TimelineClipTrackMeta = {
|
|
210
|
+
prop: string;
|
|
211
|
+
/** Step folder keys when the track is a sequence. */
|
|
212
|
+
stepKeys?: string[];
|
|
213
|
+
};
|
|
214
|
+
type TimelineClipMeta = {
|
|
215
|
+
key: string;
|
|
216
|
+
label: string;
|
|
217
|
+
color: string;
|
|
218
|
+
/** Code-defined playback behavior; intentionally not exposed as a dial. */
|
|
219
|
+
loop: 'off' | 'repeat';
|
|
220
|
+
/** Group key when the clip lives inside a nested layer, e.g. "circle". */
|
|
221
|
+
group?: string;
|
|
222
|
+
/** Step folder keys for sequence clips, e.g. ["step1", "step2"]. */
|
|
223
|
+
stepKeys?: string[];
|
|
224
|
+
/** Independent property tracks of a props clip — full rows when expanded. */
|
|
225
|
+
tracks?: TimelineClipTrackMeta[];
|
|
226
|
+
};
|
|
227
|
+
type TimelineMeta = {
|
|
228
|
+
id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
duration: number;
|
|
231
|
+
loop: boolean;
|
|
232
|
+
/** Loop wraps back to this time, not 0 — clips before it play once
|
|
233
|
+
* (intro-then-idle). 0 loops the whole timeline. */
|
|
234
|
+
loopStart: number;
|
|
235
|
+
clips: TimelineClipMeta[];
|
|
236
|
+
};
|
|
237
|
+
type TimelineTransport = {
|
|
238
|
+
time: number;
|
|
239
|
+
playing: boolean;
|
|
240
|
+
duration: number;
|
|
241
|
+
/** Completed loop passes — keeps looping clips phase-continuous across
|
|
242
|
+
* timeline wraps. Reset by seek/replay so scrubbing stays deterministic. */
|
|
243
|
+
wraps: number;
|
|
244
|
+
};
|
|
245
|
+
type Listener = () => void;
|
|
246
|
+
declare class TimelineStoreClass {
|
|
247
|
+
private timelines;
|
|
248
|
+
private transports;
|
|
249
|
+
private listeners;
|
|
250
|
+
private globalListeners;
|
|
251
|
+
private registrationCounts;
|
|
252
|
+
private listCache;
|
|
253
|
+
private rafId;
|
|
254
|
+
private lastTick;
|
|
255
|
+
register(meta: TimelineMeta, options: {
|
|
256
|
+
autoplay: boolean;
|
|
257
|
+
}): void;
|
|
258
|
+
update(meta: TimelineMeta): void;
|
|
259
|
+
unregister(id: string): void;
|
|
260
|
+
play(id: string): void;
|
|
261
|
+
pause(id: string): void;
|
|
262
|
+
replay(id: string): void;
|
|
263
|
+
seek(id: string, time: number): void;
|
|
264
|
+
getTransport(id: string): TimelineTransport;
|
|
265
|
+
getTimeline(id: string): TimelineMeta | undefined;
|
|
266
|
+
getTimelines(): TimelineMeta[];
|
|
267
|
+
subscribe(id: string, listener: Listener): () => void;
|
|
268
|
+
subscribeGlobal(listener: Listener): () => void;
|
|
269
|
+
private applyMeta;
|
|
270
|
+
private ensureLoop;
|
|
271
|
+
private tick;
|
|
272
|
+
private notify;
|
|
273
|
+
private notifyGlobal;
|
|
274
|
+
}
|
|
275
|
+
declare const TimelineStore: TimelineStoreClass;
|
|
276
|
+
|
|
277
|
+
type TimelineClipLoop = 'off' | 'repeat';
|
|
278
|
+
type TimelineStepValues = {
|
|
279
|
+
[key: string]: DialConfig[string] | undefined;
|
|
280
|
+
};
|
|
281
|
+
type TimelineStepConfig = {
|
|
282
|
+
duration?: number;
|
|
283
|
+
to?: TimelineStepValues;
|
|
284
|
+
transition?: TransitionConfig;
|
|
285
|
+
};
|
|
286
|
+
type TimelinePropStepConfig = {
|
|
287
|
+
duration?: number;
|
|
288
|
+
to?: number | string;
|
|
289
|
+
transition?: TransitionConfig;
|
|
290
|
+
};
|
|
291
|
+
type TimelinePropConfig = {
|
|
292
|
+
from?: number | string;
|
|
293
|
+
to?: number | string;
|
|
294
|
+
duration?: number;
|
|
295
|
+
/** Offset from the clip's `at` in seconds. */
|
|
296
|
+
delay?: number;
|
|
297
|
+
transition?: TransitionConfig;
|
|
298
|
+
steps?: TimelinePropStepConfig[];
|
|
299
|
+
};
|
|
300
|
+
type TimelineClipBase = {
|
|
301
|
+
at: number;
|
|
302
|
+
duration?: number;
|
|
303
|
+
transition?: TransitionConfig;
|
|
304
|
+
loop?: boolean | TimelineClipLoop;
|
|
305
|
+
};
|
|
306
|
+
type TimelineClipConfig = TimelineClipBase & ({
|
|
307
|
+
from?: DialConfig;
|
|
308
|
+
to?: DialConfig;
|
|
309
|
+
steps?: never;
|
|
310
|
+
props?: never;
|
|
311
|
+
} | {
|
|
312
|
+
from?: DialConfig;
|
|
313
|
+
to?: never;
|
|
314
|
+
/** Sequential legs on one row — a segmented bar; boundaries retime legs. */
|
|
315
|
+
steps: TimelineStepConfig[];
|
|
316
|
+
props?: never;
|
|
317
|
+
} | {
|
|
318
|
+
from?: never;
|
|
319
|
+
to?: never;
|
|
320
|
+
steps?: never;
|
|
321
|
+
/** Independent per-property tracks — mutually exclusive with from/to/steps. */
|
|
322
|
+
props: {
|
|
323
|
+
[prop: string]: TimelinePropConfig;
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
/** Nested keys group clips into a collapsible layer — purely presentational. */
|
|
327
|
+
type TimelineGroupConfig = {
|
|
328
|
+
[key: string]: TimelineClipConfig;
|
|
329
|
+
};
|
|
330
|
+
type TimelineConfig = {
|
|
331
|
+
/** Total timeline length in seconds. Inferred from the last clip when omitted. */
|
|
332
|
+
duration?: number;
|
|
333
|
+
} & {
|
|
334
|
+
[key: string]: TimelineClipConfig | TimelineGroupConfig | number | undefined;
|
|
335
|
+
};
|
|
336
|
+
/** CSS-friendly output for consumers not using Motion — spread into a style. */
|
|
337
|
+
type TimelineClipCss = {
|
|
338
|
+
transitionDuration: string;
|
|
339
|
+
transitionTimingFunction: string;
|
|
340
|
+
};
|
|
341
|
+
type TimelineClipValues<C extends TimelineClipConfig = TimelineClipConfig> = {
|
|
342
|
+
at: number;
|
|
343
|
+
duration: number;
|
|
344
|
+
/** Effective code-defined loop mode. */
|
|
345
|
+
loop: TimelineClipLoop;
|
|
346
|
+
/** Playhead is at or past the clip start. */
|
|
347
|
+
started: boolean;
|
|
348
|
+
/** Playhead is inside the clip — for looping clips, inside any cycle. */
|
|
349
|
+
active: boolean;
|
|
350
|
+
/** Playhead is past the clip end (for looping clips, past the timeline end). */
|
|
351
|
+
done: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* 0–1 position of the playhead within the clip — cycle progress (a
|
|
354
|
+
* sawtooth) for looping clips, sequence progress for steps clips.
|
|
355
|
+
*/
|
|
356
|
+
progress: number;
|
|
357
|
+
/** Index of the leg under the playhead, for sequence clips. */
|
|
358
|
+
step: C['steps'] extends TimelineStepConfig[] ? number : undefined;
|
|
359
|
+
from: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
360
|
+
[K in keyof C['props']]: number | string;
|
|
361
|
+
} : C['from'] extends DialConfig ? ResolvedValues<C['from']> : undefined;
|
|
362
|
+
to: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
363
|
+
[K in keyof C['props']]: number | string;
|
|
364
|
+
} : C['steps'] extends TimelineStepConfig[] ? C['from'] extends DialConfig ? ResolvedValues<C['from']> : Record<string, number | string> : C['to'] extends DialConfig ? ResolvedValues<C['to']> : undefined;
|
|
365
|
+
/** `to` once the clip has started, `from` before — hand it to Motion's animate.
|
|
366
|
+
* For sequences this is the final merged state; for props clips, per-track
|
|
367
|
+
* endpoint records. */
|
|
368
|
+
animate: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
369
|
+
[K in keyof C['props']]: number | string;
|
|
370
|
+
} : 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;
|
|
371
|
+
/** The clip's editable curve — single-curve clips only. */
|
|
372
|
+
transition: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
|
|
373
|
+
transition: TransitionConfig;
|
|
374
|
+
} | {
|
|
375
|
+
from: DialConfig;
|
|
376
|
+
} | {
|
|
377
|
+
to: DialConfig;
|
|
378
|
+
} ? TransitionConfig : undefined;
|
|
379
|
+
/** Duration + timing-function for native CSS transitions — single-curve clips only. */
|
|
380
|
+
css: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
|
|
381
|
+
transition: TransitionConfig;
|
|
382
|
+
} | {
|
|
383
|
+
from: DialConfig;
|
|
384
|
+
} | {
|
|
385
|
+
to: DialConfig;
|
|
386
|
+
} ? TimelineClipCss : undefined;
|
|
387
|
+
/**
|
|
388
|
+
* Values interpolated through the clip's curves at the current playhead —
|
|
389
|
+
* bind to style for true scrubbing: the element is exactly at this point
|
|
390
|
+
* in time whether playing, paused, or scrubbing. Sequence clips report the
|
|
391
|
+
* merged state of all legs (declare every animated property in `from`);
|
|
392
|
+
* props clips report every track's value.
|
|
393
|
+
*/
|
|
394
|
+
current: C['props'] extends Record<string, TimelinePropConfig> ? {
|
|
395
|
+
[K in keyof C['props']]: number | string;
|
|
396
|
+
} : 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;
|
|
397
|
+
};
|
|
398
|
+
type TimelineGroupValues<G extends TimelineGroupConfig> = {
|
|
399
|
+
[K in keyof G as G[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<G[K], TimelineClipConfig>>;
|
|
400
|
+
};
|
|
401
|
+
type DialTimelineValues<T extends TimelineConfig> = {
|
|
402
|
+
time: number;
|
|
403
|
+
playing: boolean;
|
|
404
|
+
duration: number;
|
|
405
|
+
play: () => void;
|
|
406
|
+
pause: () => void;
|
|
407
|
+
replay: () => void;
|
|
408
|
+
seek: (time: number) => void;
|
|
409
|
+
} & {
|
|
410
|
+
[K in keyof T as T[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<T[K], TimelineClipConfig>>;
|
|
411
|
+
} & {
|
|
412
|
+
[K in keyof T as T[K] extends TimelineClipConfig ? never : T[K] extends TimelineGroupConfig ? K : never]: TimelineGroupValues<Extract<T[K], TimelineGroupConfig>>;
|
|
413
|
+
};
|
|
414
|
+
declare function formatClock(time: number, tenths?: boolean): string;
|
|
415
|
+
|
|
416
|
+
interface DialTimelineOptions {
|
|
417
|
+
id?: string;
|
|
418
|
+
persist?: DialKitPersistOptions;
|
|
419
|
+
/** Start playing on mount. Defaults to true. */
|
|
420
|
+
autoplay?: boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Loop when the playhead reaches the end. `true` restarts the whole
|
|
423
|
+
* timeline; `{ from }` wraps back to that time instead, so clips before it
|
|
424
|
+
* play once and looping clips keep cycling forever. Defaults to false.
|
|
425
|
+
*/
|
|
426
|
+
loop?: boolean | {
|
|
427
|
+
from: number;
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
type UseDialTimelineOptions = DialTimelineOptions;
|
|
432
|
+
declare function useDialTimeline<T extends TimelineConfig>(name: string, config: T, options?: UseDialTimelineOptions): DialTimelineValues<T>;
|
|
433
|
+
|
|
434
|
+
interface DialTimelineProps {
|
|
435
|
+
theme?: DialTheme;
|
|
436
|
+
/** Initial dock visibility. Expansion is controlled separately by defaultOpen. */
|
|
437
|
+
defaultVisible?: boolean;
|
|
438
|
+
/** Controlled dock visibility. */
|
|
439
|
+
visible?: boolean;
|
|
440
|
+
onVisibilityChange?: (visible: boolean) => void;
|
|
441
|
+
defaultOpen?: boolean;
|
|
442
|
+
productionEnabled?: boolean;
|
|
443
|
+
}
|
|
444
|
+
declare const DialTimeline: react.NamedExoticComponent<DialTimelineProps>;
|
|
445
|
+
|
|
446
|
+
interface ControlRendererProps {
|
|
447
|
+
panelId: string;
|
|
448
|
+
controls: ControlMeta[];
|
|
449
|
+
values: Record<string, DialValue>;
|
|
450
|
+
/** Optional timeline-owned duration rendered inside the transition editor. */
|
|
451
|
+
transitionDuration?: {
|
|
452
|
+
value: number;
|
|
453
|
+
onChange: (value: number) => void;
|
|
454
|
+
min?: number;
|
|
455
|
+
max?: number;
|
|
456
|
+
step?: number;
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
declare function ControlRenderer({ panelId, controls, values, transitionDuration }: ControlRendererProps): react_jsx_runtime.JSX.Element;
|
|
460
|
+
|
|
203
461
|
interface SliderProps {
|
|
204
462
|
label: string;
|
|
205
463
|
value: number;
|
|
@@ -263,8 +521,18 @@ interface TransitionControlProps {
|
|
|
263
521
|
label: string;
|
|
264
522
|
value: TransitionConfig;
|
|
265
523
|
onChange: (value: TransitionConfig) => void;
|
|
524
|
+
/** Hide duration sliders when something else owns the duration (e.g. a timeline clip bar). */
|
|
525
|
+
hideDuration?: boolean;
|
|
526
|
+
/** Route duration edits through an external owner while keeping this control's layout. */
|
|
527
|
+
durationControl?: {
|
|
528
|
+
value: number;
|
|
529
|
+
onChange: (value: number) => void;
|
|
530
|
+
min?: number;
|
|
531
|
+
max?: number;
|
|
532
|
+
step?: number;
|
|
533
|
+
};
|
|
266
534
|
}
|
|
267
|
-
declare function TransitionControl({ panelId, path, label, value, onChange }: TransitionControlProps): react_jsx_runtime.JSX.Element;
|
|
535
|
+
declare function TransitionControl({ panelId, path, label, value, onChange, hideDuration, durationControl, }: TransitionControlProps): react_jsx_runtime.JSX.Element;
|
|
268
536
|
|
|
269
537
|
interface EasingVisualizationProps {
|
|
270
538
|
easing: EasingConfig;
|
|
@@ -311,4 +579,4 @@ interface ShortcutsMenuProps {
|
|
|
311
579
|
}
|
|
312
580
|
declare function ShortcutsMenu({ panelId }: ShortcutsMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
313
581
|
|
|
314
|
-
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialKitController, type DialKitPersistOptions, type DialKitValueUpdates, type DialMode, type DialPosition, DialRoot, DialStore, type DialTheme, type DialValue, type EasingConfig, EasingVisualization, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, type ShortcutConfig, type ShortcutInteraction, type ShortcutMode, ShortcutsMenu, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type TransitionConfig, TransitionControl, type UseDialOptions, useDialKit, useDialKitController };
|
|
582
|
+
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, ControlRenderer, type DialConfig, type DialKitController, type DialKitPersistOptions, type DialKitValueUpdates, type DialMode, type DialPosition, DialRoot, DialStore, type DialTheme, DialTimeline, type DialTimelineProps, type DialTimelineValues, type DialValue, type EasingConfig, EasingVisualization, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, type ShortcutConfig, type ShortcutInteraction, type ShortcutMode, ShortcutsMenu, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, type TimelineClipConfig, type TimelineClipCss, type TimelineClipLoop, type TimelineClipMeta, type TimelineClipTrackMeta, type TimelineClipValues, type TimelineConfig, type TimelineGroupConfig, type TimelineGroupValues, type TimelineMeta, type TimelinePropConfig, type TimelinePropStepConfig, type TimelineStepConfig, type TimelineStepValues, TimelineStore, type TimelineTransport, Toggle, type TransitionConfig, TransitionControl, type UseDialOptions, type UseDialTimelineOptions, formatClock, useDialKit, useDialKitController, useDialTimeline };
|