@measured/puck 0.18.0-canary.066aba9 → 0.18.0-canary.1ea6f98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-EXKSBUY5.mjs → chunk-CHWFBYEM.mjs} +2 -4
- package/dist/index.css +27 -34
- package/dist/index.d.mts +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.js +1218 -888
- package/dist/index.mjs +1132 -799
- package/dist/rsc.js +2 -4
- package/dist/rsc.mjs +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
@@ -16,7 +16,7 @@ import {
|
|
16
16
|
resolveRootData,
|
17
17
|
rootDroppableId,
|
18
18
|
setupZone
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-CHWFBYEM.mjs";
|
20
20
|
|
21
21
|
// ../../node_modules/classnames/index.js
|
22
22
|
var require_classnames = __commonJS({
|
@@ -210,8 +210,9 @@ var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input":
|
|
210
210
|
// components/AutoField/index.tsx
|
211
211
|
import {
|
212
212
|
useCallback as useCallback5,
|
213
|
+
useContext as useContext3,
|
213
214
|
useEffect as useEffect9,
|
214
|
-
useMemo as
|
215
|
+
useMemo as useMemo5,
|
215
216
|
useState as useState11
|
216
217
|
} from "react";
|
217
218
|
|
@@ -1085,7 +1086,7 @@ init_react_import();
|
|
1085
1086
|
import { DragDropProvider } from "@dnd-kit/react";
|
1086
1087
|
import { useState as useState5 } from "react";
|
1087
1088
|
|
1088
|
-
// lib/dnd-kit/safe.ts
|
1089
|
+
// lib/dnd/dnd-kit/safe.ts
|
1089
1090
|
init_react_import();
|
1090
1091
|
import {
|
1091
1092
|
useDraggable,
|
@@ -1165,8 +1166,53 @@ var Sortable = ({
|
|
1165
1166
|
return children({ status, ref: sortableRef });
|
1166
1167
|
};
|
1167
1168
|
|
1169
|
+
// components/AutoField/context.tsx
|
1170
|
+
init_react_import();
|
1171
|
+
import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
|
1172
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
1173
|
+
var NestedFieldContext = createContext2({});
|
1174
|
+
var useNestedFieldContext = () => {
|
1175
|
+
const context = useContext2(NestedFieldContext);
|
1176
|
+
return __spreadProps(__spreadValues({}, context), {
|
1177
|
+
readOnlyFields: context.readOnlyFields || {}
|
1178
|
+
});
|
1179
|
+
};
|
1180
|
+
var NestedFieldProvider = ({
|
1181
|
+
children,
|
1182
|
+
name,
|
1183
|
+
subName,
|
1184
|
+
wildcardName = name,
|
1185
|
+
readOnlyFields
|
1186
|
+
}) => {
|
1187
|
+
const subPath = `${name}.${subName}`;
|
1188
|
+
const wildcardSubPath = `${wildcardName}.${subName}`;
|
1189
|
+
const subReadOnlyFields = useMemo(
|
1190
|
+
() => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
|
1191
|
+
const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
|
1192
|
+
if (isLocal) {
|
1193
|
+
const subPathPattern = new RegExp(
|
1194
|
+
`^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
|
1195
|
+
);
|
1196
|
+
const localName = readOnlyKey.replace(subPathPattern, "");
|
1197
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1198
|
+
[localName]: readOnlyFields[readOnlyKey]
|
1199
|
+
});
|
1200
|
+
}
|
1201
|
+
return acc;
|
1202
|
+
}, {}),
|
1203
|
+
[name, subName, wildcardName, readOnlyFields]
|
1204
|
+
);
|
1205
|
+
return /* @__PURE__ */ jsx7(
|
1206
|
+
NestedFieldContext.Provider,
|
1207
|
+
{
|
1208
|
+
value: { readOnlyFields: subReadOnlyFields, localName: subName },
|
1209
|
+
children
|
1210
|
+
}
|
1211
|
+
);
|
1212
|
+
};
|
1213
|
+
|
1168
1214
|
// components/AutoField/fields/ArrayField/index.tsx
|
1169
|
-
import { jsx as
|
1215
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
1170
1216
|
var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
|
1171
1217
|
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
|
1172
1218
|
var ArrayField = ({
|
@@ -1177,10 +1223,10 @@ var ArrayField = ({
|
|
1177
1223
|
label,
|
1178
1224
|
readOnly,
|
1179
1225
|
id,
|
1180
|
-
Label: Label2 = (props) => /* @__PURE__ */
|
1226
|
+
Label: Label2 = (props) => /* @__PURE__ */ jsx8("div", __spreadValues({}, props))
|
1181
1227
|
}) => {
|
1182
1228
|
const { state, setUi, selectedItem, getPermissions } = useAppContext();
|
1183
|
-
const readOnlyFields =
|
1229
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
1184
1230
|
const value = _value;
|
1185
1231
|
const arrayState = state.ui.arrayState[id] || {
|
1186
1232
|
items: Array.from(value || []).map((item, idx) => {
|
@@ -1240,14 +1286,14 @@ var ArrayField = ({
|
|
1240
1286
|
return null;
|
1241
1287
|
}
|
1242
1288
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
1243
|
-
return /* @__PURE__ */
|
1289
|
+
return /* @__PURE__ */ jsx8(
|
1244
1290
|
Label2,
|
1245
1291
|
{
|
1246
1292
|
label: label || name,
|
1247
|
-
icon: /* @__PURE__ */
|
1293
|
+
icon: /* @__PURE__ */ jsx8(List, { size: 16 }),
|
1248
1294
|
el: "div",
|
1249
1295
|
readOnly,
|
1250
|
-
children: /* @__PURE__ */
|
1296
|
+
children: /* @__PURE__ */ jsx8(
|
1251
1297
|
SortableProvider,
|
1252
1298
|
{
|
1253
1299
|
onMove: (move) => {
|
@@ -1283,7 +1329,7 @@ var ArrayField = ({
|
|
1283
1329
|
localState.arrayState.items.map((item, i) => {
|
1284
1330
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
1285
1331
|
const data = Array.from(localState.value || [])[i] || {};
|
1286
|
-
return /* @__PURE__ */
|
1332
|
+
return /* @__PURE__ */ jsx8(
|
1287
1333
|
Sortable,
|
1288
1334
|
{
|
1289
1335
|
id: _arrayId,
|
@@ -1324,7 +1370,7 @@ var ArrayField = ({
|
|
1324
1370
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1325
1371
|
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
1326
1372
|
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
1327
|
-
/* @__PURE__ */
|
1373
|
+
/* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
|
1328
1374
|
IconButton,
|
1329
1375
|
{
|
1330
1376
|
type: "button",
|
@@ -1341,10 +1387,10 @@ var ArrayField = ({
|
|
1341
1387
|
);
|
1342
1388
|
},
|
1343
1389
|
title: "Duplicate",
|
1344
|
-
children: /* @__PURE__ */
|
1390
|
+
children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
|
1345
1391
|
}
|
1346
1392
|
) }),
|
1347
|
-
/* @__PURE__ */
|
1393
|
+
/* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
|
1348
1394
|
IconButton,
|
1349
1395
|
{
|
1350
1396
|
type: "button",
|
@@ -1365,39 +1411,56 @@ var ArrayField = ({
|
|
1365
1411
|
);
|
1366
1412
|
},
|
1367
1413
|
title: "Delete",
|
1368
|
-
children: /* @__PURE__ */
|
1414
|
+
children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
|
1369
1415
|
}
|
1370
1416
|
) })
|
1371
1417
|
] }),
|
1372
|
-
/* @__PURE__ */
|
1418
|
+
/* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(DragIcon, {}) })
|
1373
1419
|
] })
|
1374
1420
|
]
|
1375
1421
|
}
|
1376
1422
|
),
|
1377
|
-
/* @__PURE__ */
|
1378
|
-
const subField = field.arrayFields[
|
1379
|
-
const
|
1380
|
-
const
|
1381
|
-
const
|
1382
|
-
|
1383
|
-
|
1423
|
+
/* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
|
1424
|
+
const subField = field.arrayFields[subName];
|
1425
|
+
const indexName = `${name}[${i}]`;
|
1426
|
+
const subPath = `${indexName}.${subName}`;
|
1427
|
+
const localIndexName = `${localName}[${i}]`;
|
1428
|
+
const localWildcardName = `${localName}[*]`;
|
1429
|
+
const localSubPath = `${localIndexName}.${subName}`;
|
1430
|
+
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
1431
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
1432
|
+
const label2 = subField.label || subName;
|
1433
|
+
return /* @__PURE__ */ jsx8(
|
1434
|
+
NestedFieldProvider,
|
1384
1435
|
{
|
1385
|
-
name:
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1436
|
+
name: localIndexName,
|
1437
|
+
wildcardName: localWildcardName,
|
1438
|
+
subName,
|
1439
|
+
readOnlyFields,
|
1440
|
+
children: /* @__PURE__ */ jsx8(
|
1441
|
+
AutoFieldPrivate,
|
1442
|
+
{
|
1443
|
+
name: subPath,
|
1444
|
+
label: label2,
|
1445
|
+
id: `${_arrayId}_${subName}`,
|
1446
|
+
readOnly: subReadOnly,
|
1447
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
1448
|
+
label: label2
|
1449
|
+
// May be used by custom fields
|
1450
|
+
}),
|
1451
|
+
value: data[subName],
|
1452
|
+
onChange: (val, ui) => {
|
1453
|
+
onChange(
|
1454
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
1455
|
+
[subName]: val
|
1456
|
+
})),
|
1457
|
+
ui
|
1458
|
+
);
|
1459
|
+
}
|
1460
|
+
}
|
1461
|
+
)
|
1399
1462
|
},
|
1400
|
-
|
1463
|
+
subPath
|
1401
1464
|
);
|
1402
1465
|
}) }) })
|
1403
1466
|
]
|
@@ -1407,7 +1470,7 @@ var ArrayField = ({
|
|
1407
1470
|
_arrayId
|
1408
1471
|
);
|
1409
1472
|
}),
|
1410
|
-
!addDisabled && /* @__PURE__ */
|
1473
|
+
!addDisabled && /* @__PURE__ */ jsx8(
|
1411
1474
|
"button",
|
1412
1475
|
{
|
1413
1476
|
type: "button",
|
@@ -1421,7 +1484,7 @@ var ArrayField = ({
|
|
1421
1484
|
const newArrayState = regenerateArrayState(newValue);
|
1422
1485
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
1423
1486
|
},
|
1424
|
-
children: /* @__PURE__ */
|
1487
|
+
children: /* @__PURE__ */ jsx8(Plus, { size: 21 })
|
1425
1488
|
}
|
1426
1489
|
)
|
1427
1490
|
]
|
@@ -1435,7 +1498,7 @@ var ArrayField = ({
|
|
1435
1498
|
|
1436
1499
|
// components/AutoField/fields/DefaultField/index.tsx
|
1437
1500
|
init_react_import();
|
1438
|
-
import { Fragment as Fragment2, jsx as
|
1501
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
1439
1502
|
var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
|
1440
1503
|
var DefaultField = ({
|
1441
1504
|
field,
|
@@ -1447,16 +1510,16 @@ var DefaultField = ({
|
|
1447
1510
|
Label: Label2,
|
1448
1511
|
id
|
1449
1512
|
}) => {
|
1450
|
-
return /* @__PURE__ */
|
1513
|
+
return /* @__PURE__ */ jsx9(
|
1451
1514
|
Label2,
|
1452
1515
|
{
|
1453
1516
|
label: label || name,
|
1454
1517
|
icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
1455
|
-
field.type === "text" && /* @__PURE__ */
|
1456
|
-
field.type === "number" && /* @__PURE__ */
|
1518
|
+
field.type === "text" && /* @__PURE__ */ jsx9(Type, { size: 16 }),
|
1519
|
+
field.type === "number" && /* @__PURE__ */ jsx9(Hash, { size: 16 })
|
1457
1520
|
] }),
|
1458
1521
|
readOnly,
|
1459
|
-
children: /* @__PURE__ */
|
1522
|
+
children: /* @__PURE__ */ jsx9(
|
1460
1523
|
"input",
|
1461
1524
|
{
|
1462
1525
|
className: getClassName6("input"),
|
@@ -1467,7 +1530,14 @@ var DefaultField = ({
|
|
1467
1530
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1468
1531
|
onChange: (e) => {
|
1469
1532
|
if (field.type === "number") {
|
1470
|
-
|
1533
|
+
const numberValue = Number(e.currentTarget.value);
|
1534
|
+
if (typeof field.min !== "undefined" && numberValue < field.min) {
|
1535
|
+
return;
|
1536
|
+
}
|
1537
|
+
if (typeof field.max !== "undefined" && numberValue > field.max) {
|
1538
|
+
return;
|
1539
|
+
}
|
1540
|
+
onChange(numberValue);
|
1471
1541
|
} else {
|
1472
1542
|
onChange(e.currentTarget.value);
|
1473
1543
|
}
|
@@ -1490,7 +1560,7 @@ import { useEffect as useEffect8 } from "react";
|
|
1490
1560
|
// components/ExternalInput/index.tsx
|
1491
1561
|
init_react_import();
|
1492
1562
|
import {
|
1493
|
-
useMemo,
|
1563
|
+
useMemo as useMemo2,
|
1494
1564
|
useEffect as useEffect7,
|
1495
1565
|
useState as useState9,
|
1496
1566
|
useCallback as useCallback4,
|
@@ -1511,7 +1581,7 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
|
|
1511
1581
|
|
1512
1582
|
// components/Modal/index.tsx
|
1513
1583
|
import { createPortal } from "react-dom";
|
1514
|
-
import { jsx as
|
1584
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
1515
1585
|
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
|
1516
1586
|
var Modal = ({
|
1517
1587
|
children,
|
@@ -1523,10 +1593,10 @@ var Modal = ({
|
|
1523
1593
|
setRootEl(document.getElementById("puck-portal-root"));
|
1524
1594
|
}, []);
|
1525
1595
|
if (!rootEl) {
|
1526
|
-
return /* @__PURE__ */
|
1596
|
+
return /* @__PURE__ */ jsx10("div", {});
|
1527
1597
|
}
|
1528
1598
|
return createPortal(
|
1529
|
-
/* @__PURE__ */
|
1599
|
+
/* @__PURE__ */ jsx10("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx10(
|
1530
1600
|
"div",
|
1531
1601
|
{
|
1532
1602
|
className: getClassName7("inner"),
|
@@ -1546,11 +1616,11 @@ init_react_import();
|
|
1546
1616
|
var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
1547
1617
|
|
1548
1618
|
// components/Heading/index.tsx
|
1549
|
-
import { jsx as
|
1619
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
1550
1620
|
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
|
1551
1621
|
var Heading = ({ children, rank, size = "m" }) => {
|
1552
1622
|
const Tag = rank ? `h${rank}` : "span";
|
1553
|
-
return /* @__PURE__ */
|
1623
|
+
return /* @__PURE__ */ jsx11(
|
1554
1624
|
Tag,
|
1555
1625
|
{
|
1556
1626
|
className: getClassName8({
|
@@ -1586,7 +1656,7 @@ var filterDataAttrs = (props) => {
|
|
1586
1656
|
};
|
1587
1657
|
|
1588
1658
|
// components/Button/Button.tsx
|
1589
|
-
import { jsx as
|
1659
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
1590
1660
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1591
1661
|
var Button = (_a) => {
|
1592
1662
|
var _b = _a, {
|
@@ -1645,9 +1715,9 @@ var Button = (_a) => {
|
|
1645
1715
|
href
|
1646
1716
|
}, dataAttrs), {
|
1647
1717
|
children: [
|
1648
|
-
icon && /* @__PURE__ */
|
1718
|
+
icon && /* @__PURE__ */ jsx12("div", { className: getClassName9("icon"), children: icon }),
|
1649
1719
|
children,
|
1650
|
-
loading && /* @__PURE__ */
|
1720
|
+
loading && /* @__PURE__ */ jsx12("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx12(Loader, { size: 14 }) })
|
1651
1721
|
]
|
1652
1722
|
})
|
1653
1723
|
);
|
@@ -1655,7 +1725,7 @@ var Button = (_a) => {
|
|
1655
1725
|
};
|
1656
1726
|
|
1657
1727
|
// components/ExternalInput/index.tsx
|
1658
|
-
import { Fragment as Fragment3, jsx as
|
1728
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
1659
1729
|
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
1660
1730
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
1661
1731
|
var dataCache = {};
|
@@ -1678,10 +1748,10 @@ var ExternalInput = ({
|
|
1678
1748
|
const hasFilterFields = !!filterFields;
|
1679
1749
|
const [filters, setFilters] = useState9(field.initialFilters || {});
|
1680
1750
|
const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
|
1681
|
-
const mappedData =
|
1751
|
+
const mappedData = useMemo2(() => {
|
1682
1752
|
return data.map(mapRow);
|
1683
1753
|
}, [data]);
|
1684
|
-
const keys =
|
1754
|
+
const keys = useMemo2(() => {
|
1685
1755
|
const validKeys = /* @__PURE__ */ new Set();
|
1686
1756
|
for (const item of mappedData) {
|
1687
1757
|
for (const key of Object.keys(item)) {
|
@@ -1728,7 +1798,7 @@ var ExternalInput = ({
|
|
1728
1798
|
id,
|
1729
1799
|
children: [
|
1730
1800
|
/* @__PURE__ */ jsxs6("div", { className: getClassName10("actions"), children: [
|
1731
|
-
/* @__PURE__ */
|
1801
|
+
/* @__PURE__ */ jsx13(
|
1732
1802
|
"button",
|
1733
1803
|
{
|
1734
1804
|
type: "button",
|
@@ -1736,12 +1806,12 @@ var ExternalInput = ({
|
|
1736
1806
|
className: getClassName10("button"),
|
1737
1807
|
disabled: readOnly,
|
1738
1808
|
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
1739
|
-
/* @__PURE__ */
|
1740
|
-
/* @__PURE__ */
|
1809
|
+
/* @__PURE__ */ jsx13(Link, { size: "16" }),
|
1810
|
+
/* @__PURE__ */ jsx13("span", { children: field.placeholder })
|
1741
1811
|
] })
|
1742
1812
|
}
|
1743
1813
|
),
|
1744
|
-
value && /* @__PURE__ */
|
1814
|
+
value && /* @__PURE__ */ jsx13(
|
1745
1815
|
"button",
|
1746
1816
|
{
|
1747
1817
|
type: "button",
|
@@ -1750,11 +1820,11 @@ var ExternalInput = ({
|
|
1750
1820
|
onChange(null);
|
1751
1821
|
},
|
1752
1822
|
disabled: readOnly,
|
1753
|
-
children: /* @__PURE__ */
|
1823
|
+
children: /* @__PURE__ */ jsx13(LockOpen, { size: 16 })
|
1754
1824
|
}
|
1755
1825
|
)
|
1756
1826
|
] }),
|
1757
|
-
/* @__PURE__ */
|
1827
|
+
/* @__PURE__ */ jsx13(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs6(
|
1758
1828
|
"form",
|
1759
1829
|
{
|
1760
1830
|
className: getClassNameModal({
|
@@ -1768,11 +1838,11 @@ var ExternalInput = ({
|
|
1768
1838
|
search(searchQuery, filters);
|
1769
1839
|
},
|
1770
1840
|
children: [
|
1771
|
-
/* @__PURE__ */
|
1841
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs6("div", { className: getClassNameModal("searchForm"), children: [
|
1772
1842
|
/* @__PURE__ */ jsxs6("label", { className: getClassNameModal("search"), children: [
|
1773
|
-
/* @__PURE__ */
|
1774
|
-
/* @__PURE__ */
|
1775
|
-
/* @__PURE__ */
|
1843
|
+
/* @__PURE__ */ jsx13("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
1844
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx13(Search, { size: "18" }) }),
|
1845
|
+
/* @__PURE__ */ jsx13(
|
1776
1846
|
"input",
|
1777
1847
|
{
|
1778
1848
|
className: getClassNameModal("searchInput"),
|
@@ -1788,8 +1858,8 @@ var ExternalInput = ({
|
|
1788
1858
|
)
|
1789
1859
|
] }),
|
1790
1860
|
/* @__PURE__ */ jsxs6("div", { className: getClassNameModal("searchActions"), children: [
|
1791
|
-
/* @__PURE__ */
|
1792
|
-
hasFilterFields && /* @__PURE__ */
|
1861
|
+
/* @__PURE__ */ jsx13(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
1862
|
+
hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx13(
|
1793
1863
|
IconButton,
|
1794
1864
|
{
|
1795
1865
|
title: "Toggle filters",
|
@@ -1798,15 +1868,15 @@ var ExternalInput = ({
|
|
1798
1868
|
e.stopPropagation();
|
1799
1869
|
setFiltersToggled(!filtersToggled);
|
1800
1870
|
},
|
1801
|
-
children: /* @__PURE__ */
|
1871
|
+
children: /* @__PURE__ */ jsx13(SlidersHorizontal, { size: 20 })
|
1802
1872
|
}
|
1803
1873
|
) })
|
1804
1874
|
] })
|
1805
|
-
] }) : /* @__PURE__ */
|
1875
|
+
] }) : /* @__PURE__ */ jsx13(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
|
1806
1876
|
/* @__PURE__ */ jsxs6("div", { className: getClassNameModal("grid"), children: [
|
1807
|
-
hasFilterFields && /* @__PURE__ */
|
1877
|
+
hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
1808
1878
|
const filterField = filterFields[fieldName];
|
1809
|
-
return /* @__PURE__ */
|
1879
|
+
return /* @__PURE__ */ jsx13(
|
1810
1880
|
AutoFieldPrivate,
|
1811
1881
|
{
|
1812
1882
|
field: filterField,
|
@@ -1825,7 +1895,7 @@ var ExternalInput = ({
|
|
1825
1895
|
}) }),
|
1826
1896
|
/* @__PURE__ */ jsxs6("div", { className: getClassNameModal("tableWrapper"), children: [
|
1827
1897
|
/* @__PURE__ */ jsxs6("table", { className: getClassNameModal("table"), children: [
|
1828
|
-
/* @__PURE__ */
|
1898
|
+
/* @__PURE__ */ jsx13("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx13("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx13(
|
1829
1899
|
"th",
|
1830
1900
|
{
|
1831
1901
|
className: getClassNameModal("th"),
|
@@ -1834,8 +1904,8 @@ var ExternalInput = ({
|
|
1834
1904
|
},
|
1835
1905
|
key
|
1836
1906
|
)) }) }),
|
1837
|
-
/* @__PURE__ */
|
1838
|
-
return /* @__PURE__ */
|
1907
|
+
/* @__PURE__ */ jsx13("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
1908
|
+
return /* @__PURE__ */ jsx13(
|
1839
1909
|
"tr",
|
1840
1910
|
{
|
1841
1911
|
style: { whiteSpace: "nowrap" },
|
@@ -1844,16 +1914,16 @@ var ExternalInput = ({
|
|
1844
1914
|
onChange(mapProp(data[i]));
|
1845
1915
|
setOpen(false);
|
1846
1916
|
},
|
1847
|
-
children: keys.map((key) => /* @__PURE__ */
|
1917
|
+
children: keys.map((key) => /* @__PURE__ */ jsx13("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
1848
1918
|
},
|
1849
1919
|
i
|
1850
1920
|
);
|
1851
1921
|
}) })
|
1852
1922
|
] }),
|
1853
|
-
/* @__PURE__ */
|
1923
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx13(Loader, { size: 24 }) })
|
1854
1924
|
] })
|
1855
1925
|
] }),
|
1856
|
-
/* @__PURE__ */
|
1926
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx13(Footer, { items: mappedData }) })
|
1857
1927
|
]
|
1858
1928
|
}
|
1859
1929
|
) })
|
@@ -1863,7 +1933,7 @@ var ExternalInput = ({
|
|
1863
1933
|
};
|
1864
1934
|
|
1865
1935
|
// components/AutoField/fields/ExternalField/index.tsx
|
1866
|
-
import { jsx as
|
1936
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
1867
1937
|
var ExternalField = ({
|
1868
1938
|
field,
|
1869
1939
|
onChange,
|
@@ -1887,7 +1957,7 @@ var ExternalField = ({
|
|
1887
1957
|
if (field.type !== "external") {
|
1888
1958
|
return null;
|
1889
1959
|
}
|
1890
|
-
return /* @__PURE__ */
|
1960
|
+
return /* @__PURE__ */ jsx14(Label2, { label: label || name, icon: /* @__PURE__ */ jsx14(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx14(
|
1891
1961
|
ExternalInput,
|
1892
1962
|
{
|
1893
1963
|
name,
|
@@ -1912,7 +1982,7 @@ var ExternalField = ({
|
|
1912
1982
|
|
1913
1983
|
// components/AutoField/fields/RadioField/index.tsx
|
1914
1984
|
init_react_import();
|
1915
|
-
import { useMemo as
|
1985
|
+
import { useMemo as useMemo3 } from "react";
|
1916
1986
|
|
1917
1987
|
// lib/safe-json-parse.ts
|
1918
1988
|
init_react_import();
|
@@ -1926,7 +1996,7 @@ var safeJsonParse = (str) => {
|
|
1926
1996
|
};
|
1927
1997
|
|
1928
1998
|
// components/AutoField/fields/RadioField/index.tsx
|
1929
|
-
import { jsx as
|
1999
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
1930
2000
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
1931
2001
|
var RadioField = ({
|
1932
2002
|
field,
|
@@ -1938,26 +2008,26 @@ var RadioField = ({
|
|
1938
2008
|
label,
|
1939
2009
|
Label: Label2
|
1940
2010
|
}) => {
|
1941
|
-
const flatOptions =
|
2011
|
+
const flatOptions = useMemo3(
|
1942
2012
|
() => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
|
1943
2013
|
[field]
|
1944
2014
|
);
|
1945
2015
|
if (field.type !== "radio" || !field.options) {
|
1946
2016
|
return null;
|
1947
2017
|
}
|
1948
|
-
return /* @__PURE__ */
|
2018
|
+
return /* @__PURE__ */ jsx15(
|
1949
2019
|
Label2,
|
1950
2020
|
{
|
1951
|
-
icon: /* @__PURE__ */
|
2021
|
+
icon: /* @__PURE__ */ jsx15(CircleCheckBig, { size: 16 }),
|
1952
2022
|
label: label || name,
|
1953
2023
|
readOnly,
|
1954
2024
|
el: "div",
|
1955
|
-
children: /* @__PURE__ */
|
2025
|
+
children: /* @__PURE__ */ jsx15("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs7(
|
1956
2026
|
"label",
|
1957
2027
|
{
|
1958
2028
|
className: getClassName11("radio"),
|
1959
2029
|
children: [
|
1960
|
-
/* @__PURE__ */
|
2030
|
+
/* @__PURE__ */ jsx15(
|
1961
2031
|
"input",
|
1962
2032
|
{
|
1963
2033
|
type: "radio",
|
@@ -1977,7 +2047,7 @@ var RadioField = ({
|
|
1977
2047
|
checked: value === option.value
|
1978
2048
|
}
|
1979
2049
|
),
|
1980
|
-
/* @__PURE__ */
|
2050
|
+
/* @__PURE__ */ jsx15("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
1981
2051
|
]
|
1982
2052
|
},
|
1983
2053
|
option.label + option.value
|
@@ -1988,8 +2058,8 @@ var RadioField = ({
|
|
1988
2058
|
|
1989
2059
|
// components/AutoField/fields/SelectField/index.tsx
|
1990
2060
|
init_react_import();
|
1991
|
-
import { useMemo as
|
1992
|
-
import { jsx as
|
2061
|
+
import { useMemo as useMemo4 } from "react";
|
2062
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
1993
2063
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
1994
2064
|
var SelectField = ({
|
1995
2065
|
field,
|
@@ -2001,20 +2071,20 @@ var SelectField = ({
|
|
2001
2071
|
readOnly,
|
2002
2072
|
id
|
2003
2073
|
}) => {
|
2004
|
-
const flatOptions =
|
2074
|
+
const flatOptions = useMemo4(
|
2005
2075
|
() => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
|
2006
2076
|
[field]
|
2007
2077
|
);
|
2008
2078
|
if (field.type !== "select" || !field.options) {
|
2009
2079
|
return null;
|
2010
2080
|
}
|
2011
|
-
return /* @__PURE__ */
|
2081
|
+
return /* @__PURE__ */ jsx16(
|
2012
2082
|
Label2,
|
2013
2083
|
{
|
2014
2084
|
label: label || name,
|
2015
|
-
icon: /* @__PURE__ */
|
2085
|
+
icon: /* @__PURE__ */ jsx16(ChevronDown, { size: 16 }),
|
2016
2086
|
readOnly,
|
2017
|
-
children: /* @__PURE__ */
|
2087
|
+
children: /* @__PURE__ */ jsx16(
|
2018
2088
|
"select",
|
2019
2089
|
{
|
2020
2090
|
id,
|
@@ -2031,7 +2101,7 @@ var SelectField = ({
|
|
2031
2101
|
}
|
2032
2102
|
},
|
2033
2103
|
value,
|
2034
|
-
children: field.options.map((option) => /* @__PURE__ */
|
2104
|
+
children: field.options.map((option) => /* @__PURE__ */ jsx16(
|
2035
2105
|
"option",
|
2036
2106
|
{
|
2037
2107
|
label: option.label,
|
@@ -2047,7 +2117,7 @@ var SelectField = ({
|
|
2047
2117
|
|
2048
2118
|
// components/AutoField/fields/TextareaField/index.tsx
|
2049
2119
|
init_react_import();
|
2050
|
-
import { jsx as
|
2120
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
2051
2121
|
var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
|
2052
2122
|
var TextareaField = ({
|
2053
2123
|
onChange,
|
@@ -2058,7 +2128,7 @@ var TextareaField = ({
|
|
2058
2128
|
Label: Label2,
|
2059
2129
|
id
|
2060
2130
|
}) => {
|
2061
|
-
return /* @__PURE__ */
|
2131
|
+
return /* @__PURE__ */ jsx17(Label2, { label: label || name, icon: /* @__PURE__ */ jsx17(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx17(
|
2062
2132
|
"textarea",
|
2063
2133
|
{
|
2064
2134
|
id,
|
@@ -2085,7 +2155,7 @@ init_react_import();
|
|
2085
2155
|
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
2086
2156
|
|
2087
2157
|
// components/AutoField/fields/ObjectField/index.tsx
|
2088
|
-
import { jsx as
|
2158
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
2089
2159
|
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
2090
2160
|
var ObjectField = ({
|
2091
2161
|
field,
|
@@ -2097,43 +2167,54 @@ var ObjectField = ({
|
|
2097
2167
|
readOnly,
|
2098
2168
|
id
|
2099
2169
|
}) => {
|
2100
|
-
const {
|
2170
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
2101
2171
|
if (field.type !== "object" || !field.objectFields) {
|
2102
2172
|
return null;
|
2103
2173
|
}
|
2104
|
-
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
2105
2174
|
const data = value || {};
|
2106
|
-
return /* @__PURE__ */
|
2175
|
+
return /* @__PURE__ */ jsx18(
|
2107
2176
|
Label2,
|
2108
2177
|
{
|
2109
2178
|
label: label || name,
|
2110
|
-
icon: /* @__PURE__ */
|
2179
|
+
icon: /* @__PURE__ */ jsx18(EllipsisVertical, { size: 16 }),
|
2111
2180
|
el: "div",
|
2112
2181
|
readOnly,
|
2113
|
-
children: /* @__PURE__ */
|
2114
|
-
const subField = field.objectFields[
|
2115
|
-
const
|
2116
|
-
const
|
2117
|
-
const subReadOnly = readOnly ? readOnly :
|
2118
|
-
|
2119
|
-
|
2182
|
+
children: /* @__PURE__ */ jsx18("div", { className: getClassName14(), children: /* @__PURE__ */ jsx18("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
2183
|
+
const subField = field.objectFields[subName];
|
2184
|
+
const subPath = `${name}.${subName}`;
|
2185
|
+
const localSubPath = `${localName || name}.${subName}`;
|
2186
|
+
const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
|
2187
|
+
const label2 = subField.label || subName;
|
2188
|
+
return /* @__PURE__ */ jsx18(
|
2189
|
+
NestedFieldProvider,
|
2120
2190
|
{
|
2121
|
-
name:
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2191
|
+
name: localName || id,
|
2192
|
+
subName,
|
2193
|
+
readOnlyFields,
|
2194
|
+
children: /* @__PURE__ */ jsx18(
|
2195
|
+
AutoFieldPrivate,
|
2196
|
+
{
|
2197
|
+
name: subPath,
|
2198
|
+
label: subPath,
|
2199
|
+
id: `${id}_${subName}`,
|
2200
|
+
readOnly: subReadOnly,
|
2201
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
2202
|
+
label: label2
|
2203
|
+
// May be used by custom fields
|
2131
2204
|
}),
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2205
|
+
value: data[subName],
|
2206
|
+
onChange: (val, ui) => {
|
2207
|
+
onChange(
|
2208
|
+
__spreadProps(__spreadValues({}, data), {
|
2209
|
+
[subName]: val
|
2210
|
+
}),
|
2211
|
+
ui
|
2212
|
+
);
|
2213
|
+
}
|
2214
|
+
}
|
2215
|
+
)
|
2135
2216
|
},
|
2136
|
-
|
2217
|
+
subPath
|
2137
2218
|
);
|
2138
2219
|
}) }) })
|
2139
2220
|
}
|
@@ -2159,7 +2240,7 @@ var useSafeId = () => {
|
|
2159
2240
|
};
|
2160
2241
|
|
2161
2242
|
// components/AutoField/index.tsx
|
2162
|
-
import { Fragment as Fragment4, jsx as
|
2243
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
|
2163
2244
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
2164
2245
|
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
2165
2246
|
var FieldLabel = ({
|
@@ -2173,14 +2254,14 @@ var FieldLabel = ({
|
|
2173
2254
|
const El = el;
|
2174
2255
|
return /* @__PURE__ */ jsxs8(El, { className, children: [
|
2175
2256
|
/* @__PURE__ */ jsxs8("div", { className: getClassName15("label"), children: [
|
2176
|
-
icon ? /* @__PURE__ */
|
2257
|
+
icon ? /* @__PURE__ */ jsx19("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx19(Fragment4, {}),
|
2177
2258
|
label,
|
2178
|
-
readOnly && /* @__PURE__ */
|
2259
|
+
readOnly && /* @__PURE__ */ jsx19("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx19(Lock, { size: "12" }) })
|
2179
2260
|
] }),
|
2180
2261
|
children
|
2181
2262
|
] });
|
2182
2263
|
};
|
2183
|
-
var
|
2264
|
+
var FieldLabelInternal = ({
|
2184
2265
|
children,
|
2185
2266
|
icon,
|
2186
2267
|
label,
|
@@ -2188,14 +2269,14 @@ var FieldLabelInternal2 = ({
|
|
2188
2269
|
readOnly
|
2189
2270
|
}) => {
|
2190
2271
|
const { overrides } = useAppContext();
|
2191
|
-
const Wrapper =
|
2272
|
+
const Wrapper = useMemo5(
|
2192
2273
|
() => overrides.fieldLabel || FieldLabel,
|
2193
2274
|
[overrides]
|
2194
2275
|
);
|
2195
2276
|
if (!label) {
|
2196
|
-
return /* @__PURE__ */
|
2277
|
+
return /* @__PURE__ */ jsx19(Fragment4, { children });
|
2197
2278
|
}
|
2198
|
-
return /* @__PURE__ */
|
2279
|
+
return /* @__PURE__ */ jsx19(
|
2199
2280
|
Wrapper,
|
2200
2281
|
{
|
2201
2282
|
label,
|
@@ -2209,8 +2290,9 @@ var FieldLabelInternal2 = ({
|
|
2209
2290
|
};
|
2210
2291
|
function AutoFieldInternal(props) {
|
2211
2292
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2212
|
-
const { dispatch, overrides } = useAppContext();
|
2213
|
-
const
|
2293
|
+
const { dispatch, overrides, selectedItem } = useAppContext();
|
2294
|
+
const nestedFieldContext = useContext3(NestedFieldContext);
|
2295
|
+
const { id, Label: Label2 = FieldLabelInternal } = props;
|
2214
2296
|
const field = props.field;
|
2215
2297
|
const label = field.label;
|
2216
2298
|
const defaultId = useSafeId();
|
@@ -2270,20 +2352,29 @@ function AutoFieldInternal(props) {
|
|
2270
2352
|
return null;
|
2271
2353
|
}
|
2272
2354
|
const CustomField = field.render;
|
2273
|
-
return /* @__PURE__ */
|
2355
|
+
return /* @__PURE__ */ jsx19("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx19("div", { className: getClassName15(), children: /* @__PURE__ */ jsx19(CustomField, __spreadValues({}, mergedProps)) }) });
|
2274
2356
|
}
|
2275
2357
|
const children = defaultFields[field.type](mergedProps);
|
2276
2358
|
const Render2 = render[field.type];
|
2277
|
-
return /* @__PURE__ */
|
2278
|
-
|
2359
|
+
return /* @__PURE__ */ jsx19(
|
2360
|
+
NestedFieldContext.Provider,
|
2279
2361
|
{
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
onClick: (e) => {
|
2284
|
-
e.stopPropagation();
|
2362
|
+
value: {
|
2363
|
+
readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
|
2364
|
+
localName: nestedFieldContext.localName
|
2285
2365
|
},
|
2286
|
-
children: /* @__PURE__ */
|
2366
|
+
children: /* @__PURE__ */ jsx19(
|
2367
|
+
"div",
|
2368
|
+
{
|
2369
|
+
className: getClassNameWrapper(),
|
2370
|
+
onFocus,
|
2371
|
+
onBlur,
|
2372
|
+
onClick: (e) => {
|
2373
|
+
e.stopPropagation();
|
2374
|
+
},
|
2375
|
+
children: /* @__PURE__ */ jsx19(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2376
|
+
}
|
2377
|
+
)
|
2287
2378
|
}
|
2288
2379
|
);
|
2289
2380
|
}
|
@@ -2311,11 +2402,11 @@ function AutoFieldPrivate(props) {
|
|
2311
2402
|
value: localValue,
|
2312
2403
|
onChange: onChangeLocal
|
2313
2404
|
};
|
2314
|
-
return /* @__PURE__ */
|
2405
|
+
return /* @__PURE__ */ jsx19(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
2315
2406
|
}
|
2316
2407
|
function AutoField(props) {
|
2317
|
-
const DefaultLabel =
|
2318
|
-
const DefaultLabel2 = (labelProps) => /* @__PURE__ */
|
2408
|
+
const DefaultLabel = useMemo5(() => {
|
2409
|
+
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx19(
|
2319
2410
|
"div",
|
2320
2411
|
__spreadProps(__spreadValues({}, labelProps), {
|
2321
2412
|
className: getClassName15({ readOnly: props.readOnly })
|
@@ -2323,7 +2414,7 @@ function AutoField(props) {
|
|
2323
2414
|
);
|
2324
2415
|
return DefaultLabel2;
|
2325
2416
|
}, [props.readOnly]);
|
2326
|
-
return /* @__PURE__ */
|
2417
|
+
return /* @__PURE__ */ jsx19(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
2327
2418
|
}
|
2328
2419
|
|
2329
2420
|
// components/Drawer/index.tsx
|
@@ -2334,18 +2425,19 @@ init_react_import();
|
|
2334
2425
|
var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
|
2335
2426
|
|
2336
2427
|
// components/Drawer/index.tsx
|
2337
|
-
import { useMemo as
|
2428
|
+
import { useMemo as useMemo9, useState as useState18 } from "react";
|
2338
2429
|
|
2339
2430
|
// components/DragDropContext/index.tsx
|
2340
2431
|
init_react_import();
|
2341
2432
|
import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
|
2342
2433
|
import {
|
2343
|
-
createContext as
|
2344
|
-
useCallback as
|
2345
|
-
useContext as
|
2346
|
-
useEffect as
|
2347
|
-
|
2348
|
-
|
2434
|
+
createContext as createContext4,
|
2435
|
+
useCallback as useCallback11,
|
2436
|
+
useContext as useContext7,
|
2437
|
+
useEffect as useEffect15,
|
2438
|
+
useId,
|
2439
|
+
useRef as useRef4,
|
2440
|
+
useState as useState17
|
2349
2441
|
} from "react";
|
2350
2442
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
2351
2443
|
|
@@ -2353,23 +2445,22 @@ import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
|
2353
2445
|
init_react_import();
|
2354
2446
|
import {
|
2355
2447
|
forwardRef as forwardRef3,
|
2356
|
-
useCallback as
|
2357
|
-
useContext as
|
2358
|
-
useEffect as
|
2359
|
-
useMemo as
|
2360
|
-
useRef as
|
2361
|
-
useState as useState15
|
2448
|
+
useCallback as useCallback10,
|
2449
|
+
useContext as useContext6,
|
2450
|
+
useEffect as useEffect14,
|
2451
|
+
useMemo as useMemo8,
|
2452
|
+
useRef as useRef3
|
2362
2453
|
} from "react";
|
2363
2454
|
|
2364
2455
|
// components/DraggableComponent/index.tsx
|
2365
2456
|
init_react_import();
|
2366
2457
|
import {
|
2367
|
-
useCallback as
|
2368
|
-
useContext as
|
2458
|
+
useCallback as useCallback7,
|
2459
|
+
useContext as useContext5,
|
2369
2460
|
useEffect as useEffect10,
|
2370
|
-
useMemo as
|
2371
|
-
useRef as
|
2372
|
-
useState as
|
2461
|
+
useMemo as useMemo7,
|
2462
|
+
useRef as useRef2,
|
2463
|
+
useState as useState13
|
2373
2464
|
} from "react";
|
2374
2465
|
|
2375
2466
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -2379,18 +2470,18 @@ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8
|
|
2379
2470
|
// components/DraggableComponent/index.tsx
|
2380
2471
|
import { createPortal as createPortal2 } from "react-dom";
|
2381
2472
|
|
2382
|
-
//
|
2473
|
+
// lib/dnd/collision/dynamic/index.ts
|
2383
2474
|
init_react_import();
|
2384
2475
|
import {
|
2385
2476
|
CollisionPriority as CollisionPriority7,
|
2386
2477
|
CollisionType as CollisionType7
|
2387
2478
|
} from "@dnd-kit/abstract";
|
2388
2479
|
|
2389
|
-
//
|
2480
|
+
// lib/dnd/collision/directional/index.ts
|
2390
2481
|
init_react_import();
|
2391
2482
|
import { CollisionType } from "@dnd-kit/abstract";
|
2392
2483
|
|
2393
|
-
//
|
2484
|
+
// lib/dnd/collision/collision-debug.ts
|
2394
2485
|
init_react_import();
|
2395
2486
|
var DEBUG = false;
|
2396
2487
|
var debugElements = {};
|
@@ -2439,7 +2530,7 @@ var collisionDebug = (a, b, id, color, label) => {
|
|
2439
2530
|
});
|
2440
2531
|
};
|
2441
2532
|
|
2442
|
-
//
|
2533
|
+
// lib/dnd/collision/directional/index.ts
|
2443
2534
|
var distanceChange = "increasing";
|
2444
2535
|
var directionalCollision = (input, previous) => {
|
2445
2536
|
var _a;
|
@@ -2472,7 +2563,7 @@ var directionalCollision = (input, previous) => {
|
|
2472
2563
|
return null;
|
2473
2564
|
};
|
2474
2565
|
|
2475
|
-
//
|
2566
|
+
// lib/dnd/collision/dynamic/get-direction.ts
|
2476
2567
|
init_react_import();
|
2477
2568
|
var getDirection = (dragAxis, delta) => {
|
2478
2569
|
if (dragAxis === "dynamic") {
|
@@ -2487,7 +2578,7 @@ var getDirection = (dragAxis, delta) => {
|
|
2487
2578
|
return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
|
2488
2579
|
};
|
2489
2580
|
|
2490
|
-
//
|
2581
|
+
// lib/dnd/collision/dynamic/get-midpoint-impact.ts
|
2491
2582
|
init_react_import();
|
2492
2583
|
var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
|
2493
2584
|
const dragRect = dragShape.boundingRectangle;
|
@@ -2506,7 +2597,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
|
|
2506
2597
|
return dragRect.right - offset >= dropCenter.x;
|
2507
2598
|
};
|
2508
2599
|
|
2509
|
-
//
|
2600
|
+
// lib/dnd/collision/dynamic/track-movement-interval.ts
|
2510
2601
|
init_react_import();
|
2511
2602
|
import { Point } from "@dnd-kit/geometry";
|
2512
2603
|
var INTERVAL_SENSITIVITY = 10;
|
@@ -2610,7 +2701,14 @@ var closestCorners = (input) => {
|
|
2610
2701
|
};
|
2611
2702
|
};
|
2612
2703
|
|
2613
|
-
//
|
2704
|
+
// lib/dnd/collision/dynamic/store.ts
|
2705
|
+
init_react_import();
|
2706
|
+
import { createStore } from "zustand/vanilla";
|
2707
|
+
var collisionStore = createStore(() => ({
|
2708
|
+
fallbackEnabled: false
|
2709
|
+
}));
|
2710
|
+
|
2711
|
+
// lib/dnd/collision/dynamic/index.ts
|
2614
2712
|
var flushNext = "";
|
2615
2713
|
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
2616
2714
|
var _a, _b, _c, _d, _e;
|
@@ -2622,6 +2720,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
2622
2720
|
return null;
|
2623
2721
|
}
|
2624
2722
|
const { center: dragCenter } = dragShape;
|
2723
|
+
const { fallbackEnabled } = collisionStore.getState();
|
2625
2724
|
const interval = trackMovementInterval(position.current, dragAxis);
|
2626
2725
|
dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
|
2627
2726
|
direction: interval.direction
|
@@ -2667,7 +2766,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
2667
2766
|
flushNext = "";
|
2668
2767
|
return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
|
2669
2768
|
}
|
2670
|
-
if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
2769
|
+
if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
2671
2770
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
2672
2771
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
2673
2772
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
@@ -2728,8 +2827,107 @@ function getDeepScrollPosition(element) {
|
|
2728
2827
|
return totalScroll;
|
2729
2828
|
}
|
2730
2829
|
|
2830
|
+
// components/DropZone/context.tsx
|
2831
|
+
init_react_import();
|
2832
|
+
import {
|
2833
|
+
createContext as createContext3,
|
2834
|
+
useCallback as useCallback6,
|
2835
|
+
useMemo as useMemo6,
|
2836
|
+
useState as useState12
|
2837
|
+
} from "react";
|
2838
|
+
import { createStore as createStore2 } from "zustand";
|
2839
|
+
import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
|
2840
|
+
var dropZoneContext = createContext3(null);
|
2841
|
+
var ZoneStoreContext = createContext3(
|
2842
|
+
createStore2(() => ({
|
2843
|
+
zoneDepthIndex: {},
|
2844
|
+
nextZoneDepthIndex: {},
|
2845
|
+
areaDepthIndex: {},
|
2846
|
+
nextAreaDepthIndex: {},
|
2847
|
+
draggedItem: null,
|
2848
|
+
previewIndex: {}
|
2849
|
+
}))
|
2850
|
+
);
|
2851
|
+
var ZoneStoreProvider = ({
|
2852
|
+
children,
|
2853
|
+
store
|
2854
|
+
}) => {
|
2855
|
+
return /* @__PURE__ */ jsx20(ZoneStoreContext.Provider, { value: store, children });
|
2856
|
+
};
|
2857
|
+
var DropZoneProvider = ({
|
2858
|
+
children,
|
2859
|
+
value
|
2860
|
+
}) => {
|
2861
|
+
const [hoveringComponent, setHoveringComponent] = useState12();
|
2862
|
+
const [areasWithZones, setAreasWithZones] = useState12(
|
2863
|
+
{}
|
2864
|
+
);
|
2865
|
+
const [activeZones, setActiveZones] = useState12({});
|
2866
|
+
const { dispatch } = useAppContext();
|
2867
|
+
const registerZoneArea = useCallback6(
|
2868
|
+
(area) => {
|
2869
|
+
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
2870
|
+
},
|
2871
|
+
[setAreasWithZones]
|
2872
|
+
);
|
2873
|
+
const registerZone = useCallback6(
|
2874
|
+
(zoneCompound) => {
|
2875
|
+
if (!dispatch) {
|
2876
|
+
return;
|
2877
|
+
}
|
2878
|
+
dispatch({
|
2879
|
+
type: "registerZone",
|
2880
|
+
zone: zoneCompound
|
2881
|
+
});
|
2882
|
+
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
|
2883
|
+
},
|
2884
|
+
[setActiveZones, dispatch]
|
2885
|
+
);
|
2886
|
+
const unregisterZone = useCallback6(
|
2887
|
+
(zoneCompound) => {
|
2888
|
+
if (!dispatch) {
|
2889
|
+
return;
|
2890
|
+
}
|
2891
|
+
dispatch({
|
2892
|
+
type: "unregisterZone",
|
2893
|
+
zone: zoneCompound
|
2894
|
+
});
|
2895
|
+
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
|
2896
|
+
[zoneCompound]: false
|
2897
|
+
}));
|
2898
|
+
},
|
2899
|
+
[setActiveZones, dispatch]
|
2900
|
+
);
|
2901
|
+
const memoValue = useMemo6(
|
2902
|
+
() => __spreadValues({
|
2903
|
+
hoveringComponent,
|
2904
|
+
setHoveringComponent,
|
2905
|
+
registerZoneArea,
|
2906
|
+
areasWithZones,
|
2907
|
+
registerZone,
|
2908
|
+
unregisterZone,
|
2909
|
+
activeZones
|
2910
|
+
}, value),
|
2911
|
+
[value, hoveringComponent, areasWithZones, activeZones]
|
2912
|
+
);
|
2913
|
+
return /* @__PURE__ */ jsx20(Fragment5, { children: memoValue && /* @__PURE__ */ jsx20(dropZoneContext.Provider, { value: memoValue, children }) });
|
2914
|
+
};
|
2915
|
+
|
2916
|
+
// lib/use-context-store.ts
|
2917
|
+
init_react_import();
|
2918
|
+
import { useContext as useContext4 } from "react";
|
2919
|
+
import { useStore } from "zustand";
|
2920
|
+
import { useShallow } from "zustand/react/shallow";
|
2921
|
+
function useContextStore(context, selector) {
|
2922
|
+
const store = useContext4(context);
|
2923
|
+
if (!store) {
|
2924
|
+
throw new Error("useContextStore must be used inside context");
|
2925
|
+
}
|
2926
|
+
return useStore(store, useShallow(selector));
|
2927
|
+
}
|
2928
|
+
|
2731
2929
|
// components/DraggableComponent/index.tsx
|
2732
|
-
import { jsx as
|
2930
|
+
import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
2733
2931
|
var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
2734
2932
|
var DEBUG2 = false;
|
2735
2933
|
var space = 8;
|
@@ -2743,9 +2941,9 @@ var DefaultActionBar = ({
|
|
2743
2941
|
}) => /* @__PURE__ */ jsxs9(ActionBar, { children: [
|
2744
2942
|
/* @__PURE__ */ jsxs9(ActionBar.Group, { children: [
|
2745
2943
|
parentAction,
|
2746
|
-
label && /* @__PURE__ */
|
2944
|
+
label && /* @__PURE__ */ jsx21(ActionBar.Label, { label })
|
2747
2945
|
] }),
|
2748
|
-
/* @__PURE__ */
|
2946
|
+
/* @__PURE__ */ jsx21(ActionBar.Group, { children })
|
2749
2947
|
] });
|
2750
2948
|
var convertIdToSelector = (id, zoneCompound, data) => {
|
2751
2949
|
const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
|
@@ -2780,9 +2978,9 @@ var DraggableComponent = ({
|
|
2780
2978
|
iframe,
|
2781
2979
|
state
|
2782
2980
|
} = useAppContext();
|
2783
|
-
const ctx =
|
2784
|
-
const [localZones, setLocalZones] =
|
2785
|
-
const registerLocalZone =
|
2981
|
+
const ctx = useContext5(dropZoneContext);
|
2982
|
+
const [localZones, setLocalZones] = useState13({});
|
2983
|
+
const registerLocalZone = useCallback7(
|
2786
2984
|
(zoneCompound2, active) => {
|
2787
2985
|
var _a;
|
2788
2986
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
@@ -2792,7 +2990,7 @@ var DraggableComponent = ({
|
|
2792
2990
|
},
|
2793
2991
|
[setLocalZones]
|
2794
2992
|
);
|
2795
|
-
const unregisterLocalZone =
|
2993
|
+
const unregisterLocalZone = useCallback7(
|
2796
2994
|
(zoneCompound2) => {
|
2797
2995
|
var _a;
|
2798
2996
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
@@ -2806,7 +3004,7 @@ var DraggableComponent = ({
|
|
2806
3004
|
);
|
2807
3005
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
2808
3006
|
const { path = [] } = ctx || {};
|
2809
|
-
const [canDrag, setCanDrag] =
|
3007
|
+
const [canDrag, setCanDrag] = useState13(false);
|
2810
3008
|
useEffect10(() => {
|
2811
3009
|
var _a;
|
2812
3010
|
const item = getItem({ index, zone: zoneCompound }, state.data);
|
@@ -2817,10 +3015,13 @@ var DraggableComponent = ({
|
|
2817
3015
|
setCanDrag((_a = perms.drag) != null ? _a : true);
|
2818
3016
|
}
|
2819
3017
|
}, [state, index, zoneCompound, getPermissions]);
|
2820
|
-
const userIsDragging =
|
3018
|
+
const userIsDragging = useContextStore(
|
3019
|
+
ZoneStoreContext,
|
3020
|
+
(s) => !!s.draggedItem
|
3021
|
+
);
|
2821
3022
|
const canCollide = canDrag || userIsDragging;
|
2822
3023
|
const disabled = !isEnabled || !canCollide;
|
2823
|
-
const [dragAxis, setDragAxis] =
|
3024
|
+
const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
|
2824
3025
|
const { ref: sortableRef, status } = useSortableSafe({
|
2825
3026
|
id,
|
2826
3027
|
index,
|
@@ -2846,8 +3047,8 @@ var DraggableComponent = ({
|
|
2846
3047
|
}
|
2847
3048
|
});
|
2848
3049
|
const thisIsDragging = status === "dragging";
|
2849
|
-
const ref =
|
2850
|
-
const refSetter =
|
3050
|
+
const ref = useRef2(null);
|
3051
|
+
const refSetter = useCallback7(
|
2851
3052
|
(el) => {
|
2852
3053
|
sortableRef(el);
|
2853
3054
|
if (el) {
|
@@ -2856,14 +3057,14 @@ var DraggableComponent = ({
|
|
2856
3057
|
},
|
2857
3058
|
[sortableRef]
|
2858
3059
|
);
|
2859
|
-
const [portalEl, setPortalEl] =
|
3060
|
+
const [portalEl, setPortalEl] = useState13();
|
2860
3061
|
useEffect10(() => {
|
2861
3062
|
var _a, _b, _c;
|
2862
3063
|
setPortalEl(
|
2863
3064
|
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
|
2864
3065
|
);
|
2865
3066
|
}, [iframe.enabled, ref.current]);
|
2866
|
-
const getStyle =
|
3067
|
+
const getStyle = useCallback7(() => {
|
2867
3068
|
var _a, _b, _c;
|
2868
3069
|
if (!ref.current) return;
|
2869
3070
|
const rect = ref.current.getBoundingClientRect();
|
@@ -2883,8 +3084,8 @@ var DraggableComponent = ({
|
|
2883
3084
|
};
|
2884
3085
|
return style2;
|
2885
3086
|
}, [ref.current]);
|
2886
|
-
const [style, setStyle] =
|
2887
|
-
const sync =
|
3087
|
+
const [style, setStyle] = useState13();
|
3088
|
+
const sync = useCallback7(() => {
|
2888
3089
|
setStyle(getStyle());
|
2889
3090
|
}, [ref.current, iframe]);
|
2890
3091
|
useEffect10(() => {
|
@@ -2897,19 +3098,21 @@ var DraggableComponent = ({
|
|
2897
3098
|
}
|
2898
3099
|
}, [ref.current]);
|
2899
3100
|
useEffect10(() => {
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
3101
|
+
if (isSelected) {
|
3102
|
+
ctx == null ? void 0 : ctx.registerPath({
|
3103
|
+
index,
|
3104
|
+
zone: zoneCompound
|
3105
|
+
});
|
3106
|
+
}
|
2904
3107
|
}, [isSelected]);
|
2905
|
-
const CustomActionBar =
|
3108
|
+
const CustomActionBar = useMemo7(
|
2906
3109
|
() => overrides.actionBar || DefaultActionBar,
|
2907
3110
|
[overrides.actionBar]
|
2908
3111
|
);
|
2909
3112
|
const permissions = getPermissions({
|
2910
3113
|
item: selectedItem
|
2911
3114
|
});
|
2912
|
-
const onClick =
|
3115
|
+
const onClick = useCallback7(
|
2913
3116
|
(e) => {
|
2914
3117
|
e.stopPropagation();
|
2915
3118
|
dispatch({
|
@@ -2921,7 +3124,7 @@ var DraggableComponent = ({
|
|
2921
3124
|
},
|
2922
3125
|
[index, zoneCompound, id]
|
2923
3126
|
);
|
2924
|
-
const onSelectParent =
|
3127
|
+
const onSelectParent = useCallback7(() => {
|
2925
3128
|
if (!(ctx == null ? void 0 : ctx.areaId)) {
|
2926
3129
|
return;
|
2927
3130
|
}
|
@@ -2939,21 +3142,21 @@ var DraggableComponent = ({
|
|
2939
3142
|
}
|
2940
3143
|
});
|
2941
3144
|
}, [ctx, path]);
|
2942
|
-
const onDuplicate =
|
3145
|
+
const onDuplicate = useCallback7(() => {
|
2943
3146
|
dispatch({
|
2944
3147
|
type: "duplicate",
|
2945
3148
|
sourceIndex: index,
|
2946
3149
|
sourceZone: zoneCompound
|
2947
3150
|
});
|
2948
3151
|
}, [index, zoneCompound]);
|
2949
|
-
const onDelete =
|
3152
|
+
const onDelete = useCallback7(() => {
|
2950
3153
|
dispatch({
|
2951
3154
|
type: "remove",
|
2952
3155
|
index,
|
2953
3156
|
zone: zoneCompound
|
2954
3157
|
});
|
2955
3158
|
}, [index, zoneCompound]);
|
2956
|
-
const [hover, setHover] =
|
3159
|
+
const [hover, setHover] = useState13(false);
|
2957
3160
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
2958
3161
|
useEffect10(() => {
|
2959
3162
|
if (!ref.current) {
|
@@ -3014,7 +3217,7 @@ var DraggableComponent = ({
|
|
3014
3217
|
};
|
3015
3218
|
}
|
3016
3219
|
}, [disabled, ref]);
|
3017
|
-
const [isVisible, setIsVisible] =
|
3220
|
+
const [isVisible, setIsVisible] = useState13(false);
|
3018
3221
|
useEffect10(() => {
|
3019
3222
|
sync();
|
3020
3223
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
@@ -3023,7 +3226,7 @@ var DraggableComponent = ({
|
|
3023
3226
|
setIsVisible(false);
|
3024
3227
|
}
|
3025
3228
|
}, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
|
3026
|
-
const syncActionsPosition =
|
3229
|
+
const syncActionsPosition = useCallback7(
|
3027
3230
|
(el) => {
|
3028
3231
|
if (el) {
|
3029
3232
|
const view = el.ownerDocument.defaultView;
|
@@ -3054,7 +3257,7 @@ var DraggableComponent = ({
|
|
3054
3257
|
}
|
3055
3258
|
setDragAxis(autoDragAxis);
|
3056
3259
|
}, [ref, userDragAxis, autoDragAxis]);
|
3057
|
-
const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */
|
3260
|
+
const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ jsx21(CornerLeftUp, { size: 16 }) });
|
3058
3261
|
return /* @__PURE__ */ jsxs9(
|
3059
3262
|
DropZoneProvider,
|
3060
3263
|
{
|
@@ -3081,15 +3284,15 @@ var DraggableComponent = ({
|
|
3081
3284
|
"data-puck-overlay": true,
|
3082
3285
|
children: [
|
3083
3286
|
debug,
|
3084
|
-
isLoading && /* @__PURE__ */
|
3085
|
-
/* @__PURE__ */
|
3287
|
+
isLoading && /* @__PURE__ */ jsx21("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ jsx21(Loader, {}) }),
|
3288
|
+
/* @__PURE__ */ jsx21(
|
3086
3289
|
"div",
|
3087
3290
|
{
|
3088
3291
|
className: getClassName16("actionsOverlay"),
|
3089
3292
|
style: {
|
3090
3293
|
top: actionsOverlayTop / zoomConfig.zoom
|
3091
3294
|
},
|
3092
|
-
children: /* @__PURE__ */
|
3295
|
+
children: /* @__PURE__ */ jsx21(
|
3093
3296
|
"div",
|
3094
3297
|
{
|
3095
3298
|
className: getClassName16("actions"),
|
@@ -3107,8 +3310,8 @@ var DraggableComponent = ({
|
|
3107
3310
|
parentAction,
|
3108
3311
|
label: DEBUG2 ? id : label,
|
3109
3312
|
children: [
|
3110
|
-
permissions.duplicate && /* @__PURE__ */
|
3111
|
-
permissions.delete && /* @__PURE__ */
|
3313
|
+
permissions.duplicate && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx21(Copy, { size: 16 }) }),
|
3314
|
+
permissions.delete && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx21(Trash, { size: 16 }) })
|
3112
3315
|
]
|
3113
3316
|
}
|
3114
3317
|
)
|
@@ -3116,7 +3319,7 @@ var DraggableComponent = ({
|
|
3116
3319
|
)
|
3117
3320
|
}
|
3118
3321
|
),
|
3119
|
-
/* @__PURE__ */
|
3322
|
+
/* @__PURE__ */ jsx21("div", { className: getClassName16("overlay") })
|
3120
3323
|
]
|
3121
3324
|
}
|
3122
3325
|
),
|
@@ -3132,98 +3335,26 @@ var DraggableComponent = ({
|
|
3132
3335
|
init_react_import();
|
3133
3336
|
var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isActive": "_DropZone--isActive_kmkdc_10", "DropZone--hasChildren": "_DropZone--hasChildren_kmkdc_14", "DropZone--userIsDragging": "_DropZone--userIsDragging_kmkdc_22", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_kmkdc_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_kmkdc_27", "DropZone--isRootZone": "_DropZone--isRootZone_kmkdc_27", "DropZone--isDestination": "_DropZone--isDestination_kmkdc_37", "DropZone-item": "_DropZone-item_kmkdc_49", "DropZone-hitbox": "_DropZone-hitbox_kmkdc_53", "DropZone--isEnabled": "_DropZone--isEnabled_kmkdc_61", "DropZone--isAnimating": "_DropZone--isAnimating_kmkdc_70" };
|
3134
3337
|
|
3135
|
-
// components/DropZone/
|
3136
|
-
init_react_import();
|
3137
|
-
import {
|
3138
|
-
createContext as createContext2,
|
3139
|
-
useCallback as useCallback7,
|
3140
|
-
useMemo as useMemo6,
|
3141
|
-
useState as useState13
|
3142
|
-
} from "react";
|
3143
|
-
import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
|
3144
|
-
var dropZoneContext = createContext2(null);
|
3145
|
-
var DropZoneProvider = ({
|
3146
|
-
children,
|
3147
|
-
value
|
3148
|
-
}) => {
|
3149
|
-
const [hoveringComponent, setHoveringComponent] = useState13();
|
3150
|
-
const [areasWithZones, setAreasWithZones] = useState13(
|
3151
|
-
{}
|
3152
|
-
);
|
3153
|
-
const [activeZones, setActiveZones] = useState13({});
|
3154
|
-
const { dispatch } = useAppContext();
|
3155
|
-
const registerZoneArea = useCallback7(
|
3156
|
-
(area) => {
|
3157
|
-
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
3158
|
-
},
|
3159
|
-
[setAreasWithZones]
|
3160
|
-
);
|
3161
|
-
const registerZone = useCallback7(
|
3162
|
-
(zoneCompound) => {
|
3163
|
-
if (!dispatch) {
|
3164
|
-
return;
|
3165
|
-
}
|
3166
|
-
dispatch({
|
3167
|
-
type: "registerZone",
|
3168
|
-
zone: zoneCompound
|
3169
|
-
});
|
3170
|
-
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
|
3171
|
-
},
|
3172
|
-
[setActiveZones, dispatch]
|
3173
|
-
);
|
3174
|
-
const unregisterZone = useCallback7(
|
3175
|
-
(zoneCompound) => {
|
3176
|
-
if (!dispatch) {
|
3177
|
-
return;
|
3178
|
-
}
|
3179
|
-
dispatch({
|
3180
|
-
type: "unregisterZone",
|
3181
|
-
zone: zoneCompound
|
3182
|
-
});
|
3183
|
-
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
|
3184
|
-
[zoneCompound]: false
|
3185
|
-
}));
|
3186
|
-
},
|
3187
|
-
[setActiveZones, dispatch]
|
3188
|
-
);
|
3189
|
-
const memoValue = useMemo6(
|
3190
|
-
() => __spreadValues({
|
3191
|
-
hoveringComponent,
|
3192
|
-
setHoveringComponent,
|
3193
|
-
registerZoneArea,
|
3194
|
-
areasWithZones,
|
3195
|
-
registerZone,
|
3196
|
-
unregisterZone,
|
3197
|
-
activeZones
|
3198
|
-
}, value),
|
3199
|
-
[value, hoveringComponent, areasWithZones, activeZones]
|
3200
|
-
);
|
3201
|
-
return /* @__PURE__ */ jsx20(Fragment5, { children: memoValue && /* @__PURE__ */ jsx20(dropZoneContext.Provider, { value: memoValue, children }) });
|
3202
|
-
};
|
3203
|
-
|
3204
|
-
// lib/insert.ts
|
3205
|
-
init_react_import();
|
3206
|
-
var insert = (list, index, item) => {
|
3207
|
-
const result = Array.from(list);
|
3208
|
-
result.splice(index, 0, item);
|
3209
|
-
return result;
|
3210
|
-
};
|
3211
|
-
|
3212
|
-
// components/DropZone/use-min-empty-height.ts
|
3338
|
+
// components/DropZone/lib/use-min-empty-height.ts
|
3213
3339
|
init_react_import();
|
3214
3340
|
import { useEffect as useEffect11, useState as useState14 } from "react";
|
3215
3341
|
var useMinEmptyHeight = ({
|
3216
|
-
draggedItem,
|
3217
3342
|
zoneCompound,
|
3218
3343
|
userMinEmptyHeight,
|
3219
3344
|
ref
|
3220
3345
|
}) => {
|
3221
3346
|
const [prevHeight, setPrevHeight] = useState14(0);
|
3222
3347
|
const [isAnimating, setIsAnimating] = useState14(false);
|
3348
|
+
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
3349
|
+
var _a, _b;
|
3350
|
+
return {
|
3351
|
+
draggedItem: ((_a = s.draggedItem) == null ? void 0 : _a.data.zone) === zoneCompound ? s.draggedItem : null,
|
3352
|
+
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
3353
|
+
};
|
3354
|
+
});
|
3223
3355
|
useEffect11(() => {
|
3224
3356
|
if (draggedItem && ref.current) {
|
3225
|
-
|
3226
|
-
if (componentData.zone === zoneCompound) {
|
3357
|
+
if (isZone) {
|
3227
3358
|
const rect = ref.current.getBoundingClientRect();
|
3228
3359
|
setPrevHeight(rect.height);
|
3229
3360
|
setIsAnimating(true);
|
@@ -3253,13 +3384,128 @@ function assignRefs(refs, node) {
|
|
3253
3384
|
});
|
3254
3385
|
}
|
3255
3386
|
|
3256
|
-
// components/DropZone/
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3387
|
+
// components/DropZone/lib/use-content-with-preview.ts
|
3388
|
+
init_react_import();
|
3389
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
3390
|
+
|
3391
|
+
// lib/dnd/use-rendered-callback.ts
|
3392
|
+
init_react_import();
|
3393
|
+
import { useDragDropManager } from "@dnd-kit/react";
|
3394
|
+
import { useCallback as useCallback8 } from "react";
|
3395
|
+
function useRenderedCallback(callback, deps) {
|
3396
|
+
const manager = useDragDropManager();
|
3397
|
+
return useCallback8(
|
3398
|
+
(...args) => __async(this, null, function* () {
|
3399
|
+
yield manager == null ? void 0 : manager.renderer.rendering;
|
3400
|
+
return callback(...args);
|
3401
|
+
}),
|
3402
|
+
[...deps, manager]
|
3403
|
+
);
|
3404
|
+
}
|
3405
|
+
|
3406
|
+
// lib/insert.ts
|
3407
|
+
init_react_import();
|
3408
|
+
var insert = (list, index, item) => {
|
3409
|
+
const result = Array.from(list);
|
3410
|
+
result.splice(index, 0, item);
|
3411
|
+
return result;
|
3412
|
+
};
|
3413
|
+
|
3414
|
+
// components/DropZone/lib/use-content-with-preview.ts
|
3415
|
+
var useContentWithPreview = (content, zoneCompound) => {
|
3416
|
+
const { draggedItemId, preview, previewExists } = useContextStore(
|
3417
|
+
ZoneStoreContext,
|
3418
|
+
(s) => {
|
3419
|
+
var _a;
|
3420
|
+
return {
|
3421
|
+
draggedItemId: (_a = s.draggedItem) == null ? void 0 : _a.id,
|
3422
|
+
preview: s.previewIndex[zoneCompound],
|
3423
|
+
previewExists: Object.keys(s.previewIndex || {}).length > 0
|
3424
|
+
};
|
3425
|
+
}
|
3426
|
+
);
|
3427
|
+
const [contentWithPreview, setContentWithPreview] = useState15(content);
|
3428
|
+
const updateContent = useRenderedCallback(
|
3429
|
+
(content2, preview2) => {
|
3430
|
+
if (preview2) {
|
3431
|
+
if (preview2.type === "insert") {
|
3432
|
+
setContentWithPreview(
|
3433
|
+
insert(
|
3434
|
+
content2.filter((item) => item.props.id !== preview2.props.id),
|
3435
|
+
preview2.index,
|
3436
|
+
{
|
3437
|
+
type: "preview",
|
3438
|
+
props: { id: preview2.props.id }
|
3439
|
+
}
|
3440
|
+
)
|
3441
|
+
);
|
3442
|
+
} else {
|
3443
|
+
setContentWithPreview(
|
3444
|
+
insert(
|
3445
|
+
content2.filter((item) => item.props.id !== preview2.props.id),
|
3446
|
+
preview2.index,
|
3447
|
+
{
|
3448
|
+
type: preview2.componentType,
|
3449
|
+
props: preview2.props
|
3450
|
+
}
|
3451
|
+
)
|
3452
|
+
);
|
3453
|
+
}
|
3454
|
+
} else {
|
3455
|
+
setContentWithPreview(
|
3456
|
+
previewExists ? content2.filter((item) => item.props.id !== draggedItemId) : content2
|
3457
|
+
);
|
3458
|
+
}
|
3459
|
+
},
|
3460
|
+
[draggedItemId, previewExists]
|
3461
|
+
);
|
3462
|
+
useEffect12(() => {
|
3463
|
+
updateContent(content, preview);
|
3464
|
+
}, [content, preview]);
|
3465
|
+
return contentWithPreview;
|
3466
|
+
};
|
3467
|
+
|
3468
|
+
// components/DropZone/lib/use-drag-axis.ts
|
3469
|
+
init_react_import();
|
3470
|
+
import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
|
3260
3471
|
var GRID_DRAG_AXIS = "dynamic";
|
3261
3472
|
var FLEX_ROW_DRAG_AXIS = "x";
|
3262
3473
|
var DEFAULT_DRAG_AXIS = "y";
|
3474
|
+
var useDragAxis = (ref, collisionAxis) => {
|
3475
|
+
const { status } = useAppContext();
|
3476
|
+
const [dragAxis, setDragAxis] = useState16(
|
3477
|
+
collisionAxis || DEFAULT_DRAG_AXIS
|
3478
|
+
);
|
3479
|
+
const calculateDragAxis = useCallback9(() => {
|
3480
|
+
if (ref.current) {
|
3481
|
+
const computedStyle = window.getComputedStyle(ref.current);
|
3482
|
+
if (computedStyle.display === "grid") {
|
3483
|
+
setDragAxis(GRID_DRAG_AXIS);
|
3484
|
+
} else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
|
3485
|
+
setDragAxis(FLEX_ROW_DRAG_AXIS);
|
3486
|
+
} else {
|
3487
|
+
setDragAxis(DEFAULT_DRAG_AXIS);
|
3488
|
+
}
|
3489
|
+
}
|
3490
|
+
}, [ref.current]);
|
3491
|
+
useEffect13(() => {
|
3492
|
+
const onViewportChange = () => {
|
3493
|
+
calculateDragAxis();
|
3494
|
+
};
|
3495
|
+
window.addEventListener("viewportchange", onViewportChange);
|
3496
|
+
return () => {
|
3497
|
+
window.removeEventListener("viewportchange", onViewportChange);
|
3498
|
+
};
|
3499
|
+
}, []);
|
3500
|
+
useEffect13(calculateDragAxis, [status, collisionAxis]);
|
3501
|
+
return [dragAxis, calculateDragAxis];
|
3502
|
+
};
|
3503
|
+
|
3504
|
+
// components/DropZone/index.tsx
|
3505
|
+
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
3506
|
+
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
|
3507
|
+
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
3508
|
+
var RENDER_DEBUG = false;
|
3263
3509
|
var DropZoneEdit = forwardRef3(
|
3264
3510
|
function DropZoneEdit2({
|
3265
3511
|
zone,
|
@@ -3271,31 +3517,50 @@ var DropZoneEdit = forwardRef3(
|
|
3271
3517
|
collisionAxis
|
3272
3518
|
}, userRef) {
|
3273
3519
|
const appContext2 = useAppContext();
|
3274
|
-
const ctx =
|
3520
|
+
const ctx = useContext6(dropZoneContext);
|
3275
3521
|
const {
|
3276
3522
|
// These all need setting via context
|
3277
3523
|
data,
|
3278
3524
|
config,
|
3279
3525
|
areaId,
|
3280
|
-
draggedItem,
|
3281
3526
|
registerZoneArea,
|
3282
3527
|
depth,
|
3283
3528
|
registerLocalZone,
|
3284
3529
|
unregisterLocalZone,
|
3285
|
-
deepestZone = rootDroppableId,
|
3286
|
-
deepestArea,
|
3287
|
-
nextDeepestArea,
|
3288
3530
|
path = [],
|
3289
3531
|
activeZones
|
3290
3532
|
} = ctx;
|
3291
|
-
const { itemSelector } = appContext2.state.ui;
|
3292
3533
|
let zoneCompound = rootDroppableId;
|
3293
|
-
|
3534
|
+
if (areaId) {
|
3535
|
+
if (zone !== rootDroppableId) {
|
3536
|
+
zoneCompound = `${areaId}:${zone}`;
|
3537
|
+
}
|
3538
|
+
}
|
3539
|
+
const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
|
3540
|
+
const {
|
3541
|
+
isDeepestZone,
|
3542
|
+
inNextDeepestArea,
|
3543
|
+
draggedComponentType,
|
3544
|
+
userIsDragging,
|
3545
|
+
preview
|
3546
|
+
} = useContextStore(ZoneStoreContext, (s) => {
|
3547
|
+
var _a, _b, _c;
|
3548
|
+
return {
|
3549
|
+
isDeepestZone: (_a = s.zoneDepthIndex[zoneCompound]) != null ? _a : false,
|
3550
|
+
inNextDeepestArea: s.nextAreaDepthIndex[areaId || ""],
|
3551
|
+
draggedItemId: (_b = s.draggedItem) == null ? void 0 : _b.id,
|
3552
|
+
draggedComponentType: (_c = s.draggedItem) == null ? void 0 : _c.data.componentType,
|
3553
|
+
userIsDragging: !!s.draggedItem,
|
3554
|
+
preview: s.previewIndex[zoneCompound]
|
3555
|
+
};
|
3556
|
+
});
|
3557
|
+
const { itemSelector } = appContext2.state.ui;
|
3558
|
+
useEffect14(() => {
|
3294
3559
|
if (areaId && registerZoneArea) {
|
3295
3560
|
registerZoneArea(areaId);
|
3296
3561
|
}
|
3297
3562
|
}, [areaId]);
|
3298
|
-
|
3563
|
+
useEffect14(() => {
|
3299
3564
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
3300
3565
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
3301
3566
|
}
|
@@ -3305,25 +3570,18 @@ var DropZoneEdit = forwardRef3(
|
|
3305
3570
|
}
|
3306
3571
|
};
|
3307
3572
|
}, []);
|
3308
|
-
|
3309
|
-
if (zone !== rootDroppableId) {
|
3310
|
-
zoneCompound = `${areaId}:${zone}`;
|
3311
|
-
}
|
3312
|
-
}
|
3313
|
-
const content = useMemo7(() => {
|
3573
|
+
const content = useMemo8(() => {
|
3314
3574
|
if (areaId && zone !== rootDroppableId) {
|
3315
3575
|
return setupZone(data, zoneCompound).zones[zoneCompound];
|
3316
3576
|
}
|
3317
3577
|
return data.content || [];
|
3318
3578
|
}, [data, zoneCompound]);
|
3319
|
-
const ref =
|
3320
|
-
const acceptsTarget =
|
3321
|
-
(
|
3322
|
-
if (!
|
3579
|
+
const ref = useRef3(null);
|
3580
|
+
const acceptsTarget = useCallback10(
|
3581
|
+
(componentType) => {
|
3582
|
+
if (!componentType) {
|
3323
3583
|
return true;
|
3324
3584
|
}
|
3325
|
-
const data2 = target.data;
|
3326
|
-
const { componentType } = data2;
|
3327
3585
|
if (disallow) {
|
3328
3586
|
const defaultedAllow = allow || [];
|
3329
3587
|
const filteredDisallow = (disallow || []).filter(
|
@@ -3341,49 +3599,26 @@ var DropZoneEdit = forwardRef3(
|
|
3341
3599
|
},
|
3342
3600
|
[allow, disallow]
|
3343
3601
|
);
|
3344
|
-
|
3602
|
+
useEffect14(() => {
|
3345
3603
|
if (registerLocalZone) {
|
3346
|
-
registerLocalZone(zoneCompound, acceptsTarget(
|
3604
|
+
registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
|
3347
3605
|
}
|
3348
3606
|
return () => {
|
3349
3607
|
if (unregisterLocalZone) {
|
3350
3608
|
unregisterLocalZone(zoneCompound);
|
3351
3609
|
}
|
3352
3610
|
};
|
3353
|
-
}, [
|
3354
|
-
const
|
3355
|
-
const hoveringOverArea = nextDeepestArea ? nextDeepestArea === areaId : isRootZone;
|
3356
|
-
const userIsDragging = !!draggedItem;
|
3611
|
+
}, [draggedComponentType, zoneCompound]);
|
3612
|
+
const hoveringOverArea = inNextDeepestArea || isRootZone;
|
3357
3613
|
let isEnabled = true;
|
3358
|
-
if (
|
3359
|
-
isEnabled =
|
3614
|
+
if (userIsDragging) {
|
3615
|
+
isEnabled = isDeepestZone;
|
3360
3616
|
}
|
3361
3617
|
if (isEnabled) {
|
3362
|
-
isEnabled = acceptsTarget(
|
3363
|
-
}
|
3364
|
-
const
|
3365
|
-
const
|
3366
|
-
const contentWithPreview = useMemo7(() => {
|
3367
|
-
let contentWithPreview2 = preview ? content.filter((item) => item.props.id !== preview.props.id) : content;
|
3368
|
-
if (previewInZone) {
|
3369
|
-
contentWithPreview2 = content.filter(
|
3370
|
-
(item) => item.props.id !== preview.props.id
|
3371
|
-
);
|
3372
|
-
if (preview.type === "insert") {
|
3373
|
-
contentWithPreview2 = insert(contentWithPreview2, preview.index, {
|
3374
|
-
type: "preview",
|
3375
|
-
props: { id: preview.props.id }
|
3376
|
-
});
|
3377
|
-
} else {
|
3378
|
-
contentWithPreview2 = insert(contentWithPreview2, preview.index, {
|
3379
|
-
type: preview.componentType,
|
3380
|
-
props: preview.props
|
3381
|
-
});
|
3382
|
-
}
|
3383
|
-
}
|
3384
|
-
return contentWithPreview2;
|
3385
|
-
}, [preview, content]);
|
3386
|
-
const isDropEnabled = isEnabled && (previewInZone ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
|
3618
|
+
isEnabled = acceptsTarget(draggedComponentType);
|
3619
|
+
}
|
3620
|
+
const contentWithPreview = useContentWithPreview(content, zoneCompound);
|
3621
|
+
const isDropEnabled = isEnabled && (preview ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
|
3387
3622
|
const droppableConfig = {
|
3388
3623
|
id: zoneCompound,
|
3389
3624
|
collisionPriority: isEnabled ? depth : 0,
|
@@ -3393,45 +3628,20 @@ var DropZoneEdit = forwardRef3(
|
|
3393
3628
|
data: {
|
3394
3629
|
areaId,
|
3395
3630
|
depth,
|
3396
|
-
isDroppableTarget: acceptsTarget(
|
3631
|
+
isDroppableTarget: acceptsTarget(draggedComponentType),
|
3397
3632
|
path
|
3398
3633
|
}
|
3399
3634
|
};
|
3400
3635
|
const { ref: dropRef } = useDroppableSafe(droppableConfig);
|
3401
3636
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
3402
3637
|
const isAreaSelected = selectedItem && areaId === selectedItem.props.id;
|
3403
|
-
const [dragAxis
|
3404
|
-
collisionAxis || DEFAULT_DRAG_AXIS
|
3405
|
-
);
|
3406
|
-
const calculateDragAxis = useCallback8(() => {
|
3407
|
-
if (ref.current) {
|
3408
|
-
const computedStyle = window.getComputedStyle(ref.current);
|
3409
|
-
if (computedStyle.display === "grid") {
|
3410
|
-
setDragAxis(GRID_DRAG_AXIS);
|
3411
|
-
} else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
|
3412
|
-
setDragAxis(FLEX_ROW_DRAG_AXIS);
|
3413
|
-
} else {
|
3414
|
-
setDragAxis(DEFAULT_DRAG_AXIS);
|
3415
|
-
}
|
3416
|
-
}
|
3417
|
-
}, [ref.current]);
|
3418
|
-
useEffect12(calculateDragAxis, [appContext2.status, collisionAxis]);
|
3419
|
-
useEffect12(() => {
|
3420
|
-
const onViewportChange = () => {
|
3421
|
-
calculateDragAxis();
|
3422
|
-
};
|
3423
|
-
window.addEventListener("viewportchange", onViewportChange);
|
3424
|
-
return () => {
|
3425
|
-
window.removeEventListener("viewportchange", onViewportChange);
|
3426
|
-
};
|
3427
|
-
}, []);
|
3638
|
+
const [dragAxis] = useDragAxis(ref, collisionAxis);
|
3428
3639
|
const [minEmptyHeight, isAnimating] = useMinEmptyHeight({
|
3429
|
-
draggedItem,
|
3430
3640
|
zoneCompound,
|
3431
3641
|
userMinEmptyHeight,
|
3432
3642
|
ref
|
3433
3643
|
});
|
3434
|
-
return /* @__PURE__ */
|
3644
|
+
return /* @__PURE__ */ jsx22(
|
3435
3645
|
"div",
|
3436
3646
|
{
|
3437
3647
|
className: `${getClassName17({
|
@@ -3451,88 +3661,83 @@ var DropZoneEdit = forwardRef3(
|
|
3451
3661
|
"data-puck-dropzone": zoneCompound,
|
3452
3662
|
"data-puck-dnd": zoneCompound,
|
3453
3663
|
style: __spreadProps(__spreadValues({}, style), {
|
3454
|
-
"--min-empty-height": `${minEmptyHeight}px
|
3664
|
+
"--min-empty-height": `${minEmptyHeight}px`,
|
3665
|
+
backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
|
3455
3666
|
}),
|
3456
|
-
children:
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
|
3465
|
-
|
3466
|
-
|
3467
|
-
|
3667
|
+
children: contentWithPreview.map((item, i) => {
|
3668
|
+
var _a, _b, _c, _d, _e;
|
3669
|
+
const componentId = item.props.id;
|
3670
|
+
const puckProps = {
|
3671
|
+
renderDropZone: DropZone,
|
3672
|
+
isEditing: true,
|
3673
|
+
dragRef: null
|
3674
|
+
};
|
3675
|
+
const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
|
3676
|
+
puck: puckProps,
|
3677
|
+
editMode: true
|
3678
|
+
// DEPRECATED
|
3679
|
+
});
|
3680
|
+
const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
|
3681
|
+
let Render2 = config.components[item.type] && item.type !== "preview" ? config.components[item.type].render : () => /* @__PURE__ */ jsxs10("div", { style: { padding: 48, textAlign: "center" }, children: [
|
3682
|
+
"No configuration for ",
|
3683
|
+
item.type
|
3684
|
+
] });
|
3685
|
+
const componentConfig = config.components[item.type];
|
3686
|
+
let componentType = item.type;
|
3687
|
+
let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
3688
|
+
if (item.type === "preview" && preview) {
|
3689
|
+
let Preview4 = function() {
|
3690
|
+
return /* @__PURE__ */ jsx22(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
|
3468
3691
|
};
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3481
|
-
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
|
3495
|
-
|
3496
|
-
|
3497
|
-
|
3498
|
-
id: componentId,
|
3499
|
-
componentType,
|
3500
|
-
zoneCompound,
|
3501
|
-
depth: depth + 1,
|
3502
|
-
index: i,
|
3503
|
-
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
3504
|
-
isSelected,
|
3505
|
-
label,
|
3506
|
-
isEnabled,
|
3507
|
-
autoDragAxis: dragAxis,
|
3508
|
-
userDragAxis: collisionAxis,
|
3509
|
-
inDroppableZone: acceptsTarget(draggedItem),
|
3510
|
-
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ jsx21(
|
3511
|
-
Render2,
|
3512
|
-
__spreadProps(__spreadValues({}, defaultedProps), {
|
3513
|
-
puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
|
3514
|
-
dragRef
|
3515
|
-
})
|
3692
|
+
var Preview3 = Preview4;
|
3693
|
+
componentType = preview.componentType;
|
3694
|
+
label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
|
3695
|
+
Render2 = Preview4;
|
3696
|
+
}
|
3697
|
+
return /* @__PURE__ */ jsx22(
|
3698
|
+
DropZoneProvider,
|
3699
|
+
{
|
3700
|
+
value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
|
3701
|
+
children: /* @__PURE__ */ jsx22(
|
3702
|
+
DraggableComponent,
|
3703
|
+
{
|
3704
|
+
id: componentId,
|
3705
|
+
componentType,
|
3706
|
+
zoneCompound,
|
3707
|
+
depth: depth + 1,
|
3708
|
+
index: i,
|
3709
|
+
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
3710
|
+
isSelected,
|
3711
|
+
label,
|
3712
|
+
isEnabled,
|
3713
|
+
autoDragAxis: dragAxis,
|
3714
|
+
userDragAxis: collisionAxis,
|
3715
|
+
inDroppableZone: acceptsTarget(draggedComponentType),
|
3716
|
+
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ jsx22(
|
3717
|
+
Render2,
|
3718
|
+
__spreadProps(__spreadValues({}, defaultedProps), {
|
3719
|
+
puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
|
3720
|
+
dragRef
|
3516
3721
|
})
|
3517
|
-
|
3518
|
-
}
|
3519
|
-
|
3520
|
-
|
3521
|
-
|
3522
|
-
|
3523
|
-
|
3524
|
-
|
3722
|
+
})
|
3723
|
+
) : /* @__PURE__ */ jsx22("div", { ref: dragRef, children: /* @__PURE__ */ jsx22(Render2, __spreadValues({}, defaultedProps)) })
|
3724
|
+
}
|
3725
|
+
)
|
3726
|
+
},
|
3727
|
+
componentId
|
3728
|
+
);
|
3729
|
+
})
|
3525
3730
|
}
|
3526
3731
|
);
|
3527
3732
|
}
|
3528
3733
|
);
|
3529
3734
|
var DropZoneRender = forwardRef3(
|
3530
3735
|
function DropZoneRender2({ className, style, zone }, ref) {
|
3531
|
-
const ctx =
|
3736
|
+
const ctx = useContext6(dropZoneContext);
|
3532
3737
|
const { data, areaId = "root", config } = ctx || {};
|
3533
3738
|
let zoneCompound = rootDroppableId;
|
3534
3739
|
let content = (data == null ? void 0 : data.content) || [];
|
3535
|
-
|
3740
|
+
useEffect14(() => {
|
3536
3741
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
3537
3742
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
3538
3743
|
}
|
@@ -3549,10 +3754,10 @@ var DropZoneRender = forwardRef3(
|
|
3549
3754
|
zoneCompound = `${areaId}:${zone}`;
|
3550
3755
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
3551
3756
|
}
|
3552
|
-
return /* @__PURE__ */
|
3757
|
+
return /* @__PURE__ */ jsx22("div", { className, style, ref, children: content.map((item) => {
|
3553
3758
|
const Component = config.components[item.type];
|
3554
3759
|
if (Component) {
|
3555
|
-
return /* @__PURE__ */
|
3760
|
+
return /* @__PURE__ */ jsx22(
|
3556
3761
|
DropZoneProvider,
|
3557
3762
|
{
|
3558
3763
|
value: {
|
@@ -3562,7 +3767,7 @@ var DropZoneRender = forwardRef3(
|
|
3562
3767
|
depth: 1,
|
3563
3768
|
path: []
|
3564
3769
|
},
|
3565
|
-
children: /* @__PURE__ */
|
3770
|
+
children: /* @__PURE__ */ jsx22(
|
3566
3771
|
Component.render,
|
3567
3772
|
__spreadProps(__spreadValues({}, item.props), {
|
3568
3773
|
puck: { renderDropZone: DropZoneRender2 }
|
@@ -3578,11 +3783,11 @@ var DropZoneRender = forwardRef3(
|
|
3578
3783
|
);
|
3579
3784
|
var DropZone = forwardRef3(
|
3580
3785
|
function DropZone2(props, ref) {
|
3581
|
-
const ctx =
|
3786
|
+
const ctx = useContext6(dropZoneContext);
|
3582
3787
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
3583
|
-
return /* @__PURE__ */
|
3788
|
+
return /* @__PURE__ */ jsx22(Fragment6, { children: /* @__PURE__ */ jsx22(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
3584
3789
|
}
|
3585
|
-
return /* @__PURE__ */
|
3790
|
+
return /* @__PURE__ */ jsx22(Fragment6, { children: /* @__PURE__ */ jsx22(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
3586
3791
|
}
|
3587
3792
|
);
|
3588
3793
|
|
@@ -3598,7 +3803,7 @@ var getZoneId = (zoneCompound) => {
|
|
3598
3803
|
return [rootDroppableId, zoneCompound];
|
3599
3804
|
};
|
3600
3805
|
|
3601
|
-
//
|
3806
|
+
// lib/dnd/NestedDroppablePlugin.ts
|
3602
3807
|
init_react_import();
|
3603
3808
|
import { Plugin } from "@dnd-kit/abstract";
|
3604
3809
|
import { effects } from "@dnd-kit/state";
|
@@ -3640,7 +3845,49 @@ var getFrame = () => {
|
|
3640
3845
|
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
3641
3846
|
};
|
3642
3847
|
|
3643
|
-
//
|
3848
|
+
// lib/global-position.ts
|
3849
|
+
init_react_import();
|
3850
|
+
var GlobalPosition = class {
|
3851
|
+
constructor(target, original) {
|
3852
|
+
this.scaleFactor = 1;
|
3853
|
+
this.frameEl = null;
|
3854
|
+
this.frameRect = null;
|
3855
|
+
var _a;
|
3856
|
+
this.target = target;
|
3857
|
+
this.original = original;
|
3858
|
+
this.frameEl = document.querySelector("iframe");
|
3859
|
+
if (this.frameEl) {
|
3860
|
+
this.frameRect = this.frameEl.getBoundingClientRect();
|
3861
|
+
this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
|
3862
|
+
}
|
3863
|
+
}
|
3864
|
+
get x() {
|
3865
|
+
return this.original.x;
|
3866
|
+
}
|
3867
|
+
get y() {
|
3868
|
+
return this.original.y;
|
3869
|
+
}
|
3870
|
+
get global() {
|
3871
|
+
if (document !== this.target.ownerDocument && this.frameRect) {
|
3872
|
+
return {
|
3873
|
+
x: this.x * this.scaleFactor + this.frameRect.left,
|
3874
|
+
y: this.y * this.scaleFactor + this.frameRect.top
|
3875
|
+
};
|
3876
|
+
}
|
3877
|
+
return this.original;
|
3878
|
+
}
|
3879
|
+
get frame() {
|
3880
|
+
if (document === this.target.ownerDocument && this.frameRect) {
|
3881
|
+
return {
|
3882
|
+
x: (this.x - this.frameRect.left) / this.scaleFactor,
|
3883
|
+
y: (this.y - this.frameRect.top) / this.scaleFactor
|
3884
|
+
};
|
3885
|
+
}
|
3886
|
+
return this.original;
|
3887
|
+
}
|
3888
|
+
};
|
3889
|
+
|
3890
|
+
// lib/dnd/NestedDroppablePlugin.ts
|
3644
3891
|
var depthSort = (candidates) => {
|
3645
3892
|
return candidates.sort((a, b) => {
|
3646
3893
|
const aData = a.data;
|
@@ -3669,10 +3916,12 @@ var getZoneId2 = (candidate) => {
|
|
3669
3916
|
}
|
3670
3917
|
return id;
|
3671
3918
|
};
|
3672
|
-
var getPointerCollisions = (position, manager
|
3673
|
-
var _a;
|
3919
|
+
var getPointerCollisions = (position, manager) => {
|
3674
3920
|
const candidates = [];
|
3675
|
-
let elements = ownerDocument.elementsFromPoint(
|
3921
|
+
let elements = position.target.ownerDocument.elementsFromPoint(
|
3922
|
+
position.x,
|
3923
|
+
position.y
|
3924
|
+
);
|
3676
3925
|
const previewFrame = elements.find(
|
3677
3926
|
(el) => el.getAttribute("data-puck-preview")
|
3678
3927
|
);
|
@@ -3681,17 +3930,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
|
|
3681
3930
|
elements = [drawer];
|
3682
3931
|
}
|
3683
3932
|
if (previewFrame) {
|
3684
|
-
const
|
3685
|
-
if (
|
3686
|
-
|
3687
|
-
const frame = getFrame();
|
3688
|
-
if (frame) {
|
3689
|
-
const scaleFactor = rect.width / (((_a = iframe.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
|
3690
|
-
elements = frame.elementsFromPoint(
|
3691
|
-
(position.x - rect.left) / scaleFactor,
|
3692
|
-
(position.y - rect.top) / scaleFactor
|
3693
|
-
);
|
3694
|
-
}
|
3933
|
+
const frame = getFrame();
|
3934
|
+
if (frame) {
|
3935
|
+
elements = frame.elementsFromPoint(position.frame.x, position.frame.y);
|
3695
3936
|
}
|
3696
3937
|
}
|
3697
3938
|
if (elements) {
|
@@ -3708,9 +3949,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
|
|
3708
3949
|
}
|
3709
3950
|
return candidates;
|
3710
3951
|
};
|
3711
|
-
var findDeepestCandidate = (position, manager
|
3952
|
+
var findDeepestCandidate = (position, manager) => {
|
3712
3953
|
var _a;
|
3713
|
-
const candidates = getPointerCollisions(position, manager
|
3954
|
+
const candidates = getPointerCollisions(position, manager);
|
3714
3955
|
if (candidates.length > 0) {
|
3715
3956
|
const sortedCandidates = depthSort(candidates);
|
3716
3957
|
const draggable = manager.dragOperation.source;
|
@@ -3755,9 +3996,7 @@ var findDeepestCandidate = (position, manager, ownerDocument) => {
|
|
3755
3996
|
area: null
|
3756
3997
|
};
|
3757
3998
|
};
|
3758
|
-
var createNestedDroppablePlugin = ({
|
3759
|
-
onChange
|
3760
|
-
}) => class NestedDroppablePlugin extends Plugin {
|
3999
|
+
var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends Plugin {
|
3761
4000
|
constructor(manager, options) {
|
3762
4001
|
super(manager);
|
3763
4002
|
if (typeof window === "undefined") {
|
@@ -3765,16 +4004,19 @@ var createNestedDroppablePlugin = ({
|
|
3765
4004
|
}
|
3766
4005
|
const cleanupEffect = effects(() => {
|
3767
4006
|
const handleMove = (event) => {
|
3768
|
-
const
|
4007
|
+
const target = event.originalTarget || event.target;
|
4008
|
+
const position = new GlobalPosition(target, {
|
3769
4009
|
x: event.clientX,
|
3770
4010
|
y: event.clientY
|
3771
|
-
};
|
3772
|
-
const
|
3773
|
-
|
3774
|
-
|
3775
|
-
findDeepestCandidate(position, manager, ownerDocument),
|
3776
|
-
manager
|
4011
|
+
});
|
4012
|
+
const elements = document.elementsFromPoint(
|
4013
|
+
position.global.x,
|
4014
|
+
position.global.y
|
3777
4015
|
);
|
4016
|
+
const overEl = elements.some((el) => el.id === id);
|
4017
|
+
if (overEl) {
|
4018
|
+
onChange(findDeepestCandidate(position, manager), manager);
|
4019
|
+
}
|
3778
4020
|
};
|
3779
4021
|
const handleMoveThrottled = throttle(handleMove, 50);
|
3780
4022
|
const handlePointerMove = (event) => {
|
@@ -4191,7 +4433,7 @@ var insertComponent = (componentType, zone, index, {
|
|
4191
4433
|
import { useDebouncedCallback as useDebouncedCallback2 } from "use-debounce";
|
4192
4434
|
import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
|
4193
4435
|
|
4194
|
-
//
|
4436
|
+
// lib/dnd/PointerSensor.ts
|
4195
4437
|
init_react_import();
|
4196
4438
|
import { batch, effect } from "@dnd-kit/state";
|
4197
4439
|
import { Sensor, configurator } from "@dnd-kit/abstract";
|
@@ -4462,13 +4704,15 @@ function patchWindow(window2) {
|
|
4462
4704
|
}
|
4463
4705
|
|
4464
4706
|
// components/DragDropContext/index.tsx
|
4465
|
-
import {
|
4466
|
-
|
4707
|
+
import { createStore as createStore3 } from "zustand";
|
4708
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
4709
|
+
var DEBUG3 = false;
|
4710
|
+
var dragListenerContext = createContext4({
|
4467
4711
|
dragListeners: {}
|
4468
4712
|
});
|
4469
4713
|
function useDragListener(type, fn, deps = []) {
|
4470
|
-
const { setDragListeners } =
|
4471
|
-
|
4714
|
+
const { setDragListeners } = useContext7(dragListenerContext);
|
4715
|
+
useEffect15(() => {
|
4472
4716
|
if (setDragListeners) {
|
4473
4717
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
4474
4718
|
[type]: [...old[type] || [], fn]
|
@@ -4476,80 +4720,147 @@ function useDragListener(type, fn, deps = []) {
|
|
4476
4720
|
}
|
4477
4721
|
}, deps);
|
4478
4722
|
}
|
4479
|
-
var previewContext = createContext3(null);
|
4480
4723
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
4724
|
+
var useTempDisableFallback = (timeout3) => {
|
4725
|
+
const lastFallbackDisable = useRef4(null);
|
4726
|
+
return useCallback11((manager) => {
|
4727
|
+
collisionStore.setState({ fallbackEnabled: false });
|
4728
|
+
const fallbackId = generateId();
|
4729
|
+
lastFallbackDisable.current = fallbackId;
|
4730
|
+
setTimeout(() => {
|
4731
|
+
if (lastFallbackDisable.current === fallbackId) {
|
4732
|
+
collisionStore.setState({ fallbackEnabled: true });
|
4733
|
+
manager.collisionObserver.forceUpdate(true);
|
4734
|
+
}
|
4735
|
+
}, timeout3);
|
4736
|
+
}, []);
|
4737
|
+
};
|
4481
4738
|
var DragDropContextClient = ({
|
4482
4739
|
children,
|
4483
4740
|
disableAutoScroll
|
4484
4741
|
}) => {
|
4485
4742
|
const { state, config, dispatch, resolveData } = useAppContext();
|
4486
|
-
const
|
4487
|
-
const previewRef = useRef5(null);
|
4743
|
+
const id = useId();
|
4488
4744
|
const { data } = state;
|
4489
|
-
const
|
4490
|
-
const
|
4491
|
-
const
|
4492
|
-
|
4493
|
-
|
4745
|
+
const debouncedParamsRef = useRef4(null);
|
4746
|
+
const tempDisableFallback = useTempDisableFallback(100);
|
4747
|
+
const [zoneStore] = useState17(
|
4748
|
+
() => createStore3(() => ({
|
4749
|
+
zoneDepthIndex: {},
|
4750
|
+
nextZoneDepthIndex: {},
|
4751
|
+
areaDepthIndex: {},
|
4752
|
+
nextAreaDepthIndex: {},
|
4753
|
+
draggedItem: null,
|
4754
|
+
previewIndex: {}
|
4755
|
+
}))
|
4756
|
+
);
|
4757
|
+
const getChanged2 = useCallback11(
|
4758
|
+
(params, id2) => {
|
4759
|
+
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
4760
|
+
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
4761
|
+
const stateHasArea = Object.keys(areaDepthIndex).length > 0;
|
4762
|
+
let zoneChanged = false;
|
4763
|
+
let areaChanged = false;
|
4764
|
+
if (params.zone && !zoneDepthIndex[params.zone]) {
|
4765
|
+
zoneChanged = true;
|
4766
|
+
} else if (!params.zone && stateHasZone) {
|
4767
|
+
zoneChanged = true;
|
4768
|
+
}
|
4769
|
+
if (params.area && !areaDepthIndex[params.area]) {
|
4770
|
+
areaChanged = true;
|
4771
|
+
} else if (!params.area && stateHasArea) {
|
4772
|
+
areaChanged = true;
|
4773
|
+
}
|
4774
|
+
return { zoneChanged, areaChanged };
|
4775
|
+
},
|
4776
|
+
[zoneStore]
|
4777
|
+
);
|
4778
|
+
const setDeepestAndCollide = useCallback11(
|
4494
4779
|
(params, manager) => {
|
4495
|
-
|
4780
|
+
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
4781
|
+
if (!zoneChanged && !areaChanged) return;
|
4782
|
+
zoneStore.setState({
|
4783
|
+
zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
|
4784
|
+
areaDepthIndex: params.area ? { [params.area]: true } : {}
|
4785
|
+
});
|
4786
|
+
tempDisableFallback(manager);
|
4496
4787
|
setTimeout(() => {
|
4497
4788
|
manager.collisionObserver.forceUpdate(true);
|
4498
4789
|
}, 50);
|
4499
4790
|
debouncedParamsRef.current = null;
|
4500
4791
|
},
|
4501
|
-
[]
|
4792
|
+
[zoneStore]
|
4502
4793
|
);
|
4503
4794
|
const setDeepestDb = useDebouncedCallback2(
|
4504
4795
|
setDeepestAndCollide,
|
4505
4796
|
AREA_CHANGE_DEBOUNCE_MS
|
4506
4797
|
);
|
4507
|
-
useEffect13(() => {
|
4508
|
-
deepestRef.current = deepest;
|
4509
|
-
}, [deepest]);
|
4510
4798
|
const cancelDb = () => {
|
4511
4799
|
setDeepestDb.cancel();
|
4512
4800
|
debouncedParamsRef.current = null;
|
4513
4801
|
};
|
4514
|
-
|
4515
|
-
|
4516
|
-
|
4517
|
-
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4521
|
-
|
4522
|
-
|
4523
|
-
|
4524
|
-
}
|
4525
|
-
if (params.zone !== "void" && (lastParams == null ? void 0 : lastParams.zone) === "void") {
|
4526
|
-
setDeepest(params);
|
4527
|
-
manager.collisionObserver.forceUpdate(true);
|
4528
|
-
return;
|
4802
|
+
useEffect15(() => {
|
4803
|
+
if (DEBUG3) {
|
4804
|
+
zoneStore.subscribe(
|
4805
|
+
(s) => {
|
4806
|
+
var _a, _b;
|
4807
|
+
return console.log(
|
4808
|
+
s.previewIndex,
|
4809
|
+
(_a = Object.entries(s.zoneDepthIndex || {})[0]) == null ? void 0 : _a[0],
|
4810
|
+
(_b = Object.entries(s.areaDepthIndex || {})[0]) == null ? void 0 : _b[0]
|
4811
|
+
);
|
4529
4812
|
}
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4813
|
+
);
|
4814
|
+
}
|
4815
|
+
}, []);
|
4816
|
+
const [plugins] = useState17(() => [
|
4817
|
+
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
4818
|
+
createNestedDroppablePlugin(
|
4819
|
+
{
|
4820
|
+
onChange: (params, manager) => {
|
4821
|
+
const state2 = zoneStore.getState();
|
4822
|
+
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
4823
|
+
const isDragging = manager.dragOperation.status.dragging;
|
4824
|
+
if (areaChanged || zoneChanged) {
|
4825
|
+
let nextZoneDepthIndex = {};
|
4826
|
+
let nextAreaDepthIndex = {};
|
4827
|
+
if (params.zone) {
|
4828
|
+
nextZoneDepthIndex = { [params.zone]: true };
|
4829
|
+
}
|
4830
|
+
if (params.area) {
|
4831
|
+
nextAreaDepthIndex = { [params.area]: true };
|
4832
|
+
}
|
4833
|
+
zoneStore.setState({ nextZoneDepthIndex, nextAreaDepthIndex });
|
4834
|
+
}
|
4835
|
+
if (params.zone !== "void" && (state2 == null ? void 0 : state2.zoneDepthIndex["void"])) {
|
4836
|
+
setDeepestAndCollide(params, manager);
|
4837
|
+
return;
|
4838
|
+
}
|
4839
|
+
if (areaChanged) {
|
4840
|
+
if (isDragging) {
|
4841
|
+
const debouncedParams = debouncedParamsRef.current;
|
4842
|
+
const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
|
4843
|
+
if (!isSameParams) {
|
4844
|
+
cancelDb();
|
4845
|
+
setDeepestDb(params, manager);
|
4846
|
+
debouncedParamsRef.current = params;
|
4847
|
+
}
|
4848
|
+
} else {
|
4535
4849
|
cancelDb();
|
4536
|
-
|
4537
|
-
debouncedParamsRef.current = params;
|
4850
|
+
setDeepestAndCollide(params, manager);
|
4538
4851
|
}
|
4539
|
-
|
4540
|
-
|
4852
|
+
return;
|
4853
|
+
}
|
4854
|
+
if (zoneChanged) {
|
4541
4855
|
setDeepestAndCollide(params, manager);
|
4542
4856
|
}
|
4543
|
-
|
4857
|
+
cancelDb();
|
4544
4858
|
}
|
4545
|
-
|
4546
|
-
|
4547
|
-
|
4548
|
-
cancelDb();
|
4549
|
-
}
|
4550
|
-
})
|
4859
|
+
},
|
4860
|
+
id
|
4861
|
+
)
|
4551
4862
|
]);
|
4552
|
-
const [sensors] =
|
4863
|
+
const [sensors] = useState17(() => [
|
4553
4864
|
PointerSensor.configure({
|
4554
4865
|
activationConstraints(event, source) {
|
4555
4866
|
var _a;
|
@@ -4568,11 +4879,10 @@ var DragDropContextClient = ({
|
|
4568
4879
|
}
|
4569
4880
|
})
|
4570
4881
|
]);
|
4571
|
-
const [
|
4572
|
-
const [
|
4573
|
-
const
|
4574
|
-
const
|
4575
|
-
const registerPath = useCallback9(
|
4882
|
+
const [dragListeners, setDragListeners] = useState17({});
|
4883
|
+
const [pathData, setPathData] = useState17();
|
4884
|
+
const dragMode = useRef4(null);
|
4885
|
+
const registerPath = useCallback11(
|
4576
4886
|
(selector) => {
|
4577
4887
|
const item = getItem(selector, data);
|
4578
4888
|
if (!item) {
|
@@ -4594,41 +4904,41 @@ var DragDropContextClient = ({
|
|
4594
4904
|
},
|
4595
4905
|
[data, setPathData]
|
4596
4906
|
);
|
4597
|
-
const initialSelector =
|
4598
|
-
return /* @__PURE__ */
|
4907
|
+
const initialSelector = useRef4(void 0);
|
4908
|
+
return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
|
4599
4909
|
dragListenerContext.Provider,
|
4600
4910
|
{
|
4601
4911
|
value: {
|
4602
4912
|
dragListeners,
|
4603
4913
|
setDragListeners
|
4604
4914
|
},
|
4605
|
-
children: /* @__PURE__ */
|
4915
|
+
children: /* @__PURE__ */ jsx23(
|
4606
4916
|
DragDropProvider2,
|
4607
4917
|
{
|
4608
4918
|
plugins,
|
4609
4919
|
sensors,
|
4610
4920
|
onDragEnd: (event, manager) => {
|
4921
|
+
var _a;
|
4611
4922
|
const { source, target } = event.operation;
|
4612
|
-
deepestRef.current = null;
|
4613
4923
|
if (!source) {
|
4614
|
-
|
4924
|
+
zoneStore.setState({ draggedItem: null });
|
4615
4925
|
return;
|
4616
4926
|
}
|
4617
4927
|
const { zone, index } = source.data;
|
4618
|
-
const
|
4619
|
-
|
4928
|
+
const { previewIndex = {} } = zoneStore.getState() || {};
|
4929
|
+
const thisPreview = ((_a = previewIndex[zone]) == null ? void 0 : _a.props.id) === source.id ? previewIndex[zone] : null;
|
4620
4930
|
setTimeout(() => {
|
4621
|
-
var
|
4622
|
-
|
4931
|
+
var _a2, _b;
|
4932
|
+
zoneStore.setState({ draggedItem: null });
|
4623
4933
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
4624
|
-
|
4625
|
-
(
|
4934
|
+
zoneStore.setState({ previewIndex: {} });
|
4935
|
+
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
4626
4936
|
fn(event, manager);
|
4627
4937
|
});
|
4628
4938
|
return;
|
4629
4939
|
}
|
4630
4940
|
if (thisPreview) {
|
4631
|
-
|
4941
|
+
zoneStore.setState({ previewIndex: {} });
|
4632
4942
|
if (thisPreview.type === "insert") {
|
4633
4943
|
insertComponent(
|
4634
4944
|
thisPreview.componentType,
|
@@ -4663,8 +4973,9 @@ var DragDropContextClient = ({
|
|
4663
4973
|
}, 250);
|
4664
4974
|
},
|
4665
4975
|
onDragOver: (event, manager) => {
|
4666
|
-
var _a, _b, _c, _d;
|
4976
|
+
var _a, _b, _c, _d, _e;
|
4667
4977
|
event.preventDefault();
|
4978
|
+
const draggedItem = (_a = zoneStore.getState()) == null ? void 0 : _a.draggedItem;
|
4668
4979
|
if (!draggedItem) return;
|
4669
4980
|
cancelDb();
|
4670
4981
|
const { source, target } = event.operation;
|
@@ -4680,7 +4991,7 @@ var DragDropContextClient = ({
|
|
4680
4991
|
const targetData = target.data;
|
4681
4992
|
targetZone = targetData.zone;
|
4682
4993
|
targetIndex = targetData.index;
|
4683
|
-
const collisionData = (
|
4994
|
+
const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
|
4684
4995
|
const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
|
4685
4996
|
if (targetIndex >= sourceIndex && sourceZone === targetZone) {
|
4686
4997
|
targetIndex = targetIndex - 1;
|
@@ -4692,23 +5003,26 @@ var DragDropContextClient = ({
|
|
4692
5003
|
targetZone = target.id.toString();
|
4693
5004
|
targetIndex = 0;
|
4694
5005
|
}
|
4695
|
-
if (targetId === sourceId || ((
|
5006
|
+
if (targetId === sourceId || ((_d = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _d.path.find((path) => {
|
4696
5007
|
const [pathId] = path.split(":");
|
4697
5008
|
return pathId === sourceId;
|
4698
5009
|
}))) {
|
4699
5010
|
return;
|
4700
5011
|
}
|
4701
5012
|
if (dragMode.current === "new") {
|
4702
|
-
|
4703
|
-
|
4704
|
-
|
4705
|
-
|
4706
|
-
|
4707
|
-
|
4708
|
-
|
5013
|
+
zoneStore.setState({
|
5014
|
+
previewIndex: {
|
5015
|
+
[targetZone]: {
|
5016
|
+
componentType: sourceData.componentType,
|
5017
|
+
type: "insert",
|
5018
|
+
index: targetIndex,
|
5019
|
+
zone: targetZone,
|
5020
|
+
props: {
|
5021
|
+
id: source.id.toString()
|
5022
|
+
}
|
5023
|
+
}
|
4709
5024
|
}
|
4710
|
-
};
|
4711
|
-
setPreview(previewRef.current);
|
5025
|
+
});
|
4712
5026
|
} else {
|
4713
5027
|
if (!initialSelector.current) {
|
4714
5028
|
initialSelector.current = {
|
@@ -4718,17 +5032,20 @@ var DragDropContextClient = ({
|
|
4718
5032
|
}
|
4719
5033
|
const item = getItem(initialSelector.current, data);
|
4720
5034
|
if (item) {
|
4721
|
-
|
4722
|
-
|
4723
|
-
|
4724
|
-
|
4725
|
-
|
4726
|
-
|
4727
|
-
|
4728
|
-
|
5035
|
+
zoneStore.setState({
|
5036
|
+
previewIndex: {
|
5037
|
+
[targetZone]: {
|
5038
|
+
componentType: sourceData.componentType,
|
5039
|
+
type: "move",
|
5040
|
+
index: targetIndex,
|
5041
|
+
zone: targetZone,
|
5042
|
+
props: item.props
|
5043
|
+
}
|
5044
|
+
}
|
5045
|
+
});
|
4729
5046
|
}
|
4730
5047
|
}
|
4731
|
-
(
|
5048
|
+
(_e = dragListeners.dragover) == null ? void 0 : _e.forEach((fn) => {
|
4732
5049
|
fn(event, manager);
|
4733
5050
|
});
|
4734
5051
|
},
|
@@ -4738,45 +5055,61 @@ var DragDropContextClient = ({
|
|
4738
5055
|
type: "setUi",
|
4739
5056
|
ui: { itemSelector: null, isDragging: true }
|
4740
5057
|
});
|
5058
|
+
const { source } = event.operation;
|
5059
|
+
if (source && source.type !== "void") {
|
5060
|
+
const sourceData = source.data;
|
5061
|
+
const item = getItem(
|
5062
|
+
{
|
5063
|
+
zone: sourceData.zone,
|
5064
|
+
index: sourceData.index
|
5065
|
+
},
|
5066
|
+
data
|
5067
|
+
);
|
5068
|
+
if (item) {
|
5069
|
+
zoneStore.setState({
|
5070
|
+
previewIndex: {
|
5071
|
+
[sourceData.zone]: {
|
5072
|
+
componentType: sourceData.componentType,
|
5073
|
+
type: "move",
|
5074
|
+
index: sourceData.index,
|
5075
|
+
zone: sourceData.zone,
|
5076
|
+
props: item.props
|
5077
|
+
}
|
5078
|
+
}
|
5079
|
+
});
|
5080
|
+
}
|
5081
|
+
}
|
4741
5082
|
(_a = dragListeners.dragstart) == null ? void 0 : _a.forEach((fn) => {
|
4742
5083
|
fn(event, manager);
|
4743
5084
|
});
|
4744
5085
|
},
|
4745
5086
|
onBeforeDragStart: (event) => {
|
4746
5087
|
var _a;
|
4747
|
-
if (draggedItem) {
|
4748
|
-
console.warn("New drag started before previous drag cleaned up");
|
4749
|
-
}
|
4750
5088
|
const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.data.type) === "drawer";
|
4751
5089
|
dragMode.current = isNewComponent ? "new" : "existing";
|
4752
5090
|
initialSelector.current = void 0;
|
4753
|
-
|
5091
|
+
zoneStore.setState({ draggedItem: event.operation.source });
|
4754
5092
|
},
|
4755
|
-
children: /* @__PURE__ */
|
5093
|
+
children: /* @__PURE__ */ jsx23(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx23(
|
4756
5094
|
DropZoneProvider,
|
4757
5095
|
{
|
4758
5096
|
value: {
|
4759
5097
|
data,
|
4760
5098
|
config,
|
4761
|
-
draggedItem,
|
4762
5099
|
mode: "edit",
|
4763
5100
|
areaId: "root",
|
4764
5101
|
depth: 0,
|
4765
5102
|
registerPath,
|
4766
5103
|
pathData,
|
4767
|
-
deepestZone: deepest == null ? void 0 : deepest.zone,
|
4768
|
-
deepestArea: deepest == null ? void 0 : deepest.area,
|
4769
|
-
nextDeepestZone: nextDeepest == null ? void 0 : nextDeepest.zone,
|
4770
|
-
nextDeepestArea: nextDeepest == null ? void 0 : nextDeepest.area,
|
4771
5104
|
path: []
|
4772
5105
|
},
|
4773
5106
|
children
|
4774
5107
|
}
|
4775
|
-
)
|
5108
|
+
) })
|
4776
5109
|
}
|
4777
|
-
)
|
5110
|
+
)
|
4778
5111
|
}
|
4779
|
-
);
|
5112
|
+
) });
|
4780
5113
|
};
|
4781
5114
|
var DragDropContext = ({
|
4782
5115
|
children,
|
@@ -4786,11 +5119,11 @@ var DragDropContext = ({
|
|
4786
5119
|
if (status === "LOADING") {
|
4787
5120
|
return children;
|
4788
5121
|
}
|
4789
|
-
return /* @__PURE__ */
|
5122
|
+
return /* @__PURE__ */ jsx23(DragDropContextClient, { disableAutoScroll, children });
|
4790
5123
|
};
|
4791
5124
|
|
4792
5125
|
// components/Drawer/index.tsx
|
4793
|
-
import { jsx as
|
5126
|
+
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
4794
5127
|
var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
|
4795
5128
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
4796
5129
|
var DrawerItemInner = ({
|
@@ -4800,11 +5133,11 @@ var DrawerItemInner = ({
|
|
4800
5133
|
dragRef,
|
4801
5134
|
isDragDisabled
|
4802
5135
|
}) => {
|
4803
|
-
const CustomInner =
|
4804
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */
|
5136
|
+
const CustomInner = useMemo9(
|
5137
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ jsx24("div", { className: getClassNameItem2("default"), children: children2 })),
|
4805
5138
|
[children]
|
4806
5139
|
);
|
4807
|
-
return /* @__PURE__ */
|
5140
|
+
return /* @__PURE__ */ jsx24(
|
4808
5141
|
"div",
|
4809
5142
|
{
|
4810
5143
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
@@ -4812,9 +5145,9 @@ var DrawerItemInner = ({
|
|
4812
5145
|
onMouseDown: (e) => e.preventDefault(),
|
4813
5146
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
4814
5147
|
"data-puck-drawer-item": true,
|
4815
|
-
children: /* @__PURE__ */
|
4816
|
-
/* @__PURE__ */
|
4817
|
-
/* @__PURE__ */
|
5148
|
+
children: /* @__PURE__ */ jsx24(CustomInner, { name, children: /* @__PURE__ */ jsx24("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs11("div", { className: getClassNameItem2("draggable"), children: [
|
5149
|
+
/* @__PURE__ */ jsx24("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
5150
|
+
/* @__PURE__ */ jsx24("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx24(DragIcon, {}) })
|
4818
5151
|
] }) }) })
|
4819
5152
|
}
|
4820
5153
|
);
|
@@ -4832,8 +5165,8 @@ var DrawerItemDraggable = ({
|
|
4832
5165
|
disabled: isDragDisabled
|
4833
5166
|
});
|
4834
5167
|
return /* @__PURE__ */ jsxs11("div", { className: getClassName18("draggable"), children: [
|
4835
|
-
/* @__PURE__ */
|
4836
|
-
/* @__PURE__ */
|
5168
|
+
/* @__PURE__ */ jsx24("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ jsx24(DrawerItemInner, { name, label, children }) }),
|
5169
|
+
/* @__PURE__ */ jsx24("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ jsx24(
|
4837
5170
|
DrawerItemInner,
|
4838
5171
|
{
|
4839
5172
|
name,
|
@@ -4854,7 +5187,7 @@ var DrawerItem = ({
|
|
4854
5187
|
isDragDisabled
|
4855
5188
|
}) => {
|
4856
5189
|
const resolvedId = id || name;
|
4857
|
-
const [dynamicId, setDynamicId] =
|
5190
|
+
const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
|
4858
5191
|
if (typeof index !== "undefined") {
|
4859
5192
|
console.error(
|
4860
5193
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -4867,7 +5200,7 @@ var DrawerItem = ({
|
|
4867
5200
|
},
|
4868
5201
|
[resolvedId]
|
4869
5202
|
);
|
4870
|
-
return /* @__PURE__ */
|
5203
|
+
return /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24(
|
4871
5204
|
DrawerItemDraggable,
|
4872
5205
|
{
|
4873
5206
|
name,
|
@@ -4893,14 +5226,14 @@ var Drawer = ({
|
|
4893
5226
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
4894
5227
|
);
|
4895
5228
|
}
|
4896
|
-
const [id] =
|
5229
|
+
const [id] = useState18(generateId());
|
4897
5230
|
const { ref } = useDroppableSafe({
|
4898
5231
|
id,
|
4899
5232
|
type: "void",
|
4900
5233
|
collisionPriority: 0
|
4901
5234
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
4902
5235
|
});
|
4903
|
-
return /* @__PURE__ */
|
5236
|
+
return /* @__PURE__ */ jsx24(
|
4904
5237
|
"div",
|
4905
5238
|
{
|
4906
5239
|
className: getClassName18(),
|
@@ -4916,11 +5249,11 @@ Drawer.Item = DrawerItem;
|
|
4916
5249
|
// components/Puck/index.tsx
|
4917
5250
|
init_react_import();
|
4918
5251
|
import {
|
4919
|
-
useCallback as
|
4920
|
-
useEffect as
|
4921
|
-
useMemo as
|
5252
|
+
useCallback as useCallback17,
|
5253
|
+
useEffect as useEffect23,
|
5254
|
+
useMemo as useMemo18,
|
4922
5255
|
useReducer,
|
4923
|
-
useState as
|
5256
|
+
useState as useState26
|
4924
5257
|
} from "react";
|
4925
5258
|
|
4926
5259
|
// components/SidebarSection/index.tsx
|
@@ -4932,7 +5265,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
|
|
4932
5265
|
|
4933
5266
|
// lib/use-breadcrumbs.ts
|
4934
5267
|
init_react_import();
|
4935
|
-
import { useContext as
|
5268
|
+
import { useContext as useContext8, useMemo as useMemo10 } from "react";
|
4936
5269
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
4937
5270
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
4938
5271
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -4982,8 +5315,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
4982
5315
|
state: { data },
|
4983
5316
|
selectedItem
|
4984
5317
|
} = useAppContext();
|
4985
|
-
const dzContext =
|
4986
|
-
return
|
5318
|
+
const dzContext = useContext8(dropZoneContext);
|
5319
|
+
return useMemo10(() => {
|
4987
5320
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
4988
5321
|
selectedItem,
|
4989
5322
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -4997,7 +5330,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
4997
5330
|
};
|
4998
5331
|
|
4999
5332
|
// components/SidebarSection/index.tsx
|
5000
|
-
import { jsx as
|
5333
|
+
import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
5001
5334
|
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
5002
5335
|
var SidebarSection = ({
|
5003
5336
|
children,
|
@@ -5016,9 +5349,9 @@ var SidebarSection = ({
|
|
5016
5349
|
className: getClassName19({ noBorderTop, noPadding }),
|
5017
5350
|
style: { background },
|
5018
5351
|
children: [
|
5019
|
-
/* @__PURE__ */
|
5352
|
+
/* @__PURE__ */ jsx25("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumbs"), children: [
|
5020
5353
|
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumb"), children: [
|
5021
|
-
/* @__PURE__ */
|
5354
|
+
/* @__PURE__ */ jsx25(
|
5022
5355
|
"button",
|
5023
5356
|
{
|
5024
5357
|
type: "button",
|
@@ -5027,12 +5360,12 @@ var SidebarSection = ({
|
|
5027
5360
|
children: breadcrumb.label
|
5028
5361
|
}
|
5029
5362
|
),
|
5030
|
-
/* @__PURE__ */
|
5363
|
+
/* @__PURE__ */ jsx25(ChevronRight, { size: 16 })
|
5031
5364
|
] }, i)) : null,
|
5032
|
-
/* @__PURE__ */
|
5365
|
+
/* @__PURE__ */ jsx25("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx25(Heading, { rank: "2", size: "xs", children: title }) })
|
5033
5366
|
] }) }),
|
5034
|
-
/* @__PURE__ */
|
5035
|
-
isLoading && /* @__PURE__ */
|
5367
|
+
/* @__PURE__ */ jsx25("div", { className: getClassName19("content"), children }),
|
5368
|
+
isLoading && /* @__PURE__ */ jsx25("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx25(Loader, { size: 32 }) })
|
5036
5369
|
]
|
5037
5370
|
}
|
5038
5371
|
);
|
@@ -5063,7 +5396,7 @@ init_react_import();
|
|
5063
5396
|
var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
5064
5397
|
|
5065
5398
|
// components/MenuBar/index.tsx
|
5066
|
-
import { Fragment as Fragment7, jsx as
|
5399
|
+
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
5067
5400
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
5068
5401
|
function MenuBar({
|
5069
5402
|
appState,
|
@@ -5077,7 +5410,7 @@ function MenuBar({
|
|
5077
5410
|
history: { back, forward, historyStore }
|
5078
5411
|
} = useAppContext();
|
5079
5412
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
5080
|
-
return /* @__PURE__ */
|
5413
|
+
return /* @__PURE__ */ jsx26(
|
5081
5414
|
"div",
|
5082
5415
|
{
|
5083
5416
|
className: getClassName20({ menuOpen }),
|
@@ -5093,10 +5426,10 @@ function MenuBar({
|
|
5093
5426
|
},
|
5094
5427
|
children: /* @__PURE__ */ jsxs13("div", { className: getClassName20("inner"), children: [
|
5095
5428
|
/* @__PURE__ */ jsxs13("div", { className: getClassName20("history"), children: [
|
5096
|
-
/* @__PURE__ */
|
5097
|
-
/* @__PURE__ */
|
5429
|
+
/* @__PURE__ */ jsx26(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx26(Undo2, { size: 21 }) }),
|
5430
|
+
/* @__PURE__ */ jsx26(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx26(Redo2, { size: 21 }) })
|
5098
5431
|
] }),
|
5099
|
-
/* @__PURE__ */
|
5432
|
+
/* @__PURE__ */ jsx26(Fragment7, { children: renderHeaderActions && renderHeaderActions({
|
5100
5433
|
state: appState,
|
5101
5434
|
dispatch
|
5102
5435
|
}) })
|
@@ -5107,7 +5440,7 @@ function MenuBar({
|
|
5107
5440
|
|
5108
5441
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
5109
5442
|
init_react_import();
|
5110
|
-
var styles_module_default15 = { "Puck": "
|
5443
|
+
var styles_module_default15 = { "Puck": "_Puck_12s9r_19", "Puck-portal": "_Puck-portal_12s9r_24", "PuckLayout-inner": "_PuckLayout-inner_12s9r_31", "PuckLayout--mounted": "_PuckLayout--mounted_12s9r_43", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_12s9r_47", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_12s9r_53", "PuckLayout-mounted": "_PuckLayout-mounted_12s9r_67", "PuckLayout": "_PuckLayout_12s9r_31", "PuckLayout-header": "_PuckLayout-header_12s9r_108", "PuckLayout-headerInner": "_PuckLayout-headerInner_12s9r_117", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_12s9r_127", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_12s9r_134", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_12s9r_135", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_12s9r_139", "PuckLayout-headerPath": "_PuckLayout-headerPath_12s9r_143", "PuckLayout-headerTools": "_PuckLayout-headerTools_12s9r_150", "PuckLayout-menuButton": "_PuckLayout-menuButton_12s9r_156", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_12s9r_161", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_12s9r_135", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_12s9r_134" };
|
5111
5444
|
|
5112
5445
|
// components/Puck/components/Fields/index.tsx
|
5113
5446
|
init_react_import();
|
@@ -5117,15 +5450,15 @@ init_react_import();
|
|
5117
5450
|
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
5118
5451
|
|
5119
5452
|
// components/Puck/components/Fields/index.tsx
|
5120
|
-
import { useCallback as
|
5453
|
+
import { useCallback as useCallback12, useEffect as useEffect16, useMemo as useMemo11, useState as useState19 } from "react";
|
5121
5454
|
|
5122
5455
|
// lib/use-parent.ts
|
5123
5456
|
init_react_import();
|
5124
|
-
import { useContext as
|
5457
|
+
import { useContext as useContext9 } from "react";
|
5125
5458
|
var useParent = (itemSelector) => {
|
5126
5459
|
var _a;
|
5127
5460
|
const { selectedItem, state } = useAppContext();
|
5128
|
-
const { pathData } =
|
5461
|
+
const { pathData } = useContext9(dropZoneContext) || {};
|
5129
5462
|
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
5130
5463
|
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
5131
5464
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
@@ -5134,7 +5467,7 @@ var useParent = (itemSelector) => {
|
|
5134
5467
|
};
|
5135
5468
|
|
5136
5469
|
// components/Puck/components/Fields/index.tsx
|
5137
|
-
import { Fragment as Fragment8, jsx as
|
5470
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
5138
5471
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
5139
5472
|
var defaultPageFields = {
|
5140
5473
|
title: { type: "text" }
|
@@ -5142,7 +5475,7 @@ var defaultPageFields = {
|
|
5142
5475
|
var DefaultFields = ({
|
5143
5476
|
children
|
5144
5477
|
}) => {
|
5145
|
-
return /* @__PURE__ */
|
5478
|
+
return /* @__PURE__ */ jsx27(Fragment8, { children });
|
5146
5479
|
};
|
5147
5480
|
var useResolvedFields = () => {
|
5148
5481
|
var _a, _b;
|
@@ -5151,20 +5484,20 @@ var useResolvedFields = () => {
|
|
5151
5484
|
const { data } = state;
|
5152
5485
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
5153
5486
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
5154
|
-
const defaultFields =
|
5487
|
+
const defaultFields = useMemo11(
|
5155
5488
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
5156
5489
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
5157
5490
|
);
|
5158
5491
|
const rootProps = data.root.props || data.root;
|
5159
|
-
const [lastSelectedData, setLastSelectedData] =
|
5160
|
-
const [resolvedFields, setResolvedFields] =
|
5161
|
-
const [fieldsLoading, setFieldsLoading] =
|
5492
|
+
const [lastSelectedData, setLastSelectedData] = useState19({});
|
5493
|
+
const [resolvedFields, setResolvedFields] = useState19(defaultFields);
|
5494
|
+
const [fieldsLoading, setFieldsLoading] = useState19(false);
|
5162
5495
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5163
5496
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
5164
5497
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
5165
5498
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
5166
5499
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
5167
|
-
const resolveFields =
|
5500
|
+
const resolveFields = useCallback12(
|
5168
5501
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
5169
5502
|
var _a2;
|
5170
5503
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
@@ -5202,7 +5535,7 @@ var useResolvedFields = () => {
|
|
5202
5535
|
}),
|
5203
5536
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
5204
5537
|
);
|
5205
|
-
|
5538
|
+
useEffect16(() => {
|
5206
5539
|
if (hasResolver) {
|
5207
5540
|
setFieldsLoading(true);
|
5208
5541
|
resolveFields(defaultFields).then((fields) => {
|
@@ -5233,7 +5566,7 @@ var Fields = () => {
|
|
5233
5566
|
const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
|
5234
5567
|
const isLoading = fieldsResolving || componentResolving;
|
5235
5568
|
const rootProps = data.root.props || data.root;
|
5236
|
-
const Wrapper =
|
5569
|
+
const Wrapper = useMemo11(() => overrides.fields || DefaultFields, [overrides]);
|
5237
5570
|
return /* @__PURE__ */ jsxs14(
|
5238
5571
|
"form",
|
5239
5572
|
{
|
@@ -5242,7 +5575,7 @@ var Fields = () => {
|
|
5242
5575
|
e.preventDefault();
|
5243
5576
|
},
|
5244
5577
|
children: [
|
5245
|
-
/* @__PURE__ */
|
5578
|
+
/* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
5246
5579
|
const field = fields[fieldName];
|
5247
5580
|
if (!(field == null ? void 0 : field.type)) return null;
|
5248
5581
|
const onChange = (value, updatedUi) => {
|
@@ -5313,7 +5646,7 @@ var Fields = () => {
|
|
5313
5646
|
item: selectedItem
|
5314
5647
|
});
|
5315
5648
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
5316
|
-
return /* @__PURE__ */
|
5649
|
+
return /* @__PURE__ */ jsx27(
|
5317
5650
|
AutoFieldPrivate,
|
5318
5651
|
{
|
5319
5652
|
field,
|
@@ -5331,7 +5664,7 @@ var Fields = () => {
|
|
5331
5664
|
root: true
|
5332
5665
|
});
|
5333
5666
|
const id = `root_${field.type}_${fieldName}`;
|
5334
|
-
return /* @__PURE__ */
|
5667
|
+
return /* @__PURE__ */ jsx27(
|
5335
5668
|
AutoFieldPrivate,
|
5336
5669
|
{
|
5337
5670
|
field,
|
@@ -5345,7 +5678,7 @@ var Fields = () => {
|
|
5345
5678
|
);
|
5346
5679
|
}
|
5347
5680
|
}) }),
|
5348
|
-
isLoading && /* @__PURE__ */
|
5681
|
+
isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
|
5349
5682
|
]
|
5350
5683
|
}
|
5351
5684
|
);
|
@@ -5356,7 +5689,7 @@ init_react_import();
|
|
5356
5689
|
|
5357
5690
|
// lib/use-component-list.tsx
|
5358
5691
|
init_react_import();
|
5359
|
-
import { useEffect as
|
5692
|
+
import { useEffect as useEffect17, useState as useState20 } from "react";
|
5360
5693
|
|
5361
5694
|
// components/ComponentList/index.tsx
|
5362
5695
|
init_react_import();
|
@@ -5366,7 +5699,7 @@ init_react_import();
|
|
5366
5699
|
var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
|
5367
5700
|
|
5368
5701
|
// components/ComponentList/index.tsx
|
5369
|
-
import { jsx as
|
5702
|
+
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
5370
5703
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
5371
5704
|
var ComponentListItem = ({
|
5372
5705
|
name,
|
@@ -5376,7 +5709,7 @@ var ComponentListItem = ({
|
|
5376
5709
|
const canInsert = getPermissions({
|
5377
5710
|
type: name
|
5378
5711
|
}).insert;
|
5379
|
-
return /* @__PURE__ */
|
5712
|
+
return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
5380
5713
|
};
|
5381
5714
|
var ComponentList = ({
|
5382
5715
|
children,
|
@@ -5400,14 +5733,14 @@ var ComponentList = ({
|
|
5400
5733
|
}),
|
5401
5734
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
5402
5735
|
children: [
|
5403
|
-
/* @__PURE__ */
|
5404
|
-
/* @__PURE__ */
|
5736
|
+
/* @__PURE__ */ jsx28("div", { children: title }),
|
5737
|
+
/* @__PURE__ */ jsx28("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
|
5405
5738
|
]
|
5406
5739
|
}
|
5407
5740
|
),
|
5408
|
-
/* @__PURE__ */
|
5741
|
+
/* @__PURE__ */ jsx28("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
5409
5742
|
var _a;
|
5410
|
-
return /* @__PURE__ */
|
5743
|
+
return /* @__PURE__ */ jsx28(
|
5411
5744
|
ComponentListItem,
|
5412
5745
|
{
|
5413
5746
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -5421,10 +5754,10 @@ var ComponentList = ({
|
|
5421
5754
|
ComponentList.Item = ComponentListItem;
|
5422
5755
|
|
5423
5756
|
// lib/use-component-list.tsx
|
5424
|
-
import { jsx as
|
5757
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
5425
5758
|
var useComponentList = (config, ui) => {
|
5426
|
-
const [componentList, setComponentList] =
|
5427
|
-
|
5759
|
+
const [componentList, setComponentList] = useState20();
|
5760
|
+
useEffect17(() => {
|
5428
5761
|
var _a, _b, _c;
|
5429
5762
|
if (Object.keys(ui.componentList).length > 0) {
|
5430
5763
|
const matchedComponents = [];
|
@@ -5434,7 +5767,7 @@ var useComponentList = (config, ui) => {
|
|
5434
5767
|
if (category.visible === false || !category.components) {
|
5435
5768
|
return null;
|
5436
5769
|
}
|
5437
|
-
return /* @__PURE__ */
|
5770
|
+
return /* @__PURE__ */ jsx29(
|
5438
5771
|
ComponentList,
|
5439
5772
|
{
|
5440
5773
|
id: categoryKey,
|
@@ -5443,7 +5776,7 @@ var useComponentList = (config, ui) => {
|
|
5443
5776
|
var _a2;
|
5444
5777
|
matchedComponents.push(componentName);
|
5445
5778
|
const componentConf = config.components[componentName] || {};
|
5446
|
-
return /* @__PURE__ */
|
5779
|
+
return /* @__PURE__ */ jsx29(
|
5447
5780
|
ComponentList.Item,
|
5448
5781
|
{
|
5449
5782
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -5463,7 +5796,7 @@ var useComponentList = (config, ui) => {
|
|
5463
5796
|
);
|
5464
5797
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
5465
5798
|
_componentList.push(
|
5466
|
-
/* @__PURE__ */
|
5799
|
+
/* @__PURE__ */ jsx29(
|
5467
5800
|
ComponentList,
|
5468
5801
|
{
|
5469
5802
|
id: "other",
|
@@ -5471,7 +5804,7 @@ var useComponentList = (config, ui) => {
|
|
5471
5804
|
children: remainingComponents.map((componentName, i) => {
|
5472
5805
|
var _a2;
|
5473
5806
|
const componentConf = config.components[componentName] || {};
|
5474
|
-
return /* @__PURE__ */
|
5807
|
+
return /* @__PURE__ */ jsx29(
|
5475
5808
|
ComponentList.Item,
|
5476
5809
|
{
|
5477
5810
|
name: componentName,
|
@@ -5493,30 +5826,30 @@ var useComponentList = (config, ui) => {
|
|
5493
5826
|
};
|
5494
5827
|
|
5495
5828
|
// components/Puck/components/Components/index.tsx
|
5496
|
-
import { useMemo as
|
5497
|
-
import { jsx as
|
5829
|
+
import { useMemo as useMemo12 } from "react";
|
5830
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
5498
5831
|
var Components = () => {
|
5499
5832
|
const { config, state, overrides } = useAppContext();
|
5500
5833
|
const componentList = useComponentList(config, state.ui);
|
5501
|
-
const Wrapper =
|
5502
|
-
return /* @__PURE__ */
|
5834
|
+
const Wrapper = useMemo12(() => overrides.components || "div", [overrides]);
|
5835
|
+
return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
|
5503
5836
|
};
|
5504
5837
|
|
5505
5838
|
// components/Puck/components/Preview/index.tsx
|
5506
5839
|
init_react_import();
|
5507
|
-
import { useCallback as
|
5840
|
+
import { useCallback as useCallback13, useEffect as useEffect19, useRef as useRef6, useMemo as useMemo13 } from "react";
|
5508
5841
|
|
5509
5842
|
// components/AutoFrame/index.tsx
|
5510
5843
|
init_react_import();
|
5511
5844
|
import {
|
5512
|
-
createContext as
|
5513
|
-
useContext as
|
5514
|
-
useEffect as
|
5515
|
-
useState as
|
5845
|
+
createContext as createContext5,
|
5846
|
+
useContext as useContext10,
|
5847
|
+
useEffect as useEffect18,
|
5848
|
+
useState as useState21
|
5516
5849
|
} from "react";
|
5517
5850
|
import hash from "object-hash";
|
5518
5851
|
import { createPortal as createPortal3 } from "react-dom";
|
5519
|
-
import { Fragment as Fragment9, jsx as
|
5852
|
+
import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
|
5520
5853
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
5521
5854
|
var collectStyles = (doc) => {
|
5522
5855
|
const collected = [];
|
@@ -5559,7 +5892,7 @@ var CopyHostStyles = ({
|
|
5559
5892
|
onStylesLoaded = () => null
|
5560
5893
|
}) => {
|
5561
5894
|
const { document: doc, window: win } = useFrame();
|
5562
|
-
|
5895
|
+
useEffect18(() => {
|
5563
5896
|
if (!win || !doc) {
|
5564
5897
|
return () => {
|
5565
5898
|
};
|
@@ -5716,10 +6049,10 @@ var CopyHostStyles = ({
|
|
5716
6049
|
observer.disconnect();
|
5717
6050
|
};
|
5718
6051
|
}, []);
|
5719
|
-
return /* @__PURE__ */
|
6052
|
+
return /* @__PURE__ */ jsx31(Fragment9, { children });
|
5720
6053
|
};
|
5721
|
-
var autoFrameContext =
|
5722
|
-
var useFrame = () =>
|
6054
|
+
var autoFrameContext = createContext5({});
|
6055
|
+
var useFrame = () => useContext10(autoFrameContext);
|
5723
6056
|
function AutoFrame(_a) {
|
5724
6057
|
var _b = _a, {
|
5725
6058
|
children,
|
@@ -5736,10 +6069,10 @@ function AutoFrame(_a) {
|
|
5736
6069
|
"onStylesLoaded",
|
5737
6070
|
"frameRef"
|
5738
6071
|
]);
|
5739
|
-
const [loaded, setLoaded] =
|
5740
|
-
const [ctx, setCtx] =
|
5741
|
-
const [mountTarget, setMountTarget] =
|
5742
|
-
|
6072
|
+
const [loaded, setLoaded] = useState21(false);
|
6073
|
+
const [ctx, setCtx] = useState21({});
|
6074
|
+
const [mountTarget, setMountTarget] = useState21();
|
6075
|
+
useEffect18(() => {
|
5743
6076
|
var _a2;
|
5744
6077
|
if (frameRef.current) {
|
5745
6078
|
setCtx({
|
@@ -5751,7 +6084,7 @@ function AutoFrame(_a) {
|
|
5751
6084
|
);
|
5752
6085
|
}
|
5753
6086
|
}, [frameRef, loaded]);
|
5754
|
-
return /* @__PURE__ */
|
6087
|
+
return /* @__PURE__ */ jsx31(
|
5755
6088
|
"iframe",
|
5756
6089
|
__spreadProps(__spreadValues({}, props), {
|
5757
6090
|
className,
|
@@ -5761,7 +6094,7 @@ function AutoFrame(_a) {
|
|
5761
6094
|
onLoad: () => {
|
5762
6095
|
setLoaded(true);
|
5763
6096
|
},
|
5764
|
-
children: /* @__PURE__ */
|
6097
|
+
children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(CopyHostStyles, { debug, onStylesLoaded, children: createPortal3(children, mountTarget) }) })
|
5765
6098
|
})
|
5766
6099
|
);
|
5767
6100
|
}
|
@@ -5774,7 +6107,7 @@ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
|
|
5774
6107
|
|
5775
6108
|
// components/Render/index.tsx
|
5776
6109
|
init_react_import();
|
5777
|
-
import { jsx as
|
6110
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
5778
6111
|
function Render({
|
5779
6112
|
config,
|
5780
6113
|
data
|
@@ -5787,7 +6120,7 @@ function Render({
|
|
5787
6120
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
5788
6121
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
5789
6122
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5790
|
-
return /* @__PURE__ */
|
6123
|
+
return /* @__PURE__ */ jsx32(
|
5791
6124
|
DropZoneProvider,
|
5792
6125
|
{
|
5793
6126
|
value: {
|
@@ -5797,7 +6130,7 @@ function Render({
|
|
5797
6130
|
depth: 0,
|
5798
6131
|
path: []
|
5799
6132
|
},
|
5800
|
-
children: /* @__PURE__ */
|
6133
|
+
children: /* @__PURE__ */ jsx32(
|
5801
6134
|
config.root.render,
|
5802
6135
|
__spreadProps(__spreadValues({}, rootProps), {
|
5803
6136
|
puck: {
|
@@ -5807,13 +6140,13 @@ function Render({
|
|
5807
6140
|
title,
|
5808
6141
|
editMode: false,
|
5809
6142
|
id: "puck-root",
|
5810
|
-
children: /* @__PURE__ */
|
6143
|
+
children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
|
5811
6144
|
})
|
5812
6145
|
)
|
5813
6146
|
}
|
5814
6147
|
);
|
5815
6148
|
}
|
5816
|
-
return /* @__PURE__ */
|
6149
|
+
return /* @__PURE__ */ jsx32(
|
5817
6150
|
DropZoneProvider,
|
5818
6151
|
{
|
5819
6152
|
value: {
|
@@ -5823,17 +6156,17 @@ function Render({
|
|
5823
6156
|
depth: 0,
|
5824
6157
|
path: []
|
5825
6158
|
},
|
5826
|
-
children: /* @__PURE__ */
|
6159
|
+
children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
|
5827
6160
|
}
|
5828
6161
|
);
|
5829
6162
|
}
|
5830
6163
|
|
5831
6164
|
// components/Puck/components/Preview/index.tsx
|
5832
|
-
import { Fragment as Fragment10, jsx as
|
6165
|
+
import { Fragment as Fragment10, jsx as jsx33 } from "react/jsx-runtime";
|
5833
6166
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
5834
6167
|
var useBubbleIframeEvents = (ref) => {
|
5835
6168
|
const { status } = useAppContext();
|
5836
|
-
|
6169
|
+
useEffect19(() => {
|
5837
6170
|
var _a;
|
5838
6171
|
if (ref.current && status === "READY") {
|
5839
6172
|
const iframe = ref.current;
|
@@ -5870,22 +6203,22 @@ var useBubbleIframeEvents = (ref) => {
|
|
5870
6203
|
}
|
5871
6204
|
}, [status]);
|
5872
6205
|
};
|
5873
|
-
var
|
6206
|
+
var Preview2 = ({ id = "puck-preview" }) => {
|
5874
6207
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
5875
|
-
const Page =
|
6208
|
+
const Page = useCallback13(
|
5876
6209
|
(pageProps) => {
|
5877
6210
|
var _a, _b;
|
5878
6211
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
5879
6212
|
id: "puck-root"
|
5880
|
-
}, pageProps)) : /* @__PURE__ */
|
6213
|
+
}, pageProps)) : /* @__PURE__ */ jsx33(Fragment10, { children: pageProps.children });
|
5881
6214
|
},
|
5882
6215
|
[config.root]
|
5883
6216
|
);
|
5884
|
-
const Frame =
|
6217
|
+
const Frame = useMemo13(() => overrides.iframe, [overrides]);
|
5885
6218
|
const rootProps = state.data.root.props || state.data.root;
|
5886
|
-
const ref =
|
6219
|
+
const ref = useRef6(null);
|
5887
6220
|
useBubbleIframeEvents(ref);
|
5888
|
-
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */
|
6221
|
+
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx33(
|
5889
6222
|
Page,
|
5890
6223
|
__spreadProps(__spreadValues({}, rootProps), {
|
5891
6224
|
puck: {
|
@@ -5894,10 +6227,10 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5894
6227
|
dragRef: null
|
5895
6228
|
},
|
5896
6229
|
editMode: true,
|
5897
|
-
children: /* @__PURE__ */
|
6230
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
5898
6231
|
})
|
5899
|
-
) : /* @__PURE__ */
|
5900
|
-
return /* @__PURE__ */
|
6232
|
+
) : /* @__PURE__ */ jsx33(Render, { data: state.data, config });
|
6233
|
+
return /* @__PURE__ */ jsx33(
|
5901
6234
|
"div",
|
5902
6235
|
{
|
5903
6236
|
className: getClassName23(),
|
@@ -5906,7 +6239,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5906
6239
|
onClick: () => {
|
5907
6240
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
5908
6241
|
},
|
5909
|
-
children: iframe.enabled ? /* @__PURE__ */
|
6242
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx33(
|
5910
6243
|
AutoFrame_default,
|
5911
6244
|
{
|
5912
6245
|
id: "preview-frame",
|
@@ -5916,14 +6249,14 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5916
6249
|
setStatus("READY");
|
5917
6250
|
},
|
5918
6251
|
frameRef: ref,
|
5919
|
-
children: /* @__PURE__ */
|
6252
|
+
children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
5920
6253
|
if (Frame) {
|
5921
|
-
return /* @__PURE__ */
|
6254
|
+
return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
|
5922
6255
|
}
|
5923
6256
|
return inner;
|
5924
6257
|
} })
|
5925
6258
|
}
|
5926
|
-
) : /* @__PURE__ */
|
6259
|
+
) : /* @__PURE__ */ jsx33(
|
5927
6260
|
"div",
|
5928
6261
|
{
|
5929
6262
|
id: "preview-frame",
|
@@ -5980,7 +6313,7 @@ var scrollIntoView = (el) => {
|
|
5980
6313
|
};
|
5981
6314
|
|
5982
6315
|
// components/LayerTree/index.tsx
|
5983
|
-
import { useContext as
|
6316
|
+
import { useContext as useContext11 } from "react";
|
5984
6317
|
|
5985
6318
|
// lib/is-child-of-zone.ts
|
5986
6319
|
init_react_import();
|
@@ -6013,7 +6346,7 @@ var onScrollEnd = (frame, cb) => {
|
|
6013
6346
|
};
|
6014
6347
|
|
6015
6348
|
// components/LayerTree/index.tsx
|
6016
|
-
import { Fragment as Fragment11, jsx as
|
6349
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
|
6017
6350
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
6018
6351
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
6019
6352
|
var LayerTree = ({
|
@@ -6026,15 +6359,15 @@ var LayerTree = ({
|
|
6026
6359
|
label
|
6027
6360
|
}) => {
|
6028
6361
|
const zones = data.zones || {};
|
6029
|
-
const ctx =
|
6362
|
+
const ctx = useContext11(dropZoneContext);
|
6030
6363
|
return /* @__PURE__ */ jsxs16(Fragment11, { children: [
|
6031
6364
|
label && /* @__PURE__ */ jsxs16("div", { className: getClassName24("zoneTitle"), children: [
|
6032
|
-
/* @__PURE__ */
|
6365
|
+
/* @__PURE__ */ jsx34("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx34(Layers, { size: "16" }) }),
|
6033
6366
|
" ",
|
6034
6367
|
label
|
6035
6368
|
] }),
|
6036
6369
|
/* @__PURE__ */ jsxs16("ul", { className: getClassName24(), children: [
|
6037
|
-
zoneContent.length === 0 && /* @__PURE__ */
|
6370
|
+
zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
|
6038
6371
|
zoneContent.map((item, i) => {
|
6039
6372
|
var _a;
|
6040
6373
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -6057,7 +6390,7 @@ var LayerTree = ({
|
|
6057
6390
|
childIsSelected
|
6058
6391
|
}),
|
6059
6392
|
children: [
|
6060
|
-
/* @__PURE__ */
|
6393
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs16(
|
6061
6394
|
"button",
|
6062
6395
|
{
|
6063
6396
|
type: "button",
|
@@ -6096,22 +6429,22 @@ var LayerTree = ({
|
|
6096
6429
|
setHoveringComponent(null);
|
6097
6430
|
},
|
6098
6431
|
children: [
|
6099
|
-
containsZone && /* @__PURE__ */
|
6432
|
+
containsZone && /* @__PURE__ */ jsx34(
|
6100
6433
|
"div",
|
6101
6434
|
{
|
6102
6435
|
className: getClassNameLayer("chevron"),
|
6103
6436
|
title: isSelected ? "Collapse" : "Expand",
|
6104
|
-
children: /* @__PURE__ */
|
6437
|
+
children: /* @__PURE__ */ jsx34(ChevronDown, { size: "12" })
|
6105
6438
|
}
|
6106
6439
|
),
|
6107
6440
|
/* @__PURE__ */ jsxs16("div", { className: getClassNameLayer("title"), children: [
|
6108
|
-
/* @__PURE__ */
|
6109
|
-
/* @__PURE__ */
|
6441
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx34(Type, { size: "16" }) : /* @__PURE__ */ jsx34(LayoutGrid, { size: "16" }) }),
|
6442
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("name"), children: label2 })
|
6110
6443
|
] })
|
6111
6444
|
]
|
6112
6445
|
}
|
6113
6446
|
) }),
|
6114
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */
|
6447
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx34(
|
6115
6448
|
LayerTree,
|
6116
6449
|
{
|
6117
6450
|
config,
|
@@ -6133,13 +6466,13 @@ var LayerTree = ({
|
|
6133
6466
|
};
|
6134
6467
|
|
6135
6468
|
// components/Puck/components/Outline/index.tsx
|
6136
|
-
import { useCallback as
|
6137
|
-
import { Fragment as Fragment12, jsx as
|
6469
|
+
import { useCallback as useCallback14, useMemo as useMemo14 } from "react";
|
6470
|
+
import { Fragment as Fragment12, jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
6138
6471
|
var Outline = () => {
|
6139
6472
|
const { dispatch, state, overrides, config } = useAppContext();
|
6140
6473
|
const { data, ui } = state;
|
6141
6474
|
const { itemSelector } = ui;
|
6142
|
-
const setItemSelector =
|
6475
|
+
const setItemSelector = useCallback14(
|
6143
6476
|
(newItemSelector) => {
|
6144
6477
|
dispatch({
|
6145
6478
|
type: "setUi",
|
@@ -6148,9 +6481,9 @@ var Outline = () => {
|
|
6148
6481
|
},
|
6149
6482
|
[]
|
6150
6483
|
);
|
6151
|
-
const Wrapper =
|
6152
|
-
return /* @__PURE__ */
|
6153
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */
|
6484
|
+
const Wrapper = useMemo14(() => overrides.outline || "div", [overrides]);
|
6485
|
+
return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
|
6486
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
|
6154
6487
|
LayerTree,
|
6155
6488
|
{
|
6156
6489
|
config,
|
@@ -6163,7 +6496,7 @@ var Outline = () => {
|
|
6163
6496
|
),
|
6164
6497
|
Object.entries(findZonesForArea(data, "root")).map(
|
6165
6498
|
([zoneKey, zone]) => {
|
6166
|
-
return /* @__PURE__ */
|
6499
|
+
return /* @__PURE__ */ jsx35(
|
6167
6500
|
LayerTree,
|
6168
6501
|
{
|
6169
6502
|
config,
|
@@ -6262,19 +6595,19 @@ function usePuckHistory({
|
|
6262
6595
|
|
6263
6596
|
// lib/use-history-store.ts
|
6264
6597
|
init_react_import();
|
6265
|
-
import { useState as
|
6598
|
+
import { useState as useState22 } from "react";
|
6266
6599
|
import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
|
6267
6600
|
var EMPTY_HISTORY_INDEX = 0;
|
6268
6601
|
function useHistoryStore(initialHistory) {
|
6269
6602
|
var _a, _b;
|
6270
|
-
const [histories, setHistories] =
|
6603
|
+
const [histories, setHistories] = useState22(
|
6271
6604
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6272
6605
|
);
|
6273
6606
|
const updateHistories = (histories2) => {
|
6274
6607
|
setHistories(histories2);
|
6275
6608
|
setIndex(histories2.length - 1);
|
6276
6609
|
};
|
6277
|
-
const [index, setIndex] =
|
6610
|
+
const [index, setIndex] = useState22(
|
6278
6611
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6279
6612
|
);
|
6280
6613
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -6435,27 +6768,27 @@ var getBox = function getBox2(el) {
|
|
6435
6768
|
|
6436
6769
|
// components/Puck/components/Canvas/index.tsx
|
6437
6770
|
import {
|
6438
|
-
useCallback as
|
6439
|
-
useEffect as
|
6440
|
-
useMemo as
|
6441
|
-
useRef as
|
6442
|
-
useState as
|
6771
|
+
useCallback as useCallback15,
|
6772
|
+
useEffect as useEffect21,
|
6773
|
+
useMemo as useMemo16,
|
6774
|
+
useRef as useRef7,
|
6775
|
+
useState as useState24
|
6443
6776
|
} from "react";
|
6444
6777
|
|
6445
6778
|
// components/ViewportControls/index.tsx
|
6446
6779
|
init_react_import();
|
6447
|
-
import { useEffect as
|
6780
|
+
import { useEffect as useEffect20, useMemo as useMemo15, useState as useState23 } from "react";
|
6448
6781
|
|
6449
6782
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
6450
6783
|
init_react_import();
|
6451
6784
|
var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
|
6452
6785
|
|
6453
6786
|
// components/ViewportControls/index.tsx
|
6454
|
-
import { jsx as
|
6787
|
+
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
6455
6788
|
var icons = {
|
6456
|
-
Smartphone: /* @__PURE__ */
|
6457
|
-
Tablet: /* @__PURE__ */
|
6458
|
-
Monitor: /* @__PURE__ */
|
6789
|
+
Smartphone: /* @__PURE__ */ jsx36(Smartphone, { size: 16 }),
|
6790
|
+
Tablet: /* @__PURE__ */ jsx36(Tablet, { size: 16 }),
|
6791
|
+
Monitor: /* @__PURE__ */ jsx36(Monitor, { size: 16 })
|
6459
6792
|
};
|
6460
6793
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
6461
6794
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -6467,11 +6800,11 @@ var ViewportButton = ({
|
|
6467
6800
|
onClick
|
6468
6801
|
}) => {
|
6469
6802
|
const { state } = useAppContext();
|
6470
|
-
const [isActive, setIsActive] =
|
6471
|
-
|
6803
|
+
const [isActive, setIsActive] = useState23(false);
|
6804
|
+
useEffect20(() => {
|
6472
6805
|
setIsActive(width === state.ui.viewports.current.width);
|
6473
6806
|
}, [width, state.ui.viewports.current.width]);
|
6474
|
-
return /* @__PURE__ */
|
6807
|
+
return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
|
6475
6808
|
IconButton,
|
6476
6809
|
{
|
6477
6810
|
title,
|
@@ -6480,7 +6813,7 @@ var ViewportButton = ({
|
|
6480
6813
|
e.stopPropagation();
|
6481
6814
|
onClick({ width, height });
|
6482
6815
|
},
|
6483
|
-
children: /* @__PURE__ */
|
6816
|
+
children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
|
6484
6817
|
}
|
6485
6818
|
) });
|
6486
6819
|
};
|
@@ -6504,7 +6837,7 @@ var ViewportControls = ({
|
|
6504
6837
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
6505
6838
|
(option) => option.value === autoZoom
|
6506
6839
|
);
|
6507
|
-
const zoomOptions =
|
6840
|
+
const zoomOptions = useMemo15(
|
6508
6841
|
() => [
|
6509
6842
|
...defaultZoomOptions,
|
6510
6843
|
...defaultsContainAutoZoom ? [] : [
|
@@ -6517,7 +6850,7 @@ var ViewportControls = ({
|
|
6517
6850
|
[autoZoom]
|
6518
6851
|
);
|
6519
6852
|
return /* @__PURE__ */ jsxs18("div", { className: getClassName25(), children: [
|
6520
|
-
viewports.map((viewport, i) => /* @__PURE__ */
|
6853
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
|
6521
6854
|
ViewportButton,
|
6522
6855
|
{
|
6523
6856
|
height: viewport.height,
|
@@ -6528,8 +6861,8 @@ var ViewportControls = ({
|
|
6528
6861
|
},
|
6529
6862
|
i
|
6530
6863
|
)),
|
6531
|
-
/* @__PURE__ */
|
6532
|
-
/* @__PURE__ */
|
6864
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
6865
|
+
/* @__PURE__ */ jsx36(
|
6533
6866
|
IconButton,
|
6534
6867
|
{
|
6535
6868
|
title: "Zoom viewport out",
|
@@ -6543,10 +6876,10 @@ var ViewportControls = ({
|
|
6543
6876
|
)].value
|
6544
6877
|
);
|
6545
6878
|
},
|
6546
|
-
children: /* @__PURE__ */
|
6879
|
+
children: /* @__PURE__ */ jsx36(ZoomOut, { size: 16 })
|
6547
6880
|
}
|
6548
6881
|
),
|
6549
|
-
/* @__PURE__ */
|
6882
|
+
/* @__PURE__ */ jsx36(
|
6550
6883
|
IconButton,
|
6551
6884
|
{
|
6552
6885
|
title: "Zoom viewport in",
|
@@ -6560,11 +6893,11 @@ var ViewportControls = ({
|
|
6560
6893
|
)].value
|
6561
6894
|
);
|
6562
6895
|
},
|
6563
|
-
children: /* @__PURE__ */
|
6896
|
+
children: /* @__PURE__ */ jsx36(ZoomIn, { size: 16 })
|
6564
6897
|
}
|
6565
6898
|
),
|
6566
|
-
/* @__PURE__ */
|
6567
|
-
/* @__PURE__ */
|
6899
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
6900
|
+
/* @__PURE__ */ jsx36(
|
6568
6901
|
"select",
|
6569
6902
|
{
|
6570
6903
|
className: getClassName25("zoomSelect"),
|
@@ -6572,7 +6905,7 @@ var ViewportControls = ({
|
|
6572
6905
|
onChange: (e) => {
|
6573
6906
|
onZoom(parseFloat(e.currentTarget.value));
|
6574
6907
|
},
|
6575
|
-
children: zoomOptions.map((option) => /* @__PURE__ */
|
6908
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
|
6576
6909
|
"option",
|
6577
6910
|
{
|
6578
6911
|
value: option.value,
|
@@ -6620,24 +6953,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
6620
6953
|
};
|
6621
6954
|
|
6622
6955
|
// components/Puck/components/Canvas/index.tsx
|
6623
|
-
import { Fragment as Fragment13, jsx as
|
6956
|
+
import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
6624
6957
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
6625
6958
|
var ZOOM_ON_CHANGE = true;
|
6626
6959
|
var Canvas = () => {
|
6627
6960
|
const { status, iframe } = useAppContext();
|
6628
6961
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
6629
6962
|
const { ui } = state;
|
6630
|
-
const frameRef =
|
6631
|
-
const [showTransition, setShowTransition] =
|
6632
|
-
const defaultRender =
|
6633
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */
|
6963
|
+
const frameRef = useRef7(null);
|
6964
|
+
const [showTransition, setShowTransition] = useState24(false);
|
6965
|
+
const defaultRender = useMemo16(() => {
|
6966
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
|
6634
6967
|
return PuckDefault;
|
6635
6968
|
}, []);
|
6636
|
-
const CustomPreview =
|
6969
|
+
const CustomPreview = useMemo16(
|
6637
6970
|
() => overrides.preview || defaultRender,
|
6638
6971
|
[overrides]
|
6639
6972
|
);
|
6640
|
-
const getFrameDimensions =
|
6973
|
+
const getFrameDimensions = useCallback15(() => {
|
6641
6974
|
if (frameRef.current) {
|
6642
6975
|
const frame = frameRef.current;
|
6643
6976
|
const box = getBox(frame);
|
@@ -6645,7 +6978,7 @@ var Canvas = () => {
|
|
6645
6978
|
}
|
6646
6979
|
return { width: 0, height: 0 };
|
6647
6980
|
}, [frameRef]);
|
6648
|
-
const resetAutoZoom =
|
6981
|
+
const resetAutoZoom = useCallback15(
|
6649
6982
|
(ui2 = state.ui) => {
|
6650
6983
|
if (frameRef.current) {
|
6651
6984
|
setZoomConfig(
|
@@ -6655,11 +6988,11 @@ var Canvas = () => {
|
|
6655
6988
|
},
|
6656
6989
|
[frameRef, zoomConfig, state.ui]
|
6657
6990
|
);
|
6658
|
-
|
6991
|
+
useEffect21(() => {
|
6659
6992
|
setShowTransition(false);
|
6660
6993
|
resetAutoZoom();
|
6661
6994
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
6662
|
-
|
6995
|
+
useEffect21(() => {
|
6663
6996
|
const { height: frameHeight } = getFrameDimensions();
|
6664
6997
|
if (ui.viewports.current.height === "auto") {
|
6665
6998
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -6667,13 +7000,13 @@ var Canvas = () => {
|
|
6667
7000
|
}));
|
6668
7001
|
}
|
6669
7002
|
}, [zoomConfig.zoom]);
|
6670
|
-
|
7003
|
+
useEffect21(() => {
|
6671
7004
|
if (ZOOM_ON_CHANGE) {
|
6672
7005
|
setShowTransition(true);
|
6673
7006
|
resetAutoZoom(ui);
|
6674
7007
|
}
|
6675
7008
|
}, [ui.viewports.current.width]);
|
6676
|
-
|
7009
|
+
useEffect21(() => {
|
6677
7010
|
const cb = () => {
|
6678
7011
|
setShowTransition(false);
|
6679
7012
|
resetAutoZoom();
|
@@ -6683,8 +7016,8 @@ var Canvas = () => {
|
|
6683
7016
|
window.removeEventListener("resize", cb);
|
6684
7017
|
};
|
6685
7018
|
}, []);
|
6686
|
-
const [showLoader, setShowLoader] =
|
6687
|
-
|
7019
|
+
const [showLoader, setShowLoader] = useState24(false);
|
7020
|
+
useEffect21(() => {
|
6688
7021
|
setTimeout(() => {
|
6689
7022
|
setShowLoader(true);
|
6690
7023
|
}, 500);
|
@@ -6702,7 +7035,7 @@ var Canvas = () => {
|
|
6702
7035
|
recordHistory: true
|
6703
7036
|
}),
|
6704
7037
|
children: [
|
6705
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */
|
7038
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx37(
|
6706
7039
|
ViewportControls,
|
6707
7040
|
{
|
6708
7041
|
autoZoom: zoomConfig.autoZoom,
|
@@ -6729,7 +7062,7 @@ var Canvas = () => {
|
|
6729
7062
|
}
|
6730
7063
|
) }),
|
6731
7064
|
/* @__PURE__ */ jsxs19("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
6732
|
-
/* @__PURE__ */
|
7065
|
+
/* @__PURE__ */ jsx37(
|
6733
7066
|
"div",
|
6734
7067
|
{
|
6735
7068
|
className: getClassName26("root"),
|
@@ -6750,10 +7083,10 @@ var Canvas = () => {
|
|
6750
7083
|
})
|
6751
7084
|
);
|
6752
7085
|
},
|
6753
|
-
children: /* @__PURE__ */
|
7086
|
+
children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview2, {}) })
|
6754
7087
|
}
|
6755
7088
|
),
|
6756
|
-
/* @__PURE__ */
|
7089
|
+
/* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
|
6757
7090
|
] })
|
6758
7091
|
]
|
6759
7092
|
}
|
@@ -6762,7 +7095,7 @@ var Canvas = () => {
|
|
6762
7095
|
|
6763
7096
|
// lib/use-loaded-overrides.ts
|
6764
7097
|
init_react_import();
|
6765
|
-
import { useMemo as
|
7098
|
+
import { useMemo as useMemo17 } from "react";
|
6766
7099
|
|
6767
7100
|
// lib/load-overrides.ts
|
6768
7101
|
init_react_import();
|
@@ -6801,26 +7134,26 @@ var useLoadedOverrides = ({
|
|
6801
7134
|
overrides,
|
6802
7135
|
plugins
|
6803
7136
|
}) => {
|
6804
|
-
return
|
7137
|
+
return useMemo17(() => {
|
6805
7138
|
return loadOverrides({ overrides, plugins });
|
6806
7139
|
}, [plugins, overrides]);
|
6807
7140
|
};
|
6808
7141
|
|
6809
7142
|
// components/DefaultOverride/index.tsx
|
6810
7143
|
init_react_import();
|
6811
|
-
import { Fragment as Fragment14, jsx as
|
6812
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
7144
|
+
import { Fragment as Fragment14, jsx as jsx38 } from "react/jsx-runtime";
|
7145
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { children });
|
6813
7146
|
|
6814
7147
|
// lib/use-inject-css.ts
|
6815
7148
|
init_react_import();
|
6816
|
-
import { useEffect as
|
7149
|
+
import { useEffect as useEffect22, useState as useState25 } from "react";
|
6817
7150
|
var styles = ``;
|
6818
7151
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
6819
|
-
const [el, setEl] =
|
6820
|
-
|
7152
|
+
const [el, setEl] = useState25();
|
7153
|
+
useEffect22(() => {
|
6821
7154
|
setEl(document.createElement("style"));
|
6822
7155
|
}, []);
|
6823
|
-
|
7156
|
+
useEffect22(() => {
|
6824
7157
|
var _a;
|
6825
7158
|
if (!el || typeof window === "undefined") {
|
6826
7159
|
return;
|
@@ -6840,10 +7173,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
6840
7173
|
|
6841
7174
|
// lib/use-preview-mode-hotkeys.ts
|
6842
7175
|
init_react_import();
|
6843
|
-
import { useCallback as
|
7176
|
+
import { useCallback as useCallback16 } from "react";
|
6844
7177
|
import { useHotkeys as useHotkeys2 } from "react-hotkeys-hook";
|
6845
7178
|
var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
6846
|
-
const toggleInteractive =
|
7179
|
+
const toggleInteractive = useCallback16(() => {
|
6847
7180
|
dispatch({
|
6848
7181
|
type: "setUi",
|
6849
7182
|
ui: (ui) => ({
|
@@ -6866,7 +7199,7 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
|
6866
7199
|
};
|
6867
7200
|
|
6868
7201
|
// components/Puck/index.tsx
|
6869
|
-
import { Fragment as Fragment15, jsx as
|
7202
|
+
import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
|
6870
7203
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
6871
7204
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
6872
7205
|
function Puck({
|
@@ -6895,7 +7228,7 @@ function Puck({
|
|
6895
7228
|
waitForStyles: true
|
6896
7229
|
}, _iframe);
|
6897
7230
|
useInjectGlobalCss(iframe.enabled);
|
6898
|
-
const [generatedAppState] =
|
7231
|
+
const [generatedAppState] = useState26(() => {
|
6899
7232
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
6900
7233
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
6901
7234
|
let clientUiState = {};
|
@@ -6967,7 +7300,7 @@ function Puck({
|
|
6967
7300
|
histories,
|
6968
7301
|
index: initialHistoryIndex
|
6969
7302
|
});
|
6970
|
-
const [reducer] =
|
7303
|
+
const [reducer] = useState26(
|
6971
7304
|
() => createReducer({
|
6972
7305
|
config,
|
6973
7306
|
record: historyStore.record,
|
@@ -6985,14 +7318,14 @@ function Puck({
|
|
6985
7318
|
historyStore,
|
6986
7319
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
6987
7320
|
});
|
6988
|
-
const [menuOpen, setMenuOpen] =
|
7321
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
6989
7322
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
6990
7323
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
6991
|
-
|
7324
|
+
useEffect23(() => {
|
6992
7325
|
if (onChange) onChange(data);
|
6993
7326
|
}, [data]);
|
6994
7327
|
const rootProps = data.root.props || data.root;
|
6995
|
-
const toggleSidebars =
|
7328
|
+
const toggleSidebars = useCallback17(
|
6996
7329
|
(sidebar) => {
|
6997
7330
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
6998
7331
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -7006,7 +7339,7 @@ function Puck({
|
|
7006
7339
|
},
|
7007
7340
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
7008
7341
|
);
|
7009
|
-
|
7342
|
+
useEffect23(() => {
|
7010
7343
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
7011
7344
|
dispatch({
|
7012
7345
|
type: "setUi",
|
@@ -7029,7 +7362,7 @@ function Puck({
|
|
7029
7362
|
window.removeEventListener("resize", handleResize);
|
7030
7363
|
};
|
7031
7364
|
}, []);
|
7032
|
-
const defaultHeaderRender =
|
7365
|
+
const defaultHeaderRender = useMemo18(() => {
|
7033
7366
|
if (renderHeader) {
|
7034
7367
|
console.warn(
|
7035
7368
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -7037,20 +7370,20 @@ function Puck({
|
|
7037
7370
|
const RenderHeader = (_a2) => {
|
7038
7371
|
var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
|
7039
7372
|
const Comp = renderHeader;
|
7040
|
-
return /* @__PURE__ */
|
7373
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
7041
7374
|
};
|
7042
7375
|
return RenderHeader;
|
7043
7376
|
}
|
7044
7377
|
return DefaultOverride;
|
7045
7378
|
}, [renderHeader]);
|
7046
|
-
const defaultHeaderActionsRender =
|
7379
|
+
const defaultHeaderActionsRender = useMemo18(() => {
|
7047
7380
|
if (renderHeaderActions) {
|
7048
7381
|
console.warn(
|
7049
7382
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
7050
7383
|
);
|
7051
7384
|
const RenderHeader = (props) => {
|
7052
7385
|
const Comp = renderHeaderActions;
|
7053
|
-
return /* @__PURE__ */
|
7386
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
7054
7387
|
};
|
7055
7388
|
return RenderHeader;
|
7056
7389
|
}
|
@@ -7060,27 +7393,27 @@ function Puck({
|
|
7060
7393
|
overrides,
|
7061
7394
|
plugins
|
7062
7395
|
});
|
7063
|
-
const CustomPuck =
|
7396
|
+
const CustomPuck = useMemo18(
|
7064
7397
|
() => loadedOverrides.puck || DefaultOverride,
|
7065
7398
|
[loadedOverrides]
|
7066
7399
|
);
|
7067
|
-
const CustomHeader =
|
7400
|
+
const CustomHeader = useMemo18(
|
7068
7401
|
() => loadedOverrides.header || defaultHeaderRender,
|
7069
7402
|
[loadedOverrides]
|
7070
7403
|
);
|
7071
|
-
const CustomHeaderActions =
|
7404
|
+
const CustomHeaderActions = useMemo18(
|
7072
7405
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7073
7406
|
[loadedOverrides]
|
7074
7407
|
);
|
7075
|
-
const [mounted, setMounted] =
|
7076
|
-
|
7408
|
+
const [mounted, setMounted] = useState26(false);
|
7409
|
+
useEffect23(() => {
|
7077
7410
|
setMounted(true);
|
7078
7411
|
}, []);
|
7079
7412
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
7080
7413
|
const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
|
7081
7414
|
usePreviewModeHotkeys(dispatch, iframe.enabled);
|
7082
7415
|
return /* @__PURE__ */ jsxs20("div", { className: `Puck ${getClassName27()}`, children: [
|
7083
|
-
/* @__PURE__ */
|
7416
|
+
/* @__PURE__ */ jsx39(
|
7084
7417
|
AppProvider,
|
7085
7418
|
{
|
7086
7419
|
value: {
|
@@ -7102,7 +7435,7 @@ function Puck({
|
|
7102
7435
|
getPermissions: () => ({}),
|
7103
7436
|
refreshPermissions: () => null
|
7104
7437
|
},
|
7105
|
-
children: /* @__PURE__ */
|
7438
|
+
children: /* @__PURE__ */ jsx39(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
|
7106
7439
|
"div",
|
7107
7440
|
{
|
7108
7441
|
className: getLayoutClassName({
|
@@ -7112,59 +7445,59 @@ function Puck({
|
|
7112
7445
|
rightSideBarVisible
|
7113
7446
|
}),
|
7114
7447
|
children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("inner"), children: [
|
7115
|
-
/* @__PURE__ */
|
7448
|
+
/* @__PURE__ */ jsx39(
|
7116
7449
|
CustomHeader,
|
7117
7450
|
{
|
7118
|
-
actions: /* @__PURE__ */
|
7451
|
+
actions: /* @__PURE__ */ jsx39(Fragment15, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
7119
7452
|
Button,
|
7120
7453
|
{
|
7121
7454
|
onClick: () => {
|
7122
7455
|
onPublish && onPublish(data);
|
7123
7456
|
},
|
7124
|
-
icon: /* @__PURE__ */
|
7457
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
7125
7458
|
children: "Publish"
|
7126
7459
|
}
|
7127
7460
|
) }) }),
|
7128
|
-
children: /* @__PURE__ */
|
7461
|
+
children: /* @__PURE__ */ jsx39("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerInner"), children: [
|
7129
7462
|
/* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerToggle"), children: [
|
7130
|
-
/* @__PURE__ */
|
7463
|
+
/* @__PURE__ */ jsx39(
|
7131
7464
|
"div",
|
7132
7465
|
{
|
7133
7466
|
className: getLayoutClassName("leftSideBarToggle"),
|
7134
|
-
children: /* @__PURE__ */
|
7467
|
+
children: /* @__PURE__ */ jsx39(
|
7135
7468
|
IconButton,
|
7136
7469
|
{
|
7137
7470
|
onClick: () => {
|
7138
7471
|
toggleSidebars("left");
|
7139
7472
|
},
|
7140
7473
|
title: "Toggle left sidebar",
|
7141
|
-
children: /* @__PURE__ */
|
7474
|
+
children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
|
7142
7475
|
}
|
7143
7476
|
)
|
7144
7477
|
}
|
7145
7478
|
),
|
7146
|
-
/* @__PURE__ */
|
7479
|
+
/* @__PURE__ */ jsx39(
|
7147
7480
|
"div",
|
7148
7481
|
{
|
7149
7482
|
className: getLayoutClassName("rightSideBarToggle"),
|
7150
|
-
children: /* @__PURE__ */
|
7483
|
+
children: /* @__PURE__ */ jsx39(
|
7151
7484
|
IconButton,
|
7152
7485
|
{
|
7153
7486
|
onClick: () => {
|
7154
7487
|
toggleSidebars("right");
|
7155
7488
|
},
|
7156
7489
|
title: "Toggle right sidebar",
|
7157
|
-
children: /* @__PURE__ */
|
7490
|
+
children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
|
7158
7491
|
}
|
7159
7492
|
)
|
7160
7493
|
}
|
7161
7494
|
)
|
7162
7495
|
] }),
|
7163
|
-
/* @__PURE__ */
|
7496
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs20(Heading, { rank: "2", size: "xs", children: [
|
7164
7497
|
headerTitle || rootProps.title || "Page",
|
7165
7498
|
headerPath && /* @__PURE__ */ jsxs20(Fragment15, { children: [
|
7166
7499
|
" ",
|
7167
|
-
/* @__PURE__ */
|
7500
|
+
/* @__PURE__ */ jsx39(
|
7168
7501
|
"code",
|
7169
7502
|
{
|
7170
7503
|
className: getLayoutClassName("headerPath"),
|
@@ -7174,30 +7507,30 @@ function Puck({
|
|
7174
7507
|
] })
|
7175
7508
|
] }) }),
|
7176
7509
|
/* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerTools"), children: [
|
7177
|
-
/* @__PURE__ */
|
7510
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ jsx39(
|
7178
7511
|
IconButton,
|
7179
7512
|
{
|
7180
7513
|
onClick: () => {
|
7181
7514
|
return setMenuOpen(!menuOpen);
|
7182
7515
|
},
|
7183
7516
|
title: "Toggle menu bar",
|
7184
|
-
children: menuOpen ? /* @__PURE__ */
|
7517
|
+
children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
|
7185
7518
|
}
|
7186
7519
|
) }),
|
7187
|
-
/* @__PURE__ */
|
7520
|
+
/* @__PURE__ */ jsx39(
|
7188
7521
|
MenuBar,
|
7189
7522
|
{
|
7190
7523
|
appState,
|
7191
7524
|
dispatch,
|
7192
7525
|
onPublish,
|
7193
7526
|
menuOpen,
|
7194
|
-
renderHeaderActions: () => /* @__PURE__ */
|
7527
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
7195
7528
|
Button,
|
7196
7529
|
{
|
7197
7530
|
onClick: () => {
|
7198
7531
|
onPublish && onPublish(data);
|
7199
7532
|
},
|
7200
|
-
icon: /* @__PURE__ */
|
7533
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
7201
7534
|
children: "Publish"
|
7202
7535
|
}
|
7203
7536
|
) }),
|
@@ -7209,18 +7542,18 @@ function Puck({
|
|
7209
7542
|
}
|
7210
7543
|
),
|
7211
7544
|
/* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("leftSideBar"), children: [
|
7212
|
-
/* @__PURE__ */
|
7213
|
-
/* @__PURE__ */
|
7545
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx39(Components, {}) }),
|
7546
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx39(Outline, {}) })
|
7214
7547
|
] }),
|
7215
|
-
/* @__PURE__ */
|
7216
|
-
/* @__PURE__ */
|
7548
|
+
/* @__PURE__ */ jsx39(Canvas, {}),
|
7549
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx39(
|
7217
7550
|
SidebarSection,
|
7218
7551
|
{
|
7219
7552
|
noPadding: true,
|
7220
7553
|
noBorderTop: true,
|
7221
7554
|
showBreadcrumbs: true,
|
7222
7555
|
title: selectedItem ? selectedComponentLabel : "Page",
|
7223
|
-
children: /* @__PURE__ */
|
7556
|
+
children: /* @__PURE__ */ jsx39(Fields, {})
|
7224
7557
|
}
|
7225
7558
|
) })
|
7226
7559
|
] })
|
@@ -7228,13 +7561,13 @@ function Puck({
|
|
7228
7561
|
) }) })
|
7229
7562
|
}
|
7230
7563
|
),
|
7231
|
-
/* @__PURE__ */
|
7564
|
+
/* @__PURE__ */ jsx39("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
7232
7565
|
] });
|
7233
7566
|
}
|
7234
7567
|
Puck.Components = Components;
|
7235
7568
|
Puck.Fields = Fields;
|
7236
7569
|
Puck.Outline = Outline;
|
7237
|
-
Puck.Preview =
|
7570
|
+
Puck.Preview = Preview2;
|
7238
7571
|
|
7239
7572
|
// lib/migrate.ts
|
7240
7573
|
init_react_import();
|