@measured/puck 0.19.0-canary.e829bea0 → 0.19.0-canary.eda38b34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,9 +9,6 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
9
  var __getProtoOf = Object.getPrototypeOf;
10
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
11
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __typeError = (msg) => {
13
- throw TypeError(msg);
14
- };
15
12
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
13
  var __spreadValues = (a, b) => {
17
14
  for (var prop in b || (b = {}))
@@ -64,10 +61,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
64
61
  mod
65
62
  ));
66
63
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
67
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
68
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
69
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
70
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
71
64
  var __async = (__this, __arguments, generator) => {
72
65
  return new Promise((resolve, reject) => {
73
66
  var fulfilled = (value) => {
@@ -176,13 +169,13 @@ __export(core_exports, {
176
169
  Puck: () => Puck,
177
170
  Render: () => Render,
178
171
  createUsePuck: () => createUsePuck,
179
- mapSlots: () => mapSlotsPublic,
180
172
  migrate: () => migrate,
181
173
  overrideKeys: () => overrideKeys,
182
174
  renderContext: () => renderContext,
183
175
  resolveAllData: () => resolveAllData,
184
176
  transformProps: () => transformProps,
185
- usePuck: () => usePuck
177
+ usePuck: () => usePuck,
178
+ walkTree: () => walkTree
186
179
  });
187
180
  module.exports = __toCommonJS(core_exports);
188
181
  init_react_import();
@@ -795,7 +788,7 @@ init_react_import();
795
788
  // reducer/actions/set.ts
796
789
  init_react_import();
797
790
 
798
- // lib/data/walk-tree.ts
791
+ // lib/data/walk-app-state.ts
799
792
  init_react_import();
800
793
 
801
794
  // lib/data/for-each-slot.ts
@@ -884,8 +877,8 @@ var stripSlots = (data) => {
884
877
  });
885
878
  };
886
879
 
887
- // lib/data/walk-tree.ts
888
- function walkTree(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
880
+ // lib/data/walk-app-state.ts
881
+ function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
889
882
  var _a;
890
883
  let newZones = {};
891
884
  const newZoneIndex = {};
@@ -1018,7 +1011,7 @@ var setAction = (state, action, appStore) => {
1018
1011
  console.warn(
1019
1012
  "`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
1020
1013
  );
1021
- return walkTree(newState, appStore.config);
1014
+ return walkAppState(newState, appStore.config);
1022
1015
  }
1023
1016
  return __spreadValues(__spreadValues({}, state), action.state(state));
1024
1017
  };
@@ -1047,18 +1040,116 @@ var getIdsForParent = (zoneCompound, state) => {
1047
1040
  return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
1048
1041
  };
1049
1042
 
1043
+ // lib/data/populate-ids.ts
1044
+ init_react_import();
1045
+
1046
+ // lib/data/walk-tree.ts
1047
+ init_react_import();
1048
+
1049
+ // lib/data/map-slots.ts
1050
+ init_react_import();
1051
+ function mapSlotsAsync(_0, _1) {
1052
+ return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
1053
+ const props = __spreadValues({}, item.props);
1054
+ const propKeys = Object.keys(props);
1055
+ for (let i = 0; i < propKeys.length; i++) {
1056
+ const propKey = propKeys[i];
1057
+ const itemType = "type" in item ? item.type : "root";
1058
+ if (isSlot2(itemType, propKey, props[propKey])) {
1059
+ const content = props[propKey];
1060
+ const mappedContent = recursive ? yield Promise.all(
1061
+ content.map((item2) => __async(this, null, function* () {
1062
+ return yield mapSlotsAsync(item2, map, recursive, isSlot2);
1063
+ }))
1064
+ ) : content;
1065
+ props[propKey] = yield map(mappedContent, propKey);
1066
+ }
1067
+ }
1068
+ return __spreadProps(__spreadValues({}, item), { props });
1069
+ });
1070
+ }
1071
+ function mapSlotsSync(item, map, isSlot2 = isSlot) {
1072
+ var _a, _b;
1073
+ const props = __spreadValues({}, item.props);
1074
+ const propKeys = Object.keys(props);
1075
+ for (let i = 0; i < propKeys.length; i++) {
1076
+ const propKey = propKeys[i];
1077
+ const itemType = "type" in item ? item.type : "root";
1078
+ if (isSlot2(itemType, propKey, props[propKey])) {
1079
+ const content = props[propKey];
1080
+ const mappedContent = content.map((item2) => {
1081
+ return mapSlotsSync(item2, map, isSlot2);
1082
+ });
1083
+ props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
1084
+ }
1085
+ }
1086
+ return __spreadProps(__spreadValues({}, item), { props });
1087
+ }
1088
+
1089
+ // lib/data/walk-tree.ts
1090
+ function walkTree(data, config, callbackFn) {
1091
+ var _a, _b;
1092
+ const isSlot2 = createIsSlotConfig(config);
1093
+ const walkItem = (item) => {
1094
+ return mapSlotsSync(
1095
+ item,
1096
+ (content, parentId, propName) => callbackFn(content, { parentId, propName }),
1097
+ isSlot2
1098
+ );
1099
+ };
1100
+ if ("props" in data) {
1101
+ return walkItem(data);
1102
+ }
1103
+ const _data = data;
1104
+ const zones = (_a = _data.zones) != null ? _a : {};
1105
+ const mappedContent = _data.content.map(walkItem);
1106
+ return {
1107
+ root: walkItem(_data.root),
1108
+ content: (_b = callbackFn(mappedContent, {
1109
+ parentId: "root",
1110
+ propName: "default-zone"
1111
+ })) != null ? _b : mappedContent,
1112
+ zones: Object.keys(zones).reduce(
1113
+ (acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
1114
+ [zoneCompound]: zones[zoneCompound].map(walkItem)
1115
+ }),
1116
+ {}
1117
+ )
1118
+ };
1119
+ }
1120
+
1121
+ // lib/data/populate-ids.ts
1122
+ var populateIds = (data, config, override = false) => {
1123
+ const id = generateId(data.type);
1124
+ return walkTree(
1125
+ __spreadProps(__spreadValues({}, data), {
1126
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({ id }, data.props)
1127
+ }),
1128
+ config,
1129
+ (contents) => contents.map((item) => {
1130
+ const id2 = generateId(item.type);
1131
+ return __spreadProps(__spreadValues({}, item), {
1132
+ props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
1133
+ });
1134
+ })
1135
+ );
1136
+ };
1137
+
1050
1138
  // reducer/actions/insert.ts
1051
1139
  function insertAction(state, action, appStore) {
1052
1140
  const id = action.id || generateId(action.componentType);
1053
- const emptyComponentData = {
1054
- type: action.componentType,
1055
- props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
1056
- id
1057
- })
1058
- };
1141
+ const emptyComponentData = populateIds(
1142
+ {
1143
+ type: action.componentType,
1144
+ props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
1145
+ id
1146
+ })
1147
+ },
1148
+ appStore.config
1149
+ );
1059
1150
  const [parentId] = action.destinationZone.split(":");
1060
1151
  const idsInPath = getIdsForParent(action.destinationZone, state);
