@measured/puck 0.19.0-canary.91cb9cee → 0.19.0-canary.a60c81eb
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-GL73J54P.mjs → chunk-HGAPIQP5.mjs} +231 -161
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +352 -226
- package/dist/index.mjs +117 -53
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +232 -167
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-DOB5QZVq.d.mts → walk-tree-DBd3aQ_5.d.mts} +26 -21
- package/dist/{walk-tree-DOB5QZVq.d.ts → walk-tree-DBd3aQ_5.d.ts} +26 -21
- package/package.json +12 -7
@@ -87,68 +87,152 @@ var init_react_import = __esm({
|
|
87
87
|
// lib/data/walk-tree.ts
|
88
88
|
init_react_import();
|
89
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
90
|
// lib/data/map-slots.ts
|
104
91
|
init_react_import();
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
92
|
+
var isPromise = (v) => !!v && typeof v.then === "function";
|
93
|
+
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
94
|
+
var containsPromise = (arr) => arr.some(isPromise);
|
95
|
+
var walkField = ({
|
96
|
+
value,
|
97
|
+
fields,
|
98
|
+
map,
|
99
|
+
propKey = "",
|
100
|
+
propPath = "",
|
101
|
+
id = "",
|
102
|
+
config,
|
103
|
+
recurseSlots = false
|
104
|
+
}) => {
|
105
|
+
var _a, _b, _c;
|
106
|
+
if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
|
107
|
+
const content = value || [];
|
108
|
+
const mappedContent = recurseSlots ? content.map((el) => {
|
109
|
+
var _a2;
|
110
|
+
const componentConfig = config.components[el.type];
|
111
|
+
if (!componentConfig) {
|
112
|
+
throw new Error(`Could not find component config for ${el.type}`);
|
120
113
|
}
|
114
|
+
const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
|
115
|
+
return walkField({
|
116
|
+
value: el,
|
117
|
+
fields: fields2,
|
118
|
+
map,
|
119
|
+
id: el.props.id,
|
120
|
+
config,
|
121
|
+
recurseSlots
|
122
|
+
});
|
123
|
+
}) : content;
|
124
|
+
if (containsPromise(mappedContent)) {
|
125
|
+
return Promise.all(mappedContent);
|
121
126
|
}
|
122
|
-
return
|
123
|
-
}
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
127
|
+
return map(mappedContent, id, propPath, fields[propKey], propPath);
|
128
|
+
}
|
129
|
+
if (value && typeof value === "object") {
|
130
|
+
if (Array.isArray(value)) {
|
131
|
+
const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
|
132
|
+
if (!arrayFields) return value;
|
133
|
+
const newValue = value.map(
|
134
|
+
(el, idx) => walkField({
|
135
|
+
value: el,
|
136
|
+
fields: arrayFields,
|
137
|
+
map,
|
138
|
+
propKey,
|
139
|
+
propPath: `${propPath}[${idx}]`,
|
140
|
+
id,
|
141
|
+
config,
|
142
|
+
recurseSlots
|
143
|
+
})
|
144
|
+
);
|
145
|
+
if (containsPromise(newValue)) {
|
146
|
+
return Promise.all(newValue);
|
147
|
+
}
|
148
|
+
return newValue;
|
149
|
+
} else if ("$$typeof" in value) {
|
150
|
+
return value;
|
151
|
+
} else {
|
152
|
+
const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
|
153
|
+
return walkObject({
|
154
|
+
value,
|
155
|
+
fields: objectFields,
|
156
|
+
map,
|
157
|
+
id,
|
158
|
+
getPropPath: (k) => `${propPath}.${k}`,
|
159
|
+
config,
|
160
|
+
recurseSlots
|
136
161
|
});
|
137
|
-
props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
|
138
162
|
}
|
139
163
|
}
|
140
|
-
return
|
164
|
+
return value;
|
165
|
+
};
|
166
|
+
var walkObject = ({
|
167
|
+
value,
|
168
|
+
fields,
|
169
|
+
map,
|
170
|
+
id,
|
171
|
+
getPropPath,
|
172
|
+
config,
|
173
|
+
recurseSlots
|
174
|
+
}) => {
|
175
|
+
const newProps = Object.entries(value).map(([k, v]) => {
|
176
|
+
const opts = {
|
177
|
+
value: v,
|
178
|
+
fields,
|
179
|
+
map,
|
180
|
+
propKey: k,
|
181
|
+
propPath: getPropPath(k),
|
182
|
+
id,
|
183
|
+
config,
|
184
|
+
recurseSlots
|
185
|
+
};
|
186
|
+
const newValue = walkField(opts);
|
187
|
+
if (isPromise(newValue)) {
|
188
|
+
return newValue.then((resolvedValue) => ({
|
189
|
+
[k]: resolvedValue
|
190
|
+
}));
|
191
|
+
}
|
192
|
+
return {
|
193
|
+
[k]: newValue
|
194
|
+
};
|
195
|
+
}, {});
|
196
|
+
if (containsPromise(newProps)) {
|
197
|
+
return Promise.all(newProps).then(flatten);
|
198
|
+
}
|
199
|
+
return flatten(newProps);
|
200
|
+
};
|
201
|
+
function mapSlots(item, map, config, recurseSlots = false) {
|
202
|
+
var _a, _b, _c, _d;
|
203
|
+
const itemType = "type" in item ? item.type : "root";
|
204
|
+
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
205
|
+
const newProps = walkObject({
|
206
|
+
value: (_b = item.props) != null ? _b : {},
|
207
|
+
fields: (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {},
|
208
|
+
map,
|
209
|
+
id: item.props ? (_d = item.props.id) != null ? _d : "root" : "root",
|
210
|
+
getPropPath: (k) => k,
|
211
|
+
config,
|
212
|
+
recurseSlots
|
213
|
+
});
|
214
|
+
if (isPromise(newProps)) {
|
215
|
+
return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
|
216
|
+
props: resolvedProps
|
217
|
+
}));
|
218
|
+
}
|
219
|
+
return __spreadProps(__spreadValues({}, item), {
|
220
|
+
props: newProps
|
221
|
+
});
|
141
222
|
}
|
142
223
|
|
143
224
|
// lib/data/walk-tree.ts
|
144
225
|
function walkTree(data, config, callbackFn) {
|
145
226
|
var _a, _b;
|
146
|
-
const isSlot2 = createIsSlotConfig(config);
|
147
227
|
const walkItem = (item) => {
|
148
|
-
return
|
228
|
+
return mapSlots(
|
149
229
|
item,
|
150
|
-
(content, parentId, propName) =>
|
151
|
-
|
230
|
+
(content, parentId, propName) => {
|
231
|
+
var _a2;
|
232
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
233
|
+
},
|
234
|
+
config,
|
235
|
+
true
|
152
236
|
);
|
153
237
|
};
|
154
238
|
if ("props" in data) {
|
@@ -197,32 +281,30 @@ var setupZone = (data, zoneKey) => {
|
|
197
281
|
// lib/use-slots.tsx
|
198
282
|
init_react_import();
|
199
283
|
import { useMemo } from "react";
|
200
|
-
function useSlots(config,
|
284
|
+
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
201
285
|
const slotProps = useMemo(() => {
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
if ((field == null ? void 0 : field.type) === "slot") {
|
209
|
-
const content = props[fieldKey] || [];
|
210
|
-
const render = (readOnly == null ? void 0 : readOnly[fieldKey]) || forceReadOnly ? renderSlotRender : renderSlotEdit;
|
286
|
+
const mapped = mapSlots(
|
287
|
+
item,
|
288
|
+
(content, _parentId, propName, field, propPath) => {
|
289
|
+
const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
|
290
|
+
const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
|
291
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
211
292
|
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
212
|
-
allow: field.allow,
|
213
|
-
disallow: field.disallow
|
293
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
294
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
214
295
|
}, dzProps), {
|
215
|
-
zone:
|
296
|
+
zone: propName,
|
216
297
|
content
|
217
298
|
}));
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
|
-
|
299
|
+
return Slot;
|
300
|
+
},
|
301
|
+
config
|
302
|
+
).props;
|
303
|
+
return mapped;
|
304
|
+
}, [config, item, readOnly, forceReadOnly]);
|
223
305
|
const mergedProps = useMemo(
|
224
|
-
() => __spreadValues(__spreadValues({}, props), slotProps),
|
225
|
-
[props, slotProps]
|
306
|
+
() => __spreadValues(__spreadValues({}, item.props), slotProps),
|
307
|
+
[item.props, slotProps]
|
226
308
|
);
|
227
309
|
return mergedProps;
|
228
310
|
}
|
@@ -238,7 +320,7 @@ var Item = ({
|
|
238
320
|
metadata
|
239
321
|
}) => {
|
240
322
|
const Component = config.components[item.type];
|
241
|
-
const props = useSlots(
|
323
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
242
324
|
return /* @__PURE__ */ jsx(
|
243
325
|
Component.render,
|
244
326
|
__spreadProps(__spreadValues({}, props), {
|
@@ -300,12 +382,15 @@ function DropZoneRender({
|
|
300
382
|
metadata
|
301
383
|
}
|
302
384
|
),
|
303
|
-
metadata
|
385
|
+
metadata,
|
386
|
+
dragRef: null,
|
387
|
+
isEditing: false
|
304
388
|
}
|
305
389
|
});
|
306
|
-
const
|
390
|
+
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
391
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
307
392
|
if (Component) {
|
308
|
-
return /* @__PURE__ */ jsx2(Component.render, __spreadValues({}, propsWithSlots),
|
393
|
+
return /* @__PURE__ */ jsx2(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
309
394
|
}
|
310
395
|
return null;
|
311
396
|
}) });
|
@@ -316,7 +401,7 @@ function Render({
|
|
316
401
|
metadata = {}
|
317
402
|
}) {
|
318
403
|
var _a;
|
319
|
-
const rootProps = data.root.props
|
404
|
+
const rootProps = "props" in data.root ? data.root.props : data.root;
|
320
405
|
const title = rootProps.title || "";
|
321
406
|
const props = __spreadProps(__spreadValues({}, rootProps), {
|
322
407
|
puck: {
|
@@ -337,7 +422,7 @@ function Render({
|
|
337
422
|
editMode: false,
|
338
423
|
id: "puck-root"
|
339
424
|
});
|
340
|
-
const propsWithSlots = useSlots(config
|
425
|
+
const propsWithSlots = useSlots(config, { type: "root", props }, (props2) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
341
426
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
342
427
|
return /* @__PURE__ */ jsx2(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ jsx2(
|
343
428
|
DropZoneRender,
|
@@ -404,28 +489,6 @@ var defaultAppState = {
|
|
404
489
|
// lib/data/walk-app-state.ts
|
405
490
|
init_react_import();
|
406
491
|
|
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
492
|
// lib/data/for-related-zones.ts
|
430
493
|
init_react_import();
|
431
494
|
|
@@ -451,19 +514,26 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
451
514
|
});
|
452
515
|
}
|
453
516
|
|
517
|
+
// lib/data/flatten-node.ts
|
518
|
+
init_react_import();
|
519
|
+
import { flatten as flatten2, unflatten } from "flat";
|
520
|
+
|
454
521
|
// lib/data/strip-slots.ts
|
455
522
|
init_react_import();
|
456
|
-
var stripSlots = (data) => {
|
457
|
-
return
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
523
|
+
var stripSlots = (data, config) => {
|
524
|
+
return mapSlots(data, () => null, config);
|
525
|
+
};
|
526
|
+
|
527
|
+
// lib/data/flatten-node.ts
|
528
|
+
var flattenNode = (node, config) => {
|
529
|
+
return __spreadProps(__spreadValues({}, node), {
|
530
|
+
props: flatten2(stripSlots(node, config).props)
|
531
|
+
});
|
532
|
+
};
|
533
|
+
var expandNode = (node) => {
|
534
|
+
const props = unflatten(node.props);
|
535
|
+
return __spreadProps(__spreadValues({}, node), {
|
536
|
+
props
|
467
537
|
});
|
468
538
|
};
|
469
539
|
|
@@ -509,10 +579,9 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
509
579
|
const mappedItem = mapNodeOrSkip(item, path, index);
|
510
580
|
if (!mappedItem) return item;
|
511
581
|
const id = mappedItem.props.id;
|
512
|
-
const newProps = __spreadValues({},
|
513
|
-
forEachSlot(
|
582
|
+
const newProps = __spreadProps(__spreadValues({}, mapSlots(
|
514
583
|
mappedItem,
|
515
|
-
(parentId2, slotId
|
584
|
+
(content, parentId2, slotId) => {
|
516
585
|
const zoneCompound = `${parentId2}:${slotId}`;
|
517
586
|
const [_2, newContent2] = processContent(
|
518
587
|
path,
|
@@ -521,18 +590,19 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
521
590
|
"slot",
|
522
591
|
parentId2
|
523
592
|
);
|
524
|
-
|
593
|
+
return newContent2;
|
525
594
|
},
|
526
|
-
|
527
|
-
|
528
|
-
|
595
|
+
config
|
596
|
+
).props), {
|
597
|
+
id
|
598
|
+
});
|
529
599
|
processRelatedZones(item, id, path);
|
530
600
|
const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
|
531
601
|
const thisZoneCompound = path[path.length - 1];
|
532
602
|
const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
|
533
603
|
newNodeIndex[id] = {
|
534
604
|
data: newItem,
|
535
|
-
flatData:
|
605
|
+
flatData: flattenNode(newItem, config),
|
536
606
|
path,
|
537
607
|
parentId,
|
538
608
|
zone
|
@@ -718,25 +788,28 @@ init_react_import();
|
|
718
788
|
|
719
789
|
// lib/get-changed.ts
|
720
790
|
init_react_import();
|
791
|
+
import fdeq from "fast-deep-equal";
|
721
792
|
var getChanged = (newItem, oldItem) => {
|
722
793
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
723
794
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
724
795
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
725
796
|
return __spreadProps(__spreadValues({}, acc), {
|
726
|
-
[item]: oldItemProps[item]
|
797
|
+
[item]: !fdeq(oldItemProps[item], newItemProps[item])
|
727
798
|
});
|
728
799
|
}, {}) : {};
|
729
800
|
};
|
730
801
|
|
731
802
|
// lib/resolve-component-data.ts
|
732
|
-
import
|
803
|
+
import fdeq2 from "fast-deep-equal";
|
733
804
|
var cache = { lastChange: {} };
|
734
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace"
|
805
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
735
806
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
736
|
-
|
737
|
-
|
807
|
+
const resolvedItem = __spreadValues({}, item);
|
808
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
809
|
+
const id = "id" in item.props ? item.props.id : "root";
|
810
|
+
if (shouldRunResolver) {
|
738
811
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
739
|
-
if (item &&
|
812
|
+
if (item && fdeq2(item, oldItem)) {
|
740
813
|
return { node: resolved, didChange: false };
|
741
814
|
}
|
742
815
|
const changed = getChanged(item, oldItem);
|
@@ -749,46 +822,42 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
749
822
|
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
750
823
|
trigger
|
751
824
|
});
|
752
|
-
|
753
|
-
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
754
|
-
});
|
755
|
-
if (recursive) {
|
756
|
-
resolvedItem = yield mapSlotsAsync(
|
757
|
-
resolvedItem,
|
758
|
-
(content) => __async(void 0, null, function* () {
|
759
|
-
return Promise.all(
|
760
|
-
content.map(
|
761
|
-
(childItem) => __async(void 0, null, function* () {
|
762
|
-
return (yield resolveComponentData(
|
763
|
-
childItem,
|
764
|
-
config,
|
765
|
-
metadata,
|
766
|
-
onResolveStart,
|
767
|
-
onResolveEnd,
|
768
|
-
trigger,
|
769
|
-
false
|
770
|
-
)).node;
|
771
|
-
})
|
772
|
-
)
|
773
|
-
);
|
774
|
-
}),
|
775
|
-
false,
|
776
|
-
createIsSlotConfig(config)
|
777
|
-
);
|
778
|
-
}
|
825
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
779
826
|
if (Object.keys(readOnly).length) {
|
780
827
|
resolvedItem.readOnly = readOnly;
|
781
828
|
}
|
782
|
-
cache.lastChange[id] = {
|
783
|
-
item,
|
784
|
-
resolved: resolvedItem
|
785
|
-
};
|
786
|
-
if (onResolveEnd) {
|
787
|
-
onResolveEnd(resolvedItem);
|
788
|
-
}
|
789
|
-
return { node: resolvedItem, didChange: !fdeq(item, resolvedItem) };
|
790
829
|
}
|
791
|
-
|
830
|
+
let itemWithResolvedChildren = yield mapSlots(
|
831
|
+
resolvedItem,
|
832
|
+
(content) => __async(void 0, null, function* () {
|
833
|
+
return yield Promise.all(
|
834
|
+
content.map(
|
835
|
+
(childItem) => __async(void 0, null, function* () {
|
836
|
+
return (yield resolveComponentData(
|
837
|
+
childItem,
|
838
|
+
config,
|
839
|
+
metadata,
|
840
|
+
onResolveStart,
|
841
|
+
onResolveEnd,
|
842
|
+
trigger
|
843
|
+
)).node;
|
844
|
+
})
|
845
|
+
)
|
846
|
+
);
|
847
|
+
}),
|
848
|
+
config
|
849
|
+
);
|
850
|
+
if (shouldRunResolver && onResolveEnd) {
|
851
|
+
onResolveEnd(resolvedItem);
|
852
|
+
}
|
853
|
+
cache.lastChange[id] = {
|
854
|
+
item,
|
855
|
+
resolved: itemWithResolvedChildren
|
856
|
+
};
|
857
|
+
return {
|
858
|
+
node: itemWithResolvedChildren,
|
859
|
+
didChange: !fdeq2(item, itemWithResolvedChildren)
|
860
|
+
};
|
792
861
|
});
|
793
862
|
|
794
863
|
// lib/data/to-component.ts
|
@@ -816,13 +885,12 @@ function resolveAllData(_0, _1) {
|
|
816
885
|
},
|
817
886
|
() => {
|
818
887
|
},
|
819
|
-
"force"
|
820
|
-
false
|
888
|
+
"force"
|
821
889
|
)).node;
|
822
|
-
const resolvedDeep = yield
|
890
|
+
const resolvedDeep = yield mapSlots(
|
823
891
|
resolved,
|
824
892
|
processContent,
|
825
|
-
|
893
|
+
config
|
826
894
|
);
|
827
895
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
828
896
|
return resolvedDeep;
|
@@ -862,6 +930,8 @@ export {
|
|
862
930
|
rootAreaId,
|
863
931
|
rootZone,
|
864
932
|
rootDroppableId,
|
933
|
+
walkField,
|
934
|
+
expandNode,
|
865
935
|
walkAppState,
|
866
936
|
walkTree,
|
867
937
|
setupZone,
|
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-DBd3aQ_5.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-DBd3aQ_5.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-DBd3aQ_5.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-DBd3aQ_5.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';
|