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
@@ -1,295 +0,0 @@
1
- import * as solid_js from 'solid-js';
2
- import { Accessor, JSX } from 'solid-js';
3
-
4
- type SpringConfig = {
5
- type: 'spring';
6
- stiffness?: number;
7
- damping?: number;
8
- mass?: number;
9
- visualDuration?: number;
10
- bounce?: number;
11
- };
12
- type EasingConfig = {
13
- type: 'easing';
14
- duration: number;
15
- ease: [number, number, number, number];
16
- };
17
- type TransitionConfig = SpringConfig | EasingConfig;
18
- type ActionConfig = {
19
- type: 'action';
20
- label?: string;
21
- };
22
- type SelectConfig = {
23
- type: 'select';
24
- options: (string | {
25
- value: string;
26
- label: string;
27
- })[];
28
- default?: string;
29
- };
30
- type ColorConfig = {
31
- type: 'color';
32
- default?: string;
33
- };
34
- type TextConfig = {
35
- type: 'text';
36
- default?: string;
37
- placeholder?: string;
38
- };
39
- type DialValue = number | boolean | string | SpringConfig | EasingConfig | ActionConfig | SelectConfig | ColorConfig | TextConfig;
40
- type DialConfig = {
41
- [key: string]: DialValue | [number, number, number, number?] | DialConfig;
42
- };
43
- type ResolvedValues<T extends DialConfig> = {
44
- [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];
45
- };
46
- type DialKitValueUpdates<T extends DialConfig> = {
47
- [K in keyof T as K extends '_collapsed' ? never : K]?: T[K] extends [number, number, number, number?] ? number : T[K] extends SpringConfig | EasingConfig ? TransitionConfig : T[K] extends ActionConfig ? never : T[K] extends SelectConfig | ColorConfig | TextConfig ? string : T[K] extends DialConfig ? DialKitValueUpdates<T[K]> : T[K];
48
- };
49
- type ShortcutMode = 'fine' | 'normal' | 'coarse';
50
- type ShortcutInteraction = 'scroll' | 'drag' | 'move' | 'scroll-only';
51
- type ShortcutConfig = {
52
- key?: string;
53
- modifier?: 'alt' | 'shift' | 'meta';
54
- mode?: ShortcutMode;
55
- interaction?: ShortcutInteraction;
56
- };
57
- type ControlMeta = {
58
- type: 'slider' | 'toggle' | 'spring' | 'transition' | 'folder' | 'action' | 'select' | 'color' | 'text';
59
- path: string;
60
- label: string;
61
- min?: number;
62
- max?: number;
63
- step?: number;
64
- children?: ControlMeta[];
65
- defaultOpen?: boolean;
66
- options?: (string | {
67
- value: string;
68
- label: string;
69
- })[];
70
- placeholder?: string;
71
- shortcut?: ShortcutConfig;
72
- };
73
- type PanelConfig = {
74
- id: string;
75
- name: string;
76
- controls: ControlMeta[];
77
- values: Record<string, DialValue>;
78
- shortcuts: Record<string, ShortcutConfig>;
79
- };
80
- type Listener = () => void;
81
- type ActionListener = (action: string) => void;
82
- type Preset = {
83
- id: string;
84
- name: string;
85
- values: Record<string, DialValue>;
86
- };
87
- type DialKitPersistOptions = boolean | {
88
- key?: string;
89
- storage?: 'localStorage' | 'sessionStorage';
90
- presets?: boolean;
91
- };
92
- type DialStorePanelOptions = {
93
- retainOnUnmount?: boolean;
94
- persist?: DialKitPersistOptions;
95
- };
96
- declare class DialStoreClass {
97
- private panels;
98
- private listeners;
99
- private globalListeners;
100
- private snapshots;
101
- private actionListeners;
102
- private presets;
103
- private activePreset;
104
- private baseValues;
105
- private defaultValues;
106
- private registrationCounts;
107
- private retainedPanels;
108
- private persistConfigs;
109
- registerPanel(id: string, name: string, config: DialConfig, shortcuts?: Record<string, ShortcutConfig>, options?: DialStorePanelOptions): void;
110
- updatePanel(id: string, name: string, config: DialConfig, shortcuts?: Record<string, ShortcutConfig>, options?: DialStorePanelOptions): void;
111
- unregisterPanel(id: string): void;
112
- updateValue(panelId: string, path: string, value: DialValue): void;
113
- updateValues(panelId: string, updates: Record<string, DialValue>): void;
114
- resetValues(panelId: string): void;
115
- updateSpringMode(panelId: string, path: string, mode: 'simple' | 'advanced'): void;
116
- getSpringMode(panelId: string, path: string): 'simple' | 'advanced';
117
- updateTransitionMode(panelId: string, path: string, mode: 'easing' | 'simple' | 'advanced'): void;
118
- getTransitionMode(panelId: string, path: string): 'easing' | 'simple' | 'advanced';
119
- getValue(panelId: string, path: string): DialValue | undefined;
120
- getValues(panelId: string): Record<string, DialValue>;
121
- getPanels(): PanelConfig[];
122
- getPanel(id: string): PanelConfig | undefined;
123
- subscribe(panelId: string, listener: Listener): () => void;
124
- subscribeGlobal(listener: Listener): () => void;
125
- subscribeActions(panelId: string, listener: ActionListener): () => void;
126
- triggerAction(panelId: string, path: string): void;
127
- savePreset(panelId: string, name: string): string;
128
- loadPreset(panelId: string, presetId: string): void;
129
- deletePreset(panelId: string, presetId: string): void;
130
- getPresets(panelId: string): Preset[];
131
- getActivePresetId(panelId: string): string | null;
132
- clearActivePreset(panelId: string): void;
133
- resolveShortcutTarget(key: string, modifier?: 'alt' | 'shift' | 'meta'): {
134
- panelId: string;
135
- path: string;
136
- control: ControlMeta;
137
- } | null;
138
- resolveScrollOnlyTargets(): Array<{
139
- panelId: string;
140
- path: string;
141
- control: ControlMeta;
142
- shortcut: ShortcutConfig;
143
- }>;
144
- private configurePanelRetention;
145
- private reconcileValues;
146
- private reconcilePresets;
147
- private normalizePersistConfig;
148
- private loadPersistedPanel;
149
- private persistPanel;
150
- private getStorage;
151
- private findControlByPath;
152
- private notify;
153
- private notifyGlobal;
154
- private initTransitionModes;
155
- private parseConfig;
156
- private flattenValues;
157
- private isSpringConfig;
158
- private isEasingConfig;
159
- private isActionConfig;
160
- private isSelectConfig;
161
- private isColorConfig;
162
- private isTextConfig;
163
- private isHexColor;
164
- private formatLabel;
165
- private inferRange;
166
- private inferStep;
167
- private normalizePreservedValue;
168
- private roundToStep;
169
- private stepPrecision;
170
- private mapControlsByPath;
171
- }
172
- declare const DialStore: DialStoreClass;
173
-
174
- interface CreateDialOptions {
175
- id?: string;
176
- persist?: DialKitPersistOptions;
177
- onAction?: (action: string) => void;
178
- shortcuts?: Record<string, ShortcutConfig>;
179
- }
180
- interface DialKitController<T extends DialConfig> {
181
- values: Accessor<ResolvedValues<T>>;
182
- setValue: (path: string, value: DialValue) => void;
183
- setValues: (values: DialKitValueUpdates<T>) => void;
184
- resetValues: () => void;
185
- getValues: () => ResolvedValues<T>;
186
- }
187
- declare function createDialKit<T extends DialConfig>(name: string, config: T, options?: CreateDialOptions): Accessor<ResolvedValues<T>>;
188
- declare function createDialKitController<T extends DialConfig>(name: string, config: T, options?: CreateDialOptions): DialKitController<T>;
189
-
190
- type DialPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
191
- type DialMode = 'popover' | 'inline';
192
- type DialTheme = 'light' | 'dark' | 'system';
193
- interface DialRootProps {
194
- position?: DialPosition;
195
- defaultOpen?: boolean;
196
- mode?: DialMode;
197
- theme?: DialTheme;
198
- productionEnabled?: boolean;
199
- onOpenChange?: (open: boolean) => void;
200
- }
201
- declare function DialRoot(props: DialRootProps): solid_js.JSX.Element;
202
-
203
- interface SliderProps {
204
- label: string;
205
- value: number;
206
- onChange: (value: number) => void;
207
- min?: number;
208
- max?: number;
209
- step?: number;
210
- unit?: string;
211
- shortcut?: ShortcutConfig;
212
- shortcutActive?: boolean;
213
- }
214
- declare function Slider(props: SliderProps): solid_js.JSX.Element;
215
-
216
- interface ToggleProps {
217
- label: string;
218
- checked: boolean;
219
- onChange: (checked: boolean) => void;
220
- shortcut?: ShortcutConfig;
221
- shortcutActive?: boolean;
222
- }
223
- declare function Toggle(props: ToggleProps): solid_js.JSX.Element;
224
-
225
- interface FolderProps {
226
- title: string;
227
- children: JSX.Element;
228
- defaultOpen?: boolean;
229
- isRoot?: boolean;
230
- inline?: boolean;
231
- onOpenChange?: (isOpen: boolean) => void;
232
- toolbar?: JSX.Element;
233
- panelHeightOffset?: number;
234
- }
235
- declare function Folder(props: FolderProps): JSX.Element;
236
-
237
- interface ButtonGroupProps {
238
- buttons: Array<{
239
- label: string;
240
- onClick: () => void;
241
- }>;
242
- }
243
- declare function ButtonGroup(props: ButtonGroupProps): solid_js.JSX.Element;
244
-
245
- interface SpringControlProps {
246
- panelId: string;
247
- path: string;
248
- label: string;
249
- spring: SpringConfig;
250
- onChange: (spring: SpringConfig) => void;
251
- }
252
- declare function SpringControl(props: SpringControlProps): solid_js.JSX.Element;
253
-
254
- interface SpringVisualizationProps {
255
- spring: SpringConfig;
256
- isSimpleMode: boolean;
257
- }
258
- declare function SpringVisualization(props: SpringVisualizationProps): solid_js.JSX.Element;
259
-
260
- interface TextControlProps {
261
- label: string;
262
- value: string;
263
- onChange: (value: string) => void;
264
- placeholder?: string;
265
- }
266
- declare function TextControl(props: TextControlProps): solid_js.JSX.Element;
267
-
268
- type SelectOption = string | {
269
- value: string;
270
- label: string;
271
- };
272
- interface SelectControlProps {
273
- label: string;
274
- value: string;
275
- options: SelectOption[];
276
- onChange: (value: string) => void;
277
- }
278
- declare function SelectControl(props: SelectControlProps): solid_js.JSX.Element;
279
-
280
- interface ColorControlProps {
281
- label: string;
282
- value: string;
283
- onChange: (value: string) => void;
284
- }
285
- declare function ColorControl(props: ColorControlProps): solid_js.JSX.Element;
286
-
287
- interface PresetManagerProps {
288
- panelId: string;
289
- presets: Preset[];
290
- activePresetId: string | null;
291
- onAdd: () => void;
292
- }
293
- declare function PresetManager(props: PresetManagerProps): solid_js.JSX.Element;
294
-
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 };