@measured/puck 0.18.0-canary.066aba9 → 0.18.0-canary.4b589f6
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 +1166 -868
- package/dist/index.mjs +1080 -779
- package/dist/rsc.js +2 -4
- package/dist/rsc.mjs +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -311,7 +311,7 @@ init_react_import();
|
|
|
311
311
|
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
|
|
312
312
|
|
|
313
313
|
// components/AutoField/index.tsx
|
|
314
|
-
var
|
|
314
|
+
var import_react20 = require("react");
|
|
315
315
|
|
|
316
316
|
// components/AutoField/fields/index.tsx
|
|
317
317
|
init_react_import();
|
|
@@ -771,7 +771,7 @@ var IconButton = ({
|
|
|
771
771
|
};
|
|
772
772
|
|
|
773
773
|
// components/AutoField/fields/ArrayField/index.tsx
|
|
774
|
-
var
|
|
774
|
+
var import_react12 = require("react");
|
|
775
775
|
|
|
776
776
|
// components/DragIcon/index.tsx
|
|
777
777
|
init_react_import();
|
|
@@ -988,13 +988,11 @@ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __asy
|
|
|
988
988
|
onResolveStart(item);
|
|
989
989
|
}
|
|
990
990
|
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
|
|
991
|
-
const { readOnly: existingReadOnly = {} } = item || {};
|
|
992
|
-
const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
|
|
993
991
|
const resolvedItem = __spreadProps(__spreadValues({}, item), {
|
|
994
992
|
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
|
995
993
|
});
|
|
996
|
-
if (Object.keys(
|
|
997
|
-
resolvedItem.readOnly =
|
|
994
|
+
if (Object.keys(readOnly).length) {
|
|
995
|
+
resolvedItem.readOnly = readOnly;
|
|
998
996
|
}
|
|
999
997
|
cache.lastChange[item.props.id] = {
|
|
1000
998
|
item,
|
|
@@ -1284,7 +1282,7 @@ init_react_import();
|
|
|
1284
1282
|
var import_react9 = require("@dnd-kit/react");
|
|
1285
1283
|
var import_react10 = require("react");
|
|
1286
1284
|
|
|
1287
|
-
// lib/dnd-kit/safe.ts
|
|
1285
|
+
// lib/dnd/dnd-kit/safe.ts
|
|
1288
1286
|
init_react_import();
|
|
1289
1287
|
var import_react8 = require("@dnd-kit/react");
|
|
1290
1288
|
var import_sortable = require("@dnd-kit/react/sortable");
|
|
@@ -1361,8 +1359,53 @@ var Sortable = ({
|
|
|
1361
1359
|
return children({ status, ref: sortableRef });
|
|
1362
1360
|
};
|
|
1363
1361
|
|
|
1364
|
-
// components/AutoField/
|
|
1362
|
+
// components/AutoField/context.tsx
|
|
1363
|
+
init_react_import();
|
|
1364
|
+
var import_react11 = require("react");
|
|
1365
1365
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1366
|
+
var NestedFieldContext = (0, import_react11.createContext)({});
|
|
1367
|
+
var useNestedFieldContext = () => {
|
|
1368
|
+
const context = (0, import_react11.useContext)(NestedFieldContext);
|
|
1369
|
+
return __spreadProps(__spreadValues({}, context), {
|
|
1370
|
+
readOnlyFields: context.readOnlyFields || {}
|
|
1371
|
+
});
|
|
1372
|
+
};
|
|
1373
|
+
var NestedFieldProvider = ({
|
|
1374
|
+
children,
|
|
1375
|
+
name,
|
|
1376
|
+
subName,
|
|
1377
|
+
wildcardName = name,
|
|
1378
|
+
readOnlyFields
|
|
1379
|
+
}) => {
|
|
1380
|
+
const subPath = `${name}.${subName}`;
|
|
1381
|
+
const wildcardSubPath = `${wildcardName}.${subName}`;
|
|
1382
|
+
const subReadOnlyFields = (0, import_react11.useMemo)(
|
|
1383
|
+
() => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
|
|
1384
|
+
const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
|
|
1385
|
+
if (isLocal) {
|
|
1386
|
+
const subPathPattern = new RegExp(
|
|
1387
|
+
`^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
|
|
1388
|
+
);
|
|
1389
|
+
const localName = readOnlyKey.replace(subPathPattern, "");
|
|
1390
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
1391
|
+
[localName]: readOnlyFields[readOnlyKey]
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
return acc;
|
|
1395
|
+
}, {}),
|
|
1396
|
+
[name, subName, wildcardName, readOnlyFields]
|
|
1397
|
+
);
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1399
|
+
NestedFieldContext.Provider,
|
|
1400
|
+
{
|
|
1401
|
+
value: { readOnlyFields: subReadOnlyFields, localName: subName },
|
|
1402
|
+
children
|
|
1403
|
+
}
|
|
1404
|
+
);
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
// components/AutoField/fields/ArrayField/index.tsx
|
|
1408
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1366
1409
|
var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
|
|
1367
1410
|
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
|
|
1368
1411
|
var ArrayField = ({
|
|
@@ -1373,10 +1416,10 @@ var ArrayField = ({
|
|
|
1373
1416
|
label,
|
|
1374
1417
|
readOnly,
|
|
1375
1418
|
id,
|
|
1376
|
-
Label: Label2 = (props) => /* @__PURE__ */ (0,
|
|
1419
|
+
Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", __spreadValues({}, props))
|
|
1377
1420
|
}) => {
|
|
1378
1421
|
const { state, setUi, selectedItem, getPermissions } = useAppContext();
|
|
1379
|
-
const readOnlyFields =
|
|
1422
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
|
1380
1423
|
const value = _value;
|
|
1381
1424
|
const arrayState = state.ui.arrayState[id] || {
|
|
1382
1425
|
items: Array.from(value || []).map((item, idx) => {
|
|
@@ -1387,11 +1430,11 @@ var ArrayField = ({
|
|
|
1387
1430
|
}),
|
|
1388
1431
|
openId: ""
|
|
1389
1432
|
};
|
|
1390
|
-
const [localState, setLocalState] = (0,
|
|
1391
|
-
(0,
|
|
1433
|
+
const [localState, setLocalState] = (0, import_react12.useState)({ arrayState, value });
|
|
1434
|
+
(0, import_react12.useEffect)(() => {
|
|
1392
1435
|
setLocalState({ arrayState, value });
|
|
1393
1436
|
}, [value, state.ui.arrayState[id]]);
|
|
1394
|
-
const mapArrayStateToUi = (0,
|
|
1437
|
+
const mapArrayStateToUi = (0, import_react12.useCallback)(
|
|
1395
1438
|
(partialArrayState) => {
|
|
1396
1439
|
return {
|
|
1397
1440
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
|
@@ -1401,13 +1444,13 @@ var ArrayField = ({
|
|
|
1401
1444
|
},
|
|
1402
1445
|
[arrayState]
|
|
1403
1446
|
);
|
|
1404
|
-
const getHighestIndex = (0,
|
|
1447
|
+
const getHighestIndex = (0, import_react12.useCallback)(() => {
|
|
1405
1448
|
return arrayState.items.reduce(
|
|
1406
1449
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
|
1407
1450
|
-1
|
|
1408
1451
|
);
|
|
1409
1452
|
}, [arrayState]);
|
|
1410
|
-
const regenerateArrayState = (0,
|
|
1453
|
+
const regenerateArrayState = (0, import_react12.useCallback)(
|
|
1411
1454
|
(value2) => {
|
|
1412
1455
|
let highestIndex = getHighestIndex();
|
|
1413
1456
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
|
@@ -1426,7 +1469,7 @@ var ArrayField = ({
|
|
|
1426
1469
|
},
|
|
1427
1470
|
[arrayState]
|
|
1428
1471
|
);
|
|
1429
|
-
(0,
|
|
1472
|
+
(0, import_react12.useEffect)(() => {
|
|
1430
1473
|
if (arrayState.items.length > 0) {
|
|
1431
1474
|
setUi(mapArrayStateToUi(arrayState));
|
|
1432
1475
|
}
|
|
@@ -1436,14 +1479,14 @@ var ArrayField = ({
|
|
|
1436
1479
|
return null;
|
|
1437
1480
|
}
|
|
1438
1481
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
|
1439
|
-
return /* @__PURE__ */ (0,
|
|
1482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1440
1483
|
Label2,
|
|
1441
1484
|
{
|
|
1442
1485
|
label: label || name,
|
|
1443
|
-
icon: /* @__PURE__ */ (0,
|
|
1486
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(List, { size: 16 }),
|
|
1444
1487
|
el: "div",
|
|
1445
1488
|
readOnly,
|
|
1446
|
-
children: /* @__PURE__ */ (0,
|
|
1489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1447
1490
|
SortableProvider,
|
|
1448
1491
|
{
|
|
1449
1492
|
onMove: (move) => {
|
|
@@ -1465,7 +1508,7 @@ var ArrayField = ({
|
|
|
1465
1508
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
|
1466
1509
|
});
|
|
1467
1510
|
},
|
|
1468
|
-
children: /* @__PURE__ */ (0,
|
|
1511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1469
1512
|
"div",
|
|
1470
1513
|
{
|
|
1471
1514
|
className: getClassName5({
|
|
@@ -1479,13 +1522,13 @@ var ArrayField = ({
|
|
|
1479
1522
|
localState.arrayState.items.map((item, i) => {
|
|
1480
1523
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
|
1481
1524
|
const data = Array.from(localState.value || [])[i] || {};
|
|
1482
|
-
return /* @__PURE__ */ (0,
|
|
1525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1483
1526
|
Sortable,
|
|
1484
1527
|
{
|
|
1485
1528
|
id: _arrayId,
|
|
1486
1529
|
index: i,
|
|
1487
1530
|
disabled: readOnly,
|
|
1488
|
-
children: ({ status, ref }) => /* @__PURE__ */ (0,
|
|
1531
|
+
children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1489
1532
|
"div",
|
|
1490
1533
|
{
|
|
1491
1534
|
ref,
|
|
@@ -1495,7 +1538,7 @@ var ArrayField = ({
|
|
|
1495
1538
|
readOnly
|
|
1496
1539
|
}),
|
|
1497
1540
|
children: [
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1499
1542
|
"div",
|
|
1500
1543
|
{
|
|
1501
1544
|
onClick: (e) => {
|
|
@@ -1518,9 +1561,9 @@ var ArrayField = ({
|
|
|
1518
1561
|
className: getClassNameItem("summary"),
|
|
1519
1562
|
children: [
|
|
1520
1563
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1522
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1564
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
|
1565
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("actions"), children: [
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1524
1567
|
IconButton,
|
|
1525
1568
|
{
|
|
1526
1569
|
type: "button",
|
|
@@ -1537,10 +1580,10 @@ var ArrayField = ({
|
|
|
1537
1580
|
);
|
|
1538
1581
|
},
|
|
1539
1582
|
title: "Duplicate",
|
|
1540
|
-
children: /* @__PURE__ */ (0,
|
|
1583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Copy, { size: 16 })
|
|
1541
1584
|
}
|
|
1542
1585
|
) }),
|
|
1543
|
-
/* @__PURE__ */ (0,
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1544
1587
|
IconButton,
|
|
1545
1588
|
{
|
|
1546
1589
|
type: "button",
|
|
@@ -1561,39 +1604,56 @@ var ArrayField = ({
|
|
|
1561
1604
|
);
|
|
1562
1605
|
},
|
|
1563
1606
|
title: "Delete",
|
|
1564
|
-
children: /* @__PURE__ */ (0,
|
|
1607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Trash, { size: 16 })
|
|
1565
1608
|
}
|
|
1566
1609
|
) })
|
|
1567
1610
|
] }),
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
|
|
1569
1612
|
] })
|
|
1570
1613
|
]
|
|
1571
1614
|
}
|
|
1572
1615
|
),
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
const subField = field.arrayFields[
|
|
1575
|
-
const
|
|
1576
|
-
const
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
|
|
1617
|
+
const subField = field.arrayFields[subName];
|
|
1618
|
+
const indexName = `${name}[${i}]`;
|
|
1619
|
+
const subPath = `${indexName}.${subName}`;
|
|
1620
|
+
const localIndexName = `${localName}[${i}]`;
|
|
1621
|
+
const localWildcardName = `${localName}[*]`;
|
|
1622
|
+
const localSubPath = `${localIndexName}.${subName}`;
|
|
1623
|
+
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
|
1624
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
|
1625
|
+
const label2 = subField.label || subName;
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1627
|
+
NestedFieldProvider,
|
|
1580
1628
|
{
|
|
1581
|
-
name:
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1629
|
+
name: localIndexName,
|
|
1630
|
+
wildcardName: localWildcardName,
|
|
1631
|
+
subName,
|
|
1632
|
+
readOnlyFields,
|
|
1633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1634
|
+
AutoFieldPrivate,
|
|
1635
|
+
{
|
|
1636
|
+
name: subPath,
|
|
1637
|
+
label: label2,
|
|
1638
|
+
id: `${_arrayId}_${subName}`,
|
|
1639
|
+
readOnly: subReadOnly,
|
|
1640
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
|
1641
|
+
label: label2
|
|
1642
|
+
// May be used by custom fields
|
|
1643
|
+
}),
|
|
1644
|
+
value: data[subName],
|
|
1645
|
+
onChange: (val, ui) => {
|
|
1646
|
+
onChange(
|
|
1647
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
|
1648
|
+
[subName]: val
|
|
1649
|
+
})),
|
|
1650
|
+
ui
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
)
|
|
1595
1655
|
},
|
|
1596
|
-
|
|
1656
|
+
subPath
|
|
1597
1657
|
);
|
|
1598
1658
|
}) }) })
|
|
1599
1659
|
]
|
|
@@ -1603,7 +1663,7 @@ var ArrayField = ({
|
|
|
1603
1663
|
_arrayId
|
|
1604
1664
|
);
|
|
1605
1665
|
}),
|
|
1606
|
-
!addDisabled && /* @__PURE__ */ (0,
|
|
1666
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1607
1667
|
"button",
|
|
1608
1668
|
{
|
|
1609
1669
|
type: "button",
|
|
@@ -1617,7 +1677,7 @@ var ArrayField = ({
|
|
|
1617
1677
|
const newArrayState = regenerateArrayState(newValue);
|
|
1618
1678
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
|
1619
1679
|
},
|
|
1620
|
-
children: /* @__PURE__ */ (0,
|
|
1680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Plus, { size: 21 })
|
|
1621
1681
|
}
|
|
1622
1682
|
)
|
|
1623
1683
|
]
|
|
@@ -1631,7 +1691,7 @@ var ArrayField = ({
|
|
|
1631
1691
|
|
|
1632
1692
|
// components/AutoField/fields/DefaultField/index.tsx
|
|
1633
1693
|
init_react_import();
|
|
1634
|
-
var
|
|
1694
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1635
1695
|
var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
|
|
1636
1696
|
var DefaultField = ({
|
|
1637
1697
|
field,
|
|
@@ -1643,16 +1703,16 @@ var DefaultField = ({
|
|
|
1643
1703
|
Label: Label2,
|
|
1644
1704
|
id
|
|
1645
1705
|
}) => {
|
|
1646
|
-
return /* @__PURE__ */ (0,
|
|
1706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1647
1707
|
Label2,
|
|
1648
1708
|
{
|
|
1649
1709
|
label: label || name,
|
|
1650
|
-
icon: /* @__PURE__ */ (0,
|
|
1651
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
|
1652
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
|
1710
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1711
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Type, { size: 16 }),
|
|
1712
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Hash, { size: 16 })
|
|
1653
1713
|
] }),
|
|
1654
1714
|
readOnly,
|
|
1655
|
-
children: /* @__PURE__ */ (0,
|
|
1715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1656
1716
|
"input",
|
|
1657
1717
|
{
|
|
1658
1718
|
className: getClassName6("input"),
|
|
@@ -1663,7 +1723,14 @@ var DefaultField = ({
|
|
|
1663
1723
|
value: typeof value === "undefined" ? "" : value.toString(),
|
|
1664
1724
|
onChange: (e) => {
|
|
1665
1725
|
if (field.type === "number") {
|
|
1666
|
-
|
|
1726
|
+
const numberValue = Number(e.currentTarget.value);
|
|
1727
|
+
if (typeof field.min !== "undefined" && numberValue < field.min) {
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
if (typeof field.max !== "undefined" && numberValue > field.max) {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
onChange(numberValue);
|
|
1667
1734
|
} else {
|
|
1668
1735
|
onChange(e.currentTarget.value);
|
|
1669
1736
|
}
|
|
@@ -1681,11 +1748,11 @@ var DefaultField = ({
|
|
|
1681
1748
|
|
|
1682
1749
|
// components/AutoField/fields/ExternalField/index.tsx
|
|
1683
1750
|
init_react_import();
|
|
1684
|
-
var
|
|
1751
|
+
var import_react16 = require("react");
|
|
1685
1752
|
|
|
1686
1753
|
// components/ExternalInput/index.tsx
|
|
1687
1754
|
init_react_import();
|
|
1688
|
-
var
|
|
1755
|
+
var import_react15 = require("react");
|
|
1689
1756
|
|
|
1690
1757
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
|
1691
1758
|
init_react_import();
|
|
@@ -1693,7 +1760,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
|
|
|
1693
1760
|
|
|
1694
1761
|
// components/Modal/index.tsx
|
|
1695
1762
|
init_react_import();
|
|
1696
|
-
var
|
|
1763
|
+
var import_react13 = require("react");
|
|
1697
1764
|
|
|
1698
1765
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
|
1699
1766
|
init_react_import();
|
|
@@ -1701,22 +1768,22 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
|
|
|
1701
1768
|
|
|
1702
1769
|
// components/Modal/index.tsx
|
|
1703
1770
|
var import_react_dom = require("react-dom");
|
|
1704
|
-
var
|
|
1771
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1705
1772
|
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
|
|
1706
1773
|
var Modal = ({
|
|
1707
1774
|
children,
|
|
1708
1775
|
onClose,
|
|
1709
1776
|
isOpen
|
|
1710
1777
|
}) => {
|
|
1711
|
-
const [rootEl, setRootEl] = (0,
|
|
1712
|
-
(0,
|
|
1778
|
+
const [rootEl, setRootEl] = (0, import_react13.useState)(null);
|
|
1779
|
+
(0, import_react13.useEffect)(() => {
|
|
1713
1780
|
setRootEl(document.getElementById("puck-portal-root"));
|
|
1714
1781
|
}, []);
|
|
1715
1782
|
if (!rootEl) {
|
|
1716
|
-
return /* @__PURE__ */ (0,
|
|
1783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
|
|
1717
1784
|
}
|
|
1718
1785
|
return (0, import_react_dom.createPortal)(
|
|
1719
|
-
/* @__PURE__ */ (0,
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1720
1787
|
"div",
|
|
1721
1788
|
{
|
|
1722
1789
|
className: getClassName7("inner"),
|
|
@@ -1736,11 +1803,11 @@ init_react_import();
|
|
|
1736
1803
|
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" };
|
|
1737
1804
|
|
|
1738
1805
|
// components/Heading/index.tsx
|
|
1739
|
-
var
|
|
1806
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1740
1807
|
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
|
|
1741
1808
|
var Heading = ({ children, rank, size = "m" }) => {
|
|
1742
1809
|
const Tag = rank ? `h${rank}` : "span";
|
|
1743
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1744
1811
|
Tag,
|
|
1745
1812
|
{
|
|
1746
1813
|
className: getClassName8({
|
|
@@ -1756,7 +1823,7 @@ init_react_import();
|
|
|
1756
1823
|
|
|
1757
1824
|
// components/Button/Button.tsx
|
|
1758
1825
|
init_react_import();
|
|
1759
|
-
var
|
|
1826
|
+
var import_react14 = require("react");
|
|
1760
1827
|
|
|
1761
1828
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
|
1762
1829
|
init_react_import();
|
|
@@ -1776,7 +1843,7 @@ var filterDataAttrs = (props) => {
|
|
|
1776
1843
|
};
|
|
1777
1844
|
|
|
1778
1845
|
// components/Button/Button.tsx
|
|
1779
|
-
var
|
|
1846
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1780
1847
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
|
1781
1848
|
var Button = (_a) => {
|
|
1782
1849
|
var _b = _a, {
|
|
@@ -1806,11 +1873,11 @@ var Button = (_a) => {
|
|
|
1806
1873
|
"size",
|
|
1807
1874
|
"loading"
|
|
1808
1875
|
]);
|
|
1809
|
-
const [loading, setLoading] = (0,
|
|
1810
|
-
(0,
|
|
1876
|
+
const [loading, setLoading] = (0, import_react14.useState)(loadingProp);
|
|
1877
|
+
(0, import_react14.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
|
1811
1878
|
const ElementType = href ? "a" : type ? "button" : "span";
|
|
1812
1879
|
const dataAttrs = filterDataAttrs(props);
|
|
1813
|
-
const el = /* @__PURE__ */ (0,
|
|
1880
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1814
1881
|
ElementType,
|
|
1815
1882
|
__spreadProps(__spreadValues({
|
|
1816
1883
|
className: getClassName9({
|
|
@@ -1835,9 +1902,9 @@ var Button = (_a) => {
|
|
|
1835
1902
|
href
|
|
1836
1903
|
}, dataAttrs), {
|
|
1837
1904
|
children: [
|
|
1838
|
-
icon && /* @__PURE__ */ (0,
|
|
1905
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
|
1839
1906
|
children,
|
|
1840
|
-
loading && /* @__PURE__ */ (0,
|
|
1907
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 14 }) })
|
|
1841
1908
|
]
|
|
1842
1909
|
})
|
|
1843
1910
|
);
|
|
@@ -1845,7 +1912,7 @@ var Button = (_a) => {
|
|
|
1845
1912
|
};
|
|
1846
1913
|
|
|
1847
1914
|
// components/ExternalInput/index.tsx
|
|
1848
|
-
var
|
|
1915
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1849
1916
|
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
|
1850
1917
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
|
1851
1918
|
var dataCache = {};
|
|
@@ -1862,28 +1929,28 @@ var ExternalInput = ({
|
|
|
1862
1929
|
mapRow = (val) => val,
|
|
1863
1930
|
filterFields
|
|
1864
1931
|
} = field || {};
|
|
1865
|
-
const [data, setData] = (0,
|
|
1866
|
-
const [isOpen, setOpen] = (0,
|
|
1867
|
-
const [isLoading, setIsLoading] = (0,
|
|
1932
|
+
const [data, setData] = (0, import_react15.useState)([]);
|
|
1933
|
+
const [isOpen, setOpen] = (0, import_react15.useState)(false);
|
|
1934
|
+
const [isLoading, setIsLoading] = (0, import_react15.useState)(true);
|
|
1868
1935
|
const hasFilterFields = !!filterFields;
|
|
1869
|
-
const [filters, setFilters] = (0,
|
|
1870
|
-
const [filtersToggled, setFiltersToggled] = (0,
|
|
1871
|
-
const mappedData = (0,
|
|
1936
|
+
const [filters, setFilters] = (0, import_react15.useState)(field.initialFilters || {});
|
|
1937
|
+
const [filtersToggled, setFiltersToggled] = (0, import_react15.useState)(hasFilterFields);
|
|
1938
|
+
const mappedData = (0, import_react15.useMemo)(() => {
|
|
1872
1939
|
return data.map(mapRow);
|
|
1873
1940
|
}, [data]);
|
|
1874
|
-
const keys = (0,
|
|
1941
|
+
const keys = (0, import_react15.useMemo)(() => {
|
|
1875
1942
|
const validKeys = /* @__PURE__ */ new Set();
|
|
1876
1943
|
for (const item of mappedData) {
|
|
1877
1944
|
for (const key of Object.keys(item)) {
|
|
1878
|
-
if (typeof item[key] === "string" || typeof item[key] === "number" || (0,
|
|
1945
|
+
if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react15.isValidElement)(item[key])) {
|
|
1879
1946
|
validKeys.add(key);
|
|
1880
1947
|
}
|
|
1881
1948
|
}
|
|
1882
1949
|
}
|
|
1883
1950
|
return Array.from(validKeys);
|
|
1884
1951
|
}, [mappedData]);
|
|
1885
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
1886
|
-
const search = (0,
|
|
1952
|
+
const [searchQuery, setSearchQuery] = (0, import_react15.useState)(field.initialQuery || "");
|
|
1953
|
+
const search = (0, import_react15.useCallback)(
|
|
1887
1954
|
(query, filters2) => __async(void 0, null, function* () {
|
|
1888
1955
|
setIsLoading(true);
|
|
1889
1956
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
|
@@ -1896,18 +1963,18 @@ var ExternalInput = ({
|
|
|
1896
1963
|
}),
|
|
1897
1964
|
[id, field]
|
|
1898
1965
|
);
|
|
1899
|
-
const Footer = (0,
|
|
1900
|
-
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0,
|
|
1966
|
+
const Footer = (0, import_react15.useCallback)(
|
|
1967
|
+
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: getClassNameModal("footer"), children: [
|
|
1901
1968
|
props.items.length,
|
|
1902
1969
|
" result",
|
|
1903
1970
|
props.items.length === 1 ? "" : "s"
|
|
1904
1971
|
] }),
|
|
1905
1972
|
[field.renderFooter]
|
|
1906
1973
|
);
|
|
1907
|
-
(0,
|
|
1974
|
+
(0, import_react15.useEffect)(() => {
|
|
1908
1975
|
search(searchQuery, filters);
|
|
1909
1976
|
}, []);
|
|
1910
|
-
return /* @__PURE__ */ (0,
|
|
1977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1911
1978
|
"div",
|
|
1912
1979
|
{
|
|
1913
1980
|
className: getClassName10({
|
|
@@ -1917,21 +1984,21 @@ var ExternalInput = ({
|
|
|
1917
1984
|
}),
|
|
1918
1985
|
id,
|
|
1919
1986
|
children: [
|
|
1920
|
-
/* @__PURE__ */ (0,
|
|
1921
|
-
/* @__PURE__ */ (0,
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("actions"), children: [
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1922
1989
|
"button",
|
|
1923
1990
|
{
|
|
1924
1991
|
type: "button",
|
|
1925
1992
|
onClick: () => setOpen(true),
|
|
1926
1993
|
className: getClassName10("button"),
|
|
1927
1994
|
disabled: readOnly,
|
|
1928
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
|
1929
|
-
/* @__PURE__ */ (0,
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
1995
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: "16" }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: field.placeholder })
|
|
1931
1998
|
] })
|
|
1932
1999
|
}
|
|
1933
2000
|
),
|
|
1934
|
-
value && /* @__PURE__ */ (0,
|
|
2001
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1935
2002
|
"button",
|
|
1936
2003
|
{
|
|
1937
2004
|
type: "button",
|
|
@@ -1940,11 +2007,11 @@ var ExternalInput = ({
|
|
|
1940
2007
|
onChange(null);
|
|
1941
2008
|
},
|
|
1942
2009
|
disabled: readOnly,
|
|
1943
|
-
children: /* @__PURE__ */ (0,
|
|
2010
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LockOpen, { size: 16 })
|
|
1944
2011
|
}
|
|
1945
2012
|
)
|
|
1946
2013
|
] }),
|
|
1947
|
-
/* @__PURE__ */ (0,
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1948
2015
|
"form",
|
|
1949
2016
|
{
|
|
1950
2017
|
className: getClassNameModal({
|
|
@@ -1958,11 +2025,11 @@ var ExternalInput = ({
|
|
|
1958
2025
|
search(searchQuery, filters);
|
|
1959
2026
|
},
|
|
1960
2027
|
children: [
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
1962
|
-
/* @__PURE__ */ (0,
|
|
1963
|
-
/* @__PURE__ */ (0,
|
|
1964
|
-
/* @__PURE__ */ (0,
|
|
1965
|
-
/* @__PURE__ */ (0,
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: getClassNameModal("search"), children: [
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Search, { size: "18" }) }),
|
|
2032
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1966
2033
|
"input",
|
|
1967
2034
|
{
|
|
1968
2035
|
className: getClassNameModal("searchInput"),
|
|
@@ -1977,9 +2044,9 @@ var ExternalInput = ({
|
|
|
1977
2044
|
}
|
|
1978
2045
|
)
|
|
1979
2046
|
] }),
|
|
1980
|
-
/* @__PURE__ */ (0,
|
|
1981
|
-
/* @__PURE__ */ (0,
|
|
1982
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
|
2048
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
|
2049
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1983
2050
|
IconButton,
|
|
1984
2051
|
{
|
|
1985
2052
|
title: "Toggle filters",
|
|
@@ -1988,15 +2055,15 @@ var ExternalInput = ({
|
|
|
1988
2055
|
e.stopPropagation();
|
|
1989
2056
|
setFiltersToggled(!filtersToggled);
|
|
1990
2057
|
},
|
|
1991
|
-
children: /* @__PURE__ */ (0,
|
|
2058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlidersHorizontal, { size: 20 })
|
|
1992
2059
|
}
|
|
1993
2060
|
) })
|
|
1994
2061
|
] })
|
|
1995
|
-
] }) : /* @__PURE__ */ (0,
|
|
1996
|
-
/* @__PURE__ */ (0,
|
|
1997
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
|
2062
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
|
2064
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
|
1998
2065
|
const filterField = filterFields[fieldName];
|
|
1999
|
-
return /* @__PURE__ */ (0,
|
|
2066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2000
2067
|
AutoFieldPrivate,
|
|
2001
2068
|
{
|
|
2002
2069
|
field: filterField,
|
|
@@ -2013,9 +2080,9 @@ var ExternalInput = ({
|
|
|
2013
2080
|
fieldName
|
|
2014
2081
|
);
|
|
2015
2082
|
}) }),
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2018
|
-
/* @__PURE__ */ (0,
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: getClassNameModal("table"), children: [
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2019
2086
|
"th",
|
|
2020
2087
|
{
|
|
2021
2088
|
className: getClassNameModal("th"),
|
|
@@ -2024,8 +2091,8 @@ var ExternalInput = ({
|
|
|
2024
2091
|
},
|
|
2025
2092
|
key
|
|
2026
2093
|
)) }) }),
|
|
2027
|
-
/* @__PURE__ */ (0,
|
|
2028
|
-
return /* @__PURE__ */ (0,
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
|
2095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2029
2096
|
"tr",
|
|
2030
2097
|
{
|
|
2031
2098
|
style: { whiteSpace: "nowrap" },
|
|
@@ -2034,16 +2101,16 @@ var ExternalInput = ({
|
|
|
2034
2101
|
onChange(mapProp(data[i]));
|
|
2035
2102
|
setOpen(false);
|
|
2036
2103
|
},
|
|
2037
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
|
2104
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
|
2038
2105
|
},
|
|
2039
2106
|
i
|
|
2040
2107
|
);
|
|
2041
2108
|
}) })
|
|
2042
2109
|
] }),
|
|
2043
|
-
/* @__PURE__ */ (0,
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 24 }) })
|
|
2044
2111
|
] })
|
|
2045
2112
|
] }),
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Footer, { items: mappedData }) })
|
|
2047
2114
|
]
|
|
2048
2115
|
}
|
|
2049
2116
|
) })
|
|
@@ -2053,7 +2120,7 @@ var ExternalInput = ({
|
|
|
2053
2120
|
};
|
|
2054
2121
|
|
|
2055
2122
|
// components/AutoField/fields/ExternalField/index.tsx
|
|
2056
|
-
var
|
|
2123
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2057
2124
|
var ExternalField = ({
|
|
2058
2125
|
field,
|
|
2059
2126
|
onChange,
|
|
@@ -2067,7 +2134,7 @@ var ExternalField = ({
|
|
|
2067
2134
|
var _a, _b, _c;
|
|
2068
2135
|
const validField = field;
|
|
2069
2136
|
const deprecatedField = field;
|
|
2070
|
-
(0,
|
|
2137
|
+
(0, import_react16.useEffect)(() => {
|
|
2071
2138
|
if (deprecatedField.adaptor) {
|
|
2072
2139
|
console.error(
|
|
2073
2140
|
"Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
|
|
@@ -2077,7 +2144,7 @@ var ExternalField = ({
|
|
|
2077
2144
|
if (field.type !== "external") {
|
|
2078
2145
|
return null;
|
|
2079
2146
|
}
|
|
2080
|
-
return /* @__PURE__ */ (0,
|
|
2147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2081
2148
|
ExternalInput,
|
|
2082
2149
|
{
|
|
2083
2150
|
name,
|
|
@@ -2102,7 +2169,7 @@ var ExternalField = ({
|
|
|
2102
2169
|
|
|
2103
2170
|
// components/AutoField/fields/RadioField/index.tsx
|
|
2104
2171
|
init_react_import();
|
|
2105
|
-
var
|
|
2172
|
+
var import_react17 = require("react");
|
|
2106
2173
|
|
|
2107
2174
|
// lib/safe-json-parse.ts
|
|
2108
2175
|
init_react_import();
|
|
@@ -2116,7 +2183,7 @@ var safeJsonParse = (str) => {
|
|
|
2116
2183
|
};
|
|
2117
2184
|
|
|
2118
2185
|
// components/AutoField/fields/RadioField/index.tsx
|
|
2119
|
-
var
|
|
2186
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2120
2187
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
|
2121
2188
|
var RadioField = ({
|
|
2122
2189
|
field,
|
|
@@ -2128,26 +2195,26 @@ var RadioField = ({
|
|
|
2128
2195
|
label,
|
|
2129
2196
|
Label: Label2
|
|
2130
2197
|
}) => {
|
|
2131
|
-
const flatOptions = (0,
|
|
2198
|
+
const flatOptions = (0, import_react17.useMemo)(
|
|
2132
2199
|
() => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
|
|
2133
2200
|
[field]
|
|
2134
2201
|
);
|
|
2135
2202
|
if (field.type !== "radio" || !field.options) {
|
|
2136
2203
|
return null;
|
|
2137
2204
|
}
|
|
2138
|
-
return /* @__PURE__ */ (0,
|
|
2205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2139
2206
|
Label2,
|
|
2140
2207
|
{
|
|
2141
|
-
icon: /* @__PURE__ */ (0,
|
|
2208
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CircleCheckBig, { size: 16 }),
|
|
2142
2209
|
label: label || name,
|
|
2143
2210
|
readOnly,
|
|
2144
2211
|
el: "div",
|
|
2145
|
-
children: /* @__PURE__ */ (0,
|
|
2212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2146
2213
|
"label",
|
|
2147
2214
|
{
|
|
2148
2215
|
className: getClassName11("radio"),
|
|
2149
2216
|
children: [
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2151
2218
|
"input",
|
|
2152
2219
|
{
|
|
2153
2220
|
type: "radio",
|
|
@@ -2167,7 +2234,7 @@ var RadioField = ({
|
|
|
2167
2234
|
checked: value === option.value
|
|
2168
2235
|
}
|
|
2169
2236
|
),
|
|
2170
|
-
/* @__PURE__ */ (0,
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
|
2171
2238
|
]
|
|
2172
2239
|
},
|
|
2173
2240
|
option.label + option.value
|
|
@@ -2178,8 +2245,8 @@ var RadioField = ({
|
|
|
2178
2245
|
|
|
2179
2246
|
// components/AutoField/fields/SelectField/index.tsx
|
|
2180
2247
|
init_react_import();
|
|
2181
|
-
var
|
|
2182
|
-
var
|
|
2248
|
+
var import_react18 = require("react");
|
|
2249
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2183
2250
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
|
2184
2251
|
var SelectField = ({
|
|
2185
2252
|
field,
|
|
@@ -2191,20 +2258,20 @@ var SelectField = ({
|
|
|
2191
2258
|
readOnly,
|
|
2192
2259
|
id
|
|
2193
2260
|
}) => {
|
|
2194
|
-
const flatOptions = (0,
|
|
2261
|
+
const flatOptions = (0, import_react18.useMemo)(
|
|
2195
2262
|
() => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
|
|
2196
2263
|
[field]
|
|
2197
2264
|
);
|
|
2198
2265
|
if (field.type !== "select" || !field.options) {
|
|
2199
2266
|
return null;
|
|
2200
2267
|
}
|
|
2201
|
-
return /* @__PURE__ */ (0,
|
|
2268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2202
2269
|
Label2,
|
|
2203
2270
|
{
|
|
2204
2271
|
label: label || name,
|
|
2205
|
-
icon: /* @__PURE__ */ (0,
|
|
2272
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDown, { size: 16 }),
|
|
2206
2273
|
readOnly,
|
|
2207
|
-
children: /* @__PURE__ */ (0,
|
|
2274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2208
2275
|
"select",
|
|
2209
2276
|
{
|
|
2210
2277
|
id,
|
|
@@ -2221,7 +2288,7 @@ var SelectField = ({
|
|
|
2221
2288
|
}
|
|
2222
2289
|
},
|
|
2223
2290
|
value,
|
|
2224
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
|
2291
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2225
2292
|
"option",
|
|
2226
2293
|
{
|
|
2227
2294
|
label: option.label,
|
|
@@ -2237,7 +2304,7 @@ var SelectField = ({
|
|
|
2237
2304
|
|
|
2238
2305
|
// components/AutoField/fields/TextareaField/index.tsx
|
|
2239
2306
|
init_react_import();
|
|
2240
|
-
var
|
|
2307
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2241
2308
|
var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
|
|
2242
2309
|
var TextareaField = ({
|
|
2243
2310
|
onChange,
|
|
@@ -2248,7 +2315,7 @@ var TextareaField = ({
|
|
|
2248
2315
|
Label: Label2,
|
|
2249
2316
|
id
|
|
2250
2317
|
}) => {
|
|
2251
|
-
return /* @__PURE__ */ (0,
|
|
2318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2252
2319
|
"textarea",
|
|
2253
2320
|
{
|
|
2254
2321
|
id,
|
|
@@ -2275,7 +2342,7 @@ init_react_import();
|
|
|
2275
2342
|
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
|
2276
2343
|
|
|
2277
2344
|
// components/AutoField/fields/ObjectField/index.tsx
|
|
2278
|
-
var
|
|
2345
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2279
2346
|
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
|
2280
2347
|
var ObjectField = ({
|
|
2281
2348
|
field,
|
|
@@ -2287,43 +2354,54 @@ var ObjectField = ({
|
|
|
2287
2354
|
readOnly,
|
|
2288
2355
|
id
|
|
2289
2356
|
}) => {
|
|
2290
|
-
const {
|
|
2357
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
|
2291
2358
|
if (field.type !== "object" || !field.objectFields) {
|
|
2292
2359
|
return null;
|
|
2293
2360
|
}
|
|
2294
|
-
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
|
2295
2361
|
const data = value || {};
|
|
2296
|
-
return /* @__PURE__ */ (0,
|
|
2362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2297
2363
|
Label2,
|
|
2298
2364
|
{
|
|
2299
2365
|
label: label || name,
|
|
2300
|
-
icon: /* @__PURE__ */ (0,
|
|
2366
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EllipsisVertical, { size: 16 }),
|
|
2301
2367
|
el: "div",
|
|
2302
2368
|
readOnly,
|
|
2303
|
-
children: /* @__PURE__ */ (0,
|
|
2304
|
-
const subField = field.objectFields[
|
|
2305
|
-
const
|
|
2306
|
-
const
|
|
2307
|
-
const subReadOnly = readOnly ? readOnly :
|
|
2308
|
-
|
|
2309
|
-
|
|
2369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
|
2370
|
+
const subField = field.objectFields[subName];
|
|
2371
|
+
const subPath = `${name}.${subName}`;
|
|
2372
|
+
const localSubPath = `${localName || name}.${subName}`;
|
|
2373
|
+
const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
|
|
2374
|
+
const label2 = subField.label || subName;
|
|
2375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2376
|
+
NestedFieldProvider,
|
|
2310
2377
|
{
|
|
2311
|
-
name:
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2378
|
+
name: localName || id,
|
|
2379
|
+
subName,
|
|
2380
|
+
readOnlyFields,
|
|
2381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2382
|
+
AutoFieldPrivate,
|
|
2383
|
+
{
|
|
2384
|
+
name: subPath,
|
|
2385
|
+
label: subPath,
|
|
2386
|
+
id: `${id}_${subName}`,
|
|
2387
|
+
readOnly: subReadOnly,
|
|
2388
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
|
2389
|
+
label: label2
|
|
2390
|
+
// May be used by custom fields
|
|
2321
2391
|
}),
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2392
|
+
value: data[subName],
|
|
2393
|
+
onChange: (val, ui) => {
|
|
2394
|
+
onChange(
|
|
2395
|
+
__spreadProps(__spreadValues({}, data), {
|
|
2396
|
+
[subName]: val
|
|
2397
|
+
}),
|
|
2398
|
+
ui
|
|
2399
|
+
);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
)
|
|
2325
2403
|
},
|
|
2326
|
-
|
|
2404
|
+
subPath
|
|
2327
2405
|
);
|
|
2328
2406
|
}) }) })
|
|
2329
2407
|
}
|
|
@@ -2332,7 +2410,7 @@ var ObjectField = ({
|
|
|
2332
2410
|
|
|
2333
2411
|
// lib/use-safe-id.ts
|
|
2334
2412
|
init_react_import();
|
|
2335
|
-
var
|
|
2413
|
+
var import_react19 = __toESM(require("react"));
|
|
2336
2414
|
|
|
2337
2415
|
// lib/generate-id.ts
|
|
2338
2416
|
init_react_import();
|
|
@@ -2341,15 +2419,15 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
|
|
|
2341
2419
|
|
|
2342
2420
|
// lib/use-safe-id.ts
|
|
2343
2421
|
var useSafeId = () => {
|
|
2344
|
-
if (typeof
|
|
2345
|
-
return
|
|
2422
|
+
if (typeof import_react19.default.useId !== "undefined") {
|
|
2423
|
+
return import_react19.default.useId();
|
|
2346
2424
|
}
|
|
2347
|
-
const [id] = (0,
|
|
2425
|
+
const [id] = (0, import_react19.useState)(generateId());
|
|
2348
2426
|
return id;
|
|
2349
2427
|
};
|
|
2350
2428
|
|
|
2351
2429
|
// components/AutoField/index.tsx
|
|
2352
|
-
var
|
|
2430
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2353
2431
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
|
2354
2432
|
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
|
2355
2433
|
var FieldLabel = ({
|
|
@@ -2361,16 +2439,16 @@ var FieldLabel = ({
|
|
|
2361
2439
|
className
|
|
2362
2440
|
}) => {
|
|
2363
2441
|
const El = el;
|
|
2364
|
-
return /* @__PURE__ */ (0,
|
|
2365
|
-
/* @__PURE__ */ (0,
|
|
2366
|
-
icon ? /* @__PURE__ */ (0,
|
|
2442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(El, { className, children: [
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName15("label"), children: [
|
|
2444
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {}),
|
|
2367
2445
|
label,
|
|
2368
|
-
readOnly && /* @__PURE__ */ (0,
|
|
2446
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Lock, { size: "12" }) })
|
|
2369
2447
|
] }),
|
|
2370
2448
|
children
|
|
2371
2449
|
] });
|
|
2372
2450
|
};
|
|
2373
|
-
var
|
|
2451
|
+
var FieldLabelInternal = ({
|
|
2374
2452
|
children,
|
|
2375
2453
|
icon,
|
|
2376
2454
|
label,
|
|
@@ -2378,14 +2456,14 @@ var FieldLabelInternal2 = ({
|
|
|
2378
2456
|
readOnly
|
|
2379
2457
|
}) => {
|
|
2380
2458
|
const { overrides } = useAppContext();
|
|
2381
|
-
const Wrapper = (0,
|
|
2459
|
+
const Wrapper = (0, import_react20.useMemo)(
|
|
2382
2460
|
() => overrides.fieldLabel || FieldLabel,
|
|
2383
2461
|
[overrides]
|
|
2384
2462
|
);
|
|
2385
2463
|
if (!label) {
|
|
2386
|
-
return /* @__PURE__ */ (0,
|
|
2464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
|
|
2387
2465
|
}
|
|
2388
|
-
return /* @__PURE__ */ (0,
|
|
2466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2389
2467
|
Wrapper,
|
|
2390
2468
|
{
|
|
2391
2469
|
label,
|
|
@@ -2399,8 +2477,9 @@ var FieldLabelInternal2 = ({
|
|
|
2399
2477
|
};
|
|
2400
2478
|
function AutoFieldInternal(props) {
|
|
2401
2479
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2402
|
-
const { dispatch, overrides } = useAppContext();
|
|
2403
|
-
const
|
|
2480
|
+
const { dispatch, overrides, selectedItem } = useAppContext();
|
|
2481
|
+
const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
|
|
2482
|
+
const { id, Label: Label2 = FieldLabelInternal } = props;
|
|
2404
2483
|
const field = props.field;
|
|
2405
2484
|
const label = field.label;
|
|
2406
2485
|
const defaultId = useSafeId();
|
|
@@ -2431,7 +2510,7 @@ function AutoFieldInternal(props) {
|
|
|
2431
2510
|
Label: Label2,
|
|
2432
2511
|
id: resolvedId
|
|
2433
2512
|
});
|
|
2434
|
-
const onFocus = (0,
|
|
2513
|
+
const onFocus = (0, import_react20.useCallback)(
|
|
2435
2514
|
(e) => {
|
|
2436
2515
|
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
|
2437
2516
|
e.stopPropagation();
|
|
@@ -2445,7 +2524,7 @@ function AutoFieldInternal(props) {
|
|
|
2445
2524
|
},
|
|
2446
2525
|
[mergedProps.name]
|
|
2447
2526
|
);
|
|
2448
|
-
const onBlur = (0,
|
|
2527
|
+
const onBlur = (0, import_react20.useCallback)((e) => {
|
|
2449
2528
|
if ("name" in e.target) {
|
|
2450
2529
|
dispatch({
|
|
2451
2530
|
type: "setUi",
|
|
@@ -2460,27 +2539,36 @@ function AutoFieldInternal(props) {
|
|
|
2460
2539
|
return null;
|
|
2461
2540
|
}
|
|
2462
2541
|
const CustomField = field.render;
|
|
2463
|
-
return /* @__PURE__ */ (0,
|
|
2542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
|
|
2464
2543
|
}
|
|
2465
2544
|
const children = defaultFields[field.type](mergedProps);
|
|
2466
2545
|
const Render2 = render[field.type];
|
|
2467
|
-
return /* @__PURE__ */ (0,
|
|
2468
|
-
|
|
2546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2547
|
+
NestedFieldContext.Provider,
|
|
2469
2548
|
{
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
onClick: (e) => {
|
|
2474
|
-
e.stopPropagation();
|
|
2549
|
+
value: {
|
|
2550
|
+
readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
|
|
2551
|
+
localName: nestedFieldContext.localName
|
|
2475
2552
|
},
|
|
2476
|
-
children: /* @__PURE__ */ (0,
|
|
2553
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2554
|
+
"div",
|
|
2555
|
+
{
|
|
2556
|
+
className: getClassNameWrapper(),
|
|
2557
|
+
onFocus,
|
|
2558
|
+
onBlur,
|
|
2559
|
+
onClick: (e) => {
|
|
2560
|
+
e.stopPropagation();
|
|
2561
|
+
},
|
|
2562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
|
2563
|
+
}
|
|
2564
|
+
)
|
|
2477
2565
|
}
|
|
2478
2566
|
);
|
|
2479
2567
|
}
|
|
2480
2568
|
function AutoFieldPrivate(props) {
|
|
2481
2569
|
const { state } = useAppContext();
|
|
2482
2570
|
const { value, onChange } = props;
|
|
2483
|
-
const [localValue, setLocalValue] = (0,
|
|
2571
|
+
const [localValue, setLocalValue] = (0, import_react20.useState)(value);
|
|
2484
2572
|
const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
|
|
2485
2573
|
(val, ui) => {
|
|
2486
2574
|
onChange(val, ui);
|
|
@@ -2488,11 +2576,11 @@ function AutoFieldPrivate(props) {
|
|
|
2488
2576
|
50,
|
|
2489
2577
|
{ leading: true }
|
|
2490
2578
|
);
|
|
2491
|
-
const onChangeLocal = (0,
|
|
2579
|
+
const onChangeLocal = (0, import_react20.useCallback)((val, ui) => {
|
|
2492
2580
|
setLocalValue(val);
|
|
2493
2581
|
onChangeDb(val, ui);
|
|
2494
2582
|
}, []);
|
|
2495
|
-
(0,
|
|
2583
|
+
(0, import_react20.useEffect)(() => {
|
|
2496
2584
|
if (state.ui.field.focus !== props.name) {
|
|
2497
2585
|
setLocalValue(value);
|
|
2498
2586
|
}
|
|
@@ -2501,11 +2589,11 @@ function AutoFieldPrivate(props) {
|
|
|
2501
2589
|
value: localValue,
|
|
2502
2590
|
onChange: onChangeLocal
|
|
2503
2591
|
};
|
|
2504
|
-
return /* @__PURE__ */ (0,
|
|
2592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
|
2505
2593
|
}
|
|
2506
2594
|
function AutoField(props) {
|
|
2507
|
-
const DefaultLabel = (0,
|
|
2508
|
-
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0,
|
|
2595
|
+
const DefaultLabel = (0, import_react20.useMemo)(() => {
|
|
2596
|
+
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2509
2597
|
"div",
|
|
2510
2598
|
__spreadProps(__spreadValues({}, labelProps), {
|
|
2511
2599
|
className: getClassName15({ readOnly: props.readOnly })
|
|
@@ -2513,7 +2601,7 @@ function AutoField(props) {
|
|
|
2513
2601
|
);
|
|
2514
2602
|
return DefaultLabel2;
|
|
2515
2603
|
}, [props.readOnly]);
|
|
2516
|
-
return /* @__PURE__ */ (0,
|
|
2604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
|
2517
2605
|
}
|
|
2518
2606
|
|
|
2519
2607
|
// components/Drawer/index.tsx
|
|
@@ -2524,21 +2612,21 @@ init_react_import();
|
|
|
2524
2612
|
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" };
|
|
2525
2613
|
|
|
2526
2614
|
// components/Drawer/index.tsx
|
|
2527
|
-
var
|
|
2615
|
+
var import_react32 = require("react");
|
|
2528
2616
|
|
|
2529
2617
|
// components/DragDropContext/index.tsx
|
|
2530
2618
|
init_react_import();
|
|
2531
|
-
var
|
|
2532
|
-
var
|
|
2619
|
+
var import_react30 = require("@dnd-kit/react");
|
|
2620
|
+
var import_react31 = require("react");
|
|
2533
2621
|
var import_dom = require("@dnd-kit/dom");
|
|
2534
2622
|
|
|
2535
2623
|
// components/DropZone/index.tsx
|
|
2536
2624
|
init_react_import();
|
|
2537
|
-
var
|
|
2625
|
+
var import_react29 = require("react");
|
|
2538
2626
|
|
|
2539
2627
|
// components/DraggableComponent/index.tsx
|
|
2540
2628
|
init_react_import();
|
|
2541
|
-
var
|
|
2629
|
+
var import_react23 = require("react");
|
|
2542
2630
|
|
|
2543
2631
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
|
2544
2632
|
init_react_import();
|
|
@@ -2547,15 +2635,15 @@ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8
|
|
|
2547
2635
|
// components/DraggableComponent/index.tsx
|
|
2548
2636
|
var import_react_dom2 = require("react-dom");
|
|
2549
2637
|
|
|
2550
|
-
//
|
|
2638
|
+
// lib/dnd/collision/dynamic/index.ts
|
|
2551
2639
|
init_react_import();
|
|
2552
2640
|
var import_abstract8 = require("@dnd-kit/abstract");
|
|
2553
2641
|
|
|
2554
|
-
//
|
|
2642
|
+
// lib/dnd/collision/directional/index.ts
|
|
2555
2643
|
init_react_import();
|
|
2556
2644
|
var import_abstract = require("@dnd-kit/abstract");
|
|
2557
2645
|
|
|
2558
|
-
//
|
|
2646
|
+
// lib/dnd/collision/collision-debug.ts
|
|
2559
2647
|
init_react_import();
|
|
2560
2648
|
var DEBUG = false;
|
|
2561
2649
|
var debugElements = {};
|
|
@@ -2604,7 +2692,7 @@ var collisionDebug = (a, b, id, color, label) => {
|
|
|
2604
2692
|
});
|
|
2605
2693
|
};
|
|
2606
2694
|
|
|
2607
|
-
//
|
|
2695
|
+
// lib/dnd/collision/directional/index.ts
|
|
2608
2696
|
var distanceChange = "increasing";
|
|
2609
2697
|
var directionalCollision = (input, previous) => {
|
|
2610
2698
|
var _a;
|
|
@@ -2637,7 +2725,7 @@ var directionalCollision = (input, previous) => {
|
|
|
2637
2725
|
return null;
|
|
2638
2726
|
};
|
|
2639
2727
|
|
|
2640
|
-
//
|
|
2728
|
+
// lib/dnd/collision/dynamic/get-direction.ts
|
|
2641
2729
|
init_react_import();
|
|
2642
2730
|
var getDirection = (dragAxis, delta) => {
|
|
2643
2731
|
if (dragAxis === "dynamic") {
|
|
@@ -2652,7 +2740,7 @@ var getDirection = (dragAxis, delta) => {
|
|
|
2652
2740
|
return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
|
|
2653
2741
|
};
|
|
2654
2742
|
|
|
2655
|
-
//
|
|
2743
|
+
// lib/dnd/collision/dynamic/get-midpoint-impact.ts
|
|
2656
2744
|
init_react_import();
|
|
2657
2745
|
var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
|
|
2658
2746
|
const dragRect = dragShape.boundingRectangle;
|
|
@@ -2671,7 +2759,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
|
|
|
2671
2759
|
return dragRect.right - offset >= dropCenter.x;
|
|
2672
2760
|
};
|
|
2673
2761
|
|
|
2674
|
-
//
|
|
2762
|
+
// lib/dnd/collision/dynamic/track-movement-interval.ts
|
|
2675
2763
|
init_react_import();
|
|
2676
2764
|
var import_geometry = require("@dnd-kit/geometry");
|
|
2677
2765
|
var INTERVAL_SENSITIVITY = 10;
|
|
@@ -2775,7 +2863,14 @@ var closestCorners = (input) => {
|
|
|
2775
2863
|
};
|
|
2776
2864
|
};
|
|
2777
2865
|
|
|
2778
|
-
//
|
|
2866
|
+
// lib/dnd/collision/dynamic/store.ts
|
|
2867
|
+
init_react_import();
|
|
2868
|
+
var import_vanilla = require("zustand/vanilla");
|
|
2869
|
+
var collisionStore = (0, import_vanilla.createStore)(() => ({
|
|
2870
|
+
fallbackEnabled: false
|
|
2871
|
+
}));
|
|
2872
|
+
|
|
2873
|
+
// lib/dnd/collision/dynamic/index.ts
|
|
2779
2874
|
var flushNext = "";
|
|
2780
2875
|
var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
|
|
2781
2876
|
var _a, _b, _c, _d, _e;
|
|
@@ -2787,6 +2882,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
|
2787
2882
|
return null;
|
|
2788
2883
|
}
|
|
2789
2884
|
const { center: dragCenter } = dragShape;
|
|
2885
|
+
const { fallbackEnabled } = collisionStore.getState();
|
|
2790
2886
|
const interval = trackMovementInterval(position.current, dragAxis);
|
|
2791
2887
|
dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
|
|
2792
2888
|
direction: interval.direction
|
|
@@ -2832,7 +2928,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
|
2832
2928
|
flushNext = "";
|
|
2833
2929
|
return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
|
|
2834
2930
|
}
|
|
2835
|
-
if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
|
2931
|
+
if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
|
|
2836
2932
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
|
2837
2933
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
|
2838
2934
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
|
@@ -2893,8 +2989,102 @@ function getDeepScrollPosition(element) {
|
|
|
2893
2989
|
return totalScroll;
|
|
2894
2990
|
}
|
|
2895
2991
|
|
|
2992
|
+
// components/DropZone/context.tsx
|
|
2993
|
+
init_react_import();
|
|
2994
|
+
var import_react21 = require("react");
|
|
2995
|
+
var import_zustand = require("zustand");
|
|
2996
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2997
|
+
var dropZoneContext = (0, import_react21.createContext)(null);
|
|
2998
|
+
var ZoneStoreContext = (0, import_react21.createContext)(
|
|
2999
|
+
(0, import_zustand.createStore)(() => ({
|
|
3000
|
+
zoneDepthIndex: {},
|
|
3001
|
+
nextZoneDepthIndex: {},
|
|
3002
|
+
areaDepthIndex: {},
|
|
3003
|
+
nextAreaDepthIndex: {},
|
|
3004
|
+
draggedItem: null,
|
|
3005
|
+
previewIndex: {}
|
|
3006
|
+
}))
|
|
3007
|
+
);
|
|
3008
|
+
var ZoneStoreProvider = ({
|
|
3009
|
+
children,
|
|
3010
|
+
store
|
|
3011
|
+
}) => {
|
|
3012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ZoneStoreContext.Provider, { value: store, children });
|
|
3013
|
+
};
|
|
3014
|
+
var DropZoneProvider = ({
|
|
3015
|
+
children,
|
|
3016
|
+
value
|
|
3017
|
+
}) => {
|
|
3018
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
|
|
3019
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
|
|
3020
|
+
{}
|
|
3021
|
+
);
|
|
3022
|
+
const [activeZones, setActiveZones] = (0, import_react21.useState)({});
|
|
3023
|
+
const { dispatch } = useAppContext();
|
|
3024
|
+
const registerZoneArea = (0, import_react21.useCallback)(
|
|
3025
|
+
(area) => {
|
|
3026
|
+
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
|
3027
|
+
},
|
|
3028
|
+
[setAreasWithZones]
|
|
3029
|
+
);
|
|
3030
|
+
const registerZone = (0, import_react21.useCallback)(
|
|
3031
|
+
(zoneCompound) => {
|
|
3032
|
+
if (!dispatch) {
|
|
3033
|
+
return;
|
|
3034
|
+
}
|
|
3035
|
+
dispatch({
|
|
3036
|
+
type: "registerZone",
|
|
3037
|
+
zone: zoneCompound
|
|
3038
|
+
});
|
|
3039
|
+
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
|
|
3040
|
+
},
|
|
3041
|
+
[setActiveZones, dispatch]
|
|
3042
|
+
);
|
|
3043
|
+
const unregisterZone = (0, import_react21.useCallback)(
|
|
3044
|
+
(zoneCompound) => {
|
|
3045
|
+
if (!dispatch) {
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
3048
|
+
dispatch({
|
|
3049
|
+
type: "unregisterZone",
|
|
3050
|
+
zone: zoneCompound
|
|
3051
|
+
});
|
|
3052
|
+
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
|
|
3053
|
+
[zoneCompound]: false
|
|
3054
|
+
}));
|
|
3055
|
+
},
|
|
3056
|
+
[setActiveZones, dispatch]
|
|
3057
|
+
);
|
|
3058
|
+
const memoValue = (0, import_react21.useMemo)(
|
|
3059
|
+
() => __spreadValues({
|
|
3060
|
+
hoveringComponent,
|
|
3061
|
+
setHoveringComponent,
|
|
3062
|
+
registerZoneArea,
|
|
3063
|
+
areasWithZones,
|
|
3064
|
+
registerZone,
|
|
3065
|
+
unregisterZone,
|
|
3066
|
+
activeZones
|
|
3067
|
+
}, value),
|
|
3068
|
+
[value, hoveringComponent, areasWithZones, activeZones]
|
|
3069
|
+
);
|
|
3070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
|
|
3071
|
+
};
|
|
3072
|
+
|
|
3073
|
+
// lib/use-context-store.ts
|
|
3074
|
+
init_react_import();
|
|
3075
|
+
var import_react22 = require("react");
|
|
3076
|
+
var import_zustand2 = require("zustand");
|
|
3077
|
+
var import_shallow = require("zustand/react/shallow");
|
|
3078
|
+
function useContextStore(context, selector) {
|
|
3079
|
+
const store = (0, import_react22.useContext)(context);
|
|
3080
|
+
if (!store) {
|
|
3081
|
+
throw new Error("useContextStore must be used inside context");
|
|
3082
|
+
}
|
|
3083
|
+
return (0, import_zustand2.useStore)(store, (0, import_shallow.useShallow)(selector));
|
|
3084
|
+
}
|
|
3085
|
+
|
|
2896
3086
|
// components/DraggableComponent/index.tsx
|
|
2897
|
-
var
|
|
3087
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2898
3088
|
var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
|
2899
3089
|
var DEBUG2 = false;
|
|
2900
3090
|
var space = 8;
|
|
@@ -2905,12 +3095,12 @@ var DefaultActionBar = ({
|
|
|
2905
3095
|
label,
|
|
2906
3096
|
children,
|
|
2907
3097
|
parentAction
|
|
2908
|
-
}) => /* @__PURE__ */ (0,
|
|
2909
|
-
/* @__PURE__ */ (0,
|
|
3098
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar, { children: [
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar.Group, { children: [
|
|
2910
3100
|
parentAction,
|
|
2911
|
-
label && /* @__PURE__ */ (0,
|
|
3101
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Label, { label })
|
|
2912
3102
|
] }),
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
3103
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Group, { children })
|
|
2914
3104
|
] });
|
|
2915
3105
|
var convertIdToSelector = (id, zoneCompound, data) => {
|
|
2916
3106
|
const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
|
|
@@ -2945,9 +3135,9 @@ var DraggableComponent = ({
|
|
|
2945
3135
|
iframe,
|
|
2946
3136
|
state
|
|
2947
3137
|
} = useAppContext();
|
|
2948
|
-
const ctx = (0,
|
|
2949
|
-
const [localZones, setLocalZones] = (0,
|
|
2950
|
-
const registerLocalZone = (0,
|
|
3138
|
+
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
|
3139
|
+
const [localZones, setLocalZones] = (0, import_react23.useState)({});
|
|
3140
|
+
const registerLocalZone = (0, import_react23.useCallback)(
|
|
2951
3141
|
(zoneCompound2, active) => {
|
|
2952
3142
|
var _a;
|
|
2953
3143
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
|
@@ -2957,7 +3147,7 @@ var DraggableComponent = ({
|
|
|
2957
3147
|
},
|
|
2958
3148
|
[setLocalZones]
|
|
2959
3149
|
);
|
|
2960
|
-
const unregisterLocalZone = (0,
|
|
3150
|
+
const unregisterLocalZone = (0, import_react23.useCallback)(
|
|
2961
3151
|
(zoneCompound2) => {
|
|
2962
3152
|
var _a;
|
|
2963
3153
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
|
@@ -2971,8 +3161,8 @@ var DraggableComponent = ({
|
|
|
2971
3161
|
);
|
|
2972
3162
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
|
2973
3163
|
const { path = [] } = ctx || {};
|
|
2974
|
-
const [canDrag, setCanDrag] = (0,
|
|
2975
|
-
(0,
|
|
3164
|
+
const [canDrag, setCanDrag] = (0, import_react23.useState)(false);
|
|
3165
|
+
(0, import_react23.useEffect)(() => {
|
|
2976
3166
|
var _a;
|
|
2977
3167
|
const item = getItem({ index, zone: zoneCompound }, state.data);
|
|
2978
3168
|
if (item) {
|
|
@@ -2982,10 +3172,13 @@ var DraggableComponent = ({
|
|
|
2982
3172
|
setCanDrag((_a = perms.drag) != null ? _a : true);
|
|
2983
3173
|
}
|
|
2984
3174
|
}, [state, index, zoneCompound, getPermissions]);
|
|
2985
|
-
const userIsDragging =
|
|
3175
|
+
const userIsDragging = useContextStore(
|
|
3176
|
+
ZoneStoreContext,
|
|
3177
|
+
(s) => !!s.draggedItem
|
|
3178
|
+
);
|
|
2986
3179
|
const canCollide = canDrag || userIsDragging;
|
|
2987
3180
|
const disabled = !isEnabled || !canCollide;
|
|
2988
|
-
const [dragAxis, setDragAxis] = (0,
|
|
3181
|
+
const [dragAxis, setDragAxis] = (0, import_react23.useState)(userDragAxis || autoDragAxis);
|
|
2989
3182
|
const { ref: sortableRef, status } = useSortableSafe({
|
|
2990
3183
|
id,
|
|
2991
3184
|
index,
|
|
@@ -3011,8 +3204,8 @@ var DraggableComponent = ({
|
|
|
3011
3204
|
}
|
|
3012
3205
|
});
|
|
3013
3206
|
const thisIsDragging = status === "dragging";
|
|
3014
|
-
const ref = (0,
|
|
3015
|
-
const refSetter = (0,
|
|
3207
|
+
const ref = (0, import_react23.useRef)(null);
|
|
3208
|
+
const refSetter = (0, import_react23.useCallback)(
|
|
3016
3209
|
(el) => {
|
|
3017
3210
|
sortableRef(el);
|
|
3018
3211
|
if (el) {
|
|
@@ -3021,14 +3214,14 @@ var DraggableComponent = ({
|
|
|
3021
3214
|
},
|
|
3022
3215
|
[sortableRef]
|
|
3023
3216
|
);
|
|
3024
|
-
const [portalEl, setPortalEl] = (0,
|
|
3025
|
-
(0,
|
|
3217
|
+
const [portalEl, setPortalEl] = (0, import_react23.useState)();
|
|
3218
|
+
(0, import_react23.useEffect)(() => {
|
|
3026
3219
|
var _a, _b, _c;
|
|
3027
3220
|
setPortalEl(
|
|
3028
3221
|
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
|
|
3029
3222
|
);
|
|
3030
3223
|
}, [iframe.enabled, ref.current]);
|
|
3031
|
-
const getStyle = (0,
|
|
3224
|
+
const getStyle = (0, import_react23.useCallback)(() => {
|
|
3032
3225
|
var _a, _b, _c;
|
|
3033
3226
|
if (!ref.current) return;
|
|
3034
3227
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -3048,11 +3241,11 @@ var DraggableComponent = ({
|
|
|
3048
3241
|
};
|
|
3049
3242
|
return style2;
|
|
3050
3243
|
}, [ref.current]);
|
|
3051
|
-
const [style, setStyle] = (0,
|
|
3052
|
-
const sync = (0,
|
|
3244
|
+
const [style, setStyle] = (0, import_react23.useState)();
|
|
3245
|
+
const sync = (0, import_react23.useCallback)(() => {
|
|
3053
3246
|
setStyle(getStyle());
|
|
3054
3247
|
}, [ref.current, iframe]);
|
|
3055
|
-
(0,
|
|
3248
|
+
(0, import_react23.useEffect)(() => {
|
|
3056
3249
|
if (ref.current) {
|
|
3057
3250
|
const observer = new ResizeObserver(sync);
|
|
3058
3251
|
observer.observe(ref.current);
|
|
@@ -3061,20 +3254,22 @@ var DraggableComponent = ({
|
|
|
3061
3254
|
};
|
|
3062
3255
|
}
|
|
3063
3256
|
}, [ref.current]);
|
|
3064
|
-
(0,
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3257
|
+
(0, import_react23.useEffect)(() => {
|
|
3258
|
+
if (isSelected) {
|
|
3259
|
+
ctx == null ? void 0 : ctx.registerPath({
|
|
3260
|
+
index,
|
|
3261
|
+
zone: zoneCompound
|
|
3262
|
+
});
|
|
3263
|
+
}
|
|
3069
3264
|
}, [isSelected]);
|
|
3070
|
-
const CustomActionBar = (0,
|
|
3265
|
+
const CustomActionBar = (0, import_react23.useMemo)(
|
|
3071
3266
|
() => overrides.actionBar || DefaultActionBar,
|
|
3072
3267
|
[overrides.actionBar]
|
|
3073
3268
|
);
|
|
3074
3269
|
const permissions = getPermissions({
|
|
3075
3270
|
item: selectedItem
|
|
3076
3271
|
});
|
|
3077
|
-
const onClick = (0,
|
|
3272
|
+
const onClick = (0, import_react23.useCallback)(
|
|
3078
3273
|
(e) => {
|
|
3079
3274
|
e.stopPropagation();
|
|
3080
3275
|
dispatch({
|
|
@@ -3086,7 +3281,7 @@ var DraggableComponent = ({
|
|
|
3086
3281
|
},
|
|
3087
3282
|
[index, zoneCompound, id]
|
|
3088
3283
|
);
|
|
3089
|
-
const onSelectParent = (0,
|
|
3284
|
+
const onSelectParent = (0, import_react23.useCallback)(() => {
|
|
3090
3285
|
if (!(ctx == null ? void 0 : ctx.areaId)) {
|
|
3091
3286
|
return;
|
|
3092
3287
|
}
|
|
@@ -3104,23 +3299,23 @@ var DraggableComponent = ({
|
|
|
3104
3299
|
}
|
|
3105
3300
|
});
|
|
3106
3301
|
}, [ctx, path]);
|
|
3107
|
-
const onDuplicate = (0,
|
|
3302
|
+
const onDuplicate = (0, import_react23.useCallback)(() => {
|
|
3108
3303
|
dispatch({
|
|
3109
3304
|
type: "duplicate",
|
|
3110
3305
|
sourceIndex: index,
|
|
3111
3306
|
sourceZone: zoneCompound
|
|
3112
3307
|
});
|
|
3113
3308
|
}, [index, zoneCompound]);
|
|
3114
|
-
const onDelete = (0,
|
|
3309
|
+
const onDelete = (0, import_react23.useCallback)(() => {
|
|
3115
3310
|
dispatch({
|
|
3116
3311
|
type: "remove",
|
|
3117
3312
|
index,
|
|
3118
3313
|
zone: zoneCompound
|
|
3119
3314
|
});
|
|
3120
3315
|
}, [index, zoneCompound]);
|
|
3121
|
-
const [hover, setHover] = (0,
|
|
3316
|
+
const [hover, setHover] = (0, import_react23.useState)(false);
|
|
3122
3317
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
|
3123
|
-
(0,
|
|
3318
|
+
(0, import_react23.useEffect)(() => {
|
|
3124
3319
|
if (!ref.current) {
|
|
3125
3320
|
return;
|
|
3126
3321
|
}
|
|
@@ -3170,7 +3365,7 @@ var DraggableComponent = ({
|
|
|
3170
3365
|
thisIsDragging,
|
|
3171
3366
|
inDroppableZone
|
|
3172
3367
|
]);
|
|
3173
|
-
(0,
|
|
3368
|
+
(0, import_react23.useEffect)(() => {
|
|
3174
3369
|
if (ref.current && disabled) {
|
|
3175
3370
|
ref.current.setAttribute("data-puck-disabled", "");
|
|
3176
3371
|
return () => {
|
|
@@ -3179,8 +3374,8 @@ var DraggableComponent = ({
|
|
|
3179
3374
|
};
|
|
3180
3375
|
}
|
|
3181
3376
|
}, [disabled, ref]);
|
|
3182
|
-
const [isVisible, setIsVisible] = (0,
|
|
3183
|
-
(0,
|
|
3377
|
+
const [isVisible, setIsVisible] = (0, import_react23.useState)(false);
|
|
3378
|
+
(0, import_react23.useEffect)(() => {
|
|
3184
3379
|
sync();
|
|
3185
3380
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
|
3186
3381
|
setIsVisible(true);
|
|
@@ -3188,7 +3383,7 @@ var DraggableComponent = ({
|
|
|
3188
3383
|
setIsVisible(false);
|
|
3189
3384
|
}
|
|
3190
3385
|
}, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
|
|
3191
|
-
const syncActionsPosition = (0,
|
|
3386
|
+
const syncActionsPosition = (0, import_react23.useCallback)(
|
|
3192
3387
|
(el) => {
|
|
3193
3388
|
if (el) {
|
|
3194
3389
|
const view = el.ownerDocument.defaultView;
|
|
@@ -3205,7 +3400,7 @@ var DraggableComponent = ({
|
|
|
3205
3400
|
},
|
|
3206
3401
|
[zoomConfig]
|
|
3207
3402
|
);
|
|
3208
|
-
(0,
|
|
3403
|
+
(0, import_react23.useEffect)(() => {
|
|
3209
3404
|
if (userDragAxis) {
|
|
3210
3405
|
setDragAxis(userDragAxis);
|
|
3211
3406
|
return;
|
|
@@ -3219,8 +3414,8 @@ var DraggableComponent = ({
|
|
|
3219
3414
|
}
|
|
3220
3415
|
setDragAxis(autoDragAxis);
|
|
3221
3416
|
}, [ref, userDragAxis, autoDragAxis]);
|
|
3222
|
-
const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0,
|
|
3223
|
-
return /* @__PURE__ */ (0,
|
|
3417
|
+
const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CornerLeftUp, { size: 16 }) });
|
|
3418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3224
3419
|
DropZoneProvider,
|
|
3225
3420
|
{
|
|
3226
3421
|
value: __spreadProps(__spreadValues({}, ctx), {
|
|
@@ -3234,7 +3429,7 @@ var DraggableComponent = ({
|
|
|
3234
3429
|
}),
|
|
3235
3430
|
children: [
|
|
3236
3431
|
isVisible && (0, import_react_dom2.createPortal)(
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3432
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3238
3433
|
"div",
|
|
3239
3434
|
{
|
|
3240
3435
|
className: getClassName16({
|
|
@@ -3246,15 +3441,15 @@ var DraggableComponent = ({
|
|
|
3246
3441
|
"data-puck-overlay": true,
|
|
3247
3442
|
children: [
|
|
3248
3443
|
debug,
|
|
3249
|
-
isLoading && /* @__PURE__ */ (0,
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3444
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, {}) }),
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3251
3446
|
"div",
|
|
3252
3447
|
{
|
|
3253
3448
|
className: getClassName16("actionsOverlay"),
|
|
3254
3449
|
style: {
|
|
3255
3450
|
top: actionsOverlayTop / zoomConfig.zoom
|
|
3256
3451
|
},
|
|
3257
|
-
children: /* @__PURE__ */ (0,
|
|
3452
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3258
3453
|
"div",
|
|
3259
3454
|
{
|
|
3260
3455
|
className: getClassName16("actions"),
|
|
@@ -3266,14 +3461,14 @@ var DraggableComponent = ({
|
|
|
3266
3461
|
paddingRight: actionsSide
|
|
3267
3462
|
},
|
|
3268
3463
|
ref: syncActionsPosition,
|
|
3269
|
-
children: /* @__PURE__ */ (0,
|
|
3464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3270
3465
|
CustomActionBar,
|
|
3271
3466
|
{
|
|
3272
3467
|
parentAction,
|
|
3273
3468
|
label: DEBUG2 ? id : label,
|
|
3274
3469
|
children: [
|
|
3275
|
-
permissions.duplicate && /* @__PURE__ */ (0,
|
|
3276
|
-
permissions.delete && /* @__PURE__ */ (0,
|
|
3470
|
+
permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
|
|
3471
|
+
permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
|
|
3277
3472
|
]
|
|
3278
3473
|
}
|
|
3279
3474
|
)
|
|
@@ -3281,7 +3476,7 @@ var DraggableComponent = ({
|
|
|
3281
3476
|
)
|
|
3282
3477
|
}
|
|
3283
3478
|
),
|
|
3284
|
-
/* @__PURE__ */ (0,
|
|
3479
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("overlay") })
|
|
3285
3480
|
]
|
|
3286
3481
|
}
|
|
3287
3482
|
),
|
|
@@ -3297,70 +3492,74 @@ var DraggableComponent = ({
|
|
|
3297
3492
|
init_react_import();
|
|
3298
3493
|
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" };
|
|
3299
3494
|
|
|
3300
|
-
// components/DropZone/
|
|
3495
|
+
// components/DropZone/lib/use-min-empty-height.ts
|
|
3301
3496
|
init_react_import();
|
|
3302
|
-
var
|
|
3303
|
-
var
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
value
|
|
3497
|
+
var import_react24 = require("react");
|
|
3498
|
+
var useMinEmptyHeight = ({
|
|
3499
|
+
zoneCompound,
|
|
3500
|
+
userMinEmptyHeight,
|
|
3501
|
+
ref
|
|
3308
3502
|
}) => {
|
|
3309
|
-
const [
|
|
3310
|
-
const [
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
return;
|
|
3325
|
-
}
|
|
3326
|
-
dispatch({
|
|
3327
|
-
type: "registerZone",
|
|
3328
|
-
zone: zoneCompound
|
|
3329
|
-
});
|
|
3330
|
-
setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
|
|
3331
|
-
},
|
|
3332
|
-
[setActiveZones, dispatch]
|
|
3333
|
-
);
|
|
3334
|
-
const unregisterZone = (0, import_react21.useCallback)(
|
|
3335
|
-
(zoneCompound) => {
|
|
3336
|
-
if (!dispatch) {
|
|
3503
|
+
const [prevHeight, setPrevHeight] = (0, import_react24.useState)(0);
|
|
3504
|
+
const [isAnimating, setIsAnimating] = (0, import_react24.useState)(false);
|
|
3505
|
+
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
|
3506
|
+
var _a, _b;
|
|
3507
|
+
return {
|
|
3508
|
+
draggedItem: ((_a = s.draggedItem) == null ? void 0 : _a.data.zone) === zoneCompound ? s.draggedItem : null,
|
|
3509
|
+
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
|
3510
|
+
};
|
|
3511
|
+
});
|
|
3512
|
+
(0, import_react24.useEffect)(() => {
|
|
3513
|
+
if (draggedItem && ref.current) {
|
|
3514
|
+
if (isZone) {
|
|
3515
|
+
const rect = ref.current.getBoundingClientRect();
|
|
3516
|
+
setPrevHeight(rect.height);
|
|
3517
|
+
setIsAnimating(true);
|
|
3337
3518
|
return;
|
|
3338
3519
|
}
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
},
|
|
3347
|
-
[setActiveZones, dispatch]
|
|
3348
|
-
);
|
|
3349
|
-
const memoValue = (0, import_react21.useMemo)(
|
|
3350
|
-
() => __spreadValues({
|
|
3351
|
-
hoveringComponent,
|
|
3352
|
-
setHoveringComponent,
|
|
3353
|
-
registerZoneArea,
|
|
3354
|
-
areasWithZones,
|
|
3355
|
-
registerZone,
|
|
3356
|
-
unregisterZone,
|
|
3357
|
-
activeZones
|
|
3358
|
-
}, value),
|
|
3359
|
-
[value, hoveringComponent, areasWithZones, activeZones]
|
|
3360
|
-
);
|
|
3361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
|
|
3520
|
+
}
|
|
3521
|
+
setPrevHeight(0);
|
|
3522
|
+
setTimeout(() => {
|
|
3523
|
+
setIsAnimating(false);
|
|
3524
|
+
}, 400);
|
|
3525
|
+
}, [ref.current, draggedItem, zoneCompound]);
|
|
3526
|
+
return [prevHeight || userMinEmptyHeight, isAnimating];
|
|
3362
3527
|
};
|
|
3363
3528
|
|
|
3529
|
+
// lib/assign-refs.ts
|
|
3530
|
+
init_react_import();
|
|
3531
|
+
function assignRef(ref, node) {
|
|
3532
|
+
if (typeof ref === "function") {
|
|
3533
|
+
ref(node);
|
|
3534
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
3535
|
+
ref.current = node;
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
function assignRefs(refs, node) {
|
|
3539
|
+
refs.forEach((ref) => {
|
|
3540
|
+
assignRef(ref, node);
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3544
|
+
// components/DropZone/lib/use-content-with-preview.ts
|
|
3545
|
+
init_react_import();
|
|
3546
|
+
var import_react27 = require("react");
|
|
3547
|
+
|
|
3548
|
+
// lib/dnd/use-rendered-callback.ts
|
|
3549
|
+
init_react_import();
|
|
3550
|
+
var import_react25 = require("@dnd-kit/react");
|
|
3551
|
+
var import_react26 = require("react");
|
|
3552
|
+
function useRenderedCallback(callback, deps) {
|
|
3553
|
+
const manager = (0, import_react25.useDragDropManager)();
|
|
3554
|
+
return (0, import_react26.useCallback)(
|
|
3555
|
+
(...args) => __async(this, null, function* () {
|
|
3556
|
+
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
3557
|
+
return callback(...args);
|
|
3558
|
+
}),
|
|
3559
|
+
[...deps, manager]
|
|
3560
|
+
);
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3364
3563
|
// lib/insert.ts
|
|
3365
3564
|
init_react_import();
|
|
3366
3565
|
var insert = (list, index, item) => {
|
|
@@ -3369,58 +3568,102 @@ var insert = (list, index, item) => {
|
|
|
3369
3568
|
return result;
|
|
3370
3569
|
};
|
|
3371
3570
|
|
|
3372
|
-
// components/DropZone/use-
|
|
3571
|
+
// components/DropZone/lib/use-content-with-preview.ts
|
|
3572
|
+
var useContentWithPreview = (content, zoneCompound) => {
|
|
3573
|
+
const { draggedItemId, preview, previewExists } = useContextStore(
|
|
3574
|
+
ZoneStoreContext,
|
|
3575
|
+
(s) => {
|
|
3576
|
+
var _a;
|
|
3577
|
+
return {
|
|
3578
|
+
draggedItemId: (_a = s.draggedItem) == null ? void 0 : _a.id,
|
|
3579
|
+
preview: s.previewIndex[zoneCompound],
|
|
3580
|
+
previewExists: Object.keys(s.previewIndex || {}).length > 0
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3583
|
+
);
|
|
3584
|
+
const [contentWithPreview, setContentWithPreview] = (0, import_react27.useState)(content);
|
|
3585
|
+
const updateContent = useRenderedCallback(
|
|
3586
|
+
(content2, preview2) => {
|
|
3587
|
+
if (preview2) {
|
|
3588
|
+
if (preview2.type === "insert") {
|
|
3589
|
+
setContentWithPreview(
|
|
3590
|
+
insert(
|
|
3591
|
+
content2.filter((item) => item.props.id !== preview2.props.id),
|
|
3592
|
+
preview2.index,
|
|
3593
|
+
{
|
|
3594
|
+
type: "preview",
|
|
3595
|
+
props: { id: preview2.props.id }
|
|
3596
|
+
}
|
|
3597
|
+
)
|
|
3598
|
+
);
|
|
3599
|
+
} else {
|
|
3600
|
+
setContentWithPreview(
|
|
3601
|
+
insert(
|
|
3602
|
+
content2.filter((item) => item.props.id !== preview2.props.id),
|
|
3603
|
+
preview2.index,
|
|
3604
|
+
{
|
|
3605
|
+
type: preview2.componentType,
|
|
3606
|
+
props: preview2.props
|
|
3607
|
+
}
|
|
3608
|
+
)
|
|
3609
|
+
);
|
|
3610
|
+
}
|
|
3611
|
+
} else {
|
|
3612
|
+
setContentWithPreview(
|
|
3613
|
+
previewExists ? content2.filter((item) => item.props.id !== draggedItemId) : content2
|
|
3614
|
+
);
|
|
3615
|
+
}
|
|
3616
|
+
},
|
|
3617
|
+
[draggedItemId, previewExists]
|
|
3618
|
+
);
|
|
3619
|
+
(0, import_react27.useEffect)(() => {
|
|
3620
|
+
updateContent(content, preview);
|
|
3621
|
+
}, [content, preview]);
|
|
3622
|
+
return contentWithPreview;
|
|
3623
|
+
};
|
|
3624
|
+
|
|
3625
|
+
// components/DropZone/lib/use-drag-axis.ts
|
|
3373
3626
|
init_react_import();
|
|
3374
|
-
var
|
|
3375
|
-
var
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
(0,
|
|
3384
|
-
if (
|
|
3385
|
-
const
|
|
3386
|
-
if (
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3627
|
+
var import_react28 = require("react");
|
|
3628
|
+
var GRID_DRAG_AXIS = "dynamic";
|
|
3629
|
+
var FLEX_ROW_DRAG_AXIS = "x";
|
|
3630
|
+
var DEFAULT_DRAG_AXIS = "y";
|
|
3631
|
+
var useDragAxis = (ref, collisionAxis) => {
|
|
3632
|
+
const { status } = useAppContext();
|
|
3633
|
+
const [dragAxis, setDragAxis] = (0, import_react28.useState)(
|
|
3634
|
+
collisionAxis || DEFAULT_DRAG_AXIS
|
|
3635
|
+
);
|
|
3636
|
+
const calculateDragAxis = (0, import_react28.useCallback)(() => {
|
|
3637
|
+
if (ref.current) {
|
|
3638
|
+
const computedStyle = window.getComputedStyle(ref.current);
|
|
3639
|
+
if (computedStyle.display === "grid") {
|
|
3640
|
+
setDragAxis(GRID_DRAG_AXIS);
|
|
3641
|
+
} else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
|
|
3642
|
+
setDragAxis(FLEX_ROW_DRAG_AXIS);
|
|
3643
|
+
} else {
|
|
3644
|
+
setDragAxis(DEFAULT_DRAG_AXIS);
|
|
3391
3645
|
}
|
|
3392
3646
|
}
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3647
|
+
}, [ref.current]);
|
|
3648
|
+
(0, import_react28.useEffect)(() => {
|
|
3649
|
+
const onViewportChange = () => {
|
|
3650
|
+
calculateDragAxis();
|
|
3651
|
+
};
|
|
3652
|
+
window.addEventListener("viewportchange", onViewportChange);
|
|
3653
|
+
return () => {
|
|
3654
|
+
window.removeEventListener("viewportchange", onViewportChange);
|
|
3655
|
+
};
|
|
3656
|
+
}, []);
|
|
3657
|
+
(0, import_react28.useEffect)(calculateDragAxis, [status, collisionAxis]);
|
|
3658
|
+
return [dragAxis, calculateDragAxis];
|
|
3399
3659
|
};
|
|
3400
3660
|
|
|
3401
|
-
// lib/assign-refs.ts
|
|
3402
|
-
init_react_import();
|
|
3403
|
-
function assignRef(ref, node) {
|
|
3404
|
-
if (typeof ref === "function") {
|
|
3405
|
-
ref(node);
|
|
3406
|
-
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
3407
|
-
ref.current = node;
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3410
|
-
function assignRefs(refs, node) {
|
|
3411
|
-
refs.forEach((ref) => {
|
|
3412
|
-
assignRef(ref, node);
|
|
3413
|
-
});
|
|
3414
|
-
}
|
|
3415
|
-
|
|
3416
3661
|
// components/DropZone/index.tsx
|
|
3417
|
-
var
|
|
3662
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3418
3663
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
|
|
3419
|
-
var
|
|
3420
|
-
var
|
|
3421
|
-
var
|
|
3422
|
-
var DEFAULT_DRAG_AXIS = "y";
|
|
3423
|
-
var DropZoneEdit = (0, import_react23.forwardRef)(
|
|
3664
|
+
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
3665
|
+
var RENDER_DEBUG = false;
|
|
3666
|
+
var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3424
3667
|
function DropZoneEdit2({
|
|
3425
3668
|
zone,
|
|
3426
3669
|
allow,
|
|
@@ -3431,31 +3674,50 @@ var DropZoneEdit = (0, import_react23.forwardRef)(
|
|
|
3431
3674
|
collisionAxis
|
|
3432
3675
|
}, userRef) {
|
|
3433
3676
|
const appContext2 = useAppContext();
|
|
3434
|
-
const ctx = (0,
|
|
3677
|
+
const ctx = (0, import_react29.useContext)(dropZoneContext);
|
|
3435
3678
|
const {
|
|
3436
3679
|
// These all need setting via context
|
|
3437
3680
|
data,
|
|
3438
3681
|
config,
|
|
3439
3682
|
areaId,
|
|
3440
|
-
draggedItem,
|
|
3441
3683
|
registerZoneArea,
|
|
3442
3684
|
depth,
|
|
3443
3685
|
registerLocalZone,
|
|
3444
3686
|
unregisterLocalZone,
|
|
3445
|
-
deepestZone = rootDroppableId,
|
|
3446
|
-
deepestArea,
|
|
3447
|
-
nextDeepestArea,
|
|
3448
3687
|
path = [],
|
|
3449
3688
|
activeZones
|
|
3450
3689
|
} = ctx;
|
|
3451
|
-
const { itemSelector } = appContext2.state.ui;
|
|
3452
3690
|
let zoneCompound = rootDroppableId;
|
|
3453
|
-
|
|
3691
|
+
if (areaId) {
|
|
3692
|
+
if (zone !== rootDroppableId) {
|
|
3693
|
+
zoneCompound = `${areaId}:${zone}`;
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
|
|
3697
|
+
const {
|
|
3698
|
+
isDeepestZone,
|
|
3699
|
+
inNextDeepestArea,
|
|
3700
|
+
draggedComponentType,
|
|
3701
|
+
userIsDragging,
|
|
3702
|
+
preview
|
|
3703
|
+
} = useContextStore(ZoneStoreContext, (s) => {
|
|
3704
|
+
var _a, _b, _c;
|
|
3705
|
+
return {
|
|
3706
|
+
isDeepestZone: (_a = s.zoneDepthIndex[zoneCompound]) != null ? _a : false,
|
|
3707
|
+
inNextDeepestArea: s.nextAreaDepthIndex[areaId || ""],
|
|
3708
|
+
draggedItemId: (_b = s.draggedItem) == null ? void 0 : _b.id,
|
|
3709
|
+
draggedComponentType: (_c = s.draggedItem) == null ? void 0 : _c.data.componentType,
|
|
3710
|
+
userIsDragging: !!s.draggedItem,
|
|
3711
|
+
preview: s.previewIndex[zoneCompound]
|
|
3712
|
+
};
|
|
3713
|
+
});
|
|
3714
|
+
const { itemSelector } = appContext2.state.ui;
|
|
3715
|
+
(0, import_react29.useEffect)(() => {
|
|
3454
3716
|
if (areaId && registerZoneArea) {
|
|
3455
3717
|
registerZoneArea(areaId);
|
|
3456
3718
|
}
|
|
3457
3719
|
}, [areaId]);
|
|
3458
|
-
(0,
|
|
3720
|
+
(0, import_react29.useEffect)(() => {
|
|
3459
3721
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
3460
3722
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
3461
3723
|
}
|
|
@@ -3465,25 +3727,18 @@ var DropZoneEdit = (0, import_react23.forwardRef)(
|
|
|
3465
3727
|
}
|
|
3466
3728
|
};
|
|
3467
3729
|
}, []);
|
|
3468
|
-
|
|
3469
|
-
if (zone !== rootDroppableId) {
|
|
3470
|
-
zoneCompound = `${areaId}:${zone}`;
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
const content = (0, import_react23.useMemo)(() => {
|
|
3730
|
+
const content = (0, import_react29.useMemo)(() => {
|
|
3474
3731
|
if (areaId && zone !== rootDroppableId) {
|
|
3475
3732
|
return setupZone(data, zoneCompound).zones[zoneCompound];
|
|
3476
3733
|
}
|
|
3477
3734
|
return data.content || [];
|
|
3478
3735
|
}, [data, zoneCompound]);
|
|
3479
|
-
const ref = (0,
|
|
3480
|
-
const acceptsTarget = (0,
|
|
3481
|
-
(
|
|
3482
|
-
if (!
|
|
3736
|
+
const ref = (0, import_react29.useRef)(null);
|
|
3737
|
+
const acceptsTarget = (0, import_react29.useCallback)(
|
|
3738
|
+
(componentType) => {
|
|
3739
|
+
if (!componentType) {
|
|
3483
3740
|
return true;
|
|
3484
3741
|
}
|
|
3485
|
-
const data2 = target.data;
|
|
3486
|
-
const { componentType } = data2;
|
|
3487
3742
|
if (disallow) {
|
|
3488
3743
|
const defaultedAllow = allow || [];
|
|
3489
3744
|
const filteredDisallow = (disallow || []).filter(
|
|
@@ -3501,49 +3756,26 @@ var DropZoneEdit = (0, import_react23.forwardRef)(
|
|
|
3501
3756
|
},
|
|
3502
3757
|
[allow, disallow]
|
|
3503
3758
|
);
|
|
3504
|
-
(0,
|
|
3759
|
+
(0, import_react29.useEffect)(() => {
|
|
3505
3760
|
if (registerLocalZone) {
|
|
3506
|
-
registerLocalZone(zoneCompound, acceptsTarget(
|
|
3761
|
+
registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
|
|
3507
3762
|
}
|
|
3508
3763
|
return () => {
|
|
3509
3764
|
if (unregisterLocalZone) {
|
|
3510
3765
|
unregisterLocalZone(zoneCompound);
|
|
3511
3766
|
}
|
|
3512
3767
|
};
|
|
3513
|
-
}, [
|
|
3514
|
-
const
|
|
3515
|
-
const hoveringOverArea = nextDeepestArea ? nextDeepestArea === areaId : isRootZone;
|
|
3516
|
-
const userIsDragging = !!draggedItem;
|
|
3768
|
+
}, [draggedComponentType, zoneCompound]);
|
|
3769
|
+
const hoveringOverArea = inNextDeepestArea || isRootZone;
|
|
3517
3770
|
let isEnabled = true;
|
|
3518
|
-
if (
|
|
3519
|
-
isEnabled =
|
|
3771
|
+
if (userIsDragging) {
|
|
3772
|
+
isEnabled = isDeepestZone;
|
|
3520
3773
|
}
|
|
3521
3774
|
if (isEnabled) {
|
|
3522
|
-
isEnabled = acceptsTarget(
|
|
3523
|
-
}
|
|
3524
|
-
const
|
|
3525
|
-
const
|
|
3526
|
-
const contentWithPreview = (0, import_react23.useMemo)(() => {
|
|
3527
|
-
let contentWithPreview2 = preview ? content.filter((item) => item.props.id !== preview.props.id) : content;
|
|
3528
|
-
if (previewInZone) {
|
|
3529
|
-
contentWithPreview2 = content.filter(
|
|
3530
|
-
(item) => item.props.id !== preview.props.id
|
|
3531
|
-
);
|
|
3532
|
-
if (preview.type === "insert") {
|
|
3533
|
-
contentWithPreview2 = insert(contentWithPreview2, preview.index, {
|
|
3534
|
-
type: "preview",
|
|
3535
|
-
props: { id: preview.props.id }
|
|
3536
|
-
});
|
|
3537
|
-
} else {
|
|
3538
|
-
contentWithPreview2 = insert(contentWithPreview2, preview.index, {
|
|
3539
|
-
type: preview.componentType,
|
|
3540
|
-
props: preview.props
|
|
3541
|
-
});
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
return contentWithPreview2;
|
|
3545
|
-
}, [preview, content]);
|
|
3546
|
-
const isDropEnabled = isEnabled && (previewInZone ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
|
|
3775
|
+
isEnabled = acceptsTarget(draggedComponentType);
|
|
3776
|
+
}
|
|
3777
|
+
const contentWithPreview = useContentWithPreview(content, zoneCompound);
|
|
3778
|
+
const isDropEnabled = isEnabled && (preview ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
|
|
3547
3779
|
const droppableConfig = {
|
|
3548
3780
|
id: zoneCompound,
|
|
3549
3781
|
collisionPriority: isEnabled ? depth : 0,
|
|
@@ -3553,45 +3785,20 @@ var DropZoneEdit = (0, import_react23.forwardRef)(
|
|
|
3553
3785
|
data: {
|
|
3554
3786
|
areaId,
|
|
3555
3787
|
depth,
|
|
3556
|
-
isDroppableTarget: acceptsTarget(
|
|
3788
|
+
isDroppableTarget: acceptsTarget(draggedComponentType),
|
|
3557
3789
|
path
|
|
3558
3790
|
}
|
|
3559
3791
|
};
|
|
3560
3792
|
const { ref: dropRef } = useDroppableSafe(droppableConfig);
|
|
3561
3793
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
|
3562
3794
|
const isAreaSelected = selectedItem && areaId === selectedItem.props.id;
|
|
3563
|
-
const [dragAxis
|
|
3564
|
-
collisionAxis || DEFAULT_DRAG_AXIS
|
|
3565
|
-
);
|
|
3566
|
-
const calculateDragAxis = (0, import_react23.useCallback)(() => {
|
|
3567
|
-
if (ref.current) {
|
|
3568
|
-
const computedStyle = window.getComputedStyle(ref.current);
|
|
3569
|
-
if (computedStyle.display === "grid") {
|
|
3570
|
-
setDragAxis(GRID_DRAG_AXIS);
|
|
3571
|
-
} else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
|
|
3572
|
-
setDragAxis(FLEX_ROW_DRAG_AXIS);
|
|
3573
|
-
} else {
|
|
3574
|
-
setDragAxis(DEFAULT_DRAG_AXIS);
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
}, [ref.current]);
|
|
3578
|
-
(0, import_react23.useEffect)(calculateDragAxis, [appContext2.status, collisionAxis]);
|
|
3579
|
-
(0, import_react23.useEffect)(() => {
|
|
3580
|
-
const onViewportChange = () => {
|
|
3581
|
-
calculateDragAxis();
|
|
3582
|
-
};
|
|
3583
|
-
window.addEventListener("viewportchange", onViewportChange);
|
|
3584
|
-
return () => {
|
|
3585
|
-
window.removeEventListener("viewportchange", onViewportChange);
|
|
3586
|
-
};
|
|
3587
|
-
}, []);
|
|
3795
|
+
const [dragAxis] = useDragAxis(ref, collisionAxis);
|
|
3588
3796
|
const [minEmptyHeight, isAnimating] = useMinEmptyHeight({
|
|
3589
|
-
draggedItem,
|
|
3590
3797
|
zoneCompound,
|
|
3591
3798
|
userMinEmptyHeight,
|
|
3592
3799
|
ref
|
|
3593
3800
|
});
|
|
3594
|
-
return /* @__PURE__ */ (0,
|
|
3801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3595
3802
|
"div",
|
|
3596
3803
|
{
|
|
3597
3804
|
className: `${getClassName17({
|
|
@@ -3611,88 +3818,83 @@ var DropZoneEdit = (0, import_react23.forwardRef)(
|
|
|
3611
3818
|
"data-puck-dropzone": zoneCompound,
|
|
3612
3819
|
"data-puck-dnd": zoneCompound,
|
|
3613
3820
|
style: __spreadProps(__spreadValues({}, style), {
|
|
3614
|
-
"--min-empty-height": `${minEmptyHeight}px
|
|
3821
|
+
"--min-empty-height": `${minEmptyHeight}px`,
|
|
3822
|
+
backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
|
|
3615
3823
|
}),
|
|
3616
|
-
children:
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3824
|
+
children: contentWithPreview.map((item, i) => {
|
|
3825
|
+
var _a, _b, _c, _d, _e;
|
|
3826
|
+
const componentId = item.props.id;
|
|
3827
|
+
const puckProps = {
|
|
3828
|
+
renderDropZone: DropZone,
|
|
3829
|
+
isEditing: true,
|
|
3830
|
+
dragRef: null
|
|
3831
|
+
};
|
|
3832
|
+
const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
|
|
3833
|
+
puck: puckProps,
|
|
3834
|
+
editMode: true
|
|
3835
|
+
// DEPRECATED
|
|
3836
|
+
});
|
|
3837
|
+
const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
|
|
3838
|
+
let Render2 = config.components[item.type] && item.type !== "preview" ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
3839
|
+
"No configuration for ",
|
|
3840
|
+
item.type
|
|
3841
|
+
] });
|
|
3842
|
+
const componentConfig = config.components[item.type];
|
|
3843
|
+
let componentType = item.type;
|
|
3844
|
+
let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
|
3845
|
+
if (item.type === "preview" && preview) {
|
|
3846
|
+
let Preview4 = function() {
|
|
3847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
|
|
3628
3848
|
};
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
id: componentId,
|
|
3659
|
-
componentType,
|
|
3660
|
-
zoneCompound,
|
|
3661
|
-
depth: depth + 1,
|
|
3662
|
-
index: i,
|
|
3663
|
-
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
|
3664
|
-
isSelected,
|
|
3665
|
-
label,
|
|
3666
|
-
isEnabled,
|
|
3667
|
-
autoDragAxis: dragAxis,
|
|
3668
|
-
userDragAxis: collisionAxis,
|
|
3669
|
-
inDroppableZone: acceptsTarget(draggedItem),
|
|
3670
|
-
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3671
|
-
Render2,
|
|
3672
|
-
__spreadProps(__spreadValues({}, defaultedProps), {
|
|
3673
|
-
puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
|
|
3674
|
-
dragRef
|
|
3675
|
-
})
|
|
3849
|
+
var Preview3 = Preview4;
|
|
3850
|
+
componentType = preview.componentType;
|
|
3851
|
+
label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
|
|
3852
|
+
Render2 = Preview4;
|
|
3853
|
+
}
|
|
3854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3855
|
+
DropZoneProvider,
|
|
3856
|
+
{
|
|
3857
|
+
value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
|
|
3858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3859
|
+
DraggableComponent,
|
|
3860
|
+
{
|
|
3861
|
+
id: componentId,
|
|
3862
|
+
componentType,
|
|
3863
|
+
zoneCompound,
|
|
3864
|
+
depth: depth + 1,
|
|
3865
|
+
index: i,
|
|
3866
|
+
isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
|
|
3867
|
+
isSelected,
|
|
3868
|
+
label,
|
|
3869
|
+
isEnabled,
|
|
3870
|
+
autoDragAxis: dragAxis,
|
|
3871
|
+
userDragAxis: collisionAxis,
|
|
3872
|
+
inDroppableZone: acceptsTarget(draggedComponentType),
|
|
3873
|
+
children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3874
|
+
Render2,
|
|
3875
|
+
__spreadProps(__spreadValues({}, defaultedProps), {
|
|
3876
|
+
puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
|
|
3877
|
+
dragRef
|
|
3676
3878
|
})
|
|
3677
|
-
|
|
3678
|
-
}
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3879
|
+
})
|
|
3880
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
|
3881
|
+
}
|
|
3882
|
+
)
|
|
3883
|
+
},
|
|
3884
|
+
componentId
|
|
3885
|
+
);
|
|
3886
|
+
})
|
|
3685
3887
|
}
|
|
3686
3888
|
);
|
|
3687
3889
|
}
|
|
3688
3890
|
);
|
|
3689
|
-
var DropZoneRender = (0,
|
|
3891
|
+
var DropZoneRender = (0, import_react29.forwardRef)(
|
|
3690
3892
|
function DropZoneRender2({ className, style, zone }, ref) {
|
|
3691
|
-
const ctx = (0,
|
|
3893
|
+
const ctx = (0, import_react29.useContext)(dropZoneContext);
|
|
3692
3894
|
const { data, areaId = "root", config } = ctx || {};
|
|
3693
3895
|
let zoneCompound = rootDroppableId;
|
|
3694
3896
|
let content = (data == null ? void 0 : data.content) || [];
|
|
3695
|
-
(0,
|
|
3897
|
+
(0, import_react29.useEffect)(() => {
|
|
3696
3898
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
3697
3899
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
3698
3900
|
}
|
|
@@ -3709,10 +3911,10 @@ var DropZoneRender = (0, import_react23.forwardRef)(
|
|
|
3709
3911
|
zoneCompound = `${areaId}:${zone}`;
|
|
3710
3912
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
3711
3913
|
}
|
|
3712
|
-
return /* @__PURE__ */ (0,
|
|
3914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
3713
3915
|
const Component = config.components[item.type];
|
|
3714
3916
|
if (Component) {
|
|
3715
|
-
return /* @__PURE__ */ (0,
|
|
3917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3716
3918
|
DropZoneProvider,
|
|
3717
3919
|
{
|
|
3718
3920
|
value: {
|
|
@@ -3722,7 +3924,7 @@ var DropZoneRender = (0, import_react23.forwardRef)(
|
|
|
3722
3924
|
depth: 1,
|
|
3723
3925
|
path: []
|
|
3724
3926
|
},
|
|
3725
|
-
children: /* @__PURE__ */ (0,
|
|
3927
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3726
3928
|
Component.render,
|
|
3727
3929
|
__spreadProps(__spreadValues({}, item.props), {
|
|
3728
3930
|
puck: { renderDropZone: DropZoneRender2 }
|
|
@@ -3736,13 +3938,13 @@ var DropZoneRender = (0, import_react23.forwardRef)(
|
|
|
3736
3938
|
}) });
|
|
3737
3939
|
}
|
|
3738
3940
|
);
|
|
3739
|
-
var DropZone = (0,
|
|
3941
|
+
var DropZone = (0, import_react29.forwardRef)(
|
|
3740
3942
|
function DropZone2(props, ref) {
|
|
3741
|
-
const ctx = (0,
|
|
3943
|
+
const ctx = (0, import_react29.useContext)(dropZoneContext);
|
|
3742
3944
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
3743
|
-
return /* @__PURE__ */ (0,
|
|
3945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
3744
3946
|
}
|
|
3745
|
-
return /* @__PURE__ */ (0,
|
|
3947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
3746
3948
|
}
|
|
3747
3949
|
);
|
|
3748
3950
|
|
|
@@ -3758,7 +3960,7 @@ var getZoneId = (zoneCompound) => {
|
|
|
3758
3960
|
return [rootDroppableId, zoneCompound];
|
|
3759
3961
|
};
|
|
3760
3962
|
|
|
3761
|
-
//
|
|
3963
|
+
// lib/dnd/NestedDroppablePlugin.ts
|
|
3762
3964
|
init_react_import();
|
|
3763
3965
|
var import_abstract9 = require("@dnd-kit/abstract");
|
|
3764
3966
|
var import_state = require("@dnd-kit/state");
|
|
@@ -3800,7 +4002,7 @@ var getFrame = () => {
|
|
|
3800
4002
|
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
3801
4003
|
};
|
|
3802
4004
|
|
|
3803
|
-
//
|
|
4005
|
+
// lib/dnd/NestedDroppablePlugin.ts
|
|
3804
4006
|
var depthSort = (candidates) => {
|
|
3805
4007
|
return candidates.sort((a, b) => {
|
|
3806
4008
|
const aData = a.data;
|
|
@@ -3915,9 +4117,7 @@ var findDeepestCandidate = (position, manager, ownerDocument) => {
|
|
|
3915
4117
|
area: null
|
|
3916
4118
|
};
|
|
3917
4119
|
};
|
|
3918
|
-
var createNestedDroppablePlugin = ({
|
|
3919
|
-
onChange
|
|
3920
|
-
}) => class NestedDroppablePlugin extends import_abstract9.Plugin {
|
|
4120
|
+
var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract9.Plugin {
|
|
3921
4121
|
constructor(manager, options) {
|
|
3922
4122
|
super(manager);
|
|
3923
4123
|
if (typeof window === "undefined") {
|
|
@@ -3931,10 +4131,17 @@ var createNestedDroppablePlugin = ({
|
|
|
3931
4131
|
};
|
|
3932
4132
|
const target = event.originalTarget || event.target;
|
|
3933
4133
|
const ownerDocument = target == null ? void 0 : target.ownerDocument;
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
4134
|
+
const elements = document.elementsFromPoint(
|
|
4135
|
+
event.clientX,
|
|
4136
|
+
event.clientY
|
|
3937
4137
|
);
|
|
4138
|
+
const overEl = elements.some((el) => el.id === id);
|
|
4139
|
+
if (overEl) {
|
|
4140
|
+
onChange(
|
|
4141
|
+
findDeepestCandidate(position, manager, ownerDocument),
|
|
4142
|
+
manager
|
|
4143
|
+
);
|
|
4144
|
+
}
|
|
3938
4145
|
};
|
|
3939
4146
|
const handleMoveThrottled = throttle(handleMove, 50);
|
|
3940
4147
|
const handlePointerMove = (event) => {
|
|
@@ -4351,7 +4558,7 @@ var insertComponent = (componentType, zone, index, {
|
|
|
4351
4558
|
var import_use_debounce2 = require("use-debounce");
|
|
4352
4559
|
var import_utilities2 = require("@dnd-kit/dom/utilities");
|
|
4353
4560
|
|
|
4354
|
-
//
|
|
4561
|
+
// lib/dnd/PointerSensor.ts
|
|
4355
4562
|
init_react_import();
|
|
4356
4563
|
var import_state3 = require("@dnd-kit/state");
|
|
4357
4564
|
var import_abstract10 = require("@dnd-kit/abstract");
|
|
@@ -4613,13 +4820,15 @@ function patchWindow(window2) {
|
|
|
4613
4820
|
}
|
|
4614
4821
|
|
|
4615
4822
|
// components/DragDropContext/index.tsx
|
|
4616
|
-
var
|
|
4617
|
-
var
|
|
4823
|
+
var import_zustand3 = require("zustand");
|
|
4824
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4825
|
+
var DEBUG3 = false;
|
|
4826
|
+
var dragListenerContext = (0, import_react31.createContext)({
|
|
4618
4827
|
dragListeners: {}
|
|
4619
4828
|
});
|
|
4620
4829
|
function useDragListener(type, fn, deps = []) {
|
|
4621
|
-
const { setDragListeners } = (0,
|
|
4622
|
-
(0,
|
|
4830
|
+
const { setDragListeners } = (0, import_react31.useContext)(dragListenerContext);
|
|
4831
|
+
(0, import_react31.useEffect)(() => {
|
|
4623
4832
|
if (setDragListeners) {
|
|
4624
4833
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
4625
4834
|
[type]: [...old[type] || [], fn]
|
|
@@ -4627,80 +4836,147 @@ function useDragListener(type, fn, deps = []) {
|
|
|
4627
4836
|
}
|
|
4628
4837
|
}, deps);
|
|
4629
4838
|
}
|
|
4630
|
-
var previewContext = (0, import_react25.createContext)(null);
|
|
4631
4839
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
4840
|
+
var useTempDisableFallback = (timeout3) => {
|
|
4841
|
+
const lastFallbackDisable = (0, import_react31.useRef)(null);
|
|
4842
|
+
return (0, import_react31.useCallback)((manager) => {
|
|
4843
|
+
collisionStore.setState({ fallbackEnabled: false });
|
|
4844
|
+
const fallbackId = generateId();
|
|
4845
|
+
lastFallbackDisable.current = fallbackId;
|
|
4846
|
+
setTimeout(() => {
|
|
4847
|
+
if (lastFallbackDisable.current === fallbackId) {
|
|
4848
|
+
collisionStore.setState({ fallbackEnabled: true });
|
|
4849
|
+
manager.collisionObserver.forceUpdate(true);
|
|
4850
|
+
}
|
|
4851
|
+
}, timeout3);
|
|
4852
|
+
}, []);
|
|
4853
|
+
};
|
|
4632
4854
|
var DragDropContextClient = ({
|
|
4633
4855
|
children,
|
|
4634
4856
|
disableAutoScroll
|
|
4635
4857
|
}) => {
|
|
4636
4858
|
const { state, config, dispatch, resolveData } = useAppContext();
|
|
4637
|
-
const
|
|
4638
|
-
const previewRef = (0, import_react25.useRef)(null);
|
|
4859
|
+
const id = (0, import_react31.useId)();
|
|
4639
4860
|
const { data } = state;
|
|
4640
|
-
const
|
|
4641
|
-
const
|
|
4642
|
-
const
|
|
4643
|
-
|
|
4644
|
-
|
|
4861
|
+
const debouncedParamsRef = (0, import_react31.useRef)(null);
|
|
4862
|
+
const tempDisableFallback = useTempDisableFallback(100);
|
|
4863
|
+
const [zoneStore] = (0, import_react31.useState)(
|
|
4864
|
+
() => (0, import_zustand3.createStore)(() => ({
|
|
4865
|
+
zoneDepthIndex: {},
|
|
4866
|
+
nextZoneDepthIndex: {},
|
|
4867
|
+
areaDepthIndex: {},
|
|
4868
|
+
nextAreaDepthIndex: {},
|
|
4869
|
+
draggedItem: null,
|
|
4870
|
+
previewIndex: {}
|
|
4871
|
+
}))
|
|
4872
|
+
);
|
|
4873
|
+
const getChanged2 = (0, import_react31.useCallback)(
|
|
4874
|
+
(params, id2) => {
|
|
4875
|
+
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
4876
|
+
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
4877
|
+
const stateHasArea = Object.keys(areaDepthIndex).length > 0;
|
|
4878
|
+
let zoneChanged = false;
|
|
4879
|
+
let areaChanged = false;
|
|
4880
|
+
if (params.zone && !zoneDepthIndex[params.zone]) {
|
|
4881
|
+
zoneChanged = true;
|
|
4882
|
+
} else if (!params.zone && stateHasZone) {
|
|
4883
|
+
zoneChanged = true;
|
|
4884
|
+
}
|
|
4885
|
+
if (params.area && !areaDepthIndex[params.area]) {
|
|
4886
|
+
areaChanged = true;
|
|
4887
|
+
} else if (!params.area && stateHasArea) {
|
|
4888
|
+
areaChanged = true;
|
|
4889
|
+
}
|
|
4890
|
+
return { zoneChanged, areaChanged };
|
|
4891
|
+
},
|
|
4892
|
+
[zoneStore]
|
|
4893
|
+
);
|
|
4894
|
+
const setDeepestAndCollide = (0, import_react31.useCallback)(
|
|
4645
4895
|
(params, manager) => {
|
|
4646
|
-
|
|
4896
|
+
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
|
4897
|
+
if (!zoneChanged && !areaChanged) return;
|
|
4898
|
+
zoneStore.setState({
|
|
4899
|
+
zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
|
|
4900
|
+
areaDepthIndex: params.area ? { [params.area]: true } : {}
|
|
4901
|
+
});
|
|
4902
|
+
tempDisableFallback(manager);
|
|
4647
4903
|
setTimeout(() => {
|
|
4648
4904
|
manager.collisionObserver.forceUpdate(true);
|
|
4649
4905
|
}, 50);
|
|
4650
4906
|
debouncedParamsRef.current = null;
|
|
4651
4907
|
},
|
|
4652
|
-
[]
|
|
4908
|
+
[zoneStore]
|
|
4653
4909
|
);
|
|
4654
4910
|
const setDeepestDb = (0, import_use_debounce2.useDebouncedCallback)(
|
|
4655
4911
|
setDeepestAndCollide,
|
|
4656
4912
|
AREA_CHANGE_DEBOUNCE_MS
|
|
4657
4913
|
);
|
|
4658
|
-
(0, import_react25.useEffect)(() => {
|
|
4659
|
-
deepestRef.current = deepest;
|
|
4660
|
-
}, [deepest]);
|
|
4661
4914
|
const cancelDb = () => {
|
|
4662
4915
|
setDeepestDb.cancel();
|
|
4663
4916
|
debouncedParamsRef.current = null;
|
|
4664
4917
|
};
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
}
|
|
4676
|
-
if (params.zone !== "void" && (lastParams == null ? void 0 : lastParams.zone) === "void") {
|
|
4677
|
-
setDeepest(params);
|
|
4678
|
-
manager.collisionObserver.forceUpdate(true);
|
|
4679
|
-
return;
|
|
4918
|
+
(0, import_react31.useEffect)(() => {
|
|
4919
|
+
if (DEBUG3) {
|
|
4920
|
+
zoneStore.subscribe(
|
|
4921
|
+
(s) => {
|
|
4922
|
+
var _a, _b;
|
|
4923
|
+
return console.log(
|
|
4924
|
+
s.previewIndex,
|
|
4925
|
+
(_a = Object.entries(s.zoneDepthIndex || {})[0]) == null ? void 0 : _a[0],
|
|
4926
|
+
(_b = Object.entries(s.areaDepthIndex || {})[0]) == null ? void 0 : _b[0]
|
|
4927
|
+
);
|
|
4680
4928
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4929
|
+
);
|
|
4930
|
+
}
|
|
4931
|
+
}, []);
|
|
4932
|
+
const [plugins] = (0, import_react31.useState)(() => [
|
|
4933
|
+
...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
|
|
4934
|
+
createNestedDroppablePlugin(
|
|
4935
|
+
{
|
|
4936
|
+
onChange: (params, manager) => {
|
|
4937
|
+
const state2 = zoneStore.getState();
|
|
4938
|
+
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
|
4939
|
+
const isDragging = manager.dragOperation.status.dragging;
|
|
4940
|
+
if (areaChanged || zoneChanged) {
|
|
4941
|
+
let nextZoneDepthIndex = {};
|
|
4942
|
+
let nextAreaDepthIndex = {};
|
|
4943
|
+
if (params.zone) {
|
|
4944
|
+
nextZoneDepthIndex = { [params.zone]: true };
|
|
4945
|
+
}
|
|
4946
|
+
if (params.area) {
|
|
4947
|
+
nextAreaDepthIndex = { [params.area]: true };
|
|
4948
|
+
}
|
|
4949
|
+
zoneStore.setState({ nextZoneDepthIndex, nextAreaDepthIndex });
|
|
4950
|
+
}
|
|
4951
|
+
if (params.zone !== "void" && (state2 == null ? void 0 : state2.zoneDepthIndex["void"])) {
|
|
4952
|
+
setDeepestAndCollide(params, manager);
|
|
4953
|
+
return;
|
|
4954
|
+
}
|
|
4955
|
+
if (areaChanged) {
|
|
4956
|
+
if (isDragging) {
|
|
4957
|
+
const debouncedParams = debouncedParamsRef.current;
|
|
4958
|
+
const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
|
|
4959
|
+
if (!isSameParams) {
|
|
4960
|
+
cancelDb();
|
|
4961
|
+
setDeepestDb(params, manager);
|
|
4962
|
+
debouncedParamsRef.current = params;
|
|
4963
|
+
}
|
|
4964
|
+
} else {
|
|
4686
4965
|
cancelDb();
|
|
4687
|
-
|
|
4688
|
-
debouncedParamsRef.current = params;
|
|
4966
|
+
setDeepestAndCollide(params, manager);
|
|
4689
4967
|
}
|
|
4690
|
-
|
|
4691
|
-
|
|
4968
|
+
return;
|
|
4969
|
+
}
|
|
4970
|
+
if (zoneChanged) {
|
|
4692
4971
|
setDeepestAndCollide(params, manager);
|
|
4693
4972
|
}
|
|
4694
|
-
|
|
4973
|
+
cancelDb();
|
|
4695
4974
|
}
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
cancelDb();
|
|
4700
|
-
}
|
|
4701
|
-
})
|
|
4975
|
+
},
|
|
4976
|
+
id
|
|
4977
|
+
)
|
|
4702
4978
|
]);
|
|
4703
|
-
const [sensors] = (0,
|
|
4979
|
+
const [sensors] = (0, import_react31.useState)(() => [
|
|
4704
4980
|
PointerSensor.configure({
|
|
4705
4981
|
activationConstraints(event, source) {
|
|
4706
4982
|
var _a;
|
|
@@ -4719,11 +4995,10 @@ var DragDropContextClient = ({
|
|
|
4719
4995
|
}
|
|
4720
4996
|
})
|
|
4721
4997
|
]);
|
|
4722
|
-
const [
|
|
4723
|
-
const [
|
|
4724
|
-
const
|
|
4725
|
-
const
|
|
4726
|
-
const registerPath = (0, import_react25.useCallback)(
|
|
4998
|
+
const [dragListeners, setDragListeners] = (0, import_react31.useState)({});
|
|
4999
|
+
const [pathData, setPathData] = (0, import_react31.useState)();
|
|
5000
|
+
const dragMode = (0, import_react31.useRef)(null);
|
|
5001
|
+
const registerPath = (0, import_react31.useCallback)(
|
|
4727
5002
|
(selector) => {
|
|
4728
5003
|
const item = getItem(selector, data);
|
|
4729
5004
|
if (!item) {
|
|
@@ -4745,41 +5020,41 @@ var DragDropContextClient = ({
|
|
|
4745
5020
|
},
|
|
4746
5021
|
[data, setPathData]
|
|
4747
5022
|
);
|
|
4748
|
-
const initialSelector = (0,
|
|
4749
|
-
return /* @__PURE__ */ (0,
|
|
5023
|
+
const initialSelector = (0, import_react31.useRef)(void 0);
|
|
5024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4750
5025
|
dragListenerContext.Provider,
|
|
4751
5026
|
{
|
|
4752
5027
|
value: {
|
|
4753
5028
|
dragListeners,
|
|
4754
5029
|
setDragListeners
|
|
4755
5030
|
},
|
|
4756
|
-
children: /* @__PURE__ */ (0,
|
|
4757
|
-
|
|
5031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5032
|
+
import_react30.DragDropProvider,
|
|
4758
5033
|
{
|
|
4759
5034
|
plugins,
|
|
4760
5035
|
sensors,
|
|
4761
5036
|
onDragEnd: (event, manager) => {
|
|
5037
|
+
var _a;
|
|
4762
5038
|
const { source, target } = event.operation;
|
|
4763
|
-
deepestRef.current = null;
|
|
4764
5039
|
if (!source) {
|
|
4765
|
-
|
|
5040
|
+
zoneStore.setState({ draggedItem: null });
|
|
4766
5041
|
return;
|
|
4767
5042
|
}
|
|
4768
5043
|
const { zone, index } = source.data;
|
|
4769
|
-
const
|
|
4770
|
-
|
|
5044
|
+
const { previewIndex = {} } = zoneStore.getState() || {};
|
|
5045
|
+
const thisPreview = ((_a = previewIndex[zone]) == null ? void 0 : _a.props.id) === source.id ? previewIndex[zone] : null;
|
|
4771
5046
|
setTimeout(() => {
|
|
4772
|
-
var
|
|
4773
|
-
|
|
5047
|
+
var _a2, _b;
|
|
5048
|
+
zoneStore.setState({ draggedItem: null });
|
|
4774
5049
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
|
4775
|
-
|
|
4776
|
-
(
|
|
5050
|
+
zoneStore.setState({ previewIndex: {} });
|
|
5051
|
+
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
|
4777
5052
|
fn(event, manager);
|
|
4778
5053
|
});
|
|
4779
5054
|
return;
|
|
4780
5055
|
}
|
|
4781
5056
|
if (thisPreview) {
|
|
4782
|
-
|
|
5057
|
+
zoneStore.setState({ previewIndex: {} });
|
|
4783
5058
|
if (thisPreview.type === "insert") {
|
|
4784
5059
|
insertComponent(
|
|
4785
5060
|
thisPreview.componentType,
|
|
@@ -4814,8 +5089,9 @@ var DragDropContextClient = ({
|
|
|
4814
5089
|
}, 250);
|
|
4815
5090
|
},
|
|
4816
5091
|
onDragOver: (event, manager) => {
|
|
4817
|
-
var _a, _b, _c, _d;
|
|
5092
|
+
var _a, _b, _c, _d, _e;
|
|
4818
5093
|
event.preventDefault();
|
|
5094
|
+
const draggedItem = (_a = zoneStore.getState()) == null ? void 0 : _a.draggedItem;
|
|
4819
5095
|
if (!draggedItem) return;
|
|
4820
5096
|
cancelDb();
|
|
4821
5097
|
const { source, target } = event.operation;
|
|
@@ -4831,7 +5107,7 @@ var DragDropContextClient = ({
|
|
|
4831
5107
|
const targetData = target.data;
|
|
4832
5108
|
targetZone = targetData.zone;
|
|
4833
5109
|
targetIndex = targetData.index;
|
|
4834
|
-
const collisionData = (
|
|
5110
|
+
const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
|
|
4835
5111
|
const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
|
|
4836
5112
|
if (targetIndex >= sourceIndex && sourceZone === targetZone) {
|
|
4837
5113
|
targetIndex = targetIndex - 1;
|
|
@@ -4843,23 +5119,26 @@ var DragDropContextClient = ({
|
|
|
4843
5119
|
targetZone = target.id.toString();
|
|
4844
5120
|
targetIndex = 0;
|
|
4845
5121
|
}
|
|
4846
|
-
if (targetId === sourceId || ((
|
|
5122
|
+
if (targetId === sourceId || ((_d = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _d.path.find((path) => {
|
|
4847
5123
|
const [pathId] = path.split(":");
|
|
4848
5124
|
return pathId === sourceId;
|
|
4849
5125
|
}))) {
|
|
4850
5126
|
return;
|
|
4851
5127
|
}
|
|
4852
5128
|
if (dragMode.current === "new") {
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
5129
|
+
zoneStore.setState({
|
|
5130
|
+
previewIndex: {
|
|
5131
|
+
[targetZone]: {
|
|
5132
|
+
componentType: sourceData.componentType,
|
|
5133
|
+
type: "insert",
|
|
5134
|
+
index: targetIndex,
|
|
5135
|
+
zone: targetZone,
|
|
5136
|
+
props: {
|
|
5137
|
+
id: source.id.toString()
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
4860
5140
|
}
|
|
4861
|
-
};
|
|
4862
|
-
setPreview(previewRef.current);
|
|
5141
|
+
});
|
|
4863
5142
|
} else {
|
|
4864
5143
|
if (!initialSelector.current) {
|
|
4865
5144
|
initialSelector.current = {
|
|
@@ -4869,17 +5148,20 @@ var DragDropContextClient = ({
|
|
|
4869
5148
|
}
|
|
4870
5149
|
const item = getItem(initialSelector.current, data);
|
|
4871
5150
|
if (item) {
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
5151
|
+
zoneStore.setState({
|
|
5152
|
+
previewIndex: {
|
|
5153
|
+
[targetZone]: {
|
|
5154
|
+
componentType: sourceData.componentType,
|
|
5155
|
+
type: "move",
|
|
5156
|
+
index: targetIndex,
|
|
5157
|
+
zone: targetZone,
|
|
5158
|
+
props: item.props
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
});
|
|
4880
5162
|
}
|
|
4881
5163
|
}
|
|
4882
|
-
(
|
|
5164
|
+
(_e = dragListeners.dragover) == null ? void 0 : _e.forEach((fn) => {
|
|
4883
5165
|
fn(event, manager);
|
|
4884
5166
|
});
|
|
4885
5167
|
},
|
|
@@ -4889,45 +5171,61 @@ var DragDropContextClient = ({
|
|
|
4889
5171
|
type: "setUi",
|
|
4890
5172
|
ui: { itemSelector: null, isDragging: true }
|
|
4891
5173
|
});
|
|
5174
|
+
const { source } = event.operation;
|
|
5175
|
+
if (source && source.type !== "void") {
|
|
5176
|
+
const sourceData = source.data;
|
|
5177
|
+
const item = getItem(
|
|
5178
|
+
{
|
|
5179
|
+
zone: sourceData.zone,
|
|
5180
|
+
index: sourceData.index
|
|
5181
|
+
},
|
|
5182
|
+
data
|
|
5183
|
+
);
|
|
5184
|
+
if (item) {
|
|
5185
|
+
zoneStore.setState({
|
|
5186
|
+
previewIndex: {
|
|
5187
|
+
[sourceData.zone]: {
|
|
5188
|
+
componentType: sourceData.componentType,
|
|
5189
|
+
type: "move",
|
|
5190
|
+
index: sourceData.index,
|
|
5191
|
+
zone: sourceData.zone,
|
|
5192
|
+
props: item.props
|
|
5193
|
+
}
|
|
5194
|
+
}
|
|
5195
|
+
});
|
|
5196
|
+
}
|
|
5197
|
+
}
|
|
4892
5198
|
(_a = dragListeners.dragstart) == null ? void 0 : _a.forEach((fn) => {
|
|
4893
5199
|
fn(event, manager);
|
|
4894
5200
|
});
|
|
4895
5201
|
},
|
|
4896
5202
|
onBeforeDragStart: (event) => {
|
|
4897
5203
|
var _a;
|
|
4898
|
-
if (draggedItem) {
|
|
4899
|
-
console.warn("New drag started before previous drag cleaned up");
|
|
4900
|
-
}
|
|
4901
5204
|
const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.data.type) === "drawer";
|
|
4902
5205
|
dragMode.current = isNewComponent ? "new" : "existing";
|
|
4903
5206
|
initialSelector.current = void 0;
|
|
4904
|
-
|
|
5207
|
+
zoneStore.setState({ draggedItem: event.operation.source });
|
|
4905
5208
|
},
|
|
4906
|
-
children: /* @__PURE__ */ (0,
|
|
5209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4907
5210
|
DropZoneProvider,
|
|
4908
5211
|
{
|
|
4909
5212
|
value: {
|
|
4910
5213
|
data,
|
|
4911
5214
|
config,
|
|
4912
|
-
draggedItem,
|
|
4913
5215
|
mode: "edit",
|
|
4914
5216
|
areaId: "root",
|
|
4915
5217
|
depth: 0,
|
|
4916
5218
|
registerPath,
|
|
4917
5219
|
pathData,
|
|
4918
|
-
deepestZone: deepest == null ? void 0 : deepest.zone,
|
|
4919
|
-
deepestArea: deepest == null ? void 0 : deepest.area,
|
|
4920
|
-
nextDeepestZone: nextDeepest == null ? void 0 : nextDeepest.zone,
|
|
4921
|
-
nextDeepestArea: nextDeepest == null ? void 0 : nextDeepest.area,
|
|
4922
5220
|
path: []
|
|
4923
5221
|
},
|
|
4924
5222
|
children
|
|
4925
5223
|
}
|
|
4926
|
-
)
|
|
5224
|
+
) })
|
|
4927
5225
|
}
|
|
4928
|
-
)
|
|
5226
|
+
)
|
|
4929
5227
|
}
|
|
4930
|
-
);
|
|
5228
|
+
) });
|
|
4931
5229
|
};
|
|
4932
5230
|
var DragDropContext = ({
|
|
4933
5231
|
children,
|
|
@@ -4937,11 +5235,11 @@ var DragDropContext = ({
|
|
|
4937
5235
|
if (status === "LOADING") {
|
|
4938
5236
|
return children;
|
|
4939
5237
|
}
|
|
4940
|
-
return /* @__PURE__ */ (0,
|
|
5238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
|
4941
5239
|
};
|
|
4942
5240
|
|
|
4943
5241
|
// components/Drawer/index.tsx
|
|
4944
|
-
var
|
|
5242
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4945
5243
|
var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
|
|
4946
5244
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
|
4947
5245
|
var DrawerItemInner = ({
|
|
@@ -4951,11 +5249,11 @@ var DrawerItemInner = ({
|
|
|
4951
5249
|
dragRef,
|
|
4952
5250
|
isDragDisabled
|
|
4953
5251
|
}) => {
|
|
4954
|
-
const CustomInner = (0,
|
|
4955
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
|
5252
|
+
const CustomInner = (0, import_react32.useMemo)(
|
|
5253
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
4956
5254
|
[children]
|
|
4957
5255
|
);
|
|
4958
|
-
return /* @__PURE__ */ (0,
|
|
5256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4959
5257
|
"div",
|
|
4960
5258
|
{
|
|
4961
5259
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -4963,9 +5261,9 @@ var DrawerItemInner = ({
|
|
|
4963
5261
|
onMouseDown: (e) => e.preventDefault(),
|
|
4964
5262
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
4965
5263
|
"data-puck-drawer-item": true,
|
|
4966
|
-
children: /* @__PURE__ */ (0,
|
|
4967
|
-
/* @__PURE__ */ (0,
|
|
4968
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
|
5266
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragIcon, {}) })
|
|
4969
5267
|
] }) }) })
|
|
4970
5268
|
}
|
|
4971
5269
|
);
|
|
@@ -4982,9 +5280,9 @@ var DrawerItemDraggable = ({
|
|
|
4982
5280
|
data: { type: "drawer", componentType: name },
|
|
4983
5281
|
disabled: isDragDisabled
|
|
4984
5282
|
});
|
|
4985
|
-
return /* @__PURE__ */ (0,
|
|
4986
|
-
/* @__PURE__ */ (0,
|
|
4987
|
-
/* @__PURE__ */ (0,
|
|
5283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("draggable"), children: [
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DrawerItemInner, { name, label, children }) }),
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4988
5286
|
DrawerItemInner,
|
|
4989
5287
|
{
|
|
4990
5288
|
name,
|
|
@@ -5005,7 +5303,7 @@ var DrawerItem = ({
|
|
|
5005
5303
|
isDragDisabled
|
|
5006
5304
|
}) => {
|
|
5007
5305
|
const resolvedId = id || name;
|
|
5008
|
-
const [dynamicId, setDynamicId] = (0,
|
|
5306
|
+
const [dynamicId, setDynamicId] = (0, import_react32.useState)(generateId(resolvedId));
|
|
5009
5307
|
if (typeof index !== "undefined") {
|
|
5010
5308
|
console.error(
|
|
5011
5309
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -5018,7 +5316,7 @@ var DrawerItem = ({
|
|
|
5018
5316
|
},
|
|
5019
5317
|
[resolvedId]
|
|
5020
5318
|
);
|
|
5021
|
-
return /* @__PURE__ */ (0,
|
|
5319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5022
5320
|
DrawerItemDraggable,
|
|
5023
5321
|
{
|
|
5024
5322
|
name,
|
|
@@ -5044,14 +5342,14 @@ var Drawer = ({
|
|
|
5044
5342
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
|
5045
5343
|
);
|
|
5046
5344
|
}
|
|
5047
|
-
const [id] = (0,
|
|
5345
|
+
const [id] = (0, import_react32.useState)(generateId());
|
|
5048
5346
|
const { ref } = useDroppableSafe({
|
|
5049
5347
|
id,
|
|
5050
5348
|
type: "void",
|
|
5051
5349
|
collisionPriority: 0
|
|
5052
5350
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
5053
5351
|
});
|
|
5054
|
-
return /* @__PURE__ */ (0,
|
|
5352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5055
5353
|
"div",
|
|
5056
5354
|
{
|
|
5057
5355
|
className: getClassName18(),
|
|
@@ -5066,7 +5364,7 @@ Drawer.Item = DrawerItem;
|
|
|
5066
5364
|
|
|
5067
5365
|
// components/Puck/index.tsx
|
|
5068
5366
|
init_react_import();
|
|
5069
|
-
var
|
|
5367
|
+
var import_react48 = require("react");
|
|
5070
5368
|
|
|
5071
5369
|
// components/SidebarSection/index.tsx
|
|
5072
5370
|
init_react_import();
|
|
@@ -5077,7 +5375,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
|
|
|
5077
5375
|
|
|
5078
5376
|
// lib/use-breadcrumbs.ts
|
|
5079
5377
|
init_react_import();
|
|
5080
|
-
var
|
|
5378
|
+
var import_react33 = require("react");
|
|
5081
5379
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
|
5082
5380
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
|
5083
5381
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
|
@@ -5127,8 +5425,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
5127
5425
|
state: { data },
|
|
5128
5426
|
selectedItem
|
|
5129
5427
|
} = useAppContext();
|
|
5130
|
-
const dzContext = (0,
|
|
5131
|
-
return (0,
|
|
5428
|
+
const dzContext = (0, import_react33.useContext)(dropZoneContext);
|
|
5429
|
+
return (0, import_react33.useMemo)(() => {
|
|
5132
5430
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
|
5133
5431
|
selectedItem,
|
|
5134
5432
|
dzContext == null ? void 0 : dzContext.pathData,
|
|
@@ -5142,7 +5440,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
5142
5440
|
};
|
|
5143
5441
|
|
|
5144
5442
|
// components/SidebarSection/index.tsx
|
|
5145
|
-
var
|
|
5443
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5146
5444
|
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
|
5147
5445
|
var SidebarSection = ({
|
|
5148
5446
|
children,
|
|
@@ -5155,15 +5453,15 @@ var SidebarSection = ({
|
|
|
5155
5453
|
}) => {
|
|
5156
5454
|
const { setUi } = useAppContext();
|
|
5157
5455
|
const breadcrumbs = useBreadcrumbs(1);
|
|
5158
|
-
return /* @__PURE__ */ (0,
|
|
5456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5159
5457
|
"div",
|
|
5160
5458
|
{
|
|
5161
5459
|
className: getClassName19({ noBorderTop, noPadding }),
|
|
5162
5460
|
style: { background },
|
|
5163
5461
|
children: [
|
|
5164
|
-
/* @__PURE__ */ (0,
|
|
5165
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
|
5166
|
-
/* @__PURE__ */ (0,
|
|
5462
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
|
5463
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
|
5464
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5167
5465
|
"button",
|
|
5168
5466
|
{
|
|
5169
5467
|
type: "button",
|
|
@@ -5172,12 +5470,12 @@ var SidebarSection = ({
|
|
|
5172
5470
|
children: breadcrumb.label
|
|
5173
5471
|
}
|
|
5174
5472
|
),
|
|
5175
|
-
/* @__PURE__ */ (0,
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronRight, { size: 16 })
|
|
5176
5474
|
] }, i)) : null,
|
|
5177
|
-
/* @__PURE__ */ (0,
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
5178
5476
|
] }) }),
|
|
5179
|
-
/* @__PURE__ */ (0,
|
|
5180
|
-
isLoading && /* @__PURE__ */ (0,
|
|
5477
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("content"), children }),
|
|
5478
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Loader, { size: 32 }) })
|
|
5181
5479
|
]
|
|
5182
5480
|
}
|
|
5183
5481
|
);
|
|
@@ -5208,7 +5506,7 @@ init_react_import();
|
|
|
5208
5506
|
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" };
|
|
5209
5507
|
|
|
5210
5508
|
// components/MenuBar/index.tsx
|
|
5211
|
-
var
|
|
5509
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5212
5510
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
|
5213
5511
|
function MenuBar({
|
|
5214
5512
|
appState,
|
|
@@ -5222,7 +5520,7 @@ function MenuBar({
|
|
|
5222
5520
|
history: { back, forward, historyStore }
|
|
5223
5521
|
} = useAppContext();
|
|
5224
5522
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
|
5225
|
-
return /* @__PURE__ */ (0,
|
|
5523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5226
5524
|
"div",
|
|
5227
5525
|
{
|
|
5228
5526
|
className: getClassName20({ menuOpen }),
|
|
@@ -5236,12 +5534,12 @@ function MenuBar({
|
|
|
5236
5534
|
setMenuOpen(false);
|
|
5237
5535
|
}
|
|
5238
5536
|
},
|
|
5239
|
-
children: /* @__PURE__ */ (0,
|
|
5240
|
-
/* @__PURE__ */ (0,
|
|
5241
|
-
/* @__PURE__ */ (0,
|
|
5242
|
-
/* @__PURE__ */ (0,
|
|
5537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("inner"), children: [
|
|
5538
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("history"), children: [
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Undo2, { size: 21 }) }),
|
|
5540
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Redo2, { size: 21 }) })
|
|
5243
5541
|
] }),
|
|
5244
|
-
/* @__PURE__ */ (0,
|
|
5542
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
|
5245
5543
|
state: appState,
|
|
5246
5544
|
dispatch
|
|
5247
5545
|
}) })
|
|
@@ -5252,7 +5550,7 @@ function MenuBar({
|
|
|
5252
5550
|
|
|
5253
5551
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
|
5254
5552
|
init_react_import();
|
|
5255
|
-
var styles_module_default15 = { "Puck": "
|
|
5553
|
+
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" };
|
|
5256
5554
|
|
|
5257
5555
|
// components/Puck/components/Fields/index.tsx
|
|
5258
5556
|
init_react_import();
|
|
@@ -5262,15 +5560,15 @@ init_react_import();
|
|
|
5262
5560
|
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" };
|
|
5263
5561
|
|
|
5264
5562
|
// components/Puck/components/Fields/index.tsx
|
|
5265
|
-
var
|
|
5563
|
+
var import_react35 = require("react");
|
|
5266
5564
|
|
|
5267
5565
|
// lib/use-parent.ts
|
|
5268
5566
|
init_react_import();
|
|
5269
|
-
var
|
|
5567
|
+
var import_react34 = require("react");
|
|
5270
5568
|
var useParent = (itemSelector) => {
|
|
5271
5569
|
var _a;
|
|
5272
5570
|
const { selectedItem, state } = useAppContext();
|
|
5273
|
-
const { pathData } = (0,
|
|
5571
|
+
const { pathData } = (0, import_react34.useContext)(dropZoneContext) || {};
|
|
5274
5572
|
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
|
5275
5573
|
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
|
5276
5574
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -5279,7 +5577,7 @@ var useParent = (itemSelector) => {
|
|
|
5279
5577
|
};
|
|
5280
5578
|
|
|
5281
5579
|
// components/Puck/components/Fields/index.tsx
|
|
5282
|
-
var
|
|
5580
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5283
5581
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
|
5284
5582
|
var defaultPageFields = {
|
|
5285
5583
|
title: { type: "text" }
|
|
@@ -5287,7 +5585,7 @@ var defaultPageFields = {
|
|
|
5287
5585
|
var DefaultFields = ({
|
|
5288
5586
|
children
|
|
5289
5587
|
}) => {
|
|
5290
|
-
return /* @__PURE__ */ (0,
|
|
5588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
|
|
5291
5589
|
};
|
|
5292
5590
|
var useResolvedFields = () => {
|
|
5293
5591
|
var _a, _b;
|
|
@@ -5296,20 +5594,20 @@ var useResolvedFields = () => {
|
|
|
5296
5594
|
const { data } = state;
|
|
5297
5595
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
|
5298
5596
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
|
5299
|
-
const defaultFields = (0,
|
|
5597
|
+
const defaultFields = (0, import_react35.useMemo)(
|
|
5300
5598
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
|
5301
5599
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
|
5302
5600
|
);
|
|
5303
5601
|
const rootProps = data.root.props || data.root;
|
|
5304
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
|
5305
|
-
const [resolvedFields, setResolvedFields] = (0,
|
|
5306
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
|
5602
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react35.useState)({});
|
|
5603
|
+
const [resolvedFields, setResolvedFields] = (0, import_react35.useState)(defaultFields);
|
|
5604
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react35.useState)(false);
|
|
5307
5605
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
|
5308
5606
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
|
5309
5607
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
|
5310
5608
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
|
5311
5609
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
|
5312
|
-
const resolveFields = (0,
|
|
5610
|
+
const resolveFields = (0, import_react35.useCallback)(
|
|
5313
5611
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
|
5314
5612
|
var _a2;
|
|
5315
5613
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
|
@@ -5347,7 +5645,7 @@ var useResolvedFields = () => {
|
|
|
5347
5645
|
}),
|
|
5348
5646
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
|
5349
5647
|
);
|
|
5350
|
-
(0,
|
|
5648
|
+
(0, import_react35.useEffect)(() => {
|
|
5351
5649
|
if (hasResolver) {
|
|
5352
5650
|
setFieldsLoading(true);
|
|
5353
5651
|
resolveFields(defaultFields).then((fields) => {
|
|
@@ -5378,8 +5676,8 @@ var Fields = () => {
|
|
|
5378
5676
|
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;
|
|
5379
5677
|
const isLoading = fieldsResolving || componentResolving;
|
|
5380
5678
|
const rootProps = data.root.props || data.root;
|
|
5381
|
-
const Wrapper = (0,
|
|
5382
|
-
return /* @__PURE__ */ (0,
|
|
5679
|
+
const Wrapper = (0, import_react35.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
5680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5383
5681
|
"form",
|
|
5384
5682
|
{
|
|
5385
5683
|
className: getClassName21(),
|
|
@@ -5387,7 +5685,7 @@ var Fields = () => {
|
|
|
5387
5685
|
e.preventDefault();
|
|
5388
5686
|
},
|
|
5389
5687
|
children: [
|
|
5390
|
-
/* @__PURE__ */ (0,
|
|
5688
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
|
5391
5689
|
const field = fields[fieldName];
|
|
5392
5690
|
if (!(field == null ? void 0 : field.type)) return null;
|
|
5393
5691
|
const onChange = (value, updatedUi) => {
|
|
@@ -5458,7 +5756,7 @@ var Fields = () => {
|
|
|
5458
5756
|
item: selectedItem
|
|
5459
5757
|
});
|
|
5460
5758
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
|
5461
|
-
return /* @__PURE__ */ (0,
|
|
5759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5462
5760
|
AutoFieldPrivate,
|
|
5463
5761
|
{
|
|
5464
5762
|
field,
|
|
@@ -5476,7 +5774,7 @@ var Fields = () => {
|
|
|
5476
5774
|
root: true
|
|
5477
5775
|
});
|
|
5478
5776
|
const id = `root_${field.type}_${fieldName}`;
|
|
5479
|
-
return /* @__PURE__ */ (0,
|
|
5777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5480
5778
|
AutoFieldPrivate,
|
|
5481
5779
|
{
|
|
5482
5780
|
field,
|
|
@@ -5490,7 +5788,7 @@ var Fields = () => {
|
|
|
5490
5788
|
);
|
|
5491
5789
|
}
|
|
5492
5790
|
}) }),
|
|
5493
|
-
isLoading && /* @__PURE__ */ (0,
|
|
5791
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Loader, { size: 16 }) }) })
|
|
5494
5792
|
]
|
|
5495
5793
|
}
|
|
5496
5794
|
);
|
|
@@ -5501,7 +5799,7 @@ init_react_import();
|
|
|
5501
5799
|
|
|
5502
5800
|
// lib/use-component-list.tsx
|
|
5503
5801
|
init_react_import();
|
|
5504
|
-
var
|
|
5802
|
+
var import_react36 = require("react");
|
|
5505
5803
|
|
|
5506
5804
|
// components/ComponentList/index.tsx
|
|
5507
5805
|
init_react_import();
|
|
@@ -5511,7 +5809,7 @@ init_react_import();
|
|
|
5511
5809
|
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" };
|
|
5512
5810
|
|
|
5513
5811
|
// components/ComponentList/index.tsx
|
|
5514
|
-
var
|
|
5812
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5515
5813
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
|
5516
5814
|
var ComponentListItem = ({
|
|
5517
5815
|
name,
|
|
@@ -5521,7 +5819,7 @@ var ComponentListItem = ({
|
|
|
5521
5819
|
const canInsert = getPermissions({
|
|
5522
5820
|
type: name
|
|
5523
5821
|
}).insert;
|
|
5524
|
-
return /* @__PURE__ */ (0,
|
|
5822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
|
5525
5823
|
};
|
|
5526
5824
|
var ComponentList = ({
|
|
5527
5825
|
children,
|
|
@@ -5530,8 +5828,8 @@ var ComponentList = ({
|
|
|
5530
5828
|
}) => {
|
|
5531
5829
|
const { config, state, setUi } = useAppContext();
|
|
5532
5830
|
const { expanded = true } = state.ui.componentList[id] || {};
|
|
5533
|
-
return /* @__PURE__ */ (0,
|
|
5534
|
-
title && /* @__PURE__ */ (0,
|
|
5831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
|
|
5832
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5535
5833
|
"button",
|
|
5536
5834
|
{
|
|
5537
5835
|
type: "button",
|
|
@@ -5545,14 +5843,14 @@ var ComponentList = ({
|
|
|
5545
5843
|
}),
|
|
5546
5844
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
5547
5845
|
children: [
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5846
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: title }),
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronDown, { size: 12 }) })
|
|
5550
5848
|
]
|
|
5551
5849
|
}
|
|
5552
5850
|
),
|
|
5553
|
-
/* @__PURE__ */ (0,
|
|
5851
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
5554
5852
|
var _a;
|
|
5555
|
-
return /* @__PURE__ */ (0,
|
|
5853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5556
5854
|
ComponentListItem,
|
|
5557
5855
|
{
|
|
5558
5856
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -5566,10 +5864,10 @@ var ComponentList = ({
|
|
|
5566
5864
|
ComponentList.Item = ComponentListItem;
|
|
5567
5865
|
|
|
5568
5866
|
// lib/use-component-list.tsx
|
|
5569
|
-
var
|
|
5867
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5570
5868
|
var useComponentList = (config, ui) => {
|
|
5571
|
-
const [componentList, setComponentList] = (0,
|
|
5572
|
-
(0,
|
|
5869
|
+
const [componentList, setComponentList] = (0, import_react36.useState)();
|
|
5870
|
+
(0, import_react36.useEffect)(() => {
|
|
5573
5871
|
var _a, _b, _c;
|
|
5574
5872
|
if (Object.keys(ui.componentList).length > 0) {
|
|
5575
5873
|
const matchedComponents = [];
|
|
@@ -5579,7 +5877,7 @@ var useComponentList = (config, ui) => {
|
|
|
5579
5877
|
if (category.visible === false || !category.components) {
|
|
5580
5878
|
return null;
|
|
5581
5879
|
}
|
|
5582
|
-
return /* @__PURE__ */ (0,
|
|
5880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5583
5881
|
ComponentList,
|
|
5584
5882
|
{
|
|
5585
5883
|
id: categoryKey,
|
|
@@ -5588,7 +5886,7 @@ var useComponentList = (config, ui) => {
|
|
|
5588
5886
|
var _a2;
|
|
5589
5887
|
matchedComponents.push(componentName);
|
|
5590
5888
|
const componentConf = config.components[componentName] || {};
|
|
5591
|
-
return /* @__PURE__ */ (0,
|
|
5889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5592
5890
|
ComponentList.Item,
|
|
5593
5891
|
{
|
|
5594
5892
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -5608,7 +5906,7 @@ var useComponentList = (config, ui) => {
|
|
|
5608
5906
|
);
|
|
5609
5907
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
5610
5908
|
_componentList.push(
|
|
5611
|
-
/* @__PURE__ */ (0,
|
|
5909
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5612
5910
|
ComponentList,
|
|
5613
5911
|
{
|
|
5614
5912
|
id: "other",
|
|
@@ -5616,7 +5914,7 @@ var useComponentList = (config, ui) => {
|
|
|
5616
5914
|
children: remainingComponents.map((componentName, i) => {
|
|
5617
5915
|
var _a2;
|
|
5618
5916
|
const componentConf = config.components[componentName] || {};
|
|
5619
|
-
return /* @__PURE__ */ (0,
|
|
5917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5620
5918
|
ComponentList.Item,
|
|
5621
5919
|
{
|
|
5622
5920
|
name: componentName,
|
|
@@ -5638,25 +5936,25 @@ var useComponentList = (config, ui) => {
|
|
|
5638
5936
|
};
|
|
5639
5937
|
|
|
5640
5938
|
// components/Puck/components/Components/index.tsx
|
|
5641
|
-
var
|
|
5642
|
-
var
|
|
5939
|
+
var import_react37 = require("react");
|
|
5940
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5643
5941
|
var Components = () => {
|
|
5644
5942
|
const { config, state, overrides } = useAppContext();
|
|
5645
5943
|
const componentList = useComponentList(config, state.ui);
|
|
5646
|
-
const Wrapper = (0,
|
|
5647
|
-
return /* @__PURE__ */ (0,
|
|
5944
|
+
const Wrapper = (0, import_react37.useMemo)(() => overrides.components || "div", [overrides]);
|
|
5945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
|
|
5648
5946
|
};
|
|
5649
5947
|
|
|
5650
5948
|
// components/Puck/components/Preview/index.tsx
|
|
5651
5949
|
init_react_import();
|
|
5652
|
-
var
|
|
5950
|
+
var import_react39 = require("react");
|
|
5653
5951
|
|
|
5654
5952
|
// components/AutoFrame/index.tsx
|
|
5655
5953
|
init_react_import();
|
|
5656
|
-
var
|
|
5954
|
+
var import_react38 = require("react");
|
|
5657
5955
|
var import_object_hash = __toESM(require("object-hash"));
|
|
5658
5956
|
var import_react_dom3 = require("react-dom");
|
|
5659
|
-
var
|
|
5957
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5660
5958
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
5661
5959
|
var collectStyles = (doc) => {
|
|
5662
5960
|
const collected = [];
|
|
@@ -5699,7 +5997,7 @@ var CopyHostStyles = ({
|
|
|
5699
5997
|
onStylesLoaded = () => null
|
|
5700
5998
|
}) => {
|
|
5701
5999
|
const { document: doc, window: win } = useFrame();
|
|
5702
|
-
(0,
|
|
6000
|
+
(0, import_react38.useEffect)(() => {
|
|
5703
6001
|
if (!win || !doc) {
|
|
5704
6002
|
return () => {
|
|
5705
6003
|
};
|
|
@@ -5856,10 +6154,10 @@ var CopyHostStyles = ({
|
|
|
5856
6154
|
observer.disconnect();
|
|
5857
6155
|
};
|
|
5858
6156
|
}, []);
|
|
5859
|
-
return /* @__PURE__ */ (0,
|
|
6157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
|
5860
6158
|
};
|
|
5861
|
-
var autoFrameContext = (0,
|
|
5862
|
-
var useFrame = () => (0,
|
|
6159
|
+
var autoFrameContext = (0, import_react38.createContext)({});
|
|
6160
|
+
var useFrame = () => (0, import_react38.useContext)(autoFrameContext);
|
|
5863
6161
|
function AutoFrame(_a) {
|
|
5864
6162
|
var _b = _a, {
|
|
5865
6163
|
children,
|
|
@@ -5876,10 +6174,10 @@ function AutoFrame(_a) {
|
|
|
5876
6174
|
"onStylesLoaded",
|
|
5877
6175
|
"frameRef"
|
|
5878
6176
|
]);
|
|
5879
|
-
const [loaded, setLoaded] = (0,
|
|
5880
|
-
const [ctx, setCtx] = (0,
|
|
5881
|
-
const [mountTarget, setMountTarget] = (0,
|
|
5882
|
-
(0,
|
|
6177
|
+
const [loaded, setLoaded] = (0, import_react38.useState)(false);
|
|
6178
|
+
const [ctx, setCtx] = (0, import_react38.useState)({});
|
|
6179
|
+
const [mountTarget, setMountTarget] = (0, import_react38.useState)();
|
|
6180
|
+
(0, import_react38.useEffect)(() => {
|
|
5883
6181
|
var _a2;
|
|
5884
6182
|
if (frameRef.current) {
|
|
5885
6183
|
setCtx({
|
|
@@ -5891,7 +6189,7 @@ function AutoFrame(_a) {
|
|
|
5891
6189
|
);
|
|
5892
6190
|
}
|
|
5893
6191
|
}, [frameRef, loaded]);
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
6192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5895
6193
|
"iframe",
|
|
5896
6194
|
__spreadProps(__spreadValues({}, props), {
|
|
5897
6195
|
className,
|
|
@@ -5901,7 +6199,7 @@ function AutoFrame(_a) {
|
|
|
5901
6199
|
onLoad: () => {
|
|
5902
6200
|
setLoaded(true);
|
|
5903
6201
|
},
|
|
5904
|
-
children: /* @__PURE__ */ (0,
|
|
6202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CopyHostStyles, { debug, onStylesLoaded, children: (0, import_react_dom3.createPortal)(children, mountTarget) }) })
|
|
5905
6203
|
})
|
|
5906
6204
|
);
|
|
5907
6205
|
}
|
|
@@ -5914,7 +6212,7 @@ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
|
|
|
5914
6212
|
|
|
5915
6213
|
// components/Render/index.tsx
|
|
5916
6214
|
init_react_import();
|
|
5917
|
-
var
|
|
6215
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5918
6216
|
function Render({
|
|
5919
6217
|
config,
|
|
5920
6218
|
data
|
|
@@ -5927,7 +6225,7 @@ function Render({
|
|
|
5927
6225
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
|
5928
6226
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5929
6227
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5930
|
-
return /* @__PURE__ */ (0,
|
|
6228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5931
6229
|
DropZoneProvider,
|
|
5932
6230
|
{
|
|
5933
6231
|
value: {
|
|
@@ -5937,7 +6235,7 @@ function Render({
|
|
|
5937
6235
|
depth: 0,
|
|
5938
6236
|
path: []
|
|
5939
6237
|
},
|
|
5940
|
-
children: /* @__PURE__ */ (0,
|
|
6238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5941
6239
|
config.root.render,
|
|
5942
6240
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
5943
6241
|
puck: {
|
|
@@ -5947,13 +6245,13 @@ function Render({
|
|
|
5947
6245
|
title,
|
|
5948
6246
|
editMode: false,
|
|
5949
6247
|
id: "puck-root",
|
|
5950
|
-
children: /* @__PURE__ */ (0,
|
|
6248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
|
|
5951
6249
|
})
|
|
5952
6250
|
)
|
|
5953
6251
|
}
|
|
5954
6252
|
);
|
|
5955
6253
|
}
|
|
5956
|
-
return /* @__PURE__ */ (0,
|
|
6254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5957
6255
|
DropZoneProvider,
|
|
5958
6256
|
{
|
|
5959
6257
|
value: {
|
|
@@ -5963,17 +6261,17 @@ function Render({
|
|
|
5963
6261
|
depth: 0,
|
|
5964
6262
|
path: []
|
|
5965
6263
|
},
|
|
5966
|
-
children: /* @__PURE__ */ (0,
|
|
6264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
|
|
5967
6265
|
}
|
|
5968
6266
|
);
|
|
5969
6267
|
}
|
|
5970
6268
|
|
|
5971
6269
|
// components/Puck/components/Preview/index.tsx
|
|
5972
|
-
var
|
|
6270
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5973
6271
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
|
5974
6272
|
var useBubbleIframeEvents = (ref) => {
|
|
5975
6273
|
const { status } = useAppContext();
|
|
5976
|
-
(0,
|
|
6274
|
+
(0, import_react39.useEffect)(() => {
|
|
5977
6275
|
var _a;
|
|
5978
6276
|
if (ref.current && status === "READY") {
|
|
5979
6277
|
const iframe = ref.current;
|
|
@@ -6010,22 +6308,22 @@ var useBubbleIframeEvents = (ref) => {
|
|
|
6010
6308
|
}
|
|
6011
6309
|
}, [status]);
|
|
6012
6310
|
};
|
|
6013
|
-
var
|
|
6311
|
+
var Preview2 = ({ id = "puck-preview" }) => {
|
|
6014
6312
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
|
6015
|
-
const Page = (0,
|
|
6313
|
+
const Page = (0, import_react39.useCallback)(
|
|
6016
6314
|
(pageProps) => {
|
|
6017
6315
|
var _a, _b;
|
|
6018
6316
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
|
6019
6317
|
id: "puck-root"
|
|
6020
|
-
}, pageProps)) : /* @__PURE__ */ (0,
|
|
6318
|
+
}, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
|
6021
6319
|
},
|
|
6022
6320
|
[config.root]
|
|
6023
6321
|
);
|
|
6024
|
-
const Frame = (0,
|
|
6322
|
+
const Frame = (0, import_react39.useMemo)(() => overrides.iframe, [overrides]);
|
|
6025
6323
|
const rootProps = state.data.root.props || state.data.root;
|
|
6026
|
-
const ref = (0,
|
|
6324
|
+
const ref = (0, import_react39.useRef)(null);
|
|
6027
6325
|
useBubbleIframeEvents(ref);
|
|
6028
|
-
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0,
|
|
6326
|
+
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6029
6327
|
Page,
|
|
6030
6328
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
6031
6329
|
puck: {
|
|
@@ -6034,10 +6332,10 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
|
6034
6332
|
dragRef: null
|
|
6035
6333
|
},
|
|
6036
6334
|
editMode: true,
|
|
6037
|
-
children: /* @__PURE__ */ (0,
|
|
6335
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
|
|
6038
6336
|
})
|
|
6039
|
-
) : /* @__PURE__ */ (0,
|
|
6040
|
-
return /* @__PURE__ */ (0,
|
|
6337
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: state.data, config });
|
|
6338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6041
6339
|
"div",
|
|
6042
6340
|
{
|
|
6043
6341
|
className: getClassName23(),
|
|
@@ -6046,7 +6344,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
|
6046
6344
|
onClick: () => {
|
|
6047
6345
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
|
6048
6346
|
},
|
|
6049
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
|
6347
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6050
6348
|
AutoFrame_default,
|
|
6051
6349
|
{
|
|
6052
6350
|
id: "preview-frame",
|
|
@@ -6056,14 +6354,14 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
|
6056
6354
|
setStatus("READY");
|
|
6057
6355
|
},
|
|
6058
6356
|
frameRef: ref,
|
|
6059
|
-
children: /* @__PURE__ */ (0,
|
|
6357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
6060
6358
|
if (Frame) {
|
|
6061
|
-
return /* @__PURE__ */ (0,
|
|
6359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame, { document: document2, children: inner });
|
|
6062
6360
|
}
|
|
6063
6361
|
return inner;
|
|
6064
6362
|
} })
|
|
6065
6363
|
}
|
|
6066
|
-
) : /* @__PURE__ */ (0,
|
|
6364
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6067
6365
|
"div",
|
|
6068
6366
|
{
|
|
6069
6367
|
id: "preview-frame",
|
|
@@ -6120,7 +6418,7 @@ var scrollIntoView = (el) => {
|
|
|
6120
6418
|
};
|
|
6121
6419
|
|
|
6122
6420
|
// components/LayerTree/index.tsx
|
|
6123
|
-
var
|
|
6421
|
+
var import_react40 = require("react");
|
|
6124
6422
|
|
|
6125
6423
|
// lib/is-child-of-zone.ts
|
|
6126
6424
|
init_react_import();
|
|
@@ -6153,7 +6451,7 @@ var onScrollEnd = (frame, cb) => {
|
|
|
6153
6451
|
};
|
|
6154
6452
|
|
|
6155
6453
|
// components/LayerTree/index.tsx
|
|
6156
|
-
var
|
|
6454
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6157
6455
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
|
6158
6456
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
|
6159
6457
|
var LayerTree = ({
|
|
@@ -6166,15 +6464,15 @@ var LayerTree = ({
|
|
|
6166
6464
|
label
|
|
6167
6465
|
}) => {
|
|
6168
6466
|
const zones = data.zones || {};
|
|
6169
|
-
const ctx = (0,
|
|
6170
|
-
return /* @__PURE__ */ (0,
|
|
6171
|
-
label && /* @__PURE__ */ (0,
|
|
6172
|
-
/* @__PURE__ */ (0,
|
|
6467
|
+
const ctx = (0, import_react40.useContext)(dropZoneContext);
|
|
6468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6469
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
|
6470
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
|
6173
6471
|
" ",
|
|
6174
6472
|
label
|
|
6175
6473
|
] }),
|
|
6176
|
-
/* @__PURE__ */ (0,
|
|
6177
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
|
6474
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
|
6475
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
|
6178
6476
|
zoneContent.map((item, i) => {
|
|
6179
6477
|
var _a;
|
|
6180
6478
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
|
@@ -6187,7 +6485,7 @@ var LayerTree = ({
|
|
|
6187
6485
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
|
6188
6486
|
const componentConfig = config.components[item.type];
|
|
6189
6487
|
const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
|
|
6190
|
-
return /* @__PURE__ */ (0,
|
|
6488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6191
6489
|
"li",
|
|
6192
6490
|
{
|
|
6193
6491
|
className: getClassNameLayer({
|
|
@@ -6197,7 +6495,7 @@ var LayerTree = ({
|
|
|
6197
6495
|
childIsSelected
|
|
6198
6496
|
}),
|
|
6199
6497
|
children: [
|
|
6200
|
-
/* @__PURE__ */ (0,
|
|
6498
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6201
6499
|
"button",
|
|
6202
6500
|
{
|
|
6203
6501
|
type: "button",
|
|
@@ -6236,22 +6534,22 @@ var LayerTree = ({
|
|
|
6236
6534
|
setHoveringComponent(null);
|
|
6237
6535
|
},
|
|
6238
6536
|
children: [
|
|
6239
|
-
containsZone && /* @__PURE__ */ (0,
|
|
6537
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6240
6538
|
"div",
|
|
6241
6539
|
{
|
|
6242
6540
|
className: getClassNameLayer("chevron"),
|
|
6243
6541
|
title: isSelected ? "Collapse" : "Expand",
|
|
6244
|
-
children: /* @__PURE__ */ (0,
|
|
6542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
|
6245
6543
|
}
|
|
6246
6544
|
),
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6248
|
-
/* @__PURE__ */ (0,
|
|
6249
|
-
/* @__PURE__ */ (0,
|
|
6545
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
|
6546
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
|
|
6547
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
|
6250
6548
|
] })
|
|
6251
6549
|
]
|
|
6252
6550
|
}
|
|
6253
6551
|
) }),
|
|
6254
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
|
6552
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6255
6553
|
LayerTree,
|
|
6256
6554
|
{
|
|
6257
6555
|
config,
|
|
@@ -6273,13 +6571,13 @@ var LayerTree = ({
|
|
|
6273
6571
|
};
|
|
6274
6572
|
|
|
6275
6573
|
// components/Puck/components/Outline/index.tsx
|
|
6276
|
-
var
|
|
6277
|
-
var
|
|
6574
|
+
var import_react41 = require("react");
|
|
6575
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6278
6576
|
var Outline = () => {
|
|
6279
6577
|
const { dispatch, state, overrides, config } = useAppContext();
|
|
6280
6578
|
const { data, ui } = state;
|
|
6281
6579
|
const { itemSelector } = ui;
|
|
6282
|
-
const setItemSelector = (0,
|
|
6580
|
+
const setItemSelector = (0, import_react41.useCallback)(
|
|
6283
6581
|
(newItemSelector) => {
|
|
6284
6582
|
dispatch({
|
|
6285
6583
|
type: "setUi",
|
|
@@ -6288,9 +6586,9 @@ var Outline = () => {
|
|
|
6288
6586
|
},
|
|
6289
6587
|
[]
|
|
6290
6588
|
);
|
|
6291
|
-
const Wrapper = (0,
|
|
6292
|
-
return /* @__PURE__ */ (0,
|
|
6293
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
|
6589
|
+
const Wrapper = (0, import_react41.useMemo)(() => overrides.outline || "div", [overrides]);
|
|
6590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
6591
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6294
6592
|
LayerTree,
|
|
6295
6593
|
{
|
|
6296
6594
|
config,
|
|
@@ -6303,7 +6601,7 @@ var Outline = () => {
|
|
|
6303
6601
|
),
|
|
6304
6602
|
Object.entries(findZonesForArea(data, "root")).map(
|
|
6305
6603
|
([zoneKey, zone]) => {
|
|
6306
|
-
return /* @__PURE__ */ (0,
|
|
6604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6307
6605
|
LayerTree,
|
|
6308
6606
|
{
|
|
6309
6607
|
config,
|
|
@@ -6402,19 +6700,19 @@ function usePuckHistory({
|
|
|
6402
6700
|
|
|
6403
6701
|
// lib/use-history-store.ts
|
|
6404
6702
|
init_react_import();
|
|
6405
|
-
var
|
|
6703
|
+
var import_react42 = require("react");
|
|
6406
6704
|
var import_use_debounce3 = require("use-debounce");
|
|
6407
6705
|
var EMPTY_HISTORY_INDEX = 0;
|
|
6408
6706
|
function useHistoryStore(initialHistory) {
|
|
6409
6707
|
var _a, _b;
|
|
6410
|
-
const [histories, setHistories] = (0,
|
|
6708
|
+
const [histories, setHistories] = (0, import_react42.useState)(
|
|
6411
6709
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
|
6412
6710
|
);
|
|
6413
6711
|
const updateHistories = (histories2) => {
|
|
6414
6712
|
setHistories(histories2);
|
|
6415
6713
|
setIndex(histories2.length - 1);
|
|
6416
6714
|
};
|
|
6417
|
-
const [index, setIndex] = (0,
|
|
6715
|
+
const [index, setIndex] = (0, import_react42.useState)(
|
|
6418
6716
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
|
6419
6717
|
);
|
|
6420
6718
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
|
@@ -6574,22 +6872,22 @@ var getBox = function getBox2(el) {
|
|
|
6574
6872
|
};
|
|
6575
6873
|
|
|
6576
6874
|
// components/Puck/components/Canvas/index.tsx
|
|
6577
|
-
var
|
|
6875
|
+
var import_react44 = require("react");
|
|
6578
6876
|
|
|
6579
6877
|
// components/ViewportControls/index.tsx
|
|
6580
6878
|
init_react_import();
|
|
6581
|
-
var
|
|
6879
|
+
var import_react43 = require("react");
|
|
6582
6880
|
|
|
6583
6881
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
6584
6882
|
init_react_import();
|
|
6585
6883
|
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" };
|
|
6586
6884
|
|
|
6587
6885
|
// components/ViewportControls/index.tsx
|
|
6588
|
-
var
|
|
6886
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6589
6887
|
var icons = {
|
|
6590
|
-
Smartphone: /* @__PURE__ */ (0,
|
|
6591
|
-
Tablet: /* @__PURE__ */ (0,
|
|
6592
|
-
Monitor: /* @__PURE__ */ (0,
|
|
6888
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
|
6889
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
|
6890
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
|
6593
6891
|
};
|
|
6594
6892
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
|
6595
6893
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
|
@@ -6601,11 +6899,11 @@ var ViewportButton = ({
|
|
|
6601
6899
|
onClick
|
|
6602
6900
|
}) => {
|
|
6603
6901
|
const { state } = useAppContext();
|
|
6604
|
-
const [isActive, setIsActive] = (0,
|
|
6605
|
-
(0,
|
|
6902
|
+
const [isActive, setIsActive] = (0, import_react43.useState)(false);
|
|
6903
|
+
(0, import_react43.useEffect)(() => {
|
|
6606
6904
|
setIsActive(width === state.ui.viewports.current.width);
|
|
6607
6905
|
}, [width, state.ui.viewports.current.width]);
|
|
6608
|
-
return /* @__PURE__ */ (0,
|
|
6906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6609
6907
|
IconButton,
|
|
6610
6908
|
{
|
|
6611
6909
|
title,
|
|
@@ -6614,7 +6912,7 @@ var ViewportButton = ({
|
|
|
6614
6912
|
e.stopPropagation();
|
|
6615
6913
|
onClick({ width, height });
|
|
6616
6914
|
},
|
|
6617
|
-
children: /* @__PURE__ */ (0,
|
|
6915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
|
6618
6916
|
}
|
|
6619
6917
|
) });
|
|
6620
6918
|
};
|
|
@@ -6638,7 +6936,7 @@ var ViewportControls = ({
|
|
|
6638
6936
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
6639
6937
|
(option) => option.value === autoZoom
|
|
6640
6938
|
);
|
|
6641
|
-
const zoomOptions = (0,
|
|
6939
|
+
const zoomOptions = (0, import_react43.useMemo)(
|
|
6642
6940
|
() => [
|
|
6643
6941
|
...defaultZoomOptions,
|
|
6644
6942
|
...defaultsContainAutoZoom ? [] : [
|
|
@@ -6650,8 +6948,8 @@ var ViewportControls = ({
|
|
|
6650
6948
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
6651
6949
|
[autoZoom]
|
|
6652
6950
|
);
|
|
6653
|
-
return /* @__PURE__ */ (0,
|
|
6654
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
|
6951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
|
6952
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6655
6953
|
ViewportButton,
|
|
6656
6954
|
{
|
|
6657
6955
|
height: viewport.height,
|
|
@@ -6662,8 +6960,8 @@ var ViewportControls = ({
|
|
|
6662
6960
|
},
|
|
6663
6961
|
i
|
|
6664
6962
|
)),
|
|
6665
|
-
/* @__PURE__ */ (0,
|
|
6666
|
-
/* @__PURE__ */ (0,
|
|
6963
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
|
6964
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6667
6965
|
IconButton,
|
|
6668
6966
|
{
|
|
6669
6967
|
title: "Zoom viewport out",
|
|
@@ -6677,10 +6975,10 @@ var ViewportControls = ({
|
|
|
6677
6975
|
)].value
|
|
6678
6976
|
);
|
|
6679
6977
|
},
|
|
6680
|
-
children: /* @__PURE__ */ (0,
|
|
6978
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
|
6681
6979
|
}
|
|
6682
6980
|
),
|
|
6683
|
-
/* @__PURE__ */ (0,
|
|
6981
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6684
6982
|
IconButton,
|
|
6685
6983
|
{
|
|
6686
6984
|
title: "Zoom viewport in",
|
|
@@ -6694,11 +6992,11 @@ var ViewportControls = ({
|
|
|
6694
6992
|
)].value
|
|
6695
6993
|
);
|
|
6696
6994
|
},
|
|
6697
|
-
children: /* @__PURE__ */ (0,
|
|
6995
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
|
6698
6996
|
}
|
|
6699
6997
|
),
|
|
6700
|
-
/* @__PURE__ */ (0,
|
|
6701
|
-
/* @__PURE__ */ (0,
|
|
6998
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
|
6999
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6702
7000
|
"select",
|
|
6703
7001
|
{
|
|
6704
7002
|
className: getClassName25("zoomSelect"),
|
|
@@ -6706,7 +7004,7 @@ var ViewportControls = ({
|
|
|
6706
7004
|
onChange: (e) => {
|
|
6707
7005
|
onZoom(parseFloat(e.currentTarget.value));
|
|
6708
7006
|
},
|
|
6709
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
|
7007
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6710
7008
|
"option",
|
|
6711
7009
|
{
|
|
6712
7010
|
value: option.value,
|
|
@@ -6754,24 +7052,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
|
6754
7052
|
};
|
|
6755
7053
|
|
|
6756
7054
|
// components/Puck/components/Canvas/index.tsx
|
|
6757
|
-
var
|
|
7055
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6758
7056
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
|
6759
7057
|
var ZOOM_ON_CHANGE = true;
|
|
6760
7058
|
var Canvas = () => {
|
|
6761
7059
|
const { status, iframe } = useAppContext();
|
|
6762
7060
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
|
6763
7061
|
const { ui } = state;
|
|
6764
|
-
const frameRef = (0,
|
|
6765
|
-
const [showTransition, setShowTransition] = (0,
|
|
6766
|
-
const defaultRender = (0,
|
|
6767
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
|
7062
|
+
const frameRef = (0, import_react44.useRef)(null);
|
|
7063
|
+
const [showTransition, setShowTransition] = (0, import_react44.useState)(false);
|
|
7064
|
+
const defaultRender = (0, import_react44.useMemo)(() => {
|
|
7065
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
|
6768
7066
|
return PuckDefault;
|
|
6769
7067
|
}, []);
|
|
6770
|
-
const CustomPreview = (0,
|
|
7068
|
+
const CustomPreview = (0, import_react44.useMemo)(
|
|
6771
7069
|
() => overrides.preview || defaultRender,
|
|
6772
7070
|
[overrides]
|
|
6773
7071
|
);
|
|
6774
|
-
const getFrameDimensions = (0,
|
|
7072
|
+
const getFrameDimensions = (0, import_react44.useCallback)(() => {
|
|
6775
7073
|
if (frameRef.current) {
|
|
6776
7074
|
const frame = frameRef.current;
|
|
6777
7075
|
const box = getBox(frame);
|
|
@@ -6779,7 +7077,7 @@ var Canvas = () => {
|
|
|
6779
7077
|
}
|
|
6780
7078
|
return { width: 0, height: 0 };
|
|
6781
7079
|
}, [frameRef]);
|
|
6782
|
-
const resetAutoZoom = (0,
|
|
7080
|
+
const resetAutoZoom = (0, import_react44.useCallback)(
|
|
6783
7081
|
(ui2 = state.ui) => {
|
|
6784
7082
|
if (frameRef.current) {
|
|
6785
7083
|
setZoomConfig(
|
|
@@ -6789,11 +7087,11 @@ var Canvas = () => {
|
|
|
6789
7087
|
},
|
|
6790
7088
|
[frameRef, zoomConfig, state.ui]
|
|
6791
7089
|
);
|
|
6792
|
-
(0,
|
|
7090
|
+
(0, import_react44.useEffect)(() => {
|
|
6793
7091
|
setShowTransition(false);
|
|
6794
7092
|
resetAutoZoom();
|
|
6795
7093
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
|
6796
|
-
(0,
|
|
7094
|
+
(0, import_react44.useEffect)(() => {
|
|
6797
7095
|
const { height: frameHeight } = getFrameDimensions();
|
|
6798
7096
|
if (ui.viewports.current.height === "auto") {
|
|
6799
7097
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
@@ -6801,13 +7099,13 @@ var Canvas = () => {
|
|
|
6801
7099
|
}));
|
|
6802
7100
|
}
|
|
6803
7101
|
}, [zoomConfig.zoom]);
|
|
6804
|
-
(0,
|
|
7102
|
+
(0, import_react44.useEffect)(() => {
|
|
6805
7103
|
if (ZOOM_ON_CHANGE) {
|
|
6806
7104
|
setShowTransition(true);
|
|
6807
7105
|
resetAutoZoom(ui);
|
|
6808
7106
|
}
|
|
6809
7107
|
}, [ui.viewports.current.width]);
|
|
6810
|
-
(0,
|
|
7108
|
+
(0, import_react44.useEffect)(() => {
|
|
6811
7109
|
const cb = () => {
|
|
6812
7110
|
setShowTransition(false);
|
|
6813
7111
|
resetAutoZoom();
|
|
@@ -6817,13 +7115,13 @@ var Canvas = () => {
|
|
|
6817
7115
|
window.removeEventListener("resize", cb);
|
|
6818
7116
|
};
|
|
6819
7117
|
}, []);
|
|
6820
|
-
const [showLoader, setShowLoader] = (0,
|
|
6821
|
-
(0,
|
|
7118
|
+
const [showLoader, setShowLoader] = (0, import_react44.useState)(false);
|
|
7119
|
+
(0, import_react44.useEffect)(() => {
|
|
6822
7120
|
setTimeout(() => {
|
|
6823
7121
|
setShowLoader(true);
|
|
6824
7122
|
}, 500);
|
|
6825
7123
|
}, []);
|
|
6826
|
-
return /* @__PURE__ */ (0,
|
|
7124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6827
7125
|
"div",
|
|
6828
7126
|
{
|
|
6829
7127
|
className: getClassName26({
|
|
@@ -6836,7 +7134,7 @@ var Canvas = () => {
|
|
|
6836
7134
|
recordHistory: true
|
|
6837
7135
|
}),
|
|
6838
7136
|
children: [
|
|
6839
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
|
7137
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6840
7138
|
ViewportControls,
|
|
6841
7139
|
{
|
|
6842
7140
|
autoZoom: zoomConfig.autoZoom,
|
|
@@ -6862,8 +7160,8 @@ var Canvas = () => {
|
|
|
6862
7160
|
}
|
|
6863
7161
|
}
|
|
6864
7162
|
) }),
|
|
6865
|
-
/* @__PURE__ */ (0,
|
|
6866
|
-
/* @__PURE__ */ (0,
|
|
7163
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
|
7164
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6867
7165
|
"div",
|
|
6868
7166
|
{
|
|
6869
7167
|
className: getClassName26("root"),
|
|
@@ -6884,10 +7182,10 @@ var Canvas = () => {
|
|
|
6884
7182
|
})
|
|
6885
7183
|
);
|
|
6886
7184
|
},
|
|
6887
|
-
children: /* @__PURE__ */ (0,
|
|
7185
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview2, {}) })
|
|
6888
7186
|
}
|
|
6889
7187
|
),
|
|
6890
|
-
/* @__PURE__ */ (0,
|
|
7188
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Loader, { size: 24 }) })
|
|
6891
7189
|
] })
|
|
6892
7190
|
]
|
|
6893
7191
|
}
|
|
@@ -6896,7 +7194,7 @@ var Canvas = () => {
|
|
|
6896
7194
|
|
|
6897
7195
|
// lib/use-loaded-overrides.ts
|
|
6898
7196
|
init_react_import();
|
|
6899
|
-
var
|
|
7197
|
+
var import_react45 = require("react");
|
|
6900
7198
|
|
|
6901
7199
|
// lib/load-overrides.ts
|
|
6902
7200
|
init_react_import();
|
|
@@ -6935,26 +7233,26 @@ var useLoadedOverrides = ({
|
|
|
6935
7233
|
overrides,
|
|
6936
7234
|
plugins
|
|
6937
7235
|
}) => {
|
|
6938
|
-
return (0,
|
|
7236
|
+
return (0, import_react45.useMemo)(() => {
|
|
6939
7237
|
return loadOverrides({ overrides, plugins });
|
|
6940
7238
|
}, [plugins, overrides]);
|
|
6941
7239
|
};
|
|
6942
7240
|
|
|
6943
7241
|
// components/DefaultOverride/index.tsx
|
|
6944
7242
|
init_react_import();
|
|
6945
|
-
var
|
|
6946
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
|
7243
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7244
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
|
|
6947
7245
|
|
|
6948
7246
|
// lib/use-inject-css.ts
|
|
6949
7247
|
init_react_import();
|
|
6950
|
-
var
|
|
7248
|
+
var import_react46 = require("react");
|
|
6951
7249
|
var styles = ``;
|
|
6952
7250
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
6953
|
-
const [el, setEl] = (0,
|
|
6954
|
-
(0,
|
|
7251
|
+
const [el, setEl] = (0, import_react46.useState)();
|
|
7252
|
+
(0, import_react46.useEffect)(() => {
|
|
6955
7253
|
setEl(document.createElement("style"));
|
|
6956
7254
|
}, []);
|
|
6957
|
-
(0,
|
|
7255
|
+
(0, import_react46.useEffect)(() => {
|
|
6958
7256
|
var _a;
|
|
6959
7257
|
if (!el || typeof window === "undefined") {
|
|
6960
7258
|
return;
|
|
@@ -6974,10 +7272,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
|
6974
7272
|
|
|
6975
7273
|
// lib/use-preview-mode-hotkeys.ts
|
|
6976
7274
|
init_react_import();
|
|
6977
|
-
var
|
|
7275
|
+
var import_react47 = require("react");
|
|
6978
7276
|
var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
|
|
6979
7277
|
var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
|
6980
|
-
const toggleInteractive = (0,
|
|
7278
|
+
const toggleInteractive = (0, import_react47.useCallback)(() => {
|
|
6981
7279
|
dispatch({
|
|
6982
7280
|
type: "setUi",
|
|
6983
7281
|
ui: (ui) => ({
|
|
@@ -7000,7 +7298,7 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
|
|
7000
7298
|
};
|
|
7001
7299
|
|
|
7002
7300
|
// components/Puck/index.tsx
|
|
7003
|
-
var
|
|
7301
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7004
7302
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
|
7005
7303
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
|
7006
7304
|
function Puck({
|
|
@@ -7029,7 +7327,7 @@ function Puck({
|
|
|
7029
7327
|
waitForStyles: true
|
|
7030
7328
|
}, _iframe);
|
|
7031
7329
|
useInjectGlobalCss(iframe.enabled);
|
|
7032
|
-
const [generatedAppState] = (0,
|
|
7330
|
+
const [generatedAppState] = (0, import_react48.useState)(() => {
|
|
7033
7331
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
7034
7332
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
7035
7333
|
let clientUiState = {};
|
|
@@ -7101,14 +7399,14 @@ function Puck({
|
|
|
7101
7399
|
histories,
|
|
7102
7400
|
index: initialHistoryIndex
|
|
7103
7401
|
});
|
|
7104
|
-
const [reducer] = (0,
|
|
7402
|
+
const [reducer] = (0, import_react48.useState)(
|
|
7105
7403
|
() => createReducer({
|
|
7106
7404
|
config,
|
|
7107
7405
|
record: historyStore.record,
|
|
7108
7406
|
onAction
|
|
7109
7407
|
})
|
|
7110
7408
|
);
|
|
7111
|
-
const [appState, dispatch] = (0,
|
|
7409
|
+
const [appState, dispatch] = (0, import_react48.useReducer)(
|
|
7112
7410
|
reducer,
|
|
7113
7411
|
flushZones(initialAppState)
|
|
7114
7412
|
);
|
|
@@ -7119,14 +7417,14 @@ function Puck({
|
|
|
7119
7417
|
historyStore,
|
|
7120
7418
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
|
7121
7419
|
});
|
|
7122
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
7420
|
+
const [menuOpen, setMenuOpen] = (0, import_react48.useState)(false);
|
|
7123
7421
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
|
7124
7422
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
|
7125
|
-
(0,
|
|
7423
|
+
(0, import_react48.useEffect)(() => {
|
|
7126
7424
|
if (onChange) onChange(data);
|
|
7127
7425
|
}, [data]);
|
|
7128
7426
|
const rootProps = data.root.props || data.root;
|
|
7129
|
-
const toggleSidebars = (0,
|
|
7427
|
+
const toggleSidebars = (0, import_react48.useCallback)(
|
|
7130
7428
|
(sidebar) => {
|
|
7131
7429
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
7132
7430
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -7140,7 +7438,7 @@ function Puck({
|
|
|
7140
7438
|
},
|
|
7141
7439
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
7142
7440
|
);
|
|
7143
|
-
(0,
|
|
7441
|
+
(0, import_react48.useEffect)(() => {
|
|
7144
7442
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
7145
7443
|
dispatch({
|
|
7146
7444
|
type: "setUi",
|
|
@@ -7163,7 +7461,7 @@ function Puck({
|
|
|
7163
7461
|
window.removeEventListener("resize", handleResize);
|
|
7164
7462
|
};
|
|
7165
7463
|
}, []);
|
|
7166
|
-
const defaultHeaderRender = (0,
|
|
7464
|
+
const defaultHeaderRender = (0, import_react48.useMemo)(() => {
|
|
7167
7465
|
if (renderHeader) {
|
|
7168
7466
|
console.warn(
|
|
7169
7467
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -7171,20 +7469,20 @@ function Puck({
|
|
|
7171
7469
|
const RenderHeader = (_a2) => {
|
|
7172
7470
|
var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
|
|
7173
7471
|
const Comp = renderHeader;
|
|
7174
|
-
return /* @__PURE__ */ (0,
|
|
7472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
7175
7473
|
};
|
|
7176
7474
|
return RenderHeader;
|
|
7177
7475
|
}
|
|
7178
7476
|
return DefaultOverride;
|
|
7179
7477
|
}, [renderHeader]);
|
|
7180
|
-
const defaultHeaderActionsRender = (0,
|
|
7478
|
+
const defaultHeaderActionsRender = (0, import_react48.useMemo)(() => {
|
|
7181
7479
|
if (renderHeaderActions) {
|
|
7182
7480
|
console.warn(
|
|
7183
7481
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
7184
7482
|
);
|
|
7185
7483
|
const RenderHeader = (props) => {
|
|
7186
7484
|
const Comp = renderHeaderActions;
|
|
7187
|
-
return /* @__PURE__ */ (0,
|
|
7485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
7188
7486
|
};
|
|
7189
7487
|
return RenderHeader;
|
|
7190
7488
|
}
|
|
@@ -7194,27 +7492,27 @@ function Puck({
|
|
|
7194
7492
|
overrides,
|
|
7195
7493
|
plugins
|
|
7196
7494
|
});
|
|
7197
|
-
const CustomPuck = (0,
|
|
7495
|
+
const CustomPuck = (0, import_react48.useMemo)(
|
|
7198
7496
|
() => loadedOverrides.puck || DefaultOverride,
|
|
7199
7497
|
[loadedOverrides]
|
|
7200
7498
|
);
|
|
7201
|
-
const CustomHeader = (0,
|
|
7499
|
+
const CustomHeader = (0, import_react48.useMemo)(
|
|
7202
7500
|
() => loadedOverrides.header || defaultHeaderRender,
|
|
7203
7501
|
[loadedOverrides]
|
|
7204
7502
|
);
|
|
7205
|
-
const CustomHeaderActions = (0,
|
|
7503
|
+
const CustomHeaderActions = (0, import_react48.useMemo)(
|
|
7206
7504
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
|
7207
7505
|
[loadedOverrides]
|
|
7208
7506
|
);
|
|
7209
|
-
const [mounted, setMounted] = (0,
|
|
7210
|
-
(0,
|
|
7507
|
+
const [mounted, setMounted] = (0, import_react48.useState)(false);
|
|
7508
|
+
(0, import_react48.useEffect)(() => {
|
|
7211
7509
|
setMounted(true);
|
|
7212
7510
|
}, []);
|
|
7213
7511
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
|
7214
7512
|
const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
|
|
7215
7513
|
usePreviewModeHotkeys(dispatch, iframe.enabled);
|
|
7216
|
-
return /* @__PURE__ */ (0,
|
|
7217
|
-
/* @__PURE__ */ (0,
|
|
7514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
|
7515
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7218
7516
|
AppProvider,
|
|
7219
7517
|
{
|
|
7220
7518
|
value: {
|
|
@@ -7236,7 +7534,7 @@ function Puck({
|
|
|
7236
7534
|
getPermissions: () => ({}),
|
|
7237
7535
|
refreshPermissions: () => null
|
|
7238
7536
|
},
|
|
7239
|
-
children: /* @__PURE__ */ (0,
|
|
7537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7240
7538
|
"div",
|
|
7241
7539
|
{
|
|
7242
7540
|
className: getLayoutClassName({
|
|
@@ -7245,60 +7543,60 @@ function Puck({
|
|
|
7245
7543
|
mounted,
|
|
7246
7544
|
rightSideBarVisible
|
|
7247
7545
|
}),
|
|
7248
|
-
children: /* @__PURE__ */ (0,
|
|
7249
|
-
/* @__PURE__ */ (0,
|
|
7546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
|
7547
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7250
7548
|
CustomHeader,
|
|
7251
7549
|
{
|
|
7252
|
-
actions: /* @__PURE__ */ (0,
|
|
7550
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7253
7551
|
Button,
|
|
7254
7552
|
{
|
|
7255
7553
|
onClick: () => {
|
|
7256
7554
|
onPublish && onPublish(data);
|
|
7257
7555
|
},
|
|
7258
|
-
icon: /* @__PURE__ */ (0,
|
|
7556
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
|
|
7259
7557
|
children: "Publish"
|
|
7260
7558
|
}
|
|
7261
7559
|
) }) }),
|
|
7262
|
-
children: /* @__PURE__ */ (0,
|
|
7263
|
-
/* @__PURE__ */ (0,
|
|
7264
|
-
/* @__PURE__ */ (0,
|
|
7560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
|
7561
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
|
7562
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7265
7563
|
"div",
|
|
7266
7564
|
{
|
|
7267
7565
|
className: getLayoutClassName("leftSideBarToggle"),
|
|
7268
|
-
children: /* @__PURE__ */ (0,
|
|
7566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7269
7567
|
IconButton,
|
|
7270
7568
|
{
|
|
7271
7569
|
onClick: () => {
|
|
7272
7570
|
toggleSidebars("left");
|
|
7273
7571
|
},
|
|
7274
7572
|
title: "Toggle left sidebar",
|
|
7275
|
-
children: /* @__PURE__ */ (0,
|
|
7573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelLeft, { focusable: "false" })
|
|
7276
7574
|
}
|
|
7277
7575
|
)
|
|
7278
7576
|
}
|
|
7279
7577
|
),
|
|
7280
|
-
/* @__PURE__ */ (0,
|
|
7578
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7281
7579
|
"div",
|
|
7282
7580
|
{
|
|
7283
7581
|
className: getLayoutClassName("rightSideBarToggle"),
|
|
7284
|
-
children: /* @__PURE__ */ (0,
|
|
7582
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7285
7583
|
IconButton,
|
|
7286
7584
|
{
|
|
7287
7585
|
onClick: () => {
|
|
7288
7586
|
toggleSidebars("right");
|
|
7289
7587
|
},
|
|
7290
7588
|
title: "Toggle right sidebar",
|
|
7291
|
-
children: /* @__PURE__ */ (0,
|
|
7589
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelRight, { focusable: "false" })
|
|
7292
7590
|
}
|
|
7293
7591
|
)
|
|
7294
7592
|
}
|
|
7295
7593
|
)
|
|
7296
7594
|
] }),
|
|
7297
|
-
/* @__PURE__ */ (0,
|
|
7595
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
|
7298
7596
|
headerTitle || rootProps.title || "Page",
|
|
7299
|
-
headerPath && /* @__PURE__ */ (0,
|
|
7597
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
7300
7598
|
" ",
|
|
7301
|
-
/* @__PURE__ */ (0,
|
|
7599
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7302
7600
|
"code",
|
|
7303
7601
|
{
|
|
7304
7602
|
className: getLayoutClassName("headerPath"),
|
|
@@ -7307,31 +7605,31 @@ function Puck({
|
|
|
7307
7605
|
)
|
|
7308
7606
|
] })
|
|
7309
7607
|
] }) }),
|
|
7310
|
-
/* @__PURE__ */ (0,
|
|
7311
|
-
/* @__PURE__ */ (0,
|
|
7608
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
|
7609
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7312
7610
|
IconButton,
|
|
7313
7611
|
{
|
|
7314
7612
|
onClick: () => {
|
|
7315
7613
|
return setMenuOpen(!menuOpen);
|
|
7316
7614
|
},
|
|
7317
7615
|
title: "Toggle menu bar",
|
|
7318
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
|
7616
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { focusable: "false" })
|
|
7319
7617
|
}
|
|
7320
7618
|
) }),
|
|
7321
|
-
/* @__PURE__ */ (0,
|
|
7619
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7322
7620
|
MenuBar,
|
|
7323
7621
|
{
|
|
7324
7622
|
appState,
|
|
7325
7623
|
dispatch,
|
|
7326
7624
|
onPublish,
|
|
7327
7625
|
menuOpen,
|
|
7328
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
|
7626
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7329
7627
|
Button,
|
|
7330
7628
|
{
|
|
7331
7629
|
onClick: () => {
|
|
7332
7630
|
onPublish && onPublish(data);
|
|
7333
7631
|
},
|
|
7334
|
-
icon: /* @__PURE__ */ (0,
|
|
7632
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
|
|
7335
7633
|
children: "Publish"
|
|
7336
7634
|
}
|
|
7337
7635
|
) }),
|
|
@@ -7342,19 +7640,19 @@ function Puck({
|
|
|
7342
7640
|
] }) })
|
|
7343
7641
|
}
|
|
7344
7642
|
),
|
|
7345
|
-
/* @__PURE__ */ (0,
|
|
7346
|
-
/* @__PURE__ */ (0,
|
|
7347
|
-
/* @__PURE__ */ (0,
|
|
7643
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
|
7644
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Components, {}) }),
|
|
7645
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Outline, {}) })
|
|
7348
7646
|
] }),
|
|
7349
|
-
/* @__PURE__ */ (0,
|
|
7350
|
-
/* @__PURE__ */ (0,
|
|
7647
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Canvas, {}),
|
|
7648
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7351
7649
|
SidebarSection,
|
|
7352
7650
|
{
|
|
7353
7651
|
noPadding: true,
|
|
7354
7652
|
noBorderTop: true,
|
|
7355
7653
|
showBreadcrumbs: true,
|
|
7356
7654
|
title: selectedItem ? selectedComponentLabel : "Page",
|
|
7357
|
-
children: /* @__PURE__ */ (0,
|
|
7655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Fields, {})
|
|
7358
7656
|
}
|
|
7359
7657
|
) })
|
|
7360
7658
|
] })
|
|
@@ -7362,13 +7660,13 @@ function Puck({
|
|
|
7362
7660
|
) }) })
|
|
7363
7661
|
}
|
|
7364
7662
|
),
|
|
7365
|
-
/* @__PURE__ */ (0,
|
|
7663
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
|
7366
7664
|
] });
|
|
7367
7665
|
}
|
|
7368
7666
|
Puck.Components = Components;
|
|
7369
7667
|
Puck.Fields = Fields;
|
|
7370
7668
|
Puck.Outline = Outline;
|
|
7371
|
-
Puck.Preview =
|
|
7669
|
+
Puck.Preview = Preview2;
|
|
7372
7670
|
|
|
7373
7671
|
// lib/migrate.ts
|
|
7374
7672
|
init_react_import();
|