@panneau/ui 5.0.0-alpha.7 → 5.0.0-alpha.9

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 +17 -0
  2. package/dist/alert/Alert.d.ts +2 -2
  3. package/dist/alert/tokens.d.ts +1 -1
  4. package/dist/badge/Badge.d.ts +1 -1
  5. package/dist/badge/tokens.d.ts +1 -1
  6. package/dist/button/Button.d.ts +3 -3
  7. package/dist/button/tokens.d.ts +1 -1
  8. package/dist/card/tokens.d.ts +1 -1
  9. package/dist/checkbox/Checkbox.d.ts +1 -1
  10. package/dist/checkbox/tokens.d.ts +1 -1
  11. package/dist/combo-box/ComboBox.d.ts +1 -1
  12. package/dist/command-palette/CommandPalette.d.ts +1 -1
  13. package/dist/command-palette/match.d.ts +1 -1
  14. package/dist/command-palette/tokens.d.ts +1 -1
  15. package/dist/container/tokens.d.ts +1 -1
  16. package/dist/date-picker/DatePicker.d.ts +1 -1
  17. package/dist/date-picker/calendarTokens.d.ts +1 -1
  18. package/dist/dialog/Dialog.css +5 -0
  19. package/dist/dialog/Dialog.d.ts.map +1 -1
  20. package/dist/dialog/Dialog.js +9 -4
  21. package/dist/dialog/Dialog.js.map +1 -1
  22. package/dist/dialog/Dialog.module.js +4 -2
  23. package/dist/dialog/Dialog.module.js.map +1 -1
  24. package/dist/dialog/tokens.d.ts +1 -1
  25. package/dist/disclosure/tokens.d.ts +1 -1
  26. package/dist/divider/tokens.d.ts +1 -1
  27. package/dist/field/FieldParts.d.ts +1 -1
  28. package/dist/field/inputTokens.d.ts +1 -1
  29. package/dist/field/tokens.d.ts +1 -1
  30. package/dist/grid/Grid.d.ts +1 -1
  31. package/dist/grid/tokens.d.ts +1 -1
  32. package/dist/heading/tokens.d.ts +1 -1
  33. package/dist/icon/lucideIconLoader.d.ts +1 -1
  34. package/dist/icon/namedIcons.d.ts +1 -1
  35. package/dist/icon-button/IconButton.d.ts +2 -2
  36. package/dist/index.d.ts +61 -61
  37. package/dist/inline/Inline.d.ts +1 -1
  38. package/dist/inline/tokens.d.ts +1 -1
  39. package/dist/menu/Menu.d.ts +1 -1
  40. package/dist/menu/tokens.d.ts +1 -1
  41. package/dist/named-icons/index.d.ts +1 -1
  42. package/dist/number-input/NumberInput.d.ts +1 -1
  43. package/dist/number-input/tokens.d.ts +1 -1
  44. package/dist/pill-trigger/tokens.d.ts +1 -1
  45. package/dist/popover/Popover.css +5 -0
  46. package/dist/popover/Popover.d.ts.map +1 -1
  47. package/dist/popover/Popover.js +9 -4
  48. package/dist/popover/Popover.js.map +1 -1
  49. package/dist/popover/Popover.module.js +4 -2
  50. package/dist/popover/Popover.module.js.map +1 -1
  51. package/dist/popover/tokens.d.ts +1 -1
  52. package/dist/prose/tokens.d.ts +1 -1
  53. package/dist/radio-group/RadioGroup.d.ts +2 -2
  54. package/dist/radio-group/tokens.d.ts +1 -1
  55. package/dist/root/PanneauRoot.d.ts +27 -5
  56. package/dist/root/PanneauRoot.d.ts.map +1 -1
  57. package/dist/root/PanneauRoot.js +164 -120
  58. package/dist/root/PanneauRoot.js.map +1 -1
  59. package/dist/root/ThemeScope.d.ts +1 -1
  60. package/dist/root/ThemeScope.d.ts.map +1 -1
  61. package/dist/root/ThemeScope.js +40 -38
  62. package/dist/root/ThemeScope.js.map +1 -1
  63. package/dist/segmented-control/SegmentedControl.d.ts +1 -1
  64. package/dist/segmented-control/tokens.d.ts +1 -1
  65. package/dist/select/Select.d.ts +1 -1
  66. package/dist/select/listBoxTokens.d.ts +1 -1
  67. package/dist/skeleton/tokens.d.ts +1 -1
  68. package/dist/slider/Slider.d.ts +1 -1
  69. package/dist/spinner/tokens.d.ts +1 -1
  70. package/dist/stack/Stack.d.ts +1 -1
  71. package/dist/stack/tokens.d.ts +1 -1
  72. package/dist/switch/Switch.d.ts +1 -1
  73. package/dist/switch/tokens.d.ts +1 -1
  74. package/dist/tabs/tokens.d.ts +1 -1
  75. package/dist/tags-input/TagsInput.d.ts +1 -1
  76. package/dist/text/Text.d.ts +1 -1
  77. package/dist/text/tokens.d.ts +1 -1
  78. package/dist/text-area/TextArea.d.ts +1 -1
  79. package/dist/text-input/TextInput.d.ts +1 -1
  80. package/dist/theme/bootstrap.d.ts +2 -2
  81. package/dist/theme/checkTheme.d.ts +2 -2
  82. package/dist/theme/cli.d.ts +2 -2
  83. package/dist/theme/colorVision.d.ts +1 -1
  84. package/dist/theme/defineTheme.d.ts +5 -5
  85. package/dist/theme/index.d.ts +12 -12
  86. package/dist/theme/theme.d.ts +2 -2
  87. package/dist/theme/toneClass.d.ts +1 -1
  88. package/dist/theme/tones.d.ts +1 -1
  89. package/dist/time-input/TimeInput.d.ts +1 -1
  90. package/dist/toast/Toast.d.ts +1 -1
  91. package/dist/toast/tokens.d.ts +1 -1
  92. package/dist/tooltip/tokens.d.ts +1 -1
  93. package/dist/utils/events.d.ts +4 -0
  94. package/dist/utils/events.d.ts.map +1 -0
  95. package/dist/utils/events.js +9 -0
  96. package/dist/utils/events.js.map +1 -0
  97. package/package.json +5 -5
@@ -13,11 +13,25 @@ import { IntlContext, IntlProvider } from "react-intl";
13
13
  //#region src/root/PanneauRoot.tsx
14
14
  /** `undefined` outside of a root, `null` while the root's container isn't mounted yet. */
15
15
  var PortalContext = createContext(void 0);
