@puckeditor/core 0.23.0 → 0.24.0-canary.5d053ab9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Editor-44C53YAG.mjs → Editor-6FVPPPTF.mjs} +6 -6
- package/dist/{chunk-YQWFSBOU.mjs → chunk-3APNIQ4V.mjs} +66 -37
- package/dist/{chunk-NJTGWYYH.mjs → chunk-3RRSMHJE.mjs} +1 -1
- package/dist/{chunk-GNR2HNTB.mjs → chunk-4KR5YUJB.mjs} +7 -7
- package/dist/{chunk-WF6I3XOL.mjs → chunk-AXMNKNOE.mjs} +3 -3
- package/dist/{chunk-55V3NZVF.mjs → chunk-BVD2GJCJ.mjs} +442 -364
- package/dist/{chunk-K2LNXU54.mjs → chunk-J2WXVF4Z.mjs} +1 -0
- package/dist/{chunk-67Y7M4OJ.mjs → chunk-QHS6M72F.mjs} +1 -1
- package/dist/{chunk-4P4VZS4P.mjs → chunk-S6EKCNZI.mjs} +1 -1
- package/dist/{full-7ZJV44EE.mjs → full-MC4TVNN7.mjs} +5 -5
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +716 -611
- package/dist/index.mjs +8 -8
- package/dist/{loaded-36WRJPBT.mjs → loaded-73WW27KL.mjs} +2 -2
- package/dist/{loaded-JKA25A3T.mjs → loaded-7OPHUKVX.mjs} +2 -2
- package/dist/{loaded-SMPR6KZF.mjs → loaded-PZCRIGO7.mjs} +2 -2
- package/dist/no-external.js +716 -611
- package/dist/no-external.mjs +8 -8
- package/dist/rsc.d.mts +3 -2
- package/dist/rsc.d.ts +3 -2
- package/dist/rsc.js +112 -53
- package/dist/rsc.mjs +49 -19
- package/package.json +1 -1
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorInner,
|
|
3
3
|
LoadedRichTextMenu
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AXMNKNOE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
RichTextRenderFallback,
|
|
7
7
|
SlotRender,
|
|
8
8
|
SlotRenderPure,
|
|
9
9
|
buildMappers,
|
|
10
10
|
getSlotTransform,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./chunk-YQWFSBOU.mjs";
|
|
11
|
+
use_render_props_default
|
|
12
|
+
} from "./chunk-3APNIQ4V.mjs";
|
|
14
13
|
import {
|
|
15
14
|
LoadedRichTextMenuInner
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4KR5YUJB.mjs";
|
|
17
16
|
import {
|
|
18
17
|
ActionBar,
|
|
19
18
|
ChevronDown,
|
|
@@ -61,6 +60,7 @@ import {
|
|
|
61
60
|
monitorHotkeys,
|
|
62
61
|
reorder,
|
|
63
62
|
replace,
|
|
63
|
+
toRoot,
|
|
64
64
|
useAppStore,
|
|
65
65
|
useAppStoreApi,
|
|
66
66
|
useHotkey,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
useRegisterHistorySlice,
|
|
71
71
|
useRegisterPermissionsSlice,
|
|
72
72
|
useResetAutoZoom
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-J2WXVF4Z.mjs";
|
|
74
74
|
import {
|
|
75
75
|
generateId,
|
|
76
76
|
getItem,
|
|
@@ -2050,7 +2050,7 @@ EditorFallback.displayName = "EditorFallback";
|
|
|
2050
2050
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
2051
2051
|
import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
|
|
2052
2052
|
var Editor = lazy(
|
|
2053
|
-
() => import("./Editor-
|
|
2053
|
+
() => import("./Editor-6FVPPPTF.mjs").then((m) => ({
|
|
2054
2054
|
default: m.Editor
|
|
2055
2055
|
}))
|
|
2056
2056
|
);
|
|
@@ -2359,6 +2359,7 @@ function AutoField(props) {
|
|
|
2359
2359
|
|
|
2360
2360
|
// components/Render/index.tsx
|
|
2361
2361
|
init_react_import();
|
|
2362
|
+
import React3, { useMemo as useMemo14 } from "react";
|
|
2362
2363
|
|
|
2363
2364
|
// components/DropZone/index.tsx
|
|
2364
2365
|
init_react_import();
|
|
@@ -2368,7 +2369,7 @@ import {
|
|
|
2368
2369
|
useCallback as useCallback15,
|
|
2369
2370
|
useContext as useContext10,
|
|
2370
2371
|
useEffect as useEffect17,
|
|
2371
|
-
useMemo as
|
|
2372
|
+
useMemo as useMemo13,
|
|
2372
2373
|
useRef as useRef10
|
|
2373
2374
|
} from "react";
|
|
2374
2375
|
|
|
@@ -3799,6 +3800,10 @@ init_react_import();
|
|
|
3799
3800
|
var getSelectorForId = (state, id) => {
|
|
3800
3801
|
const node = state.indexes.nodes[id];
|
|
3801
3802
|
if (!node) return;
|
|
3803
|
+
const isRoot = node.data.type === "root" || id === "root";
|
|
3804
|
+
if (isRoot) {
|
|
3805
|
+
return;
|
|
3806
|
+
}
|
|
3802
3807
|
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
3803
3808
|
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
3804
3809
|
return { zone: zoneCompound, index };
|
|
@@ -3812,6 +3817,15 @@ function resolveAndReplaceData(currentData, getState, trigger = "force", writeTh
|
|
|
3812
3817
|
trigger
|
|
3813
3818
|
);
|
|
3814
3819
|
if (!resolvedResult.didChange && !writeThrough) return;
|
|
3820
|
+
const isRoot = resolvedResult.node.type === "root" || resolvedResult.node.props.id === "root";
|
|
3821
|
+
if (isRoot) {
|
|
3822
|
+
getState().dispatch({
|
|
3823
|
+
type: "replaceRoot",
|
|
3824
|
+
root: toRoot(resolvedResult.node),
|
|
3825
|
+
ui
|
|
3826
|
+
});
|
|
3827
|
+
return;
|
|
3828
|
+
}
|
|
3815
3829
|
const itemSelector = getSelectorForId(
|
|
3816
3830
|
getState().state,
|
|
3817
3831
|
resolvedResult.node.props.id
|
|
@@ -4993,7 +5007,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
4993
5007
|
};
|
|
4994
5008
|
|
|
4995
5009
|
// components/DropZone/index.tsx
|
|
4996
|
-
import { useShallow as
|
|
5010
|
+
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
|
4997
5011
|
|
|
4998
5012
|
// components/SlotRender/index.tsx
|
|
4999
5013
|
init_react_import();
|
|
@@ -5024,6 +5038,11 @@ var ContextSlotRender = ({
|
|
|
5024
5038
|
);
|
|
5025
5039
|
};
|
|
5026
5040
|
|
|
5041
|
+
// lib/props/editor/use-editor-props.tsx
|
|
5042
|
+
init_react_import();
|
|
5043
|
+
import { useMemo as useMemo11 } from "react";
|
|
5044
|
+
import { useShallow as useShallow6 } from "zustand/react/shallow";
|
|
5045
|
+
|
|
5027
5046
|
// lib/field-transforms/use-field-transforms-tracked.tsx
|
|
5028
5047
|
init_react_import();
|
|
5029
5048
|
import { useMemo as useMemo10, useRef as useRef6 } from "react";
|
|
@@ -5294,7 +5313,7 @@ import {
|
|
|
5294
5313
|
} from "react";
|
|
5295
5314
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
5296
5315
|
var Editor2 = lazy2(
|
|
5297
|
-
() => import("./Editor-
|
|
5316
|
+
() => import("./Editor-6FVPPPTF.mjs").then((m) => ({
|
|
5298
5317
|
default: m.Editor
|
|
5299
5318
|
}))
|
|
5300
5319
|
);
|
|
@@ -5406,6 +5425,47 @@ var getRichTextTransform = () => ({
|
|
|
5406
5425
|
}
|
|
5407
5426
|
});
|
|
5408
5427
|
|
|
5428
|
+
// lib/props/editor/use-editor-props.tsx
|
|
5429
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5430
|
+
var useEditorProps = ({
|
|
5431
|
+
component
|
|
5432
|
+
}) => {
|
|
5433
|
+
const config = useAppStore((s) => s.config);
|
|
5434
|
+
const plugins = useAppStore((s) => s.plugins);
|
|
5435
|
+
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
5436
|
+
const componentId = component.props.id;
|
|
5437
|
+
const componentIsLoading = useAppStore(
|
|
5438
|
+
(s) => {
|
|
5439
|
+
var _a;
|
|
5440
|
+
return ((_a = s.componentState[componentId]) == null ? void 0 : _a.loadingCount) > 0;
|
|
5441
|
+
}
|
|
5442
|
+
);
|
|
5443
|
+
const componentReadOnly = useAppStore(
|
|
5444
|
+
useShallow6((s) => {
|
|
5445
|
+
var _a;
|
|
5446
|
+
return (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.readOnly;
|
|
5447
|
+
})
|
|
5448
|
+
);
|
|
5449
|
+
const combinedFieldTransforms = useMemo11(
|
|
5450
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx29(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce((acc, plugin) => {
|
|
5451
|
+
if (!plugin.fieldTransforms) return acc;
|
|
5452
|
+
Object.keys(plugin.fieldTransforms).forEach((key) => {
|
|
5453
|
+
acc[key] = plugin.fieldTransforms[key];
|
|
5454
|
+
});
|
|
5455
|
+
return acc;
|
|
5456
|
+
}, {})), userFieldTransforms),
|
|
5457
|
+
[plugins, userFieldTransforms, componentId]
|
|
5458
|
+
);
|
|
5459
|
+
return useFieldTransformsTracked(
|
|
5460
|
+
config,
|
|
5461
|
+
component,
|
|
5462
|
+
combinedFieldTransforms,
|
|
5463
|
+
componentReadOnly,
|
|
5464
|
+
componentIsLoading
|
|
5465
|
+
);
|
|
5466
|
+
};
|
|
5467
|
+
var use_editor_props_default = useEditorProps;
|
|
5468
|
+
|
|
5409
5469
|
// components/MemoizeComponent/index.tsx
|
|
5410
5470
|
init_react_import();
|
|
5411
5471
|
import { deepEqual } from "fast-equals";
|
|
@@ -5436,12 +5496,12 @@ function shallowEqual(obj1, obj2, keysToIgnore = []) {
|
|
|
5436
5496
|
}
|
|
5437
5497
|
|
|
5438
5498
|
// components/MemoizeComponent/index.tsx
|
|
5439
|
-
import { jsx as
|
|
5499
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5440
5500
|
var RenderComponent = ({
|
|
5441
5501
|
Component,
|
|
5442
5502
|
componentProps: renderProps
|
|
5443
5503
|
}) => {
|
|
5444
|
-
return /* @__PURE__ */
|
|
5504
|
+
return /* @__PURE__ */ jsx30(Component, __spreadValues({}, renderProps));
|
|
5445
5505
|
};
|
|
5446
5506
|
var MemoizeComponent = memo6(RenderComponent, (prev, next) => {
|
|
5447
5507
|
let puckEquals = true;
|
|
@@ -5457,7 +5517,7 @@ import {
|
|
|
5457
5517
|
useCallback as useCallback14,
|
|
5458
5518
|
useContext as useContext9,
|
|
5459
5519
|
useEffect as useEffect16,
|
|
5460
|
-
useMemo as
|
|
5520
|
+
useMemo as useMemo12,
|
|
5461
5521
|
useRef as useRef9
|
|
5462
5522
|
} from "react";
|
|
5463
5523
|
import {
|
|
@@ -5470,7 +5530,7 @@ import {
|
|
|
5470
5530
|
useVirtualizer,
|
|
5471
5531
|
windowScroll
|
|
5472
5532
|
} from "@tanstack/react-virtual";
|
|
5473
|
-
import { Fragment as Fragment8, jsx as
|
|
5533
|
+
import { Fragment as Fragment8, jsx as jsx31 } from "react/jsx-runtime";
|
|
5474
5534
|
var ROOT_ZONE_VIRTUALIZATION_OVERSCAN = 5;
|
|
5475
5535
|
var DEFAULT_VIRTUALIZED_ITEM_HEIGHT = 320;
|
|
5476
5536
|
var measuredItemHeights = /* @__PURE__ */ new Map();
|
|
@@ -5538,7 +5598,7 @@ var VirtualizedDropZone = ({
|
|
|
5538
5598
|
},
|
|
5539
5599
|
[appStoreApi, contentIds]
|
|
5540
5600
|
);
|
|
5541
|
-
const pinnedIndexes =
|
|
5601
|
+
const pinnedIndexes = useMemo12(() => {
|
|
5542
5602
|
const nextPinnedIndexes = /* @__PURE__ */ new Set();
|
|
5543
5603
|
[selectedId, draggedItemId, dragTargetParentId].forEach((targetId) => {
|
|
5544
5604
|
const currentIndex = resolveIndex(targetId);
|
|
@@ -5609,7 +5669,7 @@ var VirtualizedDropZone = ({
|
|
|
5609
5669
|
}, [contentIds]);
|
|
5610
5670
|
const virtualItems = virtualizer.getVirtualItems();
|
|
5611
5671
|
const totalSize = virtualizer.getTotalSize();
|
|
5612
|
-
const renderedItems =
|
|
5672
|
+
const renderedItems = useMemo12(() => {
|
|
5613
5673
|
const items = [];
|
|
5614
5674
|
let previousEnd = 0;
|
|
5615
5675
|
let previousIndex = -1;
|
|
@@ -5619,7 +5679,7 @@ var VirtualizedDropZone = ({
|
|
|
5619
5679
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
5620
5680
|
if (gapSize > 0) {
|
|
5621
5681
|
items.push(
|
|
5622
|
-
/* @__PURE__ */
|
|
5682
|
+
/* @__PURE__ */ jsx31(
|
|
5623
5683
|
"div",
|
|
5624
5684
|
{
|
|
5625
5685
|
style: { height: `${gapSize}px` }
|
|
@@ -5641,7 +5701,7 @@ var VirtualizedDropZone = ({
|
|
|
5641
5701
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
5642
5702
|
if (trailingGap > 0) {
|
|
5643
5703
|
items.push(
|
|
5644
|
-
/* @__PURE__ */
|
|
5704
|
+
/* @__PURE__ */ jsx31(
|
|
5645
5705
|
"div",
|
|
5646
5706
|
{
|
|
5647
5707
|
style: { height: `${trailingGap}px` }
|
|
@@ -5652,13 +5712,13 @@ var VirtualizedDropZone = ({
|
|
|
5652
5712
|
}
|
|
5653
5713
|
return items;
|
|
5654
5714
|
}, [totalSize, virtualItems, getMeasureRef]);
|
|
5655
|
-
return /* @__PURE__ */
|
|
5715
|
+
return /* @__PURE__ */ jsx31(Fragment8, { children: renderedItems });
|
|
5656
5716
|
};
|
|
5657
5717
|
|
|
5658
5718
|
// components/DropZone/LinePlaceholder.tsx
|
|
5659
5719
|
init_react_import();
|
|
5660
5720
|
import { useLayoutEffect as useLayoutEffect2, useState as useState16 } from "react";
|
|
5661
|
-
import { jsx as
|
|
5721
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5662
5722
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default9);
|
|
5663
5723
|
var LINE_SIZE = "var(--puck-line-placeholder-width, 2px)";
|
|
5664
5724
|
var LinePlaceholder = ({
|
|
@@ -5739,7 +5799,7 @@ var LinePlaceholder = ({
|
|
|
5739
5799
|
}
|
|
5740
5800
|
}, [zoneRef, contentIds, index]);
|
|
5741
5801
|
if (!style) return null;
|
|
5742
|
-
return /* @__PURE__ */
|
|
5802
|
+
return /* @__PURE__ */ jsx32(
|
|
5743
5803
|
"div",
|
|
5744
5804
|
{
|
|
5745
5805
|
className: getClassName17("linePlaceholder"),
|
|
@@ -5750,7 +5810,7 @@ var LinePlaceholder = ({
|
|
|
5750
5810
|
};
|
|
5751
5811
|
|
|
5752
5812
|
// components/DropZone/index.tsx
|
|
5753
|
-
import { Fragment as Fragment9, jsx as
|
|
5813
|
+
import { Fragment as Fragment9, jsx as jsx33, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5754
5814
|
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default9);
|
|
5755
5815
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
5756
5816
|
var RENDER_DEBUG = false;
|
|
@@ -5762,12 +5822,12 @@ var InsertPreview = ({
|
|
|
5762
5822
|
if (element) {
|
|
5763
5823
|
return (
|
|
5764
5824
|
// Safe to use this since the HTML is set by the user
|
|
5765
|
-
/* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx33("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } })
|
|
5766
5826
|
);
|
|
5767
5827
|
}
|
|
5768
|
-
return /* @__PURE__ */
|
|
5828
|
+
return /* @__PURE__ */ jsx33(DrawerItemInner, { name: label, children: override });
|
|
5769
5829
|
};
|
|
5770
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */
|
|
5830
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ jsx33(DropZoneEdit, __spreadValues({}, props));
|
|
5771
5831
|
var DropZoneChild = ({
|
|
5772
5832
|
zoneCompound,
|
|
5773
5833
|
componentId,
|
|
@@ -5783,7 +5843,7 @@ var DropZoneChild = ({
|
|
|
5783
5843
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
5784
5844
|
const zoneStore = useContext10(ZoneStoreContext);
|
|
5785
5845
|
const nodeProps = useAppStore(
|
|
5786
|
-
|
|
5846
|
+
useShallow7((s) => {
|
|
5787
5847
|
var _a2;
|
|
5788
5848
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
|
|
5789
5849
|
})
|
|
@@ -5794,14 +5854,8 @@ var DropZoneChild = ({
|
|
|
5794
5854
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.type;
|
|
5795
5855
|
}
|
|
5796
5856
|
);
|
|
5797
|
-
const nodeReadOnly = useAppStore(
|
|
5798
|
-
useShallow6((s) => {
|
|
5799
|
-
var _a2;
|
|
5800
|
-
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
|
5801
|
-
})
|
|
5802
|
-
);
|
|
5803
5857
|
const appStore = useAppStoreApi();
|
|
5804
|
-
const item =
|
|
5858
|
+
const item = useMemo13(() => {
|
|
5805
5859
|
if (nodeProps) {
|
|
5806
5860
|
const expanded = expandNode({
|
|
5807
5861
|
type: nodeType,
|
|
@@ -5823,7 +5877,7 @@ var DropZoneChild = ({
|
|
|
5823
5877
|
const componentConfig = useAppStore(
|
|
5824
5878
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
5825
5879
|
);
|
|
5826
|
-
const puckProps =
|
|
5880
|
+
const puckProps = useMemo13(
|
|
5827
5881
|
() => ({
|
|
5828
5882
|
renderDropZone: DropZoneEditPure,
|
|
5829
5883
|
isEditing: true,
|
|
@@ -5850,7 +5904,7 @@ var DropZoneChild = ({
|
|
|
5850
5904
|
type: (_b = (_a = item == null ? void 0 : item.type) == null ? void 0 : _a.toString()) != null ? _b : ""
|
|
5851
5905
|
});
|
|
5852
5906
|
let label = (_d = (_c = componentConfig == null ? void 0 : componentConfig.label) != null ? _c : item == null ? void 0 : item.type.toString()) != null ? _d : componentLabel;
|
|
5853
|
-
const defaultsProps =
|
|
5907
|
+
const defaultsProps = useMemo13(
|
|
5854
5908
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
5855
5909
|
puck: puckProps,
|
|
5856
5910
|
editMode: true
|
|
@@ -5858,35 +5912,19 @@ var DropZoneChild = ({
|
|
|
5858
5912
|
}),
|
|
5859
5913
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
|
|
5860
5914
|
);
|
|
5861
|
-
const defaultedNode =
|
|
5915
|
+
const defaultedNode = useMemo13(
|
|
5862
5916
|
() => {
|
|
5863
5917
|
var _a2;
|
|
5864
5918
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
5865
5919
|
},
|
|
5866
5920
|
[item == null ? void 0 : item.type, nodeType, defaultsProps]
|
|
5867
5921
|
);
|
|
5868
|
-
const
|
|
5869
|
-
const plugins = useAppStore((s) => s.plugins);
|
|
5870
|
-
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
5871
|
-
const combinedFieldTransforms = useMemo12(
|
|
5872
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx32(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
5873
|
-
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
5874
|
-
{}
|
|
5875
|
-
)), userFieldTransforms),
|
|
5876
|
-
[plugins, userFieldTransforms]
|
|
5877
|
-
);
|
|
5878
|
-
const transformedProps = useFieldTransformsTracked(
|
|
5879
|
-
config,
|
|
5880
|
-
defaultedNode,
|
|
5881
|
-
combinedFieldTransforms,
|
|
5882
|
-
nodeReadOnly,
|
|
5883
|
-
isLoading
|
|
5884
|
-
);
|
|
5922
|
+
const transformedProps = use_editor_props_default({ component: defaultedNode });
|
|
5885
5923
|
if (!item) return;
|
|
5886
|
-
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */
|
|
5924
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ jsx33("div", { style: { padding: 48, textAlign: "center" }, children: noConfigMessage });
|
|
5887
5925
|
let componentType = item.type;
|
|
5888
5926
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
5889
|
-
return /* @__PURE__ */
|
|
5927
|
+
return /* @__PURE__ */ jsx33(
|
|
5890
5928
|
DraggableComponent,
|
|
5891
5929
|
{
|
|
5892
5930
|
id: componentId,
|
|
@@ -5904,7 +5942,7 @@ var DropZoneChild = ({
|
|
|
5904
5942
|
children: (dragRef) => {
|
|
5905
5943
|
var _a2;
|
|
5906
5944
|
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
5907
|
-
return /* @__PURE__ */
|
|
5945
|
+
return /* @__PURE__ */ jsx33(
|
|
5908
5946
|
MemoizeComponent,
|
|
5909
5947
|
{
|
|
5910
5948
|
Component: Render2,
|
|
@@ -5914,14 +5952,14 @@ var DropZoneChild = ({
|
|
|
5914
5952
|
}
|
|
5915
5953
|
);
|
|
5916
5954
|
}
|
|
5917
|
-
return /* @__PURE__ */
|
|
5955
|
+
return /* @__PURE__ */ jsx33("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ jsx33(
|
|
5918
5956
|
InsertPreview,
|
|
5919
5957
|
{
|
|
5920
5958
|
label,
|
|
5921
5959
|
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
5922
5960
|
element: "element" in item && item.element ? item.element : void 0
|
|
5923
5961
|
}
|
|
5924
|
-
) : /* @__PURE__ */
|
|
5962
|
+
) : /* @__PURE__ */ jsx33(
|
|
5925
5963
|
MemoizeComponent,
|
|
5926
5964
|
{
|
|
5927
5965
|
Component: Render2,
|
|
@@ -5954,7 +5992,7 @@ var DropZoneEdit = forwardRef(
|
|
|
5954
5992
|
unregisterLocalZone
|
|
5955
5993
|
} = ctx != null ? ctx : {};
|
|
5956
5994
|
const path = useAppStore(
|
|
5957
|
-
|
|
5995
|
+
useShallow7((s) => {
|
|
5958
5996
|
var _a;
|
|
5959
5997
|
return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
|
|
5960
5998
|
})
|
|
@@ -5971,13 +6009,13 @@ var DropZoneEdit = forwardRef(
|
|
|
5971
6009
|
(s) => s.nextAreaDepthIndex[areaId || ""]
|
|
5972
6010
|
);
|
|
5973
6011
|
const zoneContentIds = useAppStore(
|
|
5974
|
-
|
|
6012
|
+
useShallow7((s) => {
|
|
5975
6013
|
var _a;
|
|
5976
6014
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
|
|
5977
6015
|
})
|
|
5978
6016
|
);
|
|
5979
6017
|
const zoneType = useAppStore(
|
|
5980
|
-
|
|
6018
|
+
useShallow7((s) => {
|
|
5981
6019
|
var _a;
|
|
5982
6020
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
|
5983
6021
|
})
|
|
@@ -5998,7 +6036,7 @@ var DropZoneEdit = forwardRef(
|
|
|
5998
6036
|
}
|
|
5999
6037
|
}
|
|
6000
6038
|
}, [zoneType]);
|
|
6001
|
-
const contentIds =
|
|
6039
|
+
const contentIds = useMemo13(() => {
|
|
6002
6040
|
return zoneContentIds || [];
|
|
6003
6041
|
}, [zoneContentIds]);
|
|
6004
6042
|
const ref = useRef10(null);
|
|
@@ -6100,12 +6138,12 @@ var DropZoneEdit = forwardRef(
|
|
|
6100
6138
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
6101
6139
|
}),
|
|
6102
6140
|
children: [
|
|
6103
|
-
shouldVirtualizeItems ? /* @__PURE__ */
|
|
6141
|
+
shouldVirtualizeItems ? /* @__PURE__ */ jsx33(
|
|
6104
6142
|
VirtualizedDropZone,
|
|
6105
6143
|
{
|
|
6106
6144
|
contentIds: contentIdsWithPreview,
|
|
6107
6145
|
zoneCompound,
|
|
6108
|
-
renderItem: (props) => /* @__PURE__ */
|
|
6146
|
+
renderItem: (props) => /* @__PURE__ */ jsx33(
|
|
6109
6147
|
DropZoneChildMemo,
|
|
6110
6148
|
{
|
|
6111
6149
|
zoneCompound,
|
|
@@ -6119,7 +6157,7 @@ var DropZoneEdit = forwardRef(
|
|
|
6119
6157
|
props.componentId
|
|
6120
6158
|
)
|
|
6121
6159
|
}
|
|
6122
|
-
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */
|
|
6160
|
+
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ jsx33(
|
|
6123
6161
|
DropZoneChildMemo,
|
|
6124
6162
|
{
|
|
6125
6163
|
zoneCompound,
|
|
@@ -6131,7 +6169,7 @@ var DropZoneEdit = forwardRef(
|
|
|
6131
6169
|
},
|
|
6132
6170
|
componentId
|
|
6133
6171
|
)),
|
|
6134
|
-
(preview == null ? void 0 : preview.linePlaceholder) && /* @__PURE__ */
|
|
6172
|
+
(preview == null ? void 0 : preview.linePlaceholder) && /* @__PURE__ */ jsx33(
|
|
6135
6173
|
LinePlaceholder,
|
|
6136
6174
|
{
|
|
6137
6175
|
zoneRef: ref,
|
|
@@ -6147,34 +6185,46 @@ var DropZoneEdit = forwardRef(
|
|
|
6147
6185
|
var DropZoneRenderItem = ({
|
|
6148
6186
|
config,
|
|
6149
6187
|
item,
|
|
6150
|
-
metadata
|
|
6188
|
+
metadata,
|
|
6189
|
+
fieldTransforms
|
|
6151
6190
|
}) => {
|
|
6152
6191
|
const Component = config.components[item.type];
|
|
6153
|
-
const
|
|
6154
|
-
|
|
6192
|
+
const renderProps = use_render_props_default(
|
|
6193
|
+
config,
|
|
6194
|
+
item,
|
|
6195
|
+
(slotProps) => /* @__PURE__ */ jsx33(
|
|
6196
|
+
SlotRenderPure,
|
|
6197
|
+
__spreadProps(__spreadValues({}, slotProps), {
|
|
6198
|
+
config,
|
|
6199
|
+
metadata,
|
|
6200
|
+
fieldTransforms
|
|
6201
|
+
})
|
|
6202
|
+
),
|
|
6203
|
+
fieldTransforms
|
|
6204
|
+
);
|
|
6205
|
+
const nextContextValue = useMemo13(
|
|
6155
6206
|
() => ({
|
|
6156
|
-
areaId:
|
|
6207
|
+
areaId: renderProps.id,
|
|
6157
6208
|
depth: 1
|
|
6158
6209
|
}),
|
|
6159
|
-
[
|
|
6210
|
+
[renderProps.id]
|
|
6160
6211
|
);
|
|
6161
|
-
|
|
6162
|
-
return /* @__PURE__ */ jsx32(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx32(
|
|
6212
|
+
return /* @__PURE__ */ jsx33(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx33(
|
|
6163
6213
|
Component.render,
|
|
6164
|
-
__spreadProps(__spreadValues(
|
|
6165
|
-
puck: __spreadProps(__spreadValues({},
|
|
6214
|
+
__spreadProps(__spreadValues({}, renderProps), {
|
|
6215
|
+
puck: __spreadProps(__spreadValues({}, renderProps.puck), {
|
|
6166
6216
|
renderDropZone: DropZoneRenderPure,
|
|
6167
6217
|
metadata: __spreadValues(__spreadValues({}, metadata), Component.metadata)
|
|
6168
6218
|
})
|
|
6169
6219
|
})
|
|
6170
|
-
) },
|
|
6220
|
+
) }, renderProps.id);
|
|
6171
6221
|
};
|
|
6172
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */
|
|
6222
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx33(DropZoneRender, __spreadValues({}, props));
|
|
6173
6223
|
var DropZoneRender = forwardRef(
|
|
6174
6224
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
6175
6225
|
const ctx = useContext10(dropZoneContext);
|
|
6176
6226
|
const { areaId = "root" } = ctx || {};
|
|
6177
|
-
const { config, data, metadata } = useContext10(renderContext);
|
|
6227
|
+
const { config, data, metadata, fieldTransforms } = useContext10(renderContext);
|
|
6178
6228
|
let zoneCompound = `${areaId}:${zone}`;
|
|
6179
6229
|
let content = (data == null ? void 0 : data.content) || [];
|
|
6180
6230
|
useEffect17(() => {
|
|
@@ -6191,15 +6241,16 @@ var DropZoneRender = forwardRef(
|
|
|
6191
6241
|
if (zoneCompound !== rootDroppableId) {
|
|
6192
6242
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
6193
6243
|
}
|
|
6194
|
-
return /* @__PURE__ */
|
|
6244
|
+
return /* @__PURE__ */ jsx33(El, { className, style, ref, children: content.map((item) => {
|
|
6195
6245
|
const Component = config.components[item.type];
|
|
6196
6246
|
if (Component) {
|
|
6197
|
-
return /* @__PURE__ */
|
|
6247
|
+
return /* @__PURE__ */ jsx33(
|
|
6198
6248
|
DropZoneRenderItem,
|
|
6199
6249
|
{
|
|
6200
6250
|
config,
|
|
6201
6251
|
item,
|
|
6202
|
-
metadata
|
|
6252
|
+
metadata,
|
|
6253
|
+
fieldTransforms
|
|
6203
6254
|
},
|
|
6204
6255
|
item.props.id
|
|
6205
6256
|
);
|
|
@@ -6208,20 +6259,19 @@ var DropZoneRender = forwardRef(
|
|
|
6208
6259
|
}) });
|
|
6209
6260
|
}
|
|
6210
6261
|
);
|
|
6211
|
-
var DropZonePure = (props) => /* @__PURE__ */
|
|
6262
|
+
var DropZonePure = (props) => /* @__PURE__ */ jsx33(DropZone, __spreadValues({}, props));
|
|
6212
6263
|
var DropZone = forwardRef(
|
|
6213
6264
|
function DropZone2(props, ref) {
|
|
6214
6265
|
const ctx = useContext10(dropZoneContext);
|
|
6215
6266
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
6216
|
-
return /* @__PURE__ */
|
|
6267
|
+
return /* @__PURE__ */ jsx33(Fragment9, { children: /* @__PURE__ */ jsx33(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
6217
6268
|
}
|
|
6218
|
-
return /* @__PURE__ */
|
|
6269
|
+
return /* @__PURE__ */ jsx33(Fragment9, { children: /* @__PURE__ */ jsx33(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
6219
6270
|
}
|
|
6220
6271
|
);
|
|
6221
6272
|
|
|
6222
6273
|
// components/Render/index.tsx
|
|
6223
|
-
import
|
|
6224
|
-
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
6274
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
6225
6275
|
var renderContext = React3.createContext({
|
|
6226
6276
|
config: { components: {} },
|
|
6227
6277
|
data: { root: {}, content: [] },
|
|
@@ -6230,9 +6280,11 @@ var renderContext = React3.createContext({
|
|
|
6230
6280
|
function Render({
|
|
6231
6281
|
config,
|
|
6232
6282
|
data,
|
|
6233
|
-
metadata = {}
|
|
6283
|
+
metadata = {},
|
|
6284
|
+
fieldTransforms: userFieldTransforms
|
|
6234
6285
|
}) {
|
|
6235
|
-
var _a
|
|
6286
|
+
var _a;
|
|
6287
|
+
const fieldTransforms = userFieldTransforms;
|
|
6236
6288
|
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
6237
6289
|
root: data.root || {},
|
|
6238
6290
|
content: data.content || []
|
|
@@ -6250,23 +6302,42 @@ function Render({
|
|
|
6250
6302
|
editMode: false,
|
|
6251
6303
|
id: "puck-root"
|
|
6252
6304
|
});
|
|
6253
|
-
const
|
|
6305
|
+
const renderProps = use_render_props_default(
|
|
6254
6306
|
config,
|
|
6255
6307
|
{ type: "root", props: pageProps },
|
|
6256
|
-
(props) => /* @__PURE__ */
|
|
6308
|
+
(props) => /* @__PURE__ */ jsx34(
|
|
6309
|
+
SlotRender,
|
|
6310
|
+
__spreadProps(__spreadValues({}, props), {
|
|
6311
|
+
config,
|
|
6312
|
+
metadata,
|
|
6313
|
+
fieldTransforms
|
|
6314
|
+
})
|
|
6315
|
+
),
|
|
6316
|
+
fieldTransforms
|
|
6257
6317
|
);
|
|
6258
|
-
const
|
|
6259
|
-
const nextContextValue = useMemo13(
|
|
6318
|
+
const nextContextValue = useMemo14(
|
|
6260
6319
|
() => ({
|
|
6261
6320
|
mode: "render",
|
|
6262
6321
|
depth: 0
|
|
6263
6322
|
}),
|
|
6264
6323
|
[]
|
|
6265
6324
|
);
|
|
6266
|
-
if ((
|
|
6267
|
-
return /* @__PURE__ */
|
|
6325
|
+
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
6326
|
+
return /* @__PURE__ */ jsx34(
|
|
6327
|
+
renderContext.Provider,
|
|
6328
|
+
{
|
|
6329
|
+
value: { config, data: defaultedData, metadata, fieldTransforms },
|
|
6330
|
+
children: /* @__PURE__ */ jsx34(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx34(config.root.render, __spreadProps(__spreadValues({}, renderProps), { children: /* @__PURE__ */ jsx34(DropZoneRenderPure, { zone: rootZone }) })) })
|
|
6331
|
+
}
|
|
6332
|
+
);
|
|
6268
6333
|
}
|
|
6269
|
-
return /* @__PURE__ */
|
|
6334
|
+
return /* @__PURE__ */ jsx34(
|
|
6335
|
+
renderContext.Provider,
|
|
6336
|
+
{
|
|
6337
|
+
value: { config, data: defaultedData, metadata, fieldTransforms },
|
|
6338
|
+
children: /* @__PURE__ */ jsx34(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx34(DropZoneRenderPure, { zone: rootZone }) })
|
|
6339
|
+
}
|
|
6340
|
+
);
|
|
6270
6341
|
}
|
|
6271
6342
|
|
|
6272
6343
|
// lib/use-puck.ts
|
|
@@ -6428,7 +6499,7 @@ var styles_module_default12 = { "ComponentList": "_ComponentList_htktj_1", "Comp
|
|
|
6428
6499
|
|
|
6429
6500
|
// components/ComponentList/index.tsx
|
|
6430
6501
|
import { useEffect as useEffect19 } from "react";
|
|
6431
|
-
import { jsx as
|
|
6502
|
+
import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6432
6503
|
var getClassName19 = get_class_name_factory_default("ComponentList", styles_module_default12);
|
|
6433
6504
|
var ComponentListItem = ({
|
|
6434
6505
|
name,
|
|
@@ -6448,7 +6519,7 @@ var ComponentListItem = ({
|
|
|
6448
6519
|
);
|
|
6449
6520
|
}
|
|
6450
6521
|
}, [overrides]);
|
|
6451
|
-
return /* @__PURE__ */
|
|
6522
|
+
return /* @__PURE__ */ jsx35(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
6452
6523
|
};
|
|
6453
6524
|
var ComponentList = ({
|
|
6454
6525
|
children,
|
|
@@ -6483,14 +6554,14 @@ var ComponentList = ({
|
|
|
6483
6554
|
}),
|
|
6484
6555
|
title: expanded ? collapseTitle : expandTitle,
|
|
6485
6556
|
children: [
|
|
6486
|
-
/* @__PURE__ */
|
|
6487
|
-
/* @__PURE__ */
|
|
6557
|
+
/* @__PURE__ */ jsx35("div", { children: title }),
|
|
6558
|
+
/* @__PURE__ */ jsx35("div", { className: getClassName19("titleIcon"), children: expanded ? /* @__PURE__ */ jsx35(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx35(ChevronDown, { size: 12 }) })
|
|
6488
6559
|
]
|
|
6489
6560
|
}
|
|
6490
6561
|
),
|
|
6491
|
-
/* @__PURE__ */
|
|
6562
|
+
/* @__PURE__ */ jsx35("div", { className: getClassName19("content"), id: contentId, children: /* @__PURE__ */ jsx35(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
6492
6563
|
var _a;
|
|
6493
|
-
return /* @__PURE__ */
|
|
6564
|
+
return /* @__PURE__ */ jsx35(
|
|
6494
6565
|
ComponentListItem,
|
|
6495
6566
|
{
|
|
6496
6567
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -6504,7 +6575,7 @@ var ComponentList = ({
|
|
|
6504
6575
|
ComponentList.Item = ComponentListItem;
|
|
6505
6576
|
|
|
6506
6577
|
// lib/use-component-list.tsx
|
|
6507
|
-
import { jsx as
|
|
6578
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
6508
6579
|
var useComponentList = () => {
|
|
6509
6580
|
const [componentList, setComponentList] = useState18();
|
|
6510
6581
|
const config = useAppStore((s) => s.config);
|
|
@@ -6527,7 +6598,7 @@ var useComponentList = () => {
|
|
|
6527
6598
|
if (category.visible === false) {
|
|
6528
6599
|
return null;
|
|
6529
6600
|
}
|
|
6530
|
-
return /* @__PURE__ */
|
|
6601
|
+
return /* @__PURE__ */ jsx36(
|
|
6531
6602
|
ComponentList,
|
|
6532
6603
|
{
|
|
6533
6604
|
id: categoryKey,
|
|
@@ -6535,7 +6606,7 @@ var useComponentList = () => {
|
|
|
6535
6606
|
children: category.components.map((componentName, i) => {
|
|
6536
6607
|
var _a3;
|
|
6537
6608
|
const componentConf = config.components[componentName] || {};
|
|
6538
|
-
return /* @__PURE__ */
|
|
6609
|
+
return /* @__PURE__ */ jsx36(
|
|
6539
6610
|
ComponentList.Item,
|
|
6540
6611
|
{
|
|
6541
6612
|
label: (_a3 = componentConf["label"]) != null ? _a3 : componentName,
|
|
@@ -6555,7 +6626,7 @@ var useComponentList = () => {
|
|
|
6555
6626
|
);
|
|
6556
6627
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
6557
6628
|
_componentList.push(
|
|
6558
|
-
/* @__PURE__ */
|
|
6629
|
+
/* @__PURE__ */ jsx36(
|
|
6559
6630
|
ComponentList,
|
|
6560
6631
|
{
|
|
6561
6632
|
id: "other",
|
|
@@ -6563,7 +6634,7 @@ var useComponentList = () => {
|
|
|
6563
6634
|
children: remainingComponents.map((componentName, i) => {
|
|
6564
6635
|
var _a2;
|
|
6565
6636
|
const componentConf = config.components[componentName] || {};
|
|
6566
|
-
return /* @__PURE__ */
|
|
6637
|
+
return /* @__PURE__ */ jsx36(
|
|
6567
6638
|
ComponentList.Item,
|
|
6568
6639
|
{
|
|
6569
6640
|
name: componentName,
|
|
@@ -6585,12 +6656,12 @@ var useComponentList = () => {
|
|
|
6585
6656
|
};
|
|
6586
6657
|
|
|
6587
6658
|
// components/Puck/components/Components/index.tsx
|
|
6588
|
-
import { useMemo as
|
|
6589
|
-
import { jsx as
|
|
6659
|
+
import { useMemo as useMemo15 } from "react";
|
|
6660
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
6590
6661
|
var Components = () => {
|
|
6591
6662
|
const overrides = useAppStore((s) => s.overrides);
|
|
6592
6663
|
const componentList = useComponentList();
|
|
6593
|
-
const Wrapper =
|
|
6664
|
+
const Wrapper = useMemo15(() => {
|
|
6594
6665
|
if (overrides.components) {
|
|
6595
6666
|
console.warn(
|
|
6596
6667
|
"The `components` override has been deprecated and renamed to `drawer`"
|
|
@@ -6598,7 +6669,7 @@ var Components = () => {
|
|
|
6598
6669
|
}
|
|
6599
6670
|
return overrides.components || overrides.drawer || "div";
|
|
6600
6671
|
}, [overrides]);
|
|
6601
|
-
return /* @__PURE__ */
|
|
6672
|
+
return /* @__PURE__ */ jsx37(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx37(ComponentList, { id: "all" }) });
|
|
6602
6673
|
};
|
|
6603
6674
|
|
|
6604
6675
|
// css-module:/home/runner/work/puck/puck/packages/core/plugins/blocks/styles.module.css#css-module
|
|
@@ -6606,15 +6677,15 @@ init_react_import();
|
|
|
6606
6677
|
var styles_module_default13 = { "BlocksPlugin": "_BlocksPlugin_9af19_1" };
|
|
6607
6678
|
|
|
6608
6679
|
// plugins/blocks/index.tsx
|
|
6609
|
-
import { jsx as
|
|
6680
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
6610
6681
|
var getClassName20 = get_class_name_factory_default("BlocksPlugin", styles_module_default13);
|
|
6611
6682
|
var blocksPlugin = (props = {}) => {
|
|
6612
6683
|
var _a, _b;
|
|
6613
6684
|
return {
|
|
6614
6685
|
name: "blocks",
|
|
6615
6686
|
label: (_a = props.label) != null ? _a : "Blocks",
|
|
6616
|
-
render: () => /* @__PURE__ */
|
|
6617
|
-
icon: (_b = props.icon) != null ? _b : /* @__PURE__ */
|
|
6687
|
+
render: () => /* @__PURE__ */ jsx38("div", { className: getClassName20(), children: /* @__PURE__ */ jsx38(Components, {}) }),
|
|
6688
|
+
icon: (_b = props.icon) != null ? _b : /* @__PURE__ */ jsx38(Hammer, {})
|
|
6618
6689
|
};
|
|
6619
6690
|
};
|
|
6620
6691
|
|
|
@@ -6623,8 +6694,8 @@ init_react_import();
|
|
|
6623
6694
|
|
|
6624
6695
|
// components/Puck/components/Outline/index.tsx
|
|
6625
6696
|
init_react_import();
|
|
6626
|
-
import { useMemo as
|
|
6627
|
-
import { useShallow as
|
|
6697
|
+
import { useMemo as useMemo19 } from "react";
|
|
6698
|
+
import { useShallow as useShallow9 } from "zustand/react/shallow";
|
|
6628
6699
|
|
|
6629
6700
|
// lib/data/find-zones-for-area.ts
|
|
6630
6701
|
init_react_import();
|
|
@@ -6642,7 +6713,7 @@ init_react_import();
|
|
|
6642
6713
|
|
|
6643
6714
|
// components/LayerTree/lib/dnd/use-outline-drop-zone.ts
|
|
6644
6715
|
init_react_import();
|
|
6645
|
-
import { useMemo as
|
|
6716
|
+
import { useMemo as useMemo16 } from "react";
|
|
6646
6717
|
import { useDroppable as useDroppable3 } from "@dnd-kit/react";
|
|
6647
6718
|
|
|
6648
6719
|
// components/LayerTree/lib/dnd/compute.ts
|
|
@@ -6901,7 +6972,7 @@ var useOutlineDropZone = ({
|
|
|
6901
6972
|
const appStore = useAppStoreApi();
|
|
6902
6973
|
const outlineStore = useOutlineDndStoreApi();
|
|
6903
6974
|
const dndId = `${kind}:${zoneCompound}`;
|
|
6904
|
-
const accept =
|
|
6975
|
+
const accept = useMemo16(
|
|
6905
6976
|
() => createOutlineAccept(
|
|
6906
6977
|
{ appStore, outlineStore },
|
|
6907
6978
|
{
|
|
@@ -6924,7 +6995,7 @@ var useOutlineDropZone = ({
|
|
|
6924
6995
|
return ((_a = s.indicator) == null ? void 0 : _a.targetId) === dndId;
|
|
6925
6996
|
}
|
|
6926
6997
|
);
|
|
6927
|
-
const outlineDropZoneObject =
|
|
6998
|
+
const outlineDropZoneObject = useMemo16(
|
|
6928
6999
|
() => ({ isDropTarget, ref }),
|
|
6929
7000
|
[isDropTarget, ref]
|
|
6930
7001
|
);
|
|
@@ -6940,12 +7011,12 @@ init_react_import();
|
|
|
6940
7011
|
var styles_module_default14 = { "DropLine": "_DropLine_eyz3q_2", "DropLine--top": "_DropLine--top_eyz3q_12", "DropLine--bottom": "_DropLine--bottom_eyz3q_16", "DropLine--outset": "_DropLine--outset_eyz3q_20" };
|
|
6941
7012
|
|
|
6942
7013
|
// components/LayerTree/components/drop-line/index.tsx
|
|
6943
|
-
import { jsx as
|
|
7014
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
6944
7015
|
var getClassName21 = get_class_name_factory_default("DropLine", styles_module_default14);
|
|
6945
7016
|
var DropLine = ({
|
|
6946
7017
|
edge,
|
|
6947
7018
|
outset
|
|
6948
|
-
}) => /* @__PURE__ */
|
|
7019
|
+
}) => /* @__PURE__ */ jsx39(
|
|
6949
7020
|
"div",
|
|
6950
7021
|
{
|
|
6951
7022
|
className: getClassName21({
|
|
@@ -6975,7 +7046,7 @@ init_react_import();
|
|
|
6975
7046
|
var styles_module_default15 = { "LayerTree-helper": "_LayerTree-helper_1m7e4_2", "LayerTree-helperRoot": "_LayerTree-helperRoot_1m7e4_11" };
|
|
6976
7047
|
|
|
6977
7048
|
// components/LayerTree/components/empty-zone-placeholder/index.tsx
|
|
6978
|
-
import { jsx as
|
|
7049
|
+
import { jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6979
7050
|
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default15);
|
|
6980
7051
|
var EmptyZonePlaceholder = ({
|
|
6981
7052
|
zoneCompound
|
|
@@ -6998,7 +7069,7 @@ var EmptyZonePlaceholder = ({
|
|
|
6998
7069
|
ref,
|
|
6999
7070
|
children: [
|
|
7000
7071
|
noItemsMsg,
|
|
7001
|
-
isDropTarget && /* @__PURE__ */
|
|
7072
|
+
isDropTarget && /* @__PURE__ */ jsx40(DropLine, { edge: "top" })
|
|
7002
7073
|
]
|
|
7003
7074
|
}
|
|
7004
7075
|
);
|
|
@@ -7010,7 +7081,7 @@ import { forwardRef as forwardRef2, useCallback as useCallback18, useContext as
|
|
|
7010
7081
|
|
|
7011
7082
|
// components/LayerTree/lib/dnd/use-outline-row-dnd.ts
|
|
7012
7083
|
init_react_import();
|
|
7013
|
-
import { useCallback as useCallback16, useMemo as
|
|
7084
|
+
import { useCallback as useCallback16, useMemo as useMemo17 } from "react";
|
|
7014
7085
|
import { Feedback as Feedback3 } from "@dnd-kit/dom";
|
|
7015
7086
|
import { useSortable as useSortable3 } from "@dnd-kit/react/sortable";
|
|
7016
7087
|
var useOutlineRowDnd = ({
|
|
@@ -7021,14 +7092,14 @@ var useOutlineRowDnd = ({
|
|
|
7021
7092
|
}) => {
|
|
7022
7093
|
const appStore = useAppStoreApi();
|
|
7023
7094
|
const outlineStore = useOutlineDndStoreApi();
|
|
7024
|
-
const accept =
|
|
7095
|
+
const accept = useMemo17(
|
|
7025
7096
|
() => createOutlineAccept(
|
|
7026
7097
|
{ appStore, outlineStore },
|
|
7027
7098
|
{ kind: "row", itemId, zoneCompound }
|
|
7028
7099
|
),
|
|
7029
7100
|
[appStore, outlineStore, itemId, zoneCompound]
|
|
7030
7101
|
);
|
|
7031
|
-
const collisionDetector =
|
|
7102
|
+
const collisionDetector = useMemo17(
|
|
7032
7103
|
() => createDynamicCollisionDetector("y"),
|
|
7033
7104
|
[]
|
|
7034
7105
|
);
|
|
@@ -7087,14 +7158,14 @@ var styles_module_default16 = { "Layer": "_Layer_onfgu_1", "Layer-inner": "_Laye
|
|
|
7087
7158
|
// components/LayerTree/components/layer-actions/index.tsx
|
|
7088
7159
|
init_react_import();
|
|
7089
7160
|
import { useCallback as useCallback17 } from "react";
|
|
7090
|
-
import { useShallow as
|
|
7161
|
+
import { useShallow as useShallow8 } from "zustand/react/shallow";
|
|
7091
7162
|
|
|
7092
7163
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/components/layer-actions/styles.module.css#css-module
|
|
7093
7164
|
init_react_import();
|
|
7094
7165
|
var styles_module_default17 = { "LayerActions": "_LayerActions_d90t9_2", "LayerActions--visible": "_LayerActions--visible_d90t9_18" };
|
|
7095
7166
|
|
|
7096
7167
|
// components/LayerTree/components/layer-actions/index.tsx
|
|
7097
|
-
import { jsx as
|
|
7168
|
+
import { jsx as jsx41, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
7098
7169
|
var getClassName23 = get_class_name_factory_default("LayerActions", styles_module_default17);
|
|
7099
7170
|
var LayerActions = ({
|
|
7100
7171
|
node,
|
|
@@ -7103,7 +7174,7 @@ var LayerActions = ({
|
|
|
7103
7174
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7104
7175
|
const outlineStore = useOutlineDndStoreApi();
|
|
7105
7176
|
const permissions = useAppStore(
|
|
7106
|
-
|
|
7177
|
+
useShallow8((s) => {
|
|
7107
7178
|
const item = getItem(
|
|
7108
7179
|
{ index: node.index, zone: node.zoneCompound },
|
|
7109
7180
|
s.state
|
|
@@ -7149,13 +7220,13 @@ var LayerActions = ({
|
|
|
7149
7220
|
return null;
|
|
7150
7221
|
}
|
|
7151
7222
|
return /* @__PURE__ */ jsxs13("div", { className: getClassName23({ visible }), children: [
|
|
7152
|
-
permissions.duplicate && /* @__PURE__ */
|
|
7153
|
-
permissions.delete && /* @__PURE__ */
|
|
7223
|
+
permissions.duplicate && /* @__PURE__ */ jsx41(IconButton, { onClick: duplicateItem, title: duplicateMsg, type: "button", children: /* @__PURE__ */ jsx41(Copy, {}) }),
|
|
7224
|
+
permissions.delete && /* @__PURE__ */ jsx41(IconButton, { onClick: deleteItem, title: deleteMsg, type: "button", children: /* @__PURE__ */ jsx41(Trash, {}) })
|
|
7154
7225
|
] });
|
|
7155
7226
|
};
|
|
7156
7227
|
|
|
7157
7228
|
// components/LayerTree/components/layer/index.tsx
|
|
7158
|
-
import { jsx as
|
|
7229
|
+
import { jsx as jsx42, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7159
7230
|
var getClassName24 = get_class_name_factory_default("Layer", styles_module_default16);
|
|
7160
7231
|
var Layer = forwardRef2(function Layer2({
|
|
7161
7232
|
dataIndex,
|
|
@@ -7225,7 +7296,7 @@ var Layer = forwardRef2(function Layer2({
|
|
|
7225
7296
|
"data-index": dataIndex,
|
|
7226
7297
|
"data-puck-layer-tree-id": node.itemId,
|
|
7227
7298
|
children: [
|
|
7228
|
-
shouldShowIndicator && /* @__PURE__ */
|
|
7299
|
+
shouldShowIndicator && /* @__PURE__ */ jsx42(
|
|
7229
7300
|
DropLine,
|
|
7230
7301
|
{
|
|
7231
7302
|
edge: indicatorPosition === "before" ? "top" : "bottom",
|
|
@@ -7249,7 +7320,7 @@ var Layer = forwardRef2(function Layer2({
|
|
|
7249
7320
|
zoneStore.setState({ hoveringComponent: null });
|
|
7250
7321
|
},
|
|
7251
7322
|
children: [
|
|
7252
|
-
/* @__PURE__ */
|
|
7323
|
+
/* @__PURE__ */ jsx42("div", { className: getClassName24("caret"), children: /* @__PURE__ */ jsx42(
|
|
7253
7324
|
IconButton,
|
|
7254
7325
|
{
|
|
7255
7326
|
onClick: (e) => {
|
|
@@ -7276,11 +7347,11 @@ var Layer = forwardRef2(function Layer2({
|
|
|
7276
7347
|
},
|
|
7277
7348
|
title: isExpanded ? collapseMsg : expandMsg,
|
|
7278
7349
|
type: "button",
|
|
7279
|
-
children: /* @__PURE__ */
|
|
7350
|
+
children: /* @__PURE__ */ jsx42(ChevronRight, {})
|
|
7280
7351
|
}
|
|
7281
7352
|
) }),
|
|
7282
7353
|
/* @__PURE__ */ jsxs14("div", { className: getClassName24("content"), children: [
|
|
7283
|
-
/* @__PURE__ */
|
|
7354
|
+
/* @__PURE__ */ jsx42(
|
|
7284
7355
|
"button",
|
|
7285
7356
|
{
|
|
7286
7357
|
type: "button",
|
|
@@ -7296,20 +7367,20 @@ var Layer = forwardRef2(function Layer2({
|
|
|
7296
7367
|
zoneStore.getState().scrollToComponent(node.itemId);
|
|
7297
7368
|
},
|
|
7298
7369
|
children: /* @__PURE__ */ jsxs14("div", { className: getClassName24("title"), children: [
|
|
7299
|
-
/* @__PURE__ */
|
|
7370
|
+
/* @__PURE__ */ jsx42("div", { className: getClassName24("icon"), children: node.componentType === "Text" || node.componentType === "Heading" ? (
|
|
7300
7371
|
// Sized in CSS via --puck-outline-icon-size
|
|
7301
|
-
/* @__PURE__ */
|
|
7302
|
-
) : /* @__PURE__ */
|
|
7303
|
-
/* @__PURE__ */
|
|
7372
|
+
/* @__PURE__ */ jsx42(Type, {})
|
|
7373
|
+
) : /* @__PURE__ */ jsx42(LayoutGrid, {}) }),
|
|
7374
|
+
/* @__PURE__ */ jsx42("div", { className: getClassName24("name"), children: node.label })
|
|
7304
7375
|
] })
|
|
7305
7376
|
}
|
|
7306
7377
|
),
|
|
7307
|
-
/* @__PURE__ */
|
|
7378
|
+
/* @__PURE__ */ jsx42(LayerActions, { node, visible: isHovering && !isDragSource })
|
|
7308
7379
|
] })
|
|
7309
7380
|
]
|
|
7310
7381
|
}
|
|
7311
7382
|
),
|
|
7312
|
-
containsZone && shouldBeExpanded && node.childZones.map((childZone) => /* @__PURE__ */
|
|
7383
|
+
containsZone && shouldBeExpanded && node.childZones.map((childZone) => /* @__PURE__ */ jsx42("div", { className: getClassName24("zones"), children: /* @__PURE__ */ jsx42(
|
|
7313
7384
|
LayerTreeZone,
|
|
7314
7385
|
{
|
|
7315
7386
|
depth: shouldShowZoneTitles ? depth + 1 : depth,
|
|
@@ -7327,7 +7398,7 @@ init_react_import();
|
|
|
7327
7398
|
var styles_module_default18 = { "LayerTree": "_LayerTree_o5tyt_1", "LayerTree--nested": "_LayerTree--nested_o5tyt_12" };
|
|
7328
7399
|
|
|
7329
7400
|
// components/LayerTree/components/layer-tree-items/static-layer-tree-items.tsx
|
|
7330
|
-
import { jsx as
|
|
7401
|
+
import { jsx as jsx43, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7331
7402
|
var getClassName25 = get_class_name_factory_default("LayerTree", styles_module_default18);
|
|
7332
7403
|
var StaticLayerTreeItems = ({
|
|
7333
7404
|
depth,
|
|
@@ -7335,8 +7406,8 @@ var StaticLayerTreeItems = ({
|
|
|
7335
7406
|
tree
|
|
7336
7407
|
}) => {
|
|
7337
7408
|
return /* @__PURE__ */ jsxs15("ul", { className: getClassName25({ nested: depth > 0 }), children: [
|
|
7338
|
-
tree.items.length === 0 && /* @__PURE__ */
|
|
7339
|
-
tree.items.map((node) => /* @__PURE__ */
|
|
7409
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx43(EmptyZonePlaceholder, { zoneCompound: tree.zoneCompound }),
|
|
7410
|
+
tree.items.map((node) => /* @__PURE__ */ jsx43(
|
|
7340
7411
|
Layer,
|
|
7341
7412
|
{
|
|
7342
7413
|
depth,
|
|
@@ -7353,7 +7424,7 @@ var StaticLayerTreeItems = ({
|
|
|
7353
7424
|
init_react_import();
|
|
7354
7425
|
import { defaultRangeExtractor as defaultRangeExtractor2, useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
7355
7426
|
import { useCallback as useCallback19, useRef as useRef11 } from "react";
|
|
7356
|
-
import { jsx as
|
|
7427
|
+
import { jsx as jsx44, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7357
7428
|
var getClassName26 = get_class_name_factory_default("LayerTree", styles_module_default18);
|
|
7358
7429
|
var DEFAULT_LAYER_ROW_HEIGHT = 32;
|
|
7359
7430
|
var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
|
|
@@ -7429,7 +7500,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7429
7500
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
7430
7501
|
if (gapSize > 0) {
|
|
7431
7502
|
renderedItems.push(
|
|
7432
|
-
/* @__PURE__ */
|
|
7503
|
+
/* @__PURE__ */ jsx44(
|
|
7433
7504
|
"li",
|
|
7434
7505
|
{
|
|
7435
7506
|
"aria-hidden": "true",
|
|
@@ -7440,7 +7511,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7440
7511
|
);
|
|
7441
7512
|
}
|
|
7442
7513
|
renderedItems.push(
|
|
7443
|
-
/* @__PURE__ */
|
|
7514
|
+
/* @__PURE__ */ jsx44(
|
|
7444
7515
|
Layer,
|
|
7445
7516
|
{
|
|
7446
7517
|
dataIndex: virtualItem.index,
|
|
@@ -7459,7 +7530,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7459
7530
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
7460
7531
|
if (trailingGap > 0) {
|
|
7461
7532
|
renderedItems.push(
|
|
7462
|
-
/* @__PURE__ */
|
|
7533
|
+
/* @__PURE__ */ jsx44(
|
|
7463
7534
|
"li",
|
|
7464
7535
|
{
|
|
7465
7536
|
"aria-hidden": "true",
|
|
@@ -7470,7 +7541,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7470
7541
|
);
|
|
7471
7542
|
}
|
|
7472
7543
|
return /* @__PURE__ */ jsxs16("ul", { className: getClassName26({ nested: depth > 0 }), ref: listRef, children: [
|
|
7473
|
-
tree.items.length === 0 && /* @__PURE__ */
|
|
7544
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx44(EmptyZonePlaceholder, { zoneCompound: tree.zoneCompound }),
|
|
7474
7545
|
renderedItems
|
|
7475
7546
|
] });
|
|
7476
7547
|
};
|
|
@@ -7480,7 +7551,7 @@ init_react_import();
|
|
|
7480
7551
|
var styles_module_default19 = { "LayerTree-zoneTitle": "_LayerTree-zoneTitle_fvhlh_2", "LayerTree-zoneIcon": "_LayerTree-zoneIcon_fvhlh_19" };
|
|
7481
7552
|
|
|
7482
7553
|
// components/LayerTree/components/layer-tree-zone/index.tsx
|
|
7483
|
-
import { Fragment as Fragment10, jsx as
|
|
7554
|
+
import { Fragment as Fragment10, jsx as jsx45, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7484
7555
|
var getClassName27 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
|
7485
7556
|
var MIN_VIRTUALIZED_LAYER_COUNT = 25;
|
|
7486
7557
|
var ZoneLabel = ({
|
|
@@ -7498,9 +7569,9 @@ var ZoneLabel = ({
|
|
|
7498
7569
|
"data-puck-drop-target": isDropTarget || void 0,
|
|
7499
7570
|
ref,
|
|
7500
7571
|
children: [
|
|
7501
|
-
/* @__PURE__ */
|
|
7572
|
+
/* @__PURE__ */ jsx45("div", { className: getClassName27("zoneIcon"), children: /* @__PURE__ */ jsx45(Layers, {}) }),
|
|
7502
7573
|
label,
|
|
7503
|
-
isDropTarget && /* @__PURE__ */
|
|
7574
|
+
isDropTarget && /* @__PURE__ */ jsx45(DropLine, { edge: "bottom" })
|
|
7504
7575
|
]
|
|
7505
7576
|
}
|
|
7506
7577
|
);
|
|
@@ -7512,15 +7583,15 @@ var LayerTreeZone = ({
|
|
|
7512
7583
|
}) => {
|
|
7513
7584
|
const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
|
|
7514
7585
|
return /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
7515
|
-
tree.label && /* @__PURE__ */
|
|
7516
|
-
shouldVirtualize ? /* @__PURE__ */
|
|
7586
|
+
tree.label && /* @__PURE__ */ jsx45(ZoneLabel, { label: tree.label, zoneCompound: tree.zoneCompound }),
|
|
7587
|
+
shouldVirtualize ? /* @__PURE__ */ jsx45(
|
|
7517
7588
|
VirtualizedLayerTreeItems,
|
|
7518
7589
|
{
|
|
7519
7590
|
depth,
|
|
7520
7591
|
selectedId,
|
|
7521
7592
|
tree
|
|
7522
7593
|
}
|
|
7523
|
-
) : /* @__PURE__ */
|
|
7594
|
+
) : /* @__PURE__ */ jsx45(
|
|
7524
7595
|
StaticLayerTreeItems,
|
|
7525
7596
|
{
|
|
7526
7597
|
depth,
|
|
@@ -7535,7 +7606,7 @@ var LayerTreeZone = ({
|
|
|
7535
7606
|
init_react_import();
|
|
7536
7607
|
import { PointerActivationConstraints as PointerActivationConstraints3 } from "@dnd-kit/dom";
|
|
7537
7608
|
import { DragDropProvider as DragDropProvider3 } from "@dnd-kit/react";
|
|
7538
|
-
import { useContext as useContext15, useMemo as
|
|
7609
|
+
import { useContext as useContext15, useMemo as useMemo18, useState as useState19 } from "react";
|
|
7539
7610
|
|
|
7540
7611
|
// components/LayerTree/lib/dnd/handlers.ts
|
|
7541
7612
|
init_react_import();
|
|
@@ -7709,7 +7780,7 @@ var onOutlineDragEnd = (event, ctx) => {
|
|
|
7709
7780
|
};
|
|
7710
7781
|
|
|
7711
7782
|
// components/LayerTree/components/outline-dnd-provider/index.tsx
|
|
7712
|
-
import { jsx as
|
|
7783
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
7713
7784
|
var NO_SENSORS = [];
|
|
7714
7785
|
var OutlineDndProvider = ({ children }) => {
|
|
7715
7786
|
const appStore = useAppStoreApi();
|
|
@@ -7724,7 +7795,7 @@ var OutlineDndProvider = ({ children }) => {
|
|
|
7724
7795
|
const sensors = useSensors({
|
|
7725
7796
|
mouse: [new PointerActivationConstraints3.Distance({ value: 5 })]
|
|
7726
7797
|
});
|
|
7727
|
-
const dragContext =
|
|
7798
|
+
const dragContext = useMemo18(
|
|
7728
7799
|
() => ({
|
|
7729
7800
|
outlineDndStore,
|
|
7730
7801
|
appStore,
|
|
@@ -7732,7 +7803,7 @@ var OutlineDndProvider = ({ children }) => {
|
|
|
7732
7803
|
}),
|
|
7733
7804
|
[outlineDndStore, appStore, zoneStore]
|
|
7734
7805
|
);
|
|
7735
|
-
return /* @__PURE__ */
|
|
7806
|
+
return /* @__PURE__ */ jsx46(OutlineDndStoreContext.Provider, { value: outlineDndStore, children: /* @__PURE__ */ jsx46(
|
|
7736
7807
|
DragDropProvider3,
|
|
7737
7808
|
{
|
|
7738
7809
|
sensors: disableOutlineDrag ? NO_SENSORS : sensors,
|
|
@@ -7842,7 +7913,7 @@ var buildLayerTree = ({
|
|
|
7842
7913
|
};
|
|
7843
7914
|
|
|
7844
7915
|
// components/LayerTree/index.tsx
|
|
7845
|
-
import { jsx as
|
|
7916
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7846
7917
|
var getClassNameDragRoot = get_class_name_factory_default("LayerTreeRoot", styles_module_default20);
|
|
7847
7918
|
var LayerTree = ({
|
|
7848
7919
|
selectedId,
|
|
@@ -7854,12 +7925,12 @@ var LayerTree = ({
|
|
|
7854
7925
|
return (_b = (_a = s.dnd) == null ? void 0 : _a.disableOutlineDrag) != null ? _b : false;
|
|
7855
7926
|
}
|
|
7856
7927
|
);
|
|
7857
|
-
return /* @__PURE__ */
|
|
7928
|
+
return /* @__PURE__ */ jsx47(OutlineDndProvider, { children: /* @__PURE__ */ jsx47(
|
|
7858
7929
|
"div",
|
|
7859
7930
|
{
|
|
7860
7931
|
className: getClassNameDragRoot(),
|
|
7861
7932
|
"data-puck-dnd-disabled": disableOutlineDrag || void 0,
|
|
7862
|
-
children: trees.map((tree) => /* @__PURE__ */
|
|
7933
|
+
children: trees.map((tree) => /* @__PURE__ */ jsx47(
|
|
7863
7934
|
LayerTreeZone,
|
|
7864
7935
|
{
|
|
7865
7936
|
depth: 0,
|
|
@@ -7880,7 +7951,7 @@ init_react_import();
|
|
|
7880
7951
|
var styles_module_default21 = { "CollapseAll": "_CollapseAll_1r4cy_1", "CollapseAll-icon": "_CollapseAll-icon_1r4cy_5", "CollapseAll--visible": "_CollapseAll--visible_1r4cy_10" };
|
|
7881
7952
|
|
|
7882
7953
|
// components/Puck/components/Outline/components/collapse-all/index.tsx
|
|
7883
|
-
import { jsx as
|
|
7954
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
7884
7955
|
var getClassName28 = get_class_name_factory_default("CollapseAll", styles_module_default21);
|
|
7885
7956
|
function CollapseAll({ className }) {
|
|
7886
7957
|
const hasExpandedItems = useAppStore(
|
|
@@ -7894,14 +7965,14 @@ function CollapseAll({ className }) {
|
|
|
7894
7965
|
const collapseAll = () => {
|
|
7895
7966
|
dispatch({ type: "setUi", ui: { itemExpanded: {} } });
|
|
7896
7967
|
};
|
|
7897
|
-
return /* @__PURE__ */
|
|
7968
|
+
return /* @__PURE__ */ jsx48(
|
|
7898
7969
|
"div",
|
|
7899
7970
|
{
|
|
7900
7971
|
className: merge_class_names_default(
|
|
7901
7972
|
getClassName28({ visible: hasExpandedItems }),
|
|
7902
7973
|
className
|
|
7903
7974
|
),
|
|
7904
|
-
children: /* @__PURE__ */
|
|
7975
|
+
children: /* @__PURE__ */ jsx48(IconButton, { title: collapseAllMsg, onClick: collapseAll, children: /* @__PURE__ */ jsx48(ChevronsDownUp, { className: getClassName28("icon") }) })
|
|
7905
7976
|
}
|
|
7906
7977
|
);
|
|
7907
7978
|
}
|
|
@@ -7915,7 +7986,7 @@ init_react_import();
|
|
|
7915
7986
|
var styles_module_default22 = { "OutlineHeader": "_OutlineHeader_ntv8r_1" };
|
|
7916
7987
|
|
|
7917
7988
|
// components/Puck/components/Outline/components/outline-header/index.tsx
|
|
7918
|
-
import { jsx as
|
|
7989
|
+
import { jsx as jsx49, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7919
7990
|
var getClassName29 = get_class_name_factory_default("OutlineHeader", styles_module_default22);
|
|
7920
7991
|
var OutlineHeader = ({
|
|
7921
7992
|
children,
|
|
@@ -7923,7 +7994,7 @@ var OutlineHeader = ({
|
|
|
7923
7994
|
}) => {
|
|
7924
7995
|
const outlineHeaderMsg = useMessage("outline-header-title");
|
|
7925
7996
|
return /* @__PURE__ */ jsxs18("div", { className: getClassName29(), children: [
|
|
7926
|
-
/* @__PURE__ */
|
|
7997
|
+
/* @__PURE__ */ jsx49(Heading, { rank: "2", size: "xs", children: outlineHeaderMsg != null ? outlineHeaderMsg : title }),
|
|
7927
7998
|
children
|
|
7928
7999
|
] });
|
|
7929
8000
|
};
|
|
@@ -7934,9 +8005,9 @@ init_react_import();
|
|
|
7934
8005
|
var styles_module_default23 = { "OutlineWrapper": "_OutlineWrapper_b9ln0_1", "OutlineWrapper-collapseAll": "_OutlineWrapper-collapseAll_b9ln0_9", "OutlineWrapper-layers": "_OutlineWrapper-layers_b9ln0_15" };
|
|
7935
8006
|
|
|
7936
8007
|
// components/Puck/components/Outline/index.tsx
|
|
7937
|
-
import { jsx as
|
|
8008
|
+
import { jsx as jsx50, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7938
8009
|
var getClassName30 = get_class_name_factory_default("OutlineWrapper", styles_module_default23);
|
|
7939
|
-
var DefaultWrapper = ({ children }) => /* @__PURE__ */
|
|
8010
|
+
var DefaultWrapper = ({ children }) => /* @__PURE__ */ jsx50("div", { className: getClassName30(), children });
|
|
7940
8011
|
var Outline = () => {
|
|
7941
8012
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
7942
8013
|
const config = useAppStore((s) => s.config);
|
|
@@ -7948,9 +8019,9 @@ var Outline = () => {
|
|
|
7948
8019
|
});
|
|
7949
8020
|
const componentFallbackLabel = useMessage("label-component");
|
|
7950
8021
|
const rootZones = useAppStore(
|
|
7951
|
-
|
|
8022
|
+
useShallow9((s) => findZonesForArea(s.state, "root"))
|
|
7952
8023
|
);
|
|
7953
|
-
const trees =
|
|
8024
|
+
const trees = useMemo19(
|
|
7954
8025
|
() => rootZones.map(
|
|
7955
8026
|
(zoneCompound) => buildLayerTree({
|
|
7956
8027
|
config,
|
|
@@ -7963,13 +8034,13 @@ var Outline = () => {
|
|
|
7963
8034
|
),
|
|
7964
8035
|
[config, nodes, rootZones, zones, componentFallbackLabel]
|
|
7965
8036
|
);
|
|
7966
|
-
const Wrapper =
|
|
8037
|
+
const Wrapper = useMemo19(
|
|
7967
8038
|
() => outlineOverride || DefaultWrapper,
|
|
7968
8039
|
[outlineOverride]
|
|
7969
8040
|
);
|
|
7970
8041
|
return /* @__PURE__ */ jsxs19(Wrapper, { children: [
|
|
7971
|
-
/* @__PURE__ */
|
|
7972
|
-
/* @__PURE__ */
|
|
8042
|
+
/* @__PURE__ */ jsx50(outline_header_default, { children: /* @__PURE__ */ jsx50(collapse_all_default, { className: getClassName30("collapseAll") }) }),
|
|
8043
|
+
/* @__PURE__ */ jsx50("div", { className: getClassName30("layers"), children: /* @__PURE__ */ jsx50(LayerTree, { selectedId, trees }) })
|
|
7973
8044
|
] });
|
|
7974
8045
|
};
|
|
7975
8046
|
|
|
@@ -7978,15 +8049,15 @@ init_react_import();
|
|
|
7978
8049
|
var styles_module_default24 = { "OutlinePlugin": "_OutlinePlugin_1ylsc_1" };
|
|
7979
8050
|
|
|
7980
8051
|
// plugins/outline/index.tsx
|
|
7981
|
-
import { jsx as
|
|
8052
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
7982
8053
|
var getClassName31 = get_class_name_factory_default("OutlinePlugin", styles_module_default24);
|
|
7983
8054
|
var outlinePlugin = (props = {}) => {
|
|
7984
8055
|
var _a, _b;
|
|
7985
8056
|
return {
|
|
7986
8057
|
name: "outline",
|
|
7987
8058
|
label: (_a = props.label) != null ? _a : "Outline",
|
|
7988
|
-
render: () => /* @__PURE__ */
|
|
7989
|
-
icon: (_b = props.icon) != null ? _b : /* @__PURE__ */
|
|
8059
|
+
render: () => /* @__PURE__ */ jsx51("div", { className: getClassName31(), children: /* @__PURE__ */ jsx51(Outline, {}) }),
|
|
8060
|
+
icon: (_b = props.icon) != null ? _b : /* @__PURE__ */ jsx51(Layers, {})
|
|
7990
8061
|
};
|
|
7991
8062
|
};
|
|
7992
8063
|
|
|
@@ -8002,7 +8073,7 @@ var styles_module_default25 = { "Breadcrumbs": "_Breadcrumbs_8c6w5_1", "Breadcru
|
|
|
8002
8073
|
|
|
8003
8074
|
// lib/use-breadcrumbs.ts
|
|
8004
8075
|
init_react_import();
|
|
8005
|
-
import { useMemo as
|
|
8076
|
+
import { useMemo as useMemo20 } from "react";
|
|
8006
8077
|
var useBreadcrumbs = (renderCount) => {
|
|
8007
8078
|
const selectedId = useAppStore((s) => {
|
|
8008
8079
|
var _a;
|
|
@@ -8016,7 +8087,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
8016
8087
|
const appStore = useAppStoreApi();
|
|
8017
8088
|
const pageLabel = useMessage("label-page");
|
|
8018
8089
|
const componentLabel = useMessage("label-component");
|
|
8019
|
-
return
|
|
8090
|
+
return useMemo20(() => {
|
|
8020
8091
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
8021
8092
|
var _a, _b, _c, _d;
|
|
8022
8093
|
const [componentId] = zoneCompound.split(":");
|
|
@@ -8047,7 +8118,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
8047
8118
|
};
|
|
8048
8119
|
|
|
8049
8120
|
// components/Breadcrumbs/index.tsx
|
|
8050
|
-
import { jsx as
|
|
8121
|
+
import { jsx as jsx52, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
8051
8122
|
var getClassName32 = get_class_name_factory_default("Breadcrumbs", styles_module_default25);
|
|
8052
8123
|
var Breadcrumbs = ({
|
|
8053
8124
|
children,
|
|
@@ -8057,7 +8128,7 @@ var Breadcrumbs = ({
|
|
|
8057
8128
|
const breadcrumbs = useBreadcrumbs(numParents);
|
|
8058
8129
|
return /* @__PURE__ */ jsxs20("div", { className: getClassName32(), children: [
|
|
8059
8130
|
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs20("div", { className: getClassName32("breadcrumb"), children: [
|
|
8060
|
-
/* @__PURE__ */
|
|
8131
|
+
/* @__PURE__ */ jsx52(
|
|
8061
8132
|
"button",
|
|
8062
8133
|
{
|
|
8063
8134
|
type: "button",
|
|
@@ -8066,7 +8137,7 @@ var Breadcrumbs = ({
|
|
|
8066
8137
|
children: breadcrumb.label
|
|
8067
8138
|
}
|
|
8068
8139
|
),
|
|
8069
|
-
/* @__PURE__ */
|
|
8140
|
+
/* @__PURE__ */ jsx52(ChevronRight, { size: 16 })
|
|
8070
8141
|
] }, i)),
|
|
8071
8142
|
children
|
|
8072
8143
|
] });
|
|
@@ -8085,15 +8156,15 @@ import {
|
|
|
8085
8156
|
useCallback as useCallback20,
|
|
8086
8157
|
useContext as useContext16,
|
|
8087
8158
|
useEffect as useEffect21,
|
|
8088
|
-
useMemo as
|
|
8159
|
+
useMemo as useMemo21
|
|
8089
8160
|
} from "react";
|
|
8090
|
-
import { useShallow as
|
|
8091
|
-
import { Fragment as Fragment11, jsx as
|
|
8161
|
+
import { useShallow as useShallow10 } from "zustand/react/shallow";
|
|
8162
|
+
import { Fragment as Fragment11, jsx as jsx53, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
8092
8163
|
var getClassName33 = get_class_name_factory_default("PuckFields", styles_module_default26);
|
|
8093
8164
|
var DefaultFields = ({
|
|
8094
8165
|
children
|
|
8095
8166
|
}) => {
|
|
8096
|
-
return /* @__PURE__ */
|
|
8167
|
+
return /* @__PURE__ */ jsx53(Fragment11, { children });
|
|
8097
8168
|
};
|
|
8098
8169
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
8099
8170
|
const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
|
|
@@ -8148,7 +8219,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
8148
8219
|
return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
|
|
8149
8220
|
});
|
|
8150
8221
|
const permissions = useAppStore(
|
|
8151
|
-
|
|
8222
|
+
useShallow10((s) => {
|
|
8152
8223
|
const { selectedItem, permissions: permissions2 } = s;
|
|
8153
8224
|
return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
|
|
8154
8225
|
})
|
|
@@ -8173,7 +8244,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
8173
8244
|
}, [appStore, fieldStore]);
|
|
8174
8245
|
if (!field || !id || !visible) return null;
|
|
8175
8246
|
if (field.type === "slot") return null;
|
|
8176
|
-
return /* @__PURE__ */
|
|
8247
|
+
return /* @__PURE__ */ jsx53("div", { className: getClassName33("field"), children: /* @__PURE__ */ jsx53(
|
|
8177
8248
|
AutoFieldPrivate,
|
|
8178
8249
|
{
|
|
8179
8250
|
field,
|
|
@@ -8186,12 +8257,12 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
8186
8257
|
};
|
|
8187
8258
|
var FieldsChild = ({ fieldName }) => {
|
|
8188
8259
|
const appStore = useAppStoreApi();
|
|
8189
|
-
const initialValue =
|
|
8260
|
+
const initialValue = useMemo21(() => {
|
|
8190
8261
|
var _a;
|
|
8191
8262
|
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
8192
8263
|
return { [fieldName]: value };
|
|
8193
8264
|
}, []);
|
|
8194
|
-
return /* @__PURE__ */
|
|
8265
|
+
return /* @__PURE__ */ jsx53(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ jsx53(FieldsChildInner, { fieldName }) });
|
|
8195
8266
|
};
|
|
8196
8267
|
var FieldsChildMemo = memo8(FieldsChild);
|
|
8197
8268
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
@@ -8201,7 +8272,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
8201
8272
|
const loadingCount = s.selectedItem ? (_a = s.componentState[s.selectedItem.props.id]) == null ? void 0 : _a.loadingCount : (_b = s.componentState["root"]) == null ? void 0 : _b.loadingCount;
|
|
8202
8273
|
return (loadingCount != null ? loadingCount : 0) > 0;
|
|
8203
8274
|
});
|
|
8204
|
-
const itemSelector = useAppStore(
|
|
8275
|
+
const itemSelector = useAppStore(useShallow10((s) => s.state.ui.itemSelector));
|
|
8205
8276
|
const id = useAppStore((s) => {
|
|
8206
8277
|
var _a;
|
|
8207
8278
|
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
@@ -8210,7 +8281,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
8210
8281
|
useRegisterFieldsSlice(appStore, id);
|
|
8211
8282
|
const fieldsLoading = useAppStore((s) => s.fields.loading);
|
|
8212
8283
|
const fieldNames = useAppStore(
|
|
8213
|
-
|
|
8284
|
+
useShallow10((s) => {
|
|
8214
8285
|
if (s.fields.id === id) {
|
|
8215
8286
|
return Object.keys(s.fields.fields);
|
|
8216
8287
|
}
|
|
@@ -8218,7 +8289,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
8218
8289
|
})
|
|
8219
8290
|
);
|
|
8220
8291
|
const isLoading = fieldsLoading || componentResolving;
|
|
8221
|
-
const Wrapper =
|
|
8292
|
+
const Wrapper = useMemo21(() => overrides.fields || DefaultFields, [overrides]);
|
|
8222
8293
|
return /* @__PURE__ */ jsxs21(
|
|
8223
8294
|
"form",
|
|
8224
8295
|
{
|
|
@@ -8227,8 +8298,8 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
8227
8298
|
e.preventDefault();
|
|
8228
8299
|
},
|
|
8229
8300
|
children: [
|
|
8230
|
-
/* @__PURE__ */
|
|
8231
|
-
isLoading && /* @__PURE__ */
|
|
8301
|
+
/* @__PURE__ */ jsx53(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx53(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
8302
|
+
isLoading && /* @__PURE__ */ jsx53("div", { className: getClassName33("loadingOverlay"), children: /* @__PURE__ */ jsx53("div", { className: getClassName33("loadingOverlayInner"), children: /* @__PURE__ */ jsx53(Loader, { size: 16 }) }) })
|
|
8232
8303
|
]
|
|
8233
8304
|
}
|
|
8234
8305
|
);
|
|
@@ -8240,7 +8311,7 @@ init_react_import();
|
|
|
8240
8311
|
var styles_module_default27 = { "FieldsPlugin": "_FieldsPlugin_18cj3_1", "FieldsPlugin-header": "_FieldsPlugin-header_18cj3_7" };
|
|
8241
8312
|
|
|
8242
8313
|
// plugins/fields/index.tsx
|
|
8243
|
-
import { jsx as
|
|
8314
|
+
import { jsx as jsx54, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8244
8315
|
var getClassName34 = get_class_name_factory_default("FieldsPlugin", styles_module_default27);
|
|
8245
8316
|
var CurrentTitle = () => {
|
|
8246
8317
|
const pageLabel = useMessage("label-page");
|
|
@@ -8255,10 +8326,10 @@ var fieldsPlugin = ({ desktopSideBar = "right", label, icon } = {}) => ({
|
|
|
8255
8326
|
name: "fields",
|
|
8256
8327
|
label: label != null ? label : "Fields",
|
|
8257
8328
|
render: () => /* @__PURE__ */ jsxs22("div", { className: getClassName34(), children: [
|
|
8258
|
-
/* @__PURE__ */
|
|
8259
|
-
/* @__PURE__ */
|
|
8329
|
+
/* @__PURE__ */ jsx54("div", { className: getClassName34("header"), children: /* @__PURE__ */ jsx54(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx54(CurrentTitle, {}) }) }),
|
|
8330
|
+
/* @__PURE__ */ jsx54(Fields, {})
|
|
8260
8331
|
] }),
|
|
8261
|
-
icon: icon != null ? icon : /* @__PURE__ */
|
|
8332
|
+
icon: icon != null ? icon : /* @__PURE__ */ jsx54(RectangleEllipsis, {}),
|
|
8262
8333
|
mobileOnly: desktopSideBar === "right"
|
|
8263
8334
|
});
|
|
8264
8335
|
|
|
@@ -8269,14 +8340,14 @@ import {
|
|
|
8269
8340
|
useCallback as useCallback27,
|
|
8270
8341
|
useContext as useContext19,
|
|
8271
8342
|
useEffect as useEffect30,
|
|
8272
|
-
useMemo as
|
|
8343
|
+
useMemo as useMemo30,
|
|
8273
8344
|
useRef as useRef17,
|
|
8274
8345
|
useState as useState26
|
|
8275
8346
|
} from "react";
|
|
8276
8347
|
|
|
8277
8348
|
// components/Puck/components/Preview/index.tsx
|
|
8278
8349
|
init_react_import();
|
|
8279
|
-
import { useEffect as useEffect24, useRef as useRef12, useMemo as
|
|
8350
|
+
import { useEffect as useEffect24, useRef as useRef12, useMemo as useMemo23 } from "react";
|
|
8280
8351
|
|
|
8281
8352
|
// components/AutoFrame/index.tsx
|
|
8282
8353
|
init_react_import();
|
|
@@ -11402,7 +11473,7 @@ var useInjectIframeCss = (targetDocument) => {
|
|
|
11402
11473
|
};
|
|
11403
11474
|
|
|
11404
11475
|
// components/AutoFrame/index.tsx
|
|
11405
|
-
import { Fragment as Fragment12, jsx as
|
|
11476
|
+
import { Fragment as Fragment12, jsx as jsx55 } from "react/jsx-runtime";
|
|
11406
11477
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
11407
11478
|
var mirroredStyleAttribute = "data-puck-style-mirror";
|
|
11408
11479
|
var shouldMirrorStyleElement = (style) => {
|
|
@@ -11652,7 +11723,7 @@ var CopyHostStyles = ({
|
|
|
11652
11723
|
removeAllMirrors();
|
|
11653
11724
|
};
|
|
11654
11725
|
}, [syncHostStyles]);
|
|
11655
|
-
return /* @__PURE__ */
|
|
11726
|
+
return /* @__PURE__ */ jsx55(Fragment12, { children });
|
|
11656
11727
|
};
|
|
11657
11728
|
var autoFrameContext = createContext7({});
|
|
11658
11729
|
var useFrame = () => useContext17(autoFrameContext);
|
|
@@ -11706,7 +11777,7 @@ function AutoFrame(_a) {
|
|
|
11706
11777
|
}
|
|
11707
11778
|
}
|
|
11708
11779
|
}, [frameRef, loaded, stylesLoaded]);
|
|
11709
|
-
return /* @__PURE__ */
|
|
11780
|
+
return /* @__PURE__ */ jsx55(
|
|
11710
11781
|
"iframe",
|
|
11711
11782
|
__spreadProps(__spreadValues({}, props), {
|
|
11712
11783
|
className,
|
|
@@ -11716,7 +11787,7 @@ function AutoFrame(_a) {
|
|
|
11716
11787
|
onLoad: () => {
|
|
11717
11788
|
setLoaded(true);
|
|
11718
11789
|
},
|
|
11719
|
-
children: /* @__PURE__ */
|
|
11790
|
+
children: /* @__PURE__ */ jsx55(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx55(
|
|
11720
11791
|
CopyHostStyles,
|
|
11721
11792
|
{
|
|
11722
11793
|
debug,
|
|
@@ -11731,36 +11802,52 @@ function AutoFrame(_a) {
|
|
|
11731
11802
|
AutoFrame.displayName = "AutoFrame";
|
|
11732
11803
|
var AutoFrame_default = AutoFrame;
|
|
11733
11804
|
|
|
11734
|
-
// components/Puck/components/Preview/components/
|
|
11805
|
+
// components/Puck/components/Preview/components/interactive-page.tsx
|
|
11735
11806
|
init_react_import();
|
|
11736
|
-
import {
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11807
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
11808
|
+
var InteractivePage = () => {
|
|
11809
|
+
const config = useAppStore((s) => s.config);
|
|
11810
|
+
const metadata = useAppStore((s) => s.metadata);
|
|
11811
|
+
const renderData = useAppStore((s) => s.state.data);
|
|
11812
|
+
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
11813
|
+
const fieldTransforms = userFieldTransforms;
|
|
11814
|
+
return /* @__PURE__ */ jsx56(
|
|
11815
|
+
Render,
|
|
11816
|
+
{
|
|
11817
|
+
data: renderData,
|
|
11818
|
+
config,
|
|
11819
|
+
metadata,
|
|
11820
|
+
fieldTransforms
|
|
11821
|
+
}
|
|
11822
|
+
);
|
|
11823
|
+
};
|
|
11824
|
+
var interactive_page_default = InteractivePage;
|
|
11825
|
+
|
|
11826
|
+
// components/Puck/components/Preview/components/edit-page.tsx
|
|
11827
|
+
init_react_import();
|
|
11828
|
+
import { useMemo as useMemo22 } from "react";
|
|
11829
|
+
import { useShallow as useShallow11 } from "zustand/react/shallow";
|
|
11830
|
+
import { Fragment as Fragment13, jsx as jsx57 } from "react/jsx-runtime";
|
|
11831
|
+
var EditPage = () => {
|
|
11832
|
+
var _a, _b;
|
|
11742
11833
|
const flatRootProps = useAppStore(
|
|
11743
|
-
|
|
11834
|
+
useShallow11((s) => {
|
|
11744
11835
|
var _a2;
|
|
11745
11836
|
return (_a2 = s.state.indexes.nodes.root) == null ? void 0 : _a2.flatData.props;
|
|
11746
11837
|
})
|
|
11747
11838
|
);
|
|
11748
11839
|
const config = useAppStore((s) => s.config);
|
|
11749
11840
|
const metadata = useAppStore((s) => s.metadata);
|
|
11750
|
-
const rootAsComponent =
|
|
11841
|
+
const rootAsComponent = useMemo22(() => {
|
|
11751
11842
|
const rootAsComponent2 = toComponent({
|
|
11752
11843
|
props: flatRootProps != null ? flatRootProps : {}
|
|
11753
11844
|
});
|
|
11754
11845
|
return expandNode(rootAsComponent2);
|
|
11755
11846
|
}, [flatRootProps]);
|
|
11756
|
-
const propsWithSlots =
|
|
11757
|
-
|
|
11758
|
-
rootAsComponent,
|
|
11759
|
-
slotFieldTransforms
|
|
11760
|
-
);
|
|
11761
|
-
const renderProps = useMemo21(() => {
|
|
11847
|
+
const propsWithSlots = use_editor_props_default({ component: rootAsComponent });
|
|
11848
|
+
const renderProps = useMemo22(() => {
|
|
11762
11849
|
return __spreadProps(__spreadValues({}, propsWithSlots), {
|
|
11763
|
-
children: /* @__PURE__ */
|
|
11850
|
+
children: /* @__PURE__ */ jsx57(DropZonePure, { zone: rootDroppableId }),
|
|
11764
11851
|
puck: {
|
|
11765
11852
|
renderDropZone: DropZonePure,
|
|
11766
11853
|
isEditing: true,
|
|
@@ -11771,23 +11858,18 @@ var EditorPage = memo9(() => {
|
|
|
11771
11858
|
// DEPRECATED
|
|
11772
11859
|
});
|
|
11773
11860
|
}, [propsWithSlots, metadata]);
|
|
11774
|
-
|
|
11775
|
-
(_b = (_a = config.root) == null ? void 0 : _a.fields) != null ? _b : {},
|
|
11776
|
-
renderProps
|
|
11777
|
-
);
|
|
11778
|
-
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadProps(__spreadValues(__spreadValues({}, renderProps), richtextProps), {
|
|
11861
|
+
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, renderProps), {
|
|
11779
11862
|
id: "puck-root"
|
|
11780
|
-
})) : /* @__PURE__ */
|
|
11781
|
-
}
|
|
11782
|
-
|
|
11783
|
-
var editor_page_default = EditorPage;
|
|
11863
|
+
})) : /* @__PURE__ */ jsx57(Fragment13, { children: renderProps.children });
|
|
11864
|
+
};
|
|
11865
|
+
var edit_page_default = EditPage;
|
|
11784
11866
|
|
|
11785
11867
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
|
11786
11868
|
init_react_import();
|
|
11787
11869
|
var styles_module_default28 = { "PuckPreview": "_PuckPreview_zbic3_1", "PuckPreview-frame": "_PuckPreview-frame_zbic3_6" };
|
|
11788
11870
|
|
|
11789
11871
|
// components/Puck/components/Preview/index.tsx
|
|
11790
|
-
import { jsx as
|
|
11872
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
11791
11873
|
var getClassName35 = get_class_name_factory_default("PuckPreview", styles_module_default28);
|
|
11792
11874
|
var useBubbleIframeEvents = (ref) => {
|
|
11793
11875
|
const status = useAppStore((s) => s.status);
|
|
@@ -11844,25 +11926,21 @@ var usePreviewModeAttribute = (ref) => {
|
|
|
11844
11926
|
};
|
|
11845
11927
|
var Preview2 = ({ id = "puck-preview" }) => {
|
|
11846
11928
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
11847
|
-
const config = useAppStore((s) => s.config);
|
|
11848
11929
|
const setStatus = useAppStore((s) => s.setStatus);
|
|
11849
11930
|
const iframe = useAppStore((s) => s.iframe);
|
|
11850
11931
|
const overrides = useAppStore((s) => s.overrides);
|
|
11851
|
-
const
|
|
11852
|
-
const
|
|
11853
|
-
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
11854
|
-
);
|
|
11855
|
-
const Frame = useMemo22(() => overrides.iframe, [overrides]);
|
|
11932
|
+
const isEditMode = useAppStore((s) => s.state.ui.previewMode === "edit");
|
|
11933
|
+
const Frame = useMemo23(() => overrides.iframe, [overrides]);
|
|
11856
11934
|
const ref = useRef12(null);
|
|
11857
11935
|
useBubbleIframeEvents(ref);
|
|
11858
11936
|
usePreviewModeAttribute(ref);
|
|
11859
|
-
const inner =
|
|
11937
|
+
const inner = isEditMode ? /* @__PURE__ */ jsx58(edit_page_default, {}) : /* @__PURE__ */ jsx58(interactive_page_default, {});
|
|
11860
11938
|
useEffect24(() => {
|
|
11861
11939
|
if (!iframe.enabled) {
|
|
11862
11940
|
setStatus("READY");
|
|
11863
11941
|
}
|
|
11864
11942
|
}, [iframe.enabled]);
|
|
11865
|
-
return /* @__PURE__ */
|
|
11943
|
+
return /* @__PURE__ */ jsx58(
|
|
11866
11944
|
"div",
|
|
11867
11945
|
{
|
|
11868
11946
|
className: getClassName35(),
|
|
@@ -11874,7 +11952,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11874
11952
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
11875
11953
|
}
|
|
11876
11954
|
},
|
|
11877
|
-
children: iframe.enabled ? /* @__PURE__ */
|
|
11955
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx58(
|
|
11878
11956
|
AutoFrame_default,
|
|
11879
11957
|
{
|
|
11880
11958
|
id: "preview-frame",
|
|
@@ -11888,14 +11966,14 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11888
11966
|
setStatus("MOUNTED");
|
|
11889
11967
|
},
|
|
11890
11968
|
frameRef: ref,
|
|
11891
|
-
children: /* @__PURE__ */
|
|
11969
|
+
children: /* @__PURE__ */ jsx58(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
11892
11970
|
if (Frame) {
|
|
11893
|
-
return /* @__PURE__ */
|
|
11971
|
+
return /* @__PURE__ */ jsx58(Frame, { document: document2, children: inner });
|
|
11894
11972
|
}
|
|
11895
11973
|
return inner;
|
|
11896
11974
|
} })
|
|
11897
11975
|
}
|
|
11898
|
-
) : /* @__PURE__ */
|
|
11976
|
+
) : /* @__PURE__ */ jsx58(
|
|
11899
11977
|
"div",
|
|
11900
11978
|
{
|
|
11901
11979
|
id: "preview-frame",
|
|
@@ -11911,7 +11989,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11911
11989
|
|
|
11912
11990
|
// lib/use-loaded-overrides.ts
|
|
11913
11991
|
init_react_import();
|
|
11914
|
-
import { useMemo as
|
|
11992
|
+
import { useMemo as useMemo24 } from "react";
|
|
11915
11993
|
|
|
11916
11994
|
// lib/load-overrides.ts
|
|
11917
11995
|
init_react_import();
|
|
@@ -11953,7 +12031,7 @@ var useLoadedOverrides = ({
|
|
|
11953
12031
|
overrides,
|
|
11954
12032
|
plugins
|
|
11955
12033
|
}) => {
|
|
11956
|
-
return
|
|
12034
|
+
return useMemo24(() => {
|
|
11957
12035
|
return loadOverrides({ overrides, plugins });
|
|
11958
12036
|
}, [plugins, overrides]);
|
|
11959
12037
|
};
|
|
@@ -11966,7 +12044,7 @@ init_react_import();
|
|
|
11966
12044
|
import {
|
|
11967
12045
|
useEffect as useEffect29,
|
|
11968
12046
|
useLayoutEffect as useLayoutEffect3,
|
|
11969
|
-
useMemo as
|
|
12047
|
+
useMemo as useMemo29,
|
|
11970
12048
|
useState as useState25
|
|
11971
12049
|
} from "react";
|
|
11972
12050
|
|
|
@@ -11976,8 +12054,8 @@ var styles_module_default29 = { "Puck": "_Puck_tzaxg_19", "Puck-portal": "_Puck-
|
|
|
11976
12054
|
|
|
11977
12055
|
// components/DefaultOverride/index.tsx
|
|
11978
12056
|
init_react_import();
|
|
11979
|
-
import { Fragment as Fragment14, jsx as
|
|
11980
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
|
12057
|
+
import { Fragment as Fragment14, jsx as jsx59 } from "react/jsx-runtime";
|
|
12058
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx59(Fragment14, { children });
|
|
11981
12059
|
|
|
11982
12060
|
// lib/use-preview-mode-hotkeys.ts
|
|
11983
12061
|
init_react_import();
|
|
@@ -11999,7 +12077,7 @@ var usePreviewModeHotkeys = () => {
|
|
|
11999
12077
|
|
|
12000
12078
|
// components/Puck/components/Header/index.tsx
|
|
12001
12079
|
init_react_import();
|
|
12002
|
-
import { memo as
|
|
12080
|
+
import { memo as memo9, useCallback as useCallback22, useMemo as useMemo25, useState as useState21 } from "react";
|
|
12003
12081
|
|
|
12004
12082
|
// components/MenuBar/index.tsx
|
|
12005
12083
|
init_react_import();
|
|
@@ -12009,7 +12087,7 @@ init_react_import();
|
|
|
12009
12087
|
var styles_module_default30 = { "MenuBar": "_MenuBar_1hxnj_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_1hxnj_14", "MenuBar-inner": "_MenuBar-inner_1hxnj_29", "MenuBar-history": "_MenuBar-history_1hxnj_45" };
|
|
12010
12088
|
|
|
12011
12089
|
// components/MenuBar/index.tsx
|
|
12012
|
-
import { Fragment as Fragment15, jsx as
|
|
12090
|
+
import { Fragment as Fragment15, jsx as jsx60, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
12013
12091
|
var getClassName36 = get_class_name_factory_default("MenuBar", styles_module_default30);
|
|
12014
12092
|
function MenuBar({
|
|
12015
12093
|
menuOpen = false,
|
|
@@ -12022,7 +12100,7 @@ function MenuBar({
|
|
|
12022
12100
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
12023
12101
|
const undoLabel = useMessage("header-undo");
|
|
12024
12102
|
const redoLabel = useMessage("header-redo");
|
|
12025
|
-
return /* @__PURE__ */
|
|
12103
|
+
return /* @__PURE__ */ jsx60(
|
|
12026
12104
|
"div",
|
|
12027
12105
|
{
|
|
12028
12106
|
className: getClassName36({ menuOpen }),
|
|
@@ -12038,28 +12116,28 @@ function MenuBar({
|
|
|
12038
12116
|
},
|
|
12039
12117
|
children: /* @__PURE__ */ jsxs23("div", { className: getClassName36("inner"), children: [
|
|
12040
12118
|
/* @__PURE__ */ jsxs23("div", { className: getClassName36("history"), children: [
|
|
12041
|
-
/* @__PURE__ */
|
|
12119
|
+
/* @__PURE__ */ jsx60(
|
|
12042
12120
|
IconButton,
|
|
12043
12121
|
{
|
|
12044
12122
|
type: "button",
|
|
12045
12123
|
title: undoLabel,
|
|
12046
12124
|
disabled: !hasPast,
|
|
12047
12125
|
onClick: back,
|
|
12048
|
-
children: /* @__PURE__ */
|
|
12126
|
+
children: /* @__PURE__ */ jsx60(Undo2, { size: 21 })
|
|
12049
12127
|
}
|
|
12050
12128
|
),
|
|
12051
|
-
/* @__PURE__ */
|
|
12129
|
+
/* @__PURE__ */ jsx60(
|
|
12052
12130
|
IconButton,
|
|
12053
12131
|
{
|
|
12054
12132
|
type: "button",
|
|
12055
12133
|
title: redoLabel,
|
|
12056
12134
|
disabled: !hasFuture,
|
|
12057
12135
|
onClick: forward,
|
|
12058
|
-
children: /* @__PURE__ */
|
|
12136
|
+
children: /* @__PURE__ */ jsx60(Redo2, { size: 21 })
|
|
12059
12137
|
}
|
|
12060
12138
|
)
|
|
12061
12139
|
] }),
|
|
12062
|
-
/* @__PURE__ */
|
|
12140
|
+
/* @__PURE__ */ jsx60(Fragment15, { children: renderHeaderActions && renderHeaderActions() })
|
|
12063
12141
|
] })
|
|
12064
12142
|
}
|
|
12065
12143
|
);
|
|
@@ -12070,7 +12148,7 @@ init_react_import();
|
|
|
12070
12148
|
var styles_module_default31 = { "PuckHeader": "_PuckHeader_c2nei_1", "PuckHeader--hidePlugins": "_PuckHeader--hidePlugins_c2nei_21", "PuckHeader-inner": "_PuckHeader-inner_c2nei_26", "PuckHeader-toggle": "_PuckHeader-toggle_c2nei_46", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_c2nei_52", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_c2nei_53", "PuckHeader-title": "_PuckHeader-title_c2nei_64", "PuckHeader-path": "_PuckHeader-path_c2nei_68", "PuckHeader-tools": "_PuckHeader-tools_c2nei_75", "PuckHeader-menuButton": "_PuckHeader-menuButton_c2nei_81", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_c2nei_86" };
|
|
12071
12149
|
|
|
12072
12150
|
// components/Puck/components/Header/index.tsx
|
|
12073
|
-
import { Fragment as Fragment16, jsx as
|
|
12151
|
+
import { Fragment as Fragment16, jsx as jsx61, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
12074
12152
|
var getClassName37 = get_class_name_factory_default("PuckHeader", styles_module_default31);
|
|
12075
12153
|
var HeaderInner = ({
|
|
12076
12154
|
hidePlugins
|
|
@@ -12085,7 +12163,7 @@ var HeaderInner = ({
|
|
|
12085
12163
|
} = usePropsContext();
|
|
12086
12164
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
12087
12165
|
const appStore = useAppStoreApi();
|
|
12088
|
-
const defaultHeaderRender =
|
|
12166
|
+
const defaultHeaderRender = useMemo25(() => {
|
|
12089
12167
|
if (renderHeader) {
|
|
12090
12168
|
console.warn(
|
|
12091
12169
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -12094,13 +12172,13 @@ var HeaderInner = ({
|
|
|
12094
12172
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
12095
12173
|
const Comp = renderHeader;
|
|
12096
12174
|
const appState = useAppStore((s) => s.state);
|
|
12097
|
-
return /* @__PURE__ */
|
|
12175
|
+
return /* @__PURE__ */ jsx61(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
12098
12176
|
};
|
|
12099
12177
|
return RenderHeader;
|
|
12100
12178
|
}
|
|
12101
12179
|
return DefaultOverride;
|
|
12102
12180
|
}, [renderHeader]);
|
|
12103
|
-
const defaultHeaderActionsRender =
|
|
12181
|
+
const defaultHeaderActionsRender = useMemo25(() => {
|
|
12104
12182
|
if (renderHeaderActions) {
|
|
12105
12183
|
console.warn(
|
|
12106
12184
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
@@ -12108,7 +12186,7 @@ var HeaderInner = ({
|
|
|
12108
12186
|
const RenderHeader = (props) => {
|
|
12109
12187
|
const Comp = renderHeaderActions;
|
|
12110
12188
|
const appState = useAppStore((s) => s.state);
|
|
12111
|
-
return /* @__PURE__ */
|
|
12189
|
+
return /* @__PURE__ */ jsx61(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
12112
12190
|
};
|
|
12113
12191
|
return RenderHeader;
|
|
12114
12192
|
}
|
|
@@ -12149,21 +12227,21 @@ var HeaderInner = ({
|
|
|
12149
12227
|
const toggleLeftLabel = useMessage("header-toggle-leftsidebar");
|
|
12150
12228
|
const toggleRightLabel = useMessage("header-toggle-rightsidebar");
|
|
12151
12229
|
const toggleMenuLabel = useMessage("header-toggle-menubar");
|
|
12152
|
-
return /* @__PURE__ */
|
|
12230
|
+
return /* @__PURE__ */ jsx61(
|
|
12153
12231
|
CustomHeader,
|
|
12154
12232
|
{
|
|
12155
|
-
actions: /* @__PURE__ */
|
|
12233
|
+
actions: /* @__PURE__ */ jsx61(Fragment16, { children: /* @__PURE__ */ jsx61(CustomHeaderActions, { children: /* @__PURE__ */ jsx61(
|
|
12156
12234
|
Button,
|
|
12157
12235
|
{
|
|
12158
12236
|
onClick: () => {
|
|
12159
12237
|
const data = appStore.getState().state.data;
|
|
12160
12238
|
onPublish && onPublish(data);
|
|
12161
12239
|
},
|
|
12162
|
-
icon: /* @__PURE__ */
|
|
12240
|
+
icon: /* @__PURE__ */ jsx61(Globe, { size: "14px" }),
|
|
12163
12241
|
children: publishLabel
|
|
12164
12242
|
}
|
|
12165
12243
|
) }) }),
|
|
12166
|
-
children: /* @__PURE__ */
|
|
12244
|
+
children: /* @__PURE__ */ jsx61(
|
|
12167
12245
|
"header",
|
|
12168
12246
|
{
|
|
12169
12247
|
className: getClassName37({
|
|
@@ -12173,7 +12251,7 @@ var HeaderInner = ({
|
|
|
12173
12251
|
}),
|
|
12174
12252
|
children: /* @__PURE__ */ jsxs24("div", { className: getClassName37("inner"), children: [
|
|
12175
12253
|
/* @__PURE__ */ jsxs24("div", { className: getClassName37("toggle"), children: [
|
|
12176
|
-
/* @__PURE__ */
|
|
12254
|
+
/* @__PURE__ */ jsx61("div", { className: getClassName37("leftSideBarToggle"), children: /* @__PURE__ */ jsx61(
|
|
12177
12255
|
IconButton,
|
|
12178
12256
|
{
|
|
12179
12257
|
type: "button",
|
|
@@ -12181,10 +12259,10 @@ var HeaderInner = ({
|
|
|
12181
12259
|
toggleSidebars("left");
|
|
12182
12260
|
},
|
|
12183
12261
|
title: toggleLeftLabel,
|
|
12184
|
-
children: /* @__PURE__ */
|
|
12262
|
+
children: /* @__PURE__ */ jsx61(PanelLeft, { focusable: "false" })
|
|
12185
12263
|
}
|
|
12186
12264
|
) }),
|
|
12187
|
-
/* @__PURE__ */
|
|
12265
|
+
/* @__PURE__ */ jsx61("div", { className: getClassName37("rightSideBarToggle"), children: /* @__PURE__ */ jsx61(
|
|
12188
12266
|
IconButton,
|
|
12189
12267
|
{
|
|
12190
12268
|
type: "button",
|
|
@@ -12192,19 +12270,19 @@ var HeaderInner = ({
|
|
|
12192
12270
|
toggleSidebars("right");
|
|
12193
12271
|
},
|
|
12194
12272
|
title: toggleRightLabel,
|
|
12195
|
-
children: /* @__PURE__ */
|
|
12273
|
+
children: /* @__PURE__ */ jsx61(PanelRight, { focusable: "false" })
|
|
12196
12274
|
}
|
|
12197
12275
|
) })
|
|
12198
12276
|
] }),
|
|
12199
|
-
/* @__PURE__ */
|
|
12277
|
+
/* @__PURE__ */ jsx61("div", { className: getClassName37("title"), children: /* @__PURE__ */ jsxs24(Heading, { rank: "2", size: "xs", children: [
|
|
12200
12278
|
headerTitle || rootTitle || pageLabel,
|
|
12201
12279
|
headerPath && /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
12202
12280
|
" ",
|
|
12203
|
-
/* @__PURE__ */
|
|
12281
|
+
/* @__PURE__ */ jsx61("code", { className: getClassName37("path"), children: headerPath })
|
|
12204
12282
|
] })
|
|
12205
12283
|
] }) }),
|
|
12206
12284
|
/* @__PURE__ */ jsxs24("div", { className: getClassName37("tools"), children: [
|
|
12207
|
-
/* @__PURE__ */
|
|
12285
|
+
/* @__PURE__ */ jsx61("div", { className: getClassName37("menuButton"), children: /* @__PURE__ */ jsx61(
|
|
12208
12286
|
IconButton,
|
|
12209
12287
|
{
|
|
12210
12288
|
type: "button",
|
|
@@ -12212,23 +12290,23 @@ var HeaderInner = ({
|
|
|
12212
12290
|
return setMenuOpen(!menuOpen);
|
|
12213
12291
|
},
|
|
12214
12292
|
title: toggleMenuLabel,
|
|
12215
|
-
children: menuOpen ? /* @__PURE__ */
|
|
12293
|
+
children: menuOpen ? /* @__PURE__ */ jsx61(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx61(ChevronDown, { focusable: "false" })
|
|
12216
12294
|
}
|
|
12217
12295
|
) }),
|
|
12218
|
-
/* @__PURE__ */
|
|
12296
|
+
/* @__PURE__ */ jsx61(
|
|
12219
12297
|
MenuBar,
|
|
12220
12298
|
{
|
|
12221
12299
|
dispatch,
|
|
12222
12300
|
onPublish,
|
|
12223
12301
|
menuOpen,
|
|
12224
|
-
renderHeaderActions: () => /* @__PURE__ */
|
|
12302
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx61(CustomHeaderActions, { children: /* @__PURE__ */ jsx61(
|
|
12225
12303
|
Button,
|
|
12226
12304
|
{
|
|
12227
12305
|
onClick: () => {
|
|
12228
12306
|
const data = appStore.getState().state.data;
|
|
12229
12307
|
onPublish && onPublish(data);
|
|
12230
12308
|
},
|
|
12231
|
-
icon: /* @__PURE__ */
|
|
12309
|
+
icon: /* @__PURE__ */ jsx61(Globe, { size: "14px" }),
|
|
12232
12310
|
children: publishLabel
|
|
12233
12311
|
}
|
|
12234
12312
|
) }),
|
|
@@ -12242,7 +12320,7 @@ var HeaderInner = ({
|
|
|
12242
12320
|
}
|
|
12243
12321
|
);
|
|
12244
12322
|
};
|
|
12245
|
-
var Header =
|
|
12323
|
+
var Header = memo9(HeaderInner);
|
|
12246
12324
|
|
|
12247
12325
|
// components/SidebarSection/index.tsx
|
|
12248
12326
|
init_react_import();
|
|
@@ -12252,7 +12330,7 @@ init_react_import();
|
|
|
12252
12330
|
var styles_module_default32 = { "SidebarSection": "_SidebarSection_1uv88_1", "SidebarSection-title": "_SidebarSection-title_1uv88_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_1uv88_20", "SidebarSection-content": "_SidebarSection-content_1uv88_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_1uv88_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_1uv88_62", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_1uv88_33", "SidebarSection-heading": "_SidebarSection-heading_1uv88_74", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_1uv88_78" };
|
|
12253
12331
|
|
|
12254
12332
|
// components/SidebarSection/index.tsx
|
|
12255
|
-
import { jsx as
|
|
12333
|
+
import { jsx as jsx62, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
12256
12334
|
var getClassName38 = get_class_name_factory_default("SidebarSection", styles_module_default32);
|
|
12257
12335
|
var SidebarSection = ({
|
|
12258
12336
|
children,
|
|
@@ -12263,12 +12341,12 @@ var SidebarSection = ({
|
|
|
12263
12341
|
isLoading
|
|
12264
12342
|
}) => {
|
|
12265
12343
|
return /* @__PURE__ */ jsxs25("div", { className: getClassName38({ noBorderTop }), style: { background }, children: [
|
|
12266
|
-
/* @__PURE__ */
|
|
12267
|
-
showBreadcrumbs && /* @__PURE__ */
|
|
12268
|
-
/* @__PURE__ */
|
|
12344
|
+
/* @__PURE__ */ jsx62("div", { className: getClassName38("title"), children: /* @__PURE__ */ jsxs25("div", { className: getClassName38("breadcrumbs"), children: [
|
|
12345
|
+
showBreadcrumbs && /* @__PURE__ */ jsx62(Breadcrumbs, {}),
|
|
12346
|
+
/* @__PURE__ */ jsx62("div", { className: getClassName38("heading"), children: /* @__PURE__ */ jsx62(Heading, { rank: "2", size: "xs", children: title }) })
|
|
12269
12347
|
] }) }),
|
|
12270
|
-
/* @__PURE__ */
|
|
12271
|
-
isLoading && /* @__PURE__ */
|
|
12348
|
+
/* @__PURE__ */ jsx62("div", { className: getClassName38("content"), children }),
|
|
12349
|
+
isLoading && /* @__PURE__ */ jsx62("div", { className: getClassName38("loadingOverlay"), children: /* @__PURE__ */ jsx62(Loader, { size: 32 }) })
|
|
12272
12350
|
] });
|
|
12273
12351
|
};
|
|
12274
12352
|
|
|
@@ -12277,26 +12355,26 @@ init_react_import();
|
|
|
12277
12355
|
import {
|
|
12278
12356
|
useCallback as useCallback23,
|
|
12279
12357
|
useEffect as useEffect26,
|
|
12280
|
-
useMemo as
|
|
12358
|
+
useMemo as useMemo28,
|
|
12281
12359
|
useRef as useRef14,
|
|
12282
12360
|
useState as useState23
|
|
12283
12361
|
} from "react";
|
|
12284
12362
|
|
|
12285
12363
|
// components/ViewportControls/index.tsx
|
|
12286
12364
|
init_react_import();
|
|
12287
|
-
import { useEffect as useEffect25, useMemo as
|
|
12365
|
+
import { useEffect as useEffect25, useMemo as useMemo26, useState as useState22 } from "react";
|
|
12288
12366
|
|
|
12289
12367
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
12290
12368
|
init_react_import();
|
|
12291
12369
|
var styles_module_default33 = { "ViewportControls": "_ViewportControls_v26yb_1", "ViewportControls--fullScreen": "_ViewportControls--fullScreen_v26yb_5", "ViewportControls-toggleButton": "_ViewportControls-toggleButton_v26yb_14", "ViewportControls-actions": "_ViewportControls-actions_v26yb_39", "ViewportControls-actionsInner": "_ViewportControls-actionsInner_v26yb_43", "ViewportControls--isExpanded": "_ViewportControls--isExpanded_v26yb_67", "ViewportControls-divider": "_ViewportControls-divider_v26yb_72", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_v26yb_79", "ViewportControls-zoom": "_ViewportControls-zoom_v26yb_79", "ViewportButton-inner": "_ViewportButton-inner_v26yb_110", "ViewportButton--isActive": "_ViewportButton--isActive_v26yb_118" };
|
|
12292
12370
|
|
|
12293
12371
|
// components/ViewportControls/index.tsx
|
|
12294
|
-
import { jsx as
|
|
12372
|
+
import { jsx as jsx63, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
12295
12373
|
var icons = {
|
|
12296
|
-
Smartphone: /* @__PURE__ */
|
|
12297
|
-
Tablet: /* @__PURE__ */
|
|
12298
|
-
Monitor: /* @__PURE__ */
|
|
12299
|
-
FullWidth: /* @__PURE__ */
|
|
12374
|
+
Smartphone: /* @__PURE__ */ jsx63(Smartphone, { size: 16 }),
|
|
12375
|
+
Tablet: /* @__PURE__ */ jsx63(Tablet, { size: 16 }),
|
|
12376
|
+
Monitor: /* @__PURE__ */ jsx63(Monitor, { size: 16 }),
|
|
12377
|
+
FullWidth: /* @__PURE__ */ jsx63(Expand, { size: 16 })
|
|
12300
12378
|
};
|
|
12301
12379
|
var getClassName39 = get_class_name_factory_default("ViewportControls", styles_module_default33);
|
|
12302
12380
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default33);
|
|
@@ -12307,7 +12385,7 @@ var ActionButton = ({
|
|
|
12307
12385
|
isActive,
|
|
12308
12386
|
disabled
|
|
12309
12387
|
}) => {
|
|
12310
|
-
return /* @__PURE__ */
|
|
12388
|
+
return /* @__PURE__ */ jsx63("span", { className: getClassNameButton({ isActive }), suppressHydrationWarning: true, children: /* @__PURE__ */ jsx63(
|
|
12311
12389
|
IconButton,
|
|
12312
12390
|
{
|
|
12313
12391
|
type: "button",
|
|
@@ -12315,7 +12393,7 @@ var ActionButton = ({
|
|
|
12315
12393
|
disabled: disabled || isActive,
|
|
12316
12394
|
onClick,
|
|
12317
12395
|
suppressHydrationWarning: true,
|
|
12318
|
-
children: /* @__PURE__ */
|
|
12396
|
+
children: /* @__PURE__ */ jsx63("span", { className: getClassNameButton("inner"), children })
|
|
12319
12397
|
}
|
|
12320
12398
|
) });
|
|
12321
12399
|
};
|
|
@@ -12338,7 +12416,7 @@ var ViewportButton = ({
|
|
|
12338
12416
|
label: (_a = viewport.label) != null ? _a : ""
|
|
12339
12417
|
});
|
|
12340
12418
|
const switchDefaultTitle = useMessage("viewport-switch-default");
|
|
12341
|
-
return /* @__PURE__ */
|
|
12419
|
+
return /* @__PURE__ */ jsx63(
|
|
12342
12420
|
ActionButton,
|
|
12343
12421
|
{
|
|
12344
12422
|
title: viewport.label ? switchTitle : switchDefaultTitle,
|
|
@@ -12364,7 +12442,7 @@ var ViewportControls = ({
|
|
|
12364
12442
|
const autoZoomLabel = useMessage("viewport-zoom-auto", {
|
|
12365
12443
|
zoom: (autoZoom * 100).toFixed(0)
|
|
12366
12444
|
});
|
|
12367
|
-
const zoomOptions =
|
|
12445
|
+
const zoomOptions = useMemo26(
|
|
12368
12446
|
() => [
|
|
12369
12447
|
...defaultZoomOptions,
|
|
12370
12448
|
...defaultsContainAutoZoom ? [] : [
|
|
@@ -12392,8 +12470,8 @@ var ViewportControls = ({
|
|
|
12392
12470
|
className: getClassName39({ isExpanded, fullScreen }),
|
|
12393
12471
|
suppressHydrationWarning: true,
|
|
12394
12472
|
children: [
|
|
12395
|
-
/* @__PURE__ */
|
|
12396
|
-
viewports.map((viewport, i) => /* @__PURE__ */
|
|
12473
|
+
/* @__PURE__ */ jsx63("div", { className: getClassName39("actions"), children: /* @__PURE__ */ jsxs26("div", { className: getClassName39("actionsInner"), children: [
|
|
12474
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx63(
|
|
12397
12475
|
ViewportButton,
|
|
12398
12476
|
{
|
|
12399
12477
|
viewport,
|
|
@@ -12405,8 +12483,8 @@ var ViewportControls = ({
|
|
|
12405
12483
|
},
|
|
12406
12484
|
i
|
|
12407
12485
|
)),
|
|
12408
|
-
/* @__PURE__ */
|
|
12409
|
-
/* @__PURE__ */
|
|
12486
|
+
/* @__PURE__ */ jsx63("div", { className: getClassName39("divider") }),
|
|
12487
|
+
/* @__PURE__ */ jsx63(
|
|
12410
12488
|
ActionButton,
|
|
12411
12489
|
{
|
|
12412
12490
|
title: zoomOutLabel,
|
|
@@ -12420,10 +12498,10 @@ var ViewportControls = ({
|
|
|
12420
12498
|
)].value
|
|
12421
12499
|
);
|
|
12422
12500
|
},
|
|
12423
|
-
children: /* @__PURE__ */
|
|
12501
|
+
children: /* @__PURE__ */ jsx63(ZoomOut, { size: 16 })
|
|
12424
12502
|
}
|
|
12425
12503
|
),
|
|
12426
|
-
/* @__PURE__ */
|
|
12504
|
+
/* @__PURE__ */ jsx63(
|
|
12427
12505
|
ActionButton,
|
|
12428
12506
|
{
|
|
12429
12507
|
title: zoomInLabel,
|
|
@@ -12437,12 +12515,12 @@ var ViewportControls = ({
|
|
|
12437
12515
|
)].value
|
|
12438
12516
|
);
|
|
12439
12517
|
},
|
|
12440
|
-
children: /* @__PURE__ */
|
|
12518
|
+
children: /* @__PURE__ */ jsx63(ZoomIn, { size: 16 })
|
|
12441
12519
|
}
|
|
12442
12520
|
),
|
|
12443
12521
|
/* @__PURE__ */ jsxs26("div", { className: getClassName39("zoom"), children: [
|
|
12444
|
-
/* @__PURE__ */
|
|
12445
|
-
/* @__PURE__ */
|
|
12522
|
+
/* @__PURE__ */ jsx63("div", { className: getClassName39("divider") }),
|
|
12523
|
+
/* @__PURE__ */ jsx63(
|
|
12446
12524
|
"select",
|
|
12447
12525
|
{
|
|
12448
12526
|
className: getClassName39("zoomSelect"),
|
|
@@ -12453,7 +12531,7 @@ var ViewportControls = ({
|
|
|
12453
12531
|
onChange: (e) => {
|
|
12454
12532
|
onZoom(parseFloat(e.currentTarget.value));
|
|
12455
12533
|
},
|
|
12456
|
-
children: zoomOptions.map((option) => /* @__PURE__ */
|
|
12534
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ jsx63(
|
|
12457
12535
|
"option",
|
|
12458
12536
|
{
|
|
12459
12537
|
value: option.value,
|
|
@@ -12465,13 +12543,13 @@ var ViewportControls = ({
|
|
|
12465
12543
|
)
|
|
12466
12544
|
] })
|
|
12467
12545
|
] }) }),
|
|
12468
|
-
/* @__PURE__ */
|
|
12546
|
+
/* @__PURE__ */ jsx63(
|
|
12469
12547
|
"button",
|
|
12470
12548
|
{
|
|
12471
12549
|
className: getClassName39("toggleButton"),
|
|
12472
12550
|
title: toggleMenuLabel,
|
|
12473
12551
|
onClick: () => setIsExpanded((s) => !s),
|
|
12474
|
-
children: isExpanded ? /* @__PURE__ */
|
|
12552
|
+
children: isExpanded ? /* @__PURE__ */ jsx63(X, { size: 16 }) : /* @__PURE__ */ jsx63(Monitor, { size: 16 })
|
|
12475
12553
|
}
|
|
12476
12554
|
)
|
|
12477
12555
|
]
|
|
@@ -12484,7 +12562,7 @@ init_react_import();
|
|
|
12484
12562
|
var styles_module_default34 = { "PuckCanvas": "_PuckCanvas_zw9iy_1", "PuckCanvas-controls": "_PuckCanvas-controls_zw9iy_18", "PuckCanvas--fullScreen": "_PuckCanvas--fullScreen_zw9iy_23", "PuckCanvas-inner": "_PuckCanvas-inner_zw9iy_34", "PuckCanvas-root": "_PuckCanvas-root_zw9iy_43", "PuckCanvas--ready": "_PuckCanvas--ready_zw9iy_68", "PuckCanvas-loader": "_PuckCanvas-loader_zw9iy_73", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_zw9iy_84" };
|
|
12485
12563
|
|
|
12486
12564
|
// components/Puck/components/Canvas/index.tsx
|
|
12487
|
-
import { useShallow as
|
|
12565
|
+
import { useShallow as useShallow12 } from "zustand/react/shallow";
|
|
12488
12566
|
|
|
12489
12567
|
// lib/frame-context.tsx
|
|
12490
12568
|
init_react_import();
|
|
@@ -12492,21 +12570,21 @@ import {
|
|
|
12492
12570
|
createContext as createContext8,
|
|
12493
12571
|
useContext as useContext18,
|
|
12494
12572
|
useRef as useRef13,
|
|
12495
|
-
useMemo as
|
|
12573
|
+
useMemo as useMemo27
|
|
12496
12574
|
} from "react";
|
|
12497
|
-
import { jsx as
|
|
12575
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
12498
12576
|
var FrameContext = createContext8(null);
|
|
12499
12577
|
var FrameProvider = ({
|
|
12500
12578
|
children
|
|
12501
12579
|
}) => {
|
|
12502
12580
|
const frameRef = useRef13(null);
|
|
12503
|
-
const value =
|
|
12581
|
+
const value = useMemo27(
|
|
12504
12582
|
() => ({
|
|
12505
12583
|
frameRef
|
|
12506
12584
|
}),
|
|
12507
12585
|
[]
|
|
12508
12586
|
);
|
|
12509
|
-
return /* @__PURE__ */
|
|
12587
|
+
return /* @__PURE__ */ jsx64(FrameContext.Provider, { value, children });
|
|
12510
12588
|
};
|
|
12511
12589
|
var useCanvasFrame = () => {
|
|
12512
12590
|
const context = useContext18(FrameContext);
|
|
@@ -12517,7 +12595,7 @@ var useCanvasFrame = () => {
|
|
|
12517
12595
|
};
|
|
12518
12596
|
|
|
12519
12597
|
// components/Puck/components/Canvas/index.tsx
|
|
12520
|
-
import { Fragment as Fragment17, jsx as
|
|
12598
|
+
import { Fragment as Fragment17, jsx as jsx65, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
12521
12599
|
var getClassName40 = get_class_name_factory_default("PuckCanvas", styles_module_default34);
|
|
12522
12600
|
var ZOOM_ON_CHANGE = true;
|
|
12523
12601
|
var TRANSITION_DURATION = 150;
|
|
@@ -12536,7 +12614,7 @@ var Canvas = () => {
|
|
|
12536
12614
|
iframe,
|
|
12537
12615
|
_experimentalFullScreenCanvas
|
|
12538
12616
|
} = useAppStore(
|
|
12539
|
-
|
|
12617
|
+
useShallow12((s) => ({
|
|
12540
12618
|
dispatch: s.dispatch,
|
|
12541
12619
|
overrides: s.overrides,
|
|
12542
12620
|
setUi: s.setUi,
|
|
@@ -12554,7 +12632,7 @@ var Canvas = () => {
|
|
|
12554
12632
|
rightSideBarWidth,
|
|
12555
12633
|
viewports
|
|
12556
12634
|
} = useAppStore(
|
|
12557
|
-
|
|
12635
|
+
useShallow12((s) => ({
|
|
12558
12636
|
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
|
12559
12637
|
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
|
12560
12638
|
leftSideBarWidth: s.state.ui.leftSideBarWidth,
|
|
@@ -12564,11 +12642,11 @@ var Canvas = () => {
|
|
|
12564
12642
|
);
|
|
12565
12643
|
const [showTransition, setShowTransition] = useState23(false);
|
|
12566
12644
|
const isResizingRef = useRef14(false);
|
|
12567
|
-
const defaultRender =
|
|
12568
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */
|
|
12645
|
+
const defaultRender = useMemo28(() => {
|
|
12646
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx65(Fragment17, { children });
|
|
12569
12647
|
return PuckDefault;
|
|
12570
12648
|
}, []);
|
|
12571
|
-
const CustomPreview =
|
|
12649
|
+
const CustomPreview = useMemo28(
|
|
12572
12650
|
() => overrides.preview || defaultRender,
|
|
12573
12651
|
[overrides]
|
|
12574
12652
|
);
|
|
@@ -12692,7 +12770,7 @@ var Canvas = () => {
|
|
|
12692
12770
|
}
|
|
12693
12771
|
},
|
|
12694
12772
|
children: [
|
|
12695
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */
|
|
12773
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx65("div", { className: getClassName40("controls"), children: /* @__PURE__ */ jsx65(
|
|
12696
12774
|
ViewportControls,
|
|
12697
12775
|
{
|
|
12698
12776
|
fullScreen: _experimentalFullScreenCanvas,
|
|
@@ -12723,7 +12801,7 @@ var Canvas = () => {
|
|
|
12723
12801
|
}
|
|
12724
12802
|
) }),
|
|
12725
12803
|
/* @__PURE__ */ jsxs27("div", { className: getClassName40("inner"), ref: frameRef, children: [
|
|
12726
|
-
/* @__PURE__ */
|
|
12804
|
+
/* @__PURE__ */ jsx65(
|
|
12727
12805
|
"div",
|
|
12728
12806
|
{
|
|
12729
12807
|
className: getClassName40("root"),
|
|
@@ -12740,10 +12818,10 @@ var Canvas = () => {
|
|
|
12740
12818
|
setShowTransition(false);
|
|
12741
12819
|
isResizingRef.current = false;
|
|
12742
12820
|
},
|
|
12743
|
-
children: /* @__PURE__ */
|
|
12821
|
+
children: /* @__PURE__ */ jsx65(CustomPreview, { children: /* @__PURE__ */ jsx65(Preview2, {}) })
|
|
12744
12822
|
}
|
|
12745
12823
|
),
|
|
12746
|
-
/* @__PURE__ */
|
|
12824
|
+
/* @__PURE__ */ jsx65("div", { className: getClassName40("loader"), children: /* @__PURE__ */ jsx65(Loader, { size: 24 }) })
|
|
12747
12825
|
] })
|
|
12748
12826
|
]
|
|
12749
12827
|
}
|
|
@@ -12843,7 +12921,7 @@ init_react_import();
|
|
|
12843
12921
|
var styles_module_default35 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
|
|
12844
12922
|
|
|
12845
12923
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
12846
|
-
import { jsx as
|
|
12924
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
12847
12925
|
var getClassName41 = get_class_name_factory_default("ResizeHandle", styles_module_default35);
|
|
12848
12926
|
var ResizeHandle = ({
|
|
12849
12927
|
position,
|
|
@@ -12902,7 +12980,7 @@ var ResizeHandle = ({
|
|
|
12902
12980
|
},
|
|
12903
12981
|
[position, handleMouseMove, handleMouseUp]
|
|
12904
12982
|
);
|
|
12905
|
-
return /* @__PURE__ */
|
|
12983
|
+
return /* @__PURE__ */ jsx66(
|
|
12906
12984
|
"div",
|
|
12907
12985
|
{
|
|
12908
12986
|
ref: handleRef,
|
|
@@ -12917,7 +12995,7 @@ init_react_import();
|
|
|
12917
12995
|
var styles_module_default36 = { "Sidebar": "_Sidebar_16oed_1", "Sidebar--isVisible": "_Sidebar--isVisible_16oed_10", "Sidebar--left": "_Sidebar--left_16oed_14", "Sidebar--right": "_Sidebar--right_16oed_34", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_16oed_51" };
|
|
12918
12996
|
|
|
12919
12997
|
// components/Puck/components/Sidebar/index.tsx
|
|
12920
|
-
import { Fragment as Fragment18, jsx as
|
|
12998
|
+
import { Fragment as Fragment18, jsx as jsx67, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
12921
12999
|
var getClassName42 = get_class_name_factory_default("Sidebar", styles_module_default36);
|
|
12922
13000
|
var Sidebar = ({
|
|
12923
13001
|
position,
|
|
@@ -12928,7 +13006,7 @@ var Sidebar = ({
|
|
|
12928
13006
|
children
|
|
12929
13007
|
}) => {
|
|
12930
13008
|
return /* @__PURE__ */ jsxs28(Fragment18, { children: [
|
|
12931
|
-
/* @__PURE__ */
|
|
13009
|
+
/* @__PURE__ */ jsx67(
|
|
12932
13010
|
"div",
|
|
12933
13011
|
{
|
|
12934
13012
|
ref: sidebarRef,
|
|
@@ -12936,7 +13014,7 @@ var Sidebar = ({
|
|
|
12936
13014
|
children
|
|
12937
13015
|
}
|
|
12938
13016
|
),
|
|
12939
|
-
/* @__PURE__ */
|
|
13017
|
+
/* @__PURE__ */ jsx67("div", { className: `${getClassName42("resizeHandle")}`, children: /* @__PURE__ */ jsx67(
|
|
12940
13018
|
ResizeHandle,
|
|
12941
13019
|
{
|
|
12942
13020
|
position,
|
|
@@ -13017,7 +13095,7 @@ init_react_import();
|
|
|
13017
13095
|
var styles_module_default37 = { "Nav": "_Nav_vll2r_1", "Nav-list": "_Nav-list_vll2r_5", "Nav-mobileActions": "_Nav-mobileActions_vll2r_23", "NavItem-link": "_NavItem-link_vll2r_39", "NavItem": "_NavItem_vll2r_39", "NavItem-linkIcon": "_NavItem-linkIcon_vll2r_90", "NavItem--active": "_NavItem--active_vll2r_100", "NavItem--mobileOnly": "_NavItem--mobileOnly_vll2r_136", "NavItem--desktopOnly": "_NavItem--desktopOnly_vll2r_141" };
|
|
13018
13096
|
|
|
13019
13097
|
// components/Puck/components/Nav/index.tsx
|
|
13020
|
-
import { jsx as
|
|
13098
|
+
import { jsx as jsx68, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
13021
13099
|
var getClassName43 = get_class_name_factory_default("Nav", styles_module_default37);
|
|
13022
13100
|
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default37);
|
|
13023
13101
|
var MenuItem = ({
|
|
@@ -13028,7 +13106,7 @@ var MenuItem = ({
|
|
|
13028
13106
|
mobileOnly,
|
|
13029
13107
|
desktopOnly
|
|
13030
13108
|
}) => {
|
|
13031
|
-
return /* @__PURE__ */
|
|
13109
|
+
return /* @__PURE__ */ jsx68(
|
|
13032
13110
|
"li",
|
|
13033
13111
|
{
|
|
13034
13112
|
className: getClassNameItem3({
|
|
@@ -13037,8 +13115,8 @@ var MenuItem = ({
|
|
|
13037
13115
|
desktopOnly
|
|
13038
13116
|
}),
|
|
13039
13117
|
children: onClick && /* @__PURE__ */ jsxs29("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
13040
|
-
icon && /* @__PURE__ */
|
|
13041
|
-
/* @__PURE__ */
|
|
13118
|
+
icon && /* @__PURE__ */ jsx68("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
13119
|
+
/* @__PURE__ */ jsx68("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
13042
13120
|
] })
|
|
13043
13121
|
}
|
|
13044
13122
|
);
|
|
@@ -13048,8 +13126,8 @@ var Nav = ({
|
|
|
13048
13126
|
mobileActions
|
|
13049
13127
|
}) => {
|
|
13050
13128
|
return /* @__PURE__ */ jsxs29("nav", { className: getClassName43(), children: [
|
|
13051
|
-
/* @__PURE__ */
|
|
13052
|
-
mobileActions && /* @__PURE__ */
|
|
13129
|
+
/* @__PURE__ */ jsx68("ul", { className: getClassName43("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx68(MenuItem, __spreadValues({}, item), key)) }),
|
|
13130
|
+
mobileActions && /* @__PURE__ */ jsx68("div", { className: getClassName43("mobileActions"), children: mobileActions })
|
|
13053
13131
|
] });
|
|
13054
13132
|
};
|
|
13055
13133
|
|
|
@@ -13062,7 +13140,7 @@ var normalizeIframeConfig = (iframe) => __spreadValues({
|
|
|
13062
13140
|
}, iframe);
|
|
13063
13141
|
|
|
13064
13142
|
// components/Puck/components/Layout/index.tsx
|
|
13065
|
-
import { jsx as
|
|
13143
|
+
import { jsx as jsx69, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
13066
13144
|
var getClassName44 = get_class_name_factory_default("Puck", styles_module_default29);
|
|
13067
13145
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default29);
|
|
13068
13146
|
var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default29);
|
|
@@ -13075,14 +13153,14 @@ var FieldSideBar = () => {
|
|
|
13075
13153
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : (_c = s.config.root) == null ? void 0 : _c.label;
|
|
13076
13154
|
}
|
|
13077
13155
|
);
|
|
13078
|
-
return /* @__PURE__ */
|
|
13156
|
+
return /* @__PURE__ */ jsx69(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title: title || pageLabel, children: /* @__PURE__ */ jsx69(Fields, {}) });
|
|
13079
13157
|
};
|
|
13080
13158
|
var PluginTab = ({
|
|
13081
13159
|
children,
|
|
13082
13160
|
visible,
|
|
13083
13161
|
mobileOnly
|
|
13084
13162
|
}) => {
|
|
13085
|
-
return /* @__PURE__ */
|
|
13163
|
+
return /* @__PURE__ */ jsx69("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx69("div", { className: getPluginTabClassName("body"), children }) });
|
|
13086
13164
|
};
|
|
13087
13165
|
var Layout = ({ children }) => {
|
|
13088
13166
|
var _a, _b;
|
|
@@ -13093,7 +13171,7 @@ var Layout = ({ children }) => {
|
|
|
13093
13171
|
height
|
|
13094
13172
|
} = usePropsContext();
|
|
13095
13173
|
const dnd = useAppStore((s) => s.dnd);
|
|
13096
|
-
const iframe =
|
|
13174
|
+
const iframe = useMemo29(
|
|
13097
13175
|
() => normalizeIframeConfig(_iframe),
|
|
13098
13176
|
[_iframe]
|
|
13099
13177
|
);
|
|
@@ -13140,7 +13218,7 @@ var Layout = ({ children }) => {
|
|
|
13140
13218
|
};
|
|
13141
13219
|
}, []);
|
|
13142
13220
|
const overrides = useAppStore((s) => s.overrides);
|
|
13143
|
-
const CustomPuck =
|
|
13221
|
+
const CustomPuck = useMemo29(
|
|
13144
13222
|
() => overrides.puck || DefaultOverride,
|
|
13145
13223
|
[overrides]
|
|
13146
13224
|
);
|
|
@@ -13173,14 +13251,14 @@ var Layout = ({ children }) => {
|
|
|
13173
13251
|
return (_a2 = s.state.ui.plugin) == null ? void 0 : _a2.current;
|
|
13174
13252
|
});
|
|
13175
13253
|
const appStoreApi = useAppStoreApi();
|
|
13176
|
-
const hasLegacySideBarPlugin =
|
|
13254
|
+
const hasLegacySideBarPlugin = useMemo29(
|
|
13177
13255
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
13178
13256
|
[plugins]
|
|
13179
13257
|
);
|
|
13180
13258
|
const blocksLabel = useMessage("plugin-blocks");
|
|
13181
13259
|
const outlineLabel = useMessage("plugin-outline");
|
|
13182
13260
|
const fieldsLabel = useMessage("plugin-fields");
|
|
13183
|
-
const pluginItems =
|
|
13261
|
+
const pluginItems = useMemo29(() => {
|
|
13184
13262
|
const details = {};
|
|
13185
13263
|
const defaultPlugins = [
|
|
13186
13264
|
blocksPlugin({ label: blocksLabel }),
|
|
@@ -13202,7 +13280,7 @@ var Layout = ({ children }) => {
|
|
|
13202
13280
|
}
|
|
13203
13281
|
details[plugin.name] = {
|
|
13204
13282
|
label: (_a2 = plugin.label) != null ? _a2 : plugin.name,
|
|
13205
|
-
icon: (_b2 = plugin.icon) != null ? _b2 : /* @__PURE__ */
|
|
13283
|
+
icon: (_b2 = plugin.icon) != null ? _b2 : /* @__PURE__ */ jsx69(ToyBrick, {}),
|
|
13206
13284
|
onClick: () => {
|
|
13207
13285
|
if (plugin.name === currentPlugin) {
|
|
13208
13286
|
if (leftSideBarVisible) {
|
|
@@ -13263,12 +13341,12 @@ var Layout = ({ children }) => {
|
|
|
13263
13341
|
id: instanceId,
|
|
13264
13342
|
style: { height, visibility: "hidden" },
|
|
13265
13343
|
children: [
|
|
13266
|
-
/* @__PURE__ */
|
|
13344
|
+
/* @__PURE__ */ jsx69(
|
|
13267
13345
|
DragDropContext,
|
|
13268
13346
|
{
|
|
13269
13347
|
disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll,
|
|
13270
13348
|
behavior: dnd == null ? void 0 : dnd.behavior,
|
|
13271
|
-
children: /* @__PURE__ */
|
|
13349
|
+
children: /* @__PURE__ */ jsx69(CustomPuck, { children: children || /* @__PURE__ */ jsx69(FrameProvider, { children: /* @__PURE__ */ jsx69(
|
|
13272
13350
|
"div",
|
|
13273
13351
|
{
|
|
13274
13352
|
className: getLayoutClassName({
|
|
@@ -13286,12 +13364,12 @@ var Layout = ({ children }) => {
|
|
|
13286
13364
|
className: getLayoutClassName("inner"),
|
|
13287
13365
|
style: layoutOptions,
|
|
13288
13366
|
children: [
|
|
13289
|
-
/* @__PURE__ */
|
|
13290
|
-
/* @__PURE__ */
|
|
13367
|
+
/* @__PURE__ */ jsx69("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsx69(Header, { hidePlugins: hasLegacySideBarPlugin }) }),
|
|
13368
|
+
/* @__PURE__ */ jsx69("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx69(
|
|
13291
13369
|
Nav,
|
|
13292
13370
|
{
|
|
13293
13371
|
items: pluginItems,
|
|
13294
|
-
mobileActions: leftSideBarVisible && mobilePanelHeightMode === "toggle" && /* @__PURE__ */
|
|
13372
|
+
mobileActions: leftSideBarVisible && mobilePanelHeightMode === "toggle" && /* @__PURE__ */ jsx69(
|
|
13295
13373
|
IconButton,
|
|
13296
13374
|
{
|
|
13297
13375
|
type: "button",
|
|
@@ -13301,12 +13379,12 @@ var Layout = ({ children }) => {
|
|
|
13301
13379
|
mobilePanelExpanded: !mobilePanelExpanded
|
|
13302
13380
|
});
|
|
13303
13381
|
},
|
|
13304
|
-
children: mobilePanelExpanded ? /* @__PURE__ */
|
|
13382
|
+
children: mobilePanelExpanded ? /* @__PURE__ */ jsx69(Minimize2, { size: 21 }) : /* @__PURE__ */ jsx69(Maximize2, { size: 21 })
|
|
13305
13383
|
}
|
|
13306
13384
|
)
|
|
13307
13385
|
}
|
|
13308
13386
|
) }),
|
|
13309
|
-
/* @__PURE__ */
|
|
13387
|
+
/* @__PURE__ */ jsx69(
|
|
13310
13388
|
Sidebar,
|
|
13311
13389
|
{
|
|
13312
13390
|
position: "left",
|
|
@@ -13315,20 +13393,20 @@ var Layout = ({ children }) => {
|
|
|
13315
13393
|
onResize: setLeftWidth,
|
|
13316
13394
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
13317
13395
|
children: Object.entries(pluginItems).map(
|
|
13318
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */
|
|
13396
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx69(
|
|
13319
13397
|
PluginTab,
|
|
13320
13398
|
{
|
|
13321
13399
|
visible: currentPlugin === id,
|
|
13322
13400
|
mobileOnly,
|
|
13323
|
-
children: /* @__PURE__ */
|
|
13401
|
+
children: /* @__PURE__ */ jsx69(Render2, {})
|
|
13324
13402
|
},
|
|
13325
13403
|
id
|
|
13326
13404
|
)
|
|
13327
13405
|
)
|
|
13328
13406
|
}
|
|
13329
13407
|
),
|
|
13330
|
-
/* @__PURE__ */
|
|
13331
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */
|
|
13408
|
+
/* @__PURE__ */ jsx69(Canvas, {}),
|
|
13409
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ jsx69(
|
|
13332
13410
|
Sidebar,
|
|
13333
13411
|
{
|
|
13334
13412
|
position: "right",
|
|
@@ -13336,7 +13414,7 @@ var Layout = ({ children }) => {
|
|
|
13336
13414
|
isVisible: rightSideBarVisible,
|
|
13337
13415
|
onResize: setRightWidth,
|
|
13338
13416
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
13339
|
-
children: /* @__PURE__ */
|
|
13417
|
+
children: /* @__PURE__ */ jsx69(FieldSideBar, {})
|
|
13340
13418
|
}
|
|
13341
13419
|
)
|
|
13342
13420
|
]
|
|
@@ -13346,17 +13424,17 @@ var Layout = ({ children }) => {
|
|
|
13346
13424
|
) }) })
|
|
13347
13425
|
}
|
|
13348
13426
|
),
|
|
13349
|
-
/* @__PURE__ */
|
|
13427
|
+
/* @__PURE__ */ jsx69("div", { id: "puck-portal-root", className: getClassName44("portal") })
|
|
13350
13428
|
]
|
|
13351
13429
|
}
|
|
13352
13430
|
);
|
|
13353
13431
|
};
|
|
13354
13432
|
|
|
13355
13433
|
// components/Puck/index.tsx
|
|
13356
|
-
import { jsx as
|
|
13434
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
13357
13435
|
var propsContext = createContext9({});
|
|
13358
13436
|
function PropsProvider(props) {
|
|
13359
|
-
return /* @__PURE__ */
|
|
13437
|
+
return /* @__PURE__ */ jsx70(propsContext.Provider, { value: props, children: props.children });
|
|
13360
13438
|
}
|
|
13361
13439
|
var usePropsContext = () => useContext19(propsContext);
|
|
13362
13440
|
function PuckProvider({ children }) {
|
|
@@ -13379,7 +13457,7 @@ function PuckProvider({ children }) {
|
|
|
13379
13457
|
_experimentalFullScreenCanvas,
|
|
13380
13458
|
_experimentalVirtualization
|
|
13381
13459
|
} = usePropsContext();
|
|
13382
|
-
const iframe =
|
|
13460
|
+
const iframe = useMemo30(
|
|
13383
13461
|
() => normalizeIframeConfig(_iframe),
|
|
13384
13462
|
[_iframe]
|
|
13385
13463
|
);
|
|
@@ -13437,7 +13515,7 @@ function PuckProvider({ children }) {
|
|
|
13437
13515
|
});
|
|
13438
13516
|
})
|
|
13439
13517
|
);
|
|
13440
|
-
const initialHistoryIndex =
|
|
13518
|
+
const initialHistoryIndex = useMemo30(() => {
|
|
13441
13519
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
13442
13520
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
13443
13521
|
}
|
|
@@ -13448,7 +13526,7 @@ function PuckProvider({ children }) {
|
|
|
13448
13526
|
overrides,
|
|
13449
13527
|
plugins
|
|
13450
13528
|
});
|
|
13451
|
-
const loadedFieldTransforms =
|
|
13529
|
+
const loadedFieldTransforms = useMemo30(() => {
|
|
13452
13530
|
const _plugins = plugins || [];
|
|
13453
13531
|
const pluginFieldTransforms = _plugins.reduce(
|
|
13454
13532
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -13531,10 +13609,10 @@ function PuckProvider({ children }) {
|
|
|
13531
13609
|
resolveAndCommitData();
|
|
13532
13610
|
}, 0);
|
|
13533
13611
|
}, []);
|
|
13534
|
-
return /* @__PURE__ */
|
|
13612
|
+
return /* @__PURE__ */ jsx70(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx70(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
13535
13613
|
}
|
|
13536
13614
|
function Puck(props) {
|
|
13537
|
-
return /* @__PURE__ */
|
|
13615
|
+
return /* @__PURE__ */ jsx70(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx70(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx70(Layout, { children: props.children }) })) }));
|
|
13538
13616
|
}
|
|
13539
13617
|
Puck.Components = Components;
|
|
13540
13618
|
Puck.Fields = Fields;
|
|
@@ -13544,7 +13622,7 @@ Puck.Preview = Preview2;
|
|
|
13544
13622
|
|
|
13545
13623
|
// plugins/legacy-side-bar/index.tsx
|
|
13546
13624
|
init_react_import();
|
|
13547
|
-
import { jsx as
|
|
13625
|
+
import { jsx as jsx71, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
13548
13626
|
var LegacySideBar = ({
|
|
13549
13627
|
outlineLabel,
|
|
13550
13628
|
componentsLabel
|
|
@@ -13554,13 +13632,13 @@ var LegacySideBar = ({
|
|
|
13554
13632
|
const resolvedComponentsLabel = componentsLabel != null ? componentsLabel : componentsLabelMessage;
|
|
13555
13633
|
const resolvedOutlineLabel = outlineLabel != null ? outlineLabel : outlineLabelMessage;
|
|
13556
13634
|
return /* @__PURE__ */ jsxs31("div", { style: { overflowY: "auto" }, children: [
|
|
13557
|
-
/* @__PURE__ */
|
|
13558
|
-
/* @__PURE__ */
|
|
13635
|
+
/* @__PURE__ */ jsx71(SidebarSection, { title: resolvedComponentsLabel, noBorderTop: true, children: /* @__PURE__ */ jsx71(Components, {}) }),
|
|
13636
|
+
/* @__PURE__ */ jsx71(SidebarSection, { title: resolvedOutlineLabel, children: /* @__PURE__ */ jsx71(Outline, {}) })
|
|
13559
13637
|
] });
|
|
13560
13638
|
};
|
|
13561
13639
|
var legacySideBarPlugin = (props = {}) => ({
|
|
13562
13640
|
name: "legacy-side-bar",
|
|
13563
|
-
render: () => /* @__PURE__ */
|
|
13641
|
+
render: () => /* @__PURE__ */ jsx71(
|
|
13564
13642
|
LegacySideBar,
|
|
13565
13643
|
{
|
|
13566
13644
|
outlineLabel: props.outlineLabel,
|