@measured/puck 0.18.2-canary.73bb338 → 0.18.2-canary.8992a94

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.mjs CHANGED
@@ -159,7 +159,7 @@ var get_class_name_factory_default = getClassNameFactory;
159
159
 
160
160
  // css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
161
161
  init_react_import();
162
- var styles_module_default = { "ActionBar": "_ActionBar_rvadt_1", "ActionBar-label": "_ActionBar-label_rvadt_18", "ActionBar-action": "_ActionBar-action_rvadt_30", "ActionBar-group": "_ActionBar-group_rvadt_38" };
162
+ var styles_module_default = { "ActionBar": "_ActionBar_194sn_1", "ActionBar-label": "_ActionBar-label_194sn_18", "ActionBar-action": "_ActionBar-action_194sn_30", "ActionBar-group": "_ActionBar-group_194sn_38" };
163
163
 
164
164
  // components/ActionBar/index.tsx
165
165
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -205,7 +205,7 @@ init_react_import();
205
205
 
206
206
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
207
207
  init_react_import();
208
- var styles_module_default2 = { "InputWrapper": "_InputWrapper_g5w3n_1", "Input-label": "_Input-label_g5w3n_5", "Input-labelIcon": "_Input-labelIcon_g5w3n_14", "Input-disabledIcon": "_Input-disabledIcon_g5w3n_21", "Input-input": "_Input-input_g5w3n_26", "Input": "_Input_g5w3n_1", "Input--readOnly": "_Input--readOnly_g5w3n_74", "Input-radioGroupItems": "_Input-radioGroupItems_g5w3n_85", "Input-radio": "_Input-radio_g5w3n_85", "Input-radioInner": "_Input-radioInner_g5w3n_102", "Input-radioInput": "_Input-radioInput_g5w3n_147" };
208
+ var styles_module_default2 = { "InputWrapper": "_InputWrapper_1h1p1_1", "Input-label": "_Input-label_1h1p1_5", "Input-labelIcon": "_Input-labelIcon_1h1p1_14", "Input-disabledIcon": "_Input-disabledIcon_1h1p1_21", "Input-input": "_Input-input_1h1p1_26", "Input": "_Input_1h1p1_1", "Input--readOnly": "_Input--readOnly_1h1p1_70", "Input-radioGroupItems": "_Input-radioGroupItems_1h1p1_81", "Input-radio": "_Input-radio_1h1p1_81", "Input-radioInner": "_Input-radioInner_1h1p1_98", "Input-radioInput": "_Input-radioInput_1h1p1_143" };
209
209
 
210
210
  // components/AutoField/index.tsx
