@arcanejs/toolkit 6.0.1 → 7.0.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.
Files changed (72) hide show
  1. package/README.md +156 -12
  2. package/dist/backend/components/base.d.mts +1 -1
  3. package/dist/backend/components/base.d.ts +1 -1
  4. package/dist/backend/components/button.d.mts +1 -1
  5. package/dist/backend/components/button.d.ts +1 -1
  6. package/dist/backend/components/button.js +2 -2
  7. package/dist/backend/components/button.mjs +1 -1
  8. package/dist/backend/components/group.d.mts +1 -1
  9. package/dist/backend/components/group.d.ts +1 -1
  10. package/dist/backend/components/group.js +2 -2
  11. package/dist/backend/components/group.mjs +1 -1
  12. package/dist/backend/components/label.d.mts +2 -2
  13. package/dist/backend/components/label.d.ts +2 -2
  14. package/dist/backend/components/label.js +2 -2
  15. package/dist/backend/components/label.mjs +1 -1
  16. package/dist/backend/components/rect.d.mts +2 -2
  17. package/dist/backend/components/rect.d.ts +2 -2
  18. package/dist/backend/components/rect.js +2 -2
  19. package/dist/backend/components/rect.mjs +1 -1
  20. package/dist/backend/components/slider-button.d.mts +2 -2
  21. package/dist/backend/components/slider-button.d.ts +2 -2
  22. package/dist/backend/components/slider-button.js +2 -2
  23. package/dist/backend/components/slider-button.mjs +1 -1
  24. package/dist/backend/components/switch.d.mts +2 -2
  25. package/dist/backend/components/switch.d.ts +2 -2
  26. package/dist/backend/components/switch.js +2 -2
  27. package/dist/backend/components/switch.mjs +1 -1
  28. package/dist/backend/components/tabs.d.mts +3 -3
  29. package/dist/backend/components/tabs.d.ts +3 -3
  30. package/dist/backend/components/tabs.js +2 -2
  31. package/dist/backend/components/tabs.mjs +1 -1
  32. package/dist/backend/components/text-input.d.mts +2 -2
  33. package/dist/backend/components/text-input.d.ts +2 -2
  34. package/dist/backend/components/text-input.js +2 -2
  35. package/dist/backend/components/text-input.mjs +1 -1
  36. package/dist/backend/components/timeline.d.mts +2 -2
  37. package/dist/backend/components/timeline.d.ts +2 -2
  38. package/dist/backend/components/timeline.js +2 -2
  39. package/dist/backend/components/timeline.mjs +1 -1
  40. package/dist/{chunk-53EOA4UE.js → chunk-2K4UT5QB.js} +1 -1
  41. package/dist/{chunk-4OCRZD4F.js → chunk-4AGKM5NT.js} +1 -1
  42. package/dist/{chunk-QAH2OSHR.js → chunk-5B65Q7RL.js} +1 -1
  43. package/dist/{chunk-3TXBS2UN.mjs → chunk-6PS3Q66F.mjs} +1 -1
  44. package/dist/{chunk-LK6MGXYC.mjs → chunk-7MQHRTBE.mjs} +1 -1
  45. package/dist/{chunk-U6FSQBQ3.js → chunk-A3RWE7HZ.js} +6 -4
  46. package/dist/{chunk-NL3W4M7J.js → chunk-CVY55KAR.js} +1 -1
  47. package/dist/{chunk-WDB3IMOP.mjs → chunk-GXJ3JRRK.mjs} +1 -1
  48. package/dist/{chunk-HTCWMJUA.js → chunk-IV3AE3CW.js} +1 -1
  49. package/dist/{chunk-UQWCTVMC.mjs → chunk-JHWFQLLE.mjs} +1 -1
  50. package/dist/{chunk-QB2WPBWV.mjs → chunk-K6V55JTG.mjs} +1 -1
  51. package/dist/{chunk-PG5EAV5X.mjs → chunk-MHSAHTVN.mjs} +1 -1
  52. package/dist/{chunk-KMEDXCBI.mjs → chunk-R5OA7LLZ.mjs} +6 -4
  53. package/dist/{chunk-6ELB27LK.mjs → chunk-RJLYYTZ6.mjs} +1 -1
  54. package/dist/{chunk-3GTEUTFT.js → chunk-TF7N4O5G.js} +1 -1
  55. package/dist/{chunk-E6FGU7DA.mjs → chunk-TULW7CRV.mjs} +4 -4
  56. package/dist/{chunk-6QWYIJLM.js → chunk-UHEZQR2Q.js} +1 -1
  57. package/dist/{chunk-7JIC2XBC.js → chunk-XSKWLJOQ.js} +4 -4
  58. package/dist/frontend/entrypoint.css +836 -0
  59. package/dist/frontend/entrypoint.css.map +7 -0
  60. package/dist/frontend/entrypoint.js +26048 -26682
  61. package/dist/frontend/entrypoint.js.map +4 -4
  62. package/dist/frontend/index.d.mts +4 -6
  63. package/dist/frontend/index.d.ts +4 -6
  64. package/dist/frontend/index.js +82 -300
  65. package/dist/frontend/index.mjs +89 -307
  66. package/dist/index.d.mts +1 -1
  67. package/dist/index.d.ts +1 -1
  68. package/dist/index.js +280 -98
  69. package/dist/index.mjs +250 -68
  70. package/dist/{toolkit-CohVRj6u.d.mts → toolkit-BPqxbDbk.d.mts} +82 -19
  71. package/dist/{toolkit-C_2Y8N9R.d.ts → toolkit-Bglbv3ix.d.ts} +82 -19
  72. package/package.json +15 -20