1061
- return walkTree(
1152
+ return walkAppState(
1062
1153
  state,
1063
1154
  appStore.config,
1064
1155
  (content, zoneCompound) => {
@@ -1096,25 +1187,26 @@ var replaceAction = (state, action, appStore) => {
1096
1187
  `Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
1097
1188
  );
1098
1189
  }
1099
- return walkTree(
1190
+ const data = populateIds(action.data, appStore.config);
1191
+ return walkAppState(
1100
1192
  state,
1101
1193
  appStore.config,
1102
1194
  (content, zoneCompound) => {
1103
1195
  const newContent = [...content];
1104
1196
  if (zoneCompound === action.destinationZone) {
1105
- newContent[action.destinationIndex] = action.data;
1197
+ newContent[action.destinationIndex] = data;
1106
1198
  }
1107
1199
  return newContent;
1108
1200
  },
1109
1201
  (childItem, path) => {
1110
1202
  const pathIds = path.map((p) => p.split(":")[0]);
1111
- if (childItem.props.id === action.data.props.id) {
1112
- return action.data;
1203
+ if (childItem.props.id === data.props.id) {
1204
+ return data;
1113
1205
  } else if (childItem.props.id === parentId) {
1114
1206
  return childItem;
1115
1207
  } else if (idsInPath.indexOf(childItem.props.id) > -1) {
1116
1208
  return childItem;
1117
- } else if (pathIds.indexOf(action.data.props.id) > -1) {
1209
+ } else if (pathIds.indexOf(data.props.id) > -1) {
1118
1210
  return childItem;
1119
1211
  }
1120
1212
  return null;
@@ -1125,7 +1217,7 @@ var replaceAction = (state, action, appStore) => {
1125
1217
  // reducer/actions/replace-root.ts
1126
1218
  init_react_import();
1127
1219
  var replaceRootAction = (state, action, appStore) => {
1128
- return walkTree(
1220
+ return walkAppState(
1129
1221
  state,
1130
1222
  appStore.config,
1131
1223
  (content) => content,
@@ -1164,7 +1256,7 @@ function duplicateAction(state, action, appStore) {
1164
1256
  id: generateId(item.type)
1165
1257
  })
1166
1258
  });
1167
- const modified = walkTree(
1259
+ const modified = walkAppState(
1168
1260
  state,
1169
1261
  appStore.config,
1170
1262
  (content, zoneCompound) => {
@@ -1229,7 +1321,7 @@ var moveAction = (state, action, appStore) => {
1229
1321
  if (!item) return state;
1230
1322
  const idsInSourcePath = getIdsForParent(action.sourceZone, state);
1231
1323
  const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
1232
- return walkTree(
1324
+ return walkAppState(
1233
1325
  state,
1234
1326
  appStore.config,
1235
1327
  (content, zoneCompound) => {
@@ -1287,7 +1379,7 @@ var removeAction = (state, action, appStore) => {
1287
1379
  },
1288
1380
  [item.props.id]
1289
1381
  );
1290
- const newState = walkTree(
1382
+ const newState = walkAppState(
1291
1383
  state,
1292
1384
  appStore.config,
1293
1385
  (content, zoneCompound) => {
@@ -1378,14 +1470,14 @@ var setDataAction = (state, action, appStore) => {
1378
1470
  console.warn(
1379
1471
  "`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
1380
1472
  );
1381
- return walkTree(
1473
+ return walkAppState(
1382
1474
  __spreadProps(__spreadValues({}, state), {
1383
1475
  data: __spreadValues(__spreadValues({}, state.data), action.data)
1384
1476
  }),
1385
1477
  appStore.config
1386
1478
  );
1387
1479
  }
1388
- return walkTree(
1480
+ return walkAppState(
1389
1481
  __spreadProps(__spreadValues({}, state), {
1390
1482
  data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
1391
1483
  }),
@@ -1770,7 +1862,7 @@ var import_react7 = require("react");
1770
1862
  init_react_import();
1771
1863
  var flattenData = (state, config) => {
1772
1864
  const data = [];
1773
- walkTree(
1865
+ walkAppState(
1774
1866
  state,
1775
1867
  config,
1776
1868
  (content) => content,
@@ -1935,7 +2027,8 @@ var createFieldsSlice = (_set, _get) => {
1935
2027
  return {
1936
2028
  fields: {},
1937
2029
  loading: false,
1938
- lastResolvedData: {}
2030
+ lastResolvedData: {},
2031
+ id: void 0
1939
2032
  };
1940
2033
  };
1941
2034
  var useRegisterFieldsSlice = (appStore, id) => {
@@ -1956,7 +2049,7 @@ var useRegisterFieldsSlice = (appStore, id) => {
1956
2049
  let lastFields = fields;
1957
2050
  if (reset) {
1958
2051
  appStore.setState((s) => ({
1959
- fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields })
2052
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1960
2053
  }));
1961
2054
  lastFields = defaultFields;
1962
2055
  }
@@ -1984,12 +2077,13 @@ var useRegisterFieldsSlice = (appStore, id) => {
1984
2077
  fields: {
1985
2078
  fields: newFields,
1986
2079
  loading: false,
1987
- lastResolvedData: componentData
2080
+ lastResolvedData: componentData,
2081
+ id
1988
2082
  }
1989
2083
  });
1990
2084
  } else {
1991
2085
  appStore.setState((s) => ({
1992
- fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields })
2086
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1993
2087
  }));
1994
2088
  }
1995
2089
  }),
@@ -2006,55 +2100,6 @@ var useRegisterFieldsSlice = (appStore, id) => {
2006
2100
 
2007
2101
  // lib/resolve-component-data.ts
2008
2102
  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
2103
  var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
2059
2104
  var cache = { lastChange: {} };
2060
2105
  var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
@@ -2299,7 +2344,7 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2299
2344
  }),
2300
2345
  resolveAndCommitData: () => __async(void 0, null, function* () {
2301
2346
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2302
- walkTree(
2347
+ walkAppState(
2303
2348
  state,
2304
2349
  config,
2305
2350
  (content) => content,
@@ -2348,314 +2393,11 @@ function useAppStoreApi() {
2348
2393
  init_react_import();
2349
2394
  var import_react12 = require("@dnd-kit/react");
2350
2395
 
2351
- // lib/dnd/dnd-kit/safe.ts
2352
- init_react_import();
2353
- var import_react10 = require("@dnd-kit/react");
2354
- var import_sortable = require("@dnd-kit/react/sortable");
2355
- function useDroppableSafe(input) {
2356
- if (typeof window === "undefined") {
2357
- return { ref: () => {
2358
- } };
2359
- }
2360
- return (0, import_react10.useDroppable)(input);
2361
- }
2362
- function useDraggableSafe(input) {
2363
- if (typeof window === "undefined") {
2364
- return { ref: () => {
2365
- } };
2366
- }
2367
- return (0, import_react10.useDraggable)(input);
2368
- }
2369
- function useSortableSafe(input) {
2370
- if (typeof window === "undefined") {
2371
- return { ref: () => {
2372
- }, status: "idle", handleRef: () => {
2373
- } };
2374
- }
2375
- return (0, import_sortable.useSortable)(input);
2376
- }
2377
-
2378
2396
  // lib/dnd/use-sensors.ts
2379
2397
  init_react_import();
2380
- var import_react11 = require("react");
2381
-
2382
- // lib/dnd/PointerSensor.ts
2383
- init_react_import();
2384
- var import_state = require("@dnd-kit/state");
2385
- var import_abstract = require("@dnd-kit/abstract");
2386
- var import_geometry = require("@dnd-kit/geometry");
2398
+ var import_react10 = require("react");
2399
+ var import_react11 = require("@dnd-kit/react");
2387
2400
  var import_utilities = require("@dnd-kit/dom/utilities");
2388
- var _clearTimeout;
2389
- var _PointerSensor = class _PointerSensor extends import_abstract.Sensor {
2390
- constructor(manager, options) {
2391
- super(manager);
2392
- this.manager = manager;
2393
- this.options = options;
2394
- this.listeners = new import_utilities.Listeners();
2395
- this.cleanup = /* @__PURE__ */ new Set();
2396
- this.source = void 0;
2397
- this.started = false;
2398
- __privateAdd(this, _clearTimeout);
2399
- this.handleCancel = this.handleCancel.bind(this);
2400
- this.handlePointerUp = this.handlePointerUp.bind(this);
2401
- this.handleKeyDown = this.handleKeyDown.bind(this);
2402
- (0, import_state.effect)(() => {
2403
- const unbindGlobal = this.bindGlobal(options != null ? options : {});
2404
- return () => {
2405
- unbindGlobal();
2406
- };
2407
- });
2408
- }
2409
- bind(source, options = this.options) {
2410
- const unbind = (0, import_state.effect)(() => {
2411
- var _a;
2412
- const target = (_a = source.handle) != null ? _a : source.element;
2413
- const listener = (event) => {
2414
- if ((0, import_utilities.isPointerEvent)(event)) {
2415
- this.handlePointerDown(event, source, options);
2416
- }
2417
- };
2418
- if (target) {
2419
- patchWindow(target.ownerDocument.defaultView);
2420
- target.addEventListener("pointerdown", listener);
2421
- return () => {
2422
- target.removeEventListener("pointerdown", listener);
2423
- };
2424
- }
2425
- });
2426
- return unbind;
2427
- }
2428
- bindGlobal(options) {
2429
- const documents = /* @__PURE__ */ new Set();
2430
- for (const draggable of this.manager.registry.draggables.value) {
2431
- if (draggable.element) {
2432
- documents.add((0, import_utilities.getDocument)(draggable.element));
2433
- }
2434
- }
2435
- for (const droppable of this.manager.registry.droppables.value) {
2436
- if (droppable.element) {
2437
- documents.add((0, import_utilities.getDocument)(droppable.element));
2438
- }
2439
- }
2440
- const unbindFns = Array.from(documents).map(
2441
- (doc) => this.listeners.bind(doc, [
2442
- {
2443
- type: "pointermove",
2444
- listener: (event) => this.handlePointerMove(event, doc, options)
2445
- },
2446
- {
2447
- type: "pointerup",
2448
- listener: this.handlePointerUp,
2449
- options: {
2450
- capture: true
2451
- }
2452
- },
2453
- {
2454
- // Cancel activation if there is a competing Drag and Drop interaction
2455
- type: "dragstart",
2456
- listener: this.handleDragStart
2457
- }
2458
- ])
2459
- );
2460
- return () => {
2461
- unbindFns.forEach((unbind) => unbind());
2462
- };
2463
- }
2464
- handlePointerDown(event, source, options = {}) {
2465
- if (this.disabled || !event.isPrimary || event.button !== 0 || !(0, import_utilities.isElement)(event.target) || source.disabled) {
2466
- return;
2467
- }
2468
- const offset = (0, import_utilities.getFrameTransform)(source.element);
2469
- this.initialCoordinates = {
2470
- x: event.clientX * offset.scaleX + offset.x,
2471
- y: event.clientY * offset.scaleY + offset.y
2472
- };
2473
- this.source = source;
2474
- const { activationConstraints } = options;
2475
- const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
2476
- event.stopImmediatePropagation();
2477
- if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
2478
- this.handleStart(source, event);
2479
- } else {
2480
- const { delay } = constraints;
2481
- if (delay) {
2482
- const timeout3 = setTimeout(
2483
- () => this.handleStart(source, event),
2484
- delay.value
2485
- );
2486
- __privateSet(this, _clearTimeout, () => {
2487
- clearTimeout(timeout3);
2488
- __privateSet(this, _clearTimeout, void 0);
2489
- });
2490
- }
2491
- }
2492
- const cleanup = () => {
2493
- var _a;
2494
- (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
2495
- this.initialCoordinates = void 0;
2496
- this.source = void 0;
2497
- };
2498
- this.cleanup.add(cleanup);
2499
- }
2500
- handlePointerMove(event, doc, options) {
2501
- if (!this.source) {
2502
- return;
2503
- }
2504
- const ownerDocument = this.source.element && (0, import_utilities.getDocument)(this.source.element);
2505
- if (doc !== ownerDocument) {
2506
- return;
2507
- }
2508
- const coordinates = {
2509
- x: event.clientX,
2510
- y: event.clientY
2511
- };
2512
- const offset = (0, import_utilities.getFrameTransform)(this.source.element);
2513
- coordinates.x = coordinates.x * offset.scaleX + offset.x;
2514
- coordinates.y = coordinates.y * offset.scaleY + offset.y;
2515
- if (this.manager.dragOperation.status.dragging) {
2516
- event.preventDefault();
2517
- event.stopPropagation();
2518
- this.manager.actions.move({ to: coordinates });
2519
- return;
2520
- }
2521
- if (!this.initialCoordinates) {
2522
- return;
2523
- }
2524
- const delta = {
2525
- x: coordinates.x - this.initialCoordinates.x,
2526
- y: coordinates.y - this.initialCoordinates.y
2527
- };
2528
- const { activationConstraints } = options;
2529
- const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
2530
- const { distance, delay } = constraints != null ? constraints : {};
2531
- if (distance) {
2532
- if (distance.tolerance != null && (0, import_geometry.exceedsDistance)(delta, distance.tolerance)) {
2533
- return this.handleCancel();
2534
- }
2535
- if ((0, import_geometry.exceedsDistance)(delta, distance.value)) {
2536
- return this.handleStart(this.source, event);
2537
- }
2538
- }
2539
- if (delay) {
2540
- if ((0, import_geometry.exceedsDistance)(delta, delay.tolerance)) {
2541
- return this.handleCancel();
2542
- }
2543
- }
2544
- }
2545
- handlePointerUp(event) {
2546
- if (!this.source) {
2547
- return;
2548
- }
2549
- event.preventDefault();
2550
- event.stopPropagation();
2551
- const { status } = this.manager.dragOperation;
2552
- if (!status.idle) {
2553
- const canceled = !status.initialized;
2554
- this.manager.actions.stop({ canceled });
2555
- } else if (this.started) {
2556
- setTimeout(() => {
2557
- if (!this.manager.dragOperation.status.idle) {
2558
- this.manager.actions.stop({ canceled: false });
2559
- }
2560
- }, 10);
2561
- }
2562
- this.cleanup.forEach((cleanup) => cleanup());
2563
- this.cleanup.clear();
2564
- }
2565
- handleKeyDown(event) {
2566
- if (event.key === "Escape") {
2567
- event.preventDefault();
2568
- this.handleCancel();
2569
- }
2570
- }
2571
- handleStart(source, event) {
2572
- var _a;
2573
- const { manager, initialCoordinates } = this;
2574
- (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
2575
- if (!initialCoordinates || manager.dragOperation.status.initialized || this.started) {
2576
- return;
2577
- }
2578
- if (event.defaultPrevented) {
2579
- return;
2580
- }
2581
- this.started = true;
2582
- event.preventDefault();
2583
- (0, import_state.batch)(() => {
2584
- manager.actions.setDragSource(source.id);
2585
- manager.actions.start({ coordinates: initialCoordinates, event });
2586
- });
2587
- const ownerDocument = (0, import_utilities.getDocument)(event.target);
2588
- const unbind = this.listeners.bind(ownerDocument, [
2589
- {
2590
- // Prevent scrolling on touch devices
2591
- type: "touchmove",
2592
- listener: preventDefault,
2593
- options: {
2594
- passive: false
2595
- }
2596
- },
2597
- {
2598
- // Prevent click events
2599
- type: "click",
2600
- listener: preventDefault
2601
- },
2602
- {
2603
- type: "keydown",
2604
- listener: this.handleKeyDown
2605
- }
2606
- ]);
2607
- ownerDocument.body.setPointerCapture(event.pointerId);
2608
- this.cleanup.add(unbind);
2609
- this.cleanup.add(() => {
2610
- this.started = false;
2611
- });
2612
- }
2613
- handleDragStart(event) {
2614
- const { target } = event;
2615
- if (!(0, import_utilities.isElement)(target)) {
2616
- return;
2617
- }
2618
- const isNativeDraggable = (0, import_utilities.isHTMLElement)(target) && target.draggable && target.getAttribute("draggable") === "true";
2619
- if (isNativeDraggable) {
2620
- this.handleCancel();
2621
- } else {
2622
- preventDefault(event);
2623
- }
2624
- }
2625
- handleCancel() {
2626
- const { dragOperation } = this.manager;
2627
- if (dragOperation.status.initialized) {
2628
- this.manager.actions.stop({ canceled: true });
2629
- }
2630
- this.cleanup.forEach((cleanup) => cleanup());
2631
- this.cleanup.clear();
2632
- }
2633
- destroy() {
2634
- this.listeners.clear();
2635
- }
2636
- };
2637
- _clearTimeout = new WeakMap();
2638
- _PointerSensor.configure = (0, import_abstract.configurator)(_PointerSensor);
2639
- var PointerSensor = _PointerSensor;
2640
- function preventDefault(event) {
2641
- event.preventDefault();
2642
- }
2643
- function noop() {
2644
- }
2645
- var windows = /* @__PURE__ */ new WeakSet();
2646
- function patchWindow(window2) {
2647
- if (!window2 || windows.has(window2)) {
2648
- return;
2649
- }
2650
- window2.addEventListener("touchmove", noop, {
2651
- capture: false,
2652
- passive: false
2653
- });
2654
- windows.add(window2);
2655
- }
2656
-
2657
- // lib/dnd/use-sensors.ts
2658
- var import_utilities2 = require("@dnd-kit/dom/utilities");
2659
2401
  var useSensors = ({
2660
2402
  other,
2661
2403
  mouse,
@@ -2664,12 +2406,12 @@ var useSensors = ({
2664
2406
  touch: { delay: { value: 200, tolerance: 10 } },
2665
2407
  other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
2666
2408
  }) => {
2667
- const [sensors] = (0, import_react11.useState)(() => [
2668
- PointerSensor.configure({
2409
+ const [sensors] = (0, import_react10.useState)(() => [
2410
+ import_react11.PointerSensor.configure({
2669
2411
  activationConstraints(event, source) {
2670
2412
  var _a;
2671
2413
  const { pointerType, target } = event;
2672
- if (pointerType === "mouse" && (0, import_utilities2.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
2414
+ if (pointerType === "mouse" && (0, import_utilities.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
2673
2415
  return mouse;
2674
2416
  }
2675
2417
  if (pointerType === "touch") {
@@ -2684,11 +2426,11 @@ var useSensors = ({
2684
2426
 
2685
2427
  // lib/dnd/collision/dynamic/index.ts
2686
2428
  init_react_import();
2687
- var import_abstract9 = require("@dnd-kit/abstract");
2429
+ var import_abstract8 = require("@dnd-kit/abstract");
2688
2430
 
2689
2431
  // lib/dnd/collision/directional/index.ts
2690
2432
  init_react_import();
2691
- var import_abstract2 = require("@dnd-kit/abstract");
2433
+ var import_abstract = require("@dnd-kit/abstract");
2692
2434
 
2693
2435
  // lib/dnd/collision/collision-debug.ts
2694
2436
  init_react_import();
@@ -2766,7 +2508,7 @@ var directionalCollision = (input, previous) => {
2766
2508
  return {
2767
2509
  id: droppable.id,
2768
2510
  value: 1,
2769
- type: import_abstract2.CollisionType.Collision
2511
+ type: import_abstract.CollisionType.Collision
2770
2512
  };
2771
2513
  }
2772
2514
  return null;
@@ -2808,7 +2550,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
2808
2550
 
2809
2551
  // lib/dnd/collision/dynamic/track-movement-interval.ts
2810
2552
  init_react_import();
2811
- var import_geometry2 = require("@dnd-kit/geometry");
2553
+ var import_geometry = require("@dnd-kit/geometry");
2812
2554
  var INTERVAL_SENSITIVITY = 10;
2813
2555
  var intervalCache = {
2814
2556
  current: { x: 0, y: 0 },
@@ -2824,13 +2566,15 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
2824
2566
  };
2825
2567
  intervalCache.direction = getDirection(dragAxis, intervalCache.delta) || intervalCache.direction;
2826
2568
  if (Math.abs(intervalCache.delta.x) > INTERVAL_SENSITIVITY || Math.abs(intervalCache.delta.y) > INTERVAL_SENSITIVITY) {
2827
- intervalCache.previous = import_geometry2.Point.from(point);
2569
+ intervalCache.previous = import_geometry.Point.from(point);
2828
2570
  }
2829
2571
  return intervalCache;
2830
2572
  };
2831
2573
 
2832
2574
  // ../../node_modules/@dnd-kit/collision/dist/index.js
2833
2575
  init_react_import();
2576
+ var import_abstract2 = require("@dnd-kit/abstract");
2577
+ var import_geometry2 = require("@dnd-kit/geometry");
2834
2578
  var import_abstract3 = require("@dnd-kit/abstract");
2835
2579
  var import_geometry3 = require("@dnd-kit/geometry");
2836
2580
  var import_abstract4 = require("@dnd-kit/abstract");
@@ -2841,8 +2585,6 @@ var import_abstract6 = require("@dnd-kit/abstract");
2841
2585
  var import_geometry6 = require("@dnd-kit/geometry");
2842
2586
  var import_abstract7 = require("@dnd-kit/abstract");
2843
2587
  var import_geometry7 = require("@dnd-kit/geometry");
2844
- var import_abstract8 = require("@dnd-kit/abstract");
2845
- var import_geometry8 = require("@dnd-kit/geometry");
2846
2588
  var pointerIntersection = ({
2847
2589
  dragOperation,
2848
2590
  droppable
@@ -2856,12 +2598,12 @@ var pointerIntersection = ({
2856
2598
  return null;
2857
2599
  }
2858
2600
  if (droppable.shape.containsPoint(pointerCoordinates)) {
2859
- const distance = import_geometry3.Point.distance(droppable.shape.center, pointerCoordinates);
2601
+ const distance = import_geometry2.Point.distance(droppable.shape.center, pointerCoordinates);
2860
2602
  return {
2861
2603
  id,
2862
2604
  value: 1 / distance,
2863
- type: import_abstract3.CollisionType.PointerIntersection,
2864
- priority: import_abstract3.CollisionPriority.High
2605
+ type: import_abstract2.CollisionType.PointerIntersection,
2606
+ priority: import_abstract2.CollisionPriority.High
2865
2607
  };
2866
2608
  }
2867
2609
  return null;
@@ -2872,31 +2614,15 @@ var closestCorners = (input) => {
2872
2614
  if (!droppable.shape) {
2873
2615
  return null;
2874
2616
  }
2875
- const { left, top, right, bottom } = droppable.shape.boundingRectangle;
2876
- const corners = [
2877
- {
2878
- x: left,
2879
- y: top
2880
- },
2881
- {
2882
- x: right,
2883
- y: top
2884
- },
2885
- {
2886
- x: left,
2887
- y: bottom
2888
- },
2889
- {
2890
- x: right,
2891
- y: bottom
2892
- }
2893
- ];
2894
- const distance = corners.reduce(
2895
- (acc, corner) => {
2617
+ const shapeCorners = shape ? import_geometry4.Rectangle.from(shape.current.boundingRectangle).corners : void 0;
2618
+ const distance = import_geometry4.Rectangle.from(
2619
+ droppable.shape.boundingRectangle
2620
+ ).corners.reduce(
2621
+ (acc, corner, index) => {
2896
2622
  var _a;
2897
- return acc + import_geometry5.Point.distance(
2898
- import_geometry5.Point.from(corner),
2899
- (_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
2623
+ return acc + import_geometry4.Point.distance(
2624
+ import_geometry4.Point.from(corner),
2625
+ (_a = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a : position.current
2900
2626
  );
2901
2627
  },
2902
2628
  0
@@ -2905,8 +2631,8 @@ var closestCorners = (input) => {
2905
2631
  return {
2906
2632
  id: droppable.id,
2907
2633
  value: 1 / value,
2908
- type: import_abstract5.CollisionType.Collision,
2909
- priority: import_abstract5.CollisionPriority.Normal
2634
+ type: import_abstract4.CollisionType.Collision,
2635
+ priority: import_abstract4.CollisionPriority.Normal
2910
2636
  };
2911
2637
  };
2912
2638
 
@@ -2931,12 +2657,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2931
2657
  const { center: dragCenter } = dragShape;
2932
2658
  const { fallbackEnabled } = collisionStore.getState();
2933
2659
  const interval = trackMovementInterval(position.current, dragAxis);
2934
- dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
2935
- direction: interval.direction
2936
- });
2937
- const collisionMap = dragOperation.data.collisionMap || {};
2938
- dragOperation.data.collisionMap = collisionMap;
2939
- collisionMap[droppable.id] = {
2660
+ const data = {
2940
2661
  direction: interval.direction
2941
2662
  };
2942
2663
  const { center: dropCenter } = dropShape;
@@ -2951,7 +2672,8 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2951
2672
  collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
2952
2673
  if (collision) {
2953
2674
  return __spreadProps(__spreadValues({}, collision), {
2954
- priority: import_abstract9.CollisionPriority.Highest
2675
+ priority: import_abstract8.CollisionPriority.Highest,
2676
+ data
2955
2677
  });
2956
2678
  }
2957
2679
  }
@@ -2968,12 +2690,12 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2968
2690
  const collision = {
2969
2691
  id: droppable.id,
2970
2692
  value: intersectionRatio,
2971
- priority: import_abstract9.CollisionPriority.High,
2972
- type: import_abstract9.CollisionType.Collision
2693
+ priority: import_abstract8.CollisionPriority.High,
2694
+ type: import_abstract8.CollisionType.Collision
2973
2695
  };
2974
2696
  const shouldFlushId = flushNext === droppable.id;
2975
2697
  flushNext = "";
2976
- return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
2698
+ return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id, data });
2977
2699
  }
2978
2700
  if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2979
2701
  const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
@@ -2985,9 +2707,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2985
2707
  x: dragShape.center.x - (((_d = droppable.shape) == null ? void 0 : _d.center.x) || 0),
2986
2708
  y: dragShape.center.y - (((_e = droppable.shape) == null ? void 0 : _e.center.y) || 0)
2987
2709
  });
2988
- collisionMap[droppable.id] = {
2989
- direction
2990
- };
2710
+ data.direction = direction;
2991
2711
  if (intersectionArea) {
2992
2712
  collisionDebug(
2993
2713
  dragCenter,
@@ -2998,7 +2718,8 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2998
2718
  );
2999
2719
  flushNext = droppable.id;
3000
2720
  return __spreadProps(__spreadValues({}, fallbackCollision), {
3001
- priority: import_abstract9.CollisionPriority.Low
2721
+ priority: import_abstract8.CollisionPriority.Low,
2722
+ data
3002
2723
  });
3003
2724
  }
3004
2725
  collisionDebug(
@@ -3008,16 +2729,19 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
3008
2729
  "orange",
3009
2730
  direction || ""
3010
2731
  );
3011
- return __spreadProps(__spreadValues({}, fallbackCollision), { priority: import_abstract9.CollisionPriority.Lowest });
2732
+ return __spreadProps(__spreadValues({}, fallbackCollision), {
2733
+ priority: import_abstract8.CollisionPriority.Lowest,
2734
+ data
2735
+ });
3012
2736
  }
3013
2737
  }
3014
2738
  }
3015
2739
  collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
3016
- delete collisionMap[droppable.id];
3017
2740
  return null;
3018
2741
  };
3019
2742
 
3020
2743
  // components/Sortable/index.tsx
2744
+ var import_sortable = require("@dnd-kit/react/sortable");
3021
2745
  var import_jsx_runtime5 = require("react/jsx-runtime");
3022
2746
  var SortableProvider = ({
3023
2747
  children,
@@ -3037,16 +2761,16 @@ var SortableProvider = ({
3037
2761
  return onDragStart((_b = (_a = event.operation.source) == null ? void 0 : _a.id.toString()) != null ? _b : "");
3038
2762
  },
3039
2763
  onDragOver: (event, manager) => {
3040
- var _a, _b;
2764
+ var _a;
3041
2765
  event.preventDefault();
3042
2766
  const { operation } = event;
3043
2767
  const { source, target } = operation;
3044
2768
  if (!source || !target) return;
3045
2769
  let sourceIndex = source.data.index;
3046
2770
  let targetIndex = target.data.index;
3047
- const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
2771
+ const collisionData = (_a = manager.collisionObserver.collisions[0]) == null ? void 0 : _a.data;
3048
2772
  if (sourceIndex !== targetIndex && source.id !== target.id) {
3049
- const collisionPosition = collisionData.direction === "up" ? "before" : "after";
2773
+ const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" ? "before" : "after";
3050
2774
  if (targetIndex >= sourceIndex) {
3051
2775
  targetIndex = targetIndex - 1;
3052
2776
  }
@@ -3077,9 +2801,10 @@ var Sortable = ({
3077
2801
  }) => {
3078
2802
  const {
3079
2803
  ref: sortableRef,
3080
- status,
2804
+ isDragging,
2805
+ isDropping,
3081
2806
  handleRef
3082
- } = useSortableSafe({
2807
+ } = (0, import_sortable.useSortable)({
3083
2808
  id,
3084
2809
  type,
3085
2810
  index,
@@ -3087,7 +2812,7 @@ var Sortable = ({
3087
2812
  data: { index },
3088
2813
  collisionDetector: createDynamicCollisionDetector("y")
3089
2814
  });
3090
- return children({ status, ref: sortableRef, handleRef });
2815
+ return children({ isDragging, isDropping, ref: sortableRef, handleRef });
3091
2816
  };
3092
2817
 
3093
2818
  // components/AutoField/context.tsx
@@ -3212,7 +2937,7 @@ var ArrayField = ({
3212
2937
  }
3213
2938
  }, []);
3214
2939
  const [draggedItem, setDraggedItem] = (0, import_react14.useState)("");
3215
- const isDragging = !!draggedItem;
2940
+ const isDraggingAny = !!draggedItem;
3216
2941
  const canEdit = useAppStore(
3217
2942
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
3218
2943
  );
@@ -3277,13 +3002,13 @@ var ArrayField = ({
3277
3002
  id: _arrayId,
3278
3003
  index: i,
3279
3004
  disabled: readOnly,
3280
- children: ({ status, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3005
+ children: ({ isDragging, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3281
3006
  "div",
3282
3007
  {
3283
3008
  ref,
3284
3009
  className: getClassNameItem({
3285
3010
  isExpanded: arrayState.openId === _arrayId,
3286
- isDragging: status === "dragging",
3011
+ isDragging,
3287
3012
  readOnly
3288
3013
  }),
3289
3014
  children: [
@@ -3424,7 +3149,7 @@ var ArrayField = ({
3424
3149
  type: "button",
3425
3150
  className: getClassName5("addButton"),
3426
3151
  onClick: () => {
3427
- if (isDragging) return;
3152
+ if (isDraggingAny) return;
3428
3153
  const existingValue = value || [];
3429
3154
  const newValue = [
3430
3155
  ...existingValue,
@@ -4407,15 +4132,15 @@ init_react_import();
4407
4132
 
4408
4133
  // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
4409
4134
  init_react_import();
4410
- var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
4135
+ var styles_module_default10 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable": "_Drawer-draggable_pl7z0_8", "Drawer-draggableBg": "_Drawer-draggableBg_pl7z0_12", "DrawerItem-draggable": "_DrawerItem-draggable_pl7z0_22", "DrawerItem--disabled": "_DrawerItem--disabled_pl7z0_35", "DrawerItem": "_DrawerItem_pl7z0_22", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_pl7z0_45", "DrawerItem-name": "_DrawerItem-name_pl7z0_63" };
4411
4136
 
4412
4137
  // components/Drawer/index.tsx
4413
- var import_react37 = require("react");
4138
+ var import_react38 = require("react");
4414
4139
 
4415
4140
  // components/DragDropContext/index.tsx
4416
4141
  init_react_import();
4417
- var import_react35 = require("@dnd-kit/react");
4418
- var import_react36 = require("react");
4142
+ var import_react36 = require("@dnd-kit/react");
4143
+ var import_react37 = require("react");
4419
4144
  var import_dom = require("@dnd-kit/dom");
4420
4145
 
4421
4146
  // components/DropZone/index.tsx
@@ -4525,6 +4250,7 @@ function useContextStore(context, selector) {
4525
4250
 
4526
4251
  // components/DraggableComponent/index.tsx
4527
4252
  var import_shallow2 = require("zustand/react/shallow");
4253
+ var import_sortable2 = require("@dnd-kit/react/sortable");
4528
4254
  var import_jsx_runtime20 = require("react/jsx-runtime");
4529
4255
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
4530
4256
  var DEBUG2 = false;
@@ -4610,7 +4336,7 @@ var DraggableComponent = ({
4610
4336
  const canCollide = permissions.drag || userIsDragging;
4611
4337
  const disabled = !isEnabled || !canCollide;
4612
4338
  const [dragAxis, setDragAxis] = (0, import_react25.useState)(userDragAxis || autoDragAxis);
4613
- const { ref: sortableRef, status } = useSortableSafe({
4339
+ const { ref: sortableRef, isDragging: thisIsDragging } = (0, import_sortable2.useSortable)({
4614
4340
  id,
4615
4341
  index,
4616
4342
  group: zoneCompound,
@@ -4632,9 +4358,9 @@ var DraggableComponent = ({
4632
4358
  transition: {
4633
4359
  duration: 200,
4634
4360
  easing: "cubic-bezier(0.2, 0, 0, 1)"
4635
- }
4361
+ },
4362
+ feedback: "clone"
4636
4363
  });
4637
- const thisIsDragging = status === "dragging";
4638
4364
  const ref = (0, import_react25.useRef)(null);
4639
4365
  const refSetter = (0, import_react25.useCallback)(
4640
4366
  (el) => {
@@ -4774,18 +4500,12 @@ var DraggableComponent = ({
4774
4500
  el.addEventListener("click", onClick);
4775
4501
  el.addEventListener("mouseover", _onMouseOver);
4776
4502
  el.addEventListener("mouseout", _onMouseOut);
4777
- if (thisIsDragging) {
4778
- el.setAttribute("data-puck-dragging", "");
4779
- } else {
4780
- el.removeAttribute("data-puck-dragging");
4781
- }
4782
4503
  return () => {
4783
4504
  el.removeAttribute("data-puck-component");
4784
4505
  el.removeAttribute("data-puck-dnd");
4785
4506
  el.removeEventListener("click", onClick);
4786
4507
  el.removeEventListener("mouseover", _onMouseOver);
4787
4508
  el.removeEventListener("mouseout", _onMouseOut);
4788
- el.removeAttribute("data-puck-dragging");
4789
4509
  };
4790
4510
  }, [
4791
4511
  ref,
@@ -4937,6 +4657,9 @@ var DraggableComponent = ({
4937
4657
  init_react_import();
4938
4658
  var styles_module_default12 = { "DropZone": "_DropZone_3dmev_1", "DropZone--hasChildren": "_DropZone--hasChildren_3dmev_11", "DropZone--userIsDragging": "_DropZone--userIsDragging_3dmev_19", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_3dmev_23", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_3dmev_24", "DropZone--isRootZone": "_DropZone--isRootZone_3dmev_24", "DropZone--isDestination": "_DropZone--isDestination_3dmev_34", "DropZone-item": "_DropZone-item_3dmev_46", "DropZone-hitbox": "_DropZone-hitbox_3dmev_50", "DropZone--isEnabled": "_DropZone--isEnabled_3dmev_58", "DropZone--isAnimating": "_DropZone--isAnimating_3dmev_67" };
4939
4659
 
4660
+ // components/DropZone/index.tsx
4661
+ var import_react35 = require("@dnd-kit/react");
4662
+
4940
4663
  // components/DropZone/lib/use-min-empty-height.ts
4941
4664
  init_react_import();
4942
4665
  var import_react26 = require("react");
@@ -5150,43 +4873,70 @@ var import_react33 = __toESM(require("react"));
5150
4873
 
5151
4874
  // components/SlotRender/index.tsx
5152
4875
  init_react_import();
4876
+
4877
+ // components/SlotRender/server.tsx
4878
+ init_react_import();
5153
4879
  var import_react32 = require("react");
4880
+
4881
+ // components/ServerRender/index.tsx
4882
+ init_react_import();
5154
4883
  var import_jsx_runtime21 = require("react/jsx-runtime");
5155
- var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRender, __spreadValues({}, props));
5156
- var ContextSlotRender = ({
5157
- componentId,
5158
- zone
5159
- }) => {
5160
- const config = useAppStore((s) => s.config);
5161
- const metadata = useAppStore((s) => s.metadata);
5162
- const slotContent = useAppStore(
5163
- (s) => {
5164
- var _a, _b;
5165
- return (_b = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.props[zone]) != null ? _b : null;
5166
- }
5167
- );
5168
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5169
- SlotRenderPure,
5170
- {
5171
- content: slotContent,
5172
- zone,
5173
- config,
5174
- metadata
4884
+ function DropZoneRender({
4885
+ zone,
4886
+ data,
4887
+ areaId = "root",
4888
+ config,
4889
+ metadata = {}
4890
+ }) {
4891
+ let zoneCompound = rootDroppableId;
4892
+ let content = (data == null ? void 0 : data.content) || [];
4893
+ if (!data || !config) {
4894
+ return null;
4895
+ }
4896
+ if (areaId !== rootAreaId && zone !== rootZone) {
4897
+ zoneCompound = `${areaId}:${zone}`;
4898
+ content = setupZone(data, zoneCompound).zones[zoneCompound];
4899
+ }
4900
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: content.map((item) => {
4901
+ const Component = config.components[item.type];
4902
+ const props = __spreadProps(__spreadValues({}, item.props), {
4903
+ puck: {
4904
+ renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4905
+ DropZoneRender,
4906
+ {
4907
+ zone: zone2,
4908
+ data,
4909
+ areaId: item.props.id,
4910
+ config,
4911
+ metadata
4912
+ }
4913
+ ),
4914
+ metadata
4915
+ }
4916
+ });
4917
+ const propsWithSlots = useSlots(Component, props, (props2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
4918
+ if (Component) {
4919
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component.render, __spreadValues({}, propsWithSlots), item.props.id);
5175
4920
  }
5176
- );
5177
- };
4921
+ return null;
4922
+ }) });
4923
+ }
4924
+
4925
+ // components/SlotRender/server.tsx
4926
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4927
+ var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRender, __spreadValues({}, props));
5178
4928
  var Item = ({
5179
4929
  config,
5180
4930
  item,
5181
4931
  metadata
5182
4932
  }) => {
5183
4933
  const Component = config.components[item.type];
5184
- const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5185
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4934
+ const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
4935
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5186
4936
  Component.render,
5187
4937
  __spreadProps(__spreadValues({}, props), {
5188
4938
  puck: __spreadProps(__spreadValues({}, props.puck), {
5189
- renderDropZone: DropZoneRenderPure,
4939
+ renderDropZone: DropZoneRender,
5190
4940
  metadata: metadata || {}
5191
4941
  })
5192
4942
  })
@@ -5194,11 +4944,11 @@ var Item = ({
5194
4944
  };
5195
4945
  var SlotRender = (0, import_react32.forwardRef)(
5196
4946
  function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5197
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
4947
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
5198
4948
  if (!config.components[item.type]) {
5199
4949
  return null;
5200
4950
  }
5201
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4951
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5202
4952
  Item,
5203
4953
  {
5204
4954
  config,
@@ -5211,8 +4961,33 @@ var SlotRender = (0, import_react32.forwardRef)(
5211
4961
  }
5212
4962
  );
5213
4963
 
4964
+ // components/SlotRender/index.tsx
4965
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4966
+ var ContextSlotRender = ({
4967
+ componentId,
4968
+ zone
4969
+ }) => {
4970
+ const config = useAppStore((s) => s.config);
4971
+ const metadata = useAppStore((s) => s.metadata);
4972
+ const slotContent = useAppStore(
4973
+ (s) => {
4974
+ var _a, _b;
4975
+ return (_b = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.props[zone]) != null ? _b : null;
4976
+ }
4977
+ );
4978
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4979
+ SlotRenderPure,
4980
+ {
4981
+ content: slotContent,
4982
+ zone,
4983
+ config,
4984
+ metadata
4985
+ }
4986
+ );
4987
+ };
4988
+
5214
4989
  // components/Render/index.tsx
5215
- var import_jsx_runtime22 = require("react/jsx-runtime");
4990
+ var import_jsx_runtime24 = require("react/jsx-runtime");
5216
4991
  var renderContext = import_react33.default.createContext({
5217
4992
  config: { components: {} },
5218
4993
  data: { root: {}, content: [] },
@@ -5241,7 +5016,7 @@ function Render({
5241
5016
  editMode: false,
5242
5017
  id: "puck-root"
5243
5018
  });
5244
- const propsWithSlots = useSlots(config.root, pageProps, (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata })));
5019
+ const propsWithSlots = useSlots(config.root, pageProps, (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata })));
5245
5020
  const nextContextValue = (0, import_react33.useMemo)(
5246
5021
  () => ({
5247
5022
  mode: "render",
@@ -5250,17 +5025,17 @@ function Render({
5250
5025
  []
5251
5026
  );
5252
5027
  if ((_a = config.root) == null ? void 0 : _a.render) {
5253
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
5028
+ 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
5029
  }
5255
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
5030
+ 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
5031
  }
5257
5032
 
5258
5033
  // components/DropZone/index.tsx
5259
- var import_jsx_runtime23 = require("react/jsx-runtime");
5034
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5260
5035
  var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
5261
5036
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5262
5037
  var RENDER_DEBUG = false;
5263
- var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneEdit, __spreadValues({}, props));
5038
+ var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
5264
5039
  var DropZoneChild = ({
5265
5040
  zoneCompound,
5266
5041
  componentId,
@@ -5320,7 +5095,7 @@ var DropZoneChild = ({
5320
5095
  let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
5321
5096
  const renderPreview = (0, import_react34.useMemo)(
5322
5097
  () => function Preview4() {
5323
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
5098
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
5324
5099
  },
5325
5100
  [componentId, label, overrides]
5326
5101
  );
@@ -5336,12 +5111,12 @@ var DropZoneChild = ({
5336
5111
  componentConfig,
5337
5112
  defaultsProps,
5338
5113
  DropZoneEditPure,
5339
- (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
5114
+ (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
5340
5115
  nodeReadOnly,
5341
5116
  isLoading
5342
5117
  );
5343
5118
  if (!item) return;
5344
- let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5119
+ let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5345
5120
  "No configuration for ",
5346
5121
  item.type
5347
5122
  ] });
@@ -5350,7 +5125,7 @@ var DropZoneChild = ({
5350
5125
  if (isPreview) {
5351
5126
  Render2 = renderPreview;
5352
5127
  }
5353
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5128
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5354
5129
  DraggableComponent,
5355
5130
  {
5356
5131
  id: componentId,
@@ -5365,14 +5140,14 @@ var DropZoneChild = ({
5365
5140
  autoDragAxis: dragAxis,
5366
5141
  userDragAxis: collisionAxis,
5367
5142
  inDroppableZone,
5368
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isPreview ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5143
+ 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
5144
  Render2,
5370
5145
  __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5371
5146
  puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5372
5147
  dragRef
5373
5148
  })
5374
5149
  })
5375
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5150
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5376
5151
  }
5377
5152
  );
5378
5153
  };
@@ -5436,11 +5211,6 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5436
5211
  );
5437
5212
  (0, import_react34.useEffect)(() => {
5438
5213
  if (!zoneType || zoneType === "dropzone") {
5439
- if (zoneCompound !== rootDroppableId) {
5440
- console.warn(
5441
- "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"
5442
- );
5443
- }
5444
5214
  if (ctx == null ? void 0 : ctx.registerZone) {
5445
5215
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
5446
5216
  }
@@ -5451,6 +5221,15 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5451
5221
  };
5452
5222
  }
5453
5223
  }, [zoneType]);
5224
+ (0, import_react34.useEffect)(() => {
5225
+ if (zoneType === "dropzone") {
5226
+ if (zoneCompound !== rootDroppableId) {
5227
+ console.warn(
5228
+ "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"
5229
+ );
5230
+ }
5231
+ }
5232
+ }, [zoneType]);
5454
5233
  const contentIds = (0, import_react34.useMemo)(() => {
5455
5234
  return zoneContentIds || [];
5456
5235
  }, [zoneContentIds]);
@@ -5513,7 +5292,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5513
5292
  path: path || []
5514
5293
  }
5515
5294
  };
5516
- const { ref: dropRef } = useDroppableSafe(droppableConfig);
5295
+ const { ref: dropRef } = (0, import_react35.useDroppable)(droppableConfig);
5517
5296
  const isAreaSelected = useAppStore(
5518
5297
  (s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
5519
5298
  );
@@ -5523,7 +5302,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5523
5302
  userMinEmptyHeight,
5524
5303
  ref
5525
5304
  });
5526
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5305
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5527
5306
  "div",
5528
5307
  {
5529
5308
  className: `${getClassName17({
@@ -5545,7 +5324,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5545
5324
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
5546
5325
  }),
5547
5326
  children: contentIdsWithPreview.map((componentId, i) => {
5548
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5327
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5549
5328
  DropZoneChildMemo,
5550
5329
  {
5551
5330
  zoneCompound,
@@ -5570,7 +5349,7 @@ var DropZoneRenderItem = ({
5570
5349
  metadata
5571
5350
  }) => {
5572
5351
  const Component = config.components[item.type];
5573
- const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5352
+ const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5574
5353
  const nextContextValue = (0, import_react34.useMemo)(
5575
5354
  () => ({
5576
5355
  areaId: props.id,
@@ -5578,7 +5357,7 @@ var DropZoneRenderItem = ({
5578
5357
  }),
5579
5358
  [props]
5580
5359
  );
5581
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5360
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5582
5361
  Component.render,
5583
5362
  __spreadProps(__spreadValues({}, props), {
5584
5363
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -5588,8 +5367,8 @@ var DropZoneRenderItem = ({
5588
5367
  })
5589
5368
  ) }, props.id);
5590
5369
  };
5591
- var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneRender, __spreadValues({}, props));
5592
- var DropZoneRender = (0, import_react34.forwardRef)(
5370
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadValues({}, props));
5371
+ var DropZoneRender2 = (0, import_react34.forwardRef)(
5593
5372
  function DropZoneRenderInternal({ className, style, zone }, ref) {
5594
5373
  const ctx = (0, import_react34.useContext)(dropZoneContext);
5595
5374
  const { areaId = "root" } = ctx || {};
@@ -5615,10 +5394,10 @@ var DropZoneRender = (0, import_react34.forwardRef)(
5615
5394
  zoneCompound = `${areaId}:${zone}`;
5616
5395
  content = setupZone(data, zoneCompound).zones[zoneCompound];
5617
5396
  }
5618
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className, style, ref, children: content.map((item) => {
5397
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
5619
5398
  const Component = config.components[item.type];
5620
5399
  if (Component) {
5621
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5400
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5622
5401
  DropZoneRenderItem,
5623
5402
  {
5624
5403
  config,
@@ -5632,21 +5411,20 @@ var DropZoneRender = (0, import_react34.forwardRef)(
5632
5411
  }) });
5633
5412
  }
5634
5413
  );
5635
- var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, __spreadValues({}, props));
5414
+ var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, __spreadValues({}, props));
5636
5415
  var DropZone = (0, import_react34.forwardRef)(
5637
5416
  function DropZone2(props, ref) {
5638
5417
  const ctx = (0, import_react34.useContext)(dropZoneContext);
5639
5418
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
5640
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5419
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5641
5420
  }
5642
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
5421
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
5643
5422
  }
5644
5423
  );
5645
5424
 
5646
5425
  // lib/dnd/NestedDroppablePlugin.ts
5647
5426
  init_react_import();
5648
- var import_abstract10 = require("@dnd-kit/abstract");
5649
- var import_state2 = require("@dnd-kit/state");
5427
+ var import_abstract9 = require("@dnd-kit/abstract");
5650
5428
 
5651
5429
  // lib/throttle.ts
5652
5430
  init_react_import();
@@ -5695,7 +5473,7 @@ var GlobalPosition = class {
5695
5473
  var _a;
5696
5474
  this.target = target;
5697
5475
  this.original = original;
5698
- this.frameEl = document.querySelector("iframe");
5476
+ this.frameEl = document.querySelector("iframe#preview-frame");
5699
5477
  if (this.frameEl) {
5700
5478
  this.frameRect = this.frameEl.getBoundingClientRect();
5701
5479
  this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
@@ -5775,6 +5553,7 @@ var getZoneId2 = (candidate) => {
5775
5553
  }
5776
5554
  return id;
5777
5555
  };
5556
+ var BUFFER = 6;
5778
5557
  var getPointerCollisions = (position, manager) => {
5779
5558
  const candidates = [];
5780
5559
  let elements = position.target.ownerDocument.elementsFromPoint(
@@ -5798,13 +5577,26 @@ var getPointerCollisions = (position, manager) => {
5798
5577
  for (let i = 0; i < elements.length; i++) {
5799
5578
  const element = elements[i];
5800
5579
  const dropzoneId = element.getAttribute("data-puck-dropzone");
5580
+ const id = element.getAttribute("data-puck-dnd");
5581
+ const isVoid = element.hasAttribute("data-puck-dnd-void");
5582
+ if (BUFFER && (dropzoneId || id) && !isVoid) {
5583
+ const box = element.getBoundingClientRect();
5584
+ const contractedBox = {
5585
+ left: box.left + BUFFER,
5586
+ right: box.right - BUFFER,
5587
+ top: box.top + BUFFER,
5588
+ bottom: box.bottom - BUFFER
5589
+ };
5590
+ if (position.frame.x < contractedBox.left || position.frame.x > contractedBox.right || position.frame.y > contractedBox.bottom || position.frame.y < contractedBox.top) {
5591
+ continue;
5592
+ }
5593
+ }
5801
5594
  if (dropzoneId) {
5802
5595
  const droppable = manager.registry.droppables.get(dropzoneId);
5803
5596
  if (droppable) {
5804
5597
  candidates.push(droppable);
5805
5598
  }
5806
5599
  }
5807
- const id = element.getAttribute("data-puck-dnd");
5808
5600
  if (id) {
5809
5601
  const droppable = manager.registry.droppables.get(id);
5810
5602
  if (droppable) {
@@ -5858,17 +5650,17 @@ var findDeepestCandidate = (position, manager) => {
5858
5650
  return { zone, area };
5859
5651
  }
5860
5652
  return {
5861
- zone: "default-zone",
5862
- area: null
5653
+ zone: rootDroppableId,
5654
+ area: rootAreaId
5863
5655
  };
5864
5656
  };
5865
- var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract10.Plugin {
5657
+ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract9.Plugin {
5866
5658
  constructor(manager, options) {
5867
5659
  super(manager);
5868
5660
  if (typeof window === "undefined") {
5869
5661
  return;
5870
5662
  }
5871
- const cleanupEffect = (0, import_state2.effects)(() => {
5663
+ this.registerEffect(() => {
5872
5664
  const handleMove = (event) => {
5873
5665
  const target = event instanceof BubbledPointerEvent ? event.originalTarget || event.target : event.target;
5874
5666
  const position = new GlobalPosition(target, {
@@ -5892,12 +5684,12 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
5892
5684
  capture: true
5893
5685
  // dndkit's PointerSensor prevents propagation during drag
5894
5686
  });
5895
- this.destroy = () => {
5687
+ const cleanup = () => {
5896
5688
  document.body.removeEventListener("pointermove", handlePointerMove, {
5897
5689
  capture: true
5898
5690
  });
5899
- cleanupEffect();
5900
5691
  };
5692
+ return cleanup;
5901
5693
  });
5902
5694
  }
5903
5695
  };
@@ -5957,14 +5749,15 @@ function getDeepDir(el) {
5957
5749
  }
5958
5750
 
5959
5751
  // components/DragDropContext/index.tsx
5960
- var import_jsx_runtime24 = require("react/jsx-runtime");
5752
+ var import_debug = require("@dnd-kit/dom/plugins/debug");
5753
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5961
5754
  var DEBUG3 = false;
5962
- var dragListenerContext = (0, import_react36.createContext)({
5755
+ var dragListenerContext = (0, import_react37.createContext)({
5963
5756
  dragListeners: {}
5964
5757
  });
5965
5758
  function useDragListener(type, fn, deps = []) {
5966
- const { setDragListeners } = (0, import_react36.useContext)(dragListenerContext);
5967
- (0, import_react36.useEffect)(() => {
5759
+ const { setDragListeners } = (0, import_react37.useContext)(dragListenerContext);
5760
+ (0, import_react37.useEffect)(() => {
5968
5761
  if (setDragListeners) {
5969
5762
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
5970
5763
  [type]: [...old[type] || [], fn]
@@ -5974,8 +5767,8 @@ function useDragListener(type, fn, deps = []) {
5974
5767
  }
5975
5768
  var AREA_CHANGE_DEBOUNCE_MS = 100;
5976
5769
  var useTempDisableFallback = (timeout3) => {
5977
- const lastFallbackDisable = (0, import_react36.useRef)(null);
5978
- return (0, import_react36.useCallback)((manager) => {
5770
+ const lastFallbackDisable = (0, import_react37.useRef)(null);
5771
+ return (0, import_react37.useCallback)((manager) => {
5979
5772
  collisionStore.setState({ fallbackEnabled: false });
5980
5773
  const fallbackId = generateId();
5981
5774
  lastFallbackDisable.current = fallbackId;
@@ -5994,9 +5787,9 @@ var DragDropContextClient = ({
5994
5787
  const dispatch = useAppStore((s) => s.dispatch);
5995
5788
  const appStore = useAppStoreApi();
5996
5789
  const id = useSafeId();
5997
- const debouncedParamsRef = (0, import_react36.useRef)(null);
5790
+ const debouncedParamsRef = (0, import_react37.useRef)(null);
5998
5791
  const tempDisableFallback = useTempDisableFallback(100);
5999
- const [zoneStore] = (0, import_react36.useState)(
5792
+ const [zoneStore] = (0, import_react37.useState)(
6000
5793
  () => (0, import_zustand5.createStore)(() => ({
6001
5794
  zoneDepthIndex: {},
6002
5795
  nextZoneDepthIndex: {},
@@ -6006,7 +5799,7 @@ var DragDropContextClient = ({
6006
5799
  previewIndex: {}
6007
5800
  }))
6008
5801
  );
6009
- const getChanged2 = (0, import_react36.useCallback)(
5802
+ const getChanged2 = (0, import_react37.useCallback)(
6010
5803
  (params, id2) => {
6011
5804
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
6012
5805
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -6027,7 +5820,7 @@ var DragDropContextClient = ({
6027
5820
  },
6028
5821
  [zoneStore]
6029
5822
  );
6030
- const setDeepestAndCollide = (0, import_react36.useCallback)(
5823
+ const setDeepestAndCollide = (0, import_react37.useCallback)(
6031
5824
  (params, manager) => {
6032
5825
  const { zoneChanged, areaChanged } = getChanged2(params, id);
6033
5826
  if (!zoneChanged && !areaChanged) return;
@@ -6051,7 +5844,7 @@ var DragDropContextClient = ({
6051
5844
  setDeepestDb.cancel();
6052
5845
  debouncedParamsRef.current = null;
6053
5846
  };
6054
- (0, import_react36.useEffect)(() => {
5847
+ (0, import_react37.useEffect)(() => {
6055
5848
  if (DEBUG3) {
6056
5849
  zoneStore.subscribe(
6057
5850
  (s) => {
@@ -6065,8 +5858,9 @@ var DragDropContextClient = ({
6065
5858
  );
6066
5859
  }
6067
5860
  }, []);
6068
- const [plugins] = (0, import_react36.useState)(() => [
5861
+ const [plugins] = (0, import_react37.useState)(() => [
6069
5862
  ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
5863
+ import_debug.Debug,
6070
5864
  createNestedDroppablePlugin(
6071
5865
  {
6072
5866
  onChange: (params, manager) => {
@@ -6113,10 +5907,10 @@ var DragDropContextClient = ({
6113
5907
  )
6114
5908
  ]);
6115
5909
  const sensors = useSensors();
6116
- const [dragListeners, setDragListeners] = (0, import_react36.useState)({});
6117
- const dragMode = (0, import_react36.useRef)(null);
6118
- const initialSelector = (0, import_react36.useRef)(void 0);
6119
- const nextContextValue = (0, import_react36.useMemo)(
5910
+ const [dragListeners, setDragListeners] = (0, import_react37.useState)({});
5911
+ const dragMode = (0, import_react37.useRef)(null);
5912
+ const initialSelector = (0, import_react37.useRef)(void 0);
5913
+ const nextContextValue = (0, import_react37.useMemo)(
6120
5914
  () => ({
6121
5915
  mode: "edit",
6122
5916
  areaId: "root",
@@ -6124,15 +5918,15 @@ var DragDropContextClient = ({
6124
5918
  }),
6125
5919
  []
6126
5920
  );
6127
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5921
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6128
5922
  dragListenerContext.Provider,
6129
5923
  {
6130
5924
  value: {
6131
5925
  dragListeners,
6132
5926
  setDragListeners
6133
5927
  },
6134
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6135
- import_react35.DragDropProvider,
5928
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5929
+ import_react36.DragDropProvider,
6136
5930
  {
6137
5931
  plugins,
6138
5932
  sensors,
@@ -6199,7 +5993,7 @@ var DragDropContextClient = ({
6199
5993
  }, 250);
6200
5994
  },
6201
5995
  onDragOver: (event, manager) => {
6202
- var _a, _b, _c, _d, _e;
5996
+ var _a, _b, _c, _d;
6203
5997
  event.preventDefault();
6204
5998
  const draggedItem = (_a = zoneStore.getState()) == null ? void 0 : _a.draggedItem;
6205
5999
  if (!draggedItem) return;
@@ -6217,7 +6011,7 @@ var DragDropContextClient = ({
6217
6011
  const targetData = target.data;
6218
6012
  targetZone = targetData.zone;
6219
6013
  targetIndex = targetData.index;
6220
- const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
6014
+ const collisionData = (_b = manager.collisionObserver.collisions[0]) == null ? void 0 : _b.data;
6221
6015
  const dir = getDeepDir(target.element);
6222
6016
  const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || dir === "ltr" && (collisionData == null ? void 0 : collisionData.direction) === "left" || dir === "rtl" && (collisionData == null ? void 0 : collisionData.direction) === "right" ? "before" : "after";
6223
6017
  if (targetIndex >= sourceIndex && sourceZone === targetZone) {
@@ -6230,7 +6024,7 @@ var DragDropContextClient = ({
6230
6024
  targetZone = target.id.toString();
6231
6025
  targetIndex = 0;
6232
6026
  }
6233
- const path = ((_d = appStore.getState().state.indexes.nodes[target.id]) == null ? void 0 : _d.path) || [];
6027
+ const path = ((_c = appStore.getState().state.indexes.nodes[target.id]) == null ? void 0 : _c.path) || [];
6234
6028
  if (targetId === sourceId || path.find((path2) => {
6235
6029
  const [pathId] = path2.split(":");
6236
6030
  return pathId === sourceId;
@@ -6276,16 +6070,12 @@ var DragDropContextClient = ({
6276
6070
  });
6277
6071
  }
6278
6072
  }
6279
- (_e = dragListeners.dragover) == null ? void 0 : _e.forEach((fn) => {
6073
+ (_d = dragListeners.dragover) == null ? void 0 : _d.forEach((fn) => {
6280
6074
  fn(event, manager);
6281
6075
  });
6282
6076
  },
6283
6077
  onDragStart: (event, manager) => {
6284
6078
  var _a;
6285
- dispatch({
6286
- type: "setUi",
6287
- ui: { itemSelector: null, isDragging: true }
6288
- });
6289
6079
  const { source } = event.operation;
6290
6080
  if (source && source.type !== "void") {
6291
6081
  const sourceData = source.data;
@@ -6316,12 +6106,12 @@ var DragDropContextClient = ({
6316
6106
  },
6317
6107
  onBeforeDragStart: (event) => {
6318
6108
  var _a;
6319
- const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.data.type) === "drawer";
6109
+ const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.type) === "drawer";
6320
6110
  dragMode.current = isNewComponent ? "new" : "existing";
6321
6111
  initialSelector.current = void 0;
6322
6112
  zoneStore.setState({ draggedItem: event.operation.source });
6323
6113
  },
6324
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6114
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6325
6115
  }
6326
6116
  )
6327
6117
  }
@@ -6335,11 +6125,12 @@ var DragDropContext = ({
6335
6125
  if (status === "LOADING") {
6336
6126
  return children;
6337
6127
  }
6338
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragDropContextClient, { disableAutoScroll, children });
6128
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DragDropContextClient, { disableAutoScroll, children });
6339
6129
  };
6340
6130
 
6341
6131
  // components/Drawer/index.tsx
6342
- var import_jsx_runtime25 = require("react/jsx-runtime");
6132
+ var import_react39 = require("@dnd-kit/react");
6133
+ var import_jsx_runtime27 = require("react/jsx-runtime");
6343
6134
  var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
6344
6135
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
6345
6136
  var DrawerItemInner = ({
@@ -6349,11 +6140,11 @@ var DrawerItemInner = ({
6349
6140
  dragRef,
6350
6141
  isDragDisabled
6351
6142
  }) => {
6352
- const CustomInner = (0, import_react37.useMemo)(
6353
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6143
+ const CustomInner = (0, import_react38.useMemo)(
6144
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6354
6145
  [children]
6355
6146
  );
6356
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6147
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6357
6148
  "div",
6358
6149
  {
6359
6150
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -6361,9 +6152,9 @@ var DrawerItemInner = ({
6361
6152
  onMouseDown: (e) => e.preventDefault(),
6362
6153
  "data-testid": dragRef ? `drawer-item:${name}` : "",
6363
6154
  "data-puck-drawer-item": true,
6364
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
6365
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6366
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DragIcon, {}) })
6155
+ 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: [
6156
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6157
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DragIcon, {}) })
6367
6158
  ] }) }) })
6368
6159
  }
6369
6160
  );
@@ -6375,14 +6166,15 @@ var DrawerItemDraggable = ({
6375
6166
  id,
6376
6167
  isDragDisabled
6377
6168
  }) => {
6378
- const { ref } = useDraggableSafe({
6169
+ const { ref } = (0, import_react39.useDraggable)({
6379
6170
  id,
6380
- data: { type: "drawer", componentType: name },
6381
- disabled: isDragDisabled
6171
+ data: { componentType: name },
6172
+ disabled: isDragDisabled,
6173
+ type: "drawer"
6382
6174
  });
6383
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName18("draggable"), children: [
6384
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name, label, children }) }),
6385
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6175
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName18("draggable"), children: [
6176
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name, label, children }) }),
6177
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6386
6178
  DrawerItemInner,
6387
6179
  {
6388
6180
  name,
@@ -6403,7 +6195,7 @@ var DrawerItem = ({
6403
6195
  isDragDisabled
6404
6196
  }) => {
6405
6197
  const resolvedId = id || name;
6406
- const [dynamicId, setDynamicId] = (0, import_react37.useState)(generateId(resolvedId));
6198
+ const [dynamicId, setDynamicId] = (0, import_react38.useState)(generateId(resolvedId));
6407
6199
  if (typeof index !== "undefined") {
6408
6200
  console.error(
6409
6201
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -6416,7 +6208,7 @@ var DrawerItem = ({
6416
6208
  },
6417
6209
  [resolvedId]
6418
6210
  );
6419
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6211
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6420
6212
  DrawerItemDraggable,
6421
6213
  {
6422
6214
  name,
@@ -6443,19 +6235,20 @@ var Drawer = ({
6443
6235
  );
6444
6236
  }
6445
6237
  const id = useSafeId();
6446
- const { ref } = useDroppableSafe({
6238
+ const { ref } = (0, import_react39.useDroppable)({
6447
6239
  id,
6448
6240
  type: "void",
6449
6241
  collisionPriority: 0
6450
6242
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
6451
6243
  });
6452
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6244
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6453
6245
  "div",
6454
6246
  {
6455
6247
  className: getClassName18(),
6456
6248
  ref,
6457
6249
  "data-puck-dnd": id,
6458
6250
  "data-puck-drawer": true,
6251
+ "data-puck-dnd-void": true,
6459
6252
  children
6460
6253
  }
6461
6254
  );
@@ -6464,7 +6257,7 @@ Drawer.Item = DrawerItem;
6464
6257
 
6465
6258
  // components/Puck/index.tsx
6466
6259
  init_react_import();
6467
- var import_react52 = require("react");
6260
+ var import_react54 = require("react");
6468
6261
 
6469
6262
  // components/SidebarSection/index.tsx
6470
6263
  init_react_import();
@@ -6475,7 +6268,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_8boj8_1", "Si
6475
6268
 
6476
6269
  // lib/use-breadcrumbs.ts
6477
6270
  init_react_import();
6478
- var import_react38 = require("react");
6271
+ var import_react40 = require("react");
6479
6272
  var useBreadcrumbs = (renderCount) => {
6480
6273
  const selectedId = useAppStore((s) => {
6481
6274
  var _a;
@@ -6487,7 +6280,7 @@ var useBreadcrumbs = (renderCount) => {
6487
6280
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
6488
6281
  });
6489
6282
  const appStore = useAppStoreApi();
6490
- return (0, import_react38.useMemo)(() => {
6283
+ return (0, import_react40.useMemo)(() => {
6491
6284
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
6492
6285
  var _a, _b, _c;
6493
6286
  const [componentId] = zoneCompound.split(":");
@@ -6518,7 +6311,7 @@ var useBreadcrumbs = (renderCount) => {
6518
6311
  };
6519
6312
 
6520
6313
  // components/SidebarSection/index.tsx
6521
- var import_jsx_runtime26 = require("react/jsx-runtime");
6314
+ var import_jsx_runtime28 = require("react/jsx-runtime");
6522
6315
  var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
6523
6316
  var SidebarSection = ({
6524
6317
  children,
@@ -6531,15 +6324,15 @@ var SidebarSection = ({
6531
6324
  }) => {
6532
6325
  const setUi = useAppStore((s) => s.setUi);
6533
6326
  const breadcrumbs = useBreadcrumbs(1);
6534
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
6327
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
6535
6328
  "div",
6536
6329
  {
6537
6330
  className: getClassName19({ noBorderTop, noPadding }),
6538
6331
  style: { background },
6539
6332
  children: [
6540
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
6541
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
6542
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6333
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
6334
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
6335
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6543
6336
  "button",
6544
6337
  {
6545
6338
  type: "button",
@@ -6548,12 +6341,12 @@ var SidebarSection = ({
6548
6341
  children: breadcrumb.label
6549
6342
  }
6550
6343
  ),
6551
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
6344
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
6552
6345
  ] }, i)) : null,
6553
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
6346
+ /* @__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
6347
  ] }) }),
6555
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
6556
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 32 }) })
6348
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
6349
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
6557
6350
  ]
6558
6351
  }
6559
6352
  );
@@ -6567,7 +6360,7 @@ init_react_import();
6567
6360
  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
6361
 
6569
6362
  // components/MenuBar/index.tsx
6570
- var import_jsx_runtime27 = require("react/jsx-runtime");
6363
+ var import_jsx_runtime29 = require("react/jsx-runtime");
6571
6364
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
6572
6365
  function MenuBar({
6573
6366
  menuOpen = false,
@@ -6578,7 +6371,7 @@ function MenuBar({
6578
6371
  const forward = useAppStore((s) => s.history.forward);
6579
6372
  const hasFuture = useAppStore((s) => s.history.hasFuture());
6580
6373
  const hasPast = useAppStore((s) => s.history.hasPast());
6581
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6374
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6582
6375
  "div",
6583
6376
  {
6584
6377
  className: getClassName20({ menuOpen }),
@@ -6592,12 +6385,12 @@ function MenuBar({
6592
6385
  setMenuOpen(false);
6593
6386
  }
6594
6387
  },
6595
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
6596
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
6597
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
6598
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
6388
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName20("inner"), children: [
6389
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName20("history"), children: [
6390
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Undo2, { size: 21 }) }),
6391
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Redo2, { size: 21 }) })
6599
6392
  ] }),
6600
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions() })
6393
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: renderHeaderActions && renderHeaderActions() })
6601
6394
  ] })
6602
6395
  }
6603
6396
  );
@@ -6615,14 +6408,14 @@ init_react_import();
6615
6408
  var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
6616
6409
 
6617
6410
  // components/Puck/components/Fields/index.tsx
6618
- var import_react39 = require("react");
6411
+ var import_react41 = require("react");
6619
6412
  var import_shallow4 = require("zustand/react/shallow");
6620
- var import_jsx_runtime28 = require("react/jsx-runtime");
6413
+ var import_jsx_runtime30 = require("react/jsx-runtime");
6621
6414
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
6622
6415
  var DefaultFields = ({
6623
6416
  children
6624
6417
  }) => {
6625
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
6418
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
6626
6419
  };
6627
6420
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6628
6421
  let currentProps;
@@ -6688,12 +6481,12 @@ var FieldsChild = ({ fieldName }) => {
6688
6481
  })
6689
6482
  );
6690
6483
  const appStore = useAppStoreApi();
6691
- const onChange = (0, import_react39.useCallback)(createOnChange(fieldName, appStore), [
6484
+ const onChange = (0, import_react41.useCallback)(createOnChange(fieldName, appStore), [
6692
6485
  fieldName
6693
6486
  ]);
6694
6487
  if (!field || !id) return null;
6695
6488
  if (field.type === "slot") return null;
6696
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6489
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6697
6490
  AutoFieldPrivate,
6698
6491
  {
6699
6492
  field,
@@ -6721,11 +6514,16 @@ var Fields = ({ wrapFields = true }) => {
6721
6514
  useRegisterFieldsSlice(appStore, id);
6722
6515
  const fieldsLoading = useAppStore((s) => s.fields.loading);
6723
6516
  const fieldNames = useAppStore(
6724
- (0, import_shallow4.useShallow)((s) => Object.keys(s.fields.fields))
6517
+ (0, import_shallow4.useShallow)((s) => {
6518
+ if (s.fields.id === id) {
6519
+ return Object.keys(s.fields.fields);
6520
+ }
6521
+ return [];
6522
+ })
6725
6523
  );
6726
6524
  const isLoading = fieldsLoading || componentResolving;
6727
- const Wrapper = (0, import_react39.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
6728
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
6525
+ const Wrapper = (0, import_react41.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
6526
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6729
6527
  "form",
6730
6528
  {
6731
6529
  className: getClassName21({ wrapFields }),
@@ -6733,8 +6531,8 @@ var Fields = ({ wrapFields = true }) => {
6733
6531
  e.preventDefault();
6734
6532
  },
6735
6533
  children: [
6736
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldsChild, { fieldName }, fieldName)) }),
6737
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 16 }) }) })
6534
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldsChild, { fieldName }, fieldName)) }),
6535
+ 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
6536
  ]
6739
6537
  }
6740
6538
  );
@@ -6745,7 +6543,7 @@ init_react_import();
6745
6543
 
6746
6544
  // lib/use-component-list.tsx
6747
6545
  init_react_import();
6748
- var import_react40 = require("react");
6546
+ var import_react42 = require("react");
6749
6547
 
6750
6548
  // components/ComponentList/index.tsx
6751
6549
  init_react_import();
@@ -6755,7 +6553,7 @@ init_react_import();
6755
6553
  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
6554
 
6757
6555
  // components/ComponentList/index.tsx
6758
- var import_jsx_runtime29 = require("react/jsx-runtime");
6556
+ var import_jsx_runtime31 = require("react/jsx-runtime");
6759
6557
  var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
6760
6558
  var ComponentListItem = ({
6761
6559
  name,
@@ -6767,7 +6565,7 @@ var ComponentListItem = ({
6767
6565
  type: name
6768
6566
  }).insert
6769
6567
  );
6770
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
6568
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
6771
6569
  };
6772
6570
  var ComponentList = ({
6773
6571
  children,
@@ -6778,8 +6576,8 @@ var ComponentList = ({
6778
6576
  const setUi = useAppStore((s) => s.setUi);
6779
6577
  const componentList = useAppStore((s) => s.state.ui.componentList);
6780
6578
  const { expanded = true } = componentList[id] || {};
6781
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
6782
- title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
6579
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
6580
+ title && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6783
6581
  "button",
6784
6582
  {
6785
6583
  type: "button",
@@ -6793,14 +6591,14 @@ var ComponentList = ({
6793
6591
  }),
6794
6592
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
6795
6593
  children: [
6796
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
6797
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { size: 12 }) })
6594
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: title }),
6595
+ /* @__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
6596
  ]
6799
6597
  }
6800
6598
  ),
6801
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6599
+ /* @__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
6600
  var _a;
6803
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6601
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6804
6602
  ComponentListItem,
6805
6603
  {
6806
6604
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -6814,12 +6612,12 @@ var ComponentList = ({
6814
6612
  ComponentList.Item = ComponentListItem;
6815
6613
 
6816
6614
  // lib/use-component-list.tsx
6817
- var import_jsx_runtime30 = require("react/jsx-runtime");
6615
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6818
6616
  var useComponentList = () => {
6819
- const [componentList, setComponentList] = (0, import_react40.useState)();
6617
+ const [componentList, setComponentList] = (0, import_react42.useState)();
6820
6618
  const config = useAppStore((s) => s.config);
6821
6619
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
6822
- (0, import_react40.useEffect)(() => {
6620
+ (0, import_react42.useEffect)(() => {
6823
6621
  var _a, _b, _c;
6824
6622
  if (Object.keys(uiComponentList).length > 0) {
6825
6623
  const matchedComponents = [];
@@ -6829,7 +6627,7 @@ var useComponentList = () => {
6829
6627
  if (category.visible === false || !category.components) {
6830
6628
  return null;
6831
6629
  }
6832
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6630
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6833
6631
  ComponentList,
6834
6632
  {
6835
6633
  id: categoryKey,
@@ -6838,7 +6636,7 @@ var useComponentList = () => {
6838
6636
  var _a2;
6839
6637
  matchedComponents.push(componentName);
6840
6638
  const componentConf = config.components[componentName] || {};
6841
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6639
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6842
6640
  ComponentList.Item,
6843
6641
  {
6844
6642
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -6858,7 +6656,7 @@ var useComponentList = () => {
6858
6656
  );
6859
6657
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
6860
6658
  _componentList.push(
6861
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6659
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6862
6660
  ComponentList,
6863
6661
  {
6864
6662
  id: "other",
@@ -6866,7 +6664,7 @@ var useComponentList = () => {
6866
6664
  children: remainingComponents.map((componentName, i) => {
6867
6665
  var _a2;
6868
6666
  const componentConf = config.components[componentName] || {};
6869
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6667
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6870
6668
  ComponentList.Item,
6871
6669
  {
6872
6670
  name: componentName,
@@ -6888,25 +6686,25 @@ var useComponentList = () => {
6888
6686
  };
6889
6687
 
6890
6688
  // components/Puck/components/Components/index.tsx
6891
- var import_react41 = require("react");
6892
- var import_jsx_runtime31 = require("react/jsx-runtime");
6689
+ var import_react43 = require("react");
6690
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6893
6691
  var Components = () => {
6894
6692
  const overrides = useAppStore((s) => s.overrides);
6895
6693
  const componentList = useComponentList();
6896
- const Wrapper = (0, import_react41.useMemo)(() => overrides.components || "div", [overrides]);
6897
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
6694
+ const Wrapper = (0, import_react43.useMemo)(() => overrides.components || "div", [overrides]);
6695
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComponentList, { id: "all" }) });
6898
6696
  };
6899
6697
 
6900
6698
  // components/Puck/components/Preview/index.tsx
6901
6699
  init_react_import();
6902
- var import_react43 = require("react");
6700
+ var import_react45 = require("react");
6903
6701
 
6904
6702
  // components/AutoFrame/index.tsx
6905
6703
  init_react_import();
6906
- var import_react42 = require("react");
6704
+ var import_react44 = require("react");
6907
6705
  var import_object_hash = __toESM(require("object-hash"));
6908
6706
  var import_react_dom3 = require("react-dom");
6909
- var import_jsx_runtime32 = require("react/jsx-runtime");
6707
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6910
6708
  var styleSelector = 'style, link[rel="stylesheet"]';
6911
6709
  var collectStyles = (doc) => {
6912
6710
  const collected = [];
@@ -6949,7 +6747,7 @@ var CopyHostStyles = ({
6949
6747
  onStylesLoaded = () => null
6950
6748
  }) => {
6951
6749
  const { document: doc, window: win } = useFrame();
6952
- (0, import_react42.useEffect)(() => {
6750
+ (0, import_react44.useEffect)(() => {
6953
6751
  if (!win || !doc) {
6954
6752
  return () => {
6955
6753
  };
@@ -7106,10 +6904,10 @@ var CopyHostStyles = ({
7106
6904
  observer.disconnect();
7107
6905
  };
7108
6906
  }, []);
7109
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
6907
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
7110
6908
  };
7111
- var autoFrameContext = (0, import_react42.createContext)({});
7112
- var useFrame = () => (0, import_react42.useContext)(autoFrameContext);
6909
+ var autoFrameContext = (0, import_react44.createContext)({});
6910
+ var useFrame = () => (0, import_react44.useContext)(autoFrameContext);
7113
6911
  function AutoFrame(_a) {
7114
6912
  var _b = _a, {
7115
6913
  children,
@@ -7130,11 +6928,11 @@ function AutoFrame(_a) {
7130
6928
  "onNotReady",
7131
6929
  "frameRef"
7132
6930
  ]);
7133
- const [loaded, setLoaded] = (0, import_react42.useState)(false);
7134
- const [ctx, setCtx] = (0, import_react42.useState)({});
7135
- const [mountTarget, setMountTarget] = (0, import_react42.useState)();
7136
- const [stylesLoaded, setStylesLoaded] = (0, import_react42.useState)(false);
7137
- (0, import_react42.useEffect)(() => {
6931
+ const [loaded, setLoaded] = (0, import_react44.useState)(false);
6932
+ const [ctx, setCtx] = (0, import_react44.useState)({});
6933
+ const [mountTarget, setMountTarget] = (0, import_react44.useState)();
6934
+ const [stylesLoaded, setStylesLoaded] = (0, import_react44.useState)(false);
6935
+ (0, import_react44.useEffect)(() => {
7138
6936
  var _a2;
7139
6937
  if (frameRef.current) {
7140
6938
  const doc = frameRef.current.contentDocument;
@@ -7153,7 +6951,7 @@ function AutoFrame(_a) {
7153
6951
  }
7154
6952
  }
7155
6953
  }, [frameRef, loaded, stylesLoaded]);
7156
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6954
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7157
6955
  "iframe",
7158
6956
  __spreadProps(__spreadValues({}, props), {
7159
6957
  className,
@@ -7163,7 +6961,7 @@ function AutoFrame(_a) {
7163
6961
  onLoad: () => {
7164
6962
  setLoaded(true);
7165
6963
  },
7166
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6964
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7167
6965
  CopyHostStyles,
7168
6966
  {
7169
6967
  debug,
@@ -7182,11 +6980,11 @@ init_react_import();
7182
6980
  var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7183
6981
 
7184
6982
  // components/Puck/components/Preview/index.tsx
7185
- var import_jsx_runtime33 = require("react/jsx-runtime");
6983
+ var import_jsx_runtime35 = require("react/jsx-runtime");
7186
6984
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
7187
6985
  var useBubbleIframeEvents = (ref) => {
7188
6986
  const status = useAppStore((s) => s.status);
7189
- (0, import_react43.useEffect)(() => {
6987
+ (0, import_react45.useEffect)(() => {
7190
6988
  if (ref.current && status === "READY") {
7191
6989
  const iframe = ref.current;
7192
6990
  const handlePointerMove = (event) => {
@@ -7235,22 +7033,22 @@ var Preview3 = ({ id = "puck-preview" }) => {
7235
7033
  const renderData = useAppStore(
7236
7034
  (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
7237
7035
  );
7238
- const Page = (0, import_react43.useCallback)(
7036
+ const Page = (0, import_react45.useCallback)(
7239
7037
  (pageProps) => {
7240
7038
  var _a, _b;
7241
7039
  const rootConfig = config.root;
7242
7040
  const propsWithSlots = useSlots(rootConfig, pageProps, DropZoneEditPure);
7243
7041
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
7244
7042
  id: "puck-root"
7245
- }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: propsWithSlots.children });
7043
+ }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: propsWithSlots.children });
7246
7044
  },
7247
7045
  [config.root]
7248
7046
  );
7249
- const Frame = (0, import_react43.useMemo)(() => overrides.iframe, [overrides]);
7047
+ const Frame = (0, import_react45.useMemo)(() => overrides.iframe, [overrides]);
7250
7048
  const rootProps = root.props || root;
7251
- const ref = (0, import_react43.useRef)(null);
7049
+ const ref = (0, import_react45.useRef)(null);
7252
7050
  useBubbleIframeEvents(ref);
7253
- const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7051
+ const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7254
7052
  Page,
7255
7053
  __spreadProps(__spreadValues({}, rootProps), {
7256
7054
  puck: {
@@ -7260,15 +7058,15 @@ var Preview3 = ({ id = "puck-preview" }) => {
7260
7058
  metadata
7261
7059
  },
7262
7060
  editMode: true,
7263
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZonePure, { zone: rootDroppableId })
7061
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZonePure, { zone: rootDroppableId })
7264
7062
  })
7265
- ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: renderData, config });
7266
- (0, import_react43.useEffect)(() => {
7063
+ ) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Render, { data: renderData, config });
7064
+ (0, import_react45.useEffect)(() => {
7267
7065
  if (!iframe.enabled) {
7268
7066
  setStatus("READY");
7269
7067
  }
7270
7068
  }, [iframe.enabled]);
7271
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7069
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7272
7070
  "div",
7273
7071
  {
7274
7072
  className: getClassName23(),
@@ -7277,7 +7075,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
7277
7075
  onClick: () => {
7278
7076
  dispatch({ type: "setUi", ui: { itemSelector: null } });
7279
7077
  },
7280
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7078
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7281
7079
  AutoFrame_default,
7282
7080
  {
7283
7081
  id: "preview-frame",
@@ -7290,14 +7088,14 @@ var Preview3 = ({ id = "puck-preview" }) => {
7290
7088
  setStatus("MOUNTED");
7291
7089
  },
7292
7090
  frameRef: ref,
7293
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7091
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7294
7092
  if (Frame) {
7295
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame, { document: document2, children: inner });
7093
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Frame, { document: document2, children: inner });
7296
7094
  }
7297
7095
  return inner;
7298
7096
  } })
7299
7097
  }
7300
- ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7098
+ ) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7301
7099
  "div",
7302
7100
  {
7303
7101
  id: "preview-frame",
@@ -7333,7 +7131,7 @@ var scrollIntoView = (el) => {
7333
7131
  };
7334
7132
 
7335
7133
  // components/LayerTree/index.tsx
7336
- var import_react44 = require("react");
7134
+ var import_react46 = require("react");
7337
7135
 
7338
7136
  // lib/on-scroll-end.ts
7339
7137
  init_react_import();
@@ -7356,7 +7154,7 @@ var onScrollEnd = (frame, cb) => {
7356
7154
 
7357
7155
  // components/LayerTree/index.tsx
7358
7156
  var import_shallow5 = require("zustand/react/shallow");
7359
- var import_jsx_runtime34 = require("react/jsx-runtime");
7157
+ var import_jsx_runtime36 = require("react/jsx-runtime");
7360
7158
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
7361
7159
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
7362
7160
  var Layer = ({
@@ -7365,11 +7163,11 @@ var Layer = ({
7365
7163
  zoneCompound
7366
7164
  }) => {
7367
7165
  var _a;
7368
- const ctx = (0, import_react44.useContext)(dropZoneContext);
7166
+ const ctx = (0, import_react46.useContext)(dropZoneContext);
7369
7167
  const config = useAppStore((s) => s.config);
7370
7168
  const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
7371
7169
  const dispatch = useAppStore((s) => s.dispatch);
7372
- const setItemSelector = (0, import_react44.useCallback)(
7170
+ const setItemSelector = (0, import_react46.useCallback)(
7373
7171
  (itemSelector2) => {
7374
7172
  dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
7375
7173
  },
@@ -7402,7 +7200,7 @@ var Layer = ({
7402
7200
  });
7403
7201
  const componentConfig = config.components[nodeData.data.type];
7404
7202
  const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
7405
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7203
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7406
7204
  "li",
7407
7205
  {
7408
7206
  className: getClassNameLayer({
@@ -7412,7 +7210,7 @@ var Layer = ({
7412
7210
  childIsSelected
7413
7211
  }),
7414
7212
  children: [
7415
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
7213
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7416
7214
  "button",
7417
7215
  {
7418
7216
  type: "button",
@@ -7447,22 +7245,22 @@ var Layer = ({
7447
7245
  setHoveringComponent(null);
7448
7246
  },
7449
7247
  children: [
7450
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7248
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7451
7249
  "div",
7452
7250
  {
7453
7251
  className: getClassNameLayer("chevron"),
7454
7252
  title: isSelected ? "Collapse" : "Expand",
7455
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
7253
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChevronDown, { size: "12" })
7456
7254
  }
7457
7255
  ),
7458
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
7459
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
7460
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label })
7256
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassNameLayer("title"), children: [
7257
+ /* @__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" }) }),
7258
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassNameLayer("name"), children: label })
7461
7259
  ] })
7462
7260
  ]
7463
7261
  }
7464
7262
  ) }),
7465
- containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
7263
+ 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
7264
  ]
7467
7265
  }
7468
7266
  );
@@ -7480,15 +7278,15 @@ var LayerTree = ({
7480
7278
  }
7481
7279
  )
7482
7280
  );
7483
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
7484
- label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
7485
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
7281
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
7282
+ label && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
7283
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Layers, { size: "16" }) }),
7486
7284
  label
7487
7285
  ] }),
7488
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
7489
- contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
7286
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("ul", { className: getClassName24(), children: [
7287
+ contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
7490
7288
  contentIds.map((itemId, i) => {
7491
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7289
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7492
7290
  Layer,
7493
7291
  {
7494
7292
  index: i,
@@ -7503,7 +7301,7 @@ var LayerTree = ({
7503
7301
  };
7504
7302
 
7505
7303
  // components/Puck/components/Outline/index.tsx
7506
- var import_react45 = require("react");
7304
+ var import_react47 = require("react");
7507
7305
 
7508
7306
  // lib/data/find-zones-for-area.ts
7509
7307
  init_react_import();
@@ -7515,14 +7313,14 @@ var findZonesForArea = (state, area) => {
7515
7313
 
7516
7314
  // components/Puck/components/Outline/index.tsx
7517
7315
  var import_shallow6 = require("zustand/react/shallow");
7518
- var import_jsx_runtime35 = require("react/jsx-runtime");
7316
+ var import_jsx_runtime37 = require("react/jsx-runtime");
7519
7317
  var Outline = () => {
7520
7318
  const outlineOverride = useAppStore((s) => s.overrides.outline);
7521
7319
  const rootZones = useAppStore(
7522
7320
  (0, import_shallow6.useShallow)((s) => findZonesForArea(s.state, "root"))
7523
7321
  );
7524
- const Wrapper = (0, import_react45.useMemo)(() => outlineOverride || "div", [outlineOverride]);
7525
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7322
+ const Wrapper = (0, import_react47.useMemo)(() => outlineOverride || "div", [outlineOverride]);
7323
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7526
7324
  LayerTree,
7527
7325
  {
7528
7326
  label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
@@ -7655,22 +7453,22 @@ var getBox = function getBox2(el) {
7655
7453
  };
7656
7454
 
7657
7455
  // components/Puck/components/Canvas/index.tsx
7658
- var import_react47 = require("react");
7456
+ var import_react49 = require("react");
7659
7457
 
7660
7458
  // components/ViewportControls/index.tsx
7661
7459
  init_react_import();
7662
- var import_react46 = require("react");
7460
+ var import_react48 = require("react");
7663
7461
 
7664
7462
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7665
7463
  init_react_import();
7666
7464
  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
7465
 
7668
7466
  // components/ViewportControls/index.tsx
7669
- var import_jsx_runtime36 = require("react/jsx-runtime");
7467
+ var import_jsx_runtime38 = require("react/jsx-runtime");
7670
7468
  var icons = {
7671
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
7672
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
7673
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
7469
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Smartphone, { size: 16 }),
7470
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Tablet, { size: 16 }),
7471
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Monitor, { size: 16 })
7674
7472
  };
7675
7473
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
7676
7474
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -7682,11 +7480,11 @@ var ViewportButton = ({
7682
7480
  onClick
7683
7481
  }) => {
7684
7482
  const viewports = useAppStore((s) => s.state.ui.viewports);
7685
- const [isActive, setIsActive] = (0, import_react46.useState)(false);
7686
- (0, import_react46.useEffect)(() => {
7483
+ const [isActive, setIsActive] = (0, import_react48.useState)(false);
7484
+ (0, import_react48.useEffect)(() => {
7687
7485
  setIsActive(width === viewports.current.width);
7688
7486
  }, [width, viewports.current.width]);
7689
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7487
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7690
7488
  IconButton,
7691
7489
  {
7692
7490
  title,
@@ -7695,7 +7493,7 @@ var ViewportButton = ({
7695
7493
  e.stopPropagation();
7696
7494
  onClick({ width, height });
7697
7495
  },
7698
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
7496
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: getClassNameButton("inner"), children })
7699
7497
  }
7700
7498
  ) });
7701
7499
  };
@@ -7719,7 +7517,7 @@ var ViewportControls = ({
7719
7517
  const defaultsContainAutoZoom = defaultZoomOptions.find(
7720
7518
  (option) => option.value === autoZoom
7721
7519
  );
7722
- const zoomOptions = (0, import_react46.useMemo)(
7520
+ const zoomOptions = (0, import_react48.useMemo)(
7723
7521
  () => [
7724
7522
  ...defaultZoomOptions,
7725
7523
  ...defaultsContainAutoZoom ? [] : [
@@ -7731,8 +7529,8 @@ var ViewportControls = ({
7731
7529
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7732
7530
  [autoZoom]
7733
7531
  );
7734
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
7735
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7532
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25(), children: [
7533
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7736
7534
  ViewportButton,
7737
7535
  {
7738
7536
  height: viewport.height,
@@ -7743,8 +7541,8 @@ var ViewportControls = ({
7743
7541
  },
7744
7542
  i
7745
7543
  )),
7746
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7747
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7544
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("divider") }),
7545
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7748
7546
  IconButton,
7749
7547
  {
7750
7548
  title: "Zoom viewport out",
@@ -7758,10 +7556,10 @@ var ViewportControls = ({
7758
7556
  )].value
7759
7557
  );
7760
7558
  },
7761
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
7559
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ZoomOut, { size: 16 })
7762
7560
  }
7763
7561
  ),
7764
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7562
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7765
7563
  IconButton,
7766
7564
  {
7767
7565
  title: "Zoom viewport in",
@@ -7775,11 +7573,11 @@ var ViewportControls = ({
7775
7573
  )].value
7776
7574
  );
7777
7575
  },
7778
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
7576
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ZoomIn, { size: 16 })
7779
7577
  }
7780
7578
  ),
7781
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7782
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7579
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("divider") }),
7580
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7783
7581
  "select",
7784
7582
  {
7785
7583
  className: getClassName25("zoomSelect"),
@@ -7787,7 +7585,7 @@ var ViewportControls = ({
7787
7585
  onChange: (e) => {
7788
7586
  onZoom(parseFloat(e.currentTarget.value));
7789
7587
  },
7790
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7588
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7791
7589
  "option",
7792
7590
  {
7793
7591
  value: option.value,
@@ -7836,7 +7634,7 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
7836
7634
 
7837
7635
  // components/Puck/components/Canvas/index.tsx
7838
7636
  var import_shallow7 = require("zustand/react/shallow");
7839
- var import_jsx_runtime37 = require("react/jsx-runtime");
7637
+ var import_jsx_runtime39 = require("react/jsx-runtime");
7840
7638
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
7841
7639
  var ZOOM_ON_CHANGE = true;
7842
7640
  var Canvas = () => {
@@ -7866,17 +7664,17 @@ var Canvas = () => {
7866
7664
  viewports: s.state.ui.viewports
7867
7665
  }))
7868
7666
  );
7869
- const frameRef = (0, import_react47.useRef)(null);
7870
- const [showTransition, setShowTransition] = (0, import_react47.useState)(false);
7871
- const defaultRender = (0, import_react47.useMemo)(() => {
7872
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
7667
+ const frameRef = (0, import_react49.useRef)(null);
7668
+ const [showTransition, setShowTransition] = (0, import_react49.useState)(false);
7669
+ const defaultRender = (0, import_react49.useMemo)(() => {
7670
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
7873
7671
  return PuckDefault;
7874
7672
  }, []);
7875
- const CustomPreview = (0, import_react47.useMemo)(
7673
+ const CustomPreview = (0, import_react49.useMemo)(
7876
7674
  () => overrides.preview || defaultRender,
7877
7675
  [overrides]
7878
7676
  );
7879
- const getFrameDimensions = (0, import_react47.useCallback)(() => {
7677
+ const getFrameDimensions = (0, import_react49.useCallback)(() => {
7880
7678
  if (frameRef.current) {
7881
7679
  const frame = frameRef.current;
7882
7680
  const box = getBox(frame);
@@ -7884,7 +7682,7 @@ var Canvas = () => {
7884
7682
  }
7885
7683
  return { width: 0, height: 0 };
7886
7684
  }, [frameRef]);
7887
- const resetAutoZoom = (0, import_react47.useCallback)(
7685
+ const resetAutoZoom = (0, import_react49.useCallback)(
7888
7686
  (newViewports = viewports) => {
7889
7687
  if (frameRef.current) {
7890
7688
  setZoomConfig(
@@ -7898,11 +7696,11 @@ var Canvas = () => {
7898
7696
  },
7899
7697
  [frameRef, zoomConfig, viewports]
7900
7698
  );
7901
- (0, import_react47.useEffect)(() => {
7699
+ (0, import_react49.useEffect)(() => {
7902
7700
  setShowTransition(false);
7903
7701
  resetAutoZoom(viewports);
7904
7702
  }, [frameRef, leftSideBarVisible, rightSideBarVisible]);
7905
- (0, import_react47.useEffect)(() => {
7703
+ (0, import_react49.useEffect)(() => {
7906
7704
  const { height: frameHeight } = getFrameDimensions();
7907
7705
  if (viewports.current.height === "auto") {
7908
7706
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -7910,13 +7708,13 @@ var Canvas = () => {
7910
7708
  }));
7911
7709
  }
7912
7710
  }, [zoomConfig.zoom]);
7913
- (0, import_react47.useEffect)(() => {
7711
+ (0, import_react49.useEffect)(() => {
7914
7712
  if (ZOOM_ON_CHANGE) {
7915
7713
  setShowTransition(true);
7916
7714
  resetAutoZoom(viewports);
7917
7715
  }
7918
7716
  }, [viewports.current.width]);
7919
- (0, import_react47.useEffect)(() => {
7717
+ (0, import_react49.useEffect)(() => {
7920
7718
  const cb = () => {
7921
7719
  setShowTransition(false);
7922
7720
  resetAutoZoom();
@@ -7926,13 +7724,13 @@ var Canvas = () => {
7926
7724
  window.removeEventListener("resize", cb);
7927
7725
  };
7928
7726
  }, []);
7929
- const [showLoader, setShowLoader] = (0, import_react47.useState)(false);
7930
- (0, import_react47.useEffect)(() => {
7727
+ const [showLoader, setShowLoader] = (0, import_react49.useState)(false);
7728
+ (0, import_react49.useEffect)(() => {
7931
7729
  setTimeout(() => {
7932
7730
  setShowLoader(true);
7933
7731
  }, 500);
7934
7732
  }, []);
7935
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7733
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
7936
7734
  "div",
7937
7735
  {
7938
7736
  className: getClassName26({
@@ -7945,7 +7743,7 @@ var Canvas = () => {
7945
7743
  recordHistory: true
7946
7744
  }),
7947
7745
  children: [
7948
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7746
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7949
7747
  ViewportControls,
7950
7748
  {
7951
7749
  autoZoom: zoomConfig.autoZoom,
@@ -7971,8 +7769,8 @@ var Canvas = () => {
7971
7769
  }
7972
7770
  }
7973
7771
  ) }),
7974
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
7975
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7772
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
7773
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7976
7774
  "div",
7977
7775
  {
7978
7776
  className: getClassName26("root"),
@@ -7993,10 +7791,10 @@ var Canvas = () => {
7993
7791
  })
7994
7792
  );
7995
7793
  },
7996
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview3, {}) })
7794
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Preview3, {}) })
7997
7795
  }
7998
7796
  ),
7999
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Loader, { size: 24 }) })
7797
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Loader, { size: 24 }) })
8000
7798
  ] })
8001
7799
  ]
8002
7800
  }
@@ -8005,7 +7803,7 @@ var Canvas = () => {
8005
7803
 
8006
7804
  // lib/use-loaded-overrides.ts
8007
7805
  init_react_import();
8008
- var import_react48 = require("react");
7806
+ var import_react50 = require("react");
8009
7807
 
8010
7808
  // lib/load-overrides.ts
8011
7809
  init_react_import();
@@ -8044,26 +7842,26 @@ var useLoadedOverrides = ({
8044
7842
  overrides,
8045
7843
  plugins
8046
7844
  }) => {
8047
- return (0, import_react48.useMemo)(() => {
7845
+ return (0, import_react50.useMemo)(() => {
8048
7846
  return loadOverrides({ overrides, plugins });
8049
7847
  }, [plugins, overrides]);
8050
7848
  };
8051
7849
 
8052
7850
  // components/DefaultOverride/index.tsx
8053
7851
  init_react_import();
8054
- var import_jsx_runtime38 = require("react/jsx-runtime");
8055
- var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
7852
+ var import_jsx_runtime40 = require("react/jsx-runtime");
7853
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
8056
7854
 
8057
7855
  // lib/use-inject-css.ts
8058
7856
  init_react_import();
8059
- var import_react49 = require("react");
7857
+ var import_react51 = require("react");
8060
7858
  var styles = ``;
8061
7859
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
8062
- const [el, setEl] = (0, import_react49.useState)();
8063
- (0, import_react49.useEffect)(() => {
7860
+ const [el, setEl] = (0, import_react51.useState)();
7861
+ (0, import_react51.useEffect)(() => {
8064
7862
  setEl(document.createElement("style"));
8065
7863
  }, []);
8066
- (0, import_react49.useEffect)(() => {
7864
+ (0, import_react51.useEffect)(() => {
8067
7865
  var _a;
8068
7866
  if (!el || typeof window === "undefined") {
8069
7867
  return;
@@ -8083,10 +7881,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
8083
7881
 
8084
7882
  // lib/use-preview-mode-hotkeys.ts
8085
7883
  init_react_import();
8086
- var import_react50 = require("react");
7884
+ var import_react52 = require("react");
8087
7885
  var usePreviewModeHotkeys = () => {
8088
7886
  const appStore = useAppStoreApi();
8089
- const toggleInteractive = (0, import_react50.useCallback)(() => {
7887
+ const toggleInteractive = (0, import_react52.useCallback)(() => {
8090
7888
  const dispatch = appStore.getState().dispatch;
8091
7889
  dispatch({
8092
7890
  type: "setUi",
@@ -8101,7 +7899,7 @@ var usePreviewModeHotkeys = () => {
8101
7899
 
8102
7900
  // lib/use-puck.ts
8103
7901
  init_react_import();
8104
- var import_react51 = require("react");
7902
+ var import_react53 = require("react");
8105
7903
  var import_zustand6 = require("zustand");
8106
7904
  var generateUsePuck = (store) => {
8107
7905
  const history = {
@@ -8135,7 +7933,7 @@ var generateUsePuck = (store) => {
8135
7933
  const get = () => storeData;
8136
7934
  return __spreadProps(__spreadValues({}, storeData), { get });
8137
7935
  };
8138
- var UsePuckStoreContext = (0, import_react51.createContext)(
7936
+ var UsePuckStoreContext = (0, import_react53.createContext)(
8139
7937
  null
8140
7938
  );
8141
7939
  var convertToPickedStore = (store) => {
@@ -8149,12 +7947,12 @@ var convertToPickedStore = (store) => {
8149
7947
  };
8150
7948
  };
8151
7949
  var useRegisterUsePuckStore = (appStore) => {
8152
- const [usePuckStore] = (0, import_react51.useState)(
7950
+ const [usePuckStore] = (0, import_react53.useState)(
8153
7951
  () => (0, import_zustand6.createStore)(
8154
7952
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
8155
7953
  )
8156
7954
  );
8157
- (0, import_react51.useEffect)(() => {
7955
+ (0, import_react53.useEffect)(() => {
8158
7956
  return appStore.subscribe(
8159
7957
  (store) => convertToPickedStore(store),
8160
7958
  (pickedStore) => {
@@ -8166,7 +7964,7 @@ var useRegisterUsePuckStore = (appStore) => {
8166
7964
  };
8167
7965
  function createUsePuck() {
8168
7966
  return function usePuck2(selector) {
8169
- const usePuckApi = (0, import_react51.useContext)(UsePuckStoreContext);
7967
+ const usePuckApi = (0, import_react53.useContext)(UsePuckStoreContext);
8170
7968
  if (!usePuckApi) {
8171
7969
  throw new Error("usePuck must be used inside <Puck>.");
8172
7970
  }
@@ -8178,7 +7976,7 @@ function createUsePuck() {
8178
7976
  };
8179
7977
  }
8180
7978
  function usePuck() {
8181
- (0, import_react51.useEffect)(() => {
7979
+ (0, import_react53.useEffect)(() => {
8182
7980
  console.warn(
8183
7981
  "You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
8184
7982
  );
@@ -8187,7 +7985,8 @@ function usePuck() {
8187
7985
  }
8188
7986
 
8189
7987
  // components/Puck/index.tsx
8190
- var import_jsx_runtime39 = require("react/jsx-runtime");
7988
+ var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"));
7989
+ var import_jsx_runtime41 = require("react/jsx-runtime");
8191
7990
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
8192
7991
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
8193
7992
  var FieldSideBar = () => {
@@ -8197,13 +7996,13 @@ var FieldSideBar = () => {
8197
7996
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
8198
7997
  }
8199
7998
  );
8200
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Fields, {}) });
7999
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Fields, {}) });
8201
8000
  };
8202
- var propsContext = (0, import_react52.createContext)({});
8001
+ var propsContext = (0, import_react54.createContext)({});
8203
8002
  function PropsProvider(props) {
8204
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(propsContext.Provider, { value: props, children: props.children });
8003
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(propsContext.Provider, { value: props, children: props.children });
8205
8004
  }
8206
- var usePropsContext = () => (0, import_react52.useContext)(propsContext);
8005
+ var usePropsContext = () => (0, import_react54.useContext)(propsContext);
8207
8006
  function PuckProvider({ children }) {
8208
8007
  const {
8209
8008
  config,
@@ -8223,7 +8022,7 @@ function PuckProvider({ children }) {
8223
8022
  enabled: true,
8224
8023
  waitForStyles: true
8225
8024
  }, _iframe);
8226
- const [generatedAppState] = (0, import_react52.useState)(() => {
8025
+ const [generatedAppState] = (0, import_react54.useState)(() => {
8227
8026
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8228
8027
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
8229
8028
  let clientUiState = {};
@@ -8280,17 +8079,17 @@ function PuckProvider({ children }) {
8280
8079
  ) : {}
8281
8080
  })
8282
8081
  });
8283
- return walkTree(newAppState, config);
8082
+ return walkAppState(newAppState, config);
8284
8083
  });
8285
8084
  const { appendData = true } = _initialHistory || {};
8286
- const [blendedHistories] = (0, import_react52.useState)(
8085
+ const [blendedHistories] = (0, import_react54.useState)(
8287
8086
  [
8288
8087
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
8289
8088
  ...appendData ? [{ state: generatedAppState }] : []
8290
8089
  ].map((history) => {
8291
8090
  let newState = __spreadValues(__spreadValues({}, generatedAppState), history.state);
8292
8091
  if (!history.state.indexes) {
8293
- newState = walkTree(newState, config);
8092
+ newState = walkAppState(newState, config);
8294
8093
  }
8295
8094
  return __spreadProps(__spreadValues({}, history), {
8296
8095
  state: newState
@@ -8303,7 +8102,7 @@ function PuckProvider({ children }) {
8303
8102
  overrides,
8304
8103
  plugins
8305
8104
  });
8306
- const generateAppStore = (0, import_react52.useCallback)(
8105
+ const generateAppStore = (0, import_react54.useCallback)(
8307
8106
  (state) => {
8308
8107
  return {
8309
8108
  state,
@@ -8327,10 +8126,10 @@ function PuckProvider({ children }) {
8327
8126
  metadata
8328
8127
  ]
8329
8128
  );
8330
- const [appStore] = (0, import_react52.useState)(
8129
+ const [appStore] = (0, import_react54.useState)(
8331
8130
  () => createAppStore(generateAppStore(initialAppState))
8332
8131
  );
8333
- (0, import_react52.useEffect)(() => {
8132
+ (0, import_react54.useEffect)(() => {
8334
8133
  const state = appStore.getState().state;
8335
8134
  appStore.setState(__spreadValues({}, generateAppStore(state)));
8336
8135
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -8339,22 +8138,29 @@ function PuckProvider({ children }) {
8339
8138
  index: initialHistoryIndex,
8340
8139
  initialAppState
8341
8140
  });
8342
- (0, import_react52.useEffect)(() => {
8343
- appStore.subscribe((s) => {
8344
- if (onChange) onChange(s.state.data);
8345
- });
8141
+ const previousData = (0, import_react54.useRef)(null);
8142
+ (0, import_react54.useEffect)(() => {
8143
+ appStore.subscribe(
8144
+ (s) => s.state.data,
8145
+ (data) => {
8146
+ if (onChange) {
8147
+ if ((0, import_fast_deep_equal2.default)(data, previousData.current)) return;
8148
+ onChange(data);
8149
+ previousData.current = data;
8150
+ }
8151
+ }
8152
+ );
8346
8153
  }, []);
8347
8154
  useRegisterPermissionsSlice(appStore, permissions);
8348
8155
  const uPuckStore = useRegisterUsePuckStore(appStore);
8349
- (0, import_react52.useEffect)(() => {
8156
+ (0, import_react54.useEffect)(() => {
8350
8157
  const { resolveAndCommitData } = appStore.getState();
8351
8158
  resolveAndCommitData();
8352
8159
  }, []);
8353
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8160
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8354
8161
  }
8355
8162
  function PuckLayout({ children }) {
8356
8163
  const {
8357
- onChange,
8358
8164
  onPublish,
8359
8165
  renderHeader,
8360
8166
  renderHeaderActions,
@@ -8373,18 +8179,13 @@ function PuckLayout({ children }) {
8373
8179
  const rightSideBarVisible = useAppStore(
8374
8180
  (s) => s.state.ui.rightSideBarVisible
8375
8181
  );
8376
- const [menuOpen, setMenuOpen] = (0, import_react52.useState)(false);
8182
+ const [menuOpen, setMenuOpen] = (0, import_react54.useState)(false);
8377
8183
  const appStore = useAppStoreApi();
8378
- (0, import_react52.useEffect)(() => {
8379
- return appStore.subscribe((s) => {
8380
- if (onChange) onChange(s.state.data);
8381
- });
8382
- }, [appStore]);
8383
8184
  const rootProps = useAppStore(
8384
8185
  (s) => s.state.data.root.props || s.state.data.root.props
8385
8186
  );
8386
8187
  const dispatch = useAppStore((s) => s.dispatch);
8387
- const toggleSidebars = (0, import_react52.useCallback)(
8188
+ const toggleSidebars = (0, import_react54.useCallback)(
8388
8189
  (sidebar) => {
8389
8190
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
8390
8191
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -8398,7 +8199,7 @@ function PuckLayout({ children }) {
8398
8199
  },
8399
8200
  [dispatch, leftSideBarVisible, rightSideBarVisible]
8400
8201
  );
8401
- (0, import_react52.useEffect)(() => {
8202
+ (0, import_react54.useEffect)(() => {
8402
8203
  if (!window.matchMedia("(min-width: 638px)").matches) {
8403
8204
  dispatch({
8404
8205
  type: "setUi",
@@ -8421,7 +8222,7 @@ function PuckLayout({ children }) {
8421
8222
  window.removeEventListener("resize", handleResize);
8422
8223
  };
8423
8224
  }, []);
8424
- const defaultHeaderRender = (0, import_react52.useMemo)(() => {
8225
+ const defaultHeaderRender = (0, import_react54.useMemo)(() => {
8425
8226
  if (renderHeader) {
8426
8227
  console.warn(
8427
8228
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -8430,13 +8231,13 @@ function PuckLayout({ children }) {
8430
8231
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
8431
8232
  const Comp = renderHeader;
8432
8233
  const appState = useAppStore((s) => s.state);
8433
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8234
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8434
8235
  };
8435
8236
  return RenderHeader;
8436
8237
  }
8437
8238
  return DefaultOverride;
8438
8239
  }, [renderHeader]);
8439
- const defaultHeaderActionsRender = (0, import_react52.useMemo)(() => {
8240
+ const defaultHeaderActionsRender = (0, import_react54.useMemo)(() => {
8440
8241
  if (renderHeaderActions) {
8441
8242
  console.warn(
8442
8243
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
@@ -8444,32 +8245,32 @@ function PuckLayout({ children }) {
8444
8245
  const RenderHeader = (props) => {
8445
8246
  const Comp = renderHeaderActions;
8446
8247
  const appState = useAppStore((s) => s.state);
8447
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8248
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8448
8249
  };
8449
8250
  return RenderHeader;
8450
8251
  }
8451
8252
  return DefaultOverride;
8452
8253
  }, [renderHeader]);
8453
8254
  const overrides = useAppStore((s) => s.overrides);
8454
- const CustomPuck = (0, import_react52.useMemo)(
8255
+ const CustomPuck = (0, import_react54.useMemo)(
8455
8256
  () => overrides.puck || DefaultOverride,
8456
8257
  [overrides]
8457
8258
  );
8458
- const CustomHeader = (0, import_react52.useMemo)(
8259
+ const CustomHeader = (0, import_react54.useMemo)(
8459
8260
  () => overrides.header || defaultHeaderRender,
8460
8261
  [overrides]
8461
8262
  );
8462
- const CustomHeaderActions = (0, import_react52.useMemo)(
8263
+ const CustomHeaderActions = (0, import_react54.useMemo)(
8463
8264
  () => overrides.headerActions || defaultHeaderActionsRender,
8464
8265
  [overrides]
8465
8266
  );
8466
- const [mounted, setMounted] = (0, import_react52.useState)(false);
8467
- (0, import_react52.useEffect)(() => {
8267
+ const [mounted, setMounted] = (0, import_react54.useState)(false);
8268
+ (0, import_react54.useEffect)(() => {
8468
8269
  setMounted(true);
8469
8270
  }, []);
8470
8271
  const ready = useAppStore((s) => s.status === "READY");
8471
8272
  useMonitorHotkeys();
8472
- (0, import_react52.useEffect)(() => {
8273
+ (0, import_react54.useEffect)(() => {
8473
8274
  if (ready && iframe.enabled) {
8474
8275
  const frameDoc = getFrame();
8475
8276
  if (frameDoc) {
@@ -8478,8 +8279,8 @@ function PuckLayout({ children }) {
8478
8279
  }
8479
8280
  }, [ready, iframe.enabled]);
8480
8281
  usePreviewModeHotkeys();
8481
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
8482
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8282
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
8283
+ /* @__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
8284
  "div",
8484
8285
  {
8485
8286
  className: getLayoutClassName({
@@ -8488,61 +8289,61 @@ function PuckLayout({ children }) {
8488
8289
  mounted,
8489
8290
  rightSideBarVisible
8490
8291
  }),
8491
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("inner"), children: [
8492
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8292
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("inner"), children: [
8293
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8493
8294
  CustomHeader,
8494
8295
  {
8495
- actions: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8296
+ 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
8297
  Button,
8497
8298
  {
8498
8299
  onClick: () => {
8499
8300
  const data = appStore.getState().state.data;
8500
8301
  onPublish && onPublish(data);
8501
8302
  },
8502
- icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
8303
+ icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
8503
8304
  children: "Publish"
8504
8305
  }
8505
8306
  ) }) }),
8506
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
8507
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
8508
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8307
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
8308
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
8309
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8509
8310
  "div",
8510
8311
  {
8511
8312
  className: getLayoutClassName("leftSideBarToggle"),
8512
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8313
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8513
8314
  IconButton,
8514
8315
  {
8515
8316
  onClick: () => {
8516
8317
  toggleSidebars("left");
8517
8318
  },
8518
8319
  title: "Toggle left sidebar",
8519
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelLeft, { focusable: "false" })
8320
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
8520
8321
  }
8521
8322
  )
8522
8323
  }
8523
8324
  ),
8524
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8325
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8525
8326
  "div",
8526
8327
  {
8527
8328
  className: getLayoutClassName("rightSideBarToggle"),
8528
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8329
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8529
8330
  IconButton,
8530
8331
  {
8531
8332
  onClick: () => {
8532
8333
  toggleSidebars("right");
8533
8334
  },
8534
8335
  title: "Toggle right sidebar",
8535
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelRight, { focusable: "false" })
8336
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
8536
8337
  }
8537
8338
  )
8538
8339
  }
8539
8340
  )
8540
8341
  ] }),
8541
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Heading, { rank: "2", size: "xs", children: [
8342
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
8542
8343
  headerTitle || (rootProps == null ? void 0 : rootProps.title) || "Page",
8543
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8344
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
8544
8345
  " ",
8545
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8346
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8546
8347
  "code",
8547
8348
  {
8548
8349
  className: getLayoutClassName("headerPath"),
@@ -8551,31 +8352,31 @@ function PuckLayout({ children }) {
8551
8352
  )
8552
8353
  ] })
8553
8354
  ] }) }),
8554
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
8555
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8355
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
8356
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8556
8357
  IconButton,
8557
8358
  {
8558
8359
  onClick: () => {
8559
8360
  return setMenuOpen(!menuOpen);
8560
8361
  },
8561
8362
  title: "Toggle menu bar",
8562
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { focusable: "false" })
8363
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronDown, { focusable: "false" })
8563
8364
  }
8564
8365
  ) }),
8565
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8366
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8566
8367
  MenuBar,
8567
8368
  {
8568
8369
  dispatch,
8569
8370
  onPublish,
8570
8371
  menuOpen,
8571
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8372
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8572
8373
  Button,
8573
8374
  {
8574
8375
  onClick: () => {
8575
8376
  const data = appStore.getState().state.data;
8576
8377
  onPublish && onPublish(data);
8577
8378
  },
8578
- icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
8379
+ icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
8579
8380
  children: "Publish"
8580
8381
  }
8581
8382
  ) }),
@@ -8586,20 +8387,20 @@ function PuckLayout({ children }) {
8586
8387
  ] }) })
8587
8388
  }
8588
8389
  ),
8589
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
8590
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Components, {}) }),
8591
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Outline, {}) })
8390
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
8391
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Components, {}) }),
8392
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Outline, {}) })
8592
8393
  ] }),
8593
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Canvas, {}),
8594
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FieldSideBar, {}) })
8394
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Canvas, {}),
8395
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FieldSideBar, {}) })
8595
8396
  ] })
8596
8397
  }
8597
8398
  ) }) }),
8598
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
8399
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
8599
8400
  ] });
8600
8401
  }
8601
8402
  function Puck(props) {
8602
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
8403
+ 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
8404
  }
8604
8405
  Puck.Components = Components;
8605
8406
  Puck.Fields = Fields;
@@ -8631,9 +8432,9 @@ var migrations = [
8631
8432
  console.log("Migrating DropZones to slots...");
8632
8433
  const updatedItems = {};
8633
8434
  const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
8634
- const { indexes } = walkTree(appState, config);
8435
+ const { indexes } = walkAppState(appState, config);
8635
8436
  const deletedCompounds = [];
8636
- walkTree(appState, config, (content, zoneCompound, zoneType) => {
8437
+ walkAppState(appState, config, (content, zoneCompound, zoneType) => {
8637
8438
  var _a2, _b;
8638
8439
  if (zoneType === "dropzone") {
8639
8440
  const [id, slotName] = zoneCompound.split(":");
@@ -8652,7 +8453,7 @@ var migrations = [
8652
8453
  }
8653
8454
  return content;
8654
8455
  });
8655
- const updated = walkTree(
8456
+ const updated = walkAppState(
8656
8457
  appState,
8657
8458
  config,
8658
8459
  (content) => content,
@@ -8806,13 +8607,13 @@ function resolveAllData(_0, _1) {
8806
8607
  Puck,
8807
8608
  Render,
8808
8609
  createUsePuck,
8809
- mapSlots,
8810
8610
  migrate,
8811
8611
  overrideKeys,
8812
8612
  renderContext,
8813
8613
  resolveAllData,
8814
8614
  transformProps,
8815
- usePuck
8615
+ usePuck,
8616
+ walkTree
8816
8617
  });
8817
8618
  /*! Bundled license information:
8818
8619