@measured/puck 0.19.1-canary.c0055df8 → 0.19.1
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/{chunk-H4SMAS54.mjs → chunk-IM42S4YL.mjs} +253 -249
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +947 -925
- package/dist/index.mjs +21 -3
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +5 -4
- package/dist/rsc.mjs +1 -5
- package/dist/{walk-tree-DBd3aQ_5.d.mts → walk-tree-DrJNb8b-.d.mts} +2 -1
- package/dist/{walk-tree-DBd3aQ_5.d.ts → walk-tree-DrJNb8b-.d.ts} +2 -1
- package/package.json +1 -1
@@ -84,9 +84,35 @@ var init_react_import = __esm({
|
|
84
84
|
}
|
85
85
|
});
|
86
86
|
|
87
|
-
//
|
87
|
+
// rsc.tsx
|
88
|
+
init_react_import();
|
89
|
+
|
90
|
+
// components/ServerRender/index.tsx
|
88
91
|
init_react_import();
|
89
92
|
|
93
|
+
// lib/root-droppable-id.ts
|
94
|
+
init_react_import();
|
95
|
+
var rootAreaId = "root";
|
96
|
+
var rootZone = "default-zone";
|
97
|
+
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
98
|
+
|
99
|
+
// lib/data/setup-zone.ts
|
100
|
+
init_react_import();
|
101
|
+
var setupZone = (data, zoneKey) => {
|
102
|
+
if (zoneKey === rootDroppableId) {
|
103
|
+
return data;
|
104
|
+
}
|
105
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
106
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
107
|
+
});
|
108
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
109
|
+
return newData;
|
110
|
+
};
|
111
|
+
|
112
|
+
// lib/use-slots.tsx
|
113
|
+
init_react_import();
|
114
|
+
import { useMemo } from "react";
|
115
|
+
|
90
116
|
// lib/data/map-slots.ts
|
91
117
|
init_react_import();
|
92
118
|
|
@@ -230,66 +256,7 @@ function mapSlots(item, map, config, recurseSlots = false) {
|
|
230
256
|
});
|
231
257
|
}
|
232
258
|
|
233
|
-
// lib/data/walk-tree.ts
|
234
|
-
function walkTree(data, config, callbackFn) {
|
235
|
-
var _a, _b;
|
236
|
-
const walkItem = (item) => {
|
237
|
-
return mapSlots(
|
238
|
-
item,
|
239
|
-
(content, parentId, propName) => {
|
240
|
-
var _a2;
|
241
|
-
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
242
|
-
},
|
243
|
-
config,
|
244
|
-
true
|
245
|
-
);
|
246
|
-
};
|
247
|
-
if ("props" in data) {
|
248
|
-
return walkItem(data);
|
249
|
-
}
|
250
|
-
const _data = data;
|
251
|
-
const zones = (_a = _data.zones) != null ? _a : {};
|
252
|
-
const mappedContent = _data.content.map(walkItem);
|
253
|
-
return {
|
254
|
-
root: walkItem(_data.root),
|
255
|
-
content: (_b = callbackFn(mappedContent, {
|
256
|
-
parentId: "root",
|
257
|
-
propName: "default-zone"
|
258
|
-
})) != null ? _b : mappedContent,
|
259
|
-
zones: Object.keys(zones).reduce(
|
260
|
-
(acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
|
261
|
-
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
262
|
-
}),
|
263
|
-
{}
|
264
|
-
)
|
265
|
-
};
|
266
|
-
}
|
267
|
-
|
268
|
-
// components/ServerRender/index.tsx
|
269
|
-
init_react_import();
|
270
|
-
|
271
|
-
// lib/root-droppable-id.ts
|
272
|
-
init_react_import();
|
273
|
-
var rootAreaId = "root";
|
274
|
-
var rootZone = "default-zone";
|
275
|
-
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
276
|
-
|
277
|
-
// lib/data/setup-zone.ts
|
278
|
-
init_react_import();
|
279
|
-
var setupZone = (data, zoneKey) => {
|
280
|
-
if (zoneKey === rootDroppableId) {
|
281
|
-
return data;
|
282
|
-
}
|
283
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
284
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
285
|
-
});
|
286
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
287
|
-
return newData;
|
288
|
-
};
|
289
|
-
|
290
259
|
// lib/use-slots.tsx
|
291
|
-
init_react_import();
|
292
|
-
import { useMemo } from "react";
|
293
260
|
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
294
261
|
const slotProps = useMemo(() => {
|
295
262
|
const mapped = mapSlots(
|
@@ -454,6 +421,221 @@ function Render({
|
|
454
421
|
);
|
455
422
|
}
|
456
423
|
|
424
|
+
// lib/resolve-all-data.ts
|
425
|
+
init_react_import();
|
426
|
+
|
427
|
+
// lib/resolve-component-data.ts
|
428
|
+
init_react_import();
|
429
|
+
|
430
|
+
// lib/get-changed.ts
|
431
|
+
init_react_import();
|
432
|
+
import fdeq from "fast-deep-equal";
|
433
|
+
var getChanged = (newItem, oldItem) => {
|
434
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
435
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
436
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
437
|
+
return __spreadProps(__spreadValues({}, acc), {
|
438
|
+
[item]: !fdeq(oldItemProps[item], newItemProps[item])
|
439
|
+
});
|
440
|
+
}, {}) : {};
|
441
|
+
};
|
442
|
+
|
443
|
+
// lib/resolve-component-data.ts
|
444
|
+
import fdeq2 from "fast-deep-equal";
|
445
|
+
var cache = { lastChange: {} };
|
446
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
447
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
448
|
+
const resolvedItem = __spreadValues({}, item);
|
449
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
450
|
+
const id = "id" in item.props ? item.props.id : "root";
|
451
|
+
if (shouldRunResolver) {
|
452
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
453
|
+
if (item && fdeq2(item, oldItem)) {
|
454
|
+
return { node: resolved, didChange: false };
|
455
|
+
}
|
456
|
+
const changed = getChanged(item, oldItem);
|
457
|
+
if (onResolveStart) {
|
458
|
+
onResolveStart(item);
|
459
|
+
}
|
460
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
461
|
+
changed,
|
462
|
+
lastData: oldItem,
|
463
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
464
|
+
trigger
|
465
|
+
});
|
466
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
467
|
+
if (Object.keys(readOnly).length) {
|
468
|
+
resolvedItem.readOnly = readOnly;
|
469
|
+
}
|
470
|
+
}
|
471
|
+
let itemWithResolvedChildren = yield mapSlots(
|
472
|
+
resolvedItem,
|
473
|
+
(content) => __async(void 0, null, function* () {
|
474
|
+
return yield Promise.all(
|
475
|
+
content.map(
|
476
|
+
(childItem) => __async(void 0, null, function* () {
|
477
|
+
return (yield resolveComponentData(
|
478
|
+
childItem,
|
479
|
+
config,
|
480
|
+
metadata,
|
481
|
+
onResolveStart,
|
482
|
+
onResolveEnd,
|
483
|
+
trigger
|
484
|
+
)).node;
|
485
|
+
})
|
486
|
+
)
|
487
|
+
);
|
488
|
+
}),
|
489
|
+
config
|
490
|
+
);
|
491
|
+
if (shouldRunResolver && onResolveEnd) {
|
492
|
+
onResolveEnd(resolvedItem);
|
493
|
+
}
|
494
|
+
cache.lastChange[id] = {
|
495
|
+
item,
|
496
|
+
resolved: itemWithResolvedChildren
|
497
|
+
};
|
498
|
+
return {
|
499
|
+
node: itemWithResolvedChildren,
|
500
|
+
didChange: !fdeq2(item, itemWithResolvedChildren)
|
501
|
+
};
|
502
|
+
});
|
503
|
+
|
504
|
+
// lib/data/default-data.ts
|
505
|
+
init_react_import();
|
506
|
+
var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
507
|
+
root: data.root || {},
|
508
|
+
content: data.content || []
|
509
|
+
});
|
510
|
+
|
511
|
+
// lib/data/to-component.ts
|
512
|
+
init_react_import();
|
513
|
+
var toComponent = (item) => {
|
514
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
515
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
516
|
+
type: "root"
|
517
|
+
});
|
518
|
+
};
|
519
|
+
|
520
|
+
// lib/resolve-all-data.ts
|
521
|
+
function resolveAllData(_0, _1) {
|
522
|
+
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
523
|
+
var _a;
|
524
|
+
const defaultedData = defaultData(data);
|
525
|
+
const resolveNode = (_node) => __async(this, null, function* () {
|
526
|
+
const node = toComponent(_node);
|
527
|
+
onResolveStart == null ? void 0 : onResolveStart(node);
|
528
|
+
const resolved = (yield resolveComponentData(
|
529
|
+
node,
|
530
|
+
config,
|
531
|
+
metadata,
|
532
|
+
() => {
|
533
|
+
},
|
534
|
+
() => {
|
535
|
+
},
|
536
|
+
"force"
|
537
|
+
)).node;
|
538
|
+
const resolvedDeep = yield mapSlots(
|
539
|
+
resolved,
|
540
|
+
processContent,
|
541
|
+
config
|
542
|
+
);
|
543
|
+
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
544
|
+
return resolvedDeep;
|
545
|
+
});
|
546
|
+
const processContent = (content) => __async(this, null, function* () {
|
547
|
+
return Promise.all(content.map(resolveNode));
|
548
|
+
});
|
549
|
+
const processZones = () => __async(this, null, function* () {
|
550
|
+
var _a2;
|
551
|
+
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
552
|
+
Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
|
553
|
+
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
554
|
+
}));
|
555
|
+
return zones;
|
556
|
+
});
|
557
|
+
const dynamic = {
|
558
|
+
root: yield resolveNode(defaultedData.root),
|
559
|
+
content: yield processContent(defaultedData.content),
|
560
|
+
zones: yield processZones()
|
561
|
+
};
|
562
|
+
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
|
563
|
+
const content = defaultedData.zones[zoneKey];
|
564
|
+
dynamic.zones[zoneKey] = yield processContent(content);
|
565
|
+
}), {});
|
566
|
+
return dynamic;
|
567
|
+
});
|
568
|
+
}
|
569
|
+
|
570
|
+
// lib/transform-props.ts
|
571
|
+
init_react_import();
|
572
|
+
|
573
|
+
// lib/data/walk-tree.ts
|
574
|
+
init_react_import();
|
575
|
+
function walkTree(data, config, callbackFn) {
|
576
|
+
var _a, _b;
|
577
|
+
const walkItem = (item) => {
|
578
|
+
return mapSlots(
|
579
|
+
item,
|
580
|
+
(content, parentId, propName) => {
|
581
|
+
var _a2;
|
582
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
583
|
+
},
|
584
|
+
config,
|
585
|
+
true
|
586
|
+
);
|
587
|
+
};
|
588
|
+
if ("props" in data) {
|
589
|
+
return walkItem(data);
|
590
|
+
}
|
591
|
+
const _data = data;
|
592
|
+
const zones = (_a = _data.zones) != null ? _a : {};
|
593
|
+
const mappedContent = _data.content.map(walkItem);
|
594
|
+
return {
|
595
|
+
root: walkItem(_data.root),
|
596
|
+
content: (_b = callbackFn(mappedContent, {
|
597
|
+
parentId: "root",
|
598
|
+
propName: "default-zone"
|
599
|
+
})) != null ? _b : mappedContent,
|
600
|
+
zones: Object.keys(zones).reduce(
|
601
|
+
(acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
|
602
|
+
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
603
|
+
}),
|
604
|
+
{}
|
605
|
+
)
|
606
|
+
};
|
607
|
+
}
|
608
|
+
|
609
|
+
// lib/transform-props.ts
|
610
|
+
function transformProps(data, propTransforms, config = { components: {} }) {
|
611
|
+
const mapItem = (item) => {
|
612
|
+
if (propTransforms[item.type]) {
|
613
|
+
return __spreadProps(__spreadValues({}, item), {
|
614
|
+
props: __spreadValues({
|
615
|
+
id: item.props.id
|
616
|
+
}, propTransforms[item.type](item.props))
|
617
|
+
});
|
618
|
+
}
|
619
|
+
return item;
|
620
|
+
};
|
621
|
+
const defaultedData = defaultData(data);
|
622
|
+
const rootProps = defaultedData.root.props || defaultedData.root;
|
623
|
+
let newRoot = __spreadValues({}, defaultedData.root);
|
624
|
+
if (propTransforms["root"]) {
|
625
|
+
newRoot.props = propTransforms["root"](rootProps);
|
626
|
+
}
|
627
|
+
const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
|
628
|
+
const updatedData = walkTree(
|
629
|
+
dataWithUpdatedRoot,
|
630
|
+
config,
|
631
|
+
(content) => content.map(mapItem)
|
632
|
+
);
|
633
|
+
if (!defaultedData.root.props) {
|
634
|
+
updatedData.root = updatedData.root.props;
|
635
|
+
}
|
636
|
+
return updatedData;
|
637
|
+
}
|
638
|
+
|
457
639
|
// lib/migrate.ts
|
458
640
|
init_react_import();
|
459
641
|
|
@@ -525,7 +707,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
525
707
|
|
526
708
|
// lib/data/flatten-node.ts
|
527
709
|
init_react_import();
|
528
|
-
import
|
710
|
+
import flat from "flat";
|
529
711
|
|
530
712
|
// lib/data/strip-slots.ts
|
531
713
|
init_react_import();
|
@@ -534,6 +716,7 @@ var stripSlots = (data, config) => {
|
|
534
716
|
};
|
535
717
|
|
536
718
|
// lib/data/flatten-node.ts
|
719
|
+
var { flatten: flatten2, unflatten } = flat;
|
537
720
|
var flattenNode = (node, config) => {
|
538
721
|
return __spreadProps(__spreadValues({}, node), {
|
539
722
|
props: flatten2(stripSlots(node, config).props)
|
@@ -697,7 +880,7 @@ var migrations = [
|
|
697
880
|
const { indexes } = walkAppState(appState, config);
|
698
881
|
const deletedCompounds = [];
|
699
882
|
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
700
|
-
var _a2, _b;
|
883
|
+
var _a2, _b, _c;
|
701
884
|
if (zoneType === "dropzone") {
|
702
885
|
const [id, slotName] = zoneCompound.split(":");
|
703
886
|
const nodeData = indexes.nodes[id].data;
|
@@ -705,7 +888,7 @@ var migrations = [
|
|
705
888
|
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
706
889
|
if (((_b = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b.type) === "slot") {
|
707
890
|
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
708
|
-
props: __spreadProps(__spreadValues({}, nodeData.props), {
|
891
|
+
props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
|
709
892
|
[slotName]: content
|
710
893
|
})
|
711
894
|
});
|
@@ -749,185 +932,6 @@ function migrate(data, config) {
|
|
749
932
|
);
|
750
933
|
}
|
751
934
|
|
752
|
-
// lib/transform-props.ts
|
753
|
-
init_react_import();
|
754
|
-
|
755
|
-
// lib/data/default-data.ts
|
756
|
-
init_react_import();
|
757
|
-
var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
758
|
-
root: data.root || {},
|
759
|
-
content: data.content || []
|
760
|
-
});
|
761
|
-
|
762
|
-
// lib/transform-props.ts
|
763
|
-
function transformProps(data, propTransforms, config = { components: {} }) {
|
764
|
-
const mapItem = (item) => {
|
765
|
-
if (propTransforms[item.type]) {
|
766
|
-
return __spreadProps(__spreadValues({}, item), {
|
767
|
-
props: __spreadValues({
|
768
|
-
id: item.props.id
|
769
|
-
}, propTransforms[item.type](item.props))
|
770
|
-
});
|
771
|
-
}
|
772
|
-
return item;
|
773
|
-
};
|
774
|
-
const defaultedData = defaultData(data);
|
775
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
776
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
777
|
-
if (propTransforms["root"]) {
|
778
|
-
newRoot.props = propTransforms["root"](rootProps);
|
779
|
-
}
|
780
|
-
const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
|
781
|
-
const updatedData = walkTree(
|
782
|
-
dataWithUpdatedRoot,
|
783
|
-
config,
|
784
|
-
(content) => content.map(mapItem)
|
785
|
-
);
|
786
|
-
if (!defaultedData.root.props) {
|
787
|
-
updatedData.root = updatedData.root.props;
|
788
|
-
}
|
789
|
-
return updatedData;
|
790
|
-
}
|
791
|
-
|
792
|
-
// lib/resolve-all-data.ts
|
793
|
-
init_react_import();
|
794
|
-
|
795
|
-
// lib/resolve-component-data.ts
|
796
|
-
init_react_import();
|
797
|
-
|
798
|
-
// lib/get-changed.ts
|
799
|
-
init_react_import();
|
800
|
-
import fdeq from "fast-deep-equal";
|
801
|
-
var getChanged = (newItem, oldItem) => {
|
802
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
803
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
804
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
805
|
-
return __spreadProps(__spreadValues({}, acc), {
|
806
|
-
[item]: !fdeq(oldItemProps[item], newItemProps[item])
|
807
|
-
});
|
808
|
-
}, {}) : {};
|
809
|
-
};
|
810
|
-
|
811
|
-
// lib/resolve-component-data.ts
|
812
|
-
import fdeq2 from "fast-deep-equal";
|
813
|
-
var cache = { lastChange: {} };
|
814
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
815
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
816
|
-
const resolvedItem = __spreadValues({}, item);
|
817
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
818
|
-
const id = "id" in item.props ? item.props.id : "root";
|
819
|
-
if (shouldRunResolver) {
|
820
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
821
|
-
if (item && fdeq2(item, oldItem)) {
|
822
|
-
return { node: resolved, didChange: false };
|
823
|
-
}
|
824
|
-
const changed = getChanged(item, oldItem);
|
825
|
-
if (onResolveStart) {
|
826
|
-
onResolveStart(item);
|
827
|
-
}
|
828
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
829
|
-
changed,
|
830
|
-
lastData: oldItem,
|
831
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
832
|
-
trigger
|
833
|
-
});
|
834
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
835
|
-
if (Object.keys(readOnly).length) {
|
836
|
-
resolvedItem.readOnly = readOnly;
|
837
|
-
}
|
838
|
-
}
|
839
|
-
let itemWithResolvedChildren = yield mapSlots(
|
840
|
-
resolvedItem,
|
841
|
-
(content) => __async(void 0, null, function* () {
|
842
|
-
return yield Promise.all(
|
843
|
-
content.map(
|
844
|
-
(childItem) => __async(void 0, null, function* () {
|
845
|
-
return (yield resolveComponentData(
|
846
|
-
childItem,
|
847
|
-
config,
|
848
|
-
metadata,
|
849
|
-
onResolveStart,
|
850
|
-
onResolveEnd,
|
851
|
-
trigger
|
852
|
-
)).node;
|
853
|
-
})
|
854
|
-
)
|
855
|
-
);
|
856
|
-
}),
|
857
|
-
config
|
858
|
-
);
|
859
|
-
if (shouldRunResolver && onResolveEnd) {
|
860
|
-
onResolveEnd(resolvedItem);
|
861
|
-
}
|
862
|
-
cache.lastChange[id] = {
|
863
|
-
item,
|
864
|
-
resolved: itemWithResolvedChildren
|
865
|
-
};
|
866
|
-
return {
|
867
|
-
node: itemWithResolvedChildren,
|
868
|
-
didChange: !fdeq2(item, itemWithResolvedChildren)
|
869
|
-
};
|
870
|
-
});
|
871
|
-
|
872
|
-
// lib/data/to-component.ts
|
873
|
-
init_react_import();
|
874
|
-
var toComponent = (item) => {
|
875
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
876
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
877
|
-
type: "root"
|
878
|
-
});
|
879
|
-
};
|
880
|
-
|
881
|
-
// lib/resolve-all-data.ts
|
882
|
-
function resolveAllData(_0, _1) {
|
883
|
-
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
884
|
-
var _a;
|
885
|
-
const defaultedData = defaultData(data);
|
886
|
-
const resolveNode = (_node) => __async(this, null, function* () {
|
887
|
-
const node = toComponent(_node);
|
888
|
-
onResolveStart == null ? void 0 : onResolveStart(node);
|
889
|
-
const resolved = (yield resolveComponentData(
|
890
|
-
node,
|
891
|
-
config,
|
892
|
-
metadata,
|
893
|
-
() => {
|
894
|
-
},
|
895
|
-
() => {
|
896
|
-
},
|
897
|
-
"force"
|
898
|
-
)).node;
|
899
|
-
const resolvedDeep = yield mapSlots(
|
900
|
-
resolved,
|
901
|
-
processContent,
|
902
|
-
config
|
903
|
-
);
|
904
|
-
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
905
|
-
return resolvedDeep;
|
906
|
-
});
|
907
|
-
const processContent = (content) => __async(this, null, function* () {
|
908
|
-
return Promise.all(content.map(resolveNode));
|
909
|
-
});
|
910
|
-
const processZones = () => __async(this, null, function* () {
|
911
|
-
var _a2;
|
912
|
-
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
913
|
-
Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
|
914
|
-
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
915
|
-
}));
|
916
|
-
return zones;
|
917
|
-
});
|
918
|
-
const dynamic = {
|
919
|
-
root: yield resolveNode(defaultedData.root),
|
920
|
-
content: yield processContent(defaultedData.content),
|
921
|
-
zones: yield processZones()
|
922
|
-
};
|
923
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
|
924
|
-
const content = defaultedData.zones[zoneKey];
|
925
|
-
dynamic.zones[zoneKey] = yield processContent(content);
|
926
|
-
}), {});
|
927
|
-
return dynamic;
|
928
|
-
});
|
929
|
-
}
|
930
|
-
|
931
935
|
export {
|
932
936
|
__spreadValues,
|
933
937
|
__spreadProps,
|
@@ -945,15 +949,15 @@ export {
|
|
945
949
|
walkAppState,
|
946
950
|
walkTree,
|
947
951
|
setupZone,
|
948
|
-
defaultViewports,
|
949
|
-
getChanged,
|
950
|
-
resolveComponentData,
|
951
|
-
defaultAppState,
|
952
952
|
useSlots,
|
953
|
-
Render,
|
954
953
|
SlotRenderPure,
|
955
954
|
SlotRender,
|
956
|
-
|
955
|
+
Render,
|
956
|
+
getChanged,
|
957
|
+
resolveComponentData,
|
958
|
+
resolveAllData,
|
957
959
|
transformProps,
|
958
|
-
|
960
|
+
defaultViewports,
|
961
|
+
defaultAppState,
|
962
|
+
migrate
|
959
963
|
};
|
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-
|
2
|
-
export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-
|
1
|
+
import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-DrJNb8b-.mjs';
|
2
|
+
export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DrJNb8b-.mjs';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-
|
2
|
-
export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-
|
1
|
+
import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-DrJNb8b-.js';
|
2
|
+
export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DrJNb8b-.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|