@@ -1,16 +1,14 @@
1
- import { Theme } from '@arcanejs/toolkit-frontend/styling';
1
+ import React, { ReactNode } from 'react';
2
2
  import { FrontendComponentRenderers } from '@arcanejs/toolkit-frontend/types';
3
3
 
4
4
  type Props = {
5
5
  className?: string;
6
6
  renderers: FrontendComponentRenderers;
7
- themes?: {
8
- dark: Theme;
9
- light: Theme;
10
- };
7
+ themeRootProps?: React.HTMLAttributes<HTMLDivElement>;
8
+ loadingState?: () => ReactNode;
11
9
  };
12
10
 
13
- type ArcaneFrontendOptions = Pick<Props, 'renderers' | 'themes'>;
11
+ type ArcaneFrontendOptions = Pick<Props, 'renderers' | 'themeRootProps' | 'loadingState'>;
14
12
  declare const startArcaneFrontend: (opts: ArcaneFrontendOptions) => void;
15
13
 
16
14
  export { type ArcaneFrontendOptions, startArcaneFrontend };
@@ -1,16 +1,14 @@
1
- import { Theme } from '@arcanejs/toolkit-frontend/styling';
1
+ import React, { ReactNode } from 'react';
2
2
  import { FrontendComponentRenderers } from '@arcanejs/toolkit-frontend/types';
3
3
 
4
4
  type Props = {
5
5
  className?: string;
6
6
  renderers: FrontendComponentRenderers;
7
- themes?: {
8
- dark: Theme;
9
- light: Theme;
10
- };
7
+ themeRootProps?: React.HTMLAttributes<HTMLDivElement>;
8
+ loadingState?: () => ReactNode;
11
9
  };
12
10
 
13
- type ArcaneFrontendOptions = Pick<Props, 'renderers' | 'themes'>;
11
+ type ArcaneFrontendOptions = Pick<Props, 'renderers' | 'themeRootProps' | 'loadingState'>;
14
12
  declare const startArcaneFrontend: (opts: ArcaneFrontendOptions) => void;
15
13
 
16
14
  export { type ArcaneFrontendOptions, startArcaneFrontend };
@@ -11,294 +11,14 @@ var _diff = require('@arcanejs/diff');
11
11
 
12
12
 
13
13
  var _react = require('react');
14
- var _styledcomponents = require('styled-components');
15
-
16
-
17
-
18
-
19
-
20
14
  var _styling = require('@arcanejs/toolkit-frontend/styling');
21
15
 
22
16
 
23
17
 
24
18
  var _toolkitfrontend = require('@arcanejs/toolkit-frontend');
25
19
 
