@vuu-ui/vuu-shell 0.8.26-debug → 0.8.26

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/esm/index.js CHANGED
@@ -1,3136 +1,3 @@
1
- var __accessCheck = (obj, member, msg) => {
2
- if (!member.has(obj))
3
- throw TypeError("Cannot " + msg);
4
- };
5
- var __privateGet = (obj, member, getter) => {
6
- __accessCheck(obj, member, "read from private field");
7
- return getter ? getter.call(obj) : member.get(obj);
8
- };
9
- var __privateAdd = (obj, member, value) => {
10
- if (member.has(obj))
11
- throw TypeError("Cannot add the same private member more than once");
12
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
- };
14
- var __privateSet = (obj, member, value, setter) => {
15
- __accessCheck(obj, member, "write to private field");
16
- setter ? setter.call(obj, value) : member.set(obj, value);
17
- return value;
18
- };
19
-
20
- // src/app-header/AppHeader.tsx
21
- import { useCallback as useCallback2 } from "react";
22
- import { Toolbar } from "@vuu-ui/vuu-ui-controls";
23
- import cx2 from "clsx";
24
-
25
- // src/login/LoginPanel.tsx
26
- import {
27
- useCallback,
28
- useEffect,
29
- useRef,
30
- useState
31
- } from "react";
32
- import { Button, FormField, FormFieldLabel } from "@salt-ds/core";
33
- import { VuuInput } from "@vuu-ui/vuu-ui-controls";
34
-
35
- // src/login/VuuLogo.tsx
36
- import { useMemo } from "react";
37
- import { jsx, jsxs } from "react/jsx-runtime";
38
- var VuuLogo = () => {
39
- const logo = useMemo(
40
- () => /* @__PURE__ */ jsxs(
41
- "svg",
42
- {
43
- width: "184",
44
- height: "90",
45
- viewBox: "0 0 184 90",
46
- fill: "none",
47
- xmlns: "http://www.w3.org/2000/svg",
48
- children: [
49
- /* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_1173_59965)", children: [
50
- /* @__PURE__ */ jsx(
51
- "path",
52
- {
53
- d: "M77.0775 31.1019L69.4572 15.1795L66.3997 13.7093L47.6353 44.165L75.7224 61.2361L81.8124 51.2694L77.0775 31.1019Z",
54
- fill: "url(#paint0_linear_1173_59965)"
55
- }
56
- ),
57
- /* @__PURE__ */ jsx(
58
- "path",
59
- {
60
- d: "M82.4101 49.7431C81.0488 51.8314 79.1993 53.648 76.8897 54.9809C74.2954 56.4792 71.4601 57.194 68.6623 57.194C63.3422 57.194 58.1597 54.6188 55.0209 49.971L30.5358 7.8193L30.5232 7.84116C25.8791 0.274825 16.0118 -2.26289 8.27258 2.21011C0.411306 6.74866 -2.26753 16.7872 2.28587 24.625L35.5054 81.8189C36.9856 84.3691 39.0542 86.3668 41.4358 87.7527C41.4545 87.7652 41.4733 87.7777 41.4921 87.7902C41.5015 87.7964 41.514 87.8027 41.5234 87.8089C42.6312 88.4457 43.8079 88.942 45.0253 89.3072C45.116 89.3353 45.2099 89.3634 45.3007 89.3883C45.7388 89.5101 46.1801 89.6193 46.6276 89.7067C46.7121 89.7223 46.7966 89.7317 46.8811 89.7473C47.241 89.8097 47.604 89.8628 47.967 89.9003C48.111 89.9159 48.2549 89.9315 48.3989 89.9408C48.8151 89.9752 49.2313 89.997 49.6507 90.0001C49.6726 90.0001 49.6945 90.0001 49.7132 90.0001C49.7195 90.0001 49.7226 90.0001 49.7289 90.0001C49.7352 90.0001 49.7383 90.0001 49.7445 90.0001C50.1983 90.0001 50.6552 89.9752 51.109 89.9377C51.2123 89.9283 51.3155 89.919 51.422 89.9065C51.8663 89.8597 52.3107 89.8004 52.7551 89.7192C52.7614 89.7192 52.7676 89.7192 52.7739 89.7192C53.2621 89.6287 53.7503 89.5101 54.2322 89.3727C54.2635 89.3634 54.2917 89.354 54.323 89.3446C55.024 89.1418 55.7156 88.8889 56.3978 88.5861C56.4104 88.5799 56.426 88.5736 56.4385 88.5674C56.958 88.3364 57.4712 88.0836 57.9751 87.7933C58.4852 87.4999 58.9703 87.1815 59.4334 86.8413C59.8371 86.5478 60.2252 86.2357 60.6039 85.9048C61.0639 85.499 61.4989 85.0745 61.9026 84.6282C62.2062 84.2942 62.4972 83.9446 62.7757 83.5825C62.8665 83.4639 62.951 83.3421 63.0355 83.2235C63.2264 82.9613 63.4079 82.6929 63.5831 82.4182C63.6739 82.2746 63.7646 82.1342 63.8523 81.9906C63.8867 81.9344 63.9242 81.8813 63.9555 81.8251L82.5854 49.7525H82.4039L82.4101 49.7431Z",
61
- fill: "url(#paint1_linear_1173_59965)"
62
- }
63
- ),
64
- /* @__PURE__ */ jsx(
65
- "path",
66
- {
67
- d: "M82.8264 32.8436L81.4181 30.4464L75.3375 19.1687L72.5178 14.3929C71.9858 13.1225 70.7309 12.2266 69.26 12.2266C67.3104 12.2266 65.7331 13.8029 65.7331 15.7445C65.7331 16.4031 65.924 17.0086 66.2401 17.5362L66.2025 17.5611L77.1557 36.1617C78.4764 38.4372 78.83 41.0873 78.1509 43.6281C77.4718 46.169 75.8445 48.2915 73.5631 49.6119C72.0609 50.4797 70.3553 50.9385 68.6341 50.9385C65.1166 50.9385 61.84 49.0563 60.0812 46.0285L44.3368 19.2654H44.3681L37.7179 7.81917L37.7054 7.84102C37.5896 7.65061 37.455 7.47893 37.333 7.29477L37.1452 6.97326C37.1452 6.97326 37.1296 6.98262 37.1233 6.98887C34.0001 2.55332 29.0054 0.0780356 23.8512 0.0187285V0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C79.1961 53.651 81.0425 51.8312 82.407 49.7461H82.5885L82.5259 49.8523C83.399 48.4695 84.0687 46.9462 84.5006 45.3231C85.6304 41.0904 85.042 36.6705 82.8201 32.8467L82.8264 32.8436Z",
68
- fill: "#F37880"
69
- }
70
- ),
71
- /* @__PURE__ */ jsxs("g", { opacity: "0.86", children: [
72
- /* @__PURE__ */ jsx(
73
- "path",
74
- {
75
- d: "M66.1994 17.5642L77.1526 36.1648C78.4732 38.4403 78.8269 41.0904 78.1478 43.6313C77.7347 45.1795 76.9648 46.5716 75.9133 47.7234C77.2903 46.4686 78.2823 44.8486 78.7737 43.007C79.4527 40.4661 79.0991 37.816 77.7785 35.5405L66.8253 16.94L66.8628 16.915C66.5467 16.3875 66.3558 15.7819 66.3558 15.1233C66.3558 14.3117 66.6344 13.5657 67.0975 12.9695C66.2651 13.6125 65.7299 14.6176 65.7299 15.7476C65.7299 16.4062 65.9208 17.0118 66.2369 17.5393L66.1994 17.5642Z",
76
- fill: "white"
77
- }
78
- ),
79
- /* @__PURE__ */ jsx(
80
- "path",
81
- {
82
- d: "M82.5382 49.8335L82.5291 49.8487C82.5291 49.8487 82.5352 49.8365 82.5413 49.8304C82.5413 49.8304 82.5413 49.8304 82.5413 49.8335H82.5382Z",
83
- fill: "white"
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(
87
- "path",
88
- {
89
- d: "M77.5156 54.3596C74.9213 55.8579 72.0859 56.5727 69.2882 56.5727C63.9681 56.5727 58.7856 53.9975 55.6467 49.3497L31.1616 7.19488L31.1491 7.21673C28.9053 3.56154 25.4441 1.08626 21.5917 0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C78.2698 54.1848 79.4809 53.2109 80.5293 52.1122C79.6311 52.9581 78.6266 53.7166 77.5125 54.3596H77.5156Z",
90
- fill: "white"
91
- }
92
- )
93
- ] })
94
- ] }),
95
- /* @__PURE__ */ jsx(
96
- "path",
97
- {
98
- d: "M117.046 58.661C116.362 58.661 115.792 58.509 115.336 58.205C114.906 57.8757 114.551 57.3943 114.272 56.761L104.354 34.493C104.076 33.8597 104 33.3023 104.126 32.821C104.253 32.3397 104.519 31.9597 104.924 31.681C105.33 31.4023 105.811 31.263 106.368 31.263C107.103 31.263 107.648 31.4277 108.002 31.757C108.382 32.061 108.699 32.5297 108.952 33.163L117.958 54.025H116.324L125.292 33.125C125.571 32.517 125.9 32.061 126.28 31.757C126.66 31.4277 127.192 31.263 127.876 31.263C128.434 31.263 128.89 31.4023 129.244 31.681C129.624 31.9597 129.865 32.3397 129.966 32.821C130.068 33.3023 129.979 33.8597 129.7 34.493L119.782 56.761C119.504 57.3943 119.149 57.8757 118.718 58.205C118.313 58.509 117.756 58.661 117.046 58.661Z",
99
- fill: "white"
100
- }
101
- ),
102
- /* @__PURE__ */ jsx(
103
- "path",
104
- {
105
- d: "M144.63 58.737C142.781 58.737 141.147 58.4963 139.728 58.015C138.335 57.5337 137.157 56.8243 136.194 55.887C135.232 54.9243 134.51 53.7337 134.028 52.315C133.547 50.8963 133.306 49.2497 133.306 47.375V33.733C133.306 32.897 133.509 32.2763 133.914 31.871C134.345 31.4657 134.953 31.263 135.738 31.263C136.524 31.263 137.119 31.4657 137.524 31.871C137.955 32.2763 138.17 32.897 138.17 33.733V47.337C138.17 49.7437 138.715 51.555 139.804 52.771C140.919 53.9617 142.528 54.557 144.63 54.557C146.733 54.557 148.329 53.9617 149.418 52.771C150.508 51.555 151.052 49.7437 151.052 47.337V33.733C151.052 32.897 151.255 32.2763 151.66 31.871C152.091 31.4657 152.699 31.263 153.484 31.263C154.244 31.263 154.827 31.4657 155.232 31.871C155.663 32.2763 155.878 32.897 155.878 33.733V47.375C155.878 49.8577 155.448 51.9477 154.586 53.645C153.75 55.3423 152.496 56.6217 150.824 57.483C149.152 58.319 147.088 58.737 144.63 58.737Z",
106
- fill: "white"
107
- }
108
- ),
109
- /* @__PURE__ */ jsx(
110
- "path",
111
- {
112
- d: "M172.685 58.737C170.836 58.737 169.202 58.4963 167.783 58.015C166.39 57.5337 165.212 56.8243 164.249 55.887C163.286 54.9243 162.564 53.7337 162.083 52.315C161.602 50.8963 161.361 49.2497 161.361 47.375V33.733C161.361 32.897 161.564 32.2763 161.969 31.871C162.4 31.4657 163.008 31.263 163.793 31.263C164.578 31.263 165.174 31.4657 165.579 31.871C166.01 32.2763 166.225 32.897 166.225 33.733V47.337C166.225 49.7437 166.77 51.555 167.859 52.771C168.974 53.9617 170.582 54.557 172.685 54.557C174.788 54.557 176.384 53.9617 177.473 52.771C178.562 51.555 179.107 49.7437 179.107 47.337V33.733C179.107 32.897 179.31 32.2763 179.715 31.871C180.146 31.4657 180.754 31.263 181.539 31.263C182.299 31.263 182.882 31.4657 183.287 31.871C183.718 32.2763 183.933 32.897 183.933 33.733V47.375C183.933 49.8577 183.502 51.9477 182.641 53.645C181.805 55.3423 180.551 56.6217 178.879 57.483C177.207 58.319 175.142 58.737 172.685 58.737Z",
113
- fill: "white"
114
- }
115
- ),
116
- /* @__PURE__ */ jsxs("defs", { children: [
117
- /* @__PURE__ */ jsxs(
118
- "linearGradient",
119
- {
120
- id: "paint0_linear_1173_59965",
121
- x1: "47.6353",
122
- y1: "37.4727",
123
- x2: "81.8124",
124
- y2: "37.4727",
125
- gradientUnits: "userSpaceOnUse",
126
- children: [
127
- /* @__PURE__ */ jsx("stop", { stopColor: "#4906A5" }),
128
- /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#D3423A" })
129
- ]
130
- }
131
- ),
132
- /* @__PURE__ */ jsxs(
133
- "linearGradient",
134
- {
135
- id: "paint1_linear_1173_59965",
136
- x1: "0.0670626",
137
- y1: "45.0017",
138
- x2: "82.5916",
139
- y2: "45.0017",
140
- gradientUnits: "userSpaceOnUse",
141
- children: [
142
- /* @__PURE__ */ jsx("stop", { stopColor: "#7C06A5" }),
143
- /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#D3423A" })
144
- ]
145
- }
146
- ),
147
- /* @__PURE__ */ jsx("clipPath", { id: "clip0_1173_59965", children: /* @__PURE__ */ jsx(
148
- "rect",
149
- {
150
- width: "85",
151
- height: "90",
152
- fill: "white",
153
- transform: "translate(0.0670471)"
154
- }
155
- ) })
156
- ] })
157
- ]
158
- }
159
- ),
160
- []
161
- );
162
- return logo;
163
- };
164
-
165
- // src/login/LoginPanel.tsx
166
- import cx from "clsx";
167
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
168
- var classBase = "vuuLoginPanel";
169
- var LoginPanel = ({
170
- appName = "Demo App",
171
- className,
172
- requirePassword = true,
173
- onSubmit,
174
- ...htmlAttributes
175
- }) => {
176
- const [username, setUserName] = useState("");
177
- const [password, setPassword] = useState("");
178
- const inputRef = useRef(null);
179
- const login = () => {
180
- onSubmit(username, password);
181
- };
182
- const handleUsername = (evt) => {
183
- setUserName(evt.target.value);
184
- };
185
- const handlePassword = (evt) => {
186
- setPassword(evt.target.value);
187
- };
188
- const handleCommitName = useCallback(() => {
189
- if (!requirePassword) {
190
- onSubmit(username);
191
- }
192
- }, [onSubmit, requirePassword, username]);
193
- const handleCommitPassword = useCallback(() => {
194
- if (username) {
195
- onSubmit(username, password);
196
- }
197
- }, [onSubmit, password, username]);
198
- const dataIsValid = username.trim() !== "" && (requirePassword === false || password.trim() !== "");
199
- useEffect(() => {
200
- var _a;
201
- console.log(`inputRef`, {
202
- input: inputRef.current
203
- });
204
- (_a = inputRef.current) == null ? void 0 : _a.focus();
205
- }, []);
206
- return /* @__PURE__ */ jsxs2("div", { ...htmlAttributes, className: cx(classBase, className), children: [
207
- /* @__PURE__ */ jsxs2("div", { className: `${classBase}-branding`, children: [
208
- /* @__PURE__ */ jsx2(VuuLogo, {}),
209
- /* @__PURE__ */ jsx2("div", { className: `${classBase}-appName`, children: appName })
210
- ] }),
211
- /* @__PURE__ */ jsxs2("div", { className: `${classBase}-form`, children: [
212
- /* @__PURE__ */ jsx2("div", { className: `${classBase}-title`, children: "Welcome Back" }),
213
- /* @__PURE__ */ jsxs2(FormField, { children: [
214
- /* @__PURE__ */ jsx2(FormFieldLabel, { children: "Username" }),
215
- /* @__PURE__ */ jsx2(
216
- VuuInput,
217
- {
218
- value: username,
219
- id: "text-username",
220
- inputRef,
221
- onChange: handleUsername,
222
- onCommit: handleCommitName
223
- }
224
- )
225
- ] }),
226
- requirePassword ? /* @__PURE__ */ jsxs2(FormField, { children: [
227
- /* @__PURE__ */ jsx2(FormFieldLabel, { children: "Password" }),
228
- /* @__PURE__ */ jsx2(
229
- VuuInput,
230
- {
231
- className: `${classBase}-password`,
232
- inputProps: {
233
- type: "password"
234
- },
235
- value: password,
236
- id: "text-password",
237
- onChange: handlePassword,
238
- onCommit: handleCommitPassword,
239
- endAdornment: /* @__PURE__ */ jsx2("span", { "data-icon": "eye", style: { cursor: "pointer" } })
240
- }
241
- )
242
- ] }) : null,
243
- /* @__PURE__ */ jsx2(
244
- Button,
245
- {
246
- className: `${classBase}-login`,
247
- disabled: !dataIsValid,
248
- onClick: login,
249
- variant: "cta",
250
- children: "Login"
251
- }
252
- )
253
- ] })
254
- ] });
255
- };
256
-
257
- // src/login/login-utils.ts
258
- import { getCookieValue } from "@vuu-ui/vuu-utils";
259
- var getAuthModeFromCookies = () => {
260
- const mode = getCookieValue("vuu-auth-mode");
261
- return mode != null ? mode : "";
262
- };
263
- var getAuthDetailsFromCookies = () => {
264
- const username = getCookieValue("vuu-username");
265
- const token = getCookieValue("vuu-auth-token");
266
- return [username, token];
267
- };
268
- var getDefaultLoginUrl = () => {
269
- const authMode = getAuthModeFromCookies();
270
- return authMode === "login" ? "login.html" : "demo.html";
271
- };
272
- var redirectToLogin = (loginUrl = getDefaultLoginUrl()) => {
273
- window.location.href = loginUrl;
274
- };
275
- var logout = (loginUrl) => {
276
- document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
277
- document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
278
- redirectToLogin(loginUrl);
279
- };
280
-
281
- // src/app-header/AppHeader.tsx
282
- import { Button as Button2 } from "@salt-ds/core";
283
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
284
- var classBase2 = "vuuAppHeader";
285
- var AppHeader = ({
286
- className: classNameProp,
287
- layoutId,
288
- loginUrl,
289
- onNavigate,
290
- onSwitchTheme,
291
- themeMode: _,
292
- user,
293
- ...htmlAttributes
294
- }) => {
295
- const className = cx2(classBase2, classNameProp);
296
- const handleLogout = useCallback2(() => {
297
- logout(loginUrl);
298
- }, [loginUrl]);
299
- return /* @__PURE__ */ jsxs3(
300
- Toolbar,
301
- {
302
- alignItems: "end",
303
- className,
304
- showSeparators: true,
305
- ...htmlAttributes,
306
- children: [
307
- /* @__PURE__ */ jsx3(Button2, { className: `${classBase2}-menuItem`, variant: "secondary", children: "Help" }),
308
- /* @__PURE__ */ jsxs3(Button2, { className: `${classBase2}-menuItem`, variant: "secondary", children: [
309
- "History ",
310
- /* @__PURE__ */ jsx3("span", { "data-icon": "history" })
311
- ] }),
312
- /* @__PURE__ */ jsxs3(Button2, { className: `${classBase2}-menuItem`, variant: "secondary", children: [
313
- "View ",
314
- /* @__PURE__ */ jsx3("span", { "data-icon": "settings" })
315
- ] }),
316
- /* @__PURE__ */ jsx3(
317
- Button2,
318
- {
319
- className: `${classBase2}-menuItem`,
320
- onClick: handleLogout,
321
- variant: "secondary",
322
- children: "Log out"
323
- }
324
- )
325
- ]
326
- }
327
- );
328
- };
329
-
330
- // src/connection-status/ConnectionStatusIcon.tsx
331
- import React, { useEffect as useEffect2, useState as useState2 } from "react";
332
- import cx3 from "clsx";
333
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
334
- var ConnectionStatusIcon = ({
335
- connectionStatus,
336
- className,
337
- element = "span",
338
- ...props
339
- }) => {
340
- const [classBase14, setClassBase] = useState2("vuuConnectingStatus");
341
- useEffect2(() => {
342
- switch (connectionStatus) {
343
- case "connected":
344
- case "reconnected":
345
- setClassBase("vuuActiveStatus");
346
- break;
347
- case "connecting":
348
- setClassBase("vuuConnectingStatus");
349
- break;
350
- case "disconnected":
351
- setClassBase("vuuDisconnectedStatus");
352
- break;
353
- default:
354
- break;
355
- }
356
- }, [connectionStatus]);
357
- const statusIcon = React.createElement(element, {
358
- ...props,
359
- className: cx3("vuuStatus vuuIcon", classBase14, className)
360
- });
361
- return /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs4("div", { className: "vuuStatus-container salt-theme", children: [
362
- statusIcon,
363
- /* @__PURE__ */ jsxs4("div", { className: "vuuStatus-text", children: [
364
- "Status: ",
365
- connectionStatus.toUpperCase()
366
- ] })
367
- ] }) });
368
- };
369
-
370
- // src/feature/Feature.tsx
371
- import React3, { Suspense, useEffect as useEffect3 } from "react";
372
- import { registerComponent } from "@vuu-ui/vuu-layout";
373
-
374
- // src/feature/FeatureErrorBoundary.tsx
375
- import React2 from "react";
376
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
377
- var FeatureErrorBoundary = class extends React2.Component {
378
- constructor(props) {
379
- super(props);
380
- this.state = { errorMessage: null };
381
- }
382
- static getDerivedStateFromError(error2) {
383
- return { errorMessage: error2.message };
384
- }
385
- componentDidCatch(error2, errorInfo) {
386
- console.log(`error creating component at ${this.props.url}`);
387
- console.log(error2, errorInfo);
388
- }
389
- render() {
390
- if (this.state.errorMessage) {
391
- return /* @__PURE__ */ jsxs5(Fragment2, { children: [
392
- /* @__PURE__ */ jsx5("h1", { children: "An error occured while creating component." }),
393
- /* @__PURE__ */ jsx5("p", { children: this.state.errorMessage })
394
- ] });
395
- }
396
- return this.props.children;
397
- }
398
- };
399
-
400
- // src/feature/Loader.tsx
401
- import { jsx as jsx6 } from "react/jsx-runtime";
402
- var Loader = () => /* @__PURE__ */ jsx6("div", { className: "hwLoader" });
403
-
404
- // src/feature/css-module-loader.ts
405
- var importCSS = async (path) => {
406
- const container = new CSSStyleSheet();
407
- return fetch(path).then((x) => x.text()).then((x) => container.replace(x));
408
- };
409
-
410
- // src/feature/Feature.tsx
411
- import { jsx as jsx7 } from "react/jsx-runtime";
412
- var componentsMap = /* @__PURE__ */ new Map();
413
- var useCachedFeature = (url) => {
414
- useEffect3(
415
- () => () => {
416
- componentsMap.delete(url);
417
- },
418
- [url]
419
- );
420
- if (!componentsMap.has(url)) {
421
- componentsMap.set(
422
- url,
423
- React3.lazy(() => import(
424
- /* @vite-ignore */
425
- url
426
- ))
427
- );
428
- }
429
- const lazyFeature = componentsMap.get(url);
430
- if (!lazyFeature) {
431
- throw Error(`Unable to load Lazy Feature at url ${url}`);
432
- } else {
433
- return lazyFeature;
434
- }
435
- };
436
- function RawFeature({
437
- url,
438
- css,
439
- ComponentProps: params,
440
- ...props
441
- }) {
442
- if (css) {
443
- importCSS(css).then((styleSheet) => {
444
- document.adoptedStyleSheets = [
445
- ...document.adoptedStyleSheets,
446
- styleSheet
447
- ];
448
- });
449
- }
450
- const LazyFeature = useCachedFeature(url);
451
- return /* @__PURE__ */ jsx7(FeatureErrorBoundary, { url, children: /* @__PURE__ */ jsx7(Suspense, { fallback: /* @__PURE__ */ jsx7(Loader, {}), children: /* @__PURE__ */ jsx7(LazyFeature, { ...props, ...params }) }) });
452
- }
453
- var Feature = React3.memo(RawFeature);
454
- Feature.displayName = "Feature";
455
- registerComponent("Feature", Feature, "view");
456
-
457
- // src/layout-management/SaveLayoutPanel.tsx
458
- import { Checkbox, ComboBox, RadioButton } from "@vuu-ui/vuu-ui-controls";
459
-
460
- // ../../node_modules/html-to-image/es/util.js
461
- function resolveUrl(url, baseUrl) {
462
- if (url.match(/^[a-z]+:\/\//i)) {
463
- return url;
464
- }
465
- if (url.match(/^\/\//)) {
466
- return window.location.protocol + url;
467
- }
468
- if (url.match(/^[a-z]+:/i)) {
469
- return url;
470
- }
471
- const doc = document.implementation.createHTMLDocument();
472
- const base = doc.createElement("base");
473
- const a = doc.createElement("a");
474
- doc.head.appendChild(base);
475
- doc.body.appendChild(a);
476
- if (baseUrl) {
477
- base.href = baseUrl;
478
- }
479
- a.href = url;
480
- return a.href;
481
- }
482
- var uuid = /* @__PURE__ */ (() => {
483
- let counter = 0;
484
- const random = () => (
485
- // eslint-disable-next-line no-bitwise
486
- `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
487
- );
488
- return () => {
489
- counter += 1;
490
- return `u${random()}${counter}`;
491
- };
492
- })();
493
- function toArray(arrayLike) {
494
- const arr = [];
495
- for (let i = 0, l = arrayLike.length; i < l; i++) {
496
- arr.push(arrayLike[i]);
497
- }
498
- return arr;
499
- }
500
- function px(node, styleProperty) {
501
- const win = node.ownerDocument.defaultView || window;
502
- const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
503
- return val ? parseFloat(val.replace("px", "")) : 0;
504
- }
505
- function getNodeWidth(node) {
506
- const leftBorder = px(node, "border-left-width");
507
- const rightBorder = px(node, "border-right-width");
508
- return node.clientWidth + leftBorder + rightBorder;
509
- }
510
- function getNodeHeight(node) {
511
- const topBorder = px(node, "border-top-width");
512
- const bottomBorder = px(node, "border-bottom-width");
513
- return node.clientHeight + topBorder + bottomBorder;
514
- }
515
- function getImageSize(targetNode, options = {}) {
516
- const width = options.width || getNodeWidth(targetNode);
517
- const height = options.height || getNodeHeight(targetNode);
518
- return { width, height };
519
- }
520
- function getPixelRatio() {
521
- let ratio;
522
- let FINAL_PROCESS;
523
- try {
524
- FINAL_PROCESS = process;
525
- } catch (e) {
526
- }
527
- const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
528
- if (val) {
529
- ratio = parseInt(val, 10);
530
- if (Number.isNaN(ratio)) {
531
- ratio = 1;
532
- }
533
- }
534
- return ratio || window.devicePixelRatio || 1;
535
- }
536
- var canvasDimensionLimit = 16384;
537
- function checkCanvasDimensions(canvas) {
538
- if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
539
- if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
540
- if (canvas.width > canvas.height) {
541
- canvas.height *= canvasDimensionLimit / canvas.width;
542
- canvas.width = canvasDimensionLimit;
543
- } else {
544
- canvas.width *= canvasDimensionLimit / canvas.height;
545
- canvas.height = canvasDimensionLimit;
546
- }
547
- } else if (canvas.width > canvasDimensionLimit) {
548
- canvas.height *= canvasDimensionLimit / canvas.width;
549
- canvas.width = canvasDimensionLimit;
550
- } else {
551
- canvas.width *= canvasDimensionLimit / canvas.height;
552
- canvas.height = canvasDimensionLimit;
553
- }
554
- }
555
- }
556
- function createImage(url) {
557
- return new Promise((resolve, reject) => {
558
- const img = new Image();
559
- img.decode = () => resolve(img);
560
- img.onload = () => resolve(img);
561
- img.onerror = reject;
562
- img.crossOrigin = "anonymous";
563
- img.decoding = "async";
564
- img.src = url;
565
- });
566
- }
567
- async function svgToDataURL(svg) {
568
- return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
569
- }
570
- async function nodeToDataURL(node, width, height) {
571
- const xmlns = "http://www.w3.org/2000/svg";
572
- const svg = document.createElementNS(xmlns, "svg");
573
- const foreignObject = document.createElementNS(xmlns, "foreignObject");
574
- svg.setAttribute("width", `${width}`);
575
- svg.setAttribute("height", `${height}`);
576
- svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
577
- foreignObject.setAttribute("width", "100%");
578
- foreignObject.setAttribute("height", "100%");
579
- foreignObject.setAttribute("x", "0");
580
- foreignObject.setAttribute("y", "0");
581
- foreignObject.setAttribute("externalResourcesRequired", "true");
582
- svg.appendChild(foreignObject);
583
- foreignObject.appendChild(node);
584
- return svgToDataURL(svg);
585
- }
586
- var isInstanceOfElement = (node, instance) => {
587
- if (node instanceof instance)
588
- return true;
589
- const nodePrototype = Object.getPrototypeOf(node);
590
- if (nodePrototype === null)
591
- return false;
592
- return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
593
- };
594
-
595
- // ../../node_modules/html-to-image/es/clone-pseudos.js
596
- function formatCSSText(style) {
597
- const content = style.getPropertyValue("content");
598
- return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
599
- }
600
- function formatCSSProperties(style) {
601
- return toArray(style).map((name) => {
602
- const value = style.getPropertyValue(name);
603
- const priority = style.getPropertyPriority(name);
604
- return `${name}: ${value}${priority ? " !important" : ""};`;
605
- }).join(" ");
606
- }
607
- function getPseudoElementStyle(className, pseudo, style) {
608
- const selector = `.${className}:${pseudo}`;
609
- const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style);
610
- return document.createTextNode(`${selector}{${cssText}}`);
611
- }
612
- function clonePseudoElement(nativeNode, clonedNode, pseudo) {
613
- const style = window.getComputedStyle(nativeNode, pseudo);
614
- const content = style.getPropertyValue("content");
615
- if (content === "" || content === "none") {
616
- return;
617
- }
618
- const className = uuid();
619
- try {
620
- clonedNode.className = `${clonedNode.className} ${className}`;
621
- } catch (err) {
622
- return;
623
- }
624
- const styleElement = document.createElement("style");
625
- styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));
626
- clonedNode.appendChild(styleElement);
627
- }
628
- function clonePseudoElements(nativeNode, clonedNode) {
629
- clonePseudoElement(nativeNode, clonedNode, ":before");
630
- clonePseudoElement(nativeNode, clonedNode, ":after");
631
- }
632
-
633
- // ../../node_modules/html-to-image/es/mimes.js
634
- var WOFF = "application/font-woff";
635
- var JPEG = "image/jpeg";
636
- var mimes = {
637
- woff: WOFF,
638
- woff2: WOFF,
639
- ttf: "application/font-truetype",
640
- eot: "application/vnd.ms-fontobject",
641
- png: "image/png",
642
- jpg: JPEG,
643
- jpeg: JPEG,
644
- gif: "image/gif",
645
- tiff: "image/tiff",
646
- svg: "image/svg+xml",
647
- webp: "image/webp"
648
- };
649
- function getExtension(url) {
650
- const match = /\.([^./]*?)$/g.exec(url);
651
- return match ? match[1] : "";
652
- }
653
- function getMimeType(url) {
654
- const extension = getExtension(url).toLowerCase();
655
- return mimes[extension] || "";
656
- }
657
-
658
- // ../../node_modules/html-to-image/es/dataurl.js
659
- function getContentFromDataUrl(dataURL) {
660
- return dataURL.split(/,/)[1];
661
- }
662
- function isDataUrl(url) {
663
- return url.search(/^(data:)/) !== -1;
664
- }
665
- function makeDataUrl(content, mimeType) {
666
- return `data:${mimeType};base64,${content}`;
667
- }
668
- async function fetchAsDataURL(url, init, process2) {
669
- const res = await fetch(url, init);
670
- if (res.status === 404) {
671
- throw new Error(`Resource "${res.url}" not found`);
672
- }
673
- const blob = await res.blob();
674
- return new Promise((resolve, reject) => {
675
- const reader = new FileReader();
676
- reader.onerror = reject;
677
- reader.onloadend = () => {
678
- try {
679
- resolve(process2({ res, result: reader.result }));
680
- } catch (error2) {
681
- reject(error2);
682
- }
683
- };
684
- reader.readAsDataURL(blob);
685
- });
686
- }
687
- var cache = {};
688
- function getCacheKey(url, contentType, includeQueryParams) {
689
- let key = url.replace(/\?.*/, "");
690
- if (includeQueryParams) {
691
- key = url;
692
- }
693
- if (/ttf|otf|eot|woff2?/i.test(key)) {
694
- key = key.replace(/.*\//, "");
695
- }
696
- return contentType ? `[${contentType}]${key}` : key;
697
- }
698
- async function resourceToDataURL(resourceUrl, contentType, options) {
699
- const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
700
- if (cache[cacheKey] != null) {
701
- return cache[cacheKey];
702
- }
703
- if (options.cacheBust) {
704
- resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
705
- }
706
- let dataURL;
707
- try {
708
- const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
709
- if (!contentType) {
710
- contentType = res.headers.get("Content-Type") || "";
711
- }
712
- return getContentFromDataUrl(result);
713
- });
714
- dataURL = makeDataUrl(content, contentType);
715
- } catch (error2) {
716
- dataURL = options.imagePlaceholder || "";
717
- let msg = `Failed to fetch resource: ${resourceUrl}`;
718
- if (error2) {
719
- msg = typeof error2 === "string" ? error2 : error2.message;
720
- }
721
- if (msg) {
722
- console.warn(msg);
723
- }
724
- }
725
- cache[cacheKey] = dataURL;
726
- return dataURL;
727
- }
728
-
729
- // ../../node_modules/html-to-image/es/clone-node.js
730
- async function cloneCanvasElement(canvas) {
731
- const dataURL = canvas.toDataURL();
732
- if (dataURL === "data:,") {
733
- return canvas.cloneNode(false);
734
- }
735
- return createImage(dataURL);
736
- }
737
- async function cloneVideoElement(video, options) {
738
- if (video.currentSrc) {
739
- const canvas = document.createElement("canvas");
740
- const ctx = canvas.getContext("2d");
741
- canvas.width = video.clientWidth;
742
- canvas.height = video.clientHeight;
743
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
744
- const dataURL2 = canvas.toDataURL();
745
- return createImage(dataURL2);
746
- }
747
- const poster = video.poster;
748
- const contentType = getMimeType(poster);
749
- const dataURL = await resourceToDataURL(poster, contentType, options);
750
- return createImage(dataURL);
751
- }
752
- async function cloneIFrameElement(iframe) {
753
- var _a;
754
- try {
755
- if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
756
- return await cloneNode(iframe.contentDocument.body, {}, true);
757
- }
758
- } catch (_b) {
759
- }
760
- return iframe.cloneNode(false);
761
- }
762
- async function cloneSingleNode(node, options) {
763
- if (isInstanceOfElement(node, HTMLCanvasElement)) {
764
- return cloneCanvasElement(node);
765
- }
766
- if (isInstanceOfElement(node, HTMLVideoElement)) {
767
- return cloneVideoElement(node, options);
768
- }
769
- if (isInstanceOfElement(node, HTMLIFrameElement)) {
770
- return cloneIFrameElement(node);
771
- }
772
- return node.cloneNode(false);
773
- }
774
- var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
775
- async function cloneChildren(nativeNode, clonedNode, options) {
776
- var _a, _b;
777
- let children = [];
778
- if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
779
- children = toArray(nativeNode.assignedNodes());
780
- } else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
781
- children = toArray(nativeNode.contentDocument.body.childNodes);
782
- } else {
783
- children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
784
- }
785
- if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
786
- return clonedNode;
787
- }
788
- await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
789
- if (clonedChild) {
790
- clonedNode.appendChild(clonedChild);
791
- }
792
- }), Promise.resolve());
793
- return clonedNode;
794
- }
795
- function cloneCSSStyle(nativeNode, clonedNode) {
796
- const targetStyle = clonedNode.style;
797
- if (!targetStyle) {
798
- return;
799
- }
800
- const sourceStyle = window.getComputedStyle(nativeNode);
801
- if (sourceStyle.cssText) {
802
- targetStyle.cssText = sourceStyle.cssText;
803
- targetStyle.transformOrigin = sourceStyle.transformOrigin;
804
- } else {
805
- toArray(sourceStyle).forEach((name) => {
806
- let value = sourceStyle.getPropertyValue(name);
807
- if (name === "font-size" && value.endsWith("px")) {
808
- const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
809
- value = `${reducedFont}px`;
810
- }
811
- if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") {
812
- value = "block";
813
- }
814
- if (name === "d" && clonedNode.getAttribute("d")) {
815
- value = `path(${clonedNode.getAttribute("d")})`;
816
- }
817
- targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
818
- });
819
- }
820
- }
821
- function cloneInputValue(nativeNode, clonedNode) {
822
- if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
823
- clonedNode.innerHTML = nativeNode.value;
824
- }
825
- if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
826
- clonedNode.setAttribute("value", nativeNode.value);
827
- }
828
- }
829
- function cloneSelectValue(nativeNode, clonedNode) {
830
- if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
831
- const clonedSelect = clonedNode;
832
- const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value"));
833
- if (selectedOption) {
834
- selectedOption.setAttribute("selected", "");
835
- }
836
- }
837
- }
838
- function decorate(nativeNode, clonedNode) {
839
- if (isInstanceOfElement(clonedNode, Element)) {
840
- cloneCSSStyle(nativeNode, clonedNode);
841
- clonePseudoElements(nativeNode, clonedNode);
842
- cloneInputValue(nativeNode, clonedNode);
843
- cloneSelectValue(nativeNode, clonedNode);
844
- }
845
- return clonedNode;
846
- }
847
- async function ensureSVGSymbols(clone, options) {
848
- const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
849
- if (uses.length === 0) {
850
- return clone;
851
- }
852
- const processedDefs = {};
853
- for (let i = 0; i < uses.length; i++) {
854
- const use = uses[i];
855
- const id = use.getAttribute("xlink:href");
856
- if (id) {
857
- const exist = clone.querySelector(id);
858
- const definition = document.querySelector(id);
859
- if (!exist && definition && !processedDefs[id]) {
860
- processedDefs[id] = await cloneNode(definition, options, true);
861
- }
862
- }
863
- }
864
- const nodes = Object.values(processedDefs);
865
- if (nodes.length) {
866
- const ns = "http://www.w3.org/1999/xhtml";
867
- const svg = document.createElementNS(ns, "svg");
868
- svg.setAttribute("xmlns", ns);
869
- svg.style.position = "absolute";
870
- svg.style.width = "0";
871
- svg.style.height = "0";
872
- svg.style.overflow = "hidden";
873
- svg.style.display = "none";
874
- const defs = document.createElementNS(ns, "defs");
875
- svg.appendChild(defs);
876
- for (let i = 0; i < nodes.length; i++) {
877
- defs.appendChild(nodes[i]);
878
- }
879
- clone.appendChild(svg);
880
- }
881
- return clone;
882
- }
883
- async function cloneNode(node, options, isRoot) {
884
- if (!isRoot && options.filter && !options.filter(node)) {
885
- return null;
886
- }
887
- return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode)).then((clonedNode) => ensureSVGSymbols(clonedNode, options));
888
- }
889
-
890
- // ../../node_modules/html-to-image/es/embed-resources.js
891
- var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
892
- var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
893
- var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
894
- function toRegex(url) {
895
- const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
896
- return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
897
- }
898
- function parseURLs(cssText) {
899
- const urls = [];
900
- cssText.replace(URL_REGEX, (raw, quotation, url) => {
901
- urls.push(url);
902
- return raw;
903
- });
904
- return urls.filter((url) => !isDataUrl(url));
905
- }
906
- async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
907
- try {
908
- const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
909
- const contentType = getMimeType(resourceURL);
910
- let dataURL;
911
- if (getContentFromUrl) {
912
- const content = await getContentFromUrl(resolvedURL);
913
- dataURL = makeDataUrl(content, contentType);
914
- } else {
915
- dataURL = await resourceToDataURL(resolvedURL, contentType, options);
916
- }
917
- return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
918
- } catch (error2) {
919
- }
920
- return cssText;
921
- }
922
- function filterPreferredFontFormat(str, { preferredFontFormat }) {
923
- return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
924
- while (true) {
925
- const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
926
- if (!format) {
927
- return "";
928
- }
929
- if (format === preferredFontFormat) {
930
- return `src: ${src};`;
931
- }
932
- }
933
- });
934
- }
935
- function shouldEmbed(url) {
936
- return url.search(URL_REGEX) !== -1;
937
- }
938
- async function embedResources(cssText, baseUrl, options) {
939
- if (!shouldEmbed(cssText)) {
940
- return cssText;
941
- }
942
- const filteredCSSText = filterPreferredFontFormat(cssText, options);
943
- const urls = parseURLs(filteredCSSText);
944
- return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
945
- }
946
-
947
- // ../../node_modules/html-to-image/es/embed-images.js
948
- async function embedProp(propName, node, options) {
949
- var _a;
950
- const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
951
- if (propValue) {
952
- const cssString = await embedResources(propValue, null, options);
953
- node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
954
- return true;
955
- }
956
- return false;
957
- }
958
- async function embedBackground(clonedNode, options) {
959
- if (!await embedProp("background", clonedNode, options)) {
960
- await embedProp("background-image", clonedNode, options);
961
- }
962
- if (!await embedProp("mask", clonedNode, options)) {
963
- await embedProp("mask-image", clonedNode, options);
964
- }
965
- }
966
- async function embedImageNode(clonedNode, options) {
967
- const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
968
- if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
969
- return;
970
- }
971
- const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
972
- const dataURL = await resourceToDataURL(url, getMimeType(url), options);
973
- await new Promise((resolve, reject) => {
974
- clonedNode.onload = resolve;
975
- clonedNode.onerror = reject;
976
- const image = clonedNode;
977
- if (image.decode) {
978
- image.decode = resolve;
979
- }
980
- if (image.loading === "lazy") {
981
- image.loading = "eager";
982
- }
983
- if (isImageElement) {
984
- clonedNode.srcset = "";
985
- clonedNode.src = dataURL;
986
- } else {
987
- clonedNode.href.baseVal = dataURL;
988
- }
989
- });
990
- }
991
- async function embedChildren(clonedNode, options) {
992
- const children = toArray(clonedNode.childNodes);
993
- const deferreds = children.map((child) => embedImages(child, options));
994
- await Promise.all(deferreds).then(() => clonedNode);
995
- }
996
- async function embedImages(clonedNode, options) {
997
- if (isInstanceOfElement(clonedNode, Element)) {
998
- await embedBackground(clonedNode, options);
999
- await embedImageNode(clonedNode, options);
1000
- await embedChildren(clonedNode, options);
1001
- }
1002
- }
1003
-
1004
- // ../../node_modules/html-to-image/es/apply-style.js
1005
- function applyStyle(node, options) {
1006
- const { style } = node;
1007
- if (options.backgroundColor) {
1008
- style.backgroundColor = options.backgroundColor;
1009
- }
1010
- if (options.width) {
1011
- style.width = `${options.width}px`;
1012
- }
1013
- if (options.height) {
1014
- style.height = `${options.height}px`;
1015
- }
1016
- const manual = options.style;
1017
- if (manual != null) {
1018
- Object.keys(manual).forEach((key) => {
1019
- style[key] = manual[key];
1020
- });
1021
- }
1022
- return node;
1023
- }
1024
-
1025
- // ../../node_modules/html-to-image/es/embed-webfonts.js
1026
- var cssFetchCache = {};
1027
- async function fetchCSS(url) {
1028
- let cache2 = cssFetchCache[url];
1029
- if (cache2 != null) {
1030
- return cache2;
1031
- }
1032
- const res = await fetch(url);
1033
- const cssText = await res.text();
1034
- cache2 = { url, cssText };
1035
- cssFetchCache[url] = cache2;
1036
- return cache2;
1037
- }
1038
- async function embedFonts(data, options) {
1039
- let cssText = data.cssText;
1040
- const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
1041
- const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
1042
- const loadFonts = fontLocs.map(async (loc) => {
1043
- let url = loc.replace(regexUrl, "$1");
1044
- if (!url.startsWith("https://")) {
1045
- url = new URL(url, data.url).href;
1046
- }
1047
- return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
1048
- cssText = cssText.replace(loc, `url(${result})`);
1049
- return [loc, result];
1050
- });
1051
- });
1052
- return Promise.all(loadFonts).then(() => cssText);
1053
- }
1054
- function parseCSS(source) {
1055
- if (source == null) {
1056
- return [];
1057
- }
1058
- const result = [];
1059
- const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
1060
- let cssText = source.replace(commentsRegex, "");
1061
- const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
1062
- while (true) {
1063
- const matches = keyframesRegex.exec(cssText);
1064
- if (matches === null) {
1065
- break;
1066
- }
1067
- result.push(matches[0]);
1068
- }
1069
- cssText = cssText.replace(keyframesRegex, "");
1070
- const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
1071
- const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
1072
- const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
1073
- while (true) {
1074
- let matches = importRegex.exec(cssText);
1075
- if (matches === null) {
1076
- matches = unifiedRegex.exec(cssText);
1077
- if (matches === null) {
1078
- break;
1079
- } else {
1080
- importRegex.lastIndex = unifiedRegex.lastIndex;
1081
- }
1082
- } else {
1083
- unifiedRegex.lastIndex = importRegex.lastIndex;
1084
- }
1085
- result.push(matches[0]);
1086
- }
1087
- return result;
1088
- }
1089
- async function getCSSRules(styleSheets, options) {
1090
- const ret = [];
1091
- const deferreds = [];
1092
- styleSheets.forEach((sheet) => {
1093
- if ("cssRules" in sheet) {
1094
- try {
1095
- toArray(sheet.cssRules || []).forEach((item, index) => {
1096
- if (item.type === CSSRule.IMPORT_RULE) {
1097
- let importIndex = index + 1;
1098
- const url = item.href;
1099
- const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
1100
- try {
1101
- sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
1102
- } catch (error2) {
1103
- console.error("Error inserting rule from remote css", {
1104
- rule,
1105
- error: error2
1106
- });
1107
- }
1108
- })).catch((e) => {
1109
- console.error("Error loading remote css", e.toString());
1110
- });
1111
- deferreds.push(deferred);
1112
- }
1113
- });
1114
- } catch (e) {
1115
- const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
1116
- if (sheet.href != null) {
1117
- deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
1118
- inline.insertRule(rule, sheet.cssRules.length);
1119
- })).catch((err) => {
1120
- console.error("Error loading remote stylesheet", err);
1121
- }));
1122
- }
1123
- console.error("Error inlining remote css file", e);
1124
- }
1125
- }
1126
- });
1127
- return Promise.all(deferreds).then(() => {
1128
- styleSheets.forEach((sheet) => {
1129
- if ("cssRules" in sheet) {
1130
- try {
1131
- toArray(sheet.cssRules || []).forEach((item) => {
1132
- ret.push(item);
1133
- });
1134
- } catch (e) {
1135
- console.error(`Error while reading CSS rules from ${sheet.href}`, e);
1136
- }
1137
- }
1138
- });
1139
- return ret;
1140
- });
1141
- }
1142
- function getWebFontRules(cssRules) {
1143
- return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
1144
- }
1145
- async function parseWebFontRules(node, options) {
1146
- if (node.ownerDocument == null) {
1147
- throw new Error("Provided element is not within a Document");
1148
- }
1149
- const styleSheets = toArray(node.ownerDocument.styleSheets);
1150
- const cssRules = await getCSSRules(styleSheets, options);
1151
- return getWebFontRules(cssRules);
1152
- }
1153
- async function getWebFontCSS(node, options) {
1154
- const rules = await parseWebFontRules(node, options);
1155
- const cssTexts = await Promise.all(rules.map((rule) => {
1156
- const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
1157
- return embedResources(rule.cssText, baseUrl, options);
1158
- }));
1159
- return cssTexts.join("\n");
1160
- }
1161
- async function embedWebFonts(clonedNode, options) {
1162
- const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
1163
- if (cssText) {
1164
- const styleNode = document.createElement("style");
1165
- const sytleContent = document.createTextNode(cssText);
1166
- styleNode.appendChild(sytleContent);
1167
- if (clonedNode.firstChild) {
1168
- clonedNode.insertBefore(styleNode, clonedNode.firstChild);
1169
- } else {
1170
- clonedNode.appendChild(styleNode);
1171
- }
1172
- }
1173
- }
1174
-
1175
- // ../../node_modules/html-to-image/es/index.js
1176
- async function toSvg(node, options = {}) {
1177
- const { width, height } = getImageSize(node, options);
1178
- const clonedNode = await cloneNode(node, options, true);
1179
- await embedWebFonts(clonedNode, options);
1180
- await embedImages(clonedNode, options);
1181
- applyStyle(clonedNode, options);
1182
- const datauri = await nodeToDataURL(clonedNode, width, height);
1183
- return datauri;
1184
- }
1185
- async function toCanvas(node, options = {}) {
1186
- const { width, height } = getImageSize(node, options);
1187
- const svg = await toSvg(node, options);
1188
- const img = await createImage(svg);
1189
- const canvas = document.createElement("canvas");
1190
- const context = canvas.getContext("2d");
1191
- const ratio = options.pixelRatio || getPixelRatio();
1192
- const canvasWidth = options.canvasWidth || width;
1193
- const canvasHeight = options.canvasHeight || height;
1194
- canvas.width = canvasWidth * ratio;
1195
- canvas.height = canvasHeight * ratio;
1196
- if (!options.skipAutoScale) {
1197
- checkCanvasDimensions(canvas);
1198
- }
1199
- canvas.style.width = `${canvasWidth}`;
1200
- canvas.style.height = `${canvasHeight}`;
1201
- if (options.backgroundColor) {
1202
- context.fillStyle = options.backgroundColor;
1203
- context.fillRect(0, 0, canvas.width, canvas.height);
1204
- }
1205
- context.drawImage(img, 0, 0, canvas.width, canvas.height);
1206
- return canvas;
1207
- }
1208
- async function toPng(node, options = {}) {
1209
- const canvas = await toCanvas(node, options);
1210
- return canvas.toDataURL();
1211
- }
1212
-
1213
- // src/layout-management/screenshot-utils.ts
1214
- var takeScreenshot = (node) => {
1215
- return new Promise((resolve, reject) => {
1216
- toPng(node, {
1217
- cacheBust: true
1218
- }).then((screenshot) => {
1219
- if (!screenshot) {
1220
- reject(new Error("No Screenshot available"));
1221
- }
1222
- resolve(screenshot);
1223
- }).catch((error2) => {
1224
- console.error(
1225
- "the following error occurred while taking a screenshot of a DOMNode",
1226
- error2
1227
- );
1228
- reject(new Error("Error taking screenshot"));
1229
- });
1230
- });
1231
- };
1232
-
1233
- // src/layout-management/SaveLayoutPanel.tsx
1234
- import { Button as Button3, FormField as FormField2, FormFieldLabel as FormFieldLabel2, Input, Text } from "@salt-ds/core";
1235
- import { useEffect as useEffect4, useMemo as useMemo2, useState as useState3 } from "react";
1236
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1237
- var classBase3 = "saveLayoutPanel";
1238
- var formField = `${classBase3}-formField`;
1239
- var groups = ["Group 1", "Group 2", "Group 3", "Group 4", "Group 5"];
1240
- var checkboxValues = ["Value 1", "Value 2", "Value 3"];
1241
- var radioValues = ["Value 1", "Value 2", "Value 3"];
1242
- var SaveLayoutPanel = (props) => {
1243
- const { defaultTitle = "", onCancel, onSave, componentId } = props;
1244
- const [layoutName, setLayoutName] = useState3(defaultTitle);
1245
- const [group, setGroup] = useState3("");
1246
- const [checkValues, setCheckValues] = useState3([]);
1247
- const [radioValue, setRadioValue] = useState3(radioValues[0]);
1248
- const [screenshot, setScreenshot] = useState3();
1249
- const [screenshotErrorMessage, setScreenshotErrorMessage] = useState3();
1250
- const [username] = getAuthDetailsFromCookies();
1251
- useEffect4(() => {
1252
- if (componentId) {
1253
- takeScreenshot(document.getElementById(componentId)).then((screenshot2) => {
1254
- setScreenshot(screenshot2);
1255
- }).catch((error2) => {
1256
- setScreenshotErrorMessage(error2.message);
1257
- });
1258
- }
1259
- }, [componentId]);
1260
- const handleSubmit = () => {
1261
- onSave({
1262
- name: layoutName,
1263
- group,
1264
- screenshot: screenshot != null ? screenshot : "",
1265
- user: username
1266
- });
1267
- };
1268
- const screenshotContent = useMemo2(() => {
1269
- if (screenshot) {
1270
- return /* @__PURE__ */ jsx8(
1271
- "img",
1272
- {
1273
- className: `${classBase3}-screenshot`,
1274
- src: screenshot,
1275
- alt: "screenshot of current layout"
1276
- }
1277
- );
1278
- }
1279
- if (screenshotErrorMessage) {
1280
- return /* @__PURE__ */ jsx8(Text, { children: screenshotErrorMessage });
1281
- }
1282
- return /* @__PURE__ */ jsx8("div", { className: "spinner" });
1283
- }, [screenshot, screenshotErrorMessage]);
1284
- return /* @__PURE__ */ jsxs6("div", { className: `${classBase3}-panelContainer`, children: [
1285
- /* @__PURE__ */ jsxs6("div", { className: `${classBase3}-panelContent`, children: [
1286
- /* @__PURE__ */ jsxs6("div", { className: `${classBase3}-formContainer`, children: [
1287
- /* @__PURE__ */ jsxs6(FormField2, { className: formField, children: [
1288
- /* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Group" }),
1289
- /* @__PURE__ */ jsx8(
1290
- ComboBox,
1291
- {
1292
- source: groups,
1293
- allowFreeText: true,
1294
- InputProps: {
1295
- inputProps: {
1296
- className: `${classBase3}-inputText`,
1297
- placeholder: "Select Group or Enter New Name",
1298
- onChange: (event) => setGroup(event.target.value)
1299
- }
1300
- },
1301
- width: "100%",
1302
- onSelectionChange: (_, value) => setGroup(value || "")
1303
- }
1304
- )
1305
- ] }),
1306
- /* @__PURE__ */ jsxs6(FormField2, { className: formField, children: [
1307
- /* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Layout Name" }),
1308
- /* @__PURE__ */ jsx8(
1309
- Input,
1310
- {
1311
- inputProps: {
1312
- className: `${classBase3}-inputText`,
1313
- placeholder: "Enter Layout Name"
1314
- },
1315
- onChange: (event) => setLayoutName(event.target.value),
1316
- value: layoutName
1317
- }
1318
- )
1319
- ] }),
1320
- /* @__PURE__ */ jsxs6(FormField2, { className: formField, children: [
1321
- /* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Some Layout Setting" }),
1322
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-settingsGroup`, children: checkboxValues.map((value, i) => /* @__PURE__ */ jsx8(
1323
- Checkbox,
1324
- {
1325
- onToggle: () => setCheckValues(
1326
- (prev) => prev.includes(value) ? prev.filter((entry) => entry !== value) : [...prev, value]
1327
- ),
1328
- checked: checkValues.includes(value),
1329
- label: value
1330
- },
1331
- i
1332
- )) })
1333
- ] }),
1334
- /* @__PURE__ */ jsxs6(FormField2, { className: formField, children: [
1335
- /* @__PURE__ */ jsx8(FormFieldLabel2, { children: "Some Layout Setting" }),
1336
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-settingsGroup`, children: radioValues.map((value, i) => /* @__PURE__ */ jsx8(
1337
- RadioButton,
1338
- {
1339
- onClick: () => setRadioValue(value),
1340
- checked: radioValue === value,
1341
- label: value,
1342
- groupName: "radioGroup"
1343
- },
1344
- i
1345
- )) })
1346
- ] })
1347
- ] }),
1348
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-screenshotContainer`, children: screenshotContent })
1349
- ] }),
1350
- /* @__PURE__ */ jsxs6("div", { className: `${classBase3}-buttonsContainer`, children: [
1351
- /* @__PURE__ */ jsx8(Button3, { className: `${classBase3}-cancelButton`, onClick: onCancel, children: "Cancel" }),
1352
- /* @__PURE__ */ jsx8(
1353
- Button3,
1354
- {
1355
- className: `${classBase3}-saveButton`,
1356
- onClick: handleSubmit,
1357
- disabled: layoutName === "" || group === "",
1358
- children: "Save"
1359
- }
1360
- )
1361
- ] })
1362
- ] });
1363
- };
1364
-
1365
- // src/layout-management/LayoutList.tsx
1366
- import { List } from "@vuu-ui/vuu-ui-controls";
1367
-
1368
- // src/layout-management/useLayoutManager.tsx
1369
- import React5, {
1370
- useCallback as useCallback9,
1371
- useContext as useContext2,
1372
- useEffect as useEffect6,
1373
- useRef as useRef4,
1374
- useState as useState7
1375
- } from "react";
1376
- import {
1377
- resolveJSONPath,
1378
- isLayoutJSON
1379
- } from "@vuu-ui/vuu-layout";
1380
-
1381
- // ../vuu-popups/src/dialog/Dialog.tsx
1382
- import cx5 from "clsx";
1383
- import { useThemeAttributes } from "@vuu-ui/vuu-utils";
1384
- import { useCallback as useCallback4, useLayoutEffect as useLayoutEffect2, useRef as useRef3 } from "react";
1385
-
1386
- // ../vuu-popups/src/dialog-header/DialogHeader.tsx
1387
- import { Button as Button4, Text as Text2 } from "@salt-ds/core";
1388
- import cx4 from "clsx";
1389
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1390
- var classBase4 = "vuuDialogHeader";
1391
- var DialogHeader = ({
1392
- hideCloseButton = false,
1393
- title,
1394
- onClose,
1395
- ...htmlAttributes
1396
- }) => {
1397
- return /* @__PURE__ */ jsxs7("div", { ...htmlAttributes, className: cx4(classBase4, "vuuToolbarProxy"), children: [
1398
- /* @__PURE__ */ jsx9(Text2, { className: "dialogHeader", children: title }),
1399
- !hideCloseButton && /* @__PURE__ */ jsx9(
1400
- Button4,
1401
- {
1402
- onClick: onClose,
1403
- "data-align": "end",
1404
- "data-icon": "close",
1405
- variant: "secondary"
1406
- },
1407
- "close"
1408
- )
1409
- ] });
1410
- };
1411
-
1412
- // ../vuu-popups/src/popup/useAnchoredPosition.ts
1413
- import { useCallback as useCallback3, useLayoutEffect, useRef as useRef2, useState as useState4 } from "react";
1414
-
1415
- // ../vuu-popups/src/popup/getPositionRelativeToAnchor.ts
1416
- var getPositionRelativeToAnchor = (anchorElement, placement, offsetLeft, offsetTop, minWidth, dimensions) => {
1417
- const { bottom, height, left, right, top, width } = anchorElement.getBoundingClientRect();
1418
- switch (placement) {
1419
- case "below":
1420
- return { left: left + offsetLeft, top: bottom + offsetTop };
1421
- case "right":
1422
- return { left: right + offsetLeft, top: top + offsetTop };
1423
- case "below-center":
1424
- return { left: left + width / 2 + offsetLeft, top: bottom + offsetTop };
1425
- case "below-right":
1426
- return { left, minWidth, top: bottom + offsetTop };
1427
- case "below-full-width":
1428
- return {
1429
- left: left + offsetLeft,
1430
- minWidth,
1431
- top: bottom + offsetTop,
1432
- width
1433
- };
1434
- case "center":
1435
- if (dimensions) {
1436
- return {
1437
- left: width / 2 - dimensions.width / 2 + offsetLeft,
1438
- top: height / 2 - dimensions.height / 2 + offsetTop,
1439
- visibility: "visible"
1440
- };
1441
- } else {
1442
- return {
1443
- left: width / 2 + offsetLeft,
1444
- top: height / 2 + offsetTop,
1445
- visibility: "hidden"
1446
- };
1447
- }
1448
- default:
1449
- throw Error(
1450
- `Popup getPositionRelativeToAnchor non-supported placement value ${placement}`
1451
- );
1452
- }
1453
- };
1454
-
1455
- // ../vuu-popups/src/popup/useAnchoredPosition.ts
1456
- var useAnchoredPosition = ({
1457
- anchorElement,
1458
- minWidth,
1459
- offsetLeft = 0,
1460
- offsetTop = 0,
1461
- placement,
1462
- position: positionProp
1463
- }) => {
1464
- const popupRef = useRef2(null);
1465
- const [position, setPosition] = useState4(positionProp);
1466
- useLayoutEffect(() => {
1467
- if (placement === "absolute" && positionProp) {
1468
- setPosition(positionProp);
1469
- } else if (anchorElement.current && placement !== "auto") {
1470
- const dimensions = popupRef.current === null ? void 0 : popupRef.current.getBoundingClientRect();
1471
- const position2 = getPositionRelativeToAnchor(
1472
- anchorElement.current,
1473
- placement,
1474
- offsetLeft,
1475
- offsetTop,
1476
- minWidth,
1477
- dimensions
1478
- );
1479
- setPosition(position2);
1480
- }
1481
- }, [anchorElement, minWidth, offsetLeft, offsetTop, placement, positionProp]);
1482
- const popupCallbackRef = useCallback3(
1483
- (el) => {
1484
- popupRef.current = el;
1485
- if (el && placement === "center" && anchorElement.current) {
1486
- const { height, width } = el.getBoundingClientRect();
1487
- setPosition(
1488
- getPositionRelativeToAnchor(
1489
- anchorElement.current,
1490
- placement,
1491
- offsetLeft,
1492
- offsetTop,
1493
- void 0,
1494
- { height, width }
1495
- )
1496
- );
1497
- }
1498
- },
1499
- [anchorElement, offsetLeft, offsetTop, placement]
1500
- );
1501
- return {
1502
- position,
1503
- popupRef: placement === "center" ? popupCallbackRef : void 0
1504
- };
1505
- };
1506
-
1507
- // ../vuu-popups/src/dialog/Dialog.tsx
1508
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1509
- var classBase5 = "vuuDialog";
1510
- var AnchorBody = { current: document.body };
1511
- var EMPTY_PROPS = {};
1512
- var Dialog = ({
1513
- PopupProps = EMPTY_PROPS,
1514
- children,
1515
- className,
1516
- isOpen = false,
1517
- onClose,
1518
- style,
1519
- title,
1520
- hideCloseButton = false,
1521
- ...htmlAttributes
1522
- }) => {
1523
- const {
1524
- anchorElement = AnchorBody,
1525
- offsetLeft = 0,
1526
- offsetTop = 0,
1527
- placement = "auto"
1528
- } = PopupProps;
1529
- const rootRef = useRef3(null);
1530
- const portalRef = useRef3(null);
1531
- const [themeClass, _, dataMode] = useThemeAttributes();
1532
- const { position } = useAnchoredPosition({
1533
- anchorElement,
1534
- offsetLeft,
1535
- offsetTop,
1536
- placement
1537
- });
1538
- const close = useCallback4(() => {
1539
- onClose == null ? void 0 : onClose();
1540
- }, [onClose]);
1541
- useLayoutEffect2(() => {
1542
- if (rootRef.current) {
1543
- if (isOpen) {
1544
- rootRef.current.showModal();
1545
- const { left, top } = rootRef.current.getBoundingClientRect();
1546
- if (portalRef.current) {
1547
- portalRef.current.style.cssText = `left:-${left}px;position:absolute;top:-${top}px;`;
1548
- }
1549
- } else {
1550
- rootRef.current.close();
1551
- }
1552
- if (placement.endsWith("center")) {
1553
- const { width } = rootRef.current.getBoundingClientRect();
1554
- rootRef.current.style.marginLeft = `-${width / 2}px`;
1555
- }
1556
- }
1557
- }, [isOpen, placement]);
1558
- return /* @__PURE__ */ jsxs8(
1559
- "dialog",
1560
- {
1561
- ...htmlAttributes,
1562
- className: cx5(classBase5, themeClass),
1563
- "data-mode": dataMode,
1564
- onClose: close,
1565
- id: "vuu-dialog",
1566
- ref: rootRef,
1567
- style: { ...style, ...position },
1568
- children: [
1569
- /* @__PURE__ */ jsx10(
1570
- DialogHeader,
1571
- {
1572
- hideCloseButton,
1573
- onClose: close,
1574
- title
1575
- }
1576
- ),
1577
- /* @__PURE__ */ jsx10("div", { className: `${classBase5}-body`, children }),
1578
- /* @__PURE__ */ jsx10("div", { id: "vuu-dialog-portal-root", ref: portalRef })
1579
- ]
1580
- }
1581
- );
1582
- };
1583
-
1584
- // ../vuu-popups/src/dialog/useDialog.tsx
1585
- import { useCallback as useCallback5, useState as useState5 } from "react";
1586
- import { jsx as jsx11 } from "react/jsx-runtime";
1587
- var useDialog = () => {
1588
- const [dialogState, setDialogState] = useState5();
1589
- const handleClose = useCallback5(() => {
1590
- setDialogState(void 0);
1591
- }, []);
1592
- const dialog = dialogState ? /* @__PURE__ */ jsx11(
1593
- Dialog,
1594
- {
1595
- className: "vuDialog",
1596
- isOpen: true,
1597
- onClose: handleClose,
1598
- style: { maxHeight: 500 },
1599
- title: dialogState.title,
1600
- hideCloseButton: dialogState.hideCloseButton,
1601
- children: dialogState.content
1602
- }
1603
- ) : null;
1604
- return {
1605
- dialog,
1606
- setDialogState
1607
- };
1608
- };
1609
-
1610
- // ../vuu-popups/src/menu/context-menu-provider.tsx
1611
- import { createContext, useCallback as useCallback6, useMemo as useMemo3 } from "react";
1612
- import { jsx as jsx12 } from "react/jsx-runtime";
1613
- var ContextMenuContext = createContext(
1614
- null
1615
- );
1616
- var Provider = ({
1617
- children,
1618
- context,
1619
- menuActionHandler,
1620
- menuBuilder
1621
- }) => {
1622
- const menuBuilders = useMemo3(() => {
1623
- if ((context == null ? void 0 : context.menuBuilders) && menuBuilder) {
1624
- return context.menuBuilders.concat(menuBuilder);
1625
- } else if (menuBuilder) {
1626
- return [menuBuilder];
1627
- } else {
1628
- return (context == null ? void 0 : context.menuBuilders) || [];
1629
- }
1630
- }, [context, menuBuilder]);
1631
- const handleMenuAction = useCallback6(
1632
- (reason) => {
1633
- var _a;
1634
- if (menuActionHandler == null ? void 0 : menuActionHandler(reason)) {
1635
- return true;
1636
- }
1637
- if ((_a = context == null ? void 0 : context.menuActionHandler) == null ? void 0 : _a.call(context, reason)) {
1638
- return true;
1639
- }
1640
- },
1641
- [context, menuActionHandler]
1642
- );
1643
- return /* @__PURE__ */ jsx12(
1644
- ContextMenuContext.Provider,
1645
- {
1646
- value: {
1647
- menuActionHandler: handleMenuAction,
1648
- menuBuilders
1649
- },
1650
- children
1651
- }
1652
- );
1653
- };
1654
- var ContextMenuProvider = ({
1655
- children,
1656
- label,
1657
- menuActionHandler,
1658
- menuBuilder
1659
- }) => {
1660
- return /* @__PURE__ */ jsx12(ContextMenuContext.Consumer, { children: (parentContext) => /* @__PURE__ */ jsx12(
1661
- Provider,
1662
- {
1663
- context: parentContext,
1664
- label,
1665
- menuActionHandler,
1666
- menuBuilder,
1667
- children
1668
- }
1669
- ) });
1670
- };
1671
-
1672
- // ../vuu-popups/src/notifications/NotificationsProvider.tsx
1673
- import React4, { useState as useState6, useContext, useCallback as useCallback7, useEffect as useEffect5 } from "react";
1674
- import classNames from "clsx";
1675
- import { getUniqueId } from "@vuu-ui/vuu-utils";
1676
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1677
- var NotificationsContext = React4.createContext({
1678
- notify: () => "have you forgotten to provide a NotificationProvider?"
1679
- });
1680
- var useNotifications = () => useContext(NotificationsContext);
1681
-
1682
- // src/persistence-management/defaultApplicationJson.ts
1683
- var loadingApplicationJson = {
1684
- layout: {
1685
- type: "Component",
1686
- id: "loading-main",
1687
- props: {}
1688
- }
1689
- };
1690
- var defaultApplicationJson = {
1691
- layout: {
1692
- type: "Stack",
1693
- id: "main-tabs",
1694
- props: {
1695
- className: "vuuShell-mainTabs",
1696
- TabstripProps: {
1697
- allowAddTab: true,
1698
- allowCloseTab: true,
1699
- allowRenameTab: true,
1700
- animateSelectionThumb: false,
1701
- location: "main-tab",
1702
- variant: "primary"
1703
- },
1704
- preserve: true,
1705
- active: 0
1706
- },
1707
- children: [
1708
- {
1709
- props: {
1710
- id: "tab1",
1711
- title: "Tab 1",
1712
- className: "vuuShell-Placeholder"
1713
- },
1714
- type: "Placeholder"
1715
- }
1716
- ]
1717
- }
1718
- };
1719
-
1720
- // src/persistence-management/LocalPersistenceManager.ts
1721
- import { getLocalEntity, saveLocalEntity } from "@vuu-ui/vuu-filters";
1722
- import { formatDate, getUniqueId as getUniqueId2 } from "@vuu-ui/vuu-utils";
1723
- var baseMetadataSaveLocation = "layouts/metadata";
1724
- var baseLayoutsSaveLocation = "layouts/layouts";
1725
- var _urlKey;
1726
- var LocalPersistenceManager = class {
1727
- constructor(urlKey) {
1728
- this.username = getAuthDetailsFromCookies()[0];
1729
- this.metadataSaveLocation = `${baseMetadataSaveLocation}/${this.username}`;
1730
- this.layoutsSaveLocation = `${baseLayoutsSaveLocation}/${this.username}`;
1731
- __privateAdd(this, _urlKey, `api/vui/${this.username}`);
1732
- this.loadLayouts = () => {
1733
- return new Promise((resolve) => {
1734
- const layouts = getLocalEntity(this.layoutsSaveLocation);
1735
- resolve(layouts || []);
1736
- });
1737
- };
1738
- this.saveLayoutsWithMetadata = (layouts, metadata) => {
1739
- saveLocalEntity(this.layoutsSaveLocation, layouts);
1740
- saveLocalEntity(this.metadataSaveLocation, metadata);
1741
- };
1742
- // Ensures that there is exactly one Layout entry and exactly one Metadata
1743
- // entry in local storage corresponding to the provided ID.
1744
- this.validateIds = async (id) => {
1745
- return Promise.all([
1746
- this.validateId(id, "metadata").catch((error2) => error2.message),
1747
- this.validateId(id, "layout").catch((error2) => error2.message)
1748
- ]).then((errorMessages) => {
1749
- const combinedMessage = errorMessages.filter((msg) => msg !== void 0).join("; ");
1750
- if (combinedMessage) {
1751
- throw new Error(combinedMessage);
1752
- }
1753
- });
1754
- };
1755
- // Ensures that there is exactly one element (Layout or Metadata) in local
1756
- // storage corresponding to the provided ID.
1757
- this.validateId = (id, dataType) => {
1758
- return new Promise((resolve, reject) => {
1759
- const loadFunc = dataType === "metadata" ? () => this.loadMetadata() : () => this.loadLayouts();
1760
- loadFunc().then((array) => {
1761
- const count = array.filter((element) => element.id === id).length;
1762
- switch (count) {
1763
- case 1: {
1764
- resolve();
1765
- break;
1766
- }
1767
- case 0: {
1768
- reject(new Error(`No ${dataType} with ID ${id}`));
1769
- break;
1770
- }
1771
- default:
1772
- reject(new Error(`Non-unique ${dataType} with ID ${id}`));
1773
- }
1774
- });
1775
- });
1776
- };
1777
- if (urlKey) {
1778
- __privateSet(this, _urlKey, urlKey);
1779
- }
1780
- }
1781
- createLayout(metadata, layout) {
1782
- return new Promise((resolve) => {
1783
- Promise.all([this.loadLayouts(), this.loadMetadata()]).then(
1784
- ([existingLayouts, existingMetadata]) => {
1785
- const id = getUniqueId2();
1786
- const newMetadata = {
1787
- ...metadata,
1788
- id,
1789
- created: formatDate({ date: "dd.mm.yyyy" })(/* @__PURE__ */ new Date())
1790
- };
1791
- this.saveLayoutsWithMetadata(
1792
- [...existingLayouts, { id, json: layout }],
1793
- [...existingMetadata, newMetadata]
1794
- );
1795
- resolve(newMetadata);
1796
- }
1797
- );
1798
- });
1799
- }
1800
- updateLayout(id, newMetadata, newLayout) {
1801
- return new Promise((resolve, reject) => {
1802
- this.validateIds(id).then(() => Promise.all([this.loadLayouts(), this.loadMetadata()])).then(([existingLayouts, existingMetadata]) => {
1803
- const updatedLayouts = existingLayouts.map(
1804
- (layout) => layout.id === id ? { ...layout, json: newLayout } : layout
1805
- );
1806
- const updatedMetadata = existingMetadata.map(
1807
- (metadata) => metadata.id === id ? { ...metadata, ...newMetadata } : metadata
1808
- );
1809
- this.saveLayoutsWithMetadata(updatedLayouts, updatedMetadata);
1810
- resolve();
1811
- }).catch((e) => reject(e));
1812
- });
1813
- }
1814
- deleteLayout(id) {
1815
- return new Promise((resolve, reject) => {
1816
- this.validateIds(id).then(() => Promise.all([this.loadLayouts(), this.loadMetadata()])).then(([existingLayouts, existingMetadata]) => {
1817
- const layouts = existingLayouts.filter((layout) => layout.id !== id);
1818
- const metadata = existingMetadata.filter(
1819
- (metadata2) => metadata2.id !== id
1820
- );
1821
- this.saveLayoutsWithMetadata(layouts, metadata);
1822
- resolve();
1823
- }).catch((e) => reject(e));
1824
- });
1825
- }
1826
- loadLayout(id) {
1827
- return new Promise((resolve, reject) => {
1828
- this.validateId(id, "layout").then(() => this.loadLayouts()).then((existingLayouts) => {
1829
- const foundLayout = existingLayouts.find(
1830
- (layout) => layout.id === id
1831
- );
1832
- if (foundLayout) {
1833
- resolve(foundLayout.json);
1834
- } else {
1835
- reject(new Error(`no layout found matching id ${id}`));
1836
- }
1837
- }).catch((e) => reject(e));
1838
- });
1839
- }
1840
- loadMetadata() {
1841
- return new Promise((resolve) => {
1842
- const metadata = getLocalEntity(
1843
- this.metadataSaveLocation
1844
- );
1845
- resolve(metadata || []);
1846
- });
1847
- }
1848
- loadApplicationJSON() {
1849
- return new Promise((resolve) => {
1850
- const applicationJSON = getLocalEntity(__privateGet(this, _urlKey));
1851
- if (applicationJSON) {
1852
- resolve(applicationJSON);
1853
- } else {
1854
- resolve(defaultApplicationJson);
1855
- }
1856
- });
1857
- }
1858
- saveApplicationJSON(applicationJSON) {
1859
- return new Promise((resolve, reject) => {
1860
- const savedLayout = saveLocalEntity(
1861
- __privateGet(this, _urlKey),
1862
- applicationJSON
1863
- );
1864
- if (savedLayout) {
1865
- resolve();
1866
- } else {
1867
- reject(new Error("Application Json failed to save"));
1868
- }
1869
- });
1870
- }
1871
- };
1872
- _urlKey = new WeakMap();
1873
-
1874
- // src/persistence-management/useLayoutContextMenuItems.tsx
1875
- import { useCallback as useCallback8, useMemo as useMemo4 } from "react";
1876
- import { jsx as jsx14 } from "react/jsx-runtime";
1877
- var useLayoutContextMenuItems = (setDialogState) => {
1878
- const { saveLayout } = useLayoutManager();
1879
- const handleCloseDialog = useCallback8(() => {
1880
- setDialogState(void 0);
1881
- }, [setDialogState]);
1882
- const handleSave = useCallback8(
1883
- (layoutMetadata) => {
1884
- saveLayout(layoutMetadata);
1885
- setDialogState(void 0);
1886
- },
1887
- [saveLayout, setDialogState]
1888
- );
1889
- const [buildMenuOptions, handleMenuAction] = useMemo4(() => {
1890
- return [
1891
- (location, options) => {
1892
- const locations = location.split(" ");
1893
- const menuDescriptors = [];
1894
- if (locations.includes("main-tab")) {
1895
- menuDescriptors.push(
1896
- {
1897
- label: "Save Layout",
1898
- action: "save-layout",
1899
- options
1900
- },
1901
- {
1902
- label: "Layout Settings",
1903
- action: "layout-settings",
1904
- options
1905
- }
1906
- );
1907
- }
1908
- return menuDescriptors;
1909
- },
1910
- (action) => {
1911
- var _a, _b;
1912
- console.log("menu action", {
1913
- action
1914
- });
1915
- if (action.menuId === "save-layout") {
1916
- setDialogState({
1917
- content: /* @__PURE__ */ jsx14(
1918
- SaveLayoutPanel,
1919
- {
1920
- onCancel: handleCloseDialog,
1921
- onSave: handleSave,
1922
- componentId: (_a = action.options) == null ? void 0 : _a.controlledComponentId,
1923
- defaultTitle: (_b = action.options) == null ? void 0 : _b.controlledComponentTitle
1924
- }
1925
- ),
1926
- title: "Save Layout",
1927
- hideCloseButton: true
1928
- });
1929
- return true;
1930
- }
1931
- return false;
1932
- }
1933
- ];
1934
- }, [handleCloseDialog, handleSave, setDialogState]);
1935
- return {
1936
- buildMenuOptions,
1937
- handleMenuAction
1938
- };
1939
- };
1940
-
1941
- // src/layout-management/useLayoutManager.tsx
1942
- import { jsx as jsx15 } from "react/jsx-runtime";
1943
- var _persistenceManager;
1944
- var getPersistenceManager = () => {
1945
- if (_persistenceManager === void 0) {
1946
- _persistenceManager = true ? new LocalPersistenceManager() : new RemotePersistenceManager();
1947
- }
1948
- return _persistenceManager;
1949
- };
1950
- var LayoutManagementContext = React5.createContext({
1951
- getApplicationSettings: () => void 0,
1952
- layoutMetadata: [],
1953
- saveLayout: () => void 0,
1954
- // The default Application JSON will be served if no LayoutManagementProvider
1955
- applicationJson: defaultApplicationJson,
1956
- saveApplicationLayout: () => void 0,
1957
- saveApplicationSettings: () => void 0,
1958
- loadLayoutById: () => void 0
1959
- });
1960
- var ensureLayoutHasTitle = (layout, layoutMetadata) => {
1961
- var _a;
1962
- if (((_a = layout.props) == null ? void 0 : _a.title) !== void 0) {
1963
- return layout;
1964
- } else {
1965
- return {
1966
- ...layout,
1967
- props: {
1968
- ...layout.props,
1969
- title: layoutMetadata.name
1970
- }
1971
- };
1972
- }
1973
- };
1974
- var LayoutManagementProvider = (props) => {
1975
- const [layoutMetadata, setLayoutMetadata] = useState7([]);
1976
- const [, forceRefresh] = useState7({});
1977
- const { notify } = useNotifications();
1978
- const applicationJSONRef = useRef4(loadingApplicationJson);
1979
- const setApplicationJSON = useCallback9(
1980
- (applicationJSON, rerender = true) => {
1981
- applicationJSONRef.current = applicationJSON;
1982
- if (rerender) {
1983
- forceRefresh({});
1984
- }
1985
- },
1986
- []
1987
- );
1988
- const setApplicationLayout = useCallback9(
1989
- (layout, rerender = true) => {
1990
- setApplicationJSON(
1991
- {
1992
- ...applicationJSONRef.current,
1993
- layout
1994
- },
1995
- rerender
1996
- );
1997
- },
1998
- [setApplicationJSON]
1999
- );
2000
- const setApplicationSettings = useCallback9(
2001
- (settings) => {
2002
- setApplicationJSON(
2003
- {
2004
- ...applicationJSONRef.current,
2005
- settings: {
2006
- ...applicationJSONRef.current.settings,
2007
- ...settings
2008
- }
2009
- },
2010
- false
2011
- );
2012
- },
2013
- [setApplicationJSON]
2014
- );
2015
- useEffect6(() => {
2016
- const persistenceManager = getPersistenceManager();
2017
- persistenceManager.loadMetadata().then((metadata) => {
2018
- setLayoutMetadata(metadata);
2019
- }).catch((error2) => {
2020
- notify({
2021
- type: "error" /* Error */,
2022
- header: "Failed to Load Layouts",
2023
- body: "Could not load list of available layouts"
2024
- });
2025
- console.error("Error occurred while retrieving metadata", error2);
2026
- });
2027
- persistenceManager.loadApplicationJSON().then((applicationJSON) => {
2028
- setApplicationJSON(applicationJSON);
2029
- }).catch((error2) => {
2030
- notify({
2031
- type: "error" /* Error */,
2032
- header: "Failed to Load Layout",
2033
- body: "Could not load your latest view"
2034
- });
2035
- console.error(
2036
- "Error occurred while retrieving application layout",
2037
- error2
2038
- );
2039
- });
2040
- }, [notify, setApplicationJSON]);
2041
- const saveApplicationLayout = useCallback9(
2042
- (layout) => {
2043
- if (isLayoutJSON(layout)) {
2044
- setApplicationLayout(layout, false);
2045
- getPersistenceManager().saveApplicationJSON(applicationJSONRef.current);
2046
- } else {
2047
- console.error("Tried to save invalid application layout", layout);
2048
- }
2049
- },
2050
- [setApplicationLayout]
2051
- );
2052
- const saveLayout = useCallback9(
2053
- (metadata) => {
2054
- const layoutToSave = resolveJSONPath(
2055
- applicationJSONRef.current.layout,
2056
- "#main-tabs.ACTIVE_CHILD"
2057
- );
2058
- if (layoutToSave && isLayoutJSON(layoutToSave)) {
2059
- getPersistenceManager().createLayout(metadata, ensureLayoutHasTitle(layoutToSave, metadata)).then((metadata2) => {
2060
- notify({
2061
- type: "success" /* Success */,
2062
- header: "Layout Saved Successfully",
2063
- body: `${metadata2.name} saved successfully`
2064
- });
2065
- setLayoutMetadata((prev) => [...prev, metadata2]);
2066
- }).catch((error2) => {
2067
- notify({
2068
- type: "error" /* Error */,
2069
- header: "Failed to Save Layout",
2070
- body: `Failed to save layout ${metadata.name}`
2071
- });
2072
- console.error("Error occurred while saving layout", error2);
2073
- });
2074
- } else {
2075
- console.error("Tried to save invalid layout", layoutToSave);
2076
- notify({
2077
- type: "error" /* Error */,
2078
- header: "Failed to Save Layout",
2079
- body: "Cannot save invalid layout"
2080
- });
2081
- }
2082
- },
2083
- [notify]
2084
- );
2085
- const saveApplicationSettings = useCallback9(
2086
- (settings, key) => {
2087
- const { settings: applicationSettings } = applicationJSONRef.current;
2088
- if (key) {
2089
- setApplicationSettings({
2090
- ...applicationSettings,
2091
- [key]: settings
2092
- });
2093
- } else {
2094
- setApplicationSettings(settings);
2095
- }
2096
- getPersistenceManager().saveApplicationJSON(applicationJSONRef.current);
2097
- },
2098
- [setApplicationSettings]
2099
- );
2100
- const getApplicationSettings = useCallback9(
2101
- (key) => {
2102
- const { settings } = applicationJSONRef.current;
2103
- return key ? settings == null ? void 0 : settings[key] : settings;
2104
- },
2105
- []
2106
- );
2107
- const loadLayoutById = useCallback9(
2108
- (id) => {
2109
- getPersistenceManager().loadLayout(id).then((layoutJson) => {
2110
- var _a, _b;
2111
- const { layout: currentLayout } = applicationJSONRef.current;
2112
- setApplicationLayout({
2113
- ...currentLayout,
2114
- children: (currentLayout.children || []).concat(layoutJson),
2115
- props: {
2116
- ...currentLayout.props,
2117
- active: (_b = (_a = currentLayout.children) == null ? void 0 : _a.length) != null ? _b : 0
2118
- }
2119
- });
2120
- }).catch((error2) => {
2121
- notify({
2122
- type: "error" /* Error */,
2123
- header: "Failed to Load Layout",
2124
- body: "Failed to load the requested layout"
2125
- });
2126
- console.error("Error occurred while loading layout", error2);
2127
- });
2128
- },
2129
- [notify, setApplicationLayout]
2130
- );
2131
- return /* @__PURE__ */ jsx15(
2132
- LayoutManagementContext.Provider,
2133
- {
2134
- value: {
2135
- getApplicationSettings,
2136
- layoutMetadata,
2137
- saveLayout,
2138
- applicationJson: applicationJSONRef.current,
2139
- saveApplicationLayout,
2140
- saveApplicationSettings,
2141
- loadLayoutById
2142
- },
2143
- children: props.children
2144
- }
2145
- );
2146
- };
2147
- var useLayoutManager = () => useContext2(LayoutManagementContext);
2148
-
2149
- // src/layout-management/LayoutTile.tsx
2150
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
2151
- var classBase6 = "vuuLayoutTile";
2152
- var LayoutTile = (props) => {
2153
- const { metadata, handleLoadLayout } = props;
2154
- return /* @__PURE__ */ jsx16("div", { role: "listitem", children: /* @__PURE__ */ jsxs10(
2155
- "div",
2156
- {
2157
- className: `${classBase6}-layoutTile`,
2158
- role: "button",
2159
- onClick: () => handleLoadLayout(metadata == null ? void 0 : metadata.id),
2160
- children: [
2161
- /* @__PURE__ */ jsx16("img", { className: `${classBase6}-screenshot`, src: metadata == null ? void 0 : metadata.screenshot }),
2162
- /* @__PURE__ */ jsxs10("div", { children: [
2163
- /* @__PURE__ */ jsx16("div", { className: `${classBase6}-layoutName`, children: metadata == null ? void 0 : metadata.name }),
2164
- /* @__PURE__ */ jsx16("div", { className: `${classBase6}-layoutDetails`, children: /* @__PURE__ */ jsx16("div", { children: `${metadata == null ? void 0 : metadata.user}, ${metadata == null ? void 0 : metadata.created}` }) })
2165
- ] })
2166
- ]
2167
- },
2168
- metadata == null ? void 0 : metadata.id
2169
- ) });
2170
- };
2171
-
2172
- // src/layout-management/LayoutList.tsx
2173
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2174
- var classBase7 = "vuuLayoutList";
2175
- var LayoutList = (props) => {
2176
- const { layoutMetadata, loadLayoutById } = useLayoutManager();
2177
- const handleLoadLayout = (layoutId) => {
2178
- if (layoutId) {
2179
- loadLayoutById(layoutId);
2180
- }
2181
- };
2182
- const layoutsByGroup = layoutMetadata.reduce((acc, cur) => {
2183
- if (acc[cur.group]) {
2184
- return {
2185
- ...acc,
2186
- [cur.group]: [...acc[cur.group], cur]
2187
- };
2188
- }
2189
- return {
2190
- ...acc,
2191
- [cur.group]: [cur]
2192
- };
2193
- }, {});
2194
- return /* @__PURE__ */ jsxs11(
2195
- "div",
2196
- {
2197
- className: classBase7,
2198
- ...props,
2199
- role: "listbox",
2200
- "aria-label": "my layouts",
2201
- children: [
2202
- /* @__PURE__ */ jsx17("div", { className: `${classBase7}-header`, children: "My Layouts" }),
2203
- /* @__PURE__ */ jsx17(
2204
- List,
2205
- {
2206
- height: "auto",
2207
- source: Object.entries(layoutsByGroup),
2208
- ListItem: ({ item }) => {
2209
- if (!item)
2210
- return /* @__PURE__ */ jsx17(Fragment3, {});
2211
- const [groupName, layoutMetadata2] = item;
2212
- return /* @__PURE__ */ jsxs11("div", { role: "list", "aria-label": groupName, children: [
2213
- /* @__PURE__ */ jsx17("div", { className: `${classBase7}-groupName`, children: groupName }),
2214
- layoutMetadata2.map((metadata) => /* @__PURE__ */ jsx17(
2215
- LayoutTile,
2216
- {
2217
- metadata,
2218
- handleLoadLayout
2219
- },
2220
- metadata.id
2221
- ))
2222
- ] });
2223
- }
2224
- }
2225
- )
2226
- ]
2227
- }
2228
- );
2229
- };
2230
-
2231
- // src/left-nav/LeftNav.tsx
2232
- import { VuuLogo as VuuLogo2 } from "@vuu-ui/vuu-icons";
2233
- import { Stack, useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
2234
- import { Tab, Tabstrip } from "@vuu-ui/vuu-ui-controls";
2235
- import { useThemeAttributes as useThemeAttributes2 } from "@vuu-ui/vuu-utils";
2236
- import cx6 from "clsx";
2237
- import { useCallback as useCallback10, useState as useState8 } from "react";
2238
-
2239
- // src/feature-list/FeatureList.tsx
2240
- import { Palette, PaletteItem } from "@vuu-ui/vuu-layout";
2241
- import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
2242
- var classBase8 = "vuuFeatureList";
2243
- var FeatureList = ({
2244
- features,
2245
- title = "VUU TABLES",
2246
- ...htmlAttributes
2247
- }) => {
2248
- const ViewProps2 = {};
2249
- const listProps = {
2250
- height: "100%"
2251
- };
2252
- return /* @__PURE__ */ jsxs12("div", { ...htmlAttributes, className: classBase8, children: [
2253
- /* @__PURE__ */ jsx18("div", { className: `${classBase8}-header`, children: title }),
2254
- /* @__PURE__ */ jsx18("div", { className: `${classBase8}-content`, children: /* @__PURE__ */ jsx18(
2255
- Palette,
2256
- {
2257
- orientation: "vertical",
2258
- ListProps: listProps,
2259
- ViewProps: ViewProps2,
2260
- children: features.map((featureProps, i) => /* @__PURE__ */ jsx18(
2261
- PaletteItem,
2262
- {
2263
- closeable: true,
2264
- label: featureProps.title,
2265
- resizeable: true,
2266
- resize: "defer",
2267
- header: true,
2268
- children: /* @__PURE__ */ jsx18(Feature, { ...featureProps })
2269
- },
2270
- i
2271
- ))
2272
- }
2273
- ) })
2274
- ] });
2275
- };
2276
-
2277
- // src/left-nav/LeftNav.tsx
2278
- import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
2279
- var classBase9 = "vuuLeftNav";
2280
- var getDisplayStatus = (activeTabIndex, expanded) => {
2281
- if (activeTabIndex === 0) {
2282
- return expanded ? "menu-full" : "menu-icons";
2283
- } else {
2284
- return expanded ? "menu-full-content" : "menu-icons-content";
2285
- }
2286
- };
2287
- var LeftNav = (props) => {
2288
- const dispatch = useLayoutProviderDispatch();
2289
- const [themeClass] = useThemeAttributes2();
2290
- const {
2291
- "data-path": path,
2292
- defaultExpanded = true,
2293
- defaultActiveTabIndex = 0,
2294
- features,
2295
- onActiveChange,
2296
- onTogglePrimaryMenu,
2297
- sizeCollapsed = 80,
2298
- sizeContent = 300,
2299
- sizeExpanded = 240,
2300
- style: styleProp,
2301
- tableFeatures,
2302
- ...htmlAttributes
2303
- } = props;
2304
- const [navState, setNavState] = useState8({
2305
- activeTabIndex: defaultActiveTabIndex,
2306
- expanded: defaultExpanded
2307
- });
2308
- const getFullWidth = useCallback10(
2309
- (tabIndex, expanded) => {
2310
- if (tabIndex === 0) {
2311
- return expanded ? sizeExpanded : sizeCollapsed;
2312
- } else {
2313
- return expanded ? sizeExpanded + sizeContent : sizeCollapsed + sizeContent;
2314
- }
2315
- },
2316
- [sizeCollapsed, sizeContent, sizeExpanded]
2317
- );
2318
- const handleTabSelection = useCallback10(
2319
- (activeTabIndex) => {
2320
- const { activeTabIndex: currentIndex, expanded } = navState;
2321
- const newState = { activeTabIndex, expanded };
2322
- setNavState(newState);
2323
- if (activeTabIndex === 0 || currentIndex === 0) {
2324
- const width = getFullWidth(activeTabIndex, expanded);
2325
- dispatch({
2326
- type: "layout-resize",
2327
- path: "#vuu-side-panel",
2328
- size: width
2329
- });
2330
- }
2331
- onActiveChange == null ? void 0 : onActiveChange(activeTabIndex);
2332
- },
2333
- [dispatch, getFullWidth, navState, onActiveChange]
2334
- );
2335
- const displayStatus = getDisplayStatus(
2336
- navState.activeTabIndex,
2337
- navState.expanded
2338
- );
2339
- const toggleExpanded = useCallback10(() => {
2340
- const { activeTabIndex, expanded } = navState;
2341
- const primaryMenuExpanded = !expanded;
2342
- const newState = { activeTabIndex, expanded: primaryMenuExpanded };
2343
- setNavState(newState);
2344
- dispatch({
2345
- type: "layout-resize",
2346
- path: "#vuu-side-panel",
2347
- size: getFullWidth(activeTabIndex, primaryMenuExpanded)
2348
- });
2349
- onTogglePrimaryMenu == null ? void 0 : onTogglePrimaryMenu(primaryMenuExpanded);
2350
- }, [dispatch, getFullWidth, navState, onTogglePrimaryMenu]);
2351
- const style = {
2352
- ...styleProp,
2353
- "--nav-menu-collapsed-width": `${sizeCollapsed}px`,
2354
- "--nav-menu-expanded-width": `${sizeExpanded}px`,
2355
- "--nav-menu-content-width": `${sizeContent}px`
2356
- };
2357
- return /* @__PURE__ */ jsxs13(
2358
- "div",
2359
- {
2360
- ...htmlAttributes,
2361
- className: cx6(classBase9, `${classBase9}-${displayStatus}`),
2362
- style,
2363
- children: [
2364
- /* @__PURE__ */ jsxs13(
2365
- "div",
2366
- {
2367
- className: cx6(`${classBase9}-menu-primary`, themeClass),
2368
- "data-mode": "dark",
2369
- children: [
2370
- /* @__PURE__ */ jsx19("div", { className: "vuuLeftNav-logo", children: /* @__PURE__ */ jsx19(VuuLogo2, {}) }),
2371
- /* @__PURE__ */ jsx19("div", { className: `${classBase9}-main`, children: /* @__PURE__ */ jsxs13(
2372
- Tabstrip,
2373
- {
2374
- activeTabIndex: navState.activeTabIndex,
2375
- animateSelectionThumb: false,
2376
- className: `${classBase9}-Tabstrip`,
2377
- onActiveChange: handleTabSelection,
2378
- orientation: "vertical",
2379
- children: [
2380
- /* @__PURE__ */ jsx19(Tab, { "data-icon": "demo", label: "DEMO" }),
2381
- /* @__PURE__ */ jsx19(Tab, { "data-icon": "features", label: "VUU FEATURES" }),
2382
- /* @__PURE__ */ jsx19(Tab, { "data-icon": "tables", label: "VUU TABLES" }),
2383
- /* @__PURE__ */ jsx19(Tab, { "data-icon": "layouts", label: "MY LAYOUTS" })
2384
- ]
2385
- }
2386
- ) }),
2387
- /* @__PURE__ */ jsx19("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ jsx19(
2388
- "button",
2389
- {
2390
- className: cx6("vuuLeftNav-toggleButton", {
2391
- "vuuLeftNav-toggleButton-open": displayStatus.startsWith("menu-full"),
2392
- "vuuLeftNav-toggleButton-closed": displayStatus.startsWith("menu-icons")
2393
- }),
2394
- "data-icon": displayStatus.startsWith("menu-full") ? "chevron-left" : "chevron-right",
2395
- onClick: toggleExpanded
2396
- }
2397
- ) })
2398
- ]
2399
- }
2400
- ),
2401
- /* @__PURE__ */ jsxs13(
2402
- Stack,
2403
- {
2404
- active: navState.activeTabIndex - 1,
2405
- className: `${classBase9}-menu-secondary`,
2406
- showTabs: false,
2407
- children: [
2408
- /* @__PURE__ */ jsx19(FeatureList, { features, title: "VUU FEATURES" }),
2409
- /* @__PURE__ */ jsx19(FeatureList, { features: tableFeatures, title: "VUU TABLES" }),
2410
- /* @__PURE__ */ jsx19("div", { className: "vuuLeftNav-drawer", children: /* @__PURE__ */ jsx19(LayoutList, {}) })
2411
- ]
2412
- }
2413
- )
2414
- ]
2415
- }
2416
- );
2417
- };
2418
-
2419
- // src/session-editing-form/SessionEditingForm.tsx
2420
- import { VuuDataSource } from "@vuu-ui/vuu-data-remote";
2421
- import {
2422
- buildColumnMap,
2423
- hasAction,
2424
- isErrorResponse,
2425
- isValidNumber,
2426
- shallowEquals
2427
- } from "@vuu-ui/vuu-utils";
2428
- import { Button as Button5, useIdMemo } from "@salt-ds/core";
2429
- import cx7 from "clsx";
2430
- import {
2431
- useCallback as useCallback11,
2432
- useEffect as useEffect7,
2433
- useMemo as useMemo5,
2434
- useRef as useRef5,
2435
- useState as useState9
2436
- } from "react";
2437
- import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
2438
- var classBase10 = "vuuSessionEditingForm";
2439
- var getField = (fields, name) => {
2440
- const field = fields.find((f) => f.name === name);
2441
- if (field) {
2442
- return field;
2443
- } else {
2444
- throw Error(`SessionEditingForm, no field '${name}' found`);
2445
- }
2446
- };
2447
- var getFieldNameAndValue = (evt) => {
2448
- const {
2449
- dataset: { field },
2450
- value
2451
- } = evt.target;
2452
- if (field === void 0) {
2453
- throw Error("SessionEditingForm, form field has no field name");
2454
- }
2455
- return [field, value];
2456
- };
2457
- var Status = {
2458
- uninitialised: 0,
2459
- unchanged: 1,
2460
- changed: 2,
2461
- invalid: 3
2462
- };
2463
- function getTypedValue(value, type, throwIfUndefined = false) {
2464
- switch (type) {
2465
- case "int":
2466
- case "long": {
2467
- const typedValue = parseInt(value, 10);
2468
- if (isValidNumber(typedValue)) {
2469
- return typedValue;
2470
- } else if (throwIfUndefined) {
2471
- throw Error("SessionEditingForm getTypedValue");
2472
- } else {
2473
- return void 0;
2474
- }
2475
- }
2476
- case "double": {
2477
- const typedValue = parseFloat(value);
2478
- if (isValidNumber(typedValue)) {
2479
- return typedValue;
2480
- }
2481
- return void 0;
2482
- }
2483
- case "boolean":
2484
- return value === "true" ? true : false;
2485
- default:
2486
- return value;
2487
- }
2488
- }
2489
- var getDataSource = (dataSource, schema) => {
2490
- if (dataSource) {
2491
- return dataSource;
2492
- } else if (schema) {
2493
- return new VuuDataSource({
2494
- bufferSize: 0,
2495
- table: schema.table,
2496
- columns: schema.columns.map((col) => col.name)
2497
- });
2498
- } else {
2499
- throw Error(
2500
- "SessionEditingForm: either a DataSource or a TableSchema must be provided"
2501
- );
2502
- }
2503
- };
2504
- var SessionEditingForm = ({
2505
- className,
2506
- config: { fields, key: keyField },
2507
- dataSource: dataSourceProp,
2508
- id: idProp,
2509
- onClose,
2510
- schema,
2511
- ...htmlAttributes
2512
- }) => {
2513
- const [values, setValues] = useState9();
2514
- const [errorMessage, setErrorMessage] = useState9("");
2515
- const formContentRef = useRef5(null);
2516
- const initialDataRef = useRef5();
2517
- const dataStatusRef = useRef5(Status.uninitialised);
2518
- const dataSource = useMemo5(() => {
2519
- const applyServerData = (data) => {
2520
- if (columnMap) {
2521
- const values2 = {};
2522
- for (const column of dataSource.columns) {
2523
- values2[column] = data[columnMap[column]];
2524
- }
2525
- if (dataStatusRef.current === Status.uninitialised) {
2526
- dataStatusRef.current = Status.unchanged;
2527
- initialDataRef.current = values2;
2528
- }
2529
- setValues(values2);
2530
- }
2531
- };
2532
- const ds = getDataSource(dataSourceProp, schema);
2533
- const columnMap = buildColumnMap(ds.columns);
2534
- ds.subscribe({ range: { from: 0, to: 5 } }, (message) => {
2535
- if (message.type === "viewport-update" && message.rows) {
2536
- if (dataStatusRef.current === Status.uninitialised) {
2537
- applyServerData(message.rows[0]);
2538
- } else {
2539
- console.log("what do we do with server updates");
2540
- }
2541
- }
2542
- });
2543
- return ds;
2544
- }, [dataSourceProp, schema]);
2545
- const id = useIdMemo(idProp);
2546
- const handleChange = useCallback11(
2547
- (evt) => {
2548
- const [field, value] = getFieldNameAndValue(evt);
2549
- const { type } = getField(fields, field);
2550
- const typedValue = getTypedValue(value, type);
2551
- setValues((values2 = {}) => {
2552
- const newValues = {
2553
- ...values2,
2554
- [field]: typedValue
2555
- };
2556
- const notUpdated = shallowEquals(newValues, initialDataRef.current);
2557
- dataStatusRef.current = notUpdated ? Status.unchanged : typedValue !== void 0 ? Status.changed : Status.invalid;
2558
- return newValues;
2559
- });
2560
- },
2561
- [fields]
2562
- );
2563
- const handleBlur = useCallback11(
2564
- (evt) => {
2565
- const [field, value] = getFieldNameAndValue(evt);
2566
- const { type } = getField(fields, field);
2567
- const rowKey = values == null ? void 0 : values[keyField];
2568
- const typedValue = getTypedValue(value, type, true);
2569
- if (typeof rowKey === "string") {
2570
- dataSource.menuRpcCall({
2571
- rowKey,
2572
- field,
2573
- value: typedValue,
2574
- type: "VP_EDIT_CELL_RPC"
2575
- });
2576
- }
2577
- },
2578
- [dataSource, fields, keyField, values]
2579
- );
2580
- const applyAction = useCallback11(
2581
- (action) => {
2582
- if (typeof action === "object" && action !== null) {
2583
- if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
2584
- onClose();
2585
- }
2586
- }
2587
- },
2588
- [onClose]
2589
- );
2590
- const handleSubmit = useCallback11(async () => {
2591
- const response = await dataSource.menuRpcCall({
2592
- type: "VP_EDIT_SUBMIT_FORM_RPC"
2593
- });
2594
- if (isErrorResponse(response)) {
2595
- setErrorMessage(response.error);
2596
- } else if (hasAction(response)) {
2597
- applyAction(response.action);
2598
- }
2599
- }, [applyAction, dataSource]);
2600
- const handleKeyDown = useCallback11(
2601
- (evt) => {
2602
- if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
2603
- handleSubmit();
2604
- }
2605
- },
2606
- [handleSubmit]
2607
- );
2608
- const handleCancel = useCallback11(() => {
2609
- onClose();
2610
- }, [onClose]);
2611
- const getFormControl = (field) => {
2612
- var _a;
2613
- const value = String((_a = values == null ? void 0 : values[field.name]) != null ? _a : "");
2614
- if (field.readonly || field.name === keyField) {
2615
- return /* @__PURE__ */ jsx20("div", { className: `${classBase10}-fieldValue vuuReadOnly`, children: value });
2616
- } else {
2617
- return /* @__PURE__ */ jsx20(
2618
- "input",
2619
- {
2620
- className: `${classBase10}-fieldValue`,
2621
- "data-field": field.name,
2622
- onBlur: handleBlur,
2623
- onChange: handleChange,
2624
- type: "text",
2625
- value,
2626
- id: `${id}-input-${field.name}`
2627
- }
2628
- );
2629
- }
2630
- };
2631
- useEffect7(() => {
2632
- if (formContentRef.current) {
2633
- const firstInput = formContentRef.current.querySelector(
2634
- "input"
2635
- );
2636
- if (firstInput) {
2637
- setTimeout(() => {
2638
- firstInput.focus();
2639
- firstInput.select();
2640
- }, 100);
2641
- }
2642
- }
2643
- }, []);
2644
- useEffect7(() => {
2645
- return () => {
2646
- if (dataSource) {
2647
- dataSource.unsubscribe();
2648
- }
2649
- };
2650
- }, [dataSource]);
2651
- const isDirty = dataStatusRef.current === Status.changed;
2652
- return /* @__PURE__ */ jsxs14("div", { ...htmlAttributes, className: cx7(classBase10, className), children: [
2653
- errorMessage ? /* @__PURE__ */ jsx20(
2654
- "div",
2655
- {
2656
- className: `${classBase10}-errorBanner`,
2657
- "data-icon": "error",
2658
- title: errorMessage,
2659
- children: "Error, edit(s) not saved"
2660
- }
2661
- ) : void 0,
2662
- /* @__PURE__ */ jsx20(
2663
- "div",
2664
- {
2665
- className: `${classBase10}-content`,
2666
- ref: formContentRef,
2667
- onKeyDown: handleKeyDown,
2668
- children: fields.map((field) => {
2669
- var _a;
2670
- return /* @__PURE__ */ jsxs14("div", { className: `${classBase10}-field`, children: [
2671
- /* @__PURE__ */ jsx20(
2672
- "label",
2673
- {
2674
- className: cx7(`${classBase10}-fieldLabel`, {
2675
- [`${classBase10}-required`]: field.required
2676
- }),
2677
- htmlFor: `${id}-input-${field.name}`,
2678
- children: (_a = field == null ? void 0 : field.label) != null ? _a : field.description
2679
- }
2680
- ),
2681
- getFormControl(field)
2682
- ] }, field.name);
2683
- })
2684
- }
2685
- ),
2686
- /* @__PURE__ */ jsxs14("div", { className: `${classBase10}-buttonbar salt-theme salt-density-high`, children: [
2687
- /* @__PURE__ */ jsx20(
2688
- Button5,
2689
- {
2690
- type: "submit",
2691
- variant: "cta",
2692
- disabled: !isDirty,
2693
- onClick: handleSubmit,
2694
- children: "Submit"
2695
- }
2696
- ),
2697
- /* @__PURE__ */ jsx20(Button5, { variant: "secondary", onClick: handleCancel, children: "Cancel" })
2698
- ] })
2699
- ] });
2700
- };
2701
-
2702
- // src/shell.tsx
2703
- import { connectToServer } from "@vuu-ui/vuu-data-remote";
2704
- import {
2705
- DraggableLayout as DraggableLayout3,
2706
- LayoutProvider,
2707
- StackLayout
2708
- } from "@vuu-ui/vuu-layout";
2709
- import {
2710
- logger,
2711
- ThemeProvider,
2712
- useThemeAttributes as useThemeAttributes3
2713
- } from "@vuu-ui/vuu-utils";
2714
- import cx10 from "clsx";
2715
- import {
2716
- useCallback as useCallback14,
2717
- useEffect as useEffect8,
2718
- useRef as useRef7
2719
- } from "react";
2720
-
2721
- // src/shell-layouts/context-panel/ContextPanel.tsx
2722
- import { Button as Button6 } from "@salt-ds/core";
2723
- import cx8 from "clsx";
2724
- import { useCallback as useCallback12, useMemo as useMemo6 } from "react";
2725
- import {
2726
- layoutFromJson,
2727
- View,
2728
- useLayoutProviderDispatch as useLayoutProviderDispatch2
2729
- } from "@vuu-ui/vuu-layout";
2730
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2731
- var classBase11 = "vuuContextPanel";
2732
- var ContextPanel = ({
2733
- className: classNameProp,
2734
- expanded = false,
2735
- content: contentProp,
2736
- overlay = false,
2737
- title
2738
- }) => {
2739
- const dispatchLayoutAction = useLayoutProviderDispatch2();
2740
- const handleClose = useCallback12(() => {
2741
- dispatchLayoutAction({
2742
- path: "#context-panel",
2743
- propName: "expanded",
2744
- propValue: false,
2745
- type: "set-prop"
2746
- });
2747
- }, [dispatchLayoutAction]);
2748
- const className = cx8(classBase11, classNameProp, {
2749
- [`${classBase11}-expanded`]: expanded,
2750
- [`${classBase11}-inline`]: overlay !== true,
2751
- [`${classBase11}-overlay`]: overlay
2752
- });
2753
- const content = useMemo6(
2754
- () => contentProp && expanded ? layoutFromJson(contentProp, "context-0") : null,
2755
- [contentProp, expanded]
2756
- );
2757
- return /* @__PURE__ */ jsx21(
2758
- "div",
2759
- {
2760
- className: cx8(classBase11, className, {
2761
- [`${classBase11}-expanded`]: expanded
2762
- }),
2763
- children: /* @__PURE__ */ jsxs15(View, { className: `${classBase11}-inner`, header: false, id: "context-panel", children: [
2764
- /* @__PURE__ */ jsxs15("div", { className: `${classBase11}-header`, children: [
2765
- /* @__PURE__ */ jsx21("h2", { className: `${classBase11}-title`, children: title }),
2766
- /* @__PURE__ */ jsx21(
2767
- Button6,
2768
- {
2769
- className: `${classBase11}-close`,
2770
- "data-icon": "close",
2771
- onClick: handleClose,
2772
- variant: "secondary"
2773
- }
2774
- )
2775
- ] }),
2776
- /* @__PURE__ */ jsx21("div", { className: `${classBase11}-content`, children: content })
2777
- ] })
2778
- }
2779
- );
2780
- };
2781
-
2782
- // src/shell-layouts/useFullHeightLeftPanel.tsx
2783
- import { DraggableLayout, Flexbox } from "@vuu-ui/vuu-layout";
2784
-
2785
- // src/shell-layouts/side-panel/SidePanel.tsx
2786
- import { useMemo as useMemo7 } from "react";
2787
- import cx9 from "clsx";
2788
- import { jsx as jsx22 } from "react/jsx-runtime";
2789
- var classBase12 = "vuuShellSidePanel";
2790
- var SidePanel = ({
2791
- children,
2792
- open = true,
2793
- sizeClosed = 90,
2794
- sizeOpen = 200,
2795
- style: styleProp,
2796
- ...htmlAttributes
2797
- }) => {
2798
- const style = useMemo7(
2799
- () => ({
2800
- ...styleProp,
2801
- "--shell-left-nav-size": open ? `${sizeOpen}px` : `${sizeClosed}px`
2802
- }),
2803
- [open, sizeClosed, sizeOpen, styleProp]
2804
- );
2805
- return /* @__PURE__ */ jsx22("div", { ...htmlAttributes, className: cx9(classBase12), style, children });
2806
- };
2807
-
2808
- // src/shell-layouts/useFullHeightLeftPanel.tsx
2809
- import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
2810
- var useFullHeightLeftPanel = ({
2811
- appHeader,
2812
- LeftSidePanelProps
2813
- }) => {
2814
- return /* @__PURE__ */ jsxs16(
2815
- Flexbox,
2816
- {
2817
- className: "App",
2818
- style: {
2819
- flexDirection: "row",
2820
- height: "100%",
2821
- width: "100%"
2822
- },
2823
- children: [
2824
- /* @__PURE__ */ jsx23(SidePanel, { ...LeftSidePanelProps, id: "vuu-side-panel" }),
2825
- /* @__PURE__ */ jsxs16(
2826
- Flexbox,
2827
- {
2828
- className: "vuuShell-content",
2829
- style: { flex: 1, flexDirection: "column" },
2830
- children: [
2831
- appHeader,
2832
- /* @__PURE__ */ jsx23(DraggableLayout, { dropTarget: true, style: { flex: 1 } }, "main-content")
2833
- ]
2834
- }
2835
- ),
2836
- /* @__PURE__ */ jsx23(ContextPanel, { id: "context-panel", overlay: true })
2837
- ]
2838
- }
2839
- );
2840
- };
2841
-
2842
- // src/shell-layouts/useInlayLeftPanel.tsx
2843
- import {
2844
- DockLayout,
2845
- DraggableLayout as DraggableLayout2,
2846
- Drawer,
2847
- Flexbox as Flexbox2,
2848
- View as View2
2849
- } from "@vuu-ui/vuu-layout";
2850
- import { useCallback as useCallback13, useRef as useRef6, useState as useState10 } from "react";
2851
- import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
2852
- var useInlayLeftPanel = ({
2853
- appHeader,
2854
- LeftSidePanelProps
2855
- }) => {
2856
- const paletteView = useRef6(null);
2857
- const [open, setOpen] = useState10(true);
2858
- const handleDrawerClick = useCallback13(
2859
- (e) => {
2860
- var _a;
2861
- const target = e.target;
2862
- if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
2863
- setOpen(!open);
2864
- }
2865
- },
2866
- [open]
2867
- );
2868
- const getDrawers = useCallback13(
2869
- (leftSidePanel) => {
2870
- const drawers = [];
2871
- drawers.push(
2872
- /* @__PURE__ */ jsx24(
2873
- Drawer,
2874
- {
2875
- onClick: handleDrawerClick,
2876
- open,
2877
- position: "left",
2878
- inline: true,
2879
- peekaboo: true,
2880
- sizeOpen: 200,
2881
- toggleButton: "end",
2882
- children: /* @__PURE__ */ jsx24(
2883
- View2,
2884
- {
2885
- className: "vuuShell-palette",
2886
- id: "vw-app-palette",
2887
- ref: paletteView,
2888
- style: { height: "100%" },
2889
- children: leftSidePanel
2890
- },
2891
- "app-palette"
2892
- )
2893
- },
2894
- "left-panel"
2895
- )
2896
- );
2897
- return drawers;
2898
- },
2899
- [handleDrawerClick, open]
2900
- );
2901
- return /* @__PURE__ */ jsxs17(
2902
- Flexbox2,
2903
- {
2904
- className: "App",
2905
- style: { flexDirection: "column", height: "100%", width: "100%" },
2906
- children: [
2907
- appHeader,
2908
- /* @__PURE__ */ jsx24(DockLayout, { style: { flex: 1 }, children: getDrawers(LeftSidePanelProps == null ? void 0 : LeftSidePanelProps.children).concat(
2909
- /* @__PURE__ */ jsx24(
2910
- DraggableLayout2,
2911
- {
2912
- dropTarget: true,
2913
- style: { width: "100%", height: "100%" }
2914
- },
2915
- "main-content"
2916
- )
2917
- ) })
2918
- ]
2919
- }
2920
- );
2921
- };
2922
-
2923
- // src/shell-layouts/useShellLayout.ts
2924
- var useShellLayout = ({
2925
- leftSidePanelLayout = "inlay",
2926
- ...props
2927
- }) => {
2928
- const useLayoutHook = leftSidePanelLayout === "inlay" ? useInlayLeftPanel : useFullHeightLeftPanel;
2929
- return useLayoutHook(props);
2930
- };
2931
-
2932
- // src/shell.tsx
2933
- import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
2934
- if (typeof StackLayout !== "function") {
2935
- console.warn(
2936
- "StackLayout module not loaded, will be unsbale to deserialize from layout JSON"
2937
- );
2938
- }
2939
- var { error } = logger("Shell");
2940
- var defaultLeftSidePanel = {};
2941
- var Shell = ({
2942
- LayoutProps,
2943
- LeftSidePanelProps = defaultLeftSidePanel,
2944
- children,
2945
- className: classNameProp,
2946
- leftSidePanelLayout,
2947
- loginUrl,
2948
- saveLocation: _,
2949
- saveUrl,
2950
- serverUrl,
2951
- user,
2952
- ...htmlAttributes
2953
- }) => {
2954
- const rootRef = useRef7(null);
2955
- const { dialog, setDialogState } = useDialog();
2956
- const layoutId = useRef7("latest");
2957
- const { applicationJson, saveApplicationLayout, loadLayoutById } = useLayoutManager();
2958
- const { buildMenuOptions, handleMenuAction } = useLayoutContextMenuItems(setDialogState);
2959
- const handleLayoutChange = useCallback14(
2960
- (layout) => {
2961
- try {
2962
- saveApplicationLayout(layout);
2963
- } catch {
2964
- error == null ? void 0 : error("Failed to save layout");
2965
- }
2966
- },
2967
- [saveApplicationLayout]
2968
- );
2969
- const handleSwitchTheme = useCallback14((mode) => {
2970
- if (rootRef.current) {
2971
- rootRef.current.dataset.mode = mode;
2972
- }
2973
- }, []);
2974
- const handleNavigate = useCallback14(
2975
- (id) => {
2976
- layoutId.current = id;
2977
- loadLayoutById(id);
2978
- },
2979
- [loadLayoutById]
2980
- );
2981
- useEffect8(() => {
2982
- if (serverUrl && user.token) {
2983
- connectToServer({
2984
- authToken: user.token,
2985
- url: serverUrl,
2986
- username: user.username
2987
- });
2988
- }
2989
- }, [serverUrl, user.token, user.username]);
2990
- const [themeClass, densityClass, dataMode] = useThemeAttributes3();
2991
- const className = cx10("vuuShell", classNameProp, themeClass, densityClass);
2992
- const isLoading = applicationJson === loadingApplicationJson;
2993
- const shellLayout = useShellLayout({
2994
- LeftSidePanelProps,
2995
- leftSidePanelLayout,
2996
- appHeader: /* @__PURE__ */ jsx25(
2997
- AppHeader,
2998
- {
2999
- layoutId: layoutId.current,
3000
- loginUrl,
3001
- user,
3002
- onNavigate: handleNavigate,
3003
- onSwitchTheme: handleSwitchTheme
3004
- }
3005
- )
3006
- });
3007
- return isLoading ? null : /* @__PURE__ */ jsx25(ThemeProvider, { children: /* @__PURE__ */ jsxs18(
3008
- ContextMenuProvider,
3009
- {
3010
- menuActionHandler: handleMenuAction,
3011
- menuBuilder: buildMenuOptions,
3012
- children: [
3013
- /* @__PURE__ */ jsx25(
3014
- LayoutProvider,
3015
- {
3016
- ...LayoutProps,
3017
- layout: applicationJson.layout,
3018
- onLayoutChange: handleLayoutChange,
3019
- children: /* @__PURE__ */ jsx25(
3020
- DraggableLayout3,
3021
- {
3022
- className,
3023
- "data-mode": dataMode,
3024
- ref: rootRef,
3025
- ...htmlAttributes,
3026
- children: shellLayout
3027
- }
3028
- )
3029
- }
3030
- ),
3031
- children || dialog
3032
- ]
3033
- }
3034
- ) });
3035
- };
3036
-
3037
- // src/shellTypes.ts
3038
- var isWildcardSchema = (schema) => schema === "*";
3039
- var isTableSchema = (schema) => typeof schema === "object" && typeof schema.module === "string" && typeof schema.table === "string";
3040
-
3041
- // src/ShellContextProvider.tsx
3042
- import { createContext as createContext2, useContext as useContext3 } from "react";
3043
- import { jsx as jsx26 } from "react/jsx-runtime";
3044
- var defaultConfig = {};
3045
- var ShellContext = createContext2(defaultConfig);
3046
- var Provider2 = ({
3047
- children,
3048
- context,
3049
- inheritedContext
3050
- }) => {
3051
- const mergedContext = {
3052
- ...inheritedContext,
3053
- ...context
3054
- };
3055
- return /* @__PURE__ */ jsx26(ShellContext.Provider, { value: mergedContext, children });
3056
- };
3057
- var ShellContextProvider = ({
3058
- children,
3059
- value
3060
- }) => {
3061
- return /* @__PURE__ */ jsx26(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ jsx26(Provider2, { context: value, inheritedContext: context, children }) });
3062
- };
3063
- var useShellContext = () => {
3064
- return useContext3(ShellContext);
3065
- };
3066
-
3067
- // src/theme-switch/ThemeSwitch.tsx
3068
- import cx11 from "clsx";
3069
- import { ToggleButton, ToggleButtonGroup, useControlled } from "@salt-ds/core";
3070
- import { useCallback as useCallback15 } from "react";
3071
- import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
3072
- var classBase13 = "vuuThemeSwitch";
3073
- var ThemeSwitch = ({
3074
- className: classNameProp,
3075
- defaultMode: defaultModeProp,
3076
- mode: modeProp,
3077
- onChange,
3078
- ...htmlAttributes
3079
- }) => {
3080
- const [mode, setMode] = useControlled({
3081
- controlled: modeProp,
3082
- default: defaultModeProp != null ? defaultModeProp : "light",
3083
- name: "ThemeSwitch",
3084
- state: "mode"
3085
- });
3086
- const handleChangeSecondary = useCallback15(
3087
- (evt) => {
3088
- const { value } = evt.target;
3089
- setMode(value);
3090
- onChange(value);
3091
- },
3092
- [onChange, setMode]
3093
- );
3094
- const className = cx11(classBase13, classNameProp);
3095
- return /* @__PURE__ */ jsxs19(
3096
- ToggleButtonGroup,
3097
- {
3098
- className,
3099
- ...htmlAttributes,
3100
- onChange: handleChangeSecondary,
3101
- value: mode,
3102
- children: [
3103
- /* @__PURE__ */ jsx27(ToggleButton, { "aria-label": "alert", "data-icon": "light", value: "light" }),
3104
- /* @__PURE__ */ jsx27(ToggleButton, { "aria-label": "home", "data-icon": "dark", value: "dark" })
3105
- ]
3106
- }
3107
- );
3108
- };
3109
- export {
3110
- AppHeader,
3111
- ConnectionStatusIcon,
3112
- ContextPanel,
3113
- Feature,
3114
- FeatureList,
3115
- LayoutList,
3116
- LayoutManagementContext,
3117
- LayoutManagementProvider,
3118
- LeftNav,
3119
- LoginPanel,
3120
- SaveLayoutPanel,
3121
- SessionEditingForm,
3122
- Shell,
3123
- ShellContextProvider,
3124
- SidePanel,
3125
- ThemeSwitch,
3126
- getAuthDetailsFromCookies,
3127
- getAuthModeFromCookies,
3128
- isTableSchema,
3129
- isWildcardSchema,
3130
- logout,
3131
- redirectToLogin,
3132
- useLayoutManager,
3133
- useShellContext,
3134
- useShellLayout
3135
- };
1
+ var rt=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var ke=(e,t,o)=>(rt(e,t,"read from private field"),o?o.call(e):t.get(e)),it=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},st=(e,t,o,a)=>(rt(e,t,"write to private field"),a?a.call(e,o):t.set(e,o),o);import{useCallback as Io}from"react";import{Toolbar as Oo}from"@vuu-ui/vuu-ui-controls";import zo from"clsx";import{useCallback as lt,useEffect as Vo,useRef as Fo,useState as ct}from"react";import{Button as Ho,FormField as dt,FormFieldLabel as pt}from"@salt-ds/core";import{VuuInput as mt}from"@vuu-ui/vuu-ui-controls";import{useMemo as ko}from"react";import{jsx as P,jsxs as _}from"react/jsx-runtime";var ut=()=>ko(()=>_("svg",{width:"184",height:"90",viewBox:"0 0 184 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_("g",{clipPath:"url(#clip0_1173_59965)",children:[P("path",{d:"M77.0775 31.1019L69.4572 15.1795L66.3997 13.7093L47.6353 44.165L75.7224 61.2361L81.8124 51.2694L77.0775 31.1019Z",fill:"url(#paint0_linear_1173_59965)"}),P("path",{d:"M82.4101 49.7431C81.0488 51.8314 79.1993 53.648 76.8897 54.9809C74.2954 56.4792 71.4601 57.194 68.6623 57.194C63.3422 57.194 58.1597 54.6188 55.0209 49.971L30.5358 7.8193L30.5232 7.84116C25.8791 0.274825 16.0118 -2.26289 8.27258 2.21011C0.411306 6.74866 -2.26753 16.7872 2.28587 24.625L35.5054 81.8189C36.9856 84.3691 39.0542 86.3668 41.4358 87.7527C41.4545 87.7652 41.4733 87.7777 41.4921 87.7902C41.5015 87.7964 41.514 87.8027 41.5234 87.8089C42.6312 88.4457 43.8079 88.942 45.0253 89.3072C45.116 89.3353 45.2099 89.3634 45.3007 89.3883C45.7388 89.5101 46.1801 89.6193 46.6276 89.7067C46.7121 89.7223 46.7966 89.7317 46.8811 89.7473C47.241 89.8097 47.604 89.8628 47.967 89.9003C48.111 89.9159 48.2549 89.9315 48.3989 89.9408C48.8151 89.9752 49.2313 89.997 49.6507 90.0001C49.6726 90.0001 49.6945 90.0001 49.7132 90.0001C49.7195 90.0001 49.7226 90.0001 49.7289 90.0001C49.7352 90.0001 49.7383 90.0001 49.7445 90.0001C50.1983 90.0001 50.6552 89.9752 51.109 89.9377C51.2123 89.9283 51.3155 89.919 51.422 89.9065C51.8663 89.8597 52.3107 89.8004 52.7551 89.7192C52.7614 89.7192 52.7676 89.7192 52.7739 89.7192C53.2621 89.6287 53.7503 89.5101 54.2322 89.3727C54.2635 89.3634 54.2917 89.354 54.323 89.3446C55.024 89.1418 55.7156 88.8889 56.3978 88.5861C56.4104 88.5799 56.426 88.5736 56.4385 88.5674C56.958 88.3364 57.4712 88.0836 57.9751 87.7933C58.4852 87.4999 58.9703 87.1815 59.4334 86.8413C59.8371 86.5478 60.2252 86.2357 60.6039 85.9048C61.0639 85.499 61.4989 85.0745 61.9026 84.6282C62.2062 84.2942 62.4972 83.9446 62.7757 83.5825C62.8665 83.4639 62.951 83.3421 63.0355 83.2235C63.2264 82.9613 63.4079 82.6929 63.5831 82.4182C63.6739 82.2746 63.7646 82.1342 63.8523 81.9906C63.8867 81.9344 63.9242 81.8813 63.9555 81.8251L82.5854 49.7525H82.4039L82.4101 49.7431Z",fill:"url(#paint1_linear_1173_59965)"}),P("path",{d:"M82.8264 32.8436L81.4181 30.4464L75.3375 19.1687L72.5178 14.3929C71.9858 13.1225 70.7309 12.2266 69.26 12.2266C67.3104 12.2266 65.7331 13.8029 65.7331 15.7445C65.7331 16.4031 65.924 17.0086 66.2401 17.5362L66.2025 17.5611L77.1557 36.1617C78.4764 38.4372 78.83 41.0873 78.1509 43.6281C77.4718 46.169 75.8445 48.2915 73.5631 49.6119C72.0609 50.4797 70.3553 50.9385 68.6341 50.9385C65.1166 50.9385 61.84 49.0563 60.0812 46.0285L44.3368 19.2654H44.3681L37.7179 7.81917L37.7054 7.84102C37.5896 7.65061 37.455 7.47893 37.333 7.29477L37.1452 6.97326C37.1452 6.97326 37.1296 6.98262 37.1233 6.98887C34.0001 2.55332 29.0054 0.0780356 23.8512 0.0187285V0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C79.1961 53.651 81.0425 51.8312 82.407 49.7461H82.5885L82.5259 49.8523C83.399 48.4695 84.0687 46.9462 84.5006 45.3231C85.6304 41.0904 85.042 36.6705 82.8201 32.8467L82.8264 32.8436Z",fill:"#F37880"}),_("g",{opacity:"0.86",children:[P("path",{d:"M66.1994 17.5642L77.1526 36.1648C78.4732 38.4403 78.8269 41.0904 78.1478 43.6313C77.7347 45.1795 76.9648 46.5716 75.9133 47.7234C77.2903 46.4686 78.2823 44.8486 78.7737 43.007C79.4527 40.4661 79.0991 37.816 77.7785 35.5405L66.8253 16.94L66.8628 16.915C66.5467 16.3875 66.3558 15.7819 66.3558 15.1233C66.3558 14.3117 66.6344 13.5657 67.0975 12.9695C66.2651 13.6125 65.7299 14.6176 65.7299 15.7476C65.7299 16.4062 65.9208 17.0118 66.2369 17.5393L66.1994 17.5642Z",fill:"white"}),P("path",{d:"M82.5382 49.8335L82.5291 49.8487C82.5291 49.8487 82.5352 49.8365 82.5413 49.8304C82.5413 49.8304 82.5413 49.8304 82.5413 49.8335H82.5382Z",fill:"white"}),P("path",{d:"M77.5156 54.3596C74.9213 55.8579 72.0859 56.5727 69.2882 56.5727C63.9681 56.5727 58.7856 53.9975 55.6467 49.3497L31.1616 7.19488L31.1491 7.21673C28.9053 3.56154 25.4441 1.08626 21.5917 0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C78.2698 54.1848 79.4809 53.2109 80.5293 52.1122C79.6311 52.9581 78.6266 53.7166 77.5125 54.3596H77.5156Z",fill:"white"})]})]}),P("path",{d:"M117.046 58.661C116.362 58.661 115.792 58.509 115.336 58.205C114.906 57.8757 114.551 57.3943 114.272 56.761L104.354 34.493C104.076 33.8597 104 33.3023 104.126 32.821C104.253 32.3397 104.519 31.9597 104.924 31.681C105.33 31.4023 105.811 31.263 106.368 31.263C107.103 31.263 107.648 31.4277 108.002 31.757C108.382 32.061 108.699 32.5297 108.952 33.163L117.958 54.025H116.324L125.292 33.125C125.571 32.517 125.9 32.061 126.28 31.757C126.66 31.4277 127.192 31.263 127.876 31.263C128.434 31.263 128.89 31.4023 129.244 31.681C129.624 31.9597 129.865 32.3397 129.966 32.821C130.068 33.3023 129.979 33.8597 129.7 34.493L119.782 56.761C119.504 57.3943 119.149 57.8757 118.718 58.205C118.313 58.509 117.756 58.661 117.046 58.661Z",fill:"white"}),P("path",{d:"M144.63 58.737C142.781 58.737 141.147 58.4963 139.728 58.015C138.335 57.5337 137.157 56.8243 136.194 55.887C135.232 54.9243 134.51 53.7337 134.028 52.315C133.547 50.8963 133.306 49.2497 133.306 47.375V33.733C133.306 32.897 133.509 32.2763 133.914 31.871C134.345 31.4657 134.953 31.263 135.738 31.263C136.524 31.263 137.119 31.4657 137.524 31.871C137.955 32.2763 138.17 32.897 138.17 33.733V47.337C138.17 49.7437 138.715 51.555 139.804 52.771C140.919 53.9617 142.528 54.557 144.63 54.557C146.733 54.557 148.329 53.9617 149.418 52.771C150.508 51.555 151.052 49.7437 151.052 47.337V33.733C151.052 32.897 151.255 32.2763 151.66 31.871C152.091 31.4657 152.699 31.263 153.484 31.263C154.244 31.263 154.827 31.4657 155.232 31.871C155.663 32.2763 155.878 32.897 155.878 33.733V47.375C155.878 49.8577 155.448 51.9477 154.586 53.645C153.75 55.3423 152.496 56.6217 150.824 57.483C149.152 58.319 147.088 58.737 144.63 58.737Z",fill:"white"}),P("path",{d:"M172.685 58.737C170.836 58.737 169.202 58.4963 167.783 58.015C166.39 57.5337 165.212 56.8243 164.249 55.887C163.286 54.9243 162.564 53.7337 162.083 52.315C161.602 50.8963 161.361 49.2497 161.361 47.375V33.733C161.361 32.897 161.564 32.2763 161.969 31.871C162.4 31.4657 163.008 31.263 163.793 31.263C164.578 31.263 165.174 31.4657 165.579 31.871C166.01 32.2763 166.225 32.897 166.225 33.733V47.337C166.225 49.7437 166.77 51.555 167.859 52.771C168.974 53.9617 170.582 54.557 172.685 54.557C174.788 54.557 176.384 53.9617 177.473 52.771C178.562 51.555 179.107 49.7437 179.107 47.337V33.733C179.107 32.897 179.31 32.2763 179.715 31.871C180.146 31.4657 180.754 31.263 181.539 31.263C182.299 31.263 182.882 31.4657 183.287 31.871C183.718 32.2763 183.933 32.897 183.933 33.733V47.375C183.933 49.8577 183.502 51.9477 182.641 53.645C181.805 55.3423 180.551 56.6217 178.879 57.483C177.207 58.319 175.142 58.737 172.685 58.737Z",fill:"white"}),_("defs",{children:[_("linearGradient",{id:"paint0_linear_1173_59965",x1:"47.6353",y1:"37.4727",x2:"81.8124",y2:"37.4727",gradientUnits:"userSpaceOnUse",children:[P("stop",{stopColor:"#4906A5"}),P("stop",{offset:"1",stopColor:"#D3423A"})]}),_("linearGradient",{id:"paint1_linear_1173_59965",x1:"0.0670626",y1:"45.0017",x2:"82.5916",y2:"45.0017",gradientUnits:"userSpaceOnUse",children:[P("stop",{stopColor:"#7C06A5"}),P("stop",{offset:"1",stopColor:"#D3423A"})]}),P("clipPath",{id:"clip0_1173_59965",children:P("rect",{width:"85",height:"90",fill:"white",transform:"translate(0.0670471)"})})]})]}),[]);import Ao from"clsx";import{jsx as $,jsxs as te}from"react/jsx-runtime";var Z="vuuLoginPanel",jr=({appName:e="Demo App",className:t,requirePassword:o=!0,onSubmit:a,...n})=>{let[r,i]=ct(""),[s,u]=ct(""),c=Fo(null),d=()=>{a(r,s)},h=f=>{i(f.target.value)},y=f=>{u(f.target.value)},v=lt(()=>{o||a(r)},[a,o,r]),p=lt(()=>{r&&a(r,s)},[a,s,r]),l=r.trim()!==""&&(o===!1||s.trim()!=="");return Vo(()=>{var f;console.log("inputRef",{input:c.current}),(f=c.current)==null||f.focus()},[]),te("div",{...n,className:Ao(Z,t),children:[te("div",{className:`${Z}-branding`,children:[$(ut,{}),$("div",{className:`${Z}-appName`,children:e})]}),te("div",{className:`${Z}-form`,children:[$("div",{className:`${Z}-title`,children:"Welcome Back"}),te(dt,{children:[$(pt,{children:"Username"}),$(mt,{value:r,id:"text-username",inputRef:c,onChange:h,onCommit:v})]}),o?te(dt,{children:[$(pt,{children:"Password"}),$(mt,{className:`${Z}-password`,inputProps:{type:"password"},value:s,id:"text-password",onChange:y,onCommit:p,endAdornment:$("span",{"data-icon":"eye",style:{cursor:"pointer"}})})]}):null,$(Ho,{className:`${Z}-login`,disabled:!l,onClick:d,variant:"cta",children:"Login"})]})]})};import{getCookieValue as Ve}from"@vuu-ui/vuu-utils";var Ro=()=>{let e=Ve("vuu-auth-mode");return e!=null?e:""},le=()=>{let e=Ve("vuu-username"),t=Ve("vuu-auth-token");return[e,t]},Bo=()=>Ro()==="login"?"login.html":"demo.html",$o=(e=Bo())=>{window.location.href=e},ht=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",$o(e)};import{Button as ce}from"@salt-ds/core";import{jsx as de,jsxs as Fe}from"react/jsx-runtime";var oe="vuuAppHeader",ft=({className:e,layoutId:t,loginUrl:o,onNavigate:a,onSwitchTheme:n,themeMode:r,user:i,...s})=>{let u=zo(oe,e),c=Io(()=>{ht(o)},[o]);return Fe(Oo,{alignItems:"end",className:u,showSeparators:!0,...s,children:[de(ce,{className:`${oe}-menuItem`,variant:"secondary",children:"Help"}),Fe(ce,{className:`${oe}-menuItem`,variant:"secondary",children:["History ",de("span",{"data-icon":"history"})]}),Fe(ce,{className:`${oe}-menuItem`,variant:"secondary",children:["View ",de("span",{"data-icon":"settings"})]}),de(ce,{className:`${oe}-menuItem`,onClick:c,variant:"secondary",children:"Log out"})]})};import Uo,{useEffect as Zo,useState as qo}from"react";import Jo from"clsx";import{Fragment as _o,jsx as Wo,jsxs as gt}from"react/jsx-runtime";var bi=({connectionStatus:e,className:t,element:o="span",...a})=>{let[n,r]=qo("vuuConnectingStatus");Zo(()=>{switch(e){case"connected":case"reconnected":r("vuuActiveStatus");break;case"connecting":r("vuuConnectingStatus");break;case"disconnected":r("vuuDisconnectedStatus");break;default:break}},[e]);let i=Uo.createElement(o,{...a,className:Jo("vuuStatus vuuIcon",n,t)});return Wo(_o,{children:gt("div",{className:"vuuStatus-container salt-theme",children:[i,gt("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};import bt,{Suspense as Yo,useEffect as jo}from"react";import{registerComponent as ea}from"@vuu-ui/vuu-layout";import Go from"react";import{Fragment as Qo,jsx as vt,jsxs as Xo}from"react/jsx-runtime";var pe=class extends Go.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(`error creating component at ${this.props.url}`),console.log(t,o)}render(){return this.state.errorMessage?Xo(Qo,{children:[vt("h1",{children:"An error occured while creating component."}),vt("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as Ko}from"react/jsx-runtime";var yt=()=>Ko("div",{className:"hwLoader"});var xt=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};import{jsx as he}from"react/jsx-runtime";var me=new Map,ta=e=>{jo(()=>()=>{me.delete(e)},[e]),me.has(e)||me.set(e,bt.lazy(()=>import(e)));let t=me.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function oa({url:e,css:t,ComponentProps:o,...a}){t&&xt(t).then(r=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]});let n=ta(e);return he(pe,{url:e,children:he(Yo,{fallback:he(yt,{}),children:he(n,{...a,...o})})})}var fe=bt.memo(oa);fe.displayName="Feature";ea("Feature",fe,"view");import{Checkbox as $a,ComboBox as Ia,RadioButton as Oa}from"@vuu-ui/vuu-ui-controls";function Ct(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let o=document.implementation.createHTMLDocument(),a=o.createElement("base"),n=o.createElement("a");return o.head.appendChild(a),o.body.appendChild(n),t&&(a.href=t),n.href=e,n.href}var wt=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function N(e){let t=[];for(let o=0,a=e.length;o<a;o++)t.push(e[o]);return t}function ge(e,t){let a=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return a?parseFloat(a.replace("px","")):0}function aa(e){let t=ge(e,"border-left-width"),o=ge(e,"border-right-width");return e.clientWidth+t+o}function na(e){let t=ge(e,"border-top-width"),o=ge(e,"border-bottom-width");return e.clientHeight+t+o}function He(e,t={}){let o=t.width||aa(e),a=t.height||na(e);return{width:o,height:a}}function Lt(){let e,t;try{t=process}catch{}let o=t&&t.env?t.env.devicePixelRatio:null;return o&&(e=parseInt(o,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var E=16384;function St(e){(e.width>E||e.height>E)&&(e.width>E&&e.height>E?e.width>e.height?(e.height*=E/e.width,e.width=E):(e.width*=E/e.height,e.height=E):e.width>E?(e.height*=E/e.width,e.width=E):(e.width*=E/e.height,e.height=E))}function W(e){return new Promise((t,o)=>{let a=new Image;a.decode=()=>t(a),a.onload=()=>t(a),a.onerror=o,a.crossOrigin="anonymous",a.decoding="async",a.src=e})}async function ra(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Pt(e,t,o){let a="http://www.w3.org/2000/svg",n=document.createElementNS(a,"svg"),r=document.createElementNS(a,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${o}`),n.setAttribute("viewBox",`0 0 ${t} ${o}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),n.appendChild(r),r.appendChild(e),ra(n)}var L=(e,t)=>{if(e instanceof t)return!0;let o=Object.getPrototypeOf(e);return o===null?!1:o.constructor.name===t.name||L(o,t)};function ia(e){let t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function sa(e){return N(e).map(t=>{let o=e.getPropertyValue(t),a=e.getPropertyPriority(t);return`${t}: ${o}${a?" !important":""};`}).join(" ")}function ua(e,t,o){let a=`.${e}:${t}`,n=o.cssText?ia(o):sa(o);return document.createTextNode(`${a}{${n}}`)}function Tt(e,t,o){let a=window.getComputedStyle(e,o),n=a.getPropertyValue("content");if(n===""||n==="none")return;let r=wt();try{t.className=`${t.className} ${r}`}catch{return}let i=document.createElement("style");i.appendChild(ua(r,o,a)),t.appendChild(i)}function Mt(e,t){Tt(e,t,":before"),Tt(e,t,":after")}var Et="application/font-woff",Nt="image/jpeg",la={woff:Et,woff2:Et,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Nt,jpeg:Nt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function ca(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function G(e){let t=ca(e).toLowerCase();return la[t]||""}function da(e){return e.split(/,/)[1]}function ae(e){return e.search(/^(data:)/)!==-1}function Re(e,t){return`data:${t};base64,${e}`}async function Be(e,t,o){let a=await fetch(e,t);if(a.status===404)throw new Error(`Resource "${a.url}" not found`);let n=await a.blob();return new Promise((r,i)=>{let s=new FileReader;s.onerror=i,s.onloadend=()=>{try{r(o({res:a,result:s.result}))}catch(u){i(u)}},s.readAsDataURL(n)})}var Ae={};function pa(e,t,o){let a=e.replace(/\?.*/,"");return o&&(a=e),/ttf|otf|eot|woff2?/i.test(a)&&(a=a.replace(/.*\//,"")),t?`[${t}]${a}`:a}async function Q(e,t,o){let a=pa(e,t,o.includeQueryParams);if(Ae[a]!=null)return Ae[a];o.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let n;try{let r=await Be(e,o.fetchRequestInit,({res:i,result:s})=>(t||(t=i.headers.get("Content-Type")||""),da(s)));n=Re(r,t)}catch(r){n=o.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;r&&(i=typeof r=="string"?r:r.message),i&&console.warn(i)}return Ae[a]=n,n}async function ma(e){let t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):W(t)}async function ha(e,t){if(e.currentSrc){let r=document.createElement("canvas"),i=r.getContext("2d");r.width=e.clientWidth,r.height=e.clientHeight,i==null||i.drawImage(e,0,0,r.width,r.height);let s=r.toDataURL();return W(s)}let o=e.poster,a=G(o),n=await Q(o,a,t);return W(n)}async function fa(e){var t;try{if(!((t=e==null?void 0:e.contentDocument)===null||t===void 0)&&t.body)return await ne(e.contentDocument.body,{},!0)}catch{}return e.cloneNode(!1)}async function ga(e,t){return L(e,HTMLCanvasElement)?ma(e):L(e,HTMLVideoElement)?ha(e,t):L(e,HTMLIFrameElement)?fa(e):e.cloneNode(!1)}var va=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT";async function ya(e,t,o){var a,n;let r=[];return va(e)&&e.assignedNodes?r=N(e.assignedNodes()):L(e,HTMLIFrameElement)&&(!((a=e.contentDocument)===null||a===void 0)&&a.body)?r=N(e.contentDocument.body.childNodes):r=N(((n=e.shadowRoot)!==null&&n!==void 0?n:e).childNodes),r.length===0||L(e,HTMLVideoElement)||await r.reduce((i,s)=>i.then(()=>ne(s,o)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function xa(e,t){let o=t.style;if(!o)return;let a=window.getComputedStyle(e);a.cssText?(o.cssText=a.cssText,o.transformOrigin=a.transformOrigin):N(a).forEach(n=>{let r=a.getPropertyValue(n);n==="font-size"&&r.endsWith("px")&&(r=`${Math.floor(parseFloat(r.substring(0,r.length-2)))-.1}px`),L(e,HTMLIFrameElement)&&n==="display"&&r==="inline"&&(r="block"),n==="d"&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,a.getPropertyPriority(n))})}function ba(e,t){L(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),L(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Ca(e,t){if(L(e,HTMLSelectElement)){let o=t,a=Array.from(o.children).find(n=>e.value===n.getAttribute("value"));a&&a.setAttribute("selected","")}}function wa(e,t){return L(t,Element)&&(xa(e,t),Mt(e,t),ba(e,t),Ca(e,t)),t}async function La(e,t){let o=e.querySelectorAll?e.querySelectorAll("use"):[];if(o.length===0)return e;let a={};for(let r=0;r<o.length;r++){let s=o[r].getAttribute("xlink:href");if(s){let u=e.querySelector(s),c=document.querySelector(s);!u&&c&&!a[s]&&(a[s]=await ne(c,t,!0))}}let n=Object.values(a);if(n.length){let r="http://www.w3.org/1999/xhtml",i=document.createElementNS(r,"svg");i.setAttribute("xmlns",r),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";let s=document.createElementNS(r,"defs");i.appendChild(s);for(let u=0;u<n.length;u++)s.appendChild(n[u]);e.appendChild(i)}return e}async function ne(e,t,o){return!o&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(a=>ga(a,t)).then(a=>ya(e,a,t)).then(a=>wa(e,a)).then(a=>La(a,t))}var Dt=/url\((['"]?)([^'"]+?)\1\)/g,Sa=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Pa=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ta(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Ma(e){let t=[];return e.replace(Dt,(o,a,n)=>(t.push(n),o)),t.filter(o=>!ae(o))}async function Ea(e,t,o,a,n){try{let r=o?Ct(t,o):t,i=G(t),s;if(n){let u=await n(r);s=Re(u,i)}else s=await Q(r,i,a);return e.replace(Ta(t),`$1${s}$3`)}catch{}return e}function Na(e,{preferredFontFormat:t}){return t?e.replace(Pa,o=>{for(;;){let[a,,n]=Sa.exec(o)||[];if(!n)return"";if(n===t)return`src: ${a};`}}):e}function $e(e){return e.search(Dt)!==-1}async function ve(e,t,o){if(!$e(e))return e;let a=Na(e,o);return Ma(a).reduce((r,i)=>r.then(s=>Ea(s,i,t,o)),Promise.resolve(a))}async function ye(e,t,o){var a;let n=(a=t.style)===null||a===void 0?void 0:a.getPropertyValue(e);if(n){let r=await ve(n,null,o);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function Da(e,t){await ye("background",e,t)||await ye("background-image",e,t),await ye("mask",e,t)||await ye("mask-image",e,t)}async function ka(e,t){let o=L(e,HTMLImageElement);if(!(o&&!ae(e.src))&&!(L(e,SVGImageElement)&&!ae(e.href.baseVal)))return;let a=o?e.src:e.href.baseVal,n=await Q(a,G(a),t);await new Promise((r,i)=>{e.onload=r,e.onerror=i;let s=e;s.decode&&(s.decode=r),s.loading==="lazy"&&(s.loading="eager"),o?(e.srcset="",e.src=n):e.href.baseVal=n})}async function Va(e,t){let a=N(e.childNodes).map(n=>Ie(n,t));await Promise.all(a).then(()=>e)}async function Ie(e,t){L(e,Element)&&(await Da(e,t),await ka(e,t),await Va(e,t))}function kt(e,t){let{style:o}=e;t.backgroundColor&&(o.backgroundColor=t.backgroundColor),t.width&&(o.width=`${t.width}px`),t.height&&(o.height=`${t.height}px`);let a=t.style;return a!=null&&Object.keys(a).forEach(n=>{o[n]=a[n]}),e}var Vt={};async function Ft(e){let t=Vt[e];if(t!=null)return t;let a=await(await fetch(e)).text();return t={url:e,cssText:a},Vt[e]=t,t}async function Ht(e,t){let o=e.cssText,a=/url\(["']?([^"')]+)["']?\)/g,r=(o.match(/url\([^)]+\)/g)||[]).map(async i=>{let s=i.replace(a,"$1");return s.startsWith("https://")||(s=new URL(s,e.url).href),Be(s,t.fetchRequestInit,({result:u})=>(o=o.replace(i,`url(${u})`),[i,u]))});return Promise.all(r).then(()=>o)}function At(e){if(e==null)return[];let t=[],o=/(\/\*[\s\S]*?\*\/)/gi,a=e.replace(o,""),n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let u=n.exec(a);if(u===null)break;t.push(u[0])}a=a.replace(n,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(i,"gi");for(;;){let u=r.exec(a);if(u===null){if(u=s.exec(a),u===null)break;r.lastIndex=s.lastIndex}else s.lastIndex=r.lastIndex;t.push(u[0])}return t}async function Fa(e,t){let o=[],a=[];return e.forEach(n=>{if("cssRules"in n)try{N(n.cssRules||[]).forEach((r,i)=>{if(r.type===CSSRule.IMPORT_RULE){let s=i+1,u=r.href,c=Ft(u).then(d=>Ht(d,t)).then(d=>At(d).forEach(h=>{try{n.insertRule(h,h.startsWith("@import")?s+=1:n.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:h,error:y})}})).catch(d=>{console.error("Error loading remote css",d.toString())});a.push(c)}})}catch(r){let i=e.find(s=>s.href==null)||document.styleSheets[0];n.href!=null&&a.push(Ft(n.href).then(s=>Ht(s,t)).then(s=>At(s).forEach(u=>{i.insertRule(u,n.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",r)}}),Promise.all(a).then(()=>(e.forEach(n=>{if("cssRules"in n)try{N(n.cssRules||[]).forEach(r=>{o.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${n.href}`,r)}}),o))}function Ha(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>$e(t.style.getPropertyValue("src")))}async function Aa(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");let o=N(e.ownerDocument.styleSheets),a=await Fa(o,t);return Ha(a)}async function Rt(e,t){let o=await Aa(e,t);return(await Promise.all(o.map(n=>{let r=n.parentStyleSheet?n.parentStyleSheet.href:null;return ve(n.cssText,r,t)}))).join(`
2
+ `)}async function Bt(e,t){let o=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Rt(e,t);if(o){let a=document.createElement("style"),n=document.createTextNode(o);a.appendChild(n),e.firstChild?e.insertBefore(a,e.firstChild):e.appendChild(a)}}async function Ra(e,t={}){let{width:o,height:a}=He(e,t),n=await ne(e,t,!0);return await Bt(n,t),await Ie(n,t),kt(n,t),await Pt(n,o,a)}async function Ba(e,t={}){let{width:o,height:a}=He(e,t),n=await Ra(e,t),r=await W(n),i=document.createElement("canvas"),s=i.getContext("2d"),u=t.pixelRatio||Lt(),c=t.canvasWidth||o,d=t.canvasHeight||a;return i.width=c*u,i.height=d*u,t.skipAutoScale||St(i),i.style.width=`${c}`,i.style.height=`${d}`,t.backgroundColor&&(s.fillStyle=t.backgroundColor,s.fillRect(0,0,i.width,i.height)),s.drawImage(r,0,0,i.width,i.height),i}async function $t(e,t={}){return(await Ba(e,t)).toDataURL()}var It=e=>new Promise((t,o)=>{$t(e,{cacheBust:!0}).then(a=>{a||o(new Error("No Screenshot available")),t(a)}).catch(a=>{console.error("the following error occurred while taking a screenshot of a DOMNode",a),o(new Error("Error taking screenshot"))})});import{Button as Ot,FormField as xe,FormFieldLabel as be,Input as za,Text as Ua}from"@salt-ds/core";import{useEffect as Za,useMemo as qa,useState as X}from"react";import{jsx as S,jsxs as z}from"react/jsx-runtime";var D="saveLayoutPanel",Ce=`${D}-formField`,Ja=["Group 1","Group 2","Group 3","Group 4","Group 5"],_a=["Value 1","Value 2","Value 3"],zt=["Value 1","Value 2","Value 3"],Ut=e=>{let{defaultTitle:t="",onCancel:o,onSave:a,componentId:n}=e,[r,i]=X(t),[s,u]=X(""),[c,d]=X([]),[h,y]=X(zt[0]),[v,p]=X(),[l,f]=X(),[b]=le();Za(()=>{n&&It(document.getElementById(n)).then(g=>{p(g)}).catch(g=>{f(g.message)})},[n]);let V=()=>{a({name:r,group:s,screenshot:v!=null?v:"",user:b})},T=qa(()=>v?S("img",{className:`${D}-screenshot`,src:v,alt:"screenshot of current layout"}):l?S(Ua,{children:l}):S("div",{className:"spinner"}),[v,l]);return z("div",{className:`${D}-panelContainer`,children:[z("div",{className:`${D}-panelContent`,children:[z("div",{className:`${D}-formContainer`,children:[z(xe,{className:Ce,children:[S(be,{children:"Group"}),S(Ia,{source:Ja,allowFreeText:!0,InputProps:{inputProps:{className:`${D}-inputText`,placeholder:"Select Group or Enter New Name",onChange:g=>u(g.target.value)}},width:"100%",onSelectionChange:(g,M)=>u(M||"")})]}),z(xe,{className:Ce,children:[S(be,{children:"Layout Name"}),S(za,{inputProps:{className:`${D}-inputText`,placeholder:"Enter Layout Name"},onChange:g=>i(g.target.value),value:r})]}),z(xe,{className:Ce,children:[S(be,{children:"Some Layout Setting"}),S("div",{className:`${D}-settingsGroup`,children:_a.map((g,M)=>S($a,{onToggle:()=>d(C=>C.includes(g)?C.filter(F=>F!==g):[...C,g]),checked:c.includes(g),label:g},M))})]}),z(xe,{className:Ce,children:[S(be,{children:"Some Layout Setting"}),S("div",{className:`${D}-settingsGroup`,children:zt.map((g,M)=>S(Oa,{onClick:()=>y(g),checked:h===g,label:g,groupName:"radioGroup"},M))})]})]}),S("div",{className:`${D}-screenshotContainer`,children:T})]}),z("div",{className:`${D}-buttonsContainer`,children:[S(Ot,{className:`${D}-cancelButton`,onClick:o,children:"Cancel"}),S(Ot,{className:`${D}-saveButton`,onClick:V,disabled:r===""||s==="",children:"Save"})]})]})};import{List as Fn}from"@vuu-ui/vuu-ui-controls";import Tn,{useCallback as U,useContext as Mn,useEffect as En,useRef as Nn,useState as to}from"react";import{resolveJSONPath as Dn,isLayoutJSON as oo}from"@vuu-ui/vuu-layout";import on from"clsx";import{useThemeAttributes as an}from"@vuu-ui/vuu-utils";import{useCallback as nn,useLayoutEffect as rn,useRef as _t}from"react";import{Button as Wa,Text as Ga}from"@salt-ds/core";import Qa from"clsx";import{jsx as Zt,jsxs as Ka}from"react/jsx-runtime";var Xa="vuuDialogHeader",qt=({hideCloseButton:e=!1,title:t,onClose:o,...a})=>Ka("div",{...a,className:Qa(Xa,"vuuToolbarProxy"),children:[Zt(Ga,{className:"dialogHeader",children:t}),!e&&Zt(Wa,{onClick:o,"data-align":"end","data-icon":"close",variant:"secondary"},"close")]});import{useCallback as Ya,useLayoutEffect as ja,useRef as en,useState as tn}from"react";var Oe=(e,t,o,a,n,r)=>{let{bottom:i,height:s,left:u,right:c,top:d,width:h}=e.getBoundingClientRect();switch(t){case"below":return{left:u+o,top:i+a};case"right":return{left:c+o,top:d+a};case"below-center":return{left:u+h/2+o,top:i+a};case"below-right":return{left:u,minWidth:n,top:i+a};case"below-full-width":return{left:u+o,minWidth:n,top:i+a,width:h};case"center":return r?{left:h/2-r.width/2+o,top:s/2-r.height/2+a,visibility:"visible"}:{left:h/2+o,top:s/2+a,visibility:"hidden"};default:throw Error(`Popup getPositionRelativeToAnchor non-supported placement value ${t}`)}};var Jt=({anchorElement:e,minWidth:t,offsetLeft:o=0,offsetTop:a=0,placement:n,position:r})=>{let i=en(null),[s,u]=tn(r);ja(()=>{if(n==="absolute"&&r)u(r);else if(e.current&&n!=="auto"){let d=i.current===null?void 0:i.current.getBoundingClientRect(),h=Oe(e.current,n,o,a,t,d);u(h)}},[e,t,o,a,n,r]);let c=Ya(d=>{if(i.current=d,d&&n==="center"&&e.current){let{height:h,width:y}=d.getBoundingClientRect();u(Oe(e.current,n,o,a,void 0,{height:h,width:y}))}},[e,o,a,n]);return{position:s,popupRef:n==="center"?c:void 0}};import{jsx as ze,jsxs as ln}from"react/jsx-runtime";var Wt="vuuDialog",sn={current:document.body},un={},Gt=({PopupProps:e=un,children:t,className:o,isOpen:a=!1,onClose:n,style:r,title:i,hideCloseButton:s=!1,...u})=>{let{anchorElement:c=sn,offsetLeft:d=0,offsetTop:h=0,placement:y="auto"}=e,v=_t(null),p=_t(null),[l,f,b]=an(),{position:V}=Jt({anchorElement:c,offsetLeft:d,offsetTop:h,placement:y}),T=nn(()=>{n==null||n()},[n]);return rn(()=>{if(v.current){if(a){v.current.showModal();let{left:g,top:M}=v.current.getBoundingClientRect();p.current&&(p.current.style.cssText=`left:-${g}px;position:absolute;top:-${M}px;`)}else v.current.close();if(y.endsWith("center")){let{width:g}=v.current.getBoundingClientRect();v.current.style.marginLeft=`-${g/2}px`}}},[a,y]),ln("dialog",{...u,className:on(Wt,l),"data-mode":b,onClose:T,id:"vuu-dialog",ref:v,style:{...r,...V},children:[ze(qt,{hideCloseButton:s,onClose:T,title:i}),ze("div",{className:`${Wt}-body`,children:t}),ze("div",{id:"vuu-dialog-portal-root",ref:p})]})};import{useCallback as cn,useState as dn}from"react";import{jsx as pn}from"react/jsx-runtime";var Qt=()=>{let[e,t]=dn(),o=cn(()=>{t(void 0)},[]);return{dialog:e?pn(Gt,{className:"vuDialog",isOpen:!0,onClose:o,style:{maxHeight:500},title:e.title,hideCloseButton:e.hideCloseButton,children:e.content}):null,setDialogState:t}};import{createContext as mn,useCallback as hn,useMemo as fn}from"react";import{jsx as Ue}from"react/jsx-runtime";var Xt=mn(null),gn=({children:e,context:t,menuActionHandler:o,menuBuilder:a})=>{let n=fn(()=>t!=null&&t.menuBuilders&&a?t.menuBuilders.concat(a):a?[a]:(t==null?void 0:t.menuBuilders)||[],[t,a]),r=hn(i=>{var s;if(o!=null&&o(i)||(s=t==null?void 0:t.menuActionHandler)!=null&&s.call(t,i))return!0},[t,o]);return Ue(Xt.Provider,{value:{menuActionHandler:r,menuBuilders:n},children:e})},Kt=({children:e,label:t,menuActionHandler:o,menuBuilder:a})=>Ue(Xt.Consumer,{children:n=>Ue(gn,{context:n,label:t,menuActionHandler:o,menuBuilder:a,children:e})});import vn,{useState as du,useContext as yn,useCallback as pu,useEffect as mu}from"react";import fu from"clsx";import{getUniqueId as vu}from"@vuu-ui/vuu-utils";import{jsx as bu,jsxs as Cu}from"react/jsx-runtime";var xn=vn.createContext({notify:()=>"have you forgotten to provide a NotificationProvider?"});var Yt=()=>yn(xn);var we={layout:{type:"Component",id:"loading-main",props:{}}},Le={layout:{type:"Stack",id:"main-tabs",props:{className:"vuuShell-mainTabs",TabstripProps:{allowAddTab:!0,allowCloseTab:!0,allowRenameTab:!0,animateSelectionThumb:!1,location:"main-tab",variant:"primary"},preserve:!0,active:0},children:[{props:{id:"tab1",title:"Tab 1",className:"vuuShell-Placeholder"},type:"Placeholder"}]}};import{getLocalEntity as Ze,saveLocalEntity as qe}from"@vuu-ui/vuu-filters";import{formatDate as bn,getUniqueId as Cn}from"@vuu-ui/vuu-utils";var wn="layouts/metadata",Ln="layouts/layouts",K,Se=class{constructor(t){this.username=le()[0];this.metadataSaveLocation=`${wn}/${this.username}`;this.layoutsSaveLocation=`${Ln}/${this.username}`;it(this,K,`api/vui/${this.username}`);this.loadLayouts=()=>new Promise(t=>{let o=Ze(this.layoutsSaveLocation);t(o||[])});this.saveLayoutsWithMetadata=(t,o)=>{qe(this.layoutsSaveLocation,t),qe(this.metadataSaveLocation,o)};this.validateIds=async t=>Promise.all([this.validateId(t,"metadata").catch(o=>o.message),this.validateId(t,"layout").catch(o=>o.message)]).then(o=>{let a=o.filter(n=>n!==void 0).join("; ");if(a)throw new Error(a)});this.validateId=(t,o)=>new Promise((a,n)=>{(o==="metadata"?()=>this.loadMetadata():()=>this.loadLayouts())().then(i=>{switch(i.filter(u=>u.id===t).length){case 1:{a();break}case 0:{n(new Error(`No ${o} with ID ${t}`));break}default:n(new Error(`Non-unique ${o} with ID ${t}`))}})});t&&st(this,K,t)}createLayout(t,o){return new Promise(a=>{Promise.all([this.loadLayouts(),this.loadMetadata()]).then(([n,r])=>{let i=Cn(),s={...t,id:i,created:bn({date:"dd.mm.yyyy"})(new Date)};this.saveLayoutsWithMetadata([...n,{id:i,json:o}],[...r,s]),a(s)})})}updateLayout(t,o,a){return new Promise((n,r)=>{this.validateIds(t).then(()=>Promise.all([this.loadLayouts(),this.loadMetadata()])).then(([i,s])=>{let u=i.map(d=>d.id===t?{...d,json:a}:d),c=s.map(d=>d.id===t?{...d,...o}:d);this.saveLayoutsWithMetadata(u,c),n()}).catch(i=>r(i))})}deleteLayout(t){return new Promise((o,a)=>{this.validateIds(t).then(()=>Promise.all([this.loadLayouts(),this.loadMetadata()])).then(([n,r])=>{let i=n.filter(u=>u.id!==t),s=r.filter(u=>u.id!==t);this.saveLayoutsWithMetadata(i,s),o()}).catch(n=>a(n))})}loadLayout(t){return new Promise((o,a)=>{this.validateId(t,"layout").then(()=>this.loadLayouts()).then(n=>{let r=n.find(i=>i.id===t);r?o(r.json):a(new Error(`no layout found matching id ${t}`))}).catch(n=>a(n))})}loadMetadata(){return new Promise(t=>{let o=Ze(this.metadataSaveLocation);t(o||[])})}loadApplicationJSON(){return new Promise(t=>{let o=Ze(ke(this,K));t(o||Le)})}saveApplicationJSON(t){return new Promise((o,a)=>{qe(ke(this,K),t)?o():a(new Error("Application Json failed to save"))})}};K=new WeakMap;import{useCallback as jt,useMemo as Sn}from"react";import{jsx as Pn}from"react/jsx-runtime";var eo=e=>{let{saveLayout:t}=Y(),o=jt(()=>{e(void 0)},[e]),a=jt(i=>{t(i),e(void 0)},[t,e]),[n,r]=Sn(()=>[(i,s)=>{let u=i.split(" "),c=[];return u.includes("main-tab")&&c.push({label:"Save Layout",action:"save-layout",options:s},{label:"Layout Settings",action:"layout-settings",options:s}),c},i=>{var s,u;return console.log("menu action",{action:i}),i.menuId==="save-layout"?(e({content:Pn(Ut,{onCancel:o,onSave:a,componentId:(s=i.options)==null?void 0:s.controlledComponentId,defaultTitle:(u=i.options)==null?void 0:u.controlledComponentTitle}),title:"Save Layout",hideCloseButton:!0}),!0):!1}],[o,a,e]);return{buildMenuOptions:n,handleMenuAction:r}};import{jsx as Vn}from"react/jsx-runtime";var Je,re=()=>(Je===void 0&&(Je=new Se),Je),ao=Tn.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:Le,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}}),kn=(e,t)=>{var o;return((o=e.props)==null?void 0:o.title)!==void 0?e:{...e,props:{...e.props,title:t.name}}},_u=e=>{let[t,o]=to([]),[,a]=to({}),{notify:n}=Yt(),r=Nn(we),i=U((p,l=!0)=>{r.current=p,l&&a({})},[]),s=U((p,l=!0)=>{i({...r.current,layout:p},l)},[i]),u=U(p=>{i({...r.current,settings:{...r.current.settings,...p}},!1)},[i]);En(()=>{let p=re();p.loadMetadata().then(l=>{o(l)}).catch(l=>{n({type:"error",header:"Failed to Load Layouts",body:"Could not load list of available layouts"}),console.error("Error occurred while retrieving metadata",l)}),p.loadApplicationJSON().then(l=>{i(l)}).catch(l=>{n({type:"error",header:"Failed to Load Layout",body:"Could not load your latest view"}),console.error("Error occurred while retrieving application layout",l)})},[n,i]);let c=U(p=>{oo(p)?(s(p,!1),re().saveApplicationJSON(r.current)):console.error("Tried to save invalid application layout",p)},[s]),d=U(p=>{let l=Dn(r.current.layout,"#main-tabs.ACTIVE_CHILD");l&&oo(l)?re().createLayout(p,kn(l,p)).then(f=>{n({type:"success",header:"Layout Saved Successfully",body:`${f.name} saved successfully`}),o(b=>[...b,f])}).catch(f=>{n({type:"error",header:"Failed to Save Layout",body:`Failed to save layout ${p.name}`}),console.error("Error occurred while saving layout",f)}):(console.error("Tried to save invalid layout",l),n({type:"error",header:"Failed to Save Layout",body:"Cannot save invalid layout"}))},[n]),h=U((p,l)=>{let{settings:f}=r.current;u(l?{...f,[l]:p}:p),re().saveApplicationJSON(r.current)},[u]),y=U(p=>{let{settings:l}=r.current;return p?l==null?void 0:l[p]:l},[]),v=U(p=>{re().loadLayout(p).then(l=>{var b,V;let{layout:f}=r.current;s({...f,children:(f.children||[]).concat(l),props:{...f.props,active:(V=(b=f.children)==null?void 0:b.length)!=null?V:0}})}).catch(l=>{n({type:"error",header:"Failed to Load Layout",body:"Failed to load the requested layout"}),console.error("Error occurred while loading layout",l)})},[n,s]);return Vn(ao.Provider,{value:{getApplicationSettings:y,layoutMetadata:t,saveLayout:d,applicationJson:r.current,saveApplicationLayout:c,saveApplicationSettings:h,loadLayoutById:v},children:e.children})},Y=()=>Mn(ao);import{jsx as ie,jsxs as no}from"react/jsx-runtime";var Pe="vuuLayoutTile",ro=e=>{let{metadata:t,handleLoadLayout:o}=e;return ie("div",{role:"listitem",children:no("div",{className:`${Pe}-layoutTile`,role:"button",onClick:()=>o(t==null?void 0:t.id),children:[ie("img",{className:`${Pe}-screenshot`,src:t==null?void 0:t.screenshot}),no("div",{children:[ie("div",{className:`${Pe}-layoutName`,children:t==null?void 0:t.name}),ie("div",{className:`${Pe}-layoutDetails`,children:ie("div",{children:`${t==null?void 0:t.user}, ${t==null?void 0:t.created}`})})]})]},t==null?void 0:t.id)})};import{Fragment as Hn,jsx as se,jsxs as io}from"react/jsx-runtime";var _e="vuuLayoutList",so=e=>{let{layoutMetadata:t,loadLayoutById:o}=Y(),a=r=>{r&&o(r)},n=t.reduce((r,i)=>r[i.group]?{...r,[i.group]:[...r[i.group],i]}:{...r,[i.group]:[i]},{});return io("div",{className:_e,...e,role:"listbox","aria-label":"my layouts",children:[se("div",{className:`${_e}-header`,children:"My Layouts"}),se(Fn,{height:"auto",source:Object.entries(n),ListItem:({item:r})=>{if(!r)return se(Hn,{});let[i,s]=r;return io("div",{role:"list","aria-label":i,children:[se("div",{className:`${_e}-groupName`,children:i}),s.map(u=>se(ro,{metadata:u,handleLoadLayout:a},u.id))]})}})]})};import{VuuLogo as $n}from"@vuu-ui/vuu-icons";import{Stack as In,useLayoutProviderDispatch as On}from"@vuu-ui/vuu-layout";import{Tab as Te,Tabstrip as zn}from"@vuu-ui/vuu-ui-controls";import{useThemeAttributes as Un}from"@vuu-ui/vuu-utils";import Qe from"clsx";import{useCallback as Xe,useState as Zn}from"react";import{Palette as An,PaletteItem as Rn}from"@vuu-ui/vuu-layout";import{jsx as ue,jsxs as Bn}from"react/jsx-runtime";var We="vuuFeatureList",Ge=({features:e,title:t="VUU TABLES",...o})=>{let a={},n={height:"100%"};return Bn("div",{...o,className:We,children:[ue("div",{className:`${We}-header`,children:t}),ue("div",{className:`${We}-content`,children:ue(An,{orientation:"vertical",ListProps:n,ViewProps:a,children:e.map((r,i)=>ue(Rn,{closeable:!0,label:r.title,resizeable:!0,resize:"defer",header:!0,children:ue(fe,{...r})},i))})})]})};import{jsx as k,jsxs as Me}from"react/jsx-runtime";var j="vuuLeftNav",qn=(e,t)=>e===0?t?"menu-full":"menu-icons":t?"menu-full-content":"menu-icons-content",Nl=e=>{let t=On(),[o]=Un(),{"data-path":a,defaultExpanded:n=!0,defaultActiveTabIndex:r=0,features:i,onActiveChange:s,onTogglePrimaryMenu:u,sizeCollapsed:c=80,sizeContent:d=300,sizeExpanded:h=240,style:y,tableFeatures:v,...p}=e,[l,f]=Zn({activeTabIndex:r,expanded:n}),b=Xe((C,F)=>C===0?F?h:c:F?h+d:c+d,[c,d,h]),V=Xe(C=>{let{activeTabIndex:F,expanded:B}=l;if(f({activeTabIndex:C,expanded:B}),C===0||F===0){let x=b(C,B);t({type:"layout-resize",path:"#vuu-side-panel",size:x})}s==null||s(C)},[t,b,l,s]),T=qn(l.activeTabIndex,l.expanded),g=Xe(()=>{let{activeTabIndex:C,expanded:F}=l,B=!F;f({activeTabIndex:C,expanded:B}),t({type:"layout-resize",path:"#vuu-side-panel",size:b(C,B)}),u==null||u(B)},[t,b,l,u]),M={...y,"--nav-menu-collapsed-width":`${c}px`,"--nav-menu-expanded-width":`${h}px`,"--nav-menu-content-width":`${d}px`};return Me("div",{...p,className:Qe(j,`${j}-${T}`),style:M,children:[Me("div",{className:Qe(`${j}-menu-primary`,o),"data-mode":"dark",children:[k("div",{className:"vuuLeftNav-logo",children:k($n,{})}),k("div",{className:`${j}-main`,children:Me(zn,{activeTabIndex:l.activeTabIndex,animateSelectionThumb:!1,className:`${j}-Tabstrip`,onActiveChange:V,orientation:"vertical",children:[k(Te,{"data-icon":"demo",label:"DEMO"}),k(Te,{"data-icon":"features",label:"VUU FEATURES"}),k(Te,{"data-icon":"tables",label:"VUU TABLES"}),k(Te,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),k("div",{className:"vuuLeftNav-buttonBar",children:k("button",{className:Qe("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":T.startsWith("menu-full"),"vuuLeftNav-toggleButton-closed":T.startsWith("menu-icons")}),"data-icon":T.startsWith("menu-full")?"chevron-left":"chevron-right",onClick:g})})]}),Me(In,{active:l.activeTabIndex-1,className:`${j}-menu-secondary`,showTabs:!1,children:[k(Ge,{features:i,title:"VUU FEATURES"}),k(Ge,{features:v,title:"VUU TABLES"}),k("div",{className:"vuuLeftNav-drawer",children:k(so,{})})]})]})};import{VuuDataSource as Jn}from"@vuu-ui/vuu-data-remote";import{buildColumnMap as _n,hasAction as Wn,isErrorResponse as Gn,isValidNumber as uo,shallowEquals as Qn}from"@vuu-ui/vuu-utils";import{Button as lo,useIdMemo as Xn}from"@salt-ds/core";import co from"clsx";import{useCallback as ee,useEffect as po,useMemo as Kn,useRef as Ke,useState as mo}from"react";import{jsx as q,jsxs as Ye}from"react/jsx-runtime";var I="vuuSessionEditingForm",ho=(e,t)=>{let o=e.find(a=>a.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},fo=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},O={uninitialised:0,unchanged:1,changed:2,invalid:3};function go(e,t,o=!1){switch(t){case"int":case"long":{let a=parseInt(e,10);if(uo(a))return a;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let a=parseFloat(e);return uo(a)?a:void 0}case"boolean":return e==="true";default:return e}}var Yn=(e,t)=>{if(e)return e;if(t)return new Jn({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},Zl=({className:e,config:{fields:t,key:o},dataSource:a,id:n,onClose:r,schema:i,...s})=>{let[u,c]=mo(),[d,h]=mo(""),y=Ke(null),v=Ke(),p=Ke(O.uninitialised),l=Kn(()=>{let m=A=>{if(H){let w={};for(let J of l.columns)w[J]=A[H[J]];p.current===O.uninitialised&&(p.current=O.unchanged,v.current=w),c(w)}},x=Yn(a,i),H=_n(x.columns);return x.subscribe({range:{from:0,to:5}},A=>{A.type==="viewport-update"&&A.rows&&(p.current===O.uninitialised?m(A.rows[0]):console.log("what do we do with server updates"))}),x},[a,i]),f=Xn(n),b=ee(m=>{let[x,H]=fo(m),{type:A}=ho(t,x),w=go(H,A);c((J={})=>{let nt={...J,[x]:w},Do=Qn(nt,v.current);return p.current=Do?O.unchanged:w!==void 0?O.changed:O.invalid,nt})},[t]),V=ee(m=>{let[x,H]=fo(m),{type:A}=ho(t,x),w=u==null?void 0:u[o],J=go(H,A,!0);typeof w=="string"&&l.menuRpcCall({rowKey:w,field:x,value:J,type:"VP_EDIT_CELL_RPC"})},[l,t,o,u]),T=ee(m=>{typeof m=="object"&&m!==null&&"type"in m&&m.type==="CLOSE_DIALOG_ACTION"&&r()},[r]),g=ee(async()=>{let m=await l.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});Gn(m)?h(m.error):Wn(m)&&T(m.action)},[T,l]),M=ee(m=>{m.key==="Enter"&&p.current===O.changed&&g()},[g]),C=ee(()=>{r()},[r]),F=m=>{var H;let x=String((H=u==null?void 0:u[m.name])!=null?H:"");return m.readonly||m.name===o?q("div",{className:`${I}-fieldValue vuuReadOnly`,children:x}):q("input",{className:`${I}-fieldValue`,"data-field":m.name,onBlur:V,onChange:b,type:"text",value:x,id:`${f}-input-${m.name}`})};po(()=>{if(y.current){let m=y.current.querySelector("input");m&&setTimeout(()=>{m.focus(),m.select()},100)}},[]),po(()=>()=>{l&&l.unsubscribe()},[l]);let B=p.current===O.changed;return Ye("div",{...s,className:co(I,e),children:[d?q("div",{className:`${I}-errorBanner`,"data-icon":"error",title:d,children:"Error, edit(s) not saved"}):void 0,q("div",{className:`${I}-content`,ref:y,onKeyDown:M,children:t.map(m=>{var x;return Ye("div",{className:`${I}-field`,children:[q("label",{className:co(`${I}-fieldLabel`,{[`${I}-required`]:m.required}),htmlFor:`${f}-input-${m.name}`,children:(x=m==null?void 0:m.label)!=null?x:m.description}),F(m)]},m.name)})}),Ye("div",{className:`${I}-buttonbar salt-theme salt-density-high`,children:[q(lo,{type:"submit",variant:"cta",disabled:!B,onClick:g,children:"Submit"}),q(lo,{variant:"secondary",onClick:C,children:"Cancel"})]})]})};import{connectToServer as yr}from"@vuu-ui/vuu-data-remote";import{DraggableLayout as xr,LayoutProvider as br,StackLayout as Cr}from"@vuu-ui/vuu-layout";import{logger as wr,ThemeProvider as Lr,useThemeAttributes as Sr}from"@vuu-ui/vuu-utils";import Pr from"clsx";import{useCallback as et,useEffect as Tr,useRef as Mo}from"react";import{Button as jn}from"@salt-ds/core";import vo from"clsx";import{useCallback as er,useMemo as tr}from"react";import{layoutFromJson as or,View as ar,useLayoutProviderDispatch as nr}from"@vuu-ui/vuu-layout";import{jsx as Ee,jsxs as yo}from"react/jsx-runtime";var R="vuuContextPanel",xo=({className:e,expanded:t=!1,content:o,overlay:a=!1,title:n})=>{let r=nr(),i=er(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),s=vo(R,e,{[`${R}-expanded`]:t,[`${R}-inline`]:a!==!0,[`${R}-overlay`]:a}),u=tr(()=>o&&t?or(o,"context-0"):null,[o,t]);return Ee("div",{className:vo(R,s,{[`${R}-expanded`]:t}),children:yo(ar,{className:`${R}-inner`,header:!1,id:"context-panel",children:[yo("div",{className:`${R}-header`,children:[Ee("h2",{className:`${R}-title`,children:n}),Ee(jn,{className:`${R}-close`,"data-icon":"close",onClick:i,variant:"secondary"})]}),Ee("div",{className:`${R}-content`,children:u})]})})};import{DraggableLayout as lr,Flexbox as Co}from"@vuu-ui/vuu-layout";import{useMemo as rr}from"react";import ir from"clsx";import{jsx as ur}from"react/jsx-runtime";var sr="vuuShellSidePanel",bo=({children:e,open:t=!0,sizeClosed:o=90,sizeOpen:a=200,style:n,...r})=>{let i=rr(()=>({...n,"--shell-left-nav-size":t?`${a}px`:`${o}px`}),[t,o,a,n]);return ur("div",{...r,className:ir(sr),style:i,children:e})};import{jsx as je,jsxs as wo}from"react/jsx-runtime";var Lo=({appHeader:e,LeftSidePanelProps:t})=>wo(Co,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[je(bo,{...t,id:"vuu-side-panel"}),wo(Co,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,je(lr,{dropTarget:!0,style:{flex:1}},"main-content")]}),je(xo,{id:"context-panel",overlay:!0})]});import{DockLayout as cr,DraggableLayout as dr,Drawer as pr,Flexbox as mr,View as hr}from"@vuu-ui/vuu-layout";import{useCallback as So,useRef as fr,useState as gr}from"react";import{jsx as Ne,jsxs as vr}from"react/jsx-runtime";var Po=({appHeader:e,LeftSidePanelProps:t})=>{let o=fr(null),[a,n]=gr(!0),r=So(s=>{var c;let u=s.target;(c=o.current)!=null&&c.contains(u)||n(!a)},[a]),i=So(s=>{let u=[];return u.push(Ne(pr,{onClick:r,open:a,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:Ne(hr,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:s},"app-palette")},"left-panel")),u},[r,a]);return vr(mr,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,Ne(cr,{style:{flex:1},children:i(t==null?void 0:t.children).concat(Ne(dr,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var To=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?Po:Lo)(t);import{jsx as De,jsxs as Er}from"react/jsx-runtime";typeof Cr!="function"&&console.warn("StackLayout module not loaded, will be unsbale to deserialize from layout JSON");var{error:tt}=wr("Shell"),Mr={},Zc=({LayoutProps:e,LeftSidePanelProps:t=Mr,children:o,className:a,leftSidePanelLayout:n,loginUrl:r,saveLocation:i,saveUrl:s,serverUrl:u,user:c,...d})=>{let h=Mo(null),{dialog:y,setDialogState:v}=Qt(),p=Mo("latest"),{applicationJson:l,saveApplicationLayout:f,loadLayoutById:b}=Y(),{buildMenuOptions:V,handleMenuAction:T}=eo(v),g=et(w=>{try{f(w)}catch{tt==null||tt("Failed to save layout")}},[f]),M=et(w=>{h.current&&(h.current.dataset.mode=w)},[]),C=et(w=>{p.current=w,b(w)},[b]);Tr(()=>{u&&c.token&&yr({authToken:c.token,url:u,username:c.username})},[u,c.token,c.username]);let[F,B,m]=Sr(),x=Pr("vuuShell",a,F,B),H=l===we,A=To({LeftSidePanelProps:t,leftSidePanelLayout:n,appHeader:De(ft,{layoutId:p.current,loginUrl:r,user:c,onNavigate:C,onSwitchTheme:M})});return H?null:De(Lr,{children:Er(Kt,{menuActionHandler:T,menuBuilder:V,children:[De(br,{...e,layout:l.layout,onLayoutChange:g,children:De(xr,{className:x,"data-mode":m,ref:h,...d,children:A})}),o||y]})})};var _c=e=>e==="*",Wc=e=>typeof e=="object"&&typeof e.module=="string"&&typeof e.table=="string";import{createContext as Nr,useContext as Dr}from"react";import{jsx as ot}from"react/jsx-runtime";var kr={},at=Nr(kr),Vr=({children:e,context:t,inheritedContext:o})=>{let a={...o,...t};return ot(at.Provider,{value:a,children:e})},Yc=({children:e,value:t})=>ot(at.Consumer,{children:o=>ot(Vr,{context:t,inheritedContext:o,children:e})}),jc=()=>Dr(at);import Fr from"clsx";import{ToggleButton as Eo,ToggleButtonGroup as Hr,useControlled as Ar}from"@salt-ds/core";import{useCallback as Rr}from"react";import{jsx as No,jsxs as $r}from"react/jsx-runtime";var Br="vuuThemeSwitch",c3=({className:e,defaultMode:t,mode:o,onChange:a,...n})=>{let[r,i]=Ar({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),s=Rr(c=>{let{value:d}=c.target;i(d),a(d)},[a,i]),u=Fr(Br,e);return $r(Hr,{className:u,...n,onChange:s,value:r,children:[No(Eo,{"aria-label":"alert","data-icon":"light",value:"light"}),No(Eo,{"aria-label":"home","data-icon":"dark",value:"dark"})]})};export{ft as AppHeader,bi as ConnectionStatusIcon,xo as ContextPanel,fe as Feature,Ge as FeatureList,so as LayoutList,ao as LayoutManagementContext,_u as LayoutManagementProvider,Nl as LeftNav,jr as LoginPanel,Ut as SaveLayoutPanel,Zl as SessionEditingForm,Zc as Shell,Yc as ShellContextProvider,bo as SidePanel,c3 as ThemeSwitch,le as getAuthDetailsFromCookies,Ro as getAuthModeFromCookies,Wc as isTableSchema,_c as isWildcardSchema,ht as logout,$o as redirectToLogin,Y as useLayoutManager,jc as useShellContext,To as useShellLayout};
3136
3
  //# sourceMappingURL=index.js.map