211
211
  import {
@@ -213,7 +213,7 @@ import {
213
213
  useContext as useContext3,
214
214
  useEffect as useEffect9,
215
215
  useMemo as useMemo5,
216
- useState as useState12
216
+ useState as useState11
217
217
  } from "react";
218
218
 
219
219
  // components/AutoField/fields/index.tsx
@@ -224,7 +224,7 @@ init_react_import();
224
224
 
225
225
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/fields/ArrayField/styles.module.css#css-module
226
226
  init_react_import();
227
- var styles_module_default3 = { "ArrayField": "_ArrayField_14u8o_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_14u8o_13", "ArrayField-addButton": "_ArrayField-addButton_14u8o_18", "ArrayField--hasItems": "_ArrayField--hasItems_14u8o_33", "ArrayField-inner": "_ArrayField-inner_14u8o_59", "ArrayFieldItem": "_ArrayFieldItem_14u8o_67", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_14u8o_78", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_14u8o_82", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_14u8o_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_14u8o_127", "ArrayFieldItem-body": "_ArrayFieldItem-body_14u8o_166", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_14u8o_175", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_14u8o_183", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_14u8o_189" };
227
+ var styles_module_default3 = { "ArrayField": "_ArrayField_1jcbq_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1jcbq_13", "ArrayField-addButton": "_ArrayField-addButton_1jcbq_18", "ArrayField--hasItems": "_ArrayField--hasItems_1jcbq_33", "ArrayFieldItem": "_ArrayFieldItem_1jcbq_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1jcbq_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1jcbq_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1jcbq_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1jcbq_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1jcbq_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1jcbq_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1jcbq_181", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1jcbq_187" };
228
228
 
229
229
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
230
230
  init_react_import();
@@ -674,7 +674,7 @@ var IconButton = ({
674
674
  };
675
675
 
676
676
  // components/AutoField/fields/ArrayField/index.tsx
677
- import { useCallback as useCallback3, useEffect as useEffect4, useState as useState7 } from "react";
677
+ import { useCallback as useCallback3, useEffect as useEffect4, useState as useState6 } from "react";
678
678
 
679
679
  // components/DragIcon/index.tsx
680
680
  init_react_import();
@@ -1084,7 +1084,7 @@ function useAppContext() {
1084
1084
  // components/Sortable/index.tsx
1085
1085
  init_react_import();
1086
1086
  import { DragDropProvider } from "@dnd-kit/react";
1087
- import { useState as useState6 } from "react";
1087
+ import { useState as useState5 } from "react";
1088
1088
 
1089
1089
  // lib/dnd/dnd-kit/safe.ts
1090
1090
  init_react_import();
@@ -1115,763 +1115,98 @@ function useSortableSafe(input) {
1115
1115
  return useSortable(input);
1116
1116
  }
1117
1117
 
1118
- // lib/dnd/use-sensors.ts
1119
- init_react_import();
1120
- import { useState as useState5 } from "react";
1121
-
1122
- // lib/dnd/PointerSensor.ts
1123
- init_react_import();
1124
- import { batch, effect } from "@dnd-kit/state";
1125
- import { Sensor, configurator } from "@dnd-kit/abstract";
1126
- import {
1127
- exceedsDistance
1128
- } from "@dnd-kit/geometry";
1129
- import {
1130
- getDocument,
1131
- isElement,
1132
- isHTMLElement,
1133
- isPointerEvent,
1134
- Listeners,
1135
- getFrameTransform
1136
- } from "@dnd-kit/dom/utilities";
1137
- var _clearTimeout;
1138
- var _PointerSensor = class _PointerSensor extends Sensor {
1139
- constructor(manager, options) {
1140
- super(manager);
1141
- this.manager = manager;
1142
- this.options = options;
1143
- this.listeners = new Listeners();
1144
- this.cleanup = /* @__PURE__ */ new Set();
1145
- this.source = void 0;
1146
- __privateAdd(this, _clearTimeout);
1147
- this.handleCancel = this.handleCancel.bind(this);
1148
- this.handlePointerUp = this.handlePointerUp.bind(this);
1149
- this.handleKeyDown = this.handleKeyDown.bind(this);
1150
- effect(() => {
1151
- const unbindGlobal = this.bindGlobal(options != null ? options : {});
1152
- return () => {
1153
- unbindGlobal();
1154
- };
1155
- });
1156
- }
1157
- bind(source, options = this.options) {
1158
- const unbind = effect(() => {
1159
- var _a;
1160
- const target = (_a = source.handle) != null ? _a : source.element;
1161
- const listener = (event) => {
1162
- if (isPointerEvent(event)) {
1163
- this.handlePointerDown(event, source, options);
1164
- }
1165
- };
1166
- if (target) {
1167
- patchWindow(target.ownerDocument.defaultView);
1168
- target.addEventListener("pointerdown", listener);
1169
- return () => {
1170
- target.removeEventListener("pointerdown", listener);
1171
- };
1172
- }
1173
- });
1174
- return unbind;
1175
- }
1176
- bindGlobal(options) {
1177
- const documents = /* @__PURE__ */ new Set();
1178
- for (const draggable of this.manager.registry.draggables.value) {
1179
- if (draggable.element) {
1180
- documents.add(getDocument(draggable.element));
1181
- }
1182
- }
1183
- for (const droppable of this.manager.registry.droppables.value) {
1184
- if (droppable.element) {
1185
- documents.add(getDocument(droppable.element));
1186
- }
1187
- }
1188
- const unbindFns = Array.from(documents).map(
1189
- (doc) => this.listeners.bind(doc, [
1190
- {
1191
- type: "pointermove",
1192
- listener: (event) => this.handlePointerMove(event, doc, options)
1193
- },
1194
- {
1195
- type: "pointerup",
1196
- listener: this.handlePointerUp,
1197
- options: {
1198
- capture: true
1118
+ // components/Sortable/index.tsx
1119
+ import { jsx as jsx6 } from "react/jsx-runtime";
1120
+ var SortableProvider = ({
1121
+ children,
1122
+ onMove
1123
+ }) => {
1124
+ const [move, setMove] = useState5({ source: -1, target: -1 });
1125
+ return /* @__PURE__ */ jsx6(
1126
+ DragDropProvider,
1127
+ {
1128
+ onDragOver: (event) => {
1129
+ const { operation } = event;
1130
+ if (operation.source && operation.target) {
1131
+ const newMove = {
1132
+ source: operation.source.data.index,
1133
+ target: operation.target.data.index
1134
+ };
1135
+ if (newMove.source !== newMove.target) {
1136
+ setMove({
1137
+ source: operation.source.data.index,
1138
+ target: operation.target.data.index
1139
+ });
1199
1140
  }
1200
- },
1201
- {
1202
- // Cancel activation if there is a competing Drag and Drop interaction
1203
- type: "dragstart",
1204
- listener: this.handleDragStart
1205
1141
  }
1206
- ])
1207
- );
1208
- return () => {
1209
- unbindFns.forEach((unbind) => unbind());
1210
- };
1211
- }
1212
- handlePointerDown(event, source, options = {}) {
1213
- if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled) {
1214
- return;
1142
+ },
1143
+ onDragEnd: () => {
1144
+ if (move.source !== -1 && move.target !== -1) {
1145
+ onMove(move);
1146
+ }
1147
+ },
1148
+ children
1215
1149
  }
1216
- const offset = getFrameTransform(source.element);
1217
- this.initialCoordinates = {
1218
- x: event.clientX * offset.scaleX + offset.x,
1219
- y: event.clientY * offset.scaleY + offset.y
1220
- };
1221
- this.source = source;
1222
- const { activationConstraints } = options;
1223
- const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
1224
- event.stopImmediatePropagation();
1225
- if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
1226
- this.handleStart(source, event);
1227
- } else {
1228
- const { delay } = constraints;
1229
- if (delay) {
1230
- const timeout3 = setTimeout(
1231
- () => this.handleStart(source, event),
1232
- delay.value
1150
+ );
1151
+ };
1152
+ var Sortable = ({
1153
+ id,
1154
+ index,
1155
+ disabled,
1156
+ children,
1157
+ type = "item"
1158
+ }) => {
1159
+ const { ref: sortableRef, status } = useSortableSafe({
1160
+ id,
1161
+ type,
1162
+ index,
1163
+ disabled,
1164
+ data: { index }
1165
+ });
1166
+ return children({ status, ref: sortableRef });
1167
+ };
1168
+
1169
+ // components/AutoField/context.tsx
1170
+ init_react_import();
1171
+ import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
1172
+ import { jsx as jsx7 } from "react/jsx-runtime";
1173
+ var NestedFieldContext = createContext2({});
1174
+ var useNestedFieldContext = () => {
1175
+ const context = useContext2(NestedFieldContext);
1176
+ return __spreadProps(__spreadValues({}, context), {
1177
+ readOnlyFields: context.readOnlyFields || {}
1178
+ });
1179
+ };
1180
+ var NestedFieldProvider = ({
1181
+ children,
1182
+ name,
1183
+ subName,
1184
+ wildcardName = name,
1185
+ readOnlyFields
1186
+ }) => {
1187
+ const subPath = `${name}.${subName}`;
1188
+ const wildcardSubPath = `${wildcardName}.${subName}`;
1189
+ const subReadOnlyFields = useMemo(
1190
+ () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
1191
+ const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
1192
+ if (isLocal) {
1193
+ const subPathPattern = new RegExp(
1194
+ `^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
1233
1195
  );
1234
- __privateSet(this, _clearTimeout, () => {
1235
- clearTimeout(timeout3);
1236
- __privateSet(this, _clearTimeout, void 0);
1196
+ const localName = readOnlyKey.replace(subPathPattern, "");
1197
+ return __spreadProps(__spreadValues({}, acc), {
1198
+ [localName]: readOnlyFields[readOnlyKey]
1237
1199
  });
1238
1200
  }
1239
- }
1240
- const cleanup = () => {
1241
- var _a;
1242
- (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
1243
- this.initialCoordinates = void 0;
1244
- this.source = void 0;
1245
- };
1246
- this.cleanup.add(cleanup);
1247
- }
1248
- handlePointerMove(event, doc, options) {
1249
- if (!this.source) {
1250
- return;
1251
- }
1252
- const ownerDocument = this.source.element && getDocument(this.source.element);
1253
- if (doc !== ownerDocument) {
1254
- return;
1255
- }
1256
- const coordinates = {
1257
- x: event.clientX,
1258
- y: event.clientY
1259
- };
1260
- const offset = getFrameTransform(this.source.element);
1261
- coordinates.x = coordinates.x * offset.scaleX + offset.x;
1262
- coordinates.y = coordinates.y * offset.scaleY + offset.y;
1263
- if (this.manager.dragOperation.status.dragging) {
1264
- event.preventDefault();
1265
- event.stopPropagation();
1266
- this.manager.actions.move({ to: coordinates });
1267
- return;
1268
- }
1269
- if (!this.initialCoordinates) {
1270
- return;
1271
- }
1272
- const delta = {
1273
- x: coordinates.x - this.initialCoordinates.x,
1274
- y: coordinates.y - this.initialCoordinates.y
1275
- };
1276
- const { activationConstraints } = options;
1277
- const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
1278
- const { distance, delay } = constraints != null ? constraints : {};
1279
- if (distance) {
1280
- if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
1281
- return this.handleCancel();
1282
- }
1283
- if (exceedsDistance(delta, distance.value)) {
1284
- return this.handleStart(this.source, event);
1285
- }
1286
- }
1287
- if (delay) {
1288
- if (exceedsDistance(delta, delay.tolerance)) {
1289
- return this.handleCancel();
1290
- }
1291
- }
1292
- }
1293
- handlePointerUp(event) {
1294
- if (!this.source) {
1295
- return;
1296
- }
1297
- event.preventDefault();
1298
- event.stopPropagation();
1299
- const { status } = this.manager.dragOperation;
1300
- if (!status.idle) {
1301
- const canceled = !status.initialized;
1302
- this.manager.actions.stop({ canceled });
1303
- }
1304
- this.cleanup.forEach((cleanup) => cleanup());
1305
- this.cleanup.clear();
1306
- }
1307
- handleKeyDown(event) {
1308
- if (event.key === "Escape") {
1309
- event.preventDefault();
1310
- this.handleCancel();
1311
- }
1312
- }
1313
- handleStart(source, event) {
1314
- var _a;
1315
- const { manager, initialCoordinates } = this;
1316
- (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
1317
- if (!initialCoordinates || manager.dragOperation.status.initialized) {
1318
- return;
1319
- }
1320
- if (event.defaultPrevented) {
1321
- return;
1322
- }
1323
- event.preventDefault();
1324
- batch(() => {
1325
- manager.actions.setDragSource(source.id);
1326
- manager.actions.start({ coordinates: initialCoordinates, event });
1327
- });
1328
- const ownerDocument = getDocument(event.target);
1329
- const unbind = this.listeners.bind(ownerDocument, [
1330
- {
1331
- // Prevent scrolling on touch devices
1332
- type: "touchmove",
1333
- listener: preventDefault,
1334
- options: {
1335
- passive: false
1336
- }
1337
- },
1338
- {
1339
- // Prevent click events
1340
- type: "click",
1341
- listener: preventDefault
1342
- },
1343
- {
1344
- type: "keydown",
1345
- listener: this.handleKeyDown
1346
- }
1347
- ]);
1348
- ownerDocument.body.setPointerCapture(event.pointerId);
1349
- this.cleanup.add(unbind);
1350
- }
1351
- handleDragStart(event) {
1352
- const { target } = event;
1353
- if (!isElement(target)) {
1354
- return;
1355
- }
1356
- const isNativeDraggable = isHTMLElement(target) && target.draggable && target.getAttribute("draggable") === "true";
1357
- if (isNativeDraggable) {
1358
- this.handleCancel();
1359
- } else {
1360
- preventDefault(event);
1361
- }
1362
- }
1363
- handleCancel() {
1364
- const { dragOperation } = this.manager;
1365
- if (dragOperation.status.initialized) {
1366
- this.manager.actions.stop({ canceled: true });
1367
- }
1368
- this.cleanup.forEach((cleanup) => cleanup());
1369
- this.cleanup.clear();
1370
- }
1371
- destroy() {
1372
- this.listeners.clear();
1373
- }
1374
- };
1375
- _clearTimeout = new WeakMap();
1376
- _PointerSensor.configure = configurator(_PointerSensor);
1377
- var PointerSensor = _PointerSensor;
1378
- function preventDefault(event) {
1379
- event.preventDefault();
1380
- }
1381
- function noop() {
1382
- }
1383
- var windows = /* @__PURE__ */ new WeakSet();
1384
- function patchWindow(window2) {
1385
- if (!window2 || windows.has(window2)) {
1386
- return;
1387
- }
1388
- window2.addEventListener("touchmove", noop, {
1389
- capture: false,
1390
- passive: false
1391
- });
1392
- windows.add(window2);
1393
- }
1394
-
1395
- // lib/dnd/use-sensors.ts
1396
- import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
1397
- var useSensors = () => {
1398
- const [sensors] = useState5(() => [
1399
- PointerSensor.configure({
1400
- activationConstraints(event, source) {
1401
- var _a;
1402
- const { pointerType, target } = event;
1403
- if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
1404
- return void 0;
1405
- }
1406
- const delay = { value: 200, tolerance: 10 };
1407
- if (pointerType === "touch") {
1408
- return { delay };
1409
- }
1410
- return {
1411
- delay,
1412
- distance: { value: 5 }
1413
- };
1414
- }
1415
- })
1416
- ]);
1417
- return sensors;
1418
- };
1419
-
1420
- // lib/dnd/collision/dynamic/index.ts
1421
- init_react_import();
1422
- import {
1423
- CollisionPriority as CollisionPriority7,
1424
- CollisionType as CollisionType7
1425
- } from "@dnd-kit/abstract";
1426
-
1427
- // lib/dnd/collision/directional/index.ts
1428
- init_react_import();
1429
- import { CollisionType } from "@dnd-kit/abstract";
1430
-
1431
- // lib/dnd/collision/collision-debug.ts
1432
- init_react_import();
1433
- var DEBUG = false;
1434
- var debugElements = {};
1435
- var timeout;
1436
- var collisionDebug = (a, b, id, color, label) => {
1437
- if (!DEBUG) return;
1438
- const debugId = `${id}-debug`;
1439
- clearTimeout(timeout);
1440
- timeout = setTimeout(() => {
1441
- Object.entries(debugElements).forEach(([id2, { svg }]) => {
1442
- svg.remove();
1443
- delete debugElements[id2];
1444
- });
1445
- }, 1e3);
1446
- requestAnimationFrame(() => {
1447
- var _a, _b;
1448
- const existingEl = debugElements[debugId];
1449
- let line = (_a = debugElements[debugId]) == null ? void 0 : _a.line;
1450
- let text = (_b = debugElements[debugId]) == null ? void 0 : _b.text;
1451
- if (!existingEl) {
1452
- const svgNs = "http://www.w3.org/2000/svg";
1453
- const svg = document.createElementNS(svgNs, "svg");
1454
- line = document.createElementNS(svgNs, "line");
1455
- text = document.createElementNS(svgNs, "text");
1456
- svg.setAttribute("id", debugId);
1457
- svg.setAttribute(
1458
- "style",
1459
- "position: fixed; height: 100%; width: 100%; pointer-events: none;"
1460
- );
1461
- svg.appendChild(line);
1462
- svg.appendChild(text);
1463
- text.setAttribute("fill", `black`);
1464
- document.body.appendChild(svg);
1465
- debugElements[debugId] = { svg, line, text };
1466
- }
1467
- line.setAttribute("x1", a.x.toString());
1468
- line.setAttribute("x2", b.x.toString());
1469
- line.setAttribute("y1", a.y.toString());
1470
- line.setAttribute("y2", b.y.toString());
1471
- line.setAttribute("style", `stroke:${color};stroke-width:2`);
1472
- text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
1473
- text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
1474
- if (label) {
1475
- text.innerHTML = label;
1476
- }
1477
- });
1478
- };
1479
-
1480
- // lib/dnd/collision/directional/index.ts
1481
- var distanceChange = "increasing";
1482
- var directionalCollision = (input, previous) => {
1483
- var _a;
1484
- const { dragOperation, droppable } = input;
1485
- const { shape: dropShape } = droppable;
1486
- const { position } = dragOperation;
1487
- const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
1488
- if (!dragShape || !dropShape) return null;
1489
- const dropCenter = dropShape.center;
1490
- const distanceToPrevious = Math.sqrt(
1491
- Math.pow(dropCenter.x - previous.x, 2) + Math.pow(dropCenter.y - previous.y, 2)
1492
- );
1493
- const distanceToCurrent = Math.sqrt(
1494
- Math.pow(dropCenter.x - position.current.x, 2) + Math.pow(dropCenter.y - position.current.y, 2)
1495
- );
1496
- distanceChange = distanceToCurrent === distanceToPrevious ? distanceChange : distanceToCurrent < distanceToPrevious ? "decreasing" : "increasing";
1497
- collisionDebug(
1498
- dragShape.center,
1499
- dropCenter,
1500
- droppable.id.toString(),
1501
- "rebeccapurple"
1502
- );
1503
- if (distanceChange === "decreasing") {
1504
- return {
1505
- id: droppable.id,
1506
- value: 1,
1507
- type: CollisionType.Collision
1508
- };
1509
- }
1510
- return null;
1511
- };
1512
-
1513
- // lib/dnd/collision/dynamic/get-direction.ts
1514
- init_react_import();
1515
- var getDirection = (dragAxis, delta) => {
1516
- if (dragAxis === "dynamic") {
1517
- if (Math.abs(delta.y) > Math.abs(delta.x)) {
1518
- return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
1519
- } else {
1520
- return delta.x === 0 ? null : delta.x > 0 ? "right" : "left";
1521
- }
1522
- } else if (dragAxis === "x") {
1523
- return delta.x === 0 ? null : delta.x > 0 ? "right" : "left";
1524
- }
1525
- return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
1526
- };
1527
-
1528
- // lib/dnd/collision/dynamic/get-midpoint-impact.ts
1529
- init_react_import();
1530
- var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
1531
- const dragRect = dragShape.boundingRectangle;
1532
- const dropCenter = dropShape.center;
1533
- if (direction === "down") {
1534
- const offset2 = offsetMultiplier * dropShape.boundingRectangle.height;
1535
- return dragRect.bottom >= dropCenter.y + offset2;
1536
- } else if (direction === "up") {
1537
- const offset2 = offsetMultiplier * dropShape.boundingRectangle.height;
1538
- return dragRect.top < dropCenter.y - offset2;
1539
- } else if (direction === "left") {
1540
- const offset2 = offsetMultiplier * dropShape.boundingRectangle.width;
1541
- return dropCenter.x - offset2 >= dragRect.left;
1542
- }
1543
- const offset = offsetMultiplier * dropShape.boundingRectangle.width;
1544
- return dragRect.right - offset >= dropCenter.x;
1545
- };
1546
-
1547
- // lib/dnd/collision/dynamic/track-movement-interval.ts
1548
- init_react_import();
1549
- import { Point } from "@dnd-kit/geometry";
1550
- var INTERVAL_SENSITIVITY = 10;
1551
- var intervalCache = {
1552
- current: { x: 0, y: 0 },
1553
- delta: { x: 0, y: 0 },
1554
- previous: { x: 0, y: 0 },
1555
- direction: null
1556
- };
1557
- var trackMovementInterval = (point, dragAxis = "dynamic") => {
1558
- intervalCache.current = point;
1559
- intervalCache.delta = {
1560
- x: point.x - intervalCache.previous.x,
1561
- y: point.y - intervalCache.previous.y
1562
- };
1563
- intervalCache.direction = getDirection(dragAxis, intervalCache.delta) || intervalCache.direction;
1564
- if (Math.abs(intervalCache.delta.x) > INTERVAL_SENSITIVITY || Math.abs(intervalCache.delta.y) > INTERVAL_SENSITIVITY) {
1565
- intervalCache.previous = Point.from(point);
1566
- }
1567
- return intervalCache;
1568
- };
1569
-
1570
- // ../../node_modules/@dnd-kit/collision/dist/index.js
1571
- init_react_import();
1572
- import { CollisionPriority, CollisionType as CollisionType2 } from "@dnd-kit/abstract";
1573
- import { Point as Point2 } from "@dnd-kit/geometry";
1574
- import { CollisionPriority as CollisionPriority2, CollisionType as CollisionType22 } from "@dnd-kit/abstract";
1575
- import { Point as Point22 } from "@dnd-kit/geometry";
1576
- import { CollisionPriority as CollisionPriority3, CollisionType as CollisionType3 } from "@dnd-kit/abstract";
1577
- import { Point as Point3 } from "@dnd-kit/geometry";
1578
- import { CollisionPriority as CollisionPriority4, CollisionType as CollisionType4 } from "@dnd-kit/abstract";
1579
- import { Point as Point4 } from "@dnd-kit/geometry";
1580
- import { CollisionPriority as CollisionPriority5, CollisionType as CollisionType5 } from "@dnd-kit/abstract";
1581
- import { Point as Point5 } from "@dnd-kit/geometry";
1582
- import { CollisionPriority as CollisionPriority6, CollisionType as CollisionType6 } from "@dnd-kit/abstract";
1583
- import { Point as Point6 } from "@dnd-kit/geometry";
1584
- var pointerIntersection = ({
1585
- dragOperation,
1586
- droppable
1587
- }) => {
1588
- const pointerCoordinates = dragOperation.position.current;
1589
- if (!pointerCoordinates) {
1590
- return null;
1591
- }
1592
- const { id } = droppable;
1593
- if (!droppable.shape) {
1594
- return null;
1595
- }
1596
- if (droppable.shape.containsPoint(pointerCoordinates)) {
1597
- const distance = Point2.distance(droppable.shape.center, pointerCoordinates);
1598
- return {
1599
- id,
1600
- value: 1 / distance,
1601
- type: CollisionType2.PointerIntersection,
1602
- priority: CollisionPriority.High
1603
- };
1604
- }
1605
- return null;
1606
- };
1607
- var closestCorners = (input) => {
1608
- const { dragOperation, droppable } = input;
1609
- const { shape, position } = dragOperation;
1610
- if (!droppable.shape) {
1611
- return null;
1612
- }
1613
- const { left, top, right, bottom } = droppable.shape.boundingRectangle;
1614
- const corners = [
1615
- {
1616
- x: left,
1617
- y: top
1618
- },
1619
- {
1620
- x: right,
1621
- y: top
1622
- },
1623
- {
1624
- x: left,
1625
- y: bottom
1626
- },
1627
- {
1628
- x: right,
1629
- y: bottom
1630
- }
1631
- ];
1632
- const distance = corners.reduce(
1633
- (acc, corner) => {
1634
- var _a;
1635
- return acc + Point3.distance(
1636
- Point3.from(corner),
1637
- (_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
1638
- );
1639
- },
1640
- 0
1641
- );
1642
- const value = distance / 4;
1643
- return {
1644
- id: droppable.id,
1645
- value: 1 / value,
1646
- type: CollisionType3.Collision,
1647
- priority: CollisionPriority3.Normal
1648
- };
1649
- };
1650
-
1651
- // lib/dnd/collision/dynamic/store.ts
1652
- init_react_import();
1653
- import { createStore } from "zustand/vanilla";
1654
- var collisionStore = createStore(() => ({
1655
- fallbackEnabled: false
1656
- }));
1657
-
1658
- // lib/dnd/collision/dynamic/index.ts
1659
- var flushNext = "";
1660
- var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
1661
- var _a, _b, _c, _d, _e;
1662
- const { dragOperation, droppable } = input;
1663
- const { position } = dragOperation;
1664
- const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
1665
- const { shape: dropShape } = droppable;
1666
- if (!dragShape || !dropShape) {
1667
- return null;
1668
- }
1669
- const { center: dragCenter } = dragShape;
1670
- const { fallbackEnabled } = collisionStore.getState();
1671
- const interval = trackMovementInterval(position.current, dragAxis);
1672
- dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
1673
- direction: interval.direction
1674
- });
1675
- const collisionMap = dragOperation.data.collisionMap || {};
1676
- dragOperation.data.collisionMap = collisionMap;
1677
- collisionMap[droppable.id] = {
1678
- direction: interval.direction
1679
- };
1680
- const { center: dropCenter } = dropShape;
1681
- const overMidpoint = getMidpointImpact(
1682
- dragShape,
1683
- dropShape,
1684
- interval.direction,
1685
- midpointOffset
1686
- );
1687
- if (((_b = dragOperation.source) == null ? void 0 : _b.id) === droppable.id) {
1688
- const collision = directionalCollision(input, interval.previous);
1689
- collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
1690
- if (collision) {
1691
- return __spreadProps(__spreadValues({}, collision), {
1692
- priority: CollisionPriority7.Highest
1693
- });
1694
- }
1695
- }
1696
- const intersectionArea = dragShape.intersectionArea(dropShape);
1697
- const intersectionRatio = intersectionArea / dropShape.area;
1698
- if (intersectionArea && overMidpoint) {
1699
- collisionDebug(
1700
- dragCenter,
1701
- dropCenter,
1702
- droppable.id.toString(),
1703
- "green",
1704
- interval.direction
1705
- );
1706
- const collision = {
1707
- id: droppable.id,
1708
- value: intersectionRatio,
1709
- priority: CollisionPriority7.High,
1710
- type: CollisionType7.Collision
1711
- };
1712
- const shouldFlushId = flushNext === droppable.id;
1713
- flushNext = "";
1714
- return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
1715
- }
1716
- if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
1717
- const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
1718
- const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
1719
- if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
1720
- const fallbackCollision = closestCorners(input);
1721
- if (fallbackCollision) {
1722
- const direction = getDirection(dragAxis, {
1723
- x: dragShape.center.x - (((_d = droppable.shape) == null ? void 0 : _d.center.x) || 0),
1724
- y: dragShape.center.y - (((_e = droppable.shape) == null ? void 0 : _e.center.y) || 0)
1725
- });
1726
- collisionMap[droppable.id] = {
1727
- direction
1728
- };
1729
- if (intersectionArea) {
1730
- collisionDebug(
1731
- dragCenter,
1732
- dropCenter,
1733
- droppable.id.toString(),
1734
- "red",
1735
- direction || ""
1736
- );
1737
- flushNext = droppable.id;
1738
- return __spreadProps(__spreadValues({}, fallbackCollision), {
1739
- priority: CollisionPriority7.Low
1740
- });
1741
- }
1742
- collisionDebug(
1743
- dragCenter,
1744
- dropCenter,
1745
- droppable.id.toString(),
1746
- "orange",
1747
- direction || ""
1748
- );
1749
- return __spreadProps(__spreadValues({}, fallbackCollision), { priority: CollisionPriority7.Lowest });
1750
- }
1751
- }
1752
- }
1753
- collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
1754
- delete collisionMap[droppable.id];
1755
- return null;
1756
- };
1757
-
1758
- // components/Sortable/index.tsx
1759
- import { RestrictToElement } from "@dnd-kit/dom/modifiers";
1760
- import { jsx as jsx6 } from "react/jsx-runtime";
1761
- var SortableProvider = ({
1762
- children,
1763
- onDragStart,
1764
- onDragEnd,
1765
- onMove
1766
- }) => {
1767
- const [move, setMove] = useState6({ source: -1, target: -1 });
1768
- const sensors = useSensors();
1769
- return /* @__PURE__ */ jsx6(
1770
- DragDropProvider,
1771
- {
1772
- sensors,
1773
- modifiers: [
1774
- RestrictToElement.configure({
1775
- element() {
1776
- return document.querySelector("[data-dnd-container]");
1777
- }
1778
- })
1779
- ],
1780
- onDragStart,
1781
- onDragOver: (event, manager) => {
1782
- var _a, _b;
1783
- const { operation } = event;
1784
- const { source, target } = operation;
1785
- if (!source || !target) return;
1786
- let sourceIndex = source.data.index;
1787
- let targetIndex = target.data.index;
1788
- const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
1789
- if (sourceIndex !== targetIndex && source.id !== target.id) {
1790
- const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" ? "before" : "after";
1791
- if (targetIndex >= sourceIndex) {
1792
- targetIndex = targetIndex - 1;
1793
- }
1794
- if (collisionPosition === "after") {
1795
- targetIndex = targetIndex + 1;
1796
- }
1797
- setMove({
1798
- source: sourceIndex,
1799
- target: targetIndex
1800
- });
1801
- }
1802
- },
1803
- onDragEnd: () => {
1804
- setTimeout(() => {
1805
- if (move.source !== -1 && move.target !== -1) {
1806
- onMove(move);
1807
- }
1808
- onDragEnd();
1809
- }, 250);
1810
- setMove({ source: -1, target: -1 });
1811
- },
1812
- children
1813
- }
1814
- );
1815
- };
1816
- var Sortable = ({
1817
- id,
1818
- index,
1819
- disabled,
1820
- children,
1821
- type = "item"
1822
- }) => {
1823
- const { ref: sortableRef, status } = useSortableSafe({
1824
- id,
1825
- type,
1826
- index,
1827
- disabled,
1828
- data: { index },
1829
- collisionDetector: createDynamicCollisionDetector("y")
1830
- });
1831
- return children({ status, ref: sortableRef });
1832
- };
1833
-
1834
- // components/AutoField/context.tsx
1835
- init_react_import();
1836
- import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
1837
- import { jsx as jsx7 } from "react/jsx-runtime";
1838
- var NestedFieldContext = createContext2({});
1839
- var useNestedFieldContext = () => {
1840
- const context = useContext2(NestedFieldContext);
1841
- return __spreadProps(__spreadValues({}, context), {
1842
- readOnlyFields: context.readOnlyFields || {}
1843
- });
1844
- };
1845
- var NestedFieldProvider = ({
1846
- children,
1847
- name,
1848
- subName,
1849
- wildcardName = name,
1850
- readOnlyFields
1851
- }) => {
1852
- const subPath = `${name}.${subName}`;
1853
- const wildcardSubPath = `${wildcardName}.${subName}`;
1854
- const subReadOnlyFields = useMemo(
1855
- () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
1856
- const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
1857
- if (isLocal) {
1858
- const subPathPattern = new RegExp(
1859
- `^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
1860
- );
1861
- const localName = readOnlyKey.replace(subPathPattern, "");
1862
- return __spreadProps(__spreadValues({}, acc), {
1863
- [localName]: readOnlyFields[readOnlyKey]
1864
- });
1865
- }
1866
- return acc;
1867
- }, {}),
1868
- [name, subName, wildcardName, readOnlyFields]
1869
- );
1870
- return /* @__PURE__ */ jsx7(
1871
- NestedFieldContext.Provider,
1872
- {
1873
- value: { readOnlyFields: subReadOnlyFields, localName: subName },
1874
- children
1201
+ return acc;
1202
+ }, {}),
1203
+ [name, subName, wildcardName, readOnlyFields]
1204
+ );
1205
+ return /* @__PURE__ */ jsx7(
1206
+ NestedFieldContext.Provider,
1207
+ {
1208
+ value: { readOnlyFields: subReadOnlyFields, localName: subName },
1209
+ children
1875
1210
  }
1876
1211
  );
1877
1212
  };
@@ -1902,7 +1237,7 @@ var ArrayField = ({
1902
1237
  }),
1903
1238
  openId: ""
1904
1239
  };
1905
- const [localState, setLocalState] = useState7({ arrayState, value });
1240
+ const [localState, setLocalState] = useState6({ arrayState, value });
1906
1241
  useEffect4(() => {
1907
1242
  setLocalState({ arrayState, value });
1908
1243
  }, [value, state.ui.arrayState[id]]);
@@ -1946,7 +1281,6 @@ var ArrayField = ({
1946
1281
  setUi(mapArrayStateToUi(arrayState));
1947
1282
  }
1948
1283
  }, []);
1949
- const [isDragging, setIsDragging] = useState7(false);
1950
1284
  const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
1951
1285
  if (field.type !== "array" || !field.arrayFields) {
1952
1286
  return null;
@@ -1962,8 +1296,6 @@ var ArrayField = ({
1962
1296
  children: /* @__PURE__ */ jsx8(
1963
1297
  SortableProvider,
1964
1298
  {
1965
- onDragStart: () => setIsDragging(true),
1966
- onDragEnd: () => setIsDragging(false),
1967
1299
  onMove: (move) => {
1968
1300
  const newValue = reorder(value, move.source, move.target);
1969
1301
  const newArrayStateItems = reorder(
@@ -1994,7 +1326,7 @@ var ArrayField = ({
1994
1326
  e.preventDefault();
1995
1327
  },
1996
1328
  children: [
1997
- /* @__PURE__ */ jsx8("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
1329
+ localState.arrayState.items.map((item, i) => {
1998
1330
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1999
1331
  const data = Array.from(localState.value || [])[i] || {};
2000
1332
  return /* @__PURE__ */ jsx8(
@@ -2017,7 +1349,6 @@ var ArrayField = ({
2017
1349
  "div",
2018
1350
  {
2019
1351
  onClick: (e) => {
2020
- if (isDragging) return;
2021
1352
  e.preventDefault();
2022
1353
  e.stopPropagation();
2023
1354
  if (arrayState.openId === _arrayId) {
@@ -2047,11 +1378,7 @@ var ArrayField = ({
2047
1378
  onClick: (e) => {
2048
1379
  e.stopPropagation();
2049
1380
  const existingValue = [...value || []];
2050
- existingValue.splice(
2051
- i,
2052
- 0,
2053
- existingValue[i]
2054
- );
1381
+ existingValue.splice(i, 0, existingValue[i]);
2055
1382
  onChange(
2056
1383
  existingValue,
2057
1384
  mapArrayStateToUi(
@@ -2093,72 +1420,62 @@ var ArrayField = ({
2093
1420
  ]
2094
1421
  }
2095
1422
  ),
2096
- /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8(
2097
- "fieldset",
2098
- {
2099
- className: getClassNameItem("fieldset"),
2100
- onPointerDownCapture: (e) => {
2101
- e.stopPropagation();
2102
- },
2103
- children: Object.keys(field.arrayFields).map((subName) => {
2104
- const subField = field.arrayFields[subName];
2105
- const indexName = `${name}[${i}]`;
2106
- const subPath = `${indexName}.${subName}`;
2107
- const localIndexName = `${localName}[${i}]`;
2108
- const localWildcardName = `${localName}[*]`;
2109
- const localSubPath = `${localIndexName}.${subName}`;
2110
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
2111
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2112
- const label2 = subField.label || subName;
2113
- return /* @__PURE__ */ jsx8(
2114
- NestedFieldProvider,
1423
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
1424
+ const subField = field.arrayFields[subName];
1425
+ const indexName = `${name}[${i}]`;
1426
+ const subPath = `${indexName}.${subName}`;
1427
+ const localIndexName = `${localName}[${i}]`;
1428
+ const localWildcardName = `${localName}[*]`;
1429
+ const localSubPath = `${localIndexName}.${subName}`;
1430
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
1431
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
1432
+ const label2 = subField.label || subName;
1433
+ return /* @__PURE__ */ jsx8(
1434
+ NestedFieldProvider,
1435
+ {
1436
+ name: localIndexName,
1437
+ wildcardName: localWildcardName,
1438
+ subName,
1439
+ readOnlyFields,
1440
+ children: /* @__PURE__ */ jsx8(
1441
+ AutoFieldPrivate,
2115
1442
  {
2116
- name: localIndexName,
2117
- wildcardName: localWildcardName,
2118
- subName,
2119
- readOnlyFields,
2120
- children: /* @__PURE__ */ jsx8(
2121
- AutoFieldPrivate,
2122
- {
2123
- name: subPath,
2124
- label: label2,
2125
- id: `${_arrayId}_${subName}`,
2126
- readOnly: subReadOnly,
2127
- field: __spreadProps(__spreadValues({}, subField), {
2128
- label: label2
2129
- // May be used by custom fields
2130
- }),
2131
- value: data[subName],
2132
- onChange: (val, ui) => {
2133
- onChange(
2134
- replace(value, i, __spreadProps(__spreadValues({}, data), {
2135
- [subName]: val
2136
- })),
2137
- ui
2138
- );
2139
- }
2140
- }
2141
- )
2142
- },
2143
- subPath
2144
- );
2145
- })
2146
- }
2147
- ) })
1443
+ name: subPath,
1444
+ label: label2,
1445
+ id: `${_arrayId}_${subName}`,
1446
+ readOnly: subReadOnly,
1447
+ field: __spreadProps(__spreadValues({}, subField), {
1448
+ label: label2
1449
+ // May be used by custom fields
1450
+ }),
1451
+ value: data[subName],
1452
+ onChange: (val, ui) => {
1453
+ onChange(
1454
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
1455
+ [subName]: val
1456
+ })),
1457
+ ui
1458
+ );
1459
+ }
1460
+ }
1461
+ )
1462
+ },
1463
+ subPath
1464
+ );
1465
+ }) }) })
2148
1466
  ]
2149
1467
  }
2150
1468
  )
2151
1469
  },
2152
1470
  _arrayId
2153
1471
  );
2154
- }) }),
1472
+ }),
2155
1473
  !addDisabled && /* @__PURE__ */ jsx8(
2156
1474
  "button",
2157
1475
  {
2158
1476
  type: "button",
2159
1477
  className: getClassName5("addButton"),
2160
1478
  onClick: () => {
2161
- if (isDragging) return;
2162
1479
  const existingValue = value || [];
2163
1480
  const newValue = [
2164
1481
  ...existingValue,
@@ -2246,18 +1563,18 @@ init_react_import();
2246
1563
  import {
2247
1564
  useMemo as useMemo2,
2248
1565
  useEffect as useEffect7,
2249
- useState as useState10,
1566
+ useState as useState9,
2250
1567
  useCallback as useCallback4,
2251
1568
  isValidElement
2252
1569
  } from "react";
2253
1570
 
2254
1571
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
2255
1572
  init_react_import();
2256
- var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_91ls0_1", "ExternalInput-button": "_ExternalInput-button_91ls0_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_91ls0_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_91ls0_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_91ls0_35", "ExternalInput": "_ExternalInput_91ls0_1", "ExternalInputModal": "_ExternalInputModal_91ls0_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_91ls0_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_91ls0_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_91ls0_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_91ls0_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_91ls0_133", "ExternalInputModal-table": "_ExternalInputModal-table_91ls0_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_91ls0_149", "ExternalInputModal-th": "_ExternalInputModal-th_91ls0_149", "ExternalInputModal-td": "_ExternalInputModal-td_91ls0_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_91ls0_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_91ls0_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_91ls0_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_91ls0_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_91ls0_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_91ls0_227", "ExternalInputModal-search": "_ExternalInputModal-search_91ls0_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_91ls0_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_91ls0_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_91ls0_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_91ls0_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_91ls0_326", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_91ls0_330", "ExternalInputModal-footer": "_ExternalInputModal-footer_91ls0_330", "ExternalInputModal-field": "_ExternalInputModal-field_91ls0_343" };
1573
+ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_8wgzm_1", "ExternalInput-button": "_ExternalInput-button_8wgzm_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_8wgzm_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_8wgzm_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_8wgzm_35", "ExternalInput": "_ExternalInput_8wgzm_1", "ExternalInputModal": "_ExternalInputModal_8wgzm_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_8wgzm_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_8wgzm_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_8wgzm_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_8wgzm_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_8wgzm_133", "ExternalInputModal-table": "_ExternalInputModal-table_8wgzm_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_8wgzm_149", "ExternalInputModal-th": "_ExternalInputModal-th_8wgzm_149", "ExternalInputModal-td": "_ExternalInputModal-td_8wgzm_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_8wgzm_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_8wgzm_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_8wgzm_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_8wgzm_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_8wgzm_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_8wgzm_227", "ExternalInputModal-search": "_ExternalInputModal-search_8wgzm_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_8wgzm_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_8wgzm_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_8wgzm_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_8wgzm_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_8wgzm_326", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_8wgzm_330", "ExternalInputModal-footer": "_ExternalInputModal-footer_8wgzm_330" };
2257
1574
 
2258
1575
  // components/Modal/index.tsx
2259
1576
  init_react_import();
2260
- import { useEffect as useEffect5, useState as useState8 } from "react";
1577
+ import { useEffect as useEffect5, useState as useState7 } from "react";
2261
1578
 
2262
1579
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
2263
1580
  init_react_import();
@@ -2272,7 +1589,7 @@ var Modal = ({
2272
1589
  onClose,
2273
1590
  isOpen
2274
1591
  }) => {
2275
- const [rootEl, setRootEl] = useState8(null);
1592
+ const [rootEl, setRootEl] = useState7(null);
2276
1593
  useEffect5(() => {
2277
1594
  setRootEl(document.getElementById("puck-portal-root"));
2278
1595
  }, []);
@@ -2320,11 +1637,11 @@ init_react_import();
2320
1637
 
2321
1638
  // components/Button/Button.tsx
2322
1639
  init_react_import();
2323
- import { useEffect as useEffect6, useState as useState9 } from "react";
1640
+ import { useEffect as useEffect6, useState as useState8 } from "react";
2324
1641
 
2325
1642
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
2326
1643
  init_react_import();
2327
- var Button_module_default = { "Button": "_Button_10byl_1", "Button--medium": "_Button--medium_10byl_29", "Button--large": "_Button--large_10byl_37", "Button-icon": "_Button-icon_10byl_44", "Button--primary": "_Button--primary_10byl_48", "Button--secondary": "_Button--secondary_10byl_67", "Button--flush": "_Button--flush_10byl_84", "Button--disabled": "_Button--disabled_10byl_88", "Button--fullWidth": "_Button--fullWidth_10byl_95", "Button-spinner": "_Button-spinner_10byl_100" };
1644
+ var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
2328
1645
 
2329
1646
  // lib/filter-data-attrs.ts
2330
1647
  init_react_import();
@@ -2370,7 +1687,7 @@ var Button = (_a) => {
2370
1687
  "size",
2371
1688
  "loading"
2372
1689
  ]);
2373
- const [loading, setLoading] = useState9(loadingProp);
1690
+ const [loading, setLoading] = useState8(loadingProp);
2374
1691
  useEffect6(() => setLoading(loadingProp), [loadingProp]);
2375
1692
  const ElementType = href ? "a" : type ? "button" : "span";
2376
1693
  const dataAttrs = filterDataAttrs(props);
@@ -2426,12 +1743,12 @@ var ExternalInput = ({
2426
1743
  mapRow = (val) => val,
2427
1744
  filterFields
2428
1745
  } = field || {};
2429
- const [data, setData] = useState10([]);
2430
- const [isOpen, setOpen] = useState10(false);
2431
- const [isLoading, setIsLoading] = useState10(true);
1746
+ const [data, setData] = useState9([]);
1747
+ const [isOpen, setOpen] = useState9(false);
1748
+ const [isLoading, setIsLoading] = useState9(true);
2432
1749
  const hasFilterFields = !!filterFields;
2433
- const [filters, setFilters] = useState10(field.initialFilters || {});
2434
- const [filtersToggled, setFiltersToggled] = useState10(hasFilterFields);
1750
+ const [filters, setFilters] = useState9(field.initialFilters || {});
1751
+ const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
2435
1752
  const mappedData = useMemo2(() => {
2436
1753
  return data.map(mapRow);
2437
1754
  }, [data]);
@@ -2446,7 +1763,7 @@ var ExternalInput = ({
2446
1763
  }
2447
1764
  return Array.from(validKeys);
2448
1765
  }, [mappedData]);
2449
- const [searchQuery, setSearchQuery] = useState10(field.initialQuery || "");
1766
+ const [searchQuery, setSearchQuery] = useState9(field.initialQuery || "");
2450
1767
  const search = useCallback4(
2451
1768
  (query, filters2) => __async(void 0, null, function* () {
2452
1769
  setIsLoading(true);
@@ -2561,26 +1878,18 @@ var ExternalInput = ({
2561
1878
  hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
2562
1879
  const filterField = filterFields[fieldName];
2563
1880
  return /* @__PURE__ */ jsx13(
2564
- "div",
1881
+ AutoFieldPrivate,
2565
1882
  {
2566
- className: getClassNameModal("field"),
2567
- children: /* @__PURE__ */ jsx13(
2568
- AutoFieldPrivate,
2569
- {
2570
- field: filterField,
2571
- name: fieldName,
2572
- id: `external_field_${fieldName}_filter`,
2573
- label: filterField.label || fieldName,
2574
- value: filters[fieldName],
2575
- onChange: (value2) => {
2576
- const newFilters = __spreadProps(__spreadValues({}, filters), {
2577
- [fieldName]: value2
2578
- });
2579
- setFilters(newFilters);
2580
- search(searchQuery, newFilters);
2581
- }
2582
- }
2583
- )
1883
+ field: filterField,
1884
+ name: fieldName,
1885
+ id: `external_field_${fieldName}_filter`,
1886
+ label: filterField.label || fieldName,
1887
+ value: filters[fieldName],
1888
+ onChange: (value2) => {
1889
+ const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
1890
+ setFilters(newFilters);
1891
+ search(searchQuery, newFilters);
1892
+ }
2584
1893
  },
2585
1894
  fieldName
2586
1895
  );
@@ -2915,7 +2224,7 @@ var ObjectField = ({
2915
2224
 
2916
2225
  // lib/use-safe-id.ts
2917
2226
  init_react_import();
2918
- import React2, { useState as useState11 } from "react";
2227
+ import React2, { useState as useState10 } from "react";
2919
2228
 
2920
2229
  // lib/generate-id.ts
2921
2230
  init_react_import();
@@ -2927,7 +2236,7 @@ var useSafeId = () => {
2927
2236
  if (typeof React2.useId !== "undefined") {
2928
2237
  return React2.useId();
2929
2238
  }
2930
- const [id] = useState11(generateId());
2239
+ const [id] = useState10(generateId());
2931
2240
  return id;
2932
2241
  };
2933
2242
 
@@ -3017,7 +2326,7 @@ function AutoFieldInternal(props) {
3017
2326
  });
3018
2327
  const onFocus = useCallback5(
3019
2328
  (e) => {
3020
- if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
2329
+ if (mergedProps.name && e.target.nodeName === "INPUT") {
3021
2330
  e.stopPropagation();
3022
2331
  dispatch({
3023
2332
  type: "setUi",
@@ -3073,7 +2382,7 @@ function AutoFieldInternal(props) {
3073
2382
  function AutoFieldPrivate(props) {
3074
2383
  const { state } = useAppContext();
3075
2384
  const { value, onChange } = props;
3076
- const [localValue, setLocalValue] = useState12(value);
2385
+ const [localValue, setLocalValue] = useState11(value);
3077
2386
  const onChangeDb = useDebouncedCallback(
3078
2387
  (val, ui) => {
3079
2388
  onChange(val, ui);
@@ -3112,55 +2421,393 @@ function AutoField(props) {
3112
2421
  // components/Drawer/index.tsx
3113
2422
  init_react_import();
3114
2423
 
3115
- // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
2424
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
2425
+ init_react_import();
2426
+ 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" };
2427
+
2428
+ // components/Drawer/index.tsx
2429
+ import { useId as useId2, useMemo as useMemo9, useState as useState18 } from "react";
2430
+
2431
+ // components/DragDropContext/index.tsx
2432
+ init_react_import();
2433
+ import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
2434
+ import {
2435
+ createContext as createContext4,
2436
+ useCallback as useCallback11,
2437
+ useContext as useContext7,
2438
+ useEffect as useEffect15,
2439
+ useId,
2440
+ useRef as useRef3,
2441
+ useState as useState17
2442
+ } from "react";
2443
+ import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2444
+
2445
+ // components/DropZone/index.tsx
2446
+ init_react_import();
2447
+ import {
2448
+ forwardRef as forwardRef3,
2449
+ useCallback as useCallback10,
2450
+ useContext as useContext6,
2451
+ useEffect as useEffect14,
2452
+ useMemo as useMemo8,
2453
+ useRef as useRef2
2454
+ } from "react";
2455
+
2456
+ // components/DraggableComponent/index.tsx
2457
+ init_react_import();
2458
+ import {
2459
+ useCallback as useCallback7,
2460
+ useContext as useContext5,
2461
+ useEffect as useEffect10,
2462
+ useMemo as useMemo7,
2463
+ useRef,
2464
+ useState as useState13
2465
+ } from "react";
2466
+
2467
+ // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2468
+ init_react_import();
2469
+ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_1ukn8_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1ukn8_29", "DraggableComponent--hover": "_DraggableComponent--hover_1ukn8_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1ukn8_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1ukn8_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1ukn8_66", "DraggableComponent-actions": "_DraggableComponent-actions_1ukn8_66" };
2470
+
2471
+ // components/DraggableComponent/index.tsx
2472
+ import { createPortal as createPortal2 } from "react-dom";
2473
+
2474
+ // lib/dnd/collision/dynamic/index.ts
2475
+ init_react_import();
2476
+ import {
2477
+ CollisionPriority as CollisionPriority7,
2478
+ CollisionType as CollisionType7
2479
+ } from "@dnd-kit/abstract";
2480
+
2481
+ // lib/dnd/collision/directional/index.ts
2482
+ init_react_import();
2483
+ import { CollisionType } from "@dnd-kit/abstract";
2484
+
2485
+ // lib/dnd/collision/collision-debug.ts
2486
+ init_react_import();
2487
+ var DEBUG = false;
2488
+ var debugElements = {};
2489
+ var timeout;
2490
+ var collisionDebug = (a, b, id, color, label) => {
2491
+ if (!DEBUG) return;
2492
+ const debugId = `${id}-debug`;
2493
+ clearTimeout(timeout);
2494
+ timeout = setTimeout(() => {
2495
+ Object.entries(debugElements).forEach(([id2, { svg }]) => {
2496
+ svg.remove();
2497
+ delete debugElements[id2];
2498
+ });
2499
+ }, 1e3);
2500
+ requestAnimationFrame(() => {
2501
+ var _a, _b;
2502
+ const existingEl = debugElements[debugId];
2503
+ let line = (_a = debugElements[debugId]) == null ? void 0 : _a.line;
2504
+ let text = (_b = debugElements[debugId]) == null ? void 0 : _b.text;
2505
+ if (!existingEl) {
2506
+ const svgNs = "http://www.w3.org/2000/svg";
2507
+ const svg = document.createElementNS(svgNs, "svg");
2508
+ line = document.createElementNS(svgNs, "line");
2509
+ text = document.createElementNS(svgNs, "text");
2510
+ svg.setAttribute("id", debugId);
2511
+ svg.setAttribute(
2512
+ "style",
2513
+ "position: fixed; height: 100%; width: 100%; pointer-events: none;"
2514
+ );
2515
+ svg.appendChild(line);
2516
+ svg.appendChild(text);
2517
+ text.setAttribute("fill", `black`);
2518
+ document.body.appendChild(svg);
2519
+ debugElements[debugId] = { svg, line, text };
2520
+ }
2521
+ line.setAttribute("x1", a.x.toString());
2522
+ line.setAttribute("x2", b.x.toString());
2523
+ line.setAttribute("y1", a.y.toString());
2524
+ line.setAttribute("y2", b.y.toString());
2525
+ line.setAttribute("style", `stroke:${color};stroke-width:2`);
2526
+ text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
2527
+ text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
2528
+ if (label) {
2529
+ text.innerHTML = label;
2530
+ }
2531
+ });
2532
+ };
2533
+
2534
+ // lib/dnd/collision/directional/index.ts
2535
+ var distanceChange = "increasing";
2536
+ var directionalCollision = (input, previous) => {
2537
+ var _a;
2538
+ const { dragOperation, droppable } = input;
2539
+ const { shape: dropShape } = droppable;
2540
+ const { position } = dragOperation;
2541
+ const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
2542
+ if (!dragShape || !dropShape) return null;
2543
+ const dropCenter = dropShape.center;
2544
+ const distanceToPrevious = Math.sqrt(
2545
+ Math.pow(dropCenter.x - previous.x, 2) + Math.pow(dropCenter.y - previous.y, 2)
2546
+ );
2547
+ const distanceToCurrent = Math.sqrt(
2548
+ Math.pow(dropCenter.x - position.current.x, 2) + Math.pow(dropCenter.y - position.current.y, 2)
2549
+ );
2550
+ distanceChange = distanceToCurrent === distanceToPrevious ? distanceChange : distanceToCurrent < distanceToPrevious ? "decreasing" : "increasing";
2551
+ collisionDebug(
2552
+ dragShape.center,
2553
+ dropCenter,
2554
+ droppable.id.toString(),
2555
+ "rebeccapurple"
2556
+ );
2557
+ if (distanceChange === "decreasing") {
2558
+ return {
2559
+ id: droppable.id,
2560
+ value: 1,
2561
+ type: CollisionType.Collision
2562
+ };
2563
+ }
2564
+ return null;
2565
+ };
2566
+
2567
+ // lib/dnd/collision/dynamic/get-direction.ts
3116
2568
  init_react_import();
3117
- 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" };
3118
-
3119
- // components/Drawer/index.tsx
3120
- import { useId as useId2, useMemo as useMemo9, useState as useState19 } from "react";
2569
+ var getDirection = (dragAxis, delta) => {
2570
+ if (dragAxis === "dynamic") {
2571
+ if (Math.abs(delta.y) > Math.abs(delta.x)) {
2572
+ return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
2573
+ } else {
2574
+ return delta.x === 0 ? null : delta.x > 0 ? "right" : "left";
2575
+ }
2576
+ } else if (dragAxis === "x") {
2577
+ return delta.x === 0 ? null : delta.x > 0 ? "right" : "left";
2578
+ }
2579
+ return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
2580
+ };
3121
2581
 
3122
- // components/DragDropContext/index.tsx
2582
+ // lib/dnd/collision/dynamic/get-midpoint-impact.ts
3123
2583
  init_react_import();
3124
- import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
3125
- import {
3126
- createContext as createContext4,
3127
- useCallback as useCallback11,
3128
- useContext as useContext7,
3129
- useEffect as useEffect15,
3130
- useId,
3131
- useRef as useRef3,
3132
- useState as useState18
3133
- } from "react";
3134
- import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2584
+ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
2585
+ const dragRect = dragShape.boundingRectangle;
2586
+ const dropCenter = dropShape.center;
2587
+ if (direction === "down") {
2588
+ const offset2 = offsetMultiplier * dropShape.boundingRectangle.height;
2589
+ return dragRect.bottom >= dropCenter.y + offset2;
2590
+ } else if (direction === "up") {
2591
+ const offset2 = offsetMultiplier * dropShape.boundingRectangle.height;
2592
+ return dragRect.top < dropCenter.y - offset2;
2593
+ } else if (direction === "left") {
2594
+ const offset2 = offsetMultiplier * dropShape.boundingRectangle.width;
2595
+ return dropCenter.x - offset2 >= dragRect.left;
2596
+ }
2597
+ const offset = offsetMultiplier * dropShape.boundingRectangle.width;
2598
+ return dragRect.right - offset >= dropCenter.x;
2599
+ };
3135
2600
 
3136
- // components/DropZone/index.tsx
2601
+ // lib/dnd/collision/dynamic/track-movement-interval.ts
3137
2602
  init_react_import();
3138
- import {
3139
- forwardRef as forwardRef3,
3140
- useCallback as useCallback10,
3141
- useContext as useContext6,
3142
- useEffect as useEffect14,
3143
- useMemo as useMemo8,
3144
- useRef as useRef2
3145
- } from "react";
2603
+ import { Point } from "@dnd-kit/geometry";
2604
+ var INTERVAL_SENSITIVITY = 10;
2605
+ var intervalCache = {
2606
+ current: { x: 0, y: 0 },
2607
+ delta: { x: 0, y: 0 },
2608
+ previous: { x: 0, y: 0 },
2609
+ direction: null
2610
+ };
2611
+ var trackMovementInterval = (point, dragAxis = "dynamic") => {
2612
+ intervalCache.current = point;
2613
+ intervalCache.delta = {
2614
+ x: point.x - intervalCache.previous.x,
2615
+ y: point.y - intervalCache.previous.y
2616
+ };
2617
+ intervalCache.direction = getDirection(dragAxis, intervalCache.delta) || intervalCache.direction;
2618
+ if (Math.abs(intervalCache.delta.x) > INTERVAL_SENSITIVITY || Math.abs(intervalCache.delta.y) > INTERVAL_SENSITIVITY) {
2619
+ intervalCache.previous = Point.from(point);
2620
+ }
2621
+ return intervalCache;
2622
+ };
3146
2623
 
3147
- // components/DraggableComponent/index.tsx
2624
+ // ../../node_modules/@dnd-kit/collision/dist/index.js
3148
2625
  init_react_import();
3149
- import {
3150
- useCallback as useCallback7,
3151
- useContext as useContext5,
3152
- useEffect as useEffect10,
3153
- useMemo as useMemo7,
3154
- useRef,
3155
- useState as useState14
3156
- } from "react";
2626
+ import { CollisionPriority, CollisionType as CollisionType2 } from "@dnd-kit/abstract";
2627
+ import { Point as Point2 } from "@dnd-kit/geometry";
2628
+ import { CollisionPriority as CollisionPriority2, CollisionType as CollisionType22 } from "@dnd-kit/abstract";
2629
+ import { Point as Point22 } from "@dnd-kit/geometry";
2630
+ import { CollisionPriority as CollisionPriority3, CollisionType as CollisionType3 } from "@dnd-kit/abstract";
2631
+ import { Point as Point3 } from "@dnd-kit/geometry";
2632
+ import { CollisionPriority as CollisionPriority4, CollisionType as CollisionType4 } from "@dnd-kit/abstract";
2633
+ import { Point as Point4 } from "@dnd-kit/geometry";
2634
+ import { CollisionPriority as CollisionPriority5, CollisionType as CollisionType5 } from "@dnd-kit/abstract";
2635
+ import { Point as Point5 } from "@dnd-kit/geometry";
2636
+ import { CollisionPriority as CollisionPriority6, CollisionType as CollisionType6 } from "@dnd-kit/abstract";
2637
+ import { Point as Point6 } from "@dnd-kit/geometry";
2638
+ var pointerIntersection = ({
2639
+ dragOperation,
2640
+ droppable
2641
+ }) => {
2642
+ const pointerCoordinates = dragOperation.position.current;
2643
+ if (!pointerCoordinates) {
2644
+ return null;
2645
+ }
2646
+ const { id } = droppable;
2647
+ if (!droppable.shape) {
2648
+ return null;
2649
+ }
2650
+ if (droppable.shape.containsPoint(pointerCoordinates)) {
2651
+ const distance = Point2.distance(droppable.shape.center, pointerCoordinates);
2652
+ return {
2653
+ id,
2654
+ value: 1 / distance,
2655
+ type: CollisionType2.PointerIntersection,
2656
+ priority: CollisionPriority.High
2657
+ };
2658
+ }
2659
+ return null;
2660
+ };
2661
+ var closestCorners = (input) => {
2662
+ const { dragOperation, droppable } = input;
2663
+ const { shape, position } = dragOperation;
2664
+ if (!droppable.shape) {
2665
+ return null;
2666
+ }
2667
+ const { left, top, right, bottom } = droppable.shape.boundingRectangle;
2668
+ const corners = [
2669
+ {
2670
+ x: left,
2671
+ y: top
2672
+ },
2673
+ {
2674
+ x: right,
2675
+ y: top
2676
+ },
2677
+ {
2678
+ x: left,
2679
+ y: bottom
2680
+ },
2681
+ {
2682
+ x: right,
2683
+ y: bottom
2684
+ }
2685
+ ];
2686
+ const distance = corners.reduce(
2687
+ (acc, corner) => {
2688
+ var _a;
2689
+ return acc + Point3.distance(
2690
+ Point3.from(corner),
2691
+ (_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
2692
+ );
2693
+ },
2694
+ 0
2695
+ );
2696
+ const value = distance / 4;
2697
+ return {
2698
+ id: droppable.id,
2699
+ value: 1 / value,
2700
+ type: CollisionType3.Collision,
2701
+ priority: CollisionPriority3.Normal
2702
+ };
2703
+ };
3157
2704
 
3158
- // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2705
+ // lib/dnd/collision/dynamic/store.ts
3159
2706
  init_react_import();
3160
- var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_1ukn8_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1ukn8_29", "DraggableComponent--hover": "_DraggableComponent--hover_1ukn8_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1ukn8_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1ukn8_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1ukn8_66", "DraggableComponent-actions": "_DraggableComponent-actions_1ukn8_66" };
2707
+ import { createStore } from "zustand/vanilla";
2708
+ var collisionStore = createStore(() => ({
2709
+ fallbackEnabled: false
2710
+ }));
3161
2711
 
3162
- // components/DraggableComponent/index.tsx
3163
- import { createPortal as createPortal2 } from "react-dom";
2712
+ // lib/dnd/collision/dynamic/index.ts
2713
+ var flushNext = "";
2714
+ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
2715
+ var _a, _b, _c, _d, _e;
2716
+ const { dragOperation, droppable } = input;
2717
+ const { position } = dragOperation;
2718
+ const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
2719
+ const { shape: dropShape } = droppable;
2720
+ if (!dragShape || !dropShape) {
2721
+ return null;
2722
+ }
2723
+ const { center: dragCenter } = dragShape;
2724
+ const { fallbackEnabled } = collisionStore.getState();
2725
+ const interval = trackMovementInterval(position.current, dragAxis);
2726
+ dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
2727
+ direction: interval.direction
2728
+ });
2729
+ const collisionMap = dragOperation.data.collisionMap || {};
2730
+ dragOperation.data.collisionMap = collisionMap;
2731
+ collisionMap[droppable.id] = {
2732
+ direction: interval.direction
2733
+ };
2734
+ const { center: dropCenter } = dropShape;
2735
+ const overMidpoint = getMidpointImpact(
2736
+ dragShape,
2737
+ dropShape,
2738
+ interval.direction,
2739
+ midpointOffset
2740
+ );
2741
+ if (((_b = dragOperation.source) == null ? void 0 : _b.id) === droppable.id) {
2742
+ const collision = directionalCollision(input, interval.previous);
2743
+ collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
2744
+ if (collision) {
2745
+ return __spreadProps(__spreadValues({}, collision), {
2746
+ priority: CollisionPriority7.Highest
2747
+ });
2748
+ }
2749
+ }
2750
+ const intersectionArea = dragShape.intersectionArea(dropShape);
2751
+ const intersectionRatio = intersectionArea / dropShape.area;
2752
+ if (intersectionArea && overMidpoint) {
2753
+ collisionDebug(
2754
+ dragCenter,
2755
+ dropCenter,
2756
+ droppable.id.toString(),
2757
+ "green",
2758
+ interval.direction
2759
+ );
2760
+ const collision = {
2761
+ id: droppable.id,
2762
+ value: intersectionRatio,
2763
+ priority: CollisionPriority7.High,
2764
+ type: CollisionType7.Collision
2765
+ };
2766
+ const shouldFlushId = flushNext === droppable.id;
2767
+ flushNext = "";
2768
+ return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
2769
+ }
2770
+ if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2771
+ const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
2772
+ const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
2773
+ if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
2774
+ const fallbackCollision = closestCorners(input);
2775
+ if (fallbackCollision) {
2776
+ const direction = getDirection(dragAxis, {
2777
+ x: dragShape.center.x - (((_d = droppable.shape) == null ? void 0 : _d.center.x) || 0),
2778
+ y: dragShape.center.y - (((_e = droppable.shape) == null ? void 0 : _e.center.y) || 0)
2779
+ });
2780
+ collisionMap[droppable.id] = {
2781
+ direction
2782
+ };
2783
+ if (intersectionArea) {
2784
+ collisionDebug(
2785
+ dragCenter,
2786
+ dropCenter,
2787
+ droppable.id.toString(),
2788
+ "red",
2789
+ direction || ""
2790
+ );
2791
+ flushNext = droppable.id;
2792
+ return __spreadProps(__spreadValues({}, fallbackCollision), {
2793
+ priority: CollisionPriority7.Low
2794
+ });
2795
+ }
2796
+ collisionDebug(
2797
+ dragCenter,
2798
+ dropCenter,
2799
+ droppable.id.toString(),
2800
+ "orange",
2801
+ direction || ""
2802
+ );
2803
+ return __spreadProps(__spreadValues({}, fallbackCollision), { priority: CollisionPriority7.Lowest });
2804
+ }
2805
+ }
2806
+ }
2807
+ collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "hotpink");
2808
+ delete collisionMap[droppable.id];
2809
+ return null;
2810
+ };
3164
2811
 
3165
2812
  // lib/get-deep-scroll-position.ts
3166
2813
  init_react_import();
@@ -3187,7 +2834,7 @@ import {
3187
2834
  createContext as createContext3,
3188
2835
  useCallback as useCallback6,
3189
2836
  useMemo as useMemo6,
3190
- useState as useState13
2837
+ useState as useState12
3191
2838
  } from "react";
3192
2839
  import { createStore as createStore2 } from "zustand";
3193
2840
  import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
@@ -3212,11 +2859,11 @@ var DropZoneProvider = ({
3212
2859
  children,
3213
2860
  value
3214
2861
  }) => {
3215
- const [hoveringComponent, setHoveringComponent] = useState13();
3216
- const [areasWithZones, setAreasWithZones] = useState13(
2862
+ const [hoveringComponent, setHoveringComponent] = useState12();
2863
+ const [areasWithZones, setAreasWithZones] = useState12(
3217
2864
  {}
3218
2865
  );
3219
- const [activeZones, setActiveZones] = useState13({});
2866
+ const [activeZones, setActiveZones] = useState12({});
3220
2867
  const { dispatch } = useAppContext();
3221
2868
  const registerZoneArea = useCallback6(
3222
2869
  (area) => {
@@ -3333,7 +2980,7 @@ var DraggableComponent = ({
3333
2980
  state
3334
2981
  } = useAppContext();
3335
2982
  const ctx = useContext5(dropZoneContext);
3336
- const [localZones, setLocalZones] = useState14({});
2983
+ const [localZones, setLocalZones] = useState13({});
3337
2984
  const registerLocalZone = useCallback7(
3338
2985
  (zoneCompound2, active) => {
3339
2986
  var _a;
@@ -3358,7 +3005,7 @@ var DraggableComponent = ({
3358
3005
  );
3359
3006
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
3360
3007
  const { path = [] } = ctx || {};
3361
- const [canDrag, setCanDrag] = useState14(false);
3008
+ const [canDrag, setCanDrag] = useState13(false);
3362
3009
  useEffect10(() => {
3363
3010
  var _a;
3364
3011
  const item = getItem({ index, zone: zoneCompound }, state.data);
@@ -3375,7 +3022,7 @@ var DraggableComponent = ({
3375
3022
  );
3376
3023
  const canCollide = canDrag || userIsDragging;
3377
3024
  const disabled = !isEnabled || !canCollide;
3378
- const [dragAxis, setDragAxis] = useState14(userDragAxis || autoDragAxis);
3025
+ const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
3379
3026
  const { ref: sortableRef, status } = useSortableSafe({
3380
3027
  id,
3381
3028
  index,
@@ -3411,7 +3058,7 @@ var DraggableComponent = ({
3411
3058
  },
3412
3059
  [sortableRef]
3413
3060
  );
3414
- const [portalEl, setPortalEl] = useState14();
3061
+ const [portalEl, setPortalEl] = useState13();
3415
3062
  useEffect10(() => {
3416
3063
  var _a, _b, _c;
3417
3064
  setPortalEl(
@@ -3438,7 +3085,7 @@ var DraggableComponent = ({
3438
3085
  };
3439
3086
  return style2;
3440
3087
  }, [ref.current]);
3441
- const [style, setStyle] = useState14();
3088
+ const [style, setStyle] = useState13();
3442
3089
  const sync = useCallback7(() => {
3443
3090
  setStyle(getStyle());
3444
3091
  }, [ref.current, iframe]);
@@ -3516,7 +3163,7 @@ var DraggableComponent = ({
3516
3163
  zone: zoneCompound
3517
3164
  });
3518
3165
  }, [index, zoneCompound]);
3519
- const [hover, setHover] = useState14(false);
3166
+ const [hover, setHover] = useState13(false);
3520
3167
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3521
3168
  useEffect10(() => {
3522
3169
  if (!ref.current) {
@@ -3577,7 +3224,7 @@ var DraggableComponent = ({
3577
3224
  };
3578
3225
  }
3579
3226
  }, [disabled, ref]);
3580
- const [isVisible, setIsVisible] = useState14(false);
3227
+ const [isVisible, setIsVisible] = useState13(false);
3581
3228
  useEffect10(() => {
3582
3229
  sync();
3583
3230
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
@@ -3697,14 +3344,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
3697
3344
 
3698
3345
  // components/DropZone/lib/use-min-empty-height.ts
3699
3346
  init_react_import();
3700
- import { useEffect as useEffect11, useState as useState15 } from "react";
3347
+ import { useEffect as useEffect11, useState as useState14 } from "react";
3701
3348
  var useMinEmptyHeight = ({
3702
3349
  zoneCompound,
3703
3350
  userMinEmptyHeight,
3704
3351
  ref
3705
3352
  }) => {
3706
- const [prevHeight, setPrevHeight] = useState15(0);
3707
- const [isAnimating, setIsAnimating] = useState15(false);
3353
+ const [prevHeight, setPrevHeight] = useState14(0);
3354
+ const [isAnimating, setIsAnimating] = useState14(false);
3708
3355
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3709
3356
  var _a, _b;
3710
3357
  return {
@@ -3746,7 +3393,7 @@ function assignRefs(refs, node) {
3746
3393
 
3747
3394
  // components/DropZone/lib/use-content-with-preview.ts
3748
3395
  init_react_import();
3749
- import { useEffect as useEffect12, useState as useState16 } from "react";
3396
+ import { useEffect as useEffect12, useState as useState15 } from "react";
3750
3397
 
3751
3398
  // lib/dnd/use-rendered-callback.ts
3752
3399
  init_react_import();
@@ -3789,8 +3436,8 @@ var useContentWithPreview = (content, zoneCompound) => {
3789
3436
  ui: { isDragging }
3790
3437
  }
3791
3438
  } = useAppContext();
3792
- const [contentWithPreview, setContentWithPreview] = useState16(content);
3793
- const [localPreview, setLocalPreview] = useState16(
3439
+ const [contentWithPreview, setContentWithPreview] = useState15(content);
3440
+ const [localPreview, setLocalPreview] = useState15(
3794
3441
  preview
3795
3442
  );
3796
3443
  const updateContent = useRenderedCallback(
@@ -3839,13 +3486,13 @@ var useContentWithPreview = (content, zoneCompound) => {
3839
3486
 
3840
3487
  // components/DropZone/lib/use-drag-axis.ts
3841
3488
  init_react_import();
3842
- import { useCallback as useCallback9, useEffect as useEffect13, useState as useState17 } from "react";
3489
+ import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
3843
3490
  var GRID_DRAG_AXIS = "dynamic";
3844
3491
  var FLEX_ROW_DRAG_AXIS = "x";
3845
3492
  var DEFAULT_DRAG_AXIS = "y";
3846
3493
  var useDragAxis = (ref, collisionAxis) => {
3847
3494
  const { status } = useAppContext();
3848
- const [dragAxis, setDragAxis] = useState17(
3495
+ const [dragAxis, setDragAxis] = useState16(
3849
3496
  collisionAxis || DEFAULT_DRAG_AXIS
3850
3497
  );
3851
3498
  const calculateDragAxis = useCallback9(() => {
@@ -4157,7 +3804,6 @@ var DropZoneRender = forwardRef3(
4157
3804
  }) });
4158
3805
  }
4159
3806
  );
4160
- var DropZonePure = (props) => /* @__PURE__ */ jsx22(DropZone, __spreadValues({}, props));
4161
3807
  var DropZone = forwardRef3(
4162
3808
  function DropZone2(props, ref) {
4163
3809
  const ctx = useContext6(dropZoneContext);
@@ -4596,263 +4242,526 @@ var reorderAction = (data, action) => {
4596
4242
  })
4597
4243
  });
4598
4244
  };
4599
- function reduceData(data, action, config) {
4600
- if (action.type === "insert") {
4601
- return insertAction(data, action, config);
4245
+ function reduceData(data, action, config) {
4246
+ if (action.type === "insert") {
4247
+ return insertAction(data, action, config);
4248
+ }
4249
+ if (action.type === "duplicate") {
4250
+ const item = getItem(
4251
+ { index: action.sourceIndex, zone: action.sourceZone },
4252
+ data
4253
+ );
4254
+ const newItem = __spreadProps(__spreadValues({}, item), {
4255
+ props: __spreadProps(__spreadValues({}, item.props), {
4256
+ id: generateId(item.type)
4257
+ })
4258
+ });
4259
+ const dataWithRelatedDuplicated = duplicateRelatedZones(
4260
+ item,
4261
+ data,
4262
+ newItem.props.id
4263
+ );
4264
+ if (action.sourceZone === rootDroppableId) {
4265
+ return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
4266
+ content: insert(data.content, action.sourceIndex + 1, newItem)
4267
+ });
4268
+ }
4269
+ return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
4270
+ zones: __spreadProps(__spreadValues({}, dataWithRelatedDuplicated.zones), {
4271
+ [action.sourceZone]: insert(
4272
+ dataWithRelatedDuplicated.zones[action.sourceZone],
4273
+ action.sourceIndex + 1,
4274
+ newItem
4275
+ )
4276
+ })
4277
+ });
4278
+ }
4279
+ if (action.type === "reorder") {
4280
+ return reorderAction(data, action);
4281
+ }
4282
+ if (action.type === "move") {
4283
+ if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
4284
+ return data;
4285
+ }
4286
+ const newData = setupZone(
4287
+ setupZone(data, action.sourceZone),
4288
+ action.destinationZone
4289
+ );
4290
+ const item = getItem(
4291
+ { zone: action.sourceZone, index: action.sourceIndex },
4292
+ newData
4293
+ );
4294
+ if (action.sourceZone === action.destinationZone) {
4295
+ return reorderAction(data, __spreadProps(__spreadValues({}, action), { type: "reorder" }));
4296
+ }
4297
+ if (action.sourceZone === rootDroppableId) {
4298
+ return __spreadProps(__spreadValues({}, newData), {
4299
+ content: remove(newData.content, action.sourceIndex),
4300
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
4301
+ [action.destinationZone]: insert(
4302
+ newData.zones[action.destinationZone],
4303
+ action.destinationIndex,
4304
+ item
4305
+ )
4306
+ })
4307
+ });
4308
+ }
4309
+ if (action.destinationZone === rootDroppableId) {
4310
+ return __spreadProps(__spreadValues({}, newData), {
4311
+ content: insert(newData.content, action.destinationIndex, item),
4312
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
4313
+ [action.sourceZone]: remove(
4314
+ newData.zones[action.sourceZone],
4315
+ action.sourceIndex
4316
+ )
4317
+ })
4318
+ });
4319
+ }
4320
+ return __spreadProps(__spreadValues({}, newData), {
4321
+ zones: __spreadProps(__spreadValues({}, newData.zones), {
4322
+ [action.sourceZone]: remove(
4323
+ newData.zones[action.sourceZone],
4324
+ action.sourceIndex
4325
+ ),
4326
+ [action.destinationZone]: insert(
4327
+ newData.zones[action.destinationZone],
4328
+ action.destinationIndex,
4329
+ item
4330
+ )
4331
+ })
4332
+ });
4333
+ }
4334
+ if (action.type === "replace") {
4335
+ return replaceAction(data, action);
4336
+ }
4337
+ if (action.type === "remove") {
4338
+ const item = getItem({ index: action.index, zone: action.zone }, data);
4339
+ const dataWithRelatedRemoved = setupZone(
4340
+ removeRelatedZones(item, data),
4341
+ action.zone
4342
+ );
4343
+ if (action.zone === rootDroppableId) {
4344
+ return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
4345
+ content: remove(data.content, action.index)
4346
+ });
4347
+ }
4348
+ return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
4349
+ zones: __spreadProps(__spreadValues({}, dataWithRelatedRemoved.zones), {
4350
+ [action.zone]: remove(
4351
+ dataWithRelatedRemoved.zones[action.zone],
4352
+ action.index
4353
+ )
4354
+ })
4355
+ });
4356
+ }
4357
+ if (action.type === "registerZone") {
4358
+ if (zoneCache[action.zone]) {
4359
+ return __spreadProps(__spreadValues({}, data), {
4360
+ zones: __spreadProps(__spreadValues({}, data.zones), {
4361
+ [action.zone]: zoneCache[action.zone]
4362
+ })
4363
+ });
4364
+ }
4365
+ return setupZone(data, action.zone);
4366
+ }
4367
+ if (action.type === "unregisterZone") {
4368
+ const _zones = __spreadValues({}, data.zones || {});
4369
+ if (_zones[action.zone]) {
4370
+ zoneCache[action.zone] = _zones[action.zone];
4371
+ delete _zones[action.zone];
4372
+ }
4373
+ return __spreadProps(__spreadValues({}, data), { zones: _zones });
4374
+ }
4375
+ if (action.type === "setData") {
4376
+ if (typeof action.data === "object") {
4377
+ return __spreadValues(__spreadValues({}, data), action.data);
4378
+ }
4379
+ return __spreadValues(__spreadValues({}, data), action.data(data));
4380
+ }
4381
+ return data;
4382
+ }
4383
+
4384
+ // reducer/state.ts
4385
+ init_react_import();
4386
+ var reduceUi = (ui, action) => {
4387
+ if (action.type === "setUi") {
4388
+ if (typeof action.ui === "object") {
4389
+ return __spreadValues(__spreadValues({}, ui), action.ui);
4390
+ }
4391
+ return __spreadValues(__spreadValues({}, ui), action.ui(ui));
4392
+ }
4393
+ if (action.type === "duplicate") {
4394
+ return __spreadProps(__spreadValues({}, ui), {
4395
+ itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
4396
+ });
4397
+ }
4398
+ if (action.type === "remove") {
4399
+ return __spreadProps(__spreadValues({}, ui), {
4400
+ itemSelector: null
4401
+ });
4402
+ }
4403
+ return ui;
4404
+ };
4405
+
4406
+ // reducer/actions.tsx
4407
+ init_react_import();
4408
+
4409
+ // reducer/index.ts
4410
+ function storeInterceptor(reducer, record, onAction) {
4411
+ return (state, action) => {
4412
+ const newAppState = reducer(state, action);
4413
+ const isValidType = ![
4414
+ "registerZone",
4415
+ "unregisterZone",
4416
+ "setData",
4417
+ "setUi",
4418
+ "set"
4419
+ ].includes(action.type);
4420
+ if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
4421
+ if (record) record(newAppState);
4422
+ }
4423
+ onAction == null ? void 0 : onAction(action, newAppState, state);
4424
+ return newAppState;
4425
+ };
4426
+ }
4427
+ var setAction = (state, action) => {
4428
+ if (typeof action.state === "object") {
4429
+ return __spreadValues(__spreadValues({}, state), action.state);
4430
+ }
4431
+ return __spreadValues(__spreadValues({}, state), action.state(state));
4432
+ };
4433
+ function createReducer({
4434
+ config,
4435
+ record,
4436
+ onAction
4437
+ }) {
4438
+ return storeInterceptor(
4439
+ (state, action) => {
4440
+ const data = reduceData(state.data, action, config);
4441
+ const ui = reduceUi(state.ui, action);
4442
+ if (action.type === "set") {
4443
+ return setAction(state, action);
4444
+ }
4445
+ return { data, ui };
4446
+ },
4447
+ record,
4448
+ onAction
4449
+ );
4450
+ }
4451
+
4452
+ // lib/insert-component.ts
4453
+ var insertComponent = (componentType, zone, index, {
4454
+ config,
4455
+ dispatch,
4456
+ resolveData,
4457
+ state
4458
+ }) => {
4459
+ const id = generateId(componentType);
4460
+ const insertActionData = {
4461
+ type: "insert",
4462
+ componentType,
4463
+ destinationIndex: index,
4464
+ destinationZone: zone,
4465
+ id
4466
+ };
4467
+ const insertedData = insertAction(state.data, insertActionData, config);
4468
+ dispatch(__spreadProps(__spreadValues({}, insertActionData), {
4469
+ // Dispatch insert rather set, as user's may rely on this via onAction
4470
+ // We must always record history here so the insert is added to user history
4471
+ // If the user has defined a resolveData method, they will end up with 2 history
4472
+ // entries on insert - one for the initial insert, and one when the data resolves
4473
+ recordHistory: true
4474
+ }));
4475
+ const itemSelector = {
4476
+ index,
4477
+ zone
4478
+ };
4479
+ dispatch({ type: "setUi", ui: { itemSelector } });
4480
+ resolveData({
4481
+ data: insertedData,
4482
+ ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector })
4483
+ });
4484
+ };
4485
+
4486
+ // components/DragDropContext/index.tsx
4487
+ import { useDebouncedCallback as useDebouncedCallback2 } from "use-debounce";
4488
+ import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
4489
+
4490
+ // lib/dnd/PointerSensor.ts
4491
+ init_react_import();
4492
+ import { batch, effect } from "@dnd-kit/state";
4493
+ import { Sensor, configurator } from "@dnd-kit/abstract";
4494
+ import {
4495
+ exceedsDistance
4496
+ } from "@dnd-kit/geometry";
4497
+ import {
4498
+ getDocument,
4499
+ isElement,
4500
+ isHTMLElement,
4501
+ isPointerEvent,
4502
+ Listeners,
4503
+ getFrameTransform
4504
+ } from "@dnd-kit/dom/utilities";
4505
+ var _clearTimeout;
4506
+ var _PointerSensor = class _PointerSensor extends Sensor {
4507
+ constructor(manager, options) {
4508
+ super(manager);
4509
+ this.manager = manager;
4510
+ this.options = options;
4511
+ this.listeners = new Listeners();
4512
+ this.cleanup = /* @__PURE__ */ new Set();
4513
+ this.source = void 0;
4514
+ __privateAdd(this, _clearTimeout);
4515
+ this.handleCancel = this.handleCancel.bind(this);
4516
+ this.handlePointerUp = this.handlePointerUp.bind(this);
4517
+ this.handleKeyDown = this.handleKeyDown.bind(this);
4518
+ effect(() => {
4519
+ const unbindGlobal = this.bindGlobal(options != null ? options : {});
4520
+ return () => {
4521
+ unbindGlobal();
4522
+ };
4523
+ });
4602
4524
  }
4603
- if (action.type === "duplicate") {
4604
- const item = getItem(
4605
- { index: action.sourceIndex, zone: action.sourceZone },
4606
- data
4607
- );
4608
- const newItem = __spreadProps(__spreadValues({}, item), {
4609
- props: __spreadProps(__spreadValues({}, item.props), {
4610
- id: generateId(item.type)
4611
- })
4525
+ bind(source, options = this.options) {
4526
+ const unbind = effect(() => {
4527
+ var _a;
4528
+ const target = (_a = source.handle) != null ? _a : source.element;
4529
+ const listener = (event) => {
4530
+ if (isPointerEvent(event)) {
4531
+ this.handlePointerDown(event, source, options);
4532
+ }
4533
+ };
4534
+ if (target) {
4535
+ patchWindow(target.ownerDocument.defaultView);
4536
+ target.addEventListener("pointerdown", listener);
4537
+ return () => {
4538
+ target.removeEventListener("pointerdown", listener);
4539
+ };
4540
+ }
4612
4541
  });
4613
- const dataWithRelatedDuplicated = duplicateRelatedZones(
4614
- item,
4615
- data,
4616
- newItem.props.id
4617
- );
4618
- if (action.sourceZone === rootDroppableId) {
4619
- return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
4620
- content: insert(data.content, action.sourceIndex + 1, newItem)
4621
- });
4542
+ return unbind;
4543
+ }
4544
+ bindGlobal(options) {
4545
+ const documents = /* @__PURE__ */ new Set();
4546
+ for (const draggable of this.manager.registry.draggables.value) {
4547
+ if (draggable.element) {
4548
+ documents.add(getDocument(draggable.element));
4549
+ }
4622
4550
  }
4623
- return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
4624
- zones: __spreadProps(__spreadValues({}, dataWithRelatedDuplicated.zones), {
4625
- [action.sourceZone]: insert(
4626
- dataWithRelatedDuplicated.zones[action.sourceZone],
4627
- action.sourceIndex + 1,
4628
- newItem
4629
- )
4630
- })
4631
- });
4551
+ for (const droppable of this.manager.registry.droppables.value) {
4552
+ if (droppable.element) {
4553
+ documents.add(getDocument(droppable.element));
4554
+ }
4555
+ }
4556
+ const unbindFns = Array.from(documents).map(
4557
+ (doc) => this.listeners.bind(doc, [
4558
+ {
4559
+ type: "pointermove",
4560
+ listener: (event) => this.handlePointerMove(event, doc, options)
4561
+ },
4562
+ {
4563
+ type: "pointerup",
4564
+ listener: this.handlePointerUp,
4565
+ options: {
4566
+ capture: true
4567
+ }
4568
+ },
4569
+ {
4570
+ // Cancel activation if there is a competing Drag and Drop interaction
4571
+ type: "dragstart",
4572
+ listener: this.handleDragStart
4573
+ }
4574
+ ])
4575
+ );
4576
+ return () => {
4577
+ unbindFns.forEach((unbind) => unbind());
4578
+ };
4632
4579
  }
4633
- if (action.type === "reorder") {
4634
- return reorderAction(data, action);
4580
+ handlePointerDown(event, source, options = {}) {
4581
+ if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled) {
4582
+ return;
4583
+ }
4584
+ const offset = getFrameTransform(source.element);
4585
+ this.initialCoordinates = {
4586
+ x: event.clientX * offset.scaleX + offset.x,
4587
+ y: event.clientY * offset.scaleY + offset.y
4588
+ };
4589
+ this.source = source;
4590
+ const { activationConstraints } = options;
4591
+ const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
4592
+ event.stopImmediatePropagation();
4593
+ if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
4594
+ this.handleStart(source, event);
4595
+ } else {
4596
+ const { delay } = constraints;
4597
+ if (delay) {
4598
+ const timeout3 = setTimeout(
4599
+ () => this.handleStart(source, event),
4600
+ delay.value
4601
+ );
4602
+ __privateSet(this, _clearTimeout, () => {
4603
+ clearTimeout(timeout3);
4604
+ __privateSet(this, _clearTimeout, void 0);
4605
+ });
4606
+ }
4607
+ }
4608
+ const cleanup = () => {
4609
+ var _a;
4610
+ (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
4611
+ this.initialCoordinates = void 0;
4612
+ this.source = void 0;
4613
+ };
4614
+ this.cleanup.add(cleanup);
4635
4615
  }
4636
- if (action.type === "move") {
4637
- if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
4638
- return data;
4616
+ handlePointerMove(event, doc, options) {
4617
+ if (!this.source) {
4618
+ return;
4639
4619
  }
4640
- const newData = setupZone(
4641
- setupZone(data, action.sourceZone),
4642
- action.destinationZone
4643
- );
4644
- const item = getItem(
4645
- { zone: action.sourceZone, index: action.sourceIndex },
4646
- newData
4647
- );
4648
- if (action.sourceZone === action.destinationZone) {
4649
- return reorderAction(data, __spreadProps(__spreadValues({}, action), { type: "reorder" }));
4620
+ const ownerDocument = this.source.element && getDocument(this.source.element);
4621
+ if (doc !== ownerDocument) {
4622
+ return;
4650
4623
  }
4651
- if (action.sourceZone === rootDroppableId) {
4652
- return __spreadProps(__spreadValues({}, newData), {
4653
- content: remove(newData.content, action.sourceIndex),
4654
- zones: __spreadProps(__spreadValues({}, newData.zones), {
4655
- [action.destinationZone]: insert(
4656
- newData.zones[action.destinationZone],
4657
- action.destinationIndex,
4658
- item
4659
- )
4660
- })
4661
- });
4624
+ const coordinates = {
4625
+ x: event.clientX,
4626
+ y: event.clientY
4627
+ };
4628
+ const offset = getFrameTransform(this.source.element);
4629
+ coordinates.x = coordinates.x * offset.scaleX + offset.x;
4630
+ coordinates.y = coordinates.y * offset.scaleY + offset.y;
4631
+ if (this.manager.dragOperation.status.dragging) {
4632
+ event.preventDefault();
4633
+ event.stopPropagation();
4634
+ this.manager.actions.move({ to: coordinates });
4635
+ return;
4662
4636
  }
4663
- if (action.destinationZone === rootDroppableId) {
4664
- return __spreadProps(__spreadValues({}, newData), {
4665
- content: insert(newData.content, action.destinationIndex, item),
4666
- zones: __spreadProps(__spreadValues({}, newData.zones), {
4667
- [action.sourceZone]: remove(
4668
- newData.zones[action.sourceZone],
4669
- action.sourceIndex
4670
- )
4671
- })
4672
- });
4637
+ if (!this.initialCoordinates) {
4638
+ return;
4673
4639
  }
4674
- return __spreadProps(__spreadValues({}, newData), {
4675
- zones: __spreadProps(__spreadValues({}, newData.zones), {
4676
- [action.sourceZone]: remove(
4677
- newData.zones[action.sourceZone],
4678
- action.sourceIndex
4679
- ),
4680
- [action.destinationZone]: insert(
4681
- newData.zones[action.destinationZone],
4682
- action.destinationIndex,
4683
- item
4684
- )
4685
- })
4686
- });
4687
- }
4688
- if (action.type === "replace") {
4689
- return replaceAction(data, action);
4690
- }
4691
- if (action.type === "remove") {
4692
- const item = getItem({ index: action.index, zone: action.zone }, data);
4693
- const dataWithRelatedRemoved = setupZone(
4694
- removeRelatedZones(item, data),
4695
- action.zone
4696
- );
4697
- if (action.zone === rootDroppableId) {
4698
- return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
4699
- content: remove(data.content, action.index)
4700
- });
4640
+ const delta = {
4641
+ x: coordinates.x - this.initialCoordinates.x,
4642
+ y: coordinates.y - this.initialCoordinates.y
4643
+ };
4644
+ const { activationConstraints } = options;
4645
+ const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
4646
+ const { distance, delay } = constraints != null ? constraints : {};
4647
+ if (distance) {
4648
+ if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
4649
+ return this.handleCancel();
4650
+ }
4651
+ if (exceedsDistance(delta, distance.value)) {
4652
+ return this.handleStart(this.source, event);
4653
+ }
4701
4654
  }
4702
- return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
4703
- zones: __spreadProps(__spreadValues({}, dataWithRelatedRemoved.zones), {
4704
- [action.zone]: remove(
4705
- dataWithRelatedRemoved.zones[action.zone],
4706
- action.index
4707
- )
4708
- })
4709
- });
4710
- }
4711
- if (action.type === "registerZone") {
4712
- if (zoneCache[action.zone]) {
4713
- return __spreadProps(__spreadValues({}, data), {
4714
- zones: __spreadProps(__spreadValues({}, data.zones), {
4715
- [action.zone]: zoneCache[action.zone]
4716
- })
4717
- });
4655
+ if (delay) {
4656
+ if (exceedsDistance(delta, delay.tolerance)) {
4657
+ return this.handleCancel();
4658
+ }
4718
4659
  }
4719
- return setupZone(data, action.zone);
4720
4660
  }
4721
- if (action.type === "unregisterZone") {
4722
- const _zones = __spreadValues({}, data.zones || {});
4723
- if (_zones[action.zone]) {
4724
- zoneCache[action.zone] = _zones[action.zone];
4725
- delete _zones[action.zone];
4661
+ handlePointerUp(event) {
4662
+ if (!this.source) {
4663
+ return;
4726
4664
  }
4727
- return __spreadProps(__spreadValues({}, data), { zones: _zones });
4728
- }
4729
- if (action.type === "setData") {
4730
- if (typeof action.data === "object") {
4731
- return __spreadValues(__spreadValues({}, data), action.data);
4665
+ event.preventDefault();
4666
+ event.stopPropagation();
4667
+ const { status } = this.manager.dragOperation;
4668
+ if (!status.idle) {
4669
+ const canceled = !status.initialized;
4670
+ this.manager.actions.stop({ canceled });
4732
4671
  }
4733
- return __spreadValues(__spreadValues({}, data), action.data(data));
4672
+ this.cleanup.forEach((cleanup) => cleanup());
4673
+ this.cleanup.clear();
4734
4674
  }
4735
- return data;
4736
- }
4737
-
4738
- // reducer/state.ts
4739
- init_react_import();
4740
- var reduceUi = (ui, action) => {
4741
- if (action.type === "setUi") {
4742
- if (typeof action.ui === "object") {
4743
- return __spreadValues(__spreadValues({}, ui), action.ui);
4675
+ handleKeyDown(event) {
4676
+ if (event.key === "Escape") {
4677
+ event.preventDefault();
4678
+ this.handleCancel();
4744
4679
  }
4745
- return __spreadValues(__spreadValues({}, ui), action.ui(ui));
4746
4680
  }
4747
- if (action.type === "duplicate") {
4748
- return __spreadProps(__spreadValues({}, ui), {
4749
- itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
4681
+ handleStart(source, event) {
4682
+ var _a;
4683
+ const { manager, initialCoordinates } = this;
4684
+ (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
4685
+ if (!initialCoordinates || manager.dragOperation.status.initialized) {
4686
+ return;
4687
+ }
4688
+ if (event.defaultPrevented) {
4689
+ return;
4690
+ }
4691
+ event.preventDefault();
4692
+ batch(() => {
4693
+ manager.actions.setDragSource(source.id);
4694
+ manager.actions.start({ coordinates: initialCoordinates, event });
4750
4695
  });
4696
+ const ownerDocument = getDocument(event.target);
4697
+ const unbind = this.listeners.bind(ownerDocument, [
4698
+ {
4699
+ // Prevent scrolling on touch devices
4700
+ type: "touchmove",
4701
+ listener: preventDefault,
4702
+ options: {
4703
+ passive: false
4704
+ }
4705
+ },
4706
+ {
4707
+ // Prevent click events
4708
+ type: "click",
4709
+ listener: preventDefault
4710
+ },
4711
+ {
4712
+ type: "keydown",
4713
+ listener: this.handleKeyDown
4714
+ }
4715
+ ]);
4716
+ ownerDocument.body.setPointerCapture(event.pointerId);
4717
+ this.cleanup.add(unbind);
4751
4718
  }
4752
- if (action.type === "remove") {
4753
- return __spreadProps(__spreadValues({}, ui), {
4754
- itemSelector: null
4755
- });
4719
+ handleDragStart(event) {
4720
+ const { target } = event;
4721
+ if (!isElement(target)) {
4722
+ return;
4723
+ }
4724
+ const isNativeDraggable = isHTMLElement(target) && target.draggable && target.getAttribute("draggable") === "true";
4725
+ if (isNativeDraggable) {
4726
+ this.handleCancel();
4727
+ } else {
4728
+ preventDefault(event);
4729
+ }
4756
4730
  }
4757
- return ui;
4758
- };
4759
-
4760
- // reducer/actions.tsx
4761
- init_react_import();
4762
-
4763
- // reducer/index.ts
4764
- function storeInterceptor(reducer, record, onAction) {
4765
- return (state, action) => {
4766
- const newAppState = reducer(state, action);
4767
- const isValidType = ![
4768
- "registerZone",
4769
- "unregisterZone",
4770
- "setData",
4771
- "setUi",
4772
- "set"
4773
- ].includes(action.type);
4774
- if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
4775
- if (record) record(newAppState);
4731
+ handleCancel() {
4732
+ const { dragOperation } = this.manager;
4733
+ if (dragOperation.status.initialized) {
4734
+ this.manager.actions.stop({ canceled: true });
4776
4735
  }
4777
- onAction == null ? void 0 : onAction(action, newAppState, state);
4778
- return newAppState;
4779
- };
4780
- }
4781
- var setAction = (state, action) => {
4782
- if (typeof action.state === "object") {
4783
- return __spreadValues(__spreadValues({}, state), action.state);
4736
+ this.cleanup.forEach((cleanup) => cleanup());
4737
+ this.cleanup.clear();
4738
+ }
4739
+ destroy() {
4740
+ this.listeners.clear();
4784
4741
  }
4785
- return __spreadValues(__spreadValues({}, state), action.state(state));
4786
4742
  };
4787
- function createReducer({
4788
- config,
4789
- record,
4790
- onAction
4791
- }) {
4792
- return storeInterceptor(
4793
- (state, action) => {
4794
- const data = reduceData(state.data, action, config);
4795
- const ui = reduceUi(state.ui, action);
4796
- if (action.type === "set") {
4797
- return setAction(state, action);
4798
- }
4799
- return { data, ui };
4800
- },
4801
- record,
4802
- onAction
4803
- );
4743
+ _clearTimeout = new WeakMap();
4744
+ _PointerSensor.configure = configurator(_PointerSensor);
4745
+ var PointerSensor = _PointerSensor;
4746
+ function preventDefault(event) {
4747
+ event.preventDefault();
4804
4748
  }
4805
-
4806
- // lib/insert-component.ts
4807
- var insertComponent = (componentType, zone, index, {
4808
- config,
4809
- dispatch,
4810
- resolveData,
4811
- state
4812
- }) => {
4813
- const id = generateId(componentType);
4814
- const insertActionData = {
4815
- type: "insert",
4816
- componentType,
4817
- destinationIndex: index,
4818
- destinationZone: zone,
4819
- id
4820
- };
4821
- const insertedData = insertAction(state.data, insertActionData, config);
4822
- dispatch(__spreadProps(__spreadValues({}, insertActionData), {
4823
- // Dispatch insert rather set, as user's may rely on this via onAction
4824
- // We must always record history here so the insert is added to user history
4825
- // If the user has defined a resolveData method, they will end up with 2 history
4826
- // entries on insert - one for the initial insert, and one when the data resolves
4827
- recordHistory: true
4828
- }));
4829
- const itemSelector = {
4830
- index,
4831
- zone
4832
- };
4833
- dispatch({ type: "setUi", ui: { itemSelector } });
4834
- resolveData({
4835
- data: insertedData,
4836
- ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector })
4837
- });
4838
- };
4839
-
4840
- // components/DragDropContext/index.tsx
4841
- import { useDebouncedCallback as useDebouncedCallback2 } from "use-debounce";
4842
- import { createStore as createStore3 } from "zustand";
4843
-
4844
- // lib/get-deep-dir.ts
4845
- init_react_import();
4846
- function getDeepDir(el) {
4847
- function findDir(node) {
4848
- if (!node) return "ltr";
4849
- const d = node.getAttribute("dir");
4850
- return d || findDir(node.parentElement);
4749
+ function noop() {
4750
+ }
4751
+ var windows = /* @__PURE__ */ new WeakSet();
4752
+ function patchWindow(window2) {
4753
+ if (!window2 || windows.has(window2)) {
4754
+ return;
4851
4755
  }
4852
- return el ? findDir(el) : "ltr";
4756
+ window2.addEventListener("touchmove", noop, {
4757
+ capture: false,
4758
+ passive: false
4759
+ });
4760
+ windows.add(window2);
4853
4761
  }
4854
4762
 
4855
4763
  // components/DragDropContext/index.tsx
4764
+ import { createStore as createStore3 } from "zustand";
4856
4765
  import { jsx as jsx23 } from "react/jsx-runtime";
4857
4766
  var DEBUG3 = false;
4858
4767
  var dragListenerContext = createContext4({
@@ -4892,7 +4801,7 @@ var DragDropContextClient = ({
4892
4801
  const { data } = state;
4893
4802
  const debouncedParamsRef = useRef3(null);
4894
4803
  const tempDisableFallback = useTempDisableFallback(100);
4895
- const [zoneStore] = useState18(
4804
+ const [zoneStore] = useState17(
4896
4805
  () => createStore3(() => ({
4897
4806
  zoneDepthIndex: {},
4898
4807
  nextZoneDepthIndex: {},
@@ -4961,7 +4870,7 @@ var DragDropContextClient = ({
4961
4870
  );
4962
4871
  }
4963
4872
  }, []);
4964
- const [plugins] = useState18(() => [
4873
+ const [plugins] = useState17(() => [
4965
4874
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4966
4875
  createNestedDroppablePlugin(
4967
4876
  {
@@ -5008,9 +4917,27 @@ var DragDropContextClient = ({
5008
4917
  id
5009
4918
  )
5010
4919
  ]);
5011
- const sensors = useSensors();
5012
- const [dragListeners, setDragListeners] = useState18({});
5013
- const [pathData, setPathData] = useState18();
4920
+ const [sensors] = useState17(() => [
4921
+ PointerSensor.configure({
4922
+ activationConstraints(event, source) {
4923
+ var _a;
4924
+ const { pointerType, target } = event;
4925
+ if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
4926
+ return void 0;
4927
+ }
4928
+ const delay = { value: 200, tolerance: 10 };
4929
+ if (pointerType === "touch") {
4930
+ return { delay };
4931
+ }
4932
+ return {
4933
+ delay,
4934
+ distance: { value: 5 }
4935
+ };
4936
+ }
4937
+ })
4938
+ ]);
4939
+ const [dragListeners, setDragListeners] = useState17({});
4940
+ const [pathData, setPathData] = useState17();
5014
4941
  const dragMode = useRef3(null);
5015
4942
  const registerPath = useCallback11(
5016
4943
  (id2, selector, label) => {
@@ -5071,13 +4998,6 @@ var DragDropContextClient = ({
5071
4998
  (_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
5072
4999
  fn(event, manager);
5073
5000
  });
5074
- dispatch({
5075
- type: "setUi",
5076
- ui: {
5077
- itemSelector: null,
5078
- isDragging: false
5079
- }
5080
- });
5081
5001
  return;
5082
5002
  }
5083
5003
  if (thisPreview) {
@@ -5135,8 +5055,7 @@ var DragDropContextClient = ({
5135
5055
  targetZone = targetData.zone;
5136
5056
  targetIndex = targetData.index;
5137
5057
  const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
5138
- const dir = getDeepDir(target.element);
5139
- 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";
5058
+ const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
5140
5059
  if (targetIndex >= sourceIndex && sourceZone === targetZone) {
5141
5060
  targetIndex = targetIndex - 1;
5142
5061
  }
@@ -5332,7 +5251,7 @@ var DrawerItem = ({
5332
5251
  isDragDisabled
5333
5252
  }) => {
5334
5253
  const resolvedId = id || name;
5335
- const [dynamicId, setDynamicId] = useState19(generateId(resolvedId));
5254
+ const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
5336
5255
  if (typeof index !== "undefined") {
5337
5256
  console.error(
5338
5257
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5398,7 +5317,7 @@ import {
5398
5317
  useEffect as useEffect24,
5399
5318
  useMemo as useMemo19,
5400
5319
  useReducer,
5401
- useState as useState27
5320
+ useState as useState26
5402
5321
  } from "react";
5403
5322
 
5404
5323
  // components/SidebarSection/index.tsx
@@ -5406,7 +5325,7 @@ init_react_import();
5406
5325
 
5407
5326
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
5408
5327
  init_react_import();
5409
- var styles_module_default13 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
5328
+ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
5410
5329
 
5411
5330
  // lib/use-breadcrumbs.ts
5412
5331
  init_react_import();
@@ -5585,7 +5504,7 @@ function MenuBar({
5585
5504
 
5586
5505
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
5587
5506
  init_react_import();
5588
- var styles_module_default15 = { "Puck": "_Puck_11o75_19", "Puck-portal": "_Puck-portal_11o75_24", "PuckLayout-inner": "_PuckLayout-inner_11o75_31", "PuckLayout--mounted": "_PuckLayout--mounted_11o75_43", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_11o75_47", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_11o75_53", "PuckLayout-mounted": "_PuckLayout-mounted_11o75_67", "PuckLayout": "_PuckLayout_11o75_31", "PuckLayout-header": "_PuckLayout-header_11o75_108", "PuckLayout-headerInner": "_PuckLayout-headerInner_11o75_117", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_11o75_127", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_11o75_134", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_11o75_135", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_11o75_139", "PuckLayout-headerPath": "_PuckLayout-headerPath_11o75_143", "PuckLayout-headerTools": "_PuckLayout-headerTools_11o75_150", "PuckLayout-menuButton": "_PuckLayout-menuButton_11o75_156", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_11o75_161", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_11o75_135", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_11o75_134" };
5507
+ var styles_module_default15 = { "Puck": "_Puck_12s9r_19", "Puck-portal": "_Puck-portal_12s9r_24", "PuckLayout-inner": "_PuckLayout-inner_12s9r_31", "PuckLayout--mounted": "_PuckLayout--mounted_12s9r_43", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_12s9r_47", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_12s9r_53", "PuckLayout-mounted": "_PuckLayout-mounted_12s9r_67", "PuckLayout": "_PuckLayout_12s9r_31", "PuckLayout-header": "_PuckLayout-header_12s9r_108", "PuckLayout-headerInner": "_PuckLayout-headerInner_12s9r_117", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_12s9r_127", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_12s9r_134", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_12s9r_135", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_12s9r_139", "PuckLayout-headerPath": "_PuckLayout-headerPath_12s9r_143", "PuckLayout-headerTools": "_PuckLayout-headerTools_12s9r_150", "PuckLayout-menuButton": "_PuckLayout-menuButton_12s9r_156", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_12s9r_161", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_12s9r_135", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_12s9r_134" };
5589
5508
 
5590
5509
  // components/Puck/components/Fields/index.tsx
5591
5510
  init_react_import();
@@ -5599,7 +5518,7 @@ import { useMemo as useMemo12 } from "react";
5599
5518
 
5600
5519
  // lib/use-resolved-fields.ts
5601
5520
  init_react_import();
5602
- import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef5, useState as useState20 } from "react";
5521
+ import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef5, useState as useState19 } from "react";
5603
5522
 
5604
5523
  // lib/use-parent.ts
5605
5524
  init_react_import();
@@ -5647,10 +5566,7 @@ var selectorIs = (a, b) => (a == null ? void 0 : a.zone) === (b == null ? void 0
5647
5566
  var defaultPageFields = {
5648
5567
  title: { type: "text" }
5649
5568
  };
5650
- var useResolvedFields = ({
5651
- _skipValueCheck,
5652
- _skipIdCheck
5653
- } = {}) => {
5569
+ var useResolvedFields = () => {
5654
5570
  var _a, _b;
5655
5571
  const { selectedItem, state, config } = useAppContext();
5656
5572
  const parent = useParent();
@@ -5662,12 +5578,9 @@ var useResolvedFields = ({
5662
5578
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5663
5579
  );
5664
5580
  const rootProps = data.root.props || data.root;
5665
- const [lastSelectedData, setLastSelectedData] = useState20({});
5666
- const [resolvedFields, setResolvedFields] = useState20({
5667
- fields: defaultFields,
5668
- id: selectedItem == null ? void 0 : selectedItem.props.id
5669
- });
5670
- const [fieldsLoading, setFieldsLoading] = useState20(false);
5581
+ const [lastSelectedData, setLastSelectedData] = useState19({});
5582
+ const [resolvedFields, setResolvedFields] = useState19(defaultFields);
5583
+ const [fieldsLoading, setFieldsLoading] = useState19(false);
5671
5584
  const lastFields = useRef5(defaultFields);
5672
5585
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5673
5586
  const componentData = useMemo11(
@@ -5721,21 +5634,17 @@ var useResolvedFields = ({
5721
5634
  if (hasResolver) {
5722
5635
  setFieldsLoading(true);
5723
5636
  resolveFields(defaultFields).then((fields) => {
5724
- setResolvedFields({
5725
- fields: fields || {},
5726
- id: selectedItem == null ? void 0 : selectedItem.props.id
5727
- });
5637
+ setResolvedFields(fields || {});
5728
5638
  lastFields.current = fields;
5729
5639
  setFieldsLoading(false);
5730
5640
  });
5731
5641
  return;
5732
5642
  }
5733
5643
  }
5734
- setResolvedFields({ fields: defaultFields, id: selectedItem == null ? void 0 : selectedItem.props.id });
5644
+ setResolvedFields(defaultFields);
5735
5645
  }, [
5736
5646
  defaultFields,
5737
5647
  state.ui.itemSelector,
5738
- selectedItem,
5739
5648
  hasResolver,
5740
5649
  parent,
5741
5650
  resolveFields
@@ -5750,7 +5659,6 @@ var useResolvedFields = ({
5750
5659
  useOnValueChange(
5751
5660
  { data, parent, itemSelector: state.ui.itemSelector },
5752
5661
  () => {
5753
- if (_skipValueCheck) return;
5754
5662
  triggerResolver();
5755
5663
  },
5756
5664
  (a, b) => JSON.stringify(a) === JSON.stringify(b)
@@ -5758,10 +5666,7 @@ var useResolvedFields = ({
5758
5666
  useEffect17(() => {
5759
5667
  triggerResolver();
5760
5668
  }, []);
5761
- if (resolvedFields.id !== (selectedItem == null ? void 0 : selectedItem.props.id) && !_skipIdCheck) {
5762
- return [defaultFields, fieldsLoading];
5763
- }
5764
- return [resolvedFields.fields, fieldsLoading];
5669
+ return [resolvedFields, fieldsLoading];
5765
5670
  };
5766
5671
 
5767
5672
  // components/Puck/components/Fields/index.tsx
@@ -5911,14 +5816,14 @@ init_react_import();
5911
5816
 
5912
5817
  // lib/use-component-list.tsx
5913
5818
  init_react_import();
5914
- import { useEffect as useEffect18, useState as useState21 } from "react";
5819
+ import { useEffect as useEffect18, useState as useState20 } from "react";
5915
5820
 
5916
5821
  // components/ComponentList/index.tsx
5917
5822
  init_react_import();
5918
5823
 
5919
5824
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
5920
5825
  init_react_import();
5921
- 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" };
5826
+ var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
5922
5827
 
5923
5828
  // components/ComponentList/index.tsx
5924
5829
  import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
@@ -5978,7 +5883,7 @@ ComponentList.Item = ComponentListItem;
5978
5883
  // lib/use-component-list.tsx
5979
5884
  import { jsx as jsx29 } from "react/jsx-runtime";
5980
5885
  var useComponentList = (config, ui) => {
5981
- const [componentList, setComponentList] = useState21();
5886
+ const [componentList, setComponentList] = useState20();
5982
5887
  useEffect18(() => {
5983
5888
  var _a, _b, _c;
5984
5889
  if (Object.keys(ui.componentList).length > 0) {
@@ -6067,7 +5972,7 @@ import {
6067
5972
  createContext as createContext5,
6068
5973
  useContext as useContext10,
6069
5974
  useEffect as useEffect19,
6070
- useState as useState22
5975
+ useState as useState21
6071
5976
  } from "react";
6072
5977
  import hash from "object-hash";
6073
5978
  import { createPortal as createPortal3 } from "react-dom";
@@ -6291,9 +6196,9 @@ function AutoFrame(_a) {
6291
6196
  "onStylesLoaded",
6292
6197
  "frameRef"
6293
6198
  ]);
6294
- const [loaded, setLoaded] = useState22(false);
6295
- const [ctx, setCtx] = useState22({});
6296
- const [mountTarget, setMountTarget] = useState22();
6199
+ const [loaded, setLoaded] = useState21(false);
6200
+ const [ctx, setCtx] = useState21({});
6201
+ const [mountTarget, setMountTarget] = useState21();
6297
6202
  useEffect19(() => {
6298
6203
  var _a2;
6299
6204
  if (frameRef.current) {
@@ -6356,14 +6261,13 @@ function Render({
6356
6261
  config.root.render,
6357
6262
  __spreadProps(__spreadValues({}, rootProps), {
6358
6263
  puck: {
6359
- renderDropZone: DropZonePure,
6360
- isEditing: false,
6361
- dragRef: null
6264
+ renderDropZone: DropZone,
6265
+ isEditing: false
6362
6266
  },
6363
6267
  title,
6364
6268
  editMode: false,
6365
6269
  id: "puck-root",
6366
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
6270
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
6367
6271
  })
6368
6272
  )
6369
6273
  }
@@ -6379,7 +6283,7 @@ function Render({
6379
6283
  depth: 0,
6380
6284
  path: []
6381
6285
  },
6382
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
6286
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
6383
6287
  }
6384
6288
  );
6385
6289
  }
@@ -6439,12 +6343,12 @@ var Preview2 = ({ id = "puck-preview" }) => {
6439
6343
  Page,
6440
6344
  __spreadProps(__spreadValues({}, rootProps), {
6441
6345
  puck: {
6442
- renderDropZone: DropZonePure,
6346
+ renderDropZone: DropZone,
6443
6347
  isEditing: true,
6444
6348
  dragRef: null
6445
6349
  },
6446
6350
  editMode: true,
6447
- children: /* @__PURE__ */ jsx33(DropZonePure, { zone: rootDroppableId })
6351
+ children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
6448
6352
  })
6449
6353
  ) : /* @__PURE__ */ jsx33(Render, { data: state.data, config });
6450
6354
  return /* @__PURE__ */ jsx33(
@@ -6516,7 +6420,7 @@ init_react_import();
6516
6420
 
6517
6421
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
6518
6422
  init_react_import();
6519
- var styles_module_default19 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
6423
+ var styles_module_default19 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
6520
6424
 
6521
6425
  // lib/scroll-into-view.ts
6522
6426
  init_react_import();
@@ -6812,19 +6716,19 @@ function usePuckHistory({
6812
6716
 
6813
6717
  // lib/use-history-store.ts
6814
6718
  init_react_import();
6815
- import { useState as useState23 } from "react";
6719
+ import { useState as useState22 } from "react";
6816
6720
  import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
6817
6721
  var EMPTY_HISTORY_INDEX = 0;
6818
6722
  function useHistoryStore(initialHistory) {
6819
6723
  var _a, _b;
6820
- const [histories, setHistories] = useState23(
6724
+ const [histories, setHistories] = useState22(
6821
6725
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6822
6726
  );
6823
6727
  const updateHistories = (histories2) => {
6824
6728
  setHistories(histories2);
6825
6729
  setIndex(histories2.length - 1);
6826
6730
  };
6827
- const [index, setIndex] = useState23(
6731
+ const [index, setIndex] = useState22(
6828
6732
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6829
6733
  );
6830
6734
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6989,16 +6893,16 @@ import {
6989
6893
  useEffect as useEffect22,
6990
6894
  useMemo as useMemo17,
6991
6895
  useRef as useRef8,
6992
- useState as useState25
6896
+ useState as useState24
6993
6897
  } from "react";
6994
6898
 
6995
6899
  // components/ViewportControls/index.tsx
6996
6900
  init_react_import();
6997
- import { useEffect as useEffect21, useMemo as useMemo16, useState as useState24 } from "react";
6901
+ import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
6998
6902
 
6999
6903
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7000
6904
  init_react_import();
7001
- 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" };
6905
+ var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
7002
6906
 
7003
6907
  // components/ViewportControls/index.tsx
7004
6908
  import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -7017,7 +6921,7 @@ var ViewportButton = ({
7017
6921
  onClick
7018
6922
  }) => {
7019
6923
  const { state } = useAppContext();
7020
- const [isActive, setIsActive] = useState24(false);
6924
+ const [isActive, setIsActive] = useState23(false);
7021
6925
  useEffect21(() => {
7022
6926
  setIsActive(width === state.ui.viewports.current.width);
7023
6927
  }, [width, state.ui.viewports.current.width]);
@@ -7178,7 +7082,7 @@ var Canvas = () => {
7178
7082
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
7179
7083
  const { ui } = state;
7180
7084
  const frameRef = useRef8(null);
7181
- const [showTransition, setShowTransition] = useState25(false);
7085
+ const [showTransition, setShowTransition] = useState24(false);
7182
7086
  const defaultRender = useMemo17(() => {
7183
7087
  const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
7184
7088
  return PuckDefault;
@@ -7233,7 +7137,7 @@ var Canvas = () => {
7233
7137
  window.removeEventListener("resize", cb);
7234
7138
  };
7235
7139
  }, []);
7236
- const [showLoader, setShowLoader] = useState25(false);
7140
+ const [showLoader, setShowLoader] = useState24(false);
7237
7141
  useEffect22(() => {
7238
7142
  setTimeout(() => {
7239
7143
  setShowLoader(true);
@@ -7363,10 +7267,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
7363
7267
 
7364
7268
  // lib/use-inject-css.ts
7365
7269
  init_react_import();
7366
- import { useEffect as useEffect23, useState as useState26 } from "react";
7270
+ import { useEffect as useEffect23, useState as useState25 } from "react";
7367
7271
  var styles = ``;
7368
7272
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7369
- const [el, setEl] = useState26();
7273
+ const [el, setEl] = useState25();
7370
7274
  useEffect23(() => {
7371
7275
  setEl(document.createElement("style"));
7372
7276
  }, []);
@@ -7450,7 +7354,7 @@ function Puck({
7450
7354
  waitForStyles: true
7451
7355
  }, _iframe);
7452
7356
  useInjectGlobalCss(iframe.enabled);
7453
- const [generatedAppState] = useState27(() => {
7357
+ const [generatedAppState] = useState26(() => {
7454
7358
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
7455
7359
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7456
7360
  let clientUiState = {};
@@ -7522,7 +7426,7 @@ function Puck({
7522
7426
  histories,
7523
7427
  index: initialHistoryIndex
7524
7428
  });
7525
- const [reducer] = useState27(
7429
+ const [reducer] = useState26(
7526
7430
  () => createReducer({
7527
7431
  config,
7528
7432
  record: historyStore.record,
@@ -7540,7 +7444,7 @@ function Puck({
7540
7444
  historyStore,
7541
7445
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7542
7446
  });
7543
- const [menuOpen, setMenuOpen] = useState27(false);
7447
+ const [menuOpen, setMenuOpen] = useState26(false);
7544
7448
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7545
7449
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7546
7450
  useEffect24(() => {
@@ -7627,7 +7531,7 @@ function Puck({
7627
7531
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7628
7532
  [loadedOverrides]
7629
7533
  );
7630
- const [mounted, setMounted] = useState27(false);
7534
+ const [mounted, setMounted] = useState26(false);
7631
7535
  useEffect24(() => {
7632
7536
  setMounted(true);
7633
7537
  }, []);
@@ -7892,12 +7796,14 @@ export {
7892
7796
  Button,
7893
7797
  Drawer,
7894
7798
  DropZone,
7799
+ DropZoneProvider,
7895
7800
  FieldLabel,
7896
7801
  Group,
7897
7802
  IconButton,
7898
7803
  Label,
7899
7804
  Puck,
7900
7805
  Render,
7806
+ dropZoneContext,
7901
7807
  migrate,
7902
7808
  overrideKeys,
7903
7809
  resolveAllData,