26
- // ../toolkit-frontend/src/styling.tsx
27
-
28
-
29
-
30
-
31
-
32
-
33
- // ../toolkit-frontend/src/util/index.ts
34
-
35
-
36
- // ../toolkit-frontend/src/util/touch.ts
37
-
38
-
39
- // ../toolkit-frontend/src/util/index.ts
40
- var COLOR_SCHEME_SETTINGS = "arcane-color-scheme-preference";
41
- var VALID_COLOR_SCHEME_PREFS = ["auto", "dark", "light"];
42
- var isValidColorSchemePreference = (value) => {
43
- return VALID_COLOR_SCHEME_PREFS.includes(value);
44
- };
45
- var useColorSchemePreferences = () => {
46
- if (typeof window === "undefined") {
47
- return {
48
- colorSchemePreference: "auto",
49
- setColorSchemePreference: () => {
50
- }
51
- };
52
- }
53
- const [preference, setPreference] = _react.useState.call(void 0,
54
- window.localStorage.getItem(
55
- COLOR_SCHEME_SETTINGS
56
- ) || "auto"
57
- );
58
- const setColorSchemePreference = (newPreference) => {
59
- if (!isValidColorSchemePreference(newPreference)) {
60
- throw new Error(`Invalid color scheme preference: ${newPreference}`);
61
- }
62
- window.localStorage.setItem(COLOR_SCHEME_SETTINGS, newPreference);
63
- window.dispatchEvent(
64
- new StorageEvent("storage", {
65
- key: COLOR_SCHEME_SETTINGS,
66
- newValue: newPreference
67
- })
68
- );
69
- };
70
- _react.useEffect.call(void 0, () => {
71
- const onStorageChange = (event) => {
72
- if (event.key === COLOR_SCHEME_SETTINGS) {
73
- const newValue = event.newValue;
74
- if (isValidColorSchemePreference(newValue)) {
75
- setPreference(newValue);
76
- }
77
- }
78
- };
79
- window.addEventListener("storage", onStorageChange);
80
- return () => {
81
- window.removeEventListener("storage", onStorageChange);
82
- };
83
- }, []);
84
- return {
85
- colorSchemePreference: isValidColorSchemePreference(preference) ? preference : "auto",
86
- setColorSchemePreference
87
- };
88
- };
89
- var usePreferredColorScheme = () => {
90
- const { colorSchemePreference } = useColorSchemePreferences();
91
- const [theme, setTheme] = _react.useState.call(void 0, "light");
92
- _react.useEffect.call(void 0, () => {
93
- if (typeof window !== "undefined") {
94
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
95
- setTheme(mediaQuery.matches ? "dark" : "light");
96
- const handleChange = (event) => {
97
- setTheme(event.matches ? "dark" : "light");
98
- };
99
- mediaQuery.addEventListener("change", handleChange);
100
- return () => {
101
- mediaQuery.removeEventListener("change", handleChange);
102
- };
103
- }
104
- }, []);
105
- return colorSchemePreference === "auto" ? theme : colorSchemePreference;
106
- };
107
-
108
- // ../toolkit-frontend/src/styling.tsx
109
20
  var _jsxruntime = require('react/jsx-runtime');
