dialkit 1.0.0 → 1.2.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 (97) hide show
  1. package/README.md +293 -2
  2. package/dist/index.cjs +905 -363
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +46 -9
  5. package/dist/index.d.ts +46 -9
  6. package/dist/index.js +910 -370
  7. package/dist/index.js.map +1 -1
  8. package/dist/solid/index.cjs +1042 -532
  9. package/dist/solid/index.cjs.map +1 -1
  10. package/dist/solid/index.d.cts +36 -3
  11. package/dist/solid/index.d.ts +36 -3
  12. package/dist/solid/index.js +911 -402
  13. package/dist/solid/index.js.map +1 -1
  14. package/dist/store/index.cjs +490 -0
  15. package/dist/store/index.cjs.map +1 -0
  16. package/dist/store/index.d.cts +146 -0
  17. package/dist/store/index.d.ts +146 -0
  18. package/dist/store/index.js +465 -0
  19. package/dist/store/index.js.map +1 -0
  20. package/dist/styles.css +287 -25
  21. package/dist/svelte/Portal.svelte +30 -0
  22. package/dist/svelte/Portal.svelte.d.ts +9 -0
  23. package/dist/svelte/Portal.svelte.d.ts.map +1 -0
  24. package/dist/svelte/components/ButtonGroup.svelte +16 -0
  25. package/dist/svelte/components/ButtonGroup.svelte.d.ts +11 -0
  26. package/dist/svelte/components/ButtonGroup.svelte.d.ts.map +1 -0
  27. package/dist/svelte/components/ColorControl.svelte +81 -0
  28. package/dist/svelte/components/ColorControl.svelte.d.ts +9 -0
  29. package/dist/svelte/components/ColorControl.svelte.d.ts.map +1 -0
  30. package/dist/svelte/components/ControlRenderer.svelte +96 -0
  31. package/dist/svelte/components/ControlRenderer.svelte.d.ts +11 -0
  32. package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -0
  33. package/dist/svelte/components/DialRoot.svelte +79 -0
  34. package/dist/svelte/components/DialRoot.svelte.d.ts +14 -0
  35. package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -0
  36. package/dist/svelte/components/EasingVisualization.svelte +50 -0
  37. package/dist/svelte/components/EasingVisualization.svelte.d.ts +10 -0
  38. package/dist/svelte/components/EasingVisualization.svelte.d.ts.map +1 -0
  39. package/dist/svelte/components/Folder.svelte +213 -0
  40. package/dist/svelte/components/Folder.svelte.d.ts +14 -0
  41. package/dist/svelte/components/Folder.svelte.d.ts.map +1 -0
  42. package/dist/svelte/components/Panel.svelte +149 -0
  43. package/dist/svelte/components/Panel.svelte.d.ts +10 -0
  44. package/dist/svelte/components/Panel.svelte.d.ts.map +1 -0
  45. package/dist/svelte/components/PresetManager.svelte +157 -0
  46. package/dist/svelte/components/PresetManager.svelte.d.ts +10 -0
  47. package/dist/svelte/components/PresetManager.svelte.d.ts.map +1 -0
  48. package/dist/svelte/components/SegmentedControl.svelte +62 -0
  49. package/dist/svelte/components/SegmentedControl.svelte.d.ts +13 -0
  50. package/dist/svelte/components/SegmentedControl.svelte.d.ts.map +1 -0
  51. package/dist/svelte/components/SelectControl.svelte +152 -0
  52. package/dist/svelte/components/SelectControl.svelte.d.ts +14 -0
  53. package/dist/svelte/components/SelectControl.svelte.d.ts.map +1 -0
  54. package/dist/svelte/components/ShortcutListener.svelte +265 -0
  55. package/dist/svelte/components/ShortcutListener.svelte.d.ts +13 -0
  56. package/dist/svelte/components/ShortcutListener.svelte.d.ts.map +1 -0
  57. package/dist/svelte/components/ShortcutsMenu.svelte +128 -0
  58. package/dist/svelte/components/ShortcutsMenu.svelte.d.ts +7 -0
  59. package/dist/svelte/components/ShortcutsMenu.svelte.d.ts.map +1 -0
  60. package/dist/svelte/components/Slider.svelte +332 -0
  61. package/dist/svelte/components/Slider.svelte.d.ts +16 -0
  62. package/dist/svelte/components/Slider.svelte.d.ts.map +1 -0
  63. package/dist/svelte/components/SpringControl.svelte +126 -0
  64. package/dist/svelte/components/SpringControl.svelte.d.ts +12 -0
  65. package/dist/svelte/components/SpringControl.svelte.d.ts.map +1 -0
  66. package/dist/svelte/components/SpringVisualization.svelte +115 -0
  67. package/dist/svelte/components/SpringVisualization.svelte.d.ts +9 -0
  68. package/dist/svelte/components/SpringVisualization.svelte.d.ts.map +1 -0
  69. package/dist/svelte/components/TextControl.svelte +19 -0
  70. package/dist/svelte/components/TextControl.svelte.d.ts +10 -0
  71. package/dist/svelte/components/TextControl.svelte.d.ts.map +1 -0
  72. package/dist/svelte/components/Toggle.svelte +32 -0
  73. package/dist/svelte/components/Toggle.svelte.d.ts +12 -0
  74. package/dist/svelte/components/Toggle.svelte.d.ts.map +1 -0
  75. package/dist/svelte/components/TransitionControl.svelte +203 -0
  76. package/dist/svelte/components/TransitionControl.svelte.d.ts +12 -0
  77. package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -0
  78. package/dist/svelte/components/transitions.d.ts +6 -0
  79. package/dist/svelte/components/transitions.d.ts.map +1 -0
  80. package/dist/svelte/components/transitions.js +14 -0
  81. package/dist/svelte/createDialKit.svelte.d.ts +8 -0
  82. package/dist/svelte/createDialKit.svelte.d.ts.map +1 -0
  83. package/dist/svelte/createDialKit.svelte.js +82 -0
  84. package/dist/svelte/index.d.ts +23 -0
  85. package/dist/svelte/index.d.ts.map +1 -0
  86. package/dist/svelte/index.js +23 -0
  87. package/dist/svelte/shims.d.ts +9 -0
  88. package/dist/svelte/theme-css.d.ts +2 -0
  89. package/dist/svelte/theme-css.d.ts.map +1 -0
  90. package/dist/svelte/theme-css.js +1328 -0
  91. package/dist/vue/index.cjs +3056 -0
  92. package/dist/vue/index.cjs.map +1 -0
  93. package/dist/vue/index.d.cts +675 -0
  94. package/dist/vue/index.d.ts +675 -0
  95. package/dist/vue/index.js +3014 -0
  96. package/dist/vue/index.js.map +1 -0
  97. package/package.json +50 -6
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
4
3
 
