@measured/puck 0.21.0-canary.c78dc826 → 0.21.0-canary.cbc526d1
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/{Editor-N46HUQEC.mjs → Editor-32UYWE6W.mjs} +13 -10
- package/dist/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
- package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
- package/dist/{Render-Y567PGZ7.mjs → Render-FXZX6NFH.mjs} +6 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-BkBoKAc5.d.mts} +26 -36
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-BkBoKAc5.d.ts} +26 -36
- package/dist/{chunk-3QHWXJEI.mjs → chunk-3VQHXASI.mjs} +2 -2
- package/dist/{chunk-K3V4LVUL.mjs → chunk-6KNQXLQR.mjs} +14 -10
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/{chunk-GQKMOYLG.mjs → chunk-GVKHZNTR.mjs} +2 -2
- package/dist/{chunk-7KY6RHEY.mjs → chunk-K562SEXI.mjs} +109 -526
- package/dist/chunk-KN3XDS7U.mjs +528 -0
- package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
- package/dist/{chunk-DNF2EMM4.mjs → chunk-MEL7FUSF.mjs} +2 -2
- package/dist/{chunk-C2TVYIYC.mjs → chunk-NYGQH27S.mjs} +105 -75
- package/dist/{chunk-DJSH5REF.mjs → chunk-Q3TJ2VYO.mjs} +25 -126
- package/dist/chunk-REWRIUGR.mjs +156 -0
- package/dist/{chunk-FNWOH4R6.mjs → chunk-V2IQTPPK.mjs} +8 -6
- package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/{chunk-TB3SSIAY.mjs → chunk-WD3LNSAC.mjs} +5258 -4424
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{full-NLUNPJWS.mjs → full-4OS3O57Y.mjs} +10 -7
- package/dist/index-bqD1SEOb.d.mts +118 -0
- package/dist/index-lt1zf5WR.d.ts +118 -0
- package/dist/index.css +732 -341
- package/dist/index.d.mts +31 -120
- package/dist/index.d.ts +31 -120
- package/dist/index.js +3494 -2436
- package/dist/index.mjs +22 -16
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/{loaded-ZXOU6S6R.mjs → loaded-DCQVLO7I.mjs} +7 -4
- package/dist/{loaded-HMSPJUZM.mjs → loaded-JGRO7BH7.mjs} +7 -4
- package/dist/{loaded-EV34KGYJ.mjs → loaded-KKVJE5KH.mjs} +7 -4
- package/dist/no-external.css +870 -475
- package/dist/no-external.d.mts +4 -2
- package/dist/no-external.d.ts +4 -2
- package/dist/no-external.js +3412 -2351
- package/dist/no-external.mjs +22 -11
- package/dist/rsc.css +28 -27
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +146 -83
- package/dist/rsc.mjs +6 -4
- package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
- package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
- package/package.json +9 -4
- package/dist/chunk-WUWXFMEM.mjs +0 -11
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
styles_module_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AOEDIUVK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
defaultAppState,
|
|
6
|
-
mapFields,
|
|
7
6
|
resolveComponentData,
|
|
7
|
+
toComponent
|
|
8
|
+
} from "./chunk-REWRIUGR.mjs";
|
|
9
|
+
import {
|
|
10
|
+
get_class_name_factory_default
|
|
11
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getZoneId,
|
|
14
|
+
mapFields,
|
|
8
15
|
walkAppState,
|
|
9
16
|
walkTree
|
|
10
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Q3TJ2VYO.mjs";
|
|
11
18
|
import {
|
|
12
19
|
__async,
|
|
13
20
|
__objRest,
|
|
14
21
|
__spreadProps,
|
|
15
22
|
__spreadValues,
|
|
16
|
-
get_class_name_factory_default,
|
|
17
23
|
init_react_import
|
|
18
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
19
25
|
|
|
20
26
|
// lib/migrate.ts
|
|
21
27
|
init_react_import();
|
|
@@ -182,21 +188,29 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
|
182
188
|
// lib/resolve-all-data.ts
|
|
183
189
|
init_react_import();
|
|
184
190
|
|
|
185
|
-
// lib/
|
|
191
|
+
// lib/group-zones-by-component.ts
|
|
186
192
|
init_react_import();
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
var groupZonesByComponent = (data) => {
|
|
194
|
+
var _a;
|
|
195
|
+
const zoneEntries = Object.entries((_a = data.zones) != null ? _a : {});
|
|
196
|
+
return zoneEntries.reduce((acc, [zoneCompound, zoneContent]) => {
|
|
197
|
+
const [componentId, zoneName] = getZoneId(zoneCompound);
|
|
198
|
+
if (!componentId.length || !zoneName.length) return acc;
|
|
199
|
+
if (!acc[componentId]) {
|
|
200
|
+
acc[componentId] = [];
|
|
201
|
+
}
|
|
202
|
+
acc[componentId].push({ zoneCompound, content: zoneContent });
|
|
203
|
+
return acc;
|
|
204
|
+
}, {});
|
|
192
205
|
};
|
|
193
206
|
|
|
194
207
|
// lib/resolve-all-data.ts
|
|
195
208
|
function resolveAllData(_0, _1) {
|
|
196
209
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
197
|
-
var _a;
|
|
198
210
|
const defaultedData = defaultData(data);
|
|
199
|
-
const
|
|
211
|
+
const zonesByComponent = groupZonesByComponent(defaultedData);
|
|
212
|
+
let resolvedZones = {};
|
|
213
|
+
const resolveNode = (_node, parent) => __async(null, null, function* () {
|
|
200
214
|
const node = toComponent(_node);
|
|
201
215
|
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
202
216
|
const resolved = (yield resolveComponentData(
|
|
@@ -207,76 +221,47 @@ function resolveAllData(_0, _1) {
|
|
|
207
221
|
},
|
|
208
222
|
() => {
|
|
209
223
|
},
|
|
210
|
-
"force"
|
|
224
|
+
"force",
|
|
225
|
+
parent
|
|
211
226
|
)).node;
|
|
212
|
-
const
|
|
227
|
+
const resolvedAsComponent = toComponent(resolved);
|
|
228
|
+
const resolvedDeepPromise = mapFields(
|
|
213
229
|
resolved,
|
|
214
|
-
{
|
|
230
|
+
{
|
|
231
|
+
slot: ({ value }) => processContent(value, resolvedAsComponent)
|
|
232
|
+
},
|
|
215
233
|
config
|
|
216
234
|
);
|
|
235
|
+
let resolveZonePromises = [];
|
|
236
|
+
if (zonesByComponent[resolvedAsComponent.props.id]) {
|
|
237
|
+
resolveZonePromises = zonesByComponent[resolvedAsComponent.props.id].map(
|
|
238
|
+
(_02) => __async(null, [_02], function* ({ zoneCompound, content }) {
|
|
239
|
+
resolvedZones[zoneCompound] = yield processContent(
|
|
240
|
+
content,
|
|
241
|
+
resolvedAsComponent
|
|
242
|
+
);
|
|
243
|
+
})
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
const resolvedDeep = yield resolvedDeepPromise;
|
|
247
|
+
yield Promise.all(resolveZonePromises);
|
|
217
248
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
218
249
|
return resolvedDeep;
|
|
219
250
|
});
|
|
220
|
-
const processContent = (content) => __async(null, null, function* () {
|
|
221
|
-
return Promise.all(content.map(resolveNode));
|
|
222
|
-
});
|
|
223
|
-
const processZones = () => __async(null, null, function* () {
|
|
224
|
-
var _a2;
|
|
225
|
-
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
226
|
-
Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
|
|
227
|
-
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
228
|
-
}));
|
|
229
|
-
return zones;
|
|
251
|
+
const processContent = (content, parent) => __async(null, null, function* () {
|
|
252
|
+
return Promise.all(content.map((item) => resolveNode(item, parent)));
|
|
230
253
|
});
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}), {});
|
|
240
|
-
return dynamic;
|
|
254
|
+
const result = defaultData({});
|
|
255
|
+
result.root = yield resolveNode(defaultedData.root, null);
|
|
256
|
+
result.content = yield processContent(
|
|
257
|
+
defaultedData.content,
|
|
258
|
+
toComponent(result.root)
|
|
259
|
+
);
|
|
260
|
+
result.zones = resolvedZones;
|
|
261
|
+
return result;
|
|
241
262
|
});
|
|
242
263
|
}
|
|
243
264
|
|
|
244
|
-
// lib/field-transforms/use-field-transforms.tsx
|
|
245
|
-
init_react_import();
|
|
246
|
-
import { useMemo } from "react";
|
|
247
|
-
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
248
|
-
const mappers = useMemo(() => {
|
|
249
|
-
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
250
|
-
const fieldType = _fieldType;
|
|
251
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
252
|
-
[fieldType]: (_a) => {
|
|
253
|
-
var _b = _a, {
|
|
254
|
-
parentId
|
|
255
|
-
} = _b, params = __objRest(_b, [
|
|
256
|
-
"parentId"
|
|
257
|
-
]);
|
|
258
|
-
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
259
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
|
|
260
|
-
const fn = transforms[fieldType];
|
|
261
|
-
return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
|
|
262
|
-
isReadOnly,
|
|
263
|
-
componentId: parentId
|
|
264
|
-
}));
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}, {});
|
|
268
|
-
}, [transforms, readOnly, forceReadOnly]);
|
|
269
|
-
const transformedProps = useMemo(() => {
|
|
270
|
-
const mapped = mapFields(item, mappers, config).props;
|
|
271
|
-
return mapped;
|
|
272
|
-
}, [config, item, mappers]);
|
|
273
|
-
const mergedProps = useMemo(
|
|
274
|
-
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
275
|
-
[item.props, transformedProps]
|
|
276
|
-
);
|
|
277
|
-
return mergedProps;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
265
|
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
281
266
|
init_react_import();
|
|
282
267
|
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
@@ -295,6 +280,52 @@ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
|
295
280
|
|
|
296
281
|
// lib/use-slots.tsx
|
|
297
282
|
init_react_import();
|
|
283
|
+
|
|
284
|
+
// lib/field-transforms/use-field-transforms.tsx
|
|
285
|
+
init_react_import();
|
|
286
|
+
import { useMemo } from "react";
|
|
287
|
+
|
|
288
|
+
// lib/field-transforms/build-mappers.ts
|
|
289
|
+
init_react_import();
|
|
290
|
+
function buildMappers(transforms, readOnly, forceReadOnly) {
|
|
291
|
+
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
292
|
+
const fieldType = _fieldType;
|
|
293
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
294
|
+
[fieldType]: (_a) => {
|
|
295
|
+
var _b = _a, {
|
|
296
|
+
parentId
|
|
297
|
+
} = _b, params = __objRest(_b, [
|
|
298
|
+
"parentId"
|
|
299
|
+
]);
|
|
300
|
+
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
301
|
+
const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
|
|
302
|
+
const fn = transforms[fieldType];
|
|
303
|
+
return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
|
|
304
|
+
isReadOnly,
|
|
305
|
+
componentId: parentId
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}, {});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// lib/field-transforms/use-field-transforms.tsx
|
|
313
|
+
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
314
|
+
const mappers = useMemo(
|
|
315
|
+
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
316
|
+
[transforms, readOnly, forceReadOnly]
|
|
317
|
+
);
|
|
318
|
+
const transformedProps = useMemo(() => {
|
|
319
|
+
return mapFields(item, mappers, config).props;
|
|
320
|
+
}, [config, item, mappers]);
|
|
321
|
+
const mergedProps = useMemo(
|
|
322
|
+
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
323
|
+
[item.props, transformedProps]
|
|
324
|
+
);
|
|
325
|
+
return mergedProps;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// lib/use-slots.tsx
|
|
298
329
|
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
299
330
|
return useFieldTransforms(
|
|
300
331
|
config,
|
|
@@ -340,7 +371,7 @@ function useRichtextProps(fields, props) {
|
|
|
340
371
|
const richtextProps = useMemo2(() => {
|
|
341
372
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
342
373
|
const RichTextRender = lazy(
|
|
343
|
-
() => import("./Render-
|
|
374
|
+
() => import("./Render-FXZX6NFH.mjs").then((m) => ({
|
|
344
375
|
default: m.RichTextRender
|
|
345
376
|
}))
|
|
346
377
|
);
|
|
@@ -401,14 +432,13 @@ var SlotRender = forwardRef(
|
|
|
401
432
|
);
|
|
402
433
|
|
|
403
434
|
export {
|
|
404
|
-
|
|
435
|
+
buildMappers,
|
|
405
436
|
getSlotTransform,
|
|
406
437
|
useSlots,
|
|
407
438
|
RichTextRenderFallback,
|
|
408
439
|
useRichtextProps,
|
|
409
440
|
SlotRenderPure,
|
|
410
441
|
SlotRender,
|
|
411
|
-
toComponent,
|
|
412
442
|
migrate,
|
|
413
443
|
transformProps,
|
|
414
444
|
resolveAllData
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__async,
|
|
3
2
|
__spreadProps,
|
|
4
3
|
__spreadValues,
|
|
5
4
|
init_react_import
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
7
6
|
|
|
8
7
|
// lib/data/walk-tree.ts
|
|
9
8
|
init_react_import();
|
|
@@ -144,12 +143,12 @@ var walkObject = ({
|
|
|
144
143
|
}
|
|
145
144
|
return flatten(newProps);
|
|
146
145
|
};
|
|
147
|
-
function mapFields(item, mappers, config, recurseSlots = false) {
|
|
146
|
+
function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
|
|
148
147
|
var _a, _b, _c, _d, _e;
|
|
149
148
|
const itemType = "type" in item ? item.type : "root";
|
|
150
149
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
|
151
150
|
const newProps = walkObject({
|
|
152
|
-
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
|
151
|
+
value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
|
|
153
152
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
|
154
153
|
mappers,
|
|
155
154
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
|
@@ -223,9 +222,28 @@ var stripSlots = (data, config) => {
|
|
|
223
222
|
|
|
224
223
|
// lib/data/flatten-node.ts
|
|
225
224
|
var { flatten: flatten2, unflatten } = flat;
|
|
225
|
+
function isEmptyArrayOrObject(val) {
|
|
226
|
+
if (Array.isArray(val)) {
|
|
227
|
+
return val.length === 0;
|
|
228
|
+
}
|
|
229
|
+
if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
|
|
230
|
+
return Object.keys(val).length === 0;
|
|
231
|
+
}
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
function stripEmptyObjects(props) {
|
|
235
|
+
const result = {};
|
|
236
|
+
for (const key in props) {
|
|
237
|
+
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
238
|
+
const val = props[key];
|
|
239
|
+
if (isEmptyArrayOrObject(val)) continue;
|
|
240
|
+
result[key] = val;
|
|
241
|
+
}
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
226
244
|
var flattenNode = (node, config) => {
|
|
227
245
|
return __spreadProps(__spreadValues({}, node), {
|
|
228
|
-
props: flatten2(stripSlots(node, config).props)
|
|
246
|
+
props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
|
|
229
247
|
});
|
|
230
248
|
};
|
|
231
249
|
var expandNode = (node) => {
|
|
@@ -403,135 +421,16 @@ var setupZone = (data, zoneKey) => {
|
|
|
403
421
|
return newData;
|
|
404
422
|
};
|
|
405
423
|
|
|
406
|
-
// components/ViewportControls/default-viewports.ts
|
|
407
|
-
init_react_import();
|
|
408
|
-
var defaultViewports = [
|
|
409
|
-
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
410
|
-
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
411
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
412
|
-
];
|
|
413
|
-
|
|
414
|
-
// lib/resolve-component-data.ts
|
|
415
|
-
init_react_import();
|
|
416
|
-
|
|
417
|
-
// lib/get-changed.ts
|
|
418
|
-
init_react_import();
|
|
419
|
-
import { deepEqual } from "fast-equals";
|
|
420
|
-
var getChanged = (newItem, oldItem) => {
|
|
421
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
422
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
|
423
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
|
424
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
425
|
-
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
|
426
|
-
});
|
|
427
|
-
}, {}) : {};
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
// lib/resolve-component-data.ts
|
|
431
|
-
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
432
|
-
var cache = { lastChange: {} };
|
|
433
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
434
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
435
|
-
const resolvedItem = __spreadValues({}, item);
|
|
436
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
437
|
-
const id = "id" in item.props ? item.props.id : "root";
|
|
438
|
-
if (shouldRunResolver) {
|
|
439
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
|
440
|
-
if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
|
|
441
|
-
return { node: resolved, didChange: false };
|
|
442
|
-
}
|
|
443
|
-
const changed = getChanged(item, oldItem);
|
|
444
|
-
if (onResolveStart) {
|
|
445
|
-
onResolveStart(item);
|
|
446
|
-
}
|
|
447
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
|
448
|
-
changed,
|
|
449
|
-
lastData: oldItem,
|
|
450
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
451
|
-
trigger
|
|
452
|
-
});
|
|
453
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
454
|
-
if (Object.keys(readOnly).length) {
|
|
455
|
-
resolvedItem.readOnly = readOnly;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
let itemWithResolvedChildren = yield mapFields(
|
|
459
|
-
resolvedItem,
|
|
460
|
-
{
|
|
461
|
-
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
462
|
-
const content = value;
|
|
463
|
-
return yield Promise.all(
|
|
464
|
-
content.map(
|
|
465
|
-
(childItem) => __async(null, null, function* () {
|
|
466
|
-
return (yield resolveComponentData(
|
|
467
|
-
childItem,
|
|
468
|
-
config,
|
|
469
|
-
metadata,
|
|
470
|
-
onResolveStart,
|
|
471
|
-
onResolveEnd,
|
|
472
|
-
trigger
|
|
473
|
-
)).node;
|
|
474
|
-
})
|
|
475
|
-
)
|
|
476
|
-
);
|
|
477
|
-
})
|
|
478
|
-
},
|
|
479
|
-
config
|
|
480
|
-
);
|
|
481
|
-
if (shouldRunResolver && onResolveEnd) {
|
|
482
|
-
onResolveEnd(resolvedItem);
|
|
483
|
-
}
|
|
484
|
-
cache.lastChange[id] = {
|
|
485
|
-
item,
|
|
486
|
-
resolved: itemWithResolvedChildren
|
|
487
|
-
};
|
|
488
|
-
return {
|
|
489
|
-
node: itemWithResolvedChildren,
|
|
490
|
-
didChange: !deepEqual2(item, itemWithResolvedChildren)
|
|
491
|
-
};
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
// store/default-app-state.ts
|
|
495
|
-
init_react_import();
|
|
496
|
-
var defaultAppState = {
|
|
497
|
-
data: { content: [], root: {}, zones: {} },
|
|
498
|
-
ui: {
|
|
499
|
-
leftSideBarVisible: true,
|
|
500
|
-
rightSideBarVisible: true,
|
|
501
|
-
arrayState: {},
|
|
502
|
-
itemSelector: null,
|
|
503
|
-
componentList: {},
|
|
504
|
-
isDragging: false,
|
|
505
|
-
previewMode: "edit",
|
|
506
|
-
viewports: {
|
|
507
|
-
current: {
|
|
508
|
-
width: defaultViewports[0].width,
|
|
509
|
-
height: defaultViewports[0].height || "auto"
|
|
510
|
-
},
|
|
511
|
-
options: [],
|
|
512
|
-
controlsVisible: true
|
|
513
|
-
},
|
|
514
|
-
field: { focus: null }
|
|
515
|
-
},
|
|
516
|
-
indexes: {
|
|
517
|
-
nodes: {},
|
|
518
|
-
zones: {}
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
|
|
522
424
|
export {
|
|
523
425
|
rootAreaId,
|
|
524
426
|
rootZone,
|
|
525
427
|
rootDroppableId,
|
|
428
|
+
getZoneId,
|
|
526
429
|
defaultSlots,
|
|
527
430
|
walkField,
|
|
528
431
|
mapFields,
|
|
529
432
|
expandNode,
|
|
530
433
|
walkAppState,
|
|
531
434
|
walkTree,
|
|
532
|
-
setupZone
|
|
533
|
-
defaultViewports,
|
|
534
|
-
getChanged,
|
|
535
|
-
resolveComponentData,
|
|
536
|
-
defaultAppState
|
|
435
|
+
setupZone
|
|
537
436
|
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mapFields
|
|
3
|
+
} from "./chunk-Q3TJ2VYO.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__async,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues,
|
|
8
|
+
init_react_import
|
|
9
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
10
|
+
|
|
11
|
+
// components/ViewportControls/default-viewports.ts
|
|
12
|
+
init_react_import();
|
|
13
|
+
var defaultViewports = [
|
|
14
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
15
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
16
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
17
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// lib/data/to-component.ts
|
|
21
|
+
init_react_import();
|
|
22
|
+
var toComponent = (item) => {
|
|
23
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
24
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
25
|
+
type: "root"
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// lib/resolve-component-data.ts
|
|
30
|
+
init_react_import();
|
|
31
|
+
|
|
32
|
+
// lib/get-changed.ts
|
|
33
|
+
init_react_import();
|
|
34
|
+
import { deepEqual } from "fast-equals";
|
|
35
|
+
var getChanged = (newItem, oldItem) => {
|
|
36
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
37
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
|
38
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
|
39
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
40
|
+
[item]: !deepEqual(oldItemProps[item], newItemProps[item])
|
|
41
|
+
});
|
|
42
|
+
}, {}) : {};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// lib/resolve-component-data.ts
|
|
46
|
+
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
47
|
+
var cache = { lastChange: {} };
|
|
48
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
|
|
49
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
50
|
+
const resolvedItem = __spreadValues({}, item);
|
|
51
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
52
|
+
const id = "id" in item.props ? item.props.id : "root";
|
|
53
|
+
if (shouldRunResolver) {
|
|
54
|
+
const {
|
|
55
|
+
item: oldItem = null,
|
|
56
|
+
resolved = {},
|
|
57
|
+
parentId: oldParentId = null
|
|
58
|
+
} = cache.lastChange[id] || {};
|
|
59
|
+
const isRootOrInserted = oldParentId === null;
|
|
60
|
+
const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
|
|
61
|
+
const dataChanged = item && !deepEqual2(item, oldItem);
|
|
62
|
+
const shouldSkip = trigger === "move" && !parentChanged || trigger !== "move" && trigger !== "force" && !dataChanged;
|
|
63
|
+
if (shouldSkip) {
|
|
64
|
+
return { node: resolved, didChange: false };
|
|
65
|
+
}
|
|
66
|
+
const changed = getChanged(item, oldItem);
|
|
67
|
+
if (onResolveStart) {
|
|
68
|
+
onResolveStart(item);
|
|
69
|
+
}
|
|
70
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
|
71
|
+
changed,
|
|
72
|
+
lastData: oldItem,
|
|
73
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
74
|
+
trigger,
|
|
75
|
+
parent
|
|
76
|
+
});
|
|
77
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
78
|
+
if (Object.keys(readOnly).length) {
|
|
79
|
+
resolvedItem.readOnly = readOnly;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const itemAsComponentData = toComponent(resolvedItem);
|
|
83
|
+
let itemWithResolvedChildren = yield mapFields(
|
|
84
|
+
resolvedItem,
|
|
85
|
+
{
|
|
86
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
87
|
+
const content = value;
|
|
88
|
+
return yield Promise.all(
|
|
89
|
+
content.map(
|
|
90
|
+
(childItem) => __async(null, null, function* () {
|
|
91
|
+
return (yield resolveComponentData(
|
|
92
|
+
childItem,
|
|
93
|
+
config,
|
|
94
|
+
metadata,
|
|
95
|
+
onResolveStart,
|
|
96
|
+
onResolveEnd,
|
|
97
|
+
trigger,
|
|
98
|
+
itemAsComponentData
|
|
99
|
+
)).node;
|
|
100
|
+
})
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
config
|
|
106
|
+
);
|
|
107
|
+
if (shouldRunResolver && onResolveEnd) {
|
|
108
|
+
onResolveEnd(resolvedItem);
|
|
109
|
+
}
|
|
110
|
+
cache.lastChange[id] = {
|
|
111
|
+
item,
|
|
112
|
+
resolved: itemWithResolvedChildren,
|
|
113
|
+
parentId: parent == null ? void 0 : parent.props.id
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
node: itemWithResolvedChildren,
|
|
117
|
+
didChange: !deepEqual2(item, itemWithResolvedChildren)
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// store/default-app-state.ts
|
|
122
|
+
init_react_import();
|
|
123
|
+
var defaultAppState = {
|
|
124
|
+
data: { content: [], root: {}, zones: {} },
|
|
125
|
+
ui: {
|
|
126
|
+
leftSideBarVisible: true,
|
|
127
|
+
rightSideBarVisible: true,
|
|
128
|
+
arrayState: {},
|
|
129
|
+
itemSelector: null,
|
|
130
|
+
componentList: {},
|
|
131
|
+
isDragging: false,
|
|
132
|
+
previewMode: "edit",
|
|
133
|
+
viewports: {
|
|
134
|
+
current: {
|
|
135
|
+
width: defaultViewports[0].width,
|
|
136
|
+
height: defaultViewports[0].height || "auto"
|
|
137
|
+
},
|
|
138
|
+
options: [],
|
|
139
|
+
controlsVisible: true
|
|
140
|
+
},
|
|
141
|
+
field: { focus: null },
|
|
142
|
+
plugin: { current: null }
|
|
143
|
+
},
|
|
144
|
+
indexes: {
|
|
145
|
+
nodes: {},
|
|
146
|
+
zones: {}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
defaultViewports,
|
|
152
|
+
getChanged,
|
|
153
|
+
toComponent,
|
|
154
|
+
resolveComponentData,
|
|
155
|
+
defaultAppState
|
|
156
|
+
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
styles_module_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AOEDIUVK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
LoadedRichTextMenuInner
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6KNQXLQR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useAppStore,
|
|
9
9
|
useAppStoreApi
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-K562SEXI.mjs";
|
|
11
|
+
import {
|
|
12
|
+
get_class_name_factory_default
|
|
13
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
11
14
|
import {
|
|
12
15
|
__spreadValues,
|
|
13
|
-
get_class_name_factory_default,
|
|
14
16
|
init_react_import
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
16
18
|
|
|
17
19
|
// components/RichTextEditor/components/EditorInner.tsx
|
|
18
20
|
init_react_import();
|
|
@@ -95,7 +97,7 @@ init_react_import();
|
|
|
95
97
|
import { lazy, Suspense } from "react";
|
|
96
98
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
97
99
|
var LoadedRichTextMenuFull = lazy(
|
|
98
|
-
() => import("./full-
|
|
100
|
+
() => import("./full-4OS3O57Y.mjs").then((m) => ({
|
|
99
101
|
default: m.LoadedRichTextMenuFull
|
|
100
102
|
}))
|
|
101
103
|
);
|