@measured/puck 0.19.0-canary.f13b9536 → 0.19.0-canary.f6398bca
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 -4
- package/dist/chunk-COT3ZFIM.mjs +576 -0
- package/dist/index.d.mts +4 -10
- package/dist/index.d.ts +4 -10
- package/dist/index.js +381 -279
- package/dist/index.mjs +6507 -1614
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +255 -3766
- package/dist/rsc.mjs +5 -103
- package/dist/{resolve-all-data-DgtDFF0E.d.mts → walk-tree-CM-cu7GU.d.mts} +42 -20
- package/dist/{resolve-all-data-DgtDFF0E.d.ts → walk-tree-CM-cu7GU.d.ts} +42 -20
- package/package.json +2 -2
- package/dist/chunk-ZOHJNF5K.mjs +0 -5427
- package/dist/rsc.css +0 -339
package/dist/index.js
CHANGED
@@ -176,13 +176,13 @@ __export(core_exports, {
|
|
176
176
|
Puck: () => Puck,
|
177
177
|
Render: () => Render,
|
178
178
|
createUsePuck: () => createUsePuck,
|
179
|
-
mapSlots: () => mapSlotsPublic,
|
180
179
|
migrate: () => migrate,
|
181
180
|
overrideKeys: () => overrideKeys,
|
182
181
|
renderContext: () => renderContext,
|
183
182
|
resolveAllData: () => resolveAllData,
|
184
183
|
transformProps: () => transformProps,
|
185
|
-
usePuck: () => usePuck
|
184
|
+
usePuck: () => usePuck,
|
185
|
+
walkTree: () => walkTree
|
186
186
|
});
|
187
187
|
module.exports = __toCommonJS(core_exports);
|
188
188
|
init_react_import();
|
@@ -795,7 +795,7 @@ init_react_import();
|
|
795
795
|
// reducer/actions/set.ts
|
796
796
|
init_react_import();
|
797
797
|
|
798
|
-
// lib/data/walk-
|
798
|
+
// lib/data/walk-app-state.ts
|
799
799
|
init_react_import();
|
800
800
|
|
801
801
|
// lib/data/for-each-slot.ts
|
@@ -884,8 +884,8 @@ var stripSlots = (data) => {
|
|
884
884
|
});
|
885
885
|
};
|
886
886
|
|
887
|
-
// lib/data/walk-
|
888
|
-
function
|
887
|
+
// lib/data/walk-app-state.ts
|
888
|
+
function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
889
889
|
var _a;
|
890
890
|
let newZones = {};
|
891
891
|
const newZoneIndex = {};
|
@@ -1018,7 +1018,7 @@ var setAction = (state, action, appStore) => {
|
|
1018
1018
|
console.warn(
|
1019
1019
|
"`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
1020
1020
|
);
|
1021
|
-
return
|
1021
|
+
return walkAppState(newState, appStore.config);
|
1022
1022
|
}
|
1023
1023
|
return __spreadValues(__spreadValues({}, state), action.state(state));
|
1024
1024
|
};
|
@@ -1047,18 +1047,116 @@ var getIdsForParent = (zoneCompound, state) => {
|
|
1047
1047
|
return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
|
1048
1048
|
};
|
1049
1049
|
|
1050
|
+
// lib/data/populate-ids.ts
|
1051
|
+
init_react_import();
|
1052
|
+
|
1053
|
+
// lib/data/walk-tree.ts
|
1054
|
+
init_react_import();
|
1055
|
+
|
1056
|
+
// lib/data/map-slots.ts
|
1057
|
+
init_react_import();
|
1058
|
+
function mapSlotsAsync(_0, _1) {
|
1059
|
+
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
1060
|
+
const props = __spreadValues({}, item.props);
|
1061
|
+
const propKeys = Object.keys(props);
|
1062
|
+
for (let i = 0; i < propKeys.length; i++) {
|
1063
|
+
const propKey = propKeys[i];
|
1064
|
+
const itemType = "type" in item ? item.type : "root";
|
1065
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
1066
|
+
const content = props[propKey];
|
1067
|
+
const mappedContent = recursive ? yield Promise.all(
|
1068
|
+
content.map((item2) => __async(this, null, function* () {
|
1069
|
+
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
1070
|
+
}))
|
1071
|
+
) : content;
|
1072
|
+
props[propKey] = yield map(mappedContent, propKey);
|
1073
|
+
}
|
1074
|
+
}
|
1075
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
1076
|
+
});
|
1077
|
+
}
|
1078
|
+
function mapSlotsSync(item, map, isSlot2 = isSlot) {
|
1079
|
+
var _a, _b;
|
1080
|
+
const props = __spreadValues({}, item.props);
|
1081
|
+
const propKeys = Object.keys(props);
|
1082
|
+
for (let i = 0; i < propKeys.length; i++) {
|
1083
|
+
const propKey = propKeys[i];
|
1084
|
+
const itemType = "type" in item ? item.type : "root";
|
1085
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
1086
|
+
const content = props[propKey];
|
1087
|
+
const mappedContent = content.map((item2) => {
|
1088
|
+
return mapSlotsSync(item2, map, isSlot2);
|
1089
|
+
});
|
1090
|
+
props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
|
1091
|
+
}
|
1092
|
+
}
|
1093
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
// lib/data/walk-tree.ts
|
1097
|
+
function walkTree(data, config, callbackFn) {
|
1098
|
+
var _a, _b;
|
1099
|
+
const isSlot2 = createIsSlotConfig(config);
|
1100
|
+
const walkItem = (item) => {
|
1101
|
+
return mapSlotsSync(
|
1102
|
+
item,
|
1103
|
+
(content, parentId, propName) => callbackFn(content, { parentId, propName }),
|
1104
|
+
isSlot2
|
1105
|
+
);
|
1106
|
+
};
|
1107
|
+
if ("props" in data) {
|
1108
|
+
return walkItem(data);
|
1109
|
+
}
|
1110
|
+
const _data = data;
|
1111
|
+
const zones = (_a = _data.zones) != null ? _a : {};
|
1112
|
+
const mappedContent = _data.content.map(walkItem);
|
1113
|
+
return {
|
1114
|
+
root: walkItem(_data.root),
|
1115
|
+
content: (_b = callbackFn(mappedContent, {
|
1116
|
+
parentId: "root",
|
1117
|
+
propName: "default-zone"
|
1118
|
+
})) != null ? _b : mappedContent,
|
1119
|
+
zones: Object.keys(zones).reduce(
|
1120
|
+
(acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
|
1121
|
+
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
1122
|
+
}),
|
1123
|
+
{}
|
1124
|
+
)
|
1125
|
+
};
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
// lib/data/populate-ids.ts
|
1129
|
+
var populateIds = (data, config, override = false) => {
|
1130
|
+
const id = generateId(data.type);
|
1131
|
+
return walkTree(
|
1132
|
+
__spreadProps(__spreadValues({}, data), {
|
1133
|
+
props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({ id }, data.props)
|
1134
|
+
}),
|
1135
|
+
config,
|
1136
|
+
(contents) => contents.map((item) => {
|
1137
|
+
const id2 = generateId(item.type);
|
1138
|
+
return __spreadProps(__spreadValues({}, item), {
|
1139
|
+
props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
|
1140
|
+
});
|
1141
|
+
})
|
1142
|
+
);
|
1143
|
+
};
|
1144
|
+
|
1050
1145
|
// reducer/actions/insert.ts
|
1051
1146
|
function insertAction(state, action, appStore) {
|
1052
1147
|
const id = action.id || generateId(action.componentType);
|
1053
|
-
const emptyComponentData =
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1148
|
+
const emptyComponentData = populateIds(
|
1149
|
+
{
|
1150
|
+
type: action.componentType,
|
1151
|
+
props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
|
1152
|
+
id
|
1153
|
+
})
|
1154
|
+
},
|
1155
|
+
appStore.config
|
1156
|
+
);
|
1059
1157
|
const [parentId] = action.destinationZone.split(":");
|
1060
1158
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
1061
|
-
return
|
1159
|
+
return walkAppState(
|
1062
1160
|
state,
|
1063
1161
|
appStore.config,
|
1064
1162
|
(content, zoneCompound) => {
|
@@ -1096,25 +1194,26 @@ var replaceAction = (state, action, appStore) => {
|
|
1096
1194
|
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
1097
1195
|
);
|
1098
1196
|
}
|
1099
|
-
|
1197
|
+
const data = populateIds(action.data, appStore.config);
|
1198
|
+
return walkAppState(
|
1100
1199
|
state,
|
1101
1200
|
appStore.config,
|
1102
1201
|
(content, zoneCompound) => {
|
1103
1202
|
const newContent = [...content];
|
1104
1203
|
if (zoneCompound === action.destinationZone) {
|
1105
|
-
newContent[action.destinationIndex] =
|
1204
|
+
newContent[action.destinationIndex] = data;
|
1106
1205
|
}
|
1107
1206
|
return newContent;
|
1108
1207
|
},
|
1109
1208
|
(childItem, path) => {
|
1110
1209
|
const pathIds = path.map((p) => p.split(":")[0]);
|
1111
|
-
if (childItem.props.id ===
|
1112
|
-
return
|
1210
|
+
if (childItem.props.id === data.props.id) {
|
1211
|
+
return data;
|
1113
1212
|
} else if (childItem.props.id === parentId) {
|
1114
1213
|
return childItem;
|
1115
1214
|
} else if (idsInPath.indexOf(childItem.props.id) > -1) {
|
1116
1215
|
return childItem;
|
1117
|
-
} else if (pathIds.indexOf(
|
1216
|
+
} else if (pathIds.indexOf(data.props.id) > -1) {
|
1118
1217
|
return childItem;
|
1119
1218
|
}
|
1120
1219
|
return null;
|
@@ -1125,7 +1224,7 @@ var replaceAction = (state, action, appStore) => {
|
|
1125
1224
|
// reducer/actions/replace-root.ts
|
1126
1225
|
init_react_import();
|
1127
1226
|
var replaceRootAction = (state, action, appStore) => {
|
1128
|
-
return
|
1227
|
+
return walkAppState(
|
1129
1228
|
state,
|
1130
1229
|
appStore.config,
|
1131
1230
|
(content) => content,
|
@@ -1164,7 +1263,7 @@ function duplicateAction(state, action, appStore) {
|
|
1164
1263
|
id: generateId(item.type)
|
1165
1264
|
})
|
1166
1265
|
});
|
1167
|
-
const modified =
|
1266
|
+
const modified = walkAppState(
|
1168
1267
|
state,
|
1169
1268
|
appStore.config,
|
1170
1269
|
(content, zoneCompound) => {
|
@@ -1229,7 +1328,7 @@ var moveAction = (state, action, appStore) => {
|
|
1229
1328
|
if (!item) return state;
|
1230
1329
|
const idsInSourcePath = getIdsForParent(action.sourceZone, state);
|
1231
1330
|
const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
|
1232
|
-
return
|
1331
|
+
return walkAppState(
|
1233
1332
|
state,
|
1234
1333
|
appStore.config,
|
1235
1334
|
(content, zoneCompound) => {
|
@@ -1287,7 +1386,7 @@ var removeAction = (state, action, appStore) => {
|
|
1287
1386
|
},
|
1288
1387
|
[item.props.id]
|
1289
1388
|
);
|
1290
|
-
const newState =
|
1389
|
+
const newState = walkAppState(
|
1291
1390
|
state,
|
1292
1391
|
appStore.config,
|
1293
1392
|
(content, zoneCompound) => {
|
@@ -1378,14 +1477,14 @@ var setDataAction = (state, action, appStore) => {
|
|
1378
1477
|
console.warn(
|
1379
1478
|
"`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
1380
1479
|
);
|
1381
|
-
return
|
1480
|
+
return walkAppState(
|
1382
1481
|
__spreadProps(__spreadValues({}, state), {
|
1383
1482
|
data: __spreadValues(__spreadValues({}, state.data), action.data)
|
1384
1483
|
}),
|
1385
1484
|
appStore.config
|
1386
1485
|
);
|
1387
1486
|
}
|
1388
|
-
return
|
1487
|
+
return walkAppState(
|
1389
1488
|
__spreadProps(__spreadValues({}, state), {
|
1390
1489
|
data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
|
1391
1490
|
}),
|
@@ -1770,7 +1869,7 @@ var import_react7 = require("react");
|
|
1770
1869
|
init_react_import();
|
1771
1870
|
var flattenData = (state, config) => {
|
1772
1871
|
const data = [];
|
1773
|
-
|
1872
|
+
walkAppState(
|
1774
1873
|
state,
|
1775
1874
|
config,
|
1776
1875
|
(content) => content,
|
@@ -2006,55 +2105,6 @@ var useRegisterFieldsSlice = (appStore, id) => {
|
|
2006
2105
|
|
2007
2106
|
// lib/resolve-component-data.ts
|
2008
2107
|
init_react_import();
|
2009
|
-
|
2010
|
-
// lib/data/map-slots.ts
|
2011
|
-
init_react_import();
|
2012
|
-
function mapSlotsAsync(_0, _1) {
|
2013
|
-
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
2014
|
-
const props = __spreadValues({}, item.props);
|
2015
|
-
const propKeys = Object.keys(props);
|
2016
|
-
for (let i = 0; i < propKeys.length; i++) {
|
2017
|
-
const propKey = propKeys[i];
|
2018
|
-
const itemType = "type" in item ? item.type : "root";
|
2019
|
-
if (isSlot2(itemType, propKey, props[propKey])) {
|
2020
|
-
const content = props[propKey];
|
2021
|
-
const mappedContent = recursive ? yield Promise.all(
|
2022
|
-
content.map((item2) => __async(this, null, function* () {
|
2023
|
-
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
2024
|
-
}))
|
2025
|
-
) : content;
|
2026
|
-
props[propKey] = yield map(mappedContent, propKey);
|
2027
|
-
}
|
2028
|
-
}
|
2029
|
-
return __spreadProps(__spreadValues({}, item), { props });
|
2030
|
-
});
|
2031
|
-
}
|
2032
|
-
function mapSlotsSync(item, map, isSlot2 = isSlot) {
|
2033
|
-
const props = __spreadValues({}, item.props);
|
2034
|
-
const propKeys = Object.keys(props);
|
2035
|
-
for (let i = 0; i < propKeys.length; i++) {
|
2036
|
-
const propKey = propKeys[i];
|
2037
|
-
const itemType = "type" in item ? item.type : "root";
|
2038
|
-
if (isSlot2(itemType, propKey, props[propKey])) {
|
2039
|
-
const content = props[propKey];
|
2040
|
-
const mappedContent = content.map((item2) => {
|
2041
|
-
return mapSlotsSync(item2, map, isSlot2);
|
2042
|
-
});
|
2043
|
-
props[propKey] = map(mappedContent, props.id, propKey);
|
2044
|
-
}
|
2045
|
-
}
|
2046
|
-
return __spreadProps(__spreadValues({}, item), { props });
|
2047
|
-
}
|
2048
|
-
function mapSlotsPublic(item, config, map) {
|
2049
|
-
const isSlot2 = createIsSlotConfig(config);
|
2050
|
-
return mapSlotsSync(
|
2051
|
-
item,
|
2052
|
-
(content, parentId, propName) => map(content, { parentId, propName }),
|
2053
|
-
isSlot2
|
2054
|
-
);
|
2055
|
-
}
|
2056
|
-
|
2057
|
-
// lib/resolve-component-data.ts
|
2058
2108
|
var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
|
2059
2109
|
var cache = { lastChange: {} };
|
2060
2110
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
|
@@ -2299,7 +2349,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
|
|
2299
2349
|
}),
|
2300
2350
|
resolveAndCommitData: () => __async(void 0, null, function* () {
|
2301
2351
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
2302
|
-
|
2352
|
+
walkAppState(
|
2303
2353
|
state,
|
2304
2354
|
config,
|
2305
2355
|
(content) => content,
|
@@ -5150,43 +5200,70 @@ var import_react33 = __toESM(require("react"));
|
|
5150
5200
|
|
5151
5201
|
// components/SlotRender/index.tsx
|
5152
5202
|
init_react_import();
|
5203
|
+
|
5204
|
+
// components/SlotRender/server.tsx
|
5205
|
+
init_react_import();
|
5153
5206
|
var import_react32 = require("react");
|
5207
|
+
|
5208
|
+
// components/ServerRender/index.tsx
|
5209
|
+
init_react_import();
|
5154
5210
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
5155
|
-
|
5156
|
-
|
5157
|
-
|
5158
|
-
|
5159
|
-
|
5160
|
-
|
5161
|
-
|
5162
|
-
|
5163
|
-
|
5164
|
-
|
5165
|
-
|
5166
|
-
|
5167
|
-
)
|
5168
|
-
|
5169
|
-
|
5170
|
-
|
5171
|
-
|
5172
|
-
|
5173
|
-
|
5174
|
-
|
5211
|
+
function DropZoneRender({
|
5212
|
+
zone,
|
5213
|
+
data,
|
5214
|
+
areaId = "root",
|
5215
|
+
config,
|
5216
|
+
metadata = {}
|
5217
|
+
}) {
|
5218
|
+
let zoneCompound = rootDroppableId;
|
5219
|
+
let content = (data == null ? void 0 : data.content) || [];
|
5220
|
+
if (!data || !config) {
|
5221
|
+
return null;
|
5222
|
+
}
|
5223
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
5224
|
+
zoneCompound = `${areaId}:${zone}`;
|
5225
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
5226
|
+
}
|
5227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: content.map((item) => {
|
5228
|
+
const Component = config.components[item.type];
|
5229
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
5230
|
+
puck: {
|
5231
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
5232
|
+
DropZoneRender,
|
5233
|
+
{
|
5234
|
+
zone: zone2,
|
5235
|
+
data,
|
5236
|
+
areaId: item.props.id,
|
5237
|
+
config,
|
5238
|
+
metadata
|
5239
|
+
}
|
5240
|
+
),
|
5241
|
+
metadata
|
5242
|
+
}
|
5243
|
+
});
|
5244
|
+
const propsWithSlots = useSlots(Component, props, (props2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
5245
|
+
if (Component) {
|
5246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component.render, __spreadValues({}, propsWithSlots), item.props.id);
|
5175
5247
|
}
|
5176
|
-
|
5177
|
-
};
|
5248
|
+
return null;
|
5249
|
+
}) });
|
5250
|
+
}
|
5251
|
+
|
5252
|
+
// components/SlotRender/server.tsx
|
5253
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
5254
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRender, __spreadValues({}, props));
|
5178
5255
|
var Item = ({
|
5179
5256
|
config,
|
5180
5257
|
item,
|
5181
5258
|
metadata
|
5182
5259
|
}) => {
|
5183
5260
|
const Component = config.components[item.type];
|
5184
|
-
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0,
|
5185
|
-
return /* @__PURE__ */ (0,
|
5261
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
5262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
5186
5263
|
Component.render,
|
5187
5264
|
__spreadProps(__spreadValues({}, props), {
|
5188
5265
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
5189
|
-
renderDropZone:
|
5266
|
+
renderDropZone: DropZoneRender,
|
5190
5267
|
metadata: metadata || {}
|
5191
5268
|
})
|
5192
5269
|
})
|
@@ -5194,11 +5271,11 @@ var Item = ({
|
|
5194
5271
|
};
|
5195
5272
|
var SlotRender = (0, import_react32.forwardRef)(
|
5196
5273
|
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
5197
|
-
return /* @__PURE__ */ (0,
|
5274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
|
5198
5275
|
if (!config.components[item.type]) {
|
5199
5276
|
return null;
|
5200
5277
|
}
|
5201
|
-
return /* @__PURE__ */ (0,
|
5278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
5202
5279
|
Item,
|
5203
5280
|
{
|
5204
5281
|
config,
|
@@ -5211,8 +5288,33 @@ var SlotRender = (0, import_react32.forwardRef)(
|
|
5211
5288
|
}
|
5212
5289
|
);
|
5213
5290
|
|
5291
|
+
// components/SlotRender/index.tsx
|
5292
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
5293
|
+
var ContextSlotRender = ({
|
5294
|
+
componentId,
|
5295
|
+
zone
|
5296
|
+
}) => {
|
5297
|
+
const config = useAppStore((s) => s.config);
|
5298
|
+
const metadata = useAppStore((s) => s.metadata);
|
5299
|
+
const slotContent = useAppStore(
|
5300
|
+
(s) => {
|
5301
|
+
var _a, _b;
|
5302
|
+
return (_b = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.props[zone]) != null ? _b : null;
|
5303
|
+
}
|
5304
|
+
);
|
5305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
5306
|
+
SlotRenderPure,
|
5307
|
+
{
|
5308
|
+
content: slotContent,
|
5309
|
+
zone,
|
5310
|
+
config,
|
5311
|
+
metadata
|
5312
|
+
}
|
5313
|
+
);
|
5314
|
+
};
|
5315
|
+
|
5214
5316
|
// components/Render/index.tsx
|
5215
|
-
var
|
5317
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
5216
5318
|
var renderContext = import_react33.default.createContext({
|
5217
5319
|
config: { components: {} },
|
5218
5320
|
data: { root: {}, content: [] },
|
@@ -5241,7 +5343,7 @@ function Render({
|
|
5241
5343
|
editMode: false,
|
5242
5344
|
id: "puck-root"
|
5243
5345
|
});
|
5244
|
-
const propsWithSlots = useSlots(config.root, pageProps, (props) => /* @__PURE__ */ (0,
|
5346
|
+
const propsWithSlots = useSlots(config.root, pageProps, (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata })));
|
5245
5347
|
const nextContextValue = (0, import_react33.useMemo)(
|
5246
5348
|
() => ({
|
5247
5349
|
mode: "render",
|
@@ -5250,17 +5352,17 @@ function Render({
|
|
5250
5352
|
[]
|
5251
5353
|
);
|
5252
5354
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5253
|
-
return /* @__PURE__ */ (0,
|
5355
|
+
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 }) })) }) });
|
5254
5356
|
}
|
5255
|
-
return /* @__PURE__ */ (0,
|
5357
|
+
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 }) }) });
|
5256
5358
|
}
|
5257
5359
|
|
5258
5360
|
// components/DropZone/index.tsx
|
5259
|
-
var
|
5361
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
5260
5362
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
|
5261
5363
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
5262
5364
|
var RENDER_DEBUG = false;
|
5263
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */ (0,
|
5365
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
|
5264
5366
|
var DropZoneChild = ({
|
5265
5367
|
zoneCompound,
|
5266
5368
|
componentId,
|
@@ -5320,7 +5422,7 @@ var DropZoneChild = ({
|
|
5320
5422
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
5321
5423
|
const renderPreview = (0, import_react34.useMemo)(
|
5322
5424
|
() => function Preview4() {
|
5323
|
-
return /* @__PURE__ */ (0,
|
5425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
|
5324
5426
|
},
|
5325
5427
|
[componentId, label, overrides]
|
5326
5428
|
);
|
@@ -5336,12 +5438,12 @@ var DropZoneChild = ({
|
|
5336
5438
|
componentConfig,
|
5337
5439
|
defaultsProps,
|
5338
5440
|
DropZoneEditPure,
|
5339
|
-
(slotProps) => /* @__PURE__ */ (0,
|
5441
|
+
(slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
|
5340
5442
|
nodeReadOnly,
|
5341
5443
|
isLoading
|
5342
5444
|
);
|
5343
5445
|
if (!item) return;
|
5344
|
-
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0,
|
5446
|
+
let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
5345
5447
|
"No configuration for ",
|
5346
5448
|
item.type
|
5347
5449
|
] });
|
@@ -5350,7 +5452,7 @@ var DropZoneChild = ({
|
|
5350
5452
|
if (isPreview) {
|
5351
5453
|
Render2 = renderPreview;
|
5352
5454
|
}
|
5353
|
-
return /* @__PURE__ */ (0,
|
5455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5354
5456
|
DraggableComponent,
|
5355
5457
|
{
|
5356
5458
|
id: componentId,
|
@@ -5365,14 +5467,14 @@ var DropZoneChild = ({
|
|
5365
5467
|
autoDragAxis: dragAxis,
|
5366
5468
|
userDragAxis: collisionAxis,
|
5367
5469
|
inDroppableZone,
|
5368
|
-
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isPreview ? /* @__PURE__ */ (0,
|
5470
|
+
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)(
|
5369
5471
|
Render2,
|
5370
5472
|
__spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
|
5371
5473
|
puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
|
5372
5474
|
dragRef
|
5373
5475
|
})
|
5374
5476
|
})
|
5375
|
-
) }) : /* @__PURE__ */ (0,
|
5477
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
|
5376
5478
|
}
|
5377
5479
|
);
|
5378
5480
|
};
|
@@ -5523,7 +5625,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5523
5625
|
userMinEmptyHeight,
|
5524
5626
|
ref
|
5525
5627
|
});
|
5526
|
-
return /* @__PURE__ */ (0,
|
5628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5527
5629
|
"div",
|
5528
5630
|
{
|
5529
5631
|
className: `${getClassName17({
|
@@ -5545,7 +5647,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5545
5647
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
5546
5648
|
}),
|
5547
5649
|
children: contentIdsWithPreview.map((componentId, i) => {
|
5548
|
-
return /* @__PURE__ */ (0,
|
5650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5549
5651
|
DropZoneChildMemo,
|
5550
5652
|
{
|
5551
5653
|
zoneCompound,
|
@@ -5570,7 +5672,7 @@ var DropZoneRenderItem = ({
|
|
5570
5672
|
metadata
|
5571
5673
|
}) => {
|
5572
5674
|
const Component = config.components[item.type];
|
5573
|
-
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0,
|
5675
|
+
const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
5574
5676
|
const nextContextValue = (0, import_react34.useMemo)(
|
5575
5677
|
() => ({
|
5576
5678
|
areaId: props.id,
|
@@ -5578,7 +5680,7 @@ var DropZoneRenderItem = ({
|
|
5578
5680
|
}),
|
5579
5681
|
[props]
|
5580
5682
|
);
|
5581
|
-
return /* @__PURE__ */ (0,
|
5683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5582
5684
|
Component.render,
|
5583
5685
|
__spreadProps(__spreadValues({}, props), {
|
5584
5686
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
@@ -5588,8 +5690,8 @@ var DropZoneRenderItem = ({
|
|
5588
5690
|
})
|
5589
5691
|
) }, props.id);
|
5590
5692
|
};
|
5591
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0,
|
5592
|
-
var
|
5693
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadValues({}, props));
|
5694
|
+
var DropZoneRender2 = (0, import_react34.forwardRef)(
|
5593
5695
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
5594
5696
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
5595
5697
|
const { areaId = "root" } = ctx || {};
|
@@ -5615,10 +5717,10 @@ var DropZoneRender = (0, import_react34.forwardRef)(
|
|
5615
5717
|
zoneCompound = `${areaId}:${zone}`;
|
5616
5718
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
5617
5719
|
}
|
5618
|
-
return /* @__PURE__ */ (0,
|
5720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
|
5619
5721
|
const Component = config.components[item.type];
|
5620
5722
|
if (Component) {
|
5621
|
-
return /* @__PURE__ */ (0,
|
5723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
5622
5724
|
DropZoneRenderItem,
|
5623
5725
|
{
|
5624
5726
|
config,
|
@@ -5632,14 +5734,14 @@ var DropZoneRender = (0, import_react34.forwardRef)(
|
|
5632
5734
|
}) });
|
5633
5735
|
}
|
5634
5736
|
);
|
5635
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
5737
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, __spreadValues({}, props));
|
5636
5738
|
var DropZone = (0, import_react34.forwardRef)(
|
5637
5739
|
function DropZone2(props, ref) {
|
5638
5740
|
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
5639
5741
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
5640
|
-
return /* @__PURE__ */ (0,
|
5742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
5641
5743
|
}
|
5642
|
-
return /* @__PURE__ */ (0,
|
5744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
|
5643
5745
|
}
|
5644
5746
|
);
|
5645
5747
|
|
@@ -5695,7 +5797,7 @@ var GlobalPosition = class {
|
|
5695
5797
|
var _a;
|
5696
5798
|
this.target = target;
|
5697
5799
|
this.original = original;
|
5698
|
-
this.frameEl = document.querySelector("
|
5800
|
+
this.frameEl = document.querySelector("#preview-frame");
|
5699
5801
|
if (this.frameEl) {
|
5700
5802
|
this.frameRect = this.frameEl.getBoundingClientRect();
|
5701
5803
|
this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
|
@@ -5957,7 +6059,7 @@ function getDeepDir(el) {
|
|
5957
6059
|
}
|
5958
6060
|
|
5959
6061
|
// components/DragDropContext/index.tsx
|
5960
|
-
var
|
6062
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
5961
6063
|
var DEBUG3 = false;
|
5962
6064
|
var dragListenerContext = (0, import_react36.createContext)({
|
5963
6065
|
dragListeners: {}
|
@@ -6124,14 +6226,14 @@ var DragDropContextClient = ({
|
|
6124
6226
|
}),
|
6125
6227
|
[]
|
6126
6228
|
);
|
6127
|
-
return /* @__PURE__ */ (0,
|
6229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6128
6230
|
dragListenerContext.Provider,
|
6129
6231
|
{
|
6130
6232
|
value: {
|
6131
6233
|
dragListeners,
|
6132
6234
|
setDragListeners
|
6133
6235
|
},
|
6134
|
-
children: /* @__PURE__ */ (0,
|
6236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
6135
6237
|
import_react35.DragDropProvider,
|
6136
6238
|
{
|
6137
6239
|
plugins,
|
@@ -6321,7 +6423,7 @@ var DragDropContextClient = ({
|
|
6321
6423
|
initialSelector.current = void 0;
|
6322
6424
|
zoneStore.setState({ draggedItem: event.operation.source });
|
6323
6425
|
},
|
6324
|
-
children: /* @__PURE__ */ (0,
|
6426
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
6325
6427
|
}
|
6326
6428
|
)
|
6327
6429
|
}
|
@@ -6335,11 +6437,11 @@ var DragDropContext = ({
|
|
6335
6437
|
if (status === "LOADING") {
|
6336
6438
|
return children;
|
6337
6439
|
}
|
6338
|
-
return /* @__PURE__ */ (0,
|
6440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
6339
6441
|
};
|
6340
6442
|
|
6341
6443
|
// components/Drawer/index.tsx
|
6342
|
-
var
|
6444
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
6343
6445
|
var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
|
6344
6446
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
6345
6447
|
var DrawerItemInner = ({
|
@@ -6350,10 +6452,10 @@ var DrawerItemInner = ({
|
|
6350
6452
|
isDragDisabled
|
6351
6453
|
}) => {
|
6352
6454
|
const CustomInner = (0, import_react37.useMemo)(
|
6353
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
6455
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
6354
6456
|
[children]
|
6355
6457
|
);
|
6356
|
-
return /* @__PURE__ */ (0,
|
6458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6357
6459
|
"div",
|
6358
6460
|
{
|
6359
6461
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
@@ -6361,9 +6463,9 @@ var DrawerItemInner = ({
|
|
6361
6463
|
onMouseDown: (e) => e.preventDefault(),
|
6362
6464
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
6363
6465
|
"data-puck-drawer-item": true,
|
6364
|
-
children: /* @__PURE__ */ (0,
|
6365
|
-
/* @__PURE__ */ (0,
|
6366
|
-
/* @__PURE__ */ (0,
|
6466
|
+
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: [
|
6467
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DragIcon, {}) })
|
6367
6469
|
] }) }) })
|
6368
6470
|
}
|
6369
6471
|
);
|
@@ -6380,9 +6482,9 @@ var DrawerItemDraggable = ({
|
|
6380
6482
|
data: { type: "drawer", componentType: name },
|
6381
6483
|
disabled: isDragDisabled
|
6382
6484
|
});
|
6383
|
-
return /* @__PURE__ */ (0,
|
6384
|
-
/* @__PURE__ */ (0,
|
6385
|
-
/* @__PURE__ */ (0,
|
6485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName18("draggable"), children: [
|
6486
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name, label, children }) }),
|
6487
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6386
6488
|
DrawerItemInner,
|
6387
6489
|
{
|
6388
6490
|
name,
|
@@ -6416,7 +6518,7 @@ var DrawerItem = ({
|
|
6416
6518
|
},
|
6417
6519
|
[resolvedId]
|
6418
6520
|
);
|
6419
|
-
return /* @__PURE__ */ (0,
|
6521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6420
6522
|
DrawerItemDraggable,
|
6421
6523
|
{
|
6422
6524
|
name,
|
@@ -6449,7 +6551,7 @@ var Drawer = ({
|
|
6449
6551
|
collisionPriority: 0
|
6450
6552
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
6451
6553
|
});
|
6452
|
-
return /* @__PURE__ */ (0,
|
6554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
6453
6555
|
"div",
|
6454
6556
|
{
|
6455
6557
|
className: getClassName18(),
|
@@ -6518,7 +6620,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
6518
6620
|
};
|
6519
6621
|
|
6520
6622
|
// components/SidebarSection/index.tsx
|
6521
|
-
var
|
6623
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
6522
6624
|
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
6523
6625
|
var SidebarSection = ({
|
6524
6626
|
children,
|
@@ -6531,15 +6633,15 @@ var SidebarSection = ({
|
|
6531
6633
|
}) => {
|
6532
6634
|
const setUi = useAppStore((s) => s.setUi);
|
6533
6635
|
const breadcrumbs = useBreadcrumbs(1);
|
6534
|
-
return /* @__PURE__ */ (0,
|
6636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
6535
6637
|
"div",
|
6536
6638
|
{
|
6537
6639
|
className: getClassName19({ noBorderTop, noPadding }),
|
6538
6640
|
style: { background },
|
6539
6641
|
children: [
|
6540
|
-
/* @__PURE__ */ (0,
|
6541
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
6542
|
-
/* @__PURE__ */ (0,
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
6643
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
6543
6645
|
"button",
|
6544
6646
|
{
|
6545
6647
|
type: "button",
|
@@ -6548,12 +6650,12 @@ var SidebarSection = ({
|
|
6548
6650
|
children: breadcrumb.label
|
6549
6651
|
}
|
6550
6652
|
),
|
6551
|
-
/* @__PURE__ */ (0,
|
6653
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
|
6552
6654
|
] }, i)) : null,
|
6553
|
-
/* @__PURE__ */ (0,
|
6655
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
6554
6656
|
] }) }),
|
6555
|
-
/* @__PURE__ */ (0,
|
6556
|
-
isLoading && /* @__PURE__ */ (0,
|
6657
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
|
6658
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
|
6557
6659
|
]
|
6558
6660
|
}
|
6559
6661
|
);
|
@@ -6567,7 +6669,7 @@ init_react_import();
|
|
6567
6669
|
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" };
|
6568
6670
|
|
6569
6671
|
// components/MenuBar/index.tsx
|
6570
|
-
var
|
6672
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
6571
6673
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
6572
6674
|
function MenuBar({
|
6573
6675
|
menuOpen = false,
|
@@ -6578,7 +6680,7 @@ function MenuBar({
|
|
6578
6680
|
const forward = useAppStore((s) => s.history.forward);
|
6579
6681
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
6580
6682
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
6581
|
-
return /* @__PURE__ */ (0,
|
6683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
6582
6684
|
"div",
|
6583
6685
|
{
|
6584
6686
|
className: getClassName20({ menuOpen }),
|
@@ -6592,12 +6694,12 @@ function MenuBar({
|
|
6592
6694
|
setMenuOpen(false);
|
6593
6695
|
}
|
6594
6696
|
},
|
6595
|
-
children: /* @__PURE__ */ (0,
|
6596
|
-
/* @__PURE__ */ (0,
|
6597
|
-
/* @__PURE__ */ (0,
|
6598
|
-
/* @__PURE__ */ (0,
|
6697
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName20("inner"), children: [
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName20("history"), children: [
|
6699
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Undo2, { size: 21 }) }),
|
6700
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Redo2, { size: 21 }) })
|
6599
6701
|
] }),
|
6600
|
-
/* @__PURE__ */ (0,
|
6702
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
6601
6703
|
] })
|
6602
6704
|
}
|
6603
6705
|
);
|
@@ -6617,12 +6719,12 @@ var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
6617
6719
|
// components/Puck/components/Fields/index.tsx
|
6618
6720
|
var import_react39 = require("react");
|
6619
6721
|
var import_shallow4 = require("zustand/react/shallow");
|
6620
|
-
var
|
6722
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
6621
6723
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
6622
6724
|
var DefaultFields = ({
|
6623
6725
|
children
|
6624
6726
|
}) => {
|
6625
|
-
return /* @__PURE__ */ (0,
|
6727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
6626
6728
|
};
|
6627
6729
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
|
6628
6730
|
let currentProps;
|
@@ -6693,7 +6795,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
6693
6795
|
]);
|
6694
6796
|
if (!field || !id) return null;
|
6695
6797
|
if (field.type === "slot") return null;
|
6696
|
-
return /* @__PURE__ */ (0,
|
6798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
6697
6799
|
AutoFieldPrivate,
|
6698
6800
|
{
|
6699
6801
|
field,
|
@@ -6725,7 +6827,7 @@ var Fields = ({ wrapFields = true }) => {
|
|
6725
6827
|
);
|
6726
6828
|
const isLoading = fieldsLoading || componentResolving;
|
6727
6829
|
const Wrapper = (0, import_react39.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
6728
|
-
return /* @__PURE__ */ (0,
|
6830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
6729
6831
|
"form",
|
6730
6832
|
{
|
6731
6833
|
className: getClassName21({ wrapFields }),
|
@@ -6733,8 +6835,8 @@ var Fields = ({ wrapFields = true }) => {
|
|
6733
6835
|
e.preventDefault();
|
6734
6836
|
},
|
6735
6837
|
children: [
|
6736
|
-
/* @__PURE__ */ (0,
|
6737
|
-
isLoading && /* @__PURE__ */ (0,
|
6838
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldsChild, { fieldName }, fieldName)) }),
|
6839
|
+
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 }) }) })
|
6738
6840
|
]
|
6739
6841
|
}
|
6740
6842
|
);
|
@@ -6755,7 +6857,7 @@ init_react_import();
|
|
6755
6857
|
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" };
|
6756
6858
|
|
6757
6859
|
// components/ComponentList/index.tsx
|
6758
|
-
var
|
6860
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
6759
6861
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
6760
6862
|
var ComponentListItem = ({
|
6761
6863
|
name,
|
@@ -6767,7 +6869,7 @@ var ComponentListItem = ({
|
|
6767
6869
|
type: name
|
6768
6870
|
}).insert
|
6769
6871
|
);
|
6770
|
-
return /* @__PURE__ */ (0,
|
6872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
6771
6873
|
};
|
6772
6874
|
var ComponentList = ({
|
6773
6875
|
children,
|
@@ -6778,8 +6880,8 @@ var ComponentList = ({
|
|
6778
6880
|
const setUi = useAppStore((s) => s.setUi);
|
6779
6881
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
6780
6882
|
const { expanded = true } = componentList[id] || {};
|
6781
|
-
return /* @__PURE__ */ (0,
|
6782
|
-
title && /* @__PURE__ */ (0,
|
6883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
|
6884
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
6783
6885
|
"button",
|
6784
6886
|
{
|
6785
6887
|
type: "button",
|
@@ -6793,14 +6895,14 @@ var ComponentList = ({
|
|
6793
6895
|
}),
|
6794
6896
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
6795
6897
|
children: [
|
6796
|
-
/* @__PURE__ */ (0,
|
6797
|
-
/* @__PURE__ */ (0,
|
6898
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: title }),
|
6899
|
+
/* @__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 }) })
|
6798
6900
|
]
|
6799
6901
|
}
|
6800
6902
|
),
|
6801
|
-
/* @__PURE__ */ (0,
|
6903
|
+
/* @__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) => {
|
6802
6904
|
var _a;
|
6803
|
-
return /* @__PURE__ */ (0,
|
6905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
6804
6906
|
ComponentListItem,
|
6805
6907
|
{
|
6806
6908
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -6814,7 +6916,7 @@ var ComponentList = ({
|
|
6814
6916
|
ComponentList.Item = ComponentListItem;
|
6815
6917
|
|
6816
6918
|
// lib/use-component-list.tsx
|
6817
|
-
var
|
6919
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
6818
6920
|
var useComponentList = () => {
|
6819
6921
|
const [componentList, setComponentList] = (0, import_react40.useState)();
|
6820
6922
|
const config = useAppStore((s) => s.config);
|
@@ -6829,7 +6931,7 @@ var useComponentList = () => {
|
|
6829
6931
|
if (category.visible === false || !category.components) {
|
6830
6932
|
return null;
|
6831
6933
|
}
|
6832
|
-
return /* @__PURE__ */ (0,
|
6934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6833
6935
|
ComponentList,
|
6834
6936
|
{
|
6835
6937
|
id: categoryKey,
|
@@ -6838,7 +6940,7 @@ var useComponentList = () => {
|
|
6838
6940
|
var _a2;
|
6839
6941
|
matchedComponents.push(componentName);
|
6840
6942
|
const componentConf = config.components[componentName] || {};
|
6841
|
-
return /* @__PURE__ */ (0,
|
6943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6842
6944
|
ComponentList.Item,
|
6843
6945
|
{
|
6844
6946
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -6858,7 +6960,7 @@ var useComponentList = () => {
|
|
6858
6960
|
);
|
6859
6961
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
6860
6962
|
_componentList.push(
|
6861
|
-
/* @__PURE__ */ (0,
|
6963
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6862
6964
|
ComponentList,
|
6863
6965
|
{
|
6864
6966
|
id: "other",
|
@@ -6866,7 +6968,7 @@ var useComponentList = () => {
|
|
6866
6968
|
children: remainingComponents.map((componentName, i) => {
|
6867
6969
|
var _a2;
|
6868
6970
|
const componentConf = config.components[componentName] || {};
|
6869
|
-
return /* @__PURE__ */ (0,
|
6971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6870
6972
|
ComponentList.Item,
|
6871
6973
|
{
|
6872
6974
|
name: componentName,
|
@@ -6889,12 +6991,12 @@ var useComponentList = () => {
|
|
6889
6991
|
|
6890
6992
|
// components/Puck/components/Components/index.tsx
|
6891
6993
|
var import_react41 = require("react");
|
6892
|
-
var
|
6994
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
6893
6995
|
var Components = () => {
|
6894
6996
|
const overrides = useAppStore((s) => s.overrides);
|
6895
6997
|
const componentList = useComponentList();
|
6896
6998
|
const Wrapper = (0, import_react41.useMemo)(() => overrides.components || "div", [overrides]);
|
6897
|
-
return /* @__PURE__ */ (0,
|
6999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComponentList, { id: "all" }) });
|
6898
7000
|
};
|
6899
7001
|
|
6900
7002
|
// components/Puck/components/Preview/index.tsx
|
@@ -6906,7 +7008,7 @@ init_react_import();
|
|
6906
7008
|
var import_react42 = require("react");
|
6907
7009
|
var import_object_hash = __toESM(require("object-hash"));
|
6908
7010
|
var import_react_dom3 = require("react-dom");
|
6909
|
-
var
|
7011
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
6910
7012
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
6911
7013
|
var collectStyles = (doc) => {
|
6912
7014
|
const collected = [];
|
@@ -7106,7 +7208,7 @@ var CopyHostStyles = ({
|
|
7106
7208
|
observer.disconnect();
|
7107
7209
|
};
|
7108
7210
|
}, []);
|
7109
|
-
return /* @__PURE__ */ (0,
|
7211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
|
7110
7212
|
};
|
7111
7213
|
var autoFrameContext = (0, import_react42.createContext)({});
|
7112
7214
|
var useFrame = () => (0, import_react42.useContext)(autoFrameContext);
|
@@ -7153,7 +7255,7 @@ function AutoFrame(_a) {
|
|
7153
7255
|
}
|
7154
7256
|
}
|
7155
7257
|
}, [frameRef, loaded, stylesLoaded]);
|
7156
|
-
return /* @__PURE__ */ (0,
|
7258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7157
7259
|
"iframe",
|
7158
7260
|
__spreadProps(__spreadValues({}, props), {
|
7159
7261
|
className,
|
@@ -7163,7 +7265,7 @@ function AutoFrame(_a) {
|
|
7163
7265
|
onLoad: () => {
|
7164
7266
|
setLoaded(true);
|
7165
7267
|
},
|
7166
|
-
children: /* @__PURE__ */ (0,
|
7268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7167
7269
|
CopyHostStyles,
|
7168
7270
|
{
|
7169
7271
|
debug,
|
@@ -7182,7 +7284,7 @@ init_react_import();
|
|
7182
7284
|
var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
7183
7285
|
|
7184
7286
|
// components/Puck/components/Preview/index.tsx
|
7185
|
-
var
|
7287
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
7186
7288
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
7187
7289
|
var useBubbleIframeEvents = (ref) => {
|
7188
7290
|
const status = useAppStore((s) => s.status);
|
@@ -7242,7 +7344,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7242
7344
|
const propsWithSlots = useSlots(rootConfig, pageProps, DropZoneEditPure);
|
7243
7345
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
7244
7346
|
id: "puck-root"
|
7245
|
-
}, propsWithSlots)) : /* @__PURE__ */ (0,
|
7347
|
+
}, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: propsWithSlots.children });
|
7246
7348
|
},
|
7247
7349
|
[config.root]
|
7248
7350
|
);
|
@@ -7250,7 +7352,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7250
7352
|
const rootProps = root.props || root;
|
7251
7353
|
const ref = (0, import_react43.useRef)(null);
|
7252
7354
|
useBubbleIframeEvents(ref);
|
7253
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
7355
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7254
7356
|
Page,
|
7255
7357
|
__spreadProps(__spreadValues({}, rootProps), {
|
7256
7358
|
puck: {
|
@@ -7260,15 +7362,15 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7260
7362
|
metadata
|
7261
7363
|
},
|
7262
7364
|
editMode: true,
|
7263
|
-
children: /* @__PURE__ */ (0,
|
7365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZonePure, { zone: rootDroppableId })
|
7264
7366
|
})
|
7265
|
-
) : /* @__PURE__ */ (0,
|
7367
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Render, { data: renderData, config });
|
7266
7368
|
(0, import_react43.useEffect)(() => {
|
7267
7369
|
if (!iframe.enabled) {
|
7268
7370
|
setStatus("READY");
|
7269
7371
|
}
|
7270
7372
|
}, [iframe.enabled]);
|
7271
|
-
return /* @__PURE__ */ (0,
|
7373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7272
7374
|
"div",
|
7273
7375
|
{
|
7274
7376
|
className: getClassName23(),
|
@@ -7277,7 +7379,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7277
7379
|
onClick: () => {
|
7278
7380
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
7279
7381
|
},
|
7280
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
7382
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7281
7383
|
AutoFrame_default,
|
7282
7384
|
{
|
7283
7385
|
id: "preview-frame",
|
@@ -7290,14 +7392,14 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
7290
7392
|
setStatus("MOUNTED");
|
7291
7393
|
},
|
7292
7394
|
frameRef: ref,
|
7293
|
-
children: /* @__PURE__ */ (0,
|
7395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
7294
7396
|
if (Frame) {
|
7295
|
-
return /* @__PURE__ */ (0,
|
7397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Frame, { document: document2, children: inner });
|
7296
7398
|
}
|
7297
7399
|
return inner;
|
7298
7400
|
} })
|
7299
7401
|
}
|
7300
|
-
) : /* @__PURE__ */ (0,
|
7402
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
7301
7403
|
"div",
|
7302
7404
|
{
|
7303
7405
|
id: "preview-frame",
|
@@ -7356,7 +7458,7 @@ var onScrollEnd = (frame, cb) => {
|
|
7356
7458
|
|
7357
7459
|
// components/LayerTree/index.tsx
|
7358
7460
|
var import_shallow5 = require("zustand/react/shallow");
|
7359
|
-
var
|
7461
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
7360
7462
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
7361
7463
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
7362
7464
|
var Layer = ({
|
@@ -7402,7 +7504,7 @@ var Layer = ({
|
|
7402
7504
|
});
|
7403
7505
|
const componentConfig = config.components[nodeData.data.type];
|
7404
7506
|
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
7405
|
-
return /* @__PURE__ */ (0,
|
7507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
7406
7508
|
"li",
|
7407
7509
|
{
|
7408
7510
|
className: getClassNameLayer({
|
@@ -7412,7 +7514,7 @@ var Layer = ({
|
|
7412
7514
|
childIsSelected
|
7413
7515
|
}),
|
7414
7516
|
children: [
|
7415
|
-
/* @__PURE__ */ (0,
|
7517
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
7416
7518
|
"button",
|
7417
7519
|
{
|
7418
7520
|
type: "button",
|
@@ -7447,22 +7549,22 @@ var Layer = ({
|
|
7447
7549
|
setHoveringComponent(null);
|
7448
7550
|
},
|
7449
7551
|
children: [
|
7450
|
-
containsZone && /* @__PURE__ */ (0,
|
7552
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
7451
7553
|
"div",
|
7452
7554
|
{
|
7453
7555
|
className: getClassNameLayer("chevron"),
|
7454
7556
|
title: isSelected ? "Collapse" : "Expand",
|
7455
|
-
children: /* @__PURE__ */ (0,
|
7557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChevronDown, { size: "12" })
|
7456
7558
|
}
|
7457
7559
|
),
|
7458
|
-
/* @__PURE__ */ (0,
|
7459
|
-
/* @__PURE__ */ (0,
|
7460
|
-
/* @__PURE__ */ (0,
|
7560
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
7561
|
+
/* @__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" }) }),
|
7562
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("name"), children: label })
|
7461
7563
|
] })
|
7462
7564
|
]
|
7463
7565
|
}
|
7464
7566
|
) }),
|
7465
|
-
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0,
|
7567
|
+
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))
|
7466
7568
|
]
|
7467
7569
|
}
|
7468
7570
|
);
|
@@ -7480,15 +7582,15 @@ var LayerTree = ({
|
|
7480
7582
|
}
|
7481
7583
|
)
|
7482
7584
|
);
|
7483
|
-
return /* @__PURE__ */ (0,
|
7484
|
-
label && /* @__PURE__ */ (0,
|
7485
|
-
/* @__PURE__ */ (0,
|
7585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
7586
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
7587
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Layers, { size: "16" }) }),
|
7486
7588
|
label
|
7487
7589
|
] }),
|
7488
|
-
/* @__PURE__ */ (0,
|
7489
|
-
contentIds.length === 0 && /* @__PURE__ */ (0,
|
7590
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("ul", { className: getClassName24(), children: [
|
7591
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
7490
7592
|
contentIds.map((itemId, i) => {
|
7491
|
-
return /* @__PURE__ */ (0,
|
7593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
7492
7594
|
Layer,
|
7493
7595
|
{
|
7494
7596
|
index: i,
|
@@ -7515,14 +7617,14 @@ var findZonesForArea = (state, area) => {
|
|
7515
7617
|
|
7516
7618
|
// components/Puck/components/Outline/index.tsx
|
7517
7619
|
var import_shallow6 = require("zustand/react/shallow");
|
7518
|
-
var
|
7620
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
7519
7621
|
var Outline = () => {
|
7520
7622
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
7521
7623
|
const rootZones = useAppStore(
|
7522
7624
|
(0, import_shallow6.useShallow)((s) => findZonesForArea(s.state, "root"))
|
7523
7625
|
);
|
7524
7626
|
const Wrapper = (0, import_react45.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
7525
|
-
return /* @__PURE__ */ (0,
|
7627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
7526
7628
|
LayerTree,
|
7527
7629
|
{
|
7528
7630
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
@@ -7666,11 +7768,11 @@ init_react_import();
|
|
7666
7768
|
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" };
|
7667
7769
|
|
7668
7770
|
// components/ViewportControls/index.tsx
|
7669
|
-
var
|
7771
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
7670
7772
|
var icons = {
|
7671
|
-
Smartphone: /* @__PURE__ */ (0,
|
7672
|
-
Tablet: /* @__PURE__ */ (0,
|
7673
|
-
Monitor: /* @__PURE__ */ (0,
|
7773
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Smartphone, { size: 16 }),
|
7774
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Tablet, { size: 16 }),
|
7775
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Monitor, { size: 16 })
|
7674
7776
|
};
|
7675
7777
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
7676
7778
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -7686,7 +7788,7 @@ var ViewportButton = ({
|
|
7686
7788
|
(0, import_react46.useEffect)(() => {
|
7687
7789
|
setIsActive(width === viewports.current.width);
|
7688
7790
|
}, [width, viewports.current.width]);
|
7689
|
-
return /* @__PURE__ */ (0,
|
7791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7690
7792
|
IconButton,
|
7691
7793
|
{
|
7692
7794
|
title,
|
@@ -7695,7 +7797,7 @@ var ViewportButton = ({
|
|
7695
7797
|
e.stopPropagation();
|
7696
7798
|
onClick({ width, height });
|
7697
7799
|
},
|
7698
|
-
children: /* @__PURE__ */ (0,
|
7800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: getClassNameButton("inner"), children })
|
7699
7801
|
}
|
7700
7802
|
) });
|
7701
7803
|
};
|
@@ -7731,8 +7833,8 @@ var ViewportControls = ({
|
|
7731
7833
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
7732
7834
|
[autoZoom]
|
7733
7835
|
);
|
7734
|
-
return /* @__PURE__ */ (0,
|
7735
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
7836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25(), children: [
|
7837
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7736
7838
|
ViewportButton,
|
7737
7839
|
{
|
7738
7840
|
height: viewport.height,
|
@@ -7743,8 +7845,8 @@ var ViewportControls = ({
|
|
7743
7845
|
},
|
7744
7846
|
i
|
7745
7847
|
)),
|
7746
|
-
/* @__PURE__ */ (0,
|
7747
|
-
/* @__PURE__ */ (0,
|
7848
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("divider") }),
|
7849
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7748
7850
|
IconButton,
|
7749
7851
|
{
|
7750
7852
|
title: "Zoom viewport out",
|
@@ -7758,10 +7860,10 @@ var ViewportControls = ({
|
|
7758
7860
|
)].value
|
7759
7861
|
);
|
7760
7862
|
},
|
7761
|
-
children: /* @__PURE__ */ (0,
|
7863
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ZoomOut, { size: 16 })
|
7762
7864
|
}
|
7763
7865
|
),
|
7764
|
-
/* @__PURE__ */ (0,
|
7866
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7765
7867
|
IconButton,
|
7766
7868
|
{
|
7767
7869
|
title: "Zoom viewport in",
|
@@ -7775,11 +7877,11 @@ var ViewportControls = ({
|
|
7775
7877
|
)].value
|
7776
7878
|
);
|
7777
7879
|
},
|
7778
|
-
children: /* @__PURE__ */ (0,
|
7880
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ZoomIn, { size: 16 })
|
7779
7881
|
}
|
7780
7882
|
),
|
7781
|
-
/* @__PURE__ */ (0,
|
7782
|
-
/* @__PURE__ */ (0,
|
7883
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("divider") }),
|
7884
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7783
7885
|
"select",
|
7784
7886
|
{
|
7785
7887
|
className: getClassName25("zoomSelect"),
|
@@ -7787,7 +7889,7 @@ var ViewportControls = ({
|
|
7787
7889
|
onChange: (e) => {
|
7788
7890
|
onZoom(parseFloat(e.currentTarget.value));
|
7789
7891
|
},
|
7790
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
7892
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7791
7893
|
"option",
|
7792
7894
|
{
|
7793
7895
|
value: option.value,
|
@@ -7836,7 +7938,7 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
7836
7938
|
|
7837
7939
|
// components/Puck/components/Canvas/index.tsx
|
7838
7940
|
var import_shallow7 = require("zustand/react/shallow");
|
7839
|
-
var
|
7941
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
7840
7942
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
7841
7943
|
var ZOOM_ON_CHANGE = true;
|
7842
7944
|
var Canvas = () => {
|
@@ -7869,7 +7971,7 @@ var Canvas = () => {
|
|
7869
7971
|
const frameRef = (0, import_react47.useRef)(null);
|
7870
7972
|
const [showTransition, setShowTransition] = (0, import_react47.useState)(false);
|
7871
7973
|
const defaultRender = (0, import_react47.useMemo)(() => {
|
7872
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
7974
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
|
7873
7975
|
return PuckDefault;
|
7874
7976
|
}, []);
|
7875
7977
|
const CustomPreview = (0, import_react47.useMemo)(
|
@@ -7932,7 +8034,7 @@ var Canvas = () => {
|
|
7932
8034
|
setShowLoader(true);
|
7933
8035
|
}, 500);
|
7934
8036
|
}, []);
|
7935
|
-
return /* @__PURE__ */ (0,
|
8037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
7936
8038
|
"div",
|
7937
8039
|
{
|
7938
8040
|
className: getClassName26({
|
@@ -7945,7 +8047,7 @@ var Canvas = () => {
|
|
7945
8047
|
recordHistory: true
|
7946
8048
|
}),
|
7947
8049
|
children: [
|
7948
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
8050
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
7949
8051
|
ViewportControls,
|
7950
8052
|
{
|
7951
8053
|
autoZoom: zoomConfig.autoZoom,
|
@@ -7971,8 +8073,8 @@ var Canvas = () => {
|
|
7971
8073
|
}
|
7972
8074
|
}
|
7973
8075
|
) }),
|
7974
|
-
/* @__PURE__ */ (0,
|
7975
|
-
/* @__PURE__ */ (0,
|
8076
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
8077
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
7976
8078
|
"div",
|
7977
8079
|
{
|
7978
8080
|
className: getClassName26("root"),
|
@@ -7993,10 +8095,10 @@ var Canvas = () => {
|
|
7993
8095
|
})
|
7994
8096
|
);
|
7995
8097
|
},
|
7996
|
-
children: /* @__PURE__ */ (0,
|
8098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Preview3, {}) })
|
7997
8099
|
}
|
7998
8100
|
),
|
7999
|
-
/* @__PURE__ */ (0,
|
8101
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Loader, { size: 24 }) })
|
8000
8102
|
] })
|
8001
8103
|
]
|
8002
8104
|
}
|
@@ -8051,8 +8153,8 @@ var useLoadedOverrides = ({
|
|
8051
8153
|
|
8052
8154
|
// components/DefaultOverride/index.tsx
|
8053
8155
|
init_react_import();
|
8054
|
-
var
|
8055
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
8156
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
8157
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
8056
8158
|
|
8057
8159
|
// lib/use-inject-css.ts
|
8058
8160
|
init_react_import();
|
@@ -8187,7 +8289,7 @@ function usePuck() {
|
|
8187
8289
|
}
|
8188
8290
|
|
8189
8291
|
// components/Puck/index.tsx
|
8190
|
-
var
|
8292
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
8191
8293
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
8192
8294
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
8193
8295
|
var FieldSideBar = () => {
|
@@ -8197,11 +8299,11 @@ var FieldSideBar = () => {
|
|
8197
8299
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
|
8198
8300
|
}
|
8199
8301
|
);
|
8200
|
-
return /* @__PURE__ */ (0,
|
8302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Fields, {}) });
|
8201
8303
|
};
|
8202
8304
|
var propsContext = (0, import_react52.createContext)({});
|
8203
8305
|
function PropsProvider(props) {
|
8204
|
-
return /* @__PURE__ */ (0,
|
8306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(propsContext.Provider, { value: props, children: props.children });
|
8205
8307
|
}
|
8206
8308
|
var usePropsContext = () => (0, import_react52.useContext)(propsContext);
|
8207
8309
|
function PuckProvider({ children }) {
|
@@ -8280,7 +8382,7 @@ function PuckProvider({ children }) {
|
|
8280
8382
|
) : {}
|
8281
8383
|
})
|
8282
8384
|
});
|
8283
|
-
return
|
8385
|
+
return walkAppState(newAppState, config);
|
8284
8386
|
});
|
8285
8387
|
const { appendData = true } = _initialHistory || {};
|
8286
8388
|
const [blendedHistories] = (0, import_react52.useState)(
|
@@ -8290,7 +8392,7 @@ function PuckProvider({ children }) {
|
|
8290
8392
|
].map((history) => {
|
8291
8393
|
let newState = __spreadValues(__spreadValues({}, generatedAppState), history.state);
|
8292
8394
|
if (!history.state.indexes) {
|
8293
|
-
newState =
|
8395
|
+
newState = walkAppState(newState, config);
|
8294
8396
|
}
|
8295
8397
|
return __spreadProps(__spreadValues({}, history), {
|
8296
8398
|
state: newState
|
@@ -8350,7 +8452,7 @@ function PuckProvider({ children }) {
|
|
8350
8452
|
const { resolveAndCommitData } = appStore.getState();
|
8351
8453
|
resolveAndCommitData();
|
8352
8454
|
}, []);
|
8353
|
-
return /* @__PURE__ */ (0,
|
8455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
8354
8456
|
}
|
8355
8457
|
function PuckLayout({ children }) {
|
8356
8458
|
const {
|
@@ -8430,7 +8532,7 @@ function PuckLayout({ children }) {
|
|
8430
8532
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
8431
8533
|
const Comp = renderHeader;
|
8432
8534
|
const appState = useAppStore((s) => s.state);
|
8433
|
-
return /* @__PURE__ */ (0,
|
8535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
8434
8536
|
};
|
8435
8537
|
return RenderHeader;
|
8436
8538
|
}
|
@@ -8444,7 +8546,7 @@ function PuckLayout({ children }) {
|
|
8444
8546
|
const RenderHeader = (props) => {
|
8445
8547
|
const Comp = renderHeaderActions;
|
8446
8548
|
const appState = useAppStore((s) => s.state);
|
8447
|
-
return /* @__PURE__ */ (0,
|
8549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
8448
8550
|
};
|
8449
8551
|
return RenderHeader;
|
8450
8552
|
}
|
@@ -8478,8 +8580,8 @@ function PuckLayout({ children }) {
|
|
8478
8580
|
}
|
8479
8581
|
}, [ready, iframe.enabled]);
|
8480
8582
|
usePreviewModeHotkeys();
|
8481
|
-
return /* @__PURE__ */ (0,
|
8482
|
-
/* @__PURE__ */ (0,
|
8583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
8584
|
+
/* @__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)(
|
8483
8585
|
"div",
|
8484
8586
|
{
|
8485
8587
|
className: getLayoutClassName({
|
@@ -8488,61 +8590,61 @@ function PuckLayout({ children }) {
|
|
8488
8590
|
mounted,
|
8489
8591
|
rightSideBarVisible
|
8490
8592
|
}),
|
8491
|
-
children: /* @__PURE__ */ (0,
|
8492
|
-
/* @__PURE__ */ (0,
|
8593
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
8594
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8493
8595
|
CustomHeader,
|
8494
8596
|
{
|
8495
|
-
actions: /* @__PURE__ */ (0,
|
8597
|
+
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)(
|
8496
8598
|
Button,
|
8497
8599
|
{
|
8498
8600
|
onClick: () => {
|
8499
8601
|
const data = appStore.getState().state.data;
|
8500
8602
|
onPublish && onPublish(data);
|
8501
8603
|
},
|
8502
|
-
icon: /* @__PURE__ */ (0,
|
8604
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
8503
8605
|
children: "Publish"
|
8504
8606
|
}
|
8505
8607
|
) }) }),
|
8506
|
-
children: /* @__PURE__ */ (0,
|
8507
|
-
/* @__PURE__ */ (0,
|
8508
|
-
/* @__PURE__ */ (0,
|
8608
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
8609
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
8610
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8509
8611
|
"div",
|
8510
8612
|
{
|
8511
8613
|
className: getLayoutClassName("leftSideBarToggle"),
|
8512
|
-
children: /* @__PURE__ */ (0,
|
8614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8513
8615
|
IconButton,
|
8514
8616
|
{
|
8515
8617
|
onClick: () => {
|
8516
8618
|
toggleSidebars("left");
|
8517
8619
|
},
|
8518
8620
|
title: "Toggle left sidebar",
|
8519
|
-
children: /* @__PURE__ */ (0,
|
8621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
|
8520
8622
|
}
|
8521
8623
|
)
|
8522
8624
|
}
|
8523
8625
|
),
|
8524
|
-
/* @__PURE__ */ (0,
|
8626
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8525
8627
|
"div",
|
8526
8628
|
{
|
8527
8629
|
className: getLayoutClassName("rightSideBarToggle"),
|
8528
|
-
children: /* @__PURE__ */ (0,
|
8630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8529
8631
|
IconButton,
|
8530
8632
|
{
|
8531
8633
|
onClick: () => {
|
8532
8634
|
toggleSidebars("right");
|
8533
8635
|
},
|
8534
8636
|
title: "Toggle right sidebar",
|
8535
|
-
children: /* @__PURE__ */ (0,
|
8637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
|
8536
8638
|
}
|
8537
8639
|
)
|
8538
8640
|
}
|
8539
8641
|
)
|
8540
8642
|
] }),
|
8541
|
-
/* @__PURE__ */ (0,
|
8643
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
8542
8644
|
headerTitle || (rootProps == null ? void 0 : rootProps.title) || "Page",
|
8543
|
-
headerPath && /* @__PURE__ */ (0,
|
8645
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
8544
8646
|
" ",
|
8545
|
-
/* @__PURE__ */ (0,
|
8647
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8546
8648
|
"code",
|
8547
8649
|
{
|
8548
8650
|
className: getLayoutClassName("headerPath"),
|
@@ -8551,31 +8653,31 @@ function PuckLayout({ children }) {
|
|
8551
8653
|
)
|
8552
8654
|
] })
|
8553
8655
|
] }) }),
|
8554
|
-
/* @__PURE__ */ (0,
|
8555
|
-
/* @__PURE__ */ (0,
|
8656
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
8657
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8556
8658
|
IconButton,
|
8557
8659
|
{
|
8558
8660
|
onClick: () => {
|
8559
8661
|
return setMenuOpen(!menuOpen);
|
8560
8662
|
},
|
8561
8663
|
title: "Toggle menu bar",
|
8562
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
8664
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronDown, { focusable: "false" })
|
8563
8665
|
}
|
8564
8666
|
) }),
|
8565
|
-
/* @__PURE__ */ (0,
|
8667
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8566
8668
|
MenuBar,
|
8567
8669
|
{
|
8568
8670
|
dispatch,
|
8569
8671
|
onPublish,
|
8570
8672
|
menuOpen,
|
8571
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
8673
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
8572
8674
|
Button,
|
8573
8675
|
{
|
8574
8676
|
onClick: () => {
|
8575
8677
|
const data = appStore.getState().state.data;
|
8576
8678
|
onPublish && onPublish(data);
|
8577
8679
|
},
|
8578
|
-
icon: /* @__PURE__ */ (0,
|
8680
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
8579
8681
|
children: "Publish"
|
8580
8682
|
}
|
8581
8683
|
) }),
|
@@ -8586,20 +8688,20 @@ function PuckLayout({ children }) {
|
|
8586
8688
|
] }) })
|
8587
8689
|
}
|
8588
8690
|
),
|
8589
|
-
/* @__PURE__ */ (0,
|
8590
|
-
/* @__PURE__ */ (0,
|
8591
|
-
/* @__PURE__ */ (0,
|
8691
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
8692
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Components, {}) }),
|
8693
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Outline, {}) })
|
8592
8694
|
] }),
|
8593
|
-
/* @__PURE__ */ (0,
|
8594
|
-
/* @__PURE__ */ (0,
|
8695
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Canvas, {}),
|
8696
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FieldSideBar, {}) })
|
8595
8697
|
] })
|
8596
8698
|
}
|
8597
8699
|
) }) }),
|
8598
|
-
/* @__PURE__ */ (0,
|
8700
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
8599
8701
|
] });
|
8600
8702
|
}
|
8601
8703
|
function Puck(props) {
|
8602
|
-
return /* @__PURE__ */ (0,
|
8704
|
+
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)) })) }));
|
8603
8705
|
}
|
8604
8706
|
Puck.Components = Components;
|
8605
8707
|
Puck.Fields = Fields;
|
@@ -8631,9 +8733,9 @@ var migrations = [
|
|
8631
8733
|
console.log("Migrating DropZones to slots...");
|
8632
8734
|
const updatedItems = {};
|
8633
8735
|
const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
|
8634
|
-
const { indexes } =
|
8736
|
+
const { indexes } = walkAppState(appState, config);
|
8635
8737
|
const deletedCompounds = [];
|
8636
|
-
|
8738
|
+
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
8637
8739
|
var _a2, _b;
|
8638
8740
|
if (zoneType === "dropzone") {
|
8639
8741
|
const [id, slotName] = zoneCompound.split(":");
|
@@ -8652,7 +8754,7 @@ var migrations = [
|
|
8652
8754
|
}
|
8653
8755
|
return content;
|
8654
8756
|
});
|
8655
|
-
const updated =
|
8757
|
+
const updated = walkAppState(
|
8656
8758
|
appState,
|
8657
8759
|
config,
|
8658
8760
|
(content) => content,
|
@@ -8806,13 +8908,13 @@ function resolveAllData(_0, _1) {
|
|
8806
8908
|
Puck,
|
8807
8909
|
Render,
|
8808
8910
|
createUsePuck,
|
8809
|
-
mapSlots,
|
8810
8911
|
migrate,
|
8811
8912
|
overrideKeys,
|
8812
8913
|
renderContext,
|
8813
8914
|
resolveAllData,
|
8814
8915
|
transformProps,
|
8815
|
-
usePuck
|
8916
|
+
usePuck,
|
8917
|
+
walkTree
|
8816
8918
|
});
|
8817
8919
|
/*! Bundled license information:
|
8818
8920
|
|