@measured/puck 0.19.0-canary.896a6279 → 0.19.0-canary.8d459e4e
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 +2 -4
- package/dist/chunk-D6ENWNOG.mjs +543 -0
- package/dist/index.css +44 -38
- package/dist/index.d.mts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +485 -262
- package/dist/index.mjs +6596 -1623
- package/dist/{resolve-all-data-Cs8PfTrg.d.mts → resolve-all-data-DtB0OZRl.d.mts} +20 -15
- package/dist/{resolve-all-data-Cs8PfTrg.d.ts → resolve-all-data-DtB0OZRl.d.ts} +20 -15
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +195 -3703
- package/dist/rsc.mjs +3 -103
- package/package.json +2 -2
- package/dist/chunk-LT6HN46T.mjs +0 -5350
- package/dist/rsc.css +0 -338
package/dist/index.js
CHANGED
@@ -181,7 +181,8 @@ __export(core_exports, {
|
|
181
181
|
renderContext: () => renderContext,
|
182
182
|
resolveAllData: () => resolveAllData,
|
183
183
|
transformProps: () => transformProps,
|
184
|
-
usePuck: () => usePuck
|
184
|
+
usePuck: () => usePuck,
|
185
|
+
walkTree: () => walkTree
|
185
186
|
});
|
186
187
|
module.exports = __toCommonJS(core_exports);
|
187
188
|
init_react_import();
|
@@ -308,7 +309,7 @@ init_react_import();
|
|
308
309
|
|
309
310
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
310
311
|
init_react_import();
|
311
|
-
var styles_module_default2 = { "InputWrapper": "
|
312
|
+
var styles_module_default2 = { "InputWrapper": "_InputWrapper_4xor1_1", "Input-label": "_Input-label_4xor1_5", "Input-labelIcon": "_Input-labelIcon_4xor1_14", "Input-disabledIcon": "_Input-disabledIcon_4xor1_21", "Input-input": "_Input-input_4xor1_26", "Input": "_Input_4xor1_1", "Input--readOnly": "_Input--readOnly_4xor1_75", "Input-radioGroupItems": "_Input-radioGroupItems_4xor1_86", "Input-radio": "_Input-radio_4xor1_86", "Input-radioInner": "_Input-radioInner_4xor1_103", "Input-radioInput": "_Input-radioInput_4xor1_148" };
|
312
313
|
|
313
314
|
// components/AutoField/index.tsx
|
314
315
|
var import_react22 = require("react");
|
@@ -794,7 +795,7 @@ init_react_import();
|
|
794
795
|
// reducer/actions/set.ts
|
795
796
|
init_react_import();
|
796
797
|
|
797
|
-
// lib/data/walk-
|
798
|
+
// lib/data/walk-app-state.ts
|
798
799
|
init_react_import();
|
799
800
|
|
800
801
|
// lib/data/for-each-slot.ts
|
@@ -883,8 +884,8 @@ var stripSlots = (data) => {
|
|
883
884
|
});
|
884
885
|
};
|
885
886
|
|
886
|
-
// lib/data/walk-
|
887
|
-
function
|
887
|
+
// lib/data/walk-app-state.ts
|
888
|
+
function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
888
889
|
var _a;
|
889
890
|
let newZones = {};
|
890
891
|
const newZoneIndex = {};
|
@@ -1017,7 +1018,7 @@ var setAction = (state, action, appStore) => {
|
|
1017
1018
|
console.warn(
|
1018
1019
|
"`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
1019
1020
|
);
|
1020
|
-
return
|
1021
|
+
return walkAppState(newState, appStore.config);
|
1021
1022
|
}
|
1022
1023
|
return __spreadValues(__spreadValues({}, state), action.state(state));
|
1023
1024
|
};
|
@@ -1057,7 +1058,7 @@ function insertAction(state, action, appStore) {
|
|
1057
1058
|
};
|
1058
1059
|
const [parentId] = action.destinationZone.split(":");
|
1059
1060
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
1060
|
-
return
|
1061
|
+
return walkAppState(
|
1061
1062
|
state,
|
1062
1063
|
appStore.config,
|
1063
1064
|
(content, zoneCompound) => {
|
@@ -1095,7 +1096,7 @@ var replaceAction = (state, action, appStore) => {
|
|
1095
1096
|
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
1096
1097
|
);
|
1097
1098
|
}
|
1098
|
-
return
|
1099
|
+
return walkAppState(
|
1099
1100
|
state,
|
1100
1101
|
appStore.config,
|
1101
1102
|
(content, zoneCompound) => {
|
@@ -1124,7 +1125,7 @@ var replaceAction = (state, action, appStore) => {
|
|
1124
1125
|
// reducer/actions/replace-root.ts
|
1125
1126
|
init_react_import();
|
1126
1127
|
var replaceRootAction = (state, action, appStore) => {
|
1127
|
-
return
|
1128
|
+
return walkAppState(
|
1128
1129
|
state,
|
1129
1130
|
appStore.config,
|
1130
1131
|
(content) => content,
|
@@ -1163,7 +1164,7 @@ function duplicateAction(state, action, appStore) {
|
|
1163
1164
|
id: generateId(item.type)
|
1164
1165
|
})
|
1165
1166
|
});
|
1166
|
-
const modified =
|
1167
|
+
const modified = walkAppState(
|
1167
1168
|
state,
|
1168
1169
|
appStore.config,
|
1169
1170
|
(content, zoneCompound) => {
|
@@ -1228,7 +1229,7 @@ var moveAction = (state, action, appStore) => {
|
|
1228
1229
|
if (!item) return state;
|
1229
1230
|
const idsInSourcePath = getIdsForParent(action.sourceZone, state);
|
1230
1231
|
const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
|
1231
|
-
return
|
1232
|
+
return walkAppState(
|
1232
1233
|
state,
|
1233
1234
|
appStore.config,
|
1234
1235
|
(content, zoneCompound) => {
|
@@ -1276,7 +1277,6 @@ var reorderAction = (state, action, appStore) => {
|
|
1276
1277
|
init_react_import();
|
1277
1278
|
var removeAction = (state, action, appStore) => {
|
1278
1279
|
const item = getItem({ index: action.index, zone: action.zone }, state);
|
1279
|
-
const [parentId] = action.zone.split(":");
|
1280
1280
|
const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
|
1281
1281
|
(acc, [nodeId, nodeData]) => {
|
1282
1282
|
const pathIds = nodeData.path.map((p) => p.split(":")[0]);
|
@@ -1287,7 +1287,7 @@ var removeAction = (state, action, appStore) => {
|
|
1287
1287
|
},
|
1288
1288
|
[item.props.id]
|
1289
1289
|
);
|
1290
|
-
const newState =
|
1290
|
+
const newState = walkAppState(
|
1291
1291
|
state,
|
1292
1292
|
appStore.config,
|
1293
1293
|
(content, zoneCompound) => {
|
@@ -1295,24 +1295,17 @@ var removeAction = (state, action, appStore) => {
|
|
1295
1295
|
return remove(content, action.index);
|
1296
1296
|
}
|
1297
1297
|
return content;
|
1298
|
-
},
|
1299
|
-
(childItem, path) => {
|
1300
|
-
const parentIds = path.map((p) => p.split(":")[0]);
|
1301
|
-
if (childItem.props.id === parentId || childItem.props.id === item.props.id || parentIds.indexOf(item.props.id) > -1) {
|
1302
|
-
return childItem;
|
1303
|
-
}
|
1304
|
-
return null;
|
1305
1298
|
}
|
1306
1299
|
);
|
1307
1300
|
Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
|
1308
|
-
const
|
1309
|
-
if (nodesToDelete.includes(
|
1301
|
+
const parentId = zoneCompound.split(":")[0];
|
1302
|
+
if (nodesToDelete.includes(parentId) && newState.data.zones) {
|
1310
1303
|
delete newState.data.zones[zoneCompound];
|
1311
1304
|
}
|
1312
1305
|
});
|
1313
1306
|
Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
|
1314
|
-
const
|
1315
|
-
if (nodesToDelete.includes(
|
1307
|
+
const parentId = zoneCompound.split(":")[0];
|
1308
|
+
if (nodesToDelete.includes(parentId)) {
|
1316
1309
|
delete newState.indexes.zones[zoneCompound];
|
1317
1310
|
}
|
1318
1311
|
});
|
@@ -1385,14 +1378,14 @@ var setDataAction = (state, action, appStore) => {
|
|
1385
1378
|
console.warn(
|
1386
1379
|
"`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
1387
1380
|
);
|
1388
|
-
return
|
1381
|
+
return walkAppState(
|
1389
1382
|
__spreadProps(__spreadValues({}, state), {
|
1390
1383
|
data: __spreadValues(__spreadValues({}, state.data), action.data)
|
1391
1384
|
}),
|
1392
1385
|
appStore.config
|
1393
1386
|
);
|
1394
1387
|
}
|
1395
|
-
return
|
1388
|
+
return walkAppState(
|
1396
1389
|
__spreadProps(__spreadValues({}, state), {
|
1397
1390
|
data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
|
1398
1391
|
}),
|
@@ -1696,7 +1689,7 @@ var createHistorySlice = (set, get) => {
|
|
1696
1689
|
const { dispatch, history } = get();
|
1697
1690
|
dispatch({
|
1698
1691
|
type: "set",
|
1699
|
-
state: ((_a = history.histories[
|
1692
|
+
state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
|
1700
1693
|
});
|
1701
1694
|
set({ history: __spreadProps(__spreadValues({}, history), { index }) });
|
1702
1695
|
},
|
@@ -1777,7 +1770,7 @@ var import_react7 = require("react");
|
|
1777
1770
|
init_react_import();
|
1778
1771
|
var flattenData = (state, config) => {
|
1779
1772
|
const data = [];
|
1780
|
-
|
1773
|
+
walkAppState(
|
1781
1774
|
state,
|
1782
1775
|
config,
|
1783
1776
|
(content) => content,
|
@@ -2016,7 +2009,7 @@ init_react_import();
|
|
2016
2009
|
|
2017
2010
|
// lib/data/map-slots.ts
|
2018
2011
|
init_react_import();
|
2019
|
-
function
|
2012
|
+
function mapSlotsAsync(_0, _1) {
|
2020
2013
|
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
2021
2014
|
const props = __spreadValues({}, item.props);
|
2022
2015
|
const propKeys = Object.keys(props);
|
@@ -2027,7 +2020,7 @@ function mapSlots(_0, _1) {
|
|
2027
2020
|
const content = props[propKey];
|
2028
2021
|
const mappedContent = recursive ? yield Promise.all(
|
2029
2022
|
content.map((item2) => __async(this, null, function* () {
|
2030
|
-
return yield
|
2023
|
+
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
2031
2024
|
}))
|
2032
2025
|
) : content;
|
2033
2026
|
props[propKey] = yield map(mappedContent, propKey);
|
@@ -2036,6 +2029,23 @@ function mapSlots(_0, _1) {
|
|
2036
2029
|
return __spreadProps(__spreadValues({}, item), { props });
|
2037
2030
|
});
|
2038
2031
|
}
|
2032
|
+
function mapSlotsSync(item, map, isSlot2 = isSlot) {
|
2033
|
+
var _a, _b;
|
2034
|
+
const props = __spreadValues({}, item.props);
|
2035
|
+
const propKeys = Object.keys(props);
|
2036
|
+
for (let i = 0; i < propKeys.length; i++) {
|
2037
|
+
const propKey = propKeys[i];
|
2038
|
+
const itemType = "type" in item ? item.type : "root";
|
2039
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
2040
|
+
const content = props[propKey];
|
2041
|
+
const mappedContent = content.map((item2) => {
|
2042
|
+
return mapSlotsSync(item2, map, isSlot2);
|
2043
|
+
});
|
2044
|
+
props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
|
2045
|
+
}
|
2046
|
+
}
|
2047
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
2048
|
+
}
|
2039
2049
|
|
2040
2050
|
// lib/resolve-component-data.ts
|
2041
2051
|
var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
|
@@ -2055,14 +2065,14 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
2055
2065
|
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
2056
2066
|
changed,
|
2057
2067
|
lastData: oldItem,
|
2058
|
-
metadata,
|
2068
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
2059
2069
|
trigger
|
2060
2070
|
});
|
2061
2071
|
let resolvedItem = __spreadProps(__spreadValues({}, item), {
|
2062
2072
|
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
2063
2073
|
});
|
2064
2074
|
if (recursive) {
|
2065
|
-
resolvedItem = yield
|
2075
|
+
resolvedItem = yield mapSlotsAsync(
|
2066
2076
|
resolvedItem,
|
2067
2077
|
(content) => __async(void 0, null, function* () {
|
2068
2078
|
return Promise.all(
|
@@ -2282,7 +2292,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
|
|
2282
2292
|
}),
|
2283
2293
|
resolveAndCommitData: () => __async(void 0, null, function* () {
|
2284
2294
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
2285
|
-
|
2295
|
+
walkAppState(
|
2286
2296
|
state,
|
2287
2297
|
config,
|
2288
2298
|
(content) => content,
|
@@ -4411,7 +4421,7 @@ var import_react25 = require("react");
|
|
4411
4421
|
|
4412
4422
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
4413
4423
|
init_react_import();
|
4414
|
-
var styles_module_default11 = { "DraggableComponent": "
|
4424
|
+
var styles_module_default11 = { "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" };
|
4415
4425
|
|
4416
4426
|
// components/DraggableComponent/index.tsx
|
4417
4427
|
var import_react_dom2 = require("react-dom");
|
@@ -5102,7 +5112,7 @@ init_react_import();
|
|
5102
5112
|
// lib/use-slots.tsx
|
5103
5113
|
init_react_import();
|
5104
5114
|
var import_react31 = require("react");
|
5105
|
-
function useSlots(config, props,
|
5115
|
+
function useSlots(config, props, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
5106
5116
|
const slotProps = (0, import_react31.useMemo)(() => {
|
5107
5117
|
if (!(config == null ? void 0 : config.fields)) return props;
|
5108
5118
|
const slotProps2 = {};
|
@@ -5112,7 +5122,11 @@ function useSlots(config, props, renderSlot) {
|
|
5112
5122
|
const field = config.fields[fieldKey];
|
5113
5123
|
if ((field == null ? void 0 : field.type) === "slot") {
|
5114
5124
|
const content = props[fieldKey] || [];
|
5115
|
-
const
|
5125
|
+
const render = (readOnly == null ? void 0 : readOnly[fieldKey]) || forceReadOnly ? renderSlotRender : renderSlotEdit;
|
5126
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
5127
|
+
allow: field.allow,
|
5128
|
+
disallow: field.disallow
|
5129
|
+
}, dzProps), {
|
5116
5130
|
zone: fieldKey,
|
5117
5131
|
content
|
5118
5132
|
}));
|
@@ -5120,7 +5134,7 @@ function useSlots(config, props, renderSlot) {
|
|
5120
5134
|
}
|
5121
5135
|
}
|
5122
5136
|
return slotProps2;
|
5123
|
-
}, [config]);
|
5137
|
+
}, [config, readOnly, forceReadOnly]);
|
5124
5138
|
return __spreadValues(__spreadValues({}, props), slotProps);
|
5125
5139
|
}
|
5126
5140
|
|
@@ -5129,39 +5143,121 @@ var import_react33 = __toESM(require("react"));
|
|
5129
5143
|
|
5130
5144
|
// components/SlotRender/index.tsx
|
5131
5145
|
init_react_import();
|
5146
|
+
|
5147
|
+
// components/SlotRender/server.tsx
|
5148
|
+
init_react_import();
|
5132
5149
|
var import_react32 = require("react");
|
5150
|
+
|
5151
|
+
// components/ServerRender/index.tsx
|
5152
|
+
init_react_import();
|
5133
5153
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
5134
|
-
|
5135
|
-
|
5136
|
-
|
5137
|
-
|
5138
|
-
|
5139
|
-
|
5140
|
-
|
5141
|
-
|
5142
|
-
|
5154
|
+
function DropZoneRender({
|
5155
|
+
zone,
|
5156
|
+
data,
|
5157
|
+
areaId = "root",
|
5158
|
+
config,
|
5159
|
+
metadata = {}
|
5160
|
+
}) {
|
5161
|
+
let zoneCompound = rootDroppableId;
|
5162
|
+
let content = (data == null ? void 0 : data.content) || [];
|
5163
|
+
if (!data || !config) {
|
5164
|
+
return null;
|
5165
|
+
}
|
5166
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
5167
|
+
zoneCompound = `${areaId}:${zone}`;
|
5168
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
5169
|
+
}
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: content.map((item) => {
|
5171
|
+
const Component = config.components[item.type];
|
5172
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
5173
|
+
puck: {
|
5174
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
5175
|
+
DropZoneRender,
|
5176
|
+
{
|
5177
|
+
zone: zone2,
|
5178
|
+
data,
|
5179
|
+
areaId: item.props.id,
|
5143
5180
|
config,
|
5144
5181
|
metadata
|
5145
|
-
}
|
5146
|
-
)
|
5147
|
-
|
5148
|
-
Component.render,
|
5149
|
-
__spreadProps(__spreadValues({}, props), {
|
5150
|
-
puck: {
|
5151
|
-
renderDropZone: DropZoneRenderPure,
|
5152
|
-
metadata: metadata || {}
|
5153
|
-
}
|
5154
|
-
}),
|
5155
|
-
props.id
|
5156
|
-
);
|
5182
|
+
}
|
5183
|
+
),
|
5184
|
+
metadata
|
5157
5185
|
}
|
5158
|
-
|
5186
|
+
});
|
5187
|
+
const propsWithSlots = useSlots(Component, props, (props2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
5188
|
+
if (Component) {
|
5189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component.render, __spreadValues({}, propsWithSlots), item.props.id);
|
5190
|
+
}
|
5191
|
+
return null;
|
5192
|
+
}) });
|
5193
|
+
}
|
5194
|
+
|
5195
|
+
// components/SlotRender/server.tsx
|
5196
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
5197
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRender, __spreadValues({}, props));
|
5198
|
+
var Item = ({
|
5199
|
+
config,
|
5200
|
+
item,
|
5201
|
+
metadata
|
5202
|
+
}) => {
|
5203
|
+
const Component = config.components[item.type];
|
5204
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
5205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
5206
|
+
Component.render,
|
5207
|
+
__spreadProps(__spreadValues({}, props), {
|
5208
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
5209
|
+
renderDropZone: DropZoneRender,
|
5210
|
+
metadata: metadata || {}
|
5211
|
+
})
|
5212
|
+
})
|
5213
|
+
);
|
5214
|
+
};
|
5215
|
+
var SlotRender = (0, import_react32.forwardRef)(
|
5216
|
+
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
5217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
|
5218
|
+
if (!config.components[item.type]) {
|
5219
|
+
return null;
|
5220
|
+
}
|
5221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
5222
|
+
Item,
|
5223
|
+
{
|
5224
|
+
config,
|
5225
|
+
item,
|
5226
|
+
metadata
|
5227
|
+
},
|
5228
|
+
item.props.id
|
5229
|
+
);
|
5159
5230
|
}) });
|
5160
5231
|
}
|
5161
5232
|
);
|
5162
5233
|
|
5234
|
+
// components/SlotRender/index.tsx
|
5235
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
5236
|
+
var ContextSlotRender = ({
|
5237
|
+
componentId,
|
5238
|
+
zone
|
5239
|
+
}) => {
|
5240
|
+
const config = useAppStore((s) => s.config);
|
5241
|
+
const metadata = useAppStore((s) => s.metadata);
|
5242
|
+
const slotContent = useAppStore(
|
5243
|
+
(s) => {
|
5244
|
+
var _a, _b;
|
5245
|
+
return (_b = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.props[zone]) != null ? _b : null;
|
5246
|
+
}
|
5247
|
+
);
|
5248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
5249
|
+
SlotRenderPure,
|
5250
|
+
{
|
5251
|
+
content: slotContent,
|
5252
|
+
zone,
|
5253
|
+
config,
|
5254
|
+
metadata
|
5255
|
+
}
|
5256
|
+
);
|
5257
|
+
};
|
5258
|
+
|
5163
5259
|
// components/Render/index.tsx
|
5164
|
-
var
|
5260
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
5165
5261
|
var renderContext = import_react33.default.createContext({
|
5166
5262
|
config: { components: {} },
|
5167
5263
|
data: { root: {}, content: [] },
|
@@ -5190,7 +5286,7 @@ function Render({
|
|
5190
5286
|
editMode: false,
|
5191
5287
|
id: "puck-root"
|
5192
5288
|
});
|
5193
|
-
const propsWithSlots = useSlots(config.root, pageProps, (props) => /* @__PURE__ */ (0,
|
5289
|
+
const propsWithSlots = useSlots(config.root, pageProps, (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata })));
|
5194
5290
|
const nextContextValue = (0, import_react33.useMemo)(
|
5195
5291
|
() => ({
|
5196
5292
|
mode: "render",
|
@@ -5199,17 +5295,17 @@ function Render({
|
|
5199
5295
|
[]
|
5200
5296
|
);
|
5201
5297
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5202
|
-
return /* @__PURE__ */ (0,
|
5298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
5203
5299
|
}
|
5204
|
-
return /* @__PURE__ */ (0,
|
5300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
5205
5301
|
}
|
5206
5302
|
|
5207
5303
|
// components/DropZone/index.tsx
|
5208
|
-
var
|
5304
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
5209
5305
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
|
5210
5306
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
5211
5307
|
var RENDER_DEBUG = false;
|
5212
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */ (0,
|
5308
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
|
5213
5309
|
var DropZoneChild = ({
|
5214
5310
|
zoneCompound,
|
5215
5311
|
componentId,
|
@@ -5222,12 +5318,6 @@ var DropZoneChild = ({
|
|
5222
5318
|
}) => {
|
5223
5319
|
var _a, _b;
|
5224
5320
|
const metadata = useAppStore((s) => s.metadata);
|
5225
|
-
const puckProps = {
|
5226
|
-
renderDropZone: DropZoneEditPure,
|
5227
|
-
isEditing: true,
|
5228
|
-
dragRef: null,
|
5229
|
-
metadata
|
5230
|
-
};
|
5231
5321
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
5232
5322
|
const { depth = 1 } = ctx != null ? ctx : {};
|
5233
5323
|
const nodeProps = useAppStore(
|
@@ -5242,11 +5332,23 @@ var DropZoneChild = ({
|
|
5242
5332
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.type;
|
5243
5333
|
}
|
5244
5334
|
);
|
5335
|
+
const nodeReadOnly = useAppStore(
|
5336
|
+
(0, import_shallow3.useShallow)((s) => {
|
5337
|
+
var _a2;
|
5338
|
+
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
5339
|
+
})
|
5340
|
+
);
|
5245
5341
|
const node = { type: nodeType, props: nodeProps };
|
5246
5342
|
const item = nodeProps ? node : (preview == null ? void 0 : preview.componentType) ? { type: preview.componentType, props: preview.props } : null;
|
5247
5343
|
const componentConfig = useAppStore(
|
5248
5344
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
5249
5345
|
);
|
5346
|
+
const puckProps = {
|
5347
|
+
renderDropZone: DropZoneEditPure,
|
5348
|
+
isEditing: true,
|
5349
|
+
dragRef: null,
|
5350
|
+
metadata: __spreadValues(__spreadValues({}, metadata), componentConfig == null ? void 0 : componentConfig.metadata)
|
5351
|
+
};
|
5250
5352
|
const overrides = useAppStore((s) => s.overrides);
|
5251
5353
|
const isLoading = useAppStore(
|
5252
5354
|
(s) => {
|
@@ -5263,7 +5365,7 @@ var DropZoneChild = ({
|
|
5263
5365
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
5264
5366
|
const renderPreview = (0, import_react34.useMemo)(
|
5265
5367
|
() => function Preview4() {
|
5266
|
-
return /* @__PURE__ */ (0,
|
5368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
|
5267
5369
|
},
|
5268
5370
|
[componentId, label, overrides]
|
5269
5371
|
);
|
@@ -5278,10 +5380,13 @@ var DropZoneChild = ({
|
|
5278
5380
|
const defaultedPropsWithSlots = useSlots(
|
5279
5381
|
componentConfig,
|
5280
5382
|
defaultsProps,
|
5281
|
-
DropZoneEditPure
|
5383
|
+
DropZoneEditPure,
|
5384
|
+
(slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
|
5385
|
+
nodeReadOnly,
|
5386
|
+
isLoading
|
5282
5387
|
);
|
5283
5388
|
if (!item) return;
|
5284
|
-
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0,
|
5389
|
+
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
5285
5390
|
"No configuration for ",
|
5286
5391
|
item.type
|
5287
5392
|
] });
|
@@ -5290,7 +5395,7 @@ var DropZoneChild = ({
|
|
5290
5395
|
if (isPreview) {
|
5291
5396
|
Render2 = renderPreview;
|
5292
5397
|
}
|
5293
|
-
return /* @__PURE__ */ (0,
|
5398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5294
5399
|
DraggableComponent,
|
5295
5400
|
{
|
5296
5401
|
id: componentId,
|
@@ -5305,14 +5410,14 @@ var DropZoneChild = ({
|
|
5305
5410
|
autoDragAxis: dragAxis,
|
5306
5411
|
userDragAxis: collisionAxis,
|
5307
5412
|
inDroppableZone,
|
5308
|
-
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isPreview ? /* @__PURE__ */ (0,
|
5413
|
+
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isPreview ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5309
5414
|
Render2,
|
5310
5415
|
__spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
|
5311
5416
|
puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
|
5312
5417
|
dragRef
|
5313
5418
|
})
|
5314
5419
|
})
|
5315
|
-
) }) : /* @__PURE__ */ (0,
|
5420
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
|
5316
5421
|
}
|
5317
5422
|
);
|
5318
5423
|
};
|
@@ -5376,6 +5481,11 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5376
5481
|
);
|
5377
5482
|
(0, import_react34.useEffect)(() => {
|
5378
5483
|
if (!zoneType || zoneType === "dropzone") {
|
5484
|
+
if (zoneCompound !== rootDroppableId) {
|
5485
|
+
console.warn(
|
5486
|
+
"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"
|
5487
|
+
);
|
5488
|
+
}
|
5379
5489
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
5380
5490
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
5381
5491
|
}
|
@@ -5458,7 +5568,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5458
5568
|
userMinEmptyHeight,
|
5459
5569
|
ref
|
5460
5570
|
});
|
5461
|
-
return /* @__PURE__ */ (0,
|
5571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5462
5572
|
"div",
|
5463
5573
|
{
|
5464
5574
|
className: `${getClassName17({
|
@@ -5480,7 +5590,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5480
5590
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
5481
5591
|
}),
|
5482
5592
|
children: contentIdsWithPreview.map((componentId, i) => {
|
5483
|
-
return /* @__PURE__ */ (0,
|
5593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5484
5594
|
DropZoneChildMemo,
|
5485
5595
|
{
|
5486
5596
|
zoneCompound,
|
@@ -5499,8 +5609,32 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5499
5609
|
);
|
5500
5610
|
}
|
5501
5611
|
);
|
5502
|
-
var
|
5503
|
-
|
5612
|
+
var DropZoneRenderItem = ({
|
5613
|
+
config,
|
5614
|
+
item,
|
5615
|
+
metadata
|
5616
|
+
}) => {
|
5617
|
+
const Component = config.components[item.type];
|
5618
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
5619
|
+
const nextContextValue = (0, import_react34.useMemo)(
|
5620
|
+
() => ({
|
5621
|
+
areaId: props.id,
|
5622
|
+
depth: 1
|
5623
|
+
}),
|
5624
|
+
[props]
|
5625
|
+
);
|
5626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5627
|
+
Component.render,
|
5628
|
+
__spreadProps(__spreadValues({}, props), {
|
5629
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
5630
|
+
renderDropZone: DropZoneRenderPure,
|
5631
|
+
metadata: __spreadValues(__spreadValues({}, metadata), Component.metadata)
|
5632
|
+
})
|
5633
|
+
})
|
5634
|
+
) }, props.id);
|
5635
|
+
};
|
5636
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadValues({}, props));
|
5637
|
+
var DropZoneRender2 = (0, import_react34.forwardRef)(
|
5504
5638
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
5505
5639
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
5506
5640
|
const { areaId = "root" } = ctx || {};
|
@@ -5526,45 +5660,31 @@ var DropZoneRender = (0, import_react34.forwardRef)(
|
|
5526
5660
|
zoneCompound = `${areaId}:${zone}`;
|
5527
5661
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
5528
5662
|
}
|
5529
|
-
return /* @__PURE__ */ (0,
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
|
5530
5664
|
const Component = config.components[item.type];
|
5531
5665
|
if (Component) {
|
5532
|
-
|
5533
|
-
|
5534
|
-
|
5666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5667
|
+
DropZoneRenderItem,
|
5668
|
+
{
|
5535
5669
|
config,
|
5670
|
+
item,
|
5536
5671
|
metadata
|
5537
|
-
}
|
5538
|
-
|
5539
|
-
const nextContextValue = (0, import_react34.useMemo)(
|
5540
|
-
() => ({
|
5541
|
-
areaId: props.id,
|
5542
|
-
depth: 1
|
5543
|
-
}),
|
5544
|
-
[props]
|
5672
|
+
},
|
5673
|
+
item.props.id
|
5545
5674
|
);
|
5546
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
5547
|
-
Component.render,
|
5548
|
-
__spreadProps(__spreadValues({}, props), {
|
5549
|
-
puck: {
|
5550
|
-
renderDropZone: DropZoneRenderPure,
|
5551
|
-
metadata: metadata || {}
|
5552
|
-
}
|
5553
|
-
})
|
5554
|
-
) }, props.id);
|
5555
5675
|
}
|
5556
5676
|
return null;
|
5557
5677
|
}) });
|
5558
5678
|
}
|
5559
5679
|
);
|
5560
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
5680
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, __spreadValues({}, props));
|
5561
5681
|
var DropZone = (0, import_react34.forwardRef)(
|
5562
5682
|
function DropZone2(props, ref) {
|
5563
5683
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
5564
5684
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
5565
|
-
return /* @__PURE__ */ (0,
|
5685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
5566
5686
|
}
|
5567
|
-
return /* @__PURE__ */ (0,
|
5687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
|
5568
5688
|
}
|
5569
5689
|
);
|
5570
5690
|
|
@@ -5620,7 +5740,7 @@ var GlobalPosition = class {
|
|
5620
5740
|
var _a;
|
5621
5741
|
this.target = target;
|
5622
5742
|
this.original = original;
|
5623
|
-
this.frameEl = document.querySelector("
|
5743
|
+
this.frameEl = document.querySelector("#preview-frame");
|
5624
5744
|
if (this.frameEl) {
|
5625
5745
|
this.frameRect = this.frameEl.getBoundingClientRect();
|
5626
5746
|
this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
|
@@ -5882,7 +6002,7 @@ function getDeepDir(el) {
|
|
5882
6002
|
}
|
5883
6003
|
|
5884
6004
|
// components/DragDropContext/index.tsx
|
5885
|
-
var
|
6005
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
5886
6006
|
var DEBUG3 = false;
|
5887
6007
|
var dragListenerContext = (0, import_react36.createContext)({
|
5888
6008
|
dragListeners: {}
|
@@ -6049,14 +6169,14 @@ var DragDropContextClient = ({
|
|
6049
6169
|
}),
|
6050
6170
|
[]
|
6051
6171
|
);
|
6052
|
-
return /* @__PURE__ */ (0,
|
6172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6053
6173
|
dragListenerContext.Provider,
|
6054
6174
|
{
|
6055
6175
|
value: {
|
6056
6176
|
dragListeners,
|
6057
6177
|
setDragListeners
|
6058
6178
|
},
|
6059
|
-
children: /* @__PURE__ */ (0,
|
6179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6060
6180
|
import_react35.DragDropProvider,
|
6061
6181
|
{
|
6062
6182
|
plugins,
|
@@ -6090,7 +6210,6 @@ var DragDropContextClient = ({
|
|
6090
6210
|
}
|
6091
6211
|
if (thisPreview) {
|
6092
6212
|
zoneStore.setState({ previewIndex: {} });
|
6093
|
-
const state = appStore.getState().state;
|
6094
6213
|
if (thisPreview.type === "insert") {
|
6095
6214
|
insertComponent(
|
6096
6215
|
thisPreview.componentType,
|
@@ -6247,7 +6366,7 @@ var DragDropContextClient = ({
|
|
6247
6366
|
initialSelector.current = void 0;
|
6248
6367
|
zoneStore.setState({ draggedItem: event.operation.source });
|
6249
6368
|
},
|
6250
|
-
children: /* @__PURE__ */ (0,
|
6369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
6251
6370
|
}
|
6252
6371
|
)
|
6253
6372
|
}
|
@@ -6261,11 +6380,11 @@ var DragDropContext = ({
|
|
6261
6380
|
if (status === "LOADING") {
|
6262
6381
|
return children;
|
6263
6382
|
}
|
6264
|
-
return /* @__PURE__ */ (0,
|
6383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
6265
6384
|
};
|
6266
6385
|
|
6267
6386
|
// components/Drawer/index.tsx
|
6268
|
-
var
|
6387
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
6269
6388
|
var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
|
6270
6389
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
6271
6390
|
var DrawerItemInner = ({
|
@@ -6276,10 +6395,10 @@ var DrawerItemInner = ({
|
|
6276
6395
|
isDragDisabled
|
6277
6396
|
}) => {
|
6278
6397
|
const CustomInner = (0, import_react37.useMemo)(
|
6279
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
6398
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
6280
6399
|
[children]
|
6281
6400
|
);
|
6282
|
-
return /* @__PURE__ */ (0,
|
6401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6283
6402
|
"div",
|
6284
6403
|
{
|
6285
6404
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
@@ -6287,9 +6406,9 @@ var DrawerItemInner = ({
|
|
6287
6406
|
onMouseDown: (e) => e.preventDefault(),
|
6288
6407
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
6289
6408
|
"data-puck-drawer-item": true,
|
6290
|
-
children: /* @__PURE__ */ (0,
|
6291
|
-
/* @__PURE__ */ (0,
|
6292
|
-
/* @__PURE__ */ (0,
|
6409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
6410
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
6411
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DragIcon, {}) })
|
6293
6412
|
] }) }) })
|
6294
6413
|
}
|
6295
6414
|
);
|
@@ -6306,9 +6425,9 @@ var DrawerItemDraggable = ({
|
|
6306
6425
|
data: { type: "drawer", componentType: name },
|
6307
6426
|
disabled: isDragDisabled
|
6308
6427
|
});
|
6309
|
-
return /* @__PURE__ */ (0,
|
6310
|
-
/* @__PURE__ */ (0,
|
6311
|
-
/* @__PURE__ */ (0,
|
6428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName18("draggable"), children: [
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name, label, children }) }),
|
6430
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6312
6431
|
DrawerItemInner,
|
6313
6432
|
{
|
6314
6433
|
name,
|
@@ -6342,7 +6461,7 @@ var DrawerItem = ({
|
|
6342
6461
|
},
|
6343
6462
|
[resolvedId]
|
6344
6463
|
);
|
6345
|
-
return /* @__PURE__ */ (0,
|
6464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6346
6465
|
DrawerItemDraggable,
|
6347
6466
|
{
|
6348
6467
|
name,
|
@@ -6375,7 +6494,7 @@ var Drawer = ({
|
|
6375
6494
|
collisionPriority: 0
|
6376
6495
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
6377
6496
|
});
|
6378
|
-
return /* @__PURE__ */ (0,
|
6497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6379
6498
|
"div",
|
6380
6499
|
{
|
6381
6500
|
className: getClassName18(),
|
@@ -6444,7 +6563,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
6444
6563
|
};
|
6445
6564
|
|
6446
6565
|
// components/SidebarSection/index.tsx
|
6447
|
-
var
|
6566
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
6448
6567
|
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
6449
6568
|
var SidebarSection = ({
|
6450
6569
|
children,
|
@@ -6457,15 +6576,15 @@ var SidebarSection = ({
|
|
6457
6576
|
}) => {
|
6458
6577
|
const setUi = useAppStore((s) => s.setUi);
|
6459
6578
|
const breadcrumbs = useBreadcrumbs(1);
|
6460
|
-
return /* @__PURE__ */ (0,
|
6579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
6461
6580
|
"div",
|
6462
6581
|
{
|
6463
6582
|
className: getClassName19({ noBorderTop, noPadding }),
|
6464
6583
|
style: { background },
|
6465
6584
|
children: [
|
6466
|
-
/* @__PURE__ */ (0,
|
6467
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
6468
|
-
/* @__PURE__ */ (0,
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
6586
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
6587
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6469
6588
|
"button",
|
6470
6589
|
{
|
6471
6590
|
type: "button",
|
@@ -6474,12 +6593,12 @@ var SidebarSection = ({
|
|
6474
6593
|
children: breadcrumb.label
|
6475
6594
|
}
|
6476
6595
|
),
|
6477
|
-
/* @__PURE__ */ (0,
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
|
6478
6597
|
] }, i)) : null,
|
6479
|
-
/* @__PURE__ */ (0,
|
6598
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
6480
6599
|
] }) }),
|
6481
|
-
/* @__PURE__ */ (0,
|
6482
|
-
isLoading && /* @__PURE__ */ (0,
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
|
6601
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
|
6483
6602
|
]
|
6484
6603
|
}
|
6485
6604
|
);
|
@@ -6493,7 +6612,7 @@ init_react_import();
|
|
6493
6612
|
var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
6494
6613
|
|
6495
6614
|
// components/MenuBar/index.tsx
|
6496
|
-
var
|
6615
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
6497
6616
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
6498
6617
|
function MenuBar({
|
6499
6618
|
menuOpen = false,
|
@@ -6504,7 +6623,7 @@ function MenuBar({
|
|
6504
6623
|
const forward = useAppStore((s) => s.history.forward);
|
6505
6624
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
6506
6625
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
6507
|
-
return /* @__PURE__ */ (0,
|
6626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
6508
6627
|
"div",
|
6509
6628
|
{
|
6510
6629
|
className: getClassName20({ menuOpen }),
|
@@ -6518,12 +6637,12 @@ function MenuBar({
|
|
6518
6637
|
setMenuOpen(false);
|
6519
6638
|
}
|
6520
6639
|
},
|
6521
|
-
children: /* @__PURE__ */ (0,
|
6522
|
-
/* @__PURE__ */ (0,
|
6523
|
-
/* @__PURE__ */ (0,
|
6524
|
-
/* @__PURE__ */ (0,
|
6640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName20("inner"), children: [
|
6641
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName20("history"), children: [
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Undo2, { size: 21 }) }),
|
6643
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Redo2, { size: 21 }) })
|
6525
6644
|
] }),
|
6526
|
-
/* @__PURE__ */ (0,
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
6527
6646
|
] })
|
6528
6647
|
}
|
6529
6648
|
);
|
@@ -6543,12 +6662,12 @@ var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
6543
6662
|
// components/Puck/components/Fields/index.tsx
|
6544
6663
|
var import_react39 = require("react");
|
6545
6664
|
var import_shallow4 = require("zustand/react/shallow");
|
6546
|
-
var
|
6665
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
6547
6666
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
6548
6667
|
var DefaultFields = ({
|
6549
6668
|
children
|
6550
6669
|
}) => {
|
6551
|
-
return /* @__PURE__ */ (0,
|
6670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
6552
6671
|
};
|
6553
6672
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
|
6554
6673
|
let currentProps;
|
@@ -6619,7 +6738,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
6619
6738
|
]);
|
6620
6739
|
if (!field || !id) return null;
|
6621
6740
|
if (field.type === "slot") return null;
|
6622
|
-
return /* @__PURE__ */ (0,
|
6741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
6623
6742
|
AutoFieldPrivate,
|
6624
6743
|
{
|
6625
6744
|
field,
|
@@ -6651,7 +6770,7 @@ var Fields = ({ wrapFields = true }) => {
|
|
6651
6770
|
);
|
6652
6771
|
const isLoading = fieldsLoading || componentResolving;
|
6653
6772
|
const Wrapper = (0, import_react39.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
6654
|
-
return /* @__PURE__ */ (0,
|
6773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
6655
6774
|
"form",
|
6656
6775
|
{
|
6657
6776
|
className: getClassName21({ wrapFields }),
|
@@ -6659,8 +6778,8 @@ var Fields = ({ wrapFields = true }) => {
|
|
6659
6778
|
e.preventDefault();
|
6660
6779
|
},
|
6661
6780
|
children: [
|
6662
|
-
/* @__PURE__ */ (0,
|
6663
|
-
isLoading && /* @__PURE__ */ (0,
|
6781
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldsChild, { fieldName }, fieldName)) }),
|
6782
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Loader, { size: 16 }) }) })
|
6664
6783
|
]
|
6665
6784
|
}
|
6666
6785
|
);
|
@@ -6681,7 +6800,7 @@ init_react_import();
|
|
6681
6800
|
var styles_module_default17 = { "ComponentList": "_ComponentList_1rrlt_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1rrlt_5", "ComponentList-content": "_ComponentList-content_1rrlt_9", "ComponentList-title": "_ComponentList-title_1rrlt_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1rrlt_53" };
|
6682
6801
|
|
6683
6802
|
// components/ComponentList/index.tsx
|
6684
|
-
var
|
6803
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
6685
6804
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
6686
6805
|
var ComponentListItem = ({
|
6687
6806
|
name,
|
@@ -6693,7 +6812,7 @@ var ComponentListItem = ({
|
|
6693
6812
|
type: name
|
6694
6813
|
}).insert
|
6695
6814
|
);
|
6696
|
-
return /* @__PURE__ */ (0,
|
6815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
6697
6816
|
};
|
6698
6817
|
var ComponentList = ({
|
6699
6818
|
children,
|
@@ -6704,8 +6823,8 @@ var ComponentList = ({
|
|
6704
6823
|
const setUi = useAppStore((s) => s.setUi);
|
6705
6824
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
6706
6825
|
const { expanded = true } = componentList[id] || {};
|
6707
|
-
return /* @__PURE__ */ (0,
|
6708
|
-
title && /* @__PURE__ */ (0,
|
6826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
|
6827
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
6709
6828
|
"button",
|
6710
6829
|
{
|
6711
6830
|
type: "button",
|
@@ -6719,14 +6838,14 @@ var ComponentList = ({
|
|
6719
6838
|
}),
|
6720
6839
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
6721
6840
|
children: [
|
6722
|
-
/* @__PURE__ */ (0,
|
6723
|
-
/* @__PURE__ */ (0,
|
6841
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: title }),
|
6842
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: 12 }) })
|
6724
6843
|
]
|
6725
6844
|
}
|
6726
6845
|
),
|
6727
|
-
/* @__PURE__ */ (0,
|
6846
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
6728
6847
|
var _a;
|
6729
|
-
return /* @__PURE__ */ (0,
|
6848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
6730
6849
|
ComponentListItem,
|
6731
6850
|
{
|
6732
6851
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -6740,7 +6859,7 @@ var ComponentList = ({
|
|
6740
6859
|
ComponentList.Item = ComponentListItem;
|
6741
6860
|
|
6742
6861
|
// lib/use-component-list.tsx
|
6743
|
-
var
|
6862
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
6744
6863
|
var useComponentList = () => {
|
6745
6864
|
const [componentList, setComponentList] = (0, import_react40.useState)();
|
6746
6865
|
const config = useAppStore((s) => s.config);
|
@@ -6755,7 +6874,7 @@ var useComponentList = () => {
|
|
6755
6874
|
if (category.visible === false || !category.components) {
|
6756
6875
|
return null;
|
6757
6876
|
}
|
6758
|
-
return /* @__PURE__ */ (0,
|
6877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6759
6878
|
ComponentList,
|
6760
6879
|
{
|
6761
6880
|
id: categoryKey,
|
@@ -6764,7 +6883,7 @@ var useComponentList = () => {
|
|
6764
6883
|
var _a2;
|
6765
6884
|
matchedComponents.push(componentName);
|
6766
6885
|
const componentConf = config.components[componentName] || {};
|
6767
|
-
return /* @__PURE__ */ (0,
|
6886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6768
6887
|
ComponentList.Item,
|
6769
6888
|
{
|
6770
6889
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -6784,7 +6903,7 @@ var useComponentList = () => {
|
|
6784
6903
|
);
|
6785
6904
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
6786
6905
|
_componentList.push(
|
6787
|
-
/* @__PURE__ */ (0,
|
6906
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6788
6907
|
ComponentList,
|
6789
6908
|
{
|
6790
6909
|
id: "other",
|
@@ -6792,7 +6911,7 @@ var useComponentList = () => {
|
|
6792
6911
|
children: remainingComponents.map((componentName, i) => {
|
6793
6912
|
var _a2;
|
6794
6913
|
const componentConf = config.components[componentName] || {};
|
6795
|
-
return /* @__PURE__ */ (0,
|
6914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6796
6915
|
ComponentList.Item,
|
6797
6916
|
{
|
6798
6917
|
name: componentName,
|
@@ -6815,12 +6934,12 @@ var useComponentList = () => {
|
|
6815
6934
|
|
6816
6935
|
// components/Puck/components/Components/index.tsx
|
6817
6936
|
var import_react41 = require("react");
|
6818
|
-
var
|
6937
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
6819
6938
|
var Components = () => {
|
6820
6939
|
const overrides = useAppStore((s) => s.overrides);
|
6821
6940
|
const componentList = useComponentList();
|
6822
6941
|
const Wrapper = (0, import_react41.useMemo)(() => overrides.components || "div", [overrides]);
|
6823
|
-
return /* @__PURE__ */ (0,
|
6942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComponentList, { id: "all" }) });
|
6824
6943
|
};
|
6825
6944
|
|
6826
6945
|
// components/Puck/components/Preview/index.tsx
|
@@ -6832,7 +6951,7 @@ init_react_import();
|
|
6832
6951
|
var import_react42 = require("react");
|
6833
6952
|
var import_object_hash = __toESM(require("object-hash"));
|
6834
6953
|
var import_react_dom3 = require("react-dom");
|
6835
|
-
var
|
6954
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
6836
6955
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
6837
6956
|
var collectStyles = (doc) => {
|
6838
6957
|
const collected = [];
|
@@ -7032,7 +7151,7 @@ var CopyHostStyles = ({
|
|
7032
7151
|
observer.disconnect();
|
7033
7152
|
};
|
7034
7153
|
}, []);
|
7035
|
-
return /* @__PURE__ */ (0,
|
7154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
7036
7155
|
};
|
7037
7156
|
var autoFrameContext = (0, import_react42.createContext)({});
|
7038
7157
|
var useFrame = () => (0, import_react42.useContext)(autoFrameContext);
|
@@ -7079,7 +7198,7 @@ function AutoFrame(_a) {
|
|
7079
7198
|
}
|
7080
7199
|
}
|
7081
7200
|
}, [frameRef, loaded, stylesLoaded]);
|
7082
|
-
return /* @__PURE__ */ (0,
|
7201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7083
7202
|
"iframe",
|
7084
7203
|
__spreadProps(__spreadValues({}, props), {
|
7085
7204
|
className,
|
@@ -7089,7 +7208,7 @@ function AutoFrame(_a) {
|
|
7089
7208
|
onLoad: () => {
|
7090
7209
|
setLoaded(true);
|
7091
7210
|
},
|
7092
|
-
children: /* @__PURE__ */ (0,
|
7211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7093
7212
|
CopyHostStyles,
|
7094
7213
|
{
|
7095
7214
|
debug,
|
@@ -7108,7 +7227,7 @@ init_react_import();
|
|
7108
7227
|
var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
7109
7228
|
|
7110
7229
|
// components/Puck/components/Preview/index.tsx
|
7111
|
-
var
|
7230
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
7112
7231
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
7113
7232
|
var useBubbleIframeEvents = (ref) => {
|
7114
7233
|
const status = useAppStore((s) => s.status);
|
@@ -7168,7 +7287,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7168
7287
|
const propsWithSlots = useSlots(rootConfig, pageProps, DropZoneEditPure);
|
7169
7288
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
7170
7289
|
id: "puck-root"
|
7171
|
-
}, propsWithSlots)) : /* @__PURE__ */ (0,
|
7290
|
+
}, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: propsWithSlots.children });
|
7172
7291
|
},
|
7173
7292
|
[config.root]
|
7174
7293
|
);
|
@@ -7176,7 +7295,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7176
7295
|
const rootProps = root.props || root;
|
7177
7296
|
const ref = (0, import_react43.useRef)(null);
|
7178
7297
|
useBubbleIframeEvents(ref);
|
7179
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
7298
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7180
7299
|
Page,
|
7181
7300
|
__spreadProps(__spreadValues({}, rootProps), {
|
7182
7301
|
puck: {
|
@@ -7186,15 +7305,15 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7186
7305
|
metadata
|
7187
7306
|
},
|
7188
7307
|
editMode: true,
|
7189
|
-
children: /* @__PURE__ */ (0,
|
7308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZonePure, { zone: rootDroppableId })
|
7190
7309
|
})
|
7191
|
-
) : /* @__PURE__ */ (0,
|
7310
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Render, { data: renderData, config });
|
7192
7311
|
(0, import_react43.useEffect)(() => {
|
7193
7312
|
if (!iframe.enabled) {
|
7194
7313
|
setStatus("READY");
|
7195
7314
|
}
|
7196
7315
|
}, [iframe.enabled]);
|
7197
|
-
return /* @__PURE__ */ (0,
|
7316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7198
7317
|
"div",
|
7199
7318
|
{
|
7200
7319
|
className: getClassName23(),
|
@@ -7203,7 +7322,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7203
7322
|
onClick: () => {
|
7204
7323
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
7205
7324
|
},
|
7206
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
7325
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7207
7326
|
AutoFrame_default,
|
7208
7327
|
{
|
7209
7328
|
id: "preview-frame",
|
@@ -7216,14 +7335,14 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7216
7335
|
setStatus("MOUNTED");
|
7217
7336
|
},
|
7218
7337
|
frameRef: ref,
|
7219
|
-
children: /* @__PURE__ */ (0,
|
7338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
7220
7339
|
if (Frame) {
|
7221
|
-
return /* @__PURE__ */ (0,
|
7340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Frame, { document: document2, children: inner });
|
7222
7341
|
}
|
7223
7342
|
return inner;
|
7224
7343
|
} })
|
7225
7344
|
}
|
7226
|
-
) : /* @__PURE__ */ (0,
|
7345
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7227
7346
|
"div",
|
7228
7347
|
{
|
7229
7348
|
id: "preview-frame",
|
@@ -7282,7 +7401,7 @@ var onScrollEnd = (frame, cb) => {
|
|
7282
7401
|
|
7283
7402
|
// components/LayerTree/index.tsx
|
7284
7403
|
var import_shallow5 = require("zustand/react/shallow");
|
7285
|
-
var
|
7404
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
7286
7405
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
7287
7406
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
7288
7407
|
var Layer = ({
|
@@ -7328,7 +7447,7 @@ var Layer = ({
|
|
7328
7447
|
});
|
7329
7448
|
const componentConfig = config.components[nodeData.data.type];
|
7330
7449
|
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
7331
|
-
return /* @__PURE__ */ (0,
|
7450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
7332
7451
|
"li",
|
7333
7452
|
{
|
7334
7453
|
className: getClassNameLayer({
|
@@ -7338,7 +7457,7 @@ var Layer = ({
|
|
7338
7457
|
childIsSelected
|
7339
7458
|
}),
|
7340
7459
|
children: [
|
7341
|
-
/* @__PURE__ */ (0,
|
7460
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
7342
7461
|
"button",
|
7343
7462
|
{
|
7344
7463
|
type: "button",
|
@@ -7373,22 +7492,22 @@ var Layer = ({
|
|
7373
7492
|
setHoveringComponent(null);
|
7374
7493
|
},
|
7375
7494
|
children: [
|
7376
|
-
containsZone && /* @__PURE__ */ (0,
|
7495
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
7377
7496
|
"div",
|
7378
7497
|
{
|
7379
7498
|
className: getClassNameLayer("chevron"),
|
7380
7499
|
title: isSelected ? "Collapse" : "Expand",
|
7381
|
-
children: /* @__PURE__ */ (0,
|
7500
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChevronDown, { size: "12" })
|
7382
7501
|
}
|
7383
7502
|
),
|
7384
|
-
/* @__PURE__ */ (0,
|
7385
|
-
/* @__PURE__ */ (0,
|
7386
|
-
/* @__PURE__ */ (0,
|
7503
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
7504
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayoutGrid, { size: "16" }) }),
|
7505
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("name"), children: label })
|
7387
7506
|
] })
|
7388
7507
|
]
|
7389
7508
|
}
|
7390
7509
|
) }),
|
7391
|
-
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0,
|
7510
|
+
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
|
7392
7511
|
]
|
7393
7512
|
}
|
7394
7513
|
);
|
@@ -7406,15 +7525,15 @@ var LayerTree = ({
|
|
7406
7525
|
}
|
7407
7526
|
)
|
7408
7527
|
);
|
7409
|
-
return /* @__PURE__ */ (0,
|
7410
|
-
label && /* @__PURE__ */ (0,
|
7411
|
-
/* @__PURE__ */ (0,
|
7528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
7529
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
7530
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Layers, { size: "16" }) }),
|
7412
7531
|
label
|
7413
7532
|
] }),
|
7414
|
-
/* @__PURE__ */ (0,
|
7415
|
-
contentIds.length === 0 && /* @__PURE__ */ (0,
|
7533
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("ul", { className: getClassName24(), children: [
|
7534
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
7416
7535
|
contentIds.map((itemId, i) => {
|
7417
|
-
return /* @__PURE__ */ (0,
|
7536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
7418
7537
|
Layer,
|
7419
7538
|
{
|
7420
7539
|
index: i,
|
@@ -7441,14 +7560,14 @@ var findZonesForArea = (state, area) => {
|
|
7441
7560
|
|
7442
7561
|
// components/Puck/components/Outline/index.tsx
|
7443
7562
|
var import_shallow6 = require("zustand/react/shallow");
|
7444
|
-
var
|
7563
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
7445
7564
|
var Outline = () => {
|
7446
7565
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
7447
7566
|
const rootZones = useAppStore(
|
7448
7567
|
(0, import_shallow6.useShallow)((s) => findZonesForArea(s.state, "root"))
|
7449
7568
|
);
|
7450
7569
|
const Wrapper = (0, import_react45.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
7451
|
-
return /* @__PURE__ */ (0,
|
7570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
7452
7571
|
LayerTree,
|
7453
7572
|
{
|
7454
7573
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
@@ -7592,11 +7711,11 @@ init_react_import();
|
|
7592
7711
|
var styles_module_default20 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
|
7593
7712
|
|
7594
7713
|
// components/ViewportControls/index.tsx
|
7595
|
-
var
|
7714
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
7596
7715
|
var icons = {
|
7597
|
-
Smartphone: /* @__PURE__ */ (0,
|
7598
|
-
Tablet: /* @__PURE__ */ (0,
|
7599
|
-
Monitor: /* @__PURE__ */ (0,
|
7716
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Smartphone, { size: 16 }),
|
7717
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Tablet, { size: 16 }),
|
7718
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Monitor, { size: 16 })
|
7600
7719
|
};
|
7601
7720
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
7602
7721
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -7612,7 +7731,7 @@ var ViewportButton = ({
|
|
7612
7731
|
(0, import_react46.useEffect)(() => {
|
7613
7732
|
setIsActive(width === viewports.current.width);
|
7614
7733
|
}, [width, viewports.current.width]);
|
7615
|
-
return /* @__PURE__ */ (0,
|
7734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7616
7735
|
IconButton,
|
7617
7736
|
{
|
7618
7737
|
title,
|
@@ -7621,7 +7740,7 @@ var ViewportButton = ({
|
|
7621
7740
|
e.stopPropagation();
|
7622
7741
|
onClick({ width, height });
|
7623
7742
|
},
|
7624
|
-
children: /* @__PURE__ */ (0,
|
7743
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: getClassNameButton("inner"), children })
|
7625
7744
|
}
|
7626
7745
|
) });
|
7627
7746
|
};
|
@@ -7657,8 +7776,8 @@ var ViewportControls = ({
|
|
7657
7776
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
7658
7777
|
[autoZoom]
|
7659
7778
|
);
|
7660
|
-
return /* @__PURE__ */ (0,
|
7661
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
7779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25(), children: [
|
7780
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7662
7781
|
ViewportButton,
|
7663
7782
|
{
|
7664
7783
|
height: viewport.height,
|
@@ -7669,8 +7788,8 @@ var ViewportControls = ({
|
|
7669
7788
|
},
|
7670
7789
|
i
|
7671
7790
|
)),
|
7672
|
-
/* @__PURE__ */ (0,
|
7673
|
-
/* @__PURE__ */ (0,
|
7791
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("divider") }),
|
7792
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7674
7793
|
IconButton,
|
7675
7794
|
{
|
7676
7795
|
title: "Zoom viewport out",
|
@@ -7684,10 +7803,10 @@ var ViewportControls = ({
|
|
7684
7803
|
)].value
|
7685
7804
|
);
|
7686
7805
|
},
|
7687
|
-
children: /* @__PURE__ */ (0,
|
7806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ZoomOut, { size: 16 })
|
7688
7807
|
}
|
7689
7808
|
),
|
7690
|
-
/* @__PURE__ */ (0,
|
7809
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7691
7810
|
IconButton,
|
7692
7811
|
{
|
7693
7812
|
title: "Zoom viewport in",
|
@@ -7701,11 +7820,11 @@ var ViewportControls = ({
|
|
7701
7820
|
)].value
|
7702
7821
|
);
|
7703
7822
|
},
|
7704
|
-
children: /* @__PURE__ */ (0,
|
7823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ZoomIn, { size: 16 })
|
7705
7824
|
}
|
7706
7825
|
),
|
7707
|
-
/* @__PURE__ */ (0,
|
7708
|
-
/* @__PURE__ */ (0,
|
7826
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("divider") }),
|
7827
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7709
7828
|
"select",
|
7710
7829
|
{
|
7711
7830
|
className: getClassName25("zoomSelect"),
|
@@ -7713,7 +7832,7 @@ var ViewportControls = ({
|
|
7713
7832
|
onChange: (e) => {
|
7714
7833
|
onZoom(parseFloat(e.currentTarget.value));
|
7715
7834
|
},
|
7716
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
7835
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7717
7836
|
"option",
|
7718
7837
|
{
|
7719
7838
|
value: option.value,
|
@@ -7762,7 +7881,7 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
7762
7881
|
|
7763
7882
|
// components/Puck/components/Canvas/index.tsx
|
7764
7883
|
var import_shallow7 = require("zustand/react/shallow");
|
7765
|
-
var
|
7884
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
7766
7885
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
7767
7886
|
var ZOOM_ON_CHANGE = true;
|
7768
7887
|
var Canvas = () => {
|
@@ -7795,7 +7914,7 @@ var Canvas = () => {
|
|
7795
7914
|
const frameRef = (0, import_react47.useRef)(null);
|
7796
7915
|
const [showTransition, setShowTransition] = (0, import_react47.useState)(false);
|
7797
7916
|
const defaultRender = (0, import_react47.useMemo)(() => {
|
7798
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
7917
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
|
7799
7918
|
return PuckDefault;
|
7800
7919
|
}, []);
|
7801
7920
|
const CustomPreview = (0, import_react47.useMemo)(
|
@@ -7858,7 +7977,7 @@ var Canvas = () => {
|
|
7858
7977
|
setShowLoader(true);
|
7859
7978
|
}, 500);
|
7860
7979
|
}, []);
|
7861
|
-
return /* @__PURE__ */ (0,
|
7980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
7862
7981
|
"div",
|
7863
7982
|
{
|
7864
7983
|
className: getClassName26({
|
@@ -7871,7 +7990,7 @@ var Canvas = () => {
|
|
7871
7990
|
recordHistory: true
|
7872
7991
|
}),
|
7873
7992
|
children: [
|
7874
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
7993
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
7875
7994
|
ViewportControls,
|
7876
7995
|
{
|
7877
7996
|
autoZoom: zoomConfig.autoZoom,
|
@@ -7897,8 +8016,8 @@ var Canvas = () => {
|
|
7897
8016
|
}
|
7898
8017
|
}
|
7899
8018
|
) }),
|
7900
|
-
/* @__PURE__ */ (0,
|
7901
|
-
/* @__PURE__ */ (0,
|
8019
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
8020
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
7902
8021
|
"div",
|
7903
8022
|
{
|
7904
8023
|
className: getClassName26("root"),
|
@@ -7919,10 +8038,10 @@ var Canvas = () => {
|
|
7919
8038
|
})
|
7920
8039
|
);
|
7921
8040
|
},
|
7922
|
-
children: /* @__PURE__ */ (0,
|
8041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Preview3, {}) })
|
7923
8042
|
}
|
7924
8043
|
),
|
7925
|
-
/* @__PURE__ */ (0,
|
8044
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Loader, { size: 24 }) })
|
7926
8045
|
] })
|
7927
8046
|
]
|
7928
8047
|
}
|
@@ -7977,8 +8096,8 @@ var useLoadedOverrides = ({
|
|
7977
8096
|
|
7978
8097
|
// components/DefaultOverride/index.tsx
|
7979
8098
|
init_react_import();
|
7980
|
-
var
|
7981
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
8099
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
8100
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
7982
8101
|
|
7983
8102
|
// lib/use-inject-css.ts
|
7984
8103
|
init_react_import();
|
@@ -8041,13 +8160,22 @@ var generateUsePuck = (store) => {
|
|
8041
8160
|
index: store.history.index
|
8042
8161
|
};
|
8043
8162
|
const storeData = {
|
8044
|
-
appState: store.state,
|
8163
|
+
appState: makeStatePublic(store.state),
|
8045
8164
|
config: store.config,
|
8046
8165
|
dispatch: store.dispatch,
|
8047
8166
|
getPermissions: store.permissions.getPermissions,
|
8048
8167
|
refreshPermissions: store.permissions.refreshPermissions,
|
8049
8168
|
history,
|
8050
|
-
selectedItem: store.selectedItem || null
|
8169
|
+
selectedItem: store.selectedItem || null,
|
8170
|
+
getItemBySelector: (selector) => getItem(selector, store.state),
|
8171
|
+
getItemById: (id) => store.state.indexes.nodes[id].data,
|
8172
|
+
getSelectorForId: (id) => {
|
8173
|
+
const node = store.state.indexes.nodes[id];
|
8174
|
+
if (!node) return;
|
8175
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
8176
|
+
const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
8177
|
+
return { zone: zoneCompound, index };
|
8178
|
+
}
|
8051
8179
|
};
|
8052
8180
|
const get = () => storeData;
|
8053
8181
|
return __spreadProps(__spreadValues({}, storeData), { get });
|
@@ -8057,7 +8185,7 @@ var UsePuckStoreContext = (0, import_react51.createContext)(
|
|
8057
8185
|
);
|
8058
8186
|
var convertToPickedStore = (store) => {
|
8059
8187
|
return {
|
8060
|
-
state:
|
8188
|
+
state: store.state,
|
8061
8189
|
config: store.config,
|
8062
8190
|
dispatch: store.dispatch,
|
8063
8191
|
permissions: store.permissions,
|
@@ -8104,7 +8232,7 @@ function usePuck() {
|
|
8104
8232
|
}
|
8105
8233
|
|
8106
8234
|
// components/Puck/index.tsx
|
8107
|
-
var
|
8235
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
8108
8236
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
8109
8237
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
8110
8238
|
var FieldSideBar = () => {
|
@@ -8114,11 +8242,11 @@ var FieldSideBar = () => {
|
|
8114
8242
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
|
8115
8243
|
}
|
8116
8244
|
);
|
8117
|
-
return /* @__PURE__ */ (0,
|
8245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Fields, {}) });
|
8118
8246
|
};
|
8119
8247
|
var propsContext = (0, import_react52.createContext)({});
|
8120
8248
|
function PropsProvider(props) {
|
8121
|
-
return /* @__PURE__ */ (0,
|
8249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(propsContext.Provider, { value: props, children: props.children });
|
8122
8250
|
}
|
8123
8251
|
var usePropsContext = () => (0, import_react52.useContext)(propsContext);
|
8124
8252
|
function PuckProvider({ children }) {
|
@@ -8197,7 +8325,7 @@ function PuckProvider({ children }) {
|
|
8197
8325
|
) : {}
|
8198
8326
|
})
|
8199
8327
|
});
|
8200
|
-
return
|
8328
|
+
return walkAppState(newAppState, config);
|
8201
8329
|
});
|
8202
8330
|
const { appendData = true } = _initialHistory || {};
|
8203
8331
|
const [blendedHistories] = (0, import_react52.useState)(
|
@@ -8207,7 +8335,7 @@ function PuckProvider({ children }) {
|
|
8207
8335
|
].map((history) => {
|
8208
8336
|
let newState = __spreadValues(__spreadValues({}, generatedAppState), history.state);
|
8209
8337
|
if (!history.state.indexes) {
|
8210
|
-
newState =
|
8338
|
+
newState = walkAppState(newState, config);
|
8211
8339
|
}
|
8212
8340
|
return __spreadProps(__spreadValues({}, history), {
|
8213
8341
|
state: newState
|
@@ -8267,7 +8395,7 @@ function PuckProvider({ children }) {
|
|
8267
8395
|
const { resolveAndCommitData } = appStore.getState();
|
8268
8396
|
resolveAndCommitData();
|
8269
8397
|
}, []);
|
8270
|
-
return /* @__PURE__ */ (0,
|
8398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
8271
8399
|
}
|
8272
8400
|
function PuckLayout({ children }) {
|
8273
8401
|
const {
|
@@ -8347,7 +8475,7 @@ function PuckLayout({ children }) {
|
|
8347
8475
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
8348
8476
|
const Comp = renderHeader;
|
8349
8477
|
const appState = useAppStore((s) => s.state);
|
8350
|
-
return /* @__PURE__ */ (0,
|
8478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
8351
8479
|
};
|
8352
8480
|
return RenderHeader;
|
8353
8481
|
}
|
@@ -8361,7 +8489,7 @@ function PuckLayout({ children }) {
|
|
8361
8489
|
const RenderHeader = (props) => {
|
8362
8490
|
const Comp = renderHeaderActions;
|
8363
8491
|
const appState = useAppStore((s) => s.state);
|
8364
|
-
return /* @__PURE__ */ (0,
|
8492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
8365
8493
|
};
|
8366
8494
|
return RenderHeader;
|
8367
8495
|
}
|
@@ -8395,8 +8523,8 @@ function PuckLayout({ children }) {
|
|
8395
8523
|
}
|
8396
8524
|
}, [ready, iframe.enabled]);
|
8397
8525
|
usePreviewModeHotkeys();
|
8398
|
-
return /* @__PURE__ */ (0,
|
8399
|
-
/* @__PURE__ */ (0,
|
8526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
8527
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8400
8528
|
"div",
|
8401
8529
|
{
|
8402
8530
|
className: getLayoutClassName({
|
@@ -8405,61 +8533,61 @@ function PuckLayout({ children }) {
|
|
8405
8533
|
mounted,
|
8406
8534
|
rightSideBarVisible
|
8407
8535
|
}),
|
8408
|
-
children: /* @__PURE__ */ (0,
|
8409
|
-
/* @__PURE__ */ (0,
|
8536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
8537
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8410
8538
|
CustomHeader,
|
8411
8539
|
{
|
8412
|
-
actions: /* @__PURE__ */ (0,
|
8540
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8413
8541
|
Button,
|
8414
8542
|
{
|
8415
8543
|
onClick: () => {
|
8416
8544
|
const data = appStore.getState().state.data;
|
8417
8545
|
onPublish && onPublish(data);
|
8418
8546
|
},
|
8419
|
-
icon: /* @__PURE__ */ (0,
|
8547
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
8420
8548
|
children: "Publish"
|
8421
8549
|
}
|
8422
8550
|
) }) }),
|
8423
|
-
children: /* @__PURE__ */ (0,
|
8424
|
-
/* @__PURE__ */ (0,
|
8425
|
-
/* @__PURE__ */ (0,
|
8551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
8552
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
8553
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8426
8554
|
"div",
|
8427
8555
|
{
|
8428
8556
|
className: getLayoutClassName("leftSideBarToggle"),
|
8429
|
-
children: /* @__PURE__ */ (0,
|
8557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8430
8558
|
IconButton,
|
8431
8559
|
{
|
8432
8560
|
onClick: () => {
|
8433
8561
|
toggleSidebars("left");
|
8434
8562
|
},
|
8435
8563
|
title: "Toggle left sidebar",
|
8436
|
-
children: /* @__PURE__ */ (0,
|
8564
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
|
8437
8565
|
}
|
8438
8566
|
)
|
8439
8567
|
}
|
8440
8568
|
),
|
8441
|
-
/* @__PURE__ */ (0,
|
8569
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8442
8570
|
"div",
|
8443
8571
|
{
|
8444
8572
|
className: getLayoutClassName("rightSideBarToggle"),
|
8445
|
-
children: /* @__PURE__ */ (0,
|
8573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8446
8574
|
IconButton,
|
8447
8575
|
{
|
8448
8576
|
onClick: () => {
|
8449
8577
|
toggleSidebars("right");
|
8450
8578
|
},
|
8451
8579
|
title: "Toggle right sidebar",
|
8452
|
-
children: /* @__PURE__ */ (0,
|
8580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
|
8453
8581
|
}
|
8454
8582
|
)
|
8455
8583
|
}
|
8456
8584
|
)
|
8457
8585
|
] }),
|
8458
|
-
/* @__PURE__ */ (0,
|
8586
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
8459
8587
|
headerTitle || (rootProps == null ? void 0 : rootProps.title) || "Page",
|
8460
|
-
headerPath && /* @__PURE__ */ (0,
|
8588
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
8461
8589
|
" ",
|
8462
|
-
/* @__PURE__ */ (0,
|
8590
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8463
8591
|
"code",
|
8464
8592
|
{
|
8465
8593
|
className: getLayoutClassName("headerPath"),
|
@@ -8468,31 +8596,31 @@ function PuckLayout({ children }) {
|
|
8468
8596
|
)
|
8469
8597
|
] })
|
8470
8598
|
] }) }),
|
8471
|
-
/* @__PURE__ */ (0,
|
8472
|
-
/* @__PURE__ */ (0,
|
8599
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
8600
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8473
8601
|
IconButton,
|
8474
8602
|
{
|
8475
8603
|
onClick: () => {
|
8476
8604
|
return setMenuOpen(!menuOpen);
|
8477
8605
|
},
|
8478
8606
|
title: "Toggle menu bar",
|
8479
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
8607
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronDown, { focusable: "false" })
|
8480
8608
|
}
|
8481
8609
|
) }),
|
8482
|
-
/* @__PURE__ */ (0,
|
8610
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8483
8611
|
MenuBar,
|
8484
8612
|
{
|
8485
8613
|
dispatch,
|
8486
8614
|
onPublish,
|
8487
8615
|
menuOpen,
|
8488
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
8616
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8489
8617
|
Button,
|
8490
8618
|
{
|
8491
8619
|
onClick: () => {
|
8492
8620
|
const data = appStore.getState().state.data;
|
8493
8621
|
onPublish && onPublish(data);
|
8494
8622
|
},
|
8495
|
-
icon: /* @__PURE__ */ (0,
|
8623
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
8496
8624
|
children: "Publish"
|
8497
8625
|
}
|
8498
8626
|
) }),
|
@@ -8503,20 +8631,20 @@ function PuckLayout({ children }) {
|
|
8503
8631
|
] }) })
|
8504
8632
|
}
|
8505
8633
|
),
|
8506
|
-
/* @__PURE__ */ (0,
|
8507
|
-
/* @__PURE__ */ (0,
|
8508
|
-
/* @__PURE__ */ (0,
|
8634
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
8635
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Components, {}) }),
|
8636
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Outline, {}) })
|
8509
8637
|
] }),
|
8510
|
-
/* @__PURE__ */ (0,
|
8511
|
-
/* @__PURE__ */ (0,
|
8638
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Canvas, {}),
|
8639
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FieldSideBar, {}) })
|
8512
8640
|
] })
|
8513
8641
|
}
|
8514
8642
|
) }) }),
|
8515
|
-
/* @__PURE__ */ (0,
|
8643
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
8516
8644
|
] });
|
8517
8645
|
}
|
8518
8646
|
function Puck(props) {
|
8519
|
-
return /* @__PURE__ */ (0,
|
8647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
|
8520
8648
|
}
|
8521
8649
|
Puck.Components = Components;
|
8522
8650
|
Puck.Fields = Fields;
|
@@ -8540,10 +8668,67 @@ var migrations = [
|
|
8540
8668
|
});
|
8541
8669
|
}
|
8542
8670
|
return data;
|
8671
|
+
},
|
8672
|
+
// Migrate zones to slots
|
8673
|
+
(data, config) => {
|
8674
|
+
var _a;
|
8675
|
+
if (!config) return data;
|
8676
|
+
console.log("Migrating DropZones to slots...");
|
8677
|
+
const updatedItems = {};
|
8678
|
+
const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
|
8679
|
+
const { indexes } = walkAppState(appState, config);
|
8680
|
+
const deletedCompounds = [];
|
8681
|
+
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
8682
|
+
var _a2, _b;
|
8683
|
+
if (zoneType === "dropzone") {
|
8684
|
+
const [id, slotName] = zoneCompound.split(":");
|
8685
|
+
const nodeData = indexes.nodes[id].data;
|
8686
|
+
const componentType = nodeData.type;
|
8687
|
+
const configForComponent = config.components[componentType];
|
8688
|
+
if (((_b = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b.type) === "slot") {
|
8689
|
+
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
8690
|
+
props: __spreadProps(__spreadValues({}, nodeData.props), {
|
8691
|
+
[slotName]: content
|
8692
|
+
})
|
8693
|
+
});
|
8694
|
+
deletedCompounds.push(zoneCompound);
|
8695
|
+
}
|
8696
|
+
return content;
|
8697
|
+
}
|
8698
|
+
return content;
|
8699
|
+
});
|
8700
|
+
const updated = walkAppState(
|
8701
|
+
appState,
|
8702
|
+
config,
|
8703
|
+
(content) => content,
|
8704
|
+
(item) => {
|
8705
|
+
var _a2;
|
8706
|
+
return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
|
8707
|
+
}
|
8708
|
+
);
|
8709
|
+
deletedCompounds.forEach((zoneCompound) => {
|
8710
|
+
var _a2;
|
8711
|
+
const [_, propName] = zoneCompound.split(":");
|
8712
|
+
console.log(
|
8713
|
+
`\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
|
8714
|
+
);
|
8715
|
+
(_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
|
8716
|
+
});
|
8717
|
+
Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
|
8718
|
+
const [_, propName] = zoneCompound.split(":");
|
8719
|
+
throw new Error(
|
8720
|
+
`Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
|
8721
|
+
);
|
8722
|
+
});
|
8723
|
+
delete updated.data.zones;
|
8724
|
+
return updated.data;
|
8543
8725
|
}
|
8544
8726
|
];
|
8545
|
-
function migrate(data) {
|
8546
|
-
return migrations == null ? void 0 : migrations.reduce(
|
8727
|
+
function migrate(data, config) {
|
8728
|
+
return migrations == null ? void 0 : migrations.reduce(
|
8729
|
+
(acc, migration) => migration(acc, config),
|
8730
|
+
data
|
8731
|
+
);
|
8547
8732
|
}
|
8548
8733
|
|
8549
8734
|
// lib/transform-props.ts
|
@@ -8620,7 +8805,11 @@ function resolveAllData(_0, _1) {
|
|
8620
8805
|
"force",
|
8621
8806
|
false
|
8622
8807
|
)).node;
|
8623
|
-
const resolvedDeep = yield
|
8808
|
+
const resolvedDeep = yield mapSlotsAsync(
|
8809
|
+
resolved,
|
8810
|
+
processContent,
|
8811
|
+
false
|
8812
|
+
);
|
8624
8813
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
8625
8814
|
return resolvedDeep;
|
8626
8815
|
});
|
@@ -8647,6 +8836,39 @@ function resolveAllData(_0, _1) {
|
|
8647
8836
|
return dynamic;
|
8648
8837
|
});
|
8649
8838
|
}
|
8839
|
+
|
8840
|
+
// lib/data/walk-tree.ts
|
8841
|
+
init_react_import();
|
8842
|
+
function walkTree(data, config, callbackFn) {
|
8843
|
+
var _a, _b;
|
8844
|
+
const isSlot2 = createIsSlotConfig(config);
|
8845
|
+
const walkItem = (item) => {
|
8846
|
+
return mapSlotsSync(
|
8847
|
+
item,
|
8848
|
+
(content, parentId, propName) => callbackFn(content, { parentId, propName }),
|
8849
|
+
isSlot2
|
8850
|
+
);
|
8851
|
+
};
|
8852
|
+
if ("props" in data) {
|
8853
|
+
return walkItem(data);
|
8854
|
+
}
|
8855
|
+
const _data = data;
|
8856
|
+
const zones = (_a = _data.zones) != null ? _a : {};
|
8857
|
+
const mappedContent = _data.content.map(walkItem);
|
8858
|
+
return {
|
8859
|
+
root: walkItem(_data.root),
|
8860
|
+
content: (_b = callbackFn(mappedContent, {
|
8861
|
+
parentId: "root",
|
8862
|
+
propName: "default-zone"
|
8863
|
+
})) != null ? _b : mappedContent,
|
8864
|
+
zones: Object.keys(zones).reduce(
|
8865
|
+
(acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
|
8866
|
+
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
8867
|
+
}),
|
8868
|
+
{}
|
8869
|
+
)
|
8870
|
+
};
|
8871
|
+
}
|
8650
8872
|
// Annotate the CommonJS export names for ESM import in node:
|
8651
8873
|
0 && (module.exports = {
|
8652
8874
|
Action,
|
@@ -8667,7 +8889,8 @@ function resolveAllData(_0, _1) {
|
|
8667
8889
|
renderContext,
|
8668
8890
|
resolveAllData,
|
8669
8891
|
transformProps,
|
8670
|
-
usePuck
|
8892
|
+
usePuck,
|
8893
|
+
walkTree
|
8671
8894
|
});
|
8672
8895
|
/*! Bundled license information:
|
8673
8896
|
|