@arcanejs/toolkit 1.1.1 → 3.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.
- package/dist/backend/components/base.d.mts +10 -79
- package/dist/backend/components/base.d.ts +10 -79
- package/dist/backend/components/base.js +2 -2
- package/dist/backend/components/base.mjs +1 -1
- package/dist/backend/components/button.d.mts +9 -33
- package/dist/backend/components/button.d.ts +9 -33
- package/dist/backend/components/button.js +3 -3
- package/dist/backend/components/button.mjs +2 -2
- package/dist/backend/components/group.d.mts +9 -54
- package/dist/backend/components/group.d.ts +9 -54
- package/dist/backend/components/group.js +3 -3
- package/dist/backend/components/group.mjs +2 -2
- package/dist/backend/components/label.d.mts +6 -2
- package/dist/backend/components/label.d.ts +6 -2
- package/dist/backend/components/label.js +3 -3
- package/dist/backend/components/label.mjs +2 -2
- package/dist/backend/components/rect.d.mts +7 -2
- package/dist/backend/components/rect.d.ts +7 -2
- package/dist/backend/components/rect.js +3 -3
- package/dist/backend/components/rect.mjs +2 -2
- package/dist/backend/components/slider-button.d.mts +8 -3
- package/dist/backend/components/slider-button.d.ts +8 -3
- package/dist/backend/components/slider-button.js +3 -3
- package/dist/backend/components/slider-button.mjs +2 -2
- package/dist/backend/components/switch.d.mts +8 -3
- package/dist/backend/components/switch.d.ts +8 -3
- package/dist/backend/components/switch.js +3 -3
- package/dist/backend/components/switch.mjs +2 -2
- package/dist/backend/components/tabs.d.mts +7 -2
- package/dist/backend/components/tabs.d.ts +7 -2
- package/dist/backend/components/tabs.js +3 -3
- package/dist/backend/components/tabs.mjs +2 -2
- package/dist/backend/components/text-input.d.mts +8 -3
- package/dist/backend/components/text-input.d.ts +8 -3
- package/dist/backend/components/text-input.js +3 -3
- package/dist/backend/components/text-input.mjs +2 -2
- package/dist/backend/components/timeline.d.mts +7 -2
- package/dist/backend/components/timeline.d.ts +7 -2
- package/dist/backend/components/timeline.js +3 -3
- package/dist/backend/components/timeline.mjs +2 -2
- package/dist/{chunk-HNFNG5MD.js → chunk-4OZ22IQU.js} +5 -5
- package/dist/{chunk-5TGGF5UJ.mjs → chunk-5D7OSUZ6.mjs} +3 -3
- package/dist/{chunk-T4TMVBFM.js → chunk-6CWEURJP.js} +2 -2
- package/dist/{chunk-5JPYL5IU.js → chunk-7OX2FB6C.js} +2 -2
- package/dist/{chunk-PXYXUWXE.mjs → chunk-7TTY7CBH.mjs} +1 -1
- package/dist/{chunk-SIXWXDZW.js → chunk-CME7HZZK.js} +5 -5
- package/dist/{chunk-OAPIVG6M.mjs → chunk-CUZSHFDP.mjs} +1 -1
- package/dist/{chunk-ZLJECS4H.js → chunk-DG75CS7F.js} +5 -5
- package/dist/{chunk-V5T44HCM.js → chunk-DRQVYGTI.js} +2 -2
- package/dist/{chunk-ARRRZPUK.js → chunk-GMDJYFHD.js} +3 -3
- package/dist/{chunk-IBIEYR3L.mjs → chunk-JFZXSCGK.mjs} +3 -3
- package/dist/{chunk-LX5IL6WX.mjs → chunk-K37TZB75.mjs} +1 -1
- package/dist/{chunk-BDBRQJSI.mjs → chunk-N6IHYBZH.mjs} +1 -1
- package/dist/{chunk-SBHNIFAS.mjs → chunk-NEQRLPXK.mjs} +3 -3
- package/dist/{chunk-TOPIQUBZ.js → chunk-O5ZW6JYG.js} +6 -6
- package/dist/{chunk-7SZA6JUN.mjs → chunk-RYR5I5FT.mjs} +6 -6
- package/dist/{chunk-ADH7RZG5.js → chunk-SGACFY53.js} +6 -6
- package/dist/{chunk-25LALCAN.js → chunk-VEZGD2PG.js} +5 -5
- package/dist/{chunk-EFNFSHV3.mjs → chunk-W42AOMM6.mjs} +3 -3
- package/dist/{chunk-ISHGZXPO.mjs → chunk-YBBUC3QC.mjs} +3 -3
- package/dist/frontend/entrypoint.js +492 -221
- package/dist/frontend/entrypoint.js.map +4 -4
- package/dist/frontend/index.js +242 -6
- package/dist/frontend/index.mjs +255 -19
- package/dist/index.d.mts +7 -111
- package/dist/index.d.ts +7 -111
- package/dist/index.js +65 -26
- package/dist/index.mjs +54 -15
- package/dist/toolkit-2w2SWHlT.d.ts +269 -0
- package/dist/toolkit-DB8G2TaA.d.mts +269 -0
- package/package.json +5 -4
package/dist/frontend/index.js
CHANGED
|
@@ -16,14 +16,241 @@ 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
|
|
25
251
|
);
|
|
26
252
|
const socket = _react.useRef.call(void 0, null);
|
|
253
|
+
const uuid = _react.useRef.call(void 0, null);
|
|
27
254
|
const preparedRenderers = _react.useMemo.call(void 0, () => {
|
|
28
255
|
const prepared = {};
|
|
29
256
|
for (const renderer of renderers) {
|
|
@@ -74,6 +301,9 @@ var Stage = ({ className, renderers }) => {
|
|
|
74
301
|
};
|
|
75
302
|
const handleMessage = (msg) => {
|
|
76
303
|
switch (msg.type) {
|
|
304
|
+
case "metadata":
|
|
305
|
+
uuid.current = msg.connectionUuid;
|
|
306
|
+
return;
|
|
77
307
|
case "tree-full":
|
|
78
308
|
setRoot(msg.root);
|
|
79
309
|
return;
|
|
@@ -87,7 +317,13 @@ var Stage = ({ className, renderers }) => {
|
|
|
87
317
|
{
|
|
88
318
|
value: {
|
|
89
319
|
sendMessage,
|
|
90
|
-
renderComponent
|
|
320
|
+
renderComponent,
|
|
321
|
+
get connectionUuid() {
|
|
322
|
+
if (!uuid.current) {
|
|
323
|
+
throw new Error("Unexpected missing UUID");
|
|
324
|
+
}
|
|
325
|
+
return uuid.current;
|
|
326
|
+
}
|
|
91
327
|
},
|
|
92
328
|
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" }) }) })
|
|
93
329
|
}
|
|
@@ -96,15 +332,15 @@ var Stage = ({ className, renderers }) => {
|
|
|
96
332
|
var StyledStage = _styledcomponents.styled.call(void 0, Stage)`
|
|
97
333
|
width: 100%;
|
|
98
334
|
height: 100%;
|
|
99
|
-
background-color:
|
|
100
|
-
color: ${
|
|
101
|
-
padding: ${
|
|
335
|
+
background-color: ${(p) => p.theme.pageBg};
|
|
336
|
+
color: ${(p) => p.theme.textNormal};
|
|
337
|
+
padding: ${(p) => p.theme.sizingPx.spacing}px;
|
|
102
338
|
`;
|
|
103
339
|
function rootComponent(props) {
|
|
104
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
340
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, PreferredThemeProvider, { dark: _styling.DARK_THEME, light: _styling.LIGHT_THEME, children: [
|
|
105
341
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.BaseStyle, {}),
|
|
106
342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _styling.GlobalStyle, {}),
|
|
107
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledStage, { ...props })
|
|
108
344
|
] });
|
|
109
345
|
}
|
|
110
346
|
|
package/dist/frontend/index.mjs
CHANGED
|
@@ -5,25 +5,252 @@ 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
|
|
14
|
+
import { styled } from "styled-components";
|
|
15
15
|
import {
|
|
16
|
-
BaseStyle,
|
|
17
|
-
GlobalStyle,
|
|
18
|
-
|
|
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
|
-
|
|
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] =
|
|
249
|
+
const [root, setRoot] = useState3(
|
|
24
250
|
void 0
|
|
25
251
|
);
|
|
26
252
|
const socket = useRef(null);
|
|
253
|
+
const uuid = useRef(null);
|
|
27
254
|
const preparedRenderers = useMemo(() => {
|
|
28
255
|
const prepared = {};
|
|
29
256
|
for (const renderer of renderers) {
|
|
@@ -41,7 +268,7 @@ var Stage = ({ className, renderers }) => {
|
|
|
41
268
|
},
|
|
42
269
|
[preparedRenderers]
|
|
43
270
|
);
|
|
44
|
-
|
|
271
|
+
useEffect2(() => {
|
|
45
272
|
initializeWebsocket();
|
|
46
273
|
}, []);
|
|
47
274
|
const initializeWebsocket = async () => {
|
|
@@ -74,6 +301,9 @@ var Stage = ({ className, renderers }) => {
|
|
|
74
301
|
};
|
|
75
302
|
const handleMessage = (msg) => {
|
|
76
303
|
switch (msg.type) {
|
|
304
|
+
case "metadata":
|
|
305
|
+
uuid.current = msg.connectionUuid;
|
|
306
|
+
return;
|
|
77
307
|
case "tree-full":
|
|
78
308
|
setRoot(msg.root);
|
|
79
309
|
return;
|
|
@@ -82,29 +312,35 @@ var Stage = ({ className, renderers }) => {
|
|
|
82
312
|
return;
|
|
83
313
|
}
|
|
84
314
|
};
|
|
85
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ jsx2(
|
|
86
316
|
StageContext.Provider,
|
|
87
317
|
{
|
|
88
318
|
value: {
|
|
89
319
|
sendMessage,
|
|
90
|
-
renderComponent
|
|
320
|
+
renderComponent,
|
|
321
|
+
get connectionUuid() {
|
|
322
|
+
if (!uuid.current) {
|
|
323
|
+
throw new Error("Unexpected missing UUID");
|
|
324
|
+
}
|
|
325
|
+
return uuid.current;
|
|
326
|
+
}
|
|
91
327
|
},
|
|
92
|
-
children: /* @__PURE__ */
|
|
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" }) }) })
|
|
93
329
|
}
|
|
94
330
|
);
|
|
95
331
|
};
|
|
96
332
|
var StyledStage = styled(Stage)`
|
|
97
333
|
width: 100%;
|
|
98
334
|
height: 100%;
|
|
99
|
-
background-color:
|
|
100
|
-
color: ${
|
|
101
|
-
padding: ${
|
|
335
|
+
background-color: ${(p) => p.theme.pageBg};
|
|
336
|
+
color: ${(p) => p.theme.textNormal};
|
|
337
|
+
padding: ${(p) => p.theme.sizingPx.spacing}px;
|
|
102
338
|
`;
|
|
103
339
|
function rootComponent(props) {
|
|
104
|
-
return /* @__PURE__ */ jsxs(
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
340
|
+
return /* @__PURE__ */ jsxs(PreferredThemeProvider, { dark: DARK_THEME2, light: LIGHT_THEME2, children: [
|
|
341
|
+
/* @__PURE__ */ jsx2(BaseStyle2, {}),
|
|
342
|
+
/* @__PURE__ */ jsx2(GlobalStyle2, {}),
|
|
343
|
+
/* @__PURE__ */ jsx2(StyledStage, { ...props })
|
|
108
344
|
] });
|
|
109
345
|
}
|
|
110
346
|
|