@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
|
|
2
|
-
import { a as inspectElement, c as HighlightOverlay, d as
|
|
2
|
+
import { _ as Moon, a as inspectElement, c as HighlightOverlay, d as useUIConfiguration, f as Trash, g as Pencil, h as Pin, l as InspectorDetails, m as Plus, p as Sun, r as useRepositoryStorage, s as getBoxHighlights, t as UIConfigurationModal } from "./UIConfigurator-DekPXjv9.js";
|
|
3
3
|
import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
|
|
4
4
|
import { t as ChevronRight } from "./chevron-right-3nKJR5Bb.js";
|
|
5
5
|
import { i as Search } from "./selectDesktop.cva-CHAMxhfO.js";
|
|
@@ -9,7 +9,7 @@ import { c as $542a13ca2fa5b484$export$5b6b19405a83ff9d, n as $f2ff30fde7b014be$
|
|
|
9
9
|
import { t as $2ec61d1d4f780267$export$a8a3e93435678ff9 } from "./Heading-nI1_VOaE.js";
|
|
10
10
|
import { t as Select } from "./Select-CgIhoWgk.js";
|
|
11
11
|
import { t as ThemeContext } from "./theme.context-B3wQDJ-i.js";
|
|
12
|
-
import { c as isEditableToken
|
|
12
|
+
import { c as isEditableToken } from "./theme-model-DtTsIxou.js";
|
|
13
13
|
import { t as componentArtboards } from "./groups-oQmSeqXn.js";
|
|
14
14
|
import { Suspense, lazy, memo, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
15
15
|
import { c } from "react/compiler-runtime";
|
|
@@ -21,7 +21,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
21
21
|
* This source code is licensed under the ISC license.
|
|
22
22
|
* See the LICENSE file in the root directory of this source tree.
|
|
23
23
|
*/
|
|
24
|
-
const __iconData$
|
|
24
|
+
const __iconData$8 = {
|
|
25
25
|
name: "download",
|
|
26
26
|
size: 24,
|
|
27
27
|
node: [
|
|
@@ -39,8 +39,8 @@ const __iconData$10 = {
|
|
|
39
39
|
}]
|
|
40
40
|
]
|
|
41
41
|
};
|
|
42
|
-
__iconData$
|
|
43
|
-
const Download = createLucideIcon(__iconData$
|
|
42
|
+
__iconData$8.node;
|
|
43
|
+
const Download = createLucideIcon(__iconData$8);
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/frame.mjs
|
|
46
46
|
/**
|
|
@@ -49,7 +49,7 @@ const Download = createLucideIcon(__iconData$10);
|
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
51
|
*/
|
|
52
|
-
const __iconData$
|
|
52
|
+
const __iconData$7 = {
|
|
53
53
|
name: "frame",
|
|
54
54
|
size: 24,
|
|
55
55
|
node: [
|
|
@@ -83,8 +83,8 @@ const __iconData$9 = {
|
|
|
83
83
|
}]
|
|
84
84
|
]
|
|
85
85
|
};
|
|
86
|
-
__iconData$
|
|
87
|
-
const Frame = createLucideIcon(__iconData$
|
|
86
|
+
__iconData$7.node;
|
|
87
|
+
const Frame = createLucideIcon(__iconData$7);
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/hand.mjs
|
|
90
90
|
/**
|
|
@@ -93,7 +93,7 @@ const Frame = createLucideIcon(__iconData$9);
|
|
|
93
93
|
* This source code is licensed under the ISC license.
|
|
94
94
|
* See the LICENSE file in the root directory of this source tree.
|
|
95
95
|
*/
|
|
96
|
-
const __iconData$
|
|
96
|
+
const __iconData$6 = {
|
|
97
97
|
name: "hand",
|
|
98
98
|
size: 24,
|
|
99
99
|
node: [
|
|
@@ -115,8 +115,8 @@ const __iconData$8 = {
|
|
|
115
115
|
}]
|
|
116
116
|
]
|
|
117
117
|
};
|
|
118
|
-
__iconData$
|
|
119
|
-
const Hand = createLucideIcon(__iconData$
|
|
118
|
+
__iconData$6.node;
|
|
119
|
+
const Hand = createLucideIcon(__iconData$6);
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/monitor.mjs
|
|
122
122
|
/**
|
|
@@ -125,7 +125,7 @@ const Hand = createLucideIcon(__iconData$8);
|
|
|
125
125
|
* This source code is licensed under the ISC license.
|
|
126
126
|
* See the LICENSE file in the root directory of this source tree.
|
|
127
127
|
*/
|
|
128
|
-
const __iconData$
|
|
128
|
+
const __iconData$5 = {
|
|
129
129
|
name: "monitor",
|
|
130
130
|
size: 24,
|
|
131
131
|
node: [
|
|
@@ -153,8 +153,8 @@ const __iconData$7 = {
|
|
|
153
153
|
}]
|
|
154
154
|
]
|
|
155
155
|
};
|
|
156
|
-
__iconData$
|
|
157
|
-
const Monitor = createLucideIcon(__iconData$
|
|
156
|
+
__iconData$5.node;
|
|
157
|
+
const Monitor = createLucideIcon(__iconData$5);
|
|
158
158
|
//#endregion
|
|
159
159
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/mouse-pointer-2.mjs
|
|
160
160
|
/**
|
|
@@ -163,7 +163,7 @@ const Monitor = createLucideIcon(__iconData$7);
|
|
|
163
163
|
* This source code is licensed under the ISC license.
|
|
164
164
|
* See the LICENSE file in the root directory of this source tree.
|
|
165
165
|
*/
|
|
166
|
-
const __iconData$
|
|
166
|
+
const __iconData$4 = {
|
|
167
167
|
name: "mouse-pointer-2",
|
|
168
168
|
size: 24,
|
|
169
169
|
node: [["path", {
|
|
@@ -171,8 +171,8 @@ const __iconData$6 = {
|
|
|
171
171
|
key: "edeuup"
|
|
172
172
|
}]]
|
|
173
173
|
};
|
|
174
|
-
__iconData$
|
|
175
|
-
const MousePointer2 = createLucideIcon(__iconData$
|
|
174
|
+
__iconData$4.node;
|
|
175
|
+
const MousePointer2 = createLucideIcon(__iconData$4);
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/panel-left.mjs
|
|
178
178
|
/**
|
|
@@ -181,7 +181,7 @@ const MousePointer2 = createLucideIcon(__iconData$6);
|
|
|
181
181
|
* This source code is licensed under the ISC license.
|
|
182
182
|
* See the LICENSE file in the root directory of this source tree.
|
|
183
183
|
*/
|
|
184
|
-
const __iconData$
|
|
184
|
+
const __iconData$3 = {
|
|
185
185
|
name: "panel-left",
|
|
186
186
|
size: 24,
|
|
187
187
|
node: [["rect", {
|
|
@@ -197,8 +197,8 @@ const __iconData$5 = {
|
|
|
197
197
|
}]],
|
|
198
198
|
aliases: ["sidebar"]
|
|
199
199
|
};
|
|
200
|
-
__iconData$
|
|
201
|
-
const PanelLeft = createLucideIcon(__iconData$
|
|
200
|
+
__iconData$3.node;
|
|
201
|
+
const PanelLeft = createLucideIcon(__iconData$3);
|
|
202
202
|
//#endregion
|
|
203
203
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/panels-top-left.mjs
|
|
204
204
|
/**
|
|
@@ -207,7 +207,7 @@ const PanelLeft = createLucideIcon(__iconData$5);
|
|
|
207
207
|
* This source code is licensed under the ISC license.
|
|
208
208
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
209
|
*/
|
|
210
|
-
const __iconData$
|
|
210
|
+
const __iconData$2 = {
|
|
211
211
|
name: "panels-top-left",
|
|
212
212
|
size: 24,
|
|
213
213
|
node: [
|
|
@@ -230,29 +230,8 @@ const __iconData$4 = {
|
|
|
230
230
|
],
|
|
231
231
|
aliases: ["layout"]
|
|
232
232
|
};
|
|
233
|
-
__iconData$
|
|
234
|
-
const PanelsTopLeft = createLucideIcon(__iconData$
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/pencil.mjs
|
|
237
|
-
/**
|
|
238
|
-
* @license lucide-react v1.43.0 - ISC
|
|
239
|
-
*
|
|
240
|
-
* This source code is licensed under the ISC license.
|
|
241
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
-
*/
|
|
243
|
-
const __iconData$3 = {
|
|
244
|
-
name: "pencil",
|
|
245
|
-
size: 24,
|
|
246
|
-
node: [["path", {
|
|
247
|
-
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",
|
|
248
|
-
key: "1a8usu"
|
|
249
|
-
}], ["path", {
|
|
250
|
-
d: "m15 5 4 4",
|
|
251
|
-
key: "1mk7zo"
|
|
252
|
-
}]]
|
|
253
|
-
};
|
|
254
|
-
__iconData$3.node;
|
|
255
|
-
const Pencil = createLucideIcon(__iconData$3);
|
|
233
|
+
__iconData$2.node;
|
|
234
|
+
const PanelsTopLeft = createLucideIcon(__iconData$2);
|
|
256
235
|
//#endregion
|
|
257
236
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/scan-line.mjs
|
|
258
237
|
/**
|
|
@@ -261,7 +240,7 @@ const Pencil = createLucideIcon(__iconData$3);
|
|
|
261
240
|
* This source code is licensed under the ISC license.
|
|
262
241
|
* See the LICENSE file in the root directory of this source tree.
|
|
263
242
|
*/
|
|
264
|
-
const __iconData$
|
|
243
|
+
const __iconData$1 = {
|
|
265
244
|
name: "scan-line",
|
|
266
245
|
size: 24,
|
|
267
246
|
node: [
|
|
@@ -287,8 +266,8 @@ const __iconData$2 = {
|
|
|
287
266
|
}]
|
|
288
267
|
]
|
|
289
268
|
};
|
|
290
|
-
__iconData$
|
|
291
|
-
const ScanLine = createLucideIcon(__iconData$
|
|
269
|
+
__iconData$1.node;
|
|
270
|
+
const ScanLine = createLucideIcon(__iconData$1);
|
|
292
271
|
//#endregion
|
|
293
272
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/settings-2.mjs
|
|
294
273
|
/**
|
|
@@ -297,7 +276,7 @@ const ScanLine = createLucideIcon(__iconData$2);
|
|
|
297
276
|
* This source code is licensed under the ISC license.
|
|
298
277
|
* See the LICENSE file in the root directory of this source tree.
|
|
299
278
|
*/
|
|
300
|
-
const __iconData
|
|
279
|
+
const __iconData = {
|
|
301
280
|
name: "settings-2",
|
|
302
281
|
size: 24,
|
|
303
282
|
node: [
|
|
@@ -323,215 +302,8 @@ const __iconData$1 = {
|
|
|
323
302
|
}]
|
|
324
303
|
]
|
|
325
304
|
};
|
|
326
|
-
__iconData$1.node;
|
|
327
|
-
const Settings2 = createLucideIcon(__iconData$1);
|
|
328
|
-
//#endregion
|
|
329
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/trash.mjs
|
|
330
|
-
/**
|
|
331
|
-
* @license lucide-react v1.43.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/
|
|
336
|
-
const __iconData = {
|
|
337
|
-
name: "trash",
|
|
338
|
-
size: 24,
|
|
339
|
-
node: [
|
|
340
|
-
["path", {
|
|
341
|
-
d: "M10 11v6",
|
|
342
|
-
key: "nco0om"
|
|
343
|
-
}],
|
|
344
|
-
["path", {
|
|
345
|
-
d: "M14 11v6",
|
|
346
|
-
key: "outv1u"
|
|
347
|
-
}],
|
|
348
|
-
["path", {
|
|
349
|
-
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
|
|
350
|
-
key: "miytrc"
|
|
351
|
-
}],
|
|
352
|
-
["path", {
|
|
353
|
-
d: "M3 6h18",
|
|
354
|
-
key: "d0wm0j"
|
|
355
|
-
}],
|
|
356
|
-
["path", {
|
|
357
|
-
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
358
|
-
key: "e791ji"
|
|
359
|
-
}]
|
|
360
|
-
],
|
|
361
|
-
aliases: ["trash-2"]
|
|
362
|
-
};
|
|
363
305
|
__iconData.node;
|
|
364
|
-
const
|
|
365
|
-
//#endregion
|
|
366
|
-
//#region src/app-canvas/useWorkspaceConfiguration.ts
|
|
367
|
-
function useWorkspaceConfiguration(workspace, ready, generation, setManifest) {
|
|
368
|
-
const $ = c(15);
|
|
369
|
-
const { currentConfiguration, replaceConfiguration, defaults } = useUIConfiguration();
|
|
370
|
-
const loaded = useRef(null);
|
|
371
|
-
const t0 = workspace.id;
|
|
372
|
-
let t1;
|
|
373
|
-
if ($[0] !== defaults) {
|
|
374
|
-
t1 = JSON.stringify(defaults);
|
|
375
|
-
$[0] = defaults;
|
|
376
|
-
$[1] = t1;
|
|
377
|
-
} else t1 = $[1];
|
|
378
|
-
const key = `${generation}:${t0}:${t1}`;
|
|
379
|
-
let t2;
|
|
380
|
-
if ($[2] !== workspace.configuration) {
|
|
381
|
-
t2 = JSON.stringify(workspace.configuration);
|
|
382
|
-
$[2] = workspace.configuration;
|
|
383
|
-
$[3] = t2;
|
|
384
|
-
} else t2 = $[3];
|
|
385
|
-
const saved = t2;
|
|
386
|
-
let t3;
|
|
387
|
-
let t4;
|
|
388
|
-
if ($[4] !== currentConfiguration || $[5] !== defaults || $[6] !== key || $[7] !== ready || $[8] !== replaceConfiguration || $[9] !== saved || $[10] !== setManifest || $[11] !== workspace.configuration || $[12] !== workspace.id) {
|
|
389
|
-
t3 = () => {
|
|
390
|
-
if (!ready) return;
|
|
391
|
-
if (!loaded.current || loaded.current.key !== key || loaded.current.saved !== saved) {
|
|
392
|
-
const value = workspace.configuration ?? (loaded.current ? emptyConfiguration() : currentConfiguration);
|
|
393
|
-
const switchingWorkspace = !!loaded.current && loaded.current.workspaceId !== workspace.id;
|
|
394
|
-
loaded.current = {
|
|
395
|
-
key,
|
|
396
|
-
workspaceId: workspace.id,
|
|
397
|
-
saved
|
|
398
|
-
};
|
|
399
|
-
replaceConfiguration({
|
|
400
|
-
...value,
|
|
401
|
-
theme: {
|
|
402
|
-
light: Object.fromEntries(Object.entries(value.theme.light).filter((t5) => {
|
|
403
|
-
const [name, value_0] = t5;
|
|
404
|
-
return value_0 !== defaults.light[name];
|
|
405
|
-
})),
|
|
406
|
-
dark: Object.fromEntries(Object.entries(value.theme.dark).filter((t6) => {
|
|
407
|
-
const [name_0, value_1] = t6;
|
|
408
|
-
return value_1 !== defaults.dark[name_0];
|
|
409
|
-
})),
|
|
410
|
-
theme: Object.fromEntries(Object.entries(value.theme.theme).filter((t7) => {
|
|
411
|
-
const [name_1, value_2] = t7;
|
|
412
|
-
return value_2 !== defaults.theme[name_1];
|
|
413
|
-
}))
|
|
414
|
-
}
|
|
415
|
-
}, switchingWorkspace);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
const snapshot = {
|
|
419
|
-
...currentConfiguration,
|
|
420
|
-
theme: {
|
|
421
|
-
light: {
|
|
422
|
-
...defaults.light,
|
|
423
|
-
...currentConfiguration.theme.light
|
|
424
|
-
},
|
|
425
|
-
dark: {
|
|
426
|
-
...defaults.dark,
|
|
427
|
-
...currentConfiguration.theme.dark
|
|
428
|
-
},
|
|
429
|
-
theme: {
|
|
430
|
-
...defaults.theme,
|
|
431
|
-
...currentConfiguration.theme.theme
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
const serialized = JSON.stringify(snapshot);
|
|
436
|
-
if (serialized === saved) return;
|
|
437
|
-
loaded.current.saved = serialized;
|
|
438
|
-
setManifest((current) => ({
|
|
439
|
-
...current,
|
|
440
|
-
workspaces: current.workspaces.map((item) => item.id === workspace.id ? {
|
|
441
|
-
...item,
|
|
442
|
-
configuration: structuredClone(snapshot)
|
|
443
|
-
} : item)
|
|
444
|
-
}));
|
|
445
|
-
};
|
|
446
|
-
t4 = [
|
|
447
|
-
defaults,
|
|
448
|
-
key,
|
|
449
|
-
saved,
|
|
450
|
-
workspace.id,
|
|
451
|
-
workspace.configuration,
|
|
452
|
-
ready,
|
|
453
|
-
currentConfiguration,
|
|
454
|
-
replaceConfiguration,
|
|
455
|
-
setManifest
|
|
456
|
-
];
|
|
457
|
-
$[4] = currentConfiguration;
|
|
458
|
-
$[5] = defaults;
|
|
459
|
-
$[6] = key;
|
|
460
|
-
$[7] = ready;
|
|
461
|
-
$[8] = replaceConfiguration;
|
|
462
|
-
$[9] = saved;
|
|
463
|
-
$[10] = setManifest;
|
|
464
|
-
$[11] = workspace.configuration;
|
|
465
|
-
$[12] = workspace.id;
|
|
466
|
-
$[13] = t3;
|
|
467
|
-
$[14] = t4;
|
|
468
|
-
} else {
|
|
469
|
-
t3 = $[13];
|
|
470
|
-
t4 = $[14];
|
|
471
|
-
}
|
|
472
|
-
useLayoutEffect(t3, t4);
|
|
473
|
-
}
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region src/app-canvas/SaveCanvasTheme.tsx
|
|
476
|
-
/** Uses the same development-only writer as the configurator's CSS export. */
|
|
477
|
-
function SaveCanvasTheme() {
|
|
478
|
-
const { active, defaults } = useUIConfiguration();
|
|
479
|
-
const [writer, setWriter] = useState(null);
|
|
480
|
-
const [saving, setSaving] = useState(false);
|
|
481
|
-
const [message, setMessage] = useState("");
|
|
482
|
-
const [savedTheme, setSavedTheme] = useState(defaults);
|
|
483
|
-
useEffect(() => setWriter(getThemeWriter()), []);
|
|
484
|
-
useEffect(() => setSavedTheme(defaults), [defaults]);
|
|
485
|
-
const css = exportCss(active.theme, defaults);
|
|
486
|
-
const exported = parseThemeCss(css);
|
|
487
|
-
const currentTheme = {
|
|
488
|
-
light: {
|
|
489
|
-
...defaults.light,
|
|
490
|
-
...exported.light
|
|
491
|
-
},
|
|
492
|
-
dark: {
|
|
493
|
-
...defaults.dark,
|
|
494
|
-
...exported.dark
|
|
495
|
-
},
|
|
496
|
-
theme: {
|
|
497
|
-
...defaults.theme,
|
|
498
|
-
...exported.theme
|
|
499
|
-
}
|
|
500
|
-
};
|
|
501
|
-
const hasChanges = [
|
|
502
|
-
"light",
|
|
503
|
-
"dark",
|
|
504
|
-
"theme"
|
|
505
|
-
].some((mode) => {
|
|
506
|
-
return [.../* @__PURE__ */ new Set([...Object.keys(currentTheme[mode]), ...Object.keys(savedTheme[mode])])].some((key) => currentTheme[mode][key]?.trim() !== savedTheme[mode][key]?.trim());
|
|
507
|
-
});
|
|
508
|
-
useEffect(() => setMessage(""), [active.theme]);
|
|
509
|
-
if (!writer || !hasChanges && !saving) return null;
|
|
510
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
511
|
-
className: "povio-canvas-save-theme",
|
|
512
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
513
|
-
disabled: saving,
|
|
514
|
-
title: `Save current CSS settings to ${writer.file}`,
|
|
515
|
-
onClick: async () => {
|
|
516
|
-
setSaving(true);
|
|
517
|
-
setMessage("");
|
|
518
|
-
try {
|
|
519
|
-
await saveThemeCss(writer, css);
|
|
520
|
-
setSavedTheme(currentTheme);
|
|
521
|
-
setMessage(`Saved CSS to ${writer.file}.`);
|
|
522
|
-
} catch (error) {
|
|
523
|
-
setMessage(error instanceof Error ? error.message : "Could not save CSS settings.");
|
|
524
|
-
} finally {
|
|
525
|
-
setSaving(false);
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
children: saving ? "Saving theme…" : "Save theme to repo"
|
|
529
|
-
}), message && /* @__PURE__ */ jsx("p", {
|
|
530
|
-
role: "status",
|
|
531
|
-
children: message
|
|
532
|
-
})]
|
|
533
|
-
});
|
|
534
|
-
}
|
|
306
|
+
const Settings2 = createLucideIcon(__iconData);
|
|
535
307
|
//#endregion
|
|
536
308
|
//#region src/app-canvas/manifest.ts
|
|
537
309
|
function createCanvasWorkspace(name, id) {
|
|
@@ -563,38 +335,6 @@ function isJSON(value, ancestors = /* @__PURE__ */ new Set(), depth = 0) {
|
|
|
563
335
|
ancestors.delete(value);
|
|
564
336
|
return valid;
|
|
565
337
|
}
|
|
566
|
-
function safeJSON(value, ancestors = /* @__PURE__ */ new Set(), depth = 0) {
|
|
567
|
-
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
568
|
-
if (typeof value === "number") return Number.isFinite(value);
|
|
569
|
-
if (typeof value !== "object" || depth > 30 || ancestors.has(value)) return false;
|
|
570
|
-
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return false;
|
|
571
|
-
ancestors.add(value);
|
|
572
|
-
const valid = Object.entries(value).every(([key, child]) => ![
|
|
573
|
-
"__proto__",
|
|
574
|
-
"prototype",
|
|
575
|
-
"constructor"
|
|
576
|
-
].includes(key) && safeJSON(child, ancestors, depth + 1));
|
|
577
|
-
ancestors.delete(value);
|
|
578
|
-
return valid;
|
|
579
|
-
}
|
|
580
|
-
const stringMap = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
|
|
581
|
-
const variantValue = (value) => value === null || typeof value === "string" || typeof value === "boolean";
|
|
582
|
-
function validCvaEdits(value) {
|
|
583
|
-
return isRecord(value) && Object.entries(value).every(([slot, definition]) => {
|
|
584
|
-
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;
|
|
585
|
-
const config = definition.config;
|
|
586
|
-
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"))));
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
/** Returns an independent JSON configuration, or undefined for invalid/unset overrides. */
|
|
590
|
-
function parseCanvasConfiguration(value) {
|
|
591
|
-
if (!isRecord(value) || !safeJSON(value) || !isRecord(value.theme) || ![
|
|
592
|
-
"light",
|
|
593
|
-
"dark",
|
|
594
|
-
"theme"
|
|
595
|
-
].every((key) => stringMap(value.theme && value.theme[key])) || !isRecord(value.config) || value.overrides !== void 0 && !validCvaEdits(value.overrides)) return void 0;
|
|
596
|
-
return JSON.parse(JSON.stringify(value));
|
|
597
|
-
}
|
|
598
338
|
function parsePositions(input) {
|
|
599
339
|
return Object.fromEntries(Object.entries(isRecord(input) ? input : {}).flatMap(([breakpoint, entries]) => {
|
|
600
340
|
if (!isRecord(entries)) return [];
|
|
@@ -631,13 +371,11 @@ function parseCanvasManifest(input) {
|
|
|
631
371
|
else if (Array.isArray(value.workspaces)) for (const entry of value.workspaces) {
|
|
632
372
|
if (!isRecord(entry) || typeof entry.id !== "string" || !entry.id.trim() || ids.has(entry.id)) continue;
|
|
633
373
|
ids.add(entry.id);
|
|
634
|
-
const configuration = parseCanvasConfiguration(entry.configuration);
|
|
635
374
|
workspaces.push({
|
|
636
375
|
id: entry.id,
|
|
637
376
|
name: typeof entry.name === "string" && entry.name.trim() ? entry.name.trim() : "Workspace",
|
|
638
377
|
enabledPages: Array.isArray(entry.enabledPages) ? [...new Set(entry.enabledPages.filter((id) => typeof id === "string" && id.length > 0))] : null,
|
|
639
|
-
positions: parsePositions(entry.positions)
|
|
640
|
-
...configuration ? { configuration } : {}
|
|
378
|
+
positions: parsePositions(entry.positions)
|
|
641
379
|
});
|
|
642
380
|
}
|
|
643
381
|
if (!workspaces.length) workspaces.push(createCanvasWorkspace("All pages", "default"));
|
|
@@ -652,328 +390,419 @@ function parseCanvasManifest(input) {
|
|
|
652
390
|
//#endregion
|
|
653
391
|
//#region src/app-canvas/WorkspaceControls.tsx
|
|
654
392
|
function WorkspaceControls(t0) {
|
|
655
|
-
const $ = c(
|
|
393
|
+
const $ = c(125);
|
|
656
394
|
const { manifest, setManifest, pages, disabled } = t0;
|
|
657
395
|
const createTrigger = useRef(null);
|
|
658
|
-
const pagesTrigger = useRef(null);
|
|
659
396
|
const editTrigger = useRef(null);
|
|
660
397
|
let t1;
|
|
661
|
-
if ($[0] !== manifest.activeWorkspaceId) {
|
|
662
|
-
|
|
398
|
+
if ($[0] !== manifest.activeWorkspaceId || $[1] !== manifest.workspaces) {
|
|
399
|
+
let t2;
|
|
400
|
+
if ($[3] !== manifest.activeWorkspaceId) {
|
|
401
|
+
t2 = (item) => item.id === manifest.activeWorkspaceId;
|
|
402
|
+
$[3] = manifest.activeWorkspaceId;
|
|
403
|
+
$[4] = t2;
|
|
404
|
+
} else t2 = $[4];
|
|
405
|
+
t1 = manifest.workspaces.find(t2);
|
|
663
406
|
$[0] = manifest.activeWorkspaceId;
|
|
664
|
-
$[1] =
|
|
665
|
-
|
|
666
|
-
|
|
407
|
+
$[1] = manifest.workspaces;
|
|
408
|
+
$[2] = t1;
|
|
409
|
+
} else t1 = $[2];
|
|
410
|
+
const workspace = t1;
|
|
667
411
|
const [action, setAction] = useState(null);
|
|
668
412
|
const [name, setName] = useState("");
|
|
669
413
|
const [draftPages, setDraftPages] = useState(null);
|
|
670
414
|
const [query, setQuery] = useState("");
|
|
671
415
|
let t2;
|
|
672
|
-
if ($[
|
|
416
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
673
417
|
t2 = () => {
|
|
674
418
|
setAction(null);
|
|
675
419
|
};
|
|
676
|
-
$[
|
|
677
|
-
|
|
678
|
-
} else t2 = $[3];
|
|
679
|
-
useEffect(t2, [workspace.id]);
|
|
420
|
+
$[5] = t2;
|
|
421
|
+
} else t2 = $[5];
|
|
680
422
|
let t3;
|
|
681
|
-
if ($[
|
|
682
|
-
t3 =
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
$[6] = t3;
|
|
688
|
-
} else t3 = $[6];
|
|
423
|
+
if ($[6] !== workspace.id) {
|
|
424
|
+
t3 = [workspace.id];
|
|
425
|
+
$[6] = workspace.id;
|
|
426
|
+
$[7] = t3;
|
|
427
|
+
} else t3 = $[7];
|
|
428
|
+
useEffect(t2, t3);
|
|
689
429
|
let t4;
|
|
690
|
-
if ($[7] !== disabled) {
|
|
691
|
-
t4 = [disabled];
|
|
692
|
-
$[7] = disabled;
|
|
693
|
-
$[8] = t4;
|
|
694
|
-
} else t4 = $[8];
|
|
695
|
-
useEffect(t3, t4);
|
|
696
|
-
const open = (next) => {
|
|
697
|
-
setName(next === "create" ? "" : workspace.name);
|
|
698
|
-
setDraftPages(next === "create" ? [] : workspace.enabledPages);
|
|
699
|
-
setQuery("");
|
|
700
|
-
setAction(next);
|
|
701
|
-
};
|
|
702
430
|
let t5;
|
|
703
|
-
if ($[
|
|
704
|
-
|
|
705
|
-
|
|
431
|
+
if ($[8] !== disabled) {
|
|
432
|
+
t4 = () => {
|
|
433
|
+
if (disabled) setAction(null);
|
|
434
|
+
};
|
|
435
|
+
t5 = [disabled];
|
|
436
|
+
$[8] = disabled;
|
|
437
|
+
$[9] = t4;
|
|
706
438
|
$[10] = t5;
|
|
707
|
-
} else
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
439
|
+
} else {
|
|
440
|
+
t4 = $[9];
|
|
441
|
+
t5 = $[10];
|
|
442
|
+
}
|
|
443
|
+
useEffect(t4, t5);
|
|
444
|
+
let t6;
|
|
445
|
+
if ($[11] !== workspace.enabledPages || $[12] !== workspace.name) {
|
|
446
|
+
t6 = (next) => {
|
|
447
|
+
setName(next === "create" ? "" : workspace.name);
|
|
448
|
+
setDraftPages(next === "create" ? [] : workspace.enabledPages);
|
|
449
|
+
setQuery("");
|
|
450
|
+
setAction(next);
|
|
451
|
+
};
|
|
452
|
+
$[11] = workspace.enabledPages;
|
|
453
|
+
$[12] = workspace.name;
|
|
454
|
+
$[13] = t6;
|
|
455
|
+
} else t6 = $[13];
|
|
456
|
+
const open = t6;
|
|
457
|
+
let t7;
|
|
458
|
+
if ($[14] !== draftPages) {
|
|
459
|
+
t7 = (id) => draftPages === null || draftPages.includes(id);
|
|
460
|
+
$[14] = draftPages;
|
|
461
|
+
$[15] = t7;
|
|
462
|
+
} else t7 = $[15];
|
|
463
|
+
const enabled = t7;
|
|
464
|
+
const title = action === "create" ? "Create workspace" : action === "delete" ? "Delete workspace?" : "Edit workspace";
|
|
465
|
+
let t8;
|
|
466
|
+
if ($[16] !== action || $[17] !== disabled || $[18] !== draftPages || $[19] !== name || $[20] !== setManifest || $[21] !== workspace.id) {
|
|
467
|
+
t8 = () => {
|
|
468
|
+
if (disabled || !action) return;
|
|
469
|
+
if ((action === "create" || action === "rename") && !name.trim()) return;
|
|
470
|
+
const created = action === "create" ? {
|
|
471
|
+
...createCanvasWorkspace(name.trim(), crypto.randomUUID()),
|
|
472
|
+
enabledPages: draftPages
|
|
473
|
+
} : null;
|
|
474
|
+
setManifest((current) => {
|
|
475
|
+
if (created) return {
|
|
476
|
+
...current,
|
|
477
|
+
workspaces: [...current.workspaces, created],
|
|
478
|
+
activeWorkspaceId: created.id
|
|
479
|
+
};
|
|
480
|
+
if (action === "delete") {
|
|
481
|
+
if (current.workspaces.length < 2) return current;
|
|
482
|
+
const remaining = current.workspaces.filter((item_0) => item_0.id !== workspace.id);
|
|
483
|
+
return {
|
|
484
|
+
...current,
|
|
485
|
+
workspaces: remaining,
|
|
486
|
+
activeWorkspaceId: remaining[0].id
|
|
487
|
+
};
|
|
488
|
+
}
|
|
726
489
|
return {
|
|
727
490
|
...current,
|
|
728
|
-
workspaces:
|
|
729
|
-
|
|
491
|
+
workspaces: current.workspaces.map((item_1) => item_1.id === workspace.id ? {
|
|
492
|
+
...item_1,
|
|
493
|
+
...action === "rename" && { name: name.trim() },
|
|
494
|
+
enabledPages: draftPages
|
|
495
|
+
} : item_1)
|
|
730
496
|
};
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
...current,
|
|
734
|
-
workspaces: current.workspaces.map((item_1) => item_1.id === workspace.id ? {
|
|
735
|
-
...item_1,
|
|
736
|
-
...action === "rename" ? { name: name.trim() } : { enabledPages: draftPages }
|
|
737
|
-
} : item_1)
|
|
738
|
-
};
|
|
739
|
-
});
|
|
740
|
-
setAction(null);
|
|
741
|
-
};
|
|
742
|
-
let t6;
|
|
743
|
-
if ($[11] !== query) {
|
|
744
|
-
t6 = (page) => `${page.title} ${page.path}`.toLowerCase().includes(query.toLowerCase());
|
|
745
|
-
$[11] = query;
|
|
746
|
-
$[12] = t6;
|
|
747
|
-
} else t6 = $[12];
|
|
748
|
-
const visiblePages = pages.filter(t6);
|
|
749
|
-
const t7 = workspace.id;
|
|
750
|
-
let t8;
|
|
751
|
-
if ($[13] !== manifest.workspaces) {
|
|
752
|
-
t8 = manifest.workspaces.map(_temp);
|
|
753
|
-
$[13] = manifest.workspaces;
|
|
754
|
-
$[14] = t8;
|
|
755
|
-
} else t8 = $[14];
|
|
756
|
-
let t9;
|
|
757
|
-
if ($[15] !== setManifest) {
|
|
758
|
-
t9 = (id_0) => {
|
|
759
|
-
if (id_0 !== null) setManifest((current_0) => ({
|
|
760
|
-
...current_0,
|
|
761
|
-
activeWorkspaceId: String(id_0)
|
|
762
|
-
}));
|
|
497
|
+
});
|
|
498
|
+
setAction(null);
|
|
763
499
|
};
|
|
764
|
-
$[
|
|
765
|
-
$[
|
|
766
|
-
|
|
500
|
+
$[16] = action;
|
|
501
|
+
$[17] = disabled;
|
|
502
|
+
$[18] = draftPages;
|
|
503
|
+
$[19] = name;
|
|
504
|
+
$[20] = setManifest;
|
|
505
|
+
$[21] = workspace.id;
|
|
506
|
+
$[22] = t8;
|
|
507
|
+
} else t8 = $[22];
|
|
508
|
+
const save = t8;
|
|
509
|
+
let T0;
|
|
510
|
+
let T1;
|
|
767
511
|
let t10;
|
|
768
|
-
if ($[17] !== open) {
|
|
769
|
-
t10 = () => open("create");
|
|
770
|
-
$[17] = open;
|
|
771
|
-
$[18] = t10;
|
|
772
|
-
} else t10 = $[18];
|
|
773
512
|
let t11;
|
|
774
|
-
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
775
|
-
t11 = /* @__PURE__ */ jsx(Plus, { size: 15 });
|
|
776
|
-
$[19] = t11;
|
|
777
|
-
} else t11 = $[19];
|
|
778
513
|
let t12;
|
|
779
|
-
if ($[20] !== t10) {
|
|
780
|
-
t12 = /* @__PURE__ */ jsx("button", {
|
|
781
|
-
ref: createTrigger,
|
|
782
|
-
"aria-label": "Add workspace",
|
|
783
|
-
title: "Add workspace",
|
|
784
|
-
onClick: t10,
|
|
785
|
-
children: t11
|
|
786
|
-
});
|
|
787
|
-
$[20] = t10;
|
|
788
|
-
$[21] = t12;
|
|
789
|
-
} else t12 = $[21];
|
|
790
514
|
let t13;
|
|
791
|
-
if ($[22] !== open) {
|
|
792
|
-
t13 = () => open("rename");
|
|
793
|
-
$[22] = open;
|
|
794
|
-
$[23] = t13;
|
|
795
|
-
} else t13 = $[23];
|
|
796
515
|
let t14;
|
|
797
|
-
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
798
|
-
t14 = /* @__PURE__ */ jsx(Pencil, { size: 14 });
|
|
799
|
-
$[24] = t14;
|
|
800
|
-
} else t14 = $[24];
|
|
801
516
|
let t15;
|
|
802
|
-
if ($[25] !== t13) {
|
|
803
|
-
t15 = /* @__PURE__ */ jsx("button", {
|
|
804
|
-
ref: editTrigger,
|
|
805
|
-
"aria-label": "Rename workspace",
|
|
806
|
-
title: "Edit workspace",
|
|
807
|
-
onClick: t13,
|
|
808
|
-
children: t14
|
|
809
|
-
});
|
|
810
|
-
$[25] = t13;
|
|
811
|
-
$[26] = t15;
|
|
812
|
-
} else t15 = $[26];
|
|
813
517
|
let t16;
|
|
814
|
-
|
|
815
|
-
t16 = () => open("pages");
|
|
816
|
-
$[27] = open;
|
|
817
|
-
$[28] = t16;
|
|
818
|
-
} else t16 = $[28];
|
|
819
|
-
const t17 = pages.filter((page_0) => workspace.enabledPages === null || workspace.enabledPages.includes(page_0.id));
|
|
518
|
+
let t17;
|
|
820
519
|
let t18;
|
|
821
|
-
if ($[29] !== pages.length || $[30] !== t17) {
|
|
822
|
-
t18 = /* @__PURE__ */ jsxs("span", { children: [
|
|
823
|
-
t17.length,
|
|
824
|
-
"/",
|
|
825
|
-
pages.length
|
|
826
|
-
] });
|
|
827
|
-
$[29] = pages.length;
|
|
828
|
-
$[30] = t17;
|
|
829
|
-
$[31] = t18;
|
|
830
|
-
} else t18 = $[31];
|
|
831
520
|
let t19;
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
$[
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
$[
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
$[
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
$[
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
$[
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
521
|
+
let t20;
|
|
522
|
+
let t21;
|
|
523
|
+
let t9;
|
|
524
|
+
if ($[23] !== action || $[24] !== disabled || $[25] !== draftPages || $[26] !== enabled || $[27] !== manifest.workspaces || $[28] !== name || $[29] !== open || $[30] !== pages || $[31] !== query || $[32] !== save || $[33] !== setManifest || $[34] !== title || $[35] !== workspace.id || $[36] !== workspace.name) {
|
|
525
|
+
let t22;
|
|
526
|
+
if ($[52] !== query) {
|
|
527
|
+
t22 = (page) => `${page.title} ${page.path}`.toLowerCase().includes(query.toLowerCase());
|
|
528
|
+
$[52] = query;
|
|
529
|
+
$[53] = t22;
|
|
530
|
+
} else t22 = $[53];
|
|
531
|
+
const visiblePages = pages.filter(t22);
|
|
532
|
+
const t23 = workspace.id;
|
|
533
|
+
let t24;
|
|
534
|
+
if ($[54] !== manifest.workspaces) {
|
|
535
|
+
t24 = manifest.workspaces.map(_temp);
|
|
536
|
+
$[54] = manifest.workspaces;
|
|
537
|
+
$[55] = t24;
|
|
538
|
+
} else t24 = $[55];
|
|
539
|
+
let t25;
|
|
540
|
+
if ($[56] !== setManifest) {
|
|
541
|
+
t25 = (id_0) => {
|
|
542
|
+
if (id_0 !== null) setManifest((current_0) => ({
|
|
543
|
+
...current_0,
|
|
544
|
+
activeWorkspaceId: String(id_0)
|
|
545
|
+
}));
|
|
546
|
+
};
|
|
547
|
+
$[56] = setManifest;
|
|
548
|
+
$[57] = t25;
|
|
549
|
+
} else t25 = $[57];
|
|
550
|
+
let t26;
|
|
551
|
+
if ($[58] !== disabled || $[59] !== t24 || $[60] !== t25 || $[61] !== workspace.id) {
|
|
552
|
+
t26 = /* @__PURE__ */ jsx("div", {
|
|
553
|
+
className: "povio-canvas-workspace-select",
|
|
554
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
555
|
+
label: "Workspace",
|
|
556
|
+
hideLabel: true,
|
|
557
|
+
size: "small",
|
|
558
|
+
variant: "outlined",
|
|
559
|
+
as: "default",
|
|
560
|
+
className: "povio-canvas-workspace-input",
|
|
561
|
+
selectionMode: "single",
|
|
562
|
+
isClearable: false,
|
|
563
|
+
isDisabled: disabled,
|
|
564
|
+
renderStaticInput: false,
|
|
565
|
+
value: t23,
|
|
566
|
+
items: t24,
|
|
567
|
+
onChange: t25
|
|
568
|
+
})
|
|
569
|
+
});
|
|
570
|
+
$[58] = disabled;
|
|
571
|
+
$[59] = t24;
|
|
572
|
+
$[60] = t25;
|
|
573
|
+
$[61] = workspace.id;
|
|
574
|
+
$[62] = t26;
|
|
575
|
+
} else t26 = $[62];
|
|
576
|
+
let t27;
|
|
577
|
+
if ($[63] !== open) {
|
|
578
|
+
t27 = () => open("create");
|
|
579
|
+
$[63] = open;
|
|
580
|
+
$[64] = t27;
|
|
581
|
+
} else t27 = $[64];
|
|
582
|
+
let t28;
|
|
583
|
+
if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
|
|
584
|
+
t28 = /* @__PURE__ */ jsx(Plus, { size: 15 });
|
|
585
|
+
$[65] = t28;
|
|
586
|
+
} else t28 = $[65];
|
|
587
|
+
let t29;
|
|
588
|
+
if ($[66] !== t27) {
|
|
589
|
+
t29 = /* @__PURE__ */ jsx("button", {
|
|
590
|
+
ref: createTrigger,
|
|
591
|
+
"aria-label": "Add workspace",
|
|
592
|
+
title: "Add workspace",
|
|
593
|
+
onClick: t27,
|
|
594
|
+
children: t28
|
|
595
|
+
});
|
|
596
|
+
$[66] = t27;
|
|
597
|
+
$[67] = t29;
|
|
598
|
+
} else t29 = $[67];
|
|
599
|
+
let t30;
|
|
600
|
+
if ($[68] !== open) {
|
|
601
|
+
t30 = () => open("rename");
|
|
602
|
+
$[68] = open;
|
|
603
|
+
$[69] = t30;
|
|
604
|
+
} else t30 = $[69];
|
|
605
|
+
let t31;
|
|
606
|
+
if ($[70] === Symbol.for("react.memo_cache_sentinel")) {
|
|
607
|
+
t31 = /* @__PURE__ */ jsx(Pencil, { size: 14 });
|
|
608
|
+
$[70] = t31;
|
|
609
|
+
} else t31 = $[70];
|
|
610
|
+
let t32;
|
|
611
|
+
if ($[71] !== t30) {
|
|
612
|
+
t32 = /* @__PURE__ */ jsx("button", {
|
|
613
|
+
ref: editTrigger,
|
|
614
|
+
"aria-label": "Rename workspace",
|
|
615
|
+
title: "Edit workspace",
|
|
616
|
+
onClick: t30,
|
|
617
|
+
children: t31
|
|
618
|
+
});
|
|
619
|
+
$[71] = t30;
|
|
620
|
+
$[72] = t32;
|
|
621
|
+
} else t32 = $[72];
|
|
622
|
+
let t33;
|
|
623
|
+
if ($[73] !== t26 || $[74] !== t29 || $[75] !== t32) {
|
|
624
|
+
t33 = /* @__PURE__ */ jsxs("div", {
|
|
625
|
+
className: "povio-canvas-workspace-picker",
|
|
933
626
|
children: [
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
pages.length,
|
|
938
|
-
" pages"
|
|
939
|
-
] }),
|
|
940
|
-
/* @__PURE__ */ jsx("button", {
|
|
941
|
-
type: "button",
|
|
942
|
-
onClick: () => setDraftPages(null),
|
|
943
|
-
children: "Enable all"
|
|
944
|
-
}),
|
|
945
|
-
/* @__PURE__ */ jsx("button", {
|
|
946
|
-
type: "button",
|
|
947
|
-
onClick: () => setDraftPages([]),
|
|
948
|
-
children: "Disable all"
|
|
949
|
-
})
|
|
627
|
+
t26,
|
|
628
|
+
t29,
|
|
629
|
+
t32
|
|
950
630
|
]
|
|
951
|
-
})
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
631
|
+
});
|
|
632
|
+
$[73] = t26;
|
|
633
|
+
$[74] = t29;
|
|
634
|
+
$[75] = t32;
|
|
635
|
+
$[76] = t33;
|
|
636
|
+
} else t33 = $[76];
|
|
637
|
+
if ($[77] !== disabled || $[78] !== t33) {
|
|
638
|
+
t21 = /* @__PURE__ */ jsx("fieldset", {
|
|
639
|
+
className: "povio-canvas-workspaces",
|
|
640
|
+
disabled,
|
|
641
|
+
children: t33
|
|
642
|
+
});
|
|
643
|
+
$[77] = disabled;
|
|
644
|
+
$[78] = t33;
|
|
645
|
+
$[79] = t21;
|
|
646
|
+
} else t21 = $[79];
|
|
647
|
+
T1 = $542a13ca2fa5b484$export$5b6b19405a83ff9d;
|
|
648
|
+
t15 = action === "create" ? createTrigger : editTrigger;
|
|
649
|
+
t16 = "bottom start";
|
|
650
|
+
t17 = 6;
|
|
651
|
+
t18 = "povio-canvas-workspace-popover";
|
|
652
|
+
t19 = action !== null;
|
|
653
|
+
if ($[80] === Symbol.for("react.memo_cache_sentinel")) {
|
|
654
|
+
t20 = (isOpen) => {
|
|
655
|
+
if (!isOpen) setAction(null);
|
|
656
|
+
};
|
|
657
|
+
$[80] = t20;
|
|
658
|
+
} else t20 = $[80];
|
|
659
|
+
T0 = $f2ff30fde7b014be$export$3ddf2d174ce01153;
|
|
660
|
+
t12 = action;
|
|
661
|
+
t13 = title;
|
|
662
|
+
t14 = action === "delete" ? "alertdialog" : "dialog";
|
|
663
|
+
if ($[81] !== save) {
|
|
664
|
+
t9 = (event) => {
|
|
665
|
+
event.preventDefault();
|
|
666
|
+
save();
|
|
667
|
+
};
|
|
668
|
+
$[81] = save;
|
|
669
|
+
$[82] = t9;
|
|
670
|
+
} else t9 = $[82];
|
|
671
|
+
let t34;
|
|
672
|
+
if ($[83] !== title) {
|
|
673
|
+
t34 = /* @__PURE__ */ jsx($2ec61d1d4f780267$export$a8a3e93435678ff9, {
|
|
674
|
+
slot: "title",
|
|
675
|
+
children: title
|
|
676
|
+
});
|
|
677
|
+
$[83] = title;
|
|
678
|
+
$[84] = t34;
|
|
679
|
+
} else t34 = $[84];
|
|
680
|
+
let t35;
|
|
681
|
+
if ($[85] === Symbol.for("react.memo_cache_sentinel")) {
|
|
682
|
+
t35 = /* @__PURE__ */ jsx("button", {
|
|
683
|
+
type: "button",
|
|
684
|
+
"aria-label": "Close workspace dialog",
|
|
685
|
+
onClick: () => setAction(null),
|
|
686
|
+
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
687
|
+
});
|
|
688
|
+
$[85] = t35;
|
|
689
|
+
} else t35 = $[85];
|
|
690
|
+
if ($[86] !== t34) {
|
|
691
|
+
t10 = /* @__PURE__ */ jsxs("header", {
|
|
692
|
+
className: "povio-canvas-workspace-popover-heading",
|
|
693
|
+
children: [t34, t35]
|
|
694
|
+
});
|
|
695
|
+
$[86] = t34;
|
|
696
|
+
$[87] = t10;
|
|
697
|
+
} else t10 = $[87];
|
|
698
|
+
t11 = action === "delete" ? /* @__PURE__ */ jsxs("p", { children: [
|
|
699
|
+
"Delete “",
|
|
700
|
+
workspace.name,
|
|
701
|
+
"” and its saved layout and theme?"
|
|
702
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [(action === "create" || action === "rename") && /* @__PURE__ */ jsxs("label", { children: ["Workspace name", /* @__PURE__ */ jsx("input", {
|
|
703
|
+
autoFocus: true,
|
|
704
|
+
value: name,
|
|
705
|
+
maxLength: 80,
|
|
706
|
+
placeholder: "Workspace name",
|
|
707
|
+
onChange: (event_0) => setName(event_0.target.value),
|
|
708
|
+
required: true
|
|
709
|
+
})] }), (action === "create" || action === "rename") && /* @__PURE__ */ jsxs("div", {
|
|
710
|
+
role: "group",
|
|
711
|
+
"aria-label": "Enabled pages",
|
|
712
|
+
className: "povio-canvas-popover-pages",
|
|
713
|
+
children: [
|
|
714
|
+
/* @__PURE__ */ jsxs("div", {
|
|
715
|
+
className: "povio-canvas-popover-page-tools",
|
|
716
|
+
children: [
|
|
717
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
718
|
+
pages.filter((page_0) => enabled(page_0.id)).length,
|
|
719
|
+
"/",
|
|
720
|
+
pages.length,
|
|
721
|
+
" pages"
|
|
722
|
+
] }),
|
|
723
|
+
/* @__PURE__ */ jsx("button", {
|
|
724
|
+
type: "button",
|
|
725
|
+
onClick: () => setDraftPages(null),
|
|
726
|
+
children: "Enable all"
|
|
727
|
+
}),
|
|
728
|
+
/* @__PURE__ */ jsx("button", {
|
|
729
|
+
type: "button",
|
|
730
|
+
onClick: () => setDraftPages([]),
|
|
731
|
+
children: "Disable all"
|
|
732
|
+
})
|
|
733
|
+
]
|
|
734
|
+
}),
|
|
735
|
+
/* @__PURE__ */ jsxs("label", {
|
|
736
|
+
className: "povio-canvas-popover-search",
|
|
737
|
+
children: [/* @__PURE__ */ jsx(Search, { size: 12 }), /* @__PURE__ */ jsx("input", {
|
|
738
|
+
"aria-label": "Find workspace pages",
|
|
739
|
+
placeholder: "Find pages…",
|
|
740
|
+
value: query,
|
|
741
|
+
onChange: (event_1) => setQuery(event_1.target.value)
|
|
742
|
+
})]
|
|
743
|
+
}),
|
|
744
|
+
/* @__PURE__ */ jsxs("div", {
|
|
745
|
+
className: "povio-canvas-popover-page-list",
|
|
746
|
+
children: [visiblePages.map((page_1) => /* @__PURE__ */ jsxs("label", { children: [/* @__PURE__ */ jsx("input", {
|
|
747
|
+
type: "checkbox",
|
|
748
|
+
checked: enabled(page_1.id),
|
|
749
|
+
onChange: (event_2) => {
|
|
750
|
+
const ids = draftPages ?? pages.map(_temp2);
|
|
751
|
+
setDraftPages(event_2.target.checked ? [.../* @__PURE__ */ new Set([...ids, page_1.id])] : ids.filter((id_1) => id_1 !== page_1.id));
|
|
752
|
+
}
|
|
753
|
+
}), /* @__PURE__ */ jsx("span", { children: page_1.title })] }, page_1.id)), !visiblePages.length && /* @__PURE__ */ jsx("p", { children: "No matching pages." })]
|
|
754
|
+
})
|
|
755
|
+
]
|
|
756
|
+
})] });
|
|
757
|
+
$[23] = action;
|
|
758
|
+
$[24] = disabled;
|
|
759
|
+
$[25] = draftPages;
|
|
760
|
+
$[26] = enabled;
|
|
761
|
+
$[27] = manifest.workspaces;
|
|
762
|
+
$[28] = name;
|
|
763
|
+
$[29] = open;
|
|
764
|
+
$[30] = pages;
|
|
765
|
+
$[31] = query;
|
|
766
|
+
$[32] = save;
|
|
767
|
+
$[33] = setManifest;
|
|
768
|
+
$[34] = title;
|
|
769
|
+
$[35] = workspace.id;
|
|
770
|
+
$[36] = workspace.name;
|
|
771
|
+
$[37] = T0;
|
|
772
|
+
$[38] = T1;
|
|
773
|
+
$[39] = t10;
|
|
774
|
+
$[40] = t11;
|
|
775
|
+
$[41] = t12;
|
|
776
|
+
$[42] = t13;
|
|
777
|
+
$[43] = t14;
|
|
778
|
+
$[44] = t15;
|
|
779
|
+
$[45] = t16;
|
|
780
|
+
$[46] = t17;
|
|
781
|
+
$[47] = t18;
|
|
782
|
+
$[48] = t19;
|
|
783
|
+
$[49] = t20;
|
|
784
|
+
$[50] = t21;
|
|
785
|
+
$[51] = t9;
|
|
786
|
+
} else {
|
|
787
|
+
T0 = $[37];
|
|
788
|
+
T1 = $[38];
|
|
789
|
+
t10 = $[39];
|
|
790
|
+
t11 = $[40];
|
|
791
|
+
t12 = $[41];
|
|
792
|
+
t13 = $[42];
|
|
793
|
+
t14 = $[43];
|
|
794
|
+
t15 = $[44];
|
|
795
|
+
t16 = $[45];
|
|
796
|
+
t17 = $[46];
|
|
797
|
+
t18 = $[47];
|
|
798
|
+
t19 = $[48];
|
|
799
|
+
t20 = $[49];
|
|
800
|
+
t21 = $[50];
|
|
801
|
+
t9 = $[51];
|
|
802
|
+
}
|
|
803
|
+
let t22;
|
|
804
|
+
if ($[88] !== action || $[89] !== manifest.workspaces.length) {
|
|
805
|
+
t22 = action === "rename" ? /* @__PURE__ */ jsxs("button", {
|
|
977
806
|
type: "button",
|
|
978
807
|
className: "povio-canvas-workspace-delete",
|
|
979
808
|
disabled: manifest.workspaces.length < 2,
|
|
@@ -985,121 +814,102 @@ function WorkspaceControls(t0) {
|
|
|
985
814
|
onClick: () => action === "delete" ? setAction("rename") : setAction(null),
|
|
986
815
|
children: action === "delete" ? "Back" : "Cancel"
|
|
987
816
|
});
|
|
988
|
-
$[
|
|
989
|
-
$[
|
|
990
|
-
$[
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
$[
|
|
998
|
-
$[
|
|
999
|
-
$[
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
t38 = /* @__PURE__ */ jsx("button", {
|
|
817
|
+
$[88] = action;
|
|
818
|
+
$[89] = manifest.workspaces.length;
|
|
819
|
+
$[90] = t22;
|
|
820
|
+
} else t22 = $[90];
|
|
821
|
+
const t23 = action === "delete" ? "is-danger" : "is-primary";
|
|
822
|
+
let t24;
|
|
823
|
+
if ($[91] !== action || $[92] !== disabled || $[93] !== name) {
|
|
824
|
+
t24 = disabled || (action === "create" || action === "rename") && !name.trim();
|
|
825
|
+
$[91] = action;
|
|
826
|
+
$[92] = disabled;
|
|
827
|
+
$[93] = name;
|
|
828
|
+
$[94] = t24;
|
|
829
|
+
} else t24 = $[94];
|
|
830
|
+
const t25 = action === "create" ? "Create workspace" : action === "delete" ? "Delete" : "Save";
|
|
831
|
+
let t26;
|
|
832
|
+
if ($[95] !== t23 || $[96] !== t24 || $[97] !== t25) {
|
|
833
|
+
t26 = /* @__PURE__ */ jsx("button", {
|
|
1006
834
|
type: "submit",
|
|
1007
|
-
className:
|
|
1008
|
-
disabled:
|
|
1009
|
-
children:
|
|
835
|
+
className: t23,
|
|
836
|
+
disabled: t24,
|
|
837
|
+
children: t25
|
|
1010
838
|
});
|
|
1011
|
-
$[
|
|
1012
|
-
$[
|
|
1013
|
-
$[
|
|
1014
|
-
$[
|
|
1015
|
-
} else
|
|
1016
|
-
let
|
|
1017
|
-
if ($[
|
|
1018
|
-
|
|
839
|
+
$[95] = t23;
|
|
840
|
+
$[96] = t24;
|
|
841
|
+
$[97] = t25;
|
|
842
|
+
$[98] = t26;
|
|
843
|
+
} else t26 = $[98];
|
|
844
|
+
let t27;
|
|
845
|
+
if ($[99] !== t22 || $[100] !== t26) {
|
|
846
|
+
t27 = /* @__PURE__ */ jsxs("div", {
|
|
1019
847
|
className: "povio-canvas-workspace-popover-actions",
|
|
1020
|
-
children: [
|
|
848
|
+
children: [t22, t26]
|
|
1021
849
|
});
|
|
1022
|
-
$[
|
|
1023
|
-
$[
|
|
1024
|
-
$[
|
|
1025
|
-
} else
|
|
1026
|
-
let
|
|
1027
|
-
if ($[
|
|
1028
|
-
|
|
1029
|
-
onSubmit:
|
|
850
|
+
$[99] = t22;
|
|
851
|
+
$[100] = t26;
|
|
852
|
+
$[101] = t27;
|
|
853
|
+
} else t27 = $[101];
|
|
854
|
+
let t28;
|
|
855
|
+
if ($[102] !== t10 || $[103] !== t11 || $[104] !== t27 || $[105] !== t9) {
|
|
856
|
+
t28 = /* @__PURE__ */ jsxs("form", {
|
|
857
|
+
onSubmit: t9,
|
|
1030
858
|
children: [
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
859
|
+
t10,
|
|
860
|
+
t11,
|
|
861
|
+
t27
|
|
1034
862
|
]
|
|
1035
863
|
});
|
|
1036
|
-
$[
|
|
1037
|
-
$[
|
|
1038
|
-
$[
|
|
1039
|
-
$[
|
|
1040
|
-
$[
|
|
1041
|
-
} else
|
|
1042
|
-
let
|
|
1043
|
-
if ($[
|
|
1044
|
-
|
|
1045
|
-
"aria-label":
|
|
1046
|
-
role:
|
|
1047
|
-
children:
|
|
1048
|
-
},
|
|
1049
|
-
$[
|
|
1050
|
-
$[
|
|
1051
|
-
$[
|
|
1052
|
-
$[
|
|
1053
|
-
$[
|
|
1054
|
-
$[
|
|
1055
|
-
} else
|
|
1056
|
-
let
|
|
1057
|
-
if ($[
|
|
1058
|
-
|
|
1059
|
-
triggerRef:
|
|
1060
|
-
placement:
|
|
1061
|
-
offset:
|
|
1062
|
-
className:
|
|
1063
|
-
isOpen:
|
|
1064
|
-
onOpenChange:
|
|
1065
|
-
children:
|
|
864
|
+
$[102] = t10;
|
|
865
|
+
$[103] = t11;
|
|
866
|
+
$[104] = t27;
|
|
867
|
+
$[105] = t9;
|
|
868
|
+
$[106] = t28;
|
|
869
|
+
} else t28 = $[106];
|
|
870
|
+
let t29;
|
|
871
|
+
if ($[107] !== T0 || $[108] !== t12 || $[109] !== t13 || $[110] !== t14 || $[111] !== t28) {
|
|
872
|
+
t29 = /* @__PURE__ */ jsx(T0, {
|
|
873
|
+
"aria-label": t13,
|
|
874
|
+
role: t14,
|
|
875
|
+
children: t28
|
|
876
|
+
}, t12);
|
|
877
|
+
$[107] = T0;
|
|
878
|
+
$[108] = t12;
|
|
879
|
+
$[109] = t13;
|
|
880
|
+
$[110] = t14;
|
|
881
|
+
$[111] = t28;
|
|
882
|
+
$[112] = t29;
|
|
883
|
+
} else t29 = $[112];
|
|
884
|
+
let t30;
|
|
885
|
+
if ($[113] !== T1 || $[114] !== t15 || $[115] !== t16 || $[116] !== t17 || $[117] !== t18 || $[118] !== t19 || $[119] !== t20 || $[120] !== t29) {
|
|
886
|
+
t30 = /* @__PURE__ */ jsx(T1, {
|
|
887
|
+
triggerRef: t15,
|
|
888
|
+
placement: t16,
|
|
889
|
+
offset: t17,
|
|
890
|
+
className: t18,
|
|
891
|
+
isOpen: t19,
|
|
892
|
+
onOpenChange: t20,
|
|
893
|
+
children: t29
|
|
1066
894
|
});
|
|
1067
|
-
$[
|
|
1068
|
-
$[
|
|
1069
|
-
$[
|
|
1070
|
-
$[
|
|
1071
|
-
$[
|
|
1072
|
-
$[
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
size: "small",
|
|
1086
|
-
variant: "outlined",
|
|
1087
|
-
as: "default",
|
|
1088
|
-
className: "povio-canvas-workspace-input",
|
|
1089
|
-
selectionMode: "single",
|
|
1090
|
-
isClearable: false,
|
|
1091
|
-
isDisabled: disabled,
|
|
1092
|
-
renderStaticInput: false,
|
|
1093
|
-
value: t7,
|
|
1094
|
-
items: t8,
|
|
1095
|
-
onChange: t9
|
|
1096
|
-
})
|
|
1097
|
-
}),
|
|
1098
|
-
t12,
|
|
1099
|
-
t15
|
|
1100
|
-
]
|
|
1101
|
-
}), t19]
|
|
1102
|
-
}), t42] });
|
|
895
|
+
$[113] = T1;
|
|
896
|
+
$[114] = t15;
|
|
897
|
+
$[115] = t16;
|
|
898
|
+
$[116] = t17;
|
|
899
|
+
$[117] = t18;
|
|
900
|
+
$[118] = t19;
|
|
901
|
+
$[119] = t20;
|
|
902
|
+
$[120] = t29;
|
|
903
|
+
$[121] = t30;
|
|
904
|
+
} else t30 = $[121];
|
|
905
|
+
let t31;
|
|
906
|
+
if ($[122] !== t21 || $[123] !== t30) {
|
|
907
|
+
t31 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t21, t30] });
|
|
908
|
+
$[122] = t21;
|
|
909
|
+
$[123] = t30;
|
|
910
|
+
$[124] = t31;
|
|
911
|
+
} else t31 = $[124];
|
|
912
|
+
return t31;
|
|
1103
913
|
}
|
|
1104
914
|
function _temp2(item_3) {
|
|
1105
915
|
return item_3.id;
|
|
@@ -1110,149 +920,57 @@ function _temp(item_2) {
|
|
|
1110
920
|
label: item_2.name
|
|
1111
921
|
};
|
|
1112
922
|
}
|
|
1113
|
-
|
|
923
|
+
//#endregion
|
|
924
|
+
//#region src/app-canvas/storage-protocol.ts
|
|
925
|
+
const canvasStorageMetaName = "povio-ui-canvas-storage";
|
|
1114
926
|
//#endregion
|
|
1115
927
|
//#region src/app-canvas/useCanvasStorage.ts
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
928
|
+
/** Canvas workspaces in `povio.canvas.json` when connected, otherwise in this browser. */
|
|
929
|
+
function useCanvasStorage(key, t0) {
|
|
930
|
+
const $ = c(11);
|
|
931
|
+
const enabled = t0 === void 0 ? true : t0;
|
|
932
|
+
let t1;
|
|
933
|
+
if ($[0] !== enabled || $[1] !== key) {
|
|
934
|
+
t1 = {
|
|
935
|
+
key,
|
|
936
|
+
metaName: canvasStorageMetaName,
|
|
937
|
+
field: "manifest",
|
|
938
|
+
parse: parseCanvasManifest,
|
|
939
|
+
noun: "workspace",
|
|
940
|
+
enabled
|
|
941
|
+
};
|
|
942
|
+
$[0] = enabled;
|
|
943
|
+
$[1] = key;
|
|
944
|
+
$[2] = t1;
|
|
945
|
+
} else t1 = $[2];
|
|
946
|
+
const t2 = useRepositoryStorage(t1);
|
|
947
|
+
let setValue;
|
|
948
|
+
let storage;
|
|
949
|
+
let value;
|
|
950
|
+
if ($[3] !== t2) {
|
|
951
|
+
({value, setValue, ...storage} = t2);
|
|
952
|
+
$[3] = t2;
|
|
953
|
+
$[4] = setValue;
|
|
954
|
+
$[5] = storage;
|
|
955
|
+
$[6] = value;
|
|
956
|
+
} else {
|
|
957
|
+
setValue = $[4];
|
|
958
|
+
storage = $[5];
|
|
959
|
+
value = $[6];
|
|
1130
960
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
const [status, setStatus] = useState(connection ? "Loading workspace…" : "Saved in this browser");
|
|
1138
|
-
const [error, setError] = useState("");
|
|
1139
|
-
const latest = useRef(manifest);
|
|
1140
|
-
latest.current = manifest;
|
|
1141
|
-
const revision = useRef(null);
|
|
1142
|
-
const saved = useRef("");
|
|
1143
|
-
const busy = useRef(false);
|
|
1144
|
-
const paused = useRef(false);
|
|
1145
|
-
const alive = useRef(true);
|
|
1146
|
-
const loadGeneration = useRef(0);
|
|
1147
|
-
useEffect(() => {
|
|
1148
|
-
alive.current = true;
|
|
1149
|
-
return () => {
|
|
1150
|
-
alive.current = false;
|
|
961
|
+
let t3;
|
|
962
|
+
if ($[7] !== setValue || $[8] !== storage || $[9] !== value) {
|
|
963
|
+
t3 = {
|
|
964
|
+
manifest: value,
|
|
965
|
+
setManifest: setValue,
|
|
966
|
+
...storage
|
|
1151
967
|
};
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
setStatus("Loading workspace…");
|
|
1159
|
-
paused.current = false;
|
|
1160
|
-
try {
|
|
1161
|
-
const response = await fetch(connection.endpoint, {
|
|
1162
|
-
headers: { [canvasStorageTokenHeader]: connection.token },
|
|
1163
|
-
cache: "no-store"
|
|
1164
|
-
});
|
|
1165
|
-
const result = await response.json();
|
|
1166
|
-
if (!response.ok) throw new Error(result.error ?? "Could not read workspace configuration.");
|
|
1167
|
-
if (!alive.current || generation !== loadGeneration.current) return;
|
|
1168
|
-
revision.current = result.revision;
|
|
1169
|
-
if (result.manifest) {
|
|
1170
|
-
const next = parseCanvasManifest(result.manifest);
|
|
1171
|
-
saved.current = JSON.stringify(next);
|
|
1172
|
-
latest.current = next;
|
|
1173
|
-
setManifest(next);
|
|
1174
|
-
} else saved.current = "";
|
|
1175
|
-
setStatus(`Saved to ${connection.file}`);
|
|
1176
|
-
setReady(true);
|
|
1177
|
-
} catch (cause) {
|
|
1178
|
-
if (!alive.current || generation !== loadGeneration.current) return;
|
|
1179
|
-
paused.current = true;
|
|
1180
|
-
setError(cause instanceof Error ? cause.message : "Could not load repository settings.");
|
|
1181
|
-
setStatus("Repository unavailable");
|
|
1182
|
-
setReady(true);
|
|
1183
|
-
}
|
|
1184
|
-
}, [connection]);
|
|
1185
|
-
useEffect(() => {
|
|
1186
|
-
load();
|
|
1187
|
-
}, [load]);
|
|
1188
|
-
const save = useCallback(async () => {
|
|
1189
|
-
if (!connection || busy.current || paused.current || !ready) return;
|
|
1190
|
-
busy.current = true;
|
|
1191
|
-
try {
|
|
1192
|
-
while (alive.current && !paused.current) {
|
|
1193
|
-
const value = latest.current;
|
|
1194
|
-
const serialized = JSON.stringify(value);
|
|
1195
|
-
if (serialized === saved.current) break;
|
|
1196
|
-
setStatus("Saving to repository…");
|
|
1197
|
-
const response_0 = await fetch(connection.endpoint, {
|
|
1198
|
-
method: "POST",
|
|
1199
|
-
headers: {
|
|
1200
|
-
"Content-Type": "application/json",
|
|
1201
|
-
[canvasStorageTokenHeader]: connection.token
|
|
1202
|
-
},
|
|
1203
|
-
body: JSON.stringify({
|
|
1204
|
-
manifest: value,
|
|
1205
|
-
revision: revision.current
|
|
1206
|
-
})
|
|
1207
|
-
});
|
|
1208
|
-
const result_0 = await response_0.json();
|
|
1209
|
-
if (!response_0.ok) throw new Error(response_0.status === 409 ? "Workspace file changed elsewhere. Export your draft, then reload repository settings." : result_0.error ?? "Could not save workspace settings.");
|
|
1210
|
-
revision.current = result_0.revision;
|
|
1211
|
-
saved.current = serialized;
|
|
1212
|
-
}
|
|
1213
|
-
if (alive.current) {
|
|
1214
|
-
setError("");
|
|
1215
|
-
setStatus(`Saved to ${connection.file}`);
|
|
1216
|
-
}
|
|
1217
|
-
} catch (cause_0) {
|
|
1218
|
-
paused.current = true;
|
|
1219
|
-
if (alive.current) {
|
|
1220
|
-
setError(cause_0 instanceof Error ? cause_0.message : "Could not save workspace settings.");
|
|
1221
|
-
setStatus("Workspace not saved to repository");
|
|
1222
|
-
}
|
|
1223
|
-
} finally {
|
|
1224
|
-
busy.current = false;
|
|
1225
|
-
}
|
|
1226
|
-
}, [connection, ready]);
|
|
1227
|
-
useEffect(() => {
|
|
1228
|
-
if (!ready) return;
|
|
1229
|
-
try {
|
|
1230
|
-
localStorage.setItem(key, JSON.stringify(manifest));
|
|
1231
|
-
} catch {
|
|
1232
|
-
if (!connection) setStatus("Browser storage unavailable — export your layout");
|
|
1233
|
-
}
|
|
1234
|
-
if (!connection || paused.current || JSON.stringify(manifest) === saved.current) return;
|
|
1235
|
-
setStatus("Saving to repository…");
|
|
1236
|
-
const timer = setTimeout(() => {
|
|
1237
|
-
save();
|
|
1238
|
-
}, 350);
|
|
1239
|
-
return () => clearTimeout(timer);
|
|
1240
|
-
}, [
|
|
1241
|
-
manifest,
|
|
1242
|
-
key,
|
|
1243
|
-
connection,
|
|
1244
|
-
ready,
|
|
1245
|
-
save
|
|
1246
|
-
]);
|
|
1247
|
-
return {
|
|
1248
|
-
manifest,
|
|
1249
|
-
setManifest,
|
|
1250
|
-
ready,
|
|
1251
|
-
status,
|
|
1252
|
-
error,
|
|
1253
|
-
repositoryFile: connection?.file,
|
|
1254
|
-
reload: load
|
|
1255
|
-
};
|
|
968
|
+
$[7] = setValue;
|
|
969
|
+
$[8] = storage;
|
|
970
|
+
$[9] = value;
|
|
971
|
+
$[10] = t3;
|
|
972
|
+
} else t3 = $[10];
|
|
973
|
+
return t3;
|
|
1256
974
|
}
|
|
1257
975
|
//#endregion
|
|
1258
976
|
//#region src/app-canvas/useFrameStartup.ts
|
|
@@ -2147,7 +1865,6 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2147
1865
|
const [query, setQuery] = useState("");
|
|
2148
1866
|
const [notice, setNotice] = useState("");
|
|
2149
1867
|
const [documentGeneration, setDocumentGeneration] = useState(0);
|
|
2150
|
-
useWorkspaceConfiguration(workspace, storage.ready, documentGeneration, setManifest);
|
|
2151
1868
|
const [reload, setReload] = useState({});
|
|
2152
1869
|
const [showLayers, setShowLayers] = useState(true);
|
|
2153
1870
|
useEffect(() => setHoveredLayer(null), [
|
|
@@ -2625,12 +2342,6 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2625
2342
|
className: "povio-canvas-catalog",
|
|
2626
2343
|
"aria-label": "Page catalog",
|
|
2627
2344
|
children: [
|
|
2628
|
-
/* @__PURE__ */ jsx(WorkspaceControls, {
|
|
2629
|
-
manifest,
|
|
2630
|
-
setManifest,
|
|
2631
|
-
pages: allPages,
|
|
2632
|
-
disabled: !storage.ready
|
|
2633
|
-
}),
|
|
2634
2345
|
/* @__PURE__ */ jsxs("div", {
|
|
2635
2346
|
className: "povio-canvas-brand povio-canvas-content-switch",
|
|
2636
2347
|
role: "group",
|
|
@@ -2651,6 +2362,12 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2651
2362
|
})]
|
|
2652
2363
|
})]
|
|
2653
2364
|
}),
|
|
2365
|
+
/* @__PURE__ */ jsx(WorkspaceControls, {
|
|
2366
|
+
manifest,
|
|
2367
|
+
setManifest,
|
|
2368
|
+
pages: allPages,
|
|
2369
|
+
disabled: !storage.ready
|
|
2370
|
+
}),
|
|
2654
2371
|
/* @__PURE__ */ jsxs("div", {
|
|
2655
2372
|
className: "povio-canvas-search",
|
|
2656
2373
|
children: [
|
|
@@ -2748,18 +2465,14 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2748
2465
|
/* @__PURE__ */ jsxs("div", {
|
|
2749
2466
|
className: "povio-canvas-storage-status",
|
|
2750
2467
|
role: "status",
|
|
2751
|
-
children: [
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
},
|
|
2760
|
-
children: "Reload repository settings"
|
|
2761
|
-
})] })
|
|
2762
|
-
]
|
|
2468
|
+
children: [storage.status, storage.error && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", { children: storage.error }), /* @__PURE__ */ jsx("button", {
|
|
2469
|
+
onClick: () => {
|
|
2470
|
+
setRuntime({});
|
|
2471
|
+
setDocumentGeneration((value_3) => value_3 + 1);
|
|
2472
|
+
storage.reload();
|
|
2473
|
+
},
|
|
2474
|
+
children: "Reload repository settings"
|
|
2475
|
+
})] })]
|
|
2763
2476
|
})
|
|
2764
2477
|
]
|
|
2765
2478
|
}),
|
|
@@ -3316,6 +3029,19 @@ function startCanvasDocument(doc, options) {
|
|
|
3316
3029
|
win.addEventListener("resize", schedule);
|
|
3317
3030
|
doc.addEventListener("load", schedule, true);
|
|
3318
3031
|
doc.fonts?.ready.then(schedule);
|
|
3032
|
+
const focusDescriptor = Object.getOwnPropertyDescriptor(win.HTMLElement.prototype, "focus");
|
|
3033
|
+
const elementFocus = focusDescriptor.value;
|
|
3034
|
+
const windowFocusDescriptor = Object.getOwnPropertyDescriptor(win, "focus");
|
|
3035
|
+
const windowFocus = windowFocusDescriptor?.value;
|
|
3036
|
+
Object.defineProperty(win.HTMLElement.prototype, "focus", {
|
|
3037
|
+
...focusDescriptor,
|
|
3038
|
+
value(focusOptions) {
|
|
3039
|
+
if (doc.hasFocus()) elementFocus.call(this, focusOptions);
|
|
3040
|
+
}
|
|
3041
|
+
});
|
|
3042
|
+
win.focus = () => {
|
|
3043
|
+
if (doc.hasFocus()) windowFocus?.call(win);
|
|
3044
|
+
};
|
|
3319
3045
|
refresh();
|
|
3320
3046
|
return {
|
|
3321
3047
|
refresh,
|
|
@@ -3331,6 +3057,9 @@ function startCanvasDocument(doc, options) {
|
|
|
3331
3057
|
win.removeEventListener("submit", submit, true);
|
|
3332
3058
|
win.removeEventListener("resize", schedule);
|
|
3333
3059
|
doc.removeEventListener("load", schedule, true);
|
|
3060
|
+
Object.defineProperty(win.HTMLElement.prototype, "focus", focusDescriptor);
|
|
3061
|
+
if (windowFocusDescriptor) Object.defineProperty(win, "focus", windowFocusDescriptor);
|
|
3062
|
+
else Reflect.deleteProperty(win, "focus");
|
|
3334
3063
|
for (const [media, value] of mediaOriginals) media.mediaText = value;
|
|
3335
3064
|
for (const [style, values] of originals) for (const [property, [value, priority]] of values) if (value) style.setProperty(property, value, priority);
|
|
3336
3065
|
else style.removeProperty(property);
|
|
@@ -3411,7 +3140,7 @@ function AppCanvasFrameBridge({ href }) {
|
|
|
3411
3140
|
const APP_CANVAS_PATH = "/_canvas";
|
|
3412
3141
|
/** Must match `componentsFrameParam`; kept inline so the canvas page does not load the gallery eagerly. */
|
|
3413
3142
|
const componentsParam = "povio-components";
|
|
3414
|
-
const CanvasComponentsFrame = lazy(() => import("./CanvasComponentsFrame-
|
|
3143
|
+
const CanvasComponentsFrame = lazy(() => import("./CanvasComponentsFrame-CbgJJv-3.js"));
|
|
3415
3144
|
/** Ready-made route page. Mount beneath the app's UIConfigurationProvider. */
|
|
3416
3145
|
function AppCanvasPage(t0) {
|
|
3417
3146
|
const $ = c(24);
|