@measured/puck 0.20.0-canary.755737e8 → 0.20.0-canary.f768aab9
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/README.md +24 -20
- package/dist/{chunk-IM42S4YL.mjs → chunk-H6KSTNLT.mjs} +49 -7
- package/dist/index.css +256 -364
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1198 -1254
- package/dist/index.mjs +923 -1021
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +49 -7
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-6PP75PCU.d.mts → walk-tree-BOSl1o0G.d.mts} +20 -32
- package/dist/{walk-tree-6PP75PCU.d.ts → walk-tree-BOSl1o0G.d.ts} +20 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -458,20 +458,6 @@ var Globe = createLucideIcon("Globe", [
|
|
|
458
458
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
459
459
|
]);
|
|
460
460
|
|
|
461
|
-
// ../../node_modules/lucide-react/dist/esm/icons/hammer.js
|
|
462
|
-
init_react_import();
|
|
463
|
-
var Hammer = createLucideIcon("Hammer", [
|
|
464
|
-
["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
|
|
465
|
-
["path", { d: "m18 15 4-4", key: "16gjal" }],
|
|
466
|
-
[
|
|
467
|
-
"path",
|
|
468
|
-
{
|
|
469
|
-
d: "m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",
|
|
470
|
-
key: "b7pghm"
|
|
471
|
-
}
|
|
472
|
-
]
|
|
473
|
-
]);
|
|
474
|
-
|
|
475
461
|
// ../../node_modules/lucide-react/dist/esm/icons/hash.js
|
|
476
462
|
init_react_import();
|
|
477
463
|
var Hash = createLucideIcon("Hash", [
|
|
@@ -619,14 +605,6 @@ var Tablet = createLucideIcon("Tablet", [
|
|
|
619
605
|
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
|
620
606
|
]);
|
|
621
607
|
|
|
622
|
-
// ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
|
|
623
|
-
init_react_import();
|
|
624
|
-
var ToyBrick = createLucideIcon("ToyBrick", [
|
|
625
|
-
["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
|
|
626
|
-
["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
|
|
627
|
-
["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
|
|
628
|
-
]);
|
|
629
|
-
|
|
630
608
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
|
631
609
|
init_react_import();
|
|
632
610
|
var Trash = createLucideIcon("Trash", [
|
|
@@ -1649,8 +1627,8 @@ var migrations = [
|
|
|
1649
1627
|
return data;
|
|
1650
1628
|
},
|
|
1651
1629
|
// Migrate zones to slots
|
|
1652
|
-
(data, config) => {
|
|
1653
|
-
var _a;
|
|
1630
|
+
(data, config, migrationOptions) => {
|
|
1631
|
+
var _a, _b;
|
|
1654
1632
|
if (!config) return data;
|
|
1655
1633
|
console.log("Migrating DropZones to slots...");
|
|
1656
1634
|
const updatedItems = {};
|
|
@@ -1658,13 +1636,13 @@ var migrations = [
|
|
|
1658
1636
|
const { indexes } = walkAppState(appState, config);
|
|
1659
1637
|
const deletedCompounds = [];
|
|
1660
1638
|
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
|
1661
|
-
var _a2,
|
|
1639
|
+
var _a2, _b2, _c;
|
|
1662
1640
|
if (zoneType === "dropzone") {
|
|
1663
1641
|
const [id, slotName] = zoneCompound.split(":");
|
|
1664
1642
|
const nodeData = indexes.nodes[id].data;
|
|
1665
1643
|
const componentType = nodeData.type;
|
|
1666
1644
|
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
|
1667
|
-
if (((
|
|
1645
|
+
if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
|
|
1668
1646
|
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
|
1669
1647
|
props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
|
|
1670
1648
|
[slotName]: content
|
|
@@ -1693,7 +1671,49 @@ var migrations = [
|
|
|
1693
1671
|
);
|
|
1694
1672
|
(_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
|
|
1695
1673
|
});
|
|
1696
|
-
|
|
1674
|
+
if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
|
|
1675
|
+
const unmigratedZonesGrouped = {};
|
|
1676
|
+
Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
|
|
1677
|
+
var _a2;
|
|
1678
|
+
const [componentId, propName] = zoneCompound.split(":");
|
|
1679
|
+
const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
|
|
1680
|
+
if (!content) {
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
if (!unmigratedZonesGrouped[componentId]) {
|
|
1684
|
+
unmigratedZonesGrouped[componentId] = {};
|
|
1685
|
+
}
|
|
1686
|
+
if (!unmigratedZonesGrouped[componentId][propName]) {
|
|
1687
|
+
unmigratedZonesGrouped[componentId][propName] = content;
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
|
|
1691
|
+
updated.data = walkTree(updated.data, config, (content) => {
|
|
1692
|
+
return content.map((child) => {
|
|
1693
|
+
var _a2;
|
|
1694
|
+
if (child.props.id !== componentId) {
|
|
1695
|
+
return child;
|
|
1696
|
+
}
|
|
1697
|
+
const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
|
|
1698
|
+
if (!migrateFn) {
|
|
1699
|
+
return child;
|
|
1700
|
+
}
|
|
1701
|
+
const zones = unmigratedZonesGrouped[componentId];
|
|
1702
|
+
const migratedProps = migrateFn(child.props, zones);
|
|
1703
|
+
Object.keys(zones).forEach((propName) => {
|
|
1704
|
+
var _a3;
|
|
1705
|
+
const zoneCompound = `${componentId}:${propName}`;
|
|
1706
|
+
console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
|
|
1707
|
+
(_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
|
|
1708
|
+
});
|
|
1709
|
+
return __spreadProps(__spreadValues({}, child), {
|
|
1710
|
+
props: migratedProps
|
|
1711
|
+
});
|
|
1712
|
+
});
|
|
1713
|
+
});
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
|
|
1697
1717
|
const [_, propName] = zoneCompound.split(":");
|
|
1698
1718
|
throw new Error(
|
|
1699
1719
|
`Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
|
|
@@ -1703,9 +1723,9 @@ var migrations = [
|
|
|
1703
1723
|
return updated.data;
|
|
1704
1724
|
}
|
|
1705
1725
|
];
|
|
1706
|
-
function migrate(data, config) {
|
|
1726
|
+
function migrate(data, config, migrationOptions) {
|
|
1707
1727
|
return migrations == null ? void 0 : migrations.reduce(
|
|
1708
|
-
(acc, migration) => migration(acc, config),
|
|
1728
|
+
(acc, migration) => migration(acc, config, migrationOptions),
|
|
1709
1729
|
data
|
|
1710
1730
|
);
|
|
1711
1731
|
}
|
|
@@ -2202,11 +2222,18 @@ var monitorHotkeys = (doc) => {
|
|
|
2202
2222
|
}
|
|
2203
2223
|
}
|
|
2204
2224
|
};
|
|
2225
|
+
const onVisibilityChanged = (e) => {
|
|
2226
|
+
if (document.visibilityState === "hidden") {
|
|
2227
|
+
useHotkeyStore.getState().reset();
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2205
2230
|
doc.addEventListener("keydown", onKeyDown);
|
|
2206
2231
|
doc.addEventListener("keyup", onKeyUp);
|
|
2232
|
+
doc.addEventListener("visibilitychange", onVisibilityChanged);
|
|
2207
2233
|
return () => {
|
|
2208
2234
|
doc.removeEventListener("keydown", onKeyDown);
|
|
2209
2235
|
doc.removeEventListener("keyup", onKeyUp);
|
|
2236
|
+
doc.removeEventListener("visibilitychange", onVisibilityChanged);
|
|
2210
2237
|
};
|
|
2211
2238
|
};
|
|
2212
2239
|
var useMonitorHotkeys = () => {
|
|
@@ -2301,7 +2328,7 @@ var createHistorySlice = (set, get) => {
|
|
|
2301
2328
|
const { dispatch, history } = get();
|
|
2302
2329
|
dispatch({
|
|
2303
2330
|
type: "set",
|
|
2304
|
-
state: ((_a =
|
|
2331
|
+
state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
|
|
2305
2332
|
});
|
|
2306
2333
|
set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
|
|
2307
2334
|
},
|
|
@@ -3986,6 +4013,7 @@ var ExternalInput = ({
|
|
|
3986
4013
|
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3987
4014
|
IconButton,
|
|
3988
4015
|
{
|
|
4016
|
+
type: "button",
|
|
3989
4017
|
title: "Toggle filters",
|
|
3990
4018
|
onClick: (e) => {
|
|
3991
4019
|
e.preventDefault();
|
|
@@ -4333,9 +4361,8 @@ var ObjectField = ({
|
|
|
4333
4361
|
readOnly,
|
|
4334
4362
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
|
4335
4363
|
const subField = field.objectFields[subName];
|
|
4336
|
-
const subPath = `${
|
|
4337
|
-
const
|
|
4338
|
-
const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
|
|
4364
|
+
const subPath = `${localName}.${subName}`;
|
|
4365
|
+
const subReadOnly = readOnly ? readOnly : readOnlyFields[subPath];
|
|
4339
4366
|
const label2 = subField.label || subName;
|
|
4340
4367
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4341
4368
|
NestedFieldProvider,
|
|
@@ -4434,7 +4461,7 @@ var FieldLabelInternal = ({
|
|
|
4434
4461
|
);
|
|
4435
4462
|
};
|
|
4436
4463
|
function AutoFieldInternal(props) {
|
|
4437
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4464
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4438
4465
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
4439
4466
|
const overrides = useAppStore((s) => s.overrides);
|
|
4440
4467
|
const readOnly = useAppStore((s) => {
|
|
@@ -4506,21 +4533,23 @@ function AutoFieldInternal(props) {
|
|
|
4506
4533
|
if (field.type === "slot") {
|
|
4507
4534
|
return null;
|
|
4508
4535
|
}
|
|
4536
|
+
let children = null;
|
|
4537
|
+
let FieldComponent;
|
|
4509
4538
|
if (field.type === "custom") {
|
|
4510
4539
|
if (!field.render) {
|
|
4511
4540
|
return null;
|
|
4512
4541
|
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4542
|
+
FieldComponent = field.render;
|
|
4543
|
+
} else {
|
|
4544
|
+
children = defaultFields[field.type](mergedProps);
|
|
4545
|
+
FieldComponent = render[field.type];
|
|
4515
4546
|
}
|
|
4516
|
-
const children = defaultFields[field.type](mergedProps);
|
|
4517
|
-
const Render3 = render[field.type];
|
|
4518
4547
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4519
4548
|
NestedFieldContext.Provider,
|
|
4520
4549
|
{
|
|
4521
4550
|
value: {
|
|
4522
4551
|
readOnlyFields: nestedFieldContext.readOnlyFields || readOnly || {},
|
|
4523
|
-
localName: nestedFieldContext.localName
|
|
4552
|
+
localName: (_i = nestedFieldContext.localName) != null ? _i : mergedProps.name
|
|
4524
4553
|
},
|
|
4525
4554
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4526
4555
|
"div",
|
|
@@ -4531,7 +4560,7 @@ function AutoFieldInternal(props) {
|
|
|
4531
4560
|
onClick: (e) => {
|
|
4532
4561
|
e.stopPropagation();
|
|
4533
4562
|
},
|
|
4534
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FieldComponent, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
|
4535
4564
|
}
|
|
4536
4565
|
)
|
|
4537
4566
|
}
|
|
@@ -5876,7 +5905,7 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
|
|
|
5876
5905
|
const ctx = (0, import_react35.useContext)(dropZoneContext);
|
|
5877
5906
|
const { areaId = "root" } = ctx || {};
|
|
5878
5907
|
const { config, data, metadata } = (0, import_react35.useContext)(renderContext);
|
|
5879
|
-
let zoneCompound =
|
|
5908
|
+
let zoneCompound = `${areaId}:${zone}`;
|
|
5880
5909
|
let content = (data == null ? void 0 : data.content) || [];
|
|
5881
5910
|
(0, import_react35.useEffect)(() => {
|
|
5882
5911
|
if (!content) {
|
|
@@ -5893,8 +5922,7 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
|
|
|
5893
5922
|
if (!data || !config) {
|
|
5894
5923
|
return null;
|
|
5895
5924
|
}
|
|
5896
|
-
if (
|
|
5897
|
-
zoneCompound = `${areaId}:${zone}`;
|
|
5925
|
+
if (zoneCompound !== rootDroppableId) {
|
|
5898
5926
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5899
5927
|
}
|
|
5900
5928
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
@@ -6791,24 +6819,121 @@ Drawer.Item = DrawerItem;
|
|
|
6791
6819
|
|
|
6792
6820
|
// components/Puck/index.tsx
|
|
6793
6821
|
init_react_import();
|
|
6794
|
-
var
|
|
6822
|
+
var import_react56 = require("react");
|
|
6823
|
+
|
|
6824
|
+
// components/SidebarSection/index.tsx
|
|
6825
|
+
init_react_import();
|
|
6826
|
+
|
|
6827
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
6828
|
+
init_react_import();
|
|
6829
|
+
var styles_module_default13 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
|
|
6830
|
+
|
|
6831
|
+
// lib/use-breadcrumbs.ts
|
|
6832
|
+
init_react_import();
|
|
6833
|
+
var import_react41 = require("react");
|
|
6834
|
+
var useBreadcrumbs = (renderCount) => {
|
|
6835
|
+
const selectedId = useAppStore((s) => {
|
|
6836
|
+
var _a;
|
|
6837
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
6838
|
+
});
|
|
6839
|
+
const config = useAppStore((s) => s.config);
|
|
6840
|
+
const path = useAppStore((s) => {
|
|
6841
|
+
var _a;
|
|
6842
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
6843
|
+
});
|
|
6844
|
+
const appStore = useAppStoreApi();
|
|
6845
|
+
return (0, import_react41.useMemo)(() => {
|
|
6846
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
6847
|
+
var _a, _b, _c;
|
|
6848
|
+
const [componentId] = zoneCompound.split(":");
|
|
6849
|
+
if (componentId === "root") {
|
|
6850
|
+
return {
|
|
6851
|
+
label: "Page",
|
|
6852
|
+
selector: null
|
|
6853
|
+
};
|
|
6854
|
+
}
|
|
6855
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
6856
|
+
const parentId = node.path[node.path.length - 1];
|
|
6857
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
6858
|
+
const index = contentIds.indexOf(componentId);
|
|
6859
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
6860
|
+
return {
|
|
6861
|
+
label,
|
|
6862
|
+
selector: node ? {
|
|
6863
|
+
index,
|
|
6864
|
+
zone: node.path[node.path.length - 1]
|
|
6865
|
+
} : null
|
|
6866
|
+
};
|
|
6867
|
+
})) || [];
|
|
6868
|
+
if (renderCount) {
|
|
6869
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
6870
|
+
}
|
|
6871
|
+
return breadcrumbs;
|
|
6872
|
+
}, [path, renderCount]);
|
|
6873
|
+
};
|
|
6874
|
+
|
|
6875
|
+
// components/SidebarSection/index.tsx
|
|
6876
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6877
|
+
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
|
6878
|
+
var SidebarSection = ({
|
|
6879
|
+
children,
|
|
6880
|
+
title,
|
|
6881
|
+
background,
|
|
6882
|
+
showBreadcrumbs,
|
|
6883
|
+
noBorderTop,
|
|
6884
|
+
noPadding,
|
|
6885
|
+
isLoading
|
|
6886
|
+
}) => {
|
|
6887
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
6888
|
+
const breadcrumbs = useBreadcrumbs(1);
|
|
6889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
6890
|
+
"div",
|
|
6891
|
+
{
|
|
6892
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
|
6893
|
+
style: { background },
|
|
6894
|
+
children: [
|
|
6895
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
|
6896
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
|
6897
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6898
|
+
"button",
|
|
6899
|
+
{
|
|
6900
|
+
type: "button",
|
|
6901
|
+
className: getClassName19("breadcrumbLabel"),
|
|
6902
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
6903
|
+
children: breadcrumb.label
|
|
6904
|
+
}
|
|
6905
|
+
),
|
|
6906
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
|
|
6907
|
+
] }, i)) : null,
|
|
6908
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
6909
|
+
] }) }),
|
|
6910
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
|
|
6911
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
|
|
6912
|
+
]
|
|
6913
|
+
}
|
|
6914
|
+
);
|
|
6915
|
+
};
|
|
6916
|
+
|
|
6917
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
|
6918
|
+
init_react_import();
|
|
6919
|
+
var styles_module_default14 = { "Puck": "_Puck_dnlfp_19", "Puck-portal": "_Puck-portal_dnlfp_31", "PuckLayout-inner": "_PuckLayout-inner_dnlfp_38", "PuckLayout--mounted": "_PuckLayout--mounted_dnlfp_50", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_dnlfp_54", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_dnlfp_60", "PuckLayout-mounted": "_PuckLayout-mounted_dnlfp_74", "PuckLayout": "_PuckLayout_dnlfp_38", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_dnlfp_115", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_dnlfp_124" };
|
|
6795
6920
|
|
|
6796
6921
|
// components/Puck/components/Fields/index.tsx
|
|
6797
6922
|
init_react_import();
|
|
6798
6923
|
|
|
6799
6924
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
|
6800
6925
|
init_react_import();
|
|
6801
|
-
var
|
|
6926
|
+
var styles_module_default15 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
|
|
6802
6927
|
|
|
6803
6928
|
// components/Puck/components/Fields/index.tsx
|
|
6804
|
-
var
|
|
6929
|
+
var import_react42 = require("react");
|
|
6805
6930
|
var import_shallow5 = require("zustand/react/shallow");
|
|
6806
|
-
var
|
|
6807
|
-
var
|
|
6931
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6932
|
+
var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
|
|
6808
6933
|
var DefaultFields = ({
|
|
6809
6934
|
children
|
|
6810
6935
|
}) => {
|
|
6811
|
-
return /* @__PURE__ */ (0,
|
|
6936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
|
|
6812
6937
|
};
|
|
6813
6938
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
|
|
6814
6939
|
let currentProps;
|
|
@@ -6874,13 +6999,13 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
6874
6999
|
})
|
|
6875
7000
|
);
|
|
6876
7001
|
const appStore = useAppStoreApi();
|
|
6877
|
-
const onChange = (0,
|
|
7002
|
+
const onChange = (0, import_react42.useCallback)(createOnChange(fieldName, appStore), [
|
|
6878
7003
|
fieldName
|
|
6879
7004
|
]);
|
|
6880
7005
|
const { visible = true } = field != null ? field : {};
|
|
6881
7006
|
if (!field || !id || !visible) return null;
|
|
6882
7007
|
if (field.type === "slot") return null;
|
|
6883
|
-
return /* @__PURE__ */ (0,
|
|
7008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("field"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6884
7009
|
AutoFieldPrivate,
|
|
6885
7010
|
{
|
|
6886
7011
|
field,
|
|
@@ -6892,7 +7017,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
6892
7017
|
}
|
|
6893
7018
|
) }, id);
|
|
6894
7019
|
};
|
|
6895
|
-
var FieldsChildMemo = (0,
|
|
7020
|
+
var FieldsChildMemo = (0, import_react42.memo)(FieldsChild);
|
|
6896
7021
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
6897
7022
|
const overrides = useAppStore((s) => s.overrides);
|
|
6898
7023
|
const componentResolving = useAppStore((s) => {
|
|
@@ -6917,40 +7042,40 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
6917
7042
|
})
|
|
6918
7043
|
);
|
|
6919
7044
|
const isLoading = fieldsLoading || componentResolving;
|
|
6920
|
-
const Wrapper = (0,
|
|
6921
|
-
return /* @__PURE__ */ (0,
|
|
7045
|
+
const Wrapper = (0, import_react42.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
7046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
6922
7047
|
"form",
|
|
6923
7048
|
{
|
|
6924
|
-
className:
|
|
7049
|
+
className: getClassName20({ wrapFields }),
|
|
6925
7050
|
onSubmit: (e) => {
|
|
6926
7051
|
e.preventDefault();
|
|
6927
7052
|
},
|
|
6928
7053
|
children: [
|
|
6929
|
-
/* @__PURE__ */ (0,
|
|
6930
|
-
isLoading && /* @__PURE__ */ (0,
|
|
7054
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
7055
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Loader, { size: 16 }) }) })
|
|
6931
7056
|
]
|
|
6932
7057
|
}
|
|
6933
7058
|
);
|
|
6934
7059
|
};
|
|
6935
|
-
var Fields = (0,
|
|
7060
|
+
var Fields = (0, import_react42.memo)(FieldsInternal);
|
|
6936
7061
|
|
|
6937
7062
|
// components/Puck/components/Components/index.tsx
|
|
6938
7063
|
init_react_import();
|
|
6939
7064
|
|
|
6940
7065
|
// lib/use-component-list.tsx
|
|
6941
7066
|
init_react_import();
|
|
6942
|
-
var
|
|
7067
|
+
var import_react43 = require("react");
|
|
6943
7068
|
|
|
6944
7069
|
// components/ComponentList/index.tsx
|
|
6945
7070
|
init_react_import();
|
|
6946
7071
|
|
|
6947
7072
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
|
6948
7073
|
init_react_import();
|
|
6949
|
-
var
|
|
7074
|
+
var styles_module_default16 = { "ComponentList": "_ComponentList_1rrlt_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1rrlt_5", "ComponentList-content": "_ComponentList-content_1rrlt_9", "ComponentList-title": "_ComponentList-title_1rrlt_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1rrlt_53" };
|
|
6950
7075
|
|
|
6951
7076
|
// components/ComponentList/index.tsx
|
|
6952
|
-
var
|
|
6953
|
-
var
|
|
7077
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7078
|
+
var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
|
|
6954
7079
|
var ComponentListItem = ({
|
|
6955
7080
|
name,
|
|
6956
7081
|
label
|
|
@@ -6961,7 +7086,7 @@ var ComponentListItem = ({
|
|
|
6961
7086
|
type: name
|
|
6962
7087
|
}).insert
|
|
6963
7088
|
);
|
|
6964
|
-
return /* @__PURE__ */ (0,
|
|
7089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
|
6965
7090
|
};
|
|
6966
7091
|
var ComponentList = ({
|
|
6967
7092
|
children,
|
|
@@ -6972,12 +7097,12 @@ var ComponentList = ({
|
|
|
6972
7097
|
const setUi = useAppStore((s) => s.setUi);
|
|
6973
7098
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
6974
7099
|
const { expanded = true } = componentList[id] || {};
|
|
6975
|
-
return /* @__PURE__ */ (0,
|
|
6976
|
-
title && /* @__PURE__ */ (0,
|
|
7100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName21({ isExpanded: expanded }), children: [
|
|
7101
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6977
7102
|
"button",
|
|
6978
7103
|
{
|
|
6979
7104
|
type: "button",
|
|
6980
|
-
className:
|
|
7105
|
+
className: getClassName21("title"),
|
|
6981
7106
|
onClick: () => setUi({
|
|
6982
7107
|
componentList: __spreadProps(__spreadValues({}, componentList), {
|
|
6983
7108
|
[id]: __spreadProps(__spreadValues({}, componentList[id]), {
|
|
@@ -6987,14 +7112,14 @@ var ComponentList = ({
|
|
|
6987
7112
|
}),
|
|
6988
7113
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
6989
7114
|
children: [
|
|
6990
|
-
/* @__PURE__ */ (0,
|
|
6991
|
-
/* @__PURE__ */ (0,
|
|
7115
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: title }),
|
|
7116
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: 12 }) })
|
|
6992
7117
|
]
|
|
6993
7118
|
}
|
|
6994
7119
|
),
|
|
6995
|
-
/* @__PURE__ */ (0,
|
|
7120
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("content"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
6996
7121
|
var _a;
|
|
6997
|
-
return /* @__PURE__ */ (0,
|
|
7122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6998
7123
|
ComponentListItem,
|
|
6999
7124
|
{
|
|
7000
7125
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -7008,12 +7133,12 @@ var ComponentList = ({
|
|
|
7008
7133
|
ComponentList.Item = ComponentListItem;
|
|
7009
7134
|
|
|
7010
7135
|
// lib/use-component-list.tsx
|
|
7011
|
-
var
|
|
7136
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7012
7137
|
var useComponentList = () => {
|
|
7013
|
-
const [componentList, setComponentList] = (0,
|
|
7138
|
+
const [componentList, setComponentList] = (0, import_react43.useState)();
|
|
7014
7139
|
const config = useAppStore((s) => s.config);
|
|
7015
7140
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
7016
|
-
(0,
|
|
7141
|
+
(0, import_react43.useEffect)(() => {
|
|
7017
7142
|
var _a, _b, _c;
|
|
7018
7143
|
if (Object.keys(uiComponentList).length > 0) {
|
|
7019
7144
|
const matchedComponents = [];
|
|
@@ -7023,7 +7148,7 @@ var useComponentList = () => {
|
|
|
7023
7148
|
if (category.visible === false || !category.components) {
|
|
7024
7149
|
return null;
|
|
7025
7150
|
}
|
|
7026
|
-
return /* @__PURE__ */ (0,
|
|
7151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7027
7152
|
ComponentList,
|
|
7028
7153
|
{
|
|
7029
7154
|
id: categoryKey,
|
|
@@ -7032,7 +7157,7 @@ var useComponentList = () => {
|
|
|
7032
7157
|
var _a2;
|
|
7033
7158
|
matchedComponents.push(componentName);
|
|
7034
7159
|
const componentConf = config.components[componentName] || {};
|
|
7035
|
-
return /* @__PURE__ */ (0,
|
|
7160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7036
7161
|
ComponentList.Item,
|
|
7037
7162
|
{
|
|
7038
7163
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -7052,7 +7177,7 @@ var useComponentList = () => {
|
|
|
7052
7177
|
);
|
|
7053
7178
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
7054
7179
|
_componentList.push(
|
|
7055
|
-
/* @__PURE__ */ (0,
|
|
7180
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7056
7181
|
ComponentList,
|
|
7057
7182
|
{
|
|
7058
7183
|
id: "other",
|
|
@@ -7060,7 +7185,7 @@ var useComponentList = () => {
|
|
|
7060
7185
|
children: remainingComponents.map((componentName, i) => {
|
|
7061
7186
|
var _a2;
|
|
7062
7187
|
const componentConf = config.components[componentName] || {};
|
|
7063
|
-
return /* @__PURE__ */ (0,
|
|
7188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7064
7189
|
ComponentList.Item,
|
|
7065
7190
|
{
|
|
7066
7191
|
name: componentName,
|
|
@@ -7082,30 +7207,37 @@ var useComponentList = () => {
|
|
|
7082
7207
|
};
|
|
7083
7208
|
|
|
7084
7209
|
// components/Puck/components/Components/index.tsx
|
|
7085
|
-
var
|
|
7086
|
-
var
|
|
7210
|
+
var import_react44 = require("react");
|
|
7211
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7087
7212
|
var Components = () => {
|
|
7088
7213
|
const overrides = useAppStore((s) => s.overrides);
|
|
7089
7214
|
const componentList = useComponentList();
|
|
7090
|
-
const Wrapper = (0,
|
|
7091
|
-
return /* @__PURE__ */ (0,
|
|
7215
|
+
const Wrapper = (0, import_react44.useMemo)(() => overrides.components || "div", [overrides]);
|
|
7216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComponentList, { id: "all" }) });
|
|
7092
7217
|
};
|
|
7093
7218
|
|
|
7094
7219
|
// components/Puck/components/Preview/index.tsx
|
|
7095
7220
|
init_react_import();
|
|
7096
|
-
var
|
|
7221
|
+
var import_react46 = require("react");
|
|
7097
7222
|
|
|
7098
7223
|
// components/AutoFrame/index.tsx
|
|
7099
7224
|
init_react_import();
|
|
7100
|
-
var
|
|
7225
|
+
var import_react45 = require("react");
|
|
7101
7226
|
var import_object_hash = __toESM(require("object-hash"));
|
|
7102
7227
|
var import_react_dom3 = require("react-dom");
|
|
7103
|
-
var
|
|
7228
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7104
7229
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
7105
7230
|
var collectStyles = (doc) => {
|
|
7106
7231
|
const collected = [];
|
|
7107
7232
|
doc.querySelectorAll(styleSelector).forEach((style) => {
|
|
7108
|
-
|
|
7233
|
+
if (style.tagName === "STYLE") {
|
|
7234
|
+
const hasContent = !!style.innerHTML.trim();
|
|
7235
|
+
if (hasContent) {
|
|
7236
|
+
collected.push(style);
|
|
7237
|
+
}
|
|
7238
|
+
} else {
|
|
7239
|
+
collected.push(style);
|
|
7240
|
+
}
|
|
7109
7241
|
});
|
|
7110
7242
|
return collected;
|
|
7111
7243
|
};
|
|
@@ -7118,7 +7250,7 @@ var getStyleSheet = (el) => {
|
|
|
7118
7250
|
var getStyles = (styleSheet) => {
|
|
7119
7251
|
if (styleSheet) {
|
|
7120
7252
|
try {
|
|
7121
|
-
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
|
7253
|
+
return [...Array.from(styleSheet.cssRules)].map((rule) => rule.cssText).join("");
|
|
7122
7254
|
} catch (e) {
|
|
7123
7255
|
console.warn(
|
|
7124
7256
|
"Access to stylesheet %s is denied. Ignoring\u2026",
|
|
@@ -7143,7 +7275,7 @@ var CopyHostStyles = ({
|
|
|
7143
7275
|
onStylesLoaded = () => null
|
|
7144
7276
|
}) => {
|
|
7145
7277
|
const { document: doc, window: win } = useFrame();
|
|
7146
|
-
(0,
|
|
7278
|
+
(0, import_react45.useEffect)(() => {
|
|
7147
7279
|
if (!win || !doc) {
|
|
7148
7280
|
return () => {
|
|
7149
7281
|
};
|
|
@@ -7300,10 +7432,10 @@ var CopyHostStyles = ({
|
|
|
7300
7432
|
observer.disconnect();
|
|
7301
7433
|
};
|
|
7302
7434
|
}, []);
|
|
7303
|
-
return /* @__PURE__ */ (0,
|
|
7435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|
|
7304
7436
|
};
|
|
7305
|
-
var autoFrameContext = (0,
|
|
7306
|
-
var useFrame = () => (0,
|
|
7437
|
+
var autoFrameContext = (0, import_react45.createContext)({});
|
|
7438
|
+
var useFrame = () => (0, import_react45.useContext)(autoFrameContext);
|
|
7307
7439
|
function AutoFrame(_a) {
|
|
7308
7440
|
var _b = _a, {
|
|
7309
7441
|
children,
|
|
@@ -7324,11 +7456,11 @@ function AutoFrame(_a) {
|
|
|
7324
7456
|
"onNotReady",
|
|
7325
7457
|
"frameRef"
|
|
7326
7458
|
]);
|
|
7327
|
-
const [loaded, setLoaded] = (0,
|
|
7328
|
-
const [ctx, setCtx] = (0,
|
|
7329
|
-
const [mountTarget, setMountTarget] = (0,
|
|
7330
|
-
const [stylesLoaded, setStylesLoaded] = (0,
|
|
7331
|
-
(0,
|
|
7459
|
+
const [loaded, setLoaded] = (0, import_react45.useState)(false);
|
|
7460
|
+
const [ctx, setCtx] = (0, import_react45.useState)({});
|
|
7461
|
+
const [mountTarget, setMountTarget] = (0, import_react45.useState)();
|
|
7462
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react45.useState)(false);
|
|
7463
|
+
(0, import_react45.useEffect)(() => {
|
|
7332
7464
|
var _a2;
|
|
7333
7465
|
if (frameRef.current) {
|
|
7334
7466
|
const doc = frameRef.current.contentDocument;
|
|
@@ -7347,7 +7479,7 @@ function AutoFrame(_a) {
|
|
|
7347
7479
|
}
|
|
7348
7480
|
}
|
|
7349
7481
|
}, [frameRef, loaded, stylesLoaded]);
|
|
7350
|
-
return /* @__PURE__ */ (0,
|
|
7482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7351
7483
|
"iframe",
|
|
7352
7484
|
__spreadProps(__spreadValues({}, props), {
|
|
7353
7485
|
className,
|
|
@@ -7357,7 +7489,7 @@ function AutoFrame(_a) {
|
|
|
7357
7489
|
onLoad: () => {
|
|
7358
7490
|
setLoaded(true);
|
|
7359
7491
|
},
|
|
7360
|
-
children: /* @__PURE__ */ (0,
|
|
7492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7361
7493
|
CopyHostStyles,
|
|
7362
7494
|
{
|
|
7363
7495
|
debug,
|
|
@@ -7373,14 +7505,14 @@ var AutoFrame_default = AutoFrame;
|
|
|
7373
7505
|
|
|
7374
7506
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
|
7375
7507
|
init_react_import();
|
|
7376
|
-
var
|
|
7508
|
+
var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
|
7377
7509
|
|
|
7378
7510
|
// components/Puck/components/Preview/index.tsx
|
|
7379
|
-
var
|
|
7380
|
-
var
|
|
7511
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7512
|
+
var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
|
|
7381
7513
|
var useBubbleIframeEvents = (ref) => {
|
|
7382
7514
|
const status = useAppStore((s) => s.status);
|
|
7383
|
-
(0,
|
|
7515
|
+
(0, import_react46.useEffect)(() => {
|
|
7384
7516
|
if (ref.current && status === "READY") {
|
|
7385
7517
|
const iframe = ref.current;
|
|
7386
7518
|
const handlePointerMove = (event) => {
|
|
@@ -7429,7 +7561,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7429
7561
|
const renderData = useAppStore(
|
|
7430
7562
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
7431
7563
|
);
|
|
7432
|
-
const Page = (0,
|
|
7564
|
+
const Page = (0, import_react46.useCallback)(
|
|
7433
7565
|
(pageProps) => {
|
|
7434
7566
|
var _a, _b;
|
|
7435
7567
|
const propsWithSlots = useSlots(
|
|
@@ -7439,15 +7571,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7439
7571
|
);
|
|
7440
7572
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
|
7441
7573
|
id: "puck-root"
|
|
7442
|
-
}, propsWithSlots)) : /* @__PURE__ */ (0,
|
|
7574
|
+
}, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: propsWithSlots.children });
|
|
7443
7575
|
},
|
|
7444
7576
|
[config]
|
|
7445
7577
|
);
|
|
7446
|
-
const Frame = (0,
|
|
7578
|
+
const Frame = (0, import_react46.useMemo)(() => overrides.iframe, [overrides]);
|
|
7447
7579
|
const rootProps = root.props || root;
|
|
7448
|
-
const ref = (0,
|
|
7580
|
+
const ref = (0, import_react46.useRef)(null);
|
|
7449
7581
|
useBubbleIframeEvents(ref);
|
|
7450
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
|
7582
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7451
7583
|
Page,
|
|
7452
7584
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
7453
7585
|
puck: {
|
|
@@ -7457,28 +7589,28 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7457
7589
|
metadata
|
|
7458
7590
|
},
|
|
7459
7591
|
editMode: true,
|
|
7460
|
-
children: /* @__PURE__ */ (0,
|
|
7592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
|
|
7461
7593
|
})
|
|
7462
|
-
) : /* @__PURE__ */ (0,
|
|
7463
|
-
(0,
|
|
7594
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render2, { data: renderData, config });
|
|
7595
|
+
(0, import_react46.useEffect)(() => {
|
|
7464
7596
|
if (!iframe.enabled) {
|
|
7465
7597
|
setStatus("READY");
|
|
7466
7598
|
}
|
|
7467
7599
|
}, [iframe.enabled]);
|
|
7468
|
-
return /* @__PURE__ */ (0,
|
|
7600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7469
7601
|
"div",
|
|
7470
7602
|
{
|
|
7471
|
-
className:
|
|
7603
|
+
className: getClassName22(),
|
|
7472
7604
|
id,
|
|
7473
7605
|
"data-puck-preview": true,
|
|
7474
7606
|
onClick: () => {
|
|
7475
7607
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
7476
7608
|
},
|
|
7477
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
|
7609
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7478
7610
|
AutoFrame_default,
|
|
7479
7611
|
{
|
|
7480
7612
|
id: "preview-frame",
|
|
7481
|
-
className:
|
|
7613
|
+
className: getClassName22("frame"),
|
|
7482
7614
|
"data-rfd-iframe": true,
|
|
7483
7615
|
onReady: () => {
|
|
7484
7616
|
setStatus("READY");
|
|
@@ -7487,18 +7619,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7487
7619
|
setStatus("MOUNTED");
|
|
7488
7620
|
},
|
|
7489
7621
|
frameRef: ref,
|
|
7490
|
-
children: /* @__PURE__ */ (0,
|
|
7622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
7491
7623
|
if (Frame) {
|
|
7492
|
-
return /* @__PURE__ */ (0,
|
|
7624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Frame, { document: document2, children: inner });
|
|
7493
7625
|
}
|
|
7494
7626
|
return inner;
|
|
7495
7627
|
} })
|
|
7496
7628
|
}
|
|
7497
|
-
) : /* @__PURE__ */ (0,
|
|
7629
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7498
7630
|
"div",
|
|
7499
7631
|
{
|
|
7500
7632
|
id: "preview-frame",
|
|
7501
|
-
className:
|
|
7633
|
+
className: getClassName22("frame"),
|
|
7502
7634
|
ref,
|
|
7503
7635
|
"data-puck-entry": true,
|
|
7504
7636
|
children: inner
|
|
@@ -7516,7 +7648,7 @@ init_react_import();
|
|
|
7516
7648
|
|
|
7517
7649
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
|
7518
7650
|
init_react_import();
|
|
7519
|
-
var
|
|
7651
|
+
var styles_module_default18 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
|
|
7520
7652
|
|
|
7521
7653
|
// lib/scroll-into-view.ts
|
|
7522
7654
|
init_react_import();
|
|
@@ -7530,7 +7662,7 @@ var scrollIntoView = (el) => {
|
|
|
7530
7662
|
};
|
|
7531
7663
|
|
|
7532
7664
|
// components/LayerTree/index.tsx
|
|
7533
|
-
var
|
|
7665
|
+
var import_react47 = require("react");
|
|
7534
7666
|
|
|
7535
7667
|
// lib/on-scroll-end.ts
|
|
7536
7668
|
init_react_import();
|
|
@@ -7553,20 +7685,19 @@ var onScrollEnd = (frame, cb) => {
|
|
|
7553
7685
|
|
|
7554
7686
|
// components/LayerTree/index.tsx
|
|
7555
7687
|
var import_shallow6 = require("zustand/react/shallow");
|
|
7556
|
-
var
|
|
7557
|
-
var
|
|
7558
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
|
7688
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7689
|
+
var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
|
|
7690
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
|
|
7559
7691
|
var Layer = ({
|
|
7560
7692
|
index,
|
|
7561
7693
|
itemId,
|
|
7562
7694
|
zoneCompound
|
|
7563
7695
|
}) => {
|
|
7564
7696
|
var _a;
|
|
7565
|
-
const ctx = (0, import_react46.useContext)(dropZoneContext);
|
|
7566
7697
|
const config = useAppStore((s) => s.config);
|
|
7567
7698
|
const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
|
|
7568
7699
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7569
|
-
const setItemSelector = (0,
|
|
7700
|
+
const setItemSelector = (0, import_react47.useCallback)(
|
|
7570
7701
|
(itemSelector2) => {
|
|
7571
7702
|
dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
|
|
7572
7703
|
},
|
|
@@ -7586,7 +7717,7 @@ var Layer = ({
|
|
|
7586
7717
|
)
|
|
7587
7718
|
);
|
|
7588
7719
|
const containsZone = zonesForItem.length > 0;
|
|
7589
|
-
const zoneStore = (0,
|
|
7720
|
+
const zoneStore = (0, import_react47.useContext)(ZoneStoreContext);
|
|
7590
7721
|
const isHovering = useContextStore(
|
|
7591
7722
|
ZoneStoreContext,
|
|
7592
7723
|
(s) => s.hoveringComponent === itemId
|
|
@@ -7601,7 +7732,7 @@ var Layer = ({
|
|
|
7601
7732
|
});
|
|
7602
7733
|
const componentConfig = config.components[nodeData.data.type];
|
|
7603
7734
|
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
|
7604
|
-
return /* @__PURE__ */ (0,
|
|
7735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7605
7736
|
"li",
|
|
7606
7737
|
{
|
|
7607
7738
|
className: getClassNameLayer({
|
|
@@ -7611,7 +7742,7 @@ var Layer = ({
|
|
|
7611
7742
|
childIsSelected
|
|
7612
7743
|
}),
|
|
7613
7744
|
children: [
|
|
7614
|
-
/* @__PURE__ */ (0,
|
|
7745
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7615
7746
|
"button",
|
|
7616
7747
|
{
|
|
7617
7748
|
type: "button",
|
|
@@ -7649,22 +7780,22 @@ var Layer = ({
|
|
|
7649
7780
|
zoneStore.setState({ hoveringComponent: null });
|
|
7650
7781
|
},
|
|
7651
7782
|
children: [
|
|
7652
|
-
containsZone && /* @__PURE__ */ (0,
|
|
7783
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7653
7784
|
"div",
|
|
7654
7785
|
{
|
|
7655
7786
|
className: getClassNameLayer("chevron"),
|
|
7656
7787
|
title: isSelected ? "Collapse" : "Expand",
|
|
7657
|
-
children: /* @__PURE__ */ (0,
|
|
7788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { size: "12" })
|
|
7658
7789
|
}
|
|
7659
7790
|
),
|
|
7660
|
-
/* @__PURE__ */ (0,
|
|
7661
|
-
/* @__PURE__ */ (0,
|
|
7662
|
-
/* @__PURE__ */ (0,
|
|
7791
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
|
7792
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayoutGrid, { size: "16" }) }),
|
|
7793
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("name"), children: label })
|
|
7663
7794
|
] })
|
|
7664
7795
|
]
|
|
7665
7796
|
}
|
|
7666
7797
|
) }),
|
|
7667
|
-
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0,
|
|
7798
|
+
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
|
|
7668
7799
|
]
|
|
7669
7800
|
}
|
|
7670
7801
|
);
|
|
@@ -7673,7 +7804,15 @@ var LayerTree = ({
|
|
|
7673
7804
|
label: _label,
|
|
7674
7805
|
zoneCompound
|
|
7675
7806
|
}) => {
|
|
7676
|
-
const label =
|
|
7807
|
+
const label = useAppStore((s) => {
|
|
7808
|
+
var _a, _b, _c, _d;
|
|
7809
|
+
if (_label) return _label;
|
|
7810
|
+
if (zoneCompound === rootDroppableId) return;
|
|
7811
|
+
const [componentId, slotId] = zoneCompound.split(":");
|
|
7812
|
+
const componentType = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.type;
|
|
7813
|
+
const configForComponent = componentType && componentType !== rootAreaId ? s.config.components[componentType] : s.config.root;
|
|
7814
|
+
return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
|
|
7815
|
+
});
|
|
7677
7816
|
const contentIds = useAppStore(
|
|
7678
7817
|
(0, import_shallow6.useShallow)(
|
|
7679
7818
|
(s) => {
|
|
@@ -7682,15 +7821,15 @@ var LayerTree = ({
|
|
|
7682
7821
|
}
|
|
7683
7822
|
)
|
|
7684
7823
|
);
|
|
7685
|
-
return /* @__PURE__ */ (0,
|
|
7686
|
-
label && /* @__PURE__ */ (0,
|
|
7687
|
-
/* @__PURE__ */ (0,
|
|
7824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7825
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName23("zoneTitle"), children: [
|
|
7826
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Layers, { size: "16" }) }),
|
|
7688
7827
|
label
|
|
7689
7828
|
] }),
|
|
7690
|
-
/* @__PURE__ */ (0,
|
|
7691
|
-
contentIds.length === 0 && /* @__PURE__ */ (0,
|
|
7829
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("ul", { className: getClassName23(), children: [
|
|
7830
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("helper"), children: "No items" }),
|
|
7692
7831
|
contentIds.map((itemId, i) => {
|
|
7693
|
-
return /* @__PURE__ */ (0,
|
|
7832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7694
7833
|
Layer,
|
|
7695
7834
|
{
|
|
7696
7835
|
index: i,
|
|
@@ -7705,7 +7844,7 @@ var LayerTree = ({
|
|
|
7705
7844
|
};
|
|
7706
7845
|
|
|
7707
7846
|
// components/Puck/components/Outline/index.tsx
|
|
7708
|
-
var
|
|
7847
|
+
var import_react48 = require("react");
|
|
7709
7848
|
|
|
7710
7849
|
// lib/data/find-zones-for-area.ts
|
|
7711
7850
|
init_react_import();
|
|
@@ -7717,14 +7856,14 @@ var findZonesForArea = (state, area) => {
|
|
|
7717
7856
|
|
|
7718
7857
|
// components/Puck/components/Outline/index.tsx
|
|
7719
7858
|
var import_shallow7 = require("zustand/react/shallow");
|
|
7720
|
-
var
|
|
7859
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7721
7860
|
var Outline = () => {
|
|
7722
7861
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
7723
7862
|
const rootZones = useAppStore(
|
|
7724
7863
|
(0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
|
|
7725
7864
|
);
|
|
7726
|
-
const Wrapper = (0,
|
|
7727
|
-
return /* @__PURE__ */ (0,
|
|
7865
|
+
const Wrapper = (0, import_react48.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
|
7866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7728
7867
|
LayerTree,
|
|
7729
7868
|
{
|
|
7730
7869
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
@@ -7734,1189 +7873,925 @@ var Outline = () => {
|
|
|
7734
7873
|
)) });
|
|
7735
7874
|
};
|
|
7736
7875
|
|
|
7737
|
-
//
|
|
7876
|
+
// components/Puck/components/Canvas/index.tsx
|
|
7738
7877
|
init_react_import();
|
|
7739
|
-
var import_react48 = require("react");
|
|
7740
7878
|
|
|
7741
|
-
//
|
|
7879
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
7742
7880
|
init_react_import();
|
|
7743
|
-
var loadOverrides = ({
|
|
7744
|
-
overrides,
|
|
7745
|
-
plugins
|
|
7746
|
-
}) => {
|
|
7747
|
-
const collected = __spreadValues({}, overrides);
|
|
7748
|
-
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
7749
|
-
if (!plugin.overrides) return;
|
|
7750
|
-
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
|
7751
|
-
const overridesType = _overridesType;
|
|
7752
|
-
if (overridesType === "fieldTypes") {
|
|
7753
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
|
7754
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
|
7755
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
|
7756
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
|
7757
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
|
7758
|
-
children: childNode2 ? childNode2(props) : props.children
|
|
7759
|
-
}));
|
|
7760
|
-
collected.fieldTypes[fieldType] = Comp2;
|
|
7761
|
-
});
|
|
7762
|
-
return;
|
|
7763
|
-
}
|
|
7764
|
-
const childNode = collected[overridesType];
|
|
7765
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
|
7766
|
-
children: childNode ? childNode(props) : props.children
|
|
7767
|
-
}));
|
|
7768
|
-
collected[overridesType] = Comp;
|
|
7769
|
-
});
|
|
7770
|
-
});
|
|
7771
|
-
return collected;
|
|
7772
|
-
};
|
|
7773
|
-
|
|
7774
|
-
// lib/use-loaded-overrides.ts
|
|
7775
|
-
var useLoadedOverrides = ({
|
|
7776
|
-
overrides,
|
|
7777
|
-
plugins
|
|
7778
|
-
}) => {
|
|
7779
|
-
return (0, import_react48.useMemo)(() => {
|
|
7780
|
-
return loadOverrides({ overrides, plugins });
|
|
7781
|
-
}, [plugins, overrides]);
|
|
7782
|
-
};
|
|
7783
7881
|
|
|
7784
|
-
//
|
|
7882
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
7785
7883
|
init_react_import();
|
|
7786
|
-
var
|
|
7787
|
-
var
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7884
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
7885
|
+
var prefix = "Invariant failed";
|
|
7886
|
+
function invariant(condition, message) {
|
|
7887
|
+
if (condition) {
|
|
7888
|
+
return;
|
|
7889
|
+
}
|
|
7890
|
+
if (isProduction) {
|
|
7891
|
+
throw new Error(prefix);
|
|
7892
|
+
}
|
|
7893
|
+
var provided = typeof message === "function" ? message() : message;
|
|
7894
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
7895
|
+
throw new Error(value);
|
|
7896
|
+
}
|
|
7897
|
+
|
|
7898
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
7899
|
+
var getRect = function getRect2(_ref) {
|
|
7900
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
|
7901
|
+
var width = right - left;
|
|
7902
|
+
var height = bottom - top;
|
|
7903
|
+
var rect = {
|
|
7904
|
+
top,
|
|
7905
|
+
right,
|
|
7906
|
+
bottom,
|
|
7907
|
+
left,
|
|
7908
|
+
width,
|
|
7909
|
+
height,
|
|
7910
|
+
x: left,
|
|
7911
|
+
y: top,
|
|
7912
|
+
center: {
|
|
7913
|
+
x: (right + left) / 2,
|
|
7914
|
+
y: (bottom + top) / 2
|
|
7915
|
+
}
|
|
7798
7916
|
};
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
getItemBySelector: (selector) => getItem(selector, store.state),
|
|
7808
|
-
getItemById: (id) => store.state.indexes.nodes[id].data,
|
|
7809
|
-
getSelectorForId: (id) => {
|
|
7810
|
-
const node = store.state.indexes.nodes[id];
|
|
7811
|
-
if (!node) return;
|
|
7812
|
-
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
7813
|
-
const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
7814
|
-
return { zone: zoneCompound, index };
|
|
7815
|
-
}
|
|
7917
|
+
return rect;
|
|
7918
|
+
};
|
|
7919
|
+
var expand = function expand2(target, expandBy) {
|
|
7920
|
+
return {
|
|
7921
|
+
top: target.top - expandBy.top,
|
|
7922
|
+
left: target.left - expandBy.left,
|
|
7923
|
+
bottom: target.bottom + expandBy.bottom,
|
|
7924
|
+
right: target.right + expandBy.right
|
|
7816
7925
|
};
|
|
7817
|
-
const get = () => storeData;
|
|
7818
|
-
return __spreadProps(__spreadValues({}, storeData), { get });
|
|
7819
7926
|
};
|
|
7820
|
-
var
|
|
7821
|
-
null
|
|
7822
|
-
);
|
|
7823
|
-
var convertToPickedStore = (store) => {
|
|
7927
|
+
var shrink = function shrink2(target, shrinkBy) {
|
|
7824
7928
|
return {
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
history: store.history,
|
|
7830
|
-
selectedItem: store.selectedItem
|
|
7929
|
+
top: target.top + shrinkBy.top,
|
|
7930
|
+
left: target.left + shrinkBy.left,
|
|
7931
|
+
bottom: target.bottom - shrinkBy.bottom,
|
|
7932
|
+
right: target.right - shrinkBy.right
|
|
7831
7933
|
};
|
|
7832
7934
|
};
|
|
7833
|
-
var
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
);
|
|
7839
|
-
(0, import_react49.useEffect)(() => {
|
|
7840
|
-
return appStore.subscribe(
|
|
7841
|
-
(store) => convertToPickedStore(store),
|
|
7842
|
-
(pickedStore) => {
|
|
7843
|
-
usePuckStore.setState(generateUsePuck(pickedStore));
|
|
7844
|
-
}
|
|
7845
|
-
);
|
|
7846
|
-
}, []);
|
|
7847
|
-
return usePuckStore;
|
|
7935
|
+
var noSpacing = {
|
|
7936
|
+
top: 0,
|
|
7937
|
+
right: 0,
|
|
7938
|
+
bottom: 0,
|
|
7939
|
+
left: 0
|
|
7848
7940
|
};
|
|
7849
|
-
function
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7941
|
+
var createBox = function createBox2(_ref2) {
|
|
7942
|
+
var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
|
7943
|
+
var marginBox = getRect(expand(borderBox, margin));
|
|
7944
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
|
7945
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
|
7946
|
+
return {
|
|
7947
|
+
marginBox,
|
|
7948
|
+
borderBox: getRect(borderBox),
|
|
7949
|
+
paddingBox,
|
|
7950
|
+
contentBox,
|
|
7951
|
+
margin,
|
|
7952
|
+
border,
|
|
7953
|
+
padding
|
|
7860
7954
|
};
|
|
7861
|
-
}
|
|
7862
|
-
function
|
|
7863
|
-
(0,
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
}, []);
|
|
7868
|
-
return createUsePuck()((s) => s);
|
|
7869
|
-
}
|
|
7870
|
-
function useGetPuck() {
|
|
7871
|
-
const usePuckApi = (0, import_react49.useContext)(UsePuckStoreContext);
|
|
7872
|
-
if (!usePuckApi) {
|
|
7873
|
-
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
7955
|
+
};
|
|
7956
|
+
var parse = function parse2(raw) {
|
|
7957
|
+
var value = raw.slice(0, -2);
|
|
7958
|
+
var suffix = raw.slice(-2);
|
|
7959
|
+
if (suffix !== "px") {
|
|
7960
|
+
return 0;
|
|
7874
7961
|
}
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
// components/Puck/index.tsx
|
|
7879
|
-
var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
|
|
7880
|
-
|
|
7881
|
-
// components/Puck/components/Layout/index.tsx
|
|
7882
|
-
init_react_import();
|
|
7883
|
-
var import_react56 = require("react");
|
|
7884
|
-
|
|
7885
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
|
|
7886
|
-
init_react_import();
|
|
7887
|
-
var styles_module_default17 = { "Puck": "_Puck_n6ob8_19", "Puck-portal": "_Puck-portal_n6ob8_31", "PuckLayout-inner": "_PuckLayout-inner_n6ob8_36", "PuckLayout--mounted": "_PuckLayout--mounted_n6ob8_48", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_n6ob8_53", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_n6ob8_61", "PuckLayout-mounted": "_PuckLayout-mounted_n6ob8_77", "PuckLayout": "_PuckLayout_n6ob8_36", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_n6ob8_118", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_n6ob8_128", "PuckLayout-nav": "_PuckLayout-nav_n6ob8_137" };
|
|
7888
|
-
|
|
7889
|
-
// lib/use-inject-css.ts
|
|
7890
|
-
init_react_import();
|
|
7891
|
-
var import_react50 = require("react");
|
|
7892
|
-
var styles = ``;
|
|
7893
|
-
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
7894
|
-
const [el, setEl] = (0, import_react50.useState)();
|
|
7895
|
-
(0, import_react50.useEffect)(() => {
|
|
7896
|
-
setEl(document.createElement("style"));
|
|
7897
|
-
}, []);
|
|
7898
|
-
(0, import_react50.useEffect)(() => {
|
|
7899
|
-
var _a;
|
|
7900
|
-
if (!el || typeof window === "undefined") {
|
|
7901
|
-
return;
|
|
7902
|
-
}
|
|
7903
|
-
el.innerHTML = initialStyles;
|
|
7904
|
-
if (iframeEnabled) {
|
|
7905
|
-
const frame = getFrame();
|
|
7906
|
-
(_a = frame == null ? void 0 : frame.head) == null ? void 0 : _a.appendChild(el);
|
|
7907
|
-
}
|
|
7908
|
-
document.head.appendChild(el);
|
|
7909
|
-
}, [iframeEnabled, el]);
|
|
7910
|
-
return el;
|
|
7962
|
+
var result = Number(value);
|
|
7963
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
|
7964
|
+
return result;
|
|
7911
7965
|
};
|
|
7912
|
-
var
|
|
7913
|
-
|
|
7966
|
+
var calculateBox = function calculateBox2(borderBox, styles2) {
|
|
7967
|
+
var margin = {
|
|
7968
|
+
top: parse(styles2.marginTop),
|
|
7969
|
+
right: parse(styles2.marginRight),
|
|
7970
|
+
bottom: parse(styles2.marginBottom),
|
|
7971
|
+
left: parse(styles2.marginLeft)
|
|
7972
|
+
};
|
|
7973
|
+
var padding = {
|
|
7974
|
+
top: parse(styles2.paddingTop),
|
|
7975
|
+
right: parse(styles2.paddingRight),
|
|
7976
|
+
bottom: parse(styles2.paddingBottom),
|
|
7977
|
+
left: parse(styles2.paddingLeft)
|
|
7978
|
+
};
|
|
7979
|
+
var border = {
|
|
7980
|
+
top: parse(styles2.borderTopWidth),
|
|
7981
|
+
right: parse(styles2.borderRightWidth),
|
|
7982
|
+
bottom: parse(styles2.borderBottomWidth),
|
|
7983
|
+
left: parse(styles2.borderLeftWidth)
|
|
7984
|
+
};
|
|
7985
|
+
return createBox({
|
|
7986
|
+
borderBox,
|
|
7987
|
+
margin,
|
|
7988
|
+
padding,
|
|
7989
|
+
border
|
|
7990
|
+
});
|
|
7914
7991
|
};
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
|
7920
|
-
|
|
7921
|
-
// lib/use-preview-mode-hotkeys.ts
|
|
7922
|
-
init_react_import();
|
|
7923
|
-
var import_react51 = require("react");
|
|
7924
|
-
var usePreviewModeHotkeys = () => {
|
|
7925
|
-
const appStore = useAppStoreApi();
|
|
7926
|
-
const toggleInteractive = (0, import_react51.useCallback)(() => {
|
|
7927
|
-
const dispatch = appStore.getState().dispatch;
|
|
7928
|
-
dispatch({
|
|
7929
|
-
type: "setUi",
|
|
7930
|
-
ui: (ui) => ({
|
|
7931
|
-
previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
|
|
7932
|
-
})
|
|
7933
|
-
});
|
|
7934
|
-
}, [appStore]);
|
|
7935
|
-
useHotkey({ meta: true, i: true }, toggleInteractive);
|
|
7936
|
-
useHotkey({ ctrl: true, i: true }, toggleInteractive);
|
|
7992
|
+
var getBox = function getBox2(el) {
|
|
7993
|
+
var borderBox = el.getBoundingClientRect();
|
|
7994
|
+
var styles2 = window.getComputedStyle(el);
|
|
7995
|
+
return calculateBox(borderBox, styles2);
|
|
7937
7996
|
};
|
|
7938
7997
|
|
|
7939
|
-
// components/Puck/components/
|
|
7940
|
-
|
|
7941
|
-
var import_react52 = require("react");
|
|
7998
|
+
// components/Puck/components/Canvas/index.tsx
|
|
7999
|
+
var import_react50 = require("react");
|
|
7942
8000
|
|
|
7943
|
-
// components/
|
|
8001
|
+
// components/ViewportControls/index.tsx
|
|
7944
8002
|
init_react_import();
|
|
8003
|
+
var import_react49 = require("react");
|
|
7945
8004
|
|
|
7946
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
|
8005
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
7947
8006
|
init_react_import();
|
|
7948
|
-
var
|
|
8007
|
+
var styles_module_default19 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
|
|
7949
8008
|
|
|
7950
|
-
// components/
|
|
8009
|
+
// components/ViewportControls/index.tsx
|
|
7951
8010
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7952
|
-
var
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
8011
|
+
var icons = {
|
|
8012
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Smartphone, { size: 16 }),
|
|
8013
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tablet, { size: 16 }),
|
|
8014
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Monitor, { size: 16 })
|
|
8015
|
+
};
|
|
8016
|
+
var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
|
|
8017
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
|
|
8018
|
+
var ViewportButton = ({
|
|
8019
|
+
children,
|
|
8020
|
+
height = "auto",
|
|
8021
|
+
title,
|
|
8022
|
+
width,
|
|
8023
|
+
onClick
|
|
8024
|
+
}) => {
|
|
8025
|
+
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
8026
|
+
const [isActive, setIsActive] = (0, import_react49.useState)(false);
|
|
8027
|
+
(0, import_react49.useEffect)(() => {
|
|
8028
|
+
setIsActive(width === viewports.current.width);
|
|
8029
|
+
}, [width, viewports.current.width]);
|
|
8030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8031
|
+
IconButton,
|
|
7964
8032
|
{
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
}
|
|
7972
|
-
if (element.tagName === "A" && ((_a = element.getAttribute("href")) == null ? void 0 : _a.startsWith("#"))) {
|
|
7973
|
-
setMenuOpen(false);
|
|
7974
|
-
}
|
|
8033
|
+
type: "button",
|
|
8034
|
+
title,
|
|
8035
|
+
disabled: isActive,
|
|
8036
|
+
onClick: (e) => {
|
|
8037
|
+
e.stopPropagation();
|
|
8038
|
+
onClick({ width, height });
|
|
7975
8039
|
},
|
|
7976
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime37.
|
|
7977
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName23("history"), children: [
|
|
7978
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Undo2, { size: 21 }) }),
|
|
7979
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Redo2, { size: 21 }) })
|
|
7980
|
-
] }),
|
|
7981
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
|
7982
|
-
] })
|
|
8040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton("inner"), children })
|
|
7983
8041
|
}
|
|
8042
|
+
) });
|
|
8043
|
+
};
|
|
8044
|
+
var defaultZoomOptions = [
|
|
8045
|
+
{ label: "25%", value: 0.25 },
|
|
8046
|
+
{ label: "50%", value: 0.5 },
|
|
8047
|
+
{ label: "75%", value: 0.75 },
|
|
8048
|
+
{ label: "100%", value: 1 },
|
|
8049
|
+
{ label: "125%", value: 1.25 },
|
|
8050
|
+
{ label: "150%", value: 1.5 },
|
|
8051
|
+
{ label: "200%", value: 2 }
|
|
8052
|
+
];
|
|
8053
|
+
var ViewportControls = ({
|
|
8054
|
+
autoZoom,
|
|
8055
|
+
zoom,
|
|
8056
|
+
onViewportChange,
|
|
8057
|
+
onZoom
|
|
8058
|
+
}) => {
|
|
8059
|
+
var _a, _b;
|
|
8060
|
+
const viewports = useAppStore((s) => s.viewports);
|
|
8061
|
+
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
8062
|
+
(option) => option.value === autoZoom
|
|
7984
8063
|
);
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
var styles_module_default19 = { "PuckHeader": "_PuckHeader_dlc6d_1", "PuckHeader-inner": "_PuckHeader-inner_dlc6d_16", "PuckHeader-toggle": "_PuckHeader-toggle_dlc6d_33", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_dlc6d_40", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_dlc6d_40", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_dlc6d_41", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_dlc6d_41", "PuckHeader-title": "_PuckHeader-title_dlc6d_45", "PuckHeader-path": "_PuckHeader-path_dlc6d_49", "PuckHeader-tools": "_PuckHeader-tools_dlc6d_56", "PuckHeader-menuButton": "_PuckHeader-menuButton_dlc6d_62", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_dlc6d_67" };
|
|
7990
|
-
|
|
7991
|
-
// components/Puck/components/Header/index.tsx
|
|
7992
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7993
|
-
var getClassName24 = get_class_name_factory_default("PuckHeader", styles_module_default19);
|
|
7994
|
-
var HeaderInner = () => {
|
|
7995
|
-
const {
|
|
7996
|
-
onPublish,
|
|
7997
|
-
renderHeader,
|
|
7998
|
-
renderHeaderActions,
|
|
7999
|
-
headerTitle,
|
|
8000
|
-
headerPath,
|
|
8001
|
-
iframe: _iframe
|
|
8002
|
-
} = usePropsContext();
|
|
8003
|
-
const dispatch = useAppStore((s) => s.dispatch);
|
|
8004
|
-
const appStore = useAppStoreApi();
|
|
8005
|
-
const defaultHeaderRender = (0, import_react52.useMemo)(() => {
|
|
8006
|
-
if (renderHeader) {
|
|
8007
|
-
console.warn(
|
|
8008
|
-
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
8009
|
-
);
|
|
8010
|
-
const RenderHeader = (_a) => {
|
|
8011
|
-
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
8012
|
-
const Comp = renderHeader;
|
|
8013
|
-
const appState = useAppStore((s) => s.state);
|
|
8014
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
8015
|
-
};
|
|
8016
|
-
return RenderHeader;
|
|
8017
|
-
}
|
|
8018
|
-
return DefaultOverride;
|
|
8019
|
-
}, [renderHeader]);
|
|
8020
|
-
const defaultHeaderActionsRender = (0, import_react52.useMemo)(() => {
|
|
8021
|
-
if (renderHeaderActions) {
|
|
8022
|
-
console.warn(
|
|
8023
|
-
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
8024
|
-
);
|
|
8025
|
-
const RenderHeader = (props) => {
|
|
8026
|
-
const Comp = renderHeaderActions;
|
|
8027
|
-
const appState = useAppStore((s) => s.state);
|
|
8028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
8029
|
-
};
|
|
8030
|
-
return RenderHeader;
|
|
8031
|
-
}
|
|
8032
|
-
return DefaultOverride;
|
|
8033
|
-
}, [renderHeader]);
|
|
8034
|
-
const CustomHeader = useAppStore(
|
|
8035
|
-
(s) => s.overrides.header || defaultHeaderRender
|
|
8036
|
-
);
|
|
8037
|
-
const CustomHeaderActions = useAppStore(
|
|
8038
|
-
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
8039
|
-
);
|
|
8040
|
-
const [menuOpen, setMenuOpen] = (0, import_react52.useState)(false);
|
|
8041
|
-
const rootTitle = useAppStore((s) => {
|
|
8042
|
-
var _a, _b;
|
|
8043
|
-
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
8044
|
-
return (_b = rootData.props.title) != null ? _b : "";
|
|
8045
|
-
});
|
|
8046
|
-
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8047
|
-
const rightSideBarVisible = useAppStore(
|
|
8048
|
-
(s) => s.state.ui.rightSideBarVisible
|
|
8049
|
-
);
|
|
8050
|
-
const toggleSidebars = (0, import_react52.useCallback)(
|
|
8051
|
-
(sidebar) => {
|
|
8052
|
-
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
8053
|
-
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
8054
|
-
const oppositeSideBar = sidebar === "left" ? "rightSideBarVisible" : "leftSideBarVisible";
|
|
8055
|
-
dispatch({
|
|
8056
|
-
type: "setUi",
|
|
8057
|
-
ui: __spreadValues({
|
|
8058
|
-
[`${sidebar}SideBarVisible`]: !sideBarVisible
|
|
8059
|
-
}, !widerViewport ? { [oppositeSideBar]: false } : {})
|
|
8060
|
-
});
|
|
8061
|
-
},
|
|
8062
|
-
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
8063
|
-
);
|
|
8064
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8065
|
-
CustomHeader,
|
|
8066
|
-
{
|
|
8067
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8068
|
-
Button,
|
|
8069
|
-
{
|
|
8070
|
-
onClick: () => {
|
|
8071
|
-
const data = appStore.getState().state.data;
|
|
8072
|
-
onPublish && onPublish(data);
|
|
8073
|
-
},
|
|
8074
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
|
8075
|
-
children: "Publish"
|
|
8076
|
-
}
|
|
8077
|
-
) }) }),
|
|
8078
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8079
|
-
"header",
|
|
8064
|
+
const zoomOptions = (0, import_react49.useMemo)(
|
|
8065
|
+
() => [
|
|
8066
|
+
...defaultZoomOptions,
|
|
8067
|
+
...defaultsContainAutoZoom ? [] : [
|
|
8080
8068
|
{
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName24("toggle"), children: [
|
|
8084
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName24("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8085
|
-
IconButton,
|
|
8086
|
-
{
|
|
8087
|
-
onClick: () => {
|
|
8088
|
-
toggleSidebars("left");
|
|
8089
|
-
},
|
|
8090
|
-
title: "Toggle left sidebar",
|
|
8091
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
|
8092
|
-
}
|
|
8093
|
-
) }),
|
|
8094
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName24("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8095
|
-
IconButton,
|
|
8096
|
-
{
|
|
8097
|
-
onClick: () => {
|
|
8098
|
-
toggleSidebars("right");
|
|
8099
|
-
},
|
|
8100
|
-
title: "Toggle right sidebar",
|
|
8101
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
|
8102
|
-
}
|
|
8103
|
-
) })
|
|
8104
|
-
] }),
|
|
8105
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName24("title"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
|
8106
|
-
headerTitle || rootTitle || "Page",
|
|
8107
|
-
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
8108
|
-
" ",
|
|
8109
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("code", { className: getClassName24("path"), children: headerPath })
|
|
8110
|
-
] })
|
|
8111
|
-
] }) }),
|
|
8112
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName24("tools"), children: [
|
|
8113
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName24("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8114
|
-
IconButton,
|
|
8115
|
-
{
|
|
8116
|
-
onClick: () => {
|
|
8117
|
-
return setMenuOpen(!menuOpen);
|
|
8118
|
-
},
|
|
8119
|
-
title: "Toggle menu bar",
|
|
8120
|
-
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
|
8121
|
-
}
|
|
8122
|
-
) }),
|
|
8123
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8124
|
-
MenuBar,
|
|
8125
|
-
{
|
|
8126
|
-
dispatch,
|
|
8127
|
-
onPublish,
|
|
8128
|
-
menuOpen,
|
|
8129
|
-
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8130
|
-
Button,
|
|
8131
|
-
{
|
|
8132
|
-
onClick: () => {
|
|
8133
|
-
const data = appStore.getState().state.data;
|
|
8134
|
-
onPublish && onPublish(data);
|
|
8135
|
-
},
|
|
8136
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
|
8137
|
-
children: "Publish"
|
|
8138
|
-
}
|
|
8139
|
-
) }),
|
|
8140
|
-
setMenuOpen
|
|
8141
|
-
}
|
|
8142
|
-
)
|
|
8143
|
-
] })
|
|
8144
|
-
] })
|
|
8069
|
+
value: autoZoom,
|
|
8070
|
+
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
|
8145
8071
|
}
|
|
8146
|
-
|
|
8147
|
-
|
|
8072
|
+
]
|
|
8073
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
8074
|
+
[autoZoom]
|
|
8148
8075
|
);
|
|
8076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24(), children: [
|
|
8077
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8078
|
+
ViewportButton,
|
|
8079
|
+
{
|
|
8080
|
+
height: viewport.height,
|
|
8081
|
+
width: viewport.width,
|
|
8082
|
+
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
|
8083
|
+
onClick: onViewportChange,
|
|
8084
|
+
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
|
8085
|
+
},
|
|
8086
|
+
i
|
|
8087
|
+
)),
|
|
8088
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
|
|
8089
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8090
|
+
IconButton,
|
|
8091
|
+
{
|
|
8092
|
+
type: "button",
|
|
8093
|
+
title: "Zoom viewport out",
|
|
8094
|
+
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
|
8095
|
+
onClick: (e) => {
|
|
8096
|
+
e.stopPropagation();
|
|
8097
|
+
onZoom(
|
|
8098
|
+
zoomOptions[Math.max(
|
|
8099
|
+
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
|
8100
|
+
0
|
|
8101
|
+
)].value
|
|
8102
|
+
);
|
|
8103
|
+
},
|
|
8104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomOut, { size: 16 })
|
|
8105
|
+
}
|
|
8106
|
+
),
|
|
8107
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8108
|
+
IconButton,
|
|
8109
|
+
{
|
|
8110
|
+
type: "button",
|
|
8111
|
+
title: "Zoom viewport in",
|
|
8112
|
+
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
|
8113
|
+
onClick: (e) => {
|
|
8114
|
+
e.stopPropagation();
|
|
8115
|
+
onZoom(
|
|
8116
|
+
zoomOptions[Math.min(
|
|
8117
|
+
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
|
8118
|
+
zoomOptions.length - 1
|
|
8119
|
+
)].value
|
|
8120
|
+
);
|
|
8121
|
+
},
|
|
8122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomIn, { size: 16 })
|
|
8123
|
+
}
|
|
8124
|
+
),
|
|
8125
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
|
|
8126
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8127
|
+
"select",
|
|
8128
|
+
{
|
|
8129
|
+
className: getClassName24("zoomSelect"),
|
|
8130
|
+
value: zoom.toString(),
|
|
8131
|
+
onChange: (e) => {
|
|
8132
|
+
onZoom(parseFloat(e.currentTarget.value));
|
|
8133
|
+
},
|
|
8134
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8135
|
+
"option",
|
|
8136
|
+
{
|
|
8137
|
+
value: option.value,
|
|
8138
|
+
label: option.label
|
|
8139
|
+
},
|
|
8140
|
+
option.label
|
|
8141
|
+
))
|
|
8142
|
+
}
|
|
8143
|
+
)
|
|
8144
|
+
] });
|
|
8149
8145
|
};
|
|
8150
|
-
var Header = (0, import_react52.memo)(HeaderInner);
|
|
8151
8146
|
|
|
8152
|
-
// components/
|
|
8147
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
|
8153
8148
|
init_react_import();
|
|
8149
|
+
var styles_module_default20 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
|
|
8154
8150
|
|
|
8155
|
-
//
|
|
8151
|
+
// lib/get-zoom-config.ts
|
|
8156
8152
|
init_react_import();
|
|
8157
|
-
var
|
|
8153
|
+
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
|
8154
|
+
var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
8155
|
+
const box = getBox(frame);
|
|
8156
|
+
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
|
8157
|
+
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
|
8158
|
+
let rootHeight = 0;
|
|
8159
|
+
let autoZoom = 1;
|
|
8160
|
+
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
|
8161
|
+
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
|
8162
|
+
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
|
8163
|
+
zoom = widthZoom;
|
|
8164
|
+
if (widthZoom < heightZoom) {
|
|
8165
|
+
rootHeight = viewportHeight / zoom;
|
|
8166
|
+
} else {
|
|
8167
|
+
rootHeight = viewportHeight;
|
|
8168
|
+
zoom = heightZoom;
|
|
8169
|
+
}
|
|
8170
|
+
autoZoom = zoom;
|
|
8171
|
+
} else {
|
|
8172
|
+
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
|
8173
|
+
autoZoom = 1;
|
|
8174
|
+
zoom = 1;
|
|
8175
|
+
rootHeight = viewportHeight;
|
|
8176
|
+
}
|
|
8177
|
+
}
|
|
8178
|
+
return { autoZoom, rootHeight, zoom };
|
|
8179
|
+
};
|
|
8158
8180
|
|
|
8159
|
-
//
|
|
8160
|
-
|
|
8161
|
-
var
|
|
8162
|
-
var
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8181
|
+
// components/Puck/components/Canvas/index.tsx
|
|
8182
|
+
var import_shallow8 = require("zustand/react/shallow");
|
|
8183
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8184
|
+
var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
|
|
8185
|
+
var ZOOM_ON_CHANGE = true;
|
|
8186
|
+
var Canvas = () => {
|
|
8187
|
+
const {
|
|
8188
|
+
dispatch,
|
|
8189
|
+
overrides,
|
|
8190
|
+
setUi,
|
|
8191
|
+
zoomConfig,
|
|
8192
|
+
setZoomConfig,
|
|
8193
|
+
status,
|
|
8194
|
+
iframe
|
|
8195
|
+
} = useAppStore(
|
|
8196
|
+
(0, import_shallow8.useShallow)((s) => ({
|
|
8197
|
+
dispatch: s.dispatch,
|
|
8198
|
+
overrides: s.overrides,
|
|
8199
|
+
setUi: s.setUi,
|
|
8200
|
+
zoomConfig: s.zoomConfig,
|
|
8201
|
+
setZoomConfig: s.setZoomConfig,
|
|
8202
|
+
status: s.status,
|
|
8203
|
+
iframe: s.iframe
|
|
8204
|
+
}))
|
|
8205
|
+
);
|
|
8206
|
+
const { leftSideBarVisible, rightSideBarVisible, viewports } = useAppStore(
|
|
8207
|
+
(0, import_shallow8.useShallow)((s) => ({
|
|
8208
|
+
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
|
8209
|
+
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
|
8210
|
+
viewports: s.state.ui.viewports
|
|
8211
|
+
}))
|
|
8212
|
+
);
|
|
8213
|
+
const frameRef = (0, import_react50.useRef)(null);
|
|
8214
|
+
const [showTransition, setShowTransition] = (0, import_react50.useState)(false);
|
|
8215
|
+
const defaultRender = (0, import_react50.useMemo)(() => {
|
|
8216
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
|
|
8217
|
+
return PuckDefault;
|
|
8218
|
+
}, []);
|
|
8219
|
+
const CustomPreview = (0, import_react50.useMemo)(
|
|
8220
|
+
() => overrides.preview || defaultRender,
|
|
8221
|
+
[overrides]
|
|
8222
|
+
);
|
|
8223
|
+
const getFrameDimensions = (0, import_react50.useCallback)(() => {
|
|
8224
|
+
if (frameRef.current) {
|
|
8225
|
+
const frame = frameRef.current;
|
|
8226
|
+
const box = getBox(frame);
|
|
8227
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
8228
|
+
}
|
|
8229
|
+
return { width: 0, height: 0 };
|
|
8230
|
+
}, [frameRef]);
|
|
8231
|
+
const resetAutoZoom = (0, import_react50.useCallback)(
|
|
8232
|
+
(newViewports = viewports) => {
|
|
8233
|
+
if (frameRef.current) {
|
|
8234
|
+
setZoomConfig(
|
|
8235
|
+
getZoomConfig(
|
|
8236
|
+
newViewports == null ? void 0 : newViewports.current,
|
|
8237
|
+
frameRef.current,
|
|
8238
|
+
zoomConfig.zoom
|
|
8239
|
+
)
|
|
8240
|
+
);
|
|
8182
8241
|
}
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
if (renderCount) {
|
|
8197
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
8242
|
+
},
|
|
8243
|
+
[frameRef, zoomConfig, viewports]
|
|
8244
|
+
);
|
|
8245
|
+
(0, import_react50.useEffect)(() => {
|
|
8246
|
+
setShowTransition(false);
|
|
8247
|
+
resetAutoZoom(viewports);
|
|
8248
|
+
}, [frameRef, leftSideBarVisible, rightSideBarVisible]);
|
|
8249
|
+
(0, import_react50.useEffect)(() => {
|
|
8250
|
+
const { height: frameHeight } = getFrameDimensions();
|
|
8251
|
+
if (viewports.current.height === "auto") {
|
|
8252
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
8253
|
+
rootHeight: frameHeight / zoomConfig.zoom
|
|
8254
|
+
}));
|
|
8198
8255
|
}
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
}
|
|
8215
|
-
|
|
8216
|
-
const
|
|
8217
|
-
|
|
8256
|
+
}, [zoomConfig.zoom]);
|
|
8257
|
+
(0, import_react50.useEffect)(() => {
|
|
8258
|
+
if (ZOOM_ON_CHANGE) {
|
|
8259
|
+
setShowTransition(true);
|
|
8260
|
+
resetAutoZoom(viewports);
|
|
8261
|
+
}
|
|
8262
|
+
}, [viewports.current.width]);
|
|
8263
|
+
(0, import_react50.useEffect)(() => {
|
|
8264
|
+
const cb = () => {
|
|
8265
|
+
setShowTransition(false);
|
|
8266
|
+
resetAutoZoom();
|
|
8267
|
+
};
|
|
8268
|
+
window.addEventListener("resize", cb);
|
|
8269
|
+
return () => {
|
|
8270
|
+
window.removeEventListener("resize", cb);
|
|
8271
|
+
};
|
|
8272
|
+
}, []);
|
|
8273
|
+
const [showLoader, setShowLoader] = (0, import_react50.useState)(false);
|
|
8274
|
+
(0, import_react50.useEffect)(() => {
|
|
8275
|
+
setTimeout(() => {
|
|
8276
|
+
setShowLoader(true);
|
|
8277
|
+
}, 500);
|
|
8278
|
+
}, []);
|
|
8279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
8218
8280
|
"div",
|
|
8219
8281
|
{
|
|
8220
|
-
className: getClassName25({
|
|
8221
|
-
|
|
8282
|
+
className: getClassName25({
|
|
8283
|
+
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
8284
|
+
showLoader
|
|
8285
|
+
}),
|
|
8286
|
+
onClick: () => dispatch({
|
|
8287
|
+
type: "setUi",
|
|
8288
|
+
ui: { itemSelector: null },
|
|
8289
|
+
recordHistory: true
|
|
8290
|
+
}),
|
|
8222
8291
|
children: [
|
|
8223
|
-
/* @__PURE__ */ (0,
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8292
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8293
|
+
ViewportControls,
|
|
8294
|
+
{
|
|
8295
|
+
autoZoom: zoomConfig.autoZoom,
|
|
8296
|
+
zoom: zoomConfig.zoom,
|
|
8297
|
+
onViewportChange: (viewport) => {
|
|
8298
|
+
setShowTransition(true);
|
|
8299
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
|
8300
|
+
height: viewport.height || "auto",
|
|
8301
|
+
zoom: zoomConfig.zoom
|
|
8302
|
+
});
|
|
8303
|
+
const newUi = {
|
|
8304
|
+
viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport }),
|
|
8305
|
+
itemSelector: null
|
|
8306
|
+
};
|
|
8307
|
+
setUi(newUi);
|
|
8308
|
+
if (ZOOM_ON_CHANGE) {
|
|
8309
|
+
resetAutoZoom(__spreadProps(__spreadValues({}, viewports), { current: uiViewport }));
|
|
8232
8310
|
}
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8311
|
+
},
|
|
8312
|
+
onZoom: (zoom) => {
|
|
8313
|
+
setShowTransition(true);
|
|
8314
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
) }),
|
|
8318
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25("inner"), ref: frameRef, children: [
|
|
8319
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8320
|
+
"div",
|
|
8321
|
+
{
|
|
8322
|
+
className: getClassName25("root"),
|
|
8323
|
+
style: {
|
|
8324
|
+
width: iframe.enabled ? viewports.current.width : "100%",
|
|
8325
|
+
height: zoomConfig.rootHeight,
|
|
8326
|
+
transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
|
|
8327
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
|
|
8328
|
+
overflow: iframe.enabled ? void 0 : "auto"
|
|
8329
|
+
},
|
|
8330
|
+
suppressHydrationWarning: true,
|
|
8331
|
+
id: "puck-canvas-root",
|
|
8332
|
+
onTransitionEnd: () => {
|
|
8333
|
+
window.dispatchEvent(
|
|
8334
|
+
new CustomEvent("viewportchange", {
|
|
8335
|
+
bubbles: true,
|
|
8336
|
+
cancelable: false
|
|
8337
|
+
})
|
|
8338
|
+
);
|
|
8339
|
+
},
|
|
8340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Preview2, {}) })
|
|
8341
|
+
}
|
|
8342
|
+
),
|
|
8343
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Loader, { size: 24 }) })
|
|
8344
|
+
] })
|
|
8240
8345
|
]
|
|
8241
8346
|
}
|
|
8242
8347
|
);
|
|
8243
8348
|
};
|
|
8244
8349
|
|
|
8245
|
-
//
|
|
8246
|
-
init_react_import();
|
|
8247
|
-
|
|
8248
|
-
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
8350
|
+
// lib/use-loaded-overrides.ts
|
|
8249
8351
|
init_react_import();
|
|
8352
|
+
var import_react51 = require("react");
|
|
8250
8353
|
|
|
8251
|
-
//
|
|
8354
|
+
// lib/load-overrides.ts
|
|
8252
8355
|
init_react_import();
|
|
8253
|
-
var
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
center: {
|
|
8282
|
-
x: (right + left) / 2,
|
|
8283
|
-
y: (bottom + top) / 2
|
|
8284
|
-
}
|
|
8285
|
-
};
|
|
8286
|
-
return rect;
|
|
8287
|
-
};
|
|
8288
|
-
var expand = function expand2(target, expandBy) {
|
|
8289
|
-
return {
|
|
8290
|
-
top: target.top - expandBy.top,
|
|
8291
|
-
left: target.left - expandBy.left,
|
|
8292
|
-
bottom: target.bottom + expandBy.bottom,
|
|
8293
|
-
right: target.right + expandBy.right
|
|
8294
|
-
};
|
|
8295
|
-
};
|
|
8296
|
-
var shrink = function shrink2(target, shrinkBy) {
|
|
8297
|
-
return {
|
|
8298
|
-
top: target.top + shrinkBy.top,
|
|
8299
|
-
left: target.left + shrinkBy.left,
|
|
8300
|
-
bottom: target.bottom - shrinkBy.bottom,
|
|
8301
|
-
right: target.right - shrinkBy.right
|
|
8302
|
-
};
|
|
8303
|
-
};
|
|
8304
|
-
var noSpacing = {
|
|
8305
|
-
top: 0,
|
|
8306
|
-
right: 0,
|
|
8307
|
-
bottom: 0,
|
|
8308
|
-
left: 0
|
|
8309
|
-
};
|
|
8310
|
-
var createBox = function createBox2(_ref2) {
|
|
8311
|
-
var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
|
8312
|
-
var marginBox = getRect(expand(borderBox, margin));
|
|
8313
|
-
var paddingBox = getRect(shrink(borderBox, border));
|
|
8314
|
-
var contentBox = getRect(shrink(paddingBox, padding));
|
|
8315
|
-
return {
|
|
8316
|
-
marginBox,
|
|
8317
|
-
borderBox: getRect(borderBox),
|
|
8318
|
-
paddingBox,
|
|
8319
|
-
contentBox,
|
|
8320
|
-
margin,
|
|
8321
|
-
border,
|
|
8322
|
-
padding
|
|
8323
|
-
};
|
|
8324
|
-
};
|
|
8325
|
-
var parse = function parse2(raw) {
|
|
8326
|
-
var value = raw.slice(0, -2);
|
|
8327
|
-
var suffix = raw.slice(-2);
|
|
8328
|
-
if (suffix !== "px") {
|
|
8329
|
-
return 0;
|
|
8330
|
-
}
|
|
8331
|
-
var result = Number(value);
|
|
8332
|
-
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
|
8333
|
-
return result;
|
|
8334
|
-
};
|
|
8335
|
-
var calculateBox = function calculateBox2(borderBox, styles2) {
|
|
8336
|
-
var margin = {
|
|
8337
|
-
top: parse(styles2.marginTop),
|
|
8338
|
-
right: parse(styles2.marginRight),
|
|
8339
|
-
bottom: parse(styles2.marginBottom),
|
|
8340
|
-
left: parse(styles2.marginLeft)
|
|
8341
|
-
};
|
|
8342
|
-
var padding = {
|
|
8343
|
-
top: parse(styles2.paddingTop),
|
|
8344
|
-
right: parse(styles2.paddingRight),
|
|
8345
|
-
bottom: parse(styles2.paddingBottom),
|
|
8346
|
-
left: parse(styles2.paddingLeft)
|
|
8347
|
-
};
|
|
8348
|
-
var border = {
|
|
8349
|
-
top: parse(styles2.borderTopWidth),
|
|
8350
|
-
right: parse(styles2.borderRightWidth),
|
|
8351
|
-
bottom: parse(styles2.borderBottomWidth),
|
|
8352
|
-
left: parse(styles2.borderLeftWidth)
|
|
8353
|
-
};
|
|
8354
|
-
return createBox({
|
|
8355
|
-
borderBox,
|
|
8356
|
-
margin,
|
|
8357
|
-
padding,
|
|
8358
|
-
border
|
|
8359
|
-
});
|
|
8360
|
-
};
|
|
8361
|
-
var getBox = function getBox2(el) {
|
|
8362
|
-
var borderBox = el.getBoundingClientRect();
|
|
8363
|
-
var styles2 = window.getComputedStyle(el);
|
|
8364
|
-
return calculateBox(borderBox, styles2);
|
|
8356
|
+
var loadOverrides = ({
|
|
8357
|
+
overrides,
|
|
8358
|
+
plugins
|
|
8359
|
+
}) => {
|
|
8360
|
+
const collected = __spreadValues({}, overrides);
|
|
8361
|
+
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
8362
|
+
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
|
8363
|
+
const overridesType = _overridesType;
|
|
8364
|
+
if (overridesType === "fieldTypes") {
|
|
8365
|
+
const fieldTypes = plugin.overrides.fieldTypes;
|
|
8366
|
+
Object.keys(fieldTypes).forEach((fieldType) => {
|
|
8367
|
+
collected.fieldTypes = collected.fieldTypes || {};
|
|
8368
|
+
const childNode2 = collected.fieldTypes[fieldType];
|
|
8369
|
+
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
|
8370
|
+
children: childNode2 ? childNode2(props) : props.children
|
|
8371
|
+
}));
|
|
8372
|
+
collected.fieldTypes[fieldType] = Comp2;
|
|
8373
|
+
});
|
|
8374
|
+
return;
|
|
8375
|
+
}
|
|
8376
|
+
const childNode = collected[overridesType];
|
|
8377
|
+
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
|
8378
|
+
children: childNode ? childNode(props) : props.children
|
|
8379
|
+
}));
|
|
8380
|
+
collected[overridesType] = Comp;
|
|
8381
|
+
});
|
|
8382
|
+
});
|
|
8383
|
+
return collected;
|
|
8365
8384
|
};
|
|
8366
8385
|
|
|
8367
|
-
//
|
|
8368
|
-
var
|
|
8386
|
+
// lib/use-loaded-overrides.ts
|
|
8387
|
+
var useLoadedOverrides = ({
|
|
8388
|
+
overrides,
|
|
8389
|
+
plugins
|
|
8390
|
+
}) => {
|
|
8391
|
+
return (0, import_react51.useMemo)(() => {
|
|
8392
|
+
return loadOverrides({ overrides, plugins });
|
|
8393
|
+
}, [plugins, overrides]);
|
|
8394
|
+
};
|
|
8369
8395
|
|
|
8370
|
-
// components/
|
|
8396
|
+
// components/DefaultOverride/index.tsx
|
|
8371
8397
|
init_react_import();
|
|
8372
|
-
var
|
|
8398
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8399
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
|
|
8373
8400
|
|
|
8374
|
-
// css
|
|
8401
|
+
// lib/use-inject-css.ts
|
|
8375
8402
|
init_react_import();
|
|
8376
|
-
var
|
|
8403
|
+
var import_react52 = require("react");
|
|
8404
|
+
var styles = ``;
|
|
8405
|
+
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
8406
|
+
const [el, setEl] = (0, import_react52.useState)();
|
|
8407
|
+
(0, import_react52.useEffect)(() => {
|
|
8408
|
+
setEl(document.createElement("style"));
|
|
8409
|
+
}, []);
|
|
8410
|
+
(0, import_react52.useEffect)(() => {
|
|
8411
|
+
var _a;
|
|
8412
|
+
if (!el || typeof window === "undefined") {
|
|
8413
|
+
return;
|
|
8414
|
+
}
|
|
8415
|
+
el.innerHTML = initialStyles;
|
|
8416
|
+
if (iframeEnabled) {
|
|
8417
|
+
const frame = getFrame();
|
|
8418
|
+
(_a = frame == null ? void 0 : frame.head) == null ? void 0 : _a.appendChild(el);
|
|
8419
|
+
}
|
|
8420
|
+
document.head.appendChild(el);
|
|
8421
|
+
}, [iframeEnabled, el]);
|
|
8422
|
+
return el;
|
|
8423
|
+
};
|
|
8424
|
+
var useInjectGlobalCss = (iframeEnabled) => {
|
|
8425
|
+
return useInjectStyleSheet(styles, iframeEnabled);
|
|
8426
|
+
};
|
|
8377
8427
|
|
|
8378
|
-
//
|
|
8379
|
-
|
|
8380
|
-
var
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8428
|
+
// lib/use-preview-mode-hotkeys.ts
|
|
8429
|
+
init_react_import();
|
|
8430
|
+
var import_react53 = require("react");
|
|
8431
|
+
var usePreviewModeHotkeys = () => {
|
|
8432
|
+
const appStore = useAppStoreApi();
|
|
8433
|
+
const toggleInteractive = (0, import_react53.useCallback)(() => {
|
|
8434
|
+
const dispatch = appStore.getState().dispatch;
|
|
8435
|
+
dispatch({
|
|
8436
|
+
type: "setUi",
|
|
8437
|
+
ui: (ui) => ({
|
|
8438
|
+
previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
|
|
8439
|
+
})
|
|
8440
|
+
});
|
|
8441
|
+
}, [appStore]);
|
|
8442
|
+
useHotkey({ meta: true, i: true }, toggleInteractive);
|
|
8443
|
+
useHotkey({ ctrl: true, i: true }, toggleInteractive);
|
|
8384
8444
|
};
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8445
|
+
|
|
8446
|
+
// lib/use-puck.ts
|
|
8447
|
+
init_react_import();
|
|
8448
|
+
var import_react54 = require("react");
|
|
8449
|
+
var import_zustand6 = require("zustand");
|
|
8450
|
+
var generateUsePuck = (store) => {
|
|
8451
|
+
const history = {
|
|
8452
|
+
back: store.history.back,
|
|
8453
|
+
forward: store.history.forward,
|
|
8454
|
+
setHistories: store.history.setHistories,
|
|
8455
|
+
setHistoryIndex: store.history.setHistoryIndex,
|
|
8456
|
+
hasPast: store.history.hasPast(),
|
|
8457
|
+
hasFuture: store.history.hasFuture(),
|
|
8458
|
+
histories: store.history.histories,
|
|
8459
|
+
index: store.history.index
|
|
8460
|
+
};
|
|
8461
|
+
const storeData = {
|
|
8462
|
+
appState: makeStatePublic(store.state),
|
|
8463
|
+
config: store.config,
|
|
8464
|
+
dispatch: store.dispatch,
|
|
8465
|
+
getPermissions: store.permissions.getPermissions,
|
|
8466
|
+
refreshPermissions: store.permissions.refreshPermissions,
|
|
8467
|
+
history,
|
|
8468
|
+
selectedItem: store.selectedItem || null,
|
|
8469
|
+
getItemBySelector: (selector) => getItem(selector, store.state),
|
|
8470
|
+
getItemById: (id) => store.state.indexes.nodes[id].data,
|
|
8471
|
+
getSelectorForId: (id) => {
|
|
8472
|
+
const node = store.state.indexes.nodes[id];
|
|
8473
|
+
if (!node) return;
|
|
8474
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
8475
|
+
const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
8476
|
+
return { zone: zoneCompound, index };
|
|
8409
8477
|
}
|
|
8410
|
-
|
|
8478
|
+
};
|
|
8479
|
+
const get = () => storeData;
|
|
8480
|
+
return __spreadProps(__spreadValues({}, storeData), { get });
|
|
8411
8481
|
};
|
|
8412
|
-
var
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
{
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
(option) => option.value === autoZoom
|
|
8431
|
-
);
|
|
8432
|
-
const zoomOptions = (0, import_react54.useMemo)(
|
|
8433
|
-
() => [
|
|
8434
|
-
...defaultZoomOptions,
|
|
8435
|
-
...defaultsContainAutoZoom ? [] : [
|
|
8436
|
-
{
|
|
8437
|
-
value: autoZoom,
|
|
8438
|
-
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
|
8439
|
-
}
|
|
8440
|
-
]
|
|
8441
|
-
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
8442
|
-
[autoZoom]
|
|
8482
|
+
var UsePuckStoreContext = (0, import_react54.createContext)(
|
|
8483
|
+
null
|
|
8484
|
+
);
|
|
8485
|
+
var convertToPickedStore = (store) => {
|
|
8486
|
+
return {
|
|
8487
|
+
state: store.state,
|
|
8488
|
+
config: store.config,
|
|
8489
|
+
dispatch: store.dispatch,
|
|
8490
|
+
permissions: store.permissions,
|
|
8491
|
+
history: store.history,
|
|
8492
|
+
selectedItem: store.selectedItem
|
|
8493
|
+
};
|
|
8494
|
+
};
|
|
8495
|
+
var useRegisterUsePuckStore = (appStore) => {
|
|
8496
|
+
const [usePuckStore] = (0, import_react54.useState)(
|
|
8497
|
+
() => (0, import_zustand6.createStore)(
|
|
8498
|
+
() => generateUsePuck(convertToPickedStore(appStore.getState()))
|
|
8499
|
+
)
|
|
8443
8500
|
);
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
{
|
|
8448
|
-
|
|
8449
|
-
width: viewport.width,
|
|
8450
|
-
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
|
8451
|
-
onClick: onViewportChange,
|
|
8452
|
-
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
|
8453
|
-
},
|
|
8454
|
-
i
|
|
8455
|
-
)),
|
|
8456
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: getClassName26("divider") }),
|
|
8457
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8458
|
-
IconButton,
|
|
8459
|
-
{
|
|
8460
|
-
title: "Zoom viewport out",
|
|
8461
|
-
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
|
8462
|
-
onClick: (e) => {
|
|
8463
|
-
e.stopPropagation();
|
|
8464
|
-
onZoom(
|
|
8465
|
-
zoomOptions[Math.max(
|
|
8466
|
-
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
|
8467
|
-
0
|
|
8468
|
-
)].value
|
|
8469
|
-
);
|
|
8470
|
-
},
|
|
8471
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ZoomOut, { size: 16 })
|
|
8472
|
-
}
|
|
8473
|
-
),
|
|
8474
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8475
|
-
IconButton,
|
|
8476
|
-
{
|
|
8477
|
-
title: "Zoom viewport in",
|
|
8478
|
-
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
|
8479
|
-
onClick: (e) => {
|
|
8480
|
-
e.stopPropagation();
|
|
8481
|
-
onZoom(
|
|
8482
|
-
zoomOptions[Math.min(
|
|
8483
|
-
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
|
8484
|
-
zoomOptions.length - 1
|
|
8485
|
-
)].value
|
|
8486
|
-
);
|
|
8487
|
-
},
|
|
8488
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ZoomIn, { size: 16 })
|
|
8489
|
-
}
|
|
8490
|
-
),
|
|
8491
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: getClassName26("divider") }),
|
|
8492
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8493
|
-
"select",
|
|
8494
|
-
{
|
|
8495
|
-
className: getClassName26("zoomSelect"),
|
|
8496
|
-
value: zoom.toString(),
|
|
8497
|
-
onChange: (e) => {
|
|
8498
|
-
onZoom(parseFloat(e.currentTarget.value));
|
|
8499
|
-
},
|
|
8500
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8501
|
-
"option",
|
|
8502
|
-
{
|
|
8503
|
-
value: option.value,
|
|
8504
|
-
label: option.label
|
|
8505
|
-
},
|
|
8506
|
-
option.label
|
|
8507
|
-
))
|
|
8501
|
+
(0, import_react54.useEffect)(() => {
|
|
8502
|
+
return appStore.subscribe(
|
|
8503
|
+
(store) => convertToPickedStore(store),
|
|
8504
|
+
(pickedStore) => {
|
|
8505
|
+
usePuckStore.setState(generateUsePuck(pickedStore));
|
|
8508
8506
|
}
|
|
8509
|
-
)
|
|
8510
|
-
]
|
|
8507
|
+
);
|
|
8508
|
+
}, []);
|
|
8509
|
+
return usePuckStore;
|
|
8511
8510
|
};
|
|
8511
|
+
function createUsePuck() {
|
|
8512
|
+
return function usePuck2(selector) {
|
|
8513
|
+
const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
|
|
8514
|
+
if (!usePuckApi) {
|
|
8515
|
+
throw new Error("usePuck must be used inside <Puck>.");
|
|
8516
|
+
}
|
|
8517
|
+
const result = (0, import_zustand6.useStore)(
|
|
8518
|
+
usePuckApi,
|
|
8519
|
+
selector != null ? selector : (s) => s
|
|
8520
|
+
);
|
|
8521
|
+
return result;
|
|
8522
|
+
};
|
|
8523
|
+
}
|
|
8524
|
+
function usePuck() {
|
|
8525
|
+
(0, import_react54.useEffect)(() => {
|
|
8526
|
+
console.warn(
|
|
8527
|
+
"You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
|
|
8528
|
+
);
|
|
8529
|
+
}, []);
|
|
8530
|
+
return createUsePuck()((s) => s);
|
|
8531
|
+
}
|
|
8532
|
+
function useGetPuck() {
|
|
8533
|
+
const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
|
|
8534
|
+
if (!usePuckApi) {
|
|
8535
|
+
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
8536
|
+
}
|
|
8537
|
+
return usePuckApi.getState;
|
|
8538
|
+
}
|
|
8539
|
+
|
|
8540
|
+
// components/Puck/index.tsx
|
|
8541
|
+
var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
|
|
8542
|
+
|
|
8543
|
+
// components/Puck/components/Header/index.tsx
|
|
8544
|
+
init_react_import();
|
|
8545
|
+
var import_react55 = require("react");
|
|
8512
8546
|
|
|
8513
|
-
//
|
|
8547
|
+
// components/MenuBar/index.tsx
|
|
8514
8548
|
init_react_import();
|
|
8515
|
-
var styles_module_default22 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
|
|
8516
8549
|
|
|
8517
|
-
//
|
|
8550
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
|
8518
8551
|
init_react_import();
|
|
8519
|
-
var
|
|
8520
|
-
var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
8521
|
-
const box = getBox(frame);
|
|
8522
|
-
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
|
8523
|
-
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
|
8524
|
-
let rootHeight = 0;
|
|
8525
|
-
let autoZoom = 1;
|
|
8526
|
-
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
|
8527
|
-
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
|
8528
|
-
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
|
8529
|
-
zoom = widthZoom;
|
|
8530
|
-
if (widthZoom < heightZoom) {
|
|
8531
|
-
rootHeight = viewportHeight / zoom;
|
|
8532
|
-
} else {
|
|
8533
|
-
rootHeight = viewportHeight;
|
|
8534
|
-
zoom = heightZoom;
|
|
8535
|
-
}
|
|
8536
|
-
autoZoom = zoom;
|
|
8537
|
-
} else {
|
|
8538
|
-
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
|
8539
|
-
autoZoom = 1;
|
|
8540
|
-
zoom = 1;
|
|
8541
|
-
rootHeight = viewportHeight;
|
|
8542
|
-
}
|
|
8543
|
-
}
|
|
8544
|
-
return { autoZoom, rootHeight, zoom };
|
|
8545
|
-
};
|
|
8552
|
+
var styles_module_default21 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
|
8546
8553
|
|
|
8547
|
-
// components/
|
|
8548
|
-
var
|
|
8549
|
-
var
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
iframe
|
|
8561
|
-
} = useAppStore(
|
|
8562
|
-
(0, import_shallow8.useShallow)((s) => ({
|
|
8563
|
-
dispatch: s.dispatch,
|
|
8564
|
-
overrides: s.overrides,
|
|
8565
|
-
setUi: s.setUi,
|
|
8566
|
-
zoomConfig: s.zoomConfig,
|
|
8567
|
-
setZoomConfig: s.setZoomConfig,
|
|
8568
|
-
status: s.status,
|
|
8569
|
-
iframe: s.iframe
|
|
8570
|
-
}))
|
|
8571
|
-
);
|
|
8572
|
-
const { leftSideBarVisible, rightSideBarVisible, viewports } = useAppStore(
|
|
8573
|
-
(0, import_shallow8.useShallow)((s) => ({
|
|
8574
|
-
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
|
8575
|
-
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
|
8576
|
-
viewports: s.state.ui.viewports
|
|
8577
|
-
}))
|
|
8578
|
-
);
|
|
8579
|
-
const frameRef = (0, import_react55.useRef)(null);
|
|
8580
|
-
const [showTransition, setShowTransition] = (0, import_react55.useState)(false);
|
|
8581
|
-
const defaultRender = (0, import_react55.useMemo)(() => {
|
|
8582
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
|
|
8583
|
-
return PuckDefault;
|
|
8584
|
-
}, []);
|
|
8585
|
-
const CustomPreview = (0, import_react55.useMemo)(
|
|
8586
|
-
() => overrides.preview || defaultRender,
|
|
8587
|
-
[overrides]
|
|
8588
|
-
);
|
|
8589
|
-
const getFrameDimensions = (0, import_react55.useCallback)(() => {
|
|
8590
|
-
if (frameRef.current) {
|
|
8591
|
-
const frame = frameRef.current;
|
|
8592
|
-
const box = getBox(frame);
|
|
8593
|
-
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
8594
|
-
}
|
|
8595
|
-
return { width: 0, height: 0 };
|
|
8596
|
-
}, [frameRef]);
|
|
8597
|
-
const resetAutoZoom = (0, import_react55.useCallback)(
|
|
8598
|
-
(newViewports = viewports) => {
|
|
8599
|
-
if (frameRef.current) {
|
|
8600
|
-
setZoomConfig(
|
|
8601
|
-
getZoomConfig(
|
|
8602
|
-
newViewports == null ? void 0 : newViewports.current,
|
|
8603
|
-
frameRef.current,
|
|
8604
|
-
zoomConfig.zoom
|
|
8605
|
-
)
|
|
8606
|
-
);
|
|
8607
|
-
}
|
|
8608
|
-
},
|
|
8609
|
-
[frameRef, zoomConfig, viewports]
|
|
8610
|
-
);
|
|
8611
|
-
(0, import_react55.useEffect)(() => {
|
|
8612
|
-
setShowTransition(false);
|
|
8613
|
-
resetAutoZoom(viewports);
|
|
8614
|
-
}, [frameRef, leftSideBarVisible, rightSideBarVisible]);
|
|
8615
|
-
(0, import_react55.useEffect)(() => {
|
|
8616
|
-
const { height: frameHeight } = getFrameDimensions();
|
|
8617
|
-
if (viewports.current.height === "auto") {
|
|
8618
|
-
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
8619
|
-
rootHeight: frameHeight / zoomConfig.zoom
|
|
8620
|
-
}));
|
|
8621
|
-
}
|
|
8622
|
-
}, [zoomConfig.zoom]);
|
|
8623
|
-
(0, import_react55.useEffect)(() => {
|
|
8624
|
-
if (ZOOM_ON_CHANGE) {
|
|
8625
|
-
setShowTransition(true);
|
|
8626
|
-
resetAutoZoom(viewports);
|
|
8627
|
-
}
|
|
8628
|
-
}, [viewports.current.width]);
|
|
8629
|
-
(0, import_react55.useEffect)(() => {
|
|
8630
|
-
const cb = () => {
|
|
8631
|
-
setShowTransition(false);
|
|
8632
|
-
resetAutoZoom();
|
|
8633
|
-
};
|
|
8634
|
-
window.addEventListener("resize", cb);
|
|
8635
|
-
return () => {
|
|
8636
|
-
window.removeEventListener("resize", cb);
|
|
8637
|
-
};
|
|
8638
|
-
}, []);
|
|
8639
|
-
const [showLoader, setShowLoader] = (0, import_react55.useState)(false);
|
|
8640
|
-
(0, import_react55.useEffect)(() => {
|
|
8641
|
-
setTimeout(() => {
|
|
8642
|
-
setShowLoader(true);
|
|
8643
|
-
}, 500);
|
|
8644
|
-
}, []);
|
|
8645
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8554
|
+
// components/MenuBar/index.tsx
|
|
8555
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8556
|
+
var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
|
|
8557
|
+
function MenuBar({
|
|
8558
|
+
menuOpen = false,
|
|
8559
|
+
renderHeaderActions,
|
|
8560
|
+
setMenuOpen
|
|
8561
|
+
}) {
|
|
8562
|
+
const back = useAppStore((s) => s.history.back);
|
|
8563
|
+
const forward = useAppStore((s) => s.history.forward);
|
|
8564
|
+
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
8565
|
+
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
8566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8646
8567
|
"div",
|
|
8647
8568
|
{
|
|
8648
|
-
className:
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
onViewportChange: (viewport) => {
|
|
8664
|
-
setShowTransition(true);
|
|
8665
|
-
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
|
8666
|
-
height: viewport.height || "auto",
|
|
8667
|
-
zoom: zoomConfig.zoom
|
|
8668
|
-
});
|
|
8669
|
-
const newUi = {
|
|
8670
|
-
viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport }),
|
|
8671
|
-
itemSelector: null
|
|
8672
|
-
};
|
|
8673
|
-
setUi(newUi);
|
|
8674
|
-
if (ZOOM_ON_CHANGE) {
|
|
8675
|
-
resetAutoZoom(__spreadProps(__spreadValues({}, viewports), { current: uiViewport }));
|
|
8676
|
-
}
|
|
8677
|
-
},
|
|
8678
|
-
onZoom: (zoom) => {
|
|
8679
|
-
setShowTransition(true);
|
|
8680
|
-
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
|
8681
|
-
}
|
|
8682
|
-
}
|
|
8683
|
-
) }),
|
|
8684
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("inner"), ref: frameRef, children: [
|
|
8685
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8686
|
-
"div",
|
|
8569
|
+
className: getClassName26({ menuOpen }),
|
|
8570
|
+
onClick: (event) => {
|
|
8571
|
+
var _a;
|
|
8572
|
+
const element = event.target;
|
|
8573
|
+
if (window.matchMedia("(min-width: 638px)").matches) {
|
|
8574
|
+
return;
|
|
8575
|
+
}
|
|
8576
|
+
if (element.tagName === "A" && ((_a = element.getAttribute("href")) == null ? void 0 : _a.startsWith("#"))) {
|
|
8577
|
+
setMenuOpen(false);
|
|
8578
|
+
}
|
|
8579
|
+
},
|
|
8580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("inner"), children: [
|
|
8581
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("history"), children: [
|
|
8582
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8583
|
+
IconButton,
|
|
8687
8584
|
{
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
|
|
8694
|
-
overflow: iframe.enabled ? void 0 : "auto"
|
|
8695
|
-
},
|
|
8696
|
-
suppressHydrationWarning: true,
|
|
8697
|
-
id: "puck-canvas-root",
|
|
8698
|
-
onTransitionEnd: () => {
|
|
8699
|
-
window.dispatchEvent(
|
|
8700
|
-
new CustomEvent("viewportchange", {
|
|
8701
|
-
bubbles: true,
|
|
8702
|
-
cancelable: false
|
|
8703
|
-
})
|
|
8704
|
-
);
|
|
8705
|
-
},
|
|
8706
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Preview2, {}) })
|
|
8585
|
+
type: "button",
|
|
8586
|
+
title: "undo",
|
|
8587
|
+
disabled: !hasPast,
|
|
8588
|
+
onClick: back,
|
|
8589
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Undo2, { size: 21 })
|
|
8707
8590
|
}
|
|
8708
8591
|
),
|
|
8709
|
-
/* @__PURE__ */ (0,
|
|
8710
|
-
|
|
8711
|
-
|
|
8592
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8593
|
+
IconButton,
|
|
8594
|
+
{
|
|
8595
|
+
type: "button",
|
|
8596
|
+
title: "redo",
|
|
8597
|
+
disabled: !hasFuture,
|
|
8598
|
+
onClick: forward,
|
|
8599
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Redo2, { size: 21 })
|
|
8600
|
+
}
|
|
8601
|
+
)
|
|
8602
|
+
] }),
|
|
8603
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
|
8604
|
+
] })
|
|
8712
8605
|
}
|
|
8713
8606
|
);
|
|
8714
|
-
}
|
|
8715
|
-
|
|
8716
|
-
// components/Puck/components/Nav/index.tsx
|
|
8717
|
-
init_react_import();
|
|
8607
|
+
}
|
|
8718
8608
|
|
|
8719
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/
|
|
8609
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
|
|
8720
8610
|
init_react_import();
|
|
8721
|
-
var
|
|
8722
|
-
|
|
8723
|
-
// components/Puck/components/Nav/index.tsx
|
|
8724
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8725
|
-
var getClassName28 = get_class_name_factory_default("Nav", styles_module_default23);
|
|
8726
|
-
var getClassNameSection = get_class_name_factory_default("NavSection", styles_module_default23);
|
|
8727
|
-
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default23);
|
|
8728
|
-
var MenuItem = ({
|
|
8729
|
-
label,
|
|
8730
|
-
icon,
|
|
8731
|
-
items,
|
|
8732
|
-
onClick,
|
|
8733
|
-
isActive
|
|
8734
|
-
}) => {
|
|
8735
|
-
const showChildren = isActive;
|
|
8736
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("li", { className: getClassNameItem3({ active: isActive }), children: [
|
|
8737
|
-
onClick && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
8738
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
8739
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
8740
|
-
] }),
|
|
8741
|
-
items && showChildren && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: getClassNameItem3("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuItem, __spreadValues({}, item), key)) })
|
|
8742
|
-
] });
|
|
8743
|
-
};
|
|
8744
|
-
var NavSection = ({ title, items }) => {
|
|
8745
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("li", { className: getClassNameSection(), children: [
|
|
8746
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameSection("title"), children: title }),
|
|
8747
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: getClassNameSection("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuItem, __spreadValues({}, item), key)) })
|
|
8748
|
-
] });
|
|
8749
|
-
};
|
|
8750
|
-
var Nav = ({
|
|
8751
|
-
navigation,
|
|
8752
|
-
slim
|
|
8753
|
-
}) => {
|
|
8754
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("nav", { className: getClassName28({ slim }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: getClassName28("list"), children: Object.entries(navigation).map(([key, section]) => {
|
|
8755
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(NavSection, { title: section.title, items: section.items }, key);
|
|
8756
|
-
}) }) });
|
|
8757
|
-
};
|
|
8611
|
+
var styles_module_default22 = { "PuckHeader": "_PuckHeader_15xnq_1", "PuckHeader-inner": "_PuckHeader-inner_15xnq_10", "PuckHeader-toggle": "_PuckHeader-toggle_15xnq_20", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_15xnq_27", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_15xnq_27", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_15xnq_28", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_15xnq_28", "PuckHeader-title": "_PuckHeader-title_15xnq_32", "PuckHeader-path": "_PuckHeader-path_15xnq_36", "PuckHeader-tools": "_PuckHeader-tools_15xnq_43", "PuckHeader-menuButton": "_PuckHeader-menuButton_15xnq_49", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_15xnq_54" };
|
|
8758
8612
|
|
|
8759
|
-
// components/Puck/components/
|
|
8760
|
-
var
|
|
8761
|
-
var
|
|
8762
|
-
var
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8613
|
+
// components/Puck/components/Header/index.tsx
|
|
8614
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8615
|
+
var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
|
|
8616
|
+
var HeaderInner = () => {
|
|
8617
|
+
const {
|
|
8618
|
+
onPublish,
|
|
8619
|
+
renderHeader,
|
|
8620
|
+
renderHeaderActions,
|
|
8621
|
+
headerTitle,
|
|
8622
|
+
headerPath,
|
|
8623
|
+
iframe: _iframe
|
|
8624
|
+
} = usePropsContext();
|
|
8625
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
8626
|
+
const appStore = useAppStoreApi();
|
|
8627
|
+
const defaultHeaderRender = (0, import_react55.useMemo)(() => {
|
|
8628
|
+
if (renderHeader) {
|
|
8629
|
+
console.warn(
|
|
8630
|
+
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
8631
|
+
);
|
|
8632
|
+
const RenderHeader = (_a) => {
|
|
8633
|
+
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
8634
|
+
const Comp = renderHeader;
|
|
8635
|
+
const appState = useAppStore((s) => s.state);
|
|
8636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
8637
|
+
};
|
|
8638
|
+
return RenderHeader;
|
|
8639
|
+
}
|
|
8640
|
+
return DefaultOverride;
|
|
8641
|
+
}, [renderHeader]);
|
|
8642
|
+
const defaultHeaderActionsRender = (0, import_react55.useMemo)(() => {
|
|
8643
|
+
if (renderHeaderActions) {
|
|
8644
|
+
console.warn(
|
|
8645
|
+
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
8646
|
+
);
|
|
8647
|
+
const RenderHeader = (props) => {
|
|
8648
|
+
const Comp = renderHeaderActions;
|
|
8649
|
+
const appState = useAppStore((s) => s.state);
|
|
8650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
8651
|
+
};
|
|
8652
|
+
return RenderHeader;
|
|
8768
8653
|
}
|
|
8654
|
+
return DefaultOverride;
|
|
8655
|
+
}, [renderHeader]);
|
|
8656
|
+
const CustomHeader = useAppStore(
|
|
8657
|
+
(s) => s.overrides.header || defaultHeaderRender
|
|
8769
8658
|
);
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
var Layout = ({ children }) => {
|
|
8773
|
-
const {
|
|
8774
|
-
iframe: _iframe,
|
|
8775
|
-
dnd,
|
|
8776
|
-
initialHistory: _initialHistory,
|
|
8777
|
-
plugins
|
|
8778
|
-
} = usePropsContext();
|
|
8779
|
-
const iframe = (0, import_react56.useMemo)(
|
|
8780
|
-
() => __spreadValues({
|
|
8781
|
-
enabled: true,
|
|
8782
|
-
waitForStyles: true
|
|
8783
|
-
}, _iframe),
|
|
8784
|
-
[_iframe]
|
|
8659
|
+
const CustomHeaderActions = useAppStore(
|
|
8660
|
+
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
8785
8661
|
);
|
|
8786
|
-
|
|
8662
|
+
const [menuOpen, setMenuOpen] = (0, import_react55.useState)(false);
|
|
8663
|
+
const rootTitle = useAppStore((s) => {
|
|
8664
|
+
var _a, _b;
|
|
8665
|
+
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
8666
|
+
return (_b = rootData.props.title) != null ? _b : "";
|
|
8667
|
+
});
|
|
8787
8668
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8788
8669
|
const rightSideBarVisible = useAppStore(
|
|
8789
8670
|
(s) => s.state.ui.rightSideBarVisible
|
|
8790
8671
|
);
|
|
8791
|
-
const
|
|
8792
|
-
|
|
8793
|
-
|
|
8672
|
+
const toggleSidebars = (0, import_react55.useCallback)(
|
|
8673
|
+
(sidebar) => {
|
|
8674
|
+
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
8675
|
+
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
8676
|
+
const oppositeSideBar = sidebar === "left" ? "rightSideBarVisible" : "leftSideBarVisible";
|
|
8794
8677
|
dispatch({
|
|
8795
8678
|
type: "setUi",
|
|
8796
|
-
ui: {
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
}
|
|
8679
|
+
ui: __spreadValues({
|
|
8680
|
+
[`${sidebar}SideBarVisible`]: !sideBarVisible
|
|
8681
|
+
}, !widerViewport ? { [oppositeSideBar]: false } : {})
|
|
8800
8682
|
});
|
|
8801
|
-
}
|
|
8802
|
-
|
|
8803
|
-
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8804
|
-
dispatch({
|
|
8805
|
-
type: "setUi",
|
|
8806
|
-
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
8807
|
-
});
|
|
8808
|
-
}
|
|
8809
|
-
};
|
|
8810
|
-
window.addEventListener("resize", handleResize);
|
|
8811
|
-
return () => {
|
|
8812
|
-
window.removeEventListener("resize", handleResize);
|
|
8813
|
-
};
|
|
8814
|
-
}, []);
|
|
8815
|
-
const overrides = useAppStore((s) => s.overrides);
|
|
8816
|
-
const CustomPuck = (0, import_react56.useMemo)(
|
|
8817
|
-
() => overrides.puck || DefaultOverride,
|
|
8818
|
-
[overrides]
|
|
8683
|
+
},
|
|
8684
|
+
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
8819
8685
|
);
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
(0, import_react56.useEffect)(() => {
|
|
8827
|
-
if (ready && iframe.enabled) {
|
|
8828
|
-
const frameDoc = getFrame();
|
|
8829
|
-
if (frameDoc) {
|
|
8830
|
-
return monitorHotkeys(frameDoc);
|
|
8831
|
-
}
|
|
8832
|
-
}
|
|
8833
|
-
}, [ready, iframe.enabled]);
|
|
8834
|
-
usePreviewModeHotkeys();
|
|
8835
|
-
const [view, setView] = (0, import_react56.useState)("blocks");
|
|
8836
|
-
const pluginItems = (0, import_react56.useMemo)(() => {
|
|
8837
|
-
const details = {};
|
|
8838
|
-
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
8839
|
-
var _a, _b;
|
|
8840
|
-
if (plugin.name && plugin.render) {
|
|
8841
|
-
details[plugin.name] = {
|
|
8842
|
-
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
8843
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ToyBrick, {}),
|
|
8686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8687
|
+
CustomHeader,
|
|
8688
|
+
{
|
|
8689
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8690
|
+
Button,
|
|
8691
|
+
{
|
|
8844
8692
|
onClick: () => {
|
|
8845
|
-
|
|
8693
|
+
const data = appStore.getState().state.data;
|
|
8694
|
+
onPublish && onPublish(data);
|
|
8846
8695
|
},
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
}
|
|
8850
|
-
}
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8696
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
|
8697
|
+
children: "Publish"
|
|
8698
|
+
}
|
|
8699
|
+
) }) }),
|
|
8700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8701
|
+
"header",
|
|
8702
|
+
{
|
|
8703
|
+
className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
|
|
8704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("inner"), children: [
|
|
8705
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("toggle"), children: [
|
|
8706
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8707
|
+
IconButton,
|
|
8708
|
+
{
|
|
8709
|
+
type: "button",
|
|
8710
|
+
onClick: () => {
|
|
8711
|
+
toggleSidebars("left");
|
|
8712
|
+
},
|
|
8713
|
+
title: "Toggle left sidebar",
|
|
8714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
|
|
8715
|
+
}
|
|
8716
|
+
) }),
|
|
8717
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8718
|
+
IconButton,
|
|
8719
|
+
{
|
|
8720
|
+
type: "button",
|
|
8721
|
+
onClick: () => {
|
|
8722
|
+
toggleSidebars("right");
|
|
8723
|
+
},
|
|
8724
|
+
title: "Toggle right sidebar",
|
|
8725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
|
|
8726
|
+
}
|
|
8727
|
+
) })
|
|
8728
|
+
] }),
|
|
8729
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("title"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
|
8730
|
+
headerTitle || rootTitle || "Page",
|
|
8731
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8732
|
+
" ",
|
|
8733
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: getClassName27("path"), children: headerPath })
|
|
8734
|
+
] })
|
|
8735
|
+
] }) }),
|
|
8736
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("tools"), children: [
|
|
8737
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8738
|
+
IconButton,
|
|
8739
|
+
{
|
|
8740
|
+
type: "button",
|
|
8741
|
+
onClick: () => {
|
|
8742
|
+
return setMenuOpen(!menuOpen);
|
|
8743
|
+
},
|
|
8744
|
+
title: "Toggle menu bar",
|
|
8745
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronDown, { focusable: "false" })
|
|
8746
|
+
}
|
|
8747
|
+
) }),
|
|
8748
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8749
|
+
MenuBar,
|
|
8750
|
+
{
|
|
8751
|
+
dispatch,
|
|
8752
|
+
onPublish,
|
|
8753
|
+
menuOpen,
|
|
8754
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8755
|
+
Button,
|
|
8756
|
+
{
|
|
8893
8757
|
onClick: () => {
|
|
8894
|
-
|
|
8758
|
+
const data = appStore.getState().state.data;
|
|
8759
|
+
onPublish && onPublish(data);
|
|
8895
8760
|
},
|
|
8896
|
-
|
|
8761
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
|
8762
|
+
children: "Publish"
|
|
8897
8763
|
}
|
|
8898
|
-
},
|
|
8764
|
+
) }),
|
|
8765
|
+
setMenuOpen
|
|
8899
8766
|
}
|
|
8900
|
-
|
|
8901
|
-
}
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
}
|
|
8908
|
-
) }) }),
|
|
8909
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { id: "puck-portal-root", className: getClassName29("portal") })
|
|
8910
|
-
] });
|
|
8767
|
+
)
|
|
8768
|
+
] })
|
|
8769
|
+
] })
|
|
8770
|
+
}
|
|
8771
|
+
)
|
|
8772
|
+
}
|
|
8773
|
+
);
|
|
8911
8774
|
};
|
|
8775
|
+
var Header = (0, import_react55.memo)(HeaderInner);
|
|
8912
8776
|
|
|
8913
8777
|
// components/Puck/index.tsx
|
|
8914
|
-
var
|
|
8915
|
-
var
|
|
8778
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8779
|
+
var getClassName28 = get_class_name_factory_default("Puck", styles_module_default14);
|
|
8780
|
+
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default14);
|
|
8781
|
+
var FieldSideBar = () => {
|
|
8782
|
+
const title = useAppStore(
|
|
8783
|
+
(s) => {
|
|
8784
|
+
var _a, _b;
|
|
8785
|
+
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
|
|
8786
|
+
}
|
|
8787
|
+
);
|
|
8788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Fields, {}) });
|
|
8789
|
+
};
|
|
8790
|
+
var propsContext = (0, import_react56.createContext)({});
|
|
8916
8791
|
function PropsProvider(props) {
|
|
8917
|
-
return /* @__PURE__ */ (0,
|
|
8792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
8918
8793
|
}
|
|
8919
|
-
var usePropsContext = () => (0,
|
|
8794
|
+
var usePropsContext = () => (0, import_react56.useContext)(propsContext);
|
|
8920
8795
|
function PuckProvider({ children }) {
|
|
8921
8796
|
const {
|
|
8922
8797
|
config,
|
|
@@ -8932,14 +8807,14 @@ function PuckProvider({ children }) {
|
|
|
8932
8807
|
metadata,
|
|
8933
8808
|
onAction
|
|
8934
8809
|
} = usePropsContext();
|
|
8935
|
-
const iframe = (0,
|
|
8810
|
+
const iframe = (0, import_react56.useMemo)(
|
|
8936
8811
|
() => __spreadValues({
|
|
8937
8812
|
enabled: true,
|
|
8938
8813
|
waitForStyles: true
|
|
8939
8814
|
}, _iframe),
|
|
8940
8815
|
[_iframe]
|
|
8941
8816
|
);
|
|
8942
|
-
const [generatedAppState] = (0,
|
|
8817
|
+
const [generatedAppState] = (0, import_react56.useState)(() => {
|
|
8943
8818
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
8944
8819
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
8945
8820
|
let clientUiState = {};
|
|
@@ -8999,7 +8874,7 @@ function PuckProvider({ children }) {
|
|
|
8999
8874
|
return walkAppState(newAppState, config);
|
|
9000
8875
|
});
|
|
9001
8876
|
const { appendData = true } = _initialHistory || {};
|
|
9002
|
-
const [blendedHistories] = (0,
|
|
8877
|
+
const [blendedHistories] = (0, import_react56.useState)(
|
|
9003
8878
|
[
|
|
9004
8879
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
9005
8880
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -9019,7 +8894,7 @@ function PuckProvider({ children }) {
|
|
|
9019
8894
|
overrides,
|
|
9020
8895
|
plugins
|
|
9021
8896
|
});
|
|
9022
|
-
const generateAppStore = (0,
|
|
8897
|
+
const generateAppStore = (0, import_react56.useCallback)(
|
|
9023
8898
|
(state) => {
|
|
9024
8899
|
return {
|
|
9025
8900
|
state,
|
|
@@ -9043,15 +8918,15 @@ function PuckProvider({ children }) {
|
|
|
9043
8918
|
metadata
|
|
9044
8919
|
]
|
|
9045
8920
|
);
|
|
9046
|
-
const [appStore] = (0,
|
|
8921
|
+
const [appStore] = (0, import_react56.useState)(
|
|
9047
8922
|
() => createAppStore(generateAppStore(initialAppState))
|
|
9048
8923
|
);
|
|
9049
|
-
(0,
|
|
8924
|
+
(0, import_react56.useEffect)(() => {
|
|
9050
8925
|
if (process.env.NODE_ENV !== "production") {
|
|
9051
8926
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
9052
8927
|
}
|
|
9053
8928
|
}, [appStore]);
|
|
9054
|
-
(0,
|
|
8929
|
+
(0, import_react56.useEffect)(() => {
|
|
9055
8930
|
const state = appStore.getState().state;
|
|
9056
8931
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
9057
8932
|
}, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
|
|
@@ -9060,8 +8935,8 @@ function PuckProvider({ children }) {
|
|
|
9060
8935
|
index: initialHistoryIndex,
|
|
9061
8936
|
initialAppState
|
|
9062
8937
|
});
|
|
9063
|
-
const previousData = (0,
|
|
9064
|
-
(0,
|
|
8938
|
+
const previousData = (0, import_react56.useRef)(null);
|
|
8939
|
+
(0, import_react56.useEffect)(() => {
|
|
9065
8940
|
appStore.subscribe(
|
|
9066
8941
|
(s) => s.state.data,
|
|
9067
8942
|
(data) => {
|
|
@@ -9075,14 +8950,99 @@ function PuckProvider({ children }) {
|
|
|
9075
8950
|
}, []);
|
|
9076
8951
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
9077
8952
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
9078
|
-
(0,
|
|
8953
|
+
(0, import_react56.useEffect)(() => {
|
|
9079
8954
|
const { resolveAndCommitData } = appStore.getState();
|
|
9080
8955
|
resolveAndCommitData();
|
|
9081
8956
|
}, []);
|
|
9082
|
-
return /* @__PURE__ */ (0,
|
|
8957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
8958
|
+
}
|
|
8959
|
+
function PuckLayout({ children }) {
|
|
8960
|
+
const {
|
|
8961
|
+
iframe: _iframe,
|
|
8962
|
+
dnd,
|
|
8963
|
+
initialHistory: _initialHistory
|
|
8964
|
+
} = usePropsContext();
|
|
8965
|
+
const iframe = (0, import_react56.useMemo)(
|
|
8966
|
+
() => __spreadValues({
|
|
8967
|
+
enabled: true,
|
|
8968
|
+
waitForStyles: true
|
|
8969
|
+
}, _iframe),
|
|
8970
|
+
[_iframe]
|
|
8971
|
+
);
|
|
8972
|
+
useInjectGlobalCss(iframe.enabled);
|
|
8973
|
+
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8974
|
+
const rightSideBarVisible = useAppStore(
|
|
8975
|
+
(s) => s.state.ui.rightSideBarVisible
|
|
8976
|
+
);
|
|
8977
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
8978
|
+
(0, import_react56.useEffect)(() => {
|
|
8979
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8980
|
+
dispatch({
|
|
8981
|
+
type: "setUi",
|
|
8982
|
+
ui: {
|
|
8983
|
+
leftSideBarVisible: false,
|
|
8984
|
+
rightSideBarVisible: false
|
|
8985
|
+
}
|
|
8986
|
+
});
|
|
8987
|
+
}
|
|
8988
|
+
const handleResize = () => {
|
|
8989
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8990
|
+
dispatch({
|
|
8991
|
+
type: "setUi",
|
|
8992
|
+
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
8993
|
+
});
|
|
8994
|
+
}
|
|
8995
|
+
};
|
|
8996
|
+
window.addEventListener("resize", handleResize);
|
|
8997
|
+
return () => {
|
|
8998
|
+
window.removeEventListener("resize", handleResize);
|
|
8999
|
+
};
|
|
9000
|
+
}, []);
|
|
9001
|
+
const overrides = useAppStore((s) => s.overrides);
|
|
9002
|
+
const CustomPuck = (0, import_react56.useMemo)(
|
|
9003
|
+
() => overrides.puck || DefaultOverride,
|
|
9004
|
+
[overrides]
|
|
9005
|
+
);
|
|
9006
|
+
const [mounted, setMounted] = (0, import_react56.useState)(false);
|
|
9007
|
+
(0, import_react56.useEffect)(() => {
|
|
9008
|
+
setMounted(true);
|
|
9009
|
+
}, []);
|
|
9010
|
+
const ready = useAppStore((s) => s.status === "READY");
|
|
9011
|
+
useMonitorHotkeys();
|
|
9012
|
+
(0, import_react56.useEffect)(() => {
|
|
9013
|
+
if (ready && iframe.enabled) {
|
|
9014
|
+
const frameDoc = getFrame();
|
|
9015
|
+
if (frameDoc) {
|
|
9016
|
+
return monitorHotkeys(frameDoc);
|
|
9017
|
+
}
|
|
9018
|
+
}
|
|
9019
|
+
}, [ready, iframe.enabled]);
|
|
9020
|
+
usePreviewModeHotkeys();
|
|
9021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `Puck ${getClassName28()}`, children: [
|
|
9022
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9023
|
+
"div",
|
|
9024
|
+
{
|
|
9025
|
+
className: getLayoutClassName({
|
|
9026
|
+
leftSideBarVisible,
|
|
9027
|
+
mounted,
|
|
9028
|
+
rightSideBarVisible
|
|
9029
|
+
}),
|
|
9030
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
|
9031
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Header, {}),
|
|
9032
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
|
9033
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Components, {}) }),
|
|
9034
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Outline, {}) })
|
|
9035
|
+
] }),
|
|
9036
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Canvas, {}),
|
|
9037
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FieldSideBar, {}) })
|
|
9038
|
+
] })
|
|
9039
|
+
}
|
|
9040
|
+
) }) }),
|
|
9041
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: "puck-portal-root", className: getClassName28("portal") })
|
|
9042
|
+
] });
|
|
9083
9043
|
}
|
|
9084
9044
|
function Puck(props) {
|
|
9085
|
-
return /* @__PURE__ */ (0,
|
|
9045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
|
|
9086
9046
|
}
|
|
9087
9047
|
Puck.Components = Components;
|
|
9088
9048
|
Puck.Fields = Fields;
|
|
@@ -9217,14 +9177,6 @@ lucide-react/dist/esm/icons/globe.js:
|
|
|
9217
9177
|
* See the LICENSE file in the root directory of this source tree.
|
|
9218
9178
|
*)
|
|
9219
9179
|
|
|
9220
|
-
lucide-react/dist/esm/icons/hammer.js:
|
|
9221
|
-
(**
|
|
9222
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9223
|
-
*
|
|
9224
|
-
* This source code is licensed under the ISC license.
|
|
9225
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9226
|
-
*)
|
|
9227
|
-
|
|
9228
9180
|
lucide-react/dist/esm/icons/hash.js:
|
|
9229
9181
|
(**
|
|
9230
9182
|
* @license lucide-react v0.468.0 - ISC
|
|
@@ -9353,14 +9305,6 @@ lucide-react/dist/esm/icons/tablet.js:
|
|
|
9353
9305
|
* See the LICENSE file in the root directory of this source tree.
|
|
9354
9306
|
*)
|
|
9355
9307
|
|
|
9356
|
-
lucide-react/dist/esm/icons/toy-brick.js:
|
|
9357
|
-
(**
|
|
9358
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9359
|
-
*
|
|
9360
|
-
* This source code is licensed under the ISC license.
|
|
9361
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9362
|
-
*)
|
|
9363
|
-
|
|
9364
9308
|
lucide-react/dist/esm/icons/trash.js:
|
|
9365
9309
|
(**
|
|
9366
9310
|
* @license lucide-react v0.468.0 - ISC
|