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.
Files changed (71) hide show
  1. package/README.md +433 -3
  2. package/dist/icons.d.ts +4 -1
  3. package/dist/icons.js +13 -0
  4. package/dist/icons.js.map +1 -1
  5. package/dist/index.cjs +3118 -480
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +274 -6
  8. package/dist/index.d.ts +274 -6
  9. package/dist/index.js +3050 -417
  10. package/dist/index.js.map +1 -1
  11. package/dist/solid/index.d.ts +225 -3
  12. package/dist/solid/index.js +5697 -2508
  13. package/dist/solid/index.js.map +1 -1
  14. package/dist/store/index.cjs +57 -16
  15. package/dist/store/index.cjs.map +1 -1
  16. package/dist/store/index.d.cts +14 -2
  17. package/dist/store/index.d.ts +14 -2
  18. package/dist/store/index.js +52 -16
  19. package/dist/store/index.js.map +1 -1
  20. package/dist/styles.css +704 -0
  21. package/dist/svelte/components/ControlRenderer.svelte +5 -2
  22. package/dist/svelte/components/ControlRenderer.svelte.d.ts +2 -0
  23. package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -1
  24. package/dist/svelte/components/DialRoot.svelte +43 -6
  25. package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -1
  26. package/dist/svelte/components/Panel.svelte +7 -1
  27. package/dist/svelte/components/Panel.svelte.d.ts +2 -0
  28. package/dist/svelte/components/Panel.svelte.d.ts.map +1 -1
  29. package/dist/svelte/components/Timeline/ClipPopover.svelte +206 -0
  30. package/dist/svelte/components/Timeline/ClipPopover.svelte.d.ts +26 -0
  31. package/dist/svelte/components/Timeline/ClipPopover.svelte.d.ts.map +1 -0
  32. package/dist/svelte/components/Timeline/DialTimeline.svelte +76 -0
  33. package/dist/svelte/components/Timeline/DialTimeline.svelte.d.ts +13 -0
  34. package/dist/svelte/components/Timeline/DialTimeline.svelte.d.ts.map +1 -0
  35. package/dist/svelte/components/Timeline/TimelineClip.svelte +233 -0
  36. package/dist/svelte/components/Timeline/TimelineClip.svelte.d.ts +24 -0
  37. package/dist/svelte/components/Timeline/TimelineClip.svelte.d.ts.map +1 -0
  38. package/dist/svelte/components/Timeline/TimelineSection.svelte +756 -0
  39. package/dist/svelte/components/Timeline/TimelineSection.svelte.d.ts +12 -0
  40. package/dist/svelte/components/Timeline/TimelineSection.svelte.d.ts.map +1 -0
  41. package/dist/svelte/components/Timeline/TimelineToggleButton.svelte +25 -0
  42. package/dist/svelte/components/Timeline/TimelineToggleButton.svelte.d.ts +4 -0
  43. package/dist/svelte/components/Timeline/TimelineToggleButton.svelte.d.ts.map +1 -0
  44. package/dist/svelte/components/TransitionControl.svelte +26 -11
  45. package/dist/svelte/components/TransitionControl.svelte.d.ts +9 -0
  46. package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -1
  47. package/dist/svelte/createDialTimeline.svelte.d.ts +4 -0
  48. package/dist/svelte/createDialTimeline.svelte.d.ts.map +1 -0
  49. package/dist/svelte/createDialTimeline.svelte.js +73 -0
  50. package/dist/svelte/index.d.ts +4 -0
  51. package/dist/svelte/index.d.ts.map +1 -1
  52. package/dist/svelte/index.js +3 -0
  53. package/dist/svelte/theme-css.d.ts +1 -1
  54. package/dist/svelte/theme-css.d.ts.map +1 -1
  55. package/dist/svelte/theme-css.js +704 -0
  56. package/dist/timeline/index.cjs +1288 -0
  57. package/dist/timeline/index.cjs.map +1 -0
  58. package/dist/timeline/index.d.cts +443 -0
  59. package/dist/timeline/index.d.ts +443 -0
  60. package/dist/timeline/index.js +1233 -0
  61. package/dist/timeline/index.js.map +1 -0
  62. package/dist/vue/index.d.ts +273 -7
  63. package/dist/vue/index.js +2867 -361
  64. package/dist/vue/index.js.map +1 -1
  65. package/package.json +23 -13
  66. package/dist/solid/index.cjs +0 -3536
  67. package/dist/solid/index.cjs.map +0 -1
  68. package/dist/solid/index.d.cts +0 -295
  69. package/dist/vue/index.cjs +0 -3497
  70. package/dist/vue/index.cjs.map +0 -1
  71. package/dist/vue/index.d.cts +0 -722
