@pie-element/shared-theming 0.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/dist/constants.d.ts +288 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/css-variables.d.ts +81 -0
- package/dist/css-variables.d.ts.map +1 -0
- package/dist/hooks.d.ts +109 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +859 -0
- package/dist/mui-integration.d.ts +39 -0
- package/dist/mui-integration.d.ts.map +1 -0
- package/dist/pie-themes.d.ts +37 -0
- package/dist/pie-themes.d.ts.map +1 -0
- package/dist/provider.d.ts +30 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/types.d.ts +113 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIE Color Defaults - All 45+ default color values
|
|
3
|
+
* Copied from @pie-lib/render-ui/src/color.ts
|
|
4
|
+
*/
|
|
5
|
+
export declare const PIE_COLOR_DEFAULTS: {
|
|
6
|
+
readonly TEXT: "black";
|
|
7
|
+
readonly DISABLED: "grey";
|
|
8
|
+
readonly DISABLED_SECONDARY: "#ABABAB";
|
|
9
|
+
readonly CORRECT: "#4caf50";
|
|
10
|
+
readonly CORRECT_SECONDARY: "#e8f5e9";
|
|
11
|
+
readonly CORRECT_TERTIARY: "#0EA449";
|
|
12
|
+
readonly CORRECT_WITH_ICON: "#087D38";
|
|
13
|
+
readonly INCORRECT: "#ff9800";
|
|
14
|
+
readonly INCORRECT_SECONDARY: "#ffebee";
|
|
15
|
+
readonly INCORRECT_WITH_ICON: "#BF0D00";
|
|
16
|
+
readonly MISSING: "#d32f2f";
|
|
17
|
+
readonly MISSING_WITH_ICON: "#6A78A1";
|
|
18
|
+
readonly PRIMARY: "#3f51b5";
|
|
19
|
+
readonly PRIMARY_LIGHT: "#9fa8da";
|
|
20
|
+
readonly PRIMARY_DARK: "#283593";
|
|
21
|
+
readonly SECONDARY: "#f50057";
|
|
22
|
+
readonly SECONDARY_LIGHT: "#f48fb1";
|
|
23
|
+
readonly SECONDARY_DARK: "#880e4f";
|
|
24
|
+
readonly TERTIARY: "#146EB3";
|
|
25
|
+
readonly TERTIARY_LIGHT: "#D0E2F0";
|
|
26
|
+
readonly BACKGROUND: "rgba(255,255,255,0)";
|
|
27
|
+
readonly BACKGROUND_DARK: "#ECEDF1";
|
|
28
|
+
readonly DROPDOWN_BACKGROUND: "#E0E1E6";
|
|
29
|
+
readonly SECONDARY_BACKGROUND: "rgba(241,241,241,1)";
|
|
30
|
+
readonly BORDER: "#9A9A9A";
|
|
31
|
+
readonly BORDER_LIGHT: "#D1D1D1";
|
|
32
|
+
readonly BORDER_DARK: "#646464";
|
|
33
|
+
readonly BORDER_GRAY: "#7E8494";
|
|
34
|
+
readonly BLACK: "#000000";
|
|
35
|
+
readonly WHITE: "#ffffff";
|
|
36
|
+
readonly TRANSPARENT: "transparent";
|
|
37
|
+
readonly FOCUS_CHECKED: "#BBDEFB";
|
|
38
|
+
readonly FOCUS_CHECKED_BORDER: "#1565C0";
|
|
39
|
+
readonly FOCUS_UNCHECKED: "#E0E0E0";
|
|
40
|
+
readonly FOCUS_UNCHECKED_BORDER: "#757575";
|
|
41
|
+
readonly BLUE_GREY100: "#F3F5F7";
|
|
42
|
+
readonly BLUE_GREY300: "#C0C3CF";
|
|
43
|
+
readonly BLUE_GREY600: "#7E8494";
|
|
44
|
+
readonly BLUE_GREY900: "#152452";
|
|
45
|
+
readonly FADED_PRIMARY: "#DCDAFB";
|
|
46
|
+
readonly CHOICE_INPUT_COLOR: "black";
|
|
47
|
+
readonly CHOICE_INPUT_SELECTED_COLOR: "#3f51b5";
|
|
48
|
+
readonly CHOICE_INPUT_DISABLED_COLOR: "grey";
|
|
49
|
+
readonly FEEDBACK_CORRECT_BG: "#4caf50";
|
|
50
|
+
readonly FEEDBACK_INCORRECT_BG: "#ff9800";
|
|
51
|
+
readonly ANNOTATION_POINTER_RIGHT: "100%";
|
|
52
|
+
readonly ANNOTATION_POINTER_TOP: "5px";
|
|
53
|
+
readonly ANNOTATION_POINTER_BORDER_WIDTH: "7px";
|
|
54
|
+
readonly ANNOTATION_POINTER_BORDER_COLOR: "rgb(153, 255, 153)";
|
|
55
|
+
readonly ARROW_COLOR: "#ff9800";
|
|
56
|
+
readonly TICK_COLOR: "#ffffff";
|
|
57
|
+
readonly LINE_STROKE: "#ffffff";
|
|
58
|
+
readonly POINT_FILL: "#000000";
|
|
59
|
+
readonly POINT_STROKE: "#ffffff";
|
|
60
|
+
readonly CORRECT_ANSWER_TOGGLE_LABEL_COLOR: "#ffffff";
|
|
61
|
+
readonly PRIMARY_TEXT: "black";
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Default CSS variable mappings
|
|
65
|
+
* Maps PieThemeExtended keys to --pie-* CSS variables with fallbacks
|
|
66
|
+
*/
|
|
67
|
+
export declare const DEFAULT_CSS_MAPPINGS: readonly [{
|
|
68
|
+
readonly variableName: "--pie-text";
|
|
69
|
+
readonly themeKey: "base-content";
|
|
70
|
+
readonly fallback: "black";
|
|
71
|
+
}, {
|
|
72
|
+
readonly variableName: "--pie-background";
|
|
73
|
+
readonly themeKey: "base-100";
|
|
74
|
+
readonly fallback: "rgba(255,255,255,0)";
|
|
75
|
+
}, {
|
|
76
|
+
readonly variableName: "--pie-background-dark";
|
|
77
|
+
readonly themeKey: "background-dark";
|
|
78
|
+
readonly fallback: "#ECEDF1";
|
|
79
|
+
}, {
|
|
80
|
+
readonly variableName: "--pie-secondary-background";
|
|
81
|
+
readonly themeKey: "secondary-background";
|
|
82
|
+
readonly fallback: "rgba(241,241,241,1)";
|
|
83
|
+
}, {
|
|
84
|
+
readonly variableName: "--pie-dropdown-background";
|
|
85
|
+
readonly themeKey: "dropdown-background";
|
|
86
|
+
readonly fallback: "#E0E1E6";
|
|
87
|
+
}, {
|
|
88
|
+
readonly variableName: "--pie-primary";
|
|
89
|
+
readonly themeKey: "primary";
|
|
90
|
+
readonly fallback: "#3f51b5";
|
|
91
|
+
}, {
|
|
92
|
+
readonly variableName: "--pie-primary-light";
|
|
93
|
+
readonly themeKey: "primary-light";
|
|
94
|
+
readonly fallback: "#9fa8da";
|
|
95
|
+
}, {
|
|
96
|
+
readonly variableName: "--pie-primary-dark";
|
|
97
|
+
readonly themeKey: "primary-dark";
|
|
98
|
+
readonly fallback: "#283593";
|
|
99
|
+
}, {
|
|
100
|
+
readonly variableName: "--pie-faded-primary";
|
|
101
|
+
readonly themeKey: "faded-primary";
|
|
102
|
+
readonly fallback: "#DCDAFB";
|
|
103
|
+
}, {
|
|
104
|
+
readonly variableName: "--pie-secondary";
|
|
105
|
+
readonly themeKey: "secondary";
|
|
106
|
+
readonly fallback: "#f50057";
|
|
107
|
+
}, {
|
|
108
|
+
readonly variableName: "--pie-secondary-light";
|
|
109
|
+
readonly themeKey: "secondary-light";
|
|
110
|
+
readonly fallback: "#f48fb1";
|
|
111
|
+
}, {
|
|
112
|
+
readonly variableName: "--pie-secondary-dark";
|
|
113
|
+
readonly themeKey: "secondary-dark";
|
|
114
|
+
readonly fallback: "#880e4f";
|
|
115
|
+
}, {
|
|
116
|
+
readonly variableName: "--pie-tertiary";
|
|
117
|
+
readonly themeKey: "tertiary";
|
|
118
|
+
readonly fallback: "#146EB3";
|
|
119
|
+
}, {
|
|
120
|
+
readonly variableName: "--pie-tertiary-light";
|
|
121
|
+
readonly themeKey: "tertiary-light";
|
|
122
|
+
readonly fallback: "#D0E2F0";
|
|
123
|
+
}, {
|
|
124
|
+
readonly variableName: "--pie-correct";
|
|
125
|
+
readonly themeKey: "success";
|
|
126
|
+
readonly fallback: "#4caf50";
|
|
127
|
+
}, {
|
|
128
|
+
readonly variableName: "--pie-correct-secondary";
|
|
129
|
+
readonly themeKey: "correct-secondary";
|
|
130
|
+
readonly fallback: "#e8f5e9";
|
|
131
|
+
}, {
|
|
132
|
+
readonly variableName: "--pie-correct-tertiary";
|
|
133
|
+
readonly themeKey: "correct-tertiary";
|
|
134
|
+
readonly fallback: "#0EA449";
|
|
135
|
+
}, {
|
|
136
|
+
readonly variableName: "--pie-correct-icon";
|
|
137
|
+
readonly themeKey: "correct-icon";
|
|
138
|
+
readonly fallback: "#087D38";
|
|
139
|
+
}, {
|
|
140
|
+
readonly variableName: "--pie-incorrect";
|
|
141
|
+
readonly themeKey: "error";
|
|
142
|
+
readonly fallback: "#ff9800";
|
|
143
|
+
}, {
|
|
144
|
+
readonly variableName: "--pie-incorrect-secondary";
|
|
145
|
+
readonly themeKey: "incorrect-secondary";
|
|
146
|
+
readonly fallback: "#ffebee";
|
|
147
|
+
}, {
|
|
148
|
+
readonly variableName: "--pie-incorrect-icon";
|
|
149
|
+
readonly themeKey: "incorrect-icon";
|
|
150
|
+
readonly fallback: "#BF0D00";
|
|
151
|
+
}, {
|
|
152
|
+
readonly variableName: "--pie-missing";
|
|
153
|
+
readonly themeKey: "warning";
|
|
154
|
+
readonly fallback: "#d32f2f";
|
|
155
|
+
}, {
|
|
156
|
+
readonly variableName: "--pie-missing-icon";
|
|
157
|
+
readonly themeKey: "missing-icon";
|
|
158
|
+
readonly fallback: "#6A78A1";
|
|
159
|
+
}, {
|
|
160
|
+
readonly variableName: "--pie-disabled";
|
|
161
|
+
readonly themeKey: "disabled";
|
|
162
|
+
readonly fallback: "grey";
|
|
163
|
+
}, {
|
|
164
|
+
readonly variableName: "--pie-disabled-secondary";
|
|
165
|
+
readonly themeKey: "disabled-secondary";
|
|
166
|
+
readonly fallback: "#ABABAB";
|
|
167
|
+
}, {
|
|
168
|
+
readonly variableName: "--pie-border";
|
|
169
|
+
readonly themeKey: "border";
|
|
170
|
+
readonly fallback: "#9A9A9A";
|
|
171
|
+
}, {
|
|
172
|
+
readonly variableName: "--pie-border-light";
|
|
173
|
+
readonly themeKey: "border-light";
|
|
174
|
+
readonly fallback: "#D1D1D1";
|
|
175
|
+
}, {
|
|
176
|
+
readonly variableName: "--pie-border-dark";
|
|
177
|
+
readonly themeKey: "border-dark";
|
|
178
|
+
readonly fallback: "#646464";
|
|
179
|
+
}, {
|
|
180
|
+
readonly variableName: "--pie-border-gray";
|
|
181
|
+
readonly themeKey: "border-gray";
|
|
182
|
+
readonly fallback: "#7E8494";
|
|
183
|
+
}, {
|
|
184
|
+
readonly variableName: "--pie-focus-checked";
|
|
185
|
+
readonly themeKey: "focus-checked";
|
|
186
|
+
readonly fallback: "#BBDEFB";
|
|
187
|
+
}, {
|
|
188
|
+
readonly variableName: "--pie-focus-checked-border";
|
|
189
|
+
readonly themeKey: "focus-checked-border";
|
|
190
|
+
readonly fallback: "#1565C0";
|
|
191
|
+
}, {
|
|
192
|
+
readonly variableName: "--pie-focus-unchecked";
|
|
193
|
+
readonly themeKey: "focus-unchecked";
|
|
194
|
+
readonly fallback: "#E0E0E0";
|
|
195
|
+
}, {
|
|
196
|
+
readonly variableName: "--pie-focus-unchecked-border";
|
|
197
|
+
readonly themeKey: "focus-unchecked-border";
|
|
198
|
+
readonly fallback: "#757575";
|
|
199
|
+
}, {
|
|
200
|
+
readonly variableName: "--pie-blue-grey-100";
|
|
201
|
+
readonly themeKey: "blue-grey-100";
|
|
202
|
+
readonly fallback: "#F3F5F7";
|
|
203
|
+
}, {
|
|
204
|
+
readonly variableName: "--pie-blue-grey-300";
|
|
205
|
+
readonly themeKey: "blue-grey-300";
|
|
206
|
+
readonly fallback: "#C0C3CF";
|
|
207
|
+
}, {
|
|
208
|
+
readonly variableName: "--pie-blue-grey-600";
|
|
209
|
+
readonly themeKey: "blue-grey-600";
|
|
210
|
+
readonly fallback: "#7E8494";
|
|
211
|
+
}, {
|
|
212
|
+
readonly variableName: "--pie-blue-grey-900";
|
|
213
|
+
readonly themeKey: "blue-grey-900";
|
|
214
|
+
readonly fallback: "#152452";
|
|
215
|
+
}, {
|
|
216
|
+
readonly variableName: "--pie-black";
|
|
217
|
+
readonly themeKey: "black";
|
|
218
|
+
readonly fallback: "#000000";
|
|
219
|
+
}, {
|
|
220
|
+
readonly variableName: "--pie-white";
|
|
221
|
+
readonly themeKey: "white";
|
|
222
|
+
readonly fallback: "#ffffff";
|
|
223
|
+
}, {
|
|
224
|
+
readonly variableName: "--choice-input-color";
|
|
225
|
+
readonly themeKey: "choice-input-color";
|
|
226
|
+
readonly fallback: "black";
|
|
227
|
+
}, {
|
|
228
|
+
readonly variableName: "--choice-input-selected-color";
|
|
229
|
+
readonly themeKey: "choice-input-selected-color";
|
|
230
|
+
readonly fallback: "#3f51b5";
|
|
231
|
+
}, {
|
|
232
|
+
readonly variableName: "--choice-input-disabled-color";
|
|
233
|
+
readonly themeKey: "choice-input-disabled-color";
|
|
234
|
+
readonly fallback: "grey";
|
|
235
|
+
}, {
|
|
236
|
+
readonly variableName: "--feedback-correct-bg-color";
|
|
237
|
+
readonly themeKey: "feedback-correct-bg";
|
|
238
|
+
readonly fallback: "#4caf50";
|
|
239
|
+
}, {
|
|
240
|
+
readonly variableName: "--feedback-incorrect-bg-color";
|
|
241
|
+
readonly themeKey: "feedback-incorrect-bg";
|
|
242
|
+
readonly fallback: "#ff9800";
|
|
243
|
+
}, {
|
|
244
|
+
readonly variableName: "--before-right";
|
|
245
|
+
readonly themeKey: "annotation-pointer-right";
|
|
246
|
+
readonly fallback: "100%";
|
|
247
|
+
}, {
|
|
248
|
+
readonly variableName: "--before-top";
|
|
249
|
+
readonly themeKey: "annotation-pointer-top";
|
|
250
|
+
readonly fallback: "5px";
|
|
251
|
+
}, {
|
|
252
|
+
readonly variableName: "--before-border-width";
|
|
253
|
+
readonly themeKey: "annotation-pointer-border-width";
|
|
254
|
+
readonly fallback: "7px";
|
|
255
|
+
}, {
|
|
256
|
+
readonly variableName: "--before-border-color";
|
|
257
|
+
readonly themeKey: "annotation-pointer-border-color";
|
|
258
|
+
readonly fallback: "rgb(153, 255, 153)";
|
|
259
|
+
}, {
|
|
260
|
+
readonly variableName: "--arrow-color";
|
|
261
|
+
readonly themeKey: "arrow-color";
|
|
262
|
+
readonly fallback: "#ff9800";
|
|
263
|
+
}, {
|
|
264
|
+
readonly variableName: "--tick-color";
|
|
265
|
+
readonly themeKey: "tick-color";
|
|
266
|
+
readonly fallback: "#ffffff";
|
|
267
|
+
}, {
|
|
268
|
+
readonly variableName: "--line-stroke";
|
|
269
|
+
readonly themeKey: "line-stroke";
|
|
270
|
+
readonly fallback: "#ffffff";
|
|
271
|
+
}, {
|
|
272
|
+
readonly variableName: "--point-fill";
|
|
273
|
+
readonly themeKey: "point-fill";
|
|
274
|
+
readonly fallback: "#000000";
|
|
275
|
+
}, {
|
|
276
|
+
readonly variableName: "--point-stroke";
|
|
277
|
+
readonly themeKey: "point-stroke";
|
|
278
|
+
readonly fallback: "#ffffff";
|
|
279
|
+
}, {
|
|
280
|
+
readonly variableName: "--correct-answer-toggle-label-color";
|
|
281
|
+
readonly themeKey: "correct-answer-toggle-label-color";
|
|
282
|
+
readonly fallback: "#ffffff";
|
|
283
|
+
}, {
|
|
284
|
+
readonly variableName: "--pie-primary-text";
|
|
285
|
+
readonly themeKey: "primary-text";
|
|
286
|
+
readonly fallback: "black";
|
|
287
|
+
}];
|
|
288
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoErB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8SvB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { PieThemeExtended, CssVariableMapping } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate CSS variables from a PIE theme
|
|
4
|
+
* Maps theme properties to CSS variables with fallbacks
|
|
5
|
+
*
|
|
6
|
+
* @param theme - Partial PIE theme with color values
|
|
7
|
+
* @param options - Optional configuration for variable generation
|
|
8
|
+
* @returns Record of CSS variable names to values
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const theme = { primary: '#3F51B5', 'base-content': '#000000' };
|
|
13
|
+
* const vars = generateCssVariables(theme);
|
|
14
|
+
* // { '--pie-primary': '#3F51B5', '--pie-text': '#000000', ... }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateCssVariables(theme: Partial<PieThemeExtended>, options?: {
|
|
18
|
+
prefix?: string;
|
|
19
|
+
mappings?: readonly CssVariableMapping[];
|
|
20
|
+
}): Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Convert CSS variables object to inline style string
|
|
23
|
+
* Formats as "key: value; key: value" for use in style attributes
|
|
24
|
+
*
|
|
25
|
+
* @param cssVars - Record of CSS variable names to values
|
|
26
|
+
* @returns Formatted CSS string
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const vars = { '--pie-text': 'black', '--pie-primary': '#3F51B5' };
|
|
31
|
+
* const styleString = cssVariablesToStyleString(vars);
|
|
32
|
+
* // "--pie-text: black; --pie-primary: #3F51B5"
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function cssVariablesToStyleString(cssVars: Record<string, string>): string;
|
|
36
|
+
/**
|
|
37
|
+
* Convert CSS variables object to React CSSProperties object
|
|
38
|
+
* Useful for inline styles in React components
|
|
39
|
+
*
|
|
40
|
+
* @param cssVars - Record of CSS variable names to values
|
|
41
|
+
* @returns React CSSProperties object
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const vars = { '--pie-text': 'black' };
|
|
46
|
+
* const style = cssVariablesToReactStyle(vars);
|
|
47
|
+
* <div style={style}>...</div>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function cssVariablesToReactStyle(cssVars: Record<string, string>): React.CSSProperties;
|
|
51
|
+
/**
|
|
52
|
+
* Inject CSS variables into a DOM element
|
|
53
|
+
* Modifies the element's style property to set CSS custom properties
|
|
54
|
+
*
|
|
55
|
+
* @param cssVars - Record of CSS variable names to values
|
|
56
|
+
* @param target - Target element (defaults to document.documentElement)
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const vars = generateCssVariables(theme);
|
|
61
|
+
* injectCssVariables(vars); // Injects to :root (document.documentElement)
|
|
62
|
+
* // or
|
|
63
|
+
* injectCssVariables(vars, myElement); // Injects to specific element
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function injectCssVariables(cssVars: Record<string, string>, target?: HTMLElement): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove CSS variables from a DOM element
|
|
69
|
+
* Cleans up previously injected CSS variables
|
|
70
|
+
*
|
|
71
|
+
* @param cssVars - Record of CSS variable names (values ignored)
|
|
72
|
+
* @param target - Target element (defaults to document.documentElement)
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const vars = generateCssVariables(theme);
|
|
77
|
+
* removeCssVariables(vars); // Removes from :root
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function removeCssVariables(cssVars: Record<string, string>, target?: HTMLElement): void;
|
|
81
|
+
//# sourceMappingURL=css-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.d.ts","sourceRoot":"","sources":["../src/css-variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGpE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAChC,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC1C,GACA,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAIjF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAE7F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,MAAM,GAAE,WAAwF,GAC/F,IAAI,CAWN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,MAAM,GAAE,WAAwF,GAC/F,IAAI,CAQN"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Theme } from '@mui/material/styles';
|
|
2
|
+
import type { PieThemeExtended, ThemeContextValue } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access the PIE theme context
|
|
5
|
+
* Provides theme state, CSS variables, MUI theme, and update function
|
|
6
|
+
*
|
|
7
|
+
* @returns Theme context value
|
|
8
|
+
* @throws Error if used outside PieThemeProvider
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* function MyComponent() {
|
|
13
|
+
* const { theme, cssVariables, muiTheme, setTheme } = usePieTheme();
|
|
14
|
+
*
|
|
15
|
+
* const handleThemeChange = () => {
|
|
16
|
+
* setTheme({ ...theme, primary: '#FF0000' });
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* return <div style={cssVariablesToReactStyle(cssVariables)}>...</div>;
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function usePieTheme(): ThemeContextValue;
|
|
24
|
+
/**
|
|
25
|
+
* Hook to get CSS variables from current theme
|
|
26
|
+
* Returns a record of CSS variable names to values
|
|
27
|
+
*
|
|
28
|
+
* @returns CSS variables object
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* function MyComponent() {
|
|
33
|
+
* const cssVars = usePieThemeVariables();
|
|
34
|
+
* // { '--pie-text': 'black', '--pie-primary': '#3F51B5', ... }
|
|
35
|
+
*
|
|
36
|
+
* return <div style={cssVariablesToReactStyle(cssVars)}>...</div>;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function usePieThemeVariables(): Record<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to get CSS variables as a React style object
|
|
43
|
+
* Ready for use in inline styles
|
|
44
|
+
*
|
|
45
|
+
* @returns React CSSProperties object with CSS variables
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* function MyComponent() {
|
|
50
|
+
* const style = usePieThemeStyle();
|
|
51
|
+
* return <div style={style}>...</div>;
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function usePieThemeStyle(): React.CSSProperties;
|
|
56
|
+
/**
|
|
57
|
+
* Hook to get the current PIE theme colors
|
|
58
|
+
* Returns the theme object without CSS variables or MUI theme
|
|
59
|
+
*
|
|
60
|
+
* @returns Current PIE theme
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* function MyComponent() {
|
|
65
|
+
* const theme = usePieThemeColors();
|
|
66
|
+
* return <div>Primary: {theme.primary}</div>;
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function usePieThemeColors(): Partial<PieThemeExtended>;
|
|
71
|
+
/**
|
|
72
|
+
* Hook to get the MUI theme
|
|
73
|
+
* Returns the Material-UI theme object
|
|
74
|
+
*
|
|
75
|
+
* @returns MUI Theme
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import { styled } from '@mui/material/styles';
|
|
80
|
+
*
|
|
81
|
+
* function MyComponent() {
|
|
82
|
+
* const muiTheme = usePieMuiTheme();
|
|
83
|
+
* const spacing = muiTheme.spacing(2); // 16px
|
|
84
|
+
* return <div>...</div>;
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function usePieMuiTheme(): Theme;
|
|
89
|
+
/**
|
|
90
|
+
* Hook to update the current theme
|
|
91
|
+
* Returns a function to update the theme
|
|
92
|
+
*
|
|
93
|
+
* @returns Theme update function
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* function ThemeSwitcher() {
|
|
98
|
+
* const updateTheme = useSetPieTheme();
|
|
99
|
+
*
|
|
100
|
+
* const switchToDark = () => {
|
|
101
|
+
* updateTheme({ 'base-content': '#fff', 'base-100': '#000' });
|
|
102
|
+
* };
|
|
103
|
+
*
|
|
104
|
+
* return <button onClick={switchToDark}>Dark Mode</button>;
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function useSetPieTheme(): (theme: Partial<PieThemeExtended>) => void;
|
|
109
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAM/C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,aAAa,CAGtD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAG7D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAGtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAG3E"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { PieThemeExtended, CssVariableMapping, MuiThemeOptions, ThemeConfig, ThemeContextValue, PieThemeProviderProps, } from './types';
|
|
2
|
+
export { PIE_COLOR_DEFAULTS, DEFAULT_CSS_MAPPINGS } from './constants';
|
|
3
|
+
export { PIE_ORANGE, PIE_LIGHT_THEME, PIE_DARK_THEME, getPieTheme, PIE_THEME_NAMES, type PieThemeName, } from './pie-themes';
|
|
4
|
+
export { generateCssVariables, cssVariablesToStyleString, cssVariablesToReactStyle, injectCssVariables, removeCssVariables, } from './css-variables';
|
|
5
|
+
export { createPieMuiTheme, updateMuiThemeFromPie } from './mui-integration';
|
|
6
|
+
export { PieThemeProvider, PieThemeContext } from './provider';
|
|
7
|
+
export { usePieTheme, usePieThemeVariables, usePieThemeStyle, usePieThemeColors, usePieMuiTheme, useSetPieTheme, } from './hooks';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGvE,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG/D,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC"}
|