@measured/puck 0.21.0-canary.ace4c8b3 → 0.21.0-canary.b353d921
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-F2LSS6SE.css +403 -0
- package/dist/Editor-N46HUQEC.mjs +201 -0
- package/dist/Render-QEMDIDQC.css +101 -0
- package/dist/Render-Y567PGZ7.mjs +53 -0
- package/dist/chunk-3QHWXJEI.mjs +33 -0
- package/dist/chunk-7KY6RHEY.mjs +2230 -0
- package/dist/chunk-C2TVYIYC.mjs +415 -0
- package/dist/chunk-DCSQEDMK.mjs +194 -0
- package/dist/{chunk-TC25DCTQ.mjs → chunk-DJSH5REF.mjs} +70 -498
- package/dist/chunk-DNF2EMM4.mjs +63 -0
- package/dist/chunk-FNWOH4R6.mjs +109 -0
- package/dist/chunk-GQKMOYLG.mjs +53 -0
- package/dist/chunk-K3V4LVUL.mjs +704 -0
- package/dist/chunk-R6CVX2IY.mjs +103 -0
- package/dist/{chunk-AIFI2M23.mjs → chunk-TB3SSIAY.mjs} +1041 -2778
- package/dist/chunk-WUWXFMEM.mjs +11 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-NLUNPJWS.mjs +90 -0
- package/dist/index.css +278 -22
- package/dist/index.d.mts +100 -7
- package/dist/index.d.ts +100 -7
- package/dist/index.js +5811 -2550
- package/dist/index.mjs +25 -9
- package/dist/loaded-EV34KGYJ.mjs +57 -0
- package/dist/loaded-HMSPJUZM.mjs +54 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/loaded-ZXOU6S6R.mjs +54 -0
- package/dist/no-external.css +278 -22
- package/dist/no-external.d.mts +17 -2
- package/dist/no-external.d.ts +17 -2
- package/dist/no-external.js +5811 -2550
- package/dist/no-external.mjs +25 -9
- package/dist/rsc.css +101 -0
- package/dist/rsc.d.mts +17 -2
- package/dist/rsc.d.ts +17 -2
- package/dist/rsc.js +409 -22
- package/dist/rsc.mjs +16 -9
- package/dist/{walk-tree-CkSoNBF7.d.mts → walk-tree-Ja9bNCM9.d.mts} +208 -7
- package/dist/{walk-tree-CkSoNBF7.d.ts → walk-tree-Ja9bNCM9.d.ts} +208 -7
- package/package.json +23 -1
|
@@ -1,88 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
|
-
var __esm = (fn, res) => function __init() {
|
|
37
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
38
|
-
};
|
|
39
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
40
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
41
|
-
};
|
|
42
|
-
var __copyProps = (to, from, except, desc) => {
|
|
43
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
44
|
-
for (let key of __getOwnPropNames(from))
|
|
45
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
46
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
47
|
-
}
|
|
48
|
-
return to;
|
|
49
|
-
};
|
|
50
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
51
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
52
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
53
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
54
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
55
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
56
|
-
mod
|
|
57
|
-
));
|
|
58
|
-
var __async = (__this, __arguments, generator) => {
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
var fulfilled = (value) => {
|
|
61
|
-
try {
|
|
62
|
-
step(generator.next(value));
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var rejected = (value) => {
|
|
68
|
-
try {
|
|
69
|
-
step(generator.throw(value));
|
|
70
|
-
} catch (e) {
|
|
71
|
-
reject(e);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// ../tsup-config/react-import.js
|
|
80
|
-
import React from "react";
|
|
81
|
-
var init_react_import = __esm({
|
|
82
|
-
"../tsup-config/react-import.js"() {
|
|
83
|
-
"use strict";
|
|
84
|
-
}
|
|
85
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
__async,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues,
|
|
5
|
+
init_react_import
|
|
6
|
+
} from "./chunk-DCSQEDMK.mjs";
|
|
86
7
|
|
|
87
8
|
// lib/data/walk-tree.ts
|
|
88
9
|
init_react_import();
|
|
@@ -284,45 +205,34 @@ function walkTree(data, config, callbackFn) {
|
|
|
284
205
|
};
|
|
285
206
|
}
|
|
286
207
|
|
|
287
|
-
// lib/
|
|
208
|
+
// lib/root-droppable-id.ts
|
|
288
209
|
init_react_import();
|
|
210
|
+
var rootAreaId = "root";
|
|
211
|
+
var rootZone = "default-zone";
|
|
212
|
+
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
|
289
213
|
|
|
290
|
-
//
|
|
214
|
+
// lib/data/flatten-node.ts
|
|
291
215
|
init_react_import();
|
|
216
|
+
import flat from "flat";
|
|
292
217
|
|
|
293
|
-
//
|
|
218
|
+
// lib/data/strip-slots.ts
|
|
294
219
|
init_react_import();
|
|
295
|
-
var
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
299
|
-
];
|
|
220
|
+
var stripSlots = (data, config) => {
|
|
221
|
+
return mapFields(data, { slot: () => null }, config);
|
|
222
|
+
};
|
|
300
223
|
|
|
301
|
-
//
|
|
302
|
-
var
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
current: {
|
|
314
|
-
width: defaultViewports[0].width,
|
|
315
|
-
height: defaultViewports[0].height || "auto"
|
|
316
|
-
},
|
|
317
|
-
options: [],
|
|
318
|
-
controlsVisible: true
|
|
319
|
-
},
|
|
320
|
-
field: { focus: null }
|
|
321
|
-
},
|
|
322
|
-
indexes: {
|
|
323
|
-
nodes: {},
|
|
324
|
-
zones: {}
|
|
325
|
-
}
|
|
224
|
+
// lib/data/flatten-node.ts
|
|
225
|
+
var { flatten: flatten2, unflatten } = flat;
|
|
226
|
+
var flattenNode = (node, config) => {
|
|
227
|
+
return __spreadProps(__spreadValues({}, node), {
|
|
228
|
+
props: flatten2(stripSlots(node, config).props)
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
var expandNode = (node) => {
|
|
232
|
+
const props = unflatten(node.props);
|
|
233
|
+
return __spreadProps(__spreadValues({}, node), {
|
|
234
|
+
props
|
|
235
|
+
});
|
|
326
236
|
};
|
|
327
237
|
|
|
328
238
|
// lib/data/walk-app-state.ts
|
|
@@ -333,14 +243,6 @@ init_react_import();
|
|
|
333
243
|
|
|
334
244
|
// lib/get-zone-id.ts
|
|
335
245
|
init_react_import();
|
|
336
|
-
|
|
337
|
-
// lib/root-droppable-id.ts
|
|
338
|
-
init_react_import();
|
|
339
|
-
var rootAreaId = "root";
|
|
340
|
-
var rootZone = "default-zone";
|
|
341
|
-
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
|
342
|
-
|
|
343
|
-
// lib/get-zone-id.ts
|
|
344
246
|
var getZoneId = (zoneCompound) => {
|
|
345
247
|
if (!zoneCompound) {
|
|
346
248
|
return [];
|
|
@@ -361,30 +263,6 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
|
361
263
|
});
|
|
362
264
|
}
|
|
363
265
|
|
|
364
|
-
// lib/data/flatten-node.ts
|
|
365
|
-
init_react_import();
|
|
366
|
-
import flat from "flat";
|
|
367
|
-
|
|
368
|
-
// lib/data/strip-slots.ts
|
|
369
|
-
init_react_import();
|
|
370
|
-
var stripSlots = (data, config) => {
|
|
371
|
-
return mapFields(data, { slot: () => null }, config);
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
// lib/data/flatten-node.ts
|
|
375
|
-
var { flatten: flatten2, unflatten } = flat;
|
|
376
|
-
var flattenNode = (node, config) => {
|
|
377
|
-
return __spreadProps(__spreadValues({}, node), {
|
|
378
|
-
props: flatten2(stripSlots(node, config).props)
|
|
379
|
-
});
|
|
380
|
-
};
|
|
381
|
-
var expandNode = (node) => {
|
|
382
|
-
const props = unflatten(node.props);
|
|
383
|
-
return __spreadProps(__spreadValues({}, node), {
|
|
384
|
-
props
|
|
385
|
-
});
|
|
386
|
-
};
|
|
387
|
-
|
|
388
266
|
// lib/data/walk-app-state.ts
|
|
389
267
|
function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
|
390
268
|
var _a;
|
|
@@ -512,169 +390,26 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
|
512
390
|
});
|
|
513
391
|
}
|
|
514
392
|
|
|
515
|
-
// lib/
|
|
516
|
-
var migrations = [
|
|
517
|
-
// Migrate root to root.props
|
|
518
|
-
(data) => {
|
|
519
|
-
const rootProps = data.root.props || data.root;
|
|
520
|
-
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
|
521
|
-
console.warn(
|
|
522
|
-
"Migration applied: Root props moved from `root` to `root.props`."
|
|
523
|
-
);
|
|
524
|
-
return __spreadProps(__spreadValues({}, data), {
|
|
525
|
-
root: {
|
|
526
|
-
props: __spreadValues({}, rootProps)
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
return data;
|
|
531
|
-
},
|
|
532
|
-
// Migrate zones to slots
|
|
533
|
-
(data, config, migrationOptions) => {
|
|
534
|
-
var _a, _b;
|
|
535
|
-
if (!config) return data;
|
|
536
|
-
console.log("Migrating DropZones to slots...");
|
|
537
|
-
const updatedItems = {};
|
|
538
|
-
const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
|
|
539
|
-
const { indexes } = walkAppState(appState, config);
|
|
540
|
-
const deletedCompounds = [];
|
|
541
|
-
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
|
542
|
-
var _a2, _b2, _c;
|
|
543
|
-
if (zoneType === "dropzone") {
|
|
544
|
-
const [id, slotName] = zoneCompound.split(":");
|
|
545
|
-
const nodeData = indexes.nodes[id].data;
|
|
546
|
-
const componentType = nodeData.type;
|
|
547
|
-
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
|
548
|
-
if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
|
|
549
|
-
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
|
550
|
-
props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
|
|
551
|
-
[slotName]: content
|
|
552
|
-
})
|
|
553
|
-
});
|
|
554
|
-
deletedCompounds.push(zoneCompound);
|
|
555
|
-
}
|
|
556
|
-
return content;
|
|
557
|
-
}
|
|
558
|
-
return content;
|
|
559
|
-
});
|
|
560
|
-
const updated = walkAppState(
|
|
561
|
-
appState,
|
|
562
|
-
config,
|
|
563
|
-
(content) => content,
|
|
564
|
-
(item) => {
|
|
565
|
-
var _a2;
|
|
566
|
-
return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
|
|
567
|
-
}
|
|
568
|
-
);
|
|
569
|
-
deletedCompounds.forEach((zoneCompound) => {
|
|
570
|
-
var _a2;
|
|
571
|
-
const [_, propName] = zoneCompound.split(":");
|
|
572
|
-
console.log(
|
|
573
|
-
`\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
|
|
574
|
-
);
|
|
575
|
-
(_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
|
|
576
|
-
});
|
|
577
|
-
if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
|
|
578
|
-
const unmigratedZonesGrouped = {};
|
|
579
|
-
Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
|
|
580
|
-
var _a2;
|
|
581
|
-
const [componentId, propName] = zoneCompound.split(":");
|
|
582
|
-
const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
|
|
583
|
-
if (!content) {
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
if (!unmigratedZonesGrouped[componentId]) {
|
|
587
|
-
unmigratedZonesGrouped[componentId] = {};
|
|
588
|
-
}
|
|
589
|
-
if (!unmigratedZonesGrouped[componentId][propName]) {
|
|
590
|
-
unmigratedZonesGrouped[componentId][propName] = content;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
|
|
594
|
-
updated.data = walkTree(updated.data, config, (content) => {
|
|
595
|
-
return content.map((child) => {
|
|
596
|
-
var _a2;
|
|
597
|
-
if (child.props.id !== componentId) {
|
|
598
|
-
return child;
|
|
599
|
-
}
|
|
600
|
-
const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
|
|
601
|
-
if (!migrateFn) {
|
|
602
|
-
return child;
|
|
603
|
-
}
|
|
604
|
-
const zones = unmigratedZonesGrouped[componentId];
|
|
605
|
-
const migratedProps = migrateFn(child.props, zones);
|
|
606
|
-
Object.keys(zones).forEach((propName) => {
|
|
607
|
-
var _a3;
|
|
608
|
-
const zoneCompound = `${componentId}:${propName}`;
|
|
609
|
-
console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
|
|
610
|
-
(_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
|
|
611
|
-
});
|
|
612
|
-
return __spreadProps(__spreadValues({}, child), {
|
|
613
|
-
props: migratedProps
|
|
614
|
-
});
|
|
615
|
-
});
|
|
616
|
-
});
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
|
|
620
|
-
const [_, propName] = zoneCompound.split(":");
|
|
621
|
-
throw new Error(
|
|
622
|
-
`Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
|
|
623
|
-
);
|
|
624
|
-
});
|
|
625
|
-
delete updated.data.zones;
|
|
626
|
-
return updated.data;
|
|
627
|
-
}
|
|
628
|
-
];
|
|
629
|
-
function migrate(data, config, migrationOptions) {
|
|
630
|
-
return migrations == null ? void 0 : migrations.reduce(
|
|
631
|
-
(acc, migration) => migration(acc, config, migrationOptions),
|
|
632
|
-
data
|
|
633
|
-
);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// lib/transform-props.ts
|
|
637
|
-
init_react_import();
|
|
638
|
-
|
|
639
|
-
// lib/data/default-data.ts
|
|
393
|
+
// lib/data/setup-zone.ts
|
|
640
394
|
init_react_import();
|
|
641
|
-
var
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
// lib/transform-props.ts
|
|
647
|
-
function transformProps(data, propTransforms, config = { components: {} }) {
|
|
648
|
-
const mapItem = (item) => {
|
|
649
|
-
if (propTransforms[item.type]) {
|
|
650
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
651
|
-
props: __spreadValues({
|
|
652
|
-
id: item.props.id
|
|
653
|
-
}, propTransforms[item.type](item.props))
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
return item;
|
|
657
|
-
};
|
|
658
|
-
const defaultedData = defaultData(data);
|
|
659
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
|
660
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
|
661
|
-
if (propTransforms["root"]) {
|
|
662
|
-
newRoot.props = propTransforms["root"](rootProps);
|
|
663
|
-
}
|
|
664
|
-
const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
|
|
665
|
-
const updatedData = walkTree(
|
|
666
|
-
dataWithUpdatedRoot,
|
|
667
|
-
config,
|
|
668
|
-
(content) => content.map(mapItem)
|
|
669
|
-
);
|
|
670
|
-
if (!defaultedData.root.props) {
|
|
671
|
-
updatedData.root = updatedData.root.props;
|
|
395
|
+
var setupZone = (data, zoneKey) => {
|
|
396
|
+
if (zoneKey === rootDroppableId) {
|
|
397
|
+
return data;
|
|
672
398
|
}
|
|
673
|
-
|
|
674
|
-
}
|
|
399
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
|
400
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
|
401
|
+
});
|
|
402
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
|
403
|
+
return newData;
|
|
404
|
+
};
|
|
675
405
|
|
|
676
|
-
//
|
|
406
|
+
// components/ViewportControls/default-viewports.ts
|
|
677
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
|
+
];
|
|
678
413
|
|
|
679
414
|
// lib/resolve-component-data.ts
|
|
680
415
|
init_react_import();
|
|
@@ -756,195 +491,41 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
756
491
|
};
|
|
757
492
|
});
|
|
758
493
|
|
|
759
|
-
//
|
|
760
|
-
init_react_import();
|
|
761
|
-
var toComponent = (item) => {
|
|
762
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
763
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
764
|
-
type: "root"
|
|
765
|
-
});
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
// lib/resolve-all-data.ts
|
|
769
|
-
function resolveAllData(_0, _1) {
|
|
770
|
-
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
771
|
-
var _a;
|
|
772
|
-
const defaultedData = defaultData(data);
|
|
773
|
-
const resolveNode = (_node) => __async(null, null, function* () {
|
|
774
|
-
const node = toComponent(_node);
|
|
775
|
-
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
776
|
-
const resolved = (yield resolveComponentData(
|
|
777
|
-
node,
|
|
778
|
-
config,
|
|
779
|
-
metadata,
|
|
780
|
-
() => {
|
|
781
|
-
},
|
|
782
|
-
() => {
|
|
783
|
-
},
|
|
784
|
-
"force"
|
|
785
|
-
)).node;
|
|
786
|
-
const resolvedDeep = yield mapFields(
|
|
787
|
-
resolved,
|
|
788
|
-
{ slot: ({ value }) => processContent(value) },
|
|
789
|
-
config
|
|
790
|
-
);
|
|
791
|
-
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
792
|
-
return resolvedDeep;
|
|
793
|
-
});
|
|
794
|
-
const processContent = (content) => __async(null, null, function* () {
|
|
795
|
-
return Promise.all(content.map(resolveNode));
|
|
796
|
-
});
|
|
797
|
-
const processZones = () => __async(null, null, function* () {
|
|
798
|
-
var _a2;
|
|
799
|
-
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
800
|
-
Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
|
|
801
|
-
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
802
|
-
}));
|
|
803
|
-
return zones;
|
|
804
|
-
});
|
|
805
|
-
const dynamic = {
|
|
806
|
-
root: yield resolveNode(defaultedData.root),
|
|
807
|
-
content: yield processContent(defaultedData.content),
|
|
808
|
-
zones: yield processZones()
|
|
809
|
-
};
|
|
810
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
|
|
811
|
-
const content = defaultedData.zones[zoneKey];
|
|
812
|
-
dynamic.zones[zoneKey] = yield processContent(content);
|
|
813
|
-
}), {});
|
|
814
|
-
return dynamic;
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
// lib/data/setup-zone.ts
|
|
819
|
-
init_react_import();
|
|
820
|
-
var setupZone = (data, zoneKey) => {
|
|
821
|
-
if (zoneKey === rootDroppableId) {
|
|
822
|
-
return data;
|
|
823
|
-
}
|
|
824
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
|
825
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
|
826
|
-
});
|
|
827
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
|
828
|
-
return newData;
|
|
829
|
-
};
|
|
830
|
-
|
|
831
|
-
// lib/field-transforms/use-field-transforms.tsx
|
|
832
|
-
init_react_import();
|
|
833
|
-
import { useMemo } from "react";
|
|
834
|
-
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
835
|
-
const mappers = useMemo(() => {
|
|
836
|
-
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
837
|
-
const fieldType = _fieldType;
|
|
838
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
839
|
-
[fieldType]: (_a) => {
|
|
840
|
-
var _b = _a, {
|
|
841
|
-
parentId
|
|
842
|
-
} = _b, params = __objRest(_b, [
|
|
843
|
-
"parentId"
|
|
844
|
-
]);
|
|
845
|
-
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
846
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
|
|
847
|
-
const fn = transforms[fieldType];
|
|
848
|
-
return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
|
|
849
|
-
isReadOnly,
|
|
850
|
-
componentId: parentId
|
|
851
|
-
}));
|
|
852
|
-
}
|
|
853
|
-
});
|
|
854
|
-
}, {});
|
|
855
|
-
}, [transforms, readOnly, forceReadOnly]);
|
|
856
|
-
const transformedProps = useMemo(() => {
|
|
857
|
-
const mapped = mapFields(item, mappers, config).props;
|
|
858
|
-
return mapped;
|
|
859
|
-
}, [config, item, mappers]);
|
|
860
|
-
const mergedProps = useMemo(
|
|
861
|
-
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
862
|
-
[item.props, transformedProps]
|
|
863
|
-
);
|
|
864
|
-
return mergedProps;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
494
|
+
// store/default-app-state.ts
|
|
868
495
|
init_react_import();
|
|
869
|
-
var
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
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: {}
|
|
880
519
|
}
|
|
881
|
-
});
|
|
882
|
-
|
|
883
|
-
// lib/use-slots.tsx
|
|
884
|
-
init_react_import();
|
|
885
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
886
|
-
return useFieldTransforms(
|
|
887
|
-
config,
|
|
888
|
-
item,
|
|
889
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
890
|
-
readOnly,
|
|
891
|
-
forceReadOnly
|
|
892
|
-
);
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
// components/SlotRender/server.tsx
|
|
896
|
-
init_react_import();
|
|
897
|
-
import { forwardRef } from "react";
|
|
898
|
-
import { jsx } from "react/jsx-runtime";
|
|
899
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ jsx(SlotRender, __spreadValues({}, props));
|
|
900
|
-
var Item = ({
|
|
901
|
-
config,
|
|
902
|
-
item,
|
|
903
|
-
metadata
|
|
904
|
-
}) => {
|
|
905
|
-
const Component = config.components[item.type];
|
|
906
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
907
|
-
return /* @__PURE__ */ jsx(
|
|
908
|
-
Component.render,
|
|
909
|
-
__spreadProps(__spreadValues({}, props), {
|
|
910
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
911
|
-
metadata: metadata || {}
|
|
912
|
-
})
|
|
913
|
-
})
|
|
914
|
-
);
|
|
915
520
|
};
|
|
916
|
-
var SlotRender = forwardRef(
|
|
917
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
918
|
-
return /* @__PURE__ */ jsx("div", { className, style, ref, children: content.map((item) => {
|
|
919
|
-
if (!config.components[item.type]) {
|
|
920
|
-
return null;
|
|
921
|
-
}
|
|
922
|
-
return /* @__PURE__ */ jsx(
|
|
923
|
-
Item,
|
|
924
|
-
{
|
|
925
|
-
config,
|
|
926
|
-
item,
|
|
927
|
-
metadata
|
|
928
|
-
},
|
|
929
|
-
item.props.id
|
|
930
|
-
);
|
|
931
|
-
}) });
|
|
932
|
-
}
|
|
933
|
-
);
|
|
934
521
|
|
|
935
522
|
export {
|
|
936
|
-
__spreadValues,
|
|
937
|
-
__spreadProps,
|
|
938
|
-
__objRest,
|
|
939
|
-
__commonJS,
|
|
940
|
-
__toESM,
|
|
941
|
-
__async,
|
|
942
|
-
init_react_import,
|
|
943
523
|
rootAreaId,
|
|
944
524
|
rootZone,
|
|
945
525
|
rootDroppableId,
|
|
946
526
|
defaultSlots,
|
|
947
527
|
walkField,
|
|
528
|
+
mapFields,
|
|
948
529
|
expandNode,
|
|
949
530
|
walkAppState,
|
|
950
531
|
walkTree,
|
|
@@ -952,14 +533,5 @@ export {
|
|
|
952
533
|
defaultViewports,
|
|
953
534
|
getChanged,
|
|
954
535
|
resolveComponentData,
|
|
955
|
-
defaultAppState
|
|
956
|
-
useFieldTransforms,
|
|
957
|
-
getSlotTransform,
|
|
958
|
-
useSlots,
|
|
959
|
-
SlotRenderPure,
|
|
960
|
-
SlotRender,
|
|
961
|
-
toComponent,
|
|
962
|
-
migrate,
|
|
963
|
-
transformProps,
|
|
964
|
-
resolveAllData
|
|
536
|
+
defaultAppState
|
|
965
537
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Heading1,
|
|
3
|
+
Heading2,
|
|
4
|
+
Heading3,
|
|
5
|
+
Heading4,
|
|
6
|
+
Heading5,
|
|
7
|
+
Heading6
|
|
8
|
+
} from "./chunk-7KY6RHEY.mjs";
|
|
9
|
+
import {
|
|
10
|
+
init_react_import
|
|
11
|
+
} from "./chunk-DCSQEDMK.mjs";
|
|
12
|
+
|
|
13
|
+
// components/RichTextMenu/controls/HeadingSelect/use-options.ts
|
|
14
|
+
init_react_import();
|
|
15
|
+
import { useMemo } from "react";
|
|
16
|
+
var optionNodes = {
|
|
17
|
+
h1: { label: "Heading 1", icon: Heading1 },
|
|
18
|
+
h2: { label: "Heading 2", icon: Heading2 },
|
|
19
|
+
h3: { label: "Heading 3", icon: Heading3 },
|
|
20
|
+
h4: { label: "Heading 4", icon: Heading4 },
|
|
21
|
+
h5: { label: "Heading 5", icon: Heading5 },
|
|
22
|
+
h6: { label: "Heading 6", icon: Heading6 }
|
|
23
|
+
};
|
|
24
|
+
var useHeadingOptions = (fieldOptions) => {
|
|
25
|
+
var _a;
|
|
26
|
+
let blockOptions = [];
|
|
27
|
+
if ((fieldOptions == null ? void 0 : fieldOptions.heading) !== false) {
|
|
28
|
+
if (!((_a = fieldOptions == null ? void 0 : fieldOptions.heading) == null ? void 0 : _a.levels)) {
|
|
29
|
+
blockOptions = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
30
|
+
} else {
|
|
31
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(1)) {
|
|
32
|
+
blockOptions.push("h1");
|
|
33
|
+
}
|
|
34
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(2)) {
|
|
35
|
+
blockOptions.push("h2");
|
|
36
|
+
}
|
|
37
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(3)) {
|
|
38
|
+
blockOptions.push("h3");
|
|
39
|
+
}
|
|
40
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(4)) {
|
|
41
|
+
blockOptions.push("h4");
|
|
42
|
+
}
|
|
43
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(5)) {
|
|
44
|
+
blockOptions.push("h5");
|
|
45
|
+
}
|
|
46
|
+
if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(6)) {
|
|
47
|
+
blockOptions.push("h6");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return useMemo(
|
|
52
|
+
() => blockOptions.map((item) => ({
|
|
53
|
+
value: item,
|
|
54
|
+
label: optionNodes[item].label,
|
|
55
|
+
icon: optionNodes[item].icon
|
|
56
|
+
})),
|
|
57
|
+
[blockOptions]
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
useHeadingOptions
|
|
63
|
+
};
|