@arcanejs/toolkit 2.0.0 → 3.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.
@@ -1,8 +1,16 @@
1
+ import { Theme } from '@arcanejs/toolkit-frontend/styling';
1
2
  import { FrontendComponentRenderers } from '@arcanejs/toolkit-frontend/types';
2
3
 
3
- type ArcaneFrontendOptions = {
4
+ type Props = {
5
+ className?: string;
4
6
  renderers: FrontendComponentRenderers;
7
+ themes?: {
8
+ dark: Theme;
9
+ light: Theme;
10
+ };
5
11
  };
12
+
13
+ type ArcaneFrontendOptions = Pick<Props, 'renderers' | 'themes'>;
6
14
  declare const startArcaneFrontend: (opts: ArcaneFrontendOptions) => void;
7
15
 
8
16
  export { type ArcaneFrontendOptions, startArcaneFrontend };
@@ -1,8 +1,16 @@
1
+ import { Theme } from '@arcanejs/toolkit-frontend/styling';
1
2
  import { FrontendComponentRenderers } from '@arcanejs/toolkit-frontend/types';
2
3
 
3
- type ArcaneFrontendOptions = {
4
+ type Props = {
5
+ className?: string;
4
6
  renderers: FrontendComponentRenderers;
7
+ themes?: {
8
+ dark: Theme;
9
+ light: Theme;
10
+ };
5
11
  };
12
+
13
+ type ArcaneFrontendOptions = Pick<Props, 'renderers' | 'themes'>;
6
14
  declare const startArcaneFrontend: (opts: ArcaneFrontendOptions) => void;
7
15
 
8
16
  export { type ArcaneFrontendOptions, startArcaneFrontend };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/frontend/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/frontend/index.ts
2
2
  var _client = require('react-dom/client');
3
3
  var _util = require('@arcanejs/toolkit-frontend/util');
4
4
 
@@ -16,9 +16,235 @@ var _styledcomponents = require('styled-components');
16
16
 
17
17
 
18
18
 
19
+
19
20
  var _styling = require('@arcanejs/toolkit-frontend/styling');
20
21
  var _toolkitfrontend = require('@arcanejs/toolkit-frontend');
22
+
23
+ // ../toolkit-frontend/src/styling.tsx
24
+
25
+
26
+
27
+
28
+
29
+
30
+ // ../toolkit-frontend/src/util/index.ts
31
+
32
+
33
+ // ../toolkit-frontend/src/util/touch.ts
34
+
35
+
36
+ // ../toolkit-frontend/src/util/index.ts
37
+ var usePreferredColorScheme = () => {
38
+ const [theme, setTheme] = _react.useState.call(void 0, "light");
39
+ _react.useEffect.call(void 0, () => {
40
+ if (typeof window !== "undefined") {
41
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
42
+ setTheme(mediaQuery.matches ? "dark" : "light");
43
+ const handleChange = (event) => {
44
+ setTheme(event.matches ? "dark" : "light");
45
+ };
46
+ mediaQuery.addEventListener("change", handleChange);
47
+ return () => {
48
+ mediaQuery.removeEventListener("change", handleChange);
49
+ };
50
+ }
51
+ }, []);
52
+ return theme;
53
+ };
54
+
55
+ // ../toolkit-frontend/src/styling.tsx
21
56
  var _jsxruntime = require('react/jsx-runtime');
57
+ var GlobalStyle = _styledcomponents.createGlobalStyle`
58
+ body {
59
+ &.touch-mode * {
60
+ cursor: none !important;
61
+ }
62
+ }
63
+ `;
64
+ var DARK_THEME = {
65
+ pageBg: "#333",
66
+ colorGreen: "#98c379",
67
+ colorRed: "#e06c75",
68
+ colorAmber: "#d19a66",
69
+ bgDark1: "#252524",
70
+ bg: "#2a2a2b",
71
+ bgLight1: "#353638",
72
+ borderDark: "#151516",
73
+ borderLight: "#1c1d1d",
74
+ borderLighter: "#252524",
75
+ borderLighterer: "#6b6b67",
76
+ hint: "#4286f4",
77
+ hintRGB: "66, 134, 244",
78
+ hintDark1: "#2a77f3",
79
+ textNormal: "#F3F3F5",
80
+ textActive: "#ffffff",
81
+ textMuted: "#777777",
82
+ shadows: {
83
+ boxShadowInset: "inset 0px 0px 8px 0px rgba(0, 0, 0, 0.3)",
84
+ textShadow: "0 -1px rgba(0, 0, 0, 0.7)",
85
+ textShadowActive: "0 -1px rgba(0, 0, 0, 0.4)"
86
+ },
87
+ gradients: {
88
+ button: "linear-gradient(to bottom, #4f5053, #343436)",
89
+ buttonHover: "linear-gradient(to bottom, #5e6064, #393a3b)",
90
+ buttonActive: "linear-gradient(to bottom, #242525, #37383a)",
91
+ buttonPressedHover: "linear-gradient(to bottom, #282929, #414243)",
92
+ hintPressed: "linear-gradient(to bottom,#2a77f3,#4286f4)"
93
+ },
94
+ sizingPx: {
95
+ spacing: 15,
96
+ unitHeight: 40
97
+ }
98
+ };
99
+ var LIGHT_THEME = {
100
+ pageBg: "#f8f9fa",
101
+ colorGreen: "#22863a",
102
+ colorRed: "#d73a49",
103
+ colorAmber: "#b08800",
104
+ bgDark1: "#e9ecef",
105
+ bg: "#ffffff",
106
+ bgLight1: "#f5f5f5",
107
+ borderDark: "#c7c7c7",
108
+ borderLight: "#d7d7d7",
109
+ borderLighter: "#eaecef",
110
+ borderLighterer: "#f6f8fa",
111
+ hint: "#4286f4",
112
+ hintRGB: "0, 92, 197",
113
+ hintDark1: "#2a77f3",
114
+ textNormal: "#24292e",
115
+ textActive: "#202020",
116
+ textMuted: "#6a737d",
117
+ shadows: {
118
+ boxShadowInset: "inset 0px 0px 8px 0px rgba(0, 0, 0, 0.05)",
119
+ textShadow: "0 1px rgba(255, 255, 255, 0.7)",
120
+ textShadowActive: "0 1px rgba(255, 255, 255, 0.4)"
121
+ },
122
+ gradients: {
123
+ button: "linear-gradient(to bottom, #e1e4e8, #d1d5da)",
124
+ buttonHover: "linear-gradient(to bottom, #d1d5da, #c1c6cc)",
125
+ buttonActive: "linear-gradient(to bottom, #b1b6bc, #d2d6da)",
126
+ buttonPressedHover: "linear-gradient(to bottom, #a1a6ac, #91969c)",
127
+ hintPressed: "linear-gradient(to bottom, #438bff, #85b3ff)"
128
+ },
129
+ sizingPx: DARK_THEME.sizingPx
130
+ };
131
+ var BaseStyle = _styledcomponents.createGlobalStyle`
132
+ * {
133
+ box-sizing: border-box;
134
+ }
135
+
136
+ body {
137
+ background: ${(p) => p.theme.pageBg};
138
+ margin: 0;
139
+ padding: 0;
140
+ font-size: 14px;
141
+ font-family: sans-serif;
142
+ }
143
+ `;
144
+ var buttonStateNormal = _styledcomponents.css`
145
+ color: ${(p) => p.theme.textNormal};
146
+ background: ${(p) => p.theme.gradients.button};
147
+ text-shadow: ${(p) => p.theme.shadows.textShadow};
148
+ box-shadow:
149
+ inset 0 1px 0 rgba(255, 255, 255, 0.15),
150
+ 0 1px 0 0 rgba(0, 0, 0, 0.25);
151
+ `;
152
+ var buttonStateNormalHover = _styledcomponents.css`
153
+ color: ${(p) => p.theme.textNormal};
154
+ outline-color: rgba(243, 243, 245, 0.3);
155
+ background: ${(p) => p.theme.gradients.buttonHover};
156
+ text-shadow: ${(p) => p.theme.shadows.textShadow};
157
+ `;
158
+ var buttonStateNormalActive = _styledcomponents.css`
159
+ color: ${(p) => p.theme.textNormal};
160
+ outline-color: rgba(255, 255, 255, 0.3);
161
+ background: ${(p) => p.theme.gradients.buttonActive};
162
+ text-shadow: ${(p) => p.theme.shadows.textShadowActive};
163
+ box-shadow:
164
+ inset 0 1px 2px rgba(0, 0, 0, 0.2),
165
+ 0 1px 0 0 rgba(255, 255, 255, 0.15);
166
+ transition-duration: 50ms;
167
+ `;
168
+ var buttonStatePressed = _styledcomponents.css`
169
+ ${buttonStateNormalActive}
170
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1), 0 1px 0 0 rgba(255,255,255,0.15);
171
+ `;
172
+ var buttonStatePressedHover = _styledcomponents.css`
173
+ ${buttonStateNormalActive}
174
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1), 0 1px 0 0 rgba(255,255,255,0.15);
175
+ background: ${(p) => p.theme.gradients.buttonPressedHover};
176
+ `;
177
+ var buttonStatePressedActive = buttonStateNormalActive;
178
+ var buttonStateDisabled = _styledcomponents.css`
179
+ ${buttonStateNormal}
180
+
181
+ cursor: default;
182
+ background: ${(p) => p.theme.bg} !important;
183
+ color: rgba(${(p) => p.theme.textNormal}, 0.4);
184
+ `;
185
+ var button = _styledcomponents.css`
186
+ position: relative;
187
+ box-sizing: border-box;
188
+ cursor: pointer;
189
+ transition: all 200ms;
190
+ border-radius: 3px;
191
+ border: 1px solid ${(p) => p.theme.borderDark};
192
+ overflow: hidden;
193
+ display: flex;
194
+ justify-content: center;
195
+ align-items: center;
196
+ outline-color: transparent;
197
+ ${buttonStateNormal}
198
+
199
+ &:hover {
200
+ ${buttonStateNormalHover}
201
+ }
202
+
203
+ &:active {
204
+ ${buttonStateNormalActive}
205
+ }
206
+ `;
207
+ var buttonPressed = _styledcomponents.css`
208
+ ${buttonStatePressed}
209
+
210
+ &:hover {
211
+ ${buttonStatePressedHover}
212
+ }
213
+
214
+ &:active {
215
+ ${buttonStatePressedActive}
216
+ }
217
+ `;
218
+ var buttonDisabled = _styledcomponents.css`
219
+ ${buttonStateDisabled}
220
+
221
+ &:hover, &:active {
222
+ ${buttonStateDisabled}
223
+ }
224
+ `;
225
+ var touchIndicatorNormal = _styledcomponents.css`
226
+ position: absolute;
227
+ top: -6px;
228
+ right: -6px;
229
+ left: -6px;
230
+ bottom: -6px;
231
+ border-radius: 6px;
232
+ border: 2px solid rgba(0, 0, 0, 0);
233
+ background-color: none;
234
+ transition: border-color 300ms;
235
+ `;
236
+ var touchIndicatorTouching = _styledcomponents.css`
237
+ border-color: ${(p) => p.theme.hint};
238
+ background-color: rgba(${(p) => p.theme.hintRGB}, 0.2);
239
+ transition: border-color 0s;
240
+ `;
241
+ var PreferredThemeProvider = ({ dark, light, children }) => {
242
+ const theme = usePreferredColorScheme();
243
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styledcomponents.ThemeProvider, { theme: theme === "dark" ? dark : light, children });
244
+ };
245
+
246
+ // src/frontend/stage.tsx
247
+
22
248
  var Stage = ({ className, renderers }) => {
23
249
  const [root, setRoot] = _react.useState.call(void 0,
24
250
  void 0
@@ -106,16 +332,23 @@ var Stage = ({ className, renderers }) => {
106
332
  var StyledStage = _styledcomponents.styled.call(void 0, Stage)`
107
333
  width: 100%;
108
334
  height: 100%;
109
- background-color: #333;
110
- color: ${_styling.THEME.textNormal};
111
- padding: ${_styling.THEME.sizingPx.spacing}px;
335
+ background-color: ${(p) => p.theme.pageBg};
336
+ color: ${(p) => p.theme.textNormal};
337
+ padding: ${(p) => p.theme.sizingPx.spacing}px;
112
338
  `;
113
339
  function rootComponent(props) {
114
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
115
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.BaseStyle, {}),
116
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.GlobalStyle, {}),
117
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styledcomponents.ThemeProvider, { theme: _styling.THEME, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledStage, { ...props }) })
118
- ] });
340
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
341
+ PreferredThemeProvider,
342
+ {
343
+ dark: _nullishCoalesce(_optionalChain([props, 'access', _ => _.themes, 'optionalAccess', _2 => _2.dark]), () => ( _styling.DARK_THEME)),
344
+ light: _nullishCoalesce(_optionalChain([props, 'access', _3 => _3.themes, 'optionalAccess', _4 => _4.light]), () => ( _styling.LIGHT_THEME)),
345
+ children: [
346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.BaseStyle, {}),
347
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.GlobalStyle, {}),
348
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledStage, { ...props })
349
+ ]
350
+ }
351
+ );
119
352
  }