110
- var GlobalStyle = _styledcomponents.createGlobalStyle`
111
- body {
112
- &.touch-mode * {
113
- cursor: none !important;
114
- }
115
- }
116
- `;
117
- var DARK_THEME = {
118
- pageBg: "#333",
119
- colorGreen: "#98c379",
120
- colorRed: "#e06c75",
121
- colorAmber: "#d19a66",
122
- bgDark1: "#252524",
123
- bg: "#2a2a2b",
124
- bgLight1: "#353638",
125
- borderDark: "#151516",
126
- borderLight: "#1c1d1d",
127
- borderLighter: "#252524",
128
- borderLighterer: "#6b6b67",
129
- hint: "#4286f4",
130
- hintRGB: "66, 134, 244",
131
- hintDark1: "#2a77f3",
132
- textNormal: "#F3F3F5",
133
- textActive: "#ffffff",
134
- textMuted: "#777777",
135
- shadows: {
136
- boxShadowInset: "inset 0px 0px 8px 0px rgba(0, 0, 0, 0.3)",
137
- textShadow: "0 -1px rgba(0, 0, 0, 0.7)",
138
- textShadowActive: "0 -1px rgba(0, 0, 0, 0.4)"
139
- },
140
- gradients: {
141
- button: "linear-gradient(to bottom, #4f5053, #343436)",
142
- buttonHover: "linear-gradient(to bottom, #5e6064, #393a3b)",
143
- buttonActive: "linear-gradient(to bottom, #242525, #37383a)",
144
- buttonPressedHover: "linear-gradient(to bottom, #282929, #414243)",
145
- hintPressed: "linear-gradient(to bottom,#2a77f3,#4286f4)"
146
- },
147
- sizingPx: {
148
- spacing: 15,
149
- unitHeight: 40
150
- }
151
- };
152
- var LIGHT_THEME = {
153
- pageBg: "#f8f9fa",
154
- colorGreen: "#22863a",
155
- colorRed: "#d73a49",
156
- colorAmber: "#b08800",
157
- bgDark1: "#e9ecef",
158
- bg: "#ffffff",
159
- bgLight1: "#f5f5f5",
160
- borderDark: "#c7c7c7",
161
- borderLight: "#d7d7d7",
162
- borderLighter: "#eaecef",
163
- borderLighterer: "#f6f8fa",
164
- hint: "#4286f4",
165
- hintRGB: "0, 92, 197",
166
- hintDark1: "#2a77f3",
167
- textNormal: "#24292e",
168
- textActive: "#202020",
169
- textMuted: "#6a737d",
170
- shadows: {
171
- boxShadowInset: "inset 0px 0px 8px 0px rgba(0, 0, 0, 0.05)",
172
- textShadow: "0 1px rgba(255, 255, 255, 0.7)",
173
- textShadowActive: "0 1px rgba(255, 255, 255, 0.4)"
174
- },
175
- gradients: {
176
- button: "linear-gradient(to bottom, #e1e4e8, #d1d5da)",
177
- buttonHover: "linear-gradient(to bottom, #d1d5da, #c1c6cc)",
178
- buttonActive: "linear-gradient(to bottom, #b1b6bc, #d2d6da)",
179
- buttonPressedHover: "linear-gradient(to bottom, #a1a6ac, #91969c)",
180
- hintPressed: "linear-gradient(to bottom, #438bff, #85b3ff)"
181
- },
182
- sizingPx: DARK_THEME.sizingPx
183
- };
184
- var BaseStyle = _styledcomponents.createGlobalStyle`
185
- * {
186
- box-sizing: border-box;
187
- }
188
-
189
- body {
190
- background: ${(p) => p.theme.pageBg};
191
- margin: 0;
192
- padding: 0;
193
- font-size: 14px;
194
- font-family: sans-serif;
195
- }
196
- `;
197
- var buttonStateNormal = _styledcomponents.css`
198
- color: ${(p) => p.theme.textNormal};
199
- background: ${(p) => p.theme.gradients.button};
200
- text-shadow: ${(p) => p.theme.shadows.textShadow};
201
- box-shadow:
202
- inset 0 1px 0 rgba(255, 255, 255, 0.15),
203
- 0 1px 0 0 rgba(0, 0, 0, 0.25);
204
- `;
205
- var buttonStateNormalHover = _styledcomponents.css`
206
- color: ${(p) => p.theme.textNormal};
207
- outline-color: rgba(243, 243, 245, 0.3);
208
- background: ${(p) => p.theme.gradients.buttonHover};
209
- text-shadow: ${(p) => p.theme.shadows.textShadow};
210
- `;
211
- var buttonStateNormalActive = _styledcomponents.css`
212
- color: ${(p) => p.theme.textNormal};
213
- outline-color: rgba(255, 255, 255, 0.3);
214
- background: ${(p) => p.theme.gradients.buttonActive};
215
- text-shadow: ${(p) => p.theme.shadows.textShadowActive};
216
- box-shadow:
217
- inset 0 1px 2px rgba(0, 0, 0, 0.2),
218
- 0 1px 0 0 rgba(255, 255, 255, 0.15);
219
- transition-duration: 50ms;
220
- `;
221
- var buttonStatePressed = _styledcomponents.css`
222
- ${buttonStateNormalActive}
223
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1), 0 1px 0 0 rgba(255,255,255,0.15);
224
- `;
225
- var buttonStatePressedHover = _styledcomponents.css`
226
- ${buttonStateNormalActive}
227
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1), 0 1px 0 0 rgba(255,255,255,0.15);
228
- background: ${(p) => p.theme.gradients.buttonPressedHover};
229
- `;
230
- var buttonStatePressedActive = buttonStateNormalActive;
231
- var buttonStateDisabled = _styledcomponents.css`
232
- ${buttonStateNormal}
233
-
234
- cursor: default;
235
- background: ${(p) => p.theme.bg} !important;
236
- color: rgba(${(p) => p.theme.textNormal}, 0.4);
237
- `;
238
- var button = _styledcomponents.css`
239
- position: relative;
240
- box-sizing: border-box;
241
- cursor: pointer;
242
- transition: all 200ms;
243
- border-radius: 3px;
244
- border: 1px solid ${(p) => p.theme.borderDark};
245
- overflow: hidden;
246
- display: flex;
247
- justify-content: center;
248
- align-items: center;
249
- outline-color: transparent;
250
- ${buttonStateNormal}
251
-
252
- &:hover {
253
- ${buttonStateNormalHover}
254
- }
255
-
256
- &:active {
257
- ${buttonStateNormalActive}
258
- }
259
- `;
260
- var buttonPressed = _styledcomponents.css`
261
- ${buttonStatePressed}
262
-
263
- &:hover {
264
- ${buttonStatePressedHover}
265
- }
266
-
267
- &:active {
268
- ${buttonStatePressedActive}
269
- }
270
- `;
271
- var buttonDisabled = _styledcomponents.css`
272
- ${buttonStateDisabled}
273
-
274
- &:hover, &:active {
275
- ${buttonStateDisabled}
276
- }
277
- `;
278
- var touchIndicatorNormal = _styledcomponents.css`
279
- position: absolute;
280
- top: -6px;
281
- right: -6px;
282
- left: -6px;
283
- bottom: -6px;
284
- border-radius: 6px;
285
- border: 2px solid rgba(0, 0, 0, 0);
286
- background-color: none;
287
- transition: border-color 300ms;
288
- `;
289
- var touchIndicatorTouching = _styledcomponents.css`
290
- border-color: ${(p) => p.theme.hint};
291
- background-color: rgba(${(p) => p.theme.hintRGB}, 0.2);
292
- transition: border-color 0s;
293
- `;
294
- var PreferredThemeProvider = ({ dark, light, children }) => {
295
- const theme = usePreferredColorScheme();
296
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styledcomponents.ThemeProvider, { theme: theme === "dark" ? dark : light, children });
297
- };
298
-
299
- // src/frontend/stage.tsx
300
-
301
- var Stage = ({ className, renderers }) => {
21
+ var Stage = ({ className, renderers, loadingState }) => {
302
22
  const [root, setRoot] = _react.useState.call(void 0,
303
23
  void 0
304
24
  );
@@ -306,10 +26,17 @@ var Stage = ({ className, renderers }) => {
306
26
  const [connection, setConnection] = _react.useState.call(void 0, {
307
27
  state: "connecting"
308
28
  });
29
+ const [clockSync, setClockSync] = _react.useState.call(void 0, null);
30
+ const [lastPingMs, setLastPingMs] = _react.useState.call(void 0, null);
31
+ const [bestPing, setBestPing] = _react.useState.call(void 0, null);
309
32
  const calls = _react.useRef.call(void 0, {
310
33
  nextId: 1,
311
34
  calls: /* @__PURE__ */ new Map()
312
35
  });
36
+ const pings = _react.useRef.call(void 0, {
37
+ nextId: 1,
38
+ pings: /* @__PURE__ */ new Map()
39
+ });
313
40
  const preparedRenderers = _react.useMemo.call(void 0, () => {
314
41
  const prepared = {};
315
42
  for (const renderer of renderers) {
@@ -331,6 +58,7 @@ var Stage = ({ className, renderers }) => {
331
58
  switch (msg.type) {
332
59
  case "metadata":
333
60
  setConnection({ state: "connected", uuid: msg.connectionUuid });
61
+ setClockSync(msg.clockSync);
334
62
  return;
335
63
  case "tree-full":
336
64
  setRoot(msg.root);
@@ -354,6 +82,32 @@ var Stage = ({ className, renderers }) => {
354
82
  }
355
83
  return;
356
84
  }
85
+ case "pong": {
86
+ const ping = pings.current.pings.get(msg.pingId);
87
+ if (!ping) {
88
+ console.warn(
89
+ `Received pong response for unknown ping ID ${msg.pingId}`
90
+ );
91
+ return;
92
+ }
93
+ pings.current.pings.delete(msg.pingId);
94
+ const roundTripMs = performance.now() - ping.sentAtPerfMs;
95
+ const estimatedClientMidpointMs = ping.sentAtUnixMs + roundTripMs / 2;
96
+ const nextTimeDifferenceMs = estimatedClientMidpointMs - msg.serverTimeMillis;
97
+ setLastPingMs(roundTripMs);
98
+ setBestPing(
99
+ (current) => (
100
+ // No best ping yet
101
+ current === null || // Better ping than current best, so this will likely be more precise
102
+ roundTripMs < current.pingMs || // Time difference has changed significantly, so this is likely more accurate even if ping isn't better
103
+ Math.abs(nextTimeDifferenceMs - current.timeDifferenceMs) > roundTripMs ? {
104
+ pingMs: roundTripMs,
105
+ timeDifferenceMs: nextTimeDifferenceMs
106
+ } : current
107
+ )
108
+ );
109
+ return;
110
+ }
357
111
  }
358
112
  }, []);
359
113
  const initializeWebsocket = _react.useCallback.call(void 0, async () => {
@@ -420,6 +174,36 @@ var Stage = ({ className, renderers }) => {
420
174
  _react.useEffect.call(void 0, () => {
421
175
  initializeWebsocket();
422
176
  }, [initializeWebsocket]);
177
+ _react.useEffect.call(void 0, () => {
178
+ if (connection.state !== "connected" && clockSync !== null) {
179
+ setClockSync(null);
180
+ }
181
+ setLastPingMs(null);
182
+ setBestPing(null);
183
+ pings.current.pings.clear();
184
+ if (connection.state !== "connected" || clockSync === null) {
185
+ return;
186
+ }
187
+ const sendPing = () => {
188
+ const pingId = pings.current.nextId++;
189
+ pings.current.pings.set(pingId, {
190
+ sentAtUnixMs: Date.now(),
191
+ sentAtPerfMs: performance.now()
192
+ });
193
+ sendMessage({
194
+ type: "ping",
195
+ pingId
196
+ }).catch((error) => {
197
+ pings.current.pings.delete(pingId);
198
+ console.error("Unable to send ping", error);
199
+ });
200
+ };
201
+ sendPing();
202
+ const interval = window.setInterval(sendPing, clockSync.pingIntervalMs);
203
+ return () => {
204
+ window.clearInterval(interval);
205
+ };
206
+ }, [clockSync, connection.state, sendMessage]);
423
207
  const stageContext = _react.useMemo.call(void 0,
424
208
  () => ({
425
209
  sendMessage,
@@ -427,32 +211,30 @@ var Stage = ({ className, renderers }) => {
427
211
  call,
428
212
  connectionUuid: connection.state === "connected" ? connection.uuid : null,
429
213
  connection,
214
+ timeDifferenceMs: _nullishCoalesce(_optionalChain([bestPing, 'optionalAccess', _ => _.timeDifferenceMs]), () => ( null)),
215
+ lastPingMs,
430
216
  reconnect: () => void initializeWebsocket()
431
217
  }),
432
- [sendMessage, renderComponent, call, initializeWebsocket, connection]
218
+ [
219
+ sendMessage,
220
+ renderComponent,
221
+ call,
222
+ initializeWebsocket,
223
+ connection,
224
+ bestPing,
225
+ lastPingMs
226
+ ]
433
227
  );
434
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _toolkitfrontend.StageContext.Provider, { value: stageContext, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _toolkitfrontend.GroupStateWrapper, { openByDefault: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className, children: root ? renderComponent(root) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "no-root", children: "No root has been added to the light desk" }) }) }) });
228
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _toolkitfrontend.StageContext.Provider, { value: stageContext, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _toolkitfrontend.GroupStateWrapper, { openByDefault: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className, children: root ? renderComponent(root) : _nullishCoalesce(_optionalChain([loadingState, 'optionalCall', _2 => _2()]), () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "arcane-stage__no-root", children: "No root has been added to the light desk" }))) }) }) });
435
229
  };