5
4
  type SpringConfig = {
6
5
  type: 'spring';
@@ -44,6 +43,14 @@ type DialConfig = {
44
43
  type ResolvedValues<T extends DialConfig> = {
45
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];
46
45
  };
46
+ type ShortcutMode = 'fine' | 'normal' | 'coarse';
47
+ type ShortcutInteraction = 'scroll' | 'drag' | 'move' | 'scroll-only';
48
+ type ShortcutConfig = {
49
+ key?: string;
50
+ modifier?: 'alt' | 'shift' | 'meta';
51
+ mode?: ShortcutMode;
52
+ interaction?: ShortcutInteraction;
53
+ };
47
54
  type ControlMeta = {
48
55
  type: 'slider' | 'toggle' | 'spring' | 'transition' | 'folder' | 'action' | 'select' | 'color' | 'text';
49
56
  path: string;
@@ -58,12 +65,14 @@ type ControlMeta = {
58
65
  label: string;
59
66
  })[];
60
67
  placeholder?: string;
68
+ shortcut?: ShortcutConfig;
61
69
  };
62
70
  type PanelConfig = {
63
71
  id: string;
64
72
  name: string;
65
73
  controls: ControlMeta[];
66
74
  values: Record<string, DialValue>;
75
+ shortcuts: Record<string, ShortcutConfig>;
67
76
  };
