dialkit 0.2.2 → 1.1.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 +135 -2
- package/dist/index.cjs +512 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -8
- package/dist/index.d.ts +40 -8
- package/dist/index.js +484 -150
- package/dist/index.js.map +1 -1
- package/dist/solid/index.cjs +2612 -0
- package/dist/solid/index.cjs.map +1 -0
- package/dist/solid/index.d.cts +228 -0
- package/dist/solid/index.d.ts +228 -0
- package/dist/solid/index.js +2573 -0
- package/dist/solid/index.js.map +1 -0
- package/dist/store/index.cjs +450 -0
- package/dist/store/index.cjs.map +1 -0
- package/dist/store/index.d.cts +124 -0
- package/dist/store/index.d.ts +124 -0
- package/dist/store/index.js +425 -0
- package/dist/store/index.js.map +1 -0
- package/dist/styles.css +38 -1
- package/dist/svelte/Portal.svelte +30 -0
- package/dist/svelte/Portal.svelte.d.ts +9 -0
- package/dist/svelte/Portal.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ButtonGroup.svelte +16 -0
- package/dist/svelte/components/ButtonGroup.svelte.d.ts +11 -0
- package/dist/svelte/components/ButtonGroup.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ColorControl.svelte +81 -0
- package/dist/svelte/components/ColorControl.svelte.d.ts +9 -0
- package/dist/svelte/components/ColorControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ControlRenderer.svelte +84 -0
- package/dist/svelte/components/ControlRenderer.svelte.d.ts +11 -0
- package/dist/svelte/components/ControlRenderer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/DialRoot.svelte +65 -0
- package/dist/svelte/components/DialRoot.svelte.d.ts +11 -0
- package/dist/svelte/components/DialRoot.svelte.d.ts.map +1 -0
- package/dist/svelte/components/EasingVisualization.svelte +50 -0
- package/dist/svelte/components/EasingVisualization.svelte.d.ts +10 -0
- package/dist/svelte/components/EasingVisualization.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Folder.svelte +204 -0
- package/dist/svelte/components/Folder.svelte.d.ts +14 -0
- package/dist/svelte/components/Folder.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Panel.svelte +144 -0
- package/dist/svelte/components/Panel.svelte.d.ts +10 -0
- package/dist/svelte/components/Panel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PresetManager.svelte +156 -0
- package/dist/svelte/components/PresetManager.svelte.d.ts +10 -0
- package/dist/svelte/components/PresetManager.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SegmentedControl.svelte +106 -0
- package/dist/svelte/components/SegmentedControl.svelte.d.ts +13 -0
- package/dist/svelte/components/SegmentedControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SelectControl.svelte +151 -0
- package/dist/svelte/components/SelectControl.svelte.d.ts +14 -0
- package/dist/svelte/components/SelectControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Slider.svelte +345 -0
- package/dist/svelte/components/Slider.svelte.d.ts +13 -0
- package/dist/svelte/components/Slider.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SpringControl.svelte +124 -0
- package/dist/svelte/components/SpringControl.svelte.d.ts +12 -0
- package/dist/svelte/components/SpringControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SpringVisualization.svelte +115 -0
- package/dist/svelte/components/SpringVisualization.svelte.d.ts +9 -0
- package/dist/svelte/components/SpringVisualization.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TextControl.svelte +19 -0
- package/dist/svelte/components/TextControl.svelte.d.ts +10 -0
- package/dist/svelte/components/TextControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/Toggle.svelte +21 -0
- package/dist/svelte/components/Toggle.svelte.d.ts +9 -0
- package/dist/svelte/components/Toggle.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TransitionControl.svelte +200 -0
- package/dist/svelte/components/TransitionControl.svelte.d.ts +12 -0
- package/dist/svelte/components/TransitionControl.svelte.d.ts.map +1 -0
- package/dist/svelte/components/transitions.d.ts +6 -0
- package/dist/svelte/components/transitions.d.ts.map +1 -0
- package/dist/svelte/components/transitions.js +14 -0
- package/dist/svelte/createDialKit.svelte.d.ts +7 -0
- package/dist/svelte/createDialKit.svelte.d.ts.map +1 -0
- package/dist/svelte/createDialKit.svelte.js +82 -0
- package/dist/svelte/index.d.ts +19 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +19 -0
- package/dist/svelte/shims.d.ts +9 -0
- package/dist/svelte/theme-css.d.ts +2 -0
- package/dist/svelte/theme-css.d.ts.map +1 -0
- package/dist/svelte/theme-css.js +1097 -0
- package/package.json +56 -10
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';
|
|
@@ -10,6 +9,12 @@ type SpringConfig = {
|
|
|
10
9
|
visualDuration?: number;
|
|
11
10
|
bounce?: number;
|
|
12
11
|
};
|
|
12
|
+
type EasingConfig = {
|
|
13
|
+
type: 'easing';
|
|
14
|
+
duration: number;
|
|
15
|
+
ease: [number, number, number, number];
|
|
16
|
+
};
|
|
17
|
+
type TransitionConfig = SpringConfig | EasingConfig;
|
|
13
18
|
type ActionConfig = {
|
|
14
19
|
type: 'action';
|
|
15
20
|
label?: string;
|
|
@@ -31,15 +36,15 @@ type TextConfig = {
|
|
|
31
36
|
default?: string;
|
|
32
37
|
placeholder?: string;
|
|
33
38
|
};
|
|
34
|
-
type DialValue = number | boolean | string | SpringConfig | ActionConfig | SelectConfig | ColorConfig | TextConfig;
|
|
39
|
+
type DialValue = number | boolean | string | SpringConfig | EasingConfig | ActionConfig | SelectConfig | ColorConfig | TextConfig;
|
|
35
40
|
type DialConfig = {
|
|
36
41
|
[key: string]: DialValue | [number, number, number, number?] | DialConfig;
|
|
37
42
|
};
|
|
38
43
|
type ResolvedValues<T extends DialConfig> = {
|
|
39
|
-
[K in keyof T]: T[K] extends [number, number, number, number?] ? number : T[K] extends SpringConfig ?
|
|
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];
|
|
40
45
|
};
|
|
41
46
|
type ControlMeta = {
|
|
42
|
-
type: 'slider' | 'toggle' | 'spring' | 'folder' | 'action' | 'select' | 'color' | 'text';
|
|
47
|
+
type: 'slider' | 'toggle' | 'spring' | 'transition' | 'folder' | 'action' | 'select' | 'color' | 'text';
|
|
43
48
|
path: string;
|
|
44
49
|
label: string;
|
|
45
50
|
min?: number;
|
|
@@ -76,10 +81,13 @@ declare class DialStoreClass {
|
|
|
76
81
|
private activePreset;
|
|
77
82
|
private baseValues;
|
|
78
83
|
registerPanel(id: string, name: string, config: DialConfig): void;
|
|
84
|
+
updatePanel(id: string, name: string, config: DialConfig): void;
|
|
79
85
|
unregisterPanel(id: string): void;
|
|
80
86
|
updateValue(panelId: string, path: string, value: DialValue): void;
|
|
81
87
|
updateSpringMode(panelId: string, path: string, mode: 'simple' | 'advanced'): void;
|
|
82
88
|
getSpringMode(panelId: string, path: string): 'simple' | 'advanced';
|
|
89
|
+
updateTransitionMode(panelId: string, path: string, mode: 'easing' | 'simple' | 'advanced'): void;
|
|
90
|
+
getTransitionMode(panelId: string, path: string): 'easing' | 'simple' | 'advanced';
|
|
83
91
|
getValue(panelId: string, path: string): DialValue | undefined;
|
|
84
92
|
getValues(panelId: string): Record<string, DialValue>;
|
|
85
93
|
getPanels(): PanelConfig[];
|
|
@@ -96,9 +104,11 @@ declare class DialStoreClass {
|
|
|
96
104
|
clearActivePreset(panelId: string): void;
|
|
97
105
|
private notify;
|
|
98
106
|
private notifyGlobal;
|
|
107
|
+
private initTransitionModes;
|
|
99
108
|
private parseConfig;
|
|
100
109
|
private flattenValues;
|
|
101
110
|
private isSpringConfig;
|
|
111
|
+
private isEasingConfig;
|
|
102
112
|
private isActionConfig;
|
|
103
113
|
private isSelectConfig;
|
|
104
114
|
private isColorConfig;
|
|
@@ -107,6 +117,10 @@ declare class DialStoreClass {
|
|
|
107
117
|
private formatLabel;
|
|
108
118
|
private inferRange;
|
|
109
119
|
private inferStep;
|
|
120
|
+
private normalizePreservedValue;
|
|
121
|
+
private roundToStep;
|
|
122
|
+
private stepPrecision;
|
|
123
|
+
private mapControlsByPath;
|
|
110
124
|
}
|
|
111
125
|
declare const DialStore: DialStoreClass;
|
|
112
126
|
|
|
@@ -116,10 +130,13 @@ interface UseDialOptions {
|
|
|
116
130
|
declare function useDialKit<T extends DialConfig>(name: string, config: T, options?: UseDialOptions): ResolvedValues<T>;
|
|
117
131
|
|
|
118
132
|
type DialPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
133
|
+
type DialMode = 'popover' | 'inline';
|
|
119
134
|
interface DialRootProps {
|
|
120
135
|
position?: DialPosition;
|
|
136
|
+
defaultOpen?: boolean;
|
|
137
|
+
mode?: DialMode;
|
|
121
138
|
}
|
|
122
|
-
declare function DialRoot({ position }: DialRootProps):
|
|
139
|
+
declare function DialRoot({ position, defaultOpen, mode }: DialRootProps): react_jsx_runtime.JSX.Element | null;
|
|
123
140
|
|
|
124
141
|
interface SliderProps {
|
|
125
142
|
label: string;
|
|
@@ -144,10 +161,11 @@ interface FolderProps {
|
|
|
144
161
|
children: ReactNode;
|
|
145
162
|
defaultOpen?: boolean;
|
|
146
163
|
isRoot?: boolean;
|
|
164
|
+
inline?: boolean;
|
|
147
165
|
onOpenChange?: (isOpen: boolean) => void;
|
|
148
166
|
toolbar?: ReactNode;
|
|
149
167
|
}
|
|
150
|
-
declare function Folder({ title, children, defaultOpen, isRoot, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
|
|
168
|
+
declare function Folder({ title, children, defaultOpen, isRoot, inline, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
|
|
151
169
|
|
|
152
170
|
interface ButtonGroupProps {
|
|
153
171
|
buttons: Array<{
|
|
@@ -172,6 +190,20 @@ interface SpringVisualizationProps {
|
|
|
172
190
|
}
|
|
173
191
|
declare function SpringVisualization({ spring, isSimpleMode }: SpringVisualizationProps): react_jsx_runtime.JSX.Element;
|
|
174
192
|
|
|
193
|
+
interface TransitionControlProps {
|
|
194
|
+
panelId: string;
|
|
195
|
+
path: string;
|
|
196
|
+
label: string;
|
|
197
|
+
value: TransitionConfig;
|
|
198
|
+
onChange: (value: TransitionConfig) => void;
|
|
199
|
+
}
|
|
200
|
+
declare function TransitionControl({ panelId, path, label, value, onChange }: TransitionControlProps): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
interface EasingVisualizationProps {
|
|
203
|
+
easing: EasingConfig;
|
|
204
|
+
}
|
|
205
|
+
declare function EasingVisualization({ easing }: EasingVisualizationProps): react_jsx_runtime.JSX.Element;
|
|
206
|
+
|
|
175
207
|
interface TextControlProps {
|
|
176
208
|
label: string;
|
|
177
209
|
value: string;
|
|
@@ -207,4 +239,4 @@ interface PresetManagerProps {
|
|
|
207
239
|
}
|
|
208
240
|
declare function PresetManager({ panelId, presets, activePresetId, onAdd }: PresetManagerProps): react_jsx_runtime.JSX.Element;
|
|
209
241
|
|
|
210
|
-
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialPosition, DialRoot, DialStore, type DialValue, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type UseDialOptions, useDialKit };
|
|
242
|
+
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialMode, 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 };
|
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';
|
|
@@ -10,6 +9,12 @@ type SpringConfig = {
|
|
|
10
9
|
visualDuration?: number;
|
|
11
10
|
bounce?: number;
|
|
12
11
|
};
|
|
12
|
+
type EasingConfig = {
|
|
13
|
+
type: 'easing';
|
|
14
|
+
duration: number;
|
|
15
|
+
ease: [number, number, number, number];
|
|
16
|
+
};
|
|
17
|
+
type TransitionConfig = SpringConfig | EasingConfig;
|
|
13
18
|
type ActionConfig = {
|
|
14
19
|
type: 'action';
|
|
15
20
|
label?: string;
|
|
@@ -31,15 +36,15 @@ type TextConfig = {
|
|
|
31
36
|
default?: string;
|
|
32
37
|
placeholder?: string;
|
|
33
38
|
};
|
|
34
|
-
type DialValue = number | boolean | string | SpringConfig | ActionConfig | SelectConfig | ColorConfig | TextConfig;
|
|
39
|
+
type DialValue = number | boolean | string | SpringConfig | EasingConfig | ActionConfig | SelectConfig | ColorConfig | TextConfig;
|
|
35
40
|
type DialConfig = {
|
|
36
41
|
[key: string]: DialValue | [number, number, number, number?] | DialConfig;
|
|
37
42
|
};
|
|
38
43
|
type ResolvedValues<T extends DialConfig> = {
|
|
39
|
-
[K in keyof T]: T[K] extends [number, number, number, number?] ? number : T[K] extends SpringConfig ?
|
|
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];
|
|
40
45
|
};
|
|
41
46
|
type ControlMeta = {
|
|
42
|
-
type: 'slider' | 'toggle' | 'spring' | 'folder' | 'action' | 'select' | 'color' | 'text';
|
|
47
|
+
type: 'slider' | 'toggle' | 'spring' | 'transition' | 'folder' | 'action' | 'select' | 'color' | 'text';
|
|
43
48
|
path: string;
|
|
44
49
|
label: string;
|
|
45
50
|
min?: number;
|
|
@@ -76,10 +81,13 @@ declare class DialStoreClass {
|
|
|
76
81
|
private activePreset;
|
|
77
82
|
private baseValues;
|
|
78
83
|
registerPanel(id: string, name: string, config: DialConfig): void;
|
|
84
|
+
updatePanel(id: string, name: string, config: DialConfig): void;
|
|
79
85
|
unregisterPanel(id: string): void;
|
|
80
86
|
updateValue(panelId: string, path: string, value: DialValue): void;
|
|
81
87
|
updateSpringMode(panelId: string, path: string, mode: 'simple' | 'advanced'): void;
|
|
82
88
|
getSpringMode(panelId: string, path: string): 'simple' | 'advanced';
|
|
89
|
+
updateTransitionMode(panelId: string, path: string, mode: 'easing' | 'simple' | 'advanced'): void;
|
|
90
|
+
getTransitionMode(panelId: string, path: string): 'easing' | 'simple' | 'advanced';
|
|
83
91
|
getValue(panelId: string, path: string): DialValue | undefined;
|
|
84
92
|
getValues(panelId: string): Record<string, DialValue>;
|
|
85
93
|
getPanels(): PanelConfig[];
|
|
@@ -96,9 +104,11 @@ declare class DialStoreClass {
|
|
|
96
104
|
clearActivePreset(panelId: string): void;
|
|
97
105
|
private notify;
|
|
98
106
|
private notifyGlobal;
|
|
107
|
+
private initTransitionModes;
|
|
99
108
|
private parseConfig;
|
|
100
109
|
private flattenValues;
|
|
101
110
|
private isSpringConfig;
|
|
111
|
+
private isEasingConfig;
|
|
102
112
|
private isActionConfig;
|
|
103
113
|
private isSelectConfig;
|
|
104
114
|
private isColorConfig;
|
|
@@ -107,6 +117,10 @@ declare class DialStoreClass {
|
|
|
107
117
|
private formatLabel;
|
|
108
118
|
private inferRange;
|
|
109
119
|
private inferStep;
|
|
120
|
+
private normalizePreservedValue;
|
|
121
|
+
private roundToStep;
|
|
122
|
+
private stepPrecision;
|
|
123
|
+
private mapControlsByPath;
|
|
110
124
|
}
|
|
111
125
|
declare const DialStore: DialStoreClass;
|
|
112
126
|
|
|
@@ -116,10 +130,13 @@ interface UseDialOptions {
|
|
|
116
130
|
declare function useDialKit<T extends DialConfig>(name: string, config: T, options?: UseDialOptions): ResolvedValues<T>;
|
|
117
131
|
|
|
118
132
|
type DialPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
133
|
+
type DialMode = 'popover' | 'inline';
|
|
119
134
|
interface DialRootProps {
|
|
120
135
|
position?: DialPosition;
|
|
136
|
+
defaultOpen?: boolean;
|
|
137
|
+
mode?: DialMode;
|
|
121
138
|
}
|
|
122
|
-
declare function DialRoot({ position }: DialRootProps):
|
|
139
|
+
declare function DialRoot({ position, defaultOpen, mode }: DialRootProps): react_jsx_runtime.JSX.Element | null;
|
|
123
140
|
|
|
124
141
|
interface SliderProps {
|
|
125
142
|
label: string;
|
|
@@ -144,10 +161,11 @@ interface FolderProps {
|
|
|
144
161
|
children: ReactNode;
|
|
145
162
|
defaultOpen?: boolean;
|
|
146
163
|
isRoot?: boolean;
|
|
164
|
+
inline?: boolean;
|
|
147
165
|
onOpenChange?: (isOpen: boolean) => void;
|
|
148
166
|
toolbar?: ReactNode;
|
|
149
167
|
}
|
|
150
|
-
declare function Folder({ title, children, defaultOpen, isRoot, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
|
|
168
|
+
declare function Folder({ title, children, defaultOpen, isRoot, inline, onOpenChange, toolbar }: FolderProps): react_jsx_runtime.JSX.Element;
|
|
151
169
|
|
|
152
170
|
interface ButtonGroupProps {
|
|
153
171
|
buttons: Array<{
|
|
@@ -172,6 +190,20 @@ interface SpringVisualizationProps {
|
|
|
172
190
|
}
|
|
173
191
|
declare function SpringVisualization({ spring, isSimpleMode }: SpringVisualizationProps): react_jsx_runtime.JSX.Element;
|
|
174
192
|
|
|
193
|
+
interface TransitionControlProps {
|
|
194
|
+
panelId: string;
|
|
195
|
+
path: string;
|
|
196
|
+
label: string;
|
|
197
|
+
value: TransitionConfig;
|
|
198
|
+
onChange: (value: TransitionConfig) => void;
|
|
199
|
+
}
|
|
200
|
+
declare function TransitionControl({ panelId, path, label, value, onChange }: TransitionControlProps): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
interface EasingVisualizationProps {
|
|
203
|
+
easing: EasingConfig;
|
|
204
|
+
}
|
|
205
|
+
declare function EasingVisualization({ easing }: EasingVisualizationProps): react_jsx_runtime.JSX.Element;
|
|
206
|
+
|
|
175
207
|
interface TextControlProps {
|
|
176
208
|
label: string;
|
|
177
209
|
value: string;
|
|
@@ -207,4 +239,4 @@ interface PresetManagerProps {
|
|
|
207
239
|
}
|
|
208
240
|
declare function PresetManager({ panelId, presets, activePresetId, onAdd }: PresetManagerProps): react_jsx_runtime.JSX.Element;
|
|
209
241
|
|
|
210
|
-
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialPosition, DialRoot, DialStore, type DialValue, Folder, type PanelConfig, type Preset, PresetManager, type ResolvedValues, type SelectConfig, SelectControl, Slider, type SpringConfig, SpringControl, SpringVisualization, type TextConfig, TextControl, Toggle, type UseDialOptions, useDialKit };
|
|
242
|
+
export { type ActionConfig, ButtonGroup, type ColorConfig, ColorControl, type ControlMeta, type DialConfig, type DialMode, 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 };
|