@povio/ui 5.0.0-rc.14 → 5.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppCanvasPage-vta1j5YQ.js → AppCanvasPage-C3KN-Pwb.js} +156 -589
- package/dist/{AppCanvasPage-BZ2mrKY4.d.ts → AppCanvasPage-U9SxNwjS.d.ts} +1 -1
- package/dist/{BottomSheet-BXLE3161.js → BottomSheet-AqYVSMK9.js} +1 -75
- package/dist/BottomSheetHeader-Be6Elvs2.js +79 -0
- package/dist/{Calendar-DRHruqr_.js → Calendar-1p3VjSED.js} +3 -3
- package/dist/{CanvasComponentsFrame-D6Mh_G3q.js → CanvasComponentsFrame-Dp0oDDoH.js} +6 -6
- package/dist/{UIConfigurator-CjAW1SJY.js → CanvasInspector-TC9DOf5p.js} +1456 -500
- package/dist/{ComponentGallery-CzKU899_.js → ComponentGallery-C_rXFvUY.js} +250 -1797
- package/dist/{DatePicker-xDEqzNJv.js → DatePicker-CAzuZRmd.js} +6 -6
- package/dist/{DatePickerInput-B0fEeCOf.js → DatePickerInput-BeQOVCk0.js} +4 -3
- package/dist/{DateRangePicker-DxuVhRaf.js → DateRangePicker-X3mBhfmL.js} +5 -5
- package/dist/{DateTimePicker-4N1Pka07.js → DateTimePicker-EtmGtoRe.js} +6 -6
- package/dist/{InputItem-Cv19Hwnx.js → InputItem-yC5oMyN-.js} +7 -7
- package/dist/{Inputs-D1aE_J9f.js → Inputs-Bd2nRNqk.js} +1 -1
- package/dist/{NumberRangeInput-Bzfe-RlV.js → NumberRangeInput-TkPXiWV3.js} +2 -2
- package/dist/{RichTextEditor-Bd7F5D8f.js → RichTextEditor-DiaPcBUM.js} +110 -32
- package/dist/{Select-CgIhoWgk.js → Select-tNlFSbAC.js} +5 -5
- package/dist/{Table-piX1SWvN.js → Table-CgG02oHQ.js} +1 -1
- package/dist/{TextArea-uPffb457.js → TextArea-DuvFUjts.js} +1 -1
- package/dist/{TimePicker-DN-i98z5.js → TimePicker-CBkiE-Yq.js} +5 -4
- package/dist/{TooltipWrapper-CDHFaUKZ.js → TooltipWrapper-CSXs5-E3.js} +2 -2
- package/dist/components/autocomplete.js +3 -3
- package/dist/components/bottom-sheet.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/number-field.js +3 -3
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/query-autocomplete.js +1 -1
- package/dist/components/query-select.js +2 -2
- package/dist/components/select.js +1 -1
- package/dist/components/text-area.js +1 -1
- package/dist/components/time-picker.js +1 -1
- package/dist/config/app-canvas-tanstack.d.ts +1 -1
- 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-configurator.d.ts +35 -2
- package/dist/config/ui-configurator.js +214 -3
- package/dist/{datePickerValue.utils-QWR2q5Vv.js → datePickerValue.utils-BDB6KM8q.js} +1 -1
- package/dist/demos-DIwj5vc0.js +2011 -0
- package/dist/index.js +7 -7
- package/dist/{logger-CqZjM-sn.js → logger-CW24po62.js} +10 -1
- package/dist/rhf/date-picker.js +1 -1
- package/dist/rhf/date-range-picker.js +1 -1
- package/dist/rhf/date-time-picker.js +1 -1
- package/dist/rhf/number-range-input.js +1 -1
- package/dist/rhf/rich-text-editor.js +1 -1
- package/dist/rhf/select.js +1 -1
- package/dist/rhf/text-area.js +1 -1
- package/dist/rhf/time-picker.js +1 -1
- package/dist/rhf.js +7 -7
- package/dist/rich-text-editor.js +1 -1
- package/dist/{staticDateTimeSegments-BWea3HAt.js → staticDateTimeSegments-Bs1_N5MR.js} +1 -1
- package/dist/{staticSelect.utils-BfTCi26B.js → staticSelect.utils-BgdYv2vP.js} +5 -4
- package/dist/styles/app-canvas.css +30 -24
- package/dist/styles/configurator.css +421 -34
- package/dist/tanstack/date-picker.js +1 -1
- package/dist/tanstack/date-range-picker.js +1 -1
- package/dist/tanstack/date-time-picker.js +1 -1
- package/dist/tanstack/form.js +1 -1
- package/dist/tanstack/inputs.js +1 -1
- package/dist/tanstack/number-range-input.js +1 -1
- package/dist/tanstack/rich-text-editor.js +1 -1
- package/dist/tanstack/select.js +1 -1
- package/dist/tanstack/table.js +2 -2
- package/dist/tanstack/text-area.js +1 -1
- package/dist/tanstack/time-picker.js +1 -1
- package/dist/tanstack.js +15 -15
- package/dist/token-classes-BqLWiy6O.js +245 -0
- package/dist/{useFieldAccessibility-B-bjtrNw.js → useFieldAccessibility-DnCdz938.js} +2 -1
- package/dist/{useFormAutosave-pmh35PXp.js → useFormAutosave-CxqZAJAB.js} +1 -1
- package/dist/{useStaticInputHandoff-B7DEm75m.js → useStaticInputHandoff-DKsxpVck.js} +2 -1
- package/dist/{useTableColumnConfig-CNJ_ZvIN.js → useTableColumnConfig-BnbKElno.js} +1 -1
- package/dist/utils/logger.js +1 -1
- package/package.json +1 -1
- package/src/configurator/README.md +11 -0
- package/dist/groups-oQmSeqXn.js +0 -18
- package/dist/underline-66hmELxa.js +0 -81
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
|
|
2
|
-
import { _ as Moon, a as
|
|
2
|
+
import { _ as Moon, a as UIConfigurationModal, d as Trash, f as Sun, g as Pencil, h as Plus, i as useCanvasInspector, m as ScanLine, n as CanvasInspectorPanel, p as Settings2, r as CanvasLayerHighlight, s as useRepositoryStorage, t as CanvasInspectionOverlay, u as useUIConfiguration, v as Frame } from "./CanvasInspector-TC9DOf5p.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";
|
|
@@ -7,10 +7,9 @@ import { t as Upload } from "./upload-CXU83BJ4.js";
|
|
|
7
7
|
import { t as X } from "./x-B6vfz8Ps.js";
|
|
8
8
|
import { c as $542a13ca2fa5b484$export$5b6b19405a83ff9d, n as $f2ff30fde7b014be$export$3ddf2d174ce01153 } from "./Dialog-CKLkS00H.js";
|
|
9
9
|
import { t as $2ec61d1d4f780267$export$a8a3e93435678ff9 } from "./Heading-nI1_VOaE.js";
|
|
10
|
-
import { t as Select } from "./Select-
|
|
10
|
+
import { t as Select } from "./Select-tNlFSbAC.js";
|
|
11
11
|
import { t as ThemeContext } from "./theme.context-B3wQDJ-i.js";
|
|
12
12
|
import { c as isEditableToken } from "./theme-model-DtTsIxou.js";
|
|
13
|
-
import { t as componentArtboards } from "./groups-oQmSeqXn.js";
|
|
14
13
|
import { Suspense, lazy, memo, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
15
14
|
import { c } from "react/compiler-runtime";
|
|
16
15
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -21,7 +20,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
21
20
|
* This source code is licensed under the ISC license.
|
|
22
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
23
22
|
*/
|
|
24
|
-
const __iconData$
|
|
23
|
+
const __iconData$5 = {
|
|
25
24
|
name: "download",
|
|
26
25
|
size: 24,
|
|
27
26
|
node: [
|
|
@@ -39,52 +38,8 @@ const __iconData$8 = {
|
|
|
39
38
|
}]
|
|
40
39
|
]
|
|
41
40
|
};
|
|
42
|
-
__iconData$
|
|
43
|
-
const Download = createLucideIcon(__iconData$
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/frame.mjs
|
|
46
|
-
/**
|
|
47
|
-
* @license lucide-react v1.43.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/
|
|
52
|
-
const __iconData$7 = {
|
|
53
|
-
name: "frame",
|
|
54
|
-
size: 24,
|
|
55
|
-
node: [
|
|
56
|
-
["line", {
|
|
57
|
-
x1: "22",
|
|
58
|
-
x2: "2",
|
|
59
|
-
y1: "6",
|
|
60
|
-
y2: "6",
|
|
61
|
-
key: "15w7dq"
|
|
62
|
-
}],
|
|
63
|
-
["line", {
|
|
64
|
-
x1: "22",
|
|
65
|
-
x2: "2",
|
|
66
|
-
y1: "18",
|
|
67
|
-
y2: "18",
|
|
68
|
-
key: "1ip48p"
|
|
69
|
-
}],
|
|
70
|
-
["line", {
|
|
71
|
-
x1: "6",
|
|
72
|
-
x2: "6",
|
|
73
|
-
y1: "2",
|
|
74
|
-
y2: "22",
|
|
75
|
-
key: "a2lnyx"
|
|
76
|
-
}],
|
|
77
|
-
["line", {
|
|
78
|
-
x1: "18",
|
|
79
|
-
x2: "18",
|
|
80
|
-
y1: "2",
|
|
81
|
-
y2: "22",
|
|
82
|
-
key: "8vb6jd"
|
|
83
|
-
}]
|
|
84
|
-
]
|
|
85
|
-
};
|
|
86
|
-
__iconData$7.node;
|
|
87
|
-
const Frame = createLucideIcon(__iconData$7);
|
|
41
|
+
__iconData$5.node;
|
|
42
|
+
const Download = createLucideIcon(__iconData$5);
|
|
88
43
|
//#endregion
|
|
89
44
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/hand.mjs
|
|
90
45
|
/**
|
|
@@ -93,7 +48,7 @@ const Frame = createLucideIcon(__iconData$7);
|
|
|
93
48
|
* This source code is licensed under the ISC license.
|
|
94
49
|
* See the LICENSE file in the root directory of this source tree.
|
|
95
50
|
*/
|
|
96
|
-
const __iconData$
|
|
51
|
+
const __iconData$4 = {
|
|
97
52
|
name: "hand",
|
|
98
53
|
size: 24,
|
|
99
54
|
node: [
|
|
@@ -115,8 +70,8 @@ const __iconData$6 = {
|
|
|
115
70
|
}]
|
|
116
71
|
]
|
|
117
72
|
};
|
|
118
|
-
__iconData$
|
|
119
|
-
const Hand = createLucideIcon(__iconData$
|
|
73
|
+
__iconData$4.node;
|
|
74
|
+
const Hand = createLucideIcon(__iconData$4);
|
|
120
75
|
//#endregion
|
|
121
76
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/monitor.mjs
|
|
122
77
|
/**
|
|
@@ -125,7 +80,7 @@ const Hand = createLucideIcon(__iconData$6);
|
|
|
125
80
|
* This source code is licensed under the ISC license.
|
|
126
81
|
* See the LICENSE file in the root directory of this source tree.
|
|
127
82
|
*/
|
|
128
|
-
const __iconData$
|
|
83
|
+
const __iconData$3 = {
|
|
129
84
|
name: "monitor",
|
|
130
85
|
size: 24,
|
|
131
86
|
node: [
|
|
@@ -153,8 +108,8 @@ const __iconData$5 = {
|
|
|
153
108
|
}]
|
|
154
109
|
]
|
|
155
110
|
};
|
|
156
|
-
__iconData$
|
|
157
|
-
const Monitor = createLucideIcon(__iconData$
|
|
111
|
+
__iconData$3.node;
|
|
112
|
+
const Monitor = createLucideIcon(__iconData$3);
|
|
158
113
|
//#endregion
|
|
159
114
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/mouse-pointer-2.mjs
|
|
160
115
|
/**
|
|
@@ -163,7 +118,7 @@ const Monitor = createLucideIcon(__iconData$5);
|
|
|
163
118
|
* This source code is licensed under the ISC license.
|
|
164
119
|
* See the LICENSE file in the root directory of this source tree.
|
|
165
120
|
*/
|
|
166
|
-
const __iconData$
|
|
121
|
+
const __iconData$2 = {
|
|
167
122
|
name: "mouse-pointer-2",
|
|
168
123
|
size: 24,
|
|
169
124
|
node: [["path", {
|
|
@@ -171,8 +126,8 @@ const __iconData$4 = {
|
|
|
171
126
|
key: "edeuup"
|
|
172
127
|
}]]
|
|
173
128
|
};
|
|
174
|
-
__iconData$
|
|
175
|
-
const MousePointer2 = createLucideIcon(__iconData$
|
|
129
|
+
__iconData$2.node;
|
|
130
|
+
const MousePointer2 = createLucideIcon(__iconData$2);
|
|
176
131
|
//#endregion
|
|
177
132
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/panel-left.mjs
|
|
178
133
|
/**
|
|
@@ -181,7 +136,7 @@ const MousePointer2 = createLucideIcon(__iconData$4);
|
|
|
181
136
|
* This source code is licensed under the ISC license.
|
|
182
137
|
* See the LICENSE file in the root directory of this source tree.
|
|
183
138
|
*/
|
|
184
|
-
const __iconData$
|
|
139
|
+
const __iconData$1 = {
|
|
185
140
|
name: "panel-left",
|
|
186
141
|
size: 24,
|
|
187
142
|
node: [["rect", {
|
|
@@ -197,8 +152,8 @@ const __iconData$3 = {
|
|
|
197
152
|
}]],
|
|
198
153
|
aliases: ["sidebar"]
|
|
199
154
|
};
|
|
200
|
-
__iconData$
|
|
201
|
-
const PanelLeft = createLucideIcon(__iconData$
|
|
155
|
+
__iconData$1.node;
|
|
156
|
+
const PanelLeft = createLucideIcon(__iconData$1);
|
|
202
157
|
//#endregion
|
|
203
158
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/panels-top-left.mjs
|
|
204
159
|
/**
|
|
@@ -207,7 +162,7 @@ const PanelLeft = createLucideIcon(__iconData$3);
|
|
|
207
162
|
* This source code is licensed under the ISC license.
|
|
208
163
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
164
|
*/
|
|
210
|
-
const __iconData
|
|
165
|
+
const __iconData = {
|
|
211
166
|
name: "panels-top-left",
|
|
212
167
|
size: 24,
|
|
213
168
|
node: [
|
|
@@ -230,80 +185,8 @@ const __iconData$2 = {
|
|
|
230
185
|
],
|
|
231
186
|
aliases: ["layout"]
|
|
232
187
|
};
|
|
233
|
-
__iconData$2.node;
|
|
234
|
-
const PanelsTopLeft = createLucideIcon(__iconData$2);
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/scan-line.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$1 = {
|
|
244
|
-
name: "scan-line",
|
|
245
|
-
size: 24,
|
|
246
|
-
node: [
|
|
247
|
-
["path", {
|
|
248
|
-
d: "M3 7V5a2 2 0 0 1 2-2h2",
|
|
249
|
-
key: "aa7l1z"
|
|
250
|
-
}],
|
|
251
|
-
["path", {
|
|
252
|
-
d: "M17 3h2a2 2 0 0 1 2 2v2",
|
|
253
|
-
key: "4qcy5o"
|
|
254
|
-
}],
|
|
255
|
-
["path", {
|
|
256
|
-
d: "M21 17v2a2 2 0 0 1-2 2h-2",
|
|
257
|
-
key: "6vwrx8"
|
|
258
|
-
}],
|
|
259
|
-
["path", {
|
|
260
|
-
d: "M7 21H5a2 2 0 0 1-2-2v-2",
|
|
261
|
-
key: "ioqczr"
|
|
262
|
-
}],
|
|
263
|
-
["path", {
|
|
264
|
-
d: "M7 12h10",
|
|
265
|
-
key: "b7w52i"
|
|
266
|
-
}]
|
|
267
|
-
]
|
|
268
|
-
};
|
|
269
|
-
__iconData$1.node;
|
|
270
|
-
const ScanLine = createLucideIcon(__iconData$1);
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/settings-2.mjs
|
|
273
|
-
/**
|
|
274
|
-
* @license lucide-react v1.43.0 - ISC
|
|
275
|
-
*
|
|
276
|
-
* This source code is licensed under the ISC license.
|
|
277
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
-
*/
|
|
279
|
-
const __iconData = {
|
|
280
|
-
name: "settings-2",
|
|
281
|
-
size: 24,
|
|
282
|
-
node: [
|
|
283
|
-
["path", {
|
|
284
|
-
d: "M14 17H5",
|
|
285
|
-
key: "gfn3mx"
|
|
286
|
-
}],
|
|
287
|
-
["path", {
|
|
288
|
-
d: "M19 7h-9",
|
|
289
|
-
key: "6i9tg"
|
|
290
|
-
}],
|
|
291
|
-
["circle", {
|
|
292
|
-
cx: "17",
|
|
293
|
-
cy: "17",
|
|
294
|
-
r: "3",
|
|
295
|
-
key: "18b49y"
|
|
296
|
-
}],
|
|
297
|
-
["circle", {
|
|
298
|
-
cx: "7",
|
|
299
|
-
cy: "7",
|
|
300
|
-
r: "3",
|
|
301
|
-
key: "dfmy0x"
|
|
302
|
-
}]
|
|
303
|
-
]
|
|
304
|
-
};
|
|
305
188
|
__iconData.node;
|
|
306
|
-
const
|
|
189
|
+
const PanelsTopLeft = createLucideIcon(__iconData);
|
|
307
190
|
//#endregion
|
|
308
191
|
//#region src/app-canvas/manifest.ts
|
|
309
192
|
function createCanvasWorkspace(name, id) {
|
|
@@ -1186,415 +1069,58 @@ function PageLayers({ frame, title, selected, onSelect, onHover }) {
|
|
|
1186
1069
|
]
|
|
1187
1070
|
});
|
|
1188
1071
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
const
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
useEffect(() => {
|
|
1209
|
-
if (!enabled) clear();
|
|
1210
|
-
}, [enabled, clear]);
|
|
1211
|
-
useEffect(() => {
|
|
1212
|
-
clear();
|
|
1213
|
-
}, [generation, clear]);
|
|
1214
|
-
useEffect(() => () => {
|
|
1215
|
-
if (hoverFrame.current !== null) cancelAnimationFrame(hoverFrame.current);
|
|
1216
|
-
}, []);
|
|
1217
|
-
const pick = useCallback((pageId, frame, clientX, clientY, pin) => {
|
|
1218
|
-
if (!enabled || pinned && !pin) return;
|
|
1219
|
-
const bounds = frame.getBoundingClientRect();
|
|
1220
|
-
if (!bounds.width || !bounds.height) return;
|
|
1221
|
-
try {
|
|
1222
|
-
const doc = frame.contentDocument;
|
|
1223
|
-
if (!doc) return;
|
|
1224
|
-
const x = (clientX - bounds.left) * frame.clientWidth / bounds.width;
|
|
1225
|
-
const y = (clientY - bounds.top) * frame.clientHeight / bounds.height;
|
|
1226
|
-
const hit = doc.elementFromPoint(x, y);
|
|
1227
|
-
const element = hit?.closest("button,input,textarea,select,a,label,[role],h1,h2,h3,h4,h5,h6,p") ?? hit;
|
|
1228
|
-
if (!element || element === doc.documentElement || element === doc.body || element.namespaceURI !== "http://www.w3.org/1999/xhtml") return;
|
|
1229
|
-
const target = element;
|
|
1230
|
-
setSelection((current) => current?.element === target ? current : {
|
|
1231
|
-
pageId,
|
|
1232
|
-
element: target
|
|
1233
|
-
});
|
|
1234
|
-
setHighlightKey(null);
|
|
1235
|
-
if (pin) setPinned((current_0) => !(current_0 && selection?.element === target));
|
|
1236
|
-
} catch {
|
|
1237
|
-
clear();
|
|
1238
|
-
}
|
|
1239
|
-
}, [
|
|
1240
|
-
enabled,
|
|
1241
|
-
pinned,
|
|
1242
|
-
selection,
|
|
1243
|
-
clear
|
|
1244
|
-
]);
|
|
1245
|
-
const hover = useCallback((pageId_0, frame_0, x_0, y_0) => {
|
|
1246
|
-
if (!enabled || pinned) return;
|
|
1247
|
-
pending.current = () => pick(pageId_0, frame_0, x_0, y_0, false);
|
|
1248
|
-
if (hoverFrame.current !== null) return;
|
|
1249
|
-
hoverFrame.current = requestAnimationFrame(() => {
|
|
1250
|
-
hoverFrame.current = null;
|
|
1251
|
-
pending.current?.();
|
|
1252
|
-
pending.current = null;
|
|
1072
|
+
const gap = 64;
|
|
1073
|
+
const header = 48;
|
|
1074
|
+
const titleSpace = 72;
|
|
1075
|
+
const sectionGap = 192;
|
|
1076
|
+
/**
|
|
1077
|
+
* Lays component artboards out by section: a title, then rows of up to four columns. Saved positions win, so
|
|
1078
|
+
* artboards a person dragged stay where they put them.
|
|
1079
|
+
*/
|
|
1080
|
+
function layoutComponentArtboards(pages, heights, positions = {}) {
|
|
1081
|
+
const rowWidth = 1872;
|
|
1082
|
+
const nodes = [];
|
|
1083
|
+
const sections = [];
|
|
1084
|
+
const order = [...new Set(pages.map((page) => page.section))];
|
|
1085
|
+
let y = 0;
|
|
1086
|
+
for (const section of order) {
|
|
1087
|
+
sections.push({
|
|
1088
|
+
title: section,
|
|
1089
|
+
x: 0,
|
|
1090
|
+
y: y + titleSpace - 12
|
|
1253
1091
|
});
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
pick(pageId_1, frame_1, x_1, y_1, true);
|
|
1264
|
-
}, [pick]);
|
|
1265
|
-
useEffect(() => {
|
|
1266
|
-
if (!enabled || !selection) return;
|
|
1267
|
-
const { element: element_0 } = selection;
|
|
1268
|
-
const doc_0 = element_0.ownerDocument;
|
|
1269
|
-
const owner = doc_0.defaultView;
|
|
1270
|
-
if (!owner) return;
|
|
1271
|
-
let scheduled = null;
|
|
1272
|
-
const measure = () => {
|
|
1273
|
-
scheduled = null;
|
|
1274
|
-
if (!element_0.isConnected) {
|
|
1275
|
-
clear();
|
|
1276
|
-
return;
|
|
1092
|
+
y += titleSpace;
|
|
1093
|
+
let x = 0;
|
|
1094
|
+
let rowHeight = 0;
|
|
1095
|
+
for (const page of pages.filter((item) => item.section === section)) {
|
|
1096
|
+
const width = page.wide ? 904 : 420;
|
|
1097
|
+
if (x > 0 && x + width > rowWidth) {
|
|
1098
|
+
y += rowHeight + gap;
|
|
1099
|
+
x = 0;
|
|
1100
|
+
rowHeight = 0;
|
|
1277
1101
|
}
|
|
1278
|
-
const
|
|
1279
|
-
const
|
|
1280
|
-
const
|
|
1281
|
-
const
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
"padding.bottom",
|
|
1285
|
-
"padding.left",
|
|
1286
|
-
"margin.top",
|
|
1287
|
-
"margin.right",
|
|
1288
|
-
"margin.bottom",
|
|
1289
|
-
"margin.left",
|
|
1290
|
-
"gap.row",
|
|
1291
|
-
"gap.column"
|
|
1292
|
-
].flatMap((key) => {
|
|
1293
|
-
const [kind, side] = key.split(".");
|
|
1294
|
-
const raw = kind === "padding" ? snapshot.box.padding[side] : kind === "margin" ? snapshot.box.margin[side] : snapshot.box.gap[side];
|
|
1295
|
-
if (!(Math.abs(Number.parseFloat(raw)) > 0)) return [];
|
|
1296
|
-
const details_0 = getBoxHighlights(element_0, key);
|
|
1297
|
-
const regions = details_0.regions.filter((region) => region.width > 0 && region.height > 0);
|
|
1298
|
-
return regions.length ? [{
|
|
1299
|
-
key,
|
|
1300
|
-
label: details_0.label,
|
|
1301
|
-
regions
|
|
1302
|
-
}] : [];
|
|
1303
|
-
});
|
|
1304
|
-
if (!highlightKey) {
|
|
1305
|
-
const seen = new Set(spacing.flatMap((item) => item.regions.map((region_0) => `${item.key}:${region_0.left}:${region_0.top}:${region_0.width}:${region_0.height}`)));
|
|
1306
|
-
for (const child of Array.from(element_0.children).slice(0, 80)) {
|
|
1307
|
-
if (child.namespaceURI !== "http://www.w3.org/1999/xhtml" || !child.getClientRects().length) continue;
|
|
1308
|
-
const style = owner.getComputedStyle(child);
|
|
1309
|
-
if (style.display === "none" || style.visibility === "hidden" || /^(absolute|fixed)$/.test(style.position)) continue;
|
|
1310
|
-
for (const side_0 of [
|
|
1311
|
-
"top",
|
|
1312
|
-
"right",
|
|
1313
|
-
"bottom",
|
|
1314
|
-
"left"
|
|
1315
|
-
]) {
|
|
1316
|
-
if (!(Math.abs(Number.parseFloat(style.getPropertyValue(`margin-${side_0}`))) > 0)) continue;
|
|
1317
|
-
const key_0 = `margin.${side_0}`;
|
|
1318
|
-
const details_1 = getBoxHighlights(child, key_0);
|
|
1319
|
-
const regions_0 = details_1.regions.filter((region_1) => {
|
|
1320
|
-
const id = `${key_0}:${region_1.left}:${region_1.top}:${region_1.width}:${region_1.height}`;
|
|
1321
|
-
if (seen.has(id)) return false;
|
|
1322
|
-
seen.add(id);
|
|
1323
|
-
return region_1.width > 0 && region_1.height > 0;
|
|
1324
|
-
});
|
|
1325
|
-
if (regions_0.length) spacing.push({
|
|
1326
|
-
key: key_0,
|
|
1327
|
-
label: details_1.label,
|
|
1328
|
-
regions: regions_0
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
const next = {
|
|
1334
|
-
snapshot,
|
|
1335
|
-
spacing,
|
|
1336
|
-
outline: {
|
|
1337
|
-
left: rect.left,
|
|
1338
|
-
top: rect.top,
|
|
1339
|
-
width: rect.width,
|
|
1340
|
-
height: rect.height
|
|
1341
|
-
},
|
|
1342
|
-
highlight: details && highlightKey ? {
|
|
1343
|
-
key: highlightKey,
|
|
1344
|
-
...details
|
|
1345
|
-
} : null
|
|
1102
|
+
const measured = heights[page.id];
|
|
1103
|
+
const height = Number.isFinite(measured) && measured > 0 ? measured : 240;
|
|
1104
|
+
const saved = positions[page.id];
|
|
1105
|
+
const position = saved && Number.isFinite(saved.x) && Number.isFinite(saved.y) ? saved : {
|
|
1106
|
+
x,
|
|
1107
|
+
y
|
|
1346
1108
|
};
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
const mutations = new MutationObserver(schedule);
|
|
1353
|
-
mutations.observe(doc_0.documentElement, {
|
|
1354
|
-
subtree: true,
|
|
1355
|
-
childList: true,
|
|
1356
|
-
attributes: true,
|
|
1357
|
-
characterData: true
|
|
1358
|
-
});
|
|
1359
|
-
const resize = new ResizeObserver(schedule);
|
|
1360
|
-
resize.observe(element_0);
|
|
1361
|
-
owner.addEventListener("scroll", schedule, true);
|
|
1362
|
-
measure();
|
|
1363
|
-
return () => {
|
|
1364
|
-
mutations.disconnect();
|
|
1365
|
-
resize.disconnect();
|
|
1366
|
-
owner.removeEventListener("scroll", schedule, true);
|
|
1367
|
-
if (scheduled !== null) cancelAnimationFrame(scheduled);
|
|
1368
|
-
};
|
|
1369
|
-
}, [
|
|
1370
|
-
enabled,
|
|
1371
|
-
selection,
|
|
1372
|
-
highlightKey,
|
|
1373
|
-
clear,
|
|
1374
|
-
isKnown
|
|
1375
|
-
]);
|
|
1376
|
-
return {
|
|
1377
|
-
selection,
|
|
1378
|
-
selectElement: (pageId_2, element_1) => {
|
|
1379
|
-
setSelection({
|
|
1380
|
-
pageId: pageId_2,
|
|
1381
|
-
element: element_1
|
|
1109
|
+
nodes.push({
|
|
1110
|
+
...page,
|
|
1111
|
+
...position,
|
|
1112
|
+
width,
|
|
1113
|
+
height
|
|
1382
1114
|
});
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
pinned,
|
|
1388
|
-
hover,
|
|
1389
|
-
select,
|
|
1390
|
-
clear,
|
|
1391
|
-
highlight: setHighlightKey,
|
|
1392
|
-
togglePin: () => setPinned((value) => !value)
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
function CanvasInspectorPanel(t0) {
|
|
1396
|
-
const $ = c(22);
|
|
1397
|
-
const { inspector, onClose, onSelectToken } = t0;
|
|
1398
|
-
let t1;
|
|
1399
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1400
|
-
t1 = /* @__PURE__ */ jsx("strong", { children: "Inspector view" });
|
|
1401
|
-
$[0] = t1;
|
|
1402
|
-
} else t1 = $[0];
|
|
1403
|
-
const t2 = !inspector.selection;
|
|
1404
|
-
let t3;
|
|
1405
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1406
|
-
t3 = /* @__PURE__ */ jsx(Pin, { size: 14 });
|
|
1407
|
-
$[1] = t3;
|
|
1408
|
-
} else t3 = $[1];
|
|
1409
|
-
let t4;
|
|
1410
|
-
if ($[2] !== inspector.pinned || $[3] !== inspector.togglePin || $[4] !== t2) {
|
|
1411
|
-
t4 = /* @__PURE__ */ jsx("button", {
|
|
1412
|
-
"aria-label": "Pin inspected element",
|
|
1413
|
-
"aria-pressed": inspector.pinned,
|
|
1414
|
-
disabled: t2,
|
|
1415
|
-
onClick: inspector.togglePin,
|
|
1416
|
-
children: t3
|
|
1417
|
-
});
|
|
1418
|
-
$[2] = inspector.pinned;
|
|
1419
|
-
$[3] = inspector.togglePin;
|
|
1420
|
-
$[4] = t2;
|
|
1421
|
-
$[5] = t4;
|
|
1422
|
-
} else t4 = $[5];
|
|
1423
|
-
let t5;
|
|
1424
|
-
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1425
|
-
t5 = /* @__PURE__ */ jsx(X, { size: 15 });
|
|
1426
|
-
$[6] = t5;
|
|
1427
|
-
} else t5 = $[6];
|
|
1428
|
-
let t6;
|
|
1429
|
-
if ($[7] !== onClose) {
|
|
1430
|
-
t6 = /* @__PURE__ */ jsx("button", {
|
|
1431
|
-
"aria-label": "Close inspector view",
|
|
1432
|
-
onClick: onClose,
|
|
1433
|
-
children: t5
|
|
1434
|
-
});
|
|
1435
|
-
$[7] = onClose;
|
|
1436
|
-
$[8] = t6;
|
|
1437
|
-
} else t6 = $[8];
|
|
1438
|
-
let t7;
|
|
1439
|
-
if ($[9] !== t4 || $[10] !== t6) {
|
|
1440
|
-
t7 = /* @__PURE__ */ jsxs("header", { children: [
|
|
1441
|
-
t1,
|
|
1442
|
-
t4,
|
|
1443
|
-
t6
|
|
1444
|
-
] });
|
|
1445
|
-
$[9] = t4;
|
|
1446
|
-
$[10] = t6;
|
|
1447
|
-
$[11] = t7;
|
|
1448
|
-
} else t7 = $[11];
|
|
1449
|
-
const t8 = inspector.pinned ? "Selection pinned · click it again to unpin" : "Hover a component · click to pin";
|
|
1450
|
-
let t9;
|
|
1451
|
-
if ($[12] !== t8) {
|
|
1452
|
-
t9 = /* @__PURE__ */ jsx("p", {
|
|
1453
|
-
className: "povio-canvas-inspect-hint",
|
|
1454
|
-
children: t8
|
|
1455
|
-
});
|
|
1456
|
-
$[12] = t8;
|
|
1457
|
-
$[13] = t9;
|
|
1458
|
-
} else t9 = $[13];
|
|
1459
|
-
let t10;
|
|
1460
|
-
if ($[14] !== inspector.highlight || $[15] !== inspector.measurement || $[16] !== onSelectToken) {
|
|
1461
|
-
t10 = inspector.measurement ? /* @__PURE__ */ jsx(InspectorDetails, {
|
|
1462
|
-
snapshot: inspector.measurement.snapshot,
|
|
1463
|
-
onSelect: onSelectToken,
|
|
1464
|
-
onHighlight: inspector.highlight
|
|
1465
|
-
}) : /* @__PURE__ */ jsx("p", {
|
|
1466
|
-
className: "povio-canvas-inspect-hint",
|
|
1467
|
-
children: "Inspect a live page to see its padding, margins, borders, radii and gaps."
|
|
1468
|
-
});
|
|
1469
|
-
$[14] = inspector.highlight;
|
|
1470
|
-
$[15] = inspector.measurement;
|
|
1471
|
-
$[16] = onSelectToken;
|
|
1472
|
-
$[17] = t10;
|
|
1473
|
-
} else t10 = $[17];
|
|
1474
|
-
let t11;
|
|
1475
|
-
if ($[18] !== t10 || $[19] !== t7 || $[20] !== t9) {
|
|
1476
|
-
t11 = /* @__PURE__ */ jsxs("aside", {
|
|
1477
|
-
className: "studio-inspector-panel povio-canvas-inspector",
|
|
1478
|
-
"aria-label": "Inspector view",
|
|
1479
|
-
children: [
|
|
1480
|
-
t7,
|
|
1481
|
-
t9,
|
|
1482
|
-
t10
|
|
1483
|
-
]
|
|
1484
|
-
});
|
|
1485
|
-
$[18] = t10;
|
|
1486
|
-
$[19] = t7;
|
|
1487
|
-
$[20] = t9;
|
|
1488
|
-
$[21] = t11;
|
|
1489
|
-
} else t11 = $[21];
|
|
1490
|
-
return t11;
|
|
1491
|
-
}
|
|
1492
|
-
function CanvasInspectionOverlay(t0) {
|
|
1493
|
-
const $ = c(9);
|
|
1494
|
-
const { measurement, width } = t0;
|
|
1495
|
-
let t1;
|
|
1496
|
-
if ($[0] !== measurement.outline) {
|
|
1497
|
-
t1 = /* @__PURE__ */ jsx("div", {
|
|
1498
|
-
className: "studio-hover-outline",
|
|
1499
|
-
style: measurement.outline
|
|
1500
|
-
});
|
|
1501
|
-
$[0] = measurement.outline;
|
|
1502
|
-
$[1] = t1;
|
|
1503
|
-
} else t1 = $[1];
|
|
1504
|
-
let t2;
|
|
1505
|
-
if ($[2] !== measurement.highlight || $[3] !== measurement.spacing || $[4] !== width) {
|
|
1506
|
-
t2 = measurement.highlight ? /* @__PURE__ */ jsx(HighlightOverlay, {
|
|
1507
|
-
highlight: measurement.highlight,
|
|
1508
|
-
width
|
|
1509
|
-
}) : measurement.spacing.map((highlight) => /* @__PURE__ */ jsxs("div", {
|
|
1510
|
-
className: "povio-canvas-auto-spacing",
|
|
1511
|
-
children: [/* @__PURE__ */ jsx(HighlightOverlay, {
|
|
1512
|
-
highlight,
|
|
1513
|
-
width
|
|
1514
|
-
}), highlight.regions.map((region) => /* @__PURE__ */ jsx("span", {
|
|
1515
|
-
className: "povio-canvas-spacing-value",
|
|
1516
|
-
style: {
|
|
1517
|
-
left: region.left + region.width / 2,
|
|
1518
|
-
top: region.top + region.height / 2
|
|
1519
|
-
},
|
|
1520
|
-
children: highlight.label.split(": ")[1]
|
|
1521
|
-
}, `${region.left}:${region.top}:${region.width}:${region.height}`))]
|
|
1522
|
-
}, `${highlight.key}:${highlight.label}:${highlight.regions[0]?.left}:${highlight.regions[0]?.top}`));
|
|
1523
|
-
$[2] = measurement.highlight;
|
|
1524
|
-
$[3] = measurement.spacing;
|
|
1525
|
-
$[4] = width;
|
|
1526
|
-
$[5] = t2;
|
|
1527
|
-
} else t2 = $[5];
|
|
1528
|
-
let t3;
|
|
1529
|
-
if ($[6] !== t1 || $[7] !== t2) {
|
|
1530
|
-
t3 = /* @__PURE__ */ jsxs("div", {
|
|
1531
|
-
className: "povio-canvas-inspection-overlay",
|
|
1532
|
-
"aria-hidden": "true",
|
|
1533
|
-
children: [t1, t2]
|
|
1534
|
-
});
|
|
1535
|
-
$[6] = t1;
|
|
1536
|
-
$[7] = t2;
|
|
1537
|
-
$[8] = t3;
|
|
1538
|
-
} else t3 = $[8];
|
|
1539
|
-
return t3;
|
|
1540
|
-
}
|
|
1541
|
-
/** Temporary layer hover never replaces the pinned inspector selection. */
|
|
1542
|
-
function CanvasLayerHighlight(t0) {
|
|
1543
|
-
const $ = c(5);
|
|
1544
|
-
const { element } = t0;
|
|
1545
|
-
const [bounds, setBounds] = useState(null);
|
|
1546
|
-
let t1;
|
|
1547
|
-
let t2;
|
|
1548
|
-
if ($[0] !== element) {
|
|
1549
|
-
t1 = () => {
|
|
1550
|
-
const owner = element.ownerDocument.defaultView;
|
|
1551
|
-
const measure = () => {
|
|
1552
|
-
if (!element.isConnected) {
|
|
1553
|
-
setBounds(null);
|
|
1554
|
-
return;
|
|
1555
|
-
}
|
|
1556
|
-
const rect = element.getBoundingClientRect();
|
|
1557
|
-
setBounds({
|
|
1558
|
-
left: rect.left,
|
|
1559
|
-
top: rect.top,
|
|
1560
|
-
width: rect.width,
|
|
1561
|
-
height: rect.height
|
|
1562
|
-
});
|
|
1563
|
-
};
|
|
1564
|
-
measure();
|
|
1565
|
-
const observer = new ResizeObserver(measure);
|
|
1566
|
-
observer.observe(element);
|
|
1567
|
-
owner?.addEventListener("scroll", measure, true);
|
|
1568
|
-
owner?.addEventListener("resize", measure);
|
|
1569
|
-
return () => {
|
|
1570
|
-
observer.disconnect();
|
|
1571
|
-
owner?.removeEventListener("scroll", measure, true);
|
|
1572
|
-
owner?.removeEventListener("resize", measure);
|
|
1573
|
-
};
|
|
1574
|
-
};
|
|
1575
|
-
t2 = [element];
|
|
1576
|
-
$[0] = element;
|
|
1577
|
-
$[1] = t1;
|
|
1578
|
-
$[2] = t2;
|
|
1579
|
-
} else {
|
|
1580
|
-
t1 = $[1];
|
|
1581
|
-
t2 = $[2];
|
|
1115
|
+
x += width + gap;
|
|
1116
|
+
rowHeight = Math.max(rowHeight, header + height);
|
|
1117
|
+
}
|
|
1118
|
+
y += rowHeight + sectionGap;
|
|
1582
1119
|
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
className: "povio-canvas-inspection-overlay povio-canvas-layer-highlight",
|
|
1588
|
-
"aria-hidden": "true",
|
|
1589
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
1590
|
-
className: "studio-hover-outline",
|
|
1591
|
-
style: bounds
|
|
1592
|
-
})
|
|
1593
|
-
}) : null;
|
|
1594
|
-
$[3] = bounds;
|
|
1595
|
-
$[4] = t3;
|
|
1596
|
-
} else t3 = $[4];
|
|
1597
|
-
return t3;
|
|
1120
|
+
return {
|
|
1121
|
+
nodes,
|
|
1122
|
+
sections
|
|
1123
|
+
};
|
|
1598
1124
|
}
|
|
1599
1125
|
//#endregion
|
|
1600
1126
|
//#region src/app-canvas/route-model.ts
|
|
@@ -1861,6 +1387,23 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
1861
1387
|
const [dark, setDark] = useState(false);
|
|
1862
1388
|
/** The canvas shows either the app's pages or the component gallery's sections, as artboards either way. */
|
|
1863
1389
|
const [content, setContent] = useState("pages");
|
|
1390
|
+
/** Gallery components (names and sections only); the demos themselves render inside their frames. */
|
|
1391
|
+
const [componentList, setComponentList] = useState([]);
|
|
1392
|
+
useEffect(() => {
|
|
1393
|
+
if (!componentsHref) return;
|
|
1394
|
+
let cancelled = false;
|
|
1395
|
+
import("./demos-DIwj5vc0.js").then((n) => n.n).then(({ demos }) => {
|
|
1396
|
+
if (!cancelled) setComponentList(demos.map(({ id, title, group, wide }) => ({
|
|
1397
|
+
id,
|
|
1398
|
+
title,
|
|
1399
|
+
section: group,
|
|
1400
|
+
wide
|
|
1401
|
+
})));
|
|
1402
|
+
});
|
|
1403
|
+
return () => {
|
|
1404
|
+
cancelled = true;
|
|
1405
|
+
};
|
|
1406
|
+
}, [componentsHref]);
|
|
1864
1407
|
const [mobilePanel, setMobilePanel] = useState(null);
|
|
1865
1408
|
const [query, setQuery] = useState("");
|
|
1866
1409
|
const [notice, setNotice] = useState("");
|
|
@@ -1910,15 +1453,20 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
1910
1453
|
workspace.enabledPages,
|
|
1911
1454
|
storage.ready
|
|
1912
1455
|
]);
|
|
1913
|
-
const componentCatalog = useMemo(() => componentsHref ?
|
|
1914
|
-
id: `
|
|
1915
|
-
title:
|
|
1916
|
-
path:
|
|
1917
|
-
|
|
1456
|
+
const componentCatalog = useMemo(() => componentsHref ? componentList.map((component) => ({
|
|
1457
|
+
id: `component:${component.id}`,
|
|
1458
|
+
title: component.title,
|
|
1459
|
+
path: component.section,
|
|
1460
|
+
section: component.section,
|
|
1461
|
+
wide: component.wide,
|
|
1462
|
+
href: componentsHref(component.id),
|
|
1918
1463
|
missingParams: [],
|
|
1919
1464
|
kind: "page"
|
|
1920
|
-
})) : [], [componentsHref]);
|
|
1921
|
-
const
|
|
1465
|
+
})) : [], [componentsHref, componentList]);
|
|
1466
|
+
const showingComponents = content === "components" && componentCatalog.length > 0;
|
|
1467
|
+
const catalog = showingComponents ? componentCatalog : pageCatalog;
|
|
1468
|
+
/** Components are measured from a short frame; pages start at the breakpoint's viewport height. */
|
|
1469
|
+
const frameViewportHeight = showingComponents ? 240 : bp.height;
|
|
1922
1470
|
const startupKeys = useMemo(() => new Map(catalog.filter((page_0) => page_0.href).map((page_1) => [page_1.id, `${documentGeneration}:${bp.id}:${page_1.id}:${page_1.href}:${reload[page_1.id] ?? 0}`])), [
|
|
1923
1471
|
catalog,
|
|
1924
1472
|
documentGeneration,
|
|
@@ -1934,12 +1482,21 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
1934
1482
|
keys: startupKeys,
|
|
1935
1483
|
complete: startup.complete
|
|
1936
1484
|
};
|
|
1937
|
-
const heights = useMemo(() => Object.fromEntries(catalog.map((page_2) => [page_2.id, runtime[`${bp.id}:${page_2.id}:${page_2.href ?? ""}`]?.height ??
|
|
1485
|
+
const heights = useMemo(() => Object.fromEntries(catalog.map((page_2) => [page_2.id, runtime[`${bp.id}:${page_2.id}:${page_2.href ?? ""}`]?.height ?? frameViewportHeight])), [
|
|
1938
1486
|
catalog,
|
|
1939
1487
|
runtime,
|
|
1940
|
-
bp
|
|
1488
|
+
bp,
|
|
1489
|
+
frameViewportHeight
|
|
1941
1490
|
]);
|
|
1942
|
-
const nodes = useMemo(() =>
|
|
1491
|
+
const { nodes, sections } = useMemo(() => {
|
|
1492
|
+
const positions = workspace.positions[bp.id] ?? {};
|
|
1493
|
+
return showingComponents ? layoutComponentArtboards(componentCatalog, heights, positions) : {
|
|
1494
|
+
nodes: layoutCanvasPages(catalog, bp.width, heights, positions),
|
|
1495
|
+
sections: []
|
|
1496
|
+
};
|
|
1497
|
+
}, [
|
|
1498
|
+
showingComponents,
|
|
1499
|
+
componentCatalog,
|
|
1943
1500
|
catalog,
|
|
1944
1501
|
bp,
|
|
1945
1502
|
heights,
|
|
@@ -1965,25 +1522,28 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
1965
1522
|
const valid = new Set(catalog.map((page_3) => `${bp.id}:${page_3.id}:${page_3.href ?? ""}`));
|
|
1966
1523
|
setRuntime((current) => Object.keys(current).some((key_0) => !valid.has(key_0)) ? Object.fromEntries(Object.entries(current).filter(([key]) => valid.has(key))) : current);
|
|
1967
1524
|
}, [catalog, bp.id]);
|
|
1525
|
+
const frameInteract = interact || showingComponents && !inspectMode;
|
|
1968
1526
|
const latest = useRef({
|
|
1969
1527
|
configuration: configuration.active,
|
|
1970
1528
|
dark,
|
|
1971
|
-
interact,
|
|
1529
|
+
interact: frameInteract,
|
|
1972
1530
|
bp,
|
|
1973
1531
|
catalog,
|
|
1974
|
-
frameUrl
|
|
1532
|
+
frameUrl,
|
|
1533
|
+
viewportHeight: frameViewportHeight
|
|
1975
1534
|
});
|
|
1976
1535
|
latest.current = {
|
|
1977
1536
|
configuration: configuration.active,
|
|
1978
1537
|
dark,
|
|
1979
|
-
interact,
|
|
1538
|
+
interact: frameInteract,
|
|
1980
1539
|
bp,
|
|
1981
1540
|
catalog,
|
|
1982
|
-
frameUrl
|
|
1541
|
+
frameUrl,
|
|
1542
|
+
viewportHeight: frameViewportHeight
|
|
1983
1543
|
};
|
|
1984
|
-
const register = useCallback((
|
|
1985
|
-
if (frame) frames.current.set(
|
|
1986
|
-
else frames.current.delete(
|
|
1544
|
+
const register = useCallback((id_0, frame) => {
|
|
1545
|
+
if (frame) frames.current.set(id_0, frame);
|
|
1546
|
+
else frames.current.delete(id_0);
|
|
1987
1547
|
}, []);
|
|
1988
1548
|
const paint = useCallback(() => {
|
|
1989
1549
|
if (world.current) {
|
|
@@ -2005,16 +1565,16 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2005
1565
|
paint();
|
|
2006
1566
|
});
|
|
2007
1567
|
}, [paint]);
|
|
2008
|
-
const send = useCallback((
|
|
2009
|
-
const frame_0 = frames.current.get(
|
|
1568
|
+
const send = useCallback((id_1, type = "configuration") => {
|
|
1569
|
+
const frame_0 = frames.current.get(id_1);
|
|
2010
1570
|
if (!frame_0?.contentWindow) return;
|
|
2011
1571
|
const current_0 = latest.current;
|
|
2012
1572
|
try {
|
|
2013
1573
|
frame_0.contentWindow.postMessage({
|
|
2014
1574
|
protocol: canvasProtocol,
|
|
2015
|
-
id:
|
|
1575
|
+
id: id_1,
|
|
2016
1576
|
token,
|
|
2017
|
-
viewportHeight: current_0.
|
|
1577
|
+
viewportHeight: current_0.viewportHeight,
|
|
2018
1578
|
type,
|
|
2019
1579
|
configuration: current_0.configuration,
|
|
2020
1580
|
revision: revision.current,
|
|
@@ -2025,10 +1585,10 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2025
1585
|
setNotice("This configuration could not be sent to the page. Check for non-serializable values.");
|
|
2026
1586
|
}
|
|
2027
1587
|
}, [token]);
|
|
2028
|
-
const focusPage = useCallback((
|
|
2029
|
-
const node_0 = nodeMap.get(
|
|
1588
|
+
const focusPage = useCallback((id_2) => {
|
|
1589
|
+
const node_0 = nodeMap.get(id_2), view = viewport.current;
|
|
2030
1590
|
if (!node_0 || !view) return;
|
|
2031
|
-
setSelected(
|
|
1591
|
+
setSelected(id_2);
|
|
2032
1592
|
setShowLayers(true);
|
|
2033
1593
|
camera.current.zoom = Math.min(1, Math.max(.005, (view.clientWidth - 80) / node_0.width));
|
|
2034
1594
|
camera.current.x = 40 - node_0.x * camera.current.zoom;
|
|
@@ -2112,7 +1672,7 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2112
1672
|
useEffect(() => {
|
|
2113
1673
|
const frame_2 = requestAnimationFrame(() => {
|
|
2114
1674
|
revision.current++;
|
|
2115
|
-
for (const
|
|
1675
|
+
for (const id_3 of frames.current.keys()) send(id_3);
|
|
2116
1676
|
});
|
|
2117
1677
|
return () => cancelAnimationFrame(frame_2);
|
|
2118
1678
|
}, [
|
|
@@ -2121,8 +1681,8 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2121
1681
|
send
|
|
2122
1682
|
]);
|
|
2123
1683
|
useEffect(() => {
|
|
2124
|
-
for (const
|
|
2125
|
-
}, [
|
|
1684
|
+
for (const id_4 of frames.current.keys()) send(id_4, "mode");
|
|
1685
|
+
}, [frameInteract, send]);
|
|
2126
1686
|
useEffect(() => {
|
|
2127
1687
|
paint();
|
|
2128
1688
|
const element = viewport.current;
|
|
@@ -2269,11 +1829,11 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2269
1829
|
}
|
|
2270
1830
|
if (event_3.currentTarget.hasPointerCapture(event_3.pointerId)) event_3.currentTarget.releasePointerCapture(event_3.pointerId);
|
|
2271
1831
|
};
|
|
2272
|
-
const onLoad = useCallback((
|
|
2273
|
-
if (frames.current.get(
|
|
2274
|
-
startupRef.current.complete(startupRef.current.keys.get(
|
|
2275
|
-
send(
|
|
2276
|
-
send(
|
|
1832
|
+
const onLoad = useCallback((id_5, frame_3) => {
|
|
1833
|
+
if (frames.current.get(id_5) !== frame_3) return;
|
|
1834
|
+
startupRef.current.complete(startupRef.current.keys.get(id_5));
|
|
1835
|
+
send(id_5);
|
|
1836
|
+
send(id_5, "mode");
|
|
2277
1837
|
}, [send]);
|
|
2278
1838
|
useEffect(() => {
|
|
2279
1839
|
const timer = setTimeout(() => setRuntime((current_5) => {
|
|
@@ -2456,7 +2016,7 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2456
2016
|
"/",
|
|
2457
2017
|
nodes.length,
|
|
2458
2018
|
" ",
|
|
2459
|
-
content === "components" ? "
|
|
2019
|
+
content === "components" ? "components" : "pages",
|
|
2460
2020
|
" ready"
|
|
2461
2021
|
]
|
|
2462
2022
|
})
|
|
@@ -2500,14 +2060,21 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2500
2060
|
children: /* @__PURE__ */ jsx(PanelLeft, { size: 18 })
|
|
2501
2061
|
})
|
|
2502
2062
|
}),
|
|
2503
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2504
2064
|
ref: world,
|
|
2505
2065
|
className: "povio-canvas-world",
|
|
2506
2066
|
style: {
|
|
2507
2067
|
width: width_0,
|
|
2508
2068
|
height: height_0
|
|
2509
2069
|
},
|
|
2510
|
-
children:
|
|
2070
|
+
children: [sections.map((section) => /* @__PURE__ */ jsx("h2", {
|
|
2071
|
+
className: "povio-canvas-section-title",
|
|
2072
|
+
style: {
|
|
2073
|
+
left: section.x,
|
|
2074
|
+
top: section.y
|
|
2075
|
+
},
|
|
2076
|
+
children: section.title
|
|
2077
|
+
}, section.title)), nodes.map((node_5, index) => {
|
|
2511
2078
|
const state = runtime[`${bp.id}:${node_5.id}:${node_5.href ?? ""}`] ?? {};
|
|
2512
2079
|
let source = "";
|
|
2513
2080
|
let originError = false;
|
|
@@ -2558,7 +2125,7 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2558
2125
|
children: [
|
|
2559
2126
|
/* @__PURE__ */ jsx("strong", { children: node_5.title }),
|
|
2560
2127
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2561
|
-
|
|
2128
|
+
node_5.width,
|
|
2562
2129
|
" × ",
|
|
2563
2130
|
Math.round(node_5.height).toLocaleString()
|
|
2564
2131
|
] }),
|
|
@@ -2627,20 +2194,20 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2627
2194
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2628
2195
|
/* @__PURE__ */ jsx(PageFrame, {
|
|
2629
2196
|
id: node_5.id,
|
|
2630
|
-
interact,
|
|
2197
|
+
interact: frameInteract,
|
|
2631
2198
|
inspect: inspectMode,
|
|
2632
2199
|
src: source,
|
|
2633
|
-
width:
|
|
2200
|
+
width: node_5.width,
|
|
2634
2201
|
height: node_5.height,
|
|
2635
2202
|
name: `${canvasProtocol}:${JSON.stringify({
|
|
2636
2203
|
id: node_5.id,
|
|
2637
2204
|
token,
|
|
2638
|
-
viewportHeight:
|
|
2205
|
+
viewportHeight: frameViewportHeight
|
|
2639
2206
|
})}`,
|
|
2640
2207
|
onLoad,
|
|
2641
2208
|
register
|
|
2642
2209
|
}, `${documentGeneration}:${bp.id}:${source}:${reload[node_5.id] ?? 0}`),
|
|
2643
|
-
!
|
|
2210
|
+
!frameInteract && /* @__PURE__ */ jsx("button", {
|
|
2644
2211
|
type: "button",
|
|
2645
2212
|
className: "povio-canvas-frame-cover",
|
|
2646
2213
|
tabIndex: 0,
|
|
@@ -2680,7 +2247,7 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2680
2247
|
})
|
|
2681
2248
|
]
|
|
2682
2249
|
}, node_5.id);
|
|
2683
|
-
})
|
|
2250
|
+
})]
|
|
2684
2251
|
}),
|
|
2685
2252
|
!nodes.length && /* @__PURE__ */ jsx("div", {
|
|
2686
2253
|
className: "povio-canvas-empty",
|
|
@@ -2779,12 +2346,12 @@ function AppCanvas({ router, examples = emptyExamples, exclude = emptyExclude, e
|
|
|
2779
2346
|
id: item_4.id,
|
|
2780
2347
|
label: `${item_4.label} · ${item_4.width}px`
|
|
2781
2348
|
})),
|
|
2782
|
-
onChange: (
|
|
2783
|
-
if (
|
|
2349
|
+
onChange: (id_6) => {
|
|
2350
|
+
if (id_6 === null || id_6 === bp.id) return;
|
|
2784
2351
|
setRuntime({});
|
|
2785
2352
|
setManifest((m_2) => ({
|
|
2786
2353
|
...m_2,
|
|
2787
|
-
breakpoint: String(
|
|
2354
|
+
breakpoint: String(id_6)
|
|
2788
2355
|
}));
|
|
2789
2356
|
}
|
|
2790
2357
|
})
|
|
@@ -3147,7 +2714,7 @@ function AppCanvasFrameBridge({ href }) {
|
|
|
3147
2714
|
const APP_CANVAS_PATH = "/_canvas";
|
|
3148
2715
|
/** Must match `componentsFrameParam`; kept inline so the canvas page does not load the gallery eagerly. */
|
|
3149
2716
|
const componentsParam = "povio-components";
|
|
3150
|
-
const CanvasComponentsFrame = lazy(() => import("./CanvasComponentsFrame-
|
|
2717
|
+
const CanvasComponentsFrame = lazy(() => import("./CanvasComponentsFrame-Dp0oDDoH.js"));
|
|
3151
2718
|
/** Ready-made route page. Mount beneath the app's UIConfigurationProvider. */
|
|
3152
2719
|
function AppCanvasPage(t0) {
|
|
3153
2720
|
const $ = c(24);
|
|
@@ -3205,10 +2772,10 @@ function AppCanvasPage(t0) {
|
|
|
3205
2772
|
if (isAppCanvasFrame()) {
|
|
3206
2773
|
let t7;
|
|
3207
2774
|
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
3208
|
-
const
|
|
3209
|
-
t7 =
|
|
2775
|
+
const component = new URLSearchParams(window.location.search).get(componentsParam);
|
|
2776
|
+
t7 = component ? /* @__PURE__ */ jsx(Suspense, {
|
|
3210
2777
|
fallback: null,
|
|
3211
|
-
children: /* @__PURE__ */ jsx(CanvasComponentsFrame, {
|
|
2778
|
+
children: /* @__PURE__ */ jsx(CanvasComponentsFrame, { id: component })
|
|
3212
2779
|
}) : null;
|
|
3213
2780
|
$[14] = t7;
|
|
3214
2781
|
} else t7 = $[14];
|
|
@@ -3216,7 +2783,7 @@ function AppCanvasPage(t0) {
|
|
|
3216
2783
|
}
|
|
3217
2784
|
let t7;
|
|
3218
2785
|
if ($[15] !== canvasPath) {
|
|
3219
|
-
t7 = (
|
|
2786
|
+
t7 = (component_0) => `${canvasPath}?${componentsParam}=${encodeURIComponent(component_0)}`;
|
|
3220
2787
|
$[15] = canvasPath;
|
|
3221
2788
|
$[16] = t7;
|
|
3222
2789
|
} else t7 = $[16];
|