68
77
  type Listener = () => void;
69
78
  type ActionListener = (action: string) => void;
@@ -81,8 +90,8 @@ declare class DialStoreClass {
81
90
  private presets;
82
91
  private activePreset;
83
92
  private baseValues;
84
- registerPanel(id: string, name: string, config: DialConfig): void;
85
- updatePanel(id: string, name: string, config: DialConfig): void;
93
+ registerPanel(id: string, name: string, config: DialConfig, shortcuts?: Record<string, ShortcutConfig>): void;
94
+ updatePanel(id: string, name: string, config: DialConfig, shortcuts?: Record<string, ShortcutConfig>): void;
86
95
  unregisterPanel(id: string): void;
87
96
  updateValue(panelId: string, path: string, value: DialValue): void;
88
97
  updateSpringMode(panelId: string, path: string, mode: 'simple' | 'advanced'): void;
@@ -103,6 +112,18 @@ declare class DialStoreClass {
103
112
  getPresets(panelId: string): Preset[];
104
113
  getActivePresetId(panelId: string): string | null;
105
114
  clearActivePreset(panelId: string): void;
115
+ resolveShortcutTarget(key: string, modifier?: 'alt' | 'shift' | 'meta'): {
116
+ panelId: string;
117
+ path: string;
118
+ control: ControlMeta;
119
+ } | null;
120
+ resolveScrollOnlyTargets(): Array<{
121
+ panelId: string;
122
+ path: string;
123
+ control: ControlMeta;
124
+ shortcut: ShortcutConfig;
125
+ }>;
126
+ private findControlByPath;
106
127
  private notify;
107
128
  private notifyGlobal;
108
129
  private initTransitionModes;
@@ -127,15 +148,21 @@ declare const DialStore: DialStoreClass;
127
148
 
128
149
  interface UseDialOptions {
129
150
  onAction?: (action: string) => void;
151
+ shortcuts?: Record<string, ShortcutConfig>;
130
152
  }
131
153
  declare function useDialKit<T extends DialConfig>(name: string, config: T, options?: UseDialOptions): ResolvedValues<T>;
132
154
 
133
155
  type DialPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
156
+ type DialMode = 'popover' | 'inline';
157
+ type DialTheme = 'light' | 'dark' | 'system';
134
158
  interface DialRootProps {
135
159
  position?: DialPosition;
136
160
  defaultOpen?: boolean;
161
+ mode?: DialMode;
162
+ theme?: DialTheme;
163
+ productionEnabled?: boolean;
137
164
  }
138
- declare function DialRoot({ position, defaultOpen }: DialRootProps): react.ReactPortal | null;
165
+ declare function DialRoot({ position, defaultOpen, mode, theme, productionEnabled }: DialRootProps): react_jsx_runtime.JSX.Element | null;
139
166
 
140
167
  interface SliderProps {
141
168
  label: string;
@@ -145,25 +172,30 @@ interface SliderProps {
145
172
  max?: number;
146
173
  step?: number;
147
174
  unit?: string;
175
+ shortcut?: ShortcutConfig;
176
+ shortcutActive?: boolean;
148
177
  }
149
- declare function Slider({ label, value, onChange, min, max, step, unit, }: SliderProps): react_jsx_runtime.JSX.Element;
178
+ declare function Slider({ label, value, onChange, min, max, step, unit, shortcut, shortcutActive, }: SliderProps): react_jsx_runtime.JSX.Element;
150
179
 
151
180
  interface ToggleProps {
152
181
  label: string;
153
182
  checked: boolean;
154
183
  onChange: (checked: boolean) => void;
184
+ shortcut?: ShortcutConfig;
185
+ shortcutActive?: boolean;
155
186
  }
156
- declare function Toggle({ label, checked, onChange }: ToggleProps): react_jsx_runtime.JSX.Element;
187
+ declare function Toggle({ label, checked, onChange, shortcut, shortcutActive }: ToggleProps): react_jsx_runtime.JSX.Element;
157
188
 
158
189
  interface FolderProps {
159
190
  title: string;
160
191
  children: ReactNode;
161
192
  defaultOpen?: boolean;
162
193
  isRoot?: boolean;
194
+ inline?: boolean;
163
195
  onOpenChange?: (isOpen: boolean) => void;
164
196
  toolbar?: ReactNode;
165
197
  }
166
- declare function Folder({ title, children, defaultOpen, isRoot, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
198
+ declare function Folder({ title, children, defaultOpen, isRoot, inline, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
167
199
 
168
200
  interface ButtonGroupProps {
169
201
  buttons: Array<{
@@ -237,4 +269,9 @@ interface PresetManagerProps {
237
269
  }
238
270
  declare function PresetManager({ panelId, presets, activePresetId, onAdd }: PresetManagerProps): react_jsx_runtime.JSX.Element;
239
271
 
240
- export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialPosition, DialRoot, DialStore, type DialValue, type EasingConfig, EasingVisualization, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type TransitionConfig, TransitionControl, type UseDialOptions, useDialKit };
272
+ interface ShortcutsMenuProps {
273
+ panelId: string;
274
+ }
275
+ declare function ShortcutsMenu({ panelId }: ShortcutsMenuProps): react_jsx_runtime.JSX.Element | null;
276
+
277
+ export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, 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 };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
4
3
 
5
4
  type SpringConfig = {
6
5
  type: 'spring';
@@ -44,6 +43,14 @@ type DialConfig = {
44
43
  type ResolvedValues<T extends DialConfig> = {
45
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];
46
45
  };
46
+ type ShortcutMode = 'fine' | 'normal' | 'coarse';
47
+ type ShortcutInteraction = 'scroll' | 'drag' | 'move' | 'scroll-only';
48
+ type ShortcutConfig = {
49
+ key?: string;
50
+ modifier?: 'alt' | 'shift' | 'meta';
51
+ mode?: ShortcutMode;
52
+ interaction?: ShortcutInteraction;
53
+ };
47
54
  type ControlMeta = {
48
55
  type: 'slider' | 'toggle' | 'spring' | 'transition' | 'folder' | 'action' | 'select' | 'color' | 'text';
49
56
  path: string;
@@ -58,12 +65,14 @@ type ControlMeta = {
58
65
  label: string;
59
66
  })[];
60
67
  placeholder?: string;
68
+ shortcut?: ShortcutConfig;
61
69
  };
62
70
  type PanelConfig = {
63
71
  id: string;
64
72
  name: string;
65
73
  controls: ControlMeta[];
66
74
  values: Record<string, DialValue>;
75
+ shortcuts: Record<string, ShortcutConfig>;
67
76
  };
68
77
  type Listener = () => void;
69
78
  type ActionListener = (action: string) => void;
@@ -81,8 +90,8 @@ declare class DialStoreClass {
81
90
  private presets;
82
91
  private activePreset;
83
92
  private baseValues;
84
- registerPanel(id: string, name: string, config: DialConfig): void;
85
- updatePanel(id: string, name: string, config: DialConfig): void;
93
+ registerPanel(id: string, name: string, config: DialConfig, shortcuts?: Record<string, ShortcutConfig>): void;
94
+ updatePanel(id: string, name: string, config: DialConfig, shortcuts?: Record<string, ShortcutConfig>): void;
86
95
  unregisterPanel(id: string): void;
87
96
  updateValue(panelId: string, path: string, value: DialValue): void;
88
97
  updateSpringMode(panelId: string, path: string, mode: 'simple' | 'advanced'): void;
@@ -103,6 +112,18 @@ declare class DialStoreClass {
103
112
  getPresets(panelId: string): Preset[];
104
113
  getActivePresetId(panelId: string): string | null;
105
114
  clearActivePreset(panelId: string): void;
115
+ resolveShortcutTarget(key: string, modifier?: 'alt' | 'shift' | 'meta'): {
116
+ panelId: string;
117
+ path: string;
118
+ control: ControlMeta;
119
+ } | null;
120
+ resolveScrollOnlyTargets(): Array<{
121
+ panelId: string;
122
+ path: string;
123
+ control: ControlMeta;
124
+ shortcut: ShortcutConfig;
125
+ }>;
126
+ private findControlByPath;
106
127
  private notify;
107
128
  private notifyGlobal;
108
129
  private initTransitionModes;
@@ -127,15 +148,21 @@ declare const DialStore: DialStoreClass;
127
148
 
128
149
  interface UseDialOptions {
129
150
  onAction?: (action: string) => void;
151
+ shortcuts?: Record<string, ShortcutConfig>;
130
152
  }
131
153
  declare function useDialKit<T extends DialConfig>(name: string, config: T, options?: UseDialOptions): ResolvedValues<T>;
132
154
 
133
155
  type DialPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
156
+ type DialMode = 'popover' | 'inline';
157
+ type DialTheme = 'light' | 'dark' | 'system';
134
158
  interface DialRootProps {
135
159
  position?: DialPosition;
136
160
  defaultOpen?: boolean;
161
+ mode?: DialMode;
162
+ theme?: DialTheme;
163
+ productionEnabled?: boolean;
137
164
  }
138
- declare function DialRoot({ position, defaultOpen }: DialRootProps): react.ReactPortal | null;
165
+ declare function DialRoot({ position, defaultOpen, mode, theme, productionEnabled }: DialRootProps): react_jsx_runtime.JSX.Element | null;
139
166
 
140
167
  interface SliderProps {
141
168
  label: string;
@@ -145,25 +172,30 @@ interface SliderProps {
145
172
  max?: number;
146
173
  step?: number;
147
174
  unit?: string;
175
+ shortcut?: ShortcutConfig;
176
+ shortcutActive?: boolean;
148
177
  }
149
- declare function Slider({ label, value, onChange, min, max, step, unit, }: SliderProps): react_jsx_runtime.JSX.Element;
178
+ declare function Slider({ label, value, onChange, min, max, step, unit, shortcut, shortcutActive, }: SliderProps): react_jsx_runtime.JSX.Element;
150
179
 
151
180
  interface ToggleProps {
152
181
  label: string;
153
182
  checked: boolean;
154
183
  onChange: (checked: boolean) => void;
184
+ shortcut?: ShortcutConfig;
185
+ shortcutActive?: boolean;
155
186
  }
156
- declare function Toggle({ label, checked, onChange }: ToggleProps): react_jsx_runtime.JSX.Element;
187
+ declare function Toggle({ label, checked, onChange, shortcut, shortcutActive }: ToggleProps): react_jsx_runtime.JSX.Element;
157
188
 
158
189
  interface FolderProps {
159
190
  title: string;
160
191
  children: ReactNode;
161
192
  defaultOpen?: boolean;
162
193
  isRoot?: boolean;
194
+ inline?: boolean;
163
195
  onOpenChange?: (isOpen: boolean) => void;
164
196
  toolbar?: ReactNode;
165
197
  }
166
- declare function Folder({ title, children, defaultOpen, isRoot, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
198
+ declare function Folder({ title, children, defaultOpen, isRoot, inline, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
167
199
 
168
200
  interface ButtonGroupProps {
169
201
  buttons: Array<{
@@ -237,4 +269,9 @@ interface PresetManagerProps {
237
269
  }
238
270
  declare function PresetManager({ panelId, presets, activePresetId, onAdd }: PresetManagerProps): react_jsx_runtime.JSX.Element;
239
271
 
240
- export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialPosition, DialRoot, DialStore, type DialValue, type EasingConfig, EasingVisualization, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type TransitionConfig, TransitionControl, type UseDialOptions, useDialKit };
272
+ interface ShortcutsMenuProps {
273
+ panelId: string;
274
+ }
275
+ declare function ShortcutsMenu({ panelId }: ShortcutsMenuProps): react_jsx_runtime.JSX.Element | null;
276
+
277
+ export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, 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 };