@@ -76,6 +76,7 @@ type PanelConfig = {
76
76
  controls: ControlMeta[];
77
77
  values: Record<string, DialValue>;
78
78
  shortcuts: Record<string, ShortcutConfig>;
79
+ kind?: 'timeline';
79
80
  };
80
81
  type Listener = () => void;
81
82
  type ActionListener = (action: string) => void;
@@ -92,9 +93,13 @@ type DialKitPersistOptions = boolean | {
92
93
  type DialStorePanelOptions = {
93
94
  retainOnUnmount?: boolean;
94
95
  persist?: DialKitPersistOptions;
96
+ kind?: 'timeline';
95
97
  };
96
98
  declare class DialStoreClass {
97
99
  private panels;
100
+ private panelsSnapshot;
101
+ private standardPanelsSnapshot;
102
+ private timelinePanelsSnapshot;
98
103
  private listeners;
99
104
  private globalListeners;
100
105
  private snapshots;
@@ -118,7 +123,7 @@ declare class DialStoreClass {
118
123
  getTransitionMode(panelId: string, path: string): 'easing' | 'simple' | 'advanced';
119
124
  getValue(panelId: string, path: string): DialValue | undefined;
120
125
  getValues(panelId: string): Record<string, DialValue>;
121
- getPanels(): PanelConfig[];
126
+ getPanels(kind?: 'panel' | 'timeline'): PanelConfig[];
122
127
  getPanel(id: string): PanelConfig | undefined;
123
128
  subscribe(panelId: string, listener: Listener): () => void;
124
129
  subscribeGlobal(listener: Listener): () => void;
@@ -187,6 +192,162 @@ interface DialKitController<T extends DialConfig> {
187
192
  declare function createDialKit<T extends DialConfig>(name: string, config: T, options?: CreateDialOptions): Accessor<ResolvedValues<T>>;
188
193
  declare function createDialKitController<T extends DialConfig>(name: string, config: T, options?: CreateDialOptions): DialKitController<T>;
189
194
 
195
+ type TimelineClipLoop = 'off' | 'repeat';
196
+ type TimelineStepValues = {
197
+ [key: string]: DialConfig[string] | undefined;
198
+ };
199
+ type TimelineStepConfig = {
200
+ duration?: number;
201
+ to?: TimelineStepValues;
202
+ transition?: TransitionConfig;
203
+ };
204
+ type TimelinePropStepConfig = {
205
+ duration?: number;
206
+ to?: number | string;
207
+ transition?: TransitionConfig;
208
+ };
209
+ type TimelinePropConfig = {
210
+ from?: number | string;
211
+ to?: number | string;
212
+ duration?: number;
213
+ /** Offset from the clip's `at` in seconds. */
214
+ delay?: number;
215
+ transition?: TransitionConfig;
216
+ steps?: TimelinePropStepConfig[];
217
+ };
218
+ type TimelineClipBase = {
219
+ at: number;
220
+ duration?: number;
221
+ transition?: TransitionConfig;
222
+ loop?: boolean | TimelineClipLoop;
223
+ };
224
+ type TimelineClipConfig = TimelineClipBase & ({
225
+ from?: DialConfig;
226
+ to?: DialConfig;
227
+ steps?: never;
228
+ props?: never;
229
+ } | {
230
+ from?: DialConfig;
231
+ to?: never;
232
+ /** Sequential legs on one row — a segmented bar; boundaries retime legs. */
233
+ steps: TimelineStepConfig[];
234
+ props?: never;
235
+ } | {
236
+ from?: never;
237
+ to?: never;
238
+ steps?: never;
239
+ /** Independent per-property tracks — mutually exclusive with from/to/steps. */
240
+ props: {
241
+ [prop: string]: TimelinePropConfig;
242
+ };
243
+ });
244
+ /** Nested keys group clips into a collapsible layer — purely presentational. */
245
+ type TimelineGroupConfig = {
246
+ [key: string]: TimelineClipConfig;
247
+ };
248
+ type TimelineConfig = {
249
+ /** Total timeline length in seconds. Inferred from the last clip when omitted. */
250
+ duration?: number;
251
+ } & {
252
+ [key: string]: TimelineClipConfig | TimelineGroupConfig | number | undefined;
253
+ };
254
+ /** CSS-friendly output for consumers not using Motion — spread into a style. */
255
+ type TimelineClipCss = {
256
+ transitionDuration: string;
257
+ transitionTimingFunction: string;
258
+ };
259
+ type TimelineClipValues<C extends TimelineClipConfig = TimelineClipConfig> = {
260
+ at: number;
261
+ duration: number;
262
+ /** Effective code-defined loop mode. */
263
+ loop: TimelineClipLoop;
264
+ /** Playhead is at or past the clip start. */
265
+ started: boolean;
266
+ /** Playhead is inside the clip — for looping clips, inside any cycle. */
267
+ active: boolean;
268
+ /** Playhead is past the clip end (for looping clips, past the timeline end). */
269
+ done: boolean;
270
+ /**
271
+ * 0–1 position of the playhead within the clip — cycle progress (a
272
+ * sawtooth) for looping clips, sequence progress for steps clips.
273
+ */
274
+ progress: number;
275
+ /** Index of the leg under the playhead, for sequence clips. */
276
+ step: C['steps'] extends TimelineStepConfig[] ? number : undefined;
277
+ from: C['props'] extends Record<string, TimelinePropConfig> ? {
278
+ [K in keyof C['props']]: number | string;
279
+ } : C['from'] extends DialConfig ? ResolvedValues<C['from']> : undefined;
280
+ to: C['props'] extends Record<string, TimelinePropConfig> ? {
281
+ [K in keyof C['props']]: number | string;
282
+ } : C['steps'] extends TimelineStepConfig[] ? C['from'] extends DialConfig ? ResolvedValues<C['from']> : Record<string, number | string> : C['to'] extends DialConfig ? ResolvedValues<C['to']> : undefined;
283
+ /** `to` once the clip has started, `from` before — hand it to Motion's animate.
284
+ * For sequences this is the final merged state; for props clips, per-track
285
+ * endpoint records. */
286
+ animate: C['props'] extends Record<string, TimelinePropConfig> ? {
287
+ [K in keyof C['props']]: number | string;
288
+ } : 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;
289
+ /** The clip's editable curve — single-curve clips only. */
290
+ transition: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
291
+ transition: TransitionConfig;
292
+ } | {
293
+ from: DialConfig;
294
+ } | {
295
+ to: DialConfig;
296
+ } ? TransitionConfig : undefined;
297
+ /** Duration + timing-function for native CSS transitions — single-curve clips only. */
298
+ css: C['props'] extends Record<string, TimelinePropConfig> ? undefined : C['steps'] extends TimelineStepConfig[] ? undefined : C extends {
299
+ transition: TransitionConfig;
300
+ } | {
301
+ from: DialConfig;
302
+ } | {
303
+ to: DialConfig;
304
+ } ? TimelineClipCss : undefined;
305
+ /**
306
+ * Values interpolated through the clip's curves at the current playhead —
307
+ * bind to style for true scrubbing: the element is exactly at this point
308
+ * in time whether playing, paused, or scrubbing. Sequence clips report the
309
+ * merged state of all legs (declare every animated property in `from`);
310
+ * props clips report every track's value.
311
+ */
312
+ current: C['props'] extends Record<string, TimelinePropConfig> ? {
313
+ [K in keyof C['props']]: number | string;
314
+ } : 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;
315
+ };
316
+ type TimelineGroupValues<G extends TimelineGroupConfig> = {
317
+ [K in keyof G as G[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<G[K], TimelineClipConfig>>;
318
+ };
319
+ type DialTimelineValues<T extends TimelineConfig> = {
320
+ time: number;
321
+ playing: boolean;
322
+ duration: number;
323
+ play: () => void;
324
+ pause: () => void;
325
+ replay: () => void;
326
+ seek: (time: number) => void;
327
+ } & {
328
+ [K in keyof T as T[K] extends TimelineClipConfig ? K : never]: TimelineClipValues<Extract<T[K], TimelineClipConfig>>;
329
+ } & {
330
+ [K in keyof T as T[K] extends TimelineClipConfig ? never : T[K] extends TimelineGroupConfig ? K : never]: TimelineGroupValues<Extract<T[K], TimelineGroupConfig>>;
331
+ };
332
+
333
+ interface DialTimelineOptions {
334
+ id?: string;
335
+ persist?: DialKitPersistOptions;
336
+ /** Start playing on mount. Defaults to true. */
337
+ autoplay?: boolean;
338
+ /**
339
+ * Loop when the playhead reaches the end. `true` restarts the whole
340
+ * timeline; `{ from }` wraps back to that time instead, so clips before it
341
+ * play once and looping clips keep cycling forever. Defaults to false.
342
+ */
343
+ loop?: boolean | {
344
+ from: number;
345
+ };
346
+ }
347
+
348
+ type CreateDialTimelineOptions = DialTimelineOptions;
349
+ declare function createDialTimeline<T extends TimelineConfig>(name: string, config: T, options?: CreateDialTimelineOptions): Accessor<DialTimelineValues<T>>;
350
+
190
351
  type DialPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
191
352
  type DialMode = 'popover' | 'inline';
192
353
  type DialTheme = 'light' | 'dark' | 'system';
@@ -200,6 +361,16 @@ interface DialRootProps {
200
361
  }
201
362
  declare function DialRoot(props: DialRootProps): solid_js.JSX.Element;
202
363
 
364
+ interface DialTimelineProps {
365
+ theme?: DialTheme;
366
+ defaultVisible?: boolean;
367
+ visible?: boolean;
368
+ onVisibilityChange?: (visible: boolean) => void;
369
+ defaultOpen?: boolean;
370
+ productionEnabled?: boolean;
371
+ }
372
+ declare function DialTimeline(props: DialTimelineProps): JSX.Element;
373
+
203
374
  interface SliderProps {
204
375
  label: string;
205
376
  value: number;
@@ -226,14 +397,35 @@ interface FolderProps {
226
397
  title: string;
227
398
  children: JSX.Element;
228
399
  defaultOpen?: boolean;
400
+ onOpenChange?: (isOpen: boolean) => void;
401
+ /** @deprecated Use RootPanel instead; kept for backwards compatibility. */
229
402
  isRoot?: boolean;
403
+ /** @deprecated Only meaningful with isRoot. */
230
404
  inline?: boolean;
231
- onOpenChange?: (isOpen: boolean) => void;
405
+ /** @deprecated Only meaningful with isRoot. */
232
406
  toolbar?: JSX.Element;
407
+ /** @deprecated Only meaningful with isRoot. */
233
408
  panelHeightOffset?: number;
234
409
  }
410
+ /** Collapsible section with animated height/opacity and rotating chevron. */
235
411
  declare function Folder(props: FolderProps): JSX.Element;
236
412
 
413
+ interface RootPanelProps {
414
+ title: string;
415
+ children: JSX.Element;
416
+ defaultOpen?: boolean;
417
+ inline?: boolean;
418
+ onOpenChange?: (isOpen: boolean) => void;
419
+ toolbar?: JSX.Element;
420
+ panelHeightOffset?: number;
421
+ }
422
+ /**
423
+ * The top-level panel shell: header with panel icon and toolbar, and (in
424
+ * popover mode) the bubble-to-panel morph animation with drag-friendly
425
+ * collapsed state. Section folding lives in Folder.
426
+ */
427
+ declare function RootPanel(props: RootPanelProps): JSX.Element;
428
+
237
429
  interface ButtonGroupProps {
238
430
  buttons: Array<{
239
431
  label: string;
@@ -257,6 +449,28 @@ interface SpringVisualizationProps {
257
449
  }
258
450
  declare function SpringVisualization(props: SpringVisualizationProps): solid_js.JSX.Element;
259
451
 
452
+ interface TransitionDurationControl {
453
+ value: number;
454
+ onChange: (value: number) => void;
455
+ min?: number;
456
+ max?: number;
457
+ step?: number;
458
+ }
459
+ interface TransitionControlProps {
460
+ panelId: string;
461
+ path: string;
462
+ label: string;
463
+ value: TransitionConfig;
464
+ onChange: (value: TransitionConfig) => void;
465
+ hideDuration?: boolean;
466
+ durationControl?: TransitionDurationControl;
467
+ }
468
+ declare function TransitionControl(props: TransitionControlProps): solid_js.JSX.Element;
469
+
470
+ declare function EasingVisualization(props: {
471
+ easing: EasingConfig;
472
+ }): solid_js.JSX.Element;
473
+
260
474
  interface TextControlProps {
261
475
  label: string;
262
476
  value: string;
@@ -292,4 +506,12 @@ interface PresetManagerProps {
292
506
  }
293
507
  declare function PresetManager(props: PresetManagerProps): solid_js.JSX.Element;
294
508
 
295
- export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type CreateDialOptions, type DialConfig, type DialKitController, type DialKitPersistOptions, type DialKitValueUpdates, type DialMode, type DialPosition, DialRoot, DialStore, type DialTheme, type DialValue, type EasingConfig, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, type ShortcutConfig, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type TransitionConfig, createDialKit, createDialKitController };
509
+ interface ControlRendererProps {
510
+ panelId: string;
511
+ controls: ControlMeta[];
512
+ values: Record<string, DialValue>;
513
+ transitionDuration?: TransitionDurationControl;
514
+ }
515
+ declare function ControlRenderer(props: ControlRendererProps): solid_js.JSX.Element;
516
+
517
+ export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, ControlRenderer, type CreateDialOptions, type CreateDialTimelineOptions, 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, RootPanel, type SelectConfig, SelectControl, type ShortcutConfig, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, type TimelineClipConfig, type TimelineClipCss, type TimelineClipLoop, type TimelineClipValues, type TimelineConfig, type TimelineGroupConfig, type TimelineGroupValues, type TimelinePropConfig, type TimelinePropStepConfig, type TimelineStepConfig, type TimelineStepValues, Toggle, type TransitionConfig, TransitionControl, createDialKit, createDialKitController, createDialTimeline };