16
- /** The color scheme and density in effect, which a `ThemeScope` inherits when it doesn't set them. */
16
+ /**
17
+ * The color scheme and density in effect, which a `ThemeScope` inherits when it doesn't set them,
18
+ * and the nonce of the styles of themes.
19
+ */
17
20
  var ScopeContext = createContext({
18
21
  colorScheme: "light",
19
22
  density: "auto"
20
23
  });
24
+ /**
25
+ * The nonce of the page's Content Security Policy, where React Aria reads it: the `nonce` (or
26
+ * `content`) of `<meta property="csp-nonce">` or `<meta name="csp-nonce">`, or
27
+ * `__webpack_nonce__`. `undefined` without one, and on the server.
28
+ */
29
+ function getPageNonce() {
30
+ if (typeof document === "undefined") return;
31
+ const meta = document.querySelector("meta[property=\"csp-nonce\"], meta[name=\"csp-nonce\"]");
32
+ const nonce = meta?.nonce || meta?.content || globalThis.__webpack_nonce__;
33
+ return nonce !== void 0 && nonce !== "" ? nonce : void 0;
34
+ }
21
35
  /** Gives overlays a container: that of a root, or of a scope. */
22
36
  var PortalProvider = PortalContext.Provider;
23
37
  /**
@@ -25,12 +39,12 @@ var PortalProvider = PortalContext.Provider;
25
39
  * fonts. React hoists them to the head and adds each once, however many roots or scopes use it.
26
40
  * Returns the scope of the theme too, for `data-panneau-theme`.
27
41
  */
