@measured/puck 0.18.2-canary.b399c21 → 0.18.2-canary.b9ce5b7
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.css +268 -279
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1301 -1395
- package/dist/index.mjs +1113 -1207
- package/dist/{resolve-all-data-ppm982Jh.d.mts → resolve-all-data-C-cc7ftj.d.mts} +2 -2
- package/dist/{resolve-all-data-ppm982Jh.d.ts → resolve-all-data-C-cc7ftj.d.ts} +2 -2
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +3 -3
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": "
|
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": "
|
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
|
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": "
|
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
|
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
|
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
|
-
//
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
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
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
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
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
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
|
-
|
1235
|
-
|
1236
|
-
|
1196
|
+
const localName = readOnlyKey.replace(subPathPattern, "");
|
1197
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1198
|
+
[localName]: readOnlyFields[readOnlyKey]
|
1237
1199
|
});
|
1238
1200
|
}
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
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] =
|
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
|
-
|
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
|
-
|
2098
|
-
{
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
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:
|
2117
|
-
|
2118
|
-
subName
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
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
|
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-
|
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
|
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] =
|
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
|
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": "
|
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] =
|
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] =
|
2430
|
-
const [isOpen, setOpen] =
|
2431
|
-
const [isLoading, setIsLoading] =
|
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] =
|
2434
|
-
const [filtersToggled, setFiltersToggled] =
|
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] =
|
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
|
-
|
1881
|
+
AutoFieldPrivate,
|
2565
1882
|
{
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
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
|
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] =
|
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 &&
|
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] =
|
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
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
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
|
-
//
|
2582
|
+
// lib/dnd/collision/dynamic/get-midpoint-impact.ts
|
3123
2583
|
init_react_import();
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
}
|
3134
|
-
|
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
|
-
//
|
2601
|
+
// lib/dnd/collision/dynamic/track-movement-interval.ts
|
3137
2602
|
init_react_import();
|
3138
|
-
import {
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
}
|
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
|
-
//
|
2624
|
+
// ../../node_modules/@dnd-kit/collision/dist/index.js
|
3148
2625
|
init_react_import();
|
3149
|
-
import {
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
} from "
|
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
|
-
//
|
2705
|
+
// lib/dnd/collision/dynamic/store.ts
|
3159
2706
|
init_react_import();
|
3160
|
-
|
2707
|
+
import { createStore } from "zustand/vanilla";
|
2708
|
+
var collisionStore = createStore(() => ({
|
2709
|
+
fallbackEnabled: false
|
2710
|
+
}));
|
3161
2711
|
|
3162
|
-
//
|
3163
|
-
|
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
|
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] =
|
3216
|
-
const [areasWithZones, setAreasWithZones] =
|
2862
|
+
const [hoveringComponent, setHoveringComponent] = useState12();
|
2863
|
+
const [areasWithZones, setAreasWithZones] = useState12(
|
3217
2864
|
{}
|
3218
2865
|
);
|
3219
|
-
const [activeZones, setActiveZones] =
|
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] =
|
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] =
|
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] =
|
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] =
|
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] =
|
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] =
|
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] =
|
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
|
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] =
|
3707
|
-
const [isAnimating, setIsAnimating] =
|
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
|
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] =
|
3793
|
-
const [localPreview, setLocalPreview] =
|
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
|
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] =
|
3495
|
+
const [dragAxis, setDragAxis] = useState16(
|
3849
3496
|
collisionAxis || DEFAULT_DRAG_AXIS
|
3850
3497
|
);
|
3851
3498
|
const calculateDragAxis = useCallback9(() => {
|
@@ -4596,263 +4243,526 @@ var reorderAction = (data, action) => {
|
|
4596
4243
|
})
|
4597
4244
|
});
|
4598
4245
|
};
|
4599
|
-
function reduceData(data, action, config) {
|
4600
|
-
if (action.type === "insert") {
|
4601
|
-
return insertAction(data, action, config);
|
4246
|
+
function reduceData(data, action, config) {
|
4247
|
+
if (action.type === "insert") {
|
4248
|
+
return insertAction(data, action, config);
|
4249
|
+
}
|
4250
|
+
if (action.type === "duplicate") {
|
4251
|
+
const item = getItem(
|
4252
|
+
{ index: action.sourceIndex, zone: action.sourceZone },
|
4253
|
+
data
|
4254
|
+
);
|
4255
|
+
const newItem = __spreadProps(__spreadValues({}, item), {
|
4256
|
+
props: __spreadProps(__spreadValues({}, item.props), {
|
4257
|
+
id: generateId(item.type)
|
4258
|
+
})
|
4259
|
+
});
|
4260
|
+
const dataWithRelatedDuplicated = duplicateRelatedZones(
|
4261
|
+
item,
|
4262
|
+
data,
|
4263
|
+
newItem.props.id
|
4264
|
+
);
|
4265
|
+
if (action.sourceZone === rootDroppableId) {
|
4266
|
+
return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
|
4267
|
+
content: insert(data.content, action.sourceIndex + 1, newItem)
|
4268
|
+
});
|
4269
|
+
}
|
4270
|
+
return __spreadProps(__spreadValues({}, dataWithRelatedDuplicated), {
|
4271
|
+
zones: __spreadProps(__spreadValues({}, dataWithRelatedDuplicated.zones), {
|
4272
|
+
[action.sourceZone]: insert(
|
4273
|
+
dataWithRelatedDuplicated.zones[action.sourceZone],
|
4274
|
+
action.sourceIndex + 1,
|
4275
|
+
newItem
|
4276
|
+
)
|
4277
|
+
})
|
4278
|
+
});
|
4279
|
+
}
|
4280
|
+
if (action.type === "reorder") {
|
4281
|
+
return reorderAction(data, action);
|
4282
|
+
}
|
4283
|
+
if (action.type === "move") {
|
4284
|
+
if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
|
4285
|
+
return data;
|
4286
|
+
}
|
4287
|
+
const newData = setupZone(
|
4288
|
+
setupZone(data, action.sourceZone),
|
4289
|
+
action.destinationZone
|
4290
|
+
);
|
4291
|
+
const item = getItem(
|
4292
|
+
{ zone: action.sourceZone, index: action.sourceIndex },
|
4293
|
+
newData
|
4294
|
+
);
|
4295
|
+
if (action.sourceZone === action.destinationZone) {
|
4296
|
+
return reorderAction(data, __spreadProps(__spreadValues({}, action), { type: "reorder" }));
|
4297
|
+
}
|
4298
|
+
if (action.sourceZone === rootDroppableId) {
|
4299
|
+
return __spreadProps(__spreadValues({}, newData), {
|
4300
|
+
content: remove(newData.content, action.sourceIndex),
|
4301
|
+
zones: __spreadProps(__spreadValues({}, newData.zones), {
|
4302
|
+
[action.destinationZone]: insert(
|
4303
|
+
newData.zones[action.destinationZone],
|
4304
|
+
action.destinationIndex,
|
4305
|
+
item
|
4306
|
+
)
|
4307
|
+
})
|
4308
|
+
});
|
4309
|
+
}
|
4310
|
+
if (action.destinationZone === rootDroppableId) {
|
4311
|
+
return __spreadProps(__spreadValues({}, newData), {
|
4312
|
+
content: insert(newData.content, action.destinationIndex, item),
|
4313
|
+
zones: __spreadProps(__spreadValues({}, newData.zones), {
|
4314
|
+
[action.sourceZone]: remove(
|
4315
|
+
newData.zones[action.sourceZone],
|
4316
|
+
action.sourceIndex
|
4317
|
+
)
|
4318
|
+
})
|
4319
|
+
});
|
4320
|
+
}
|
4321
|
+
return __spreadProps(__spreadValues({}, newData), {
|
4322
|
+
zones: __spreadProps(__spreadValues({}, newData.zones), {
|
4323
|
+
[action.sourceZone]: remove(
|
4324
|
+
newData.zones[action.sourceZone],
|
4325
|
+
action.sourceIndex
|
4326
|
+
),
|
4327
|
+
[action.destinationZone]: insert(
|
4328
|
+
newData.zones[action.destinationZone],
|
4329
|
+
action.destinationIndex,
|
4330
|
+
item
|
4331
|
+
)
|
4332
|
+
})
|
4333
|
+
});
|
4334
|
+
}
|
4335
|
+
if (action.type === "replace") {
|
4336
|
+
return replaceAction(data, action);
|
4337
|
+
}
|
4338
|
+
if (action.type === "remove") {
|
4339
|
+
const item = getItem({ index: action.index, zone: action.zone }, data);
|
4340
|
+
const dataWithRelatedRemoved = setupZone(
|
4341
|
+
removeRelatedZones(item, data),
|
4342
|
+
action.zone
|
4343
|
+
);
|
4344
|
+
if (action.zone === rootDroppableId) {
|
4345
|
+
return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
|
4346
|
+
content: remove(data.content, action.index)
|
4347
|
+
});
|
4348
|
+
}
|
4349
|
+
return __spreadProps(__spreadValues({}, dataWithRelatedRemoved), {
|
4350
|
+
zones: __spreadProps(__spreadValues({}, dataWithRelatedRemoved.zones), {
|
4351
|
+
[action.zone]: remove(
|
4352
|
+
dataWithRelatedRemoved.zones[action.zone],
|
4353
|
+
action.index
|
4354
|
+
)
|
4355
|
+
})
|
4356
|
+
});
|
4357
|
+
}
|
4358
|
+
if (action.type === "registerZone") {
|
4359
|
+
if (zoneCache[action.zone]) {
|
4360
|
+
return __spreadProps(__spreadValues({}, data), {
|
4361
|
+
zones: __spreadProps(__spreadValues({}, data.zones), {
|
4362
|
+
[action.zone]: zoneCache[action.zone]
|
4363
|
+
})
|
4364
|
+
});
|
4365
|
+
}
|
4366
|
+
return setupZone(data, action.zone);
|
4367
|
+
}
|
4368
|
+
if (action.type === "unregisterZone") {
|
4369
|
+
const _zones = __spreadValues({}, data.zones || {});
|
4370
|
+
if (_zones[action.zone]) {
|
4371
|
+
zoneCache[action.zone] = _zones[action.zone];
|
4372
|
+
delete _zones[action.zone];
|
4373
|
+
}
|
4374
|
+
return __spreadProps(__spreadValues({}, data), { zones: _zones });
|
4375
|
+
}
|
4376
|
+
if (action.type === "setData") {
|
4377
|
+
if (typeof action.data === "object") {
|
4378
|
+
return __spreadValues(__spreadValues({}, data), action.data);
|
4379
|
+
}
|
4380
|
+
return __spreadValues(__spreadValues({}, data), action.data(data));
|
4381
|
+
}
|
4382
|
+
return data;
|
4383
|
+
}
|
4384
|
+
|
4385
|
+
// reducer/state.ts
|
4386
|
+
init_react_import();
|
4387
|
+
var reduceUi = (ui, action) => {
|
4388
|
+
if (action.type === "setUi") {
|
4389
|
+
if (typeof action.ui === "object") {
|
4390
|
+
return __spreadValues(__spreadValues({}, ui), action.ui);
|
4391
|
+
}
|
4392
|
+
return __spreadValues(__spreadValues({}, ui), action.ui(ui));
|
4393
|
+
}
|
4394
|
+
if (action.type === "duplicate") {
|
4395
|
+
return __spreadProps(__spreadValues({}, ui), {
|
4396
|
+
itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
|
4397
|
+
});
|
4398
|
+
}
|
4399
|
+
if (action.type === "remove") {
|
4400
|
+
return __spreadProps(__spreadValues({}, ui), {
|
4401
|
+
itemSelector: null
|
4402
|
+
});
|
4403
|
+
}
|
4404
|
+
return ui;
|
4405
|
+
};
|
4406
|
+
|
4407
|
+
// reducer/actions.tsx
|
4408
|
+
init_react_import();
|
4409
|
+
|
4410
|
+
// reducer/index.ts
|
4411
|
+
function storeInterceptor(reducer, record, onAction) {
|
4412
|
+
return (state, action) => {
|
4413
|
+
const newAppState = reducer(state, action);
|
4414
|
+
const isValidType = ![
|
4415
|
+
"registerZone",
|
4416
|
+
"unregisterZone",
|
4417
|
+
"setData",
|
4418
|
+
"setUi",
|
4419
|
+
"set"
|
4420
|
+
].includes(action.type);
|
4421
|
+
if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
|
4422
|
+
if (record) record(newAppState);
|
4423
|
+
}
|
4424
|
+
onAction == null ? void 0 : onAction(action, newAppState, state);
|
4425
|
+
return newAppState;
|
4426
|
+
};
|
4427
|
+
}
|
4428
|
+
var setAction = (state, action) => {
|
4429
|
+
if (typeof action.state === "object") {
|
4430
|
+
return __spreadValues(__spreadValues({}, state), action.state);
|
4431
|
+
}
|
4432
|
+
return __spreadValues(__spreadValues({}, state), action.state(state));
|
4433
|
+
};
|
4434
|
+
function createReducer({
|
4435
|
+
config,
|
4436
|
+
record,
|
4437
|
+
onAction
|
4438
|
+
}) {
|
4439
|
+
return storeInterceptor(
|
4440
|
+
(state, action) => {
|
4441
|
+
const data = reduceData(state.data, action, config);
|
4442
|
+
const ui = reduceUi(state.ui, action);
|
4443
|
+
if (action.type === "set") {
|
4444
|
+
return setAction(state, action);
|
4445
|
+
}
|
4446
|
+
return { data, ui };
|
4447
|
+
},
|
4448
|
+
record,
|
4449
|
+
onAction
|
4450
|
+
);
|
4451
|
+
}
|
4452
|
+
|
4453
|
+
// lib/insert-component.ts
|
4454
|
+
var insertComponent = (componentType, zone, index, {
|
4455
|
+
config,
|
4456
|
+
dispatch,
|
4457
|
+
resolveData,
|
4458
|
+
state
|
4459
|
+
}) => {
|
4460
|
+
const id = generateId(componentType);
|
4461
|
+
const insertActionData = {
|
4462
|
+
type: "insert",
|
4463
|
+
componentType,
|
4464
|
+
destinationIndex: index,
|
4465
|
+
destinationZone: zone,
|
4466
|
+
id
|
4467
|
+
};
|
4468
|
+
const insertedData = insertAction(state.data, insertActionData, config);
|
4469
|
+
dispatch(__spreadProps(__spreadValues({}, insertActionData), {
|
4470
|
+
// Dispatch insert rather set, as user's may rely on this via onAction
|
4471
|
+
// We must always record history here so the insert is added to user history
|
4472
|
+
// If the user has defined a resolveData method, they will end up with 2 history
|
4473
|
+
// entries on insert - one for the initial insert, and one when the data resolves
|
4474
|
+
recordHistory: true
|
4475
|
+
}));
|
4476
|
+
const itemSelector = {
|
4477
|
+
index,
|
4478
|
+
zone
|
4479
|
+
};
|
4480
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
4481
|
+
resolveData({
|
4482
|
+
data: insertedData,
|
4483
|
+
ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector })
|
4484
|
+
});
|
4485
|
+
};
|
4486
|
+
|
4487
|
+
// components/DragDropContext/index.tsx
|
4488
|
+
import { useDebouncedCallback as useDebouncedCallback2 } from "use-debounce";
|
4489
|
+
import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
|
4490
|
+
|
4491
|
+
// lib/dnd/PointerSensor.ts
|
4492
|
+
init_react_import();
|
4493
|
+
import { batch, effect } from "@dnd-kit/state";
|
4494
|
+
import { Sensor, configurator } from "@dnd-kit/abstract";
|
4495
|
+
import {
|
4496
|
+
exceedsDistance
|
4497
|
+
} from "@dnd-kit/geometry";
|
4498
|
+
import {
|
4499
|
+
getDocument,
|
4500
|
+
isElement,
|
4501
|
+
isHTMLElement,
|
4502
|
+
isPointerEvent,
|
4503
|
+
Listeners,
|
4504
|
+
getFrameTransform
|
4505
|
+
} from "@dnd-kit/dom/utilities";
|
4506
|
+
var _clearTimeout;
|
4507
|
+
var _PointerSensor = class _PointerSensor extends Sensor {
|
4508
|
+
constructor(manager, options) {
|
4509
|
+
super(manager);
|
4510
|
+
this.manager = manager;
|
4511
|
+
this.options = options;
|
4512
|
+
this.listeners = new Listeners();
|
4513
|
+
this.cleanup = /* @__PURE__ */ new Set();
|
4514
|
+
this.source = void 0;
|
4515
|
+
__privateAdd(this, _clearTimeout);
|
4516
|
+
this.handleCancel = this.handleCancel.bind(this);
|
4517
|
+
this.handlePointerUp = this.handlePointerUp.bind(this);
|
4518
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
4519
|
+
effect(() => {
|
4520
|
+
const unbindGlobal = this.bindGlobal(options != null ? options : {});
|
4521
|
+
return () => {
|
4522
|
+
unbindGlobal();
|
4523
|
+
};
|
4524
|
+
});
|
4602
4525
|
}
|
4603
|
-
|
4604
|
-
const
|
4605
|
-
|
4606
|
-
|
4607
|
-
|
4608
|
-
|
4609
|
-
|
4610
|
-
|
4611
|
-
}
|
4526
|
+
bind(source, options = this.options) {
|
4527
|
+
const unbind = effect(() => {
|
4528
|
+
var _a;
|
4529
|
+
const target = (_a = source.handle) != null ? _a : source.element;
|
4530
|
+
const listener = (event) => {
|
4531
|
+
if (isPointerEvent(event)) {
|
4532
|
+
this.handlePointerDown(event, source, options);
|
4533
|
+
}
|
4534
|
+
};
|
4535
|
+
if (target) {
|
4536
|
+
patchWindow(target.ownerDocument.defaultView);
|
4537
|
+
target.addEventListener("pointerdown", listener);
|
4538
|
+
return () => {
|
4539
|
+
target.removeEventListener("pointerdown", listener);
|
4540
|
+
};
|
4541
|
+
}
|
4612
4542
|
});
|
4613
|
-
|
4614
|
-
|
4615
|
-
|
4616
|
-
|
4617
|
-
)
|
4618
|
-
|
4619
|
-
|
4620
|
-
|
4621
|
-
});
|
4543
|
+
return unbind;
|
4544
|
+
}
|
4545
|
+
bindGlobal(options) {
|
4546
|
+
const documents = /* @__PURE__ */ new Set();
|
4547
|
+
for (const draggable of this.manager.registry.draggables.value) {
|
4548
|
+
if (draggable.element) {
|
4549
|
+
documents.add(getDocument(draggable.element));
|
4550
|
+
}
|
4622
4551
|
}
|
4623
|
-
|
4624
|
-
|
4625
|
-
|
4626
|
-
|
4627
|
-
|
4628
|
-
|
4629
|
-
|
4630
|
-
|
4631
|
-
|
4552
|
+
for (const droppable of this.manager.registry.droppables.value) {
|
4553
|
+
if (droppable.element) {
|
4554
|
+
documents.add(getDocument(droppable.element));
|
4555
|
+
}
|
4556
|
+
}
|
4557
|
+
const unbindFns = Array.from(documents).map(
|
4558
|
+
(doc) => this.listeners.bind(doc, [
|
4559
|
+
{
|
4560
|
+
type: "pointermove",
|
4561
|
+
listener: (event) => this.handlePointerMove(event, doc, options)
|
4562
|
+
},
|
4563
|
+
{
|
4564
|
+
type: "pointerup",
|
4565
|
+
listener: this.handlePointerUp,
|
4566
|
+
options: {
|
4567
|
+
capture: true
|
4568
|
+
}
|
4569
|
+
},
|
4570
|
+
{
|
4571
|
+
// Cancel activation if there is a competing Drag and Drop interaction
|
4572
|
+
type: "dragstart",
|
4573
|
+
listener: this.handleDragStart
|
4574
|
+
}
|
4575
|
+
])
|
4576
|
+
);
|
4577
|
+
return () => {
|
4578
|
+
unbindFns.forEach((unbind) => unbind());
|
4579
|
+
};
|
4632
4580
|
}
|
4633
|
-
|
4634
|
-
|
4581
|
+
handlePointerDown(event, source, options = {}) {
|
4582
|
+
if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled) {
|
4583
|
+
return;
|
4584
|
+
}
|
4585
|
+
const offset = getFrameTransform(source.element);
|
4586
|
+
this.initialCoordinates = {
|
4587
|
+
x: event.clientX * offset.scaleX + offset.x,
|
4588
|
+
y: event.clientY * offset.scaleY + offset.y
|
4589
|
+
};
|
4590
|
+
this.source = source;
|
4591
|
+
const { activationConstraints } = options;
|
4592
|
+
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
|
4593
|
+
event.stopImmediatePropagation();
|
4594
|
+
if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
|
4595
|
+
this.handleStart(source, event);
|
4596
|
+
} else {
|
4597
|
+
const { delay } = constraints;
|
4598
|
+
if (delay) {
|
4599
|
+
const timeout3 = setTimeout(
|
4600
|
+
() => this.handleStart(source, event),
|
4601
|
+
delay.value
|
4602
|
+
);
|
4603
|
+
__privateSet(this, _clearTimeout, () => {
|
4604
|
+
clearTimeout(timeout3);
|
4605
|
+
__privateSet(this, _clearTimeout, void 0);
|
4606
|
+
});
|
4607
|
+
}
|
4608
|
+
}
|
4609
|
+
const cleanup = () => {
|
4610
|
+
var _a;
|
4611
|
+
(_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
|
4612
|
+
this.initialCoordinates = void 0;
|
4613
|
+
this.source = void 0;
|
4614
|
+
};
|
4615
|
+
this.cleanup.add(cleanup);
|
4635
4616
|
}
|
4636
|
-
|
4637
|
-
if (
|
4638
|
-
return
|
4617
|
+
handlePointerMove(event, doc, options) {
|
4618
|
+
if (!this.source) {
|
4619
|
+
return;
|
4639
4620
|
}
|
4640
|
-
const
|
4641
|
-
|
4642
|
-
|
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" }));
|
4621
|
+
const ownerDocument = this.source.element && getDocument(this.source.element);
|
4622
|
+
if (doc !== ownerDocument) {
|
4623
|
+
return;
|
4650
4624
|
}
|
4651
|
-
|
4652
|
-
|
4653
|
-
|
4654
|
-
|
4655
|
-
|
4656
|
-
|
4657
|
-
|
4658
|
-
|
4659
|
-
|
4660
|
-
|
4661
|
-
});
|
4625
|
+
const coordinates = {
|
4626
|
+
x: event.clientX,
|
4627
|
+
y: event.clientY
|
4628
|
+
};
|
4629
|
+
const offset = getFrameTransform(this.source.element);
|
4630
|
+
coordinates.x = coordinates.x * offset.scaleX + offset.x;
|
4631
|
+
coordinates.y = coordinates.y * offset.scaleY + offset.y;
|
4632
|
+
if (this.manager.dragOperation.status.dragging) {
|
4633
|
+
event.preventDefault();
|
4634
|
+
event.stopPropagation();
|
4635
|
+
this.manager.actions.move({ to: coordinates });
|
4636
|
+
return;
|
4662
4637
|
}
|
4663
|
-
if (
|
4664
|
-
return
|
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
|
-
});
|
4638
|
+
if (!this.initialCoordinates) {
|
4639
|
+
return;
|
4673
4640
|
}
|
4674
|
-
|
4675
|
-
|
4676
|
-
|
4677
|
-
|
4678
|
-
|
4679
|
-
|
4680
|
-
|
4681
|
-
|
4682
|
-
|
4683
|
-
|
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
|
-
});
|
4641
|
+
const delta = {
|
4642
|
+
x: coordinates.x - this.initialCoordinates.x,
|
4643
|
+
y: coordinates.y - this.initialCoordinates.y
|
4644
|
+
};
|
4645
|
+
const { activationConstraints } = options;
|
4646
|
+
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
|
4647
|
+
const { distance, delay } = constraints != null ? constraints : {};
|
4648
|
+
if (distance) {
|
4649
|
+
if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
|
4650
|
+
return this.handleCancel();
|
4651
|
+
}
|
4652
|
+
if (exceedsDistance(delta, distance.value)) {
|
4653
|
+
return this.handleStart(this.source, event);
|
4654
|
+
}
|
4701
4655
|
}
|
4702
|
-
|
4703
|
-
|
4704
|
-
|
4705
|
-
|
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
|
-
});
|
4656
|
+
if (delay) {
|
4657
|
+
if (exceedsDistance(delta, delay.tolerance)) {
|
4658
|
+
return this.handleCancel();
|
4659
|
+
}
|
4718
4660
|
}
|
4719
|
-
return setupZone(data, action.zone);
|
4720
4661
|
}
|
4721
|
-
|
4722
|
-
|
4723
|
-
|
4724
|
-
zoneCache[action.zone] = _zones[action.zone];
|
4725
|
-
delete _zones[action.zone];
|
4662
|
+
handlePointerUp(event) {
|
4663
|
+
if (!this.source) {
|
4664
|
+
return;
|
4726
4665
|
}
|
4727
|
-
|
4728
|
-
|
4729
|
-
|
4730
|
-
if (
|
4731
|
-
|
4666
|
+
event.preventDefault();
|
4667
|
+
event.stopPropagation();
|
4668
|
+
const { status } = this.manager.dragOperation;
|
4669
|
+
if (!status.idle) {
|
4670
|
+
const canceled = !status.initialized;
|
4671
|
+
this.manager.actions.stop({ canceled });
|
4732
4672
|
}
|
4733
|
-
|
4673
|
+
this.cleanup.forEach((cleanup) => cleanup());
|
4674
|
+
this.cleanup.clear();
|
4734
4675
|
}
|
4735
|
-
|
4736
|
-
|
4737
|
-
|
4738
|
-
|
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);
|
4676
|
+
handleKeyDown(event) {
|
4677
|
+
if (event.key === "Escape") {
|
4678
|
+
event.preventDefault();
|
4679
|
+
this.handleCancel();
|
4744
4680
|
}
|
4745
|
-
return __spreadValues(__spreadValues({}, ui), action.ui(ui));
|
4746
4681
|
}
|
4747
|
-
|
4748
|
-
|
4749
|
-
|
4682
|
+
handleStart(source, event) {
|
4683
|
+
var _a;
|
4684
|
+
const { manager, initialCoordinates } = this;
|
4685
|
+
(_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
|
4686
|
+
if (!initialCoordinates || manager.dragOperation.status.initialized) {
|
4687
|
+
return;
|
4688
|
+
}
|
4689
|
+
if (event.defaultPrevented) {
|
4690
|
+
return;
|
4691
|
+
}
|
4692
|
+
event.preventDefault();
|
4693
|
+
batch(() => {
|
4694
|
+
manager.actions.setDragSource(source.id);
|
4695
|
+
manager.actions.start({ coordinates: initialCoordinates, event });
|
4750
4696
|
});
|
4697
|
+
const ownerDocument = getDocument(event.target);
|
4698
|
+
const unbind = this.listeners.bind(ownerDocument, [
|
4699
|
+
{
|
4700
|
+
// Prevent scrolling on touch devices
|
4701
|
+
type: "touchmove",
|
4702
|
+
listener: preventDefault,
|
4703
|
+
options: {
|
4704
|
+
passive: false
|
4705
|
+
}
|
4706
|
+
},
|
4707
|
+
{
|
4708
|
+
// Prevent click events
|
4709
|
+
type: "click",
|
4710
|
+
listener: preventDefault
|
4711
|
+
},
|
4712
|
+
{
|
4713
|
+
type: "keydown",
|
4714
|
+
listener: this.handleKeyDown
|
4715
|
+
}
|
4716
|
+
]);
|
4717
|
+
ownerDocument.body.setPointerCapture(event.pointerId);
|
4718
|
+
this.cleanup.add(unbind);
|
4751
4719
|
}
|
4752
|
-
|
4753
|
-
|
4754
|
-
|
4755
|
-
|
4720
|
+
handleDragStart(event) {
|
4721
|
+
const { target } = event;
|
4722
|
+
if (!isElement(target)) {
|
4723
|
+
return;
|
4724
|
+
}
|
4725
|
+
const isNativeDraggable = isHTMLElement(target) && target.draggable && target.getAttribute("draggable") === "true";
|
4726
|
+
if (isNativeDraggable) {
|
4727
|
+
this.handleCancel();
|
4728
|
+
} else {
|
4729
|
+
preventDefault(event);
|
4730
|
+
}
|
4756
4731
|
}
|
4757
|
-
|
4758
|
-
};
|
4759
|
-
|
4760
|
-
|
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);
|
4732
|
+
handleCancel() {
|
4733
|
+
const { dragOperation } = this.manager;
|
4734
|
+
if (dragOperation.status.initialized) {
|
4735
|
+
this.manager.actions.stop({ canceled: true });
|
4776
4736
|
}
|
4777
|
-
|
4778
|
-
|
4779
|
-
}
|
4780
|
-
|
4781
|
-
|
4782
|
-
if (typeof action.state === "object") {
|
4783
|
-
return __spreadValues(__spreadValues({}, state), action.state);
|
4737
|
+
this.cleanup.forEach((cleanup) => cleanup());
|
4738
|
+
this.cleanup.clear();
|
4739
|
+
}
|
4740
|
+
destroy() {
|
4741
|
+
this.listeners.clear();
|
4784
4742
|
}
|
4785
|
-
return __spreadValues(__spreadValues({}, state), action.state(state));
|
4786
4743
|
};
|
4787
|
-
|
4788
|
-
|
4789
|
-
|
4790
|
-
|
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
|
-
);
|
4744
|
+
_clearTimeout = new WeakMap();
|
4745
|
+
_PointerSensor.configure = configurator(_PointerSensor);
|
4746
|
+
var PointerSensor = _PointerSensor;
|
4747
|
+
function preventDefault(event) {
|
4748
|
+
event.preventDefault();
|
4804
4749
|
}
|
4805
|
-
|
4806
|
-
|
4807
|
-
var
|
4808
|
-
|
4809
|
-
|
4810
|
-
|
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);
|
4750
|
+
function noop() {
|
4751
|
+
}
|
4752
|
+
var windows = /* @__PURE__ */ new WeakSet();
|
4753
|
+
function patchWindow(window2) {
|
4754
|
+
if (!window2 || windows.has(window2)) {
|
4755
|
+
return;
|
4851
4756
|
}
|
4852
|
-
|
4757
|
+
window2.addEventListener("touchmove", noop, {
|
4758
|
+
capture: false,
|
4759
|
+
passive: false
|
4760
|
+
});
|
4761
|
+
windows.add(window2);
|
4853
4762
|
}
|
4854
4763
|
|
4855
4764
|
// components/DragDropContext/index.tsx
|
4765
|
+
import { createStore as createStore3 } from "zustand";
|
4856
4766
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
4857
4767
|
var DEBUG3 = false;
|
4858
4768
|
var dragListenerContext = createContext4({
|
@@ -4892,7 +4802,7 @@ var DragDropContextClient = ({
|
|
4892
4802
|
const { data } = state;
|
4893
4803
|
const debouncedParamsRef = useRef3(null);
|
4894
4804
|
const tempDisableFallback = useTempDisableFallback(100);
|
4895
|
-
const [zoneStore] =
|
4805
|
+
const [zoneStore] = useState17(
|
4896
4806
|
() => createStore3(() => ({
|
4897
4807
|
zoneDepthIndex: {},
|
4898
4808
|
nextZoneDepthIndex: {},
|
@@ -4961,7 +4871,7 @@ var DragDropContextClient = ({
|
|
4961
4871
|
);
|
4962
4872
|
}
|
4963
4873
|
}, []);
|
4964
|
-
const [plugins] =
|
4874
|
+
const [plugins] = useState17(() => [
|
4965
4875
|
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
4966
4876
|
createNestedDroppablePlugin(
|
4967
4877
|
{
|
@@ -5008,9 +4918,27 @@ var DragDropContextClient = ({
|
|
5008
4918
|
id
|
5009
4919
|
)
|
5010
4920
|
]);
|
5011
|
-
const sensors =
|
5012
|
-
|
5013
|
-
|
4921
|
+
const [sensors] = useState17(() => [
|
4922
|
+
PointerSensor.configure({
|
4923
|
+
activationConstraints(event, source) {
|
4924
|
+
var _a;
|
4925
|
+
const { pointerType, target } = event;
|
4926
|
+
if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
|
4927
|
+
return void 0;
|
4928
|
+
}
|
4929
|
+
const delay = { value: 200, tolerance: 10 };
|
4930
|
+
if (pointerType === "touch") {
|
4931
|
+
return { delay };
|
4932
|
+
}
|
4933
|
+
return {
|
4934
|
+
delay,
|
4935
|
+
distance: { value: 5 }
|
4936
|
+
};
|
4937
|
+
}
|
4938
|
+
})
|
4939
|
+
]);
|
4940
|
+
const [dragListeners, setDragListeners] = useState17({});
|
4941
|
+
const [pathData, setPathData] = useState17();
|
5014
4942
|
const dragMode = useRef3(null);
|
5015
4943
|
const registerPath = useCallback11(
|
5016
4944
|
(id2, selector, label) => {
|
@@ -5071,13 +4999,6 @@ var DragDropContextClient = ({
|
|
5071
4999
|
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
5072
5000
|
fn(event, manager);
|
5073
5001
|
});
|
5074
|
-
dispatch({
|
5075
|
-
type: "setUi",
|
5076
|
-
ui: {
|
5077
|
-
itemSelector: null,
|
5078
|
-
isDragging: false
|
5079
|
-
}
|
5080
|
-
});
|
5081
5002
|
return;
|
5082
5003
|
}
|
5083
5004
|
if (thisPreview) {
|
@@ -5135,8 +5056,7 @@ var DragDropContextClient = ({
|
|
5135
5056
|
targetZone = targetData.zone;
|
5136
5057
|
targetIndex = targetData.index;
|
5137
5058
|
const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
|
5138
|
-
const
|
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";
|
5059
|
+
const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
|
5140
5060
|
if (targetIndex >= sourceIndex && sourceZone === targetZone) {
|
5141
5061
|
targetIndex = targetIndex - 1;
|
5142
5062
|
}
|
@@ -5332,7 +5252,7 @@ var DrawerItem = ({
|
|
5332
5252
|
isDragDisabled
|
5333
5253
|
}) => {
|
5334
5254
|
const resolvedId = id || name;
|
5335
|
-
const [dynamicId, setDynamicId] =
|
5255
|
+
const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
|
5336
5256
|
if (typeof index !== "undefined") {
|
5337
5257
|
console.error(
|
5338
5258
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -5398,7 +5318,7 @@ import {
|
|
5398
5318
|
useEffect as useEffect24,
|
5399
5319
|
useMemo as useMemo19,
|
5400
5320
|
useReducer,
|
5401
|
-
useState as
|
5321
|
+
useState as useState26
|
5402
5322
|
} from "react";
|
5403
5323
|
|
5404
5324
|
// components/SidebarSection/index.tsx
|
@@ -5406,7 +5326,7 @@ init_react_import();
|
|
5406
5326
|
|
5407
5327
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
5408
5328
|
init_react_import();
|
5409
|
-
var styles_module_default13 = { "SidebarSection": "
|
5329
|
+
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
5330
|
|
5411
5331
|
// lib/use-breadcrumbs.ts
|
5412
5332
|
init_react_import();
|
@@ -5585,7 +5505,7 @@ function MenuBar({
|
|
5585
5505
|
|
5586
5506
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
5587
5507
|
init_react_import();
|
5588
|
-
var styles_module_default15 = { "Puck": "
|
5508
|
+
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
5509
|
|
5590
5510
|
// components/Puck/components/Fields/index.tsx
|
5591
5511
|
init_react_import();
|
@@ -5599,7 +5519,7 @@ import { useMemo as useMemo12 } from "react";
|
|
5599
5519
|
|
5600
5520
|
// lib/use-resolved-fields.ts
|
5601
5521
|
init_react_import();
|
5602
|
-
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef5, useState as
|
5522
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef5, useState as useState19 } from "react";
|
5603
5523
|
|
5604
5524
|
// lib/use-parent.ts
|
5605
5525
|
init_react_import();
|
@@ -5647,10 +5567,7 @@ var selectorIs = (a, b) => (a == null ? void 0 : a.zone) === (b == null ? void 0
|
|
5647
5567
|
var defaultPageFields = {
|
5648
5568
|
title: { type: "text" }
|
5649
5569
|
};
|
5650
|
-
var useResolvedFields = ({
|
5651
|
-
_skipValueCheck,
|
5652
|
-
_skipIdCheck
|
5653
|
-
} = {}) => {
|
5570
|
+
var useResolvedFields = () => {
|
5654
5571
|
var _a, _b;
|
5655
5572
|
const { selectedItem, state, config } = useAppContext();
|
5656
5573
|
const parent = useParent();
|
@@ -5662,12 +5579,9 @@ var useResolvedFields = ({
|
|
5662
5579
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
5663
5580
|
);
|
5664
5581
|
const rootProps = data.root.props || data.root;
|
5665
|
-
const [lastSelectedData, setLastSelectedData] =
|
5666
|
-
const [resolvedFields, setResolvedFields] =
|
5667
|
-
|
5668
|
-
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5669
|
-
});
|
5670
|
-
const [fieldsLoading, setFieldsLoading] = useState20(false);
|
5582
|
+
const [lastSelectedData, setLastSelectedData] = useState19({});
|
5583
|
+
const [resolvedFields, setResolvedFields] = useState19(defaultFields);
|
5584
|
+
const [fieldsLoading, setFieldsLoading] = useState19(false);
|
5671
5585
|
const lastFields = useRef5(defaultFields);
|
5672
5586
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5673
5587
|
const componentData = useMemo11(
|
@@ -5721,21 +5635,17 @@ var useResolvedFields = ({
|
|
5721
5635
|
if (hasResolver) {
|
5722
5636
|
setFieldsLoading(true);
|
5723
5637
|
resolveFields(defaultFields).then((fields) => {
|
5724
|
-
setResolvedFields({
|
5725
|
-
fields: fields || {},
|
5726
|
-
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5727
|
-
});
|
5638
|
+
setResolvedFields(fields || {});
|
5728
5639
|
lastFields.current = fields;
|
5729
5640
|
setFieldsLoading(false);
|
5730
5641
|
});
|
5731
5642
|
return;
|
5732
5643
|
}
|
5733
5644
|
}
|
5734
|
-
setResolvedFields(
|
5645
|
+
setResolvedFields(defaultFields);
|
5735
5646
|
}, [
|
5736
5647
|
defaultFields,
|
5737
5648
|
state.ui.itemSelector,
|
5738
|
-
selectedItem,
|
5739
5649
|
hasResolver,
|
5740
5650
|
parent,
|
5741
5651
|
resolveFields
|
@@ -5750,7 +5660,6 @@ var useResolvedFields = ({
|
|
5750
5660
|
useOnValueChange(
|
5751
5661
|
{ data, parent, itemSelector: state.ui.itemSelector },
|
5752
5662
|
() => {
|
5753
|
-
if (_skipValueCheck) return;
|
5754
5663
|
triggerResolver();
|
5755
5664
|
},
|
5756
5665
|
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
@@ -5758,10 +5667,7 @@ var useResolvedFields = ({
|
|
5758
5667
|
useEffect17(() => {
|
5759
5668
|
triggerResolver();
|
5760
5669
|
}, []);
|
5761
|
-
|
5762
|
-
return [defaultFields, fieldsLoading];
|
5763
|
-
}
|
5764
|
-
return [resolvedFields.fields, fieldsLoading];
|
5670
|
+
return [resolvedFields, fieldsLoading];
|
5765
5671
|
};
|
5766
5672
|
|
5767
5673
|
// components/Puck/components/Fields/index.tsx
|
@@ -5911,14 +5817,14 @@ init_react_import();
|
|
5911
5817
|
|
5912
5818
|
// lib/use-component-list.tsx
|
5913
5819
|
init_react_import();
|
5914
|
-
import { useEffect as useEffect18, useState as
|
5820
|
+
import { useEffect as useEffect18, useState as useState20 } from "react";
|
5915
5821
|
|
5916
5822
|
// components/ComponentList/index.tsx
|
5917
5823
|
init_react_import();
|
5918
5824
|
|
5919
5825
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
5920
5826
|
init_react_import();
|
5921
|
-
var styles_module_default17 = { "ComponentList": "
|
5827
|
+
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
5828
|
|
5923
5829
|
// components/ComponentList/index.tsx
|
5924
5830
|
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
@@ -5978,7 +5884,7 @@ ComponentList.Item = ComponentListItem;
|
|
5978
5884
|
// lib/use-component-list.tsx
|
5979
5885
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
5980
5886
|
var useComponentList = (config, ui) => {
|
5981
|
-
const [componentList, setComponentList] =
|
5887
|
+
const [componentList, setComponentList] = useState20();
|
5982
5888
|
useEffect18(() => {
|
5983
5889
|
var _a, _b, _c;
|
5984
5890
|
if (Object.keys(ui.componentList).length > 0) {
|
@@ -6067,7 +5973,7 @@ import {
|
|
6067
5973
|
createContext as createContext5,
|
6068
5974
|
useContext as useContext10,
|
6069
5975
|
useEffect as useEffect19,
|
6070
|
-
useState as
|
5976
|
+
useState as useState21
|
6071
5977
|
} from "react";
|
6072
5978
|
import hash from "object-hash";
|
6073
5979
|
import { createPortal as createPortal3 } from "react-dom";
|
@@ -6291,9 +6197,9 @@ function AutoFrame(_a) {
|
|
6291
6197
|
"onStylesLoaded",
|
6292
6198
|
"frameRef"
|
6293
6199
|
]);
|
6294
|
-
const [loaded, setLoaded] =
|
6295
|
-
const [ctx, setCtx] =
|
6296
|
-
const [mountTarget, setMountTarget] =
|
6200
|
+
const [loaded, setLoaded] = useState21(false);
|
6201
|
+
const [ctx, setCtx] = useState21({});
|
6202
|
+
const [mountTarget, setMountTarget] = useState21();
|
6297
6203
|
useEffect19(() => {
|
6298
6204
|
var _a2;
|
6299
6205
|
if (frameRef.current) {
|
@@ -6516,7 +6422,7 @@ init_react_import();
|
|
6516
6422
|
|
6517
6423
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
6518
6424
|
init_react_import();
|
6519
|
-
var styles_module_default19 = { "LayerTree": "
|
6425
|
+
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
6426
|
|
6521
6427
|
// lib/scroll-into-view.ts
|
6522
6428
|
init_react_import();
|
@@ -6812,19 +6718,19 @@ function usePuckHistory({
|
|
6812
6718
|
|
6813
6719
|
// lib/use-history-store.ts
|
6814
6720
|
init_react_import();
|
6815
|
-
import { useState as
|
6721
|
+
import { useState as useState22 } from "react";
|
6816
6722
|
import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
|
6817
6723
|
var EMPTY_HISTORY_INDEX = 0;
|
6818
6724
|
function useHistoryStore(initialHistory) {
|
6819
6725
|
var _a, _b;
|
6820
|
-
const [histories, setHistories] =
|
6726
|
+
const [histories, setHistories] = useState22(
|
6821
6727
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6822
6728
|
);
|
6823
6729
|
const updateHistories = (histories2) => {
|
6824
6730
|
setHistories(histories2);
|
6825
6731
|
setIndex(histories2.length - 1);
|
6826
6732
|
};
|
6827
|
-
const [index, setIndex] =
|
6733
|
+
const [index, setIndex] = useState22(
|
6828
6734
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6829
6735
|
);
|
6830
6736
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -6989,16 +6895,16 @@ import {
|
|
6989
6895
|
useEffect as useEffect22,
|
6990
6896
|
useMemo as useMemo17,
|
6991
6897
|
useRef as useRef8,
|
6992
|
-
useState as
|
6898
|
+
useState as useState24
|
6993
6899
|
} from "react";
|
6994
6900
|
|
6995
6901
|
// components/ViewportControls/index.tsx
|
6996
6902
|
init_react_import();
|
6997
|
-
import { useEffect as useEffect21, useMemo as useMemo16, useState as
|
6903
|
+
import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
|
6998
6904
|
|
6999
6905
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
7000
6906
|
init_react_import();
|
7001
|
-
var styles_module_default20 = { "ViewportControls": "
|
6907
|
+
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
6908
|
|
7003
6909
|
// components/ViewportControls/index.tsx
|
7004
6910
|
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
@@ -7017,7 +6923,7 @@ var ViewportButton = ({
|
|
7017
6923
|
onClick
|
7018
6924
|
}) => {
|
7019
6925
|
const { state } = useAppContext();
|
7020
|
-
const [isActive, setIsActive] =
|
6926
|
+
const [isActive, setIsActive] = useState23(false);
|
7021
6927
|
useEffect21(() => {
|
7022
6928
|
setIsActive(width === state.ui.viewports.current.width);
|
7023
6929
|
}, [width, state.ui.viewports.current.width]);
|
@@ -7178,7 +7084,7 @@ var Canvas = () => {
|
|
7178
7084
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
7179
7085
|
const { ui } = state;
|
7180
7086
|
const frameRef = useRef8(null);
|
7181
|
-
const [showTransition, setShowTransition] =
|
7087
|
+
const [showTransition, setShowTransition] = useState24(false);
|
7182
7088
|
const defaultRender = useMemo17(() => {
|
7183
7089
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
|
7184
7090
|
return PuckDefault;
|
@@ -7233,7 +7139,7 @@ var Canvas = () => {
|
|
7233
7139
|
window.removeEventListener("resize", cb);
|
7234
7140
|
};
|
7235
7141
|
}, []);
|
7236
|
-
const [showLoader, setShowLoader] =
|
7142
|
+
const [showLoader, setShowLoader] = useState24(false);
|
7237
7143
|
useEffect22(() => {
|
7238
7144
|
setTimeout(() => {
|
7239
7145
|
setShowLoader(true);
|
@@ -7363,10 +7269,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
|
|
7363
7269
|
|
7364
7270
|
// lib/use-inject-css.ts
|
7365
7271
|
init_react_import();
|
7366
|
-
import { useEffect as useEffect23, useState as
|
7272
|
+
import { useEffect as useEffect23, useState as useState25 } from "react";
|
7367
7273
|
var styles = ``;
|
7368
7274
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7369
|
-
const [el, setEl] =
|
7275
|
+
const [el, setEl] = useState25();
|
7370
7276
|
useEffect23(() => {
|
7371
7277
|
setEl(document.createElement("style"));
|
7372
7278
|
}, []);
|
@@ -7450,7 +7356,7 @@ function Puck({
|
|
7450
7356
|
waitForStyles: true
|
7451
7357
|
}, _iframe);
|
7452
7358
|
useInjectGlobalCss(iframe.enabled);
|
7453
|
-
const [generatedAppState] =
|
7359
|
+
const [generatedAppState] = useState26(() => {
|
7454
7360
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7455
7361
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7456
7362
|
let clientUiState = {};
|
@@ -7522,7 +7428,7 @@ function Puck({
|
|
7522
7428
|
histories,
|
7523
7429
|
index: initialHistoryIndex
|
7524
7430
|
});
|
7525
|
-
const [reducer] =
|
7431
|
+
const [reducer] = useState26(
|
7526
7432
|
() => createReducer({
|
7527
7433
|
config,
|
7528
7434
|
record: historyStore.record,
|
@@ -7540,7 +7446,7 @@ function Puck({
|
|
7540
7446
|
historyStore,
|
7541
7447
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
7542
7448
|
});
|
7543
|
-
const [menuOpen, setMenuOpen] =
|
7449
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
7544
7450
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
7545
7451
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
7546
7452
|
useEffect24(() => {
|
@@ -7627,7 +7533,7 @@ function Puck({
|
|
7627
7533
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7628
7534
|
[loadedOverrides]
|
7629
7535
|
);
|
7630
|
-
const [mounted, setMounted] =
|
7536
|
+
const [mounted, setMounted] = useState26(false);
|
7631
7537
|
useEffect24(() => {
|
7632
7538
|
setMounted(true);
|
7633
7539
|
}, []);
|