120
353
 
121
354
  // src/frontend/index.ts
@@ -5,22 +5,248 @@ import { initialiseListeners } from "@arcanejs/toolkit-frontend/util";
5
5
  // src/frontend/stage.tsx
6
6
  import { patchJson } from "@arcanejs/diff";
7
7
  import {
8
- useState,
8
+ useState as useState3,
9
9
  useRef,
10
10
  useCallback,
11
- useEffect,
11
+ useEffect as useEffect2,
12
12
  useMemo
13
13
  } from "react";
14
- import { styled, ThemeProvider } from "styled-components";
14
+ import { styled } from "styled-components";
15
15
  import {
16
- BaseStyle,
17
- GlobalStyle,
18
- THEME
16
+ BaseStyle as BaseStyle2,
17
+ GlobalStyle as GlobalStyle2,
18
+ DARK_THEME as DARK_THEME2,
19
+ LIGHT_THEME as LIGHT_THEME2
19
20
  } from "@arcanejs/toolkit-frontend/styling";
20
21
  import { GroupStateWrapper, StageContext } from "@arcanejs/toolkit-frontend";
21
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
+
23
+ // ../toolkit-frontend/src/styling.tsx
24
+ import {
25
+ createGlobalStyle,
26
+ css,
27
+ ThemeProvider
28
+ } from "styled-components";
29
+
30
+ // ../toolkit-frontend/src/util/index.ts
31
+ import { useEffect, useState as useState2 } from "react";
32
+
33
+ // ../toolkit-frontend/src/util/touch.ts
34
+ import { useState } from "react";
35
+
36
+ // ../toolkit-frontend/src/util/index.ts
37
+ var usePreferredColorScheme = () => {
38
+ const [theme, setTheme] = useState2("light");
39
+ useEffect(() => {
40
+ if (typeof window !== "undefined") {
41
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
42
+ setTheme(mediaQuery.matches ? "dark" : "light");
43
+ const handleChange = (event) => {
44
+ setTheme(event.matches ? "dark" : "light");
45
+ };
46
+ mediaQuery.addEventListener("change", handleChange);
47
+ return () => {
48
+ mediaQuery.removeEventListener("change", handleChange);
49
+ };
50
+ }
51
+ }, []);
52
+ return theme;
53
+ };
54
+
55
+ // ../toolkit-frontend/src/styling.tsx
56
+ import { jsx } from "react/jsx-runtime";
57
+ var GlobalStyle = createGlobalStyle`
58
+ body {
59
+ &.touch-mode * {
60
+ cursor: none !important;
61
+ }
62
+ }
63
+ `;
64
+ var DARK_THEME = {
65
+ pageBg: "#333",
66
+ colorGreen: "#98c379",
67
+ colorRed: "#e06c75",
68
+ colorAmber: "#d19a66",
69
+ bgDark1: "#252524",
70
+ bg: "#2a2a2b",
71
+ bgLight1: "#353638",
72
+ borderDark: "#151516",
73
+ borderLight: "#1c1d1d",
74
+ borderLighter: "#252524",
75
+ borderLighterer: "#6b6b67",
76
+ hint: "#4286f4",
77
+ hintRGB: "66, 134, 244",
78
+ hintDark1: "#2a77f3",
79
+ textNormal: "#F3F3F5",
80
+ textActive: "#ffffff",
81
+ textMuted: "#777777",
82
+ shadows: {
83
+ boxShadowInset: "inset 0px 0px 8px 0px rgba(0, 0, 0, 0.3)",
84
+ textShadow: "0 -1px rgba(0, 0, 0, 0.7)",
85
+ textShadowActive: "0 -1px rgba(0, 0, 0, 0.4)"
86
+ },
87
+ gradients: {
88
+ button: "linear-gradient(to bottom, #4f5053, #343436)",
89
+ buttonHover: "linear-gradient(to bottom, #5e6064, #393a3b)",
90
+ buttonActive: "linear-gradient(to bottom, #242525, #37383a)",
91
+ buttonPressedHover: "linear-gradient(to bottom, #282929, #414243)",
92
+ hintPressed: "linear-gradient(to bottom,#2a77f3,#4286f4)"
93
+ },
94
+ sizingPx: {
95
+ spacing: 15,
96
+ unitHeight: 40
97
+ }
98
+ };
99
+ var LIGHT_THEME = {
100
+ pageBg: "#f8f9fa",
101
+ colorGreen: "#22863a",
102
+ colorRed: "#d73a49",
103
+ colorAmber: "#b08800",
104
+ bgDark1: "#e9ecef",
105
+ bg: "#ffffff",
106
+ bgLight1: "#f5f5f5",
107
+ borderDark: "#c7c7c7",
108
+ borderLight: "#d7d7d7",
109
+ borderLighter: "#eaecef",
110
+ borderLighterer: "#f6f8fa",
111
+ hint: "#4286f4",
112
+ hintRGB: "0, 92, 197",
113
+ hintDark1: "#2a77f3",
114
+ textNormal: "#24292e",
115
+ textActive: "#202020",
116
+ textMuted: "#6a737d",
117
+ shadows: {
118
+ boxShadowInset: "inset 0px 0px 8px 0px rgba(0, 0, 0, 0.05)",
119
+ textShadow: "0 1px rgba(255, 255, 255, 0.7)",
120
+ textShadowActive: "0 1px rgba(255, 255, 255, 0.4)"
121
+ },
122
+ gradients: {
123
+ button: "linear-gradient(to bottom, #e1e4e8, #d1d5da)",
124
+ buttonHover: "linear-gradient(to bottom, #d1d5da, #c1c6cc)",
125
+ buttonActive: "linear-gradient(to bottom, #b1b6bc, #d2d6da)",
126
+ buttonPressedHover: "linear-gradient(to bottom, #a1a6ac, #91969c)",
127
+ hintPressed: "linear-gradient(to bottom, #438bff, #85b3ff)"
128
+ },
129
+ sizingPx: DARK_THEME.sizingPx
130
+ };
131
+ var BaseStyle = createGlobalStyle`
132
+ * {
133
+ box-sizing: border-box;
134
+ }
135
+
136
+ body {
137
+ background: ${(p) => p.theme.pageBg};
138
+ margin: 0;
139
+ padding: 0;
140
+ font-size: 14px;
141
+ font-family: sans-serif;
142
+ }
143
+ `;
144
+ var buttonStateNormal = css`
145
+ color: ${(p) => p.theme.textNormal};
146
+ background: ${(p) => p.theme.gradients.button};
147
+ text-shadow: ${(p) => p.theme.shadows.textShadow};
148
+ box-shadow:
149
+ inset 0 1px 0 rgba(255, 255, 255, 0.15),
150
+ 0 1px 0 0 rgba(0, 0, 0, 0.25);
151
+ `;
152
+ var buttonStateNormalHover = css`
153
+ color: ${(p) => p.theme.textNormal};
154
+ outline-color: rgba(243, 243, 245, 0.3);
155
+ background: ${(p) => p.theme.gradients.buttonHover};
156
+ text-shadow: ${(p) => p.theme.shadows.textShadow};
157
+ `;
158
+ var buttonStateNormalActive = css`
159
+ color: ${(p) => p.theme.textNormal};
160
+ outline-color: rgba(255, 255, 255, 0.3);
161
+ background: ${(p) => p.theme.gradients.buttonActive};
162
+ text-shadow: ${(p) => p.theme.shadows.textShadowActive};
163
+ box-shadow:
164
+ inset 0 1px 2px rgba(0, 0, 0, 0.2),
165
+ 0 1px 0 0 rgba(255, 255, 255, 0.15);
166
+ transition-duration: 50ms;
167
+ `;
168
+ var buttonStatePressed = css`
169
+ ${buttonStateNormalActive}
170
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1), 0 1px 0 0 rgba(255,255,255,0.15);
171
+ `;
172
+ var buttonStatePressedHover = css`
173
+ ${buttonStateNormalActive}
174
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1), 0 1px 0 0 rgba(255,255,255,0.15);
175
+ background: ${(p) => p.theme.gradients.buttonPressedHover};
176
+ `;
177
+ var buttonStatePressedActive = buttonStateNormalActive;
178
+ var buttonStateDisabled = css`
179
+ ${buttonStateNormal}
180
+
181
+ cursor: default;
182
+ background: ${(p) => p.theme.bg} !important;
183
+ color: rgba(${(p) => p.theme.textNormal}, 0.4);
184
+ `;
185
+ var button = css`
186
+ position: relative;
187
+ box-sizing: border-box;
188
+ cursor: pointer;
189
+ transition: all 200ms;
190
+ border-radius: 3px;
191
+ border: 1px solid ${(p) => p.theme.borderDark};
192
+ overflow: hidden;
193
+ display: flex;
194
+ justify-content: center;
195
+ align-items: center;
196
+ outline-color: transparent;
197
+ ${buttonStateNormal}
198
+
199
+ &:hover {
200
+ ${buttonStateNormalHover}
201
+ }
202
+
203
+ &:active {
204
+ ${buttonStateNormalActive}
205
+ }
206
+ `;
207
+ var buttonPressed = css`
208
+ ${buttonStatePressed}
209
+
210
+ &:hover {
211
+ ${buttonStatePressedHover}
212
+ }
213
+
214
+ &:active {
215
+ ${buttonStatePressedActive}
216
+ }
217
+ `;
218
+ var buttonDisabled = css`
219
+ ${buttonStateDisabled}
220
+
221
+ &:hover, &:active {
222
+ ${buttonStateDisabled}
223
+ }
224
+ `;
225
+ var touchIndicatorNormal = css`
226
+ position: absolute;
227
+ top: -6px;
228
+ right: -6px;
229
+ left: -6px;
230
+ bottom: -6px;
231
+ border-radius: 6px;
232
+ border: 2px solid rgba(0, 0, 0, 0);
233
+ background-color: none;
234
+ transition: border-color 300ms;
235
+ `;
236
+ var touchIndicatorTouching = css`
237
+ border-color: ${(p) => p.theme.hint};
238
+ background-color: rgba(${(p) => p.theme.hintRGB}, 0.2);
239
+ transition: border-color 0s;
240
+ `;
241
+ var PreferredThemeProvider = ({ dark, light, children }) => {
242
+ const theme = usePreferredColorScheme();
243
+ return /* @__PURE__ */ jsx(ThemeProvider, { theme: theme === "dark" ? dark : light, children });
244
+ };
245
+
246
+ // src/frontend/stage.tsx
247
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
22
248
  var Stage = ({ className, renderers }) => {
23
- const [root, setRoot] = useState(
249
+ const [root, setRoot] = useState3(
24
250
  void 0
25
251
  );
26
252
  const socket = useRef(null);
@@ -42,7 +268,7 @@ var Stage = ({ className, renderers }) => {
42
268
  },
43
269
  [preparedRenderers]
44
270
  );
45
- useEffect(() => {
271
+ useEffect2(() => {
46
272
  initializeWebsocket();
47
273
  }, []);
48
274
  const initializeWebsocket = async () => {
@@ -86,7 +312,7 @@ var Stage = ({ className, renderers }) => {
86
312
  return;
87
313
  }
88
314
  };
89
- return /* @__PURE__ */ jsx(
315
+ return /* @__PURE__ */ jsx2(
90
316
  StageContext.Provider,
91
317
  {
92
318
  value: {
@@ -99,23 +325,30 @@ var Stage = ({ className, renderers }) => {
99
325
  return uuid.current;
100
326
  }
101
327
  },
102
- children: /* @__PURE__ */ jsx(GroupStateWrapper, { openByDefault: false, children: /* @__PURE__ */ jsx("div", { className, children: root ? renderComponent(root) : /* @__PURE__ */ jsx("div", { className: "no-root", children: "No root has been added to the light desk" }) }) })
328
+ children: /* @__PURE__ */ jsx2(GroupStateWrapper, { openByDefault: false, children: /* @__PURE__ */ jsx2("div", { className, children: root ? renderComponent(root) : /* @__PURE__ */ jsx2("div", { className: "no-root", children: "No root has been added to the light desk" }) }) })
103
329
  }
104
330
  );
105
331
  };
106
332
  var StyledStage = styled(Stage)`
107
333
  width: 100%;
108
334
  height: 100%;
109
- background-color: #333;
110
- color: ${THEME.textNormal};
111
- padding: ${THEME.sizingPx.spacing}px;
335
+ background-color: ${(p) => p.theme.pageBg};
336
+ color: ${(p) => p.theme.textNormal};
337
+ padding: ${(p) => p.theme.sizingPx.spacing}px;
112
338
  `;
113
339
  function rootComponent(props) {
114
- return /* @__PURE__ */ jsxs(Fragment, { children: [
115
- /* @__PURE__ */ jsx(BaseStyle, {}),
116
- /* @__PURE__ */ jsx(GlobalStyle, {}),
117
- /* @__PURE__ */ jsx(ThemeProvider, { theme: THEME, children: /* @__PURE__ */ jsx(StyledStage, { ...props }) })
118
- ] });
340
+ return /* @__PURE__ */ jsxs(
341
+ PreferredThemeProvider,
342
+ {
343
+ dark: props.themes?.dark ?? DARK_THEME2,
344
+ light: props.themes?.light ?? LIGHT_THEME2,
345
+ children: [
346
+ /* @__PURE__ */ jsx2(BaseStyle2, {}),
347
+ /* @__PURE__ */ jsx2(GlobalStyle2, {}),
348
+ /* @__PURE__ */ jsx2(StyledStage, { ...props })
349
+ ]
350
+ }
351
+ );
119
352
  }
120
353
 
121
354
  // src/frontend/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcanejs/toolkit",
3
- "version": "2.0.0",
3
+ "version": "3.1.0",
4
4
  "private": false,
5
5
  "description": "Build web-accessible control interfaces for your long-running Node.js processes",
6
6
  "keywords": [
@@ -115,7 +115,7 @@
115
115
  "tsup": "^8.1.0",
116
116
  "typescript": "^5.3.3",
117
117
  "@arcanejs/eslint-config": "^0.0.0",
118
- "@arcanejs/toolkit-frontend": "^0.4.0",
118
+ "@arcanejs/toolkit-frontend": "^0.6.0",
119
119
  "@arcanejs/typescript-config": "^0.0.0"
120
120
  },
121
121
  "dependencies": {
@@ -132,7 +132,7 @@
132
132
  "react": "^18",
133
133
  "react-dom": "18.3.1",
134
134
  "styled-components": "^6.1.13",
135
- "@arcanejs/toolkit-frontend": "^0.4.0"
135
+ "@arcanejs/toolkit-frontend": "^0.6.0"
136
136
  },
137
137
  "peerDependenciesMeta": {
138
138
  "@arcanejs/toolkit-frontend": {