@rogieking/figui3 6.20.2 → 6.21.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/propskit.d.ts ADDED
@@ -0,0 +1,98 @@
1
+ export type PropsKitTheme = "system" | "light" | "dark";
2
+
3
+ export type PropsKitSliderTuple = [number, number, number, number?];
4
+
5
+ export type PropsKitSelectConfig = {
6
+ type: "select";
7
+ options: Array<string | { value: string; label?: string }>;
8
+ default?: string;
9
+ };
10
+
11
+ export type PropsKitColorConfig = {
12
+ type: "color";
13
+ default: string;
14
+ };
15
+
16
+ export type PropsKitTextConfig = {
17
+ type: "text";
18
+ default?: string;
19
+ placeholder?: string;
20
+ };
21
+
22
+ export type PropsKitEasingConfig = {
23
+ type: "easing" | "spring";
24
+ value?: number[];
25
+ ease?: number[];
26
+ default?: number[];
27
+ [key: string]: unknown;
28
+ };
29
+
30
+ export type PropsKitActionConfig = {
31
+ type: "action";
32
+ };
33
+
34
+ export type PropsKitFolderConfig = {
35
+ _collapsed?: boolean;
36
+ [key: string]: PropsKitConfigValue;
37
+ };
38
+
39
+ export type PropsKitConfigValue =
40
+ | number
41
+ | boolean
42
+ | string
43
+ | PropsKitSliderTuple
44
+ | PropsKitSelectConfig
45
+ | PropsKitColorConfig
46
+ | PropsKitTextConfig
47
+ | PropsKitEasingConfig
48
+ | PropsKitActionConfig
49
+ | PropsKitFolderConfig;
50
+
51
+ export type PropsKitConfig = Record<string, PropsKitConfigValue>;
52
+
53
+ export type PropsKitOptions = {
54
+ theme?: PropsKitTheme;
55
+ onChange?: (
56
+ path: string,
57
+ value: unknown,
58
+ values: Record<string, unknown>,
59
+ ) => void;
60
+ onAction?: (name: string) => void;
61
+ scoped?: boolean;
62
+ };
63
+
64
+ export type PropsKitInstance = {
65
+ readonly values: Record<string, unknown>;
66
+ get(path: string): unknown;
67
+ set(path: string, value: unknown): void;
68
+ subscribe(fn: (values: Record<string, unknown>) => void): () => void;
69
+ destroy(): void;
70
+ };
71
+
72
+ export declare const PROPSKIT_SCOPE_ROOT_CLASS: "figui-root";
73
+ export declare const PROPSKIT_OVERLAY_ROOT_ATTR: "data-figui-overlay-root";
74
+
75
+ export declare function applyFiguiTheme(
76
+ el: Element,
77
+ theme?: PropsKitTheme,
78
+ ): void;
79
+
80
+ export declare function syncOverlayTheme(source?: Element | null): Element | null;
81
+
82
+ export declare function inferControl(
83
+ key: string,
84
+ value: unknown,
85
+ ): Record<string, unknown>;
86
+
87
+ export declare function parseConfig(
88
+ config: PropsKitConfig,
89
+ ): Array<Record<string, unknown>>;
90
+
91
+ export declare function createPropsKit(
92
+ target: Element | DocumentFragment,
93
+ name: string,
94
+ config: PropsKitConfig,
95
+ options?: PropsKitOptions,
96
+ ): PropsKitInstance;
97
+
98
+ export as namespace PropsKit;
package/propskit.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * PropsKit entry — one JS file for consumers.
3
+ * Bundles fig + fig-lab + fig-editor + propskit-core.
4
+ */
5
+ import "./fig-editor.js";
6
+
7
+ export {
8
+ PROPSKIT_SCOPE_ROOT_CLASS,
9
+ PROPSKIT_OVERLAY_ROOT_ATTR,
10
+ applyFiguiTheme,
11
+ syncOverlayTheme,
12
+ inferControl,
13
+ parseConfig,
14
+ createPropsKit,
15
+ } from "./propskit-core.js";