@measured/puck 0.17.0-canary.552c8f9 → 0.17.0-canary.6e568de
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +249 -1161
- package/dist/index.mjs +227 -1134
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -13,18 +13,18 @@ var __typeError = (msg) => {
|
|
13
13
|
throw TypeError(msg);
|
14
14
|
};
|
15
15
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
16
|
-
var __spreadValues = (
|
17
|
-
for (var prop in
|
18
|
-
if (__hasOwnProp.call(
|
19
|
-
__defNormalProp(
|
16
|
+
var __spreadValues = (a, b) => {
|
17
|
+
for (var prop in b || (b = {}))
|
18
|
+
if (__hasOwnProp.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
20
|
if (__getOwnPropSymbols)
|
21
|
-
for (var prop of __getOwnPropSymbols(
|
22
|
-
if (__propIsEnum.call(
|
23
|
-
__defNormalProp(
|
21
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
22
|
+
if (__propIsEnum.call(b, prop))
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
24
24
|
}
|
25
|
-
return
|
25
|
+
return a;
|
26
26
|
};
|
27
|
-
var __spreadProps = (
|
27
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
28
28
|
var __objRest = (source, exclude) => {
|
29
29
|
var target = {};
|
30
30
|
for (var prop in source)
|
@@ -73,15 +73,15 @@ var __async = (__this, __arguments, generator) => {
|
|
73
73
|
var fulfilled = (value) => {
|
74
74
|
try {
|
75
75
|
step(generator.next(value));
|
76
|
-
} catch (
|
77
|
-
reject(
|
76
|
+
} catch (e) {
|
77
|
+
reject(e);
|
78
78
|
}
|
79
79
|
};
|
80
80
|
var rejected = (value) => {
|
81
81
|
try {
|
82
82
|
step(generator.throw(value));
|
83
|
-
} catch (
|
84
|
-
reject(
|
83
|
+
} catch (e) {
|
84
|
+
reject(e);
|
85
85
|
}
|
86
86
|
};
|
87
87
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
@@ -109,8 +109,8 @@ var require_classnames = __commonJS({
|
|
109
109
|
var nativeCodeString = "[native code]";
|
110
110
|
function classNames() {
|
111
111
|
var classes = [];
|
112
|
-
for (var
|
113
|
-
var arg = arguments[
|
112
|
+
for (var i = 0; i < arguments.length; i++) {
|
113
|
+
var arg = arguments[i];
|
114
114
|
if (!arg) continue;
|
115
115
|
var argType = typeof arg;
|
116
116
|
if (argType === "string" || argType === "number") {
|
@@ -239,9 +239,9 @@ var getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (o
|
|
239
239
|
for (let modifier in modifiers) {
|
240
240
|
prefixedModifiers[styles2[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
241
241
|
}
|
242
|
-
const
|
242
|
+
const c = styles2[rootClass];
|
243
243
|
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
244
|
-
[
|
244
|
+
[c]: !!c
|
245
245
|
}, prefixedModifiers));
|
246
246
|
} else {
|
247
247
|
return config.baseClass + styles2[rootClass] || "";
|
@@ -664,10 +664,10 @@ var IconButton = ({
|
|
664
664
|
disabled,
|
665
665
|
fullWidth
|
666
666
|
}),
|
667
|
-
onClick: (
|
667
|
+
onClick: (e) => {
|
668
668
|
if (!onClick) return;
|
669
669
|
setLoading(true);
|
670
|
-
Promise.resolve(onClick(
|
670
|
+
Promise.resolve(onClick(e)).then(() => {
|
671
671
|
setLoading(false);
|
672
672
|
});
|
673
673
|
},
|
@@ -768,7 +768,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
768
768
|
const [resolvedPermissions, setResolvedPermissions] = (0, import_react4.useState)({});
|
769
769
|
const resolveDataForItem = (0, import_react4.useCallback)(
|
770
770
|
(item, force = false) => __async(void 0, null, function* () {
|
771
|
-
var _a, _b,
|
771
|
+
var _a, _b, _c;
|
772
772
|
const componentConfig = item.type === "root" ? config.root : config.components[item.type];
|
773
773
|
if (!componentConfig) {
|
774
774
|
return;
|
@@ -785,7 +785,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
785
785
|
lastPermissions: ((_b = cache3[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
|
786
786
|
permissions: initialPermissions,
|
787
787
|
appState,
|
788
|
-
lastData: ((
|
788
|
+
lastData: ((_c = cache3[item.props.id]) == null ? void 0 : _c.lastData) || null
|
789
789
|
}
|
790
790
|
);
|
791
791
|
setCache((_cache) => __spreadProps(__spreadValues({}, _cache), {
|
@@ -794,7 +794,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
794
794
|
lastPermissions: resolvedPermissions2
|
795
795
|
}
|
796
796
|
}));
|
797
|
-
setResolvedPermissions((
|
797
|
+
setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
|
798
798
|
[item.props.id]: resolvedPermissions2
|
799
799
|
}));
|
800
800
|
unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
|
@@ -941,12 +941,12 @@ init_react_import();
|
|
941
941
|
var cache2 = {};
|
942
942
|
function resolveRootData(data, config) {
|
943
943
|
return __async(this, null, function* () {
|
944
|
-
var _a, _b,
|
944
|
+
var _a, _b, _c, _d, _e;
|
945
945
|
if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
|
946
946
|
if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
|
947
947
|
return cache2.lastChange.resolved;
|
948
948
|
}
|
949
|
-
const changed = getChanged(data.root, (
|
949
|
+
const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
|
950
950
|
const rootWithProps = data.root;
|
951
951
|
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
952
952
|
changed,
|
@@ -1426,27 +1426,27 @@ var ArrayField = ({
|
|
1426
1426
|
hasItems: Array.isArray(value) && value.length > 0,
|
1427
1427
|
addDisabled
|
1428
1428
|
}),
|
1429
|
-
onMouseOver: (
|
1430
|
-
|
1429
|
+
onMouseOver: (e) => {
|
1430
|
+
e.stopPropagation();
|
1431
1431
|
setHovering(true);
|
1432
1432
|
},
|
1433
|
-
onMouseOut: (
|
1434
|
-
|
1433
|
+
onMouseOut: (e) => {
|
1434
|
+
e.stopPropagation();
|
1435
1435
|
setHovering(false);
|
1436
1436
|
},
|
1437
|
-
onClick: (
|
1438
|
-
|
1437
|
+
onClick: (e) => {
|
1438
|
+
e.preventDefault();
|
1439
1439
|
},
|
1440
1440
|
children: [
|
1441
|
-
localState.arrayState.items.map((item,
|
1442
|
-
const { _arrayId = `${id}-${
|
1443
|
-
const data = Array.from(localState.value || [])[
|
1441
|
+
localState.arrayState.items.map((item, i) => {
|
1442
|
+
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
1443
|
+
const data = Array.from(localState.value || [])[i] || {};
|
1444
1444
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
1445
1445
|
Draggable,
|
1446
1446
|
{
|
1447
1447
|
id: _arrayId,
|
1448
|
-
index:
|
1449
|
-
className: (
|
1448
|
+
index: i,
|
1449
|
+
className: (_, snapshot2) => getClassNameItem({
|
1450
1450
|
isExpanded: arrayState.openId === _arrayId,
|
1451
1451
|
isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
|
1452
1452
|
readOnly
|
@@ -1473,7 +1473,7 @@ var ArrayField = ({
|
|
1473
1473
|
},
|
1474
1474
|
className: getClassNameItem("summary"),
|
1475
1475
|
children: [
|
1476
|
-
field.getItemSummary ? field.getItemSummary(data,
|
1476
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1477
1477
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
1478
1478
|
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("actions"), children: [
|
1479
1479
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
@@ -1481,15 +1481,15 @@ var ArrayField = ({
|
|
1481
1481
|
{
|
1482
1482
|
type: "button",
|
1483
1483
|
disabled: !!addDisabled,
|
1484
|
-
onClick: (
|
1485
|
-
|
1484
|
+
onClick: (e) => {
|
1485
|
+
e.stopPropagation();
|
1486
1486
|
const existingValue = [
|
1487
1487
|
...value || []
|
1488
1488
|
];
|
1489
1489
|
existingValue.splice(
|
1490
|
-
|
1490
|
+
i,
|
1491
1491
|
0,
|
1492
|
-
existingValue[
|
1492
|
+
existingValue[i]
|
1493
1493
|
);
|
1494
1494
|
onChange(
|
1495
1495
|
existingValue,
|
@@ -1507,16 +1507,16 @@ var ArrayField = ({
|
|
1507
1507
|
{
|
1508
1508
|
type: "button",
|
1509
1509
|
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
1510
|
-
onClick: (
|
1511
|
-
|
1510
|
+
onClick: (e) => {
|
1511
|
+
e.stopPropagation();
|
1512
1512
|
const existingValue = [
|
1513
1513
|
...value || []
|
1514
1514
|
];
|
1515
1515
|
const existingItems = [
|
1516
1516
|
...arrayState.items || []
|
1517
1517
|
];
|
1518
|
-
existingValue.splice(
|
1519
|
-
existingItems.splice(
|
1518
|
+
existingValue.splice(i, 1);
|
1519
|
+
existingItems.splice(i, 1);
|
1520
1520
|
onChange(
|
1521
1521
|
existingValue,
|
1522
1522
|
mapArrayStateToUi({
|
@@ -1537,7 +1537,7 @@ var ArrayField = ({
|
|
1537
1537
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
1538
1538
|
(fieldName) => {
|
1539
1539
|
const subField = field.arrayFields[fieldName];
|
1540
|
-
const subFieldName = `${name}[${
|
1540
|
+
const subFieldName = `${name}[${i}].${fieldName}`;
|
1541
1541
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
1542
1542
|
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
|
1543
1543
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
@@ -1551,7 +1551,7 @@ var ArrayField = ({
|
|
1551
1551
|
value: data[fieldName],
|
1552
1552
|
onChange: (val, ui) => {
|
1553
1553
|
onChange(
|
1554
|
-
replace(value,
|
1554
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
1555
1555
|
[fieldName]: val
|
1556
1556
|
})),
|
1557
1557
|
ui
|
@@ -1626,11 +1626,11 @@ var DefaultField = ({
|
|
1626
1626
|
type: field.type,
|
1627
1627
|
name,
|
1628
1628
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1629
|
-
onChange: (
|
1629
|
+
onChange: (e) => {
|
1630
1630
|
if (field.type === "number") {
|
1631
|
-
onChange(Number(
|
1631
|
+
onChange(Number(e.currentTarget.value));
|
1632
1632
|
} else {
|
1633
|
-
onChange(
|
1633
|
+
onChange(e.currentTarget.value);
|
1634
1634
|
}
|
1635
1635
|
},
|
1636
1636
|
readOnly,
|
@@ -1685,7 +1685,7 @@ var Modal = ({
|
|
1685
1685
|
"div",
|
1686
1686
|
{
|
1687
1687
|
className: getClassName7("inner"),
|
1688
|
-
onClick: (
|
1688
|
+
onClick: (e) => e.stopPropagation(),
|
1689
1689
|
children
|
1690
1690
|
}
|
1691
1691
|
) }),
|
@@ -1757,10 +1757,10 @@ var Button = ({
|
|
1757
1757
|
fullWidth,
|
1758
1758
|
[size]: true
|
1759
1759
|
}),
|
1760
|
-
onClick: (
|
1760
|
+
onClick: (e) => {
|
1761
1761
|
if (!onClick) return;
|
1762
1762
|
setLoading(true);
|
1763
|
-
Promise.resolve(onClick(
|
1763
|
+
Promise.resolve(onClick(e)).then(() => {
|
1764
1764
|
setLoading(false);
|
1765
1765
|
});
|
1766
1766
|
},
|
@@ -1889,8 +1889,8 @@ var ExternalInput = ({
|
|
1889
1889
|
hasData: mappedData.length > 0,
|
1890
1890
|
filtersToggled
|
1891
1891
|
}),
|
1892
|
-
onSubmit: (
|
1893
|
-
|
1892
|
+
onSubmit: (e) => {
|
1893
|
+
e.preventDefault();
|
1894
1894
|
search(searchQuery, filters);
|
1895
1895
|
},
|
1896
1896
|
children: [
|
@@ -1905,8 +1905,8 @@ var ExternalInput = ({
|
|
1905
1905
|
name: "q",
|
1906
1906
|
type: "search",
|
1907
1907
|
placeholder: field.placeholder,
|
1908
|
-
onChange: (
|
1909
|
-
setSearchQuery(
|
1908
|
+
onChange: (e) => {
|
1909
|
+
setSearchQuery(e.currentTarget.value);
|
1910
1910
|
},
|
1911
1911
|
autoComplete: "off",
|
1912
1912
|
value: searchQuery
|
@@ -1919,9 +1919,9 @@ var ExternalInput = ({
|
|
1919
1919
|
IconButton,
|
1920
1920
|
{
|
1921
1921
|
title: "Toggle filters",
|
1922
|
-
onClick: (
|
1923
|
-
|
1924
|
-
|
1922
|
+
onClick: (e) => {
|
1923
|
+
e.preventDefault();
|
1924
|
+
e.stopPropagation();
|
1925
1925
|
setFiltersToggled(!filtersToggled);
|
1926
1926
|
},
|
1927
1927
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
|
@@ -1960,19 +1960,19 @@ var ExternalInput = ({
|
|
1960
1960
|
},
|
1961
1961
|
key
|
1962
1962
|
)) }) }),
|
1963
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item,
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
1964
1964
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
1965
1965
|
"tr",
|
1966
1966
|
{
|
1967
1967
|
style: { whiteSpace: "nowrap" },
|
1968
1968
|
className: getClassNameModal("tr"),
|
1969
1969
|
onClick: () => {
|
1970
|
-
onChange(mapProp(data[
|
1970
|
+
onChange(mapProp(data[i]));
|
1971
1971
|
setOpen(false);
|
1972
1972
|
},
|
1973
1973
|
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
1974
1974
|
},
|
1975
|
-
|
1975
|
+
i
|
1976
1976
|
);
|
1977
1977
|
}) })
|
1978
1978
|
] }),
|
@@ -2000,7 +2000,7 @@ var ExternalField = ({
|
|
2000
2000
|
id,
|
2001
2001
|
readOnly
|
2002
2002
|
}) => {
|
2003
|
-
var _a, _b,
|
2003
|
+
var _a, _b, _c;
|
2004
2004
|
const validField = field;
|
2005
2005
|
const deprecatedField = field;
|
2006
2006
|
(0, import_react11.useEffect)(() => {
|
@@ -2022,7 +2022,7 @@ var ExternalField = ({
|
|
2022
2022
|
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
2023
2023
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
2024
2024
|
mapRow: validField.mapRow,
|
2025
|
-
fetchList: ((
|
2025
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
2026
2026
|
return yield deprecatedField.adaptor.fetchList(
|
2027
2027
|
deprecatedField.adaptorParams
|
2028
2028
|
);
|
@@ -2072,12 +2072,12 @@ var RadioField = ({
|
|
2072
2072
|
className: getClassName11("radioInput"),
|
2073
2073
|
value: option.value,
|
2074
2074
|
name,
|
2075
|
-
onChange: (
|
2076
|
-
if (
|
2077
|
-
onChange(JSON.parse(
|
2075
|
+
onChange: (e) => {
|
2076
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
2077
|
+
onChange(JSON.parse(e.currentTarget.value));
|
2078
2078
|
return;
|
2079
2079
|
}
|
2080
|
-
onChange(
|
2080
|
+
onChange(e.currentTarget.value);
|
2081
2081
|
},
|
2082
2082
|
disabled: readOnly,
|
2083
2083
|
checked: value === option.value
|
@@ -2121,12 +2121,12 @@ var SelectField = ({
|
|
2121
2121
|
id,
|
2122
2122
|
className: getClassName12("input"),
|
2123
2123
|
disabled: readOnly,
|
2124
|
-
onChange: (
|
2125
|
-
if (
|
2126
|
-
onChange(JSON.parse(
|
2124
|
+
onChange: (e) => {
|
2125
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
2126
|
+
onChange(JSON.parse(e.currentTarget.value));
|
2127
2127
|
return;
|
2128
2128
|
}
|
2129
|
-
onChange(
|
2129
|
+
onChange(e.currentTarget.value);
|
2130
2130
|
},
|
2131
2131
|
value,
|
2132
2132
|
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
@@ -2164,7 +2164,7 @@ var TextareaField = ({
|
|
2164
2164
|
autoComplete: "off",
|
2165
2165
|
name,
|
2166
2166
|
value: typeof value === "undefined" ? "" : value,
|
2167
|
-
onChange: (
|
2167
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
2168
2168
|
readOnly,
|
2169
2169
|
tabIndex: readOnly ? -1 : void 0,
|
2170
2170
|
rows: 5
|
@@ -2306,7 +2306,7 @@ var FieldLabelInternal2 = ({
|
|
2306
2306
|
);
|
2307
2307
|
};
|
2308
2308
|
function AutoFieldInternal(props) {
|
2309
|
-
var _a, _b,
|
2309
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2310
2310
|
const { dispatch, overrides } = useAppContext();
|
2311
2311
|
const { id, Label = FieldLabelInternal2 } = props;
|
2312
2312
|
const field = props.field;
|
@@ -2326,7 +2326,7 @@ function AutoFieldInternal(props) {
|
|
2326
2326
|
const render = __spreadProps(__spreadValues({}, overrides.fieldTypes), {
|
2327
2327
|
array: ((_a = overrides.fieldTypes) == null ? void 0 : _a.array) || defaultFields.array,
|
2328
2328
|
external: ((_b = overrides.fieldTypes) == null ? void 0 : _b.external) || defaultFields.external,
|
2329
|
-
object: ((
|
2329
|
+
object: ((_c = overrides.fieldTypes) == null ? void 0 : _c.object) || defaultFields.object,
|
2330
2330
|
select: ((_d = overrides.fieldTypes) == null ? void 0 : _d.select) || defaultFields.select,
|
2331
2331
|
textarea: ((_e = overrides.fieldTypes) == null ? void 0 : _e.textarea) || defaultFields.textarea,
|
2332
2332
|
radio: ((_f = overrides.fieldTypes) == null ? void 0 : _f.radio) || defaultFields.radio,
|
@@ -2340,9 +2340,9 @@ function AutoFieldInternal(props) {
|
|
2340
2340
|
id: resolvedId
|
2341
2341
|
});
|
2342
2342
|
const onFocus = (0, import_react13.useCallback)(
|
2343
|
-
(
|
2344
|
-
if (mergedProps.name &&
|
2345
|
-
|
2343
|
+
(e) => {
|
2344
|
+
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2345
|
+
e.stopPropagation();
|
2346
2346
|
dispatch({
|
2347
2347
|
type: "setUi",
|
2348
2348
|
ui: {
|
@@ -2353,8 +2353,8 @@ function AutoFieldInternal(props) {
|
|
2353
2353
|
},
|
2354
2354
|
[mergedProps.name]
|
2355
2355
|
);
|
2356
|
-
const onBlur = (0, import_react13.useCallback)((
|
2357
|
-
if ("name" in
|
2356
|
+
const onBlur = (0, import_react13.useCallback)((e) => {
|
2357
|
+
if ("name" in e.target) {
|
2358
2358
|
dispatch({
|
2359
2359
|
type: "setUi",
|
2360
2360
|
ui: {
|
@@ -2472,982 +2472,18 @@ var import_react_dom2 = require("react-dom");
|
|
2472
2472
|
|
2473
2473
|
// components/DraggableComponent/collision/dynamic/index.ts
|
2474
2474
|
init_react_import();
|
2475
|
-
|
2476
|
-
// ../../node_modules/@dnd-kit/abstract/index.js
|
2477
|
-
init_react_import();
|
2478
|
-
|
2479
|
-
// ../../node_modules/@dnd-kit/state/dist/index.mjs
|
2480
|
-
init_react_import();
|
2481
|
-
|
2482
|
-
// ../../node_modules/@preact/signals-core/dist/signals-core.mjs
|
2483
|
-
init_react_import();
|
2484
|
-
var i = Symbol.for("preact-signals");
|
2485
|
-
function t() {
|
2486
|
-
if (r > 1) {
|
2487
|
-
r--;
|
2488
|
-
return;
|
2489
|
-
}
|
2490
|
-
let i2, t2 = false;
|
2491
|
-
while (void 0 !== s) {
|
2492
|
-
let o2 = s;
|
2493
|
-
s = void 0;
|
2494
|
-
f++;
|
2495
|
-
while (void 0 !== o2) {
|
2496
|
-
const n2 = o2.o;
|
2497
|
-
o2.o = void 0;
|
2498
|
-
o2.f &= -3;
|
2499
|
-
if (!(8 & o2.f) && v(o2)) try {
|
2500
|
-
o2.c();
|
2501
|
-
} catch (o3) {
|
2502
|
-
if (!t2) {
|
2503
|
-
i2 = o3;
|
2504
|
-
t2 = true;
|
2505
|
-
}
|
2506
|
-
}
|
2507
|
-
o2 = n2;
|
2508
|
-
}
|
2509
|
-
}
|
2510
|
-
f = 0;
|
2511
|
-
r--;
|
2512
|
-
if (t2) throw i2;
|
2513
|
-
}
|
2514
|
-
function o(i2) {
|
2515
|
-
if (r > 0) return i2();
|
2516
|
-
r++;
|
2517
|
-
try {
|
2518
|
-
return i2();
|
2519
|
-
} finally {
|
2520
|
-
t();
|
2521
|
-
}
|
2522
|
-
}
|
2523
|
-
var n;
|
2524
|
-
var s;
|
2525
|
-
function h(i2) {
|
2526
|
-
const t2 = n;
|
2527
|
-
n = void 0;
|
2528
|
-
try {
|
2529
|
-
return i2();
|
2530
|
-
} finally {
|
2531
|
-
n = t2;
|
2532
|
-
}
|
2533
|
-
}
|
2534
|
-
var r = 0;
|
2535
|
-
var f = 0;
|
2536
|
-
var e = 0;
|
2537
|
-
function c(i2) {
|
2538
|
-
if (void 0 === n) return;
|
2539
|
-
let t2 = i2.n;
|
2540
|
-
if (void 0 === t2 || t2.t !== n) {
|
2541
|
-
t2 = { i: 0, S: i2, p: n.s, n: void 0, t: n, e: void 0, x: void 0, r: t2 };
|
2542
|
-
if (void 0 !== n.s) n.s.n = t2;
|
2543
|
-
n.s = t2;
|
2544
|
-
i2.n = t2;
|
2545
|
-
if (32 & n.f) i2.S(t2);
|
2546
|
-
return t2;
|
2547
|
-
} else if (-1 === t2.i) {
|
2548
|
-
t2.i = 0;
|
2549
|
-
if (void 0 !== t2.n) {
|
2550
|
-
t2.n.p = t2.p;
|
2551
|
-
if (void 0 !== t2.p) t2.p.n = t2.n;
|
2552
|
-
t2.p = n.s;
|
2553
|
-
t2.n = void 0;
|
2554
|
-
n.s.n = t2;
|
2555
|
-
n.s = t2;
|
2556
|
-
}
|
2557
|
-
return t2;
|
2558
|
-
}
|
2559
|
-
}
|
2560
|
-
function u(i2) {
|
2561
|
-
this.v = i2;
|
2562
|
-
this.i = 0;
|
2563
|
-
this.n = void 0;
|
2564
|
-
this.t = void 0;
|
2565
|
-
}
|
2566
|
-
u.prototype.brand = i;
|
2567
|
-
u.prototype.h = function() {
|
2568
|
-
return true;
|
2569
|
-
};
|
2570
|
-
u.prototype.S = function(i2) {
|
2571
|
-
if (this.t !== i2 && void 0 === i2.e) {
|
2572
|
-
i2.x = this.t;
|
2573
|
-
if (void 0 !== this.t) this.t.e = i2;
|
2574
|
-
this.t = i2;
|
2575
|
-
}
|
2576
|
-
};
|
2577
|
-
u.prototype.U = function(i2) {
|
2578
|
-
if (void 0 !== this.t) {
|
2579
|
-
const t2 = i2.e, o2 = i2.x;
|
2580
|
-
if (void 0 !== t2) {
|
2581
|
-
t2.x = o2;
|
2582
|
-
i2.e = void 0;
|
2583
|
-
}
|
2584
|
-
if (void 0 !== o2) {
|
2585
|
-
o2.e = t2;
|
2586
|
-
i2.x = void 0;
|
2587
|
-
}
|
2588
|
-
if (i2 === this.t) this.t = o2;
|
2589
|
-
}
|
2590
|
-
};
|
2591
|
-
u.prototype.subscribe = function(i2) {
|
2592
|
-
return E(() => {
|
2593
|
-
const t2 = this.value, o2 = n;
|
2594
|
-
n = void 0;
|
2595
|
-
try {
|
2596
|
-
i2(t2);
|
2597
|
-
} finally {
|
2598
|
-
n = o2;
|
2599
|
-
}
|
2600
|
-
});
|
2601
|
-
};
|
2602
|
-
u.prototype.valueOf = function() {
|
2603
|
-
return this.value;
|
2604
|
-
};
|
2605
|
-
u.prototype.toString = function() {
|
2606
|
-
return this.value + "";
|
2607
|
-
};
|
2608
|
-
u.prototype.toJSON = function() {
|
2609
|
-
return this.value;
|
2610
|
-
};
|
2611
|
-
u.prototype.peek = function() {
|
2612
|
-
const i2 = n;
|
2613
|
-
n = void 0;
|
2614
|
-
try {
|
2615
|
-
return this.value;
|
2616
|
-
} finally {
|
2617
|
-
n = i2;
|
2618
|
-
}
|
2619
|
-
};
|
2620
|
-
Object.defineProperty(u.prototype, "value", { get() {
|
2621
|
-
const i2 = c(this);
|
2622
|
-
if (void 0 !== i2) i2.i = this.i;
|
2623
|
-
return this.v;
|
2624
|
-
}, set(i2) {
|
2625
|
-
if (i2 !== this.v) {
|
2626
|
-
if (f > 100) throw new Error("Cycle detected");
|
2627
|
-
this.v = i2;
|
2628
|
-
this.i++;
|
2629
|
-
e++;
|
2630
|
-
r++;
|
2631
|
-
try {
|
2632
|
-
for (let i3 = this.t; void 0 !== i3; i3 = i3.x) i3.t.N();
|
2633
|
-
} finally {
|
2634
|
-
t();
|
2635
|
-
}
|
2636
|
-
}
|
2637
|
-
} });
|
2638
|
-
function d(i2) {
|
2639
|
-
return new u(i2);
|
2640
|
-
}
|
2641
|
-
function v(i2) {
|
2642
|
-
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;
|
2643
|
-
return false;
|
2644
|
-
}
|
2645
|
-
function l(i2) {
|
2646
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) {
|
2647
|
-
const o2 = t2.S.n;
|
2648
|
-
if (void 0 !== o2) t2.r = o2;
|
2649
|
-
t2.S.n = t2;
|
2650
|
-
t2.i = -1;
|
2651
|
-
if (void 0 === t2.n) {
|
2652
|
-
i2.s = t2;
|
2653
|
-
break;
|
2654
|
-
}
|
2655
|
-
}
|
2656
|
-
}
|
2657
|
-
function y(i2) {
|
2658
|
-
let t2, o2 = i2.s;
|
2659
|
-
while (void 0 !== o2) {
|
2660
|
-
const i3 = o2.p;
|
2661
|
-
if (-1 === o2.i) {
|
2662
|
-
o2.S.U(o2);
|
2663
|
-
if (void 0 !== i3) i3.n = o2.n;
|
2664
|
-
if (void 0 !== o2.n) o2.n.p = i3;
|
2665
|
-
} else t2 = o2;
|
2666
|
-
o2.S.n = o2.r;
|
2667
|
-
if (void 0 !== o2.r) o2.r = void 0;
|
2668
|
-
o2 = i3;
|
2669
|
-
}
|
2670
|
-
i2.s = t2;
|
2671
|
-
}
|
2672
|
-
function a(i2) {
|
2673
|
-
u.call(this, void 0);
|
2674
|
-
this.x = i2;
|
2675
|
-
this.s = void 0;
|
2676
|
-
this.g = e - 1;
|
2677
|
-
this.f = 4;
|
2678
|
-
}
|
2679
|
-
(a.prototype = new u()).h = function() {
|
2680
|
-
this.f &= -3;
|
2681
|
-
if (1 & this.f) return false;
|
2682
|
-
if (32 == (36 & this.f)) return true;
|
2683
|
-
this.f &= -5;
|
2684
|
-
if (this.g === e) return true;
|
2685
|
-
this.g = e;
|
2686
|
-
this.f |= 1;
|
2687
|
-
if (this.i > 0 && !v(this)) {
|
2688
|
-
this.f &= -2;
|
2689
|
-
return true;
|
2690
|
-
}
|
2691
|
-
const i2 = n;
|
2692
|
-
try {
|
2693
|
-
l(this);
|
2694
|
-
n = this;
|
2695
|
-
const i3 = this.x();
|
2696
|
-
if (16 & this.f || this.v !== i3 || 0 === this.i) {
|
2697
|
-
this.v = i3;
|
2698
|
-
this.f &= -17;
|
2699
|
-
this.i++;
|
2700
|
-
}
|
2701
|
-
} catch (i3) {
|
2702
|
-
this.v = i3;
|
2703
|
-
this.f |= 16;
|
2704
|
-
this.i++;
|
2705
|
-
}
|
2706
|
-
n = i2;
|
2707
|
-
y(this);
|
2708
|
-
this.f &= -2;
|
2709
|
-
return true;
|
2710
|
-
};
|
2711
|
-
a.prototype.S = function(i2) {
|
2712
|
-
if (void 0 === this.t) {
|
2713
|
-
this.f |= 36;
|
2714
|
-
for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.S(i3);
|
2715
|
-
}
|
2716
|
-
u.prototype.S.call(this, i2);
|
2717
|
-
};
|
2718
|
-
a.prototype.U = function(i2) {
|
2719
|
-
if (void 0 !== this.t) {
|
2720
|
-
u.prototype.U.call(this, i2);
|
2721
|
-
if (void 0 === this.t) {
|
2722
|
-
this.f &= -33;
|
2723
|
-
for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.U(i3);
|
2724
|
-
}
|
2725
|
-
}
|
2726
|
-
};
|
2727
|
-
a.prototype.N = function() {
|
2728
|
-
if (!(2 & this.f)) {
|
2729
|
-
this.f |= 6;
|
2730
|
-
for (let i2 = this.t; void 0 !== i2; i2 = i2.x) i2.t.N();
|
2731
|
-
}
|
2732
|
-
};
|
2733
|
-
Object.defineProperty(a.prototype, "value", { get() {
|
2734
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
2735
|
-
const i2 = c(this);
|
2736
|
-
this.h();
|
2737
|
-
if (void 0 !== i2) i2.i = this.i;
|
2738
|
-
if (16 & this.f) throw this.v;
|
2739
|
-
return this.v;
|
2740
|
-
} });
|
2741
|
-
function w(i2) {
|
2742
|
-
return new a(i2);
|
2743
|
-
}
|
2744
|
-
function _(i2) {
|
2745
|
-
const o2 = i2.u;
|
2746
|
-
i2.u = void 0;
|
2747
|
-
if ("function" == typeof o2) {
|
2748
|
-
r++;
|
2749
|
-
const s2 = n;
|
2750
|
-
n = void 0;
|
2751
|
-
try {
|
2752
|
-
o2();
|
2753
|
-
} catch (t2) {
|
2754
|
-
i2.f &= -2;
|
2755
|
-
i2.f |= 8;
|
2756
|
-
g(i2);
|
2757
|
-
throw t2;
|
2758
|
-
} finally {
|
2759
|
-
n = s2;
|
2760
|
-
t();
|
2761
|
-
}
|
2762
|
-
}
|
2763
|
-
}
|
2764
|
-
function g(i2) {
|
2765
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) t2.S.U(t2);
|
2766
|
-
i2.x = void 0;
|
2767
|
-
i2.s = void 0;
|
2768
|
-
_(i2);
|
2769
|
-
}
|
2770
|
-
function p(i2) {
|
2771
|
-
if (n !== this) throw new Error("Out-of-order effect");
|
2772
|
-
y(this);
|
2773
|
-
n = i2;
|
2774
|
-
this.f &= -2;
|
2775
|
-
if (8 & this.f) g(this);
|
2776
|
-
t();
|
2777
|
-
}
|
2778
|
-
function b(i2) {
|
2779
|
-
this.x = i2;
|
2780
|
-
this.u = void 0;
|
2781
|
-
this.s = void 0;
|
2782
|
-
this.o = void 0;
|
2783
|
-
this.f = 32;
|
2784
|
-
}
|
2785
|
-
b.prototype.c = function() {
|
2786
|
-
const i2 = this.S();
|
2787
|
-
try {
|
2788
|
-
if (8 & this.f) return;
|
2789
|
-
if (void 0 === this.x) return;
|
2790
|
-
const t2 = this.x();
|
2791
|
-
if ("function" == typeof t2) this.u = t2;
|
2792
|
-
} finally {
|
2793
|
-
i2();
|
2794
|
-
}
|
2795
|
-
};
|
2796
|
-
b.prototype.S = function() {
|
2797
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
2798
|
-
this.f |= 1;
|
2799
|
-
this.f &= -9;
|
2800
|
-
_(this);
|
2801
|
-
l(this);
|
2802
|
-
r++;
|
2803
|
-
const i2 = n;
|
2804
|
-
n = this;
|
2805
|
-
return p.bind(this, i2);
|
2806
|
-
};
|
2807
|
-
b.prototype.N = function() {
|
2808
|
-
if (!(2 & this.f)) {
|
2809
|
-
this.f |= 2;
|
2810
|
-
this.o = s;
|
2811
|
-
s = this;
|
2812
|
-
}
|
2813
|
-
};
|
2814
|
-
b.prototype.d = function() {
|
2815
|
-
this.f |= 8;
|
2816
|
-
if (!(1 & this.f)) g(this);
|
2817
|
-
};
|
2818
|
-
function E(i2) {
|
2819
|
-
const t2 = new b(i2);
|
2820
|
-
try {
|
2821
|
-
t2.c();
|
2822
|
-
} catch (i3) {
|
2823
|
-
t2.d();
|
2824
|
-
throw i3;
|
2825
|
-
}
|
2826
|
-
return t2.d.bind(t2);
|
2827
|
-
}
|
2828
|
-
|
2829
|
-
// ../../node_modules/@dnd-kit/state/dist/index.mjs
|
2830
|
-
function computed(compute, comparator) {
|
2831
|
-
if (comparator) {
|
2832
|
-
let previousValue;
|
2833
|
-
return w(() => {
|
2834
|
-
const value = compute();
|
2835
|
-
if (value && previousValue && comparator(previousValue, value)) {
|
2836
|
-
return previousValue;
|
2837
|
-
}
|
2838
|
-
previousValue = value;
|
2839
|
-
return value;
|
2840
|
-
});
|
2841
|
-
}
|
2842
|
-
return w(compute);
|
2843
|
-
}
|
2844
|
-
function reactive({ get }, _2) {
|
2845
|
-
return {
|
2846
|
-
init(value) {
|
2847
|
-
return d(value);
|
2848
|
-
},
|
2849
|
-
get() {
|
2850
|
-
const current = get.call(this);
|
2851
|
-
return current.value;
|
2852
|
-
},
|
2853
|
-
set(newValue) {
|
2854
|
-
const current = get.call(this);
|
2855
|
-
if (current.peek() === newValue) {
|
2856
|
-
return;
|
2857
|
-
}
|
2858
|
-
current.value = newValue;
|
2859
|
-
}
|
2860
|
-
};
|
2861
|
-
}
|
2862
|
-
function derived(target, _2) {
|
2863
|
-
const map = /* @__PURE__ */ new WeakMap();
|
2864
|
-
return function() {
|
2865
|
-
let result = map.get(this);
|
2866
|
-
if (!result) {
|
2867
|
-
result = computed(target.bind(this));
|
2868
|
-
map.set(this, result);
|
2869
|
-
}
|
2870
|
-
return result.value;
|
2871
|
-
};
|
2872
|
-
}
|
2873
|
-
function effects(...entries) {
|
2874
|
-
const effects2 = entries.map(E);
|
2875
|
-
return () => effects2.forEach((cleanup) => cleanup());
|
2876
|
-
}
|
2877
|
-
|
2878
|
-
// ../../node_modules/@dnd-kit/geometry/dist/index.mjs
|
2879
|
-
init_react_import();
|
2880
|
-
var __create2 = Object.create;
|
2881
|
-
var __defProp2 = Object.defineProperty;
|
2882
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
2883
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
2884
|
-
var __typeError2 = (msg) => {
|
2885
|
-
throw TypeError(msg);
|
2886
|
-
};
|
2887
|
-
var __pow = Math.pow;
|
2888
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2889
|
-
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
2890
|
-
var __decoratorStart = (base) => {
|
2891
|
-
var _a;
|
2892
|
-
return [, , , __create2((_a = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a : null)];
|
2893
|
-
};
|
2894
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
2895
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError2("Function expected") : fn;
|
2896
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError2("Already initialized") : fns.push(__expectFn(fn || null)) });
|
2897
|
-
var __decoratorMetadata = (array, target) => __defNormalProp2(target, __knownSymbol("metadata"), array[3]);
|
2898
|
-
var __runInitializers = (array, flags, self, value) => {
|
2899
|
-
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);
|
2900
|
-
return value;
|
2901
|
-
};
|
2902
|
-
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
2903
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
2904
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
2905
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
2906
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc2(k < 4 ? target : { get [name]() {
|
2907
|
-
return __privateGet2(this, extra);
|
2908
|
-
}, set [name](x) {
|
2909
|
-
return __privateSet2(this, extra, x);
|
2910
|
-
} }, name));
|
2911
|
-
k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
2912
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
2913
|
-
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
2914
|
-
if (k) {
|
2915
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
|
2916
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet2 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
2917
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
2918
|
-
}
|
2919
|
-
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;
|
2920
|
-
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
2921
|
-
else if (typeof it !== "object" || it === null) __typeError2("Object expected");
|
2922
|
-
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
2923
|
-
}
|
2924
|
-
return k || __decoratorMetadata(array, target), desc && __defProp2(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
2925
|
-
};
|
2926
|
-
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
2927
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError2('Cannot use the "in" operator on this value') : member.has(obj);
|
2928
|
-
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2929
|
-
var __privateAdd2 = (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);
|
2930
|
-
var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
2931
|
-
var __privateMethod = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
|
2932
|
-
var Point = class _Point {
|
2933
|
-
/**
|
2934
|
-
* @param {number} Coordinate of the point on the horizontal axis
|
2935
|
-
* @param {number} Coordinate of the point on the vertical axis
|
2936
|
-
*/
|
2937
|
-
constructor(x, y2) {
|
2938
|
-
this.x = x;
|
2939
|
-
this.y = y2;
|
2940
|
-
}
|
2941
|
-
/**
|
2942
|
-
* Returns the delta between this point and another point.
|
2943
|
-
*
|
2944
|
-
* @param {Point} a - A point
|
2945
|
-
* @param {Point} b - Another point
|
2946
|
-
*/
|
2947
|
-
static delta(a2, b2) {
|
2948
|
-
return new _Point(a2.x - b2.x, a2.y - b2.y);
|
2949
|
-
}
|
2950
|
-
/**
|
2951
|
-
* Returns the distance (hypotenuse) between this point and another point.
|
2952
|
-
*
|
2953
|
-
* @param {Point} a - A point
|
2954
|
-
* @param {Point} b - Another point
|
2955
|
-
*/
|
2956
|
-
static distance(a2, b2) {
|
2957
|
-
return Math.hypot(a2.x - b2.x, a2.y - b2.y);
|
2958
|
-
}
|
2959
|
-
/**
|
2960
|
-
* Returns true if both points are equal.
|
2961
|
-
*
|
2962
|
-
* @param {Point} a - A point
|
2963
|
-
* @param {Point} b - Another point
|
2964
|
-
*/
|
2965
|
-
static equals(a2, b2) {
|
2966
|
-
return a2.x === b2.x && a2.y === b2.y;
|
2967
|
-
}
|
2968
|
-
static from({ x, y: y2 }) {
|
2969
|
-
return new _Point(x, y2);
|
2970
|
-
}
|
2971
|
-
};
|
2972
|
-
var SENSITIVITY = 10;
|
2973
|
-
var _direction_dec;
|
2974
|
-
var _delta_dec;
|
2975
|
-
var _current_dec;
|
2976
|
-
var _previous_dec;
|
2977
|
-
var _initial_dec;
|
2978
|
-
var _velocity_dec;
|
2979
|
-
var _timestamp;
|
2980
|
-
var _init;
|
2981
|
-
var _velocity;
|
2982
|
-
var _initial;
|
2983
|
-
var _previous;
|
2984
|
-
var _current;
|
2985
|
-
_velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
|
2986
|
-
var Position = class {
|
2987
|
-
constructor(initialValue) {
|
2988
|
-
__runInitializers(_init, 5, this);
|
2989
|
-
__privateAdd2(this, _timestamp, 0);
|
2990
|
-
__privateAdd2(this, _velocity, __runInitializers(_init, 8, this, {
|
2991
|
-
x: 0,
|
2992
|
-
y: 0
|
2993
|
-
})), __runInitializers(_init, 11, this);
|
2994
|
-
__privateAdd2(this, _initial, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
2995
|
-
__privateAdd2(this, _previous, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
2996
|
-
__privateAdd2(this, _current, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
2997
|
-
const point = Point.from(initialValue);
|
2998
|
-
this.initial = point;
|
2999
|
-
this.current = point;
|
3000
|
-
this.previous = point;
|
3001
|
-
}
|
3002
|
-
get delta() {
|
3003
|
-
return Point.delta(this.current, this.initial);
|
3004
|
-
}
|
3005
|
-
get direction() {
|
3006
|
-
const delta = {
|
3007
|
-
x: this.current.x - this.previous.x,
|
3008
|
-
y: this.current.y - this.previous.y
|
3009
|
-
};
|
3010
|
-
if (!delta.x && !delta.y) {
|
3011
|
-
return null;
|
3012
|
-
}
|
3013
|
-
if (Math.abs(delta.x) > Math.abs(delta.y)) {
|
3014
|
-
return delta.x > 0 ? "right" : "left";
|
3015
|
-
}
|
3016
|
-
return delta.y > 0 ? "down" : "up";
|
3017
|
-
}
|
3018
|
-
reset(coordinates) {
|
3019
|
-
const point = Point.from(coordinates);
|
3020
|
-
o(() => {
|
3021
|
-
__privateSet2(this, _timestamp, 0);
|
3022
|
-
this.velocity = { x: 0, y: 0 };
|
3023
|
-
this.current = point;
|
3024
|
-
this.previous = point;
|
3025
|
-
this.initial = point;
|
3026
|
-
});
|
3027
|
-
}
|
3028
|
-
update(coordinates) {
|
3029
|
-
const { current } = this;
|
3030
|
-
const point = Point.from(coordinates);
|
3031
|
-
if (Point.equals(current, point)) {
|
3032
|
-
return;
|
3033
|
-
}
|
3034
|
-
const delta = {
|
3035
|
-
x: point.x - current.x,
|
3036
|
-
y: point.y - current.y
|
3037
|
-
};
|
3038
|
-
const timestamp = Date.now();
|
3039
|
-
const timeDelta = timestamp - __privateGet2(this, _timestamp);
|
3040
|
-
const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
|
3041
|
-
if (Math.abs(delta.x) < SENSITIVITY || Math.abs(delta.y) < SENSITIVITY) {
|
3042
|
-
this.previous = current;
|
3043
|
-
}
|
3044
|
-
__privateSet2(this, _timestamp, timestamp);
|
3045
|
-
this.velocity = {
|
3046
|
-
x: velocity(delta.x),
|
3047
|
-
y: velocity(delta.y)
|
3048
|
-
};
|
3049
|
-
this.current = point;
|
3050
|
-
}
|
3051
|
-
};
|
3052
|
-
_init = __decoratorStart(null);
|
3053
|
-
_timestamp = /* @__PURE__ */ new WeakMap();
|
3054
|
-
_velocity = /* @__PURE__ */ new WeakMap();
|
3055
|
-
_initial = /* @__PURE__ */ new WeakMap();
|
3056
|
-
_previous = /* @__PURE__ */ new WeakMap();
|
3057
|
-
_current = /* @__PURE__ */ new WeakMap();
|
3058
|
-
__decorateElement(_init, 4, "velocity", _velocity_dec, Position, _velocity);
|
3059
|
-
__decorateElement(_init, 4, "initial", _initial_dec, Position, _initial);
|
3060
|
-
__decorateElement(_init, 4, "previous", _previous_dec, Position, _previous);
|
3061
|
-
__decorateElement(_init, 4, "current", _current_dec, Position, _current);
|
3062
|
-
__decorateElement(_init, 2, "delta", _delta_dec, Position);
|
3063
|
-
__decorateElement(_init, 2, "direction", _direction_dec, Position);
|
3064
|
-
__decoratorMetadata(_init, Position);
|
3065
|
-
function exceedsDistance({ x, y: y2 }, distance) {
|
3066
|
-
const dx = Math.abs(x);
|
3067
|
-
const dy = Math.abs(y2);
|
3068
|
-
if (typeof distance === "number") {
|
3069
|
-
return Math.sqrt(__pow(dx, 2) + __pow(dy, 2)) > distance;
|
3070
|
-
}
|
3071
|
-
if ("x" in distance && "y" in distance) {
|
3072
|
-
return dx > distance.x && dy > distance.y;
|
3073
|
-
}
|
3074
|
-
if ("x" in distance) {
|
3075
|
-
return dx > distance.x;
|
3076
|
-
}
|
3077
|
-
if ("y" in distance) {
|
3078
|
-
return dy > distance.y;
|
3079
|
-
}
|
3080
|
-
return false;
|
3081
|
-
}
|
3082
|
-
var Axis = /* @__PURE__ */ ((Axis2) => {
|
3083
|
-
Axis2["Horizontal"] = "x";
|
3084
|
-
Axis2["Vertical"] = "y";
|
3085
|
-
return Axis2;
|
3086
|
-
})(Axis || {});
|
3087
|
-
var Axes = Object.values(Axis);
|
3088
|
-
|
3089
|
-
// ../../node_modules/@dnd-kit/abstract/index.js
|
3090
|
-
var __create3 = Object.create;
|
3091
|
-
var __defProp3 = Object.defineProperty;
|
3092
|
-
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
3093
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
3094
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
3095
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
3096
|
-
var __knownSymbol2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
3097
|
-
var __typeError3 = (msg) => {
|
3098
|
-
throw TypeError(msg);
|
3099
|
-
};
|
3100
|
-
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3101
|
-
var __name2 = (target, value) => __defProp3(target, "name", { value, configurable: true });
|
3102
|
-
var __objRest2 = (source, exclude) => {
|
3103
|
-
var target = {};
|
3104
|
-
for (var prop in source)
|
3105
|
-
if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
|
3106
|
-
target[prop] = source[prop];
|
3107
|
-
if (source != null && __getOwnPropSymbols2)
|
3108
|
-
for (var prop of __getOwnPropSymbols2(source)) {
|
3109
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
|
3110
|
-
target[prop] = source[prop];
|
3111
|
-
}
|
3112
|
-
return target;
|
3113
|
-
};
|
3114
|
-
var __decoratorStart2 = (base) => {
|
3115
|
-
var _a;
|
3116
|
-
return [, , , __create3((_a = base == null ? void 0 : base[__knownSymbol2("metadata")]) != null ? _a : null)];
|
3117
|
-
};
|
3118
|
-
var __decoratorStrings2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
3119
|
-
var __expectFn2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError3("Function expected") : fn;
|
3120
|
-
var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError3("Already initialized") : fns.push(__expectFn2(fn || null)) });
|
3121
|
-
var __decoratorMetadata2 = (array, target) => __defNormalProp3(target, __knownSymbol2("metadata"), array[3]);
|
3122
|
-
var __runInitializers2 = (array, flags, self, value) => {
|
3123
|
-
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);
|
3124
|
-
return value;
|
3125
|
-
};
|
3126
|
-
var __decorateElement2 = (array, flags, name, decorators, target, extra) => {
|
3127
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
3128
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings2[k + 5];
|
3129
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
3130
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc3(k < 4 ? target : { get [name]() {
|
3131
|
-
return __privateGet3(this, extra);
|
3132
|
-
}, set [name](x) {
|
3133
|
-
return __privateSet3(this, extra, x);
|
3134
|
-
} }, name));
|
3135
|
-
k ? p2 && k < 4 && __name2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name2(target, name);
|
3136
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
3137
|
-
ctx = __decoratorContext2(k, name, done = {}, array[3], extraInitializers);
|
3138
|
-
if (k) {
|
3139
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn2(target, x) : (x) => name in x };
|
3140
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet3 : __privateMethod2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
3141
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet3(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
3142
|
-
}
|
3143
|
-
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;
|
3144
|
-
if (k ^ 4 || it === void 0) __expectFn2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
3145
|
-
else if (typeof it !== "object" || it === null) __typeError3("Object expected");
|
3146
|
-
else __expectFn2(fn = it.get) && (desc.get = fn), __expectFn2(fn = it.set) && (desc.set = fn), __expectFn2(fn = it.init) && initializers.unshift(fn);
|
3147
|
-
}
|
3148
|
-
return k || __decoratorMetadata2(array, target), desc && __defProp3(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
3149
|
-
};
|
3150
|
-
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
3151
|
-
var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError3('Cannot use the "in" operator on this value') : member.has(obj);
|
3152
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3153
|
-
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3154
|
-
var __privateSet3 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
3155
|
-
var __privateMethod2 = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
|
3156
|
-
function configure(plugin, options) {
|
3157
|
-
return {
|
3158
|
-
plugin,
|
3159
|
-
options
|
3160
|
-
};
|
3161
|
-
}
|
3162
|
-
function configurator(plugin) {
|
3163
|
-
return (options) => {
|
3164
|
-
return configure(plugin, options);
|
3165
|
-
};
|
3166
|
-
}
|
3167
|
-
var _disabled_dec;
|
3168
|
-
var _init2;
|
3169
|
-
var _disabled;
|
3170
|
-
_disabled_dec = [reactive];
|
3171
|
-
var Plugin = class {
|
3172
|
-
constructor(manager, options) {
|
3173
|
-
this.manager = manager;
|
3174
|
-
this.options = options;
|
3175
|
-
__privateAdd3(this, _disabled, __runInitializers2(_init2, 8, this, false)), __runInitializers2(_init2, 11, this);
|
3176
|
-
}
|
3177
|
-
/**
|
3178
|
-
* Enable a disabled plugin instance.
|
3179
|
-
* Triggers effects.
|
3180
|
-
*/
|
3181
|
-
enable() {
|
3182
|
-
this.disabled = false;
|
3183
|
-
}
|
3184
|
-
/**
|
3185
|
-
* Disable an enabled plugin instance.
|
3186
|
-
* Triggers effects.
|
3187
|
-
*/
|
3188
|
-
disable() {
|
3189
|
-
this.disabled = true;
|
3190
|
-
}
|
3191
|
-
/**
|
3192
|
-
* Whether the plugin instance is disabled.
|
3193
|
-
* Does not trigger effects when accessed.
|
3194
|
-
*/
|
3195
|
-
isDisabled() {
|
3196
|
-
return h(() => {
|
3197
|
-
return this.disabled;
|
3198
|
-
});
|
3199
|
-
}
|
3200
|
-
/**
|
3201
|
-
* Configure a plugin instance with new options.
|
3202
|
-
*/
|
3203
|
-
configure(options) {
|
3204
|
-
this.options = options;
|
3205
|
-
}
|
3206
|
-
/**
|
3207
|
-
* Destroy a plugin instance.
|
3208
|
-
*/
|
3209
|
-
destroy() {
|
3210
|
-
}
|
3211
|
-
/**
|
3212
|
-
* Configure a plugin constructor with options.
|
3213
|
-
* This method is used to configure the options that the
|
3214
|
-
* plugin constructor will use to create plugin instances.
|
3215
|
-
*/
|
3216
|
-
static configure(options) {
|
3217
|
-
return configure(this, options);
|
3218
|
-
}
|
3219
|
-
};
|
3220
|
-
_init2 = __decoratorStart2(null);
|
3221
|
-
_disabled = /* @__PURE__ */ new WeakMap();
|
3222
|
-
__decorateElement2(_init2, 4, "disabled", _disabled_dec, Plugin, _disabled);
|
3223
|
-
__decoratorMetadata2(_init2, Plugin);
|
3224
|
-
var _previousValues;
|
3225
|
-
_previousValues = /* @__PURE__ */ new WeakMap();
|
3226
|
-
var _previousCoordinates;
|
3227
|
-
var _collisions;
|
3228
|
-
_previousCoordinates = /* @__PURE__ */ new WeakMap();
|
3229
|
-
_collisions = /* @__PURE__ */ new WeakMap();
|
3230
|
-
var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
3231
|
-
CollisionPriority2[CollisionPriority2["Lowest"] = 0] = "Lowest";
|
3232
|
-
CollisionPriority2[CollisionPriority2["Low"] = 1] = "Low";
|
3233
|
-
CollisionPriority2[CollisionPriority2["Normal"] = 2] = "Normal";
|
3234
|
-
CollisionPriority2[CollisionPriority2["High"] = 3] = "High";
|
3235
|
-
CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
|
3236
|
-
return CollisionPriority2;
|
3237
|
-
})(CollisionPriority || {});
|
3238
|
-
var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
3239
|
-
CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
|
3240
|
-
CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
|
3241
|
-
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
3242
|
-
return CollisionType2;
|
3243
|
-
})(CollisionType || {});
|
3244
|
-
var _disabled_dec2;
|
3245
|
-
var _data_dec;
|
3246
|
-
var _id_dec;
|
3247
|
-
var _manager_dec;
|
3248
|
-
var _init22;
|
3249
|
-
var _manager;
|
3250
|
-
var _id;
|
3251
|
-
var _data;
|
3252
|
-
var _disabled2;
|
3253
|
-
_manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
|
3254
|
-
var Entity = class {
|
3255
|
-
/**
|
3256
|
-
* Creates a new instance of the `Entity` class.
|
3257
|
-
*
|
3258
|
-
* @param input - An object containing the initial properties of the entity.
|
3259
|
-
* @param manager - The manager that controls the drag and drop operations.
|
3260
|
-
*/
|
3261
|
-
constructor(input, manager) {
|
3262
|
-
__privateAdd3(this, _manager, __runInitializers2(_init22, 8, this)), __runInitializers2(_init22, 11, this);
|
3263
|
-
__privateAdd3(this, _id, __runInitializers2(_init22, 12, this)), __runInitializers2(_init22, 15, this);
|
3264
|
-
__privateAdd3(this, _data, __runInitializers2(_init22, 16, this)), __runInitializers2(_init22, 19, this);
|
3265
|
-
__privateAdd3(this, _disabled2, __runInitializers2(_init22, 20, this)), __runInitializers2(_init22, 23, this);
|
3266
|
-
this.effects = void 0;
|
3267
|
-
const { effects: effects5, id, data = {}, disabled = false } = input;
|
3268
|
-
let previousId = id;
|
3269
|
-
this.manager = manager;
|
3270
|
-
this.id = id;
|
3271
|
-
this.data = data;
|
3272
|
-
this.disabled = disabled;
|
3273
|
-
this.effects = () => {
|
3274
|
-
var _a;
|
3275
|
-
return [
|
3276
|
-
() => {
|
3277
|
-
const { id: id2, manager: manager2 } = this;
|
3278
|
-
if (id2 === previousId) {
|
3279
|
-
return;
|
3280
|
-
}
|
3281
|
-
manager2 == null ? void 0 : manager2.registry.register(this);
|
3282
|
-
return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
|
3283
|
-
},
|
3284
|
-
...(_a = effects5 == null ? void 0 : effects5()) != null ? _a : []
|
3285
|
-
];
|
3286
|
-
};
|
3287
|
-
this.destroy = this.destroy.bind(this);
|
3288
|
-
if (manager) {
|
3289
|
-
queueMicrotask(() => {
|
3290
|
-
var _a;
|
3291
|
-
(_a = this.manager) == null ? void 0 : _a.registry.register(this);
|
3292
|
-
});
|
3293
|
-
}
|
3294
|
-
}
|
3295
|
-
/**
|
3296
|
-
* A method that registers the entity with the manager.
|
3297
|
-
* @returns CleanupFunction | void
|
3298
|
-
*/
|
3299
|
-
register() {
|
3300
|
-
var _a;
|
3301
|
-
return (_a = this.manager) == null ? void 0 : _a.registry.register(this);
|
3302
|
-
}
|
3303
|
-
/**
|
3304
|
-
* A method that unregisters the entity from the manager.
|
3305
|
-
* @returns void
|
3306
|
-
*/
|
3307
|
-
unregister() {
|
3308
|
-
var _a;
|
3309
|
-
(_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
|
3310
|
-
}
|
3311
|
-
/**
|
3312
|
-
* A method that cleans up the entity when it is no longer needed.
|
3313
|
-
* @returns void
|
3314
|
-
*/
|
3315
|
-
destroy() {
|
3316
|
-
var _a;
|
3317
|
-
(_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
|
3318
|
-
}
|
3319
|
-
};
|
3320
|
-
_init22 = __decoratorStart2(null);
|
3321
|
-
_manager = /* @__PURE__ */ new WeakMap();
|
3322
|
-
_id = /* @__PURE__ */ new WeakMap();
|
3323
|
-
_data = /* @__PURE__ */ new WeakMap();
|
3324
|
-
_disabled2 = /* @__PURE__ */ new WeakMap();
|
3325
|
-
__decorateElement2(_init22, 4, "manager", _manager_dec, Entity, _manager);
|
3326
|
-
__decorateElement2(_init22, 4, "id", _id_dec, Entity, _id);
|
3327
|
-
__decorateElement2(_init22, 4, "data", _data_dec, Entity, _data);
|
3328
|
-
__decorateElement2(_init22, 4, "disabled", _disabled_dec2, Entity, _disabled2);
|
3329
|
-
__decoratorMetadata2(_init22, Entity);
|
3330
|
-
var _isDragSource_dec;
|
3331
|
-
var _status_dec;
|
3332
|
-
var _type_dec;
|
3333
|
-
var _modifiers_dec;
|
3334
|
-
var _c;
|
3335
|
-
var _init3;
|
3336
|
-
var _modifiers;
|
3337
|
-
var _type;
|
3338
|
-
var _status;
|
3339
|
-
var Draggable2 = class extends (_c = Entity, _modifiers_dec = [reactive], _type_dec = [reactive], _status_dec = [reactive], _isDragSource_dec = [derived], _c) {
|
3340
|
-
constructor(_a, manager) {
|
3341
|
-
var _b = _a, { modifiers, type, sensors } = _b, input = __objRest2(_b, ["modifiers", "type", "sensors"]);
|
3342
|
-
super(input, manager);
|
3343
|
-
__runInitializers2(_init3, 5, this);
|
3344
|
-
this.sensors = void 0;
|
3345
|
-
__privateAdd3(this, _modifiers, __runInitializers2(_init3, 8, this)), __runInitializers2(_init3, 11, this);
|
3346
|
-
__privateAdd3(this, _type, __runInitializers2(_init3, 12, this)), __runInitializers2(_init3, 15, this);
|
3347
|
-
__privateAdd3(this, _status, __runInitializers2(_init3, 16, this, "idle")), __runInitializers2(_init3, 19, this);
|
3348
|
-
this.type = type;
|
3349
|
-
this.sensors = sensors;
|
3350
|
-
this.modifiers = modifiers;
|
3351
|
-
}
|
3352
|
-
get isDragSource() {
|
3353
|
-
var _a, _b;
|
3354
|
-
return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.source) == null ? void 0 : _b.id) === this.id;
|
3355
|
-
}
|
3356
|
-
};
|
3357
|
-
_init3 = __decoratorStart2(_c);
|
3358
|
-
_modifiers = /* @__PURE__ */ new WeakMap();
|
3359
|
-
_type = /* @__PURE__ */ new WeakMap();
|
3360
|
-
_status = /* @__PURE__ */ new WeakMap();
|
3361
|
-
__decorateElement2(_init3, 4, "modifiers", _modifiers_dec, Draggable2, _modifiers);
|
3362
|
-
__decorateElement2(_init3, 4, "type", _type_dec, Draggable2, _type);
|
3363
|
-
__decorateElement2(_init3, 4, "status", _status_dec, Draggable2, _status);
|
3364
|
-
__decorateElement2(_init3, 2, "isDragSource", _isDragSource_dec, Draggable2);
|
3365
|
-
__decoratorMetadata2(_init3, Draggable2);
|
3366
|
-
var _isDropTarget_dec;
|
3367
|
-
var _shape_dec;
|
3368
|
-
var _collisionPriority_dec;
|
3369
|
-
var _collisionDetector_dec;
|
3370
|
-
var _type_dec2;
|
3371
|
-
var _accept_dec;
|
3372
|
-
var _c2;
|
3373
|
-
var _init4;
|
3374
|
-
var _accept;
|
3375
|
-
var _type2;
|
3376
|
-
var _collisionDetector;
|
3377
|
-
var _collisionPriority;
|
3378
|
-
var _shape;
|
3379
|
-
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) {
|
3380
|
-
constructor(_a, manager) {
|
3381
|
-
var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest2(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
3382
|
-
super(input, manager);
|
3383
|
-
__runInitializers2(_init4, 5, this);
|
3384
|
-
__privateAdd3(this, _accept, __runInitializers2(_init4, 8, this)), __runInitializers2(_init4, 11, this);
|
3385
|
-
__privateAdd3(this, _type2, __runInitializers2(_init4, 12, this)), __runInitializers2(_init4, 15, this);
|
3386
|
-
__privateAdd3(this, _collisionDetector, __runInitializers2(_init4, 16, this)), __runInitializers2(_init4, 19, this);
|
3387
|
-
__privateAdd3(this, _collisionPriority, __runInitializers2(_init4, 20, this)), __runInitializers2(_init4, 23, this);
|
3388
|
-
__privateAdd3(this, _shape, __runInitializers2(_init4, 24, this)), __runInitializers2(_init4, 27, this);
|
3389
|
-
this.accept = accept;
|
3390
|
-
this.collisionDetector = collisionDetector;
|
3391
|
-
this.collisionPriority = collisionPriority;
|
3392
|
-
this.type = type;
|
3393
|
-
}
|
3394
|
-
/**
|
3395
|
-
* Checks whether or not the droppable accepts a given draggable.
|
3396
|
-
*
|
3397
|
-
* @param {Draggable} draggable
|
3398
|
-
* @returns {boolean}
|
3399
|
-
*/
|
3400
|
-
accepts(draggable) {
|
3401
|
-
const { accept } = this;
|
3402
|
-
if (!accept) {
|
3403
|
-
return true;
|
3404
|
-
}
|
3405
|
-
if (typeof accept === "function") {
|
3406
|
-
return accept(draggable);
|
3407
|
-
}
|
3408
|
-
if (!draggable.type) {
|
3409
|
-
return false;
|
3410
|
-
}
|
3411
|
-
if (Array.isArray(accept)) {
|
3412
|
-
return accept.includes(draggable.type);
|
3413
|
-
}
|
3414
|
-
return draggable.type === accept;
|
3415
|
-
}
|
3416
|
-
get isDropTarget() {
|
3417
|
-
var _a, _b;
|
3418
|
-
return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.target) == null ? void 0 : _b.id) === this.id;
|
3419
|
-
}
|
3420
|
-
};
|
3421
|
-
_init4 = __decoratorStart2(_c2);
|
3422
|
-
_accept = /* @__PURE__ */ new WeakMap();
|
3423
|
-
_type2 = /* @__PURE__ */ new WeakMap();
|
3424
|
-
_collisionDetector = /* @__PURE__ */ new WeakMap();
|
3425
|
-
_collisionPriority = /* @__PURE__ */ new WeakMap();
|
3426
|
-
_shape = /* @__PURE__ */ new WeakMap();
|
3427
|
-
__decorateElement2(_init4, 4, "accept", _accept_dec, Droppable2, _accept);
|
3428
|
-
__decorateElement2(_init4, 4, "type", _type_dec2, Droppable2, _type2);
|
3429
|
-
__decorateElement2(_init4, 4, "collisionDetector", _collisionDetector_dec, Droppable2, _collisionDetector);
|
3430
|
-
__decorateElement2(_init4, 4, "collisionPriority", _collisionPriority_dec, Droppable2, _collisionPriority);
|
3431
|
-
__decorateElement2(_init4, 4, "shape", _shape_dec, Droppable2, _shape);
|
3432
|
-
__decorateElement2(_init4, 2, "isDropTarget", _isDropTarget_dec, Droppable2);
|
3433
|
-
__decoratorMetadata2(_init4, Droppable2);
|
3434
|
-
var Sensor = class extends Plugin {
|
3435
|
-
constructor(manager, options) {
|
3436
|
-
super(manager, options);
|
3437
|
-
this.manager = manager;
|
3438
|
-
this.options = options;
|
3439
|
-
}
|
3440
|
-
};
|
2475
|
+
var import_abstract8 = require("@dnd-kit/abstract");
|
3441
2476
|
|
3442
2477
|
// components/DraggableComponent/collision/directional/index.ts
|
3443
2478
|
init_react_import();
|
2479
|
+
var import_abstract = require("@dnd-kit/abstract");
|
3444
2480
|
|
3445
2481
|
// components/DraggableComponent/collision/collision-debug.ts
|
3446
2482
|
init_react_import();
|
3447
2483
|
var DEBUG = false;
|
3448
2484
|
var debugElements = {};
|
3449
2485
|
var timeout;
|
3450
|
-
var collisionDebug = (
|
2486
|
+
var collisionDebug = (a, b, id, color, label) => {
|
3451
2487
|
if (!DEBUG) return;
|
3452
2488
|
const debugId = `${id}-debug`;
|
3453
2489
|
clearTimeout(timeout);
|
@@ -3478,13 +2514,13 @@ var collisionDebug = (a2, b2, id, color, label) => {
|
|
3478
2514
|
document.body.appendChild(svg);
|
3479
2515
|
debugElements[debugId] = { svg, line, text };
|
3480
2516
|
}
|
3481
|
-
line.setAttribute("x1",
|
3482
|
-
line.setAttribute("x2",
|
3483
|
-
line.setAttribute("y1",
|
3484
|
-
line.setAttribute("y2",
|
2517
|
+
line.setAttribute("x1", a.x.toString());
|
2518
|
+
line.setAttribute("x2", b.x.toString());
|
2519
|
+
line.setAttribute("y1", a.y.toString());
|
2520
|
+
line.setAttribute("y2", b.y.toString());
|
3485
2521
|
line.setAttribute("style", `stroke:${color};stroke-width:2`);
|
3486
|
-
text.setAttribute("x", (
|
3487
|
-
text.setAttribute("y", (
|
2522
|
+
text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
|
2523
|
+
text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
|
3488
2524
|
if (label) {
|
3489
2525
|
text.innerHTML = label;
|
3490
2526
|
}
|
@@ -3518,7 +2554,7 @@ var directionalCollision = (input, previous) => {
|
|
3518
2554
|
return {
|
3519
2555
|
id: droppable.id,
|
3520
2556
|
value: 1,
|
3521
|
-
type: CollisionType.Collision
|
2557
|
+
type: import_abstract.CollisionType.Collision
|
3522
2558
|
};
|
3523
2559
|
}
|
3524
2560
|
return null;
|
@@ -3560,6 +2596,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
|
|
3560
2596
|
|
3561
2597
|
// components/DraggableComponent/collision/dynamic/track-movement-interval.ts
|
3562
2598
|
init_react_import();
|
2599
|
+
var import_geometry = require("@dnd-kit/geometry");
|
3563
2600
|
var INTERVAL_SENSITIVITY = 10;
|
3564
2601
|
var intervalCache = {
|
3565
2602
|
current: { x: 0, y: 0 },
|
@@ -3575,13 +2612,25 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
|
|
3575
2612
|
};
|
3576
2613
|
intervalCache.direction = getDirection(dragAxis, intervalCache.delta) || intervalCache.direction;
|
3577
2614
|
if (Math.abs(intervalCache.delta.x) > INTERVAL_SENSITIVITY || Math.abs(intervalCache.delta.y) > INTERVAL_SENSITIVITY) {
|
3578
|
-
intervalCache.previous = Point.from(point);
|
2615
|
+
intervalCache.previous = import_geometry.Point.from(point);
|
3579
2616
|
}
|
3580
2617
|
return intervalCache;
|
3581
2618
|
};
|
3582
2619
|
|
3583
2620
|
// ../../node_modules/@dnd-kit/collision/dist/index.js
|
3584
2621
|
init_react_import();
|
2622
|
+
var import_abstract2 = require("@dnd-kit/abstract");
|
2623
|
+
var import_geometry2 = require("@dnd-kit/geometry");
|
2624
|
+
var import_abstract3 = require("@dnd-kit/abstract");
|
2625
|
+
var import_geometry3 = require("@dnd-kit/geometry");
|
2626
|
+
var import_abstract4 = require("@dnd-kit/abstract");
|
2627
|
+
var import_geometry4 = require("@dnd-kit/geometry");
|
2628
|
+
var import_abstract5 = require("@dnd-kit/abstract");
|
2629
|
+
var import_geometry5 = require("@dnd-kit/geometry");
|
2630
|
+
var import_abstract6 = require("@dnd-kit/abstract");
|
2631
|
+
var import_geometry6 = require("@dnd-kit/geometry");
|
2632
|
+
var import_abstract7 = require("@dnd-kit/abstract");
|
2633
|
+
var import_geometry7 = require("@dnd-kit/geometry");
|
3585
2634
|
var pointerIntersection = ({
|
3586
2635
|
dragOperation,
|
3587
2636
|
droppable
|
@@ -3595,12 +2644,12 @@ var pointerIntersection = ({
|
|
3595
2644
|
return null;
|
3596
2645
|
}
|
3597
2646
|
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
3598
|
-
const distance = Point.distance(droppable.shape.center, pointerCoordinates);
|
2647
|
+
const distance = import_geometry2.Point.distance(droppable.shape.center, pointerCoordinates);
|
3599
2648
|
return {
|
3600
2649
|
id,
|
3601
2650
|
value: 1 / distance,
|
3602
|
-
type: CollisionType.PointerIntersection,
|
3603
|
-
priority: CollisionPriority.High
|
2651
|
+
type: import_abstract2.CollisionType.PointerIntersection,
|
2652
|
+
priority: import_abstract2.CollisionPriority.High
|
3604
2653
|
};
|
3605
2654
|
}
|
3606
2655
|
return null;
|
@@ -3633,8 +2682,8 @@ var closestCorners = (input) => {
|
|
3633
2682
|
const distance = corners.reduce(
|
3634
2683
|
(acc, corner) => {
|
3635
2684
|
var _a;
|
3636
|
-
return acc + Point.distance(
|
3637
|
-
Point.from(corner),
|
2685
|
+
return acc + import_geometry4.Point.distance(
|
2686
|
+
import_geometry4.Point.from(corner),
|
3638
2687
|
(_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
|
3639
2688
|
);
|
3640
2689
|
},
|
@@ -3644,15 +2693,15 @@ var closestCorners = (input) => {
|
|
3644
2693
|
return {
|
3645
2694
|
id: droppable.id,
|
3646
2695
|
value: 1 / value,
|
3647
|
-
type: CollisionType.Collision,
|
3648
|
-
priority: CollisionPriority.Normal
|
2696
|
+
type: import_abstract4.CollisionType.Collision,
|
2697
|
+
priority: import_abstract4.CollisionPriority.Normal
|
3649
2698
|
};
|
3650
2699
|
};
|
3651
2700
|
|
3652
2701
|
// components/DraggableComponent/collision/dynamic/index.ts
|
3653
2702
|
var flushNext = "";
|
3654
2703
|
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
3655
|
-
var _a, _b,
|
2704
|
+
var _a, _b, _c, _d, _e;
|
3656
2705
|
const { dragOperation, droppable } = input;
|
3657
2706
|
const { position } = dragOperation;
|
3658
2707
|
const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
|
@@ -3682,7 +2731,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3682
2731
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
|
3683
2732
|
if (collision) {
|
3684
2733
|
return __spreadProps(__spreadValues({}, collision), {
|
3685
|
-
priority: CollisionPriority.Highest
|
2734
|
+
priority: import_abstract8.CollisionPriority.Highest
|
3686
2735
|
});
|
3687
2736
|
}
|
3688
2737
|
}
|
@@ -3699,14 +2748,14 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3699
2748
|
const collision = {
|
3700
2749
|
id: droppable.id,
|
3701
2750
|
value: intersectionRatio,
|
3702
|
-
priority: CollisionPriority.High,
|
3703
|
-
type: CollisionType.Collision
|
2751
|
+
priority: import_abstract8.CollisionPriority.High,
|
2752
|
+
type: import_abstract8.CollisionType.Collision
|
3704
2753
|
};
|
3705
2754
|
const shouldFlushId = flushNext === droppable.id;
|
3706
2755
|
flushNext = "";
|
3707
2756
|
return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
|
3708
2757
|
}
|
3709
|
-
if (((
|
2758
|
+
if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
3710
2759
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
3711
2760
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
3712
2761
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
@@ -3729,7 +2778,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3729
2778
|
);
|
3730
2779
|
flushNext = droppable.id;
|
3731
2780
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
3732
|
-
priority: CollisionPriority.Low
|
2781
|
+
priority: import_abstract8.CollisionPriority.Low
|
3733
2782
|
});
|
3734
2783
|
}
|
3735
2784
|
collisionDebug(
|
@@ -3739,7 +2788,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3739
2788
|
"orange",
|
3740
2789
|
direction || ""
|
3741
2790
|
);
|
3742
|
-
return __spreadProps(__spreadValues({}, fallbackCollision), { priority: CollisionPriority.Lowest });
|
2791
|
+
return __spreadProps(__spreadValues({}, fallbackCollision), { priority: import_abstract8.CollisionPriority.Lowest });
|
3743
2792
|
}
|
3744
2793
|
}
|
3745
2794
|
}
|
@@ -3774,6 +2823,25 @@ function useSortableSafe(input) {
|
|
3774
2823
|
return (0, import_sortable.useSortable)(input);
|
3775
2824
|
}
|
3776
2825
|
|
2826
|
+
// lib/get-deep-scroll-position.ts
|
2827
|
+
init_react_import();
|
2828
|
+
function getDeepScrollPosition(element) {
|
2829
|
+
let totalScroll = {
|
2830
|
+
x: 0,
|
2831
|
+
y: 0
|
2832
|
+
};
|
2833
|
+
let current = element;
|
2834
|
+
while (current && current !== document.documentElement) {
|
2835
|
+
const parent = current.parentElement;
|
2836
|
+
if (parent) {
|
2837
|
+
totalScroll.x += parent.scrollLeft;
|
2838
|
+
totalScroll.y += parent.scrollTop;
|
2839
|
+
}
|
2840
|
+
current = parent;
|
2841
|
+
}
|
2842
|
+
return totalScroll;
|
2843
|
+
}
|
2844
|
+
|
3777
2845
|
// components/DraggableComponent/index.tsx
|
3778
2846
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
3779
2847
|
var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
@@ -3877,22 +2945,22 @@ var DraggableComponent = ({
|
|
3877
2945
|
);
|
3878
2946
|
const [portalEl, setPortalEl] = (0, import_react16.useState)();
|
3879
2947
|
(0, import_react16.useEffect)(() => {
|
3880
|
-
var _a, _b;
|
2948
|
+
var _a, _b, _c;
|
3881
2949
|
setPortalEl(
|
3882
|
-
|
2950
|
+
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
|
3883
2951
|
);
|
3884
|
-
}, [iframe.enabled]);
|
2952
|
+
}, [iframe.enabled, ref.current]);
|
3885
2953
|
const getStyle = (0, import_react16.useCallback)(() => {
|
3886
|
-
var _a, _b;
|
2954
|
+
var _a, _b, _c;
|
3887
2955
|
if (!ref.current) return;
|
3888
2956
|
const rect = ref.current.getBoundingClientRect();
|
3889
|
-
const
|
3890
|
-
const
|
3891
|
-
const portalContainerEl = iframe.enabled ? null : document.getElementById("puck-preview");
|
2957
|
+
const deepScrollPosition = getDeepScrollPosition(ref.current);
|
2958
|
+
const portalContainerEl = iframe.enabled ? null : (_a = ref.current) == null ? void 0 : _a.closest("[data-puck-preview]");
|
3892
2959
|
const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
|
2960
|
+
const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
|
3893
2961
|
const scroll = {
|
3894
|
-
x:
|
3895
|
-
y:
|
2962
|
+
x: deepScrollPosition.x - portalScroll.x - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _b : 0),
|
2963
|
+
y: deepScrollPosition.y - portalScroll.y - ((_c = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _c : 0)
|
3896
2964
|
};
|
3897
2965
|
const style2 = {
|
3898
2966
|
left: `${rect.left + scroll.x}px`,
|
@@ -3901,11 +2969,20 @@ var DraggableComponent = ({
|
|
3901
2969
|
width: `${rect.width}px`
|
3902
2970
|
};
|
3903
2971
|
return style2;
|
3904
|
-
}, [ref
|
2972
|
+
}, [ref.current]);
|
3905
2973
|
const [style, setStyle] = (0, import_react16.useState)();
|
3906
2974
|
const sync = (0, import_react16.useCallback)(() => {
|
3907
2975
|
setStyle(getStyle());
|
3908
|
-
}, [ref, iframe]);
|
2976
|
+
}, [ref.current, iframe]);
|
2977
|
+
(0, import_react16.useEffect)(() => {
|
2978
|
+
if (ref.current) {
|
2979
|
+
const observer = new ResizeObserver(sync);
|
2980
|
+
observer.observe(ref.current);
|
2981
|
+
return () => {
|
2982
|
+
observer.disconnect();
|
2983
|
+
};
|
2984
|
+
}
|
2985
|
+
}, [ref.current]);
|
3909
2986
|
(0, import_react16.useEffect)(() => {
|
3910
2987
|
ctx == null ? void 0 : ctx.registerPath({
|
3911
2988
|
index,
|
@@ -3920,8 +2997,8 @@ var DraggableComponent = ({
|
|
3920
2997
|
item: selectedItem
|
3921
2998
|
});
|
3922
2999
|
const onClick = (0, import_react16.useCallback)(
|
3923
|
-
(
|
3924
|
-
|
3000
|
+
(e) => {
|
3001
|
+
e.stopPropagation();
|
3925
3002
|
dispatch({
|
3926
3003
|
type: "setUi",
|
3927
3004
|
ui: {
|
@@ -3932,8 +3009,8 @@ var DraggableComponent = ({
|
|
3932
3009
|
[index, zoneCompound, id]
|
3933
3010
|
);
|
3934
3011
|
const onDuplicate = (0, import_react16.useCallback)(
|
3935
|
-
(
|
3936
|
-
|
3012
|
+
(e) => {
|
3013
|
+
e.stopPropagation();
|
3937
3014
|
dispatch({
|
3938
3015
|
type: "duplicate",
|
3939
3016
|
sourceIndex: index,
|
@@ -3943,8 +3020,8 @@ var DraggableComponent = ({
|
|
3943
3020
|
[index, zoneCompound]
|
3944
3021
|
);
|
3945
3022
|
const onDelete = (0, import_react16.useCallback)(
|
3946
|
-
(
|
3947
|
-
|
3023
|
+
(e) => {
|
3024
|
+
e.stopPropagation();
|
3948
3025
|
dispatch({
|
3949
3026
|
type: "remove",
|
3950
3027
|
index,
|
@@ -3960,7 +3037,7 @@ var DraggableComponent = ({
|
|
3960
3037
|
return;
|
3961
3038
|
}
|
3962
3039
|
const el = ref.current;
|
3963
|
-
const _onMouseOver = (
|
3040
|
+
const _onMouseOver = (e) => {
|
3964
3041
|
if (userIsDragging) {
|
3965
3042
|
if (thisIsDragging) {
|
3966
3043
|
setHover(true);
|
@@ -3970,10 +3047,10 @@ var DraggableComponent = ({
|
|
3970
3047
|
} else {
|
3971
3048
|
setHover(true);
|
3972
3049
|
}
|
3973
|
-
|
3050
|
+
e.stopPropagation();
|
3974
3051
|
};
|
3975
|
-
const _onMouseOut = (
|
3976
|
-
|
3052
|
+
const _onMouseOut = (e) => {
|
3053
|
+
e.stopPropagation();
|
3977
3054
|
setHover(false);
|
3978
3055
|
};
|
3979
3056
|
el.setAttribute("data-puck-component", id);
|
@@ -4382,8 +3459,8 @@ function DropZoneEdit({
|
|
4382
3459
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: deepestZone || rootDroppableId }),
|
4383
3460
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: deepestArea || "No area" })
|
4384
3461
|
] }),
|
4385
|
-
contentWithPreview.map((item,
|
4386
|
-
var _a, _b,
|
3462
|
+
contentWithPreview.map((item, i) => {
|
3463
|
+
var _a, _b, _c, _d, _e;
|
4387
3464
|
const componentId = item.props.id;
|
4388
3465
|
const puckProps = {
|
4389
3466
|
renderDropZone: DropZone,
|
@@ -4409,7 +3486,7 @@ function DropZoneEdit({
|
|
4409
3486
|
};
|
4410
3487
|
var Preview2 = Preview3;
|
4411
3488
|
componentType = preview.componentType;
|
4412
|
-
label = (_d = (
|
3489
|
+
label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
|
4413
3490
|
Render2 = Preview3;
|
4414
3491
|
}
|
4415
3492
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
@@ -4423,7 +3500,7 @@ function DropZoneEdit({
|
|
4423
3500
|
componentType,
|
4424
3501
|
zoneCompound,
|
4425
3502
|
depth: depth + 1,
|
4426
|
-
index:
|
3503
|
+
index: i,
|
4427
3504
|
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
4428
3505
|
isSelected,
|
4429
3506
|
label,
|
@@ -4509,6 +3586,8 @@ var getZoneId = (zoneCompound) => {
|
|
4509
3586
|
|
4510
3587
|
// components/DragDropContext/NestedDroppablePlugin.ts
|
4511
3588
|
init_react_import();
|
3589
|
+
var import_abstract9 = require("@dnd-kit/abstract");
|
3590
|
+
var import_state = require("@dnd-kit/state");
|
4512
3591
|
|
4513
3592
|
// lib/throttle.ts
|
4514
3593
|
init_react_import();
|
@@ -4543,9 +3622,9 @@ function isPositionInsideRect(position, rect) {
|
|
4543
3622
|
var BUFFER_ZONE = 8;
|
4544
3623
|
var REFRESH_ON_MOVE = true;
|
4545
3624
|
var depthSort = (candidates) => {
|
4546
|
-
return candidates.sort((
|
4547
|
-
const aData =
|
4548
|
-
const bData =
|
3625
|
+
return candidates.sort((a, b) => {
|
3626
|
+
const aData = a.data;
|
3627
|
+
const bData = b.data;
|
4549
3628
|
if (aData.depth > bData.depth) {
|
4550
3629
|
return 1;
|
4551
3630
|
}
|
@@ -4581,8 +3660,8 @@ var getAreaId = (candidate) => {
|
|
4581
3660
|
};
|
4582
3661
|
var getDeepestId = (candidates, idFn) => {
|
4583
3662
|
let id = null;
|
4584
|
-
for (let
|
4585
|
-
const candidate = candidates[
|
3663
|
+
for (let i = 0; i < candidates.length; i++) {
|
3664
|
+
const candidate = candidates[i];
|
4586
3665
|
id = idFn(candidate);
|
4587
3666
|
if (id) break;
|
4588
3667
|
}
|
@@ -4646,6 +3725,11 @@ var findDeepestCandidate = (position, manager) => {
|
|
4646
3725
|
if (candidateData2.areaId === draggedCandidateId) {
|
4647
3726
|
return false;
|
4648
3727
|
}
|
3728
|
+
} else if (candidate.type === "component") {
|
3729
|
+
const candidateData2 = candidate.data;
|
3730
|
+
if (!candidateData2.inDroppableZone) {
|
3731
|
+
return false;
|
3732
|
+
}
|
4649
3733
|
}
|
4650
3734
|
return true;
|
4651
3735
|
});
|
@@ -4661,13 +3745,13 @@ var findDeepestCandidate = (position, manager) => {
|
|
4661
3745
|
};
|
4662
3746
|
var createNestedDroppablePlugin = ({
|
4663
3747
|
onChange
|
4664
|
-
}) => class NestedDroppablePlugin extends Plugin {
|
3748
|
+
}) => class NestedDroppablePlugin extends import_abstract9.Plugin {
|
4665
3749
|
constructor(manager, options) {
|
4666
3750
|
super(manager);
|
4667
3751
|
if (typeof window === "undefined") {
|
4668
3752
|
return;
|
4669
3753
|
}
|
4670
|
-
const cleanupEffect = effects(() => {
|
3754
|
+
const cleanupEffect = (0, import_state.effects)(() => {
|
4671
3755
|
const handleMove = (position) => {
|
4672
3756
|
if (REFRESH_ON_MOVE) {
|
4673
3757
|
for (const droppable of manager.registry.droppables.value) {
|
@@ -4776,7 +3860,7 @@ function duplicateRelatedZones(item, data, newId) {
|
|
4776
3860
|
(dupeOfDupes2, item2, index) => __spreadValues(__spreadValues({}, dupeOfDupes2), duplicateRelatedZones(zone[index], data, item2.props.id).zones),
|
4777
3861
|
acc
|
4778
3862
|
);
|
4779
|
-
const [
|
3863
|
+
const [_, zoneId] = getZoneId(key);
|
4780
3864
|
return __spreadProps(__spreadValues({}, dupeOfDupes), {
|
4781
3865
|
[key]: zone,
|
4782
3866
|
[`${newId}:${zoneId}`]: dupedZone
|
@@ -5096,9 +4180,12 @@ var import_utilities2 = require("@dnd-kit/dom/utilities");
|
|
5096
4180
|
|
5097
4181
|
// components/DragDropContext/PointerSensor.ts
|
5098
4182
|
init_react_import();
|
4183
|
+
var import_state3 = require("@dnd-kit/state");
|
4184
|
+
var import_abstract10 = require("@dnd-kit/abstract");
|
4185
|
+
var import_geometry8 = require("@dnd-kit/geometry");
|
5099
4186
|
var import_utilities = require("@dnd-kit/dom/utilities");
|
5100
4187
|
var _clearTimeout;
|
5101
|
-
var _PointerSensor = class _PointerSensor extends Sensor {
|
4188
|
+
var _PointerSensor = class _PointerSensor extends import_abstract10.Sensor {
|
5102
4189
|
constructor(manager, options) {
|
5103
4190
|
super(manager);
|
5104
4191
|
this.manager = manager;
|
@@ -5110,7 +4197,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5110
4197
|
this.handleCancel = this.handleCancel.bind(this);
|
5111
4198
|
this.handlePointerUp = this.handlePointerUp.bind(this);
|
5112
4199
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
5113
|
-
|
4200
|
+
(0, import_state3.effect)(() => {
|
5114
4201
|
const unbindGlobal = this.bindGlobal(options != null ? options : {});
|
5115
4202
|
return () => {
|
5116
4203
|
unbindGlobal();
|
@@ -5118,7 +4205,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5118
4205
|
});
|
5119
4206
|
}
|
5120
4207
|
bind(source, options = this.options) {
|
5121
|
-
const unbind =
|
4208
|
+
const unbind = (0, import_state3.effect)(() => {
|
5122
4209
|
var _a;
|
5123
4210
|
const target = (_a = source.handle) != null ? _a : source.element;
|
5124
4211
|
const listener = (event) => {
|
@@ -5240,15 +4327,15 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5240
4327
|
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, this.source) : activationConstraints;
|
5241
4328
|
const { distance, delay } = constraints != null ? constraints : {};
|
5242
4329
|
if (distance) {
|
5243
|
-
if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
|
4330
|
+
if (distance.tolerance != null && (0, import_geometry8.exceedsDistance)(delta, distance.tolerance)) {
|
5244
4331
|
return this.handleCancel();
|
5245
4332
|
}
|
5246
|
-
if (exceedsDistance(delta, distance.value)) {
|
4333
|
+
if ((0, import_geometry8.exceedsDistance)(delta, distance.value)) {
|
5247
4334
|
return this.handleStart(this.source, event);
|
5248
4335
|
}
|
5249
4336
|
}
|
5250
4337
|
if (delay) {
|
5251
|
-
if (exceedsDistance(delta, delay.tolerance)) {
|
4338
|
+
if ((0, import_geometry8.exceedsDistance)(delta, delay.tolerance)) {
|
5252
4339
|
return this.handleCancel();
|
5253
4340
|
}
|
5254
4341
|
}
|
@@ -5281,7 +4368,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5281
4368
|
return;
|
5282
4369
|
}
|
5283
4370
|
event.preventDefault();
|
5284
|
-
|
4371
|
+
(0, import_state3.batch)(() => {
|
5285
4372
|
manager.actions.setDragSource(source.id);
|
5286
4373
|
manager.actions.start({ coordinates: initialCoordinates, event });
|
5287
4374
|
});
|
@@ -5333,7 +4420,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5333
4420
|
}
|
5334
4421
|
};
|
5335
4422
|
_clearTimeout = new WeakMap();
|
5336
|
-
_PointerSensor.configure = configurator(_PointerSensor);
|
4423
|
+
_PointerSensor.configure = (0, import_abstract10.configurator)(_PointerSensor);
|
5337
4424
|
var PointerSensor = _PointerSensor;
|
5338
4425
|
function preventDefault(event) {
|
5339
4426
|
event.preventDefault();
|
@@ -5400,7 +4487,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5400
4487
|
...import_dom.defaultPreset.plugins,
|
5401
4488
|
createNestedDroppablePlugin({
|
5402
4489
|
onChange: (params, manager) => {
|
5403
|
-
var _a, _b,
|
4490
|
+
var _a, _b, _c;
|
5404
4491
|
const paramsChanged = !deepestRef.current || params.area !== ((_a = deepestRef.current) == null ? void 0 : _a.area) || params.zone !== ((_b = deepestRef.current) == null ? void 0 : _b.zone);
|
5405
4492
|
if (paramsChanged) {
|
5406
4493
|
if (manager.dragOperation.status.dragging) {
|
@@ -5410,7 +4497,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5410
4497
|
}
|
5411
4498
|
setNextDeepest(params);
|
5412
4499
|
}
|
5413
|
-
if (params.area !== ((
|
4500
|
+
if (params.area !== ((_c = deepestRef.current) == null ? void 0 : _c.area)) {
|
5414
4501
|
setTimeout(() => {
|
5415
4502
|
manager.collisionObserver.forceUpdate(true);
|
5416
4503
|
}, 50);
|
@@ -5485,24 +4572,25 @@ var DragDropContextClient = ({ children }) => {
|
|
5485
4572
|
return;
|
5486
4573
|
}
|
5487
4574
|
const { zone, index } = source.data;
|
4575
|
+
const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
|
4576
|
+
previewRef.current = null;
|
5488
4577
|
setTimeout(() => {
|
5489
4578
|
var _a, _b;
|
5490
4579
|
setDraggedItem(null);
|
5491
4580
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
5492
4581
|
setPreview(null);
|
5493
|
-
previewRef.current = null;
|
5494
4582
|
(_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
|
5495
4583
|
fn(event, manager);
|
5496
4584
|
});
|
5497
4585
|
return;
|
5498
4586
|
}
|
5499
|
-
if (
|
4587
|
+
if (thisPreview) {
|
5500
4588
|
setPreview(null);
|
5501
|
-
if (
|
4589
|
+
if (thisPreview.type === "insert") {
|
5502
4590
|
insertComponent(
|
5503
|
-
|
5504
|
-
|
5505
|
-
|
4591
|
+
thisPreview.componentType,
|
4592
|
+
thisPreview.zone,
|
4593
|
+
thisPreview.index,
|
5506
4594
|
{ config, dispatch, resolveData, state }
|
5507
4595
|
);
|
5508
4596
|
} else if (initialSelector.current) {
|
@@ -5510,12 +4598,11 @@ var DragDropContextClient = ({ children }) => {
|
|
5510
4598
|
type: "move",
|
5511
4599
|
sourceIndex: initialSelector.current.index,
|
5512
4600
|
sourceZone: initialSelector.current.zone,
|
5513
|
-
destinationIndex:
|
5514
|
-
destinationZone:
|
4601
|
+
destinationIndex: thisPreview.index,
|
4602
|
+
destinationZone: thisPreview.zone,
|
5515
4603
|
recordHistory: false
|
5516
4604
|
});
|
5517
4605
|
}
|
5518
|
-
previewRef.current = null;
|
5519
4606
|
}
|
5520
4607
|
dispatch({
|
5521
4608
|
type: "setUi",
|
@@ -5531,7 +4618,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5531
4618
|
}, 300);
|
5532
4619
|
},
|
5533
4620
|
onDragOver: (event, manager) => {
|
5534
|
-
var _a, _b,
|
4621
|
+
var _a, _b, _c, _d;
|
5535
4622
|
event.preventDefault();
|
5536
4623
|
if (!draggedItem) return;
|
5537
4624
|
const { source, target } = event.operation;
|
@@ -5559,7 +4646,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5559
4646
|
targetZone = target.id.toString();
|
5560
4647
|
targetIndex = 0;
|
5561
4648
|
}
|
5562
|
-
if (targetId === sourceId || ((
|
4649
|
+
if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
|
5563
4650
|
const [pathId] = path.split(":");
|
5564
4651
|
return pathId === sourceId;
|
5565
4652
|
}))) {
|
@@ -5677,7 +4764,7 @@ var DrawerItemInner = ({
|
|
5677
4764
|
{
|
5678
4765
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
5679
4766
|
ref: dragRef,
|
5680
|
-
onMouseDown: (
|
4767
|
+
onMouseDown: (e) => e.preventDefault(),
|
5681
4768
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
5682
4769
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
5683
4770
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DragIcon, {}) })
|
@@ -5865,7 +4952,7 @@ var SidebarSection = ({
|
|
5865
4952
|
style: { background },
|
5866
4953
|
children: [
|
5867
4954
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
5868
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb,
|
4955
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
5869
4956
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
5870
4957
|
"button",
|
5871
4958
|
{
|
@@ -5876,7 +4963,7 @@ var SidebarSection = ({
|
|
5876
4963
|
}
|
5877
4964
|
),
|
5878
4965
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
|
5879
|
-
] },
|
4966
|
+
] }, i)) : null,
|
5880
4967
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
5881
4968
|
] }) }),
|
5882
4969
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
@@ -6086,8 +5173,8 @@ var Fields = () => {
|
|
6086
5173
|
"form",
|
6087
5174
|
{
|
6088
5175
|
className: getClassName21(),
|
6089
|
-
onSubmit: (
|
6090
|
-
|
5176
|
+
onSubmit: (e) => {
|
5177
|
+
e.preventDefault();
|
6091
5178
|
},
|
6092
5179
|
children: [
|
6093
5180
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
@@ -6271,7 +5358,7 @@ var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6271
5358
|
var useComponentList = (config, ui) => {
|
6272
5359
|
const [componentList, setComponentList] = (0, import_react25.useState)();
|
6273
5360
|
(0, import_react25.useEffect)(() => {
|
6274
|
-
var _a, _b,
|
5361
|
+
var _a, _b, _c;
|
6275
5362
|
if (Object.keys(ui.componentList).length > 0) {
|
6276
5363
|
const matchedComponents = [];
|
6277
5364
|
let _componentList;
|
@@ -6285,7 +5372,7 @@ var useComponentList = (config, ui) => {
|
|
6285
5372
|
{
|
6286
5373
|
id: categoryKey,
|
6287
5374
|
title: category.title || categoryKey,
|
6288
|
-
children: category.components.map((componentName,
|
5375
|
+
children: category.components.map((componentName, i) => {
|
6289
5376
|
var _a2;
|
6290
5377
|
matchedComponents.push(componentName);
|
6291
5378
|
const componentConf = config.components[componentName] || {};
|
@@ -6294,7 +5381,7 @@ var useComponentList = (config, ui) => {
|
|
6294
5381
|
{
|
6295
5382
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
6296
5383
|
name: componentName,
|
6297
|
-
index:
|
5384
|
+
index: i
|
6298
5385
|
},
|
6299
5386
|
componentName
|
6300
5387
|
);
|
@@ -6313,8 +5400,8 @@ var useComponentList = (config, ui) => {
|
|
6313
5400
|
ComponentList,
|
6314
5401
|
{
|
6315
5402
|
id: "other",
|
6316
|
-
title: ((
|
6317
|
-
children: remainingComponents.map((componentName,
|
5403
|
+
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
5404
|
+
children: remainingComponents.map((componentName, i) => {
|
6318
5405
|
var _a2;
|
6319
5406
|
const componentConf = config.components[componentName] || {};
|
6320
5407
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
@@ -6322,7 +5409,7 @@ var useComponentList = (config, ui) => {
|
|
6322
5409
|
{
|
6323
5410
|
name: componentName,
|
6324
5411
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
6325
|
-
index:
|
5412
|
+
index: i
|
6326
5413
|
},
|
6327
5414
|
componentName
|
6328
5415
|
);
|
@@ -6376,7 +5463,7 @@ var getStyles = (styleSheet) => {
|
|
6376
5463
|
if (styleSheet) {
|
6377
5464
|
try {
|
6378
5465
|
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
6379
|
-
} catch (
|
5466
|
+
} catch (e) {
|
6380
5467
|
console.warn(
|
6381
5468
|
"Access to stylesheet %s is denied. Ignoring\u2026",
|
6382
5469
|
styleSheet.href
|
@@ -6513,7 +5600,7 @@ var CopyHostStyles = ({
|
|
6513
5600
|
const parentBody = parentDocument.getElementsByTagName("body")[0];
|
6514
5601
|
syncAttributes(parentBody, doc.body);
|
6515
5602
|
Promise.all(
|
6516
|
-
collectedStyles.map((styleNode,
|
5603
|
+
collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
|
6517
5604
|
if (styleNode.nodeName === "LINK") {
|
6518
5605
|
const linkHref = styleNode.href;
|
6519
5606
|
if (hrefs.indexOf(linkHref) > -1) {
|
@@ -6671,6 +5758,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
6671
5758
|
{
|
6672
5759
|
className: getClassName23(),
|
6673
5760
|
id,
|
5761
|
+
"data-puck-preview": true,
|
6674
5762
|
onClick: () => {
|
6675
5763
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
6676
5764
|
},
|
@@ -6824,9 +5912,9 @@ var LayerTree = ({
|
|
6824
5912
|
] }),
|
6825
5913
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
6826
5914
|
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
6827
|
-
zoneContent.map((item,
|
5915
|
+
zoneContent.map((item, i) => {
|
6828
5916
|
var _a;
|
6829
|
-
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) ===
|
5917
|
+
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
6830
5918
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
6831
5919
|
const containsZone = Object.keys(zonesForItem).length > 0;
|
6832
5920
|
const { setHoveringComponent = () => {
|
@@ -6856,7 +5944,7 @@ var LayerTree = ({
|
|
6856
5944
|
setItemSelector(null);
|
6857
5945
|
return;
|
6858
5946
|
}
|
6859
|
-
const id = zoneContent[
|
5947
|
+
const id = zoneContent[i].props.id;
|
6860
5948
|
const frame = getFrame();
|
6861
5949
|
const el = frame == null ? void 0 : frame.querySelector(
|
6862
5950
|
`[data-puck-component="${id}"]`
|
@@ -6871,17 +5959,17 @@ var LayerTree = ({
|
|
6871
5959
|
scrollIntoView(el);
|
6872
5960
|
onScrollEnd(frame, () => {
|
6873
5961
|
setItemSelector({
|
6874
|
-
index:
|
5962
|
+
index: i,
|
6875
5963
|
zone
|
6876
5964
|
});
|
6877
5965
|
});
|
6878
5966
|
},
|
6879
|
-
onMouseOver: (
|
6880
|
-
|
5967
|
+
onMouseOver: (e) => {
|
5968
|
+
e.stopPropagation();
|
6881
5969
|
setHoveringComponent(item.props.id);
|
6882
5970
|
},
|
6883
|
-
onMouseOut: (
|
6884
|
-
|
5971
|
+
onMouseOut: (e) => {
|
5972
|
+
e.stopPropagation();
|
6885
5973
|
setHoveringComponent(null);
|
6886
5974
|
},
|
6887
5975
|
children: [
|
@@ -6914,7 +6002,7 @@ var LayerTree = ({
|
|
6914
6002
|
) }, idx))
|
6915
6003
|
]
|
6916
6004
|
},
|
6917
|
-
`${item.props.id}_${
|
6005
|
+
`${item.props.id}_${i}`
|
6918
6006
|
);
|
6919
6007
|
})
|
6920
6008
|
] })
|
@@ -7259,8 +6347,8 @@ var ViewportButton = ({
|
|
7259
6347
|
{
|
7260
6348
|
title,
|
7261
6349
|
disabled: isActive,
|
7262
|
-
onClick: (
|
7263
|
-
|
6350
|
+
onClick: (e) => {
|
6351
|
+
e.stopPropagation();
|
7264
6352
|
onClick({ width, height });
|
7265
6353
|
},
|
7266
6354
|
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
@@ -7296,11 +6384,11 @@ var ViewportControls = ({
|
|
7296
6384
|
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
7297
6385
|
}
|
7298
6386
|
]
|
7299
|
-
].filter((
|
6387
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
7300
6388
|
[autoZoom]
|
7301
6389
|
);
|
7302
6390
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
7303
|
-
viewports.map((viewport,
|
6391
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
7304
6392
|
ViewportButton,
|
7305
6393
|
{
|
7306
6394
|
height: viewport.height,
|
@@ -7309,7 +6397,7 @@ var ViewportControls = ({
|
|
7309
6397
|
onClick: onViewportChange,
|
7310
6398
|
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
7311
6399
|
},
|
7312
|
-
|
6400
|
+
i
|
7313
6401
|
)),
|
7314
6402
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
7315
6403
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
@@ -7317,8 +6405,8 @@ var ViewportControls = ({
|
|
7317
6405
|
{
|
7318
6406
|
title: "Zoom viewport out",
|
7319
6407
|
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
7320
|
-
onClick: (
|
7321
|
-
|
6408
|
+
onClick: (e) => {
|
6409
|
+
e.stopPropagation();
|
7322
6410
|
onZoom(
|
7323
6411
|
zoomOptions[Math.max(
|
7324
6412
|
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
@@ -7334,8 +6422,8 @@ var ViewportControls = ({
|
|
7334
6422
|
{
|
7335
6423
|
title: "Zoom viewport in",
|
7336
6424
|
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
7337
|
-
onClick: (
|
7338
|
-
|
6425
|
+
onClick: (e) => {
|
6426
|
+
e.stopPropagation();
|
7339
6427
|
onZoom(
|
7340
6428
|
zoomOptions[Math.min(
|
7341
6429
|
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
@@ -7352,8 +6440,8 @@ var ViewportControls = ({
|
|
7352
6440
|
{
|
7353
6441
|
className: getClassName25("zoomSelect"),
|
7354
6442
|
value: zoom.toString(),
|
7355
|
-
onChange: (
|
7356
|
-
onZoom(parseFloat(
|
6443
|
+
onChange: (e) => {
|
6444
|
+
onZoom(parseFloat(e.currentTarget.value));
|
7357
6445
|
},
|
7358
6446
|
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
7359
6447
|
"option",
|
@@ -7693,7 +6781,7 @@ function Puck({
|
|
7693
6781
|
}, _iframe);
|
7694
6782
|
useInjectGlobalCss(iframe.enabled);
|
7695
6783
|
const [generatedAppState] = (0, import_react36.useState)(() => {
|
7696
|
-
var _a2, _b2,
|
6784
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7697
6785
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7698
6786
|
let clientUiState = {};
|
7699
6787
|
if (typeof window !== "undefined") {
|
@@ -7707,13 +6795,13 @@ function Puck({
|
|
7707
6795
|
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
7708
6796
|
key,
|
7709
6797
|
diff: Math.abs(viewportWidth - value.width)
|
7710
|
-
})).sort((
|
6798
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
7711
6799
|
const closestViewport = viewportDifferences[0].key;
|
7712
6800
|
if (iframe.enabled) {
|
7713
6801
|
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
7714
6802
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
7715
6803
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
7716
|
-
height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((
|
6804
|
+
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",
|
7717
6805
|
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)
|
7718
6806
|
})
|
7719
6807
|
})
|
@@ -8164,8 +7252,8 @@ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
|
|
8164
7252
|
const { zones = {} } = data;
|
8165
7253
|
const zoneKeys = Object.keys(zones);
|
8166
7254
|
const resolvedZones = {};
|
8167
|
-
for (let
|
8168
|
-
const zoneKey = zoneKeys[
|
7255
|
+
for (let i = 0; i < zoneKeys.length; i++) {
|
7256
|
+
const zoneKey = zoneKeys[i];
|
8169
7257
|
resolvedZones[zoneKey] = yield resolveAllComponentData(
|
8170
7258
|
zones[zoneKey],
|
8171
7259
|
config,
|