436
- var StyledStage = _styledcomponents.styled.call(void 0, Stage)`
437
- width: 100%;
438
- height: 100%;
439
- background-color: ${(p) => p.theme.pageBg};
440
- color: ${(p) => p.theme.textNormal};
441
- padding: ${(p) => p.theme.sizingPx.spacing}px;
442
- `;
443
230
  function rootComponent(props) {
444
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
445
- PreferredThemeProvider,
231
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.ThemeRoot, { rootProps: props.themeRootProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
232
+ Stage,
446
233
  {
447
- dark: _nullishCoalesce(_optionalChain([props, 'access', _ => _.themes, 'optionalAccess', _2 => _2.dark]), () => ( _styling.DARK_THEME)),
448
- light: _nullishCoalesce(_optionalChain([props, 'access', _3 => _3.themes, 'optionalAccess', _4 => _4.light]), () => ( _styling.LIGHT_THEME)),
449
- children: [
450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.BaseStyle, {}),
451
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.GlobalStyle, {}),
452
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledStage, { ...props })
453
- ]
234
+ ...props,
235
+ className: _util.calculateClass.call(void 0, "arcane-stage", props.className)
454
236
  }
455
- );
237
+ ) });
456
238
  }
457
239
 
458
240
  // src/frontend/index.ts