@measured/puck 0.19.0-canary.896a6279 → 0.19.0-canary.a6dd529f
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/README.md +1 -0
- package/dist/{chunk-LT6HN46T.mjs → chunk-ZOHJNF5K.mjs} +187 -110
- package/dist/index.css +44 -38
- package/dist/index.d.mts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +221 -76
- package/dist/index.mjs +76 -7
- package/dist/{resolve-all-data-Cs8PfTrg.d.mts → resolve-all-data-BFRAghCj.d.mts} +5 -1
- package/dist/{resolve-all-data-Cs8PfTrg.d.ts → resolve-all-data-BFRAghCj.d.ts} +5 -1
- package/dist/rsc.css +12 -11
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +123 -69
- package/dist/rsc.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -95,6 +95,7 @@ Available recipes include:
|
|
95
95
|
|
96
96
|
- [**next**](https://github.com/measuredco/puck/tree/main/recipes/next): Next.js example, using App Router and static page generation
|
97
97
|
- [**remix**](https://github.com/measuredco/puck/tree/main/recipes/remix): Remix Run v2 example, using dynamic routes at root-level
|
98
|
+
- [**react-router**](https://github.com/measuredco/puck/tree/main/recipes/react-router): React Router v7 app example, using dynamic routes to create pages at any level
|
98
99
|
|
99
100
|
## Community
|
100
101
|
|
@@ -226,6 +226,68 @@ ActionBar.Action = Action;
|
|
226
226
|
ActionBar.Label = Label;
|
227
227
|
ActionBar.Group = Group;
|
228
228
|
|
229
|
+
// lib/data/map-slots.ts
|
230
|
+
init_react_import();
|
231
|
+
|
232
|
+
// lib/data/is-slot.ts
|
233
|
+
init_react_import();
|
234
|
+
var isSlot = (prop) => {
|
235
|
+
var _a, _b;
|
236
|
+
return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
|
237
|
+
};
|
238
|
+
var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
|
239
|
+
var _a, _b;
|
240
|
+
const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
|
241
|
+
if (!configForComponent) return isSlot(propValue);
|
242
|
+
return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
|
243
|
+
};
|
244
|
+
|
245
|
+
// lib/data/map-slots.ts
|
246
|
+
function mapSlotsAsync(_0, _1) {
|
247
|
+
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
248
|
+
const props = __spreadValues({}, item.props);
|
249
|
+
const propKeys = Object.keys(props);
|
250
|
+
for (let i = 0; i < propKeys.length; i++) {
|
251
|
+
const propKey = propKeys[i];
|
252
|
+
const itemType = "type" in item ? item.type : "root";
|
253
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
254
|
+
const content = props[propKey];
|
255
|
+
const mappedContent = recursive ? yield Promise.all(
|
256
|
+
content.map((item2) => __async(this, null, function* () {
|
257
|
+
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
258
|
+
}))
|
259
|
+
) : content;
|
260
|
+
props[propKey] = yield map(mappedContent, propKey);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
264
|
+
});
|
265
|
+
}
|
266
|
+
function mapSlotsSync(item, map, isSlot2 = isSlot) {
|
267
|
+
const props = __spreadValues({}, item.props);
|
268
|
+
const propKeys = Object.keys(props);
|
269
|
+
for (let i = 0; i < propKeys.length; i++) {
|
270
|
+
const propKey = propKeys[i];
|
271
|
+
const itemType = "type" in item ? item.type : "root";
|
272
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
273
|
+
const content = props[propKey];
|
274
|
+
const mappedContent = content.map((item2) => {
|
275
|
+
return mapSlotsSync(item2, map, isSlot2);
|
276
|
+
});
|
277
|
+
props[propKey] = map(mappedContent, props.id, propKey);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
281
|
+
}
|
282
|
+
function mapSlotsPublic(item, config, map) {
|
283
|
+
const isSlot2 = createIsSlotConfig(config);
|
284
|
+
return mapSlotsSync(
|
285
|
+
item,
|
286
|
+
(content, parentId, propName) => map(content, { parentId, propName }),
|
287
|
+
isSlot2
|
288
|
+
);
|
289
|
+
}
|
290
|
+
|
229
291
|
// components/Render/index.tsx
|
230
292
|
init_react_import();
|
231
293
|
|
@@ -238,7 +300,7 @@ var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
|
238
300
|
// lib/use-slots.tsx
|
239
301
|
init_react_import();
|
240
302
|
import { useMemo } from "react";
|
241
|
-
function useSlots(config, props,
|
303
|
+
function useSlots(config, props, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
242
304
|
const slotProps = useMemo(() => {
|
243
305
|
if (!(config == null ? void 0 : config.fields)) return props;
|
244
306
|
const slotProps2 = {};
|
@@ -248,7 +310,11 @@ function useSlots(config, props, renderSlot) {
|
|
248
310
|
const field = config.fields[fieldKey];
|
249
311
|
if ((field == null ? void 0 : field.type) === "slot") {
|
250
312
|
const content = props[fieldKey] || [];
|
251
|
-
const
|
313
|
+
const render = (readOnly == null ? void 0 : readOnly[fieldKey]) || forceReadOnly ? renderSlotRender : renderSlotEdit;
|
314
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
315
|
+
allow: field.allow,
|
316
|
+
disallow: field.disallow
|
317
|
+
}, dzProps), {
|
252
318
|
zone: fieldKey,
|
253
319
|
content
|
254
320
|
}));
|
@@ -256,7 +322,7 @@ function useSlots(config, props, renderSlot) {
|
|
256
322
|
}
|
257
323
|
}
|
258
324
|
return slotProps2;
|
259
|
-
}, [config]);
|
325
|
+
}, [config, readOnly, forceReadOnly]);
|
260
326
|
return __spreadValues(__spreadValues({}, props), slotProps);
|
261
327
|
}
|
262
328
|
|
@@ -264,7 +330,7 @@ function useSlots(config, props, renderSlot) {
|
|
264
330
|
init_react_import();
|
265
331
|
import {
|
266
332
|
forwardRef as forwardRef4,
|
267
|
-
memo
|
333
|
+
memo,
|
268
334
|
useCallback as useCallback7,
|
269
335
|
useContext as useContext5,
|
270
336
|
useEffect as useEffect10,
|
@@ -285,7 +351,7 @@ import {
|
|
285
351
|
|
286
352
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
287
353
|
init_react_import();
|
288
|
-
var styles_module_default2 = { "DraggableComponent": "
|
354
|
+
var styles_module_default2 = { "DraggableComponent": "_DraggableComponent_qzbgx_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_qzbgx_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_qzbgx_29", "DraggableComponent--hover": "_DraggableComponent--hover_qzbgx_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_qzbgx_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_qzbgx_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_qzbgx_66", "DraggableComponent-actions": "_DraggableComponent-actions_qzbgx_66" };
|
289
355
|
|
290
356
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
291
357
|
init_react_import();
|
@@ -628,21 +694,6 @@ init_react_import();
|
|
628
694
|
|
629
695
|
// lib/data/for-each-slot.ts
|
630
696
|
init_react_import();
|
631
|
-
|
632
|
-
// lib/data/is-slot.ts
|
633
|
-
init_react_import();
|
634
|
-
var isSlot = (prop) => {
|
635
|
-
var _a, _b;
|
636
|
-
return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
|
637
|
-
};
|
638
|
-
var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
|
639
|
-
var _a, _b;
|
640
|
-
const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
|
641
|
-
if (!configForComponent) return isSlot(propValue);
|
642
|
-
return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
|
643
|
-
};
|
644
|
-
|
645
|
-
// lib/data/for-each-slot.ts
|
646
697
|
var forEachSlot = (item, cb, recursive = false, isSlot2 = isSlot) => {
|
647
698
|
const props = item.props || {};
|
648
699
|
const propKeys = Object.keys(props);
|
@@ -1097,7 +1148,6 @@ var reorderAction = (state, action, appStore) => {
|
|
1097
1148
|
init_react_import();
|
1098
1149
|
var removeAction = (state, action, appStore) => {
|
1099
1150
|
const item = getItem({ index: action.index, zone: action.zone }, state);
|
1100
|
-
const [parentId] = action.zone.split(":");
|
1101
1151
|
const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
|
1102
1152
|
(acc, [nodeId, nodeData]) => {
|
1103
1153
|
const pathIds = nodeData.path.map((p) => p.split(":")[0]);
|
@@ -1116,24 +1166,17 @@ var removeAction = (state, action, appStore) => {
|
|
1116
1166
|
return remove(content, action.index);
|
1117
1167
|
}
|
1118
1168
|
return content;
|
1119
|
-
},
|
1120
|
-
(childItem, path) => {
|
1121
|
-
const parentIds = path.map((p) => p.split(":")[0]);
|
1122
|
-
if (childItem.props.id === parentId || childItem.props.id === item.props.id || parentIds.indexOf(item.props.id) > -1) {
|
1123
|
-
return childItem;
|
1124
|
-
}
|
1125
|
-
return null;
|
1126
1169
|
}
|
1127
1170
|
);
|
1128
1171
|
Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
|
1129
|
-
const
|
1130
|
-
if (nodesToDelete.includes(
|
1172
|
+
const parentId = zoneCompound.split(":")[0];
|
1173
|
+
if (nodesToDelete.includes(parentId) && newState.data.zones) {
|
1131
1174
|
delete newState.data.zones[zoneCompound];
|
1132
1175
|
}
|
1133
1176
|
});
|
1134
1177
|
Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
|
1135
|
-
const
|
1136
|
-
if (nodesToDelete.includes(
|
1178
|
+
const parentId = zoneCompound.split(":")[0];
|
1179
|
+
if (nodesToDelete.includes(parentId)) {
|
1137
1180
|
delete newState.indexes.zones[zoneCompound];
|
1138
1181
|
}
|
1139
1182
|
});
|
@@ -1517,7 +1560,7 @@ var createHistorySlice = (set, get) => {
|
|
1517
1560
|
const { dispatch, history } = get();
|
1518
1561
|
dispatch({
|
1519
1562
|
type: "set",
|
1520
|
-
state: ((_a = history.histories[
|
1563
|
+
state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
|
1521
1564
|
});
|
1522
1565
|
set({ history: __spreadProps(__spreadValues({}, history), { index }) });
|
1523
1566
|
},
|
@@ -1834,31 +1877,6 @@ var useRegisterFieldsSlice = (appStore, id) => {
|
|
1834
1877
|
|
1835
1878
|
// lib/resolve-component-data.ts
|
1836
1879
|
init_react_import();
|
1837
|
-
|
1838
|
-
// lib/data/map-slots.ts
|
1839
|
-
init_react_import();
|
1840
|
-
function mapSlots(_0, _1) {
|
1841
|
-
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
1842
|
-
const props = __spreadValues({}, item.props);
|
1843
|
-
const propKeys = Object.keys(props);
|
1844
|
-
for (let i = 0; i < propKeys.length; i++) {
|
1845
|
-
const propKey = propKeys[i];
|
1846
|
-
const itemType = "type" in item ? item.type : "root";
|
1847
|
-
if (isSlot2(itemType, propKey, props[propKey])) {
|
1848
|
-
const content = props[propKey];
|
1849
|
-
const mappedContent = recursive ? yield Promise.all(
|
1850
|
-
content.map((item2) => __async(this, null, function* () {
|
1851
|
-
return yield mapSlots(item2, map, recursive, isSlot2);
|
1852
|
-
}))
|
1853
|
-
) : content;
|
1854
|
-
props[propKey] = yield map(mappedContent, propKey);
|
1855
|
-
}
|
1856
|
-
}
|
1857
|
-
return __spreadProps(__spreadValues({}, item), { props });
|
1858
|
-
});
|
1859
|
-
}
|
1860
|
-
|
1861
|
-
// lib/resolve-component-data.ts
|
1862
1880
|
import fdeq from "fast-deep-equal";
|
1863
1881
|
var cache = { lastChange: {} };
|
1864
1882
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
|
@@ -1876,14 +1894,14 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1876
1894
|
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1877
1895
|
changed,
|
1878
1896
|
lastData: oldItem,
|
1879
|
-
metadata,
|
1897
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1880
1898
|
trigger
|
1881
1899
|
});
|
1882
1900
|
let resolvedItem = __spreadProps(__spreadValues({}, item), {
|
1883
1901
|
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
1884
1902
|
});
|
1885
1903
|
if (recursive) {
|
1886
|
-
resolvedItem = yield
|
1904
|
+
resolvedItem = yield mapSlotsAsync(
|
1887
1905
|
resolvedItem,
|
1888
1906
|
(content) => __async(void 0, null, function* () {
|
1889
1907
|
return Promise.all(
|
@@ -3969,7 +3987,6 @@ var DragDropContextClient = ({
|
|
3969
3987
|
}
|
3970
3988
|
if (thisPreview) {
|
3971
3989
|
zoneStore.setState({ previewIndex: {} });
|
3972
|
-
const state = appStore.getState().state;
|
3973
3990
|
if (thisPreview.type === "insert") {
|
3974
3991
|
insertComponent(
|
3975
3992
|
thisPreview.componentType,
|
@@ -4448,30 +4465,60 @@ init_react_import();
|
|
4448
4465
|
import { forwardRef as forwardRef3 } from "react";
|
4449
4466
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
4450
4467
|
var SlotRenderPure = (props) => /* @__PURE__ */ jsx8(SlotRender, __spreadValues({}, props));
|
4468
|
+
var ContextSlotRender = ({
|
4469
|
+
componentId,
|
4470
|
+
zone
|
4471
|
+
}) => {
|
4472
|
+
const config = useAppStore((s) => s.config);
|
4473
|
+
const metadata = useAppStore((s) => s.metadata);
|
4474
|
+
const slotContent = useAppStore(
|
4475
|
+
(s) => {
|
4476
|
+
var _a, _b;
|
4477
|
+
return (_b = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.props[zone]) != null ? _b : null;
|
4478
|
+
}
|
4479
|
+
);
|
4480
|
+
return /* @__PURE__ */ jsx8(
|
4481
|
+
SlotRenderPure,
|
4482
|
+
{
|
4483
|
+
content: slotContent,
|
4484
|
+
zone,
|
4485
|
+
config,
|
4486
|
+
metadata
|
4487
|
+
}
|
4488
|
+
);
|
4489
|
+
};
|
4490
|
+
var Item = ({
|
4491
|
+
config,
|
4492
|
+
item,
|
4493
|
+
metadata
|
4494
|
+
}) => {
|
4495
|
+
const Component = config.components[item.type];
|
4496
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ jsx8(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
4497
|
+
return /* @__PURE__ */ jsx8(
|
4498
|
+
Component.render,
|
4499
|
+
__spreadProps(__spreadValues({}, props), {
|
4500
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
4501
|
+
renderDropZone: DropZoneRenderPure,
|
4502
|
+
metadata: metadata || {}
|
4503
|
+
})
|
4504
|
+
})
|
4505
|
+
);
|
4506
|
+
};
|
4451
4507
|
var SlotRender = forwardRef3(
|
4452
4508
|
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
4453
4509
|
return /* @__PURE__ */ jsx8("div", { className, style, ref, children: content.map((item) => {
|
4454
|
-
|
4455
|
-
|
4456
|
-
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ jsx8(
|
4457
|
-
SlotRenderPure,
|
4458
|
-
__spreadProps(__spreadValues({}, slotProps), {
|
4459
|
-
config,
|
4460
|
-
metadata
|
4461
|
-
})
|
4462
|
-
));
|
4463
|
-
return /* @__PURE__ */ jsx8(
|
4464
|
-
Component.render,
|
4465
|
-
__spreadProps(__spreadValues({}, props), {
|
4466
|
-
puck: {
|
4467
|
-
renderDropZone: DropZoneRenderPure,
|
4468
|
-
metadata: metadata || {}
|
4469
|
-
}
|
4470
|
-
}),
|
4471
|
-
props.id
|
4472
|
-
);
|
4510
|
+
if (!config.components[item.type]) {
|
4511
|
+
return null;
|
4473
4512
|
}
|
4474
|
-
return
|
4513
|
+
return /* @__PURE__ */ jsx8(
|
4514
|
+
Item,
|
4515
|
+
{
|
4516
|
+
config,
|
4517
|
+
item,
|
4518
|
+
metadata
|
4519
|
+
},
|
4520
|
+
item.props.id
|
4521
|
+
);
|
4475
4522
|
}) });
|
4476
4523
|
}
|
4477
4524
|
);
|
@@ -4494,12 +4541,6 @@ var DropZoneChild = ({
|
|
4494
4541
|
}) => {
|
4495
4542
|
var _a, _b;
|
4496
4543
|
const metadata = useAppStore((s) => s.metadata);
|
4497
|
-
const puckProps = {
|
4498
|
-
renderDropZone: DropZoneEditPure,
|
4499
|
-
isEditing: true,
|
4500
|
-
dragRef: null,
|
4501
|
-
metadata
|
4502
|
-
};
|
4503
4544
|
const ctx = useContext5(dropZoneContext);
|
4504
4545
|
const { depth = 1 } = ctx != null ? ctx : {};
|
4505
4546
|
const nodeProps = useAppStore(
|
@@ -4514,11 +4555,23 @@ var DropZoneChild = ({
|
|
4514
4555
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.type;
|
4515
4556
|
}
|
4516
4557
|
);
|
4558
|
+
const nodeReadOnly = useAppStore(
|
4559
|
+
useShallow3((s) => {
|
4560
|
+
var _a2;
|
4561
|
+
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
4562
|
+
})
|
4563
|
+
);
|
4517
4564
|
const node = { type: nodeType, props: nodeProps };
|
4518
4565
|
const item = nodeProps ? node : (preview == null ? void 0 : preview.componentType) ? { type: preview.componentType, props: preview.props } : null;
|
4519
4566
|
const componentConfig = useAppStore(
|
4520
4567
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
4521
4568
|
);
|
4569
|
+
const puckProps = {
|
4570
|
+
renderDropZone: DropZoneEditPure,
|
4571
|
+
isEditing: true,
|
4572
|
+
dragRef: null,
|
4573
|
+
metadata: __spreadValues(__spreadValues({}, metadata), componentConfig == null ? void 0 : componentConfig.metadata)
|
4574
|
+
};
|
4522
4575
|
const overrides = useAppStore((s) => s.overrides);
|
4523
4576
|
const isLoading = useAppStore(
|
4524
4577
|
(s) => {
|
@@ -4550,7 +4603,10 @@ var DropZoneChild = ({
|
|
4550
4603
|
const defaultedPropsWithSlots = useSlots(
|
4551
4604
|
componentConfig,
|
4552
4605
|
defaultsProps,
|
4553
|
-
DropZoneEditPure
|
4606
|
+
DropZoneEditPure,
|
4607
|
+
(slotProps) => /* @__PURE__ */ jsx9(ContextSlotRender, { componentId, zone: slotProps.zone }),
|
4608
|
+
nodeReadOnly,
|
4609
|
+
isLoading
|
4554
4610
|
);
|
4555
4611
|
if (!item) return;
|
4556
4612
|
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ jsxs4("div", { style: { padding: 48, textAlign: "center" }, children: [
|
@@ -4588,7 +4644,7 @@ var DropZoneChild = ({
|
|
4588
4644
|
}
|
4589
4645
|
);
|
4590
4646
|
};
|
4591
|
-
var DropZoneChildMemo =
|
4647
|
+
var DropZoneChildMemo = memo(DropZoneChild);
|
4592
4648
|
var DropZoneEdit = forwardRef4(
|
4593
4649
|
function DropZoneEditInternal({
|
4594
4650
|
zone,
|
@@ -4648,6 +4704,11 @@ var DropZoneEdit = forwardRef4(
|
|
4648
4704
|
);
|
4649
4705
|
useEffect10(() => {
|
4650
4706
|
if (!zoneType || zoneType === "dropzone") {
|
4707
|
+
if (zoneCompound !== rootDroppableId) {
|
4708
|
+
console.warn(
|
4709
|
+
"DropZones have been deprecated in favor of slot fields and will be removed in a future version of Puck. Please see the migration guide: https://www.puckeditor.com/docs/guides/migrations/dropzones-to-slots"
|
4710
|
+
);
|
4711
|
+
}
|
4651
4712
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
4652
4713
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
4653
4714
|
}
|
@@ -4771,6 +4832,30 @@ var DropZoneEdit = forwardRef4(
|
|
4771
4832
|
);
|
4772
4833
|
}
|
4773
4834
|
);
|
4835
|
+
var DropZoneRenderItem = ({
|
4836
|
+
config,
|
4837
|
+
item,
|
4838
|
+
metadata
|
4839
|
+
}) => {
|
4840
|
+
const Component = config.components[item.type];
|
4841
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ jsx9(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
4842
|
+
const nextContextValue = useMemo6(
|
4843
|
+
() => ({
|
4844
|
+
areaId: props.id,
|
4845
|
+
depth: 1
|
4846
|
+
}),
|
4847
|
+
[props]
|
4848
|
+
);
|
4849
|
+
return /* @__PURE__ */ jsx9(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx9(
|
4850
|
+
Component.render,
|
4851
|
+
__spreadProps(__spreadValues({}, props), {
|
4852
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
4853
|
+
renderDropZone: DropZoneRenderPure,
|
4854
|
+
metadata: __spreadValues(__spreadValues({}, metadata), Component.metadata)
|
4855
|
+
})
|
4856
|
+
})
|
4857
|
+
) }, props.id);
|
4858
|
+
};
|
4774
4859
|
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx9(DropZoneRender, __spreadValues({}, props));
|
4775
4860
|
var DropZoneRender = forwardRef4(
|
4776
4861
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
@@ -4801,29 +4886,15 @@ var DropZoneRender = forwardRef4(
|
|
4801
4886
|
return /* @__PURE__ */ jsx9("div", { className, style, ref, children: content.map((item) => {
|
4802
4887
|
const Component = config.components[item.type];
|
4803
4888
|
if (Component) {
|
4804
|
-
|
4805
|
-
|
4806
|
-
|
4889
|
+
return /* @__PURE__ */ jsx9(
|
4890
|
+
DropZoneRenderItem,
|
4891
|
+
{
|
4807
4892
|
config,
|
4893
|
+
item,
|
4808
4894
|
metadata
|
4809
|
-
}
|
4810
|
-
|
4811
|
-
const nextContextValue = useMemo6(
|
4812
|
-
() => ({
|
4813
|
-
areaId: props.id,
|
4814
|
-
depth: 1
|
4815
|
-
}),
|
4816
|
-
[props]
|
4895
|
+
},
|
4896
|
+
item.props.id
|
4817
4897
|
);
|
4818
|
-
return /* @__PURE__ */ jsx9(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx9(
|
4819
|
-
Component.render,
|
4820
|
-
__spreadProps(__spreadValues({}, props), {
|
4821
|
-
puck: {
|
4822
|
-
renderDropZone: DropZoneRenderPure,
|
4823
|
-
metadata: metadata || {}
|
4824
|
-
}
|
4825
|
-
})
|
4826
|
-
) }, props.id);
|
4827
4898
|
}
|
4828
4899
|
return null;
|
4829
4900
|
}) });
|
@@ -4959,7 +5030,11 @@ function resolveAllData(_0, _1) {
|
|
4959
5030
|
"force",
|
4960
5031
|
false
|
4961
5032
|
)).node;
|
4962
|
-
const resolvedDeep = yield
|
5033
|
+
const resolvedDeep = yield mapSlotsAsync(
|
5034
|
+
resolved,
|
5035
|
+
processContent,
|
5036
|
+
false
|
5037
|
+
);
|
4963
5038
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
4964
5039
|
return resolvedDeep;
|
4965
5040
|
});
|
@@ -5034,6 +5109,7 @@ export {
|
|
5034
5109
|
rootZone,
|
5035
5110
|
rootDroppableId,
|
5036
5111
|
walkTree,
|
5112
|
+
getItem,
|
5037
5113
|
setupZone,
|
5038
5114
|
makeStatePublic,
|
5039
5115
|
defaultViewports,
|
@@ -5043,6 +5119,7 @@ export {
|
|
5043
5119
|
useRegisterHistorySlice,
|
5044
5120
|
useRegisterPermissionsSlice,
|
5045
5121
|
useRegisterFieldsSlice,
|
5122
|
+
mapSlotsPublic,
|
5046
5123
|
defaultAppState,
|
5047
5124
|
createAppStore,
|
5048
5125
|
appStoreContext,
|