@measured/puck 0.19.0-canary.8d459e4e → 0.19.0-canary.91cb9cee
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-D6ENWNOG.mjs → chunk-GL73J54P.mjs} +423 -87
- package/dist/index.css +143 -143
- package/dist/index.d.mts +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.js +1107 -1178
- package/dist/index.mjs +978 -1399
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +366 -18
- package/dist/rsc.mjs +7 -3
- package/dist/{resolve-all-data-DtB0OZRl.d.mts → walk-tree-DOB5QZVq.d.mts} +30 -7
- package/dist/{resolve-all-data-DtB0OZRl.d.ts → walk-tree-DOB5QZVq.d.ts} +30 -7
- package/package.json +3 -3
@@ -8,9 +8,6 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
8
|
var __getProtoOf = Object.getPrototypeOf;
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
10
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
-
var __typeError = (msg) => {
|
12
|
-
throw TypeError(msg);
|
13
|
-
};
|
14
11
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
15
12
|
var __spreadValues = (a, b) => {
|
16
13
|
for (var prop in b || (b = {}))
|
@@ -58,10 +55,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
58
55
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
59
56
|
mod
|
60
57
|
));
|
61
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
62
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
63
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
64
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
65
58
|
var __async = (__this, __arguments, generator) => {
|
66
59
|
return new Promise((resolve, reject) => {
|
67
60
|
var fulfilled = (value) => {
|
@@ -91,6 +84,94 @@ var init_react_import = __esm({
|
|
91
84
|
}
|
92
85
|
});
|
93
86
|
|
87
|
+
// lib/data/walk-tree.ts
|
88
|
+
init_react_import();
|
89
|
+
|
90
|
+
// lib/data/is-slot.ts
|
91
|
+
init_react_import();
|
92
|
+
var isSlot = (prop) => {
|
93
|
+
var _a, _b;
|
94
|
+
return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
|
95
|
+
};
|
96
|
+
var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
|
97
|
+
var _a, _b;
|
98
|
+
const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
|
99
|
+
if (!configForComponent) return isSlot(propValue);
|
100
|
+
return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
|
101
|
+
};
|
102
|
+
|
103
|
+
// lib/data/map-slots.ts
|
104
|
+
init_react_import();
|
105
|
+
function mapSlotsAsync(_0, _1) {
|
106
|
+
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
107
|
+
const props = __spreadValues({}, item.props);
|
108
|
+
const propKeys = Object.keys(props);
|
109
|
+
for (let i = 0; i < propKeys.length; i++) {
|
110
|
+
const propKey = propKeys[i];
|
111
|
+
const itemType = "type" in item ? item.type : "root";
|
112
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
113
|
+
const content = props[propKey];
|
114
|
+
const mappedContent = recursive ? yield Promise.all(
|
115
|
+
content.map((item2) => __async(this, null, function* () {
|
116
|
+
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
117
|
+
}))
|
118
|
+
) : content;
|
119
|
+
props[propKey] = yield map(mappedContent, propKey);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
123
|
+
});
|
124
|
+
}
|
125
|
+
function mapSlotsSync(item, map, isSlot2 = isSlot) {
|
126
|
+
var _a, _b;
|
127
|
+
const props = __spreadValues({}, item.props);
|
128
|
+
const propKeys = Object.keys(props);
|
129
|
+
for (let i = 0; i < propKeys.length; i++) {
|
130
|
+
const propKey = propKeys[i];
|
131
|
+
const itemType = "type" in item ? item.type : "root";
|
132
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
133
|
+
const content = props[propKey];
|
134
|
+
const mappedContent = content.map((item2) => {
|
135
|
+
return mapSlotsSync(item2, map, isSlot2);
|
136
|
+
});
|
137
|
+
props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
141
|
+
}
|
142
|
+
|
143
|
+
// lib/data/walk-tree.ts
|
144
|
+
function walkTree(data, config, callbackFn) {
|
145
|
+
var _a, _b;
|
146
|
+
const isSlot2 = createIsSlotConfig(config);
|
147
|
+
const walkItem = (item) => {
|
148
|
+
return mapSlotsSync(
|
149
|
+
item,
|
150
|
+
(content, parentId, propName) => callbackFn(content, { parentId, propName }),
|
151
|
+
isSlot2
|
152
|
+
);
|
153
|
+
};
|
154
|
+
if ("props" in data) {
|
155
|
+
return walkItem(data);
|
156
|
+
}
|
157
|
+
const _data = data;
|
158
|
+
const zones = (_a = _data.zones) != null ? _a : {};
|
159
|
+
const mappedContent = _data.content.map(walkItem);
|
160
|
+
return {
|
161
|
+
root: walkItem(_data.root),
|
162
|
+
content: (_b = callbackFn(mappedContent, {
|
163
|
+
parentId: "root",
|
164
|
+
propName: "default-zone"
|
165
|
+
})) != null ? _b : mappedContent,
|
166
|
+
zones: Object.keys(zones).reduce(
|
167
|
+
(acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
|
168
|
+
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
169
|
+
}),
|
170
|
+
{}
|
171
|
+
)
|
172
|
+
};
|
173
|
+
}
|
174
|
+
|
94
175
|
// components/ServerRender/index.tsx
|
95
176
|
init_react_import();
|
96
177
|
|
@@ -139,7 +220,11 @@ function useSlots(config, props, renderSlotEdit, renderSlotRender = renderSlotEd
|
|
139
220
|
}
|
140
221
|
return slotProps2;
|
141
222
|
}, [config, readOnly, forceReadOnly]);
|
142
|
-
|
223
|
+
const mergedProps = useMemo(
|
224
|
+
() => __spreadValues(__spreadValues({}, props), slotProps),
|
225
|
+
[props, slotProps]
|
226
|
+
);
|
227
|
+
return mergedProps;
|
143
228
|
}
|
144
229
|
|
145
230
|
// components/SlotRender/server.tsx
|
@@ -275,6 +360,316 @@ function Render({
|
|
275
360
|
);
|
276
361
|
}
|
277
362
|
|
363
|
+
// lib/migrate.ts
|
364
|
+
init_react_import();
|
365
|
+
|
366
|
+
// store/default-app-state.ts
|
367
|
+
init_react_import();
|
368
|
+
|
369
|
+
// components/ViewportControls/default-viewports.ts
|
370
|
+
init_react_import();
|
371
|
+
var defaultViewports = [
|
372
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
373
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
374
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
375
|
+
];
|
376
|
+
|
377
|
+
// store/default-app-state.ts
|
378
|
+
var defaultAppState = {
|
379
|
+
data: { content: [], root: {}, zones: {} },
|
380
|
+
ui: {
|
381
|
+
leftSideBarVisible: true,
|
382
|
+
rightSideBarVisible: true,
|
383
|
+
arrayState: {},
|
384
|
+
itemSelector: null,
|
385
|
+
componentList: {},
|
386
|
+
isDragging: false,
|
387
|
+
previewMode: "edit",
|
388
|
+
viewports: {
|
389
|
+
current: {
|
390
|
+
width: defaultViewports[0].width,
|
391
|
+
height: defaultViewports[0].height || "auto"
|
392
|
+
},
|
393
|
+
options: [],
|
394
|
+
controlsVisible: true
|
395
|
+
},
|
396
|
+
field: { focus: null }
|
397
|
+
},
|
398
|
+
indexes: {
|
399
|
+
nodes: {},
|
400
|
+
zones: {}
|
401
|
+
}
|
402
|
+
};
|
403
|
+
|
404
|
+
// lib/data/walk-app-state.ts
|
405
|
+
init_react_import();
|
406
|
+
|
407
|
+
// lib/data/for-each-slot.ts
|
408
|
+
init_react_import();
|
409
|
+
var forEachSlot = (item, cb, recursive = false, isSlot2 = isSlot) => {
|
410
|
+
const props = item.props || {};
|
411
|
+
const propKeys = Object.keys(props);
|
412
|
+
for (let i = 0; i < propKeys.length; i++) {
|
413
|
+
const propKey = propKeys[i];
|
414
|
+
const itemType = "type" in item ? item.type : "root";
|
415
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
416
|
+
const content = props[propKey];
|
417
|
+
cb(props.id, propKey, content);
|
418
|
+
if (recursive) {
|
419
|
+
content.forEach(
|
420
|
+
(childItem) => __async(void 0, null, function* () {
|
421
|
+
return forEachSlot(childItem, cb, true, isSlot2);
|
422
|
+
})
|
423
|
+
);
|
424
|
+
}
|
425
|
+
}
|
426
|
+
}
|
427
|
+
};
|
428
|
+
|
429
|
+
// lib/data/for-related-zones.ts
|
430
|
+
init_react_import();
|
431
|
+
|
432
|
+
// lib/get-zone-id.ts
|
433
|
+
init_react_import();
|
434
|
+
var getZoneId = (zoneCompound) => {
|
435
|
+
if (!zoneCompound) {
|
436
|
+
return [];
|
437
|
+
}
|
438
|
+
if (zoneCompound && zoneCompound.indexOf(":") > -1) {
|
439
|
+
return zoneCompound.split(":");
|
440
|
+
}
|
441
|
+
return [rootDroppableId, zoneCompound];
|
442
|
+
};
|
443
|
+
|
444
|
+
// lib/data/for-related-zones.ts
|
445
|
+
function forRelatedZones(item, data, cb, path = []) {
|
446
|
+
Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
|
447
|
+
const [parentId] = getZoneId(zoneCompound);
|
448
|
+
if (parentId === item.props.id) {
|
449
|
+
cb(path, zoneCompound, content);
|
450
|
+
}
|
451
|
+
});
|
452
|
+
}
|
453
|
+
|
454
|
+
// lib/data/strip-slots.ts
|
455
|
+
init_react_import();
|
456
|
+
var stripSlots = (data) => {
|
457
|
+
return __spreadProps(__spreadValues({}, data), {
|
458
|
+
props: Object.entries(data.props).reduce(
|
459
|
+
(acc, [propKey, propVal]) => {
|
460
|
+
if (isSlot(propVal)) {
|
461
|
+
return acc;
|
462
|
+
}
|
463
|
+
return __spreadProps(__spreadValues({}, acc), { [propKey]: propVal });
|
464
|
+
},
|
465
|
+
{ id: data.props.id }
|
466
|
+
)
|
467
|
+
});
|
468
|
+
};
|
469
|
+
|
470
|
+
// lib/data/walk-app-state.ts
|
471
|
+
function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
472
|
+
var _a;
|
473
|
+
let newZones = {};
|
474
|
+
const newZoneIndex = {};
|
475
|
+
const newNodeIndex = {};
|
476
|
+
const processContent = (path, zoneCompound, content, zoneType, newId) => {
|
477
|
+
var _a2;
|
478
|
+
const [parentId] = zoneCompound.split(":");
|
479
|
+
const mappedContent = ((_a2 = mapContent(content, zoneCompound, zoneType)) != null ? _a2 : content) || [];
|
480
|
+
const [_2, zone] = zoneCompound.split(":");
|
481
|
+
const newZoneCompound = `${newId || parentId}:${zone}`;
|
482
|
+
const newContent2 = mappedContent.map(
|
483
|
+
(zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
|
484
|
+
);
|
485
|
+
newZoneIndex[newZoneCompound] = {
|
486
|
+
contentIds: newContent2.map((item) => item.props.id),
|
487
|
+
type: zoneType
|
488
|
+
};
|
489
|
+
return [newZoneCompound, newContent2];
|
490
|
+
};
|
491
|
+
const processRelatedZones = (item, newId, initialPath) => {
|
492
|
+
forRelatedZones(
|
493
|
+
item,
|
494
|
+
state.data,
|
495
|
+
(relatedPath, relatedZoneCompound, relatedContent) => {
|
496
|
+
const [zoneCompound, newContent2] = processContent(
|
497
|
+
relatedPath,
|
498
|
+
relatedZoneCompound,
|
499
|
+
relatedContent,
|
500
|
+
"dropzone",
|
501
|
+
newId
|
502
|
+
);
|
503
|
+
newZones[zoneCompound] = newContent2;
|
504
|
+
},
|
505
|
+
initialPath
|
506
|
+
);
|
507
|
+
};
|
508
|
+
const processItem = (item, path, index) => {
|
509
|
+
const mappedItem = mapNodeOrSkip(item, path, index);
|
510
|
+
if (!mappedItem) return item;
|
511
|
+
const id = mappedItem.props.id;
|
512
|
+
const newProps = __spreadValues({}, mappedItem.props);
|
513
|
+
forEachSlot(
|
514
|
+
mappedItem,
|
515
|
+
(parentId2, slotId, content) => {
|
516
|
+
const zoneCompound = `${parentId2}:${slotId}`;
|
517
|
+
const [_2, newContent2] = processContent(
|
518
|
+
path,
|
519
|
+
zoneCompound,
|
520
|
+
content,
|
521
|
+
"slot",
|
522
|
+
parentId2
|
523
|
+
);
|
524
|
+
newProps[slotId] = newContent2;
|
525
|
+
},
|
526
|
+
false,
|
527
|
+
createIsSlotConfig(config)
|
528
|
+
);
|
529
|
+
processRelatedZones(item, id, path);
|
530
|
+
const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
|
531
|
+
const thisZoneCompound = path[path.length - 1];
|
532
|
+
const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
|
533
|
+
newNodeIndex[id] = {
|
534
|
+
data: newItem,
|
535
|
+
flatData: stripSlots(newItem),
|
536
|
+
path,
|
537
|
+
parentId,
|
538
|
+
zone
|
539
|
+
};
|
540
|
+
const finalData = __spreadProps(__spreadValues({}, newItem), { props: __spreadValues({}, newItem.props) });
|
541
|
+
if (newProps.id === "root") {
|
542
|
+
delete finalData["type"];
|
543
|
+
delete finalData.props["id"];
|
544
|
+
}
|
545
|
+
return finalData;
|
546
|
+
};
|
547
|
+
const zones = state.data.zones || {};
|
548
|
+
const [_, newContent] = processContent(
|
549
|
+
[],
|
550
|
+
rootDroppableId,
|
551
|
+
state.data.content,
|
552
|
+
"root"
|
553
|
+
);
|
554
|
+
const processedContent = newContent;
|
555
|
+
const zonesAlreadyProcessed = Object.keys(newZones);
|
556
|
+
Object.keys(zones || {}).forEach((zoneCompound) => {
|
557
|
+
const [parentId] = zoneCompound.split(":");
|
558
|
+
if (zonesAlreadyProcessed.includes(zoneCompound)) {
|
559
|
+
return;
|
560
|
+
}
|
561
|
+
const [_2, newContent2] = processContent(
|
562
|
+
[rootDroppableId],
|
563
|
+
zoneCompound,
|
564
|
+
zones[zoneCompound],
|
565
|
+
"dropzone",
|
566
|
+
parentId
|
567
|
+
);
|
568
|
+
newZones[zoneCompound] = newContent2;
|
569
|
+
}, newZones);
|
570
|
+
const processedRoot = processItem(
|
571
|
+
{
|
572
|
+
type: "root",
|
573
|
+
props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
|
574
|
+
},
|
575
|
+
[],
|
576
|
+
-1
|
577
|
+
);
|
578
|
+
const root = __spreadProps(__spreadValues({}, state.data.root), {
|
579
|
+
props: processedRoot.props
|
580
|
+
});
|
581
|
+
return __spreadProps(__spreadValues({}, state), {
|
582
|
+
data: {
|
583
|
+
root,
|
584
|
+
content: processedContent,
|
585
|
+
zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
|
586
|
+
},
|
587
|
+
indexes: {
|
588
|
+
nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
|
589
|
+
zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
|
590
|
+
}
|
591
|
+
});
|
592
|
+
}
|
593
|
+
|
594
|
+
// lib/migrate.ts
|
595
|
+
var migrations = [
|
596
|
+
// Migrate root to root.props
|
597
|
+
(data) => {
|
598
|
+
const rootProps = data.root.props || data.root;
|
599
|
+
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
600
|
+
console.warn(
|
601
|
+
"Migration applied: Root props moved from `root` to `root.props`."
|
602
|
+
);
|
603
|
+
return __spreadProps(__spreadValues({}, data), {
|
604
|
+
root: {
|
605
|
+
props: __spreadValues({}, rootProps)
|
606
|
+
}
|
607
|
+
});
|
608
|
+
}
|
609
|
+
return data;
|
610
|
+
},
|
611
|
+
// Migrate zones to slots
|
612
|
+
(data, config) => {
|
613
|
+
var _a;
|
614
|
+
if (!config) return data;
|
615
|
+
console.log("Migrating DropZones to slots...");
|
616
|
+
const updatedItems = {};
|
617
|
+
const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
|
618
|
+
const { indexes } = walkAppState(appState, config);
|
619
|
+
const deletedCompounds = [];
|
620
|
+
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
621
|
+
var _a2, _b;
|
622
|
+
if (zoneType === "dropzone") {
|
623
|
+
const [id, slotName] = zoneCompound.split(":");
|
624
|
+
const nodeData = indexes.nodes[id].data;
|
625
|
+
const componentType = nodeData.type;
|
626
|
+
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
627
|
+
if (((_b = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b.type) === "slot") {
|
628
|
+
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
629
|
+
props: __spreadProps(__spreadValues({}, nodeData.props), {
|
630
|
+
[slotName]: content
|
631
|
+
})
|
632
|
+
});
|
633
|
+
deletedCompounds.push(zoneCompound);
|
634
|
+
}
|
635
|
+
return content;
|
636
|
+
}
|
637
|
+
return content;
|
638
|
+
});
|
639
|
+
const updated = walkAppState(
|
640
|
+
appState,
|
641
|
+
config,
|
642
|
+
(content) => content,
|
643
|
+
(item) => {
|
644
|
+
var _a2;
|
645
|
+
return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
|
646
|
+
}
|
647
|
+
);
|
648
|
+
deletedCompounds.forEach((zoneCompound) => {
|
649
|
+
var _a2;
|
650
|
+
const [_, propName] = zoneCompound.split(":");
|
651
|
+
console.log(
|
652
|
+
`\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
|
653
|
+
);
|
654
|
+
(_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
|
655
|
+
});
|
656
|
+
Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
|
657
|
+
const [_, propName] = zoneCompound.split(":");
|
658
|
+
throw new Error(
|
659
|
+
`Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
|
660
|
+
);
|
661
|
+
});
|
662
|
+
delete updated.data.zones;
|
663
|
+
return updated.data;
|
664
|
+
}
|
665
|
+
];
|
666
|
+
function migrate(data, config) {
|
667
|
+
return migrations == null ? void 0 : migrations.reduce(
|
668
|
+
(acc, migration) => migration(acc, config),
|
669
|
+
data
|
670
|
+
);
|
671
|
+
}
|
672
|
+
|
278
673
|
// lib/transform-props.ts
|
279
674
|
init_react_import();
|
280
675
|
|
@@ -286,11 +681,13 @@ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
|
286
681
|
});
|
287
682
|
|
288
683
|
// lib/transform-props.ts
|
289
|
-
function transformProps(data, propTransforms) {
|
684
|
+
function transformProps(data, propTransforms, config = { components: {} }) {
|
290
685
|
const mapItem = (item) => {
|
291
686
|
if (propTransforms[item.type]) {
|
292
687
|
return __spreadProps(__spreadValues({}, item), {
|
293
|
-
props:
|
688
|
+
props: __spreadValues({
|
689
|
+
id: item.props.id
|
690
|
+
}, propTransforms[item.type](item.props))
|
294
691
|
});
|
295
692
|
}
|
296
693
|
return item;
|
@@ -299,23 +696,18 @@ function transformProps(data, propTransforms) {
|
|
299
696
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
300
697
|
let newRoot = __spreadValues({}, defaultedData.root);
|
301
698
|
if (propTransforms["root"]) {
|
302
|
-
|
303
|
-
newRoot.props = propTransforms["root"](rootProps);
|
304
|
-
} else {
|
305
|
-
newRoot = propTransforms["root"](rootProps);
|
306
|
-
}
|
699
|
+
newRoot.props = propTransforms["root"](rootProps);
|
307
700
|
}
|
308
|
-
const
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
return afterPropTransforms;
|
701
|
+
const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
|
702
|
+
const updatedData = walkTree(
|
703
|
+
dataWithUpdatedRoot,
|
704
|
+
config,
|
705
|
+
(content) => content.map(mapItem)
|
706
|
+
);
|
707
|
+
if (!defaultedData.root.props) {
|
708
|
+
updatedData.root = updatedData.root.props;
|
709
|
+
}
|
710
|
+
return updatedData;
|
319
711
|
}
|
320
712
|
|
321
713
|
// lib/resolve-all-data.ts
|
@@ -324,61 +716,6 @@ init_react_import();
|
|
324
716
|
// lib/resolve-component-data.ts
|
325
717
|
init_react_import();
|
326
718
|
|
327
|
-
// lib/data/map-slots.ts
|
328
|
-
init_react_import();
|
329
|
-
|
330
|
-
// lib/data/is-slot.ts
|
331
|
-
init_react_import();
|
332
|
-
var isSlot = (prop) => {
|
333
|
-
var _a, _b;
|
334
|
-
return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
|
335
|
-
};
|
336
|
-
var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
|
337
|
-
var _a, _b;
|
338
|
-
const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
|
339
|
-
if (!configForComponent) return isSlot(propValue);
|
340
|
-
return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
|
341
|
-
};
|
342
|
-
|
343
|
-
// lib/data/map-slots.ts
|
344
|
-
function mapSlotsAsync(_0, _1) {
|
345
|
-
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
346
|
-
const props = __spreadValues({}, item.props);
|
347
|
-
const propKeys = Object.keys(props);
|
348
|
-
for (let i = 0; i < propKeys.length; i++) {
|
349
|
-
const propKey = propKeys[i];
|
350
|
-
const itemType = "type" in item ? item.type : "root";
|
351
|
-
if (isSlot2(itemType, propKey, props[propKey])) {
|
352
|
-
const content = props[propKey];
|
353
|
-
const mappedContent = recursive ? yield Promise.all(
|
354
|
-
content.map((item2) => __async(this, null, function* () {
|
355
|
-
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
356
|
-
}))
|
357
|
-
) : content;
|
358
|
-
props[propKey] = yield map(mappedContent, propKey);
|
359
|
-
}
|
360
|
-
}
|
361
|
-
return __spreadProps(__spreadValues({}, item), { props });
|
362
|
-
});
|
363
|
-
}
|
364
|
-
function mapSlotsSync(item, map, isSlot2 = isSlot) {
|
365
|
-
var _a, _b;
|
366
|
-
const props = __spreadValues({}, item.props);
|
367
|
-
const propKeys = Object.keys(props);
|
368
|
-
for (let i = 0; i < propKeys.length; i++) {
|
369
|
-
const propKey = propKeys[i];
|
370
|
-
const itemType = "type" in item ? item.type : "root";
|
371
|
-
if (isSlot2(itemType, propKey, props[propKey])) {
|
372
|
-
const content = props[propKey];
|
373
|
-
const mappedContent = content.map((item2) => {
|
374
|
-
return mapSlotsSync(item2, map, isSlot2);
|
375
|
-
});
|
376
|
-
props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
|
377
|
-
}
|
378
|
-
}
|
379
|
-
return __spreadProps(__spreadValues({}, item), { props });
|
380
|
-
}
|
381
|
-
|
382
719
|
// lib/get-changed.ts
|
383
720
|
init_react_import();
|
384
721
|
var getChanged = (newItem, oldItem) => {
|
@@ -520,24 +857,23 @@ export {
|
|
520
857
|
__objRest,
|
521
858
|
__commonJS,
|
522
859
|
__toESM,
|
523
|
-
__privateGet,
|
524
|
-
__privateAdd,
|
525
|
-
__privateSet,
|
526
860
|
__async,
|
527
861
|
init_react_import,
|
528
|
-
isSlot,
|
529
|
-
createIsSlotConfig,
|
530
862
|
rootAreaId,
|
531
863
|
rootZone,
|
532
864
|
rootDroppableId,
|
865
|
+
walkAppState,
|
866
|
+
walkTree,
|
533
867
|
setupZone,
|
868
|
+
defaultViewports,
|
534
869
|
getChanged,
|
535
|
-
mapSlotsSync,
|
536
870
|
resolveComponentData,
|
871
|
+
defaultAppState,
|
537
872
|
useSlots,
|
538
873
|
Render,
|
539
874
|
SlotRenderPure,
|
540
875
|
SlotRender,
|
876
|
+
migrate,
|
541
877
|
transformProps,
|
542
878
|
resolveAllData
|
543
879
|
};
|