@povio/ui 5.0.0-rc.12 → 5.0.0-rc.13
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/README.md +1 -1
- package/dist/{AppCanvasPage-DCjiFfQW.js → AppCanvasPage-DtWEvs_Y.js} +576 -847
- package/dist/{CanvasComponentsFrame-CZXY0Dxi.js → CanvasComponentsFrame-CbgJJv-3.js} +1 -1
- package/dist/{ComponentGallery-D4U5hXZL.js → ComponentGallery-COqEqqN6.js} +2 -2
- package/dist/{Form-DmcByQts.d.ts → Form-DAtj2szV.d.ts} +1 -1
- package/dist/{Inputs-C0sUmuPv.d.ts → Inputs-C_6dVwC7.d.ts} +1 -1
- package/dist/{Table-BN2_J_Ne.js → Table-piX1SWvN.js} +54 -1
- package/dist/{UIConfigurator-CBU0G6rb.js → UIConfigurator-DekPXjv9.js} +1131 -273
- package/dist/config/app-canvas-tanstack.js +1 -1
- package/dist/config/app-canvas.d.ts +1 -1
- package/dist/config/app-canvas.js +1 -1
- package/dist/config/ui-config.d.ts +1 -1
- package/dist/config/ui-configurator-vite.d.ts +7 -0
- package/dist/config/ui-configurator-vite.js +327 -177
- package/dist/config/ui-configurator.d.ts +14 -2
- package/dist/config/ui-configurator.js +2 -2
- package/dist/{configuration.context-iuZu-ie0.d.ts → configuration.context-3I7-wBII.d.ts} +3 -2
- package/dist/{dynamicInputs-DdcsSoYu.d.ts → dynamicInputs-R5i7AT_C.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/rhf/inputs.d.ts +1 -1
- package/dist/rhf.d.ts +2 -2
- package/dist/rhf.js +3 -3
- package/dist/styles/app-canvas.css +15 -42
- package/dist/styles/configurator.css +251 -92
- package/dist/{table.cva-D5oQ-QvA.js → table.cva-DlMT-zLD.js} +1 -54
- package/dist/tanstack/form.d.ts +1 -1
- package/dist/tanstack/inputs.d.ts +2 -2
- package/dist/tanstack/table.js +2 -2
- package/dist/tanstack.d.ts +4 -4
- package/dist/tanstack.js +3 -3
- package/dist/{uiConfig.context-BqKWd_MO.d.ts → uiConfig.context-BksnNQyw.d.ts} +1 -1
- package/dist/{useTableColumnConfig-6zn3zKl3.js → useTableColumnConfig-CNJ_ZvIN.js} +1 -1
- package/package.json +1 -1
- package/src/configurator/README.md +18 -1
|
@@ -3,7 +3,6 @@ import { t as UIConfig } from "./uiConfig.context-BS3r_kTS.js";
|
|
|
3
3
|
import { t as Check } from "./check-DYMBkp_Z.js";
|
|
4
4
|
import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
|
|
5
5
|
import { t as ChevronRight } from "./chevron-right-3nKJR5Bb.js";
|
|
6
|
-
import { a as tableHeaderTextDefinition, c as GripVertical, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, s as theadDefinition, t as tableCellTextDefinition } from "./table.cva-D5oQ-QvA.js";
|
|
7
6
|
import { t as Info } from "./info-iUmX3uDk.js";
|
|
8
7
|
import { a as checkboxDefinition, i as checkboxContentWrapperDefinition, o as checkboxGroupLabelDefinition, r as checkboxContentRowDefinition, s as checkboxIconDefinition, u as Minus } from "./CheckboxCheckmark-FwKjPVbV.js";
|
|
9
8
|
import { i as Search, n as selectListBoxItemDefinition, r as selectInputTagsContentWrapperDefinition, t as selectPopoverDefinition } from "./selectDesktop.cva-CHAMxhfO.js";
|
|
@@ -19,6 +18,7 @@ import { t as $2ec61d1d4f780267$export$a8a3e93435678ff9 } from "./Heading-nI1_VO
|
|
|
19
18
|
import { t as $efe09c6d1c304b50$export$9afb8bc826b033ea } from "./Text-D2MPZ3sY.js";
|
|
20
19
|
import { n as $1f3c3b1a70cec653$export$ff05c3ac10437e03, t as $cdaed739b1139372$export$c24727297075ec6a } from "./Form-DlQcyN1f.js";
|
|
21
20
|
import { t as Checkbox } from "./Checkbox-D3f2Plbc.js";
|
|
21
|
+
import { t as $aa5f63badbfee5df$exports } from "./intlStrings-chfsan9H.js";
|
|
22
22
|
import { a as $928221da08ecbc62$export$dca12b0bb56e4fc, i as $928221da08ecbc62$export$a11e76429ed99b4, n as $928221da08ecbc62$export$7c5906fe4f1f2af2, r as $928221da08ecbc62$export$7ff8f37d2d81a48d, t as $928221da08ecbc62$export$41f133550aa26f48 } from "./ListBox-CL8Ar4Q_.js";
|
|
23
23
|
import { n as $8b8d26808cb8cb53$export$8948f78d83984c69, t as $8b8d26808cb8cb53$export$2b77a92f1a5ad772 } from "./Modal-w60dVQcb.js";
|
|
24
24
|
import { i as radioDefinition, n as radioContentRowDefinition, r as radioContentWrapperDefinition, t as RadioGroup } from "./RadioGroup-efBKgTYA.js";
|
|
@@ -46,10 +46,11 @@ import { a as stepperSeparatorDefinition, i as stepperNumberDefinition, n as ste
|
|
|
46
46
|
import { i as dialogOverlayDefinition, n as dialogMainDefinition, t as dialogContentDefinition } from "./dialog.cva-COhDZaVl.js";
|
|
47
47
|
import { i as alertDefinition, n as statusIconDefinition, r as statusSeparatorDefinition, t as Alert } from "./Alert-CnvEb1D_.js";
|
|
48
48
|
import { a as toastDefinition, i as toastContainerDefinition } from "./toast.cva-C_L_RffH.js";
|
|
49
|
+
import { a as tableHeaderTextDefinition, i as tableHeadRowDefinition, n as tableDataDefinition, o as tableRowDefinition, r as tableHeadDataDefinition, s as theadDefinition, t as tableCellTextDefinition } from "./table.cva-DlMT-zLD.js";
|
|
49
50
|
import { t as linkDefinition } from "./link.cva-DMTHZiJG.js";
|
|
50
51
|
import { t as tooltipWrapperTriggerDefinition } from "./tooltipWrapper.cva-BBQ4ic3D.js";
|
|
51
|
-
import { C as toRgb, S as toHex, _ as listedLayoutToken, a as generateShades, b as runtimeCss, c as isEditableToken, d as labelFor, f as layoutKindFor, g as linkedLayoutTokens, h as layoutScales, i as exportCss, l as isFontSizeToken, m as layoutLevelFor, n as controlHeightCounterpart, o as groupFor, p as layoutKinds, r as emptyTheme, s as groups, t as baseColorNames, u as isRgb, w as validToken, x as spacingLevels, y as previewTokens } from "./theme-model-DtTsIxou.js";
|
|
52
|
-
import $ahdqC$react, { Fragment, Suspense, createContext, lazy, use, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
52
|
+
import { C as toRgb, S as toHex, _ as listedLayoutToken, a as generateShades, b as runtimeCss, c as isEditableToken, d as labelFor, f as layoutKindFor, g as linkedLayoutTokens, h as layoutScales, i as exportCss, l as isFontSizeToken, m as layoutLevelFor, n as controlHeightCounterpart, o as groupFor, p as layoutKinds, r as emptyTheme, s as groups, t as baseColorNames, u as isRgb, v as parseThemeCss, w as validToken, x as spacingLevels, y as previewTokens } from "./theme-model-DtTsIxou.js";
|
|
53
|
+
import $ahdqC$react, { Fragment, Suspense, createContext, lazy, use, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
53
54
|
import { c } from "react/compiler-runtime";
|
|
54
55
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
55
56
|
import { mergeProps } from "react-aria/mergeProps";
|
|
@@ -58,8 +59,8 @@ import { filterDOMProps } from "react-aria/filterDOMProps";
|
|
|
58
59
|
import { useFocusRing } from "react-aria/useFocusRing";
|
|
59
60
|
import { createHideableComponent } from "react-aria/private/collections/Hidden";
|
|
60
61
|
import { createPortal } from "react-dom";
|
|
61
|
-
import "react-aria/useLocalizedStringFormatter";
|
|
62
|
-
import "react-aria/useListFormatter";
|
|
62
|
+
import { useLocalizedStringFormatter } from "react-aria/useLocalizedStringFormatter";
|
|
63
|
+
import { useListFormatter } from "react-aria/useListFormatter";
|
|
63
64
|
import { HiddenSelect, useSelect } from "react-aria/useSelect";
|
|
64
65
|
import { useSelectState } from "react-stately/useSelectState";
|
|
65
66
|
import { UNSAFE_PortalProvider } from "react-aria";
|
|
@@ -70,7 +71,7 @@ import { UNSAFE_PortalProvider } from "react-aria";
|
|
|
70
71
|
* This source code is licensed under the ISC license.
|
|
71
72
|
* See the LICENSE file in the root directory of this source tree.
|
|
72
73
|
*/
|
|
73
|
-
const __iconData$
|
|
74
|
+
const __iconData$10 = {
|
|
74
75
|
name: "arrow-down-to-line",
|
|
75
76
|
size: 24,
|
|
76
77
|
node: [
|
|
@@ -88,8 +89,8 @@ const __iconData$9 = {
|
|
|
88
89
|
}]
|
|
89
90
|
]
|
|
90
91
|
};
|
|
91
|
-
__iconData$
|
|
92
|
-
const ArrowDownToLine = createLucideIcon(__iconData$
|
|
92
|
+
__iconData$10.node;
|
|
93
|
+
const ArrowDownToLine = createLucideIcon(__iconData$10);
|
|
93
94
|
//#endregion
|
|
94
95
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.mjs
|
|
95
96
|
/**
|
|
@@ -98,7 +99,7 @@ const ArrowDownToLine = createLucideIcon(__iconData$9);
|
|
|
98
99
|
* This source code is licensed under the ISC license.
|
|
99
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
100
101
|
*/
|
|
101
|
-
const __iconData$
|
|
102
|
+
const __iconData$9 = {
|
|
102
103
|
name: "chevrons-up-down",
|
|
103
104
|
size: 24,
|
|
104
105
|
node: [["path", {
|
|
@@ -109,8 +110,8 @@ const __iconData$8 = {
|
|
|
109
110
|
key: "sgt6xg"
|
|
110
111
|
}]]
|
|
111
112
|
};
|
|
112
|
-
__iconData$
|
|
113
|
-
const ChevronsUpDown = createLucideIcon(__iconData$
|
|
113
|
+
__iconData$9.node;
|
|
114
|
+
const ChevronsUpDown = createLucideIcon(__iconData$9);
|
|
114
115
|
//#endregion
|
|
115
116
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/external-link.mjs
|
|
116
117
|
/**
|
|
@@ -119,7 +120,7 @@ const ChevronsUpDown = createLucideIcon(__iconData$8);
|
|
|
119
120
|
* This source code is licensed under the ISC license.
|
|
120
121
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
122
|
*/
|
|
122
|
-
const __iconData$
|
|
123
|
+
const __iconData$8 = {
|
|
123
124
|
name: "external-link",
|
|
124
125
|
size: 24,
|
|
125
126
|
node: [
|
|
@@ -137,8 +138,8 @@ const __iconData$7 = {
|
|
|
137
138
|
}]
|
|
138
139
|
]
|
|
139
140
|
};
|
|
140
|
-
__iconData$
|
|
141
|
-
const ExternalLink = createLucideIcon(__iconData$
|
|
141
|
+
__iconData$8.node;
|
|
142
|
+
const ExternalLink = createLucideIcon(__iconData$8);
|
|
142
143
|
//#endregion
|
|
143
144
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/moon.mjs
|
|
144
145
|
/**
|
|
@@ -147,7 +148,7 @@ const ExternalLink = createLucideIcon(__iconData$7);
|
|
|
147
148
|
* This source code is licensed under the ISC license.
|
|
148
149
|
* See the LICENSE file in the root directory of this source tree.
|
|
149
150
|
*/
|
|
150
|
-
const __iconData$
|
|
151
|
+
const __iconData$7 = {
|
|
151
152
|
name: "moon",
|
|
152
153
|
size: 24,
|
|
153
154
|
node: [["path", {
|
|
@@ -155,8 +156,8 @@ const __iconData$6 = {
|
|
|
155
156
|
key: "kfwtm"
|
|
156
157
|
}]]
|
|
157
158
|
};
|
|
158
|
-
__iconData$
|
|
159
|
-
const Moon = createLucideIcon(__iconData$
|
|
159
|
+
__iconData$7.node;
|
|
160
|
+
const Moon = createLucideIcon(__iconData$7);
|
|
160
161
|
//#endregion
|
|
161
162
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/panel-top.mjs
|
|
162
163
|
/**
|
|
@@ -165,7 +166,7 @@ const Moon = createLucideIcon(__iconData$6);
|
|
|
165
166
|
* This source code is licensed under the ISC license.
|
|
166
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
167
168
|
*/
|
|
168
|
-
const __iconData$
|
|
169
|
+
const __iconData$6 = {
|
|
169
170
|
name: "panel-top",
|
|
170
171
|
size: 24,
|
|
171
172
|
node: [["rect", {
|
|
@@ -180,8 +181,29 @@ const __iconData$5 = {
|
|
|
180
181
|
key: "1pudct"
|
|
181
182
|
}]]
|
|
182
183
|
};
|
|
184
|
+
__iconData$6.node;
|
|
185
|
+
const PanelTop = createLucideIcon(__iconData$6);
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/pencil.mjs
|
|
188
|
+
/**
|
|
189
|
+
* @license lucide-react v1.43.0 - ISC
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the ISC license.
|
|
192
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
+
*/
|
|
194
|
+
const __iconData$5 = {
|
|
195
|
+
name: "pencil",
|
|
196
|
+
size: 24,
|
|
197
|
+
node: [["path", {
|
|
198
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
199
|
+
key: "1a8usu"
|
|
200
|
+
}], ["path", {
|
|
201
|
+
d: "m15 5 4 4",
|
|
202
|
+
key: "1mk7zo"
|
|
203
|
+
}]]
|
|
204
|
+
};
|
|
183
205
|
__iconData$5.node;
|
|
184
|
-
const
|
|
206
|
+
const Pencil = createLucideIcon(__iconData$5);
|
|
185
207
|
//#endregion
|
|
186
208
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/pin.mjs
|
|
187
209
|
/**
|
|
@@ -246,58 +268,6 @@ const __iconData$2 = {
|
|
|
246
268
|
__iconData$2.node;
|
|
247
269
|
const RotateCcw = createLucideIcon(__iconData$2);
|
|
248
270
|
//#endregion
|
|
249
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/sliders-horizontal.mjs
|
|
250
|
-
/**
|
|
251
|
-
* @license lucide-react v1.43.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/
|
|
256
|
-
const __iconData$1 = {
|
|
257
|
-
name: "sliders-horizontal",
|
|
258
|
-
size: 24,
|
|
259
|
-
node: [
|
|
260
|
-
["path", {
|
|
261
|
-
d: "M10 5H3",
|
|
262
|
-
key: "1qgfaw"
|
|
263
|
-
}],
|
|
264
|
-
["path", {
|
|
265
|
-
d: "M12 19H3",
|
|
266
|
-
key: "yhmn1j"
|
|
267
|
-
}],
|
|
268
|
-
["path", {
|
|
269
|
-
d: "M14 3v4",
|
|
270
|
-
key: "1sua03"
|
|
271
|
-
}],
|
|
272
|
-
["path", {
|
|
273
|
-
d: "M16 17v4",
|
|
274
|
-
key: "1q0r14"
|
|
275
|
-
}],
|
|
276
|
-
["path", {
|
|
277
|
-
d: "M21 12h-9",
|
|
278
|
-
key: "1o4lsq"
|
|
279
|
-
}],
|
|
280
|
-
["path", {
|
|
281
|
-
d: "M21 19h-5",
|
|
282
|
-
key: "1rlt1p"
|
|
283
|
-
}],
|
|
284
|
-
["path", {
|
|
285
|
-
d: "M21 5h-7",
|
|
286
|
-
key: "1oszz2"
|
|
287
|
-
}],
|
|
288
|
-
["path", {
|
|
289
|
-
d: "M8 10v4",
|
|
290
|
-
key: "tgpxqk"
|
|
291
|
-
}],
|
|
292
|
-
["path", {
|
|
293
|
-
d: "M8 12H3",
|
|
294
|
-
key: "a7s4jb"
|
|
295
|
-
}]
|
|
296
|
-
]
|
|
297
|
-
};
|
|
298
|
-
__iconData$1.node;
|
|
299
|
-
const SlidersHorizontal = createLucideIcon(__iconData$1);
|
|
300
|
-
//#endregion
|
|
301
271
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/sun.mjs
|
|
302
272
|
/**
|
|
303
273
|
* @license lucide-react v1.43.0 - ISC
|
|
@@ -305,7 +275,7 @@ const SlidersHorizontal = createLucideIcon(__iconData$1);
|
|
|
305
275
|
* This source code is licensed under the ISC license.
|
|
306
276
|
* See the LICENSE file in the root directory of this source tree.
|
|
307
277
|
*/
|
|
308
|
-
const __iconData = {
|
|
278
|
+
const __iconData$1 = {
|
|
309
279
|
name: "sun",
|
|
310
280
|
size: 24,
|
|
311
281
|
node: [
|
|
@@ -349,10 +319,50 @@ const __iconData = {
|
|
|
349
319
|
}]
|
|
350
320
|
]
|
|
351
321
|
};
|
|
322
|
+
__iconData$1.node;
|
|
323
|
+
const Sun = createLucideIcon(__iconData$1);
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/trash.mjs
|
|
326
|
+
/**
|
|
327
|
+
* @license lucide-react v1.43.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/
|
|
332
|
+
const __iconData = {
|
|
333
|
+
name: "trash",
|
|
334
|
+
size: 24,
|
|
335
|
+
node: [
|
|
336
|
+
["path", {
|
|
337
|
+
d: "M10 11v6",
|
|
338
|
+
key: "nco0om"
|
|
339
|
+
}],
|
|
340
|
+
["path", {
|
|
341
|
+
d: "M14 11v6",
|
|
342
|
+
key: "outv1u"
|
|
343
|
+
}],
|
|
344
|
+
["path", {
|
|
345
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
|
|
346
|
+
key: "miytrc"
|
|
347
|
+
}],
|
|
348
|
+
["path", {
|
|
349
|
+
d: "M3 6h18",
|
|
350
|
+
key: "d0wm0j"
|
|
351
|
+
}],
|
|
352
|
+
["path", {
|
|
353
|
+
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
354
|
+
key: "e791ji"
|
|
355
|
+
}]
|
|
356
|
+
],
|
|
357
|
+
aliases: ["trash-2"]
|
|
358
|
+
};
|
|
352
359
|
__iconData.node;
|
|
353
|
-
const
|
|
360
|
+
const Trash = createLucideIcon(__iconData);
|
|
354
361
|
//#endregion
|
|
355
362
|
//#region ../../node_modules/.bun/react-aria-components@1.21.1+67f6792bdf102c28/node_modules/react-aria-components/dist/private/Select.mjs
|
|
363
|
+
function $parcel$interopDefault(a) {
|
|
364
|
+
return a && a.__esModule ? a.default : a;
|
|
365
|
+
}
|
|
356
366
|
const $c8bb816105474884$export$7540cee5be7dc19b = /*#__PURE__*/ createContext(null);
|
|
357
367
|
const $c8bb816105474884$export$ef445b55be0601bd = /*#__PURE__*/ createContext(null);
|
|
358
368
|
const $c8bb816105474884$export$ef9b1a59e592288f = /*#__PURE__*/ createHideableComponent(function Select(props, ref) {
|
|
@@ -473,6 +483,68 @@ function $c8bb816105474884$var$SelectInner({ props, selectRef: ref, collection }
|
|
|
473
483
|
})));
|
|
474
484
|
}
|
|
475
485
|
const $c8bb816105474884$export$f8f745c04421623f = /*#__PURE__*/ createContext(null);
|
|
486
|
+
const $c8bb816105474884$export$e288731fd71264f0 = /*#__PURE__*/ createHideableComponent(function SelectValue(props, ref) {
|
|
487
|
+
[props, ref] = $7230ffa83bc0c2cf$export$29f1550f4b0d4415(props, ref, $c8bb816105474884$export$f8f745c04421623f);
|
|
488
|
+
let state = useContext($c8bb816105474884$export$ef445b55be0601bd);
|
|
489
|
+
let { placeholder } = $7230ffa83bc0c2cf$export$fabf2dc03a41866e($c8bb816105474884$export$7540cee5be7dc19b);
|
|
490
|
+
let rendered = state.selectedItems.map((item) => {
|
|
491
|
+
let rendered = item.props?.children;
|
|
492
|
+
if (typeof rendered === "function") rendered = rendered({
|
|
493
|
+
isHovered: false,
|
|
494
|
+
isPressed: false,
|
|
495
|
+
isSelected: false,
|
|
496
|
+
isFocused: false,
|
|
497
|
+
isFocusVisible: false,
|
|
498
|
+
isDisabled: false,
|
|
499
|
+
selectionMode: "single",
|
|
500
|
+
selectionBehavior: "toggle"
|
|
501
|
+
});
|
|
502
|
+
return rendered;
|
|
503
|
+
});
|
|
504
|
+
let formatter = useListFormatter();
|
|
505
|
+
let textValue = useMemo(() => state.selectedItems.map((item) => item?.textValue), [state.selectedItems]);
|
|
506
|
+
let selectionMode = state.selectionManager.selectionMode;
|
|
507
|
+
let selectedText = useMemo(() => selectionMode === "single" ? textValue[0] ?? "" : formatter.format(textValue), [
|
|
508
|
+
selectionMode,
|
|
509
|
+
formatter,
|
|
510
|
+
textValue
|
|
511
|
+
]);
|
|
512
|
+
let defaultChildren = useMemo(() => {
|
|
513
|
+
if (selectionMode === "single") return rendered[0];
|
|
514
|
+
let parts = formatter.formatToParts(textValue);
|
|
515
|
+
if (parts.length === 0) return null;
|
|
516
|
+
let index = 0;
|
|
517
|
+
return parts.map((part) => {
|
|
518
|
+
if (part.type === "element") return /*#__PURE__*/ $ahdqC$react.createElement(Fragment, { key: index }, rendered[index++]);
|
|
519
|
+
else return part.value;
|
|
520
|
+
});
|
|
521
|
+
}, [
|
|
522
|
+
selectionMode,
|
|
523
|
+
formatter,
|
|
524
|
+
textValue,
|
|
525
|
+
rendered
|
|
526
|
+
]);
|
|
527
|
+
let stringFormatter = useLocalizedStringFormatter($parcel$interopDefault($aa5f63badbfee5df$exports), "react-aria-components");
|
|
528
|
+
let renderProps = $7230ffa83bc0c2cf$export$4d86445c2cf5e3({
|
|
529
|
+
...props,
|
|
530
|
+
defaultChildren: defaultChildren ?? placeholder ?? stringFormatter.format("selectPlaceholder"),
|
|
531
|
+
defaultClassName: "react-aria-SelectValue",
|
|
532
|
+
values: {
|
|
533
|
+
selectedItem: state.selectedItems[0]?.value ?? null,
|
|
534
|
+
selectedItems: useMemo(() => state.selectedItems.map((item) => item.value ?? null), [state.selectedItems]),
|
|
535
|
+
selectedText,
|
|
536
|
+
isPlaceholder: state.selectedItems.length === 0,
|
|
537
|
+
state
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
let DOMProps = filterDOMProps(props, { global: true });
|
|
541
|
+
return /*#__PURE__*/ $ahdqC$react.createElement($7230ffa83bc0c2cf$export$df3a06d6289f983e.span, {
|
|
542
|
+
ref,
|
|
543
|
+
...DOMProps,
|
|
544
|
+
...renderProps,
|
|
545
|
+
"data-placeholder": state.selectedItems.length === 0 || void 0
|
|
546
|
+
}, /*#__PURE__*/ $ahdqC$react.createElement($efe09c6d1c304b50$export$9afb8bc826b033ea.Provider, { value: void 0 }, renderProps.children));
|
|
547
|
+
});
|
|
476
548
|
//#endregion
|
|
477
549
|
//#region src/configurator/cva-definitions.ts
|
|
478
550
|
const cvaDefinitions = {
|
|
@@ -623,7 +695,7 @@ function UIConfigurationProvider(t0) {
|
|
|
623
695
|
let t1;
|
|
624
696
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
625
697
|
t1 = () => {
|
|
626
|
-
setComponentHosts(_temp$
|
|
698
|
+
setComponentHosts(_temp$8);
|
|
627
699
|
return () => setComponentHosts(_temp2$5);
|
|
628
700
|
};
|
|
629
701
|
$[0] = t1;
|
|
@@ -631,12 +703,14 @@ function UIConfigurationProvider(t0) {
|
|
|
631
703
|
const hostComponents = t1;
|
|
632
704
|
let t2;
|
|
633
705
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
634
|
-
t2 = (value, t3) => {
|
|
635
|
-
|
|
706
|
+
t2 = (value, t3, t4) => {
|
|
707
|
+
const closeEditor = t3 === void 0 ? false : t3;
|
|
708
|
+
const remount = t4 === void 0 ? true : t4;
|
|
709
|
+
if (closeEditor) setOpen(false);
|
|
636
710
|
setApplied(structuredClone(value));
|
|
637
711
|
setDraft(structuredClone(value));
|
|
638
712
|
setPreviewConfiguration(null);
|
|
639
|
-
setRevision(_temp3$4);
|
|
713
|
+
if (remount) setRevision(_temp3$4);
|
|
640
714
|
};
|
|
641
715
|
$[1] = t2;
|
|
642
716
|
} else t2 = $[1];
|
|
@@ -821,7 +895,7 @@ function _temp3$4(current) {
|
|
|
821
895
|
function _temp2$5(count_0) {
|
|
822
896
|
return count_0 - 1;
|
|
823
897
|
}
|
|
824
|
-
function _temp$
|
|
898
|
+
function _temp$8(count) {
|
|
825
899
|
return count + 1;
|
|
826
900
|
}
|
|
827
901
|
function useUIConfiguration() {
|
|
@@ -909,7 +983,7 @@ function InspectorDetails(t0) {
|
|
|
909
983
|
$[13] = onSelect;
|
|
910
984
|
$[14] = t6;
|
|
911
985
|
} else t6 = $[14];
|
|
912
|
-
t5 = snapshot.groups.map(_temp$
|
|
986
|
+
t5 = snapshot.groups.map(_temp$7).filter(_temp2$4).map(t6);
|
|
913
987
|
$[10] = onSelect;
|
|
914
988
|
$[11] = snapshot.groups;
|
|
915
989
|
$[12] = t5;
|
|
@@ -926,7 +1000,7 @@ function InspectorDetails(t0) {
|
|
|
926
1000
|
function _temp2$4(group_0) {
|
|
927
1001
|
return group_0.properties.length;
|
|
928
1002
|
}
|
|
929
|
-
function _temp$
|
|
1003
|
+
function _temp$7(group) {
|
|
930
1004
|
return {
|
|
931
1005
|
name: group.name,
|
|
932
1006
|
properties: group.properties.filter((property) => group.name !== "Layout" || ![
|
|
@@ -2177,120 +2251,6 @@ function PreviewInspector({ children, revision, isKnown, onSelect, onScroll }) {
|
|
|
2177
2251
|
});
|
|
2178
2252
|
}
|
|
2179
2253
|
//#endregion
|
|
2180
|
-
//#region src/configurator/ConfigurationLauncher.tsx
|
|
2181
|
-
function ConfigurationLauncher({ position, onOpen }) {
|
|
2182
|
-
const ref = useRef(null);
|
|
2183
|
-
const gesture = useRef(null);
|
|
2184
|
-
const dragged = useRef(false);
|
|
2185
|
-
const pending = useRef(null);
|
|
2186
|
-
const frame = useRef(null);
|
|
2187
|
-
const place = useCallback((next) => {
|
|
2188
|
-
const element = ref.current;
|
|
2189
|
-
if (!element) return;
|
|
2190
|
-
const left = Math.max(8, Math.min(next.left, window.innerWidth - element.offsetWidth - 8));
|
|
2191
|
-
const top = Math.max(8, Math.min(next.top, window.innerHeight - element.offsetHeight - 8));
|
|
2192
|
-
position.current = {
|
|
2193
|
-
left,
|
|
2194
|
-
top
|
|
2195
|
-
};
|
|
2196
|
-
element.style.left = `${left}px`;
|
|
2197
|
-
element.style.top = `${top}px`;
|
|
2198
|
-
}, [position]);
|
|
2199
|
-
function finish() {
|
|
2200
|
-
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
2201
|
-
frame.current = null;
|
|
2202
|
-
if (pending.current) place(pending.current);
|
|
2203
|
-
pending.current = null;
|
|
2204
|
-
gesture.current = null;
|
|
2205
|
-
}
|
|
2206
|
-
useLayoutEffect(() => {
|
|
2207
|
-
const element_0 = ref.current;
|
|
2208
|
-
if (!element_0) return;
|
|
2209
|
-
const resize = () => place(position.current ?? {
|
|
2210
|
-
left: window.innerWidth - element_0.offsetWidth - 24,
|
|
2211
|
-
top: window.innerHeight - element_0.offsetHeight - 24
|
|
2212
|
-
});
|
|
2213
|
-
resize();
|
|
2214
|
-
window.addEventListener("resize", resize);
|
|
2215
|
-
return () => {
|
|
2216
|
-
window.removeEventListener("resize", resize);
|
|
2217
|
-
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
2218
|
-
if (pending.current) position.current = pending.current;
|
|
2219
|
-
};
|
|
2220
|
-
}, [place, position]);
|
|
2221
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
2222
|
-
ref,
|
|
2223
|
-
type: "button",
|
|
2224
|
-
className: "studio-floating-launcher",
|
|
2225
|
-
"aria-label": "Open Povio UI configuration",
|
|
2226
|
-
title: "Open Povio UI · Drag to move",
|
|
2227
|
-
onClick: (event) => {
|
|
2228
|
-
if (dragged.current && event.detail !== 0) {
|
|
2229
|
-
dragged.current = false;
|
|
2230
|
-
return;
|
|
2231
|
-
}
|
|
2232
|
-
onOpen();
|
|
2233
|
-
},
|
|
2234
|
-
onPointerDown: (event_0) => {
|
|
2235
|
-
if (event_0.button !== 0) return;
|
|
2236
|
-
const rect = event_0.currentTarget.getBoundingClientRect();
|
|
2237
|
-
dragged.current = false;
|
|
2238
|
-
gesture.current = {
|
|
2239
|
-
x: event_0.clientX,
|
|
2240
|
-
y: event_0.clientY,
|
|
2241
|
-
left: rect.left,
|
|
2242
|
-
top: rect.top,
|
|
2243
|
-
pointerId: event_0.pointerId
|
|
2244
|
-
};
|
|
2245
|
-
event_0.currentTarget.setPointerCapture(event_0.pointerId);
|
|
2246
|
-
},
|
|
2247
|
-
onPointerMove: (event_1) => {
|
|
2248
|
-
const start = gesture.current;
|
|
2249
|
-
if (!start || start.pointerId !== event_1.pointerId) return;
|
|
2250
|
-
const x = event_1.clientX - start.x;
|
|
2251
|
-
const y = event_1.clientY - start.y;
|
|
2252
|
-
if (!dragged.current && Math.hypot(x, y) < 5) return;
|
|
2253
|
-
dragged.current = true;
|
|
2254
|
-
pending.current = {
|
|
2255
|
-
left: start.left + x,
|
|
2256
|
-
top: start.top + y
|
|
2257
|
-
};
|
|
2258
|
-
if (frame.current !== null) return;
|
|
2259
|
-
frame.current = requestAnimationFrame(() => {
|
|
2260
|
-
frame.current = null;
|
|
2261
|
-
if (pending.current) place(pending.current);
|
|
2262
|
-
});
|
|
2263
|
-
},
|
|
2264
|
-
onPointerUp: (event_2) => {
|
|
2265
|
-
if (gesture.current?.pointerId !== event_2.pointerId) return;
|
|
2266
|
-
finish();
|
|
2267
|
-
if (event_2.currentTarget.hasPointerCapture(event_2.pointerId)) event_2.currentTarget.releasePointerCapture(event_2.pointerId);
|
|
2268
|
-
},
|
|
2269
|
-
onPointerCancel: finish,
|
|
2270
|
-
onLostPointerCapture: finish,
|
|
2271
|
-
onKeyDown: (event_3) => {
|
|
2272
|
-
const move = {
|
|
2273
|
-
ArrowLeft: [-1, 0],
|
|
2274
|
-
ArrowRight: [1, 0],
|
|
2275
|
-
ArrowUp: [0, -1],
|
|
2276
|
-
ArrowDown: [0, 1]
|
|
2277
|
-
}[event_3.key];
|
|
2278
|
-
if (!move || !position.current) return;
|
|
2279
|
-
event_3.preventDefault();
|
|
2280
|
-
const step = event_3.shiftKey ? 40 : 10;
|
|
2281
|
-
place({
|
|
2282
|
-
left: position.current.left + move[0] * step,
|
|
2283
|
-
top: position.current.top + move[1] * step
|
|
2284
|
-
});
|
|
2285
|
-
},
|
|
2286
|
-
children: [
|
|
2287
|
-
/* @__PURE__ */ jsx(SlidersHorizontal, { size: 18 }),
|
|
2288
|
-
/* @__PURE__ */ jsx("span", { children: "Povio UI" }),
|
|
2289
|
-
/* @__PURE__ */ jsx(GripVertical, { size: 16 })
|
|
2290
|
-
]
|
|
2291
|
-
});
|
|
2292
|
-
}
|
|
2293
|
-
//#endregion
|
|
2294
2254
|
//#region src/configurator/useStudioPopout.ts
|
|
2295
2255
|
const StudioPopoutContext = createContext(false);
|
|
2296
2256
|
/** Keep the popup's styles current without copying scripts or starting a second app. */
|
|
@@ -2635,6 +2595,7 @@ function useStudioWindow(bounds, enabled = true) {
|
|
|
2635
2595
|
onLostPointerCapture: move.onLostPointerCapture,
|
|
2636
2596
|
onPointerCancel: move.onPointerCancel,
|
|
2637
2597
|
onPointerDown(event_5) {
|
|
2598
|
+
if (!event_5.currentTarget.contains(event_5.target)) return;
|
|
2638
2599
|
if (event_5.target.closest("button, input, select, textarea, a, label, [role='tab']")) return;
|
|
2639
2600
|
move.onPointerDown(event_5);
|
|
2640
2601
|
}
|
|
@@ -2662,7 +2623,7 @@ function CvaPreview(t0) {
|
|
|
2662
2623
|
component = slot.split(".")[0];
|
|
2663
2624
|
const props = {
|
|
2664
2625
|
...definition?.config.defaultVariants,
|
|
2665
|
-
...Object.fromEntries(Object.entries(variants).filter(_temp$
|
|
2626
|
+
...Object.fromEntries(Object.entries(variants).filter(_temp$6).map(_temp2$3))
|
|
2666
2627
|
};
|
|
2667
2628
|
const classes = (key, t4) => {
|
|
2668
2629
|
const extra = t4 === void 0 ? {} : t4;
|
|
@@ -3431,7 +3392,7 @@ function _temp2$3(t0) {
|
|
|
3431
3392
|
const [name, value_0] = t0;
|
|
3432
3393
|
return [name, value_0 === "true" ? true : value_0 === "false" ? false : value_0];
|
|
3433
3394
|
}
|
|
3434
|
-
function _temp$
|
|
3395
|
+
function _temp$6(t0) {
|
|
3435
3396
|
const [, value] = t0;
|
|
3436
3397
|
return value !== "";
|
|
3437
3398
|
}
|
|
@@ -3587,7 +3548,7 @@ function ClassField(t0) {
|
|
|
3587
3548
|
onFocus,
|
|
3588
3549
|
onChange: t4,
|
|
3589
3550
|
onBlur: t5,
|
|
3590
|
-
onKeyDown: _temp$
|
|
3551
|
+
onKeyDown: _temp$5
|
|
3591
3552
|
});
|
|
3592
3553
|
$[10] = label;
|
|
3593
3554
|
$[11] = onFocus;
|
|
@@ -3608,7 +3569,7 @@ function ClassField(t0) {
|
|
|
3608
3569
|
} else t7 = $[17];
|
|
3609
3570
|
return t7;
|
|
3610
3571
|
}
|
|
3611
|
-
function _temp$
|
|
3572
|
+
function _temp$5(event_0) {
|
|
3612
3573
|
if (event_0.key === "Enter" && !event_0.nativeEvent.isComposing) {
|
|
3613
3574
|
event_0.preventDefault();
|
|
3614
3575
|
event_0.currentTarget.parentElement?.focus();
|
|
@@ -3978,6 +3939,342 @@ async function saveThemeCss(connection, css) {
|
|
|
3978
3939
|
}
|
|
3979
3940
|
}
|
|
3980
3941
|
//#endregion
|
|
3942
|
+
//#region src/configurator/theme-versions.ts
|
|
3943
|
+
const themeVersionsMetaName = "povio-ui-theme-versions";
|
|
3944
|
+
function createThemeVersion(name, id, configuration) {
|
|
3945
|
+
return {
|
|
3946
|
+
id,
|
|
3947
|
+
name: name.trim() || "Theme",
|
|
3948
|
+
...configuration ? { configuration: structuredClone(configuration) } : {}
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
function createThemeVersions() {
|
|
3952
|
+
return {
|
|
3953
|
+
version: 1,
|
|
3954
|
+
versions: [createThemeVersion("Default", "default")],
|
|
3955
|
+
activeVersionId: "default"
|
|
3956
|
+
};
|
|
3957
|
+
}
|
|
3958
|
+
function isRecord(value) {
|
|
3959
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3960
|
+
}
|
|
3961
|
+
function safeJSON(value, ancestors = /* @__PURE__ */ new Set(), depth = 0) {
|
|
3962
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
3963
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
3964
|
+
if (typeof value !== "object" || depth > 30 || ancestors.has(value)) return false;
|
|
3965
|
+
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return false;
|
|
3966
|
+
ancestors.add(value);
|
|
3967
|
+
const valid = Object.entries(value).every(([key, child]) => ![
|
|
3968
|
+
"__proto__",
|
|
3969
|
+
"prototype",
|
|
3970
|
+
"constructor"
|
|
3971
|
+
].includes(key) && safeJSON(child, ancestors, depth + 1));
|
|
3972
|
+
ancestors.delete(value);
|
|
3973
|
+
return valid;
|
|
3974
|
+
}
|
|
3975
|
+
const stringMap = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
|
|
3976
|
+
const variantValue = (value) => value === null || typeof value === "string" || typeof value === "boolean";
|
|
3977
|
+
function validCvaEdits(value) {
|
|
3978
|
+
return isRecord(value) && Object.entries(value).every(([slot, definition]) => {
|
|
3979
|
+
if (!/^[a-zA-Z][a-zA-Z0-9]*\.[a-zA-Z][a-zA-Z0-9]*$/.test(slot) || !isRecord(definition) || !Array.isArray(definition.base) || !definition.base.every((item) => typeof item === "string") || !isRecord(definition.config)) return false;
|
|
3980
|
+
const config = definition.config;
|
|
3981
|
+
return isRecord(config.variants) && Object.values(config.variants).every(stringMap) && isRecord(config.defaultVariants) && Object.values(config.defaultVariants).every(variantValue) && Array.isArray(config.compoundVariants) && config.compoundVariants.every((compound) => isRecord(compound) && Object.values(compound).every((item) => variantValue(item) || Array.isArray(item) && (item.every((part) => typeof part === "string") || item.every((part) => typeof part === "boolean"))));
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
/** Returns an independent JSON configuration, or undefined for invalid/unset overrides. */
|
|
3985
|
+
function parseUIConfiguration(value) {
|
|
3986
|
+
if (!isRecord(value) || !safeJSON(value) || !isRecord(value.theme) || ![
|
|
3987
|
+
"light",
|
|
3988
|
+
"dark",
|
|
3989
|
+
"theme"
|
|
3990
|
+
].every((key) => stringMap(value.theme && value.theme[key])) || !isRecord(value.config) || value.overrides !== void 0 && !validCvaEdits(value.overrides)) return void 0;
|
|
3991
|
+
return JSON.parse(JSON.stringify(value));
|
|
3992
|
+
}
|
|
3993
|
+
/** Returns an independent component configuration, or undefined when invalid. */
|
|
3994
|
+
function parseComponentConfiguration(value) {
|
|
3995
|
+
if (!isRecord(value) || !safeJSON(value) || !isRecord(value.config) || value.overrides !== void 0 && !validCvaEdits(value.overrides)) return void 0;
|
|
3996
|
+
const copy = JSON.parse(JSON.stringify(value));
|
|
3997
|
+
return {
|
|
3998
|
+
config: copy.config ?? {},
|
|
3999
|
+
overrides: copy.overrides ?? {}
|
|
4000
|
+
};
|
|
4001
|
+
}
|
|
4002
|
+
/** Sanitize stored JSON text or a repository value. */
|
|
4003
|
+
function parseThemeVersions(input) {
|
|
4004
|
+
const fallback = createThemeVersions();
|
|
4005
|
+
let value = input;
|
|
4006
|
+
if (typeof value === "string") try {
|
|
4007
|
+
value = JSON.parse(value);
|
|
4008
|
+
} catch {
|
|
4009
|
+
return fallback;
|
|
4010
|
+
}
|
|
4011
|
+
if (!isRecord(value) || value.version !== 1 || !Array.isArray(value.versions)) return fallback;
|
|
4012
|
+
const versions = [];
|
|
4013
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4014
|
+
for (const entry of value.versions) {
|
|
4015
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || !entry.id.trim() || ids.has(entry.id)) continue;
|
|
4016
|
+
ids.add(entry.id);
|
|
4017
|
+
const configuration = parseUIConfiguration(entry.configuration);
|
|
4018
|
+
versions.push({
|
|
4019
|
+
id: entry.id,
|
|
4020
|
+
name: typeof entry.name === "string" && entry.name.trim() ? entry.name.trim() : "Theme",
|
|
4021
|
+
...configuration ? { configuration } : {}
|
|
4022
|
+
});
|
|
4023
|
+
}
|
|
4024
|
+
if (!versions.length) return fallback;
|
|
4025
|
+
return {
|
|
4026
|
+
version: 1,
|
|
4027
|
+
versions,
|
|
4028
|
+
activeVersionId: typeof value.activeVersionId === "string" && versions.some((version) => version.id === value.activeVersionId) ? value.activeVersionId : versions[0].id
|
|
4029
|
+
};
|
|
4030
|
+
}
|
|
4031
|
+
//#endregion
|
|
4032
|
+
//#region src/configurator/component-configuration.ts
|
|
4033
|
+
const emptyComponentConfiguration = () => ({
|
|
4034
|
+
config: {},
|
|
4035
|
+
overrides: {}
|
|
4036
|
+
});
|
|
4037
|
+
/**
|
|
4038
|
+
* The app's applied component settings: pass the JSON written by the configurator's Apply theme
|
|
4039
|
+
* and the app's code-level overrides, which stay underneath the applied variant overrides.
|
|
4040
|
+
*/
|
|
4041
|
+
function resolveUIConfiguration(file, baseOverrides) {
|
|
4042
|
+
const { config, overrides } = parseComponentConfiguration(file) ?? emptyComponentConfiguration();
|
|
4043
|
+
return {
|
|
4044
|
+
config,
|
|
4045
|
+
overrides: applyCvaEdits(baseOverrides, overrides)
|
|
4046
|
+
};
|
|
4047
|
+
}
|
|
4048
|
+
/** Key-order independent JSON without empty objects, for comparing component configurations. */
|
|
4049
|
+
function canonicalJSON(value) {
|
|
4050
|
+
const normalize = (item) => {
|
|
4051
|
+
if (Array.isArray(item)) return item.map(normalize);
|
|
4052
|
+
if (!item || typeof item !== "object") return item;
|
|
4053
|
+
const entries = Object.keys(item).sort().flatMap((key) => {
|
|
4054
|
+
const child = normalize(item[key]);
|
|
4055
|
+
return child === void 0 || child && typeof child === "object" && !Array.isArray(child) && !Object.keys(child).length ? [] : [[key, child]];
|
|
4056
|
+
});
|
|
4057
|
+
return Object.fromEntries(entries);
|
|
4058
|
+
};
|
|
4059
|
+
return JSON.stringify(normalize(value));
|
|
4060
|
+
}
|
|
4061
|
+
//#endregion
|
|
4062
|
+
//#region src/configurator/repository-storage-protocol.ts
|
|
4063
|
+
const componentConfigurationMetaName = "povio-ui-component-configuration";
|
|
4064
|
+
const repositoryStorageTokenHeader = "x-povio-ui-storage-token";
|
|
4065
|
+
/** Dev-server event sent when a repository storage file changes, so other tabs reload it. */
|
|
4066
|
+
const repositoryStorageChangedEvent = "povio-ui:repository-storage-changed";
|
|
4067
|
+
//#endregion
|
|
4068
|
+
//#region src/configurator/useRepositoryStorage.ts
|
|
4069
|
+
const hot = import.meta.hot;
|
|
4070
|
+
function connectionFromDocument(metaName) {
|
|
4071
|
+
if (typeof document === "undefined") return null;
|
|
4072
|
+
try {
|
|
4073
|
+
const value = JSON.parse(document.querySelector(`meta[name="${metaName}"]`)?.content ?? "null");
|
|
4074
|
+
return value && typeof value.endpoint === "string" && value.endpoint.startsWith("/") && !value.endpoint.startsWith("//") && typeof value.token === "string" && typeof value.file === "string" ? value : null;
|
|
4075
|
+
} catch {
|
|
4076
|
+
return null;
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
/** Repo is authoritative when connected; local storage remains an offline draft cache. */
|
|
4080
|
+
function useRepositoryStorage({ key, metaName, field, parse, noun, enabled = true }) {
|
|
4081
|
+
const Noun = `${noun[0].toUpperCase()}${noun.slice(1)}`;
|
|
4082
|
+
const [connection] = useState(() => enabled ? connectionFromDocument(metaName) : null);
|
|
4083
|
+
const [value, setValue] = useState(() => {
|
|
4084
|
+
try {
|
|
4085
|
+
return parse(localStorage.getItem(key));
|
|
4086
|
+
} catch {
|
|
4087
|
+
return parse(null);
|
|
4088
|
+
}
|
|
4089
|
+
});
|
|
4090
|
+
const [ready, setReady] = useState(!connection);
|
|
4091
|
+
const [status, setStatus] = useState(connection ? `Loading ${noun}…` : "Saved in this browser");
|
|
4092
|
+
const [error, setError] = useState("");
|
|
4093
|
+
const latest = useRef(value);
|
|
4094
|
+
latest.current = value;
|
|
4095
|
+
const revision = useRef(null);
|
|
4096
|
+
const saved = useRef("");
|
|
4097
|
+
const busy = useRef(false);
|
|
4098
|
+
const paused = useRef(false);
|
|
4099
|
+
const alive = useRef(true);
|
|
4100
|
+
const loadGeneration = useRef(0);
|
|
4101
|
+
useEffect(() => {
|
|
4102
|
+
alive.current = true;
|
|
4103
|
+
return () => {
|
|
4104
|
+
alive.current = false;
|
|
4105
|
+
};
|
|
4106
|
+
}, []);
|
|
4107
|
+
const read = useCallback(async (quiet) => {
|
|
4108
|
+
if (!connection) return;
|
|
4109
|
+
const generation = ++loadGeneration.current;
|
|
4110
|
+
if (!quiet) {
|
|
4111
|
+
setReady(false);
|
|
4112
|
+
setError("");
|
|
4113
|
+
setStatus(`Loading ${noun}…`);
|
|
4114
|
+
}
|
|
4115
|
+
paused.current = false;
|
|
4116
|
+
try {
|
|
4117
|
+
const response = await fetch(connection.endpoint, {
|
|
4118
|
+
headers: { [repositoryStorageTokenHeader]: connection.token },
|
|
4119
|
+
cache: "no-store"
|
|
4120
|
+
});
|
|
4121
|
+
const result = await response.json();
|
|
4122
|
+
if (!response.ok) throw new Error(result.error ?? `Could not read ${noun} settings.`);
|
|
4123
|
+
if (!alive.current || generation !== loadGeneration.current) return;
|
|
4124
|
+
revision.current = result.revision;
|
|
4125
|
+
if (result[field]) {
|
|
4126
|
+
const next = parse(result[field]);
|
|
4127
|
+
saved.current = JSON.stringify(next);
|
|
4128
|
+
latest.current = next;
|
|
4129
|
+
setValue(next);
|
|
4130
|
+
} else saved.current = "";
|
|
4131
|
+
setStatus(`Saved to ${connection.file}`);
|
|
4132
|
+
setReady(true);
|
|
4133
|
+
} catch (cause) {
|
|
4134
|
+
if (!alive.current || generation !== loadGeneration.current) return;
|
|
4135
|
+
paused.current = true;
|
|
4136
|
+
setError(cause instanceof Error ? cause.message : "Could not load repository settings.");
|
|
4137
|
+
setStatus("Repository unavailable");
|
|
4138
|
+
setReady(true);
|
|
4139
|
+
}
|
|
4140
|
+
}, [
|
|
4141
|
+
connection,
|
|
4142
|
+
field,
|
|
4143
|
+
noun,
|
|
4144
|
+
parse
|
|
4145
|
+
]);
|
|
4146
|
+
const load = useCallback(() => read(false), [read]);
|
|
4147
|
+
useEffect(() => {
|
|
4148
|
+
load();
|
|
4149
|
+
}, [load]);
|
|
4150
|
+
useEffect(() => {
|
|
4151
|
+
if (!connection || !hot) return;
|
|
4152
|
+
const changed = (change) => {
|
|
4153
|
+
if (change.endpoint !== connection.endpoint || change.revision === revision.current) return;
|
|
4154
|
+
if (busy.current || JSON.stringify(latest.current) !== saved.current) return;
|
|
4155
|
+
read(true);
|
|
4156
|
+
};
|
|
4157
|
+
hot.on(repositoryStorageChangedEvent, changed);
|
|
4158
|
+
return () => hot.off?.(repositoryStorageChangedEvent, changed);
|
|
4159
|
+
}, [connection, read]);
|
|
4160
|
+
const save = useCallback(async () => {
|
|
4161
|
+
if (!connection || busy.current || paused.current || !ready) return;
|
|
4162
|
+
busy.current = true;
|
|
4163
|
+
try {
|
|
4164
|
+
while (alive.current && !paused.current) {
|
|
4165
|
+
const current = latest.current;
|
|
4166
|
+
const serialized = JSON.stringify(current);
|
|
4167
|
+
if (serialized === saved.current) break;
|
|
4168
|
+
setStatus("Saving to repository…");
|
|
4169
|
+
const response_0 = await fetch(connection.endpoint, {
|
|
4170
|
+
method: "POST",
|
|
4171
|
+
headers: {
|
|
4172
|
+
"Content-Type": "application/json",
|
|
4173
|
+
[repositoryStorageTokenHeader]: connection.token
|
|
4174
|
+
},
|
|
4175
|
+
body: JSON.stringify({
|
|
4176
|
+
[field]: current,
|
|
4177
|
+
revision: revision.current
|
|
4178
|
+
})
|
|
4179
|
+
});
|
|
4180
|
+
const result_0 = await response_0.json();
|
|
4181
|
+
if (!response_0.ok) throw new Error(response_0.status === 409 ? `${Noun} file changed elsewhere. Export your draft, then reload repository settings.` : result_0.error ?? `Could not save ${noun} settings.`);
|
|
4182
|
+
revision.current = result_0.revision;
|
|
4183
|
+
saved.current = serialized;
|
|
4184
|
+
}
|
|
4185
|
+
if (alive.current) {
|
|
4186
|
+
setError("");
|
|
4187
|
+
setStatus(`Saved to ${connection.file}`);
|
|
4188
|
+
}
|
|
4189
|
+
} catch (cause_0) {
|
|
4190
|
+
paused.current = true;
|
|
4191
|
+
if (alive.current) {
|
|
4192
|
+
setError(cause_0 instanceof Error ? cause_0.message : `Could not save ${noun} settings.`);
|
|
4193
|
+
setStatus(`${Noun} not saved to repository`);
|
|
4194
|
+
}
|
|
4195
|
+
} finally {
|
|
4196
|
+
busy.current = false;
|
|
4197
|
+
}
|
|
4198
|
+
}, [
|
|
4199
|
+
connection,
|
|
4200
|
+
field,
|
|
4201
|
+
noun,
|
|
4202
|
+
Noun,
|
|
4203
|
+
ready
|
|
4204
|
+
]);
|
|
4205
|
+
useEffect(() => {
|
|
4206
|
+
if (!ready) return;
|
|
4207
|
+
try {
|
|
4208
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
4209
|
+
} catch {
|
|
4210
|
+
if (!connection) setStatus(`Browser storage unavailable — export your ${noun}`);
|
|
4211
|
+
}
|
|
4212
|
+
if (!connection || paused.current || JSON.stringify(value) === saved.current) return;
|
|
4213
|
+
setStatus("Saving to repository…");
|
|
4214
|
+
const timer = setTimeout(() => {
|
|
4215
|
+
save();
|
|
4216
|
+
}, 350);
|
|
4217
|
+
return () => clearTimeout(timer);
|
|
4218
|
+
}, [
|
|
4219
|
+
value,
|
|
4220
|
+
key,
|
|
4221
|
+
connection,
|
|
4222
|
+
noun,
|
|
4223
|
+
ready,
|
|
4224
|
+
save
|
|
4225
|
+
]);
|
|
4226
|
+
return {
|
|
4227
|
+
value,
|
|
4228
|
+
setValue,
|
|
4229
|
+
ready,
|
|
4230
|
+
status,
|
|
4231
|
+
error,
|
|
4232
|
+
repositoryFile: connection?.file,
|
|
4233
|
+
reload: load
|
|
4234
|
+
};
|
|
4235
|
+
}
|
|
4236
|
+
//#endregion
|
|
4237
|
+
//#region src/configurator/component-configuration-client.ts
|
|
4238
|
+
const getComponentConfigurationWriter = () => connectionFromDocument(componentConfigurationMetaName);
|
|
4239
|
+
async function request(writer, init) {
|
|
4240
|
+
const response = await fetch(writer.endpoint, {
|
|
4241
|
+
...init,
|
|
4242
|
+
cache: "no-store",
|
|
4243
|
+
headers: {
|
|
4244
|
+
...init?.headers,
|
|
4245
|
+
[repositoryStorageTokenHeader]: writer.token
|
|
4246
|
+
}
|
|
4247
|
+
});
|
|
4248
|
+
return {
|
|
4249
|
+
response,
|
|
4250
|
+
result: await response.json()
|
|
4251
|
+
};
|
|
4252
|
+
}
|
|
4253
|
+
/** The component configuration in the repository, or null when the file does not exist yet. */
|
|
4254
|
+
async function readComponentConfiguration(writer) {
|
|
4255
|
+
const { response, result } = await request(writer);
|
|
4256
|
+
if (!response.ok) throw new Error(result.error ?? "Could not read UI configuration.");
|
|
4257
|
+
return {
|
|
4258
|
+
configuration: result.configuration ? parseComponentConfiguration(result.configuration) ?? null : null,
|
|
4259
|
+
revision: result.revision
|
|
4260
|
+
};
|
|
4261
|
+
}
|
|
4262
|
+
/** Applying is explicit, so a file changed elsewhere is re-read and overwritten once. */
|
|
4263
|
+
async function saveComponentConfiguration(writer, configuration, revision) {
|
|
4264
|
+
const post = (current) => request(writer, {
|
|
4265
|
+
method: "POST",
|
|
4266
|
+
headers: { "Content-Type": "application/json" },
|
|
4267
|
+
body: JSON.stringify({
|
|
4268
|
+
configuration,
|
|
4269
|
+
revision: current
|
|
4270
|
+
})
|
|
4271
|
+
});
|
|
4272
|
+
let { response, result } = await post(revision);
|
|
4273
|
+
if (response.status === 409) ({response, result} = await post((await readComponentConfiguration(writer)).revision));
|
|
4274
|
+
if (!response.ok) throw new Error(result.error ?? "Could not save UI configuration.");
|
|
4275
|
+
return result.revision;
|
|
4276
|
+
}
|
|
4277
|
+
//#endregion
|
|
3981
4278
|
//#region src/configurator/ColorModeSwitch.tsx
|
|
3982
4279
|
/** Controlled color-mode switch, shared by configurators and application settings. */
|
|
3983
4280
|
function ColorModeSwitch(t0) {
|
|
@@ -4051,7 +4348,7 @@ function AlphaColorField(t0) {
|
|
|
4051
4348
|
setPercentText(null);
|
|
4052
4349
|
if (Number.isFinite(entered_0)) onChange(`#${color}${toAlpha(entered_0)}`);
|
|
4053
4350
|
};
|
|
4054
|
-
const blurOnEnter = _temp$
|
|
4351
|
+
const blurOnEnter = _temp$4;
|
|
4055
4352
|
const t1 = `#${color}`;
|
|
4056
4353
|
let t2;
|
|
4057
4354
|
if ($[0] !== t1 || $[1] !== value) {
|
|
@@ -4153,7 +4450,7 @@ function AlphaColorField(t0) {
|
|
|
4153
4450
|
]
|
|
4154
4451
|
});
|
|
4155
4452
|
}
|
|
4156
|
-
function _temp$
|
|
4453
|
+
function _temp$4(event) {
|
|
4157
4454
|
if (event.key === "Enter" && !event.nativeEvent.isComposing) event.currentTarget.blur();
|
|
4158
4455
|
}
|
|
4159
4456
|
//#endregion
|
|
@@ -4251,7 +4548,7 @@ function PaletteSelect(t0) {
|
|
|
4251
4548
|
} else t6 = $[14];
|
|
4252
4549
|
let t7;
|
|
4253
4550
|
if ($[15] !== options) {
|
|
4254
|
-
t7 = paletteFamilies(options).map(_temp$
|
|
4551
|
+
t7 = paletteFamilies(options).map(_temp$3);
|
|
4255
4552
|
$[15] = options;
|
|
4256
4553
|
$[16] = t7;
|
|
4257
4554
|
} else t7 = $[16];
|
|
@@ -4412,7 +4709,7 @@ function _temp2$1(t0) {
|
|
|
4412
4709
|
})]
|
|
4413
4710
|
}, name_0);
|
|
4414
4711
|
}
|
|
4415
|
-
function _temp$
|
|
4712
|
+
function _temp$3(t0) {
|
|
4416
4713
|
const { family: name, steps } = t0;
|
|
4417
4714
|
return /* @__PURE__ */ jsx("optgroup", {
|
|
4418
4715
|
label: `Base palette / ${name}`,
|
|
@@ -4585,7 +4882,7 @@ function useLoadedFonts() {
|
|
|
4585
4882
|
const [revision, setRevision] = useState(0);
|
|
4586
4883
|
let t1;
|
|
4587
4884
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
4588
|
-
t1 = () => setRevision(_temp$
|
|
4885
|
+
t1 = () => setRevision(_temp$2);
|
|
4589
4886
|
$[1] = t1;
|
|
4590
4887
|
} else t1 = $[1];
|
|
4591
4888
|
const refresh = t1;
|
|
@@ -4634,7 +4931,7 @@ function useLoadedFonts() {
|
|
|
4634
4931
|
function _temp2(face) {
|
|
4635
4932
|
return unquote(face.family);
|
|
4636
4933
|
}
|
|
4637
|
-
function _temp$
|
|
4934
|
+
function _temp$2(value) {
|
|
4638
4935
|
return value + 1;
|
|
4639
4936
|
}
|
|
4640
4937
|
const uploadedFamilies = /* @__PURE__ */ new Set();
|
|
@@ -5266,7 +5563,7 @@ function ShadesGenerator(t0) {
|
|
|
5266
5563
|
if ($[2] !== initial || $[3] !== steps || $[4] !== text || $[5] !== title) {
|
|
5267
5564
|
const hex = text.trim().replace(/^#/, "");
|
|
5268
5565
|
base = /^[0-9a-f]{6}$/i.test(hex) ? toRgb(`#${hex}`) : /^[0-9a-f]{3}$/i.test(hex) ? toRgb(`#${hex.replace(/./g, "$&$&")}`) : null;
|
|
5269
|
-
shades = base ? generateShades(base, steps.map(_temp)) : null;
|
|
5566
|
+
shades = base ? generateShades(base, steps.map(_temp$1)) : null;
|
|
5270
5567
|
pending = !!shades && base !== initial;
|
|
5271
5568
|
t8 = "studio-shades";
|
|
5272
5569
|
t9 = "group";
|
|
@@ -5437,13 +5734,13 @@ function ShadesGenerator(t0) {
|
|
|
5437
5734
|
} else t18 = $[51];
|
|
5438
5735
|
return t18;
|
|
5439
5736
|
}
|
|
5440
|
-
function _temp(t0) {
|
|
5737
|
+
function _temp$1(t0) {
|
|
5441
5738
|
const { step } = t0;
|
|
5442
5739
|
return step;
|
|
5443
5740
|
}
|
|
5444
5741
|
//#endregion
|
|
5445
5742
|
//#region src/configurator/ComponentPreview.tsx
|
|
5446
|
-
const ComponentGallery = lazy(() => import("./ComponentGallery-
|
|
5743
|
+
const ComponentGallery = lazy(() => import("./ComponentGallery-COqEqqN6.js"));
|
|
5447
5744
|
/** Every component, styled by a configuration; the configurator's preview and the App Canvas Components view. */
|
|
5448
5745
|
function ComponentPreview(t0) {
|
|
5449
5746
|
const $ = c(14);
|
|
@@ -5503,6 +5800,543 @@ function ComponentPreview(t0) {
|
|
|
5503
5800
|
return t8;
|
|
5504
5801
|
}
|
|
5505
5802
|
//#endregion
|
|
5803
|
+
//#region src/configurator/ThemeVersionControls.tsx
|
|
5804
|
+
/** Switches, creates, renames and deletes theme versions from the configurator's title row. */
|
|
5805
|
+
function ThemeVersionControls(t0) {
|
|
5806
|
+
const $ = c(84);
|
|
5807
|
+
const { state } = t0;
|
|
5808
|
+
const { themes, setThemes, active, ready, error, status } = state;
|
|
5809
|
+
const createTrigger = useRef(null);
|
|
5810
|
+
const editTrigger = useRef(null);
|
|
5811
|
+
const [action, setAction] = useState(null);
|
|
5812
|
+
const [name, setName] = useState("");
|
|
5813
|
+
const disabled = !ready;
|
|
5814
|
+
let t1;
|
|
5815
|
+
if ($[0] !== active.name) {
|
|
5816
|
+
t1 = (next) => {
|
|
5817
|
+
setName(next === "create" ? `${active.name} copy` : active.name);
|
|
5818
|
+
setAction(next);
|
|
5819
|
+
};
|
|
5820
|
+
$[0] = active.name;
|
|
5821
|
+
$[1] = t1;
|
|
5822
|
+
} else t1 = $[1];
|
|
5823
|
+
const open = t1;
|
|
5824
|
+
const title = action === "create" ? "New theme version" : action === "delete" ? "Delete theme version?" : "Edit theme version";
|
|
5825
|
+
let t2;
|
|
5826
|
+
if ($[2] !== action || $[3] !== active.configuration || $[4] !== active.id || $[5] !== disabled || $[6] !== name || $[7] !== setThemes) {
|
|
5827
|
+
t2 = () => {
|
|
5828
|
+
if (disabled || !action) return;
|
|
5829
|
+
if (action !== "delete" && !name.trim()) return;
|
|
5830
|
+
if (action === "create") {
|
|
5831
|
+
const created = createThemeVersion(name, crypto.randomUUID(), active.configuration);
|
|
5832
|
+
setThemes((current) => ({
|
|
5833
|
+
...current,
|
|
5834
|
+
versions: [...current.versions, created],
|
|
5835
|
+
activeVersionId: created.id
|
|
5836
|
+
}));
|
|
5837
|
+
} else if (action === "delete") setThemes((current_0) => {
|
|
5838
|
+
if (current_0.versions.length < 2) return current_0;
|
|
5839
|
+
const remaining = current_0.versions.filter((version) => version.id !== active.id);
|
|
5840
|
+
return {
|
|
5841
|
+
...current_0,
|
|
5842
|
+
versions: remaining,
|
|
5843
|
+
activeVersionId: remaining[0].id
|
|
5844
|
+
};
|
|
5845
|
+
});
|
|
5846
|
+
else setThemes((current_1) => ({
|
|
5847
|
+
...current_1,
|
|
5848
|
+
versions: current_1.versions.map((version_0) => version_0.id === active.id ? {
|
|
5849
|
+
...version_0,
|
|
5850
|
+
name: name.trim()
|
|
5851
|
+
} : version_0)
|
|
5852
|
+
}));
|
|
5853
|
+
setAction(null);
|
|
5854
|
+
};
|
|
5855
|
+
$[2] = action;
|
|
5856
|
+
$[3] = active.configuration;
|
|
5857
|
+
$[4] = active.id;
|
|
5858
|
+
$[5] = disabled;
|
|
5859
|
+
$[6] = name;
|
|
5860
|
+
$[7] = setThemes;
|
|
5861
|
+
$[8] = t2;
|
|
5862
|
+
} else t2 = $[8];
|
|
5863
|
+
const save = t2;
|
|
5864
|
+
let t3;
|
|
5865
|
+
if ($[9] !== setThemes) {
|
|
5866
|
+
t3 = (id) => {
|
|
5867
|
+
if (id !== null) setThemes((current_2) => ({
|
|
5868
|
+
...current_2,
|
|
5869
|
+
activeVersionId: String(id)
|
|
5870
|
+
}));
|
|
5871
|
+
};
|
|
5872
|
+
$[9] = setThemes;
|
|
5873
|
+
$[10] = t3;
|
|
5874
|
+
} else t3 = $[10];
|
|
5875
|
+
let t4;
|
|
5876
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
5877
|
+
t4 = /* @__PURE__ */ jsxs($7705c033048f6da7$export$353f5b6fc5456de1, {
|
|
5878
|
+
className: "studio-version-trigger",
|
|
5879
|
+
children: [/* @__PURE__ */ jsx($c8bb816105474884$export$e288731fd71264f0, {}), /* @__PURE__ */ jsx(ChevronDown, {
|
|
5880
|
+
size: 12,
|
|
5881
|
+
"aria-hidden": "true"
|
|
5882
|
+
})]
|
|
5883
|
+
});
|
|
5884
|
+
$[11] = t4;
|
|
5885
|
+
} else t4 = $[11];
|
|
5886
|
+
let t5;
|
|
5887
|
+
if ($[12] !== themes.versions) {
|
|
5888
|
+
t5 = /* @__PURE__ */ jsx($542a13ca2fa5b484$export$5b6b19405a83ff9d, {
|
|
5889
|
+
className: "studio-version-popover",
|
|
5890
|
+
placement: "bottom start",
|
|
5891
|
+
children: /* @__PURE__ */ jsx($928221da08ecbc62$export$41f133550aa26f48, {
|
|
5892
|
+
className: "studio-version-list",
|
|
5893
|
+
items: themes.versions,
|
|
5894
|
+
children: _temp
|
|
5895
|
+
})
|
|
5896
|
+
});
|
|
5897
|
+
$[12] = themes.versions;
|
|
5898
|
+
$[13] = t5;
|
|
5899
|
+
} else t5 = $[13];
|
|
5900
|
+
let t6;
|
|
5901
|
+
if ($[14] !== active.id || $[15] !== disabled || $[16] !== t3 || $[17] !== t5) {
|
|
5902
|
+
t6 = /* @__PURE__ */ jsxs($c8bb816105474884$export$ef9b1a59e592288f, {
|
|
5903
|
+
"aria-label": "Theme version",
|
|
5904
|
+
className: "studio-version-select",
|
|
5905
|
+
selectedKey: active.id,
|
|
5906
|
+
isDisabled: disabled,
|
|
5907
|
+
onSelectionChange: t3,
|
|
5908
|
+
children: [t4, t5]
|
|
5909
|
+
});
|
|
5910
|
+
$[14] = active.id;
|
|
5911
|
+
$[15] = disabled;
|
|
5912
|
+
$[16] = t3;
|
|
5913
|
+
$[17] = t5;
|
|
5914
|
+
$[18] = t6;
|
|
5915
|
+
} else t6 = $[18];
|
|
5916
|
+
let t7;
|
|
5917
|
+
if ($[19] !== open) {
|
|
5918
|
+
t7 = () => open("create");
|
|
5919
|
+
$[19] = open;
|
|
5920
|
+
$[20] = t7;
|
|
5921
|
+
} else t7 = $[20];
|
|
5922
|
+
let t8;
|
|
5923
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
5924
|
+
t8 = /* @__PURE__ */ jsx(Plus, { size: 14 });
|
|
5925
|
+
$[21] = t8;
|
|
5926
|
+
} else t8 = $[21];
|
|
5927
|
+
let t9;
|
|
5928
|
+
if ($[22] !== disabled || $[23] !== t7) {
|
|
5929
|
+
t9 = /* @__PURE__ */ jsx("button", {
|
|
5930
|
+
ref: createTrigger,
|
|
5931
|
+
type: "button",
|
|
5932
|
+
className: "studio-version-action",
|
|
5933
|
+
"aria-label": "Add theme version",
|
|
5934
|
+
title: "Add theme version",
|
|
5935
|
+
disabled,
|
|
5936
|
+
onClick: t7,
|
|
5937
|
+
children: t8
|
|
5938
|
+
});
|
|
5939
|
+
$[22] = disabled;
|
|
5940
|
+
$[23] = t7;
|
|
5941
|
+
$[24] = t9;
|
|
5942
|
+
} else t9 = $[24];
|
|
5943
|
+
let t10;
|
|
5944
|
+
if ($[25] !== open) {
|
|
5945
|
+
t10 = () => open("rename");
|
|
5946
|
+
$[25] = open;
|
|
5947
|
+
$[26] = t10;
|
|
5948
|
+
} else t10 = $[26];
|
|
5949
|
+
let t11;
|
|
5950
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
5951
|
+
t11 = /* @__PURE__ */ jsx(Pencil, { size: 14 });
|
|
5952
|
+
$[27] = t11;
|
|
5953
|
+
} else t11 = $[27];
|
|
5954
|
+
let t12;
|
|
5955
|
+
if ($[28] !== disabled || $[29] !== t10) {
|
|
5956
|
+
t12 = /* @__PURE__ */ jsx("button", {
|
|
5957
|
+
ref: editTrigger,
|
|
5958
|
+
type: "button",
|
|
5959
|
+
className: "studio-version-action",
|
|
5960
|
+
"aria-label": "Edit theme version",
|
|
5961
|
+
title: "Edit theme version",
|
|
5962
|
+
disabled,
|
|
5963
|
+
onClick: t10,
|
|
5964
|
+
children: t11
|
|
5965
|
+
});
|
|
5966
|
+
$[28] = disabled;
|
|
5967
|
+
$[29] = t10;
|
|
5968
|
+
$[30] = t12;
|
|
5969
|
+
} else t12 = $[30];
|
|
5970
|
+
let t13;
|
|
5971
|
+
if ($[31] !== error) {
|
|
5972
|
+
t13 = error && /* @__PURE__ */ jsx("p", {
|
|
5973
|
+
className: "studio-version-error",
|
|
5974
|
+
role: "alert",
|
|
5975
|
+
children: error
|
|
5976
|
+
});
|
|
5977
|
+
$[31] = error;
|
|
5978
|
+
$[32] = t13;
|
|
5979
|
+
} else t13 = $[32];
|
|
5980
|
+
const t14 = action === "create" ? createTrigger : editTrigger;
|
|
5981
|
+
const t15 = action !== null;
|
|
5982
|
+
let t16;
|
|
5983
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
5984
|
+
t16 = (isOpen) => {
|
|
5985
|
+
if (!isOpen) setAction(null);
|
|
5986
|
+
};
|
|
5987
|
+
$[33] = t16;
|
|
5988
|
+
} else t16 = $[33];
|
|
5989
|
+
const t17 = action === "delete" ? "alertdialog" : "dialog";
|
|
5990
|
+
let t18;
|
|
5991
|
+
if ($[34] !== save) {
|
|
5992
|
+
t18 = (event) => {
|
|
5993
|
+
event.preventDefault();
|
|
5994
|
+
save();
|
|
5995
|
+
};
|
|
5996
|
+
$[34] = save;
|
|
5997
|
+
$[35] = t18;
|
|
5998
|
+
} else t18 = $[35];
|
|
5999
|
+
let t19;
|
|
6000
|
+
if ($[36] !== title) {
|
|
6001
|
+
t19 = /* @__PURE__ */ jsx($2ec61d1d4f780267$export$a8a3e93435678ff9, {
|
|
6002
|
+
slot: "title",
|
|
6003
|
+
children: title
|
|
6004
|
+
});
|
|
6005
|
+
$[36] = title;
|
|
6006
|
+
$[37] = t19;
|
|
6007
|
+
} else t19 = $[37];
|
|
6008
|
+
let t20;
|
|
6009
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
6010
|
+
t20 = /* @__PURE__ */ jsx("button", {
|
|
6011
|
+
type: "button",
|
|
6012
|
+
"aria-label": "Close theme version dialog",
|
|
6013
|
+
onClick: () => setAction(null),
|
|
6014
|
+
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
6015
|
+
});
|
|
6016
|
+
$[38] = t20;
|
|
6017
|
+
} else t20 = $[38];
|
|
6018
|
+
let t21;
|
|
6019
|
+
if ($[39] !== t19) {
|
|
6020
|
+
t21 = /* @__PURE__ */ jsxs("header", {
|
|
6021
|
+
className: "studio-version-dialog-heading",
|
|
6022
|
+
children: [t19, t20]
|
|
6023
|
+
});
|
|
6024
|
+
$[39] = t19;
|
|
6025
|
+
$[40] = t21;
|
|
6026
|
+
} else t21 = $[40];
|
|
6027
|
+
let t22;
|
|
6028
|
+
if ($[41] !== action || $[42] !== active.name || $[43] !== name) {
|
|
6029
|
+
t22 = action === "delete" ? /* @__PURE__ */ jsxs("p", { children: [
|
|
6030
|
+
"Delete “",
|
|
6031
|
+
active.name,
|
|
6032
|
+
"” and its saved theme?"
|
|
6033
|
+
] }) : /* @__PURE__ */ jsxs("label", { children: ["Version name", /* @__PURE__ */ jsx("input", {
|
|
6034
|
+
autoFocus: true,
|
|
6035
|
+
value: name,
|
|
6036
|
+
maxLength: 80,
|
|
6037
|
+
placeholder: "Version name",
|
|
6038
|
+
onChange: (event_0) => setName(event_0.target.value),
|
|
6039
|
+
required: true
|
|
6040
|
+
})] });
|
|
6041
|
+
$[41] = action;
|
|
6042
|
+
$[42] = active.name;
|
|
6043
|
+
$[43] = name;
|
|
6044
|
+
$[44] = t22;
|
|
6045
|
+
} else t22 = $[44];
|
|
6046
|
+
let t23;
|
|
6047
|
+
if ($[45] !== action || $[46] !== active.name) {
|
|
6048
|
+
t23 = action === "create" && /* @__PURE__ */ jsxs("p", {
|
|
6049
|
+
className: "studio-version-hint",
|
|
6050
|
+
children: [
|
|
6051
|
+
"Starts as a copy of “",
|
|
6052
|
+
active.name,
|
|
6053
|
+
"”."
|
|
6054
|
+
]
|
|
6055
|
+
});
|
|
6056
|
+
$[45] = action;
|
|
6057
|
+
$[46] = active.name;
|
|
6058
|
+
$[47] = t23;
|
|
6059
|
+
} else t23 = $[47];
|
|
6060
|
+
let t24;
|
|
6061
|
+
if ($[48] !== action || $[49] !== themes.versions) {
|
|
6062
|
+
t24 = action === "rename" ? /* @__PURE__ */ jsxs("button", {
|
|
6063
|
+
type: "button",
|
|
6064
|
+
className: "studio-version-delete",
|
|
6065
|
+
disabled: themes.versions.length < 2,
|
|
6066
|
+
onClick: () => setAction("delete"),
|
|
6067
|
+
children: [/* @__PURE__ */ jsx(Trash, { size: 12 }), " Delete version"]
|
|
6068
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
6069
|
+
type: "button",
|
|
6070
|
+
autoFocus: action === "delete",
|
|
6071
|
+
onClick: () => action === "delete" ? setAction("rename") : setAction(null),
|
|
6072
|
+
children: action === "delete" ? "Back" : "Cancel"
|
|
6073
|
+
});
|
|
6074
|
+
$[48] = action;
|
|
6075
|
+
$[49] = themes.versions;
|
|
6076
|
+
$[50] = t24;
|
|
6077
|
+
} else t24 = $[50];
|
|
6078
|
+
const t25 = action === "delete" ? "is-danger" : "is-primary";
|
|
6079
|
+
let t26;
|
|
6080
|
+
if ($[51] !== action || $[52] !== disabled || $[53] !== name) {
|
|
6081
|
+
t26 = disabled || action !== "delete" && !name.trim();
|
|
6082
|
+
$[51] = action;
|
|
6083
|
+
$[52] = disabled;
|
|
6084
|
+
$[53] = name;
|
|
6085
|
+
$[54] = t26;
|
|
6086
|
+
} else t26 = $[54];
|
|
6087
|
+
const t27 = action === "create" ? "Create version" : action === "delete" ? "Delete" : "Save";
|
|
6088
|
+
let t28;
|
|
6089
|
+
if ($[55] !== t25 || $[56] !== t26 || $[57] !== t27) {
|
|
6090
|
+
t28 = /* @__PURE__ */ jsx("button", {
|
|
6091
|
+
type: "submit",
|
|
6092
|
+
className: t25,
|
|
6093
|
+
disabled: t26,
|
|
6094
|
+
children: t27
|
|
6095
|
+
});
|
|
6096
|
+
$[55] = t25;
|
|
6097
|
+
$[56] = t26;
|
|
6098
|
+
$[57] = t27;
|
|
6099
|
+
$[58] = t28;
|
|
6100
|
+
} else t28 = $[58];
|
|
6101
|
+
let t29;
|
|
6102
|
+
if ($[59] !== t24 || $[60] !== t28) {
|
|
6103
|
+
t29 = /* @__PURE__ */ jsxs("div", {
|
|
6104
|
+
className: "studio-version-dialog-actions",
|
|
6105
|
+
children: [t24, t28]
|
|
6106
|
+
});
|
|
6107
|
+
$[59] = t24;
|
|
6108
|
+
$[60] = t28;
|
|
6109
|
+
$[61] = t29;
|
|
6110
|
+
} else t29 = $[61];
|
|
6111
|
+
let t30;
|
|
6112
|
+
if ($[62] !== t18 || $[63] !== t21 || $[64] !== t22 || $[65] !== t23 || $[66] !== t29) {
|
|
6113
|
+
t30 = /* @__PURE__ */ jsxs("form", {
|
|
6114
|
+
onSubmit: t18,
|
|
6115
|
+
children: [
|
|
6116
|
+
t21,
|
|
6117
|
+
t22,
|
|
6118
|
+
t23,
|
|
6119
|
+
t29
|
|
6120
|
+
]
|
|
6121
|
+
});
|
|
6122
|
+
$[62] = t18;
|
|
6123
|
+
$[63] = t21;
|
|
6124
|
+
$[64] = t22;
|
|
6125
|
+
$[65] = t23;
|
|
6126
|
+
$[66] = t29;
|
|
6127
|
+
$[67] = t30;
|
|
6128
|
+
} else t30 = $[67];
|
|
6129
|
+
let t31;
|
|
6130
|
+
if ($[68] !== action || $[69] !== t17 || $[70] !== t30 || $[71] !== title) {
|
|
6131
|
+
t31 = /* @__PURE__ */ jsx($f2ff30fde7b014be$export$3ddf2d174ce01153, {
|
|
6132
|
+
"aria-label": title,
|
|
6133
|
+
role: t17,
|
|
6134
|
+
children: t30
|
|
6135
|
+
}, action);
|
|
6136
|
+
$[68] = action;
|
|
6137
|
+
$[69] = t17;
|
|
6138
|
+
$[70] = t30;
|
|
6139
|
+
$[71] = title;
|
|
6140
|
+
$[72] = t31;
|
|
6141
|
+
} else t31 = $[72];
|
|
6142
|
+
let t32;
|
|
6143
|
+
if ($[73] !== t14 || $[74] !== t15 || $[75] !== t31) {
|
|
6144
|
+
t32 = /* @__PURE__ */ jsx($542a13ca2fa5b484$export$5b6b19405a83ff9d, {
|
|
6145
|
+
triggerRef: t14,
|
|
6146
|
+
placement: "bottom start",
|
|
6147
|
+
offset: 6,
|
|
6148
|
+
className: "studio-version-popover studio-version-dialog",
|
|
6149
|
+
isOpen: t15,
|
|
6150
|
+
onOpenChange: t16,
|
|
6151
|
+
children: t31
|
|
6152
|
+
});
|
|
6153
|
+
$[73] = t14;
|
|
6154
|
+
$[74] = t15;
|
|
6155
|
+
$[75] = t31;
|
|
6156
|
+
$[76] = t32;
|
|
6157
|
+
} else t32 = $[76];
|
|
6158
|
+
let t33;
|
|
6159
|
+
if ($[77] !== status || $[78] !== t12 || $[79] !== t13 || $[80] !== t32 || $[81] !== t6 || $[82] !== t9) {
|
|
6160
|
+
t33 = /* @__PURE__ */ jsxs("div", {
|
|
6161
|
+
className: "studio-version-picker",
|
|
6162
|
+
title: status,
|
|
6163
|
+
children: [
|
|
6164
|
+
t6,
|
|
6165
|
+
t9,
|
|
6166
|
+
t12,
|
|
6167
|
+
t13,
|
|
6168
|
+
t32
|
|
6169
|
+
]
|
|
6170
|
+
});
|
|
6171
|
+
$[77] = status;
|
|
6172
|
+
$[78] = t12;
|
|
6173
|
+
$[79] = t13;
|
|
6174
|
+
$[80] = t32;
|
|
6175
|
+
$[81] = t6;
|
|
6176
|
+
$[82] = t9;
|
|
6177
|
+
$[83] = t33;
|
|
6178
|
+
} else t33 = $[83];
|
|
6179
|
+
return t33;
|
|
6180
|
+
}
|
|
6181
|
+
function _temp(version_1) {
|
|
6182
|
+
return /* @__PURE__ */ jsx($928221da08ecbc62$export$a11e76429ed99b4, {
|
|
6183
|
+
id: version_1.id,
|
|
6184
|
+
textValue: version_1.name,
|
|
6185
|
+
className: "studio-version-item",
|
|
6186
|
+
children: version_1.name
|
|
6187
|
+
});
|
|
6188
|
+
}
|
|
6189
|
+
//#endregion
|
|
6190
|
+
//#region src/configurator/useThemeVersions.ts
|
|
6191
|
+
/** The editor only needs differences from the repository base theme. */
|
|
6192
|
+
function withoutDefaults(value, defaults) {
|
|
6193
|
+
const differing = (mode) => Object.fromEntries(Object.entries(value.theme[mode]).filter(([name, item]) => item !== defaults[mode][name]));
|
|
6194
|
+
return {
|
|
6195
|
+
...value,
|
|
6196
|
+
theme: {
|
|
6197
|
+
light: differing("light"),
|
|
6198
|
+
dark: differing("dark"),
|
|
6199
|
+
theme: differing("theme")
|
|
6200
|
+
}
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
/**
|
|
6204
|
+
* Named theme versions kept in `povio.themes.json` (or this browser when no writer is connected).
|
|
6205
|
+
* Loads the active version into the configuration and records every edit back into it.
|
|
6206
|
+
*/
|
|
6207
|
+
function useThemeVersions(t0) {
|
|
6208
|
+
const $ = c(26);
|
|
6209
|
+
const enabled = t0 === void 0 ? true : t0;
|
|
6210
|
+
let t1;
|
|
6211
|
+
if ($[0] !== enabled) {
|
|
6212
|
+
t1 = {
|
|
6213
|
+
key: "povio-ui-theme-versions",
|
|
6214
|
+
metaName: themeVersionsMetaName,
|
|
6215
|
+
field: "themes",
|
|
6216
|
+
parse: parseThemeVersions,
|
|
6217
|
+
noun: "theme versions",
|
|
6218
|
+
enabled
|
|
6219
|
+
};
|
|
6220
|
+
$[0] = enabled;
|
|
6221
|
+
$[1] = t1;
|
|
6222
|
+
} else t1 = $[1];
|
|
6223
|
+
const storage = useRepositoryStorage(t1);
|
|
6224
|
+
const { value: themes, setValue: setThemes, ready } = storage;
|
|
6225
|
+
let t2;
|
|
6226
|
+
if ($[2] !== themes.activeVersionId || $[3] !== themes.versions) {
|
|
6227
|
+
t2 = themes.versions.find((version) => version.id === themes.activeVersionId) ?? themes.versions[0];
|
|
6228
|
+
$[2] = themes.activeVersionId;
|
|
6229
|
+
$[3] = themes.versions;
|
|
6230
|
+
$[4] = t2;
|
|
6231
|
+
} else t2 = $[4];
|
|
6232
|
+
const active = t2;
|
|
6233
|
+
const { currentConfiguration, replaceConfiguration, defaults } = useUIConfiguration();
|
|
6234
|
+
const loaded = useRef(null);
|
|
6235
|
+
const t3 = active.id;
|
|
6236
|
+
let t4;
|
|
6237
|
+
if ($[5] !== defaults) {
|
|
6238
|
+
t4 = JSON.stringify(defaults);
|
|
6239
|
+
$[5] = defaults;
|
|
6240
|
+
$[6] = t4;
|
|
6241
|
+
} else t4 = $[6];
|
|
6242
|
+
const key = `${t3}:${t4}`;
|
|
6243
|
+
let t5;
|
|
6244
|
+
if ($[7] !== active.configuration) {
|
|
6245
|
+
t5 = JSON.stringify(active.configuration);
|
|
6246
|
+
$[7] = active.configuration;
|
|
6247
|
+
$[8] = t5;
|
|
6248
|
+
} else t5 = $[8];
|
|
6249
|
+
const saved = t5;
|
|
6250
|
+
let t6;
|
|
6251
|
+
let t7;
|
|
6252
|
+
if ($[9] !== active.configuration || $[10] !== active.id || $[11] !== currentConfiguration || $[12] !== defaults || $[13] !== enabled || $[14] !== key || $[15] !== ready || $[16] !== replaceConfiguration || $[17] !== saved || $[18] !== setThemes) {
|
|
6253
|
+
t6 = () => {
|
|
6254
|
+
if (!enabled || !ready) return;
|
|
6255
|
+
if (!loaded.current || loaded.current.key !== key || loaded.current.saved !== saved) {
|
|
6256
|
+
const value = active.configuration ?? (loaded.current ? emptyConfiguration() : currentConfiguration);
|
|
6257
|
+
const sameValues = !!loaded.current && loaded.current.versionId === active.id && loaded.current.saved === saved;
|
|
6258
|
+
loaded.current = {
|
|
6259
|
+
key,
|
|
6260
|
+
versionId: active.id,
|
|
6261
|
+
saved
|
|
6262
|
+
};
|
|
6263
|
+
replaceConfiguration(withoutDefaults(value, defaults), false, !sameValues);
|
|
6264
|
+
return;
|
|
6265
|
+
}
|
|
6266
|
+
const snapshot = {
|
|
6267
|
+
...currentConfiguration,
|
|
6268
|
+
theme: {
|
|
6269
|
+
light: {
|
|
6270
|
+
...defaults.light,
|
|
6271
|
+
...currentConfiguration.theme.light
|
|
6272
|
+
},
|
|
6273
|
+
dark: {
|
|
6274
|
+
...defaults.dark,
|
|
6275
|
+
...currentConfiguration.theme.dark
|
|
6276
|
+
},
|
|
6277
|
+
theme: {
|
|
6278
|
+
...defaults.theme,
|
|
6279
|
+
...currentConfiguration.theme.theme
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
};
|
|
6283
|
+
const serialized = JSON.stringify(snapshot);
|
|
6284
|
+
if (serialized === saved) return;
|
|
6285
|
+
loaded.current.saved = serialized;
|
|
6286
|
+
setThemes((current) => ({
|
|
6287
|
+
...current,
|
|
6288
|
+
versions: current.versions.map((version_0) => version_0.id === active.id ? {
|
|
6289
|
+
...version_0,
|
|
6290
|
+
configuration: structuredClone(snapshot)
|
|
6291
|
+
} : version_0)
|
|
6292
|
+
}));
|
|
6293
|
+
};
|
|
6294
|
+
t7 = [
|
|
6295
|
+
enabled,
|
|
6296
|
+
ready,
|
|
6297
|
+
key,
|
|
6298
|
+
saved,
|
|
6299
|
+
active.id,
|
|
6300
|
+
active.configuration,
|
|
6301
|
+
defaults,
|
|
6302
|
+
currentConfiguration,
|
|
6303
|
+
replaceConfiguration,
|
|
6304
|
+
setThemes
|
|
6305
|
+
];
|
|
6306
|
+
$[9] = active.configuration;
|
|
6307
|
+
$[10] = active.id;
|
|
6308
|
+
$[11] = currentConfiguration;
|
|
6309
|
+
$[12] = defaults;
|
|
6310
|
+
$[13] = enabled;
|
|
6311
|
+
$[14] = key;
|
|
6312
|
+
$[15] = ready;
|
|
6313
|
+
$[16] = replaceConfiguration;
|
|
6314
|
+
$[17] = saved;
|
|
6315
|
+
$[18] = setThemes;
|
|
6316
|
+
$[19] = t6;
|
|
6317
|
+
$[20] = t7;
|
|
6318
|
+
} else {
|
|
6319
|
+
t6 = $[19];
|
|
6320
|
+
t7 = $[20];
|
|
6321
|
+
}
|
|
6322
|
+
useLayoutEffect(t6, t7);
|
|
6323
|
+
let t8;
|
|
6324
|
+
if ($[21] !== active || $[22] !== setThemes || $[23] !== storage || $[24] !== themes) {
|
|
6325
|
+
t8 = {
|
|
6326
|
+
...storage,
|
|
6327
|
+
themes,
|
|
6328
|
+
setThemes,
|
|
6329
|
+
active
|
|
6330
|
+
};
|
|
6331
|
+
$[21] = active;
|
|
6332
|
+
$[22] = setThemes;
|
|
6333
|
+
$[23] = storage;
|
|
6334
|
+
$[24] = themes;
|
|
6335
|
+
$[25] = t8;
|
|
6336
|
+
} else t8 = $[25];
|
|
6337
|
+
return t8;
|
|
6338
|
+
}
|
|
6339
|
+
//#endregion
|
|
5506
6340
|
//#region src/configurator/UIConfigurator.tsx
|
|
5507
6341
|
const colorNamespaces = {
|
|
5508
6342
|
surface: "Surfaces",
|
|
@@ -5817,7 +6651,7 @@ function PopoutOverlay(t0) {
|
|
|
5817
6651
|
} else t3 = $[5];
|
|
5818
6652
|
return t3;
|
|
5819
6653
|
}
|
|
5820
|
-
function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating, onPopout, onDock,
|
|
6654
|
+
function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating, onPopout, onDock, popupBlocked, themeVersions }) {
|
|
5821
6655
|
const Overlay = poppedOut || floating ? PopoutOverlay : $8b8d26808cb8cb53$export$8948f78d83984c69;
|
|
5822
6656
|
const Surface = poppedOut || floating ? "div" : $8b8d26808cb8cb53$export$2b77a92f1a5ad772;
|
|
5823
6657
|
const studioWindow = useStudioWindow(windowBounds, !poppedOut);
|
|
@@ -5864,6 +6698,23 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
5864
6698
|
useEffect(() => {
|
|
5865
6699
|
setThemeWriter(getThemeWriter());
|
|
5866
6700
|
}, []);
|
|
6701
|
+
const [componentWriter, setComponentWriter] = useState(null);
|
|
6702
|
+
const [repositoryComponents, setRepositoryComponents] = useState(null);
|
|
6703
|
+
useEffect(() => {
|
|
6704
|
+
const writer = getComponentConfigurationWriter();
|
|
6705
|
+
setComponentWriter(writer);
|
|
6706
|
+
if (!writer) return;
|
|
6707
|
+
let alive = true;
|
|
6708
|
+
readComponentConfiguration(writer).then(({ configuration, revision: revision_0 }) => {
|
|
6709
|
+
if (alive) setRepositoryComponents({
|
|
6710
|
+
json: canonicalJSON(configuration ?? emptyComponentConfiguration()),
|
|
6711
|
+
revision: revision_0
|
|
6712
|
+
});
|
|
6713
|
+
}).catch(() => {});
|
|
6714
|
+
return () => {
|
|
6715
|
+
alive = false;
|
|
6716
|
+
};
|
|
6717
|
+
}, []);
|
|
5867
6718
|
const [exportTab, setExportTab] = useState(remembered.exportTab ?? "css");
|
|
5868
6719
|
const editorRef = useRef(null);
|
|
5869
6720
|
const previewRef = useRef(null);
|
|
@@ -5901,6 +6752,18 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
5901
6752
|
const exportRef = useRef(null);
|
|
5902
6753
|
const changedCount = Object.keys(draft.overrides ?? {}).length + Object.values(draft.theme).reduce((count, tokens) => count + Object.keys(tokens).length, 0) + Object.values(draft.config).reduce((count_0, value) => count_0 + (typeof value === "object" && value !== null ? Object.keys(value).length : 1), 0);
|
|
5903
6754
|
const config = inherited;
|
|
6755
|
+
const components = {
|
|
6756
|
+
config: draft.config,
|
|
6757
|
+
overrides: draft.overrides ?? {}
|
|
6758
|
+
};
|
|
6759
|
+
const componentsJson = canonicalJSON(components);
|
|
6760
|
+
const componentsDiffer = !!componentWriter && !!repositoryComponents && componentsJson !== repositoryComponents.json;
|
|
6761
|
+
const themeCss = exportCss(draft.theme, defaults);
|
|
6762
|
+
const themeDiffers = [
|
|
6763
|
+
"light",
|
|
6764
|
+
"dark",
|
|
6765
|
+
"theme"
|
|
6766
|
+
].some((mode_0) => Object.keys(parseThemeCss(themeCss)[mode_0]).length > 0);
|
|
5904
6767
|
const exportText = exportTab === "css" ? exportCss(draft.theme, defaults) : exportTab === "overrides" ? exportCvaEdits(draft.overrides) : `import { UIConfig } from "@povio/ui/ui-config";\n\nconst config = ${JSON.stringify(draft.config, null, 2)} satisfies Partial<UIConfig.Options>;\n\n// Wrap your application:\n// <UIConfig.Provider config={config}>{children}</UIConfig.Provider>\n`;
|
|
5905
6768
|
const changeSection = (next) => {
|
|
5906
6769
|
if (compactPreview && bodyRef.current?.parentElement) bodyRef.current.parentElement.scrollTop = 0;
|
|
@@ -6272,18 +7135,18 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
6272
7135
|
/* @__PURE__ */ jsxs("header", {
|
|
6273
7136
|
className: "studio-topbar",
|
|
6274
7137
|
...poppedOut ? {} : studioWindow.dragArea,
|
|
6275
|
-
children: [
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
7138
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7139
|
+
className: "studio-title",
|
|
7140
|
+
children: [/* @__PURE__ */ jsx($2ec61d1d4f780267$export$a8a3e93435678ff9, {
|
|
7141
|
+
slot: "title",
|
|
7142
|
+
className: "studio-visually-hidden",
|
|
7143
|
+
children: "Povio UI Configuration"
|
|
7144
|
+
}), /* @__PURE__ */ jsx(ThemeVersionControls, { state: themeVersions })]
|
|
7145
|
+
}), /* @__PURE__ */ jsxs("nav", {
|
|
7146
|
+
className: "studio-nav",
|
|
7147
|
+
"aria-label": "Configuration sections",
|
|
7148
|
+
children: [
|
|
7149
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6287
7150
|
className: "studio-section-tabs",
|
|
6288
7151
|
children: [
|
|
6289
7152
|
navSections.map((group_5) => /* @__PURE__ */ jsx("button", {
|
|
@@ -6301,7 +7164,8 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
6301
7164
|
children: "Advanced"
|
|
6302
7165
|
})
|
|
6303
7166
|
]
|
|
6304
|
-
}),
|
|
7167
|
+
}),
|
|
7168
|
+
!componentsHosted && /* @__PURE__ */ jsx("button", {
|
|
6305
7169
|
type: "button",
|
|
6306
7170
|
className: "studio-preview-tab",
|
|
6307
7171
|
"aria-current": compactPreview ? "page" : void 0,
|
|
@@ -6311,11 +7175,8 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
6311
7175
|
if (dialog) dialog.scrollTop = 0;
|
|
6312
7176
|
},
|
|
6313
7177
|
children: "Components"
|
|
6314
|
-
})
|
|
6315
|
-
|
|
6316
|
-
/* @__PURE__ */ jsx("div", {
|
|
6317
|
-
className: "studio-topbar-controls",
|
|
6318
|
-
children: /* @__PURE__ */ jsxs("label", {
|
|
7178
|
+
}),
|
|
7179
|
+
/* @__PURE__ */ jsxs("label", {
|
|
6319
7180
|
className: "studio-search",
|
|
6320
7181
|
title: "Search tokens",
|
|
6321
7182
|
children: [
|
|
@@ -6342,8 +7203,8 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
6342
7203
|
})
|
|
6343
7204
|
]
|
|
6344
7205
|
})
|
|
6345
|
-
|
|
6346
|
-
]
|
|
7206
|
+
]
|
|
7207
|
+
})]
|
|
6347
7208
|
}),
|
|
6348
7209
|
/* @__PURE__ */ jsxs("div", {
|
|
6349
7210
|
ref: bodyRef,
|
|
@@ -6758,19 +7619,43 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
6758
7619
|
}),
|
|
6759
7620
|
/* @__PURE__ */ jsx("button", {
|
|
6760
7621
|
className: "studio-primary",
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
7622
|
+
disabled: !(themeWriter && themeDiffers || componentsDiffer) || savingTheme || !!Object.keys(invalidFields).length,
|
|
7623
|
+
title: !themeWriter && !componentWriter ? "Applying needs the uiConfigurator Vite plugin" : themeWriter && themeDiffers || componentsDiffer ? `Write this version to ${[themeWriter && themeDiffers && themeWriter.file, componentsDiffer && componentWriter?.file].filter(Boolean).join(" and ")}` : "The repository already matches this version",
|
|
7624
|
+
onClick: async () => {
|
|
7625
|
+
setSavingTheme(true);
|
|
7626
|
+
setMessage("");
|
|
7627
|
+
const written = [];
|
|
7628
|
+
try {
|
|
7629
|
+
if (themeWriter && themeDiffers) {
|
|
7630
|
+
await saveThemeCss(themeWriter, themeCss);
|
|
7631
|
+
written.push(themeWriter.file);
|
|
7632
|
+
}
|
|
7633
|
+
if (componentsDiffer && componentWriter && repositoryComponents) {
|
|
7634
|
+
const revision_1 = await saveComponentConfiguration(componentWriter, components, repositoryComponents.revision);
|
|
7635
|
+
setRepositoryComponents({
|
|
7636
|
+
json: componentsJson,
|
|
7637
|
+
revision: revision_1
|
|
7638
|
+
});
|
|
7639
|
+
written.push(componentWriter.file);
|
|
7640
|
+
}
|
|
7641
|
+
setMessage(`Applied to ${written.join(" and ")}.`);
|
|
7642
|
+
} catch (error_0) {
|
|
7643
|
+
setMessage(error_0 instanceof Error ? error_0.message : "Could not apply theme.");
|
|
7644
|
+
} finally {
|
|
7645
|
+
setSavingTheme(false);
|
|
7646
|
+
}
|
|
7647
|
+
},
|
|
7648
|
+
children: savingTheme ? "Applying…" : "Apply theme"
|
|
6764
7649
|
})
|
|
6765
7650
|
]
|
|
6766
7651
|
}),
|
|
6767
7652
|
/* @__PURE__ */ jsx("button", {
|
|
6768
7653
|
type: "button",
|
|
6769
|
-
className: "studio-window-
|
|
6770
|
-
"aria-label": "
|
|
6771
|
-
title: "
|
|
6772
|
-
onClick:
|
|
6773
|
-
children: /* @__PURE__ */ jsx(
|
|
7654
|
+
className: "studio-window-close",
|
|
7655
|
+
"aria-label": "Close UI configuration",
|
|
7656
|
+
title: "Close",
|
|
7657
|
+
onClick: apply,
|
|
7658
|
+
children: /* @__PURE__ */ jsx(X, { size: 17 })
|
|
6774
7659
|
}),
|
|
6775
7660
|
/* @__PURE__ */ jsx("button", {
|
|
6776
7661
|
type: "button",
|
|
@@ -6785,8 +7670,7 @@ function ConfigurationModalContent({ memory, windowBounds, poppedOut, floating,
|
|
|
6785
7670
|
className: "studio-window-grip",
|
|
6786
7671
|
"aria-label": "Move UI configuration",
|
|
6787
7672
|
title: "Drag to move, or use arrow keys",
|
|
6788
|
-
...studioWindow.move
|
|
6789
|
-
children: /* @__PURE__ */ jsx(GripVertical, { size: 20 })
|
|
7673
|
+
...studioWindow.move
|
|
6790
7674
|
}), windowEdges.map((edge) => /* @__PURE__ */ jsx("button", {
|
|
6791
7675
|
type: "button",
|
|
6792
7676
|
className: `studio-window-resize studio-window-resize-${edge}`,
|
|
@@ -6847,12 +7731,8 @@ const floatingDefault = {
|
|
|
6847
7731
|
};
|
|
6848
7732
|
const hostedFloatingWidth = 360;
|
|
6849
7733
|
function UIConfigurationModal() {
|
|
6850
|
-
const { isOpen, revision,
|
|
6851
|
-
const
|
|
6852
|
-
const [hasLauncher, setHasLauncher] = useState(false);
|
|
6853
|
-
const restorePopout = useRef(false);
|
|
6854
|
-
const launcherPosition = useRef(null);
|
|
6855
|
-
useEffect(() => setMinimized(false), [revision]);
|
|
7734
|
+
const { isOpen, revision, floating, componentsHosted } = useUIConfiguration();
|
|
7735
|
+
const themeVersions = useThemeVersions();
|
|
6856
7736
|
const memory = useRef({});
|
|
6857
7737
|
const windowBounds = useRef(null);
|
|
6858
7738
|
const floatingBounds = useRef(floatingDefault);
|
|
@@ -6860,39 +7740,17 @@ function UIConfigurationModal() {
|
|
|
6860
7740
|
...floatingDefault,
|
|
6861
7741
|
width: hostedFloatingWidth
|
|
6862
7742
|
};
|
|
6863
|
-
const popout = useStudioPopout(isOpen
|
|
6864
|
-
if (
|
|
6865
|
-
position: launcherPosition,
|
|
6866
|
-
onOpen: () => {
|
|
6867
|
-
setMinimized(false);
|
|
6868
|
-
if (!isOpen) {
|
|
6869
|
-
if (floating) openFloating();
|
|
6870
|
-
else open();
|
|
6871
|
-
}
|
|
6872
|
-
if (restorePopout.current) popout.open();
|
|
6873
|
-
}
|
|
6874
|
-
}), document.body);
|
|
6875
|
-
if (!isOpen || minimized) return null;
|
|
7743
|
+
const popout = useStudioPopout(isOpen);
|
|
7744
|
+
if (!isOpen) return null;
|
|
6876
7745
|
const content = /* @__PURE__ */ jsx(ConfigurationModalContent, {
|
|
6877
7746
|
memory,
|
|
6878
7747
|
windowBounds: floating ? floatingBounds : windowBounds,
|
|
6879
7748
|
floating,
|
|
6880
7749
|
poppedOut: !!popout.popup,
|
|
6881
|
-
onPopout:
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
onDock: () => {
|
|
6886
|
-
restorePopout.current = false;
|
|
6887
|
-
popout.dock();
|
|
6888
|
-
},
|
|
6889
|
-
onMinimize: () => {
|
|
6890
|
-
restorePopout.current = !!popout.popup;
|
|
6891
|
-
setHasLauncher(true);
|
|
6892
|
-
setMinimized(true);
|
|
6893
|
-
popout.dock();
|
|
6894
|
-
},
|
|
6895
|
-
popupBlocked: popout.blocked
|
|
7750
|
+
onPopout: popout.open,
|
|
7751
|
+
onDock: popout.dock,
|
|
7752
|
+
popupBlocked: popout.blocked,
|
|
7753
|
+
themeVersions
|
|
6896
7754
|
}, revision);
|
|
6897
7755
|
return popout.popup ? createPortal(/* @__PURE__ */ jsx(StudioPopoutContext, {
|
|
6898
7756
|
value: true,
|
|
@@ -6903,4 +7761,4 @@ function UIConfigurationModal() {
|
|
|
6903
7761
|
}), popout.popup.document.body) : floating ? createPortal(content, document.body) : content;
|
|
6904
7762
|
}
|
|
6905
7763
|
//#endregion
|
|
6906
|
-
export { inspectElement as a, HighlightOverlay as c,
|
|
7764
|
+
export { Moon as _, inspectElement as a, HighlightOverlay as c, useUIConfiguration as d, Trash as f, Pencil as g, Pin as h, resolveUIConfiguration as i, InspectorDetails as l, Plus as m, ColorModeSwitch as n, inspectTokens as o, Sun as p, useRepositoryStorage as r, getBoxHighlights as s, UIConfigurationModal as t, UIConfigurationProvider as u };
|