@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/index.js ADDED
@@ -0,0 +1,859 @@
1
+ import { createTheme as k, StyledEngineProvider as A, ThemeProvider as T } from "@mui/material/styles";
2
+ import y, { createContext as D, useState as R, useEffect as g, useContext as K, useMemo as v } from "react";
3
+ const b = {
4
+ 50: "#ffebee",
5
+ 400: "#ef5350",
6
+ 500: "#f44336",
7
+ 600: "#e53935",
8
+ 700: "#d32f2f",
9
+ 800: "#c62828",
10
+ 900: "#b71c1c"
11
+ }, E = {
12
+ 200: "#f48fb1",
13
+ 900: "#880e4f",
14
+ A400: "#f50057"
15
+ }, s = {
16
+ 200: "#9fa8da",
17
+ 300: "#7986cb",
18
+ 400: "#5c6bc0",
19
+ 500: "#3f51b5",
20
+ 600: "#3949ab",
21
+ 800: "#283593"
22
+ }, n = {
23
+ 100: "#bbdefb",
24
+ 200: "#90caf9",
25
+ 300: "#64b5f6",
26
+ 400: "#42a5f5",
27
+ 500: "#2196f3",
28
+ 600: "#1e88e5",
29
+ 700: "#1976d2",
30
+ 800: "#1565c0",
31
+ 900: "#0d47a1"
32
+ }, i = {
33
+ 50: "#e8f5e9",
34
+ 300: "#81c784",
35
+ 400: "#66bb6a",
36
+ 500: "#4caf50",
37
+ 600: "#43a047",
38
+ 700: "#388e3c",
39
+ 800: "#2e7d32",
40
+ 900: "#1b5e20"
41
+ }, c = {
42
+ 50: "#fff3e0",
43
+ 300: "#ffb74d",
44
+ 400: "#ffa726",
45
+ 500: "#ff9800",
46
+ 600: "#fb8c00",
47
+ 700: "#f57c00",
48
+ 800: "#ef6c00",
49
+ 900: "#e65100"
50
+ }, t = {
51
+ 50: "#fafafa",
52
+ 100: "#f5f5f5",
53
+ 300: "#e0e0e0",
54
+ 400: "#bdbdbd",
55
+ 500: "#9e9e9e",
56
+ 600: "#757575",
57
+ 700: "#616161",
58
+ 800: "#424242",
59
+ 900: "#212121"
60
+ }, a = {
61
+ TEXT: "black",
62
+ DISABLED: "grey",
63
+ DISABLED_SECONDARY: "#ABABAB",
64
+ CORRECT: i[500],
65
+ // #4CAF50
66
+ CORRECT_SECONDARY: i[50],
67
+ // #E8F5E9
68
+ CORRECT_TERTIARY: "#0EA449",
69
+ CORRECT_WITH_ICON: "#087D38",
70
+ INCORRECT: c[500],
71
+ // #FF9800
72
+ INCORRECT_SECONDARY: b[50],
73
+ // #FFEBEE
74
+ INCORRECT_WITH_ICON: "#BF0D00",
75
+ MISSING: b[700],
76
+ // #D32F2F
77
+ MISSING_WITH_ICON: "#6A78A1",
78
+ PRIMARY: s[500],
79
+ // #3F51B5
80
+ PRIMARY_LIGHT: s[200],
81
+ // #9FA8DA
82
+ PRIMARY_DARK: s[800],
83
+ // #283593
84
+ SECONDARY: E.A400,
85
+ // #F50057
86
+ SECONDARY_LIGHT: E[200],
87
+ // #F48FB1
88
+ SECONDARY_DARK: E[900],
89
+ // #880E4F
90
+ TERTIARY: "#146EB3",
91
+ TERTIARY_LIGHT: "#D0E2F0",
92
+ BACKGROUND: "rgba(255,255,255,0)",
93
+ BACKGROUND_DARK: "#ECEDF1",
94
+ DROPDOWN_BACKGROUND: "#E0E1E6",
95
+ SECONDARY_BACKGROUND: "rgba(241,241,241,1)",
96
+ BORDER: "#9A9A9A",
97
+ BORDER_LIGHT: "#D1D1D1",
98
+ BORDER_DARK: "#646464",
99
+ BORDER_GRAY: "#7E8494",
100
+ BLACK: "#000000",
101
+ WHITE: "#ffffff",
102
+ TRANSPARENT: "transparent",
103
+ FOCUS_CHECKED: "#BBDEFB",
104
+ FOCUS_CHECKED_BORDER: "#1565C0",
105
+ FOCUS_UNCHECKED: "#E0E0E0",
106
+ FOCUS_UNCHECKED_BORDER: "#757575",
107
+ BLUE_GREY100: "#F3F5F7",
108
+ BLUE_GREY300: "#C0C3CF",
109
+ BLUE_GREY600: "#7E8494",
110
+ BLUE_GREY900: "#152452",
111
+ FADED_PRIMARY: "#DCDAFB",
112
+ // Component-specific colors (formerly ad-hoc, now formalized)
113
+ // Choice inputs
114
+ CHOICE_INPUT_COLOR: "black",
115
+ // References TEXT
116
+ CHOICE_INPUT_SELECTED_COLOR: s[500],
117
+ // References PRIMARY
118
+ CHOICE_INPUT_DISABLED_COLOR: "grey",
119
+ // References DISABLED
120
+ // Feedback
121
+ FEEDBACK_CORRECT_BG: i[500],
122
+ // References CORRECT
123
+ FEEDBACK_INCORRECT_BG: c[500],
124
+ // References INCORRECT
125
+ // Annotations (extended-text-entry)
126
+ ANNOTATION_POINTER_RIGHT: "100%",
127
+ ANNOTATION_POINTER_TOP: "5px",
128
+ ANNOTATION_POINTER_BORDER_WIDTH: "7px",
129
+ ANNOTATION_POINTER_BORDER_COLOR: "rgb(153, 255, 153)",
130
+ // Number line / graphing
131
+ ARROW_COLOR: c[500],
132
+ // Dynamic, using INCORRECT as default
133
+ TICK_COLOR: "#ffffff",
134
+ LINE_STROKE: "#ffffff",
135
+ POINT_FILL: "#000000",
136
+ POINT_STROKE: "#ffffff",
137
+ CORRECT_ANSWER_TOGGLE_LABEL_COLOR: "#ffffff",
138
+ // Utility
139
+ PRIMARY_TEXT: "black"
140
+ // References TEXT
141
+ }, B = [
142
+ // Core text and background
143
+ {
144
+ variableName: "--pie-text",
145
+ themeKey: "base-content",
146
+ fallback: a.TEXT
147
+ },
148
+ {
149
+ variableName: "--pie-background",
150
+ themeKey: "base-100",
151
+ fallback: a.BACKGROUND
152
+ },
153
+ {
154
+ variableName: "--pie-background-dark",
155
+ themeKey: "background-dark",
156
+ fallback: a.BACKGROUND_DARK
157
+ },
158
+ {
159
+ variableName: "--pie-secondary-background",
160
+ themeKey: "secondary-background",
161
+ fallback: a.SECONDARY_BACKGROUND
162
+ },
163
+ {
164
+ variableName: "--pie-dropdown-background",
165
+ themeKey: "dropdown-background",
166
+ fallback: a.DROPDOWN_BACKGROUND
167
+ },
168
+ // Primary colors
169
+ {
170
+ variableName: "--pie-primary",
171
+ themeKey: "primary",
172
+ fallback: a.PRIMARY
173
+ },
174
+ {
175
+ variableName: "--pie-primary-light",
176
+ themeKey: "primary-light",
177
+ fallback: a.PRIMARY_LIGHT
178
+ },
179
+ {
180
+ variableName: "--pie-primary-dark",
181
+ themeKey: "primary-dark",
182
+ fallback: a.PRIMARY_DARK
183
+ },
184
+ {
185
+ variableName: "--pie-faded-primary",
186
+ themeKey: "faded-primary",
187
+ fallback: a.FADED_PRIMARY
188
+ },
189
+ // Secondary colors
190
+ {
191
+ variableName: "--pie-secondary",
192
+ themeKey: "secondary",
193
+ fallback: a.SECONDARY
194
+ },
195
+ {
196
+ variableName: "--pie-secondary-light",
197
+ themeKey: "secondary-light",
198
+ fallback: a.SECONDARY_LIGHT
199
+ },
200
+ {
201
+ variableName: "--pie-secondary-dark",
202
+ themeKey: "secondary-dark",
203
+ fallback: a.SECONDARY_DARK
204
+ },
205
+ // Tertiary colors
206
+ {
207
+ variableName: "--pie-tertiary",
208
+ themeKey: "tertiary",
209
+ fallback: a.TERTIARY
210
+ },
211
+ {
212
+ variableName: "--pie-tertiary-light",
213
+ themeKey: "tertiary-light",
214
+ fallback: a.TERTIARY_LIGHT
215
+ },
216
+ // Correct (success) colors
217
+ {
218
+ variableName: "--pie-correct",
219
+ themeKey: "success",
220
+ fallback: a.CORRECT
221
+ },
222
+ {
223
+ variableName: "--pie-correct-secondary",
224
+ themeKey: "correct-secondary",
225
+ fallback: a.CORRECT_SECONDARY
226
+ },
227
+ {
228
+ variableName: "--pie-correct-tertiary",
229
+ themeKey: "correct-tertiary",
230
+ fallback: a.CORRECT_TERTIARY
231
+ },
232
+ {
233
+ variableName: "--pie-correct-icon",
234
+ themeKey: "correct-icon",
235
+ fallback: a.CORRECT_WITH_ICON
236
+ },
237
+ // Incorrect (error) colors
238
+ {
239
+ variableName: "--pie-incorrect",
240
+ themeKey: "error",
241
+ fallback: a.INCORRECT
242
+ },
243
+ {
244
+ variableName: "--pie-incorrect-secondary",
245
+ themeKey: "incorrect-secondary",
246
+ fallback: a.INCORRECT_SECONDARY
247
+ },
248
+ {
249
+ variableName: "--pie-incorrect-icon",
250
+ themeKey: "incorrect-icon",
251
+ fallback: a.INCORRECT_WITH_ICON
252
+ },
253
+ // Missing (warning) colors
254
+ {
255
+ variableName: "--pie-missing",
256
+ themeKey: "warning",
257
+ fallback: a.MISSING
258
+ },
259
+ {
260
+ variableName: "--pie-missing-icon",
261
+ themeKey: "missing-icon",
262
+ fallback: a.MISSING_WITH_ICON
263
+ },
264
+ // Disabled colors
265
+ {
266
+ variableName: "--pie-disabled",
267
+ themeKey: "disabled",
268
+ fallback: a.DISABLED
269
+ },
270
+ {
271
+ variableName: "--pie-disabled-secondary",
272
+ themeKey: "disabled-secondary",
273
+ fallback: a.DISABLED_SECONDARY
274
+ },
275
+ // Border colors
276
+ {
277
+ variableName: "--pie-border",
278
+ themeKey: "border",
279
+ fallback: a.BORDER
280
+ },
281
+ {
282
+ variableName: "--pie-border-light",
283
+ themeKey: "border-light",
284
+ fallback: a.BORDER_LIGHT
285
+ },
286
+ {
287
+ variableName: "--pie-border-dark",
288
+ themeKey: "border-dark",
289
+ fallback: a.BORDER_DARK
290
+ },
291
+ {
292
+ variableName: "--pie-border-gray",
293
+ themeKey: "border-gray",
294
+ fallback: a.BORDER_GRAY
295
+ },
296
+ // Focus states
297
+ {
298
+ variableName: "--pie-focus-checked",
299
+ themeKey: "focus-checked",
300
+ fallback: a.FOCUS_CHECKED
301
+ },
302
+ {
303
+ variableName: "--pie-focus-checked-border",
304
+ themeKey: "focus-checked-border",
305
+ fallback: a.FOCUS_CHECKED_BORDER
306
+ },
307
+ {
308
+ variableName: "--pie-focus-unchecked",
309
+ themeKey: "focus-unchecked",
310
+ fallback: a.FOCUS_UNCHECKED
311
+ },
312
+ {
313
+ variableName: "--pie-focus-unchecked-border",
314
+ themeKey: "focus-unchecked-border",
315
+ fallback: a.FOCUS_UNCHECKED_BORDER
316
+ },
317
+ // Blue-grey palette
318
+ {
319
+ variableName: "--pie-blue-grey-100",
320
+ themeKey: "blue-grey-100",
321
+ fallback: a.BLUE_GREY100
322
+ },
323
+ {
324
+ variableName: "--pie-blue-grey-300",
325
+ themeKey: "blue-grey-300",
326
+ fallback: a.BLUE_GREY300
327
+ },
328
+ {
329
+ variableName: "--pie-blue-grey-600",
330
+ themeKey: "blue-grey-600",
331
+ fallback: a.BLUE_GREY600
332
+ },
333
+ {
334
+ variableName: "--pie-blue-grey-900",
335
+ themeKey: "blue-grey-900",
336
+ fallback: a.BLUE_GREY900
337
+ },
338
+ // Base colors
339
+ { variableName: "--pie-black", themeKey: "black", fallback: a.BLACK },
340
+ { variableName: "--pie-white", themeKey: "white", fallback: a.WHITE },
341
+ // Component-specific variables (formerly ad-hoc, now formalized for comprehensive theming)
342
+ // Choice inputs (multiple-choice, likert, matrix)
343
+ {
344
+ variableName: "--choice-input-color",
345
+ themeKey: "choice-input-color",
346
+ fallback: a.CHOICE_INPUT_COLOR
347
+ },
348
+ {
349
+ variableName: "--choice-input-selected-color",
350
+ themeKey: "choice-input-selected-color",
351
+ fallback: a.CHOICE_INPUT_SELECTED_COLOR
352
+ },
353
+ {
354
+ variableName: "--choice-input-disabled-color",
355
+ themeKey: "choice-input-disabled-color",
356
+ fallback: a.CHOICE_INPUT_DISABLED_COLOR
357
+ },
358
+ // Feedback (multiple-choice, match-list)
359
+ {
360
+ variableName: "--feedback-correct-bg-color",
361
+ themeKey: "feedback-correct-bg",
362
+ fallback: a.FEEDBACK_CORRECT_BG
363
+ },
364
+ {
365
+ variableName: "--feedback-incorrect-bg-color",
366
+ themeKey: "feedback-incorrect-bg",
367
+ fallback: a.FEEDBACK_INCORRECT_BG
368
+ },
369
+ // Annotations (extended-text-entry)
370
+ {
371
+ variableName: "--before-right",
372
+ themeKey: "annotation-pointer-right",
373
+ fallback: a.ANNOTATION_POINTER_RIGHT
374
+ },
375
+ {
376
+ variableName: "--before-top",
377
+ themeKey: "annotation-pointer-top",
378
+ fallback: a.ANNOTATION_POINTER_TOP
379
+ },
380
+ {
381
+ variableName: "--before-border-width",
382
+ themeKey: "annotation-pointer-border-width",
383
+ fallback: a.ANNOTATION_POINTER_BORDER_WIDTH
384
+ },
385
+ {
386
+ variableName: "--before-border-color",
387
+ themeKey: "annotation-pointer-border-color",
388
+ fallback: a.ANNOTATION_POINTER_BORDER_COLOR
389
+ },
390
+ // Number line / graphing (number-line)
391
+ {
392
+ variableName: "--arrow-color",
393
+ themeKey: "arrow-color",
394
+ fallback: a.ARROW_COLOR
395
+ },
396
+ {
397
+ variableName: "--tick-color",
398
+ themeKey: "tick-color",
399
+ fallback: a.TICK_COLOR
400
+ },
401
+ {
402
+ variableName: "--line-stroke",
403
+ themeKey: "line-stroke",
404
+ fallback: a.LINE_STROKE
405
+ },
406
+ {
407
+ variableName: "--point-fill",
408
+ themeKey: "point-fill",
409
+ fallback: a.POINT_FILL
410
+ },
411
+ {
412
+ variableName: "--point-stroke",
413
+ themeKey: "point-stroke",
414
+ fallback: a.POINT_STROKE
415
+ },
416
+ {
417
+ variableName: "--correct-answer-toggle-label-color",
418
+ themeKey: "correct-answer-toggle-label-color",
419
+ fallback: a.CORRECT_ANSWER_TOGGLE_LABEL_COLOR
420
+ },
421
+ // Utility
422
+ {
423
+ variableName: "--pie-primary-text",
424
+ themeKey: "primary-text",
425
+ fallback: a.PRIMARY_TEXT
426
+ }
427
+ ], p = c[800], P = {
428
+ // Core text and backgrounds
429
+ "base-content": "#1a202c",
430
+ // Dark grey for text
431
+ "base-100": "#ffffff",
432
+ // White background
433
+ "base-200": "#f7fafc",
434
+ // Very light grey
435
+ "base-300": "#e2e8f0",
436
+ // Light grey for borders
437
+ // PIE Brand colors (orange primary)
438
+ primary: p,
439
+ // #FF6F00
440
+ "primary-light": c[400],
441
+ // #FFA726
442
+ "primary-dark": c[900],
443
+ // #E65100
444
+ "faded-primary": c[50],
445
+ // #FFF3E0
446
+ // Secondary colors (blue)
447
+ secondary: n[600],
448
+ // #1E88E5
449
+ "secondary-light": n[300],
450
+ // #64B5F6
451
+ "secondary-dark": n[800],
452
+ // #1565C0
453
+ // Tertiary colors (indigo)
454
+ tertiary: s[600],
455
+ // #3949AB
456
+ "tertiary-light": s[200],
457
+ // #9FA8DA
458
+ // Status colors - Correct (green)
459
+ success: i[600],
460
+ // #43A047
461
+ "correct-secondary": i[50],
462
+ // #E8F5E9
463
+ "correct-tertiary": i[700],
464
+ // #388E3C
465
+ "correct-icon": i[800],
466
+ // #2E7D32
467
+ // Status colors - Incorrect (red)
468
+ error: b[600],
469
+ // #E53935
470
+ "incorrect-secondary": b[50],
471
+ // #FFEBEE
472
+ "incorrect-icon": b[800],
473
+ // #C62828
474
+ // Status colors - Missing/Warning (amber)
475
+ warning: c[700],
476
+ // #F57C00
477
+ "missing-icon": t[600],
478
+ // #757575
479
+ // Disabled states
480
+ disabled: t[500],
481
+ // #9E9E9E
482
+ "disabled-secondary": t[300],
483
+ // #E0E0E0
484
+ // Backgrounds
485
+ "background-dark": t[100],
486
+ // #F5F5F5
487
+ "secondary-background": t[50],
488
+ // #FAFAFA
489
+ "dropdown-background": "#ffffff",
490
+ // Borders
491
+ border: t[400],
492
+ // #BDBDBD
493
+ "border-light": t[300],
494
+ // #E0E0E0
495
+ "border-dark": t[600],
496
+ // #757575
497
+ "border-gray": t[500],
498
+ // #9E9E9E
499
+ // Focus states
500
+ "focus-checked": n[100],
501
+ // #BBDEFB
502
+ "focus-checked-border": n[700],
503
+ // #1976D2
504
+ "focus-unchecked": t[300],
505
+ // #E0E0E0
506
+ "focus-unchecked-border": t[600],
507
+ // #757575
508
+ // Blue-grey palette
509
+ "blue-grey-100": "#F3F5F7",
510
+ "blue-grey-300": "#C0C3CF",
511
+ "blue-grey-600": "#7E8494",
512
+ "blue-grey-900": "#152452",
513
+ // Absolute colors
514
+ black: "#000000",
515
+ white: "#ffffff",
516
+ // Component-specific
517
+ "choice-input-color": "#1a202c",
518
+ "choice-input-selected-color": p,
519
+ "choice-input-disabled-color": t[500],
520
+ "feedback-correct-bg": i[50],
521
+ "feedback-incorrect-bg": b[50],
522
+ "annotation-pointer-border-color": i[300],
523
+ "arrow-color": c[600],
524
+ "tick-color": t[700],
525
+ "line-stroke": t[400],
526
+ "point-fill": p,
527
+ "point-stroke": "#ffffff",
528
+ "correct-answer-toggle-label-color": "#1a202c",
529
+ "primary-text": "#1a202c"
530
+ }, S = {
531
+ // Core text and backgrounds
532
+ "base-content": "#e2e8f0",
533
+ // Light grey for text
534
+ "base-100": "#1a202c",
535
+ // Dark blue-grey background
536
+ "base-200": "#2d3748",
537
+ // Medium dark grey
538
+ "base-300": "#4a5568",
539
+ // Medium grey for borders
540
+ // PIE Brand colors (orange primary - brighter for dark mode)
541
+ primary: c[500],
542
+ // #FF9800 (brighter than light theme)
543
+ "primary-light": c[300],
544
+ // #FFB74D
545
+ "primary-dark": c[700],
546
+ // #F57C00
547
+ "faded-primary": c[900] + "40",
548
+ // #E65100 with opacity
549
+ // Secondary colors (cyan)
550
+ secondary: n[400],
551
+ // #42A5F5
552
+ "secondary-light": n[200],
553
+ // #90CAF9
554
+ "secondary-dark": n[600],
555
+ // #1E88E5
556
+ // Tertiary colors (indigo)
557
+ tertiary: s[400],
558
+ // #5C6BC0
559
+ "tertiary-light": s[300],
560
+ // #7986CB
561
+ // Status colors - Correct (green)
562
+ success: i[500],
563
+ // #4CAF50
564
+ "correct-secondary": i[900] + "40",
565
+ // #1B5E20 with opacity
566
+ "correct-tertiary": i[600],
567
+ // #43A047
568
+ "correct-icon": i[400],
569
+ // #66BB6A
570
+ // Status colors - Incorrect (red)
571
+ error: b[500],
572
+ // #F44336
573
+ "incorrect-secondary": b[900] + "40",
574
+ // #B71C1C with opacity
575
+ "incorrect-icon": b[400],
576
+ // #EF5350
577
+ // Status colors - Missing/Warning
578
+ warning: c[600],
579
+ // #FB8C00
580
+ "missing-icon": t[500],
581
+ // #9E9E9E
582
+ // Disabled states
583
+ disabled: t[600],
584
+ // #757575
585
+ "disabled-secondary": t[800],
586
+ // #424242
587
+ // Backgrounds
588
+ "background-dark": "#0f1419",
589
+ // Very dark background
590
+ "secondary-background": "#2d3748",
591
+ // Medium dark background
592
+ "dropdown-background": "#2d3748",
593
+ // Borders
594
+ border: t[700],
595
+ // #616161
596
+ "border-light": t[800],
597
+ // #424242
598
+ "border-dark": t[500],
599
+ // #9E9E9E
600
+ "border-gray": t[600],
601
+ // #757575
602
+ // Focus states
603
+ "focus-checked": n[900],
604
+ // #0D47A1
605
+ "focus-checked-border": n[500],
606
+ // #2196F3
607
+ "focus-unchecked": t[800],
608
+ // #424242
609
+ "focus-unchecked-border": t[500],
610
+ // #9E9E9E
611
+ // Blue-grey palette
612
+ "blue-grey-100": "#37474F",
613
+ "blue-grey-300": "#546E7A",
614
+ "blue-grey-600": "#78909C",
615
+ "blue-grey-900": "#ECEFF1",
616
+ // Absolute colors
617
+ black: "#000000",
618
+ white: "#ffffff",
619
+ // Component-specific
620
+ "choice-input-color": "#e2e8f0",
621
+ "choice-input-selected-color": c[500],
622
+ "choice-input-disabled-color": t[600],
623
+ "feedback-correct-bg": i[900] + "80",
624
+ // With higher opacity for visibility
625
+ "feedback-incorrect-bg": b[900] + "80",
626
+ "annotation-pointer-border-color": i[600],
627
+ "arrow-color": c[500],
628
+ "tick-color": t[300],
629
+ "line-stroke": t[600],
630
+ "point-fill": c[500],
631
+ "point-stroke": t[900],
632
+ "correct-answer-toggle-label-color": "#e2e8f0",
633
+ "primary-text": "#e2e8f0"
634
+ };
635
+ function H(e) {
636
+ return e === "dark" ? S : P;
637
+ }
638
+ const U = ["light", "dark"];
639
+ function C(e, r) {
640
+ const o = {}, d = r?.mappings || B;
641
+ for (const l of d) {
642
+ const f = e[l.themeKey];
643
+ o[l.variableName] = f || l.fallback;
644
+ }
645
+ return o;
646
+ }
647
+ function M(e) {
648
+ return Object.entries(e).map(([r, o]) => `${r}: ${o}`).join("; ");
649
+ }
650
+ function w(e) {
651
+ return e;
652
+ }
653
+ function L(e, r = typeof document < "u" ? document.documentElement : null) {
654
+ if (!r) {
655
+ console.warn(
656
+ "injectCssVariables: No target element available (running in non-browser environment)"
657
+ );
658
+ return;
659
+ }
660
+ Object.entries(e).forEach(([o, d]) => {
661
+ r.style.setProperty(o, d);
662
+ });
663
+ }
664
+ function W(e, r = typeof document < "u" ? document.documentElement : null) {
665
+ r && Object.keys(e).forEach((o) => {
666
+ r.style.removeProperty(o);
667
+ });
668
+ }
669
+ function N(e, r = {}) {
670
+ const {
671
+ useThemePalette: o = !1,
672
+ injectCssVariables: d = !0,
673
+ preserveMuiDefaults: l = !0
674
+ } = r, f = {
675
+ typography: {
676
+ fontFamily: "inherit"
677
+ },
678
+ palette: l ? {
679
+ action: {
680
+ disabled: "rgba(0, 0, 0, 0.54)"
681
+ }
682
+ } : {}
683
+ };
684
+ return o && (f.palette = {
685
+ ...f.palette,
686
+ primary: {
687
+ main: e.primary || "#3F51B5",
688
+ light: e["primary-light"],
689
+ dark: e["primary-dark"]
690
+ },
691
+ secondary: {
692
+ main: e.secondary || "#F50057",
693
+ light: e["secondary-light"],
694
+ dark: e["secondary-dark"]
695
+ },
696
+ success: {
697
+ main: e.success || "#4CAF50"
698
+ },
699
+ error: {
700
+ main: e.error || "#FF9800"
701
+ },
702
+ warning: {
703
+ main: e.warning || "#FFC107"
704
+ },
705
+ info: {
706
+ main: e.info || "#2196F3"
707
+ },
708
+ text: {
709
+ primary: e["base-content"] || "rgba(0, 0, 0, 0.87)"
710
+ },
711
+ background: {
712
+ default: e["base-100"] || "#fff",
713
+ paper: e["base-200"] || "#fff"
714
+ }
715
+ }), d && (f.components = {
716
+ MuiTypography: {
717
+ styleOverrides: {
718
+ root: {
719
+ fontFamily: "inherit",
720
+ color: l ? "inherit" : "var(--pie-text, inherit)"
721
+ }
722
+ }
723
+ },
724
+ MuiButton: {
725
+ styleOverrides: {
726
+ contained: l ? {
727
+ backgroundColor: "#e0e0e0",
728
+ color: "#000000",
729
+ "&:hover": {
730
+ backgroundColor: "#bdbdbd"
731
+ }
732
+ } : {
733
+ backgroundColor: "var(--pie-primary)",
734
+ color: "var(--pie-text)",
735
+ "&:hover": {
736
+ backgroundColor: "var(--pie-primary-dark)"
737
+ }
738
+ }
739
+ }
740
+ },
741
+ MuiTextField: {
742
+ styleOverrides: {
743
+ root: {
744
+ "& .MuiInputBase-root": {
745
+ color: d && !l ? "var(--pie-text)" : void 0
746
+ }
747
+ }
748
+ }
749
+ },
750
+ MuiSelect: {
751
+ styleOverrides: {
752
+ root: {
753
+ color: d && !l ? "var(--pie-text)" : void 0
754
+ }
755
+ }
756
+ }
757
+ }), k(f);
758
+ }
759
+ function V(e, r) {
760
+ return k({
761
+ ...e,
762
+ palette: {
763
+ ...e.palette,
764
+ primary: {
765
+ ...e.palette.primary,
766
+ main: r.primary || e.palette.primary.main,
767
+ light: r["primary-light"] || e.palette.primary.light,
768
+ dark: r["primary-dark"] || e.palette.primary.dark
769
+ },
770
+ secondary: {
771
+ ...e.palette.secondary,
772
+ main: r.secondary || e.palette.secondary.main,
773
+ light: r["secondary-light"] || e.palette.secondary.light,
774
+ dark: r["secondary-dark"] || e.palette.secondary.dark
775
+ },
776
+ text: {
777
+ ...e.palette.text,
778
+ primary: r["base-content"] || e.palette.text.primary
779
+ },
780
+ background: {
781
+ ...e.palette.background,
782
+ default: r["base-100"] || e.palette.background.default,
783
+ paper: r["base-200"] || e.palette.background.paper
784
+ }
785
+ }
786
+ });
787
+ }
788
+ const _ = D(void 0);
789
+ function x({ children: e, config: r }) {
790
+ const [o, d] = R(r.theme), [l, f] = R(
791
+ () => C(r.theme, { prefix: r.prefix, mappings: r.mappings })
792
+ ), [u, h] = R(
793
+ () => N(r.theme, r.muiOptions)
794
+ );
795
+ g(() => {
796
+ const O = C(o, {
797
+ prefix: r.prefix,
798
+ mappings: r.mappings
799
+ });
800
+ f(O), h(N(o, r.muiOptions)), r.injectGlobally && L(O);
801
+ }, [o, r.prefix, r.mappings, r.muiOptions, r.injectGlobally]);
802
+ const I = {
803
+ theme: o,
804
+ cssVariables: l,
805
+ muiTheme: u,
806
+ setTheme: d
807
+ };
808
+ return /* @__PURE__ */ y.createElement(_.Provider, { value: I }, /* @__PURE__ */ y.createElement(A, { injectFirst: !0 }, /* @__PURE__ */ y.createElement(T, { theme: u }, e)));
809
+ }
810
+ function m() {
811
+ const e = K(_);
812
+ if (!e)
813
+ throw new Error("usePieTheme must be used within a PieThemeProvider");
814
+ return e;
815
+ }
816
+ function F() {
817
+ const { cssVariables: e } = m();
818
+ return e;
819
+ }
820
+ function j() {
821
+ const e = F();
822
+ return v(() => e, [e]);
823
+ }
824
+ function X() {
825
+ const { theme: e } = m();
826
+ return e;
827
+ }
828
+ function $() {
829
+ const { muiTheme: e } = m();
830
+ return e;
831
+ }
832
+ function q() {
833
+ const { setTheme: e } = m();
834
+ return e;
835
+ }
836
+ export {
837
+ B as DEFAULT_CSS_MAPPINGS,
838
+ a as PIE_COLOR_DEFAULTS,
839
+ S as PIE_DARK_THEME,
840
+ P as PIE_LIGHT_THEME,
841
+ p as PIE_ORANGE,
842
+ U as PIE_THEME_NAMES,
843
+ _ as PieThemeContext,
844
+ x as PieThemeProvider,
845
+ N as createPieMuiTheme,
846
+ w as cssVariablesToReactStyle,
847
+ M as cssVariablesToStyleString,
848
+ C as generateCssVariables,
849
+ H as getPieTheme,
850
+ L as injectCssVariables,
851
+ W as removeCssVariables,
852
+ V as updateMuiThemeFromPie,
853
+ $ as usePieMuiTheme,
854
+ m as usePieTheme,
855
+ X as usePieThemeColors,
856
+ j as usePieThemeStyle,
857
+ F as usePieThemeVariables,
858
+ q as useSetPieTheme
859
+ };