@measured/puck 0.20.0-canary.3badc0ce → 0.20.0-canary.5780043
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-32MJ3X3H.mjs → chunk-H6KSTNLT.mjs} +249 -246
- package/dist/index.css +1 -3
- package/dist/index.d.mts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +944 -953
- package/dist/index.mjs +8446 -25
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +1 -1
- package/dist/rsc.mjs +1 -5
- package/dist/{walk-tree-6p9XnDIV.d.mts → walk-tree-BDO40vbf.d.mts} +1 -1
- package/dist/{walk-tree-6p9XnDIV.d.ts → walk-tree-BDO40vbf.d.ts} +1 -1
- package/package.json +2 -3
- package/dist/chunk-H4AGHNLK.mjs +0 -8476
- package/dist/no-external.css +0 -1895
- package/dist/no-external.d.mts +0 -4
- package/dist/no-external.d.ts +0 -4
- package/dist/no-external.js +0 -9355
- package/dist/no-external.mjs +0 -52
|
@@ -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
|
|
|
@@ -792,185 +974,6 @@ function migrate(data, config, migrationOptions) {
|
|
|
792
974
|
);
|
|
793
975
|
}
|
|
794
976
|
|
|
795
|
-
// lib/transform-props.ts
|
|
796
|
-
init_react_import();
|
|
797
|
-
|
|
798
|
-
// lib/data/default-data.ts
|
|
799
|
-
init_react_import();
|
|
800
|
-
var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
|
801
|
-
root: data.root || {},
|
|
802
|
-
content: data.content || []
|
|
803
|
-
});
|
|
804
|
-
|
|
805
|
-
// lib/transform-props.ts
|
|
806
|
-
function transformProps(data, propTransforms, config = { components: {} }) {
|
|
807
|
-
const mapItem = (item) => {
|
|
808
|
-
if (propTransforms[item.type]) {
|
|
809
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
810
|
-
props: __spreadValues({
|
|
811
|
-
id: item.props.id
|
|
812
|
-
}, propTransforms[item.type](item.props))
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
return item;
|
|
816
|
-
};
|
|
817
|
-
const defaultedData = defaultData(data);
|
|
818
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
|
819
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
|
820
|
-
if (propTransforms["root"]) {
|
|
821
|
-
newRoot.props = propTransforms["root"](rootProps);
|
|
822
|
-
}
|
|
823
|
-
const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
|
|
824
|
-
const updatedData = walkTree(
|
|
825
|
-
dataWithUpdatedRoot,
|
|
826
|
-
config,
|
|
827
|
-
(content) => content.map(mapItem)
|
|
828
|
-
);
|
|
829
|
-
if (!defaultedData.root.props) {
|
|
830
|
-
updatedData.root = updatedData.root.props;
|
|
831
|
-
}
|
|
832
|
-
return updatedData;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
// lib/resolve-all-data.ts
|
|
836
|
-
init_react_import();
|
|
837
|
-
|
|
838
|
-
// lib/resolve-component-data.ts
|
|
839
|
-
init_react_import();
|
|
840
|
-
|
|
841
|
-
// lib/get-changed.ts
|
|
842
|
-
init_react_import();
|
|
843
|
-
import fdeq from "fast-deep-equal";
|
|
844
|
-
var getChanged = (newItem, oldItem) => {
|
|
845
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
846
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
|
847
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
|
848
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
849
|
-
[item]: !fdeq(oldItemProps[item], newItemProps[item])
|
|
850
|
-
});
|
|
851
|
-
}, {}) : {};
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
// lib/resolve-component-data.ts
|
|
855
|
-
import fdeq2 from "fast-deep-equal";
|
|
856
|
-
var cache = { lastChange: {} };
|
|
857
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
858
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
859
|
-
const resolvedItem = __spreadValues({}, item);
|
|
860
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
861
|
-
const id = "id" in item.props ? item.props.id : "root";
|
|
862
|
-
if (shouldRunResolver) {
|
|
863
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
|
864
|
-
if (item && fdeq2(item, oldItem)) {
|
|
865
|
-
return { node: resolved, didChange: false };
|
|
866
|
-
}
|
|
867
|
-
const changed = getChanged(item, oldItem);
|
|
868
|
-
if (onResolveStart) {
|
|
869
|
-
onResolveStart(item);
|
|
870
|
-
}
|
|
871
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
|
872
|
-
changed,
|
|
873
|
-
lastData: oldItem,
|
|
874
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
|
875
|
-
trigger
|
|
876
|
-
});
|
|
877
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
|
878
|
-
if (Object.keys(readOnly).length) {
|
|
879
|
-
resolvedItem.readOnly = readOnly;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
let itemWithResolvedChildren = yield mapSlots(
|
|
883
|
-
resolvedItem,
|
|
884
|
-
(content) => __async(void 0, null, function* () {
|
|
885
|
-
return yield Promise.all(
|
|
886
|
-
content.map(
|
|
887
|
-
(childItem) => __async(void 0, null, function* () {
|
|
888
|
-
return (yield resolveComponentData(
|
|
889
|
-
childItem,
|
|
890
|
-
config,
|
|
891
|
-
metadata,
|
|
892
|
-
onResolveStart,
|
|
893
|
-
onResolveEnd,
|
|
894
|
-
trigger
|
|
895
|
-
)).node;
|
|
896
|
-
})
|
|
897
|
-
)
|
|
898
|
-
);
|
|
899
|
-
}),
|
|
900
|
-
config
|
|
901
|
-
);
|
|
902
|
-
if (shouldRunResolver && onResolveEnd) {
|
|
903
|
-
onResolveEnd(resolvedItem);
|
|
904
|
-
}
|
|
905
|
-
cache.lastChange[id] = {
|
|
906
|
-
item,
|
|
907
|
-
resolved: itemWithResolvedChildren
|
|
908
|
-
};
|
|
909
|
-
return {
|
|
910
|
-
node: itemWithResolvedChildren,
|
|
911
|
-
didChange: !fdeq2(item, itemWithResolvedChildren)
|
|
912
|
-
};
|
|
913
|
-
});
|
|
914
|
-
|
|
915
|
-
// lib/data/to-component.ts
|
|
916
|
-
init_react_import();
|
|
917
|
-
var toComponent = (item) => {
|
|
918
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
919
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
920
|
-
type: "root"
|
|
921
|
-
});
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
// lib/resolve-all-data.ts
|
|
925
|
-
function resolveAllData(_0, _1) {
|
|
926
|
-
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
927
|
-
var _a;
|
|
928
|
-
const defaultedData = defaultData(data);
|
|
929
|
-
const resolveNode = (_node) => __async(this, null, function* () {
|
|
930
|
-
const node = toComponent(_node);
|
|
931
|
-
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
932
|
-
const resolved = (yield resolveComponentData(
|
|
933
|
-
node,
|
|
934
|
-
config,
|
|
935
|
-
metadata,
|
|
936
|
-
() => {
|
|
937
|
-
},
|
|
938
|
-
() => {
|
|
939
|
-
},
|
|
940
|
-
"force"
|
|
941
|
-
)).node;
|
|
942
|
-
const resolvedDeep = yield mapSlots(
|
|
943
|
-
resolved,
|
|
944
|
-
processContent,
|
|
945
|
-
config
|
|
946
|
-
);
|
|
947
|
-
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
948
|
-
return resolvedDeep;
|
|
949
|
-
});
|
|
950
|
-
const processContent = (content) => __async(this, null, function* () {
|
|
951
|
-
return Promise.all(content.map(resolveNode));
|
|
952
|
-
});
|
|
953
|
-
const processZones = () => __async(this, null, function* () {
|
|
954
|
-
var _a2;
|
|
955
|
-
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
956
|
-
Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
|
|
957
|
-
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
958
|
-
}));
|
|
959
|
-
return zones;
|
|
960
|
-
});
|
|
961
|
-
const dynamic = {
|
|
962
|
-
root: yield resolveNode(defaultedData.root),
|
|
963
|
-
content: yield processContent(defaultedData.content),
|
|
964
|
-
zones: yield processZones()
|
|
965
|
-
};
|
|
966
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
|
|
967
|
-
const content = defaultedData.zones[zoneKey];
|
|
968
|
-
dynamic.zones[zoneKey] = yield processContent(content);
|
|
969
|
-
}), {});
|
|
970
|
-
return dynamic;
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
|
|
974
977
|
export {
|
|
975
978
|
__spreadValues,
|
|
976
979
|
__spreadProps,
|
|
@@ -988,15 +991,15 @@ export {
|
|
|
988
991
|
walkAppState,
|
|
989
992
|
walkTree,
|
|
990
993
|
setupZone,
|
|
991
|
-
defaultViewports,
|
|
992
|
-
getChanged,
|
|
993
|
-
resolveComponentData,
|
|
994
|
-
defaultAppState,
|
|
995
994
|
useSlots,
|
|
996
|
-
Render,
|
|
997
995
|
SlotRenderPure,
|
|
998
996
|
SlotRender,
|
|
999
|
-
|
|
997
|
+
Render,
|
|
998
|
+
getChanged,
|
|
999
|
+
resolveComponentData,
|
|
1000
|
+
resolveAllData,
|
|
1000
1001
|
transformProps,
|
|
1001
|
-
|
|
1002
|
+
defaultViewports,
|
|
1003
|
+
defaultAppState,
|
|
1004
|
+
migrate
|
|
1002
1005
|
};
|
package/dist/index.css
CHANGED
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
/*
|
|
137
|
+
/* styles.css */
|
|
138
138
|
#frame-root {
|
|
139
139
|
height: 1px;
|
|
140
140
|
min-height: 100vh;
|
|
@@ -144,8 +144,6 @@
|
|
|
144
144
|
z-index: 0;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
/* bundle/index.css */
|
|
148
|
-
|
|
149
147
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css/#css-module-data */
|
|
150
148
|
._ActionBar_rvadt_1 {
|
|
151
149
|
align-items: center;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as History, P as Permissions,
|
|
2
|
-
export {
|
|
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-BDO40vbf.mjs';
|
|
2
|
+
export { $ as Adaptor, Z as ArrayField, t as ArrayState, ac as AsFieldProps, B as BaseData, L as BaseField, J as ComponentDataMap, E as ComponentDataOptionalId, K as Content, a3 as CustomField, a2 as CustomFieldRender, a9 as DefaultComponentProps, a6 as DefaultRootFieldProps, a8 as DefaultRootProps, a7 as DefaultRootRenderProps, m as Direction, n as DragAxis, a1 as ExternalField, a0 as ExternalFieldWithAdaptor, ae as ExtractPropsFromConfig, af as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, G as MappedItem, N as NumberField, _ as ObjectField, q as OverrideKey, v as PuckComponent, a5 as PuckContext, Y as RadioField, x as RootConfig, z as RootData, y as RootDataWithoutProps, X as SelectField, S as Slot, u as SlotComponent, a4 as SlotField, T as TextField, Q as TextareaField, o as Viewport, ad as WithChildren, aa as WithId, ab as WithPuckProps, W as WithSlotProps, ag as migrate, p as overrideKeys, ai as resolveAllData, ah as transformProps, w as walkTree } from './walk-tree-BDO40vbf.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';
|
|
@@ -249,9 +249,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
|
249
249
|
metadata?: Metadata;
|
|
250
250
|
}): react_jsx_runtime.JSX.Element;
|
|
251
251
|
|
|
252
|
-
type WithGet<T> = T & {
|
|
253
|
-
get: () => T;
|
|
254
|
-
};
|
|
255
252
|
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
256
253
|
appState: AppState;
|
|
257
254
|
config: UserConfig;
|
|
@@ -274,7 +271,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
274
271
|
};
|
|
275
272
|
};
|
|
276
273
|
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
|
277
|
-
type UsePuckStore<UserConfig extends Config = Config> =
|
|
274
|
+
type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
|
|
278
275
|
/**
|
|
279
276
|
* createUsePuck
|
|
280
277
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as History, P as Permissions,
|
|
2
|
-
export {
|
|
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-BDO40vbf.js';
|
|
2
|
+
export { $ as Adaptor, Z as ArrayField, t as ArrayState, ac as AsFieldProps, B as BaseData, L as BaseField, J as ComponentDataMap, E as ComponentDataOptionalId, K as Content, a3 as CustomField, a2 as CustomFieldRender, a9 as DefaultComponentProps, a6 as DefaultRootFieldProps, a8 as DefaultRootProps, a7 as DefaultRootRenderProps, m as Direction, n as DragAxis, a1 as ExternalField, a0 as ExternalFieldWithAdaptor, ae as ExtractPropsFromConfig, af as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, G as MappedItem, N as NumberField, _ as ObjectField, q as OverrideKey, v as PuckComponent, a5 as PuckContext, Y as RadioField, x as RootConfig, z as RootData, y as RootDataWithoutProps, X as SelectField, S as Slot, u as SlotComponent, a4 as SlotField, T as TextField, Q as TextareaField, o as Viewport, ad as WithChildren, aa as WithId, ab as WithPuckProps, W as WithSlotProps, ag as migrate, p as overrideKeys, ai as resolveAllData, ah as transformProps, w as walkTree } from './walk-tree-BDO40vbf.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';
|
|
@@ -249,9 +249,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
|
249
249
|
metadata?: Metadata;
|
|
250
250
|
}): react_jsx_runtime.JSX.Element;
|
|
251
251
|
|
|
252
|
-
type WithGet<T> = T & {
|
|
253
|
-
get: () => T;
|
|
254
|
-
};
|
|
255
252
|
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
256
253
|
appState: AppState;
|
|
257
254
|
config: UserConfig;
|
|
@@ -274,7 +271,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
274
271
|
};
|
|
275
272
|
};
|
|
276
273
|
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
|
277
|
-
type UsePuckStore<UserConfig extends Config = Config> =
|
|
274
|
+
type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
|
|
278
275
|
/**
|
|
279
276
|
* createUsePuck
|
|
280
277
|
*
|