@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.mjs
CHANGED
@@ -29,8 +29,8 @@ var require_classnames = __commonJS({
|
|
29
29
|
var nativeCodeString = "[native code]";
|
30
30
|
function classNames() {
|
31
31
|
var classes = [];
|
32
|
-
for (var
|
33
|
-
var arg = arguments[
|
32
|
+
for (var i = 0; i < arguments.length; i++) {
|
33
|
+
var arg = arguments[i];
|
34
34
|
if (!arg) continue;
|
35
35
|
var argType = typeof arg;
|
36
36
|
if (argType === "string" || argType === "number") {
|
@@ -137,9 +137,9 @@ var getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (o
|
|
137
137
|
for (let modifier in modifiers) {
|
138
138
|
prefixedModifiers[styles2[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
139
139
|
}
|
140
|
-
const
|
140
|
+
const c = styles2[rootClass];
|
141
141
|
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
142
|
-
[
|
142
|
+
[c]: !!c
|
143
143
|
}, prefixedModifiers));
|
144
144
|
} else {
|
145
145
|
return config.baseClass + styles2[rootClass] || "";
|
@@ -567,10 +567,10 @@ var IconButton = ({
|
|
567
567
|
disabled,
|
568
568
|
fullWidth
|
569
569
|
}),
|
570
|
-
onClick: (
|
570
|
+
onClick: (e) => {
|
571
571
|
if (!onClick) return;
|
572
572
|
setLoading(true);
|
573
|
-
Promise.resolve(onClick(
|
573
|
+
Promise.resolve(onClick(e)).then(() => {
|
574
574
|
setLoading(false);
|
575
575
|
});
|
576
576
|
},
|
@@ -647,7 +647,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
647
647
|
const [resolvedPermissions, setResolvedPermissions] = useState2({});
|
648
648
|
const resolveDataForItem = useCallback(
|
649
649
|
(item, force = false) => __async(void 0, null, function* () {
|
650
|
-
var _a, _b,
|
650
|
+
var _a, _b, _c;
|
651
651
|
const componentConfig = item.type === "root" ? config.root : config.components[item.type];
|
652
652
|
if (!componentConfig) {
|
653
653
|
return;
|
@@ -664,7 +664,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
664
664
|
lastPermissions: ((_b = cache[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
|
665
665
|
permissions: initialPermissions,
|
666
666
|
appState,
|
667
|
-
lastData: ((
|
667
|
+
lastData: ((_c = cache[item.props.id]) == null ? void 0 : _c.lastData) || null
|
668
668
|
}
|
669
669
|
);
|
670
670
|
setCache((_cache) => __spreadProps(__spreadValues({}, _cache), {
|
@@ -673,7 +673,7 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
|
|
673
673
|
lastPermissions: resolvedPermissions2
|
674
674
|
}
|
675
675
|
}));
|
676
|
-
setResolvedPermissions((
|
676
|
+
setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
|
677
677
|
[item.props.id]: resolvedPermissions2
|
678
678
|
}));
|
679
679
|
unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
|
@@ -1234,27 +1234,27 @@ var ArrayField = ({
|
|
1234
1234
|
hasItems: Array.isArray(value) && value.length > 0,
|
1235
1235
|
addDisabled
|
1236
1236
|
}),
|
1237
|
-
onMouseOver: (
|
1238
|
-
|
1237
|
+
onMouseOver: (e) => {
|
1238
|
+
e.stopPropagation();
|
1239
1239
|
setHovering(true);
|
1240
1240
|
},
|
1241
|
-
onMouseOut: (
|
1242
|
-
|
1241
|
+
onMouseOut: (e) => {
|
1242
|
+
e.stopPropagation();
|
1243
1243
|
setHovering(false);
|
1244
1244
|
},
|
1245
|
-
onClick: (
|
1246
|
-
|
1245
|
+
onClick: (e) => {
|
1246
|
+
e.preventDefault();
|
1247
1247
|
},
|
1248
1248
|
children: [
|
1249
|
-
localState.arrayState.items.map((item,
|
1250
|
-
const { _arrayId = `${id}-${
|
1251
|
-
const data = Array.from(localState.value || [])[
|
1249
|
+
localState.arrayState.items.map((item, i) => {
|
1250
|
+
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
1251
|
+
const data = Array.from(localState.value || [])[i] || {};
|
1252
1252
|
return /* @__PURE__ */ jsx9(
|
1253
1253
|
Draggable,
|
1254
1254
|
{
|
1255
1255
|
id: _arrayId,
|
1256
|
-
index:
|
1257
|
-
className: (
|
1256
|
+
index: i,
|
1257
|
+
className: (_, snapshot2) => getClassNameItem({
|
1258
1258
|
isExpanded: arrayState.openId === _arrayId,
|
1259
1259
|
isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
|
1260
1260
|
readOnly
|
@@ -1281,7 +1281,7 @@ var ArrayField = ({
|
|
1281
1281
|
},
|
1282
1282
|
className: getClassNameItem("summary"),
|
1283
1283
|
children: [
|
1284
|
-
field.getItemSummary ? field.getItemSummary(data,
|
1284
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1285
1285
|
/* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
|
1286
1286
|
!readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
|
1287
1287
|
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
|
@@ -1289,15 +1289,15 @@ var ArrayField = ({
|
|
1289
1289
|
{
|
1290
1290
|
type: "button",
|
1291
1291
|
disabled: !!addDisabled,
|
1292
|
-
onClick: (
|
1293
|
-
|
1292
|
+
onClick: (e) => {
|
1293
|
+
e.stopPropagation();
|
1294
1294
|
const existingValue = [
|
1295
1295
|
...value || []
|
1296
1296
|
];
|
1297
1297
|
existingValue.splice(
|
1298
|
-
|
1298
|
+
i,
|
1299
1299
|
0,
|
1300
|
-
existingValue[
|
1300
|
+
existingValue[i]
|
1301
1301
|
);
|
1302
1302
|
onChange(
|
1303
1303
|
existingValue,
|
@@ -1315,16 +1315,16 @@ var ArrayField = ({
|
|
1315
1315
|
{
|
1316
1316
|
type: "button",
|
1317
1317
|
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
1318
|
-
onClick: (
|
1319
|
-
|
1318
|
+
onClick: (e) => {
|
1319
|
+
e.stopPropagation();
|
1320
1320
|
const existingValue = [
|
1321
1321
|
...value || []
|
1322
1322
|
];
|
1323
1323
|
const existingItems = [
|
1324
1324
|
...arrayState.items || []
|
1325
1325
|
];
|
1326
|
-
existingValue.splice(
|
1327
|
-
existingItems.splice(
|
1326
|
+
existingValue.splice(i, 1);
|
1327
|
+
existingItems.splice(i, 1);
|
1328
1328
|
onChange(
|
1329
1329
|
existingValue,
|
1330
1330
|
mapArrayStateToUi({
|
@@ -1345,7 +1345,7 @@ var ArrayField = ({
|
|
1345
1345
|
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx9("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
1346
1346
|
(fieldName) => {
|
1347
1347
|
const subField = field.arrayFields[fieldName];
|
1348
|
-
const subFieldName = `${name}[${
|
1348
|
+
const subFieldName = `${name}[${i}].${fieldName}`;
|
1349
1349
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
1350
1350
|
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
|
1351
1351
|
return /* @__PURE__ */ jsx9(
|
@@ -1359,7 +1359,7 @@ var ArrayField = ({
|
|
1359
1359
|
value: data[fieldName],
|
1360
1360
|
onChange: (val, ui) => {
|
1361
1361
|
onChange(
|
1362
|
-
replace(value,
|
1362
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
1363
1363
|
[fieldName]: val
|
1364
1364
|
})),
|
1365
1365
|
ui
|
@@ -1434,11 +1434,11 @@ var DefaultField = ({
|
|
1434
1434
|
type: field.type,
|
1435
1435
|
name,
|
1436
1436
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1437
|
-
onChange: (
|
1437
|
+
onChange: (e) => {
|
1438
1438
|
if (field.type === "number") {
|
1439
|
-
onChange(Number(
|
1439
|
+
onChange(Number(e.currentTarget.value));
|
1440
1440
|
} else {
|
1441
|
-
onChange(
|
1441
|
+
onChange(e.currentTarget.value);
|
1442
1442
|
}
|
1443
1443
|
},
|
1444
1444
|
readOnly,
|
@@ -1499,7 +1499,7 @@ var Modal = ({
|
|
1499
1499
|
"div",
|
1500
1500
|
{
|
1501
1501
|
className: getClassName7("inner"),
|
1502
|
-
onClick: (
|
1502
|
+
onClick: (e) => e.stopPropagation(),
|
1503
1503
|
children
|
1504
1504
|
}
|
1505
1505
|
) }),
|
@@ -1571,10 +1571,10 @@ var Button = ({
|
|
1571
1571
|
fullWidth,
|
1572
1572
|
[size]: true
|
1573
1573
|
}),
|
1574
|
-
onClick: (
|
1574
|
+
onClick: (e) => {
|
1575
1575
|
if (!onClick) return;
|
1576
1576
|
setLoading(true);
|
1577
|
-
Promise.resolve(onClick(
|
1577
|
+
Promise.resolve(onClick(e)).then(() => {
|
1578
1578
|
setLoading(false);
|
1579
1579
|
});
|
1580
1580
|
},
|
@@ -1703,8 +1703,8 @@ var ExternalInput = ({
|
|
1703
1703
|
hasData: mappedData.length > 0,
|
1704
1704
|
filtersToggled
|
1705
1705
|
}),
|
1706
|
-
onSubmit: (
|
1707
|
-
|
1706
|
+
onSubmit: (e) => {
|
1707
|
+
e.preventDefault();
|
1708
1708
|
search(searchQuery, filters);
|
1709
1709
|
},
|
1710
1710
|
children: [
|
@@ -1719,8 +1719,8 @@ var ExternalInput = ({
|
|
1719
1719
|
name: "q",
|
1720
1720
|
type: "search",
|
1721
1721
|
placeholder: field.placeholder,
|
1722
|
-
onChange: (
|
1723
|
-
setSearchQuery(
|
1722
|
+
onChange: (e) => {
|
1723
|
+
setSearchQuery(e.currentTarget.value);
|
1724
1724
|
},
|
1725
1725
|
autoComplete: "off",
|
1726
1726
|
value: searchQuery
|
@@ -1733,9 +1733,9 @@ var ExternalInput = ({
|
|
1733
1733
|
IconButton,
|
1734
1734
|
{
|
1735
1735
|
title: "Toggle filters",
|
1736
|
-
onClick: (
|
1737
|
-
|
1738
|
-
|
1736
|
+
onClick: (e) => {
|
1737
|
+
e.preventDefault();
|
1738
|
+
e.stopPropagation();
|
1739
1739
|
setFiltersToggled(!filtersToggled);
|
1740
1740
|
},
|
1741
1741
|
children: /* @__PURE__ */ jsx14(SlidersHorizontal, { size: 20 })
|
@@ -1774,19 +1774,19 @@ var ExternalInput = ({
|
|
1774
1774
|
},
|
1775
1775
|
key
|
1776
1776
|
)) }) }),
|
1777
|
-
/* @__PURE__ */ jsx14("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item,
|
1777
|
+
/* @__PURE__ */ jsx14("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
1778
1778
|
return /* @__PURE__ */ jsx14(
|
1779
1779
|
"tr",
|
1780
1780
|
{
|
1781
1781
|
style: { whiteSpace: "nowrap" },
|
1782
1782
|
className: getClassNameModal("tr"),
|
1783
1783
|
onClick: () => {
|
1784
|
-
onChange(mapProp(data[
|
1784
|
+
onChange(mapProp(data[i]));
|
1785
1785
|
setOpen(false);
|
1786
1786
|
},
|
1787
1787
|
children: keys.map((key) => /* @__PURE__ */ jsx14("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
1788
1788
|
},
|
1789
|
-
|
1789
|
+
i
|
1790
1790
|
);
|
1791
1791
|
}) })
|
1792
1792
|
] }),
|
@@ -1814,7 +1814,7 @@ var ExternalField = ({
|
|
1814
1814
|
id,
|
1815
1815
|
readOnly
|
1816
1816
|
}) => {
|
1817
|
-
var _a, _b,
|
1817
|
+
var _a, _b, _c;
|
1818
1818
|
const validField = field;
|
1819
1819
|
const deprecatedField = field;
|
1820
1820
|
useEffect8(() => {
|
@@ -1836,7 +1836,7 @@ var ExternalField = ({
|
|
1836
1836
|
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
1837
1837
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
1838
1838
|
mapRow: validField.mapRow,
|
1839
|
-
fetchList: ((
|
1839
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
1840
1840
|
return yield deprecatedField.adaptor.fetchList(
|
1841
1841
|
deprecatedField.adaptorParams
|
1842
1842
|
);
|
@@ -1886,12 +1886,12 @@ var RadioField = ({
|
|
1886
1886
|
className: getClassName11("radioInput"),
|
1887
1887
|
value: option.value,
|
1888
1888
|
name,
|
1889
|
-
onChange: (
|
1890
|
-
if (
|
1891
|
-
onChange(JSON.parse(
|
1889
|
+
onChange: (e) => {
|
1890
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1891
|
+
onChange(JSON.parse(e.currentTarget.value));
|
1892
1892
|
return;
|
1893
1893
|
}
|
1894
|
-
onChange(
|
1894
|
+
onChange(e.currentTarget.value);
|
1895
1895
|
},
|
1896
1896
|
disabled: readOnly,
|
1897
1897
|
checked: value === option.value
|
@@ -1935,12 +1935,12 @@ var SelectField = ({
|
|
1935
1935
|
id,
|
1936
1936
|
className: getClassName12("input"),
|
1937
1937
|
disabled: readOnly,
|
1938
|
-
onChange: (
|
1939
|
-
if (
|
1940
|
-
onChange(JSON.parse(
|
1938
|
+
onChange: (e) => {
|
1939
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1940
|
+
onChange(JSON.parse(e.currentTarget.value));
|
1941
1941
|
return;
|
1942
1942
|
}
|
1943
|
-
onChange(
|
1943
|
+
onChange(e.currentTarget.value);
|
1944
1944
|
},
|
1945
1945
|
value,
|
1946
1946
|
children: field.options.map((option) => /* @__PURE__ */ jsx17(
|
@@ -1978,7 +1978,7 @@ var TextareaField = ({
|
|
1978
1978
|
autoComplete: "off",
|
1979
1979
|
name,
|
1980
1980
|
value: typeof value === "undefined" ? "" : value,
|
1981
|
-
onChange: (
|
1981
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
1982
1982
|
readOnly,
|
1983
1983
|
tabIndex: readOnly ? -1 : void 0,
|
1984
1984
|
rows: 5
|
@@ -2120,7 +2120,7 @@ var FieldLabelInternal2 = ({
|
|
2120
2120
|
);
|
2121
2121
|
};
|
2122
2122
|
function AutoFieldInternal(props) {
|
2123
|
-
var _a, _b,
|
2123
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2124
2124
|
const { dispatch, overrides } = useAppContext();
|
2125
2125
|
const { id, Label = FieldLabelInternal2 } = props;
|
2126
2126
|
const field = props.field;
|
@@ -2140,7 +2140,7 @@ function AutoFieldInternal(props) {
|
|
2140
2140
|
const render = __spreadProps(__spreadValues({}, overrides.fieldTypes), {
|
2141
2141
|
array: ((_a = overrides.fieldTypes) == null ? void 0 : _a.array) || defaultFields.array,
|
2142
2142
|
external: ((_b = overrides.fieldTypes) == null ? void 0 : _b.external) || defaultFields.external,
|
2143
|
-
object: ((
|
2143
|
+
object: ((_c = overrides.fieldTypes) == null ? void 0 : _c.object) || defaultFields.object,
|
2144
2144
|
select: ((_d = overrides.fieldTypes) == null ? void 0 : _d.select) || defaultFields.select,
|
2145
2145
|
textarea: ((_e = overrides.fieldTypes) == null ? void 0 : _e.textarea) || defaultFields.textarea,
|
2146
2146
|
radio: ((_f = overrides.fieldTypes) == null ? void 0 : _f.radio) || defaultFields.radio,
|
@@ -2154,9 +2154,9 @@ function AutoFieldInternal(props) {
|
|
2154
2154
|
id: resolvedId
|
2155
2155
|
});
|
2156
2156
|
const onFocus = useCallback5(
|
2157
|
-
(
|
2158
|
-
if (mergedProps.name &&
|
2159
|
-
|
2157
|
+
(e) => {
|
2158
|
+
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2159
|
+
e.stopPropagation();
|
2160
2160
|
dispatch({
|
2161
2161
|
type: "setUi",
|
2162
2162
|
ui: {
|
@@ -2167,8 +2167,8 @@ function AutoFieldInternal(props) {
|
|
2167
2167
|
},
|
2168
2168
|
[mergedProps.name]
|
2169
2169
|
);
|
2170
|
-
const onBlur = useCallback5((
|
2171
|
-
if ("name" in
|
2170
|
+
const onBlur = useCallback5((e) => {
|
2171
|
+
if ("name" in e.target) {
|
2172
2172
|
dispatch({
|
2173
2173
|
type: "setUi",
|
2174
2174
|
ui: {
|
@@ -2307,982 +2307,21 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
2307
2307
|
|
2308
2308
|
// components/DraggableComponent/collision/dynamic/index.ts
|
2309
2309
|
init_react_import();
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
// ../../node_modules/@dnd-kit/state/dist/index.mjs
|
2315
|
-
init_react_import();
|
2316
|
-
|
2317
|
-
// ../../node_modules/@preact/signals-core/dist/signals-core.mjs
|
2318
|
-
init_react_import();
|
2319
|
-
var i = Symbol.for("preact-signals");
|
2320
|
-
function t() {
|
2321
|
-
if (r > 1) {
|
2322
|
-
r--;
|
2323
|
-
return;
|
2324
|
-
}
|
2325
|
-
let i2, t2 = false;
|
2326
|
-
while (void 0 !== s) {
|
2327
|
-
let o2 = s;
|
2328
|
-
s = void 0;
|
2329
|
-
f++;
|
2330
|
-
while (void 0 !== o2) {
|
2331
|
-
const n2 = o2.o;
|
2332
|
-
o2.o = void 0;
|
2333
|
-
o2.f &= -3;
|
2334
|
-
if (!(8 & o2.f) && v(o2)) try {
|
2335
|
-
o2.c();
|
2336
|
-
} catch (o3) {
|
2337
|
-
if (!t2) {
|
2338
|
-
i2 = o3;
|
2339
|
-
t2 = true;
|
2340
|
-
}
|
2341
|
-
}
|
2342
|
-
o2 = n2;
|
2343
|
-
}
|
2344
|
-
}
|
2345
|
-
f = 0;
|
2346
|
-
r--;
|
2347
|
-
if (t2) throw i2;
|
2348
|
-
}
|
2349
|
-
function o(i2) {
|
2350
|
-
if (r > 0) return i2();
|
2351
|
-
r++;
|
2352
|
-
try {
|
2353
|
-
return i2();
|
2354
|
-
} finally {
|
2355
|
-
t();
|
2356
|
-
}
|
2357
|
-
}
|
2358
|
-
var n;
|
2359
|
-
var s;
|
2360
|
-
function h(i2) {
|
2361
|
-
const t2 = n;
|
2362
|
-
n = void 0;
|
2363
|
-
try {
|
2364
|
-
return i2();
|
2365
|
-
} finally {
|
2366
|
-
n = t2;
|
2367
|
-
}
|
2368
|
-
}
|
2369
|
-
var r = 0;
|
2370
|
-
var f = 0;
|
2371
|
-
var e = 0;
|
2372
|
-
function c(i2) {
|
2373
|
-
if (void 0 === n) return;
|
2374
|
-
let t2 = i2.n;
|
2375
|
-
if (void 0 === t2 || t2.t !== n) {
|
2376
|
-
t2 = { i: 0, S: i2, p: n.s, n: void 0, t: n, e: void 0, x: void 0, r: t2 };
|
2377
|
-
if (void 0 !== n.s) n.s.n = t2;
|
2378
|
-
n.s = t2;
|
2379
|
-
i2.n = t2;
|
2380
|
-
if (32 & n.f) i2.S(t2);
|
2381
|
-
return t2;
|
2382
|
-
} else if (-1 === t2.i) {
|
2383
|
-
t2.i = 0;
|
2384
|
-
if (void 0 !== t2.n) {
|
2385
|
-
t2.n.p = t2.p;
|
2386
|
-
if (void 0 !== t2.p) t2.p.n = t2.n;
|
2387
|
-
t2.p = n.s;
|
2388
|
-
t2.n = void 0;
|
2389
|
-
n.s.n = t2;
|
2390
|
-
n.s = t2;
|
2391
|
-
}
|
2392
|
-
return t2;
|
2393
|
-
}
|
2394
|
-
}
|
2395
|
-
function u(i2) {
|
2396
|
-
this.v = i2;
|
2397
|
-
this.i = 0;
|
2398
|
-
this.n = void 0;
|
2399
|
-
this.t = void 0;
|
2400
|
-
}
|
2401
|
-
u.prototype.brand = i;
|
2402
|
-
u.prototype.h = function() {
|
2403
|
-
return true;
|
2404
|
-
};
|
2405
|
-
u.prototype.S = function(i2) {
|
2406
|
-
if (this.t !== i2 && void 0 === i2.e) {
|
2407
|
-
i2.x = this.t;
|
2408
|
-
if (void 0 !== this.t) this.t.e = i2;
|
2409
|
-
this.t = i2;
|
2410
|
-
}
|
2411
|
-
};
|
2412
|
-
u.prototype.U = function(i2) {
|
2413
|
-
if (void 0 !== this.t) {
|
2414
|
-
const t2 = i2.e, o2 = i2.x;
|
2415
|
-
if (void 0 !== t2) {
|
2416
|
-
t2.x = o2;
|
2417
|
-
i2.e = void 0;
|
2418
|
-
}
|
2419
|
-
if (void 0 !== o2) {
|
2420
|
-
o2.e = t2;
|
2421
|
-
i2.x = void 0;
|
2422
|
-
}
|
2423
|
-
if (i2 === this.t) this.t = o2;
|
2424
|
-
}
|
2425
|
-
};
|
2426
|
-
u.prototype.subscribe = function(i2) {
|
2427
|
-
return E(() => {
|
2428
|
-
const t2 = this.value, o2 = n;
|
2429
|
-
n = void 0;
|
2430
|
-
try {
|
2431
|
-
i2(t2);
|
2432
|
-
} finally {
|
2433
|
-
n = o2;
|
2434
|
-
}
|
2435
|
-
});
|
2436
|
-
};
|
2437
|
-
u.prototype.valueOf = function() {
|
2438
|
-
return this.value;
|
2439
|
-
};
|
2440
|
-
u.prototype.toString = function() {
|
2441
|
-
return this.value + "";
|
2442
|
-
};
|
2443
|
-
u.prototype.toJSON = function() {
|
2444
|
-
return this.value;
|
2445
|
-
};
|
2446
|
-
u.prototype.peek = function() {
|
2447
|
-
const i2 = n;
|
2448
|
-
n = void 0;
|
2449
|
-
try {
|
2450
|
-
return this.value;
|
2451
|
-
} finally {
|
2452
|
-
n = i2;
|
2453
|
-
}
|
2454
|
-
};
|
2455
|
-
Object.defineProperty(u.prototype, "value", { get() {
|
2456
|
-
const i2 = c(this);
|
2457
|
-
if (void 0 !== i2) i2.i = this.i;
|
2458
|
-
return this.v;
|
2459
|
-
}, set(i2) {
|
2460
|
-
if (i2 !== this.v) {
|
2461
|
-
if (f > 100) throw new Error("Cycle detected");
|
2462
|
-
this.v = i2;
|
2463
|
-
this.i++;
|
2464
|
-
e++;
|
2465
|
-
r++;
|
2466
|
-
try {
|
2467
|
-
for (let i3 = this.t; void 0 !== i3; i3 = i3.x) i3.t.N();
|
2468
|
-
} finally {
|
2469
|
-
t();
|
2470
|
-
}
|
2471
|
-
}
|
2472
|
-
} });
|
2473
|
-
function d(i2) {
|
2474
|
-
return new u(i2);
|
2475
|
-
}
|
2476
|
-
function v(i2) {
|
2477
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) if (t2.S.i !== t2.i || !t2.S.h() || t2.S.i !== t2.i) return true;
|
2478
|
-
return false;
|
2479
|
-
}
|
2480
|
-
function l(i2) {
|
2481
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) {
|
2482
|
-
const o2 = t2.S.n;
|
2483
|
-
if (void 0 !== o2) t2.r = o2;
|
2484
|
-
t2.S.n = t2;
|
2485
|
-
t2.i = -1;
|
2486
|
-
if (void 0 === t2.n) {
|
2487
|
-
i2.s = t2;
|
2488
|
-
break;
|
2489
|
-
}
|
2490
|
-
}
|
2491
|
-
}
|
2492
|
-
function y(i2) {
|
2493
|
-
let t2, o2 = i2.s;
|
2494
|
-
while (void 0 !== o2) {
|
2495
|
-
const i3 = o2.p;
|
2496
|
-
if (-1 === o2.i) {
|
2497
|
-
o2.S.U(o2);
|
2498
|
-
if (void 0 !== i3) i3.n = o2.n;
|
2499
|
-
if (void 0 !== o2.n) o2.n.p = i3;
|
2500
|
-
} else t2 = o2;
|
2501
|
-
o2.S.n = o2.r;
|
2502
|
-
if (void 0 !== o2.r) o2.r = void 0;
|
2503
|
-
o2 = i3;
|
2504
|
-
}
|
2505
|
-
i2.s = t2;
|
2506
|
-
}
|
2507
|
-
function a(i2) {
|
2508
|
-
u.call(this, void 0);
|
2509
|
-
this.x = i2;
|
2510
|
-
this.s = void 0;
|
2511
|
-
this.g = e - 1;
|
2512
|
-
this.f = 4;
|
2513
|
-
}
|
2514
|
-
(a.prototype = new u()).h = function() {
|
2515
|
-
this.f &= -3;
|
2516
|
-
if (1 & this.f) return false;
|
2517
|
-
if (32 == (36 & this.f)) return true;
|
2518
|
-
this.f &= -5;
|
2519
|
-
if (this.g === e) return true;
|
2520
|
-
this.g = e;
|
2521
|
-
this.f |= 1;
|
2522
|
-
if (this.i > 0 && !v(this)) {
|
2523
|
-
this.f &= -2;
|
2524
|
-
return true;
|
2525
|
-
}
|
2526
|
-
const i2 = n;
|
2527
|
-
try {
|
2528
|
-
l(this);
|
2529
|
-
n = this;
|
2530
|
-
const i3 = this.x();
|
2531
|
-
if (16 & this.f || this.v !== i3 || 0 === this.i) {
|
2532
|
-
this.v = i3;
|
2533
|
-
this.f &= -17;
|
2534
|
-
this.i++;
|
2535
|
-
}
|
2536
|
-
} catch (i3) {
|
2537
|
-
this.v = i3;
|
2538
|
-
this.f |= 16;
|
2539
|
-
this.i++;
|
2540
|
-
}
|
2541
|
-
n = i2;
|
2542
|
-
y(this);
|
2543
|
-
this.f &= -2;
|
2544
|
-
return true;
|
2545
|
-
};
|
2546
|
-
a.prototype.S = function(i2) {
|
2547
|
-
if (void 0 === this.t) {
|
2548
|
-
this.f |= 36;
|
2549
|
-
for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.S(i3);
|
2550
|
-
}
|
2551
|
-
u.prototype.S.call(this, i2);
|
2552
|
-
};
|
2553
|
-
a.prototype.U = function(i2) {
|
2554
|
-
if (void 0 !== this.t) {
|
2555
|
-
u.prototype.U.call(this, i2);
|
2556
|
-
if (void 0 === this.t) {
|
2557
|
-
this.f &= -33;
|
2558
|
-
for (let i3 = this.s; void 0 !== i3; i3 = i3.n) i3.S.U(i3);
|
2559
|
-
}
|
2560
|
-
}
|
2561
|
-
};
|
2562
|
-
a.prototype.N = function() {
|
2563
|
-
if (!(2 & this.f)) {
|
2564
|
-
this.f |= 6;
|
2565
|
-
for (let i2 = this.t; void 0 !== i2; i2 = i2.x) i2.t.N();
|
2566
|
-
}
|
2567
|
-
};
|
2568
|
-
Object.defineProperty(a.prototype, "value", { get() {
|
2569
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
2570
|
-
const i2 = c(this);
|
2571
|
-
this.h();
|
2572
|
-
if (void 0 !== i2) i2.i = this.i;
|
2573
|
-
if (16 & this.f) throw this.v;
|
2574
|
-
return this.v;
|
2575
|
-
} });
|
2576
|
-
function w(i2) {
|
2577
|
-
return new a(i2);
|
2578
|
-
}
|
2579
|
-
function _(i2) {
|
2580
|
-
const o2 = i2.u;
|
2581
|
-
i2.u = void 0;
|
2582
|
-
if ("function" == typeof o2) {
|
2583
|
-
r++;
|
2584
|
-
const s2 = n;
|
2585
|
-
n = void 0;
|
2586
|
-
try {
|
2587
|
-
o2();
|
2588
|
-
} catch (t2) {
|
2589
|
-
i2.f &= -2;
|
2590
|
-
i2.f |= 8;
|
2591
|
-
g(i2);
|
2592
|
-
throw t2;
|
2593
|
-
} finally {
|
2594
|
-
n = s2;
|
2595
|
-
t();
|
2596
|
-
}
|
2597
|
-
}
|
2598
|
-
}
|
2599
|
-
function g(i2) {
|
2600
|
-
for (let t2 = i2.s; void 0 !== t2; t2 = t2.n) t2.S.U(t2);
|
2601
|
-
i2.x = void 0;
|
2602
|
-
i2.s = void 0;
|
2603
|
-
_(i2);
|
2604
|
-
}
|
2605
|
-
function p(i2) {
|
2606
|
-
if (n !== this) throw new Error("Out-of-order effect");
|
2607
|
-
y(this);
|
2608
|
-
n = i2;
|
2609
|
-
this.f &= -2;
|
2610
|
-
if (8 & this.f) g(this);
|
2611
|
-
t();
|
2612
|
-
}
|
2613
|
-
function b(i2) {
|
2614
|
-
this.x = i2;
|
2615
|
-
this.u = void 0;
|
2616
|
-
this.s = void 0;
|
2617
|
-
this.o = void 0;
|
2618
|
-
this.f = 32;
|
2619
|
-
}
|
2620
|
-
b.prototype.c = function() {
|
2621
|
-
const i2 = this.S();
|
2622
|
-
try {
|
2623
|
-
if (8 & this.f) return;
|
2624
|
-
if (void 0 === this.x) return;
|
2625
|
-
const t2 = this.x();
|
2626
|
-
if ("function" == typeof t2) this.u = t2;
|
2627
|
-
} finally {
|
2628
|
-
i2();
|
2629
|
-
}
|
2630
|
-
};
|
2631
|
-
b.prototype.S = function() {
|
2632
|
-
if (1 & this.f) throw new Error("Cycle detected");
|
2633
|
-
this.f |= 1;
|
2634
|
-
this.f &= -9;
|
2635
|
-
_(this);
|
2636
|
-
l(this);
|
2637
|
-
r++;
|
2638
|
-
const i2 = n;
|
2639
|
-
n = this;
|
2640
|
-
return p.bind(this, i2);
|
2641
|
-
};
|
2642
|
-
b.prototype.N = function() {
|
2643
|
-
if (!(2 & this.f)) {
|
2644
|
-
this.f |= 2;
|
2645
|
-
this.o = s;
|
2646
|
-
s = this;
|
2647
|
-
}
|
2648
|
-
};
|
2649
|
-
b.prototype.d = function() {
|
2650
|
-
this.f |= 8;
|
2651
|
-
if (!(1 & this.f)) g(this);
|
2652
|
-
};
|
2653
|
-
function E(i2) {
|
2654
|
-
const t2 = new b(i2);
|
2655
|
-
try {
|
2656
|
-
t2.c();
|
2657
|
-
} catch (i3) {
|
2658
|
-
t2.d();
|
2659
|
-
throw i3;
|
2660
|
-
}
|
2661
|
-
return t2.d.bind(t2);
|
2662
|
-
}
|
2663
|
-
|
2664
|
-
// ../../node_modules/@dnd-kit/state/dist/index.mjs
|
2665
|
-
function computed(compute, comparator) {
|
2666
|
-
if (comparator) {
|
2667
|
-
let previousValue;
|
2668
|
-
return w(() => {
|
2669
|
-
const value = compute();
|
2670
|
-
if (value && previousValue && comparator(previousValue, value)) {
|
2671
|
-
return previousValue;
|
2672
|
-
}
|
2673
|
-
previousValue = value;
|
2674
|
-
return value;
|
2675
|
-
});
|
2676
|
-
}
|
2677
|
-
return w(compute);
|
2678
|
-
}
|
2679
|
-
function reactive({ get }, _2) {
|
2680
|
-
return {
|
2681
|
-
init(value) {
|
2682
|
-
return d(value);
|
2683
|
-
},
|
2684
|
-
get() {
|
2685
|
-
const current = get.call(this);
|
2686
|
-
return current.value;
|
2687
|
-
},
|
2688
|
-
set(newValue) {
|
2689
|
-
const current = get.call(this);
|
2690
|
-
if (current.peek() === newValue) {
|
2691
|
-
return;
|
2692
|
-
}
|
2693
|
-
current.value = newValue;
|
2694
|
-
}
|
2695
|
-
};
|
2696
|
-
}
|
2697
|
-
function derived(target, _2) {
|
2698
|
-
const map = /* @__PURE__ */ new WeakMap();
|
2699
|
-
return function() {
|
2700
|
-
let result = map.get(this);
|
2701
|
-
if (!result) {
|
2702
|
-
result = computed(target.bind(this));
|
2703
|
-
map.set(this, result);
|
2704
|
-
}
|
2705
|
-
return result.value;
|
2706
|
-
};
|
2707
|
-
}
|
2708
|
-
function effects(...entries) {
|
2709
|
-
const effects2 = entries.map(E);
|
2710
|
-
return () => effects2.forEach((cleanup) => cleanup());
|
2711
|
-
}
|
2712
|
-
|
2713
|
-
// ../../node_modules/@dnd-kit/geometry/dist/index.mjs
|
2714
|
-
init_react_import();
|
2715
|
-
var __create = Object.create;
|
2716
|
-
var __defProp = Object.defineProperty;
|
2717
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
2718
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
2719
|
-
var __typeError = (msg) => {
|
2720
|
-
throw TypeError(msg);
|
2721
|
-
};
|
2722
|
-
var __pow = Math.pow;
|
2723
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2724
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
2725
|
-
var __decoratorStart = (base) => {
|
2726
|
-
var _a;
|
2727
|
-
return [, , , __create((_a = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a : null)];
|
2728
|
-
};
|
2729
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
2730
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
2731
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
2732
|
-
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
2733
|
-
var __runInitializers = (array, flags, self, value) => {
|
2734
|
-
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
|
2735
|
-
return value;
|
2736
|
-
};
|
2737
|
-
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
2738
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
2739
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
2740
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
2741
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
2742
|
-
return __privateGet2(this, extra);
|
2743
|
-
}, set [name](x) {
|
2744
|
-
return __privateSet2(this, extra, x);
|
2745
|
-
} }, name));
|
2746
|
-
k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
2747
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
2748
|
-
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
2749
|
-
if (k) {
|
2750
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
|
2751
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet2 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
2752
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
2753
|
-
}
|
2754
|
-
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
2755
|
-
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
2756
|
-
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
2757
|
-
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
2758
|
-
}
|
2759
|
-
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
2760
|
-
};
|
2761
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
2762
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
2763
|
-
var __privateGet2 = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2764
|
-
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2765
|
-
var __privateSet2 = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
2766
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
2767
|
-
var Point = class _Point {
|
2768
|
-
/**
|
2769
|
-
* @param {number} Coordinate of the point on the horizontal axis
|
2770
|
-
* @param {number} Coordinate of the point on the vertical axis
|
2771
|
-
*/
|
2772
|
-
constructor(x, y2) {
|
2773
|
-
this.x = x;
|
2774
|
-
this.y = y2;
|
2775
|
-
}
|
2776
|
-
/**
|
2777
|
-
* Returns the delta between this point and another point.
|
2778
|
-
*
|
2779
|
-
* @param {Point} a - A point
|
2780
|
-
* @param {Point} b - Another point
|
2781
|
-
*/
|
2782
|
-
static delta(a2, b2) {
|
2783
|
-
return new _Point(a2.x - b2.x, a2.y - b2.y);
|
2784
|
-
}
|
2785
|
-
/**
|
2786
|
-
* Returns the distance (hypotenuse) between this point and another point.
|
2787
|
-
*
|
2788
|
-
* @param {Point} a - A point
|
2789
|
-
* @param {Point} b - Another point
|
2790
|
-
*/
|
2791
|
-
static distance(a2, b2) {
|
2792
|
-
return Math.hypot(a2.x - b2.x, a2.y - b2.y);
|
2793
|
-
}
|
2794
|
-
/**
|
2795
|
-
* Returns true if both points are equal.
|
2796
|
-
*
|
2797
|
-
* @param {Point} a - A point
|
2798
|
-
* @param {Point} b - Another point
|
2799
|
-
*/
|
2800
|
-
static equals(a2, b2) {
|
2801
|
-
return a2.x === b2.x && a2.y === b2.y;
|
2802
|
-
}
|
2803
|
-
static from({ x, y: y2 }) {
|
2804
|
-
return new _Point(x, y2);
|
2805
|
-
}
|
2806
|
-
};
|
2807
|
-
var SENSITIVITY = 10;
|
2808
|
-
var _direction_dec;
|
2809
|
-
var _delta_dec;
|
2810
|
-
var _current_dec;
|
2811
|
-
var _previous_dec;
|
2812
|
-
var _initial_dec;
|
2813
|
-
var _velocity_dec;
|
2814
|
-
var _timestamp;
|
2815
|
-
var _init;
|
2816
|
-
var _velocity;
|
2817
|
-
var _initial;
|
2818
|
-
var _previous;
|
2819
|
-
var _current;
|
2820
|
-
_velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
|
2821
|
-
var Position = class {
|
2822
|
-
constructor(initialValue) {
|
2823
|
-
__runInitializers(_init, 5, this);
|
2824
|
-
__privateAdd2(this, _timestamp, 0);
|
2825
|
-
__privateAdd2(this, _velocity, __runInitializers(_init, 8, this, {
|
2826
|
-
x: 0,
|
2827
|
-
y: 0
|
2828
|
-
})), __runInitializers(_init, 11, this);
|
2829
|
-
__privateAdd2(this, _initial, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
2830
|
-
__privateAdd2(this, _previous, __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
2831
|
-
__privateAdd2(this, _current, __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
2832
|
-
const point = Point.from(initialValue);
|
2833
|
-
this.initial = point;
|
2834
|
-
this.current = point;
|
2835
|
-
this.previous = point;
|
2836
|
-
}
|
2837
|
-
get delta() {
|
2838
|
-
return Point.delta(this.current, this.initial);
|
2839
|
-
}
|
2840
|
-
get direction() {
|
2841
|
-
const delta = {
|
2842
|
-
x: this.current.x - this.previous.x,
|
2843
|
-
y: this.current.y - this.previous.y
|
2844
|
-
};
|
2845
|
-
if (!delta.x && !delta.y) {
|
2846
|
-
return null;
|
2847
|
-
}
|
2848
|
-
if (Math.abs(delta.x) > Math.abs(delta.y)) {
|
2849
|
-
return delta.x > 0 ? "right" : "left";
|
2850
|
-
}
|
2851
|
-
return delta.y > 0 ? "down" : "up";
|
2852
|
-
}
|
2853
|
-
reset(coordinates) {
|
2854
|
-
const point = Point.from(coordinates);
|
2855
|
-
o(() => {
|
2856
|
-
__privateSet2(this, _timestamp, 0);
|
2857
|
-
this.velocity = { x: 0, y: 0 };
|
2858
|
-
this.current = point;
|
2859
|
-
this.previous = point;
|
2860
|
-
this.initial = point;
|
2861
|
-
});
|
2862
|
-
}
|
2863
|
-
update(coordinates) {
|
2864
|
-
const { current } = this;
|
2865
|
-
const point = Point.from(coordinates);
|
2866
|
-
if (Point.equals(current, point)) {
|
2867
|
-
return;
|
2868
|
-
}
|
2869
|
-
const delta = {
|
2870
|
-
x: point.x - current.x,
|
2871
|
-
y: point.y - current.y
|
2872
|
-
};
|
2873
|
-
const timestamp = Date.now();
|
2874
|
-
const timeDelta = timestamp - __privateGet2(this, _timestamp);
|
2875
|
-
const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
|
2876
|
-
if (Math.abs(delta.x) < SENSITIVITY || Math.abs(delta.y) < SENSITIVITY) {
|
2877
|
-
this.previous = current;
|
2878
|
-
}
|
2879
|
-
__privateSet2(this, _timestamp, timestamp);
|
2880
|
-
this.velocity = {
|
2881
|
-
x: velocity(delta.x),
|
2882
|
-
y: velocity(delta.y)
|
2883
|
-
};
|
2884
|
-
this.current = point;
|
2885
|
-
}
|
2886
|
-
};
|
2887
|
-
_init = __decoratorStart(null);
|
2888
|
-
_timestamp = /* @__PURE__ */ new WeakMap();
|
2889
|
-
_velocity = /* @__PURE__ */ new WeakMap();
|
2890
|
-
_initial = /* @__PURE__ */ new WeakMap();
|
2891
|
-
_previous = /* @__PURE__ */ new WeakMap();
|
2892
|
-
_current = /* @__PURE__ */ new WeakMap();
|
2893
|
-
__decorateElement(_init, 4, "velocity", _velocity_dec, Position, _velocity);
|
2894
|
-
__decorateElement(_init, 4, "initial", _initial_dec, Position, _initial);
|
2895
|
-
__decorateElement(_init, 4, "previous", _previous_dec, Position, _previous);
|
2896
|
-
__decorateElement(_init, 4, "current", _current_dec, Position, _current);
|
2897
|
-
__decorateElement(_init, 2, "delta", _delta_dec, Position);
|
2898
|
-
__decorateElement(_init, 2, "direction", _direction_dec, Position);
|
2899
|
-
__decoratorMetadata(_init, Position);
|
2900
|
-
function exceedsDistance({ x, y: y2 }, distance) {
|
2901
|
-
const dx = Math.abs(x);
|
2902
|
-
const dy = Math.abs(y2);
|
2903
|
-
if (typeof distance === "number") {
|
2904
|
-
return Math.sqrt(__pow(dx, 2) + __pow(dy, 2)) > distance;
|
2905
|
-
}
|
2906
|
-
if ("x" in distance && "y" in distance) {
|
2907
|
-
return dx > distance.x && dy > distance.y;
|
2908
|
-
}
|
2909
|
-
if ("x" in distance) {
|
2910
|
-
return dx > distance.x;
|
2911
|
-
}
|
2912
|
-
if ("y" in distance) {
|
2913
|
-
return dy > distance.y;
|
2914
|
-
}
|
2915
|
-
return false;
|
2916
|
-
}
|
2917
|
-
var Axis = /* @__PURE__ */ ((Axis2) => {
|
2918
|
-
Axis2["Horizontal"] = "x";
|
2919
|
-
Axis2["Vertical"] = "y";
|
2920
|
-
return Axis2;
|
2921
|
-
})(Axis || {});
|
2922
|
-
var Axes = Object.values(Axis);
|
2923
|
-
|
2924
|
-
// ../../node_modules/@dnd-kit/abstract/index.js
|
2925
|
-
var __create2 = Object.create;
|
2926
|
-
var __defProp2 = Object.defineProperty;
|
2927
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
2928
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
2929
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
2930
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
2931
|
-
var __knownSymbol2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
2932
|
-
var __typeError2 = (msg) => {
|
2933
|
-
throw TypeError(msg);
|
2934
|
-
};
|
2935
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2936
|
-
var __name2 = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
2937
|
-
var __objRest2 = (source, exclude) => {
|
2938
|
-
var target = {};
|
2939
|
-
for (var prop in source)
|
2940
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
2941
|
-
target[prop] = source[prop];
|
2942
|
-
if (source != null && __getOwnPropSymbols)
|
2943
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
2944
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
2945
|
-
target[prop] = source[prop];
|
2946
|
-
}
|
2947
|
-
return target;
|
2948
|
-
};
|
2949
|
-
var __decoratorStart2 = (base) => {
|
2950
|
-
var _a;
|
2951
|
-
return [, , , __create2((_a = base == null ? void 0 : base[__knownSymbol2("metadata")]) != null ? _a : null)];
|
2952
|
-
};
|
2953
|
-
var __decoratorStrings2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
2954
|
-
var __expectFn2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError2("Function expected") : fn;
|
2955
|
-
var __decoratorContext2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError2("Already initialized") : fns.push(__expectFn2(fn || null)) });
|
2956
|
-
var __decoratorMetadata2 = (array, target) => __defNormalProp2(target, __knownSymbol2("metadata"), array[3]);
|
2957
|
-
var __runInitializers2 = (array, flags, self, value) => {
|
2958
|
-
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
|
2959
|
-
return value;
|
2960
|
-
};
|
2961
|
-
var __decorateElement2 = (array, flags, name, decorators, target, extra) => {
|
2962
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
2963
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings2[k + 5];
|
2964
|
-
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
2965
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc2(k < 4 ? target : { get [name]() {
|
2966
|
-
return __privateGet3(this, extra);
|
2967
|
-
}, set [name](x) {
|
2968
|
-
return __privateSet3(this, extra, x);
|
2969
|
-
} }, name));
|
2970
|
-
k ? p2 && k < 4 && __name2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name2(target, name);
|
2971
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
2972
|
-
ctx = __decoratorContext2(k, name, done = {}, array[3], extraInitializers);
|
2973
|
-
if (k) {
|
2974
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn2(target, x) : (x) => name in x };
|
2975
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet3 : __privateMethod2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
2976
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet3(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
2977
|
-
}
|
2978
|
-
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
2979
|
-
if (k ^ 4 || it === void 0) __expectFn2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
2980
|
-
else if (typeof it !== "object" || it === null) __typeError2("Object expected");
|
2981
|
-
else __expectFn2(fn = it.get) && (desc.get = fn), __expectFn2(fn = it.set) && (desc.set = fn), __expectFn2(fn = it.init) && initializers.unshift(fn);
|
2982
|
-
}
|
2983
|
-
return k || __decoratorMetadata2(array, target), desc && __defProp2(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
2984
|
-
};
|
2985
|
-
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
2986
|
-
var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError2('Cannot use the "in" operator on this value') : member.has(obj);
|
2987
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2988
|
-
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2989
|
-
var __privateSet3 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
2990
|
-
var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
|
2991
|
-
function configure(plugin, options) {
|
2992
|
-
return {
|
2993
|
-
plugin,
|
2994
|
-
options
|
2995
|
-
};
|
2996
|
-
}
|
2997
|
-
function configurator(plugin) {
|
2998
|
-
return (options) => {
|
2999
|
-
return configure(plugin, options);
|
3000
|
-
};
|
3001
|
-
}
|
3002
|
-
var _disabled_dec;
|
3003
|
-
var _init2;
|
3004
|
-
var _disabled;
|
3005
|
-
_disabled_dec = [reactive];
|
3006
|
-
var Plugin = class {
|
3007
|
-
constructor(manager, options) {
|
3008
|
-
this.manager = manager;
|
3009
|
-
this.options = options;
|
3010
|
-
__privateAdd3(this, _disabled, __runInitializers2(_init2, 8, this, false)), __runInitializers2(_init2, 11, this);
|
3011
|
-
}
|
3012
|
-
/**
|
3013
|
-
* Enable a disabled plugin instance.
|
3014
|
-
* Triggers effects.
|
3015
|
-
*/
|
3016
|
-
enable() {
|
3017
|
-
this.disabled = false;
|
3018
|
-
}
|
3019
|
-
/**
|
3020
|
-
* Disable an enabled plugin instance.
|
3021
|
-
* Triggers effects.
|
3022
|
-
*/
|
3023
|
-
disable() {
|
3024
|
-
this.disabled = true;
|
3025
|
-
}
|
3026
|
-
/**
|
3027
|
-
* Whether the plugin instance is disabled.
|
3028
|
-
* Does not trigger effects when accessed.
|
3029
|
-
*/
|
3030
|
-
isDisabled() {
|
3031
|
-
return h(() => {
|
3032
|
-
return this.disabled;
|
3033
|
-
});
|
3034
|
-
}
|
3035
|
-
/**
|
3036
|
-
* Configure a plugin instance with new options.
|
3037
|
-
*/
|
3038
|
-
configure(options) {
|
3039
|
-
this.options = options;
|
3040
|
-
}
|
3041
|
-
/**
|
3042
|
-
* Destroy a plugin instance.
|
3043
|
-
*/
|
3044
|
-
destroy() {
|
3045
|
-
}
|
3046
|
-
/**
|
3047
|
-
* Configure a plugin constructor with options.
|
3048
|
-
* This method is used to configure the options that the
|
3049
|
-
* plugin constructor will use to create plugin instances.
|
3050
|
-
*/
|
3051
|
-
static configure(options) {
|
3052
|
-
return configure(this, options);
|
3053
|
-
}
|
3054
|
-
};
|
3055
|
-
_init2 = __decoratorStart2(null);
|
3056
|
-
_disabled = /* @__PURE__ */ new WeakMap();
|
3057
|
-
__decorateElement2(_init2, 4, "disabled", _disabled_dec, Plugin, _disabled);
|
3058
|
-
__decoratorMetadata2(_init2, Plugin);
|
3059
|
-
var _previousValues;
|
3060
|
-
_previousValues = /* @__PURE__ */ new WeakMap();
|
3061
|
-
var _previousCoordinates;
|
3062
|
-
var _collisions;
|
3063
|
-
_previousCoordinates = /* @__PURE__ */ new WeakMap();
|
3064
|
-
_collisions = /* @__PURE__ */ new WeakMap();
|
3065
|
-
var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
3066
|
-
CollisionPriority2[CollisionPriority2["Lowest"] = 0] = "Lowest";
|
3067
|
-
CollisionPriority2[CollisionPriority2["Low"] = 1] = "Low";
|
3068
|
-
CollisionPriority2[CollisionPriority2["Normal"] = 2] = "Normal";
|
3069
|
-
CollisionPriority2[CollisionPriority2["High"] = 3] = "High";
|
3070
|
-
CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
|
3071
|
-
return CollisionPriority2;
|
3072
|
-
})(CollisionPriority || {});
|
3073
|
-
var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
3074
|
-
CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
|
3075
|
-
CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
|
3076
|
-
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
3077
|
-
return CollisionType2;
|
3078
|
-
})(CollisionType || {});
|
3079
|
-
var _disabled_dec2;
|
3080
|
-
var _data_dec;
|
3081
|
-
var _id_dec;
|
3082
|
-
var _manager_dec;
|
3083
|
-
var _init22;
|
3084
|
-
var _manager;
|
3085
|
-
var _id;
|
3086
|
-
var _data;
|
3087
|
-
var _disabled2;
|
3088
|
-
_manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
|
3089
|
-
var Entity = class {
|
3090
|
-
/**
|
3091
|
-
* Creates a new instance of the `Entity` class.
|
3092
|
-
*
|
3093
|
-
* @param input - An object containing the initial properties of the entity.
|
3094
|
-
* @param manager - The manager that controls the drag and drop operations.
|
3095
|
-
*/
|
3096
|
-
constructor(input, manager) {
|
3097
|
-
__privateAdd3(this, _manager, __runInitializers2(_init22, 8, this)), __runInitializers2(_init22, 11, this);
|
3098
|
-
__privateAdd3(this, _id, __runInitializers2(_init22, 12, this)), __runInitializers2(_init22, 15, this);
|
3099
|
-
__privateAdd3(this, _data, __runInitializers2(_init22, 16, this)), __runInitializers2(_init22, 19, this);
|
3100
|
-
__privateAdd3(this, _disabled2, __runInitializers2(_init22, 20, this)), __runInitializers2(_init22, 23, this);
|
3101
|
-
this.effects = void 0;
|
3102
|
-
const { effects: effects5, id, data = {}, disabled = false } = input;
|
3103
|
-
let previousId = id;
|
3104
|
-
this.manager = manager;
|
3105
|
-
this.id = id;
|
3106
|
-
this.data = data;
|
3107
|
-
this.disabled = disabled;
|
3108
|
-
this.effects = () => {
|
3109
|
-
var _a;
|
3110
|
-
return [
|
3111
|
-
() => {
|
3112
|
-
const { id: id2, manager: manager2 } = this;
|
3113
|
-
if (id2 === previousId) {
|
3114
|
-
return;
|
3115
|
-
}
|
3116
|
-
manager2 == null ? void 0 : manager2.registry.register(this);
|
3117
|
-
return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
|
3118
|
-
},
|
3119
|
-
...(_a = effects5 == null ? void 0 : effects5()) != null ? _a : []
|
3120
|
-
];
|
3121
|
-
};
|
3122
|
-
this.destroy = this.destroy.bind(this);
|
3123
|
-
if (manager) {
|
3124
|
-
queueMicrotask(() => {
|
3125
|
-
var _a;
|
3126
|
-
(_a = this.manager) == null ? void 0 : _a.registry.register(this);
|
3127
|
-
});
|
3128
|
-
}
|
3129
|
-
}
|
3130
|
-
/**
|
3131
|
-
* A method that registers the entity with the manager.
|
3132
|
-
* @returns CleanupFunction | void
|
3133
|
-
*/
|
3134
|
-
register() {
|
3135
|
-
var _a;
|
3136
|
-
return (_a = this.manager) == null ? void 0 : _a.registry.register(this);
|
3137
|
-
}
|
3138
|
-
/**
|
3139
|
-
* A method that unregisters the entity from the manager.
|
3140
|
-
* @returns void
|
3141
|
-
*/
|
3142
|
-
unregister() {
|
3143
|
-
var _a;
|
3144
|
-
(_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
|
3145
|
-
}
|
3146
|
-
/**
|
3147
|
-
* A method that cleans up the entity when it is no longer needed.
|
3148
|
-
* @returns void
|
3149
|
-
*/
|
3150
|
-
destroy() {
|
3151
|
-
var _a;
|
3152
|
-
(_a = this.manager) == null ? void 0 : _a.registry.unregister(this);
|
3153
|
-
}
|
3154
|
-
};
|
3155
|
-
_init22 = __decoratorStart2(null);
|
3156
|
-
_manager = /* @__PURE__ */ new WeakMap();
|
3157
|
-
_id = /* @__PURE__ */ new WeakMap();
|
3158
|
-
_data = /* @__PURE__ */ new WeakMap();
|
3159
|
-
_disabled2 = /* @__PURE__ */ new WeakMap();
|
3160
|
-
__decorateElement2(_init22, 4, "manager", _manager_dec, Entity, _manager);
|
3161
|
-
__decorateElement2(_init22, 4, "id", _id_dec, Entity, _id);
|
3162
|
-
__decorateElement2(_init22, 4, "data", _data_dec, Entity, _data);
|
3163
|
-
__decorateElement2(_init22, 4, "disabled", _disabled_dec2, Entity, _disabled2);
|
3164
|
-
__decoratorMetadata2(_init22, Entity);
|
3165
|
-
var _isDragSource_dec;
|
3166
|
-
var _status_dec;
|
3167
|
-
var _type_dec;
|
3168
|
-
var _modifiers_dec;
|
3169
|
-
var _c;
|
3170
|
-
var _init3;
|
3171
|
-
var _modifiers;
|
3172
|
-
var _type;
|
3173
|
-
var _status;
|
3174
|
-
var Draggable2 = class extends (_c = Entity, _modifiers_dec = [reactive], _type_dec = [reactive], _status_dec = [reactive], _isDragSource_dec = [derived], _c) {
|
3175
|
-
constructor(_a, manager) {
|
3176
|
-
var _b = _a, { modifiers, type, sensors } = _b, input = __objRest2(_b, ["modifiers", "type", "sensors"]);
|
3177
|
-
super(input, manager);
|
3178
|
-
__runInitializers2(_init3, 5, this);
|
3179
|
-
this.sensors = void 0;
|
3180
|
-
__privateAdd3(this, _modifiers, __runInitializers2(_init3, 8, this)), __runInitializers2(_init3, 11, this);
|
3181
|
-
__privateAdd3(this, _type, __runInitializers2(_init3, 12, this)), __runInitializers2(_init3, 15, this);
|
3182
|
-
__privateAdd3(this, _status, __runInitializers2(_init3, 16, this, "idle")), __runInitializers2(_init3, 19, this);
|
3183
|
-
this.type = type;
|
3184
|
-
this.sensors = sensors;
|
3185
|
-
this.modifiers = modifiers;
|
3186
|
-
}
|
3187
|
-
get isDragSource() {
|
3188
|
-
var _a, _b;
|
3189
|
-
return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.source) == null ? void 0 : _b.id) === this.id;
|
3190
|
-
}
|
3191
|
-
};
|
3192
|
-
_init3 = __decoratorStart2(_c);
|
3193
|
-
_modifiers = /* @__PURE__ */ new WeakMap();
|
3194
|
-
_type = /* @__PURE__ */ new WeakMap();
|
3195
|
-
_status = /* @__PURE__ */ new WeakMap();
|
3196
|
-
__decorateElement2(_init3, 4, "modifiers", _modifiers_dec, Draggable2, _modifiers);
|
3197
|
-
__decorateElement2(_init3, 4, "type", _type_dec, Draggable2, _type);
|
3198
|
-
__decorateElement2(_init3, 4, "status", _status_dec, Draggable2, _status);
|
3199
|
-
__decorateElement2(_init3, 2, "isDragSource", _isDragSource_dec, Draggable2);
|
3200
|
-
__decoratorMetadata2(_init3, Draggable2);
|
3201
|
-
var _isDropTarget_dec;
|
3202
|
-
var _shape_dec;
|
3203
|
-
var _collisionPriority_dec;
|
3204
|
-
var _collisionDetector_dec;
|
3205
|
-
var _type_dec2;
|
3206
|
-
var _accept_dec;
|
3207
|
-
var _c2;
|
3208
|
-
var _init4;
|
3209
|
-
var _accept;
|
3210
|
-
var _type2;
|
3211
|
-
var _collisionDetector;
|
3212
|
-
var _collisionPriority;
|
3213
|
-
var _shape;
|
3214
|
-
var Droppable2 = class extends (_c2 = Entity, _accept_dec = [reactive], _type_dec2 = [reactive], _collisionDetector_dec = [reactive], _collisionPriority_dec = [reactive], _shape_dec = [reactive], _isDropTarget_dec = [derived], _c2) {
|
3215
|
-
constructor(_a, manager) {
|
3216
|
-
var _b = _a, { accept, collisionDetector, collisionPriority, type } = _b, input = __objRest2(_b, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
3217
|
-
super(input, manager);
|
3218
|
-
__runInitializers2(_init4, 5, this);
|
3219
|
-
__privateAdd3(this, _accept, __runInitializers2(_init4, 8, this)), __runInitializers2(_init4, 11, this);
|
3220
|
-
__privateAdd3(this, _type2, __runInitializers2(_init4, 12, this)), __runInitializers2(_init4, 15, this);
|
3221
|
-
__privateAdd3(this, _collisionDetector, __runInitializers2(_init4, 16, this)), __runInitializers2(_init4, 19, this);
|
3222
|
-
__privateAdd3(this, _collisionPriority, __runInitializers2(_init4, 20, this)), __runInitializers2(_init4, 23, this);
|
3223
|
-
__privateAdd3(this, _shape, __runInitializers2(_init4, 24, this)), __runInitializers2(_init4, 27, this);
|
3224
|
-
this.accept = accept;
|
3225
|
-
this.collisionDetector = collisionDetector;
|
3226
|
-
this.collisionPriority = collisionPriority;
|
3227
|
-
this.type = type;
|
3228
|
-
}
|
3229
|
-
/**
|
3230
|
-
* Checks whether or not the droppable accepts a given draggable.
|
3231
|
-
*
|
3232
|
-
* @param {Draggable} draggable
|
3233
|
-
* @returns {boolean}
|
3234
|
-
*/
|
3235
|
-
accepts(draggable) {
|
3236
|
-
const { accept } = this;
|
3237
|
-
if (!accept) {
|
3238
|
-
return true;
|
3239
|
-
}
|
3240
|
-
if (typeof accept === "function") {
|
3241
|
-
return accept(draggable);
|
3242
|
-
}
|
3243
|
-
if (!draggable.type) {
|
3244
|
-
return false;
|
3245
|
-
}
|
3246
|
-
if (Array.isArray(accept)) {
|
3247
|
-
return accept.includes(draggable.type);
|
3248
|
-
}
|
3249
|
-
return draggable.type === accept;
|
3250
|
-
}
|
3251
|
-
get isDropTarget() {
|
3252
|
-
var _a, _b;
|
3253
|
-
return ((_b = (_a = this.manager) == null ? void 0 : _a.dragOperation.target) == null ? void 0 : _b.id) === this.id;
|
3254
|
-
}
|
3255
|
-
};
|
3256
|
-
_init4 = __decoratorStart2(_c2);
|
3257
|
-
_accept = /* @__PURE__ */ new WeakMap();
|
3258
|
-
_type2 = /* @__PURE__ */ new WeakMap();
|
3259
|
-
_collisionDetector = /* @__PURE__ */ new WeakMap();
|
3260
|
-
_collisionPriority = /* @__PURE__ */ new WeakMap();
|
3261
|
-
_shape = /* @__PURE__ */ new WeakMap();
|
3262
|
-
__decorateElement2(_init4, 4, "accept", _accept_dec, Droppable2, _accept);
|
3263
|
-
__decorateElement2(_init4, 4, "type", _type_dec2, Droppable2, _type2);
|
3264
|
-
__decorateElement2(_init4, 4, "collisionDetector", _collisionDetector_dec, Droppable2, _collisionDetector);
|
3265
|
-
__decorateElement2(_init4, 4, "collisionPriority", _collisionPriority_dec, Droppable2, _collisionPriority);
|
3266
|
-
__decorateElement2(_init4, 4, "shape", _shape_dec, Droppable2, _shape);
|
3267
|
-
__decorateElement2(_init4, 2, "isDropTarget", _isDropTarget_dec, Droppable2);
|
3268
|
-
__decoratorMetadata2(_init4, Droppable2);
|
3269
|
-
var Sensor = class extends Plugin {
|
3270
|
-
constructor(manager, options) {
|
3271
|
-
super(manager, options);
|
3272
|
-
this.manager = manager;
|
3273
|
-
this.options = options;
|
3274
|
-
}
|
3275
|
-
};
|
2310
|
+
import {
|
2311
|
+
CollisionPriority as CollisionPriority7,
|
2312
|
+
CollisionType as CollisionType7
|
2313
|
+
} from "@dnd-kit/abstract";
|
3276
2314
|
|
3277
2315
|
// components/DraggableComponent/collision/directional/index.ts
|
3278
2316
|
init_react_import();
|
2317
|
+
import { CollisionType } from "@dnd-kit/abstract";
|
3279
2318
|
|
3280
2319
|
// components/DraggableComponent/collision/collision-debug.ts
|
3281
2320
|
init_react_import();
|
3282
2321
|
var DEBUG = false;
|
3283
2322
|
var debugElements = {};
|
3284
2323
|
var timeout;
|
3285
|
-
var collisionDebug = (
|
2324
|
+
var collisionDebug = (a, b, id, color, label) => {
|
3286
2325
|
if (!DEBUG) return;
|
3287
2326
|
const debugId = `${id}-debug`;
|
3288
2327
|
clearTimeout(timeout);
|
@@ -3313,13 +2352,13 @@ var collisionDebug = (a2, b2, id, color, label) => {
|
|
3313
2352
|
document.body.appendChild(svg);
|
3314
2353
|
debugElements[debugId] = { svg, line, text };
|
3315
2354
|
}
|
3316
|
-
line.setAttribute("x1",
|
3317
|
-
line.setAttribute("x2",
|
3318
|
-
line.setAttribute("y1",
|
3319
|
-
line.setAttribute("y2",
|
2355
|
+
line.setAttribute("x1", a.x.toString());
|
2356
|
+
line.setAttribute("x2", b.x.toString());
|
2357
|
+
line.setAttribute("y1", a.y.toString());
|
2358
|
+
line.setAttribute("y2", b.y.toString());
|
3320
2359
|
line.setAttribute("style", `stroke:${color};stroke-width:2`);
|
3321
|
-
text.setAttribute("x", (
|
3322
|
-
text.setAttribute("y", (
|
2360
|
+
text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
|
2361
|
+
text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
|
3323
2362
|
if (label) {
|
3324
2363
|
text.innerHTML = label;
|
3325
2364
|
}
|
@@ -3395,6 +2434,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
|
|
3395
2434
|
|
3396
2435
|
// components/DraggableComponent/collision/dynamic/track-movement-interval.ts
|
3397
2436
|
init_react_import();
|
2437
|
+
import { Point } from "@dnd-kit/geometry";
|
3398
2438
|
var INTERVAL_SENSITIVITY = 10;
|
3399
2439
|
var intervalCache = {
|
3400
2440
|
current: { x: 0, y: 0 },
|
@@ -3417,6 +2457,18 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
|
|
3417
2457
|
|
3418
2458
|
// ../../node_modules/@dnd-kit/collision/dist/index.js
|
3419
2459
|
init_react_import();
|
2460
|
+
import { CollisionPriority, CollisionType as CollisionType2 } from "@dnd-kit/abstract";
|
2461
|
+
import { Point as Point2 } from "@dnd-kit/geometry";
|
2462
|
+
import { CollisionPriority as CollisionPriority2, CollisionType as CollisionType22 } from "@dnd-kit/abstract";
|
2463
|
+
import { Point as Point22 } from "@dnd-kit/geometry";
|
2464
|
+
import { CollisionPriority as CollisionPriority3, CollisionType as CollisionType3 } from "@dnd-kit/abstract";
|
2465
|
+
import { Point as Point3 } from "@dnd-kit/geometry";
|
2466
|
+
import { CollisionPriority as CollisionPriority4, CollisionType as CollisionType4 } from "@dnd-kit/abstract";
|
2467
|
+
import { Point as Point4 } from "@dnd-kit/geometry";
|
2468
|
+
import { CollisionPriority as CollisionPriority5, CollisionType as CollisionType5 } from "@dnd-kit/abstract";
|
2469
|
+
import { Point as Point5 } from "@dnd-kit/geometry";
|
2470
|
+
import { CollisionPriority as CollisionPriority6, CollisionType as CollisionType6 } from "@dnd-kit/abstract";
|
2471
|
+
import { Point as Point6 } from "@dnd-kit/geometry";
|
3420
2472
|
var pointerIntersection = ({
|
3421
2473
|
dragOperation,
|
3422
2474
|
droppable
|
@@ -3430,11 +2482,11 @@ var pointerIntersection = ({
|
|
3430
2482
|
return null;
|
3431
2483
|
}
|
3432
2484
|
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
3433
|
-
const distance =
|
2485
|
+
const distance = Point2.distance(droppable.shape.center, pointerCoordinates);
|
3434
2486
|
return {
|
3435
2487
|
id,
|
3436
2488
|
value: 1 / distance,
|
3437
|
-
type:
|
2489
|
+
type: CollisionType2.PointerIntersection,
|
3438
2490
|
priority: CollisionPriority.High
|
3439
2491
|
};
|
3440
2492
|
}
|
@@ -3468,8 +2520,8 @@ var closestCorners = (input) => {
|
|
3468
2520
|
const distance = corners.reduce(
|
3469
2521
|
(acc, corner) => {
|
3470
2522
|
var _a;
|
3471
|
-
return acc +
|
3472
|
-
|
2523
|
+
return acc + Point3.distance(
|
2524
|
+
Point3.from(corner),
|
3473
2525
|
(_a = shape == null ? void 0 : shape.current.center) != null ? _a : position.current
|
3474
2526
|
);
|
3475
2527
|
},
|
@@ -3479,15 +2531,15 @@ var closestCorners = (input) => {
|
|
3479
2531
|
return {
|
3480
2532
|
id: droppable.id,
|
3481
2533
|
value: 1 / value,
|
3482
|
-
type:
|
3483
|
-
priority:
|
2534
|
+
type: CollisionType3.Collision,
|
2535
|
+
priority: CollisionPriority3.Normal
|
3484
2536
|
};
|
3485
2537
|
};
|
3486
2538
|
|
3487
2539
|
// components/DraggableComponent/collision/dynamic/index.ts
|
3488
2540
|
var flushNext = "";
|
3489
2541
|
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
3490
|
-
var _a, _b,
|
2542
|
+
var _a, _b, _c, _d, _e;
|
3491
2543
|
const { dragOperation, droppable } = input;
|
3492
2544
|
const { position } = dragOperation;
|
3493
2545
|
const dragShape = (_a = dragOperation.shape) == null ? void 0 : _a.current;
|
@@ -3517,7 +2569,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3517
2569
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
|
3518
2570
|
if (collision) {
|
3519
2571
|
return __spreadProps(__spreadValues({}, collision), {
|
3520
|
-
priority:
|
2572
|
+
priority: CollisionPriority7.Highest
|
3521
2573
|
});
|
3522
2574
|
}
|
3523
2575
|
}
|
@@ -3534,14 +2586,14 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3534
2586
|
const collision = {
|
3535
2587
|
id: droppable.id,
|
3536
2588
|
value: intersectionRatio,
|
3537
|
-
priority:
|
3538
|
-
type:
|
2589
|
+
priority: CollisionPriority7.High,
|
2590
|
+
type: CollisionType7.Collision
|
3539
2591
|
};
|
3540
2592
|
const shouldFlushId = flushNext === droppable.id;
|
3541
2593
|
flushNext = "";
|
3542
2594
|
return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
|
3543
2595
|
}
|
3544
|
-
if (((
|
2596
|
+
if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
3545
2597
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
3546
2598
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
3547
2599
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
@@ -3564,7 +2616,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3564
2616
|
);
|
3565
2617
|
flushNext = droppable.id;
|
3566
2618
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
3567
|
-
priority:
|
2619
|
+
priority: CollisionPriority7.Low
|
3568
2620
|
});
|
3569
2621
|
}
|
3570
2622
|
collisionDebug(
|
@@ -3574,7 +2626,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
3574
2626
|
"orange",
|
3575
2627
|
direction || ""
|
3576
2628
|
);
|
3577
|
-
return __spreadProps(__spreadValues({}, fallbackCollision), { priority:
|
2629
|
+
return __spreadProps(__spreadValues({}, fallbackCollision), { priority: CollisionPriority7.Lowest });
|
3578
2630
|
}
|
3579
2631
|
}
|
3580
2632
|
}
|
@@ -3612,6 +2664,25 @@ function useSortableSafe(input) {
|
|
3612
2664
|
return useSortable(input);
|
3613
2665
|
}
|
3614
2666
|
|
2667
|
+
// lib/get-deep-scroll-position.ts
|
2668
|
+
init_react_import();
|
2669
|
+
function getDeepScrollPosition(element) {
|
2670
|
+
let totalScroll = {
|
2671
|
+
x: 0,
|
2672
|
+
y: 0
|
2673
|
+
};
|
2674
|
+
let current = element;
|
2675
|
+
while (current && current !== document.documentElement) {
|
2676
|
+
const parent = current.parentElement;
|
2677
|
+
if (parent) {
|
2678
|
+
totalScroll.x += parent.scrollLeft;
|
2679
|
+
totalScroll.y += parent.scrollTop;
|
2680
|
+
}
|
2681
|
+
current = parent;
|
2682
|
+
}
|
2683
|
+
return totalScroll;
|
2684
|
+
}
|
2685
|
+
|
3615
2686
|
// components/DraggableComponent/index.tsx
|
3616
2687
|
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
3617
2688
|
var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
@@ -3715,22 +2786,22 @@ var DraggableComponent = ({
|
|
3715
2786
|
);
|
3716
2787
|
const [portalEl, setPortalEl] = useState12();
|
3717
2788
|
useEffect11(() => {
|
3718
|
-
var _a, _b;
|
2789
|
+
var _a, _b, _c;
|
3719
2790
|
setPortalEl(
|
3720
|
-
|
2791
|
+
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
|
3721
2792
|
);
|
3722
|
-
}, [iframe.enabled]);
|
2793
|
+
}, [iframe.enabled, ref.current]);
|
3723
2794
|
const getStyle = useCallback6(() => {
|
3724
|
-
var _a, _b;
|
2795
|
+
var _a, _b, _c;
|
3725
2796
|
if (!ref.current) return;
|
3726
2797
|
const rect = ref.current.getBoundingClientRect();
|
3727
|
-
const
|
3728
|
-
const
|
3729
|
-
const portalContainerEl = iframe.enabled ? null : document.getElementById("puck-preview");
|
2798
|
+
const deepScrollPosition = getDeepScrollPosition(ref.current);
|
2799
|
+
const portalContainerEl = iframe.enabled ? null : (_a = ref.current) == null ? void 0 : _a.closest("[data-puck-preview]");
|
3730
2800
|
const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
|
2801
|
+
const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
|
3731
2802
|
const scroll = {
|
3732
|
-
x:
|
3733
|
-
y:
|
2803
|
+
x: deepScrollPosition.x - portalScroll.x - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _b : 0),
|
2804
|
+
y: deepScrollPosition.y - portalScroll.y - ((_c = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _c : 0)
|
3734
2805
|
};
|
3735
2806
|
const style2 = {
|
3736
2807
|
left: `${rect.left + scroll.x}px`,
|
@@ -3739,11 +2810,20 @@ var DraggableComponent = ({
|
|
3739
2810
|
width: `${rect.width}px`
|
3740
2811
|
};
|
3741
2812
|
return style2;
|
3742
|
-
}, [ref
|
2813
|
+
}, [ref.current]);
|
3743
2814
|
const [style, setStyle] = useState12();
|
3744
2815
|
const sync = useCallback6(() => {
|
3745
2816
|
setStyle(getStyle());
|
3746
|
-
}, [ref, iframe]);
|
2817
|
+
}, [ref.current, iframe]);
|
2818
|
+
useEffect11(() => {
|
2819
|
+
if (ref.current) {
|
2820
|
+
const observer = new ResizeObserver(sync);
|
2821
|
+
observer.observe(ref.current);
|
2822
|
+
return () => {
|
2823
|
+
observer.disconnect();
|
2824
|
+
};
|
2825
|
+
}
|
2826
|
+
}, [ref.current]);
|
3747
2827
|
useEffect11(() => {
|
3748
2828
|
ctx == null ? void 0 : ctx.registerPath({
|
3749
2829
|
index,
|
@@ -3758,8 +2838,8 @@ var DraggableComponent = ({
|
|
3758
2838
|
item: selectedItem
|
3759
2839
|
});
|
3760
2840
|
const onClick = useCallback6(
|
3761
|
-
(
|
3762
|
-
|
2841
|
+
(e) => {
|
2842
|
+
e.stopPropagation();
|
3763
2843
|
dispatch({
|
3764
2844
|
type: "setUi",
|
3765
2845
|
ui: {
|
@@ -3770,8 +2850,8 @@ var DraggableComponent = ({
|
|
3770
2850
|
[index, zoneCompound, id]
|
3771
2851
|
);
|
3772
2852
|
const onDuplicate = useCallback6(
|
3773
|
-
(
|
3774
|
-
|
2853
|
+
(e) => {
|
2854
|
+
e.stopPropagation();
|
3775
2855
|
dispatch({
|
3776
2856
|
type: "duplicate",
|
3777
2857
|
sourceIndex: index,
|
@@ -3781,8 +2861,8 @@ var DraggableComponent = ({
|
|
3781
2861
|
[index, zoneCompound]
|
3782
2862
|
);
|
3783
2863
|
const onDelete = useCallback6(
|
3784
|
-
(
|
3785
|
-
|
2864
|
+
(e) => {
|
2865
|
+
e.stopPropagation();
|
3786
2866
|
dispatch({
|
3787
2867
|
type: "remove",
|
3788
2868
|
index,
|
@@ -3798,7 +2878,7 @@ var DraggableComponent = ({
|
|
3798
2878
|
return;
|
3799
2879
|
}
|
3800
2880
|
const el = ref.current;
|
3801
|
-
const _onMouseOver = (
|
2881
|
+
const _onMouseOver = (e) => {
|
3802
2882
|
if (userIsDragging) {
|
3803
2883
|
if (thisIsDragging) {
|
3804
2884
|
setHover(true);
|
@@ -3808,10 +2888,10 @@ var DraggableComponent = ({
|
|
3808
2888
|
} else {
|
3809
2889
|
setHover(true);
|
3810
2890
|
}
|
3811
|
-
|
2891
|
+
e.stopPropagation();
|
3812
2892
|
};
|
3813
|
-
const _onMouseOut = (
|
3814
|
-
|
2893
|
+
const _onMouseOut = (e) => {
|
2894
|
+
e.stopPropagation();
|
3815
2895
|
setHover(false);
|
3816
2896
|
};
|
3817
2897
|
el.setAttribute("data-puck-component", id);
|
@@ -4220,8 +3300,8 @@ function DropZoneEdit({
|
|
4220
3300
|
/* @__PURE__ */ jsx23("p", { children: deepestZone || rootDroppableId }),
|
4221
3301
|
/* @__PURE__ */ jsx23("p", { children: deepestArea || "No area" })
|
4222
3302
|
] }),
|
4223
|
-
contentWithPreview.map((item,
|
4224
|
-
var _a, _b,
|
3303
|
+
contentWithPreview.map((item, i) => {
|
3304
|
+
var _a, _b, _c, _d, _e;
|
4225
3305
|
const componentId = item.props.id;
|
4226
3306
|
const puckProps = {
|
4227
3307
|
renderDropZone: DropZone,
|
@@ -4247,7 +3327,7 @@ function DropZoneEdit({
|
|
4247
3327
|
};
|
4248
3328
|
var Preview2 = Preview3;
|
4249
3329
|
componentType = preview.componentType;
|
4250
|
-
label = (_d = (
|
3330
|
+
label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
|
4251
3331
|
Render2 = Preview3;
|
4252
3332
|
}
|
4253
3333
|
return /* @__PURE__ */ jsx23(
|
@@ -4261,7 +3341,7 @@ function DropZoneEdit({
|
|
4261
3341
|
componentType,
|
4262
3342
|
zoneCompound,
|
4263
3343
|
depth: depth + 1,
|
4264
|
-
index:
|
3344
|
+
index: i,
|
4265
3345
|
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
4266
3346
|
isSelected,
|
4267
3347
|
label,
|
@@ -4347,6 +3427,8 @@ var getZoneId = (zoneCompound) => {
|
|
4347
3427
|
|
4348
3428
|
// components/DragDropContext/NestedDroppablePlugin.ts
|
4349
3429
|
init_react_import();
|
3430
|
+
import { Plugin } from "@dnd-kit/abstract";
|
3431
|
+
import { effects } from "@dnd-kit/state";
|
4350
3432
|
|
4351
3433
|
// lib/throttle.ts
|
4352
3434
|
init_react_import();
|
@@ -4381,9 +3463,9 @@ function isPositionInsideRect(position, rect) {
|
|
4381
3463
|
var BUFFER_ZONE = 8;
|
4382
3464
|
var REFRESH_ON_MOVE = true;
|
4383
3465
|
var depthSort = (candidates) => {
|
4384
|
-
return candidates.sort((
|
4385
|
-
const aData =
|
4386
|
-
const bData =
|
3466
|
+
return candidates.sort((a, b) => {
|
3467
|
+
const aData = a.data;
|
3468
|
+
const bData = b.data;
|
4387
3469
|
if (aData.depth > bData.depth) {
|
4388
3470
|
return 1;
|
4389
3471
|
}
|
@@ -4419,8 +3501,8 @@ var getAreaId = (candidate) => {
|
|
4419
3501
|
};
|
4420
3502
|
var getDeepestId = (candidates, idFn) => {
|
4421
3503
|
let id = null;
|
4422
|
-
for (let
|
4423
|
-
const candidate = candidates[
|
3504
|
+
for (let i = 0; i < candidates.length; i++) {
|
3505
|
+
const candidate = candidates[i];
|
4424
3506
|
id = idFn(candidate);
|
4425
3507
|
if (id) break;
|
4426
3508
|
}
|
@@ -4484,6 +3566,11 @@ var findDeepestCandidate = (position, manager) => {
|
|
4484
3566
|
if (candidateData2.areaId === draggedCandidateId) {
|
4485
3567
|
return false;
|
4486
3568
|
}
|
3569
|
+
} else if (candidate.type === "component") {
|
3570
|
+
const candidateData2 = candidate.data;
|
3571
|
+
if (!candidateData2.inDroppableZone) {
|
3572
|
+
return false;
|
3573
|
+
}
|
4487
3574
|
}
|
4488
3575
|
return true;
|
4489
3576
|
});
|
@@ -4614,7 +3701,7 @@ function duplicateRelatedZones(item, data, newId) {
|
|
4614
3701
|
(dupeOfDupes2, item2, index) => __spreadValues(__spreadValues({}, dupeOfDupes2), duplicateRelatedZones(zone[index], data, item2.props.id).zones),
|
4615
3702
|
acc
|
4616
3703
|
);
|
4617
|
-
const [
|
3704
|
+
const [_, zoneId] = getZoneId(key);
|
4618
3705
|
return __spreadProps(__spreadValues({}, dupeOfDupes), {
|
4619
3706
|
[key]: zone,
|
4620
3707
|
[`${newId}:${zoneId}`]: dupedZone
|
@@ -4934,6 +4021,11 @@ import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
|
|
4934
4021
|
|
4935
4022
|
// components/DragDropContext/PointerSensor.ts
|
4936
4023
|
init_react_import();
|
4024
|
+
import { batch, effect } from "@dnd-kit/state";
|
4025
|
+
import { Sensor, configurator } from "@dnd-kit/abstract";
|
4026
|
+
import {
|
4027
|
+
exceedsDistance
|
4028
|
+
} from "@dnd-kit/geometry";
|
4937
4029
|
import {
|
4938
4030
|
getDocument,
|
4939
4031
|
isElement,
|
@@ -4955,7 +4047,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
4955
4047
|
this.handleCancel = this.handleCancel.bind(this);
|
4956
4048
|
this.handlePointerUp = this.handlePointerUp.bind(this);
|
4957
4049
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
4958
|
-
|
4050
|
+
effect(() => {
|
4959
4051
|
const unbindGlobal = this.bindGlobal(options != null ? options : {});
|
4960
4052
|
return () => {
|
4961
4053
|
unbindGlobal();
|
@@ -4963,7 +4055,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
4963
4055
|
});
|
4964
4056
|
}
|
4965
4057
|
bind(source, options = this.options) {
|
4966
|
-
const unbind =
|
4058
|
+
const unbind = effect(() => {
|
4967
4059
|
var _a;
|
4968
4060
|
const target = (_a = source.handle) != null ? _a : source.element;
|
4969
4061
|
const listener = (event) => {
|
@@ -5126,7 +4218,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
5126
4218
|
return;
|
5127
4219
|
}
|
5128
4220
|
event.preventDefault();
|
5129
|
-
|
4221
|
+
batch(() => {
|
5130
4222
|
manager.actions.setDragSource(source.id);
|
5131
4223
|
manager.actions.start({ coordinates: initialCoordinates, event });
|
5132
4224
|
});
|
@@ -5245,7 +4337,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5245
4337
|
...defaultPreset.plugins,
|
5246
4338
|
createNestedDroppablePlugin({
|
5247
4339
|
onChange: (params, manager) => {
|
5248
|
-
var _a, _b,
|
4340
|
+
var _a, _b, _c;
|
5249
4341
|
const paramsChanged = !deepestRef.current || params.area !== ((_a = deepestRef.current) == null ? void 0 : _a.area) || params.zone !== ((_b = deepestRef.current) == null ? void 0 : _b.zone);
|
5250
4342
|
if (paramsChanged) {
|
5251
4343
|
if (manager.dragOperation.status.dragging) {
|
@@ -5255,7 +4347,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5255
4347
|
}
|
5256
4348
|
setNextDeepest(params);
|
5257
4349
|
}
|
5258
|
-
if (params.area !== ((
|
4350
|
+
if (params.area !== ((_c = deepestRef.current) == null ? void 0 : _c.area)) {
|
5259
4351
|
setTimeout(() => {
|
5260
4352
|
manager.collisionObserver.forceUpdate(true);
|
5261
4353
|
}, 50);
|
@@ -5330,24 +4422,25 @@ var DragDropContextClient = ({ children }) => {
|
|
5330
4422
|
return;
|
5331
4423
|
}
|
5332
4424
|
const { zone, index } = source.data;
|
4425
|
+
const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
|
4426
|
+
previewRef.current = null;
|
5333
4427
|
setTimeout(() => {
|
5334
4428
|
var _a, _b;
|
5335
4429
|
setDraggedItem(null);
|
5336
4430
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
5337
4431
|
setPreview(null);
|
5338
|
-
previewRef.current = null;
|
5339
4432
|
(_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
|
5340
4433
|
fn(event, manager);
|
5341
4434
|
});
|
5342
4435
|
return;
|
5343
4436
|
}
|
5344
|
-
if (
|
4437
|
+
if (thisPreview) {
|
5345
4438
|
setPreview(null);
|
5346
|
-
if (
|
4439
|
+
if (thisPreview.type === "insert") {
|
5347
4440
|
insertComponent(
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
4441
|
+
thisPreview.componentType,
|
4442
|
+
thisPreview.zone,
|
4443
|
+
thisPreview.index,
|
5351
4444
|
{ config, dispatch, resolveData, state }
|
5352
4445
|
);
|
5353
4446
|
} else if (initialSelector.current) {
|
@@ -5355,12 +4448,11 @@ var DragDropContextClient = ({ children }) => {
|
|
5355
4448
|
type: "move",
|
5356
4449
|
sourceIndex: initialSelector.current.index,
|
5357
4450
|
sourceZone: initialSelector.current.zone,
|
5358
|
-
destinationIndex:
|
5359
|
-
destinationZone:
|
4451
|
+
destinationIndex: thisPreview.index,
|
4452
|
+
destinationZone: thisPreview.zone,
|
5360
4453
|
recordHistory: false
|
5361
4454
|
});
|
5362
4455
|
}
|
5363
|
-
previewRef.current = null;
|
5364
4456
|
}
|
5365
4457
|
dispatch({
|
5366
4458
|
type: "setUi",
|
@@ -5376,7 +4468,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5376
4468
|
}, 300);
|
5377
4469
|
},
|
5378
4470
|
onDragOver: (event, manager) => {
|
5379
|
-
var _a, _b,
|
4471
|
+
var _a, _b, _c, _d;
|
5380
4472
|
event.preventDefault();
|
5381
4473
|
if (!draggedItem) return;
|
5382
4474
|
const { source, target } = event.operation;
|
@@ -5404,7 +4496,7 @@ var DragDropContextClient = ({ children }) => {
|
|
5404
4496
|
targetZone = target.id.toString();
|
5405
4497
|
targetIndex = 0;
|
5406
4498
|
}
|
5407
|
-
if (targetId === sourceId || ((
|
4499
|
+
if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
|
5408
4500
|
const [pathId] = path.split(":");
|
5409
4501
|
return pathId === sourceId;
|
5410
4502
|
}))) {
|
@@ -5522,7 +4614,7 @@ var DrawerItemInner = ({
|
|
5522
4614
|
{
|
5523
4615
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
5524
4616
|
ref: dragRef,
|
5525
|
-
onMouseDown: (
|
4617
|
+
onMouseDown: (e) => e.preventDefault(),
|
5526
4618
|
children: /* @__PURE__ */ jsx25(CustomInner, { name, children: /* @__PURE__ */ jsx25("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs12("div", { className: getClassNameItem2("draggable"), children: [
|
5527
4619
|
/* @__PURE__ */ jsx25("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
5528
4620
|
/* @__PURE__ */ jsx25("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx25(DragIcon, {}) })
|
@@ -5716,7 +4808,7 @@ var SidebarSection = ({
|
|
5716
4808
|
style: { background },
|
5717
4809
|
children: [
|
5718
4810
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumbs"), children: [
|
5719
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb,
|
4811
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumb"), children: [
|
5720
4812
|
/* @__PURE__ */ jsx26(
|
5721
4813
|
"button",
|
5722
4814
|
{
|
@@ -5727,7 +4819,7 @@ var SidebarSection = ({
|
|
5727
4819
|
}
|
5728
4820
|
),
|
5729
4821
|
/* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
|
5730
|
-
] },
|
4822
|
+
] }, i)) : null,
|
5731
4823
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
|
5732
4824
|
] }) }),
|
5733
4825
|
/* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
|
@@ -5937,8 +5029,8 @@ var Fields = () => {
|
|
5937
5029
|
"form",
|
5938
5030
|
{
|
5939
5031
|
className: getClassName21(),
|
5940
|
-
onSubmit: (
|
5941
|
-
|
5032
|
+
onSubmit: (e) => {
|
5033
|
+
e.preventDefault();
|
5942
5034
|
},
|
5943
5035
|
children: [
|
5944
5036
|
/* @__PURE__ */ jsx28(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
@@ -6122,7 +5214,7 @@ import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6122
5214
|
var useComponentList = (config, ui) => {
|
6123
5215
|
const [componentList, setComponentList] = useState18();
|
6124
5216
|
useEffect15(() => {
|
6125
|
-
var _a, _b,
|
5217
|
+
var _a, _b, _c;
|
6126
5218
|
if (Object.keys(ui.componentList).length > 0) {
|
6127
5219
|
const matchedComponents = [];
|
6128
5220
|
let _componentList;
|
@@ -6136,7 +5228,7 @@ var useComponentList = (config, ui) => {
|
|
6136
5228
|
{
|
6137
5229
|
id: categoryKey,
|
6138
5230
|
title: category.title || categoryKey,
|
6139
|
-
children: category.components.map((componentName,
|
5231
|
+
children: category.components.map((componentName, i) => {
|
6140
5232
|
var _a2;
|
6141
5233
|
matchedComponents.push(componentName);
|
6142
5234
|
const componentConf = config.components[componentName] || {};
|
@@ -6145,7 +5237,7 @@ var useComponentList = (config, ui) => {
|
|
6145
5237
|
{
|
6146
5238
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
6147
5239
|
name: componentName,
|
6148
|
-
index:
|
5240
|
+
index: i
|
6149
5241
|
},
|
6150
5242
|
componentName
|
6151
5243
|
);
|
@@ -6164,8 +5256,8 @@ var useComponentList = (config, ui) => {
|
|
6164
5256
|
ComponentList,
|
6165
5257
|
{
|
6166
5258
|
id: "other",
|
6167
|
-
title: ((
|
6168
|
-
children: remainingComponents.map((componentName,
|
5259
|
+
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
5260
|
+
children: remainingComponents.map((componentName, i) => {
|
6169
5261
|
var _a2;
|
6170
5262
|
const componentConf = config.components[componentName] || {};
|
6171
5263
|
return /* @__PURE__ */ jsx30(
|
@@ -6173,7 +5265,7 @@ var useComponentList = (config, ui) => {
|
|
6173
5265
|
{
|
6174
5266
|
name: componentName,
|
6175
5267
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
6176
|
-
index:
|
5268
|
+
index: i
|
6177
5269
|
},
|
6178
5270
|
componentName
|
6179
5271
|
);
|
@@ -6232,7 +5324,7 @@ var getStyles = (styleSheet) => {
|
|
6232
5324
|
if (styleSheet) {
|
6233
5325
|
try {
|
6234
5326
|
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
6235
|
-
} catch (
|
5327
|
+
} catch (e) {
|
6236
5328
|
console.warn(
|
6237
5329
|
"Access to stylesheet %s is denied. Ignoring\u2026",
|
6238
5330
|
styleSheet.href
|
@@ -6369,7 +5461,7 @@ var CopyHostStyles = ({
|
|
6369
5461
|
const parentBody = parentDocument.getElementsByTagName("body")[0];
|
6370
5462
|
syncAttributes(parentBody, doc.body);
|
6371
5463
|
Promise.all(
|
6372
|
-
collectedStyles.map((styleNode,
|
5464
|
+
collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
|
6373
5465
|
if (styleNode.nodeName === "LINK") {
|
6374
5466
|
const linkHref = styleNode.href;
|
6375
5467
|
if (hrefs.indexOf(linkHref) > -1) {
|
@@ -6527,6 +5619,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
6527
5619
|
{
|
6528
5620
|
className: getClassName23(),
|
6529
5621
|
id,
|
5622
|
+
"data-puck-preview": true,
|
6530
5623
|
onClick: () => {
|
6531
5624
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
6532
5625
|
},
|
@@ -6680,9 +5773,9 @@ var LayerTree = ({
|
|
6680
5773
|
] }),
|
6681
5774
|
/* @__PURE__ */ jsxs17("ul", { className: getClassName24(), children: [
|
6682
5775
|
zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
|
6683
|
-
zoneContent.map((item,
|
5776
|
+
zoneContent.map((item, i) => {
|
6684
5777
|
var _a;
|
6685
|
-
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) ===
|
5778
|
+
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
6686
5779
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
6687
5780
|
const containsZone = Object.keys(zonesForItem).length > 0;
|
6688
5781
|
const { setHoveringComponent = () => {
|
@@ -6712,7 +5805,7 @@ var LayerTree = ({
|
|
6712
5805
|
setItemSelector(null);
|
6713
5806
|
return;
|
6714
5807
|
}
|
6715
|
-
const id = zoneContent[
|
5808
|
+
const id = zoneContent[i].props.id;
|
6716
5809
|
const frame = getFrame();
|
6717
5810
|
const el = frame == null ? void 0 : frame.querySelector(
|
6718
5811
|
`[data-puck-component="${id}"]`
|
@@ -6727,17 +5820,17 @@ var LayerTree = ({
|
|
6727
5820
|
scrollIntoView(el);
|
6728
5821
|
onScrollEnd(frame, () => {
|
6729
5822
|
setItemSelector({
|
6730
|
-
index:
|
5823
|
+
index: i,
|
6731
5824
|
zone
|
6732
5825
|
});
|
6733
5826
|
});
|
6734
5827
|
},
|
6735
|
-
onMouseOver: (
|
6736
|
-
|
5828
|
+
onMouseOver: (e) => {
|
5829
|
+
e.stopPropagation();
|
6737
5830
|
setHoveringComponent(item.props.id);
|
6738
5831
|
},
|
6739
|
-
onMouseOut: (
|
6740
|
-
|
5832
|
+
onMouseOut: (e) => {
|
5833
|
+
e.stopPropagation();
|
6741
5834
|
setHoveringComponent(null);
|
6742
5835
|
},
|
6743
5836
|
children: [
|
@@ -6770,7 +5863,7 @@ var LayerTree = ({
|
|
6770
5863
|
) }, idx))
|
6771
5864
|
]
|
6772
5865
|
},
|
6773
|
-
`${item.props.id}_${
|
5866
|
+
`${item.props.id}_${i}`
|
6774
5867
|
);
|
6775
5868
|
})
|
6776
5869
|
] })
|
@@ -7121,8 +6214,8 @@ var ViewportButton = ({
|
|
7121
6214
|
{
|
7122
6215
|
title,
|
7123
6216
|
disabled: isActive,
|
7124
|
-
onClick: (
|
7125
|
-
|
6217
|
+
onClick: (e) => {
|
6218
|
+
e.stopPropagation();
|
7126
6219
|
onClick({ width, height });
|
7127
6220
|
},
|
7128
6221
|
children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
|
@@ -7158,11 +6251,11 @@ var ViewportControls = ({
|
|
7158
6251
|
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
7159
6252
|
}
|
7160
6253
|
]
|
7161
|
-
].filter((
|
6254
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
7162
6255
|
[autoZoom]
|
7163
6256
|
);
|
7164
6257
|
return /* @__PURE__ */ jsxs19("div", { className: getClassName25(), children: [
|
7165
|
-
viewports.map((viewport,
|
6258
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
|
7166
6259
|
ViewportButton,
|
7167
6260
|
{
|
7168
6261
|
height: viewport.height,
|
@@ -7171,7 +6264,7 @@ var ViewportControls = ({
|
|
7171
6264
|
onClick: onViewportChange,
|
7172
6265
|
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
7173
6266
|
},
|
7174
|
-
|
6267
|
+
i
|
7175
6268
|
)),
|
7176
6269
|
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
7177
6270
|
/* @__PURE__ */ jsx36(
|
@@ -7179,8 +6272,8 @@ var ViewportControls = ({
|
|
7179
6272
|
{
|
7180
6273
|
title: "Zoom viewport out",
|
7181
6274
|
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
7182
|
-
onClick: (
|
7183
|
-
|
6275
|
+
onClick: (e) => {
|
6276
|
+
e.stopPropagation();
|
7184
6277
|
onZoom(
|
7185
6278
|
zoomOptions[Math.max(
|
7186
6279
|
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
@@ -7196,8 +6289,8 @@ var ViewportControls = ({
|
|
7196
6289
|
{
|
7197
6290
|
title: "Zoom viewport in",
|
7198
6291
|
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
7199
|
-
onClick: (
|
7200
|
-
|
6292
|
+
onClick: (e) => {
|
6293
|
+
e.stopPropagation();
|
7201
6294
|
onZoom(
|
7202
6295
|
zoomOptions[Math.min(
|
7203
6296
|
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
@@ -7214,8 +6307,8 @@ var ViewportControls = ({
|
|
7214
6307
|
{
|
7215
6308
|
className: getClassName25("zoomSelect"),
|
7216
6309
|
value: zoom.toString(),
|
7217
|
-
onChange: (
|
7218
|
-
onZoom(parseFloat(
|
6310
|
+
onChange: (e) => {
|
6311
|
+
onZoom(parseFloat(e.currentTarget.value));
|
7219
6312
|
},
|
7220
6313
|
children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
|
7221
6314
|
"option",
|
@@ -7555,7 +6648,7 @@ function Puck({
|
|
7555
6648
|
}, _iframe);
|
7556
6649
|
useInjectGlobalCss(iframe.enabled);
|
7557
6650
|
const [generatedAppState] = useState24(() => {
|
7558
|
-
var _a2, _b2,
|
6651
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7559
6652
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7560
6653
|
let clientUiState = {};
|
7561
6654
|
if (typeof window !== "undefined") {
|
@@ -7569,13 +6662,13 @@ function Puck({
|
|
7569
6662
|
const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
|
7570
6663
|
key,
|
7571
6664
|
diff: Math.abs(viewportWidth - value.width)
|
7572
|
-
})).sort((
|
6665
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
7573
6666
|
const closestViewport = viewportDifferences[0].key;
|
7574
6667
|
if (iframe.enabled) {
|
7575
6668
|
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
7576
6669
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
7577
6670
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
7578
|
-
height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((
|
6671
|
+
height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
|
7579
6672
|
width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
|
7580
6673
|
})
|
7581
6674
|
})
|