@measured/puck 0.17.0-canary.552c8f9 → 0.17.0-canary.5e57623
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 +63 -15
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +414 -1295
- package/dist/index.mjs +392 -1269
- package/dist/{resolve-all-data-Fx9YY5bj.d.mts → resolve-all-data-ZKVfUAQq.d.mts} +1 -0
- package/dist/{resolve-all-data-Fx9YY5bj.d.ts → resolve-all-data-ZKVfUAQq.d.ts} +1 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -29,8 +29,8 @@ var require_classnames = __commonJS({
|
|
29
29
|
var nativeCodeString = "[native code]";
|
30
30
|
function classNames() {
|
31
31
|
var classes = [];
|
32
|
-
for (var
|
33
|
-
var arg = arguments[
|
32
|
+
for (var i = 0; i < arguments.length; i++) {
|
33
|
+
var arg = arguments[i];
|
34
34
|
if (!arg) continue;
|
35
35
|
var argType = typeof arg;
|
36
36
|
if (argType === "string" || argType === "number") {
|
@@ -137,9 +137,9 @@ var getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (o
|
|
137
137
|
for (let modifier in modifiers) {
|
138
138
|
prefixedModifiers[styles2[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
139
139
|
}
|
140
|
-
const
|
140
|
+
const c = styles2[rootClass];
|
141
141
|
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
142
|
-
[
|
142
|
+
[c]: !!c
|
143
143
|
}, prefixedModifiers));
|
144
144
|
} else {
|
145
145
|
return config.baseClass + styles2[rootClass] || "";
|
@@ -149,7 +149,7 @@ var get_class_name_factory_default = getClassNameFactory;
|
|
149
149
|
|
150
150
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
|
151
151
|
init_react_import();
|
152
|
-
var styles_module_default = { "ActionBar": "
|
152
|
+
var styles_module_default = { "ActionBar": "_ActionBar_1lbm7_1", "ActionBar-label": "_ActionBar-label_1lbm7_18", "ActionBar-action": "_ActionBar-action_1lbm7_30", "ActionBar-group": "_ActionBar-group_1lbm7_38" };
|
153
153
|
|
154
154
|
// components/ActionBar/index.tsx
|
155
155
|
import { jsx, jsxs } from "react/jsx-runtime";
|
@@ -157,10 +157,19 @@ var getClassName = get_class_name_factory_default("ActionBar", styles_module_def
|
|
157
157
|
var ActionBar = ({
|
158
158
|
label,
|
159
159
|
children
|
160
|
-
}) => /* @__PURE__ */ jsxs(
|
161
|
-
|
162
|
-
|
163
|
-
|
160
|
+
}) => /* @__PURE__ */ jsxs(
|
161
|
+
"div",
|
162
|
+
{
|
163
|
+
className: getClassName(),
|
164
|
+
onClick: (e) => {
|
165
|
+
e.stopPropagation();
|
166
|
+
},
|
167
|
+
children: [
|
168
|
+
label && /* @__PURE__ */ jsx(ActionBar.Group, { children: /* @__PURE__ */ jsx("div", { className: getClassName("label"), children: label }) }),
|
169
|
+
children
|
170
|
+
]
|
171
|
+
}
|
172
|
+
);
|
164
173
|
var Action = ({
|
165
174
|
children,
|
166
175
|
label,
|
@@ -176,7 +185,9 @@ var Action = ({
|
|
176
185
|
}
|
177
186
|
);
|
178
187
|
var Group = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassName("group"), children });
|
188
|
+
var Label = ({ label }) => /* @__PURE__ */ jsx("div", { className: getClassName("label"), children: label });
|
179
189
|
ActionBar.Action = Action;
|
190
|
+
ActionBar.Label = Label;
|
180
191
|
ActionBar.Group = Group;
|
181
192
|
|
182
193
|
// components/AutoField/index.tsx
|
@@ -283,6 +294,13 @@ var Copy = createLucideIcon("Copy", [
|
|
283
294
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
284
295
|
]);
|
285
296
|
|
297
|
+
// ../../node_modules/lucide-react/dist/esm/icons/corner-left-up.js
|
298
|
+
init_react_import();
|
299
|
+
var CornerLeftUp = createLucideIcon("CornerLeftUp", [
|
300
|
+
["polyline", { points: "14 9 9 4 4 9", key: "m9oyvo" }],
|
301
|
+
["path", { d: "M20 20h-7a4 4 0 0 1-4-4V4", key: "1blwi3" }]
|
302
|
+
]);
|
303
|
+
|
286
304
|
// ../../node_modules/lucide-react/dist/esm/icons/globe.js
|
287
305
|
init_react_import();
|
288
306
|
var Globe = createLucideIcon("Globe", [
|
@@ -567,10 +585,10 @@ var IconButton = ({
|
|
567
585
|
disabled,
|
568
586
|
fullWidth
|
569
587
|
}),
|
570
|
-
onClick: (
|
588
|
+
onClick: (e) => {
|
571
589
|
if (!onClick) return;
|
572
590
|
setLoading(true);
|
573
|
-
Promise.resolve(onClick(
|
591
|
+
Promise.resolve(onClick(e)).then(() => {
|
574
592
|
setLoading(false);
|
575
593
|
});
|
576
594
|
},
|
@@ -647,7 +665,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
647
665
|
const [resolvedPermissions, setResolvedPermissions] = useState2({});
|
648
666
|
const resolveDataForItem = useCallback(
|
649
667
|
(item, force = false) => __async(void 0, null, function* () {
|
650
|
-
var _a, _b,
|
668
|
+
var _a, _b, _c;
|
651
669
|
const componentConfig = item.type === "root" ? config.root : config.components[item.type];
|
652
670
|
if (!componentConfig) {
|
653
671
|
return;
|
@@ -664,7 +682,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
664
682
|
lastPermissions: ((_b = cache[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
|
665
683
|
permissions: initialPermissions,
|
666
684
|
appState,
|
667
|
-
lastData: ((
|
685
|
+
lastData: ((_c = cache[item.props.id]) == null ? void 0 : _c.lastData) || null
|
668
686
|
}
|
669
687
|
);
|
670
688
|
setCache((_cache) => __spreadProps(__spreadValues({}, _cache), {
|
@@ -673,7 +691,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
673
691
|
lastPermissions: resolvedPermissions2
|
674
692
|
}
|
675
693
|
}));
|
676
|
-
setResolvedPermissions((
|
694
|
+
setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
|
677
695
|
[item.props.id]: resolvedPermissions2
|
678
696
|
}));
|
679
697
|
unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
|
@@ -1124,7 +1142,7 @@ var ArrayField = ({
|
|
1124
1142
|
label,
|
1125
1143
|
readOnly,
|
1126
1144
|
id,
|
1127
|
-
Label = (props) => /* @__PURE__ */ jsx9("div", __spreadValues({}, props))
|
1145
|
+
Label: Label2 = (props) => /* @__PURE__ */ jsx9("div", __spreadValues({}, props))
|
1128
1146
|
}) => {
|
1129
1147
|
const { state, setUi, selectedItem, getPermissions } = useAppContext();
|
1130
1148
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
@@ -1189,7 +1207,7 @@ var ArrayField = ({
|
|
1189
1207
|
}
|
1190
1208
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
1191
1209
|
return /* @__PURE__ */ jsx9(
|
1192
|
-
|
1210
|
+
Label2,
|
1193
1211
|
{
|
1194
1212
|
label: label || name,
|
1195
1213
|
icon: /* @__PURE__ */ jsx9(List, { size: 16 }),
|
@@ -1234,27 +1252,27 @@ var ArrayField = ({
|
|
1234
1252
|
hasItems: Array.isArray(value) && value.length > 0,
|
1235
1253
|
addDisabled
|
1236
1254
|
}),
|
1237
|
-
onMouseOver: (
|
1238
|
-
|
1255
|
+
onMouseOver: (e) => {
|
1256
|
+
e.stopPropagation();
|
1239
1257
|
setHovering(true);
|
1240
1258
|
},
|
1241
|
-
onMouseOut: (
|
1242
|
-
|
1259
|
+
onMouseOut: (e) => {
|
1260
|
+
e.stopPropagation();
|
1243
1261
|
setHovering(false);
|
1244
1262
|
},
|
1245
|
-
onClick: (
|
1246
|
-
|
1263
|
+
onClick: (e) => {
|
1264
|
+
e.preventDefault();
|
1247
1265
|
},
|
1248
1266
|
children: [
|
1249
|
-
localState.arrayState.items.map((item,
|
1250
|
-
const { _arrayId = `${id}-${
|
1251
|
-
const data = Array.from(localState.value || [])[
|
1267
|
+
localState.arrayState.items.map((item, i) => {
|
1268
|
+
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
1269
|
+
const data = Array.from(localState.value || [])[i] || {};
|
1252
1270
|
return /* @__PURE__ */ jsx9(
|
1253
1271
|
Draggable,
|
1254
1272
|
{
|
1255
1273
|
id: _arrayId,
|
1256
|
-
index:
|
1257
|
-
className: (
|
1274
|
+
index: i,
|
1275
|
+
className: (_, snapshot2) => getClassNameItem({
|
1258
1276
|
isExpanded: arrayState.openId === _arrayId,
|
1259
1277
|
isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
|
1260
1278
|
readOnly
|
@@ -1281,7 +1299,7 @@ var ArrayField = ({
|
|
1281
1299
|
},
|
1282
1300
|
className: getClassNameItem("summary"),
|
1283
1301
|
children: [
|
1284
|
-
field.getItemSummary ? field.getItemSummary(data,
|
1302
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1285
1303
|
/* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
|
1286
1304
|
!readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
|
1287
1305
|
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
|
@@ -1289,15 +1307,15 @@ var ArrayField = ({
|
|
1289
1307
|
{
|
1290
1308
|
type: "button",
|
1291
1309
|
disabled: !!addDisabled,
|
1292
|
-
onClick: (
|
1293
|
-
|
1310
|
+
onClick: (e) => {
|
1311
|
+
e.stopPropagation();
|
1294
1312
|
const existingValue = [
|
1295
1313
|
...value || []
|
1296
1314
|
];
|
1297
1315
|
existingValue.splice(
|
1298
|
-
|
1316
|
+
i,
|
1299
1317
|
0,
|
1300
|
-
existingValue[
|
1318
|
+
existingValue[i]
|
1301
1319
|
);
|
1302
1320
|
onChange(
|
1303
1321
|
existingValue,
|
@@ -1315,16 +1333,16 @@ var ArrayField = ({
|
|
1315
1333
|
{
|
1316
1334
|
type: "button",
|
1317
1335
|
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
1318
|
-
onClick: (
|
1319
|
-
|
1336
|
+
onClick: (e) => {
|
1337
|
+
e.stopPropagation();
|
1320
1338
|
const existingValue = [
|
1321
1339
|
...value || []
|
1322
1340
|
];
|
1323
1341
|
const existingItems = [
|
1324
1342
|
...arrayState.items || []
|
1325
1343
|
];
|
1326
|
-
existingValue.splice(
|
1327
|
-
existingItems.splice(
|
1344
|
+
existingValue.splice(i, 1);
|
1345
|
+
existingItems.splice(i, 1);
|
1328
1346
|
onChange(
|
1329
1347
|
existingValue,
|
1330
1348
|
mapArrayStateToUi({
|
@@ -1345,7 +1363,7 @@ var ArrayField = ({
|
|
1345
1363
|
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx9("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
1346
1364
|
(fieldName) => {
|
1347
1365
|
const subField = field.arrayFields[fieldName];
|
1348
|
-
const subFieldName = `${name}[${
|
1366
|
+
const subFieldName = `${name}[${i}].${fieldName}`;
|
1349
1367
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
1350
1368
|
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
|
1351
1369
|
return /* @__PURE__ */ jsx9(
|
@@ -1359,7 +1377,7 @@ var ArrayField = ({
|
|
1359
1377
|
value: data[fieldName],
|
1360
1378
|
onChange: (val, ui) => {
|
1361
1379
|
onChange(
|
1362
|
-
replace(value,
|
1380
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
1363
1381
|
[fieldName]: val
|
1364
1382
|
})),
|
1365
1383
|
ui
|
@@ -1414,11 +1432,11 @@ var DefaultField = ({
|
|
1414
1432
|
value,
|
1415
1433
|
name,
|
1416
1434
|
label,
|
1417
|
-
Label,
|
1435
|
+
Label: Label2,
|
1418
1436
|
id
|
1419
1437
|
}) => {
|
1420
1438
|
return /* @__PURE__ */ jsx10(
|
1421
|
-
|
1439
|
+
Label2,
|
1422
1440
|
{
|
1423
1441
|
label: label || name,
|
1424
1442
|
icon: /* @__PURE__ */ jsxs5(Fragment6, { children: [
|
@@ -1434,11 +1452,11 @@ var DefaultField = ({
|
|
1434
1452
|
type: field.type,
|
1435
1453
|
name,
|
1436
1454
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1437
|
-
onChange: (
|
1455
|
+
onChange: (e) => {
|
1438
1456
|
if (field.type === "number") {
|
1439
|
-
onChange(Number(
|
1457
|
+
onChange(Number(e.currentTarget.value));
|
1440
1458
|
} else {
|
1441
|
-
onChange(
|
1459
|
+
onChange(e.currentTarget.value);
|
1442
1460
|
}
|
1443
1461
|
},
|
1444
1462
|
readOnly,
|
@@ -1499,7 +1517,7 @@ var Modal = ({
|
|
1499
1517
|
"div",
|
1500
1518
|
{
|
1501
1519
|
className: getClassName7("inner"),
|
1502
|
-
onClick: (
|
1520
|
+
onClick: (e) => e.stopPropagation(),
|
1503
1521
|
children
|
1504
1522
|
}
|
1505
1523
|
) }),
|
@@ -1571,10 +1589,10 @@ var Button = ({
|
|
1571
1589
|
fullWidth,
|
1572
1590
|
[size]: true
|
1573
1591
|
}),
|
1574
|
-
onClick: (
|
1592
|
+
onClick: (e) => {
|
1575
1593
|
if (!onClick) return;
|
1576
1594
|
setLoading(true);
|
1577
|
-
Promise.resolve(onClick(
|
1595
|
+
Promise.resolve(onClick(e)).then(() => {
|
1578
1596
|
setLoading(false);
|
1579
1597
|
});
|
1580
1598
|
},
|
@@ -1703,8 +1721,8 @@ var ExternalInput = ({
|
|
1703
1721
|
hasData: mappedData.length > 0,
|
1704
1722
|
filtersToggled
|
1705
1723
|
}),
|
1706
|
-
onSubmit: (
|
1707
|
-
|
1724
|
+
onSubmit: (e) => {
|
1725
|
+
e.preventDefault();
|
1708
1726
|
search(searchQuery, filters);
|
1709
1727
|
},
|
1710
1728
|
children: [
|
@@ -1719,8 +1737,8 @@ var ExternalInput = ({
|
|
1719
1737
|
name: "q",
|
1720
1738
|
type: "search",
|
1721
1739
|
placeholder: field.placeholder,
|
1722
|
-
onChange: (
|
1723
|
-
setSearchQuery(
|
1740
|
+
onChange: (e) => {
|
1741
|
+
setSearchQuery(e.currentTarget.value);
|
1724
1742
|
},
|
1725
1743
|
autoComplete: "off",
|
1726
1744
|
value: searchQuery
|
@@ -1733,9 +1751,9 @@ var ExternalInput = ({
|
|
1733
1751
|
IconButton,
|
1734
1752
|
{
|
1735
1753
|
title: "Toggle filters",
|
1736
|
-
onClick: (
|
1737
|
-
|
1738
|
-
|
1754
|
+
onClick: (e) => {
|
1755
|
+
e.preventDefault();
|
1756
|
+
e.stopPropagation();
|
1739
1757
|
setFiltersToggled(!filtersToggled);
|
1740
1758
|
},
|
1741
1759
|
children: /* @__PURE__ */ jsx14(SlidersHorizontal, { size: 20 })
|
@@ -1774,19 +1792,19 @@ var ExternalInput = ({
|
|
1774
1792
|
},
|
1775
1793
|
key
|
1776
1794
|
)) }) }),
|
1777
|
-
/* @__PURE__ */ jsx14("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item,
|
1795
|
+
/* @__PURE__ */ jsx14("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
1778
1796
|
return /* @__PURE__ */ jsx14(
|
1779
1797
|
"tr",
|
1780
1798
|
{
|
1781
1799
|
style: { whiteSpace: "nowrap" },
|
1782
1800
|
className: getClassNameModal("tr"),
|
1783
1801
|
onClick: () => {
|
1784
|
-
onChange(mapProp(data[
|
1802
|
+
onChange(mapProp(data[i]));
|
1785
1803
|
setOpen(false);
|
1786
1804
|
},
|
1787
1805
|
children: keys.map((key) => /* @__PURE__ */ jsx14("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
1788
1806
|
},
|
1789
|
-
|
1807
|
+
i
|
1790
1808
|
);
|
1791
1809
|
}) })
|
1792
1810
|
] }),
|
@@ -1810,11 +1828,11 @@ var ExternalField = ({
|
|
1810
1828
|
value,
|
1811
1829
|
name,
|
1812
1830
|
label,
|
1813
|
-
Label,
|
1831
|
+
Label: Label2,
|
1814
1832
|
id,
|
1815
1833
|
readOnly
|
1816
1834
|
}) => {
|
1817
|
-
var _a, _b,
|
1835
|
+
var _a, _b, _c;
|
1818
1836
|
const validField = field;
|
1819
1837
|
const deprecatedField = field;
|
1820
1838
|
useEffect8(() => {
|
@@ -1827,7 +1845,7 @@ var ExternalField = ({
|
|
1827
1845
|
if (field.type !== "external") {
|
1828
1846
|
return null;
|
1829
1847
|
}
|
1830
|
-
return /* @__PURE__ */ jsx15(
|
1848
|
+
return /* @__PURE__ */ jsx15(Label2, { label: label || name, icon: /* @__PURE__ */ jsx15(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx15(
|
1831
1849
|
ExternalInput,
|
1832
1850
|
{
|
1833
1851
|
name,
|
@@ -1836,7 +1854,7 @@ var ExternalField = ({
|
|
1836
1854
|
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
1837
1855
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
1838
1856
|
mapRow: validField.mapRow,
|
1839
|
-
fetchList: ((
|
1857
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
1840
1858
|
return yield deprecatedField.adaptor.fetchList(
|
1841
1859
|
deprecatedField.adaptorParams
|
1842
1860
|
);
|
@@ -1862,13 +1880,13 @@ var RadioField = ({
|
|
1862
1880
|
name,
|
1863
1881
|
id,
|
1864
1882
|
label,
|
1865
|
-
Label
|
1883
|
+
Label: Label2
|
1866
1884
|
}) => {
|
1867
1885
|
if (field.type !== "radio" || !field.options) {
|
1868
1886
|
return null;
|
1869
1887
|
}
|
1870
1888
|
return /* @__PURE__ */ jsx16(
|
1871
|
-
|
1889
|
+
Label2,
|
1872
1890
|
{
|
1873
1891
|
icon: /* @__PURE__ */ jsx16(CheckCircle, { size: 16 }),
|
1874
1892
|
label: label || name,
|
@@ -1886,12 +1904,12 @@ var RadioField = ({
|
|
1886
1904
|
className: getClassName11("radioInput"),
|
1887
1905
|
value: option.value,
|
1888
1906
|
name,
|
1889
|
-
onChange: (
|
1890
|
-
if (
|
1891
|
-
onChange(JSON.parse(
|
1907
|
+
onChange: (e) => {
|
1908
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1909
|
+
onChange(JSON.parse(e.currentTarget.value));
|
1892
1910
|
return;
|
1893
1911
|
}
|
1894
|
-
onChange(
|
1912
|
+
onChange(e.currentTarget.value);
|
1895
1913
|
},
|
1896
1914
|
disabled: readOnly,
|
1897
1915
|
checked: value === option.value
|
@@ -1914,7 +1932,7 @@ var SelectField = ({
|
|
1914
1932
|
field,
|
1915
1933
|
onChange,
|
1916
1934
|
label,
|
1917
|
-
Label,
|
1935
|
+
Label: Label2,
|
1918
1936
|
value,
|
1919
1937
|
name,
|
1920
1938
|
readOnly,
|
@@ -1924,7 +1942,7 @@ var SelectField = ({
|
|
1924
1942
|
return null;
|
1925
1943
|
}
|
1926
1944
|
return /* @__PURE__ */ jsx17(
|
1927
|
-
|
1945
|
+
Label2,
|
1928
1946
|
{
|
1929
1947
|
label: label || name,
|
1930
1948
|
icon: /* @__PURE__ */ jsx17(ChevronDown, { size: 16 }),
|
@@ -1935,12 +1953,12 @@ var SelectField = ({
|
|
1935
1953
|
id,
|
1936
1954
|
className: getClassName12("input"),
|
1937
1955
|
disabled: readOnly,
|
1938
|
-
onChange: (
|
1939
|
-
if (
|
1940
|
-
onChange(JSON.parse(
|
1956
|
+
onChange: (e) => {
|
1957
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1958
|
+
onChange(JSON.parse(e.currentTarget.value));
|
1941
1959
|
return;
|
1942
1960
|
}
|
1943
|
-
onChange(
|
1961
|
+
onChange(e.currentTarget.value);
|
1944
1962
|
},
|
1945
1963
|
value,
|
1946
1964
|
children: field.options.map((option) => /* @__PURE__ */ jsx17(
|
@@ -1967,10 +1985,10 @@ var TextareaField = ({
|
|
1967
1985
|
value,
|
1968
1986
|
name,
|
1969
1987
|
label,
|
1970
|
-
Label,
|
1988
|
+
Label: Label2,
|
1971
1989
|
id
|
1972
1990
|
}) => {
|
1973
|
-
return /* @__PURE__ */ jsx18(
|
1991
|
+
return /* @__PURE__ */ jsx18(Label2, { label: label || name, icon: /* @__PURE__ */ jsx18(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx18(
|
1974
1992
|
"textarea",
|
1975
1993
|
{
|
1976
1994
|
id,
|
@@ -1978,7 +1996,7 @@ var TextareaField = ({
|
|
1978
1996
|
autoComplete: "off",
|
1979
1997
|
name,
|
1980
1998
|
value: typeof value === "undefined" ? "" : value,
|
1981
|
-
onChange: (
|
1999
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
1982
2000
|
readOnly,
|
1983
2001
|
tabIndex: readOnly ? -1 : void 0,
|
1984
2002
|
rows: 5
|
@@ -2005,7 +2023,7 @@ var ObjectField = ({
|
|
2005
2023
|
value,
|
2006
2024
|
name,
|
2007
2025
|
label,
|
2008
|
-
Label,
|
2026
|
+
Label: Label2,
|
2009
2027
|
readOnly,
|
2010
2028
|
id
|
2011
2029
|
}) => {
|
@@ -2016,7 +2034,7 @@ var ObjectField = ({
|
|
2016
2034
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
2017
2035
|
const data = value || {};
|
2018
2036
|
return /* @__PURE__ */ jsx19(
|
2019
|
-
|
2037
|
+
Label2,
|
2020
2038
|
{
|
2021
2039
|
label: label || name,
|
2022
2040
|
icon: /* @__PURE__ */ jsx19(MoreVertical, { size: 16 }),
|
@@ -2120,9 +2138,9 @@ var FieldLabelInternal2 = ({
|
|
2120
2138
|
);
|
2121
2139
|
};
|
2122
2140
|
function AutoFieldInternal(props) {
|
2123
|
-
var _a, _b,
|
2141
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2124
2142
|
const { dispatch, overrides } = useAppContext();
|
2125
|
-
const { id, Label = FieldLabelInternal2 } = props;
|
2143
|
+
const { id, Label: Label2 = FieldLabelInternal2 } = props;
|
2126
2144
|
const field = props.field;
|
2127
2145
|
const label = field.label;
|
2128
2146
|
const defaultId = useSafeId();
|
@@ -2140,7 +2158,7 @@ function AutoFieldInternal(props) {
|
|
2140
2158
|
const render = __spreadProps(__spreadValues({}, overrides.fieldTypes), {
|
2141
2159
|
array: ((_a = overrides.fieldTypes) == null ? void 0 : _a.array) || defaultFields.array,
|
2142
2160
|
external: ((_b = overrides.fieldTypes) == null ? void 0 : _b.external) || defaultFields.external,
|
2143
|
-
object: ((
|
2161
|
+
object: ((_c = overrides.fieldTypes) == null ? void 0 : _c.object) || defaultFields.object,
|
2144
2162
|
select: ((_d = overrides.fieldTypes) == null ? void 0 : _d.select) || defaultFields.select,
|
2145
2163
|
textarea: ((_e = overrides.fieldTypes) == null ? void 0 : _e.textarea) || defaultFields.textarea,
|
2146
2164
|
radio: ((_f = overrides.fieldTypes) == null ? void 0 : _f.radio) || defaultFields.radio,
|
@@ -2150,13 +2168,13 @@ function AutoFieldInternal(props) {
|
|
2150
2168
|
const mergedProps = __spreadProps(__spreadValues({}, props), {
|
2151
2169
|
field,
|
2152
2170
|
label,
|
2153
|
-
Label,
|
2171
|
+
Label: Label2,
|
2154
2172
|
id: resolvedId
|
2155
2173
|
});
|
2156
2174
|
const onFocus = useCallback5(
|
2157
|
-
(
|
2158
|
-
if (mergedProps.name &&
|
2159
|
-
|
2175
|
+
(e) => {
|
2176
|
+
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2177
|
+
e.stopPropagation();
|
2160
2178
|
dispatch({
|
2161
2179
|
type: "setUi",
|
2162
2180
|
ui: {
|
@@ -2167,8 +2185,8 @@ function AutoFieldInternal(props) {
|
|
2167
2185
|
},
|
2168
2186
|
[mergedProps.name]
|
2169
2187
|
);
|
2170
|
-
const onBlur = useCallback5((
|
2171
|
-
if ("name" in
|
2188
|
+
const onBlur = useCallback5((e) => {
|
2189
|
+
if ("name" in e.target) {
|
2172
2190
|
dispatch({
|
2173
2191
|
type: "setUi",
|
2174
2192
|
ui: {
|
@@ -2248,7 +2266,7 @@ import {
|
|
2248
2266
|
useRef as useRef5,
|
2249
2267
|
useState as useState15
|
2250
2268
|
} from "react";
|
2251
|
-
import { defaultPreset } from "@dnd-kit/dom";
|
2269
|
+
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
2252
2270
|
|
2253
2271
|
// components/DropZone/index.tsx
|
2254
2272
|
init_react_import();
|
@@ -2307,982 +2325,21 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
2307
2325
|
|
2308
2326
|
// components/DraggableComponent/collision/dynamic/index.ts
|
2309
2327
|
init_react_import();
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
// ../../node_modules/@dnd-kit/state/dist/index.mjs
|
2315
|
-
init_react_import();
|
2316
|
-
|
2317
|
-
// ../../node_modules/@preact/signals-core/dist/signals-core.mjs
|
2318
|
-
init_react_import();
|
2319
|
-
var i = Symbol.for("preact-signals");
|
2320
|
-
function t() {
|
2321
|
-
if (r > 1) {
|
2322
|
-
r--;
|
2323
|
-
return;
|
2324
|
-
}
|
2325
|
-
let i2, t2 = false;
|
2326
|
-
while (void 0 !== s) {
|
2327
|
-
let o2 = s;
|
2328
|
-
s = void 0;
|
2329
|
-
f++;
|
2330
|
-
while (void 0 !== o2) {
|
2331
|
-
const n2 = o2.o;
|
2332
|
-
o2.o = void 0;
|
2333
|
-
o2.f &= -3;
|
2334
|
-
if (!(8 & o2.f) && v(o2)) try {
|
2335
|
-
o2.c();
|
2336
|
-
} catch (o3) {
|
2337
|
-
if (!t2) {
|
2338
|
-
i2 = o3;
|
2339
|
-
t2 = true;
|
2340
|
-
}
|
2341
|
-
}
|
2342
|
-
o2 = n2;
|
2343
|
-
}
|
2344
|
-
}
|
2345
|
-
f = 0;
|
2346
|
-
r--;
|
2347
|
-
if (t2) throw i2;
|
2348
|
-
}
|
2349
|
-
function o(i2) {
|
2350
|
-
if (r > 0) return i2();
|
2351
|
-
r++;
|
2352
|
-
try {
|
2353
|
-
return i2();
|
2354
|
-
} finally {
|
2355
|
-
t();
|
2356
|
-
}
|
2357
|
-
}
|
2358
|
-
var n;
|
2359
|
-
var s;
|
2360
|
-
function h(i2) {
|
2361
|
-
const t2 = n;
|
2362
|
-
n = void 0;
|
2363
|
-
try {
|
2364
|
-
return i2();
|
2365
|
-
} finally {
|
2366
|
-
n = t2;
|
2367
|
-
}
|
2368
|
-
}
|
2369
|
-
var r = 0;
|
2370
|
-
var f = 0;
|
2371
|
-
var e = 0;
|
2372
|
-
function c(i2) {
|
2373
|
-
if (void 0 === n) return;
|
2374
|
-
let t2 = i2.n;
|
2375
|
-
if (void 0 === t2 || t2.t !== n) {
|
2376
|
-
t2 = { i: 0, S: i2, p: n.s, n: void 0, t: n, e: void 0, x: void 0, r: t2 };
|
2377
|
-
if (void 0 !== n.s) n.s.n = t2;
|
2378
|
-
n.s = t2;
|
2379
|
-
i2.n = t2;
|
2380
|
-
if (32 & n.f) i2.S(t2);
|
2381
|
-
return t2;
|
2382
|
-
} else if (-1 === t2.i) {
|
2383
|
-
t2.i = 0;
|
2384
|
-
if (void 0 !== t2.n) {
|
2385
|
-
t2.n.p = t2.p;
|
2386
|
-
if (void 0 !== t2.p) t2.p.n = t2.n;
|
2387
|
-
t2.p = n.s;
|
2388
|
-
t2.n = void 0;
|
2389
|
-
n.s.n = t2;
|
2390
|
-
n.s = t2;
|
2391
|
-
}
|
2392
|
-
return t2;
|
2393
|
-
}
|
2394
|
-
}
|
2395
|
-
function u(i2) {
|
2396
|
-
this.v = i2;
|
2397
|
-
this.i = 0;
|
2398
|
-
this.n = void 0;
|
2399
|
-
this.t = void 0;
|
2400
|
-
}
|
2401
|
-
u.prototype.brand = i;
|
2402
|
-
u.prototype.h = function() {
|
2403
|
-
return true;
|
2404
|
-
};
|
2405
|
-
u.prototype.S = function(i2) {
|
2406
|
-
if (this.t !== i2 && void 0 === i2.e) {
|
2407
|
-
i2.x = this.t;
|
2408
|
-
if (void 0 !== this.t) this.t.e = i2;
|
2409
|
-
this.t = i2;
|
2410
|
-
}
|
2411
|
-
};
|
2412
|
-
u.prototype.U = function(i2) {
|
2413
|
-
if (void 0 !== this.t) {
|
2414
|
-
const t2 = i2.e, o2 = i2.x;
|
2415
|
-
if (void 0 !== t2) {
|
2416
|
-
t2.x = o2;
|
2417
|
-
i2.e = void 0;
|
2418
|
-
}
|
2419
|
-
if (void 0 !== o2) {
|
2420
|
-
o2.e = t2;
|
2421
|
-
i2.x = void 0;
|
2422
|
-
}
|
2423
|
-
if (i2 === this.t) this.t = o2;
|
2424
|
-
}
|
2425
|
-
};
|
2426
|
-
u.prototype.subscribe = function(i2) {
|
2427
|
-
return E(() => {
|
2428
|
-
const t2 = this.value, o2 = n;
|
2429
|
-
n = void 0;
|
2430
|
-
try {
|
2431
|
-
i2(t2);
|
2432
|
-
} finally {
|
2433
|
-
n = o2;
|
2434
|
-
}
|
2435
|
-
});
|
2436
|
-
};
|
2437
|
-
u.prototype.valueOf = function() {
|
2438
|
-
return this.value;
|
2439
|
-
};
|
2440
|
-
u.prototype.toString = function() {
|
2441
|
-
return this.value + "";
|
2442
|
-
};
|
2443
|
-
u.prototype.toJSON = function() {
|
2444
|
-
return this.value;
|
2445
|
-
};
|
2446
|
-
u.prototype.peek = function() {
|
2447
|
-
const i2 = n;
|
2448
|
-
n = void 0;
|
2449
|
-
try {
|
2450
|
-
return this.value;
|
2451
|
-
} finally {
|
2452
|
-
n = i2;
|
2453
|
-
}
|
2454
|
-
};
|
2455
|
-
Object.defineProperty(u.prototype, "value", { get() {
|
2456
|
-
const i2 = c(this);
|
2457
|
-
if (void 0 !== i2) i2.i = this.i;
|
2458
|
-
return this.v;
|
2459
|
-
}, set(i2) {
|
2460
|
-
if (i2 !== this.v) {
|
2461
|
-
if (f > 100) throw new Error("Cycle detected");
|
2462
|
-
this.v = i2;
|
2463
|
-
this.i++;
|
2464
|
-
e++;
|
2465
|
-
r++;
|
2466
|
-
try {
|
2467
|
-
for (let i3 = this.t; void 0 !== i3; i3 = i3.x) i3.t.N();
|
2468
|
-
} finally {
|
2469
|
-
t();
|
2470
|
-
}
|
2471
|
-
}
|
2472
|
-
} });
|
2473
|
-
function d(i2) {
|
2474
|
-
return new u(i2);
|
2475
|
-
}
|
2476
|
-
function v(i2) {
|
2477
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) if (t2.S.i !== t2.i || !t2.S.h() || t2.S.i !== t2.i) return true;
|
2478
|
-
return false;
|
2479
|
-
}
|
2480
|
-
function l(i2) {
|
2481
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) {
|
2482
|
-
const o2 = t2.S.n;
|
2483
|
-
if (void 0 !== o2) t2.r = o2;
|
2484
|
-
t2.S.n = t2;
|
2485
|
-
t2.i = -1;
|
2486
|
-
if (void 0 === t2.n) {
|
2487
|
-
i2.s = t2;
|
2488
|
-
break;
|
2489
|
-
}
|
2490
|
-
}
|
2491
|
-
}
|
2492
|
-
function y(i2) {
|
2493
|
-
let t2, o2 = i2.s;
|
2494
|
-
while (void 0 !== o2) {
|
2495
|
-
const i3 = o2.p;
|
2496
|
-
if (-1 === o2.i) {
|
2497
|
-
o2.S.U(o2);
|
2498
|
-
if (void 0 !== i3) i3.n = o2.n;
|
2499
|
-
if (void 0 !== o2.n) o2.n.p = i3;
|
2500
|
-
} else t2 = o2;
|
2501
|
-
o2.S.n = o2.r;
|
2502
|
-
if (void 0 !== o2.r) o2.r = void 0;
|
2503
|
-
o2 = i3;
|
2504
|
-
}
|
2505
|
-
i2.s = t2;
|
2506
|
-
}
|
2507
|
-
function a(i2) {
|
2508
|
-
u.call(this, void 0);
|
2509
|
-
this.x = i2;
|
2510
|
-
this.s = void 0;
|
2511
|
-
this.g = e - 1;
|
2512
|
-
this.f = 4;
|
2513
|
-
}
|
2514
|
-
(a.prototype = new u()).h = function() {
|
2515
|
-
this.f &= -3;
|
2516
|
-
if (1 & this.f) return false;
|
2517
|
-
if (32 == (36 & this.f)) return true;
|
2518
|
-
this.f &= -5;
|
2519
|
-
if (this.g === e) return true;
|
2520
|
-
this.g = e;
|
2521
|
-
this.f |= 1;
|
2522
|
-
if (this.i > 0 && !v(this)) {
|
2523
|
-
this.f &= -2;
|
2524
|
-
return true;
|
2525
|
-
}
|
2526
|
-
const i2 = n;
|
2527
|
-
try {
|
2528
|
-
l(this);
|
2529
|
-
n = this;
|
2530
|
-
const i3 = this.x();
|
2531
|
-
if (16 & this.f || this.v !== i3 || 0 === this.i) {
|
2532
|
-
this.v = i3;
|
2533
|
-
this.f &= -17;
|
2534
|
-
this.i++;
|
2535
|
-
}
|
2536
|
-
} catch (i3) {
|
2537
|
-
this.v = i3;
|
2538
|
-
this.f |= 16;
|
2539
|
-
this.i++;
|
2540
|
-
}
|
2541
|
-
n = i2;
|
2542
|
-
y(this);
|
2543
|
-
this.f &= -2;
|
2544
|
-
return true;
|
2545
|
-
};
|
2546
|
-
a.prototype.S = function(i2) {
|
2547
|
-
if (void 0 === this.t) {
|
2548
|
-
this.f |= 36;
|
2549
|
-
for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.S(i3);
|
2550
|
-
}
|
2551
|
-
u.prototype.S.call(this, i2);
|
2552
|
-
};
|
2553
|
-
a.prototype.U = function(i2) {
|
2554
|
-
if (void 0 !== this.t) {
|
2555
|
-
u.prototype.U.call(this, i2);
|
2556
|
-
if (void 0 === this.t) {
|
2557
|
-
this.f &= -33;
|
2558
|
-
for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.U(i3);
|
2559
|
-
}
|
2560
|
-
}
|
2561
|
-
};
|
2562
|
-
a.prototype.N = function() {
|
2563
|
-
if (!(2 & this.f)) {
|
2564
|
-
this.f |= 6;
|
2565
|
-
for (let i2 = this.t; void 0 !== i2; i2 = i2.x) i2.t.N();
|
2566
|
-
}
|
2567
|
-
};
|
2568
|
-
Object.defineProperty(a.prototype, "value", { get() {
|
2569
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
2570
|
-
const i2 = c(this);
|
2571
|
-
this.h();
|
2572
|
-
if (void 0 !== i2) i2.i = this.i;
|
2573
|
-
if (16 & this.f) throw this.v;
|
2574
|
-
return this.v;
|
2575
|
-
} });
|
2576
|
-
function w(i2) {
|
2577
|
-
return new a(i2);
|
2578
|
-
}
|
2579
|
-
function _(i2) {
|
2580
|
-
const o2 = i2.u;
|
2581
|
-
i2.u = void 0;
|
2582
|
-
if ("function" == typeof o2) {
|
2583
|
-
r++;
|
2584
|
-
const s2 = n;
|
2585
|
-
n = void 0;
|
2586
|
-
try {
|
2587
|
-
o2();
|
2588
|
-
} catch (t2) {
|
2589
|
-
i2.f &= -2;
|
2590
|
-
i2.f |= 8;
|
2591
|
-
g(i2);
|
2592
|
-
throw t2;
|
2593
|
-
} finally {
|
2594
|
-
n = s2;
|
2595
|
-
t();
|
2596
|
-
}
|
2597
|
-
}
|
2598
|
-
}
|
2599
|
-
function g(i2) {
|
2600
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) t2.S.U(t2);
|
2601
|
-
i2.x = void 0;
|
2602
|
-
i2.s = void 0;
|
2603
|
-
_(i2);
|
2604
|
-
}
|
2605
|
-
function p(i2) {
|
2606
|
-
if (n !== this) throw new Error("Out-of-order effect");
|
2607
|
-
y(this);
|
2608
|
-
n = i2;
|
2609
|
-
this.f &= -2;
|
2610
|
-
if (8 & this.f) g(this);
|
2611
|
-
t();
|
2612
|
-
}
|
2613
|
-
function b(i2) {
|
2614
|
-
this.x = i2;
|
2615
|
-
this.u = void 0;
|
2616
|
-
this.s = void 0;
|
2617
|
-
this.o = void 0;
|
2618
|
-
this.f = 32;
|
2619
|
-
}
|
2620
|
-
b.prototype.c = function() {
|
2621
|
-
const i2 = this.S();
|
2622
|
-
try {
|
2623
|
-
if (8 & this.f) return;
|
2624
|
-
if (void 0 === this.x) return;
|
2625
|
-
const t2 = this.x();
|
2626
|
-
if ("function" == typeof t2) this.u = t2;
|
2627
|
-
} finally {
|
2628
|
-
i2();
|
2629
|
-
}
|
2630
|
-
};
|
2631
|
-
b.prototype.S = function() {
|
2632
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
2633
|
-
this.f |= 1;
|
2634
|
-
this.f &= -9;
|
2635
|
-
_(this);
|
2636
|
-
l(this);
|
2637
|
-
r++;
|
2638
|
-
const i2 = n;
|
2639
|
-
n = this;
|
2640
|
-
return p.bind(this, i2);
|
2641
|
-
};
|
2642
|
-
b.prototype.N = function() {
|
2643
|
-
if (!(2 & this.f)) {
|
2644
|
-
this.f |= 2;
|
2645
|
-
this.o = s;
|
2646
|
-
s = this;
|
2647
|
-
}
|
2648
|
-
};
|
2649
|
-
b.prototype.d = function() {
|
2650
|
-
this.f |= 8;
|
2651
|
-
if (!(1 & this.f)) g(this);
|
2652
|
-
};
|
2653
|
-
function E(i2) {
|
2654
|
-
const t2 = new b(i2);
|
2655
|
-
try {
|
2656
|
-
t2.c();
|
2657
|
-
} catch (i3) {
|
2658
|
-
t2.d();
|
2659
|
-
throw i3;
|
2660
|
-
}
|
2661
|
-
return t2.d.bind(t2);
|
2662
|
-
}
|
2663
|
-
|
2664
|
-
// ../../node_modules/@dnd-kit/state/dist/index.mjs
|
2665
|
-
function computed(compute, comparator) {
|
2666
|
-
if (comparator) {
|
2667
|
-
let previousValue;
|
2668
|
-
return w(() => {
|
2669
|
-
const value = compute();
|
2670
|
-
if (value && previousValue && comparator(previousValue, value)) {
|
2671
|
-
return previousValue;
|
2672
|
-
}
|
2673
|
-
previousValue = value;
|
2674
|
-
return value;
|
2675
|
-
});
|
2676
|
-
}
|
2677
|
-
return w(compute);
|
2678
|
-
}
|
2679
|
-
function reactive({ get }, _2) {
|
2680
|
-
return {
|
2681
|
-
init(value) {
|
2682
|
-
return d(value);
|
2683
|
-
},
|
2684
|
-
get() {
|
2685
|
-
const current = get.call(this);
|
2686
|
-
return current.value;
|
2687
|
-
},
|
2688
|
-
set(newValue) {
|
2689
|
-
const current = get.call(this);
|
2690
|
-
if (current.peek() === newValue) {
|
2691
|
-
return;
|
2692
|
-
}
|
2693
|
-
current.value = newValue;
|
2694
|
-
}
|
2695
|
-
};
|
2696
|
-
}
|
2697
|
-
function derived(target, _2) {
|
2698
|
-
const map = /* @__PURE__ */ new WeakMap();
|
2699
|
-
return function() {
|
2700
|
-
let result = map.get(this);
|
2701
|
-
if (!result) {
|
2702
|
-
result = computed(target.bind(this));
|
2703
|
-
map.set(this, result);
|
2704
|
-
}
|
2705
|
-
return result.value;
|
2706
|
-
};
|
2707
|
-
}
|
2708
|
-
function effects(...entries) {
|
2709
|
-
const effects2 = entries.map(E);
|
2710
|
-
return () => effects2.forEach((cleanup) => cleanup());
|
2711
|
-
}
|
2712
|
-
|
2713
|
-
// ../../node_modules/@dnd-kit/geometry/dist/index.mjs
|
2714
|
-
init_react_import();
|
2715
|
-
var __create = Object.create;
|
2716
|
-
var __defProp = Object.defineProperty;
|
2717
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
2718
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
2719
|
-
var __typeError = (msg) => {
|
2720
|
-
throw TypeError(msg);
|
2721
|
-
};
|
2722
|
-
var __pow = Math.pow;
|
2723
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2724
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
2725
|
-
var __decoratorStart = (base) => {
|
2726
|
-
var _a;
|
2727
|
-
return [, , , __create((_a = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a : null)];
|
2728
|
-
};
|
2729
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
2730
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
2731
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
2732
|
-
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
2733
|
-
var __runInitializers = (array, flags, self, value) => {
|
2734
|
-
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
|
2735
|
-
return value;
|
2736
|
-
};
|
2737
|
-
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
2738
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
2739
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
2740
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
2741
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
2742
|
-
return __privateGet2(this, extra);
|
2743
|
-
}, set [name](x) {
|
2744
|
-
return __privateSet2(this, extra, x);
|
2745
|
-
} }, name));
|
2746
|
-
k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
2747
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
2748
|
-
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
2749
|
-
if (k) {
|
2750
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
|
2751
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet2 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
2752
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
2753
|
-
}
|
2754
|
-
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
2755
|
-
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
2756
|
-
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
2757
|
-
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
2758
|
-
}
|
2759
|
-
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
2760
|
-
};
|
2761
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
2762
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
2763
|
-
var __privateGet2 = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2764
|
-
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2765
|
-
var __privateSet2 = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
2766
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
2767
|
-
var Point = class _Point {
|
2768
|
-
/**
|
2769
|
-
* @param {number} Coordinate of the point on the horizontal axis
|
2770
|
-
* @param {number} Coordinate of the point on the vertical axis
|
2771
|
-
*/
|
2772
|
-
constructor(x, y2) {
|
2773
|
-
this.x = x;
|
2774
|
-
this.y = y2;
|
2775
|
-
}
|
2776
|
-
/**
|
2777
|
-
* Returns the delta between this point and another point.
|
2778
|
-
*
|
2779
|
-
* @param {Point} a - A point
|
2780
|
-
* @param {Point} b - Another point
|
2781
|
-
*/
|
2782
|
-
static delta(a2, b2) {
|
2783
|
-
return new _Point(a2.x - b2.x, a2.y - b2.y);
|
2784
|
-
}
|
2785
|
-
/**
|
2786
|
-
* Returns the distance (hypotenuse) between this point and another point.
|
2787
|
-
*
|
2788
|
-
* @param {Point} a - A point
|
2789
|
-
* @param {Point} b - Another point
|
2790
|
-
*/
|
2791
|
-
static distance(a2, b2) {
|
2792
|
-
return Math.hypot(a2.x - b2.x, a2.y - b2.y);
|
2793
|
-
}
|
2794
|
-
/**
|
2795
|
-
* Returns true if both points are equal.
|
2796
|
-
*
|
2797
|
-
* @param {Point} a - A point
|
2798
|
-
* @param {Point} b - Another point
|
2799
|
-
*/
|
2800
|
-
static equals(a2, b2) {
|
2801
|
-
return a2.x === b2.x && a2.y === b2.y;
|
2802
|
-
}
|
2803
|
-
static from({ x, y: y2 }) {
|
2804
|
-
return new _Point(x, y2);
|
2805
|
-
}
|
2806
|
-
};
|
2807
|
-
var SENSITIVITY = 10;
|
2808
|
-
var _direction_dec;
|
2809
|
-
var _delta_dec;
|
2810
|
-
var _current_dec;
|
2811
|
-
var _previous_dec;
|
2812
|
-
var _initial_dec;
|
2813
|
-
var _velocity_dec;
|
2814
|
-
var _timestamp;
|
2815
|
-
var _init;
|
2816
|
-
var _velocity;
|
2817
|
-
var _initial;
|
2818
|
-
var _previous;
|
2819
|
-
var _current;
|
2820
|
-
_velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
|
2821
|
-
var Position = class {
|
2822
|
-
constructor(initialValue) {
|
2823
|
-
__runInitializers(_init, 5, this);
|
2824
|
-
__privateAdd2(this, _timestamp, 0);
|
2825
|
-
__privateAdd2(this, _velocity, __runInitializers(_init, 8, this, {
|
2826
|
-
x: 0,
|
2827
|
-
y: 0
|
2828
|
-
})), __runInitializers(_init, 11, this);
|
2829
|
-
__privateAdd2(this, _initial, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
2830
|
-
__privateAdd2(this, _previous, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
2831
|
-
__privateAdd2(this, _current, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
2832
|
-
const point = Point.from(initialValue);
|
2833
|
-
this.initial = point;
|
2834
|
-
this.current = point;
|
2835
|
-
this.previous = point;
|
2836
|
-
}
|
2837
|
-
get delta() {
|
2838
|
-
return Point.delta(this.current, this.initial);
|
2839
|
-
}
|
2840
|
-
get direction() {
|
2841
|
-
const delta = {
|
2842
|
-
x: this.current.x - this.previous.x,
|
2843
|
-
y: this.current.y - this.previous.y
|
2844
|
-
};
|
2845
|
-
if (!delta.x && !delta.y) {
|
2846
|
-
return null;
|
2847
|
-
}
|
2848
|
-
if (Math.abs(delta.x) > Math.abs(delta.y)) {
|
2849
|
-
return delta.x > 0 ? "right" : "left";
|
2850
|
-
}
|
2851
|
-
return delta.y > 0 ? "down" : "up";
|
2852
|
-
}
|
2853
|
-
reset(coordinates) {
|
2854
|
-
const point = Point.from(coordinates);
|
2855
|
-
o(() => {
|
2856
|
-
__privateSet2(this, _timestamp, 0);
|
2857
|
-
this.velocity = { x: 0, y: 0 };
|
2858
|
-
this.current = point;
|
2859
|
-
this.previous = point;
|
2860
|
-
this.initial = point;
|
2861
|
-
});
|
2862
|
-
}
|
2863
|
-
update(coordinates) {
|
2864
|
-
const { current } = this;
|
2865
|
-
const point = Point.from(coordinates);
|
2866
|
-
if (Point.equals(current, point)) {
|
2867
|
-
return;
|
2868
|
-
}
|
2869
|
-
const delta = {
|
2870
|
-
x: point.x - current.x,
|
2871
|
-
y: point.y - current.y
|
2872
|
-
};
|
2873
|
-
const timestamp = Date.now();
|
2874
|
-
const timeDelta = timestamp - __privateGet2(this, _timestamp);
|
2875
|
-
const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
|
2876
|
-
if (Math.abs(delta.x) < SENSITIVITY || Math.abs(delta.y) < SENSITIVITY) {
|
2877
|
-
this.previous = current;
|
2878
|
-
}
|
2879
|
-
__privateSet2(this, _timestamp, timestamp);
|
2880
|
-
this.velocity = {
|
2881
|
-
x: velocity(delta.x),
|
2882
|
-
y: velocity(delta.y)
|
2883
|
-
};
|
2884
|
-
this.current = point;
|
2885
|
-
}
|
2886
|
-
};
|
2887
|
-
_init = __decoratorStart(null);
|
2888
|
-
_timestamp = /* @__PURE__ */ new WeakMap();
|
2889
|
-
_velocity = /* @__PURE__ */ new WeakMap();
|
2890
|
-
_initial = /* @__PURE__ */ new WeakMap();
|
2891
|
-
_previous = /* @__PURE__ */ new WeakMap();
|
2892
|
-
_current = /* @__PURE__ */ new WeakMap();
|
2893
|
-
__decorateElement(_init, 4, "velocity", _velocity_dec, Position, _velocity);
|
2894
|
-
__decorateElement(_init, 4, "initial", _initial_dec, Position, _initial);
|
2895
|
-
__decorateElement(_init, 4, "previous", _previous_dec, Position, _previous);
|
2896
|
-
__decorateElement(_init, 4, "current", _current_dec, Position, _current);
|
2897
|
-
__decorateElement(_init, 2, "delta", _delta_dec, Position);
|
2898
|
-
__decorateElement(_init, 2, "direction", _direction_dec, Position);
|
2899
|
-
__decoratorMetadata(_init, Position);
|
2900
|
-
function exceedsDistance({ x, y: y2 }, distance) {
|
2901
|
-
const dx = Math.abs(x);
|
2902
|
-
const dy = Math.abs(y2);
|
2903
|
-
if (typeof distance === "number") {
|
2904
|
-
return Math.sqrt(__pow(dx, 2) + __pow(dy, 2)) > distance;
|
2905
|
-
}
|
2906
|
-
if ("x" in distance && "y" in distance) {
|
2907
|
-
return dx > distance.x && dy > distance.y;
|
2908
|
-
}
|
2909
|
-
if ("x" in distance) {
|
2910
|
-
return dx > distance.x;
|
2911
|
-
}
|
2912
|
-
if ("y" in distance) {
|
2913
|
-
return dy > distance.y;
|
2914
|
-
}
|
2915
|
-
return false;
|
2916
|
-
}
|
2917
|
-
var Axis = /* @__PURE__ */ ((Axis2) => {
|
2918
|
-
Axis2["Horizontal"] = "x";
|
2919
|
-
Axis2["Vertical"] = "y";
|
2920
|
-
return Axis2;
|
2921
|
-
})(Axis || {});
|
2922
|
-
var Axes = Object.values(Axis);
|
2923
|
-
|
2924
|
-
// ../../node_modules/@dnd-kit/abstract/index.js
|
2925
|
-
var __create2 = Object.create;
|
2926
|
-
var __defProp2 = Object.defineProperty;
|
2927
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
2928
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
2929
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
2930
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
2931
|
-
var __knownSymbol2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
2932
|
-
var __typeError2 = (msg) => {
|
2933
|
-
throw TypeError(msg);
|
2934
|
-
};
|
2935
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2936
|
-
var __name2 = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
2937
|
-
var __objRest2 = (source, exclude) => {
|
2938
|
-
var target = {};
|
2939
|
-
for (var prop in source)
|
2940
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
2941
|
-
target[prop] = source[prop];
|
2942
|
-
if (source != null && __getOwnPropSymbols)
|
2943
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
2944
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
2945
|
-
target[prop] = source[prop];
|
2946
|
-
}
|
2947
|
-
return target;
|
2948
|
-
};
|
2949
|
-
var __decoratorStart2 = (base) => {
|
2950
|
-
var _a;
|
2951
|
-
return [, , , __create2((_a = base == null ? void 0 : base[__knownSymbol2("metadata")]) != null ? _a : null)];
|
2952
|
-
};
|
2953
|
-
var __decoratorStrings2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
2954
|
-
var __expectFn2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError2("Function expected") : fn;
|
2955
|
-
var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError2("Already initialized") : fns.push(__expectFn2(fn || null)) });
|
2956
|
-
var __decoratorMetadata2 = (array, target) => __defNormalProp2(target, __knownSymbol2("metadata"), array[3]);
|
2957
|
-
var __runInitializers2 = (array, flags, self, value) => {
|
2958
|
-
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
|
2959
|
-
return value;
|
2960
|
-
};
|
2961
|
-
var __decorateElement2 = (array, flags, name, decorators, target, extra) => {
|
2962
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
2963
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings2[k + 5];
|
2964
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
2965
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc2(k < 4 ? target : { get [name]() {
|
2966
|
-
return __privateGet3(this, extra);
|
2967
|
-
}, set [name](x) {
|
2968
|
-
return __privateSet3(this, extra, x);
|
2969
|
-
} }, name));
|
2970
|
-
k ? p2 && k < 4 && __name2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name2(target, name);
|
2971
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
2972
|
-
ctx = __decoratorContext2(k, name, done = {}, array[3], extraInitializers);
|
2973
|
-
if (k) {
|
2974
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn2(target, x) : (x) => name in x };
|
2975
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet3 : __privateMethod2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
2976
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet3(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
2977
|
-
}
|
2978
|
-
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
2979
|
-
if (k ^ 4 || it === void 0) __expectFn2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
2980
|
-
else if (typeof it !== "object" || it === null) __typeError2("Object expected");
|
2981
|
-
else __expectFn2(fn = it.get) && (desc.get = fn), __expectFn2(fn = it.set) && (desc.set = fn), __expectFn2(fn = it.init) && initializers.unshift(fn);
|
2982
|
-
}
|
2983
|
-
return k || __decoratorMetadata2(array, target), desc && __defProp2(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
2984
|
-
};
|
2985
|
-
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
2986
|
-
var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError2('Cannot use the "in" operator on this value') : member.has(obj);
|
2987
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2988
|
-
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2989
|
-
var __privateSet3 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
2990
|
-
var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
|
2991
|
-
function configure(plugin, options) {
|
2992
|
-
return {
|
2993
|
-
plugin,
|
2994
|
-
options
|
2995
|
-
};
|
2996
|
-
}
|
2997
|
-
function configurator(plugin) {
|
2998
|
-
return (options) => {
|
2999
|
-
return configure(plugin, options);
|
3000
|
-
};
|
3001
|
-
}
|
3002
|
-
var _disabled_dec;
|
3003
|
-
var _init2;
|
3004
|
-
var _disabled;
|
3005
|
-
_disabled_dec = [reactive];
|
3006
|
-
var Plugin = class {
|
3007
|
-
constructor(manager, options) {
|
3008
|
-
this.manager = manager;
|
3009
|
-
this.options = options;
|
3010
|
-
__privateAdd3(this, _disabled, __runInitializers2(_init2, 8, this, false)), __runInitializers2(_init2, 11, this);
|
3011
|
-
}
|
3012
|
-
/**
|
3013
|
-
* Enable a disabled plugin instance.
|
3014
|
-
* Triggers effects.
|
3015
|
-
*/
|
3016
|
-
enable() {
|
3017
|
-
this.disabled = false;
|
3018
|
-
}
|
3019
|
-
/**
|
3020
|
-
* Disable an enabled plugin instance.
|
3021
|
-
* Triggers effects.
|
3022
|
-
*/
|
3023
|
-
disable() {
|
3024
|
-
this.disabled = true;
|
3025
|
-
}
|
3026
|
-
/**
|
3027
|
-
* Whether the plugin instance is disabled.
|
3028
|
-
* Does not trigger effects when accessed.
|
3029
|
-
*/
|
3030
|
-
isDisabled() {
|
3031
|
-
return h(() => {
|
3032
|
-
return this.disabled;
|
3033
|
-
});
|
3034
|
-
}
|
3035
|
-
/**
|
3036
|
-
* Configure a plugin instance with new options.
|
3037
|
-
*/
|
3038
|
-
configure(options) {
|
3039
|
-
this.options = options;
|
3040
|
-
}
|
3041
|
-
/**
|
3042
|
-
* Destroy a plugin instance.
|
3043
|
-
*/
|
3044
|
-
destroy() {
|
3045
|
-
}
|
3046
|
-
/**
|
3047
|
-
* Configure a plugin constructor with options.
|
3048
|
-
* This method is used to configure the options that the
|
3049
|
-
* plugin constructor will use to create plugin instances.
|
3050
|
-
*/
|
3051
|
-
static configure(options) {
|
3052
|
-
return configure(this, options);
|
3053
|
-
}
|
3054
|
-
};
|
3055
|
-
_init2 = __decoratorStart2(null);
|
3056
|
-
_disabled = /* @__PURE__ */ new WeakMap();
|
3057
|
-
__decorateElement2(_init2, 4, "disabled", _disabled_dec, Plugin, _disabled);
|
3058
|
-
__decoratorMetadata2(_init2, Plugin);
|
3059
|
-
var _previousValues;
|
3060
|
-
_previousValues = /* @__PURE__ */ new WeakMap();
|
3061
|
-
var _previousCoordinates;
|
3062
|
-
var _collisions;
|
3063
|
-
_previousCoordinates = /* @__PURE__ */ new WeakMap();
|
3064
|
-
_collisions = /* @__PURE__ */ new WeakMap();
|
3065
|
-
var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
3066
|
-
CollisionPriority2[CollisionPriority2["Lowest"] = 0] = "Lowest";
|
3067
|
-
CollisionPriority2[CollisionPriority2["Low"] = 1] = "Low";
|
3068
|
-
CollisionPriority2[CollisionPriority2["Normal"] = 2] = "Normal";
|
3069
|
-
CollisionPriority2[CollisionPriority2["High"] = 3] = "High";
|
3070
|
-
CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
|
3071
|
-
return CollisionPriority2;
|
3072
|
-
})(CollisionPriority || {});
|
3073
|
-
var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
3074
|
-
CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
|
3075
|
-
CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
|
3076
|
-
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
3077
|
-
return CollisionType2;
|
3078
|
-
})(CollisionType || {});
|
3079
|
-
var _disabled_dec2;
|
3080
|
-
var _data_dec;
|
3081
|
-
var _id_dec;
|
3082
|
-
var _manager_dec;
|
3083
|
-
var _init22;
|
3084
|
-
var _manager;
|
3085
|
-
var _id;
|
3086
|
-
var _data;
|
3087
|
-
var _disabled2;
|
3088
|
-
_manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
|
3089
|
-
var Entity = class {
|
3090
|
-
/**
|
3091
|
-
* Creates a new instance of the `Entity` class.
|
3092
|
-
*
|
3093
|
-
* @param input - An object containing the initial properties of the entity.
|
3094
|
-
* @param manager - The manager that controls the drag and drop operations.
|
3095
|
-
*/
|
3096
|
-
constructor(input, manager) {
|
3097
|
-
__privateAdd3(this, _manager, __runInitializers2(_init22, 8, this)), __runInitializers2(_init22, 11, this);
|
3098
|
-
__privateAdd3(this, _id, __runInitializers2(_init22, 12, this)), __runInitializers2(_init22, 15, this);
|
3099
|
-
__privateAdd3(this, _data, __runInitializers2(_init22, 16, this)), __runInitializers2(_init22, 19, this);
|
3100
|
-
__privateAdd3(this, _disabled2, __runInitializers2(_init22, 20, this)), __runInitializers2(_init22, 23, this);
|
3101
|
-
this.effects = void 0;
|
3102
|
-
const { effects: effects5, id, data = {}, disabled = false } = input;
|
3103
|
-
let previousId = id;
|
3104
|
-
this.manager = manager;
|
3105
|
-
this.id = id;
|
3106
|
-
this.data = data;
|
3107
|
-
this.disabled = disabled;
|
3108
|
-
this.effects = () => {
|
3109
|
-
var _a;
|
3110
|
-
return [
|
3111
|
-
() => {
|
3112
|
-
const { id: id2, manager: manager2 } = this;
|
3113
|
-
if (id2 === previousId) {
|
3114
|
-
return;
|
3115
|
-
}
|
3116
|
-
manager2 == null ? void 0 : manager2.registry.register(this);
|
3117
|
-
return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
|
3118
|
-
},
|
3119
|
-
...(_a = effects5 == null ? void 0 : effects5()) != null ? _a : []
|
3120
|
-
];
|
3121
|
-
};
|
3122
|
-
this.destroy = this.destroy.bind(this);
|
3123
|
-
if (manager) {
|
3124
|
-
queueMicrotask(() => {
|
3125
|
-
var _a;
|
3126
|
-
(_a = this.manager) == null ? void 0 : _a.registry.register(this);
|
3127
|
-
});
|
3128
|
-
}
|
3129
|
-
}
|
3130
|
-
/**
|
3131
|
-
* A method that registers the entity with the manager.
|
3132
|
-
* @returns CleanupFunction | void
|
3133
|
-
*/
|
3134
|
-
register() {
|
3135
|
-
var _a;
|
3136
|
-
return (_a = this.manager) == null ? void 0 : _a.registry.register(this);
|
3137
|
-
}
|
3138
|
-
/**
|
3139
|
-
* A method that unregisters the entity from the manager.
|
3140
|
-
* @returns void
|
3141
|
-
*/
|
3142
|
-
unregister() {
|
3143
|
-
var _a;
|
3144
|
-
(_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
|
3145
|
-
}
|
3146
|
-
/**
|
3147
|
-
* A method that cleans up the entity when it is no longer needed.
|
3148
|
-
* @returns void
|
3149
|
-
*/
|
3150
|
-
destroy() {
|
3151
|
-
var _a;
|
3152
|
-
(_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
|
3153
|
-
}
|
3154
|
-
};
|
3155
|
-
_init22 = __decoratorStart2(null);
|
3156
|
-
_manager = /* @__PURE__ */ new WeakMap();
|
3157
|
-
_id = /* @__PURE__ */ new WeakMap();
|
3158
|
-
_data = /* @__PURE__ */ new WeakMap();
|
3159
|
-
_disabled2 = /* @__PURE__ */ new WeakMap();
|
3160
|
-
__decorateElement2(_init22, 4, "manager", _manager_dec, Entity, _manager);
|
3161
|
-
__decorateElement2(_init22, 4, "id", _id_dec, Entity, _id);
|
3162
|
-
__decorateElement2(_init22, 4, "data", _data_dec, Entity, _data);
|
3163
|
-
__decorateElement2(_init22, 4, "disabled", _disabled_dec2, Entity, _disabled2);
|
3164
|
-
__decoratorMetadata2(_init22, Entity);
|
3165
|
-
var _isDragSource_dec;
|
3166
|
-
var _status_dec;
|
3167
|
-
var _type_dec;
|
3168
|
-
var _modifiers_dec;
|
3169
|
-
var _c;
|
3170
|
-
var _init3;
|
3171
|
-
var _modifiers;
|
3172
|
-
var _type;
|
3173
|
-
var _status;
|
3174
|
-
var Draggable2 = class extends (_c = Entity, _modifiers_dec = [reactive], _type_dec = [reactive], _status_dec = [reactive], _isDragSource_dec = [derived], _c) {
|
3175
|
-
constructor(_a, manager) {
|
3176
|
-
var _b = _a, { modifiers, type, sensors } = _b, input = __objRest2(_b, ["modifiers", "type", "sensors"]);
|
3177
|
-
super(input, manager);
|
3178
|
-
__runInitializers2(_init3, 5, this);
|
3179
|
-
this.sensors = void 0;
|
3180
|
-
__privateAdd3(this, _modifiers, __runInitializers2(_init3, 8, this)), __runInitializers2(_init3, 11, this);
|
3181
|
-
__privateAdd3(this, _type, __runInitializers2(_init3, 12, this)), __runInitializers2(_init3, 15, this);
|
3182
|
-
__privateAdd3(this, _status, __runInitializers2(_init3, 16, this, "idle")), __runInitializers2(_init3, 19, this);
|
3183
|
-
this.type = type;
|
3184
|
-
this.sensors = sensors;
|
3185
|
-
this.modifiers = modifiers;
|
3186
|
-
}
|
3187
|
-
get isDragSource() {
|
3188
|
-
var _a, _b;
|
3189
|
-
return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.source) == null ? void 0 : _b.id) === this.id;
|
3190
|
-
}
|
3191
|
-
};
|
3192
|
-
_init3 = __decoratorStart2(_c);
|
3193
|
-
_modifiers = /* @__PURE__ */ new WeakMap();
|
3194
|
-
_type = /* @__PURE__ */ new WeakMap();
|
3195
|
-
_status = /* @__PURE__ */ new WeakMap();
|
3196
|
-
__decorateElement2(_init3, 4, "modifiers", _modifiers_dec, Draggable2, _modifiers);
|
3197
|
-
__decorateElement2(_init3, 4, "type", _type_dec, Draggable2, _type);
|
3198
|
-
__decorateElement2(_init3, 4, "status", _status_dec, Draggable2, _status);
|
3199
|
-
__decorateElement2(_init3, 2, "isDragSource", _isDragSource_dec, Draggable2);
|
3200
|
-
__decoratorMetadata2(_init3, Draggable2);
|
3201
|
-
var _isDropTarget_dec;
|
3202
|
-
var _shape_dec;
|
3203
|
-
var _collisionPriority_dec;
|
3204
|
-
var _collisionDetector_dec;
|
3205
|
-
var _type_dec2;
|
3206
|
-
var _accept_dec;
|
3207
|
-
var _c2;
|
3208
|
-
var _init4;
|
3209
|
-
var _accept;
|
3210
|
-
var _type2;
|
3211
|
-
var _collisionDetector;
|
3212
|
-
var _collisionPriority;
|
3213
|
-
var _shape;
|
3214
|
-
var Droppable2 = class extends (_c2 = Entity, _accept_dec = [reactive], _type_dec2 = [reactive], _collisionDetector_dec = [reactive], _collisionPriority_dec = [reactive], _shape_dec = [reactive], _isDropTarget_dec = [derived], _c2) {
|
3215
|
-
constructor(_a, manager) {
|
3216
|
-
var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest2(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
3217
|
-
super(input, manager);
|
3218
|
-
__runInitializers2(_init4, 5, this);
|
3219
|
-
__privateAdd3(this, _accept, __runInitializers2(_init4, 8, this)), __runInitializers2(_init4, 11, this);
|
3220
|
-
__privateAdd3(this, _type2, __runInitializers2(_init4, 12, this)), __runInitializers2(_init4, 15, this);
|
3221
|
-
__privateAdd3(this, _collisionDetector, __runInitializers2(_init4, 16, this)), __runInitializers2(_init4, 19, this);
|
3222
|
-
__privateAdd3(this, _collisionPriority, __runInitializers2(_init4, 20, this)), __runInitializers2(_init4, 23, this);
|
3223
|
-
__privateAdd3(this, _shape, __runInitializers2(_init4, 24, this)), __runInitializers2(_init4, 27, this);
|
3224
|
-
this.accept = accept;
|
3225
|
-
this.collisionDetector = collisionDetector;
|
3226
|
-
this.collisionPriority = collisionPriority;
|
3227
|
-
this.type = type;
|
3228
|
-
}
|
3229
|
-
/**
|
3230
|
-
* Checks whether or not the droppable accepts a given draggable.
|
3231
|
-
*
|
3232
|
-
* @param {Draggable} draggable
|
3233
|
-
* @returns {boolean}
|
3234
|
-
*/
|
3235
|
-
accepts(draggable) {
|
3236
|
-
const { accept } = this;
|
3237
|
-
if (!accept) {
|
3238
|
-
return true;
|
3239
|
-
}
|
3240
|
-
if (typeof accept === "function") {
|
3241
|
-
return accept(draggable);
|
3242
|
-
}
|
3243
|
-
if (!draggable.type) {
|
3244
|
-
return false;
|
3245
|
-
}
|
3246
|
-
if (Array.isArray(accept)) {
|
3247
|
-
return accept.includes(draggable.type);
|
3248
|
-
}
|
3249
|
-
return draggable.type === accept;
|
3250
|
-
}
|
3251
|
-
get isDropTarget() {
|
3252
|
-
var _a, _b;
|
3253
|
-
return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.target) == null ? void 0 : _b.id) === this.id;
|
3254
|
-
}
|
3255
|
-
};
|
3256
|
-
_init4 = __decoratorStart2(_c2);
|
3257
|
-
_accept = /* @__PURE__ */ new WeakMap();
|
3258
|
-
_type2 = /* @__PURE__ */ new WeakMap();
|
3259
|
-
_collisionDetector = /* @__PURE__ */ new WeakMap();
|
3260
|
-
_collisionPriority = /* @__PURE__ */ new WeakMap();
|
3261
|
-
_shape = /* @__PURE__ */ new WeakMap();
|
3262
|
-
__decorateElement2(_init4, 4, "accept", _accept_dec, Droppable2, _accept);
|
3263
|
-
__decorateElement2(_init4, 4, "type", _type_dec2, Droppable2, _type2);
|
3264
|
-
__decorateElement2(_init4, 4, "collisionDetector", _collisionDetector_dec, Droppable2, _collisionDetector);
|
3265
|
-
__decorateElement2(_init4, 4, "collisionPriority", _collisionPriority_dec, Droppable2, _collisionPriority);
|
3266
|
-
__decorateElement2(_init4, 4, "shape", _shape_dec, Droppable2, _shape);
|
3267
|
-
__decorateElement2(_init4, 2, "isDropTarget", _isDropTarget_dec, Droppable2);
|
3268
|
-
__decoratorMetadata2(_init4, Droppable2);
|
3269
|
-
var Sensor = class extends Plugin {
|
3270
|
-
constructor(manager, options) {
|
3271
|
-
super(manager, options);
|
3272
|
-
this.manager = manager;
|
3273
|
-
this.options = options;
|
3274
|
-
}
|
3275
|
-
};
|
2328
|
+
import {
|
2329
|
+
CollisionPriority as CollisionPriority7,
|
2330
|
+
CollisionType as CollisionType7
|
2331
|
+
} from "@dnd-kit/abstract";
|
3276
2332
|
|
3277
2333
|
// components/DraggableComponent/collision/directional/index.ts
|
3278
2334
|
init_react_import();
|
2335
|
+
import { CollisionType } from "@dnd-kit/abstract";
|
3279
2336
|
|
3280
2337
|
// components/DraggableComponent/collision/collision-debug.ts
|
3281
2338
|
init_react_import();
|
3282
2339
|
var DEBUG = false;
|
3283
2340
|
var debugElements = {};
|
3284
2341
|
var timeout;
|
3285
|
-
var collisionDebug = (
|
2342
|
+
var collisionDebug = (a, b, id, color, label) => {
|
3286
2343
|
if (!DEBUG) return;
|
3287
2344
|
const debugId = `${id}-debug`;
|
3288
2345
|
clearTimeout(timeout);
|
@@ -3313,13 +2370,13 @@ var collisionDebug = (a2, b2, id, color, label) => {
|
|
3313
2370
|
document.body.appendChild(svg);
|
3314
2371
|
debugElements[debugId] = { svg, line, text };
|
3315
2372
|
}
|
3316
|
-
line.setAttribute("x1",
|
3317
|
-
line.setAttribute("x2",
|
3318
|
-
line.setAttribute("y1",
|
3319
|
-
line.setAttribute("y2",
|
2373
|
+
line.setAttribute("x1", a.x.toString());
|
2374
|
+
line.setAttribute("x2", b.x.toString());
|
2375
|
+
line.setAttribute("y1", a.y.toString());
|
2376
|
+
line.setAttribute("y2", b.y.toString());
|
3320
2377
|
line.setAttribute("style", `stroke:${color};stroke-width:2`);
|
3321
|
-
text.setAttribute("x", (
|
3322
|
-
text.setAttribute("y", (
|
2378
|
+
text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
|
2379
|
+
text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
|
3323
2380
|
if (label) {
|
3324
2381
|
text.innerHTML = label;
|
3325
2382
|
}
|
@@ -3395,6 +2452,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
|
|
3395
2452
|
|
3396
2453
|
// components/DraggableComponent/collision/dynamic/track-movement-interval.ts
|
3397
2454
|
init_react_import();
|
2455
|
+
import { Point } from "@dnd-kit/geometry";
|
3398
2456
|
var INTERVAL_SENSITIVITY = 10;
|
3399
2457
|
var intervalCache = {
|
3400
2458
|
current: { x: 0, y: 0 },
|
@@ -3417,6 +2475,18 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
|
|
3417
2475
|
|
3418
2476
|
// ../../node_modules/@dnd-kit/collision/dist/index.js
|
3419
2477
|
init_react_import();
|
2478
|
+
import { CollisionPriority, CollisionType as CollisionType2 } from "@dnd-kit/abstract";
|
2479
|
+
import { Point as Point2 } from "@dnd-kit/geometry";
|
2480
|
+
import { CollisionPriority as CollisionPriority2, CollisionType as CollisionType22 } from "@dnd-kit/abstract";
|
2481
|
+
import { Point as Point22 } from "@dnd-kit/geometry";
|
2482
|
+
import { CollisionPriority as CollisionPriority3, CollisionType as CollisionType3 } from "@dnd-kit/abstract";
|
2483
|
+
import { Point as Point3 } from "@dnd-kit/geometry";
|
2484
|
+
import { CollisionPriority as CollisionPriority4, CollisionType as CollisionType4 } from "@dnd-kit/abstract";
|
2485
|
+
import { Point as Point4 } from "@dnd-kit/geometry";
|
2486
|
+
import { CollisionPriority as CollisionPriority5, CollisionType as CollisionType5 } from "@dnd-kit/abstract";
|
2487
|
+
import { Point as Point5 } from "@dnd-kit/geometry";
|
2488
|
+
import { CollisionPriority as CollisionPriority6, CollisionType as CollisionType6 } from "@dnd-kit/abstract";
|
2489
|
+
import { Point as Point6 } from "@dnd-kit/geometry";
|
3420
2490
|
var pointerIntersection = ({
|
3421
2491
|
dragOperation,
|
3422
2492
|
droppable
|
@@ -3430,11 +2500,11 @@ var pointerIntersection = ({
|
|
3430
2500
|
return null;
|
3431
2501
|
}
|
3432
2502
|
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
3433
|
-
const distance =
|
2503
|
+
const distance = Point2.distance(droppable.shape.center, pointerCoordinates);
|
3434
2504
|
return {
|
3435
2505
|
id,
|
3436
2506
|
value: 1 / distance,
|
3437
|
-
type:
|
2507
|
+
type: CollisionType2.PointerIntersection,
|
3438
2508
|
priority: CollisionPriority.High
|
3439
2509
|
};
|
3440
2510
|
}
|
@@ -3468,8 +2538,8 @@ var closestCorners = (input) => {
|
|
3468
2538
|
const distance = corners.reduce(
|
3469
2539
|
(acc, corner) => {
|
3470
2540
|
var _a;
|
3471
|
-
return acc +
|
3472
|
-
|
2541
|
+
return acc + Point3.distance(
|
2542
|
+
Point3.from(corner),
|
3473
2543
|
(_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
|
3474
2544
|
);
|
3475
2545
|
},
|
@@ -3479,15 +2549,15 @@ var closestCorners = (input) => {
|
|
3479
2549
|
return {
|
3480
2550
|
id: droppable.id,
|
3481
2551
|
value: 1 / value,
|
3482
|
-
type:
|
3483
|
-
priority:
|
2552
|
+
type: CollisionType3.Collision,
|
2553
|
+
priority: CollisionPriority3.Normal
|
3484
2554
|
};
|
3485
2555
|
};
|
3486
2556
|
|
3487
2557
|
// components/DraggableComponent/collision/dynamic/index.ts
|
3488
2558
|
var flushNext = "";
|
3489
2559
|
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
3490
|
-
var _a, _b,
|
2560
|
+
var _a, _b, _c, _d, _e;
|
3491
2561
|
const { dragOperation, droppable } = input;
|
3492
2562
|
const { position } = dragOperation;
|
3493
2563
|
const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
|
@@ -3517,7 +2587,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3517
2587
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
|
3518
2588
|
if (collision) {
|
3519
2589
|
return __spreadProps(__spreadValues({}, collision), {
|
3520
|
-
priority:
|
2590
|
+
priority: CollisionPriority7.Highest
|
3521
2591
|
});
|
3522
2592
|
}
|
3523
2593
|
}
|
@@ -3534,14 +2604,14 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3534
2604
|
const collision = {
|
3535
2605
|
id: droppable.id,
|
3536
2606
|
value: intersectionRatio,
|
3537
|
-
priority:
|
3538
|
-
type:
|
2607
|
+
priority: CollisionPriority7.High,
|
2608
|
+
type: CollisionType7.Collision
|
3539
2609
|
};
|
3540
2610
|
const shouldFlushId = flushNext === droppable.id;
|
3541
2611
|
flushNext = "";
|
3542
2612
|
return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
|
3543
2613
|
}
|
3544
|
-
if (((
|
2614
|
+
if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
3545
2615
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
3546
2616
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
3547
2617
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
@@ -3564,7 +2634,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3564
2634
|
);
|
3565
2635
|
flushNext = droppable.id;
|
3566
2636
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
3567
|
-
priority:
|
2637
|
+
priority: CollisionPriority7.Low
|
3568
2638
|
});
|
3569
2639
|
}
|
3570
2640
|
collisionDebug(
|
@@ -3574,7 +2644,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3574
2644
|
"orange",
|
3575
2645
|
direction || ""
|
3576
2646
|
);
|
3577
|
-
return __spreadProps(__spreadValues({}, fallbackCollision), { priority:
|
2647
|
+
return __spreadProps(__spreadValues({}, fallbackCollision), { priority: CollisionPriority7.Lowest });
|
3578
2648
|
}
|
3579
2649
|
}
|
3580
2650
|
}
|
@@ -3612,6 +2682,25 @@ function useSortableSafe(input) {
|
|
3612
2682
|
return useSortable(input);
|
3613
2683
|
}
|
3614
2684
|
|
2685
|
+
// lib/get-deep-scroll-position.ts
|
2686
|
+
init_react_import();
|
2687
|
+
function getDeepScrollPosition(element) {
|
2688
|
+
let totalScroll = {
|
2689
|
+
x: 0,
|
2690
|
+
y: 0
|
2691
|
+
};
|
2692
|
+
let current = element;
|
2693
|
+
while (current && current !== document.documentElement) {
|
2694
|
+
const parent = current.parentElement;
|
2695
|
+
if (parent) {
|
2696
|
+
totalScroll.x += parent.scrollLeft;
|
2697
|
+
totalScroll.y += parent.scrollTop;
|
2698
|
+
}
|
2699
|
+
current = parent;
|
2700
|
+
}
|
2701
|
+
return totalScroll;
|
2702
|
+
}
|
2703
|
+
|
3615
2704
|
// components/DraggableComponent/index.tsx
|
3616
2705
|
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
3617
2706
|
var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
@@ -3622,8 +2711,23 @@ var actionsTop = -(actionsOverlayTop - 8);
|
|
3622
2711
|
var actionsSide = space;
|
3623
2712
|
var DefaultActionBar = ({
|
3624
2713
|
label,
|
3625
|
-
children
|
3626
|
-
|
2714
|
+
children,
|
2715
|
+
parentAction
|
2716
|
+
}) => /* @__PURE__ */ jsxs10(ActionBar, { children: [
|
2717
|
+
/* @__PURE__ */ jsxs10(ActionBar.Group, { children: [
|
2718
|
+
parentAction,
|
2719
|
+
label && /* @__PURE__ */ jsx21(ActionBar.Label, { label })
|
2720
|
+
] }),
|
2721
|
+
/* @__PURE__ */ jsx21(ActionBar.Group, { children })
|
2722
|
+
] });
|
2723
|
+
var convertIdToSelector = (id, zoneCompound, data) => {
|
2724
|
+
const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
|
2725
|
+
const index = content.findIndex((item) => item.props.id === id);
|
2726
|
+
return {
|
2727
|
+
zone: zoneCompound || "",
|
2728
|
+
index
|
2729
|
+
};
|
2730
|
+
};
|
3627
2731
|
var DraggableComponent = ({
|
3628
2732
|
children,
|
3629
2733
|
depth,
|
@@ -3685,6 +2789,7 @@ var DraggableComponent = ({
|
|
3685
2789
|
group: zoneCompound,
|
3686
2790
|
type: "component",
|
3687
2791
|
data: {
|
2792
|
+
areaId: ctx == null ? void 0 : ctx.areaId,
|
3688
2793
|
zone: zoneCompound,
|
3689
2794
|
index,
|
3690
2795
|
componentType,
|
@@ -3715,22 +2820,22 @@ var DraggableComponent = ({
|
|
3715
2820
|
);
|
3716
2821
|
const [portalEl, setPortalEl] = useState12();
|
3717
2822
|
useEffect11(() => {
|
3718
|
-
var _a, _b;
|
2823
|
+
var _a, _b, _c;
|
3719
2824
|
setPortalEl(
|
3720
|
-
|
2825
|
+
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
|
3721
2826
|
);
|
3722
|
-
}, [iframe.enabled]);
|
2827
|
+
}, [iframe.enabled, ref.current]);
|
3723
2828
|
const getStyle = useCallback6(() => {
|
3724
|
-
var _a, _b;
|
2829
|
+
var _a, _b, _c;
|
3725
2830
|
if (!ref.current) return;
|
3726
2831
|
const rect = ref.current.getBoundingClientRect();
|
3727
|
-
const
|
3728
|
-
const
|
3729
|
-
const portalContainerEl = iframe.enabled ? null : document.getElementById("puck-preview");
|
2832
|
+
const deepScrollPosition = getDeepScrollPosition(ref.current);
|
2833
|
+
const portalContainerEl = iframe.enabled ? null : (_a = ref.current) == null ? void 0 : _a.closest("[data-puck-preview]");
|
3730
2834
|
const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
|
2835
|
+
const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
|
3731
2836
|
const scroll = {
|
3732
|
-
x:
|
3733
|
-
y:
|
2837
|
+
x: deepScrollPosition.x - portalScroll.x - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _b : 0),
|
2838
|
+
y: deepScrollPosition.y - portalScroll.y - ((_c = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _c : 0)
|
3734
2839
|
};
|
3735
2840
|
const style2 = {
|
3736
2841
|
left: `${rect.left + scroll.x}px`,
|
@@ -3739,11 +2844,20 @@ var DraggableComponent = ({
|
|
3739
2844
|
width: `${rect.width}px`
|
3740
2845
|
};
|
3741
2846
|
return style2;
|
3742
|
-
}, [ref
|
2847
|
+
}, [ref.current]);
|
3743
2848
|
const [style, setStyle] = useState12();
|
3744
2849
|
const sync = useCallback6(() => {
|
3745
2850
|
setStyle(getStyle());
|
3746
|
-
}, [ref, iframe]);
|
2851
|
+
}, [ref.current, iframe]);
|
2852
|
+
useEffect11(() => {
|
2853
|
+
if (ref.current) {
|
2854
|
+
const observer = new ResizeObserver(sync);
|
2855
|
+
observer.observe(ref.current);
|
2856
|
+
return () => {
|
2857
|
+
observer.disconnect();
|
2858
|
+
};
|
2859
|
+
}
|
2860
|
+
}, [ref.current]);
|
3747
2861
|
useEffect11(() => {
|
3748
2862
|
ctx == null ? void 0 : ctx.registerPath({
|
3749
2863
|
index,
|
@@ -3758,8 +2872,8 @@ var DraggableComponent = ({
|
|
3758
2872
|
item: selectedItem
|
3759
2873
|
});
|
3760
2874
|
const onClick = useCallback6(
|
3761
|
-
(
|
3762
|
-
|
2875
|
+
(e) => {
|
2876
|
+
e.stopPropagation();
|
3763
2877
|
dispatch({
|
3764
2878
|
type: "setUi",
|
3765
2879
|
ui: {
|
@@ -3769,28 +2883,38 @@ var DraggableComponent = ({
|
|
3769
2883
|
},
|
3770
2884
|
[index, zoneCompound, id]
|
3771
2885
|
);
|
3772
|
-
const
|
3773
|
-
(
|
3774
|
-
|
3775
|
-
|
3776
|
-
|
3777
|
-
|
3778
|
-
|
3779
|
-
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
|
3784
|
-
|
3785
|
-
|
3786
|
-
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
2886
|
+
const onSelectParent = useCallback6(() => {
|
2887
|
+
if (!(ctx == null ? void 0 : ctx.areaId)) {
|
2888
|
+
return;
|
2889
|
+
}
|
2890
|
+
const parentAreaId = ctx.areaId;
|
2891
|
+
const parentZone = path[path.length - 3];
|
2892
|
+
const parentItemSelector = convertIdToSelector(
|
2893
|
+
parentAreaId,
|
2894
|
+
parentZone,
|
2895
|
+
state.data
|
2896
|
+
);
|
2897
|
+
dispatch({
|
2898
|
+
type: "setUi",
|
2899
|
+
ui: {
|
2900
|
+
itemSelector: parentItemSelector
|
2901
|
+
}
|
2902
|
+
});
|
2903
|
+
}, [ctx, path]);
|
2904
|
+
const onDuplicate = useCallback6(() => {
|
2905
|
+
dispatch({
|
2906
|
+
type: "duplicate",
|
2907
|
+
sourceIndex: index,
|
2908
|
+
sourceZone: zoneCompound
|
2909
|
+
});
|
2910
|
+
}, [index, zoneCompound]);
|
2911
|
+
const onDelete = useCallback6(() => {
|
2912
|
+
dispatch({
|
2913
|
+
type: "remove",
|
2914
|
+
index,
|
2915
|
+
zone: zoneCompound
|
2916
|
+
});
|
2917
|
+
}, [index, zoneCompound]);
|
3794
2918
|
const [hover, setHover] = useState12(false);
|
3795
2919
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
3796
2920
|
useEffect11(() => {
|
@@ -3798,7 +2922,7 @@ var DraggableComponent = ({
|
|
3798
2922
|
return;
|
3799
2923
|
}
|
3800
2924
|
const el = ref.current;
|
3801
|
-
const _onMouseOver = (
|
2925
|
+
const _onMouseOver = (e) => {
|
3802
2926
|
if (userIsDragging) {
|
3803
2927
|
if (thisIsDragging) {
|
3804
2928
|
setHover(true);
|
@@ -3808,10 +2932,10 @@ var DraggableComponent = ({
|
|
3808
2932
|
} else {
|
3809
2933
|
setHover(true);
|
3810
2934
|
}
|
3811
|
-
|
2935
|
+
e.stopPropagation();
|
3812
2936
|
};
|
3813
|
-
const _onMouseOut = (
|
3814
|
-
|
2937
|
+
const _onMouseOut = (e) => {
|
2938
|
+
e.stopPropagation();
|
3815
2939
|
setHover(false);
|
3816
2940
|
};
|
3817
2941
|
el.setAttribute("data-puck-component", id);
|
@@ -3893,6 +3017,7 @@ var DraggableComponent = ({
|
|
3893
3017
|
}
|
3894
3018
|
setDragAxis(autoDragAxis);
|
3895
3019
|
}, [ref, userDragAxis, autoDragAxis]);
|
3020
|
+
const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ jsx21(CornerLeftUp, { size: 16 }) });
|
3896
3021
|
return /* @__PURE__ */ jsxs10(
|
3897
3022
|
DropZoneProvider,
|
3898
3023
|
{
|
@@ -3938,10 +3063,17 @@ var DraggableComponent = ({
|
|
3938
3063
|
paddingRight: actionsSide
|
3939
3064
|
},
|
3940
3065
|
ref: syncActionsPosition,
|
3941
|
-
children: /* @__PURE__ */ jsxs10(
|
3942
|
-
|
3943
|
-
|
3944
|
-
|
3066
|
+
children: /* @__PURE__ */ jsxs10(
|
3067
|
+
CustomActionBar,
|
3068
|
+
{
|
3069
|
+
parentAction,
|
3070
|
+
label: DEBUG2 ? id : label,
|
3071
|
+
children: [
|
3072
|
+
permissions.duplicate && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx21(Copy, { size: 16 }) }),
|
3073
|
+
permissions.delete && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx21(Trash, { size: 16 }) })
|
3074
|
+
]
|
3075
|
+
}
|
3076
|
+
)
|
3945
3077
|
}
|
3946
3078
|
)
|
3947
3079
|
}
|
@@ -4216,12 +3348,12 @@ function DropZoneEdit({
|
|
4216
3348
|
"--min-empty-height": `${minEmptyHeight}px`
|
4217
3349
|
}),
|
4218
3350
|
children: [
|
4219
|
-
isRootZone && DEBUG3 && /* @__PURE__ */ jsxs11(
|
3351
|
+
isRootZone && DEBUG3 && /* @__PURE__ */ jsxs11("div", { "data-puck-component": true, children: [
|
4220
3352
|
/* @__PURE__ */ jsx23("p", { children: deepestZone || rootDroppableId }),
|
4221
3353
|
/* @__PURE__ */ jsx23("p", { children: deepestArea || "No area" })
|
4222
3354
|
] }),
|
4223
|
-
contentWithPreview.map((item,
|
4224
|
-
var _a, _b,
|
3355
|
+
contentWithPreview.map((item, i) => {
|
3356
|
+
var _a, _b, _c, _d, _e;
|
4225
3357
|
const componentId = item.props.id;
|
4226
3358
|
const puckProps = {
|
4227
3359
|
renderDropZone: DropZone,
|
@@ -4247,7 +3379,7 @@ function DropZoneEdit({
|
|
4247
3379
|
};
|
4248
3380
|
var Preview2 = Preview3;
|
4249
3381
|
componentType = preview.componentType;
|
4250
|
-
label = (_d = (
|
3382
|
+
label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
|
4251
3383
|
Render2 = Preview3;
|
4252
3384
|
}
|
4253
3385
|
return /* @__PURE__ */ jsx23(
|
@@ -4261,7 +3393,7 @@ function DropZoneEdit({
|
|
4261
3393
|
componentType,
|
4262
3394
|
zoneCompound,
|
4263
3395
|
depth: depth + 1,
|
4264
|
-
index:
|
3396
|
+
index: i,
|
4265
3397
|
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
4266
3398
|
isSelected,
|
4267
3399
|
label,
|
@@ -4347,6 +3479,8 @@ var getZoneId = (zoneCompound) => {
|
|
4347
3479
|
|
4348
3480
|
// components/DragDropContext/NestedDroppablePlugin.ts
|
4349
3481
|
init_react_import();
|
3482
|
+
import { Plugin } from "@dnd-kit/abstract";
|
3483
|
+
import { effects } from "@dnd-kit/state";
|
4350
3484
|
|
4351
3485
|
// lib/throttle.ts
|
4352
3486
|
init_react_import();
|
@@ -4381,9 +3515,9 @@ function isPositionInsideRect(position, rect) {
|
|
4381
3515
|
var BUFFER_ZONE = 8;
|
4382
3516
|
var REFRESH_ON_MOVE = true;
|
4383
3517
|
var depthSort = (candidates) => {
|
4384
|
-
return candidates.sort((
|
4385
|
-
const aData =
|
4386
|
-
const bData =
|
3518
|
+
return candidates.sort((a, b) => {
|
3519
|
+
const aData = a.data;
|
3520
|
+
const bData = b.data;
|
4387
3521
|
if (aData.depth > bData.depth) {
|
4388
3522
|
return 1;
|
4389
3523
|
}
|
@@ -4408,24 +3542,6 @@ var getZoneId2 = (candidate) => {
|
|
4408
3542
|
}
|
4409
3543
|
return id;
|
4410
3544
|
};
|
4411
|
-
var getAreaId = (candidate) => {
|
4412
|
-
if (candidate.type === "component") {
|
4413
|
-
const data = candidate.data;
|
4414
|
-
if (data.containsActiveZone) {
|
4415
|
-
return candidate.id;
|
4416
|
-
}
|
4417
|
-
}
|
4418
|
-
return null;
|
4419
|
-
};
|
4420
|
-
var getDeepestId = (candidates, idFn) => {
|
4421
|
-
let id = null;
|
4422
|
-
for (let i2 = 0; i2 < candidates.length; i2++) {
|
4423
|
-
const candidate = candidates[i2];
|
4424
|
-
id = idFn(candidate);
|
4425
|
-
if (id) break;
|
4426
|
-
}
|
4427
|
-
return id;
|
4428
|
-
};
|
4429
3545
|
var expandHitBox = (rect) => {
|
4430
3546
|
return {
|
4431
3547
|
bottom: rect.bottom + BUFFER_ZONE,
|
@@ -4484,12 +3600,17 @@ var findDeepestCandidate = (position, manager) => {
|
|
4484
3600
|
if (candidateData2.areaId === draggedCandidateId) {
|
4485
3601
|
return false;
|
4486
3602
|
}
|
3603
|
+
} else if (candidate.type === "component") {
|
3604
|
+
const candidateData2 = candidate.data;
|
3605
|
+
if (!candidateData2.inDroppableZone) {
|
3606
|
+
return false;
|
3607
|
+
}
|
4487
3608
|
}
|
4488
3609
|
return true;
|
4489
3610
|
});
|
4490
3611
|
filteredCandidates.reverse();
|
4491
3612
|
const zone = getZoneId2(filteredCandidates[0]);
|
4492
|
-
const area =
|
3613
|
+
const area = filteredCandidates[0].data.areaId || null;
|
4493
3614
|
return { zone, area };
|
4494
3615
|
}
|
4495
3616
|
return {
|
@@ -4614,7 +3735,7 @@ function duplicateRelatedZones(item, data, newId) {
|
|
4614
3735
|
(dupeOfDupes2, item2, index) => __spreadValues(__spreadValues({}, dupeOfDupes2), duplicateRelatedZones(zone[index], data, item2.props.id).zones),
|
4615
3736
|
acc
|
4616
3737
|
);
|
4617
|
-
const [
|
3738
|
+
const [_, zoneId] = getZoneId(key);
|
4618
3739
|
return __spreadProps(__spreadValues({}, dupeOfDupes), {
|
4619
3740
|
[key]: zone,
|
4620
3741
|
[`${newId}:${zoneId}`]: dupedZone
|
@@ -4934,6 +4055,11 @@ import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
|
|
4934
4055
|
|
4935
4056
|
// components/DragDropContext/PointerSensor.ts
|
4936
4057
|
init_react_import();
|
4058
|
+
import { batch, effect } from "@dnd-kit/state";
|
4059
|
+
import { Sensor, configurator } from "@dnd-kit/abstract";
|
4060
|
+
import {
|
4061
|
+
exceedsDistance
|
4062
|
+
} from "@dnd-kit/geometry";
|
4937
4063
|
import {
|
4938
4064
|
getDocument,
|
4939
4065
|
isElement,
|
@@ -4955,7 +4081,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
4955
4081
|
this.handleCancel = this.handleCancel.bind(this);
|
4956
4082
|
this.handlePointerUp = this.handlePointerUp.bind(this);
|
4957
4083
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
4958
|
-
|
4084
|
+
effect(() => {
|
4959
4085
|
const unbindGlobal = this.bindGlobal(options != null ? options : {});
|
4960
4086
|
return () => {
|
4961
4087
|
unbindGlobal();
|
@@ -4963,7 +4089,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
4963
4089
|
});
|
4964
4090
|
}
|
4965
4091
|
bind(source, options = this.options) {
|
4966
|
-
const unbind =
|
4092
|
+
const unbind = effect(() => {
|
4967
4093
|
var _a;
|
4968
4094
|
const target = (_a = source.handle) != null ? _a : source.element;
|
4969
4095
|
const listener = (event) => {
|
@@ -5126,7 +4252,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5126
4252
|
return;
|
5127
4253
|
}
|
5128
4254
|
event.preventDefault();
|
5129
|
-
|
4255
|
+
batch(() => {
|
5130
4256
|
manager.actions.setDragSource(source.id);
|
5131
4257
|
manager.actions.start({ coordinates: initialCoordinates, event });
|
5132
4258
|
});
|
@@ -5214,7 +4340,10 @@ function useDragListener(type, fn, deps = []) {
|
|
5214
4340
|
}
|
5215
4341
|
var previewContext = createContext3(null);
|
5216
4342
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
5217
|
-
var DragDropContextClient = ({
|
4343
|
+
var DragDropContextClient = ({
|
4344
|
+
children,
|
4345
|
+
disableAutoScroll
|
4346
|
+
}) => {
|
5218
4347
|
const { state, config, dispatch, resolveData } = useAppContext();
|
5219
4348
|
const [preview, setPreview] = useState15(null);
|
5220
4349
|
const previewRef = useRef5(null);
|
@@ -5222,45 +4351,63 @@ var DragDropContextClient = ({ children }) => {
|
|
5222
4351
|
const [deepest, setDeepest] = useState15(null);
|
5223
4352
|
const [nextDeepest, setNextDeepest] = useState15(null);
|
5224
4353
|
const deepestRef = useRef5(deepest);
|
5225
|
-
const
|
5226
|
-
const
|
5227
|
-
|
5228
|
-
|
5229
|
-
|
5230
|
-
|
5231
|
-
|
5232
|
-
|
5233
|
-
if (deepestRef.current === null || ((_a = deepestRef.current) == null ? void 0 : _a.zone) === "void" || params.zone && params.area && ((_b = dbDeepestRef.current) == null ? void 0 : _b.area) === params.area) {
|
5234
|
-
setDeepest(params);
|
5235
|
-
} else {
|
5236
|
-
setDeepestDb(params);
|
5237
|
-
}
|
5238
|
-
if (!dbDeepestRef.current) {
|
5239
|
-
dbDeepestRef.current = params;
|
5240
|
-
}
|
4354
|
+
const debouncedParamsRef = useRef5(null);
|
4355
|
+
const setDeepestAndCollide = useCallback9(
|
4356
|
+
(params, manager) => {
|
4357
|
+
setDeepest(params);
|
4358
|
+
setTimeout(() => {
|
4359
|
+
manager.collisionObserver.forceUpdate(true);
|
4360
|
+
}, 50);
|
4361
|
+
debouncedParamsRef.current = null;
|
5241
4362
|
},
|
5242
|
-
[
|
4363
|
+
[]
|
4364
|
+
);
|
4365
|
+
const setDeepestDb = useDebouncedCallback2(
|
4366
|
+
setDeepestAndCollide,
|
4367
|
+
AREA_CHANGE_DEBOUNCE_MS
|
5243
4368
|
);
|
4369
|
+
useEffect13(() => {
|
4370
|
+
deepestRef.current = deepest;
|
4371
|
+
}, [deepest]);
|
4372
|
+
const cancelDb = () => {
|
4373
|
+
setDeepestDb.cancel();
|
4374
|
+
debouncedParamsRef.current = null;
|
4375
|
+
};
|
5244
4376
|
const [plugins] = useState15(() => [
|
5245
|
-
...defaultPreset.plugins,
|
4377
|
+
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
5246
4378
|
createNestedDroppablePlugin({
|
5247
4379
|
onChange: (params, manager) => {
|
5248
|
-
|
5249
|
-
const
|
5250
|
-
|
5251
|
-
|
5252
|
-
|
4380
|
+
const lastParams = deepestRef.current;
|
4381
|
+
const areaChanged = params.area !== (lastParams == null ? void 0 : lastParams.area);
|
4382
|
+
const zoneChanged = params.zone !== (lastParams == null ? void 0 : lastParams.zone);
|
4383
|
+
const isDragging = manager.dragOperation.status.dragging;
|
4384
|
+
if (areaChanged || zoneChanged) {
|
4385
|
+
setNextDeepest(params);
|
4386
|
+
}
|
4387
|
+
if (params.zone !== "void" && (lastParams == null ? void 0 : lastParams.zone) === "void") {
|
4388
|
+
setDeepest(params);
|
4389
|
+
manager.collisionObserver.forceUpdate(true);
|
4390
|
+
return;
|
4391
|
+
}
|
4392
|
+
if (areaChanged) {
|
4393
|
+
if (isDragging) {
|
4394
|
+
const debouncedParams = debouncedParamsRef.current;
|
4395
|
+
const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
|
4396
|
+
if (!isSameParams) {
|
4397
|
+
cancelDb();
|
4398
|
+
setDeepestDb(params, manager);
|
4399
|
+
debouncedParamsRef.current = params;
|
4400
|
+
}
|
5253
4401
|
} else {
|
5254
|
-
|
4402
|
+
cancelDb();
|
4403
|
+
setDeepestAndCollide(params, manager);
|
5255
4404
|
}
|
5256
|
-
|
4405
|
+
return;
|
5257
4406
|
}
|
5258
|
-
if (
|
5259
|
-
|
5260
|
-
manager.collisionObserver.forceUpdate(true);
|
5261
|
-
}, 50);
|
4407
|
+
if (zoneChanged) {
|
4408
|
+
setDeepestAndCollide(params, manager);
|
5262
4409
|
}
|
5263
|
-
|
4410
|
+
cancelDb();
|
5264
4411
|
}
|
5265
4412
|
})
|
5266
4413
|
]);
|
@@ -5330,24 +4477,25 @@ var DragDropContextClient = ({ children }) => {
|
|
5330
4477
|
return;
|
5331
4478
|
}
|
5332
4479
|
const { zone, index } = source.data;
|
4480
|
+
const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
|
4481
|
+
previewRef.current = null;
|
5333
4482
|
setTimeout(() => {
|
5334
4483
|
var _a, _b;
|
5335
4484
|
setDraggedItem(null);
|
5336
4485
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
5337
4486
|
setPreview(null);
|
5338
|
-
previewRef.current = null;
|
5339
4487
|
(_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
|
5340
4488
|
fn(event, manager);
|
5341
4489
|
});
|
5342
4490
|
return;
|
5343
4491
|
}
|
5344
|
-
if (
|
4492
|
+
if (thisPreview) {
|
5345
4493
|
setPreview(null);
|
5346
|
-
if (
|
4494
|
+
if (thisPreview.type === "insert") {
|
5347
4495
|
insertComponent(
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
4496
|
+
thisPreview.componentType,
|
4497
|
+
thisPreview.zone,
|
4498
|
+
thisPreview.index,
|
5351
4499
|
{ config, dispatch, resolveData, state }
|
5352
4500
|
);
|
5353
4501
|
} else if (initialSelector.current) {
|
@@ -5355,12 +4503,11 @@ var DragDropContextClient = ({ children }) => {
|
|
5355
4503
|
type: "move",
|
5356
4504
|
sourceIndex: initialSelector.current.index,
|
5357
4505
|
sourceZone: initialSelector.current.zone,
|
5358
|
-
destinationIndex:
|
5359
|
-
destinationZone:
|
4506
|
+
destinationIndex: thisPreview.index,
|
4507
|
+
destinationZone: thisPreview.zone,
|
5360
4508
|
recordHistory: false
|
5361
4509
|
});
|
5362
4510
|
}
|
5363
|
-
previewRef.current = null;
|
5364
4511
|
}
|
5365
4512
|
dispatch({
|
5366
4513
|
type: "setUi",
|
@@ -5376,9 +4523,10 @@ var DragDropContextClient = ({ children }) => {
|
|
5376
4523
|
}, 300);
|
5377
4524
|
},
|
5378
4525
|
onDragOver: (event, manager) => {
|
5379
|
-
var _a, _b,
|
4526
|
+
var _a, _b, _c, _d;
|
5380
4527
|
event.preventDefault();
|
5381
4528
|
if (!draggedItem) return;
|
4529
|
+
cancelDb();
|
5382
4530
|
const { source, target } = event.operation;
|
5383
4531
|
if (!target || !source || target.type === "void") return;
|
5384
4532
|
const [sourceId] = source.id.split(":");
|
@@ -5404,7 +4552,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5404
4552
|
targetZone = target.id.toString();
|
5405
4553
|
targetIndex = 0;
|
5406
4554
|
}
|
5407
|
-
if (targetId === sourceId || ((
|
4555
|
+
if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
|
5408
4556
|
const [pathId] = path.split(":");
|
5409
4557
|
return pathId === sourceId;
|
5410
4558
|
}))) {
|
@@ -5494,12 +4642,15 @@ var DragDropContextClient = ({ children }) => {
|
|
5494
4642
|
}
|
5495
4643
|
);
|
5496
4644
|
};
|
5497
|
-
var DragDropContext2 = ({
|
4645
|
+
var DragDropContext2 = ({
|
4646
|
+
children,
|
4647
|
+
disableAutoScroll
|
4648
|
+
}) => {
|
5498
4649
|
const { status } = useAppContext();
|
5499
4650
|
if (status === "LOADING") {
|
5500
4651
|
return children;
|
5501
4652
|
}
|
5502
|
-
return /* @__PURE__ */ jsx24(DragDropContextClient, { children });
|
4653
|
+
return /* @__PURE__ */ jsx24(DragDropContextClient, { disableAutoScroll, children });
|
5503
4654
|
};
|
5504
4655
|
|
5505
4656
|
// components/Drawer/index.tsx
|
@@ -5522,7 +4673,7 @@ var DrawerItemInner = ({
|
|
5522
4673
|
{
|
5523
4674
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
5524
4675
|
ref: dragRef,
|
5525
|
-
onMouseDown: (
|
4676
|
+
onMouseDown: (e) => e.preventDefault(),
|
5526
4677
|
children: /* @__PURE__ */ jsx25(CustomInner, { name, children: /* @__PURE__ */ jsx25("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs12("div", { className: getClassNameItem2("draggable"), children: [
|
5527
4678
|
/* @__PURE__ */ jsx25("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
5528
4679
|
/* @__PURE__ */ jsx25("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx25(DragIcon, {}) })
|
@@ -5716,7 +4867,7 @@ var SidebarSection = ({
|
|
5716
4867
|
style: { background },
|
5717
4868
|
children: [
|
5718
4869
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumbs"), children: [
|
5719
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb,
|
4870
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumb"), children: [
|
5720
4871
|
/* @__PURE__ */ jsx26(
|
5721
4872
|
"button",
|
5722
4873
|
{
|
@@ -5727,7 +4878,7 @@ var SidebarSection = ({
|
|
5727
4878
|
}
|
5728
4879
|
),
|
5729
4880
|
/* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
|
5730
|
-
] },
|
4881
|
+
] }, i)) : null,
|
5731
4882
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
|
5732
4883
|
] }) }),
|
5733
4884
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
|
@@ -5937,8 +5088,8 @@ var Fields = () => {
|
|
5937
5088
|
"form",
|
5938
5089
|
{
|
5939
5090
|
className: getClassName21(),
|
5940
|
-
onSubmit: (
|
5941
|
-
|
5091
|
+
onSubmit: (e) => {
|
5092
|
+
e.preventDefault();
|
5942
5093
|
},
|
5943
5094
|
children: [
|
5944
5095
|
/* @__PURE__ */ jsx28(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
@@ -6122,7 +5273,7 @@ import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6122
5273
|
var useComponentList = (config, ui) => {
|
6123
5274
|
const [componentList, setComponentList] = useState18();
|
6124
5275
|
useEffect15(() => {
|
6125
|
-
var _a, _b,
|
5276
|
+
var _a, _b, _c;
|
6126
5277
|
if (Object.keys(ui.componentList).length > 0) {
|
6127
5278
|
const matchedComponents = [];
|
6128
5279
|
let _componentList;
|
@@ -6136,7 +5287,7 @@ var useComponentList = (config, ui) => {
|
|
6136
5287
|
{
|
6137
5288
|
id: categoryKey,
|
6138
5289
|
title: category.title || categoryKey,
|
6139
|
-
children: category.components.map((componentName,
|
5290
|
+
children: category.components.map((componentName, i) => {
|
6140
5291
|
var _a2;
|
6141
5292
|
matchedComponents.push(componentName);
|
6142
5293
|
const componentConf = config.components[componentName] || {};
|
@@ -6145,7 +5296,7 @@ var useComponentList = (config, ui) => {
|
|
6145
5296
|
{
|
6146
5297
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
6147
5298
|
name: componentName,
|
6148
|
-
index:
|
5299
|
+
index: i
|
6149
5300
|
},
|
6150
5301
|
componentName
|
6151
5302
|
);
|
@@ -6164,8 +5315,8 @@ var useComponentList = (config, ui) => {
|
|
6164
5315
|
ComponentList,
|
6165
5316
|
{
|
6166
5317
|
id: "other",
|
6167
|
-
title: ((
|
6168
|
-
children: remainingComponents.map((componentName,
|
5318
|
+
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
5319
|
+
children: remainingComponents.map((componentName, i) => {
|
6169
5320
|
var _a2;
|
6170
5321
|
const componentConf = config.components[componentName] || {};
|
6171
5322
|
return /* @__PURE__ */ jsx30(
|
@@ -6173,7 +5324,7 @@ var useComponentList = (config, ui) => {
|
|
6173
5324
|
{
|
6174
5325
|
name: componentName,
|
6175
5326
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
6176
|
-
index:
|
5327
|
+
index: i
|
6177
5328
|
},
|
6178
5329
|
componentName
|
6179
5330
|
);
|
@@ -6232,7 +5383,7 @@ var getStyles = (styleSheet) => {
|
|
6232
5383
|
if (styleSheet) {
|
6233
5384
|
try {
|
6234
5385
|
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
6235
|
-
} catch (
|
5386
|
+
} catch (e) {
|
6236
5387
|
console.warn(
|
6237
5388
|
"Access to stylesheet %s is denied. Ignoring\u2026",
|
6238
5389
|
styleSheet.href
|
@@ -6369,7 +5520,7 @@ var CopyHostStyles = ({
|
|
6369
5520
|
const parentBody = parentDocument.getElementsByTagName("body")[0];
|
6370
5521
|
syncAttributes(parentBody, doc.body);
|
6371
5522
|
Promise.all(
|
6372
|
-
collectedStyles.map((styleNode,
|
5523
|
+
collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
|
6373
5524
|
if (styleNode.nodeName === "LINK") {
|
6374
5525
|
const linkHref = styleNode.href;
|
6375
5526
|
if (hrefs.indexOf(linkHref) > -1) {
|
@@ -6527,6 +5678,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
6527
5678
|
{
|
6528
5679
|
className: getClassName23(),
|
6529
5680
|
id,
|
5681
|
+
"data-puck-preview": true,
|
6530
5682
|
onClick: () => {
|
6531
5683
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
6532
5684
|
},
|
@@ -6680,9 +5832,9 @@ var LayerTree = ({
|
|
6680
5832
|
] }),
|
6681
5833
|
/* @__PURE__ */ jsxs17("ul", { className: getClassName24(), children: [
|
6682
5834
|
zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
|
6683
|
-
zoneContent.map((item,
|
5835
|
+
zoneContent.map((item, i) => {
|
6684
5836
|
var _a;
|
6685
|
-
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) ===
|
5837
|
+
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
6686
5838
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
6687
5839
|
const containsZone = Object.keys(zonesForItem).length > 0;
|
6688
5840
|
const { setHoveringComponent = () => {
|
@@ -6712,7 +5864,7 @@ var LayerTree = ({
|
|
6712
5864
|
setItemSelector(null);
|
6713
5865
|
return;
|
6714
5866
|
}
|
6715
|
-
const id = zoneContent[
|
5867
|
+
const id = zoneContent[i].props.id;
|
6716
5868
|
const frame = getFrame();
|
6717
5869
|
const el = frame == null ? void 0 : frame.querySelector(
|
6718
5870
|
`[data-puck-component="${id}"]`
|
@@ -6727,17 +5879,17 @@ var LayerTree = ({
|
|
6727
5879
|
scrollIntoView(el);
|
6728
5880
|
onScrollEnd(frame, () => {
|
6729
5881
|
setItemSelector({
|
6730
|
-
index:
|
5882
|
+
index: i,
|
6731
5883
|
zone
|
6732
5884
|
});
|
6733
5885
|
});
|
6734
5886
|
},
|
6735
|
-
onMouseOver: (
|
6736
|
-
|
5887
|
+
onMouseOver: (e) => {
|
5888
|
+
e.stopPropagation();
|
6737
5889
|
setHoveringComponent(item.props.id);
|
6738
5890
|
},
|
6739
|
-
onMouseOut: (
|
6740
|
-
|
5891
|
+
onMouseOut: (e) => {
|
5892
|
+
e.stopPropagation();
|
6741
5893
|
setHoveringComponent(null);
|
6742
5894
|
},
|
6743
5895
|
children: [
|
@@ -6770,7 +5922,7 @@ var LayerTree = ({
|
|
6770
5922
|
) }, idx))
|
6771
5923
|
]
|
6772
5924
|
},
|
6773
|
-
`${item.props.id}_${
|
5925
|
+
`${item.props.id}_${i}`
|
6774
5926
|
);
|
6775
5927
|
})
|
6776
5928
|
] })
|
@@ -7121,8 +6273,8 @@ var ViewportButton = ({
|
|
7121
6273
|
{
|
7122
6274
|
title,
|
7123
6275
|
disabled: isActive,
|
7124
|
-
onClick: (
|
7125
|
-
|
6276
|
+
onClick: (e) => {
|
6277
|
+
e.stopPropagation();
|
7126
6278
|
onClick({ width, height });
|
7127
6279
|
},
|
7128
6280
|
children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
|
@@ -7158,11 +6310,11 @@ var ViewportControls = ({
|
|
7158
6310
|
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
7159
6311
|
}
|
7160
6312
|
]
|
7161
|
-
].filter((
|
6313
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
7162
6314
|
[autoZoom]
|
7163
6315
|
);
|
7164
6316
|
return /* @__PURE__ */ jsxs19("div", { className: getClassName25(), children: [
|
7165
|
-
viewports.map((viewport,
|
6317
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
|
7166
6318
|
ViewportButton,
|
7167
6319
|
{
|
7168
6320
|
height: viewport.height,
|
@@ -7171,7 +6323,7 @@ var ViewportControls = ({
|
|
7171
6323
|
onClick: onViewportChange,
|
7172
6324
|
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
7173
6325
|
},
|
7174
|
-
|
6326
|
+
i
|
7175
6327
|
)),
|
7176
6328
|
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
7177
6329
|
/* @__PURE__ */ jsx36(
|
@@ -7179,8 +6331,8 @@ var ViewportControls = ({
|
|
7179
6331
|
{
|
7180
6332
|
title: "Zoom viewport out",
|
7181
6333
|
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
7182
|
-
onClick: (
|
7183
|
-
|
6334
|
+
onClick: (e) => {
|
6335
|
+
e.stopPropagation();
|
7184
6336
|
onZoom(
|
7185
6337
|
zoomOptions[Math.max(
|
7186
6338
|
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
@@ -7196,8 +6348,8 @@ var ViewportControls = ({
|
|
7196
6348
|
{
|
7197
6349
|
title: "Zoom viewport in",
|
7198
6350
|
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
7199
|
-
onClick: (
|
7200
|
-
|
6351
|
+
onClick: (e) => {
|
6352
|
+
e.stopPropagation();
|
7201
6353
|
onZoom(
|
7202
6354
|
zoomOptions[Math.min(
|
7203
6355
|
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
@@ -7214,8 +6366,8 @@ var ViewportControls = ({
|
|
7214
6366
|
{
|
7215
6367
|
className: getClassName25("zoomSelect"),
|
7216
6368
|
value: zoom.toString(),
|
7217
|
-
onChange: (
|
7218
|
-
onZoom(parseFloat(
|
6369
|
+
onChange: (e) => {
|
6370
|
+
onZoom(parseFloat(e.currentTarget.value));
|
7219
6371
|
},
|
7220
6372
|
children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
|
7221
6373
|
"option",
|
@@ -7462,45 +6614,7 @@ import { DragDropManager as DragDropManager2, Feedback } from "@dnd-kit/dom";
|
|
7462
6614
|
// lib/use-inject-css.ts
|
7463
6615
|
init_react_import();
|
7464
6616
|
import { useEffect as useEffect20, useState as useState23 } from "react";
|
7465
|
-
var styles =
|
7466
|
-
/* Prevent user from interacting with underlying component */
|
7467
|
-
[data-puck-component] * {
|
7468
|
-
pointer-events: none;
|
7469
|
-
user-select: none;
|
7470
|
-
-webkit-user-select: none;
|
7471
|
-
}
|
7472
|
-
|
7473
|
-
[data-puck-component] {
|
7474
|
-
cursor: grab;
|
7475
|
-
pointer-events: auto !important;
|
7476
|
-
user-select: none;
|
7477
|
-
-webkit-user-select: none;
|
7478
|
-
}
|
7479
|
-
|
7480
|
-
[data-puck-disabled] {
|
7481
|
-
cursor: pointer;
|
7482
|
-
}
|
7483
|
-
|
7484
|
-
/* Placeholder */
|
7485
|
-
[data-puck-dragging]:not([data-dnd-dragging]) {
|
7486
|
-
background: var(--puck-color-azure-06) !important;
|
7487
|
-
border: none !important;
|
7488
|
-
color: #00000000 !important;
|
7489
|
-
opacity: 0.3 !important;
|
7490
|
-
outline: none !important;
|
7491
|
-
transition: none !important;
|
7492
|
-
}
|
7493
|
-
|
7494
|
-
[data-puck-dragging]:not([data-dnd-dragging]) *, [data-puck-dragging]:not([data-dnd-dragging])::after, [data-puck-dragging]:not([data-dnd-dragging])::before {
|
7495
|
-
opacity: 0 !important;
|
7496
|
-
}
|
7497
|
-
|
7498
|
-
[data-dnd-dragging] {
|
7499
|
-
pointer-events: none !important;
|
7500
|
-
outline: 2px var(--puck-color-azure-09) solid !important;
|
7501
|
-
outline-offset: -2px !important;
|
7502
|
-
}
|
7503
|
-
`;
|
6617
|
+
var styles = ``;
|
7504
6618
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7505
6619
|
const [el, setEl] = useState23();
|
7506
6620
|
useEffect20(() => {
|
@@ -7555,7 +6669,7 @@ function Puck({
|
|
7555
6669
|
}, _iframe);
|
7556
6670
|
useInjectGlobalCss(iframe.enabled);
|
7557
6671
|
const [generatedAppState] = useState24(() => {
|
7558
|
-
var _a2, _b2,
|
6672
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7559
6673
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7560
6674
|
let clientUiState = {};
|
7561
6675
|
if (typeof window !== "undefined") {
|
@@ -7569,13 +6683,13 @@ function Puck({
|
|
7569
6683
|
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
7570
6684
|
key,
|
7571
6685
|
diff: Math.abs(viewportWidth - value.width)
|
7572
|
-
})).sort((
|
6686
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
7573
6687
|
const closestViewport = viewportDifferences[0].key;
|
7574
6688
|
if (iframe.enabled) {
|
7575
6689
|
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
7576
6690
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
7577
6691
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
7578
|
-
height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((
|
6692
|
+
height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
|
7579
6693
|
width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
|
7580
6694
|
})
|
7581
6695
|
})
|
@@ -7761,7 +6875,7 @@ function Puck({
|
|
7761
6875
|
getPermissions: () => ({}),
|
7762
6876
|
refreshPermissions: () => null
|
7763
6877
|
},
|
7764
|
-
children: /* @__PURE__ */ jsx39(DragDropContext2, { children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
|
6878
|
+
children: /* @__PURE__ */ jsx39(DragDropContext2, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
|
7765
6879
|
"div",
|
7766
6880
|
{
|
7767
6881
|
className: getLayoutClassName({
|
@@ -8051,6 +7165,7 @@ export {
|
|
8051
7165
|
FieldLabel,
|
8052
7166
|
Group,
|
8053
7167
|
IconButton,
|
7168
|
+
Label,
|
8054
7169
|
Puck,
|
8055
7170
|
Render,
|
8056
7171
|
dropZoneContext,
|
@@ -8125,6 +7240,14 @@ lucide-react/dist/esm/icons/copy.js:
|
|
8125
7240
|
* See the LICENSE file in the root directory of this source tree.
|
8126
7241
|
*)
|
8127
7242
|
|
7243
|
+
lucide-react/dist/esm/icons/corner-left-up.js:
|
7244
|
+
(**
|
7245
|
+
* @license lucide-react v0.298.0 - ISC
|
7246
|
+
*
|
7247
|
+
* This source code is licensed under the ISC license.
|
7248
|
+
* See the LICENSE file in the root directory of this source tree.
|
7249
|
+
*)
|
7250
|
+
|
8128
7251
|
lucide-react/dist/esm/icons/globe.js:
|
8129
7252
|
(**
|
8130
7253
|
* @license lucide-react v0.298.0 - ISC
|