@measured/puck 0.20.0-canary.755737e8 → 0.20.0-canary.93d525c5
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 +1199 -1254
- package/dist/index.mjs +924 -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) => {
|
|
@@ -6149,6 +6177,7 @@ var findDeepestCandidate = (position, manager) => {
|
|
|
6149
6177
|
});
|
|
6150
6178
|
filteredCandidates.reverse();
|
|
6151
6179
|
const primaryCandidate = filteredCandidates[0];
|
|
6180
|
+
if (!primaryCandidate) return { zone: null, area: null };
|
|
6152
6181
|
const primaryCandidateData = primaryCandidate.data;
|
|
6153
6182
|
const primaryCandidateIsComponent = "containsActiveZone" in primaryCandidateData;
|
|
6154
6183
|
const zone = getZoneId2(primaryCandidate);
|
|
@@ -6791,24 +6820,121 @@ Drawer.Item = DrawerItem;
|
|
|
6791
6820
|
|
|
6792
6821
|
// components/Puck/index.tsx
|
|
6793
6822
|
init_react_import();
|
|
6794
|
-
var
|
|
6823
|
+
var import_react56 = require("react");
|
|
6824
|
+
|
|
6825
|
+
// components/SidebarSection/index.tsx
|
|
6826
|
+
init_react_import();
|
|
6827
|
+
|
|
6828
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
6829
|
+
init_react_import();
|
|
6830
|
+
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" };
|
|
6831
|
+
|
|
6832
|
+
// lib/use-breadcrumbs.ts
|
|
6833
|
+
init_react_import();
|
|
6834
|
+
var import_react41 = require("react");
|
|
6835
|
+
var useBreadcrumbs = (renderCount) => {
|
|
6836
|
+
const selectedId = useAppStore((s) => {
|
|
6837
|
+
var _a;
|
|
6838
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
6839
|
+
});
|
|
6840
|
+
const config = useAppStore((s) => s.config);
|
|
6841
|
+
const path = useAppStore((s) => {
|
|
6842
|
+
var _a;
|
|
6843
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
6844
|
+
});
|
|
6845
|
+
const appStore = useAppStoreApi();
|
|
6846
|
+
return (0, import_react41.useMemo)(() => {
|
|
6847
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
6848
|
+
var _a, _b, _c;
|
|
6849
|
+
const [componentId] = zoneCompound.split(":");
|
|
6850
|
+
if (componentId === "root") {
|
|
6851
|
+
return {
|
|
6852
|
+
label: "Page",
|
|
6853
|
+
selector: null
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6856
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
6857
|
+
const parentId = node.path[node.path.length - 1];
|
|
6858
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
6859
|
+
const index = contentIds.indexOf(componentId);
|
|
6860
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
6861
|
+
return {
|
|
6862
|
+
label,
|
|
6863
|
+
selector: node ? {
|
|
6864
|
+
index,
|
|
6865
|
+
zone: node.path[node.path.length - 1]
|
|
6866
|
+
} : null
|
|
6867
|
+
};
|
|
6868
|
+
})) || [];
|
|
6869
|
+
if (renderCount) {
|
|
6870
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
6871
|
+
}
|
|
6872
|
+
return breadcrumbs;
|
|
6873
|
+
}, [path, renderCount]);
|
|
6874
|
+
};
|
|
6875
|
+
|
|
6876
|
+
// components/SidebarSection/index.tsx
|
|
6877
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6878
|
+
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
|
6879
|
+
var SidebarSection = ({
|
|
6880
|
+
children,
|
|
6881
|
+
title,
|
|
6882
|
+
background,
|
|
6883
|
+
showBreadcrumbs,
|
|
6884
|
+
noBorderTop,
|
|
6885
|
+
noPadding,
|
|
6886
|
+
isLoading
|
|
6887
|
+
}) => {
|
|
6888
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
6889
|
+
const breadcrumbs = useBreadcrumbs(1);
|
|
6890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
6891
|
+
"div",
|
|
6892
|
+
{
|
|
6893
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
|
6894
|
+
style: { background },
|
|
6895
|
+
children: [
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
|
6897
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
|
6898
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6899
|
+
"button",
|
|
6900
|
+
{
|
|
6901
|
+
type: "button",
|
|
6902
|
+
className: getClassName19("breadcrumbLabel"),
|
|
6903
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
6904
|
+
children: breadcrumb.label
|
|
6905
|
+
}
|
|
6906
|
+
),
|
|
6907
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
|
|
6908
|
+
] }, i)) : null,
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
6910
|
+
] }) }),
|
|
6911
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
|
|
6912
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
|
|
6913
|
+
]
|
|
6914
|
+
}
|
|
6915
|
+
);
|
|
6916
|
+
};
|
|
6917
|
+
|
|
6918
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
|
6919
|
+
init_react_import();
|
|
6920
|
+
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
6921
|
|
|
6796
6922
|
// components/Puck/components/Fields/index.tsx
|
|
6797
6923
|
init_react_import();
|
|
6798
6924
|
|
|
6799
6925
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
|
6800
6926
|
init_react_import();
|
|
6801
|
-
var
|
|
6927
|
+
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
6928
|
|
|
6803
6929
|
// components/Puck/components/Fields/index.tsx
|
|
6804
|
-
var
|
|
6930
|
+
var import_react42 = require("react");
|
|
6805
6931
|
var import_shallow5 = require("zustand/react/shallow");
|
|
6806
|
-
var
|
|
6807
|
-
var
|
|
6932
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6933
|
+
var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
|
|
6808
6934
|
var DefaultFields = ({
|
|
6809
6935
|
children
|
|
6810
6936
|
}) => {
|
|
6811
|
-
return /* @__PURE__ */ (0,
|
|
6937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
|
|
6812
6938
|
};
|
|
6813
6939
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
|
|
6814
6940
|
let currentProps;
|
|
@@ -6874,13 +7000,13 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
6874
7000
|
})
|
|
6875
7001
|
);
|
|
6876
7002
|
const appStore = useAppStoreApi();
|
|
6877
|
-
const onChange = (0,
|
|
7003
|
+
const onChange = (0, import_react42.useCallback)(createOnChange(fieldName, appStore), [
|
|
6878
7004
|
fieldName
|
|
6879
7005
|
]);
|
|
6880
7006
|
const { visible = true } = field != null ? field : {};
|
|
6881
7007
|
if (!field || !id || !visible) return null;
|
|
6882
7008
|
if (field.type === "slot") return null;
|
|
6883
|
-
return /* @__PURE__ */ (0,
|
|
7009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("field"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6884
7010
|
AutoFieldPrivate,
|
|
6885
7011
|
{
|
|
6886
7012
|
field,
|
|
@@ -6892,7 +7018,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
6892
7018
|
}
|
|
6893
7019
|
) }, id);
|
|
6894
7020
|
};
|
|
6895
|
-
var FieldsChildMemo = (0,
|
|
7021
|
+
var FieldsChildMemo = (0, import_react42.memo)(FieldsChild);
|
|
6896
7022
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
6897
7023
|
const overrides = useAppStore((s) => s.overrides);
|
|
6898
7024
|
const componentResolving = useAppStore((s) => {
|
|
@@ -6917,40 +7043,40 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
6917
7043
|
})
|
|
6918
7044
|
);
|
|
6919
7045
|
const isLoading = fieldsLoading || componentResolving;
|
|
6920
|
-
const Wrapper = (0,
|
|
6921
|
-
return /* @__PURE__ */ (0,
|
|
7046
|
+
const Wrapper = (0, import_react42.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
7047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
6922
7048
|
"form",
|
|
6923
7049
|
{
|
|
6924
|
-
className:
|
|
7050
|
+
className: getClassName20({ wrapFields }),
|
|
6925
7051
|
onSubmit: (e) => {
|
|
6926
7052
|
e.preventDefault();
|
|
6927
7053
|
},
|
|
6928
7054
|
children: [
|
|
6929
|
-
/* @__PURE__ */ (0,
|
|
6930
|
-
isLoading && /* @__PURE__ */ (0,
|
|
7055
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
7056
|
+
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
7057
|
]
|
|
6932
7058
|
}
|
|
6933
7059
|
);
|
|
6934
7060
|
};
|
|
6935
|
-
var Fields = (0,
|
|
7061
|
+
var Fields = (0, import_react42.memo)(FieldsInternal);
|
|
6936
7062
|
|
|
6937
7063
|
// components/Puck/components/Components/index.tsx
|
|
6938
7064
|
init_react_import();
|
|
6939
7065
|
|
|
6940
7066
|
// lib/use-component-list.tsx
|
|
6941
7067
|
init_react_import();
|
|
6942
|
-
var
|
|
7068
|
+
var import_react43 = require("react");
|
|
6943
7069
|
|
|
6944
7070
|
// components/ComponentList/index.tsx
|
|
6945
7071
|
init_react_import();
|
|
6946
7072
|
|
|
6947
7073
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
|
6948
7074
|
init_react_import();
|
|
6949
|
-
var
|
|
7075
|
+
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
7076
|
|
|
6951
7077
|
// components/ComponentList/index.tsx
|
|
6952
|
-
var
|
|
6953
|
-
var
|
|
7078
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7079
|
+
var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
|
|
6954
7080
|
var ComponentListItem = ({
|
|
6955
7081
|
name,
|
|
6956
7082
|
label
|
|
@@ -6961,7 +7087,7 @@ var ComponentListItem = ({
|
|
|
6961
7087
|
type: name
|
|
6962
7088
|
}).insert
|
|
6963
7089
|
);
|
|
6964
|
-
return /* @__PURE__ */ (0,
|
|
7090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
|
|
6965
7091
|
};
|
|
6966
7092
|
var ComponentList = ({
|
|
6967
7093
|
children,
|
|
@@ -6972,12 +7098,12 @@ var ComponentList = ({
|
|
|
6972
7098
|
const setUi = useAppStore((s) => s.setUi);
|
|
6973
7099
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
6974
7100
|
const { expanded = true } = componentList[id] || {};
|
|
6975
|
-
return /* @__PURE__ */ (0,
|
|
6976
|
-
title && /* @__PURE__ */ (0,
|
|
7101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName21({ isExpanded: expanded }), children: [
|
|
7102
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6977
7103
|
"button",
|
|
6978
7104
|
{
|
|
6979
7105
|
type: "button",
|
|
6980
|
-
className:
|
|
7106
|
+
className: getClassName21("title"),
|
|
6981
7107
|
onClick: () => setUi({
|
|
6982
7108
|
componentList: __spreadProps(__spreadValues({}, componentList), {
|
|
6983
7109
|
[id]: __spreadProps(__spreadValues({}, componentList[id]), {
|
|
@@ -6987,14 +7113,14 @@ var ComponentList = ({
|
|
|
6987
7113
|
}),
|
|
6988
7114
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
6989
7115
|
children: [
|
|
6990
|
-
/* @__PURE__ */ (0,
|
|
6991
|
-
/* @__PURE__ */ (0,
|
|
7116
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: title }),
|
|
7117
|
+
/* @__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
7118
|
]
|
|
6993
7119
|
}
|
|
6994
7120
|
),
|
|
6995
|
-
/* @__PURE__ */ (0,
|
|
7121
|
+
/* @__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
7122
|
var _a;
|
|
6997
|
-
return /* @__PURE__ */ (0,
|
|
7123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6998
7124
|
ComponentListItem,
|
|
6999
7125
|
{
|
|
7000
7126
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -7008,12 +7134,12 @@ var ComponentList = ({
|
|
|
7008
7134
|
ComponentList.Item = ComponentListItem;
|
|
7009
7135
|
|
|
7010
7136
|
// lib/use-component-list.tsx
|
|
7011
|
-
var
|
|
7137
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7012
7138
|
var useComponentList = () => {
|
|
7013
|
-
const [componentList, setComponentList] = (0,
|
|
7139
|
+
const [componentList, setComponentList] = (0, import_react43.useState)();
|
|
7014
7140
|
const config = useAppStore((s) => s.config);
|
|
7015
7141
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
7016
|
-
(0,
|
|
7142
|
+
(0, import_react43.useEffect)(() => {
|
|
7017
7143
|
var _a, _b, _c;
|
|
7018
7144
|
if (Object.keys(uiComponentList).length > 0) {
|
|
7019
7145
|
const matchedComponents = [];
|
|
@@ -7023,7 +7149,7 @@ var useComponentList = () => {
|
|
|
7023
7149
|
if (category.visible === false || !category.components) {
|
|
7024
7150
|
return null;
|
|
7025
7151
|
}
|
|
7026
|
-
return /* @__PURE__ */ (0,
|
|
7152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7027
7153
|
ComponentList,
|
|
7028
7154
|
{
|
|
7029
7155
|
id: categoryKey,
|
|
@@ -7032,7 +7158,7 @@ var useComponentList = () => {
|
|
|
7032
7158
|
var _a2;
|
|
7033
7159
|
matchedComponents.push(componentName);
|
|
7034
7160
|
const componentConf = config.components[componentName] || {};
|
|
7035
|
-
return /* @__PURE__ */ (0,
|
|
7161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7036
7162
|
ComponentList.Item,
|
|
7037
7163
|
{
|
|
7038
7164
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -7052,7 +7178,7 @@ var useComponentList = () => {
|
|
|
7052
7178
|
);
|
|
7053
7179
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
7054
7180
|
_componentList.push(
|
|
7055
|
-
/* @__PURE__ */ (0,
|
|
7181
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7056
7182
|
ComponentList,
|
|
7057
7183
|
{
|
|
7058
7184
|
id: "other",
|
|
@@ -7060,7 +7186,7 @@ var useComponentList = () => {
|
|
|
7060
7186
|
children: remainingComponents.map((componentName, i) => {
|
|
7061
7187
|
var _a2;
|
|
7062
7188
|
const componentConf = config.components[componentName] || {};
|
|
7063
|
-
return /* @__PURE__ */ (0,
|
|
7189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7064
7190
|
ComponentList.Item,
|
|
7065
7191
|
{
|
|
7066
7192
|
name: componentName,
|
|
@@ -7082,30 +7208,37 @@ var useComponentList = () => {
|
|
|
7082
7208
|
};
|
|
7083
7209
|
|
|
7084
7210
|
// components/Puck/components/Components/index.tsx
|
|
7085
|
-
var
|
|
7086
|
-
var
|
|
7211
|
+
var import_react44 = require("react");
|
|
7212
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7087
7213
|
var Components = () => {
|
|
7088
7214
|
const overrides = useAppStore((s) => s.overrides);
|
|
7089
7215
|
const componentList = useComponentList();
|
|
7090
|
-
const Wrapper = (0,
|
|
7091
|
-
return /* @__PURE__ */ (0,
|
|
7216
|
+
const Wrapper = (0, import_react44.useMemo)(() => overrides.components || "div", [overrides]);
|
|
7217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComponentList, { id: "all" }) });
|
|
7092
7218
|
};
|
|
7093
7219
|
|
|
7094
7220
|
// components/Puck/components/Preview/index.tsx
|
|
7095
7221
|
init_react_import();
|
|
7096
|
-
var
|
|
7222
|
+
var import_react46 = require("react");
|
|
7097
7223
|
|
|
7098
7224
|
// components/AutoFrame/index.tsx
|
|
7099
7225
|
init_react_import();
|
|
7100
|
-
var
|
|
7226
|
+
var import_react45 = require("react");
|
|
7101
7227
|
var import_object_hash = __toESM(require("object-hash"));
|
|
7102
7228
|
var import_react_dom3 = require("react-dom");
|
|
7103
|
-
var
|
|
7229
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7104
7230
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
7105
7231
|
var collectStyles = (doc) => {
|
|
7106
7232
|
const collected = [];
|
|
7107
7233
|
doc.querySelectorAll(styleSelector).forEach((style) => {
|
|
7108
|
-
|
|
7234
|
+
if (style.tagName === "STYLE") {
|
|
7235
|
+
const hasContent = !!style.innerHTML.trim();
|
|
7236
|
+
if (hasContent) {
|
|
7237
|
+
collected.push(style);
|
|
7238
|
+
}
|
|
7239
|
+
} else {
|
|
7240
|
+
collected.push(style);
|
|
7241
|
+
}
|
|
7109
7242
|
});
|
|
7110
7243
|
return collected;
|
|
7111
7244
|
};
|
|
@@ -7118,7 +7251,7 @@ var getStyleSheet = (el) => {
|
|
|
7118
7251
|
var getStyles = (styleSheet) => {
|
|
7119
7252
|
if (styleSheet) {
|
|
7120
7253
|
try {
|
|
7121
|
-
return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
|
7254
|
+
return [...Array.from(styleSheet.cssRules)].map((rule) => rule.cssText).join("");
|
|
7122
7255
|
} catch (e) {
|
|
7123
7256
|
console.warn(
|
|
7124
7257
|
"Access to stylesheet %s is denied. Ignoring\u2026",
|
|
@@ -7143,7 +7276,7 @@ var CopyHostStyles = ({
|
|
|
7143
7276
|
onStylesLoaded = () => null
|
|
7144
7277
|
}) => {
|
|
7145
7278
|
const { document: doc, window: win } = useFrame();
|
|
7146
|
-
(0,
|
|
7279
|
+
(0, import_react45.useEffect)(() => {
|
|
7147
7280
|
if (!win || !doc) {
|
|
7148
7281
|
return () => {
|
|
7149
7282
|
};
|
|
@@ -7300,10 +7433,10 @@ var CopyHostStyles = ({
|
|
|
7300
7433
|
observer.disconnect();
|
|
7301
7434
|
};
|
|
7302
7435
|
}, []);
|
|
7303
|
-
return /* @__PURE__ */ (0,
|
|
7436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
|
|
7304
7437
|
};
|
|
7305
|
-
var autoFrameContext = (0,
|
|
7306
|
-
var useFrame = () => (0,
|
|
7438
|
+
var autoFrameContext = (0, import_react45.createContext)({});
|
|
7439
|
+
var useFrame = () => (0, import_react45.useContext)(autoFrameContext);
|
|
7307
7440
|
function AutoFrame(_a) {
|
|
7308
7441
|
var _b = _a, {
|
|
7309
7442
|
children,
|
|
@@ -7324,11 +7457,11 @@ function AutoFrame(_a) {
|
|
|
7324
7457
|
"onNotReady",
|
|
7325
7458
|
"frameRef"
|
|
7326
7459
|
]);
|
|
7327
|
-
const [loaded, setLoaded] = (0,
|
|
7328
|
-
const [ctx, setCtx] = (0,
|
|
7329
|
-
const [mountTarget, setMountTarget] = (0,
|
|
7330
|
-
const [stylesLoaded, setStylesLoaded] = (0,
|
|
7331
|
-
(0,
|
|
7460
|
+
const [loaded, setLoaded] = (0, import_react45.useState)(false);
|
|
7461
|
+
const [ctx, setCtx] = (0, import_react45.useState)({});
|
|
7462
|
+
const [mountTarget, setMountTarget] = (0, import_react45.useState)();
|
|
7463
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react45.useState)(false);
|
|
7464
|
+
(0, import_react45.useEffect)(() => {
|
|
7332
7465
|
var _a2;
|
|
7333
7466
|
if (frameRef.current) {
|
|
7334
7467
|
const doc = frameRef.current.contentDocument;
|
|
@@ -7347,7 +7480,7 @@ function AutoFrame(_a) {
|
|
|
7347
7480
|
}
|
|
7348
7481
|
}
|
|
7349
7482
|
}, [frameRef, loaded, stylesLoaded]);
|
|
7350
|
-
return /* @__PURE__ */ (0,
|
|
7483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7351
7484
|
"iframe",
|
|
7352
7485
|
__spreadProps(__spreadValues({}, props), {
|
|
7353
7486
|
className,
|
|
@@ -7357,7 +7490,7 @@ function AutoFrame(_a) {
|
|
|
7357
7490
|
onLoad: () => {
|
|
7358
7491
|
setLoaded(true);
|
|
7359
7492
|
},
|
|
7360
|
-
children: /* @__PURE__ */ (0,
|
|
7493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7361
7494
|
CopyHostStyles,
|
|
7362
7495
|
{
|
|
7363
7496
|
debug,
|
|
@@ -7373,14 +7506,14 @@ var AutoFrame_default = AutoFrame;
|
|
|
7373
7506
|
|
|
7374
7507
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
|
7375
7508
|
init_react_import();
|
|
7376
|
-
var
|
|
7509
|
+
var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
|
7377
7510
|
|
|
7378
7511
|
// components/Puck/components/Preview/index.tsx
|
|
7379
|
-
var
|
|
7380
|
-
var
|
|
7512
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7513
|
+
var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
|
|
7381
7514
|
var useBubbleIframeEvents = (ref) => {
|
|
7382
7515
|
const status = useAppStore((s) => s.status);
|
|
7383
|
-
(0,
|
|
7516
|
+
(0, import_react46.useEffect)(() => {
|
|
7384
7517
|
if (ref.current && status === "READY") {
|
|
7385
7518
|
const iframe = ref.current;
|
|
7386
7519
|
const handlePointerMove = (event) => {
|
|
@@ -7429,7 +7562,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7429
7562
|
const renderData = useAppStore(
|
|
7430
7563
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
7431
7564
|
);
|
|
7432
|
-
const Page = (0,
|
|
7565
|
+
const Page = (0, import_react46.useCallback)(
|
|
7433
7566
|
(pageProps) => {
|
|
7434
7567
|
var _a, _b;
|
|
7435
7568
|
const propsWithSlots = useSlots(
|
|
@@ -7439,15 +7572,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7439
7572
|
);
|
|
7440
7573
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
|
7441
7574
|
id: "puck-root"
|
|
7442
|
-
}, propsWithSlots)) : /* @__PURE__ */ (0,
|
|
7575
|
+
}, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: propsWithSlots.children });
|
|
7443
7576
|
},
|
|
7444
7577
|
[config]
|
|
7445
7578
|
);
|
|
7446
|
-
const Frame = (0,
|
|
7579
|
+
const Frame = (0, import_react46.useMemo)(() => overrides.iframe, [overrides]);
|
|
7447
7580
|
const rootProps = root.props || root;
|
|
7448
|
-
const ref = (0,
|
|
7581
|
+
const ref = (0, import_react46.useRef)(null);
|
|
7449
7582
|
useBubbleIframeEvents(ref);
|
|
7450
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
|
7583
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7451
7584
|
Page,
|
|
7452
7585
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
7453
7586
|
puck: {
|
|
@@ -7457,28 +7590,28 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7457
7590
|
metadata
|
|
7458
7591
|
},
|
|
7459
7592
|
editMode: true,
|
|
7460
|
-
children: /* @__PURE__ */ (0,
|
|
7593
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
|
|
7461
7594
|
})
|
|
7462
|
-
) : /* @__PURE__ */ (0,
|
|
7463
|
-
(0,
|
|
7595
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render2, { data: renderData, config });
|
|
7596
|
+
(0, import_react46.useEffect)(() => {
|
|
7464
7597
|
if (!iframe.enabled) {
|
|
7465
7598
|
setStatus("READY");
|
|
7466
7599
|
}
|
|
7467
7600
|
}, [iframe.enabled]);
|
|
7468
|
-
return /* @__PURE__ */ (0,
|
|
7601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7469
7602
|
"div",
|
|
7470
7603
|
{
|
|
7471
|
-
className:
|
|
7604
|
+
className: getClassName22(),
|
|
7472
7605
|
id,
|
|
7473
7606
|
"data-puck-preview": true,
|
|
7474
7607
|
onClick: () => {
|
|
7475
7608
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
7476
7609
|
},
|
|
7477
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
|
7610
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7478
7611
|
AutoFrame_default,
|
|
7479
7612
|
{
|
|
7480
7613
|
id: "preview-frame",
|
|
7481
|
-
className:
|
|
7614
|
+
className: getClassName22("frame"),
|
|
7482
7615
|
"data-rfd-iframe": true,
|
|
7483
7616
|
onReady: () => {
|
|
7484
7617
|
setStatus("READY");
|
|
@@ -7487,18 +7620,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7487
7620
|
setStatus("MOUNTED");
|
|
7488
7621
|
},
|
|
7489
7622
|
frameRef: ref,
|
|
7490
|
-
children: /* @__PURE__ */ (0,
|
|
7623
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
7491
7624
|
if (Frame) {
|
|
7492
|
-
return /* @__PURE__ */ (0,
|
|
7625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Frame, { document: document2, children: inner });
|
|
7493
7626
|
}
|
|
7494
7627
|
return inner;
|
|
7495
7628
|
} })
|
|
7496
7629
|
}
|
|
7497
|
-
) : /* @__PURE__ */ (0,
|
|
7630
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7498
7631
|
"div",
|
|
7499
7632
|
{
|
|
7500
7633
|
id: "preview-frame",
|
|
7501
|
-
className:
|
|
7634
|
+
className: getClassName22("frame"),
|
|
7502
7635
|
ref,
|
|
7503
7636
|
"data-puck-entry": true,
|
|
7504
7637
|
children: inner
|
|
@@ -7516,7 +7649,7 @@ init_react_import();
|
|
|
7516
7649
|
|
|
7517
7650
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
|
7518
7651
|
init_react_import();
|
|
7519
|
-
var
|
|
7652
|
+
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
7653
|
|
|
7521
7654
|
// lib/scroll-into-view.ts
|
|
7522
7655
|
init_react_import();
|
|
@@ -7530,7 +7663,7 @@ var scrollIntoView = (el) => {
|
|
|
7530
7663
|
};
|
|
7531
7664
|
|
|
7532
7665
|
// components/LayerTree/index.tsx
|
|
7533
|
-
var
|
|
7666
|
+
var import_react47 = require("react");
|
|
7534
7667
|
|
|
7535
7668
|
// lib/on-scroll-end.ts
|
|
7536
7669
|
init_react_import();
|
|
@@ -7553,20 +7686,19 @@ var onScrollEnd = (frame, cb) => {
|
|
|
7553
7686
|
|
|
7554
7687
|
// components/LayerTree/index.tsx
|
|
7555
7688
|
var import_shallow6 = require("zustand/react/shallow");
|
|
7556
|
-
var
|
|
7557
|
-
var
|
|
7558
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
|
7689
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7690
|
+
var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
|
|
7691
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
|
|
7559
7692
|
var Layer = ({
|
|
7560
7693
|
index,
|
|
7561
7694
|
itemId,
|
|
7562
7695
|
zoneCompound
|
|
7563
7696
|
}) => {
|
|
7564
7697
|
var _a;
|
|
7565
|
-
const ctx = (0, import_react46.useContext)(dropZoneContext);
|
|
7566
7698
|
const config = useAppStore((s) => s.config);
|
|
7567
7699
|
const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
|
|
7568
7700
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7569
|
-
const setItemSelector = (0,
|
|
7701
|
+
const setItemSelector = (0, import_react47.useCallback)(
|
|
7570
7702
|
(itemSelector2) => {
|
|
7571
7703
|
dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
|
|
7572
7704
|
},
|
|
@@ -7586,7 +7718,7 @@ var Layer = ({
|
|
|
7586
7718
|
)
|
|
7587
7719
|
);
|
|
7588
7720
|
const containsZone = zonesForItem.length > 0;
|
|
7589
|
-
const zoneStore = (0,
|
|
7721
|
+
const zoneStore = (0, import_react47.useContext)(ZoneStoreContext);
|
|
7590
7722
|
const isHovering = useContextStore(
|
|
7591
7723
|
ZoneStoreContext,
|
|
7592
7724
|
(s) => s.hoveringComponent === itemId
|
|
@@ -7601,7 +7733,7 @@ var Layer = ({
|
|
|
7601
7733
|
});
|
|
7602
7734
|
const componentConfig = config.components[nodeData.data.type];
|
|
7603
7735
|
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
|
7604
|
-
return /* @__PURE__ */ (0,
|
|
7736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7605
7737
|
"li",
|
|
7606
7738
|
{
|
|
7607
7739
|
className: getClassNameLayer({
|
|
@@ -7611,7 +7743,7 @@ var Layer = ({
|
|
|
7611
7743
|
childIsSelected
|
|
7612
7744
|
}),
|
|
7613
7745
|
children: [
|
|
7614
|
-
/* @__PURE__ */ (0,
|
|
7746
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7615
7747
|
"button",
|
|
7616
7748
|
{
|
|
7617
7749
|
type: "button",
|
|
@@ -7649,22 +7781,22 @@ var Layer = ({
|
|
|
7649
7781
|
zoneStore.setState({ hoveringComponent: null });
|
|
7650
7782
|
},
|
|
7651
7783
|
children: [
|
|
7652
|
-
containsZone && /* @__PURE__ */ (0,
|
|
7784
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7653
7785
|
"div",
|
|
7654
7786
|
{
|
|
7655
7787
|
className: getClassNameLayer("chevron"),
|
|
7656
7788
|
title: isSelected ? "Collapse" : "Expand",
|
|
7657
|
-
children: /* @__PURE__ */ (0,
|
|
7789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { size: "12" })
|
|
7658
7790
|
}
|
|
7659
7791
|
),
|
|
7660
|
-
/* @__PURE__ */ (0,
|
|
7661
|
-
/* @__PURE__ */ (0,
|
|
7662
|
-
/* @__PURE__ */ (0,
|
|
7792
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
|
7793
|
+
/* @__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" }) }),
|
|
7794
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("name"), children: label })
|
|
7663
7795
|
] })
|
|
7664
7796
|
]
|
|
7665
7797
|
}
|
|
7666
7798
|
) }),
|
|
7667
|
-
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0,
|
|
7799
|
+
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
7800
|
]
|
|
7669
7801
|
}
|
|
7670
7802
|
);
|
|
@@ -7673,7 +7805,15 @@ var LayerTree = ({
|
|
|
7673
7805
|
label: _label,
|
|
7674
7806
|
zoneCompound
|
|
7675
7807
|
}) => {
|
|
7676
|
-
const label =
|
|
7808
|
+
const label = useAppStore((s) => {
|
|
7809
|
+
var _a, _b, _c, _d;
|
|
7810
|
+
if (_label) return _label;
|
|
7811
|
+
if (zoneCompound === rootDroppableId) return;
|
|
7812
|
+
const [componentId, slotId] = zoneCompound.split(":");
|
|
7813
|
+
const componentType = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.type;
|
|
7814
|
+
const configForComponent = componentType && componentType !== rootAreaId ? s.config.components[componentType] : s.config.root;
|
|
7815
|
+
return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
|
|
7816
|
+
});
|
|
7677
7817
|
const contentIds = useAppStore(
|
|
7678
7818
|
(0, import_shallow6.useShallow)(
|
|
7679
7819
|
(s) => {
|
|
@@ -7682,15 +7822,15 @@ var LayerTree = ({
|
|
|
7682
7822
|
}
|
|
7683
7823
|
)
|
|
7684
7824
|
);
|
|
7685
|
-
return /* @__PURE__ */ (0,
|
|
7686
|
-
label && /* @__PURE__ */ (0,
|
|
7687
|
-
/* @__PURE__ */ (0,
|
|
7825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
7826
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName23("zoneTitle"), children: [
|
|
7827
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Layers, { size: "16" }) }),
|
|
7688
7828
|
label
|
|
7689
7829
|
] }),
|
|
7690
|
-
/* @__PURE__ */ (0,
|
|
7691
|
-
contentIds.length === 0 && /* @__PURE__ */ (0,
|
|
7830
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("ul", { className: getClassName23(), children: [
|
|
7831
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("helper"), children: "No items" }),
|
|
7692
7832
|
contentIds.map((itemId, i) => {
|
|
7693
|
-
return /* @__PURE__ */ (0,
|
|
7833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7694
7834
|
Layer,
|
|
7695
7835
|
{
|
|
7696
7836
|
index: i,
|
|
@@ -7705,7 +7845,7 @@ var LayerTree = ({
|
|
|
7705
7845
|
};
|
|
7706
7846
|
|
|
7707
7847
|
// components/Puck/components/Outline/index.tsx
|
|
7708
|
-
var
|
|
7848
|
+
var import_react48 = require("react");
|
|
7709
7849
|
|
|
7710
7850
|
// lib/data/find-zones-for-area.ts
|
|
7711
7851
|
init_react_import();
|
|
@@ -7717,14 +7857,14 @@ var findZonesForArea = (state, area) => {
|
|
|
7717
7857
|
|
|
7718
7858
|
// components/Puck/components/Outline/index.tsx
|
|
7719
7859
|
var import_shallow7 = require("zustand/react/shallow");
|
|
7720
|
-
var
|
|
7860
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7721
7861
|
var Outline = () => {
|
|
7722
7862
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
7723
7863
|
const rootZones = useAppStore(
|
|
7724
7864
|
(0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
|
|
7725
7865
|
);
|
|
7726
|
-
const Wrapper = (0,
|
|
7727
|
-
return /* @__PURE__ */ (0,
|
|
7866
|
+
const Wrapper = (0, import_react48.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
|
7867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7728
7868
|
LayerTree,
|
|
7729
7869
|
{
|
|
7730
7870
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
@@ -7734,1189 +7874,925 @@ var Outline = () => {
|
|
|
7734
7874
|
)) });
|
|
7735
7875
|
};
|
|
7736
7876
|
|
|
7737
|
-
//
|
|
7877
|
+
// components/Puck/components/Canvas/index.tsx
|
|
7738
7878
|
init_react_import();
|
|
7739
|
-
var import_react48 = require("react");
|
|
7740
7879
|
|
|
7741
|
-
//
|
|
7880
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
7742
7881
|
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
7882
|
|
|
7784
|
-
//
|
|
7883
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
7785
7884
|
init_react_import();
|
|
7786
|
-
var
|
|
7787
|
-
var
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7885
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
7886
|
+
var prefix = "Invariant failed";
|
|
7887
|
+
function invariant(condition, message) {
|
|
7888
|
+
if (condition) {
|
|
7889
|
+
return;
|
|
7890
|
+
}
|
|
7891
|
+
if (isProduction) {
|
|
7892
|
+
throw new Error(prefix);
|
|
7893
|
+
}
|
|
7894
|
+
var provided = typeof message === "function" ? message() : message;
|
|
7895
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
7896
|
+
throw new Error(value);
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
7900
|
+
var getRect = function getRect2(_ref) {
|
|
7901
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
|
7902
|
+
var width = right - left;
|
|
7903
|
+
var height = bottom - top;
|
|
7904
|
+
var rect = {
|
|
7905
|
+
top,
|
|
7906
|
+
right,
|
|
7907
|
+
bottom,
|
|
7908
|
+
left,
|
|
7909
|
+
width,
|
|
7910
|
+
height,
|
|
7911
|
+
x: left,
|
|
7912
|
+
y: top,
|
|
7913
|
+
center: {
|
|
7914
|
+
x: (right + left) / 2,
|
|
7915
|
+
y: (bottom + top) / 2
|
|
7916
|
+
}
|
|
7798
7917
|
};
|
|
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
|
-
}
|
|
7918
|
+
return rect;
|
|
7919
|
+
};
|
|
7920
|
+
var expand = function expand2(target, expandBy) {
|
|
7921
|
+
return {
|
|
7922
|
+
top: target.top - expandBy.top,
|
|
7923
|
+
left: target.left - expandBy.left,
|
|
7924
|
+
bottom: target.bottom + expandBy.bottom,
|
|
7925
|
+
right: target.right + expandBy.right
|
|
7816
7926
|
};
|
|
7817
|
-
const get = () => storeData;
|
|
7818
|
-
return __spreadProps(__spreadValues({}, storeData), { get });
|
|
7819
7927
|
};
|
|
7820
|
-
var
|
|
7821
|
-
null
|
|
7822
|
-
);
|
|
7823
|
-
var convertToPickedStore = (store) => {
|
|
7928
|
+
var shrink = function shrink2(target, shrinkBy) {
|
|
7824
7929
|
return {
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
history: store.history,
|
|
7830
|
-
selectedItem: store.selectedItem
|
|
7930
|
+
top: target.top + shrinkBy.top,
|
|
7931
|
+
left: target.left + shrinkBy.left,
|
|
7932
|
+
bottom: target.bottom - shrinkBy.bottom,
|
|
7933
|
+
right: target.right - shrinkBy.right
|
|
7831
7934
|
};
|
|
7832
7935
|
};
|
|
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;
|
|
7936
|
+
var noSpacing = {
|
|
7937
|
+
top: 0,
|
|
7938
|
+
right: 0,
|
|
7939
|
+
bottom: 0,
|
|
7940
|
+
left: 0
|
|
7848
7941
|
};
|
|
7849
|
-
function
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7942
|
+
var createBox = function createBox2(_ref2) {
|
|
7943
|
+
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;
|
|
7944
|
+
var marginBox = getRect(expand(borderBox, margin));
|
|
7945
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
|
7946
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
|
7947
|
+
return {
|
|
7948
|
+
marginBox,
|
|
7949
|
+
borderBox: getRect(borderBox),
|
|
7950
|
+
paddingBox,
|
|
7951
|
+
contentBox,
|
|
7952
|
+
margin,
|
|
7953
|
+
border,
|
|
7954
|
+
padding
|
|
7860
7955
|
};
|
|
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>.");
|
|
7956
|
+
};
|
|
7957
|
+
var parse = function parse2(raw) {
|
|
7958
|
+
var value = raw.slice(0, -2);
|
|
7959
|
+
var suffix = raw.slice(-2);
|
|
7960
|
+
if (suffix !== "px") {
|
|
7961
|
+
return 0;
|
|
7874
7962
|
}
|
|
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;
|
|
7963
|
+
var result = Number(value);
|
|
7964
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
|
7965
|
+
return result;
|
|
7911
7966
|
};
|
|
7912
|
-
var
|
|
7913
|
-
|
|
7967
|
+
var calculateBox = function calculateBox2(borderBox, styles2) {
|
|
7968
|
+
var margin = {
|
|
7969
|
+
top: parse(styles2.marginTop),
|
|
7970
|
+
right: parse(styles2.marginRight),
|
|
7971
|
+
bottom: parse(styles2.marginBottom),
|
|
7972
|
+
left: parse(styles2.marginLeft)
|
|
7973
|
+
};
|
|
7974
|
+
var padding = {
|
|
7975
|
+
top: parse(styles2.paddingTop),
|
|
7976
|
+
right: parse(styles2.paddingRight),
|
|
7977
|
+
bottom: parse(styles2.paddingBottom),
|
|
7978
|
+
left: parse(styles2.paddingLeft)
|
|
7979
|
+
};
|
|
7980
|
+
var border = {
|
|
7981
|
+
top: parse(styles2.borderTopWidth),
|
|
7982
|
+
right: parse(styles2.borderRightWidth),
|
|
7983
|
+
bottom: parse(styles2.borderBottomWidth),
|
|
7984
|
+
left: parse(styles2.borderLeftWidth)
|
|
7985
|
+
};
|
|
7986
|
+
return createBox({
|
|
7987
|
+
borderBox,
|
|
7988
|
+
margin,
|
|
7989
|
+
padding,
|
|
7990
|
+
border
|
|
7991
|
+
});
|
|
7914
7992
|
};
|
|
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);
|
|
7993
|
+
var getBox = function getBox2(el) {
|
|
7994
|
+
var borderBox = el.getBoundingClientRect();
|
|
7995
|
+
var styles2 = window.getComputedStyle(el);
|
|
7996
|
+
return calculateBox(borderBox, styles2);
|
|
7937
7997
|
};
|
|
7938
7998
|
|
|
7939
|
-
// components/Puck/components/
|
|
7940
|
-
|
|
7941
|
-
var import_react52 = require("react");
|
|
7999
|
+
// components/Puck/components/Canvas/index.tsx
|
|
8000
|
+
var import_react50 = require("react");
|
|
7942
8001
|
|
|
7943
|
-
// components/
|
|
8002
|
+
// components/ViewportControls/index.tsx
|
|
7944
8003
|
init_react_import();
|
|
8004
|
+
var import_react49 = require("react");
|
|
7945
8005
|
|
|
7946
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
|
8006
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
7947
8007
|
init_react_import();
|
|
7948
|
-
var
|
|
8008
|
+
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
8009
|
|
|
7950
|
-
// components/
|
|
8010
|
+
// components/ViewportControls/index.tsx
|
|
7951
8011
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7952
|
-
var
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
8012
|
+
var icons = {
|
|
8013
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Smartphone, { size: 16 }),
|
|
8014
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tablet, { size: 16 }),
|
|
8015
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Monitor, { size: 16 })
|
|
8016
|
+
};
|
|
8017
|
+
var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
|
|
8018
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
|
|
8019
|
+
var ViewportButton = ({
|
|
8020
|
+
children,
|
|
8021
|
+
height = "auto",
|
|
8022
|
+
title,
|
|
8023
|
+
width,
|
|
8024
|
+
onClick
|
|
8025
|
+
}) => {
|
|
8026
|
+
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
8027
|
+
const [isActive, setIsActive] = (0, import_react49.useState)(false);
|
|
8028
|
+
(0, import_react49.useEffect)(() => {
|
|
8029
|
+
setIsActive(width === viewports.current.width);
|
|
8030
|
+
}, [width, viewports.current.width]);
|
|
8031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8032
|
+
IconButton,
|
|
7964
8033
|
{
|
|
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
|
-
}
|
|
8034
|
+
type: "button",
|
|
8035
|
+
title,
|
|
8036
|
+
disabled: isActive,
|
|
8037
|
+
onClick: (e) => {
|
|
8038
|
+
e.stopPropagation();
|
|
8039
|
+
onClick({ width, height });
|
|
7975
8040
|
},
|
|
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
|
-
] })
|
|
8041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton("inner"), children })
|
|
7983
8042
|
}
|
|
8043
|
+
) });
|
|
8044
|
+
};
|
|
8045
|
+
var defaultZoomOptions = [
|
|
8046
|
+
{ label: "25%", value: 0.25 },
|
|
8047
|
+
{ label: "50%", value: 0.5 },
|
|
8048
|
+
{ label: "75%", value: 0.75 },
|
|
8049
|
+
{ label: "100%", value: 1 },
|
|
8050
|
+
{ label: "125%", value: 1.25 },
|
|
8051
|
+
{ label: "150%", value: 1.5 },
|
|
8052
|
+
{ label: "200%", value: 2 }
|
|
8053
|
+
];
|
|
8054
|
+
var ViewportControls = ({
|
|
8055
|
+
autoZoom,
|
|
8056
|
+
zoom,
|
|
8057
|
+
onViewportChange,
|
|
8058
|
+
onZoom
|
|
8059
|
+
}) => {
|
|
8060
|
+
var _a, _b;
|
|
8061
|
+
const viewports = useAppStore((s) => s.viewports);
|
|
8062
|
+
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
8063
|
+
(option) => option.value === autoZoom
|
|
7984
8064
|
);
|
|
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",
|
|
8065
|
+
const zoomOptions = (0, import_react49.useMemo)(
|
|
8066
|
+
() => [
|
|
8067
|
+
...defaultZoomOptions,
|
|
8068
|
+
...defaultsContainAutoZoom ? [] : [
|
|
8080
8069
|
{
|
|
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
|
-
] })
|
|
8070
|
+
value: autoZoom,
|
|
8071
|
+
label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
|
|
8145
8072
|
}
|
|
8146
|
-
|
|
8147
|
-
|
|
8073
|
+
]
|
|
8074
|
+
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
8075
|
+
[autoZoom]
|
|
8148
8076
|
);
|
|
8077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24(), children: [
|
|
8078
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8079
|
+
ViewportButton,
|
|
8080
|
+
{
|
|
8081
|
+
height: viewport.height,
|
|
8082
|
+
width: viewport.width,
|
|
8083
|
+
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
|
8084
|
+
onClick: onViewportChange,
|
|
8085
|
+
children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
|
|
8086
|
+
},
|
|
8087
|
+
i
|
|
8088
|
+
)),
|
|
8089
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
|
|
8090
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8091
|
+
IconButton,
|
|
8092
|
+
{
|
|
8093
|
+
type: "button",
|
|
8094
|
+
title: "Zoom viewport out",
|
|
8095
|
+
disabled: zoom <= ((_a = zoomOptions[0]) == null ? void 0 : _a.value),
|
|
8096
|
+
onClick: (e) => {
|
|
8097
|
+
e.stopPropagation();
|
|
8098
|
+
onZoom(
|
|
8099
|
+
zoomOptions[Math.max(
|
|
8100
|
+
zoomOptions.findIndex((option) => option.value === zoom) - 1,
|
|
8101
|
+
0
|
|
8102
|
+
)].value
|
|
8103
|
+
);
|
|
8104
|
+
},
|
|
8105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomOut, { size: 16 })
|
|
8106
|
+
}
|
|
8107
|
+
),
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8109
|
+
IconButton,
|
|
8110
|
+
{
|
|
8111
|
+
type: "button",
|
|
8112
|
+
title: "Zoom viewport in",
|
|
8113
|
+
disabled: zoom >= ((_b = zoomOptions[zoomOptions.length - 1]) == null ? void 0 : _b.value),
|
|
8114
|
+
onClick: (e) => {
|
|
8115
|
+
e.stopPropagation();
|
|
8116
|
+
onZoom(
|
|
8117
|
+
zoomOptions[Math.min(
|
|
8118
|
+
zoomOptions.findIndex((option) => option.value === zoom) + 1,
|
|
8119
|
+
zoomOptions.length - 1
|
|
8120
|
+
)].value
|
|
8121
|
+
);
|
|
8122
|
+
},
|
|
8123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomIn, { size: 16 })
|
|
8124
|
+
}
|
|
8125
|
+
),
|
|
8126
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
|
|
8127
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8128
|
+
"select",
|
|
8129
|
+
{
|
|
8130
|
+
className: getClassName24("zoomSelect"),
|
|
8131
|
+
value: zoom.toString(),
|
|
8132
|
+
onChange: (e) => {
|
|
8133
|
+
onZoom(parseFloat(e.currentTarget.value));
|
|
8134
|
+
},
|
|
8135
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8136
|
+
"option",
|
|
8137
|
+
{
|
|
8138
|
+
value: option.value,
|
|
8139
|
+
label: option.label
|
|
8140
|
+
},
|
|
8141
|
+
option.label
|
|
8142
|
+
))
|
|
8143
|
+
}
|
|
8144
|
+
)
|
|
8145
|
+
] });
|
|
8149
8146
|
};
|
|
8150
|
-
var Header = (0, import_react52.memo)(HeaderInner);
|
|
8151
8147
|
|
|
8152
|
-
// components/
|
|
8148
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
|
8153
8149
|
init_react_import();
|
|
8150
|
+
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
8151
|
|
|
8155
|
-
//
|
|
8152
|
+
// lib/get-zoom-config.ts
|
|
8156
8153
|
init_react_import();
|
|
8157
|
-
var
|
|
8154
|
+
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
|
8155
|
+
var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
8156
|
+
const box = getBox(frame);
|
|
8157
|
+
const { width: frameWidth, height: frameHeight } = box.contentBox;
|
|
8158
|
+
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
|
8159
|
+
let rootHeight = 0;
|
|
8160
|
+
let autoZoom = 1;
|
|
8161
|
+
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
|
8162
|
+
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
|
8163
|
+
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
|
8164
|
+
zoom = widthZoom;
|
|
8165
|
+
if (widthZoom < heightZoom) {
|
|
8166
|
+
rootHeight = viewportHeight / zoom;
|
|
8167
|
+
} else {
|
|
8168
|
+
rootHeight = viewportHeight;
|
|
8169
|
+
zoom = heightZoom;
|
|
8170
|
+
}
|
|
8171
|
+
autoZoom = zoom;
|
|
8172
|
+
} else {
|
|
8173
|
+
if (RESET_ZOOM_SMALLER_THAN_FRAME) {
|
|
8174
|
+
autoZoom = 1;
|
|
8175
|
+
zoom = 1;
|
|
8176
|
+
rootHeight = viewportHeight;
|
|
8177
|
+
}
|
|
8178
|
+
}
|
|
8179
|
+
return { autoZoom, rootHeight, zoom };
|
|
8180
|
+
};
|
|
8158
8181
|
|
|
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
|
-
|
|
8182
|
+
// components/Puck/components/Canvas/index.tsx
|
|
8183
|
+
var import_shallow8 = require("zustand/react/shallow");
|
|
8184
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8185
|
+
var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
|
|
8186
|
+
var ZOOM_ON_CHANGE = true;
|
|
8187
|
+
var Canvas = () => {
|
|
8188
|
+
const {
|
|
8189
|
+
dispatch,
|
|
8190
|
+
overrides,
|
|
8191
|
+
setUi,
|
|
8192
|
+
zoomConfig,
|
|
8193
|
+
setZoomConfig,
|
|
8194
|
+
status,
|
|
8195
|
+
iframe
|
|
8196
|
+
} = useAppStore(
|
|
8197
|
+
(0, import_shallow8.useShallow)((s) => ({
|
|
8198
|
+
dispatch: s.dispatch,
|
|
8199
|
+
overrides: s.overrides,
|
|
8200
|
+
setUi: s.setUi,
|
|
8201
|
+
zoomConfig: s.zoomConfig,
|
|
8202
|
+
setZoomConfig: s.setZoomConfig,
|
|
8203
|
+
status: s.status,
|
|
8204
|
+
iframe: s.iframe
|
|
8205
|
+
}))
|
|
8206
|
+
);
|
|
8207
|
+
const { leftSideBarVisible, rightSideBarVisible, viewports } = useAppStore(
|
|
8208
|
+
(0, import_shallow8.useShallow)((s) => ({
|
|
8209
|
+
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
|
8210
|
+
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
|
8211
|
+
viewports: s.state.ui.viewports
|
|
8212
|
+
}))
|
|
8213
|
+
);
|
|
8214
|
+
const frameRef = (0, import_react50.useRef)(null);
|
|
8215
|
+
const [showTransition, setShowTransition] = (0, import_react50.useState)(false);
|
|
8216
|
+
const defaultRender = (0, import_react50.useMemo)(() => {
|
|
8217
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
|
|
8218
|
+
return PuckDefault;
|
|
8219
|
+
}, []);
|
|
8220
|
+
const CustomPreview = (0, import_react50.useMemo)(
|
|
8221
|
+
() => overrides.preview || defaultRender,
|
|
8222
|
+
[overrides]
|
|
8223
|
+
);
|
|
8224
|
+
const getFrameDimensions = (0, import_react50.useCallback)(() => {
|
|
8225
|
+
if (frameRef.current) {
|
|
8226
|
+
const frame = frameRef.current;
|
|
8227
|
+
const box = getBox(frame);
|
|
8228
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
8229
|
+
}
|
|
8230
|
+
return { width: 0, height: 0 };
|
|
8231
|
+
}, [frameRef]);
|
|
8232
|
+
const resetAutoZoom = (0, import_react50.useCallback)(
|
|
8233
|
+
(newViewports = viewports) => {
|
|
8234
|
+
if (frameRef.current) {
|
|
8235
|
+
setZoomConfig(
|
|
8236
|
+
getZoomConfig(
|
|
8237
|
+
newViewports == null ? void 0 : newViewports.current,
|
|
8238
|
+
frameRef.current,
|
|
8239
|
+
zoomConfig.zoom
|
|
8240
|
+
)
|
|
8241
|
+
);
|
|
8182
8242
|
}
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
if (renderCount) {
|
|
8197
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
8243
|
+
},
|
|
8244
|
+
[frameRef, zoomConfig, viewports]
|
|
8245
|
+
);
|
|
8246
|
+
(0, import_react50.useEffect)(() => {
|
|
8247
|
+
setShowTransition(false);
|
|
8248
|
+
resetAutoZoom(viewports);
|
|
8249
|
+
}, [frameRef, leftSideBarVisible, rightSideBarVisible]);
|
|
8250
|
+
(0, import_react50.useEffect)(() => {
|
|
8251
|
+
const { height: frameHeight } = getFrameDimensions();
|
|
8252
|
+
if (viewports.current.height === "auto") {
|
|
8253
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
8254
|
+
rootHeight: frameHeight / zoomConfig.zoom
|
|
8255
|
+
}));
|
|
8198
8256
|
}
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
}
|
|
8215
|
-
|
|
8216
|
-
const
|
|
8217
|
-
|
|
8257
|
+
}, [zoomConfig.zoom]);
|
|
8258
|
+
(0, import_react50.useEffect)(() => {
|
|
8259
|
+
if (ZOOM_ON_CHANGE) {
|
|
8260
|
+
setShowTransition(true);
|
|
8261
|
+
resetAutoZoom(viewports);
|
|
8262
|
+
}
|
|
8263
|
+
}, [viewports.current.width]);
|
|
8264
|
+
(0, import_react50.useEffect)(() => {
|
|
8265
|
+
const cb = () => {
|
|
8266
|
+
setShowTransition(false);
|
|
8267
|
+
resetAutoZoom();
|
|
8268
|
+
};
|
|
8269
|
+
window.addEventListener("resize", cb);
|
|
8270
|
+
return () => {
|
|
8271
|
+
window.removeEventListener("resize", cb);
|
|
8272
|
+
};
|
|
8273
|
+
}, []);
|
|
8274
|
+
const [showLoader, setShowLoader] = (0, import_react50.useState)(false);
|
|
8275
|
+
(0, import_react50.useEffect)(() => {
|
|
8276
|
+
setTimeout(() => {
|
|
8277
|
+
setShowLoader(true);
|
|
8278
|
+
}, 500);
|
|
8279
|
+
}, []);
|
|
8280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
8218
8281
|
"div",
|
|
8219
8282
|
{
|
|
8220
|
-
className: getClassName25({
|
|
8221
|
-
|
|
8283
|
+
className: getClassName25({
|
|
8284
|
+
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
8285
|
+
showLoader
|
|
8286
|
+
}),
|
|
8287
|
+
onClick: () => dispatch({
|
|
8288
|
+
type: "setUi",
|
|
8289
|
+
ui: { itemSelector: null },
|
|
8290
|
+
recordHistory: true
|
|
8291
|
+
}),
|
|
8222
8292
|
children: [
|
|
8223
|
-
/* @__PURE__ */ (0,
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8293
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8294
|
+
ViewportControls,
|
|
8295
|
+
{
|
|
8296
|
+
autoZoom: zoomConfig.autoZoom,
|
|
8297
|
+
zoom: zoomConfig.zoom,
|
|
8298
|
+
onViewportChange: (viewport) => {
|
|
8299
|
+
setShowTransition(true);
|
|
8300
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
|
8301
|
+
height: viewport.height || "auto",
|
|
8302
|
+
zoom: zoomConfig.zoom
|
|
8303
|
+
});
|
|
8304
|
+
const newUi = {
|
|
8305
|
+
viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport }),
|
|
8306
|
+
itemSelector: null
|
|
8307
|
+
};
|
|
8308
|
+
setUi(newUi);
|
|
8309
|
+
if (ZOOM_ON_CHANGE) {
|
|
8310
|
+
resetAutoZoom(__spreadProps(__spreadValues({}, viewports), { current: uiViewport }));
|
|
8232
8311
|
}
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8312
|
+
},
|
|
8313
|
+
onZoom: (zoom) => {
|
|
8314
|
+
setShowTransition(true);
|
|
8315
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
|
|
8316
|
+
}
|
|
8317
|
+
}
|
|
8318
|
+
) }),
|
|
8319
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25("inner"), ref: frameRef, children: [
|
|
8320
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8321
|
+
"div",
|
|
8322
|
+
{
|
|
8323
|
+
className: getClassName25("root"),
|
|
8324
|
+
style: {
|
|
8325
|
+
width: iframe.enabled ? viewports.current.width : "100%",
|
|
8326
|
+
height: zoomConfig.rootHeight,
|
|
8327
|
+
transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
|
|
8328
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
|
|
8329
|
+
overflow: iframe.enabled ? void 0 : "auto"
|
|
8330
|
+
},
|
|
8331
|
+
suppressHydrationWarning: true,
|
|
8332
|
+
id: "puck-canvas-root",
|
|
8333
|
+
onTransitionEnd: () => {
|
|
8334
|
+
window.dispatchEvent(
|
|
8335
|
+
new CustomEvent("viewportchange", {
|
|
8336
|
+
bubbles: true,
|
|
8337
|
+
cancelable: false
|
|
8338
|
+
})
|
|
8339
|
+
);
|
|
8340
|
+
},
|
|
8341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Preview2, {}) })
|
|
8342
|
+
}
|
|
8343
|
+
),
|
|
8344
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Loader, { size: 24 }) })
|
|
8345
|
+
] })
|
|
8240
8346
|
]
|
|
8241
8347
|
}
|
|
8242
8348
|
);
|
|
8243
8349
|
};
|
|
8244
8350
|
|
|
8245
|
-
//
|
|
8246
|
-
init_react_import();
|
|
8247
|
-
|
|
8248
|
-
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
8351
|
+
// lib/use-loaded-overrides.ts
|
|
8249
8352
|
init_react_import();
|
|
8353
|
+
var import_react51 = require("react");
|
|
8250
8354
|
|
|
8251
|
-
//
|
|
8355
|
+
// lib/load-overrides.ts
|
|
8252
8356
|
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);
|
|
8357
|
+
var loadOverrides = ({
|
|
8358
|
+
overrides,
|
|
8359
|
+
plugins
|
|
8360
|
+
}) => {
|
|
8361
|
+
const collected = __spreadValues({}, overrides);
|
|
8362
|
+
plugins == null ? void 0 : plugins.forEach((plugin) => {
|
|
8363
|
+
Object.keys(plugin.overrides).forEach((_overridesType) => {
|
|
8364
|
+
const overridesType = _overridesType;
|
|
8365
|
+
if (overridesType === "fieldTypes") {
|
|
8366
|
+
const fieldTypes = plugin.overrides.fieldTypes;
|
|
8367
|
+
Object.keys(fieldTypes).forEach((fieldType) => {
|
|
8368
|
+
collected.fieldTypes = collected.fieldTypes || {};
|
|
8369
|
+
const childNode2 = collected.fieldTypes[fieldType];
|
|
8370
|
+
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
|
8371
|
+
children: childNode2 ? childNode2(props) : props.children
|
|
8372
|
+
}));
|
|
8373
|
+
collected.fieldTypes[fieldType] = Comp2;
|
|
8374
|
+
});
|
|
8375
|
+
return;
|
|
8376
|
+
}
|
|
8377
|
+
const childNode = collected[overridesType];
|
|
8378
|
+
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
|
8379
|
+
children: childNode ? childNode(props) : props.children
|
|
8380
|
+
}));
|
|
8381
|
+
collected[overridesType] = Comp;
|
|
8382
|
+
});
|
|
8383
|
+
});
|
|
8384
|
+
return collected;
|
|
8365
8385
|
};
|
|
8366
8386
|
|
|
8367
|
-
//
|
|
8368
|
-
var
|
|
8387
|
+
// lib/use-loaded-overrides.ts
|
|
8388
|
+
var useLoadedOverrides = ({
|
|
8389
|
+
overrides,
|
|
8390
|
+
plugins
|
|
8391
|
+
}) => {
|
|
8392
|
+
return (0, import_react51.useMemo)(() => {
|
|
8393
|
+
return loadOverrides({ overrides, plugins });
|
|
8394
|
+
}, [plugins, overrides]);
|
|
8395
|
+
};
|
|
8369
8396
|
|
|
8370
|
-
// components/
|
|
8397
|
+
// components/DefaultOverride/index.tsx
|
|
8371
8398
|
init_react_import();
|
|
8372
|
-
var
|
|
8399
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8400
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
|
|
8373
8401
|
|
|
8374
|
-
// css
|
|
8402
|
+
// lib/use-inject-css.ts
|
|
8375
8403
|
init_react_import();
|
|
8376
|
-
var
|
|
8404
|
+
var import_react52 = require("react");
|
|
8405
|
+
var styles = ``;
|
|
8406
|
+
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
8407
|
+
const [el, setEl] = (0, import_react52.useState)();
|
|
8408
|
+
(0, import_react52.useEffect)(() => {
|
|
8409
|
+
setEl(document.createElement("style"));
|
|
8410
|
+
}, []);
|
|
8411
|
+
(0, import_react52.useEffect)(() => {
|
|
8412
|
+
var _a;
|
|
8413
|
+
if (!el || typeof window === "undefined") {
|
|
8414
|
+
return;
|
|
8415
|
+
}
|
|
8416
|
+
el.innerHTML = initialStyles;
|
|
8417
|
+
if (iframeEnabled) {
|
|
8418
|
+
const frame = getFrame();
|
|
8419
|
+
(_a = frame == null ? void 0 : frame.head) == null ? void 0 : _a.appendChild(el);
|
|
8420
|
+
}
|
|
8421
|
+
document.head.appendChild(el);
|
|
8422
|
+
}, [iframeEnabled, el]);
|
|
8423
|
+
return el;
|
|
8424
|
+
};
|
|
8425
|
+
var useInjectGlobalCss = (iframeEnabled) => {
|
|
8426
|
+
return useInjectStyleSheet(styles, iframeEnabled);
|
|
8427
|
+
};
|
|
8377
8428
|
|
|
8378
|
-
//
|
|
8379
|
-
|
|
8380
|
-
var
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8429
|
+
// lib/use-preview-mode-hotkeys.ts
|
|
8430
|
+
init_react_import();
|
|
8431
|
+
var import_react53 = require("react");
|
|
8432
|
+
var usePreviewModeHotkeys = () => {
|
|
8433
|
+
const appStore = useAppStoreApi();
|
|
8434
|
+
const toggleInteractive = (0, import_react53.useCallback)(() => {
|
|
8435
|
+
const dispatch = appStore.getState().dispatch;
|
|
8436
|
+
dispatch({
|
|
8437
|
+
type: "setUi",
|
|
8438
|
+
ui: (ui) => ({
|
|
8439
|
+
previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
|
|
8440
|
+
})
|
|
8441
|
+
});
|
|
8442
|
+
}, [appStore]);
|
|
8443
|
+
useHotkey({ meta: true, i: true }, toggleInteractive);
|
|
8444
|
+
useHotkey({ ctrl: true, i: true }, toggleInteractive);
|
|
8384
8445
|
};
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8446
|
+
|
|
8447
|
+
// lib/use-puck.ts
|
|
8448
|
+
init_react_import();
|
|
8449
|
+
var import_react54 = require("react");
|
|
8450
|
+
var import_zustand6 = require("zustand");
|
|
8451
|
+
var generateUsePuck = (store) => {
|
|
8452
|
+
const history = {
|
|
8453
|
+
back: store.history.back,
|
|
8454
|
+
forward: store.history.forward,
|
|
8455
|
+
setHistories: store.history.setHistories,
|
|
8456
|
+
setHistoryIndex: store.history.setHistoryIndex,
|
|
8457
|
+
hasPast: store.history.hasPast(),
|
|
8458
|
+
hasFuture: store.history.hasFuture(),
|
|
8459
|
+
histories: store.history.histories,
|
|
8460
|
+
index: store.history.index
|
|
8461
|
+
};
|
|
8462
|
+
const storeData = {
|
|
8463
|
+
appState: makeStatePublic(store.state),
|
|
8464
|
+
config: store.config,
|
|
8465
|
+
dispatch: store.dispatch,
|
|
8466
|
+
getPermissions: store.permissions.getPermissions,
|
|
8467
|
+
refreshPermissions: store.permissions.refreshPermissions,
|
|
8468
|
+
history,
|
|
8469
|
+
selectedItem: store.selectedItem || null,
|
|
8470
|
+
getItemBySelector: (selector) => getItem(selector, store.state),
|
|
8471
|
+
getItemById: (id) => store.state.indexes.nodes[id].data,
|
|
8472
|
+
getSelectorForId: (id) => {
|
|
8473
|
+
const node = store.state.indexes.nodes[id];
|
|
8474
|
+
if (!node) return;
|
|
8475
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
8476
|
+
const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
8477
|
+
return { zone: zoneCompound, index };
|
|
8409
8478
|
}
|
|
8410
|
-
|
|
8479
|
+
};
|
|
8480
|
+
const get = () => storeData;
|
|
8481
|
+
return __spreadProps(__spreadValues({}, storeData), { get });
|
|
8411
8482
|
};
|
|
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]
|
|
8483
|
+
var UsePuckStoreContext = (0, import_react54.createContext)(
|
|
8484
|
+
null
|
|
8485
|
+
);
|
|
8486
|
+
var convertToPickedStore = (store) => {
|
|
8487
|
+
return {
|
|
8488
|
+
state: store.state,
|
|
8489
|
+
config: store.config,
|
|
8490
|
+
dispatch: store.dispatch,
|
|
8491
|
+
permissions: store.permissions,
|
|
8492
|
+
history: store.history,
|
|
8493
|
+
selectedItem: store.selectedItem
|
|
8494
|
+
};
|
|
8495
|
+
};
|
|
8496
|
+
var useRegisterUsePuckStore = (appStore) => {
|
|
8497
|
+
const [usePuckStore] = (0, import_react54.useState)(
|
|
8498
|
+
() => (0, import_zustand6.createStore)(
|
|
8499
|
+
() => generateUsePuck(convertToPickedStore(appStore.getState()))
|
|
8500
|
+
)
|
|
8443
8501
|
);
|
|
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
|
-
))
|
|
8502
|
+
(0, import_react54.useEffect)(() => {
|
|
8503
|
+
return appStore.subscribe(
|
|
8504
|
+
(store) => convertToPickedStore(store),
|
|
8505
|
+
(pickedStore) => {
|
|
8506
|
+
usePuckStore.setState(generateUsePuck(pickedStore));
|
|
8508
8507
|
}
|
|
8509
|
-
)
|
|
8510
|
-
]
|
|
8508
|
+
);
|
|
8509
|
+
}, []);
|
|
8510
|
+
return usePuckStore;
|
|
8511
8511
|
};
|
|
8512
|
+
function createUsePuck() {
|
|
8513
|
+
return function usePuck2(selector) {
|
|
8514
|
+
const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
|
|
8515
|
+
if (!usePuckApi) {
|
|
8516
|
+
throw new Error("usePuck must be used inside <Puck>.");
|
|
8517
|
+
}
|
|
8518
|
+
const result = (0, import_zustand6.useStore)(
|
|
8519
|
+
usePuckApi,
|
|
8520
|
+
selector != null ? selector : (s) => s
|
|
8521
|
+
);
|
|
8522
|
+
return result;
|
|
8523
|
+
};
|
|
8524
|
+
}
|
|
8525
|
+
function usePuck() {
|
|
8526
|
+
(0, import_react54.useEffect)(() => {
|
|
8527
|
+
console.warn(
|
|
8528
|
+
"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."
|
|
8529
|
+
);
|
|
8530
|
+
}, []);
|
|
8531
|
+
return createUsePuck()((s) => s);
|
|
8532
|
+
}
|
|
8533
|
+
function useGetPuck() {
|
|
8534
|
+
const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
|
|
8535
|
+
if (!usePuckApi) {
|
|
8536
|
+
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
8537
|
+
}
|
|
8538
|
+
return usePuckApi.getState;
|
|
8539
|
+
}
|
|
8540
|
+
|
|
8541
|
+
// components/Puck/index.tsx
|
|
8542
|
+
var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
|
|
8543
|
+
|
|
8544
|
+
// components/Puck/components/Header/index.tsx
|
|
8545
|
+
init_react_import();
|
|
8546
|
+
var import_react55 = require("react");
|
|
8512
8547
|
|
|
8513
|
-
//
|
|
8548
|
+
// components/MenuBar/index.tsx
|
|
8514
8549
|
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
8550
|
|
|
8517
|
-
//
|
|
8551
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
|
8518
8552
|
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
|
-
};
|
|
8553
|
+
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
8554
|
|
|
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)(
|
|
8555
|
+
// components/MenuBar/index.tsx
|
|
8556
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8557
|
+
var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
|
|
8558
|
+
function MenuBar({
|
|
8559
|
+
menuOpen = false,
|
|
8560
|
+
renderHeaderActions,
|
|
8561
|
+
setMenuOpen
|
|
8562
|
+
}) {
|
|
8563
|
+
const back = useAppStore((s) => s.history.back);
|
|
8564
|
+
const forward = useAppStore((s) => s.history.forward);
|
|
8565
|
+
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
8566
|
+
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
8567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8646
8568
|
"div",
|
|
8647
8569
|
{
|
|
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",
|
|
8570
|
+
className: getClassName26({ menuOpen }),
|
|
8571
|
+
onClick: (event) => {
|
|
8572
|
+
var _a;
|
|
8573
|
+
const element = event.target;
|
|
8574
|
+
if (window.matchMedia("(min-width: 638px)").matches) {
|
|
8575
|
+
return;
|
|
8576
|
+
}
|
|
8577
|
+
if (element.tagName === "A" && ((_a = element.getAttribute("href")) == null ? void 0 : _a.startsWith("#"))) {
|
|
8578
|
+
setMenuOpen(false);
|
|
8579
|
+
}
|
|
8580
|
+
},
|
|
8581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("inner"), children: [
|
|
8582
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("history"), children: [
|
|
8583
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8584
|
+
IconButton,
|
|
8687
8585
|
{
|
|
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, {}) })
|
|
8586
|
+
type: "button",
|
|
8587
|
+
title: "undo",
|
|
8588
|
+
disabled: !hasPast,
|
|
8589
|
+
onClick: back,
|
|
8590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Undo2, { size: 21 })
|
|
8707
8591
|
}
|
|
8708
8592
|
),
|
|
8709
|
-
/* @__PURE__ */ (0,
|
|
8710
|
-
|
|
8711
|
-
|
|
8593
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8594
|
+
IconButton,
|
|
8595
|
+
{
|
|
8596
|
+
type: "button",
|
|
8597
|
+
title: "redo",
|
|
8598
|
+
disabled: !hasFuture,
|
|
8599
|
+
onClick: forward,
|
|
8600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Redo2, { size: 21 })
|
|
8601
|
+
}
|
|
8602
|
+
)
|
|
8603
|
+
] }),
|
|
8604
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
|
8605
|
+
] })
|
|
8712
8606
|
}
|
|
8713
8607
|
);
|
|
8714
|
-
}
|
|
8715
|
-
|
|
8716
|
-
// components/Puck/components/Nav/index.tsx
|
|
8717
|
-
init_react_import();
|
|
8608
|
+
}
|
|
8718
8609
|
|
|
8719
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/
|
|
8610
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
|
|
8720
8611
|
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
|
-
};
|
|
8612
|
+
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
8613
|
|
|
8759
|
-
// components/Puck/components/
|
|
8760
|
-
var
|
|
8761
|
-
var
|
|
8762
|
-
var
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8614
|
+
// components/Puck/components/Header/index.tsx
|
|
8615
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8616
|
+
var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
|
|
8617
|
+
var HeaderInner = () => {
|
|
8618
|
+
const {
|
|
8619
|
+
onPublish,
|
|
8620
|
+
renderHeader,
|
|
8621
|
+
renderHeaderActions,
|
|
8622
|
+
headerTitle,
|
|
8623
|
+
headerPath,
|
|
8624
|
+
iframe: _iframe
|
|
8625
|
+
} = usePropsContext();
|
|
8626
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
8627
|
+
const appStore = useAppStoreApi();
|
|
8628
|
+
const defaultHeaderRender = (0, import_react55.useMemo)(() => {
|
|
8629
|
+
if (renderHeader) {
|
|
8630
|
+
console.warn(
|
|
8631
|
+
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
8632
|
+
);
|
|
8633
|
+
const RenderHeader = (_a) => {
|
|
8634
|
+
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
8635
|
+
const Comp = renderHeader;
|
|
8636
|
+
const appState = useAppStore((s) => s.state);
|
|
8637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
8638
|
+
};
|
|
8639
|
+
return RenderHeader;
|
|
8640
|
+
}
|
|
8641
|
+
return DefaultOverride;
|
|
8642
|
+
}, [renderHeader]);
|
|
8643
|
+
const defaultHeaderActionsRender = (0, import_react55.useMemo)(() => {
|
|
8644
|
+
if (renderHeaderActions) {
|
|
8645
|
+
console.warn(
|
|
8646
|
+
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
8647
|
+
);
|
|
8648
|
+
const RenderHeader = (props) => {
|
|
8649
|
+
const Comp = renderHeaderActions;
|
|
8650
|
+
const appState = useAppStore((s) => s.state);
|
|
8651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
8652
|
+
};
|
|
8653
|
+
return RenderHeader;
|
|
8768
8654
|
}
|
|
8655
|
+
return DefaultOverride;
|
|
8656
|
+
}, [renderHeader]);
|
|
8657
|
+
const CustomHeader = useAppStore(
|
|
8658
|
+
(s) => s.overrides.header || defaultHeaderRender
|
|
8769
8659
|
);
|
|
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]
|
|
8660
|
+
const CustomHeaderActions = useAppStore(
|
|
8661
|
+
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
8785
8662
|
);
|
|
8786
|
-
|
|
8663
|
+
const [menuOpen, setMenuOpen] = (0, import_react55.useState)(false);
|
|
8664
|
+
const rootTitle = useAppStore((s) => {
|
|
8665
|
+
var _a, _b;
|
|
8666
|
+
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
8667
|
+
return (_b = rootData.props.title) != null ? _b : "";
|
|
8668
|
+
});
|
|
8787
8669
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8788
8670
|
const rightSideBarVisible = useAppStore(
|
|
8789
8671
|
(s) => s.state.ui.rightSideBarVisible
|
|
8790
8672
|
);
|
|
8791
|
-
const
|
|
8792
|
-
|
|
8793
|
-
|
|
8673
|
+
const toggleSidebars = (0, import_react55.useCallback)(
|
|
8674
|
+
(sidebar) => {
|
|
8675
|
+
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
8676
|
+
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
8677
|
+
const oppositeSideBar = sidebar === "left" ? "rightSideBarVisible" : "leftSideBarVisible";
|
|
8794
8678
|
dispatch({
|
|
8795
8679
|
type: "setUi",
|
|
8796
|
-
ui: {
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
}
|
|
8680
|
+
ui: __spreadValues({
|
|
8681
|
+
[`${sidebar}SideBarVisible`]: !sideBarVisible
|
|
8682
|
+
}, !widerViewport ? { [oppositeSideBar]: false } : {})
|
|
8800
8683
|
});
|
|
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]
|
|
8684
|
+
},
|
|
8685
|
+
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
8819
8686
|
);
|
|
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, {}),
|
|
8687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8688
|
+
CustomHeader,
|
|
8689
|
+
{
|
|
8690
|
+
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)(
|
|
8691
|
+
Button,
|
|
8692
|
+
{
|
|
8844
8693
|
onClick: () => {
|
|
8845
|
-
|
|
8694
|
+
const data = appStore.getState().state.data;
|
|
8695
|
+
onPublish && onPublish(data);
|
|
8846
8696
|
},
|
|
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
|
-
|
|
8697
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
|
8698
|
+
children: "Publish"
|
|
8699
|
+
}
|
|
8700
|
+
) }) }),
|
|
8701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8702
|
+
"header",
|
|
8703
|
+
{
|
|
8704
|
+
className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
|
|
8705
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("inner"), children: [
|
|
8706
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("toggle"), children: [
|
|
8707
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8708
|
+
IconButton,
|
|
8709
|
+
{
|
|
8710
|
+
type: "button",
|
|
8711
|
+
onClick: () => {
|
|
8712
|
+
toggleSidebars("left");
|
|
8713
|
+
},
|
|
8714
|
+
title: "Toggle left sidebar",
|
|
8715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
|
|
8716
|
+
}
|
|
8717
|
+
) }),
|
|
8718
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8719
|
+
IconButton,
|
|
8720
|
+
{
|
|
8721
|
+
type: "button",
|
|
8722
|
+
onClick: () => {
|
|
8723
|
+
toggleSidebars("right");
|
|
8724
|
+
},
|
|
8725
|
+
title: "Toggle right sidebar",
|
|
8726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
|
|
8727
|
+
}
|
|
8728
|
+
) })
|
|
8729
|
+
] }),
|
|
8730
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("title"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
|
8731
|
+
headerTitle || rootTitle || "Page",
|
|
8732
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8733
|
+
" ",
|
|
8734
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: getClassName27("path"), children: headerPath })
|
|
8735
|
+
] })
|
|
8736
|
+
] }) }),
|
|
8737
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("tools"), children: [
|
|
8738
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8739
|
+
IconButton,
|
|
8740
|
+
{
|
|
8741
|
+
type: "button",
|
|
8742
|
+
onClick: () => {
|
|
8743
|
+
return setMenuOpen(!menuOpen);
|
|
8744
|
+
},
|
|
8745
|
+
title: "Toggle menu bar",
|
|
8746
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronDown, { focusable: "false" })
|
|
8747
|
+
}
|
|
8748
|
+
) }),
|
|
8749
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8750
|
+
MenuBar,
|
|
8751
|
+
{
|
|
8752
|
+
dispatch,
|
|
8753
|
+
onPublish,
|
|
8754
|
+
menuOpen,
|
|
8755
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8756
|
+
Button,
|
|
8757
|
+
{
|
|
8893
8758
|
onClick: () => {
|
|
8894
|
-
|
|
8759
|
+
const data = appStore.getState().state.data;
|
|
8760
|
+
onPublish && onPublish(data);
|
|
8895
8761
|
},
|
|
8896
|
-
|
|
8762
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
|
|
8763
|
+
children: "Publish"
|
|
8897
8764
|
}
|
|
8898
|
-
},
|
|
8765
|
+
) }),
|
|
8766
|
+
setMenuOpen
|
|
8899
8767
|
}
|
|
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
|
-
] });
|
|
8768
|
+
)
|
|
8769
|
+
] })
|
|
8770
|
+
] })
|
|
8771
|
+
}
|
|
8772
|
+
)
|
|
8773
|
+
}
|
|
8774
|
+
);
|
|
8911
8775
|
};
|
|
8776
|
+
var Header = (0, import_react55.memo)(HeaderInner);
|
|
8912
8777
|
|
|
8913
8778
|
// components/Puck/index.tsx
|
|
8914
|
-
var
|
|
8915
|
-
var
|
|
8779
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8780
|
+
var getClassName28 = get_class_name_factory_default("Puck", styles_module_default14);
|
|
8781
|
+
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default14);
|
|
8782
|
+
var FieldSideBar = () => {
|
|
8783
|
+
const title = useAppStore(
|
|
8784
|
+
(s) => {
|
|
8785
|
+
var _a, _b;
|
|
8786
|
+
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
|
|
8787
|
+
}
|
|
8788
|
+
);
|
|
8789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Fields, {}) });
|
|
8790
|
+
};
|
|
8791
|
+
var propsContext = (0, import_react56.createContext)({});
|
|
8916
8792
|
function PropsProvider(props) {
|
|
8917
|
-
return /* @__PURE__ */ (0,
|
|
8793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
8918
8794
|
}
|
|
8919
|
-
var usePropsContext = () => (0,
|
|
8795
|
+
var usePropsContext = () => (0, import_react56.useContext)(propsContext);
|
|
8920
8796
|
function PuckProvider({ children }) {
|
|
8921
8797
|
const {
|
|
8922
8798
|
config,
|
|
@@ -8932,14 +8808,14 @@ function PuckProvider({ children }) {
|
|
|
8932
8808
|
metadata,
|
|
8933
8809
|
onAction
|
|
8934
8810
|
} = usePropsContext();
|
|
8935
|
-
const iframe = (0,
|
|
8811
|
+
const iframe = (0, import_react56.useMemo)(
|
|
8936
8812
|
() => __spreadValues({
|
|
8937
8813
|
enabled: true,
|
|
8938
8814
|
waitForStyles: true
|
|
8939
8815
|
}, _iframe),
|
|
8940
8816
|
[_iframe]
|
|
8941
8817
|
);
|
|
8942
|
-
const [generatedAppState] = (0,
|
|
8818
|
+
const [generatedAppState] = (0, import_react56.useState)(() => {
|
|
8943
8819
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
8944
8820
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
8945
8821
|
let clientUiState = {};
|
|
@@ -8999,7 +8875,7 @@ function PuckProvider({ children }) {
|
|
|
8999
8875
|
return walkAppState(newAppState, config);
|
|
9000
8876
|
});
|
|
9001
8877
|
const { appendData = true } = _initialHistory || {};
|
|
9002
|
-
const [blendedHistories] = (0,
|
|
8878
|
+
const [blendedHistories] = (0, import_react56.useState)(
|
|
9003
8879
|
[
|
|
9004
8880
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
9005
8881
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -9019,7 +8895,7 @@ function PuckProvider({ children }) {
|
|
|
9019
8895
|
overrides,
|
|
9020
8896
|
plugins
|
|
9021
8897
|
});
|
|
9022
|
-
const generateAppStore = (0,
|
|
8898
|
+
const generateAppStore = (0, import_react56.useCallback)(
|
|
9023
8899
|
(state) => {
|
|
9024
8900
|
return {
|
|
9025
8901
|
state,
|
|
@@ -9043,15 +8919,15 @@ function PuckProvider({ children }) {
|
|
|
9043
8919
|
metadata
|
|
9044
8920
|
]
|
|
9045
8921
|
);
|
|
9046
|
-
const [appStore] = (0,
|
|
8922
|
+
const [appStore] = (0, import_react56.useState)(
|
|
9047
8923
|
() => createAppStore(generateAppStore(initialAppState))
|
|
9048
8924
|
);
|
|
9049
|
-
(0,
|
|
8925
|
+
(0, import_react56.useEffect)(() => {
|
|
9050
8926
|
if (process.env.NODE_ENV !== "production") {
|
|
9051
8927
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
9052
8928
|
}
|
|
9053
8929
|
}, [appStore]);
|
|
9054
|
-
(0,
|
|
8930
|
+
(0, import_react56.useEffect)(() => {
|
|
9055
8931
|
const state = appStore.getState().state;
|
|
9056
8932
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
9057
8933
|
}, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
|
|
@@ -9060,8 +8936,8 @@ function PuckProvider({ children }) {
|
|
|
9060
8936
|
index: initialHistoryIndex,
|
|
9061
8937
|
initialAppState
|
|
9062
8938
|
});
|
|
9063
|
-
const previousData = (0,
|
|
9064
|
-
(0,
|
|
8939
|
+
const previousData = (0, import_react56.useRef)(null);
|
|
8940
|
+
(0, import_react56.useEffect)(() => {
|
|
9065
8941
|
appStore.subscribe(
|
|
9066
8942
|
(s) => s.state.data,
|
|
9067
8943
|
(data) => {
|
|
@@ -9075,14 +8951,99 @@ function PuckProvider({ children }) {
|
|
|
9075
8951
|
}, []);
|
|
9076
8952
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
9077
8953
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
9078
|
-
(0,
|
|
8954
|
+
(0, import_react56.useEffect)(() => {
|
|
9079
8955
|
const { resolveAndCommitData } = appStore.getState();
|
|
9080
8956
|
resolveAndCommitData();
|
|
9081
8957
|
}, []);
|
|
9082
|
-
return /* @__PURE__ */ (0,
|
|
8958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
8959
|
+
}
|
|
8960
|
+
function PuckLayout({ children }) {
|
|
8961
|
+
const {
|
|
8962
|
+
iframe: _iframe,
|
|
8963
|
+
dnd,
|
|
8964
|
+
initialHistory: _initialHistory
|
|
8965
|
+
} = usePropsContext();
|
|
8966
|
+
const iframe = (0, import_react56.useMemo)(
|
|
8967
|
+
() => __spreadValues({
|
|
8968
|
+
enabled: true,
|
|
8969
|
+
waitForStyles: true
|
|
8970
|
+
}, _iframe),
|
|
8971
|
+
[_iframe]
|
|
8972
|
+
);
|
|
8973
|
+
useInjectGlobalCss(iframe.enabled);
|
|
8974
|
+
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8975
|
+
const rightSideBarVisible = useAppStore(
|
|
8976
|
+
(s) => s.state.ui.rightSideBarVisible
|
|
8977
|
+
);
|
|
8978
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
8979
|
+
(0, import_react56.useEffect)(() => {
|
|
8980
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8981
|
+
dispatch({
|
|
8982
|
+
type: "setUi",
|
|
8983
|
+
ui: {
|
|
8984
|
+
leftSideBarVisible: false,
|
|
8985
|
+
rightSideBarVisible: false
|
|
8986
|
+
}
|
|
8987
|
+
});
|
|
8988
|
+
}
|
|
8989
|
+
const handleResize = () => {
|
|
8990
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8991
|
+
dispatch({
|
|
8992
|
+
type: "setUi",
|
|
8993
|
+
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
8994
|
+
});
|
|
8995
|
+
}
|
|
8996
|
+
};
|
|
8997
|
+
window.addEventListener("resize", handleResize);
|
|
8998
|
+
return () => {
|
|
8999
|
+
window.removeEventListener("resize", handleResize);
|
|
9000
|
+
};
|
|
9001
|
+
}, []);
|
|
9002
|
+
const overrides = useAppStore((s) => s.overrides);
|
|
9003
|
+
const CustomPuck = (0, import_react56.useMemo)(
|
|
9004
|
+
() => overrides.puck || DefaultOverride,
|
|
9005
|
+
[overrides]
|
|
9006
|
+
);
|
|
9007
|
+
const [mounted, setMounted] = (0, import_react56.useState)(false);
|
|
9008
|
+
(0, import_react56.useEffect)(() => {
|
|
9009
|
+
setMounted(true);
|
|
9010
|
+
}, []);
|
|
9011
|
+
const ready = useAppStore((s) => s.status === "READY");
|
|
9012
|
+
useMonitorHotkeys();
|
|
9013
|
+
(0, import_react56.useEffect)(() => {
|
|
9014
|
+
if (ready && iframe.enabled) {
|
|
9015
|
+
const frameDoc = getFrame();
|
|
9016
|
+
if (frameDoc) {
|
|
9017
|
+
return monitorHotkeys(frameDoc);
|
|
9018
|
+
}
|
|
9019
|
+
}
|
|
9020
|
+
}, [ready, iframe.enabled]);
|
|
9021
|
+
usePreviewModeHotkeys();
|
|
9022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `Puck ${getClassName28()}`, children: [
|
|
9023
|
+
/* @__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)(
|
|
9024
|
+
"div",
|
|
9025
|
+
{
|
|
9026
|
+
className: getLayoutClassName({
|
|
9027
|
+
leftSideBarVisible,
|
|
9028
|
+
mounted,
|
|
9029
|
+
rightSideBarVisible
|
|
9030
|
+
}),
|
|
9031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
|
9032
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Header, {}),
|
|
9033
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
|
9034
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Components, {}) }),
|
|
9035
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Outline, {}) })
|
|
9036
|
+
] }),
|
|
9037
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Canvas, {}),
|
|
9038
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FieldSideBar, {}) })
|
|
9039
|
+
] })
|
|
9040
|
+
}
|
|
9041
|
+
) }) }),
|
|
9042
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: "puck-portal-root", className: getClassName28("portal") })
|
|
9043
|
+
] });
|
|
9083
9044
|
}
|
|
9084
9045
|
function Puck(props) {
|
|
9085
|
-
return /* @__PURE__ */ (0,
|
|
9046
|
+
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
9047
|
}
|
|
9087
9048
|
Puck.Components = Components;
|
|
9088
9049
|
Puck.Fields = Fields;
|
|
@@ -9217,14 +9178,6 @@ lucide-react/dist/esm/icons/globe.js:
|
|
|
9217
9178
|
* See the LICENSE file in the root directory of this source tree.
|
|
9218
9179
|
*)
|
|
9219
9180
|
|
|
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
9181
|
lucide-react/dist/esm/icons/hash.js:
|
|
9229
9182
|
(**
|
|
9230
9183
|
* @license lucide-react v0.468.0 - ISC
|
|
@@ -9353,14 +9306,6 @@ lucide-react/dist/esm/icons/tablet.js:
|
|
|
9353
9306
|
* See the LICENSE file in the root directory of this source tree.
|
|
9354
9307
|
*)
|
|
9355
9308
|
|
|
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
9309
|
lucide-react/dist/esm/icons/trash.js:
|
|
9365
9310
|
(**
|
|
9366
9311
|
* @license lucide-react v0.468.0 - ISC
|