@measured/puck 0.18.0-canary.066aba9 → 0.18.0-canary.37cfc43
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 +1224 -880
- package/dist/index.mjs +1156 -809
- 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
|
-
|
4544
|
-
}
|
4545
|
-
if (zoneChanged) {
|
4546
|
-
setDeepestAndCollide(params, manager);
|
4857
|
+
cancelDb();
|
4547
4858
|
}
|
4548
|
-
|
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;
|
@@ -5200,19 +5533,33 @@ var useResolvedFields = () => {
|
|
5200
5533
|
lastData
|
5201
5534
|
});
|
5202
5535
|
}),
|
5203
|
-
[data, config, componentData, selectedItem, resolvedFields, state]
|
5536
|
+
[data, config, componentData, selectedItem, resolvedFields, state, parent]
|
5204
5537
|
);
|
5205
|
-
|
5206
|
-
|
5207
|
-
|
5208
|
-
|
5209
|
-
|
5210
|
-
|
5211
|
-
|
5212
|
-
|
5213
|
-
|
5538
|
+
const [hasParent, setHasParent] = useState19(false);
|
5539
|
+
useEffect16(() => {
|
5540
|
+
setHasParent(!!parent);
|
5541
|
+
}, [parent]);
|
5542
|
+
useEffect16(() => {
|
5543
|
+
var _a2;
|
5544
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || hasParent) {
|
5545
|
+
if (hasResolver) {
|
5546
|
+
setFieldsLoading(true);
|
5547
|
+
resolveFields(defaultFields).then((fields) => {
|
5548
|
+
setResolvedFields(fields || {});
|
5549
|
+
setFieldsLoading(false);
|
5550
|
+
});
|
5551
|
+
} else {
|
5552
|
+
setResolvedFields(defaultFields);
|
5553
|
+
}
|
5214
5554
|
}
|
5215
|
-
}, [
|
5555
|
+
}, [
|
5556
|
+
data,
|
5557
|
+
defaultFields,
|
5558
|
+
state.ui.itemSelector,
|
5559
|
+
selectedItem,
|
5560
|
+
hasResolver,
|
5561
|
+
hasParent
|
5562
|
+
]);
|
5216
5563
|
return [resolvedFields, fieldsLoading];
|
5217
5564
|
};
|
5218
5565
|
var Fields = () => {
|
@@ -5233,7 +5580,7 @@ var Fields = () => {
|
|
5233
5580
|
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
5581
|
const isLoading = fieldsResolving || componentResolving;
|
5235
5582
|
const rootProps = data.root.props || data.root;
|
5236
|
-
const Wrapper =
|
5583
|
+
const Wrapper = useMemo11(() => overrides.fields || DefaultFields, [overrides]);
|
5237
5584
|
return /* @__PURE__ */ jsxs14(
|
5238
5585
|
"form",
|
5239
5586
|
{
|
@@ -5242,7 +5589,7 @@ var Fields = () => {
|
|
5242
5589
|
e.preventDefault();
|
5243
5590
|
},
|
5244
5591
|
children: [
|
5245
|
-
/* @__PURE__ */
|
5592
|
+
/* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
5246
5593
|
const field = fields[fieldName];
|
5247
5594
|
if (!(field == null ? void 0 : field.type)) return null;
|
5248
5595
|
const onChange = (value, updatedUi) => {
|
@@ -5313,7 +5660,7 @@ var Fields = () => {
|
|
5313
5660
|
item: selectedItem
|
5314
5661
|
});
|
5315
5662
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
5316
|
-
return /* @__PURE__ */
|
5663
|
+
return /* @__PURE__ */ jsx27(
|
5317
5664
|
AutoFieldPrivate,
|
5318
5665
|
{
|
5319
5666
|
field,
|
@@ -5331,7 +5678,7 @@ var Fields = () => {
|
|
5331
5678
|
root: true
|
5332
5679
|
});
|
5333
5680
|
const id = `root_${field.type}_${fieldName}`;
|
5334
|
-
return /* @__PURE__ */
|
5681
|
+
return /* @__PURE__ */ jsx27(
|
5335
5682
|
AutoFieldPrivate,
|
5336
5683
|
{
|
5337
5684
|
field,
|
@@ -5345,7 +5692,7 @@ var Fields = () => {
|
|
5345
5692
|
);
|
5346
5693
|
}
|
5347
5694
|
}) }),
|
5348
|
-
isLoading && /* @__PURE__ */
|
5695
|
+
isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
|
5349
5696
|
]
|
5350
5697
|
}
|
5351
5698
|
);
|
@@ -5356,7 +5703,7 @@ init_react_import();
|
|
5356
5703
|
|
5357
5704
|
// lib/use-component-list.tsx
|
5358
5705
|
init_react_import();
|
5359
|
-
import { useEffect as
|
5706
|
+
import { useEffect as useEffect17, useState as useState20 } from "react";
|
5360
5707
|
|
5361
5708
|
// components/ComponentList/index.tsx
|
5362
5709
|
init_react_import();
|
@@ -5366,7 +5713,7 @@ init_react_import();
|
|
5366
5713
|
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
5714
|
|
5368
5715
|
// components/ComponentList/index.tsx
|
5369
|
-
import { jsx as
|
5716
|
+
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
5370
5717
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
5371
5718
|
var ComponentListItem = ({
|
5372
5719
|
name,
|
@@ -5376,7 +5723,7 @@ var ComponentListItem = ({
|
|
5376
5723
|
const canInsert = getPermissions({
|
5377
5724
|
type: name
|
5378
5725
|
}).insert;
|
5379
|
-
return /* @__PURE__ */
|
5726
|
+
return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
5380
5727
|
};
|
5381
5728
|
var ComponentList = ({
|
5382
5729
|
children,
|
@@ -5400,14 +5747,14 @@ var ComponentList = ({
|
|
5400
5747
|
}),
|
5401
5748
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
5402
5749
|
children: [
|
5403
|
-
/* @__PURE__ */
|
5404
|
-
/* @__PURE__ */
|
5750
|
+
/* @__PURE__ */ jsx28("div", { children: title }),
|
5751
|
+
/* @__PURE__ */ jsx28("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
|
5405
5752
|
]
|
5406
5753
|
}
|
5407
5754
|
),
|
5408
|
-
/* @__PURE__ */
|
5755
|
+
/* @__PURE__ */ jsx28("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
5409
5756
|
var _a;
|
5410
|
-
return /* @__PURE__ */
|
5757
|
+
return /* @__PURE__ */ jsx28(
|
5411
5758
|
ComponentListItem,
|
5412
5759
|
{
|
5413
5760
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -5421,10 +5768,10 @@ var ComponentList = ({
|
|
5421
5768
|
ComponentList.Item = ComponentListItem;
|
5422
5769
|
|
5423
5770
|
// lib/use-component-list.tsx
|
5424
|
-
import { jsx as
|
5771
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
5425
5772
|
var useComponentList = (config, ui) => {
|
5426
|
-
const [componentList, setComponentList] =
|
5427
|
-
|
5773
|
+
const [componentList, setComponentList] = useState20();
|
5774
|
+
useEffect17(() => {
|
5428
5775
|
var _a, _b, _c;
|
5429
5776
|
if (Object.keys(ui.componentList).length > 0) {
|
5430
5777
|
const matchedComponents = [];
|
@@ -5434,7 +5781,7 @@ var useComponentList = (config, ui) => {
|
|
5434
5781
|
if (category.visible === false || !category.components) {
|
5435
5782
|
return null;
|
5436
5783
|
}
|
5437
|
-
return /* @__PURE__ */
|
5784
|
+
return /* @__PURE__ */ jsx29(
|
5438
5785
|
ComponentList,
|
5439
5786
|
{
|
5440
5787
|
id: categoryKey,
|
@@ -5443,7 +5790,7 @@ var useComponentList = (config, ui) => {
|
|
5443
5790
|
var _a2;
|
5444
5791
|
matchedComponents.push(componentName);
|
5445
5792
|
const componentConf = config.components[componentName] || {};
|
5446
|
-
return /* @__PURE__ */
|
5793
|
+
return /* @__PURE__ */ jsx29(
|
5447
5794
|
ComponentList.Item,
|
5448
5795
|
{
|
5449
5796
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -5463,7 +5810,7 @@ var useComponentList = (config, ui) => {
|
|
5463
5810
|
);
|
5464
5811
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
5465
5812
|
_componentList.push(
|
5466
|
-
/* @__PURE__ */
|
5813
|
+
/* @__PURE__ */ jsx29(
|
5467
5814
|
ComponentList,
|
5468
5815
|
{
|
5469
5816
|
id: "other",
|
@@ -5471,7 +5818,7 @@ var useComponentList = (config, ui) => {
|
|
5471
5818
|
children: remainingComponents.map((componentName, i) => {
|
5472
5819
|
var _a2;
|
5473
5820
|
const componentConf = config.components[componentName] || {};
|
5474
|
-
return /* @__PURE__ */
|
5821
|
+
return /* @__PURE__ */ jsx29(
|
5475
5822
|
ComponentList.Item,
|
5476
5823
|
{
|
5477
5824
|
name: componentName,
|
@@ -5493,30 +5840,30 @@ var useComponentList = (config, ui) => {
|
|
5493
5840
|
};
|
5494
5841
|
|
5495
5842
|
// components/Puck/components/Components/index.tsx
|
5496
|
-
import { useMemo as
|
5497
|
-
import { jsx as
|
5843
|
+
import { useMemo as useMemo12 } from "react";
|
5844
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
5498
5845
|
var Components = () => {
|
5499
5846
|
const { config, state, overrides } = useAppContext();
|
5500
5847
|
const componentList = useComponentList(config, state.ui);
|
5501
|
-
const Wrapper =
|
5502
|
-
return /* @__PURE__ */
|
5848
|
+
const Wrapper = useMemo12(() => overrides.components || "div", [overrides]);
|
5849
|
+
return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
|
5503
5850
|
};
|
5504
5851
|
|
5505
5852
|
// components/Puck/components/Preview/index.tsx
|
5506
5853
|
init_react_import();
|
5507
|
-
import { useCallback as
|
5854
|
+
import { useCallback as useCallback13, useEffect as useEffect19, useRef as useRef6, useMemo as useMemo13 } from "react";
|
5508
5855
|
|
5509
5856
|
// components/AutoFrame/index.tsx
|
5510
5857
|
init_react_import();
|
5511
5858
|
import {
|
5512
|
-
createContext as
|
5513
|
-
useContext as
|
5514
|
-
useEffect as
|
5515
|
-
useState as
|
5859
|
+
createContext as createContext5,
|
5860
|
+
useContext as useContext10,
|
5861
|
+
useEffect as useEffect18,
|
5862
|
+
useState as useState21
|
5516
5863
|
} from "react";
|
5517
5864
|
import hash from "object-hash";
|
5518
5865
|
import { createPortal as createPortal3 } from "react-dom";
|
5519
|
-
import { Fragment as Fragment9, jsx as
|
5866
|
+
import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
|
5520
5867
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
5521
5868
|
var collectStyles = (doc) => {
|
5522
5869
|
const collected = [];
|
@@ -5559,7 +5906,7 @@ var CopyHostStyles = ({
|
|
5559
5906
|
onStylesLoaded = () => null
|
5560
5907
|
}) => {
|
5561
5908
|
const { document: doc, window: win } = useFrame();
|
5562
|
-
|
5909
|
+
useEffect18(() => {
|
5563
5910
|
if (!win || !doc) {
|
5564
5911
|
return () => {
|
5565
5912
|
};
|
@@ -5716,10 +6063,10 @@ var CopyHostStyles = ({
|
|
5716
6063
|
observer.disconnect();
|
5717
6064
|
};
|
5718
6065
|
}, []);
|
5719
|
-
return /* @__PURE__ */
|
6066
|
+
return /* @__PURE__ */ jsx31(Fragment9, { children });
|
5720
6067
|
};
|
5721
|
-
var autoFrameContext =
|
5722
|
-
var useFrame = () =>
|
6068
|
+
var autoFrameContext = createContext5({});
|
6069
|
+
var useFrame = () => useContext10(autoFrameContext);
|
5723
6070
|
function AutoFrame(_a) {
|
5724
6071
|
var _b = _a, {
|
5725
6072
|
children,
|
@@ -5736,10 +6083,10 @@ function AutoFrame(_a) {
|
|
5736
6083
|
"onStylesLoaded",
|
5737
6084
|
"frameRef"
|
5738
6085
|
]);
|
5739
|
-
const [loaded, setLoaded] =
|
5740
|
-
const [ctx, setCtx] =
|
5741
|
-
const [mountTarget, setMountTarget] =
|
5742
|
-
|
6086
|
+
const [loaded, setLoaded] = useState21(false);
|
6087
|
+
const [ctx, setCtx] = useState21({});
|
6088
|
+
const [mountTarget, setMountTarget] = useState21();
|
6089
|
+
useEffect18(() => {
|
5743
6090
|
var _a2;
|
5744
6091
|
if (frameRef.current) {
|
5745
6092
|
setCtx({
|
@@ -5751,7 +6098,7 @@ function AutoFrame(_a) {
|
|
5751
6098
|
);
|
5752
6099
|
}
|
5753
6100
|
}, [frameRef, loaded]);
|
5754
|
-
return /* @__PURE__ */
|
6101
|
+
return /* @__PURE__ */ jsx31(
|
5755
6102
|
"iframe",
|
5756
6103
|
__spreadProps(__spreadValues({}, props), {
|
5757
6104
|
className,
|
@@ -5761,7 +6108,7 @@ function AutoFrame(_a) {
|
|
5761
6108
|
onLoad: () => {
|
5762
6109
|
setLoaded(true);
|
5763
6110
|
},
|
5764
|
-
children: /* @__PURE__ */
|
6111
|
+
children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(CopyHostStyles, { debug, onStylesLoaded, children: createPortal3(children, mountTarget) }) })
|
5765
6112
|
})
|
5766
6113
|
);
|
5767
6114
|
}
|
@@ -5774,7 +6121,7 @@ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
|
|
5774
6121
|
|
5775
6122
|
// components/Render/index.tsx
|
5776
6123
|
init_react_import();
|
5777
|
-
import { jsx as
|
6124
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
5778
6125
|
function Render({
|
5779
6126
|
config,
|
5780
6127
|
data
|
@@ -5787,7 +6134,7 @@ function Render({
|
|
5787
6134
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
5788
6135
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
5789
6136
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5790
|
-
return /* @__PURE__ */
|
6137
|
+
return /* @__PURE__ */ jsx32(
|
5791
6138
|
DropZoneProvider,
|
5792
6139
|
{
|
5793
6140
|
value: {
|
@@ -5797,7 +6144,7 @@ function Render({
|
|
5797
6144
|
depth: 0,
|
5798
6145
|
path: []
|
5799
6146
|
},
|
5800
|
-
children: /* @__PURE__ */
|
6147
|
+
children: /* @__PURE__ */ jsx32(
|
5801
6148
|
config.root.render,
|
5802
6149
|
__spreadProps(__spreadValues({}, rootProps), {
|
5803
6150
|
puck: {
|
@@ -5807,13 +6154,13 @@ function Render({
|
|
5807
6154
|
title,
|
5808
6155
|
editMode: false,
|
5809
6156
|
id: "puck-root",
|
5810
|
-
children: /* @__PURE__ */
|
6157
|
+
children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
|
5811
6158
|
})
|
5812
6159
|
)
|
5813
6160
|
}
|
5814
6161
|
);
|
5815
6162
|
}
|
5816
|
-
return /* @__PURE__ */
|
6163
|
+
return /* @__PURE__ */ jsx32(
|
5817
6164
|
DropZoneProvider,
|
5818
6165
|
{
|
5819
6166
|
value: {
|
@@ -5823,17 +6170,17 @@ function Render({
|
|
5823
6170
|
depth: 0,
|
5824
6171
|
path: []
|
5825
6172
|
},
|
5826
|
-
children: /* @__PURE__ */
|
6173
|
+
children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
|
5827
6174
|
}
|
5828
6175
|
);
|
5829
6176
|
}
|
5830
6177
|
|
5831
6178
|
// components/Puck/components/Preview/index.tsx
|
5832
|
-
import { Fragment as Fragment10, jsx as
|
6179
|
+
import { Fragment as Fragment10, jsx as jsx33 } from "react/jsx-runtime";
|
5833
6180
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
5834
6181
|
var useBubbleIframeEvents = (ref) => {
|
5835
6182
|
const { status } = useAppContext();
|
5836
|
-
|
6183
|
+
useEffect19(() => {
|
5837
6184
|
var _a;
|
5838
6185
|
if (ref.current && status === "READY") {
|
5839
6186
|
const iframe = ref.current;
|
@@ -5870,22 +6217,22 @@ var useBubbleIframeEvents = (ref) => {
|
|
5870
6217
|
}
|
5871
6218
|
}, [status]);
|
5872
6219
|
};
|
5873
|
-
var
|
6220
|
+
var Preview2 = ({ id = "puck-preview" }) => {
|
5874
6221
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
5875
|
-
const Page =
|
6222
|
+
const Page = useCallback13(
|
5876
6223
|
(pageProps) => {
|
5877
6224
|
var _a, _b;
|
5878
6225
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
5879
6226
|
id: "puck-root"
|
5880
|
-
}, pageProps)) : /* @__PURE__ */
|
6227
|
+
}, pageProps)) : /* @__PURE__ */ jsx33(Fragment10, { children: pageProps.children });
|
5881
6228
|
},
|
5882
6229
|
[config.root]
|
5883
6230
|
);
|
5884
|
-
const Frame =
|
6231
|
+
const Frame = useMemo13(() => overrides.iframe, [overrides]);
|
5885
6232
|
const rootProps = state.data.root.props || state.data.root;
|
5886
|
-
const ref =
|
6233
|
+
const ref = useRef6(null);
|
5887
6234
|
useBubbleIframeEvents(ref);
|
5888
|
-
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */
|
6235
|
+
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx33(
|
5889
6236
|
Page,
|
5890
6237
|
__spreadProps(__spreadValues({}, rootProps), {
|
5891
6238
|
puck: {
|
@@ -5894,10 +6241,10 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5894
6241
|
dragRef: null
|
5895
6242
|
},
|
5896
6243
|
editMode: true,
|
5897
|
-
children: /* @__PURE__ */
|
6244
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
5898
6245
|
})
|
5899
|
-
) : /* @__PURE__ */
|
5900
|
-
return /* @__PURE__ */
|
6246
|
+
) : /* @__PURE__ */ jsx33(Render, { data: state.data, config });
|
6247
|
+
return /* @__PURE__ */ jsx33(
|
5901
6248
|
"div",
|
5902
6249
|
{
|
5903
6250
|
className: getClassName23(),
|
@@ -5906,7 +6253,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5906
6253
|
onClick: () => {
|
5907
6254
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
5908
6255
|
},
|
5909
|
-
children: iframe.enabled ? /* @__PURE__ */
|
6256
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx33(
|
5910
6257
|
AutoFrame_default,
|
5911
6258
|
{
|
5912
6259
|
id: "preview-frame",
|
@@ -5916,14 +6263,14 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5916
6263
|
setStatus("READY");
|
5917
6264
|
},
|
5918
6265
|
frameRef: ref,
|
5919
|
-
children: /* @__PURE__ */
|
6266
|
+
children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
5920
6267
|
if (Frame) {
|
5921
|
-
return /* @__PURE__ */
|
6268
|
+
return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
|
5922
6269
|
}
|
5923
6270
|
return inner;
|
5924
6271
|
} })
|
5925
6272
|
}
|
5926
|
-
) : /* @__PURE__ */
|
6273
|
+
) : /* @__PURE__ */ jsx33(
|
5927
6274
|
"div",
|
5928
6275
|
{
|
5929
6276
|
id: "preview-frame",
|
@@ -5980,7 +6327,7 @@ var scrollIntoView = (el) => {
|
|
5980
6327
|
};
|
5981
6328
|
|
5982
6329
|
// components/LayerTree/index.tsx
|
5983
|
-
import { useContext as
|
6330
|
+
import { useContext as useContext11 } from "react";
|
5984
6331
|
|
5985
6332
|
// lib/is-child-of-zone.ts
|
5986
6333
|
init_react_import();
|
@@ -6013,7 +6360,7 @@ var onScrollEnd = (frame, cb) => {
|
|
6013
6360
|
};
|
6014
6361
|
|
6015
6362
|
// components/LayerTree/index.tsx
|
6016
|
-
import { Fragment as Fragment11, jsx as
|
6363
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
|
6017
6364
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
6018
6365
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
6019
6366
|
var LayerTree = ({
|
@@ -6026,15 +6373,15 @@ var LayerTree = ({
|
|
6026
6373
|
label
|
6027
6374
|
}) => {
|
6028
6375
|
const zones = data.zones || {};
|
6029
|
-
const ctx =
|
6376
|
+
const ctx = useContext11(dropZoneContext);
|
6030
6377
|
return /* @__PURE__ */ jsxs16(Fragment11, { children: [
|
6031
6378
|
label && /* @__PURE__ */ jsxs16("div", { className: getClassName24("zoneTitle"), children: [
|
6032
|
-
/* @__PURE__ */
|
6379
|
+
/* @__PURE__ */ jsx34("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx34(Layers, { size: "16" }) }),
|
6033
6380
|
" ",
|
6034
6381
|
label
|
6035
6382
|
] }),
|
6036
6383
|
/* @__PURE__ */ jsxs16("ul", { className: getClassName24(), children: [
|
6037
|
-
zoneContent.length === 0 && /* @__PURE__ */
|
6384
|
+
zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
|
6038
6385
|
zoneContent.map((item, i) => {
|
6039
6386
|
var _a;
|
6040
6387
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -6057,7 +6404,7 @@ var LayerTree = ({
|
|
6057
6404
|
childIsSelected
|
6058
6405
|
}),
|
6059
6406
|
children: [
|
6060
|
-
/* @__PURE__ */
|
6407
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs16(
|
6061
6408
|
"button",
|
6062
6409
|
{
|
6063
6410
|
type: "button",
|
@@ -6096,22 +6443,22 @@ var LayerTree = ({
|
|
6096
6443
|
setHoveringComponent(null);
|
6097
6444
|
},
|
6098
6445
|
children: [
|
6099
|
-
containsZone && /* @__PURE__ */
|
6446
|
+
containsZone && /* @__PURE__ */ jsx34(
|
6100
6447
|
"div",
|
6101
6448
|
{
|
6102
6449
|
className: getClassNameLayer("chevron"),
|
6103
6450
|
title: isSelected ? "Collapse" : "Expand",
|
6104
|
-
children: /* @__PURE__ */
|
6451
|
+
children: /* @__PURE__ */ jsx34(ChevronDown, { size: "12" })
|
6105
6452
|
}
|
6106
6453
|
),
|
6107
6454
|
/* @__PURE__ */ jsxs16("div", { className: getClassNameLayer("title"), children: [
|
6108
|
-
/* @__PURE__ */
|
6109
|
-
/* @__PURE__ */
|
6455
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx34(Type, { size: "16" }) : /* @__PURE__ */ jsx34(LayoutGrid, { size: "16" }) }),
|
6456
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("name"), children: label2 })
|
6110
6457
|
] })
|
6111
6458
|
]
|
6112
6459
|
}
|
6113
6460
|
) }),
|
6114
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */
|
6461
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx34(
|
6115
6462
|
LayerTree,
|
6116
6463
|
{
|
6117
6464
|
config,
|
@@ -6133,13 +6480,13 @@ var LayerTree = ({
|
|
6133
6480
|
};
|
6134
6481
|
|
6135
6482
|
// components/Puck/components/Outline/index.tsx
|
6136
|
-
import { useCallback as
|
6137
|
-
import { Fragment as Fragment12, jsx as
|
6483
|
+
import { useCallback as useCallback14, useMemo as useMemo14 } from "react";
|
6484
|
+
import { Fragment as Fragment12, jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
6138
6485
|
var Outline = () => {
|
6139
6486
|
const { dispatch, state, overrides, config } = useAppContext();
|
6140
6487
|
const { data, ui } = state;
|
6141
6488
|
const { itemSelector } = ui;
|
6142
|
-
const setItemSelector =
|
6489
|
+
const setItemSelector = useCallback14(
|
6143
6490
|
(newItemSelector) => {
|
6144
6491
|
dispatch({
|
6145
6492
|
type: "setUi",
|
@@ -6148,9 +6495,9 @@ var Outline = () => {
|
|
6148
6495
|
},
|
6149
6496
|
[]
|
6150
6497
|
);
|
6151
|
-
const Wrapper =
|
6152
|
-
return /* @__PURE__ */
|
6153
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */
|
6498
|
+
const Wrapper = useMemo14(() => overrides.outline || "div", [overrides]);
|
6499
|
+
return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
|
6500
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
|
6154
6501
|
LayerTree,
|
6155
6502
|
{
|
6156
6503
|
config,
|
@@ -6163,7 +6510,7 @@ var Outline = () => {
|
|
6163
6510
|
),
|
6164
6511
|
Object.entries(findZonesForArea(data, "root")).map(
|
6165
6512
|
([zoneKey, zone]) => {
|
6166
|
-
return /* @__PURE__ */
|
6513
|
+
return /* @__PURE__ */ jsx35(
|
6167
6514
|
LayerTree,
|
6168
6515
|
{
|
6169
6516
|
config,
|
@@ -6262,19 +6609,19 @@ function usePuckHistory({
|
|
6262
6609
|
|
6263
6610
|
// lib/use-history-store.ts
|
6264
6611
|
init_react_import();
|
6265
|
-
import { useState as
|
6612
|
+
import { useState as useState22 } from "react";
|
6266
6613
|
import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
|
6267
6614
|
var EMPTY_HISTORY_INDEX = 0;
|
6268
6615
|
function useHistoryStore(initialHistory) {
|
6269
6616
|
var _a, _b;
|
6270
|
-
const [histories, setHistories] =
|
6617
|
+
const [histories, setHistories] = useState22(
|
6271
6618
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6272
6619
|
);
|
6273
6620
|
const updateHistories = (histories2) => {
|
6274
6621
|
setHistories(histories2);
|
6275
6622
|
setIndex(histories2.length - 1);
|
6276
6623
|
};
|
6277
|
-
const [index, setIndex] =
|
6624
|
+
const [index, setIndex] = useState22(
|
6278
6625
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6279
6626
|
);
|
6280
6627
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -6435,27 +6782,27 @@ var getBox = function getBox2(el) {
|
|
6435
6782
|
|
6436
6783
|
// components/Puck/components/Canvas/index.tsx
|
6437
6784
|
import {
|
6438
|
-
useCallback as
|
6439
|
-
useEffect as
|
6440
|
-
useMemo as
|
6441
|
-
useRef as
|
6442
|
-
useState as
|
6785
|
+
useCallback as useCallback15,
|
6786
|
+
useEffect as useEffect21,
|
6787
|
+
useMemo as useMemo16,
|
6788
|
+
useRef as useRef7,
|
6789
|
+
useState as useState24
|
6443
6790
|
} from "react";
|
6444
6791
|
|
6445
6792
|
// components/ViewportControls/index.tsx
|
6446
6793
|
init_react_import();
|
6447
|
-
import { useEffect as
|
6794
|
+
import { useEffect as useEffect20, useMemo as useMemo15, useState as useState23 } from "react";
|
6448
6795
|
|
6449
6796
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
6450
6797
|
init_react_import();
|
6451
6798
|
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
6799
|
|
6453
6800
|
// components/ViewportControls/index.tsx
|
6454
|
-
import { jsx as
|
6801
|
+
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
6455
6802
|
var icons = {
|
6456
|
-
Smartphone: /* @__PURE__ */
|
6457
|
-
Tablet: /* @__PURE__ */
|
6458
|
-
Monitor: /* @__PURE__ */
|
6803
|
+
Smartphone: /* @__PURE__ */ jsx36(Smartphone, { size: 16 }),
|
6804
|
+
Tablet: /* @__PURE__ */ jsx36(Tablet, { size: 16 }),
|
6805
|
+
Monitor: /* @__PURE__ */ jsx36(Monitor, { size: 16 })
|
6459
6806
|
};
|
6460
6807
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
6461
6808
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -6467,11 +6814,11 @@ var ViewportButton = ({
|
|
6467
6814
|
onClick
|
6468
6815
|
}) => {
|
6469
6816
|
const { state } = useAppContext();
|
6470
|
-
const [isActive, setIsActive] =
|
6471
|
-
|
6817
|
+
const [isActive, setIsActive] = useState23(false);
|
6818
|
+
useEffect20(() => {
|
6472
6819
|
setIsActive(width === state.ui.viewports.current.width);
|
6473
6820
|
}, [width, state.ui.viewports.current.width]);
|
6474
|
-
return /* @__PURE__ */
|
6821
|
+
return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
|
6475
6822
|
IconButton,
|
6476
6823
|
{
|
6477
6824
|
title,
|
@@ -6480,7 +6827,7 @@ var ViewportButton = ({
|
|
6480
6827
|
e.stopPropagation();
|
6481
6828
|
onClick({ width, height });
|
6482
6829
|
},
|
6483
|
-
children: /* @__PURE__ */
|
6830
|
+
children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
|
6484
6831
|
}
|
6485
6832
|
) });
|
6486
6833
|
};
|
@@ -6504,7 +6851,7 @@ var ViewportControls = ({
|
|
6504
6851
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
6505
6852
|
(option) => option.value === autoZoom
|
6506
6853
|
);
|
6507
|
-
const zoomOptions =
|
6854
|
+
const zoomOptions = useMemo15(
|
6508
6855
|
() => [
|
6509
6856
|
...defaultZoomOptions,
|
6510
6857
|
...defaultsContainAutoZoom ? [] : [
|
@@ -6517,7 +6864,7 @@ var ViewportControls = ({
|
|
6517
6864
|
[autoZoom]
|
6518
6865
|
);
|
6519
6866
|
return /* @__PURE__ */ jsxs18("div", { className: getClassName25(), children: [
|
6520
|
-
viewports.map((viewport, i) => /* @__PURE__ */
|
6867
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
|
6521
6868
|
ViewportButton,
|
6522
6869
|
{
|
6523
6870
|
height: viewport.height,
|
@@ -6528,8 +6875,8 @@ var ViewportControls = ({
|
|
6528
6875
|
},
|
6529
6876
|
i
|
6530
6877
|
)),
|
6531
|
-
/* @__PURE__ */
|
6532
|
-
/* @__PURE__ */
|
6878
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
6879
|
+
/* @__PURE__ */ jsx36(
|
6533
6880
|
IconButton,
|
6534
6881
|
{
|
6535
6882
|
title: "Zoom viewport out",
|
@@ -6543,10 +6890,10 @@ var ViewportControls = ({
|
|
6543
6890
|
)].value
|
6544
6891
|
);
|
6545
6892
|
},
|
6546
|
-
children: /* @__PURE__ */
|
6893
|
+
children: /* @__PURE__ */ jsx36(ZoomOut, { size: 16 })
|
6547
6894
|
}
|
6548
6895
|
),
|
6549
|
-
/* @__PURE__ */
|
6896
|
+
/* @__PURE__ */ jsx36(
|
6550
6897
|
IconButton,
|
6551
6898
|
{
|
6552
6899
|
title: "Zoom viewport in",
|
@@ -6560,11 +6907,11 @@ var ViewportControls = ({
|
|
6560
6907
|
)].value
|
6561
6908
|
);
|
6562
6909
|
},
|
6563
|
-
children: /* @__PURE__ */
|
6910
|
+
children: /* @__PURE__ */ jsx36(ZoomIn, { size: 16 })
|
6564
6911
|
}
|
6565
6912
|
),
|
6566
|
-
/* @__PURE__ */
|
6567
|
-
/* @__PURE__ */
|
6913
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
6914
|
+
/* @__PURE__ */ jsx36(
|
6568
6915
|
"select",
|
6569
6916
|
{
|
6570
6917
|
className: getClassName25("zoomSelect"),
|
@@ -6572,7 +6919,7 @@ var ViewportControls = ({
|
|
6572
6919
|
onChange: (e) => {
|
6573
6920
|
onZoom(parseFloat(e.currentTarget.value));
|
6574
6921
|
},
|
6575
|
-
children: zoomOptions.map((option) => /* @__PURE__ */
|
6922
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
|
6576
6923
|
"option",
|
6577
6924
|
{
|
6578
6925
|
value: option.value,
|
@@ -6620,24 +6967,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
6620
6967
|
};
|
6621
6968
|
|
6622
6969
|
// components/Puck/components/Canvas/index.tsx
|
6623
|
-
import { Fragment as Fragment13, jsx as
|
6970
|
+
import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
6624
6971
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
6625
6972
|
var ZOOM_ON_CHANGE = true;
|
6626
6973
|
var Canvas = () => {
|
6627
6974
|
const { status, iframe } = useAppContext();
|
6628
6975
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
6629
6976
|
const { ui } = state;
|
6630
|
-
const frameRef =
|
6631
|
-
const [showTransition, setShowTransition] =
|
6632
|
-
const defaultRender =
|
6633
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */
|
6977
|
+
const frameRef = useRef7(null);
|
6978
|
+
const [showTransition, setShowTransition] = useState24(false);
|
6979
|
+
const defaultRender = useMemo16(() => {
|
6980
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
|
6634
6981
|
return PuckDefault;
|
6635
6982
|
}, []);
|
6636
|
-
const CustomPreview =
|
6983
|
+
const CustomPreview = useMemo16(
|
6637
6984
|
() => overrides.preview || defaultRender,
|
6638
6985
|
[overrides]
|
6639
6986
|
);
|
6640
|
-
const getFrameDimensions =
|
6987
|
+
const getFrameDimensions = useCallback15(() => {
|
6641
6988
|
if (frameRef.current) {
|
6642
6989
|
const frame = frameRef.current;
|
6643
6990
|
const box = getBox(frame);
|
@@ -6645,7 +6992,7 @@ var Canvas = () => {
|
|
6645
6992
|
}
|
6646
6993
|
return { width: 0, height: 0 };
|
6647
6994
|
}, [frameRef]);
|
6648
|
-
const resetAutoZoom =
|
6995
|
+
const resetAutoZoom = useCallback15(
|
6649
6996
|
(ui2 = state.ui) => {
|
6650
6997
|
if (frameRef.current) {
|
6651
6998
|
setZoomConfig(
|
@@ -6655,11 +7002,11 @@ var Canvas = () => {
|
|
6655
7002
|
},
|
6656
7003
|
[frameRef, zoomConfig, state.ui]
|
6657
7004
|
);
|
6658
|
-
|
7005
|
+
useEffect21(() => {
|
6659
7006
|
setShowTransition(false);
|
6660
7007
|
resetAutoZoom();
|
6661
7008
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
6662
|
-
|
7009
|
+
useEffect21(() => {
|
6663
7010
|
const { height: frameHeight } = getFrameDimensions();
|
6664
7011
|
if (ui.viewports.current.height === "auto") {
|
6665
7012
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -6667,13 +7014,13 @@ var Canvas = () => {
|
|
6667
7014
|
}));
|
6668
7015
|
}
|
6669
7016
|
}, [zoomConfig.zoom]);
|
6670
|
-
|
7017
|
+
useEffect21(() => {
|
6671
7018
|
if (ZOOM_ON_CHANGE) {
|
6672
7019
|
setShowTransition(true);
|
6673
7020
|
resetAutoZoom(ui);
|
6674
7021
|
}
|
6675
7022
|
}, [ui.viewports.current.width]);
|
6676
|
-
|
7023
|
+
useEffect21(() => {
|
6677
7024
|
const cb = () => {
|
6678
7025
|
setShowTransition(false);
|
6679
7026
|
resetAutoZoom();
|
@@ -6683,8 +7030,8 @@ var Canvas = () => {
|
|
6683
7030
|
window.removeEventListener("resize", cb);
|
6684
7031
|
};
|
6685
7032
|
}, []);
|
6686
|
-
const [showLoader, setShowLoader] =
|
6687
|
-
|
7033
|
+
const [showLoader, setShowLoader] = useState24(false);
|
7034
|
+
useEffect21(() => {
|
6688
7035
|
setTimeout(() => {
|
6689
7036
|
setShowLoader(true);
|
6690
7037
|
}, 500);
|
@@ -6702,7 +7049,7 @@ var Canvas = () => {
|
|
6702
7049
|
recordHistory: true
|
6703
7050
|
}),
|
6704
7051
|
children: [
|
6705
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */
|
7052
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx37(
|
6706
7053
|
ViewportControls,
|
6707
7054
|
{
|
6708
7055
|
autoZoom: zoomConfig.autoZoom,
|
@@ -6729,7 +7076,7 @@ var Canvas = () => {
|
|
6729
7076
|
}
|
6730
7077
|
) }),
|
6731
7078
|
/* @__PURE__ */ jsxs19("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
6732
|
-
/* @__PURE__ */
|
7079
|
+
/* @__PURE__ */ jsx37(
|
6733
7080
|
"div",
|
6734
7081
|
{
|
6735
7082
|
className: getClassName26("root"),
|
@@ -6750,10 +7097,10 @@ var Canvas = () => {
|
|
6750
7097
|
})
|
6751
7098
|
);
|
6752
7099
|
},
|
6753
|
-
children: /* @__PURE__ */
|
7100
|
+
children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview2, {}) })
|
6754
7101
|
}
|
6755
7102
|
),
|
6756
|
-
/* @__PURE__ */
|
7103
|
+
/* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
|
6757
7104
|
] })
|
6758
7105
|
]
|
6759
7106
|
}
|
@@ -6762,7 +7109,7 @@ var Canvas = () => {
|
|
6762
7109
|
|
6763
7110
|
// lib/use-loaded-overrides.ts
|
6764
7111
|
init_react_import();
|
6765
|
-
import { useMemo as
|
7112
|
+
import { useMemo as useMemo17 } from "react";
|
6766
7113
|
|
6767
7114
|
// lib/load-overrides.ts
|
6768
7115
|
init_react_import();
|
@@ -6801,26 +7148,26 @@ var useLoadedOverrides = ({
|
|
6801
7148
|
overrides,
|
6802
7149
|
plugins
|
6803
7150
|
}) => {
|
6804
|
-
return
|
7151
|
+
return useMemo17(() => {
|
6805
7152
|
return loadOverrides({ overrides, plugins });
|
6806
7153
|
}, [plugins, overrides]);
|
6807
7154
|
};
|
6808
7155
|
|
6809
7156
|
// components/DefaultOverride/index.tsx
|
6810
7157
|
init_react_import();
|
6811
|
-
import { Fragment as Fragment14, jsx as
|
6812
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
7158
|
+
import { Fragment as Fragment14, jsx as jsx38 } from "react/jsx-runtime";
|
7159
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { children });
|
6813
7160
|
|
6814
7161
|
// lib/use-inject-css.ts
|
6815
7162
|
init_react_import();
|
6816
|
-
import { useEffect as
|
7163
|
+
import { useEffect as useEffect22, useState as useState25 } from "react";
|
6817
7164
|
var styles = ``;
|
6818
7165
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
6819
|
-
const [el, setEl] =
|
6820
|
-
|
7166
|
+
const [el, setEl] = useState25();
|
7167
|
+
useEffect22(() => {
|
6821
7168
|
setEl(document.createElement("style"));
|
6822
7169
|
}, []);
|
6823
|
-
|
7170
|
+
useEffect22(() => {
|
6824
7171
|
var _a;
|
6825
7172
|
if (!el || typeof window === "undefined") {
|
6826
7173
|
return;
|
@@ -6840,10 +7187,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
6840
7187
|
|
6841
7188
|
// lib/use-preview-mode-hotkeys.ts
|
6842
7189
|
init_react_import();
|
6843
|
-
import { useCallback as
|
7190
|
+
import { useCallback as useCallback16 } from "react";
|
6844
7191
|
import { useHotkeys as useHotkeys2 } from "react-hotkeys-hook";
|
6845
7192
|
var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
6846
|
-
const toggleInteractive =
|
7193
|
+
const toggleInteractive = useCallback16(() => {
|
6847
7194
|
dispatch({
|
6848
7195
|
type: "setUi",
|
6849
7196
|
ui: (ui) => ({
|
@@ -6866,7 +7213,7 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
|
6866
7213
|
};
|
6867
7214
|
|
6868
7215
|
// components/Puck/index.tsx
|
6869
|
-
import { Fragment as Fragment15, jsx as
|
7216
|
+
import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
|
6870
7217
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
6871
7218
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
6872
7219
|
function Puck({
|
@@ -6895,7 +7242,7 @@ function Puck({
|
|
6895
7242
|
waitForStyles: true
|
6896
7243
|
}, _iframe);
|
6897
7244
|
useInjectGlobalCss(iframe.enabled);
|
6898
|
-
const [generatedAppState] =
|
7245
|
+
const [generatedAppState] = useState26(() => {
|
6899
7246
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
6900
7247
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
6901
7248
|
let clientUiState = {};
|
@@ -6967,7 +7314,7 @@ function Puck({
|
|
6967
7314
|
histories,
|
6968
7315
|
index: initialHistoryIndex
|
6969
7316
|
});
|
6970
|
-
const [reducer] =
|
7317
|
+
const [reducer] = useState26(
|
6971
7318
|
() => createReducer({
|
6972
7319
|
config,
|
6973
7320
|
record: historyStore.record,
|
@@ -6985,14 +7332,14 @@ function Puck({
|
|
6985
7332
|
historyStore,
|
6986
7333
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
6987
7334
|
});
|
6988
|
-
const [menuOpen, setMenuOpen] =
|
7335
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
6989
7336
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
6990
7337
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
6991
|
-
|
7338
|
+
useEffect23(() => {
|
6992
7339
|
if (onChange) onChange(data);
|
6993
7340
|
}, [data]);
|
6994
7341
|
const rootProps = data.root.props || data.root;
|
6995
|
-
const toggleSidebars =
|
7342
|
+
const toggleSidebars = useCallback17(
|
6996
7343
|
(sidebar) => {
|
6997
7344
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
6998
7345
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -7006,7 +7353,7 @@ function Puck({
|
|
7006
7353
|
},
|
7007
7354
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
7008
7355
|
);
|
7009
|
-
|
7356
|
+
useEffect23(() => {
|
7010
7357
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
7011
7358
|
dispatch({
|
7012
7359
|
type: "setUi",
|
@@ -7029,7 +7376,7 @@ function Puck({
|
|
7029
7376
|
window.removeEventListener("resize", handleResize);
|
7030
7377
|
};
|
7031
7378
|
}, []);
|
7032
|
-
const defaultHeaderRender =
|
7379
|
+
const defaultHeaderRender = useMemo18(() => {
|
7033
7380
|
if (renderHeader) {
|
7034
7381
|
console.warn(
|
7035
7382
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -7037,20 +7384,20 @@ function Puck({
|
|
7037
7384
|
const RenderHeader = (_a2) => {
|
7038
7385
|
var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
|
7039
7386
|
const Comp = renderHeader;
|
7040
|
-
return /* @__PURE__ */
|
7387
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
7041
7388
|
};
|
7042
7389
|
return RenderHeader;
|
7043
7390
|
}
|
7044
7391
|
return DefaultOverride;
|
7045
7392
|
}, [renderHeader]);
|
7046
|
-
const defaultHeaderActionsRender =
|
7393
|
+
const defaultHeaderActionsRender = useMemo18(() => {
|
7047
7394
|
if (renderHeaderActions) {
|
7048
7395
|
console.warn(
|
7049
7396
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
7050
7397
|
);
|
7051
7398
|
const RenderHeader = (props) => {
|
7052
7399
|
const Comp = renderHeaderActions;
|
7053
|
-
return /* @__PURE__ */
|
7400
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
7054
7401
|
};
|
7055
7402
|
return RenderHeader;
|
7056
7403
|
}
|
@@ -7060,27 +7407,27 @@ function Puck({
|
|
7060
7407
|
overrides,
|
7061
7408
|
plugins
|
7062
7409
|
});
|
7063
|
-
const CustomPuck =
|
7410
|
+
const CustomPuck = useMemo18(
|
7064
7411
|
() => loadedOverrides.puck || DefaultOverride,
|
7065
7412
|
[loadedOverrides]
|
7066
7413
|
);
|
7067
|
-
const CustomHeader =
|
7414
|
+
const CustomHeader = useMemo18(
|
7068
7415
|
() => loadedOverrides.header || defaultHeaderRender,
|
7069
7416
|
[loadedOverrides]
|
7070
7417
|
);
|
7071
|
-
const CustomHeaderActions =
|
7418
|
+
const CustomHeaderActions = useMemo18(
|
7072
7419
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7073
7420
|
[loadedOverrides]
|
7074
7421
|
);
|
7075
|
-
const [mounted, setMounted] =
|
7076
|
-
|
7422
|
+
const [mounted, setMounted] = useState26(false);
|
7423
|
+
useEffect23(() => {
|
7077
7424
|
setMounted(true);
|
7078
7425
|
}, []);
|
7079
7426
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
7080
7427
|
const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
|
7081
7428
|
usePreviewModeHotkeys(dispatch, iframe.enabled);
|
7082
7429
|
return /* @__PURE__ */ jsxs20("div", { className: `Puck ${getClassName27()}`, children: [
|
7083
|
-
/* @__PURE__ */
|
7430
|
+
/* @__PURE__ */ jsx39(
|
7084
7431
|
AppProvider,
|
7085
7432
|
{
|
7086
7433
|
value: {
|
@@ -7102,7 +7449,7 @@ function Puck({
|
|
7102
7449
|
getPermissions: () => ({}),
|
7103
7450
|
refreshPermissions: () => null
|
7104
7451
|
},
|
7105
|
-
children: /* @__PURE__ */
|
7452
|
+
children: /* @__PURE__ */ jsx39(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
|
7106
7453
|
"div",
|
7107
7454
|
{
|
7108
7455
|
className: getLayoutClassName({
|
@@ -7112,59 +7459,59 @@ function Puck({
|
|
7112
7459
|
rightSideBarVisible
|
7113
7460
|
}),
|
7114
7461
|
children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("inner"), children: [
|
7115
|
-
/* @__PURE__ */
|
7462
|
+
/* @__PURE__ */ jsx39(
|
7116
7463
|
CustomHeader,
|
7117
7464
|
{
|
7118
|
-
actions: /* @__PURE__ */
|
7465
|
+
actions: /* @__PURE__ */ jsx39(Fragment15, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
7119
7466
|
Button,
|
7120
7467
|
{
|
7121
7468
|
onClick: () => {
|
7122
7469
|
onPublish && onPublish(data);
|
7123
7470
|
},
|
7124
|
-
icon: /* @__PURE__ */
|
7471
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
7125
7472
|
children: "Publish"
|
7126
7473
|
}
|
7127
7474
|
) }) }),
|
7128
|
-
children: /* @__PURE__ */
|
7475
|
+
children: /* @__PURE__ */ jsx39("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerInner"), children: [
|
7129
7476
|
/* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerToggle"), children: [
|
7130
|
-
/* @__PURE__ */
|
7477
|
+
/* @__PURE__ */ jsx39(
|
7131
7478
|
"div",
|
7132
7479
|
{
|
7133
7480
|
className: getLayoutClassName("leftSideBarToggle"),
|
7134
|
-
children: /* @__PURE__ */
|
7481
|
+
children: /* @__PURE__ */ jsx39(
|
7135
7482
|
IconButton,
|
7136
7483
|
{
|
7137
7484
|
onClick: () => {
|
7138
7485
|
toggleSidebars("left");
|
7139
7486
|
},
|
7140
7487
|
title: "Toggle left sidebar",
|
7141
|
-
children: /* @__PURE__ */
|
7488
|
+
children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
|
7142
7489
|
}
|
7143
7490
|
)
|
7144
7491
|
}
|
7145
7492
|
),
|
7146
|
-
/* @__PURE__ */
|
7493
|
+
/* @__PURE__ */ jsx39(
|
7147
7494
|
"div",
|
7148
7495
|
{
|
7149
7496
|
className: getLayoutClassName("rightSideBarToggle"),
|
7150
|
-
children: /* @__PURE__ */
|
7497
|
+
children: /* @__PURE__ */ jsx39(
|
7151
7498
|
IconButton,
|
7152
7499
|
{
|
7153
7500
|
onClick: () => {
|
7154
7501
|
toggleSidebars("right");
|
7155
7502
|
},
|
7156
7503
|
title: "Toggle right sidebar",
|
7157
|
-
children: /* @__PURE__ */
|
7504
|
+
children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
|
7158
7505
|
}
|
7159
7506
|
)
|
7160
7507
|
}
|
7161
7508
|
)
|
7162
7509
|
] }),
|
7163
|
-
/* @__PURE__ */
|
7510
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs20(Heading, { rank: "2", size: "xs", children: [
|
7164
7511
|
headerTitle || rootProps.title || "Page",
|
7165
7512
|
headerPath && /* @__PURE__ */ jsxs20(Fragment15, { children: [
|
7166
7513
|
" ",
|
7167
|
-
/* @__PURE__ */
|
7514
|
+
/* @__PURE__ */ jsx39(
|
7168
7515
|
"code",
|
7169
7516
|
{
|
7170
7517
|
className: getLayoutClassName("headerPath"),
|
@@ -7174,30 +7521,30 @@ function Puck({
|
|
7174
7521
|
] })
|
7175
7522
|
] }) }),
|
7176
7523
|
/* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerTools"), children: [
|
7177
|
-
/* @__PURE__ */
|
7524
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ jsx39(
|
7178
7525
|
IconButton,
|
7179
7526
|
{
|
7180
7527
|
onClick: () => {
|
7181
7528
|
return setMenuOpen(!menuOpen);
|
7182
7529
|
},
|
7183
7530
|
title: "Toggle menu bar",
|
7184
|
-
children: menuOpen ? /* @__PURE__ */
|
7531
|
+
children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
|
7185
7532
|
}
|
7186
7533
|
) }),
|
7187
|
-
/* @__PURE__ */
|
7534
|
+
/* @__PURE__ */ jsx39(
|
7188
7535
|
MenuBar,
|
7189
7536
|
{
|
7190
7537
|
appState,
|
7191
7538
|
dispatch,
|
7192
7539
|
onPublish,
|
7193
7540
|
menuOpen,
|
7194
|
-
renderHeaderActions: () => /* @__PURE__ */
|
7541
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
7195
7542
|
Button,
|
7196
7543
|
{
|
7197
7544
|
onClick: () => {
|
7198
7545
|
onPublish && onPublish(data);
|
7199
7546
|
},
|
7200
|
-
icon: /* @__PURE__ */
|
7547
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
7201
7548
|
children: "Publish"
|
7202
7549
|
}
|
7203
7550
|
) }),
|
@@ -7209,18 +7556,18 @@ function Puck({
|
|
7209
7556
|
}
|
7210
7557
|
),
|
7211
7558
|
/* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("leftSideBar"), children: [
|
7212
|
-
/* @__PURE__ */
|
7213
|
-
/* @__PURE__ */
|
7559
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx39(Components, {}) }),
|
7560
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx39(Outline, {}) })
|
7214
7561
|
] }),
|
7215
|
-
/* @__PURE__ */
|
7216
|
-
/* @__PURE__ */
|
7562
|
+
/* @__PURE__ */ jsx39(Canvas, {}),
|
7563
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx39(
|
7217
7564
|
SidebarSection,
|
7218
7565
|
{
|
7219
7566
|
noPadding: true,
|
7220
7567
|
noBorderTop: true,
|
7221
7568
|
showBreadcrumbs: true,
|
7222
7569
|
title: selectedItem ? selectedComponentLabel : "Page",
|
7223
|
-
children: /* @__PURE__ */
|
7570
|
+
children: /* @__PURE__ */ jsx39(Fields, {})
|
7224
7571
|
}
|
7225
7572
|
) })
|
7226
7573
|
] })
|
@@ -7228,13 +7575,13 @@ function Puck({
|
|
7228
7575
|
) }) })
|
7229
7576
|
}
|
7230
7577
|
),
|
7231
|
-
/* @__PURE__ */
|
7578
|
+
/* @__PURE__ */ jsx39("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
7232
7579
|
] });
|
7233
7580
|
}
|
7234
7581
|
Puck.Components = Components;
|
7235
7582
|
Puck.Fields = Fields;
|
7236
7583
|
Puck.Outline = Outline;
|
7237
|
-
Puck.Preview =
|
7584
|
+
Puck.Preview = Preview2;
|
7238
7585
|
|
7239
7586
|
// lib/migrate.ts
|
7240
7587
|
init_react_import();
|