28
- function useThemeStyles(theme) {
29
- const $ = c(13);
42
+ function useThemeStyles(theme, nonce) {
43
+ const $ = c(17);
30
44
  let t0;
31
45
  let t1;
32
46
  let t2;
33
- if ($[0] !== theme) {
47
+ if ($[0] !== nonce || $[1] !== theme) {
34
48
  const css = theme !== null ? getThemeCss(theme, "§") : "";
35
49
  const scope = css !== "" ? hashString(css) : void 0;
36
50
  const fontCss = getFontFaceCss(theme?.fonts);
@@ -38,50 +52,65 @@ function useThemeStyles(theme) {
38
52
  t0 = scope !== void 0 ? /* @__PURE__ */ jsx("style", {
39
53
  href: `panneau-theme-${scope}`,
40
54
  precedence: "panneau",
55
+ nonce,
41
56
  children: css.replaceAll("§", scope)
42
57
  }) : null;
43
58
  t1 = fontCss !== "" ? /* @__PURE__ */ jsx("style", {
44
59
  href: `panneau-fonts-${hashString(fontCss)}`,
45
60
  precedence: "panneau",
61
+ nonce,
46
62
  children: fontCss
47
63
  }) : null;
48
- $[0] = theme;
49
- $[1] = t0;
50
- $[2] = t1;
51
- $[3] = t2;
64
+ $[0] = nonce;
65
+ $[1] = theme;
66
+ $[2] = t0;
67
+ $[3] = t1;
68
+ $[4] = t2;
52
69
  } else {
53
- t0 = $[1];
54
- t1 = $[2];
55
- t2 = $[3];
70
+ t0 = $[2];
71
+ t1 = $[3];
72
+ t2 = $[4];
56
73
  }
57
74
  let t3;
58
- if ($[4] !== theme?.fonts) {
59
- t3 = getFontStylesheets(theme?.fonts).map(_temp);
60
- $[4] = theme?.fonts;
61
- $[5] = t3;
62
- } else t3 = $[5];
75
+ if ($[5] !== nonce || $[6] !== theme?.fonts) {
76
+ let t4;
77
+ if ($[8] !== nonce) {
78
+ t4 = (href) => /* @__PURE__ */ jsx("link", {
79
+ rel: "stylesheet",
80
+ href,
81
+ precedence: "panneau",
82
+ nonce
83
+ }, href);
84
+ $[8] = nonce;
85
+ $[9] = t4;
86
+ } else t4 = $[9];
87
+ t3 = getFontStylesheets(theme?.fonts).map(t4);
88
+ $[5] = nonce;
89
+ $[6] = theme?.fonts;
90
+ $[7] = t3;
91
+ } else t3 = $[7];
63
92
  let t4;
64
- if ($[6] !== t0 || $[7] !== t1 || $[8] !== t3) {
93
+ if ($[10] !== t0 || $[11] !== t1 || $[12] !== t3) {
65
94
  t4 = /* @__PURE__ */ jsxs(Fragment, { children: [
66
95
  t0,
67
96
  t1,
68
97
  t3
69
98
  ] });
70
- $[6] = t0;
71
- $[7] = t1;
72
- $[8] = t3;
73
- $[9] = t4;
74
- } else t4 = $[9];
99
+ $[10] = t0;
100
+ $[11] = t1;
101
+ $[12] = t3;
102
+ $[13] = t4;
103
+ } else t4 = $[13];
75
104
  let t5;
76
- if ($[10] !== t2 || $[11] !== t4) {
105
+ if ($[14] !== t2 || $[15] !== t4) {
77
106
  t5 = {
78
107
  scope: t2,
79
108
  styles: t4
80
109
  };
81
- $[10] = t2;
82
- $[11] = t4;
83
- $[12] = t5;
84
- } else t5 = $[12];
110
+ $[14] = t2;
111
+ $[15] = t4;
112
+ $[16] = t5;
113
+ } else t5 = $[16];
85
114
  return t5;
86
115
  }
87
116
  /**
@@ -89,13 +118,6 @@ function useThemeStyles(theme) {
89
118
  * without a root. It is `null` during the first render of a root: overlays wait for it, since
90
119
  * React Aria hides everything outside of a modal from assistive technologies when it opens.
91
120
  */
92
- function _temp(href) {
93
- return /* @__PURE__ */ jsx("link", {
94
- rel: "stylesheet",
95
- href,
96
- precedence: "panneau"
97
- }, href);
98
- }
99
121
  function usePortalContainer() {
100
122
  return use(PortalContext);
101
123
  }
@@ -105,8 +127,8 @@ function usePortalContainer() {
105
127
  * missing.
106
128
  */
107
129
  function PanneauIntlProvider(t0) {
108
- const $ = c(11);
109
- const { locale: t1, children } = t0;
130
+ const $ = c(14);
131
+ const { locale: t1, messages: added, children } = t0;
110
132
  const locale = t1 === void 0 ? "en" : t1;
111
133
  let t2;
112
134
  if ($[0] !== locale) {
@@ -131,19 +153,29 @@ function PanneauIntlProvider(t0) {
131
153
  $[6] = t5;
132
154
  } else t5 = $[6];
133
155
  let t6;
134
- if ($[7] !== children || $[8] !== t4 || $[9] !== t5) {
135
- t6 = /* @__PURE__ */ jsx(IntlProvider, {
156
+ if ($[7] !== added || $[8] !== t5) {
157
+ t6 = {
158
+ ...t5,
159
+ ...added
160
+ };
161
+ $[7] = added;
162
+ $[8] = t5;
163
+ $[9] = t6;
164
+ } else t6 = $[9];
165
+ let t7;
166
+ if ($[10] !== children || $[11] !== t4 || $[12] !== t6) {
167
+ t7 = /* @__PURE__ */ jsx(IntlProvider, {
136
168
  locale: t4,
137
169
  defaultLocale: "en",
138
- messages: t5,
170
+ messages: t6,
139
171
  children
140
172
  });
141
- $[7] = children;
142
- $[8] = t4;
143
- $[9] = t5;
144
- $[10] = t6;
145
- } else t6 = $[10];
146
- return t6;
173
+ $[10] = children;
174
+ $[11] = t4;
175
+ $[12] = t6;
176
+ $[13] = t7;
177
+ } else t7 = $[13];
178
+ return t7;
147
179
  }
148
180
  /**
149
181
  * The root of every Panneau interface. It scopes the base stylesheet and the design tokens to its
@@ -153,133 +185,143 @@ function PanneauIntlProvider(t0) {
153
185
  * with Panneau's messages in its `locale`.
154
186
  */
155
187
  function PanneauRoot(t0) {
156
- const $ = c(45);
188
+ const $ = c(49);
157
189
  let children;
158
190
  let className;
191
+ let givenNonce;
159
192
  let locale;
193
+ let messages;
160
194
  let props;
161
195
  let t1;
162
196
  let t2;
163
197
  let t3;
164
198
  let t4;
165
199
  if ($[0] !== t0) {
166
- ({theme: t1, colorScheme: t2, density: t3, iconLoader: t4, locale, className, children, ...props} = t0);
200
+ ({theme: t1, colorScheme: t2, density: t3, iconLoader: t4, locale, messages, nonce: givenNonce, className, children, ...props} = t0);
167
201
  $[0] = t0;
168
202
  $[1] = children;
169
203
  $[2] = className;
170
- $[3] = locale;
171
- $[4] = props;
172
- $[5] = t1;
173
- $[6] = t2;
174
- $[7] = t3;
175
- $[8] = t4;
204
+ $[3] = givenNonce;
205
+ $[4] = locale;
206
+ $[5] = messages;
207
+ $[6] = props;
208
+ $[7] = t1;
209
+ $[8] = t2;
210
+ $[9] = t3;
211
+ $[10] = t4;
176
212
  } else {
177
213
  children = $[1];
178
214
  className = $[2];
179
- locale = $[3];
180
- props = $[4];
181
- t1 = $[5];
182
- t2 = $[6];
183
- t3 = $[7];
184
- t4 = $[8];
215
+ givenNonce = $[3];
216
+ locale = $[4];
217
+ messages = $[5];
218
+ props = $[6];
219
+ t1 = $[7];
220
+ t2 = $[8];
221
+ t3 = $[9];
222
+ t4 = $[10];
185
223
  }
186
224
  const theme = t1 === void 0 ? null : t1;
187
225
  const colorScheme = t2 === void 0 ? "light" : t2;
188
226
  const density = t3 === void 0 ? "auto" : t3;
189
227
  const iconLoader = t4 === void 0 ? null : t4;
228
+ const [pageNonce] = useState(getPageNonce);
229
+ const nonce = givenNonce ?? pageNonce;
190
230
  const intl = use(IntlContext);
191
231
  const [container, setContainer] = useState(null);
192
- const { scope, styles: themeStyles } = useThemeStyles(theme);
232
+ const { scope, styles: themeStyles } = useThemeStyles(theme, nonce);
193
233
  let t5;
194
- if ($[9] !== className) {
234
+ if ($[11] !== className) {
195
235
  t5 = cx("panneau-root", PanneauRoot_module_default.root, PanneauRoot_module_default.container, className);
196
- $[9] = className;
197
- $[10] = t5;
198
- } else t5 = $[10];
236
+ $[11] = className;
237
+ $[12] = t5;
238
+ } else t5 = $[12];
199
239
  const t6 = locale ?? intl?.locale;
200
240
  let t7;
201
- if ($[11] !== colorScheme || $[12] !== density) {
241
+ if ($[13] !== colorScheme || $[14] !== density || $[15] !== nonce) {
202
242
  t7 = {
203
243
  colorScheme,
204
- density
244
+ density,
245
+ nonce
205
246
  };
206
- $[11] = colorScheme;
207
- $[12] = density;
208
- $[13] = t7;
209
- } else t7 = $[13];
247
+ $[13] = colorScheme;
248
+ $[14] = density;
249
+ $[15] = nonce;
250
+ $[16] = t7;
251
+ } else t7 = $[16];
210
252
  let t8;
211
- if ($[14] !== colorScheme || $[15] !== density || $[16] !== scope) {
253
+ if ($[17] !== colorScheme || $[18] !== density || $[19] !== scope) {
212
254
  t8 = {
213
255
  "data-color-scheme": colorScheme,
214
256
  "data-density": density,
215
257
  "data-panneau-theme": scope
216
258
  };
217
- $[14] = colorScheme;
218
- $[15] = density;
219
- $[16] = scope;
220
- $[17] = t8;
221
- } else t8 = $[17];
259
+ $[17] = colorScheme;
260
+ $[18] = density;
261
+ $[19] = scope;
262
+ $[20] = t8;
263
+ } else t8 = $[20];
222
264
  let t9;
223
- if ($[18] !== children || $[19] !== t8) {
265
+ if ($[21] !== children || $[22] !== t8) {
224
266
  t9 = /* @__PURE__ */ jsx(ToastProvider, {
225
267
  regionClassName: PanneauRoot_module_default.root,
226
268
  regionProps: t8,
227
269
  children
228
270
  });
229
- $[18] = children;
230
- $[19] = t8;
231
- $[20] = t9;
232
- } else t9 = $[20];
271
+ $[21] = children;
272
+ $[22] = t8;
273
+ $[23] = t9;
274
+ } else t9 = $[23];
233
275
  let t10;
234
- if ($[21] !== container || $[22] !== t9) {
276
+ if ($[24] !== container || $[25] !== t9) {
235
277
  t10 = /* @__PURE__ */ jsx(PortalContext, {
236
278
  value: container,
237
279
  children: t9
238
280
  });
239
- $[21] = container;
240
- $[22] = t9;
241
- $[23] = t10;
242
- } else t10 = $[23];
281
+ $[24] = container;
282
+ $[25] = t9;
283
+ $[26] = t10;
284
+ } else t10 = $[26];
243
285
  let t11;
244
- if ($[24] !== t10 || $[25] !== t7) {
286
+ if ($[27] !== t10 || $[28] !== t7) {
245
287
  t11 = /* @__PURE__ */ jsx(ScopeContext, {
246
288
  value: t7,
247
289
  children: t10
248
290
  });
249
- $[24] = t10;
250
- $[25] = t7;
251
- $[26] = t11;
252
- } else t11 = $[26];
291
+ $[27] = t10;
292
+ $[28] = t7;
293
+ $[29] = t11;
294
+ } else t11 = $[29];
253
295
  let t12;
254
- if ($[27] !== iconLoader || $[28] !== t11) {
296
+ if ($[30] !== iconLoader || $[31] !== t11) {
255
297
  t12 = /* @__PURE__ */ jsx(NamedIconLoaderContext, {
256
298
  value: iconLoader,
257
299
  children: t11
258
300
  });
259
- $[27] = iconLoader;
260
- $[28] = t11;
261
- $[29] = t12;
262
- } else t12 = $[29];
301
+ $[30] = iconLoader;
302
+ $[31] = t11;
303
+ $[32] = t12;
304
+ } else t12 = $[32];
263
305
  let t13;
264
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
306
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
265
307
  t13 = /* @__PURE__ */ jsx("div", {
266
308
  ref: setContainer,
267
309
  className: PanneauRoot_module_default.portal
268
310
  });
269
- $[30] = t13;
270
- } else t13 = $[30];
311
+ $[33] = t13;
312
+ } else t13 = $[33];
271
313
  let t14;
272
- if ($[31] !== t12 || $[32] !== t6) {
314
+ if ($[34] !== t12 || $[35] !== t6) {
273
315
  t14 = /* @__PURE__ */ jsxs(I18nProvider, {
274
316
  locale: t6,
275
317
  children: [t12, t13]
276
318
  });
277
- $[31] = t12;
278
- $[32] = t6;
279
- $[33] = t14;
280
- } else t14 = $[33];
319
+ $[34] = t12;
320
+ $[35] = t6;
321
+ $[36] = t14;
322
+ } else t14 = $[36];
281
323
  let t15;
282
- if ($[34] !== colorScheme || $[35] !== density || $[36] !== props || $[37] !== scope || $[38] !== t14 || $[39] !== t5 || $[40] !== themeStyles) {
324
+ if ($[37] !== colorScheme || $[38] !== density || $[39] !== props || $[40] !== scope || $[41] !== t14 || $[42] !== t5 || $[43] !== themeStyles) {
283
325
  t15 = /* @__PURE__ */ jsxs("div", {
284
326
  ...props,
285
327
  className: t5,
@@ -288,32 +330,34 @@ function PanneauRoot(t0) {
288
330
  "data-panneau-theme": scope,
289
331
  children: [themeStyles, t14]
290
332
  });
291
- $[34] = colorScheme;
292
- $[35] = density;
293
- $[36] = props;
294
- $[37] = scope;
295
- $[38] = t14;
296
- $[39] = t5;
297
- $[40] = themeStyles;
298
- $[41] = t15;
299
- } else t15 = $[41];
333
+ $[37] = colorScheme;
334
+ $[38] = density;
335
+ $[39] = props;
336
+ $[40] = scope;
337
+ $[41] = t14;
338
+ $[42] = t5;
339
+ $[43] = themeStyles;
340
+ $[44] = t15;
341
+ } else t15 = $[44];
300
342
  const root = t15;
301
343
  if (intl === null || intl === void 0) {
302
344
  let t16;
303
- if ($[42] !== locale || $[43] !== root) {
345
+ if ($[45] !== locale || $[46] !== messages || $[47] !== root) {
304
346
  t16 = /* @__PURE__ */ jsx(PanneauIntlProvider, {
305
347
  locale,
348
+ messages,
306
349
  children: root
307
350
  });
308
- $[42] = locale;
309
- $[43] = root;
310
- $[44] = t16;
311
- } else t16 = $[44];
351
+ $[45] = locale;
352
+ $[46] = messages;
353
+ $[47] = root;
354
+ $[48] = t16;
355
+ } else t16 = $[48];
312
356
  return t16;
313
357
  }
314
358
  return root;
315
359
  }
316
360
  //#endregion
317
- export { PanneauRoot, PortalProvider, ScopeContext, usePortalContainer, useThemeStyles };
361
+ export { PanneauRoot, PortalProvider, ScopeContext, getPageNonce, usePortalContainer, useThemeStyles };
318
362
 
319
363
  //# sourceMappingURL=PanneauRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PanneauRoot.js","names":["HTMLAttributes","ReactNode","createContext","use","useState","I18nProvider","IntlContext","IntlProvider","IntlShape","getPanneauMessages","NamedIconLoader","NamedIconLoaderContext","getFontFaceCss","getFontStylesheets","ColorScheme","Density","Theme","getThemeCss","hashString","ToastProvider","cx","styles","PanneauRootProps","HTMLDivElement","theme","colorScheme","density","iconLoader","locale","children","PortalContext","Element","undefined","ScopeContext","PortalProvider","Provider","useThemeStyles","$","_c","t0","t1","t2","css","scope","fontCss","fonts","replaceAll","t3","map","_temp","t4","t5","href","usePortalContainer","PanneauIntlProvider","messages","Object","keys","translated","length","t6","PanneauRoot","className","props","intl","container","setContainer","themeStyles","root","t7","t8","t9","t10","t11","t12","t13","Symbol","for","portal","t14","t15","t16","_c","_Fragment","styles"],"sources":["../../src/root/PanneauRoot.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, createContext, use, useState } from 'react';\nimport { I18nProvider } from 'react-aria-components';\nimport { IntlContext, IntlProvider, type IntlShape } from 'react-intl';\n\nimport { getPanneauMessages } from '@panneau/intl';\n\nimport { type NamedIconLoader, NamedIconLoaderContext } from '../icon/namedIcons';\nimport { getFontFaceCss, getFontStylesheets } from '../theme/fonts';\nimport {\n type ColorScheme,\n type Density,\n type Theme,\n getThemeCss,\n hashString,\n} from '../theme/theme';\nimport { ToastProvider } from '../toast/Toast';\nimport { cx } from '../utils/cx';\nimport styles from './PanneauRoot.module.css';\n\nexport interface PanneauRootProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Tokens, tones, variants and fonts that override the default theme: `bootstrapTheme`, or a\n * project's own (`defineTheme()`).\n */\n theme?: Theme | null;\n /** Defaults to `light`. `auto` follows the system setting. */\n colorScheme?: ColorScheme;\n /**\n * How much room controls and rows take: `compact`, `comfortable` or `touch`. Defaults to\n * `auto`: `touch` on touch screens, `comfortable` otherwise.\n */\n density?: Density;\n /**\n * Loads the icons that definitions name (`\"icon\": \"send\"`), for `getNamedIcon()`: pass\n * `lucideIconLoader` from `@panneau/ui/named-icons`, or a loader of only the icons the app\n * uses. Without it, named icons render an empty space.\n */\n iconLoader?: NamedIconLoader | null;\n /**\n * Locale of dates and numbers in React Aria components. Defaults to the react-intl locale, or\n * to the browser's without an `IntlProvider`.\n *\n * Without an `IntlProvider` above it, the root provides one, with the messages of every Panneau\n * package in this locale (English without a locale, or for a locale Panneau doesn't translate).\n * An app with its own `IntlProvider` adds them with `withPanneauMessages()` from\n * `@panneau/intl`.\n */\n locale?: string;\n children?: ReactNode;\n}\n\n/** `undefined` outside of a root, `null` while the root's container isn't mounted yet. */\nconst PortalContext = createContext<Element | null | undefined>(undefined);\n\n/** The color scheme and density in effect, which a `ThemeScope` inherits when it doesn't set them. */\nexport const ScopeContext = createContext<{ colorScheme: ColorScheme; density: Density }>({\n colorScheme: 'light',\n density: 'auto',\n});\n\n/** Gives overlays a container: that of a root, or of a scope. */\nexport const PortalProvider = PortalContext.Provider;\n\n/**\n * The `<style>` and `<link>` elements of a theme: its CSS, scoped to `data-panneau-theme`, and its\n * fonts. React hoists them to the head and adds each once, however many roots or scopes use it.\n * Returns the scope of the theme too, for `data-panneau-theme`.\n */\nexport function useThemeStyles(theme: Theme | null): { scope?: string; styles: ReactNode } {\n const css = theme !== null ? getThemeCss(theme, '§') : '';\n const scope = css !== '' ? hashString(css) : undefined;\n const fontCss = getFontFaceCss(theme?.fonts);\n return {\n scope,\n styles: (\n <>\n {scope !== undefined ? (\n <style href={`panneau-theme-${scope}`} precedence=\"panneau\">\n {css.replaceAll('§', scope)}\n </style>\n ) : null}\n {fontCss !== '' ? (\n <style href={`panneau-fonts-${hashString(fontCss)}`} precedence=\"panneau\">\n {fontCss}\n </style>\n ) : null}\n {getFontStylesheets(theme?.fonts).map((href) => (\n <link key={href} rel=\"stylesheet\" href={href} precedence=\"panneau\" />\n ))}\n </>\n ),\n };\n}\n\n/**\n * The element overlays render into: the closest `PanneauRoot`'s or `ThemeScope`'s, or `undefined` for the body\n * without a root. It is `null` during the first render of a root: overlays wait for it, since\n * React Aria hides everything outside of a modal from assistive technologies when it opens.\n */\nexport function usePortalContainer(): Element | null | undefined {\n return use(PortalContext);\n}\n\n/**\n * An `IntlProvider` with Panneau's messages in a locale, for a root without one above it. A locale\n * Panneau doesn't translate gets English, so that react-intl doesn't report every message as\n * missing.\n */\nfunction PanneauIntlProvider({\n locale = 'en',\n children,\n}: {\n locale?: string;\n children: ReactNode;\n}) {\n const messages = getPanneauMessages(locale);\n const translated = Object.keys(messages).length > 0;\n return (\n <IntlProvider\n locale={translated ? locale : 'en'}\n defaultLocale=\"en\"\n messages={translated ? messages : getPanneauMessages('en')}\n >\n {children}\n </IntlProvider>\n );\n}\n\n/**\n * The root of every Panneau interface. It scopes the base stylesheet and the design tokens to its\n * element (no global CSS), applies a theme and a color scheme, and hosts overlays and toasts so\n * that they get the tokens too. Panneau components must render inside one. A project can override\n * any token with its own class on the root. Without an `IntlProvider` above it, it provides one\n * with Panneau's messages in its `locale`.\n */\nexport function PanneauRoot({\n theme = null,\n colorScheme = 'light',\n density = 'auto',\n iconLoader = null,\n locale,\n className,\n children,\n ...props\n}: PanneauRootProps) {\n const intl = use(IntlContext) as IntlShape | null | undefined;\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const { scope, styles: themeStyles } = useThemeStyles(theme);\n const root = (\n <div\n {...props}\n className={cx('panneau-root', styles.root, styles.container, className)}\n data-color-scheme={colorScheme}\n data-density={density}\n data-panneau-theme={scope}\n >\n {themeStyles}\n <I18nProvider locale={locale ?? intl?.locale}>\n <NamedIconLoaderContext value={iconLoader}>\n <ScopeContext value={{ colorScheme, density }}>\n <PortalContext value={container}>\n <ToastProvider\n regionClassName={styles.root}\n regionProps={{\n 'data-color-scheme': colorScheme,\n 'data-density': density,\n 'data-panneau-theme': scope,\n }}\n >\n {children}\n </ToastProvider>\n </PortalContext>\n </ScopeContext>\n </NamedIconLoaderContext>\n <div ref={setContainer} className={styles.portal} />\n </I18nProvider>\n </div>\n );\n if (intl === null || intl === undefined) {\n return <PanneauIntlProvider locale={locale}>{root}</PanneauIntlProvider>;\n }\n return root;\n}\n"],"mappings":";;;;;;;;;;;;;;AAoDA,IAAM8B,gBAAgB5B,cAA0C8B,KAAAA,CAAS;;AAGzE,IAAaC,eAAe/B,cAA8D;CACtFuB,aAAa;CACbC,SAAS;AACb,CAAC;;AAGD,IAAaQ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GACMiB,sBAAAA;GALxB,UAAA,CAOKwB,aACDY,GAmBE;;EAAA1C,EAAA,MAAAZ;EAAAY,EAAA,MAAAX;EAAAW,EAAA,MAAA0B;EAAA1B,EAAA,MAAAM;EAAAN,EAAA,MAAA0C;EAAA1C,EAAA,MAAAc;EAAAd,EAAA,MAAA8B;EAAA9B,EAAA,MAAA2C;CAAA,OAAAA,MAAA3C,EAAA;CA5BV,MAAA+B,OACIY;CA6BJ,IAAIhB,SAAS,QAAQA,SAAShC,KAAAA,GAAS;EAAA,IAAAiD;EAAA,IAAA5C,EAAA,QAAAT,UAAAS,EAAA,QAAA+B,MAAA;GAC5Ba,MAAA,oBAAC,qBAAD;IAA6BrD;IAASwC,UAAAA;GAAlB,CAAA;GAA6C/B,EAAA,MAAAT;GAAAS,EAAA,MAAA+B;GAAA/B,EAAA,MAAA4C;EAAA,OAAAA,MAAA5C,EAAA;EAAA,OAAjE4C;CAAiE;CAC3E,OACMb;AAAI"}
1
+ {"version":3,"file":"PanneauRoot.js","names":["HTMLAttributes","ReactNode","createContext","use","useState","I18nProvider","IntlContext","IntlProvider","IntlShape","getPanneauMessages","NamedIconLoader","NamedIconLoaderContext","getFontFaceCss","getFontStylesheets","ColorScheme","Density","Theme","getThemeCss","hashString","ToastProvider","cx","styles","PanneauRootProps","HTMLDivElement","theme","colorScheme","density","iconLoader","locale","messages","Readonly","Record","nonce","children","PortalContext","Element","undefined","ScopeContext","getPageNonce","document","meta","querySelector","HTMLMetaElement","content","globalThis","__webpack_nonce__","PortalProvider","Provider","useThemeStyles","$","_c","t0","t1","t2","css","scope","fontCss","fonts","replaceAll","t3","t4","href","map","t5","usePortalContainer","PanneauIntlProvider","added","Object","keys","translated","length","t6","t7","PanneauRoot","className","givenNonce","props","pageNonce","intl","container","setContainer","themeStyles","root","t8","t9","t10","t11","t12","t13","Symbol","for","portal","t14","t15","t16","_c","_Fragment","styles"],"sources":["../../src/root/PanneauRoot.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, createContext, use, useState } from 'react';\nimport { I18nProvider } from 'react-aria-components';\nimport { IntlContext, IntlProvider, type IntlShape } from 'react-intl';\n\nimport { getPanneauMessages } from '@panneau/intl';\n\nimport { type NamedIconLoader, NamedIconLoaderContext } from '../icon/namedIcons';\nimport { getFontFaceCss, getFontStylesheets } from '../theme/fonts';\nimport {\n type ColorScheme,\n type Density,\n type Theme,\n getThemeCss,\n hashString,\n} from '../theme/theme';\nimport { ToastProvider } from '../toast/Toast';\nimport { cx } from '../utils/cx';\nimport styles from './PanneauRoot.module.css';\n\nexport interface PanneauRootProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Tokens, tones, variants and fonts that override the default theme: `bootstrapTheme`, or a\n * project's own (`defineTheme()`).\n */\n theme?: Theme | null;\n /** Defaults to `light`. `auto` follows the system setting. */\n colorScheme?: ColorScheme;\n /**\n * How much room controls and rows take: `compact`, `comfortable` or `touch`. Defaults to\n * `auto`: `touch` on touch screens, `comfortable` otherwise.\n */\n density?: Density;\n /**\n * Loads the icons that definitions name (`\"icon\": \"send\"`), for `getNamedIcon()`: pass\n * `lucideIconLoader` from `@panneau/ui/named-icons`, or a loader of only the icons the app\n * uses. Without it, named icons render an empty space.\n */\n iconLoader?: NamedIconLoader | null;\n /**\n * Locale of dates and numbers in React Aria components. Defaults to the react-intl locale, or\n * to the browser's without an `IntlProvider`.\n *\n * Without an `IntlProvider` above it, the root provides one, with the messages of every Panneau\n * package in this locale (English without a locale, or for a locale Panneau doesn't translate).\n * An app with its own `IntlProvider` adds them with `withPanneauMessages()` from\n * `@panneau/intl`.\n */\n locale?: string;\n /**\n * Messages added to Panneau's, by id, when the root provides the `IntlProvider`: those of\n * plugins (`loadMessages()` of `@panneau/core`). An app with its own `IntlProvider` adds them\n * to its own.\n */\n messages?: Readonly<Record<string, string>> | null;\n /**\n * The nonce of the page's Content Security Policy, set on the `<style>` and `<link>` elements of\n * themes and fonts, for a policy without `'unsafe-inline'` in `style-src`. Defaults to the\n * nonce React Aria reads too: that of `<meta property=\"csp-nonce\">`, or `__webpack_nonce__`.\n */\n nonce?: string;\n children?: ReactNode;\n}\n\n/** `undefined` outside of a root, `null` while the root's container isn't mounted yet. */\nconst PortalContext = createContext<Element | null | undefined>(undefined);\n\n/**\n * The color scheme and density in effect, which a `ThemeScope` inherits when it doesn't set them,\n * and the nonce of the styles of themes.\n */\nexport const ScopeContext = createContext<{\n colorScheme: ColorScheme;\n density: Density;\n nonce?: string | undefined;\n}>({\n colorScheme: 'light',\n density: 'auto',\n});\n\n/**\n * The nonce of the page's Content Security Policy, where React Aria reads it: the `nonce` (or\n * `content`) of `<meta property=\"csp-nonce\">` or `<meta name=\"csp-nonce\">`, or\n * `__webpack_nonce__`. `undefined` without one, and on the server.\n */\nexport function getPageNonce(): string | undefined {\n if (typeof document === 'undefined') {\n return undefined;\n }\n const meta = document.querySelector<HTMLMetaElement>(\n 'meta[property=\"csp-nonce\"], meta[name=\"csp-nonce\"]',\n );\n const nonce =\n meta?.nonce ||\n meta?.content ||\n (globalThis as { __webpack_nonce__?: string }).__webpack_nonce__;\n return nonce !== undefined && nonce !== '' ? nonce : undefined;\n}\n\n/** Gives overlays a container: that of a root, or of a scope. */\nexport const PortalProvider = PortalContext.Provider;\n\n/**\n * The `<style>` and `<link>` elements of a theme: its CSS, scoped to `data-panneau-theme`, and its\n * fonts. React hoists them to the head and adds each once, however many roots or scopes use it.\n * Returns the scope of the theme too, for `data-panneau-theme`.\n */\nexport function useThemeStyles(\n theme: Theme | null,\n nonce?: string,\n): { scope?: string; styles: ReactNode } {\n const css = theme !== null ? getThemeCss(theme, '§') : '';\n const scope = css !== '' ? hashString(css) : undefined;\n const fontCss = getFontFaceCss(theme?.fonts);\n return {\n scope,\n styles: (\n <>\n {scope !== undefined ? (\n <style href={`panneau-theme-${scope}`} precedence=\"panneau\" nonce={nonce}>\n {css.replaceAll('§', scope)}\n </style>\n ) : null}\n {fontCss !== '' ? (\n <style\n href={`panneau-fonts-${hashString(fontCss)}`}\n precedence=\"panneau\"\n nonce={nonce}\n >\n {fontCss}\n </style>\n ) : null}\n {getFontStylesheets(theme?.fonts).map((href) => (\n <link\n key={href}\n rel=\"stylesheet\"\n href={href}\n precedence=\"panneau\"\n nonce={nonce}\n />\n ))}\n </>\n ),\n };\n}\n\n/**\n * The element overlays render into: the closest `PanneauRoot`'s or `ThemeScope`'s, or `undefined` for the body\n * without a root. It is `null` during the first render of a root: overlays wait for it, since\n * React Aria hides everything outside of a modal from assistive technologies when it opens.\n */\nexport function usePortalContainer(): Element | null | undefined {\n return use(PortalContext);\n}\n\n/**\n * An `IntlProvider` with Panneau's messages in a locale, for a root without one above it. A locale\n * Panneau doesn't translate gets English, so that react-intl doesn't report every message as\n * missing.\n */\nfunction PanneauIntlProvider({\n locale = 'en',\n messages: added,\n children,\n}: {\n locale?: string;\n messages?: Readonly<Record<string, string>> | null;\n children: ReactNode;\n}) {\n const messages = getPanneauMessages(locale);\n const translated = Object.keys(messages).length > 0;\n return (\n <IntlProvider\n locale={translated ? locale : 'en'}\n defaultLocale=\"en\"\n messages={{ ...(translated ? messages : getPanneauMessages('en')), ...added }}\n >\n {children}\n </IntlProvider>\n );\n}\n\n/**\n * The root of every Panneau interface. It scopes the base stylesheet and the design tokens to its\n * element (no global CSS), applies a theme and a color scheme, and hosts overlays and toasts so\n * that they get the tokens too. Panneau components must render inside one. A project can override\n * any token with its own class on the root. Without an `IntlProvider` above it, it provides one\n * with Panneau's messages in its `locale`.\n */\nexport function PanneauRoot({\n theme = null,\n colorScheme = 'light',\n density = 'auto',\n iconLoader = null,\n locale,\n messages,\n nonce: givenNonce,\n className,\n children,\n ...props\n}: PanneauRootProps) {\n const [pageNonce] = useState(getPageNonce);\n const nonce = givenNonce ?? pageNonce;\n const intl = use(IntlContext) as IntlShape | null | undefined;\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const { scope, styles: themeStyles } = useThemeStyles(theme, nonce);\n const root = (\n <div\n {...props}\n className={cx('panneau-root', styles.root, styles.container, className)}\n data-color-scheme={colorScheme}\n data-density={density}\n data-panneau-theme={scope}\n >\n {themeStyles}\n <I18nProvider locale={locale ?? intl?.locale}>\n <NamedIconLoaderContext value={iconLoader}>\n <ScopeContext value={{ colorScheme, density, nonce }}>\n <PortalContext value={container}>\n <ToastProvider\n regionClassName={styles.root}\n regionProps={{\n 'data-color-scheme': colorScheme,\n 'data-density': density,\n 'data-panneau-theme': scope,\n }}\n >\n {children}\n </ToastProvider>\n </PortalContext>\n </ScopeContext>\n </NamedIconLoaderContext>\n <div ref={setContainer} className={styles.portal} />\n </I18nProvider>\n </div>\n );\n if (intl === null || intl === undefined) {\n return (\n <PanneauIntlProvider locale={locale} messages={messages}>\n {root}\n </PanneauIntlProvider>\n );\n }\n return root;\n}\n"],"mappings":";;;;;;;;;;;;;;AAgEA,IAAMkC,gBAAgBhC,cAA0CkC,KAAAA,CAAS;;;;;AAMzE,IAAaC,eAAenC,cAIzB;CACCuB,aAAa;CACbC,SAAS;AACb,CAAC;;;;;;AAOD,SAAgBY,eAAmC;CAC/C,IAAI,OAAOC,aAAa,aACpB;CAEJ,MAAMC,OAAOD,SAASE,cAClB,wDACJ;CACA,MAAMT,QACFQ,MAAMR,SACNQ,MAAMG,WACLC,WAA8CC;CACnD,OAAOb,UAAUI,KAAAA,KAAaJ,UAAU,KAAKA,QAAQI,KAAAA;AACzD;;AAGA,IAAaU,iBAAiBZ,cAAca;;;;;;AAO5C,SAAOC,eAAAxB,OAAAQ,OAAA;CAAA,MAAAiB,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAJ,EAAA,OAAAjB,SAAAiB,EAAA,OAAAzB,OAAA;EAIH,MAAA8B,MAAY9B,UAAU,OAAOP,YAAYO,OAAO,GAAQ,IAA5C;EACZ,MAAA+B,QAAcD,QAAQ,KAAKpC,WAAWoC,GAAe,IAAvClB,KAAAA;EACd,MAAAoB,UAAgB5C,eAAeY,OAAKiC,KAAO;EA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B,QAAArB;GAAtB,UAAA,CACIgB,KAgBAC,GAjBS;;EAkBEvC,EAAA,MAAAsC;EAAAtC,EAAA,MAAAsB;EAAAtB,EAAA,MAAA2C;CAAA,OAAAA,MAAA3C,EAAA;CAAA,IAAA4C;CAAA,IAAA5C,EAAA,QAAAxB,eAAAwB,EAAA,QAAAvB,WAAAuB,EAAA,QAAA2B,SAAA3B,EAAA,QAAAM,SAAAN,EAAA,QAAA2C,OAAA3C,EAAA,QAAAc,MAAAd,EAAA,QAAAgC,aAAA;EA1BnBY,MAAA,qBAAA,OAAA;GA2BM,GA1BEjB;GACO,WAAAb;GACQtC,qBAAAA;GACLC,gBAAAA;GACM6B,sBAAAA;GALxB,UAAA,CAOK0B,aACDW,GAmBE;;EAAA3C,EAAA,MAAAxB;EAAAwB,EAAA,MAAAvB;EAAAuB,EAAA,MAAA2B;EAAA3B,EAAA,MAAAM;EAAAN,EAAA,MAAA2C;EAAA3C,EAAA,MAAAc;EAAAd,EAAA,MAAAgC;EAAAhC,EAAA,MAAA4C;CAAA,OAAAA,MAAA5C,EAAA;CA5BV,MAAAiC,OACIW;CA6BJ,IAAIf,SAAS,QAAQA,SAAS1C,KAAAA,GAAS;EAAA,IAAA0D;EAAA,IAAA7C,EAAA,QAAArB,UAAAqB,EAAA,QAAApB,YAAAoB,EAAA,QAAAiC,MAAA;GAE/BY,MAAA,oBAAC,qBAAD;IAA6BlE;IAAkBC;IAC1CqD,UAAAA;GADe,CAAA;GAEEjC,EAAA,MAAArB;GAAAqB,EAAA,MAAApB;GAAAoB,EAAA,MAAAiC;GAAAjC,EAAA,MAAA6C;EAAA,OAAAA,MAAA7C,EAAA;EAAA,OAFtB6C;CAEsB;CAE7B,OACMZ;AAAI"}
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import type { ColorScheme, Density, Theme } from '../theme/theme';
2
+ import type { ColorScheme, Density, Theme } from '../theme/theme.js';
3
3
  export interface ThemeScopeProps extends HTMLAttributes<HTMLElement> {
4
4
  /** Element to render. Defaults to `div`. */
5
5
  as?: 'div' | 'section' | 'aside' | 'nav' | 'header' | 'footer' | 'main' | 'article';
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeScope.d.ts","sourceRoot":"","sources":["../../src/root/ThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAKlE,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAChE,4CAA4C;IAC5C,EAAE,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IACpF,2DAA2D;IAC3D,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACvB,EAAE,EAAE,OAAe,EACnB,KAAY,EACZ,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,eAAe,+BA+BjB"}
1
+ {"version":3,"file":"ThemeScope.d.ts","sourceRoot":"","sources":["../../src/root/ThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAKlE,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAChE,4CAA4C;IAC5C,EAAE,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IACpF,2DAA2D;IAC3D,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACvB,EAAE,EAAE,OAAe,EACnB,KAAY,EACZ,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,eAAe,+BAgCjB"}
@@ -15,7 +15,7 @@ import { use, useState } from "react";
15
15
  * theme around it.
16
16
  */
17
17
  function ThemeScope(t0) {
18
- const $ = c(31);
18
+ const $ = c(32);
19
19
  let children;
20
20
  let className;
21
21
  let colorScheme;
@@ -46,60 +46,62 @@ function ThemeScope(t0) {
46
46
  const theme = t2 === void 0 ? null : t2;
47
47
  const parent = use(ScopeContext);
48
48
  const [container, setContainer] = useState(null);
49
- const { scope, styles: themeStyles } = useThemeStyles(theme);
49
+ const { scope, styles: themeStyles } = useThemeStyles(theme, parent.nonce);
50
50
  const t3 = colorScheme ?? parent.colorScheme;
51
51
  const t4 = density ?? parent.density;
52
52
  let t5;
53
- if ($[8] !== t3 || $[9] !== t4) {
53
+ if ($[8] !== parent.nonce || $[9] !== t3 || $[10] !== t4) {
54
54
  t5 = {
55
55
  colorScheme: t3,
56
- density: t4
56
+ density: t4,
57
+ nonce: parent.nonce
57
58
  };
58
- $[8] = t3;
59
- $[9] = t4;
60
- $[10] = t5;
61
- } else t5 = $[10];
59
+ $[8] = parent.nonce;
60
+ $[9] = t3;
61
+ $[10] = t4;
62
+ $[11] = t5;
63
+ } else t5 = $[11];
62
64
  const effective = t5;
63
65
  const t6 = colorScheme !== void 0 && PanneauRoot_module_default.scheme;
64
66
  const t7 = density !== void 0 && PanneauRoot_module_default.density;
65
67
  let t8;
66
- if ($[11] !== className || $[12] !== t6 || $[13] !== t7) {
68
+ if ($[12] !== className || $[13] !== t6 || $[14] !== t7) {
67
69
  t8 = cx("panneau-theme-scope", PanneauRoot_module_default.scope, t6, t7, className);
68
- $[11] = className;
69
- $[12] = t6;
70
- $[13] = t7;
71
- $[14] = t8;
72
- } else t8 = $[14];
70
+ $[12] = className;
71
+ $[13] = t6;
72
+ $[14] = t7;
73
+ $[15] = t8;
74
+ } else t8 = $[15];
73
75
  let t9;
74
- if ($[15] !== children || $[16] !== container) {
76
+ if ($[16] !== children || $[17] !== container) {
75
77
  t9 = /* @__PURE__ */ jsx(PortalProvider, {
76
78
  value: container,
77
79
  children
78
80
  });
79
- $[15] = children;
80
- $[16] = container;
81
- $[17] = t9;
82
- } else t9 = $[17];
81
+ $[16] = children;
82
+ $[17] = container;
83
+ $[18] = t9;
84
+ } else t9 = $[18];
83
85
  let t10;
84
- if ($[18] !== effective || $[19] !== t9) {
86
+ if ($[19] !== effective || $[20] !== t9) {
85
87
  t10 = /* @__PURE__ */ jsx(ScopeContext, {
86
88
  value: effective,
87
89
  children: t9
88
90
  });
89
- $[18] = effective;
90
- $[19] = t9;
91
- $[20] = t10;
92
- } else t10 = $[20];
91
+ $[19] = effective;
92
+ $[20] = t9;
93
+ $[21] = t10;
94
+ } else t10 = $[21];
93
95
  let t11;
94
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
96
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
95
97
  t11 = /* @__PURE__ */ jsx("div", {
96
98
  ref: setContainer,
97
99
  className: PanneauRoot_module_default.portal
98
100
  });
99
- $[21] = t11;
100
- } else t11 = $[21];
101
+ $[22] = t11;
102
+ } else t11 = $[22];
101
103
  let t12;
102
- if ($[22] !== Element || $[23] !== effective.colorScheme || $[24] !== effective.density || $[25] !== props || $[26] !== scope || $[27] !== t10 || $[28] !== t8 || $[29] !== themeStyles) {
104
+ if ($[23] !== Element || $[24] !== effective.colorScheme || $[25] !== effective.density || $[26] !== props || $[27] !== scope || $[28] !== t10 || $[29] !== t8 || $[30] !== themeStyles) {
103
105
  t12 = /* @__PURE__ */ jsxs(Element, {
104
106
  ...props,
105
107
  className: t8,
@@ -112,16 +114,16 @@ function ThemeScope(t0) {
112
114
  t11
113
115
  ]
114
116
  });
115
- $[22] = Element;
116
- $[23] = effective.colorScheme;
117
- $[24] = effective.density;
118
- $[25] = props;
119
- $[26] = scope;
120
- $[27] = t10;
121
- $[28] = t8;
122
- $[29] = themeStyles;
123
- $[30] = t12;
124
- } else t12 = $[30];
117
+ $[23] = Element;
118
+ $[24] = effective.colorScheme;
119
+ $[25] = effective.density;
120
+ $[26] = props;
121
+ $[27] = scope;
122
+ $[28] = t10;
123
+ $[29] = t8;
124
+ $[30] = themeStyles;
125
+ $[31] = t12;
126
+ } else t12 = $[31];
125
127
  return t12;
126
128
  }
127
129
  //#endregion