@measured/puck 0.20.0-canary.f2447833 → 0.20.0-canary.f73c8fa0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/chunk-BNXRZWNI.mjs +1065 -0
- package/dist/{chunk-F7MIAKDQ.mjs → chunk-UBWXLOVR.mjs} +2324 -533
- package/dist/index.css +39 -29
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +387 -318
- package/dist/index.mjs +4 -4
- package/dist/no-external.css +39 -29
- package/dist/no-external.d.mts +1 -1
- package/dist/no-external.d.ts +1 -1
- package/dist/no-external.js +387 -318
- package/dist/no-external.mjs +4 -4
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +456 -1808
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-yh0Fsxem.d.ts → walk-tree-Dn5XpDNA.d.mts} +3 -0
- package/dist/{walk-tree-yh0Fsxem.d.mts → walk-tree-Dn5XpDNA.d.ts} +3 -0
- package/package.json +1 -1
- package/dist/chunk-IP64IXIP.mjs +0 -2820
- package/dist/rsc.css +0 -26
package/dist/no-external.js
CHANGED
|
@@ -2267,7 +2267,8 @@ var defaultAppState = {
|
|
|
2267
2267
|
options: [],
|
|
2268
2268
|
controlsVisible: true
|
|
2269
2269
|
},
|
|
2270
|
-
field: { focus: null }
|
|
2270
|
+
field: { focus: null },
|
|
2271
|
+
plugin: { current: null }
|
|
2271
2272
|
},
|
|
2272
2273
|
indexes: {
|
|
2273
2274
|
nodes: {},
|
|
@@ -3272,6 +3273,7 @@ var SubFieldInternal = ({
|
|
|
3272
3273
|
var SubField = (0, import_react14.memo)(SubFieldInternal);
|
|
3273
3274
|
|
|
3274
3275
|
// components/AutoField/fields/ArrayField/index.tsx
|
|
3276
|
+
var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
|
|
3275
3277
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3276
3278
|
var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
|
|
3277
3279
|
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
|
|
@@ -3482,6 +3484,23 @@ var ArrayField = ({
|
|
|
3482
3484
|
},
|
|
3483
3485
|
[regenerateArrayState, setUi, mapArrayStateToUi, onChange, setLocalState]
|
|
3484
3486
|
);
|
|
3487
|
+
(0, import_react15.useEffect)(() => {
|
|
3488
|
+
return appStoreApi.subscribe(
|
|
3489
|
+
({ selectedItem }) => {
|
|
3490
|
+
var _a;
|
|
3491
|
+
const props = (_a = name ? selectedItem == null ? void 0 : selectedItem.props : {}) != null ? _a : {};
|
|
3492
|
+
return name ? getDeep(props, name) : [];
|
|
3493
|
+
},
|
|
3494
|
+
(val) => {
|
|
3495
|
+
if (!(0, import_fast_deep_equal3.default)(val, valueRef.current)) {
|
|
3496
|
+
valueRef.current = val;
|
|
3497
|
+
const newArrayState = regenerateArrayState(valueRef.current);
|
|
3498
|
+
setUi(mapArrayStateToUi(newArrayState), false);
|
|
3499
|
+
setLocalState(newArrayState);
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
);
|
|
3503
|
+
}, [appStoreApi]);
|
|
3485
3504
|
if (field.type !== "array" || !field.arrayFields) {
|
|
3486
3505
|
return null;
|
|
3487
3506
|
}
|
|
@@ -3497,6 +3516,7 @@ var ArrayField = ({
|
|
|
3497
3516
|
SortableProvider,
|
|
3498
3517
|
{
|
|
3499
3518
|
onDragStart: (id2) => {
|
|
3519
|
+
valueRef.current = getValue();
|
|
3500
3520
|
setDraggedItem(id2);
|
|
3501
3521
|
syncCurrentIndexes();
|
|
3502
3522
|
},
|
|
@@ -3510,8 +3530,7 @@ var ArrayField = ({
|
|
|
3510
3530
|
if (arrayState.items[move.source]._arrayId !== draggedItem) {
|
|
3511
3531
|
return;
|
|
3512
3532
|
}
|
|
3513
|
-
const
|
|
3514
|
-
const newValue = reorder(value2, move.source, move.target);
|
|
3533
|
+
const newValue = reorder(valueRef.current, move.source, move.target);
|
|
3515
3534
|
const newArrayStateItems = reorder(
|
|
3516
3535
|
arrayState.items,
|
|
3517
3536
|
move.source,
|
|
@@ -4475,7 +4494,7 @@ function AutoFieldInternal(_a) {
|
|
|
4475
4494
|
number: ((_h = overrides.fieldTypes) == null ? void 0 : _h.number) || defaultFields.number
|
|
4476
4495
|
});
|
|
4477
4496
|
},
|
|
4478
|
-
[overrides
|
|
4497
|
+
[overrides]
|
|
4479
4498
|
);
|
|
4480
4499
|
const mergedProps = (0, import_react22.useMemo)(
|
|
4481
4500
|
() => __spreadProps(__spreadValues({}, props), {
|
|
@@ -4511,6 +4530,12 @@ function AutoFieldInternal(_a) {
|
|
|
4511
4530
|
});
|
|
4512
4531
|
}
|
|
4513
4532
|
}, []);
|
|
4533
|
+
let Children = (0, import_react22.useMemo)(() => {
|
|
4534
|
+
if (field.type !== "custom" && field.type !== "slot") {
|
|
4535
|
+
return defaultFields[field.type];
|
|
4536
|
+
}
|
|
4537
|
+
return (_props) => null;
|
|
4538
|
+
}, [field.type]);
|
|
4514
4539
|
let FieldComponent = (0, import_react22.useMemo)(() => {
|
|
4515
4540
|
if (field.type === "custom") {
|
|
4516
4541
|
if (!field.render) {
|
|
@@ -4520,14 +4545,8 @@ function AutoFieldInternal(_a) {
|
|
|
4520
4545
|
} else {
|
|
4521
4546
|
return render[field.type];
|
|
4522
4547
|
}
|
|
4523
|
-
}, [field,
|
|
4548
|
+
}, [field.type, render]);
|
|
4524
4549
|
const { visible = true } = props.field;
|
|
4525
|
-
let Children = (0, import_react22.useMemo)(() => {
|
|
4526
|
-
if (field.type !== "custom" && field.type !== "slot") {
|
|
4527
|
-
return defaultFields[field.type];
|
|
4528
|
-
}
|
|
4529
|
-
return () => null;
|
|
4530
|
-
}, [field]);
|
|
4531
4550
|
if (!visible) {
|
|
4532
4551
|
return null;
|
|
4533
4552
|
}
|
|
@@ -5523,13 +5542,212 @@ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
|
5523
5542
|
return mergedProps;
|
|
5524
5543
|
}
|
|
5525
5544
|
|
|
5526
|
-
// lib/field-transforms/default-transforms.tsx
|
|
5545
|
+
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
5527
5546
|
init_react_import();
|
|
5547
|
+
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
5548
|
+
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
5549
|
+
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
5550
|
+
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
5551
|
+
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
5552
|
+
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
5553
|
+
}, dzProps), {
|
|
5554
|
+
zone: propName,
|
|
5555
|
+
content
|
|
5556
|
+
}));
|
|
5557
|
+
return Slot;
|
|
5558
|
+
}
|
|
5559
|
+
});
|
|
5528
5560
|
|
|
5529
|
-
//
|
|
5561
|
+
// lib/use-slots.tsx
|
|
5562
|
+
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
5563
|
+
return useFieldTransforms(
|
|
5564
|
+
config,
|
|
5565
|
+
item,
|
|
5566
|
+
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
5567
|
+
readOnly,
|
|
5568
|
+
forceReadOnly
|
|
5569
|
+
);
|
|
5570
|
+
}
|
|
5571
|
+
|
|
5572
|
+
// components/Render/index.tsx
|
|
5573
|
+
var import_react34 = __toESM(require("react"));
|
|
5574
|
+
|
|
5575
|
+
// components/SlotRender/index.tsx
|
|
5576
|
+
init_react_import();
|
|
5577
|
+
var import_shallow4 = require("zustand/react/shallow");
|
|
5578
|
+
|
|
5579
|
+
// components/SlotRender/server.tsx
|
|
5530
5580
|
init_react_import();
|
|
5531
5581
|
var import_react33 = require("react");
|
|
5532
5582
|
|
|
5583
|
+
// components/ServerRender/index.tsx
|
|
5584
|
+
init_react_import();
|
|
5585
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5586
|
+
function DropZoneRender({
|
|
5587
|
+
zone,
|
|
5588
|
+
data,
|
|
5589
|
+
areaId = "root",
|
|
5590
|
+
config,
|
|
5591
|
+
metadata = {}
|
|
5592
|
+
}) {
|
|
5593
|
+
let zoneCompound = rootDroppableId;
|
|
5594
|
+
let content = (data == null ? void 0 : data.content) || [];
|
|
5595
|
+
if (!data || !config) {
|
|
5596
|
+
return null;
|
|
5597
|
+
}
|
|
5598
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
5599
|
+
zoneCompound = `${areaId}:${zone}`;
|
|
5600
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5601
|
+
}
|
|
5602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: content.map((item) => {
|
|
5603
|
+
const Component = config.components[item.type];
|
|
5604
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
5605
|
+
puck: {
|
|
5606
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5607
|
+
DropZoneRender,
|
|
5608
|
+
{
|
|
5609
|
+
zone: zone2,
|
|
5610
|
+
data,
|
|
5611
|
+
areaId: item.props.id,
|
|
5612
|
+
config,
|
|
5613
|
+
metadata
|
|
5614
|
+
}
|
|
5615
|
+
),
|
|
5616
|
+
metadata,
|
|
5617
|
+
dragRef: null,
|
|
5618
|
+
isEditing: false
|
|
5619
|
+
}
|
|
5620
|
+
});
|
|
5621
|
+
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
5622
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
5623
|
+
if (Component) {
|
|
5624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
5625
|
+
}
|
|
5626
|
+
return null;
|
|
5627
|
+
}) });
|
|
5628
|
+
}
|
|
5629
|
+
|
|
5630
|
+
// components/SlotRender/server.tsx
|
|
5631
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5632
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlotRender, __spreadValues({}, props));
|
|
5633
|
+
var Item = ({
|
|
5634
|
+
config,
|
|
5635
|
+
item,
|
|
5636
|
+
metadata
|
|
5637
|
+
}) => {
|
|
5638
|
+
const Component = config.components[item.type];
|
|
5639
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5641
|
+
Component.render,
|
|
5642
|
+
__spreadProps(__spreadValues({}, props), {
|
|
5643
|
+
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
5644
|
+
renderDropZone: DropZoneRender,
|
|
5645
|
+
metadata: metadata || {}
|
|
5646
|
+
})
|
|
5647
|
+
})
|
|
5648
|
+
);
|
|
5649
|
+
};
|
|
5650
|
+
var SlotRender = (0, import_react33.forwardRef)(
|
|
5651
|
+
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
5653
|
+
if (!config.components[item.type]) {
|
|
5654
|
+
return null;
|
|
5655
|
+
}
|
|
5656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5657
|
+
Item,
|
|
5658
|
+
{
|
|
5659
|
+
config,
|
|
5660
|
+
item,
|
|
5661
|
+
metadata
|
|
5662
|
+
},
|
|
5663
|
+
item.props.id
|
|
5664
|
+
);
|
|
5665
|
+
}) });
|
|
5666
|
+
}
|
|
5667
|
+
);
|
|
5668
|
+
|
|
5669
|
+
// components/SlotRender/index.tsx
|
|
5670
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5671
|
+
var ContextSlotRender = ({
|
|
5672
|
+
componentId,
|
|
5673
|
+
zone
|
|
5674
|
+
}) => {
|
|
5675
|
+
const config = useAppStore((s) => s.config);
|
|
5676
|
+
const metadata = useAppStore((s) => s.metadata);
|
|
5677
|
+
const slotContent = useAppStore(
|
|
5678
|
+
(0, import_shallow4.useShallow)((s) => {
|
|
5679
|
+
var _a, _b;
|
|
5680
|
+
const indexes = s.state.indexes;
|
|
5681
|
+
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5682
|
+
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
5683
|
+
})
|
|
5684
|
+
);
|
|
5685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5686
|
+
SlotRenderPure,
|
|
5687
|
+
{
|
|
5688
|
+
content: slotContent,
|
|
5689
|
+
zone,
|
|
5690
|
+
config,
|
|
5691
|
+
metadata
|
|
5692
|
+
}
|
|
5693
|
+
);
|
|
5694
|
+
};
|
|
5695
|
+
|
|
5696
|
+
// components/Render/index.tsx
|
|
5697
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5698
|
+
var renderContext = import_react34.default.createContext({
|
|
5699
|
+
config: { components: {} },
|
|
5700
|
+
data: { root: {}, content: [] },
|
|
5701
|
+
metadata: {}
|
|
5702
|
+
});
|
|
5703
|
+
function Render({
|
|
5704
|
+
config,
|
|
5705
|
+
data,
|
|
5706
|
+
metadata = {}
|
|
5707
|
+
}) {
|
|
5708
|
+
var _a;
|
|
5709
|
+
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
5710
|
+
root: data.root || {},
|
|
5711
|
+
content: data.content || []
|
|
5712
|
+
});
|
|
5713
|
+
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
|
5714
|
+
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5715
|
+
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
|
5716
|
+
puck: {
|
|
5717
|
+
renderDropZone: DropZonePure,
|
|
5718
|
+
isEditing: false,
|
|
5719
|
+
dragRef: null,
|
|
5720
|
+
metadata
|
|
5721
|
+
},
|
|
5722
|
+
title,
|
|
5723
|
+
editMode: false,
|
|
5724
|
+
id: "puck-root"
|
|
5725
|
+
});
|
|
5726
|
+
const propsWithSlots = useSlots(
|
|
5727
|
+
config,
|
|
5728
|
+
{ type: "root", props: pageProps },
|
|
5729
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5730
|
+
);
|
|
5731
|
+
const nextContextValue = (0, import_react34.useMemo)(
|
|
5732
|
+
() => ({
|
|
5733
|
+
mode: "render",
|
|
5734
|
+
depth: 0
|
|
5735
|
+
}),
|
|
5736
|
+
[]
|
|
5737
|
+
);
|
|
5738
|
+
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5740
|
+
}
|
|
5741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5742
|
+
}
|
|
5743
|
+
|
|
5744
|
+
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
5745
|
+
init_react_import();
|
|
5746
|
+
|
|
5747
|
+
// components/InlineTextField/index.tsx
|
|
5748
|
+
init_react_import();
|
|
5749
|
+
var import_react35 = require("react");
|
|
5750
|
+
|
|
5533
5751
|
// lib/overlay-portal/index.tsx
|
|
5534
5752
|
init_react_import();
|
|
5535
5753
|
var registerOverlayPortal = (el, opts = {}) => {
|
|
@@ -5616,8 +5834,18 @@ function setDeep(node, path, newVal) {
|
|
|
5616
5834
|
return __spreadValues(__spreadValues({}, node), newNode);
|
|
5617
5835
|
}
|
|
5618
5836
|
|
|
5837
|
+
// lib/get-selector-for-id.ts
|
|
5838
|
+
init_react_import();
|
|
5839
|
+
var getSelectorForId = (state, id) => {
|
|
5840
|
+
const node = state.indexes.nodes[id];
|
|
5841
|
+
if (!node) return;
|
|
5842
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
5843
|
+
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
5844
|
+
return { zone: zoneCompound, index };
|
|
5845
|
+
};
|
|
5846
|
+
|
|
5619
5847
|
// components/InlineTextField/index.tsx
|
|
5620
|
-
var
|
|
5848
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5621
5849
|
var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
|
|
5622
5850
|
var InlineTextFieldInternal = ({
|
|
5623
5851
|
propPath,
|
|
@@ -5627,10 +5855,10 @@ var InlineTextFieldInternal = ({
|
|
|
5627
5855
|
opts = {}
|
|
5628
5856
|
}) => {
|
|
5629
5857
|
var _a;
|
|
5630
|
-
const ref = (0,
|
|
5858
|
+
const ref = (0, import_react35.useRef)(null);
|
|
5631
5859
|
const appStoreApi = useAppStoreApi();
|
|
5632
5860
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
5633
|
-
(0,
|
|
5861
|
+
(0, import_react35.useEffect)(() => {
|
|
5634
5862
|
const appStore = appStoreApi.getState();
|
|
5635
5863
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
5636
5864
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -5672,9 +5900,9 @@ var InlineTextFieldInternal = ({
|
|
|
5672
5900
|
};
|
|
5673
5901
|
}
|
|
5674
5902
|
}, [appStoreApi, ref.current, value]);
|
|
5675
|
-
const [isHovering, setIsHovering] = (0,
|
|
5676
|
-
const [isFocused, setIsFocused] = (0,
|
|
5677
|
-
return /* @__PURE__ */ (0,
|
|
5903
|
+
const [isHovering, setIsHovering] = (0, import_react35.useState)(false);
|
|
5904
|
+
const [isFocused, setIsFocused] = (0, import_react35.useState)(false);
|
|
5905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5678
5906
|
"span",
|
|
5679
5907
|
{
|
|
5680
5908
|
className: getClassName17(),
|
|
@@ -5687,12 +5915,22 @@ var InlineTextFieldInternal = ({
|
|
|
5687
5915
|
onClickCapture: (e) => {
|
|
5688
5916
|
e.preventDefault();
|
|
5689
5917
|
e.stopPropagation();
|
|
5918
|
+
const itemSelector = getSelectorForId(
|
|
5919
|
+
appStoreApi.getState().state,
|
|
5920
|
+
componentId
|
|
5921
|
+
);
|
|
5922
|
+
appStoreApi.getState().setUi({ itemSelector });
|
|
5690
5923
|
},
|
|
5691
5924
|
onKeyDown: (e) => {
|
|
5925
|
+
e.stopPropagation();
|
|
5692
5926
|
if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
|
|
5693
5927
|
e.preventDefault();
|
|
5694
5928
|
}
|
|
5695
5929
|
},
|
|
5930
|
+
onKeyUp: (e) => {
|
|
5931
|
+
e.stopPropagation();
|
|
5932
|
+
e.preventDefault();
|
|
5933
|
+
},
|
|
5696
5934
|
onMouseOverCapture: () => setIsHovering(true),
|
|
5697
5935
|
onMouseOutCapture: () => setIsHovering(false),
|
|
5698
5936
|
onFocus: () => setIsFocused(true),
|
|
@@ -5700,27 +5938,14 @@ var InlineTextFieldInternal = ({
|
|
|
5700
5938
|
}
|
|
5701
5939
|
);
|
|
5702
5940
|
};
|
|
5703
|
-
var InlineTextField = (0,
|
|
5941
|
+
var InlineTextField = (0, import_react35.memo)(InlineTextFieldInternal);
|
|
5704
5942
|
|
|
5705
|
-
// lib/field-transforms/default-transforms.tsx
|
|
5706
|
-
var
|
|
5707
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
5708
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
5709
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
5710
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
5711
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
5712
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
5713
|
-
}, dzProps), {
|
|
5714
|
-
zone: propName,
|
|
5715
|
-
content
|
|
5716
|
-
}));
|
|
5717
|
-
return Slot;
|
|
5718
|
-
}
|
|
5719
|
-
});
|
|
5943
|
+
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
5944
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5720
5945
|
var getInlineTextTransform = () => ({
|
|
5721
5946
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5722
5947
|
if (field.contentEditable) {
|
|
5723
|
-
return /* @__PURE__ */ (0,
|
|
5948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5724
5949
|
InlineTextField,
|
|
5725
5950
|
{
|
|
5726
5951
|
propPath,
|
|
@@ -5735,7 +5960,7 @@ var getInlineTextTransform = () => ({
|
|
|
5735
5960
|
},
|
|
5736
5961
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5737
5962
|
if (field.contentEditable) {
|
|
5738
|
-
return /* @__PURE__ */ (0,
|
|
5963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5739
5964
|
InlineTextField,
|
|
5740
5965
|
{
|
|
5741
5966
|
propPath,
|
|
@@ -5749,7 +5974,7 @@ var getInlineTextTransform = () => ({
|
|
|
5749
5974
|
},
|
|
5750
5975
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
5751
5976
|
if (field.contentEditable && typeof value === "string") {
|
|
5752
|
-
return /* @__PURE__ */ (0,
|
|
5977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5753
5978
|
InlineTextField,
|
|
5754
5979
|
{
|
|
5755
5980
|
propPath,
|
|
@@ -5763,189 +5988,6 @@ var getInlineTextTransform = () => ({
|
|
|
5763
5988
|
}
|
|
5764
5989
|
});
|
|
5765
5990
|
|
|
5766
|
-
// lib/use-slots.tsx
|
|
5767
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
5768
|
-
return useFieldTransforms(
|
|
5769
|
-
config,
|
|
5770
|
-
item,
|
|
5771
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
5772
|
-
readOnly,
|
|
5773
|
-
forceReadOnly
|
|
5774
|
-
);
|
|
5775
|
-
}
|
|
5776
|
-
|
|
5777
|
-
// components/Render/index.tsx
|
|
5778
|
-
var import_react35 = __toESM(require("react"));
|
|
5779
|
-
|
|
5780
|
-
// components/SlotRender/index.tsx
|
|
5781
|
-
init_react_import();
|
|
5782
|
-
var import_shallow4 = require("zustand/react/shallow");
|
|
5783
|
-
|
|
5784
|
-
// components/SlotRender/server.tsx
|
|
5785
|
-
init_react_import();
|
|
5786
|
-
var import_react34 = require("react");
|
|
5787
|
-
|
|
5788
|
-
// components/ServerRender/index.tsx
|
|
5789
|
-
init_react_import();
|
|
5790
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
5791
|
-
function DropZoneRender({
|
|
5792
|
-
zone,
|
|
5793
|
-
data,
|
|
5794
|
-
areaId = "root",
|
|
5795
|
-
config,
|
|
5796
|
-
metadata = {}
|
|
5797
|
-
}) {
|
|
5798
|
-
let zoneCompound = rootDroppableId;
|
|
5799
|
-
let content = (data == null ? void 0 : data.content) || [];
|
|
5800
|
-
if (!data || !config) {
|
|
5801
|
-
return null;
|
|
5802
|
-
}
|
|
5803
|
-
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
5804
|
-
zoneCompound = `${areaId}:${zone}`;
|
|
5805
|
-
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5806
|
-
}
|
|
5807
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: content.map((item) => {
|
|
5808
|
-
const Component = config.components[item.type];
|
|
5809
|
-
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
5810
|
-
puck: {
|
|
5811
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5812
|
-
DropZoneRender,
|
|
5813
|
-
{
|
|
5814
|
-
zone: zone2,
|
|
5815
|
-
data,
|
|
5816
|
-
areaId: item.props.id,
|
|
5817
|
-
config,
|
|
5818
|
-
metadata
|
|
5819
|
-
}
|
|
5820
|
-
),
|
|
5821
|
-
metadata,
|
|
5822
|
-
dragRef: null,
|
|
5823
|
-
isEditing: false
|
|
5824
|
-
}
|
|
5825
|
-
});
|
|
5826
|
-
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
5827
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
5828
|
-
if (Component) {
|
|
5829
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
5830
|
-
}
|
|
5831
|
-
return null;
|
|
5832
|
-
}) });
|
|
5833
|
-
}
|
|
5834
|
-
|
|
5835
|
-
// components/SlotRender/server.tsx
|
|
5836
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5837
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRender, __spreadValues({}, props));
|
|
5838
|
-
var Item = ({
|
|
5839
|
-
config,
|
|
5840
|
-
item,
|
|
5841
|
-
metadata
|
|
5842
|
-
}) => {
|
|
5843
|
-
const Component = config.components[item.type];
|
|
5844
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5845
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5846
|
-
Component.render,
|
|
5847
|
-
__spreadProps(__spreadValues({}, props), {
|
|
5848
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
5849
|
-
renderDropZone: DropZoneRender,
|
|
5850
|
-
metadata: metadata || {}
|
|
5851
|
-
})
|
|
5852
|
-
})
|
|
5853
|
-
);
|
|
5854
|
-
};
|
|
5855
|
-
var SlotRender = (0, import_react34.forwardRef)(
|
|
5856
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
5857
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
|
|
5858
|
-
if (!config.components[item.type]) {
|
|
5859
|
-
return null;
|
|
5860
|
-
}
|
|
5861
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5862
|
-
Item,
|
|
5863
|
-
{
|
|
5864
|
-
config,
|
|
5865
|
-
item,
|
|
5866
|
-
metadata
|
|
5867
|
-
},
|
|
5868
|
-
item.props.id
|
|
5869
|
-
);
|
|
5870
|
-
}) });
|
|
5871
|
-
}
|
|
5872
|
-
);
|
|
5873
|
-
|
|
5874
|
-
// components/SlotRender/index.tsx
|
|
5875
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5876
|
-
var ContextSlotRender = ({
|
|
5877
|
-
componentId,
|
|
5878
|
-
zone
|
|
5879
|
-
}) => {
|
|
5880
|
-
const config = useAppStore((s) => s.config);
|
|
5881
|
-
const metadata = useAppStore((s) => s.metadata);
|
|
5882
|
-
const slotContent = useAppStore(
|
|
5883
|
-
(0, import_shallow4.useShallow)((s) => {
|
|
5884
|
-
var _a, _b;
|
|
5885
|
-
const indexes = s.state.indexes;
|
|
5886
|
-
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5887
|
-
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
5888
|
-
})
|
|
5889
|
-
);
|
|
5890
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5891
|
-
SlotRenderPure,
|
|
5892
|
-
{
|
|
5893
|
-
content: slotContent,
|
|
5894
|
-
zone,
|
|
5895
|
-
config,
|
|
5896
|
-
metadata
|
|
5897
|
-
}
|
|
5898
|
-
);
|
|
5899
|
-
};
|
|
5900
|
-
|
|
5901
|
-
// components/Render/index.tsx
|
|
5902
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5903
|
-
var renderContext = import_react35.default.createContext({
|
|
5904
|
-
config: { components: {} },
|
|
5905
|
-
data: { root: {}, content: [] },
|
|
5906
|
-
metadata: {}
|
|
5907
|
-
});
|
|
5908
|
-
function Render({
|
|
5909
|
-
config,
|
|
5910
|
-
data,
|
|
5911
|
-
metadata = {}
|
|
5912
|
-
}) {
|
|
5913
|
-
var _a;
|
|
5914
|
-
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
|
5915
|
-
root: data.root || {},
|
|
5916
|
-
content: data.content || []
|
|
5917
|
-
});
|
|
5918
|
-
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
|
5919
|
-
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
|
5920
|
-
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
|
5921
|
-
puck: {
|
|
5922
|
-
renderDropZone: DropZonePure,
|
|
5923
|
-
isEditing: false,
|
|
5924
|
-
dragRef: null,
|
|
5925
|
-
metadata
|
|
5926
|
-
},
|
|
5927
|
-
title,
|
|
5928
|
-
editMode: false,
|
|
5929
|
-
id: "puck-root"
|
|
5930
|
-
});
|
|
5931
|
-
const propsWithSlots = useSlots(
|
|
5932
|
-
config,
|
|
5933
|
-
{ type: "root", props: pageProps },
|
|
5934
|
-
(props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5935
|
-
);
|
|
5936
|
-
const nextContextValue = (0, import_react35.useMemo)(
|
|
5937
|
-
() => ({
|
|
5938
|
-
mode: "render",
|
|
5939
|
-
depth: 0
|
|
5940
|
-
}),
|
|
5941
|
-
[]
|
|
5942
|
-
);
|
|
5943
|
-
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
5944
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5945
|
-
}
|
|
5946
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5947
|
-
}
|
|
5948
|
-
|
|
5949
5991
|
// components/DropZone/index.tsx
|
|
5950
5992
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5951
5993
|
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
|
@@ -7538,7 +7580,14 @@ var useComponentList = () => {
|
|
|
7538
7580
|
|
|
7539
7581
|
// components/Puck/components/Components/index.tsx
|
|
7540
7582
|
var import_react45 = require("react");
|
|
7583
|
+
|
|
7584
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Components/styles.module.css#css-module
|
|
7585
|
+
init_react_import();
|
|
7586
|
+
var styles_module_default16 = { "Components": "_Components_uwdh8_1" };
|
|
7587
|
+
|
|
7588
|
+
// components/Puck/components/Components/index.tsx
|
|
7541
7589
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7590
|
+
var getClassName22 = get_class_name_factory_default("Components", styles_module_default16);
|
|
7542
7591
|
var Components = () => {
|
|
7543
7592
|
const overrides = useAppStore((s) => s.overrides);
|
|
7544
7593
|
const componentList = useComponentList();
|
|
@@ -7550,7 +7599,7 @@ var Components = () => {
|
|
|
7550
7599
|
}
|
|
7551
7600
|
return overrides.components || overrides.drawer || "div";
|
|
7552
7601
|
}, [overrides]);
|
|
7553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComponentList, { id: "all" }) });
|
|
7602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName22(), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComponentList, { id: "all" }) }) });
|
|
7554
7603
|
};
|
|
7555
7604
|
|
|
7556
7605
|
// components/Puck/components/Preview/index.tsx
|
|
@@ -7842,11 +7891,11 @@ var AutoFrame_default = AutoFrame;
|
|
|
7842
7891
|
|
|
7843
7892
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
|
7844
7893
|
init_react_import();
|
|
7845
|
-
var
|
|
7894
|
+
var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
|
7846
7895
|
|
|
7847
7896
|
// components/Puck/components/Preview/index.tsx
|
|
7848
7897
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7849
|
-
var
|
|
7898
|
+
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default17);
|
|
7850
7899
|
var useBubbleIframeEvents = (ref) => {
|
|
7851
7900
|
const status = useAppStore((s) => s.status);
|
|
7852
7901
|
(0, import_react47.useEffect)(() => {
|
|
@@ -7937,7 +7986,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7937
7986
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7938
7987
|
"div",
|
|
7939
7988
|
{
|
|
7940
|
-
className:
|
|
7989
|
+
className: getClassName23(),
|
|
7941
7990
|
id,
|
|
7942
7991
|
"data-puck-preview": true,
|
|
7943
7992
|
onClick: (e) => {
|
|
@@ -7950,7 +7999,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7950
7999
|
AutoFrame_default,
|
|
7951
8000
|
{
|
|
7952
8001
|
id: "preview-frame",
|
|
7953
|
-
className:
|
|
8002
|
+
className: getClassName23("frame"),
|
|
7954
8003
|
"data-rfd-iframe": true,
|
|
7955
8004
|
onReady: () => {
|
|
7956
8005
|
setStatus("READY");
|
|
@@ -7970,7 +8019,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
7970
8019
|
"div",
|
|
7971
8020
|
{
|
|
7972
8021
|
id: "preview-frame",
|
|
7973
|
-
className:
|
|
8022
|
+
className: getClassName23("frame"),
|
|
7974
8023
|
ref,
|
|
7975
8024
|
"data-puck-entry": true,
|
|
7976
8025
|
children: inner
|
|
@@ -7988,7 +8037,7 @@ init_react_import();
|
|
|
7988
8037
|
|
|
7989
8038
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
|
7990
8039
|
init_react_import();
|
|
7991
|
-
var
|
|
8040
|
+
var styles_module_default18 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
|
|
7992
8041
|
|
|
7993
8042
|
// lib/scroll-into-view.ts
|
|
7994
8043
|
init_react_import();
|
|
@@ -8026,8 +8075,8 @@ var onScrollEnd = (frame, cb) => {
|
|
|
8026
8075
|
// components/LayerTree/index.tsx
|
|
8027
8076
|
var import_shallow7 = require("zustand/react/shallow");
|
|
8028
8077
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8029
|
-
var
|
|
8030
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
|
8078
|
+
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default18);
|
|
8079
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
|
|
8031
8080
|
var Layer = ({
|
|
8032
8081
|
index,
|
|
8033
8082
|
itemId,
|
|
@@ -8162,12 +8211,12 @@ var LayerTree = ({
|
|
|
8162
8211
|
)
|
|
8163
8212
|
);
|
|
8164
8213
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
8165
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className:
|
|
8166
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className:
|
|
8214
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
|
8215
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Layers, { size: "16" }) }),
|
|
8167
8216
|
label
|
|
8168
8217
|
] }),
|
|
8169
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("ul", { className:
|
|
8170
|
-
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className:
|
|
8218
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("ul", { className: getClassName24(), children: [
|
|
8219
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
|
8171
8220
|
contentIds.map((itemId, i) => {
|
|
8172
8221
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8173
8222
|
Layer,
|
|
@@ -8196,21 +8245,28 @@ var findZonesForArea = (state, area) => {
|
|
|
8196
8245
|
|
|
8197
8246
|
// components/Puck/components/Outline/index.tsx
|
|
8198
8247
|
var import_shallow8 = require("zustand/react/shallow");
|
|
8248
|
+
|
|
8249
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Outline/styles.module.css#css-module
|
|
8250
|
+
init_react_import();
|
|
8251
|
+
var styles_module_default19 = { "Outline": "_Outline_1rrni_1" };
|
|
8252
|
+
|
|
8253
|
+
// components/Puck/components/Outline/index.tsx
|
|
8199
8254
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8255
|
+
var getClassName25 = get_class_name_factory_default("Outline", styles_module_default19);
|
|
8200
8256
|
var Outline = () => {
|
|
8201
8257
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
8202
8258
|
const rootZones = useAppStore(
|
|
8203
8259
|
(0, import_shallow8.useShallow)((s) => findZonesForArea(s.state, "root"))
|
|
8204
8260
|
);
|
|
8205
8261
|
const Wrapper = (0, import_react49.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
|
8206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25(), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8207
8263
|
LayerTree,
|
|
8208
8264
|
{
|
|
8209
8265
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
8210
8266
|
zoneCompound
|
|
8211
8267
|
},
|
|
8212
8268
|
zoneCompound
|
|
8213
|
-
)) });
|
|
8269
|
+
)) }) });
|
|
8214
8270
|
};
|
|
8215
8271
|
|
|
8216
8272
|
// lib/use-loaded-overrides.ts
|
|
@@ -8287,13 +8343,7 @@ var generateUsePuck = (store) => {
|
|
|
8287
8343
|
selectedItem: store.selectedItem || null,
|
|
8288
8344
|
getItemBySelector: (selector) => getItem(selector, store.state),
|
|
8289
8345
|
getItemById: (id) => store.state.indexes.nodes[id].data,
|
|
8290
|
-
getSelectorForId: (id) =>
|
|
8291
|
-
const node = store.state.indexes.nodes[id];
|
|
8292
|
-
if (!node) return;
|
|
8293
|
-
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
8294
|
-
const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
8295
|
-
return { zone: zoneCompound, index };
|
|
8296
|
-
}
|
|
8346
|
+
getSelectorForId: (id) => getSelectorForId(store.state, id)
|
|
8297
8347
|
};
|
|
8298
8348
|
return storeData;
|
|
8299
8349
|
};
|
|
@@ -8356,7 +8406,7 @@ function useGetPuck() {
|
|
|
8356
8406
|
}
|
|
8357
8407
|
|
|
8358
8408
|
// components/Puck/index.tsx
|
|
8359
|
-
var
|
|
8409
|
+
var import_fast_deep_equal4 = __toESM(require("fast-deep-equal"));
|
|
8360
8410
|
|
|
8361
8411
|
// components/Puck/components/Layout/index.tsx
|
|
8362
8412
|
init_react_import();
|
|
@@ -8364,7 +8414,7 @@ var import_react61 = require("react");
|
|
|
8364
8414
|
|
|
8365
8415
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
|
|
8366
8416
|
init_react_import();
|
|
8367
|
-
var
|
|
8417
|
+
var styles_module_default20 = { "Puck": "_Puck_94wda_19", "Puck-portal": "_Puck-portal_94wda_31", "PuckLayout-inner": "_PuckLayout-inner_94wda_36", "PuckLayout--mounted": "_PuckLayout--mounted_94wda_57", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_94wda_61", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_94wda_69", "PuckLayout-mounted": "_PuckLayout-mounted_94wda_85", "PuckLayout": "_PuckLayout_94wda_36", "PuckLayout-nav": "_PuckLayout-nav_94wda_126", "PuckPluginTab": "_PuckPluginTab_94wda_131", "PuckPluginTab--visible": "_PuckPluginTab--visible_94wda_136" };
|
|
8368
8418
|
|
|
8369
8419
|
// lib/use-inject-css.ts
|
|
8370
8420
|
init_react_import();
|
|
@@ -8425,11 +8475,11 @@ init_react_import();
|
|
|
8425
8475
|
|
|
8426
8476
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
|
8427
8477
|
init_react_import();
|
|
8428
|
-
var
|
|
8478
|
+
var styles_module_default21 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
|
8429
8479
|
|
|
8430
8480
|
// components/MenuBar/index.tsx
|
|
8431
8481
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8432
|
-
var
|
|
8482
|
+
var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
|
|
8433
8483
|
function MenuBar({
|
|
8434
8484
|
menuOpen = false,
|
|
8435
8485
|
renderHeaderActions,
|
|
@@ -8442,7 +8492,7 @@ function MenuBar({
|
|
|
8442
8492
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8443
8493
|
"div",
|
|
8444
8494
|
{
|
|
8445
|
-
className:
|
|
8495
|
+
className: getClassName26({ menuOpen }),
|
|
8446
8496
|
onClick: (event) => {
|
|
8447
8497
|
var _a;
|
|
8448
8498
|
const element = event.target;
|
|
@@ -8453,8 +8503,8 @@ function MenuBar({
|
|
|
8453
8503
|
setMenuOpen(false);
|
|
8454
8504
|
}
|
|
8455
8505
|
},
|
|
8456
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className:
|
|
8457
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className:
|
|
8506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("inner"), children: [
|
|
8507
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("history"), children: [
|
|
8458
8508
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8459
8509
|
IconButton,
|
|
8460
8510
|
{
|
|
@@ -8484,11 +8534,11 @@ function MenuBar({
|
|
|
8484
8534
|
|
|
8485
8535
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
|
|
8486
8536
|
init_react_import();
|
|
8487
|
-
var
|
|
8537
|
+
var styles_module_default22 = { "PuckHeader": "_PuckHeader_1ehbp_1", "PuckHeader-inner": "_PuckHeader-inner_1ehbp_16", "PuckHeader-toggle": "_PuckHeader-toggle_1ehbp_33", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_1ehbp_40", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_1ehbp_40", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_1ehbp_41", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_1ehbp_41", "PuckHeader-title": "_PuckHeader-title_1ehbp_45", "PuckHeader-path": "_PuckHeader-path_1ehbp_49", "PuckHeader-tools": "_PuckHeader-tools_1ehbp_56", "PuckHeader-menuButton": "_PuckHeader-menuButton_1ehbp_62", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_1ehbp_67" };
|
|
8488
8538
|
|
|
8489
8539
|
// components/Puck/components/Header/index.tsx
|
|
8490
8540
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8491
|
-
var
|
|
8541
|
+
var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
|
|
8492
8542
|
var HeaderInner = () => {
|
|
8493
8543
|
const {
|
|
8494
8544
|
onPublish,
|
|
@@ -8528,7 +8578,7 @@ var HeaderInner = () => {
|
|
|
8528
8578
|
return RenderHeader;
|
|
8529
8579
|
}
|
|
8530
8580
|
return DefaultOverride;
|
|
8531
|
-
}, [
|
|
8581
|
+
}, [renderHeaderActions]);
|
|
8532
8582
|
const CustomHeader = useAppStore(
|
|
8533
8583
|
(s) => s.overrides.header || defaultHeaderRender
|
|
8534
8584
|
);
|
|
@@ -8576,10 +8626,10 @@ var HeaderInner = () => {
|
|
|
8576
8626
|
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8577
8627
|
"header",
|
|
8578
8628
|
{
|
|
8579
|
-
className:
|
|
8580
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className:
|
|
8581
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className:
|
|
8582
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className:
|
|
8629
|
+
className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
|
|
8630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("inner"), children: [
|
|
8631
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("toggle"), children: [
|
|
8632
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8583
8633
|
IconButton,
|
|
8584
8634
|
{
|
|
8585
8635
|
type: "button",
|
|
@@ -8590,7 +8640,7 @@ var HeaderInner = () => {
|
|
|
8590
8640
|
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
|
|
8591
8641
|
}
|
|
8592
8642
|
) }),
|
|
8593
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className:
|
|
8643
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8594
8644
|
IconButton,
|
|
8595
8645
|
{
|
|
8596
8646
|
type: "button",
|
|
@@ -8602,15 +8652,15 @@ var HeaderInner = () => {
|
|
|
8602
8652
|
}
|
|
8603
8653
|
) })
|
|
8604
8654
|
] }),
|
|
8605
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className:
|
|
8655
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("title"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
|
8606
8656
|
headerTitle || rootTitle || "Page",
|
|
8607
8657
|
headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
8608
8658
|
" ",
|
|
8609
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className:
|
|
8659
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: getClassName27("path"), children: headerPath })
|
|
8610
8660
|
] })
|
|
8611
8661
|
] }) }),
|
|
8612
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className:
|
|
8613
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className:
|
|
8662
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("tools"), children: [
|
|
8663
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8614
8664
|
IconButton,
|
|
8615
8665
|
{
|
|
8616
8666
|
type: "button",
|
|
@@ -8655,7 +8705,7 @@ init_react_import();
|
|
|
8655
8705
|
|
|
8656
8706
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
8657
8707
|
init_react_import();
|
|
8658
|
-
var
|
|
8708
|
+
var styles_module_default23 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
|
|
8659
8709
|
|
|
8660
8710
|
// lib/use-breadcrumbs.ts
|
|
8661
8711
|
init_react_import();
|
|
@@ -8703,7 +8753,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
8703
8753
|
|
|
8704
8754
|
// components/SidebarSection/index.tsx
|
|
8705
8755
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8706
|
-
var
|
|
8756
|
+
var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default23);
|
|
8707
8757
|
var SidebarSection = ({
|
|
8708
8758
|
children,
|
|
8709
8759
|
title,
|
|
@@ -8718,26 +8768,26 @@ var SidebarSection = ({
|
|
|
8718
8768
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
8719
8769
|
"div",
|
|
8720
8770
|
{
|
|
8721
|
-
className:
|
|
8771
|
+
className: getClassName28({ noBorderTop, noPadding }),
|
|
8722
8772
|
style: { background },
|
|
8723
8773
|
children: [
|
|
8724
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className:
|
|
8725
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className:
|
|
8774
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName28("title"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassName28("breadcrumbs"), children: [
|
|
8775
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassName28("breadcrumb"), children: [
|
|
8726
8776
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8727
8777
|
"button",
|
|
8728
8778
|
{
|
|
8729
8779
|
type: "button",
|
|
8730
|
-
className:
|
|
8780
|
+
className: getClassName28("breadcrumbLabel"),
|
|
8731
8781
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
8732
8782
|
children: breadcrumb.label
|
|
8733
8783
|
}
|
|
8734
8784
|
),
|
|
8735
8785
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronRight, { size: 16 })
|
|
8736
8786
|
] }, i)) : null,
|
|
8737
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className:
|
|
8787
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName28("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
8738
8788
|
] }) }),
|
|
8739
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className:
|
|
8740
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className:
|
|
8789
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName28("content"), children }),
|
|
8790
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName28("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Loader, { size: 32 }) })
|
|
8741
8791
|
]
|
|
8742
8792
|
}
|
|
8743
8793
|
);
|
|
@@ -8753,7 +8803,7 @@ var import_react56 = require("react");
|
|
|
8753
8803
|
|
|
8754
8804
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
8755
8805
|
init_react_import();
|
|
8756
|
-
var
|
|
8806
|
+
var styles_module_default24 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
|
|
8757
8807
|
|
|
8758
8808
|
// components/ViewportControls/index.tsx
|
|
8759
8809
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
@@ -8762,8 +8812,8 @@ var icons = {
|
|
|
8762
8812
|
Tablet: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Tablet, { size: 16 }),
|
|
8763
8813
|
Monitor: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Monitor, { size: 16 })
|
|
8764
8814
|
};
|
|
8765
|
-
var
|
|
8766
|
-
var getClassNameButton = get_class_name_factory_default("ViewportButton",
|
|
8815
|
+
var getClassName29 = get_class_name_factory_default("ViewportControls", styles_module_default24);
|
|
8816
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default24);
|
|
8767
8817
|
var ViewportButton = ({
|
|
8768
8818
|
children,
|
|
8769
8819
|
height = "auto",
|
|
@@ -8822,7 +8872,7 @@ var ViewportControls = ({
|
|
|
8822
8872
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
8823
8873
|
[autoZoom]
|
|
8824
8874
|
);
|
|
8825
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className:
|
|
8875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName29(), children: [
|
|
8826
8876
|
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8827
8877
|
ViewportButton,
|
|
8828
8878
|
{
|
|
@@ -8834,7 +8884,7 @@ var ViewportControls = ({
|
|
|
8834
8884
|
},
|
|
8835
8885
|
i
|
|
8836
8886
|
)),
|
|
8837
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
8887
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getClassName29("divider") }),
|
|
8838
8888
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8839
8889
|
IconButton,
|
|
8840
8890
|
{
|
|
@@ -8871,11 +8921,11 @@ var ViewportControls = ({
|
|
|
8871
8921
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ZoomIn, { size: 16 })
|
|
8872
8922
|
}
|
|
8873
8923
|
),
|
|
8874
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className:
|
|
8924
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getClassName29("divider") }),
|
|
8875
8925
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8876
8926
|
"select",
|
|
8877
8927
|
{
|
|
8878
|
-
className:
|
|
8928
|
+
className: getClassName29("zoomSelect"),
|
|
8879
8929
|
value: zoom.toString(),
|
|
8880
8930
|
onChange: (e) => {
|
|
8881
8931
|
onZoom(parseFloat(e.currentTarget.value));
|
|
@@ -8895,7 +8945,7 @@ var ViewportControls = ({
|
|
|
8895
8945
|
|
|
8896
8946
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
|
8897
8947
|
init_react_import();
|
|
8898
|
-
var
|
|
8948
|
+
var styles_module_default25 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
|
|
8899
8949
|
|
|
8900
8950
|
// components/Puck/components/Canvas/index.tsx
|
|
8901
8951
|
var import_shallow9 = require("zustand/react/shallow");
|
|
@@ -8927,7 +8977,7 @@ var useCanvasFrame = () => {
|
|
|
8927
8977
|
|
|
8928
8978
|
// components/Puck/components/Canvas/index.tsx
|
|
8929
8979
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
8930
|
-
var
|
|
8980
|
+
var getClassName30 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
|
|
8931
8981
|
var ZOOM_ON_CHANGE = true;
|
|
8932
8982
|
var TRANSITION_DURATION = 150;
|
|
8933
8983
|
var Canvas = () => {
|
|
@@ -9029,7 +9079,7 @@ var Canvas = () => {
|
|
|
9029
9079
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
9030
9080
|
"div",
|
|
9031
9081
|
{
|
|
9032
|
-
className:
|
|
9082
|
+
className: getClassName30({
|
|
9033
9083
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
9034
9084
|
showLoader
|
|
9035
9085
|
}),
|
|
@@ -9044,7 +9094,7 @@ var Canvas = () => {
|
|
|
9044
9094
|
}
|
|
9045
9095
|
},
|
|
9046
9096
|
children: [
|
|
9047
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className:
|
|
9097
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: getClassName30("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9048
9098
|
ViewportControls,
|
|
9049
9099
|
{
|
|
9050
9100
|
autoZoom: zoomConfig.autoZoom,
|
|
@@ -9074,11 +9124,11 @@ var Canvas = () => {
|
|
|
9074
9124
|
}
|
|
9075
9125
|
}
|
|
9076
9126
|
) }),
|
|
9077
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className:
|
|
9127
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: getClassName30("inner"), ref: frameRef, children: [
|
|
9078
9128
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9079
9129
|
"div",
|
|
9080
9130
|
{
|
|
9081
|
-
className:
|
|
9131
|
+
className: getClassName30("root"),
|
|
9082
9132
|
style: {
|
|
9083
9133
|
width: iframe.enabled ? viewports.current.width : "100%",
|
|
9084
9134
|
height: zoomConfig.rootHeight,
|
|
@@ -9095,7 +9145,7 @@ var Canvas = () => {
|
|
|
9095
9145
|
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Preview2, {}) })
|
|
9096
9146
|
}
|
|
9097
9147
|
),
|
|
9098
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className:
|
|
9148
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: getClassName30("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Loader, { size: 24 }) })
|
|
9099
9149
|
] })
|
|
9100
9150
|
]
|
|
9101
9151
|
}
|
|
@@ -9192,11 +9242,11 @@ var import_react60 = require("react");
|
|
|
9192
9242
|
|
|
9193
9243
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
9194
9244
|
init_react_import();
|
|
9195
|
-
var
|
|
9245
|
+
var styles_module_default26 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
|
|
9196
9246
|
|
|
9197
9247
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
9198
9248
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
9199
|
-
var
|
|
9249
|
+
var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default26);
|
|
9200
9250
|
var ResizeHandle = ({
|
|
9201
9251
|
position,
|
|
9202
9252
|
sidebarRef,
|
|
@@ -9258,7 +9308,7 @@ var ResizeHandle = ({
|
|
|
9258
9308
|
"div",
|
|
9259
9309
|
{
|
|
9260
9310
|
ref: handleRef,
|
|
9261
|
-
className:
|
|
9311
|
+
className: getClassName31({ [position]: true }),
|
|
9262
9312
|
onMouseDown: handleMouseDown
|
|
9263
9313
|
}
|
|
9264
9314
|
);
|
|
@@ -9266,24 +9316,23 @@ var ResizeHandle = ({
|
|
|
9266
9316
|
|
|
9267
9317
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
|
|
9268
9318
|
init_react_import();
|
|
9269
|
-
var
|
|
9319
|
+
var styles_module_default27 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
|
|
9270
9320
|
|
|
9271
9321
|
// components/Puck/components/Sidebar/index.tsx
|
|
9272
9322
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9273
|
-
var
|
|
9323
|
+
var getClassName32 = get_class_name_factory_default("Sidebar", styles_module_default27);
|
|
9274
9324
|
var Sidebar = ({
|
|
9275
9325
|
position,
|
|
9276
9326
|
sidebarRef,
|
|
9277
9327
|
isVisible,
|
|
9278
|
-
width,
|
|
9279
9328
|
onResize,
|
|
9280
9329
|
onResizeEnd,
|
|
9281
9330
|
children
|
|
9282
9331
|
}) => {
|
|
9283
9332
|
if (!isVisible) return null;
|
|
9284
9333
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9285
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { ref: sidebarRef, className:
|
|
9286
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: `${
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { ref: sidebarRef, className: getClassName32({ [position]: true }), children }),
|
|
9335
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9287
9336
|
ResizeHandle,
|
|
9288
9337
|
{
|
|
9289
9338
|
position,
|
|
@@ -9300,13 +9349,13 @@ init_react_import();
|
|
|
9300
9349
|
|
|
9301
9350
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Nav/styles.module.css#css-module
|
|
9302
9351
|
init_react_import();
|
|
9303
|
-
var
|
|
9352
|
+
var styles_module_default28 = { "Nav-list": "_Nav-list_b6txo_1", "NavSection": "_NavSection_b6txo_7", "Nav--slim": "_Nav--slim_b6txo_15", "NavSection-list": "_NavSection-list_b6txo_24", "NavSection-title": "_NavSection-title_b6txo_36", "NavItem-link": "_NavItem-link_b6txo_47", "NavItem-linkIcon": "_NavItem-linkIcon_b6txo_67", "NavItem--active": "_NavItem--active_b6txo_72", "NavItem": "_NavItem_b6txo_47", "NavItem-list": "_NavItem-list_b6txo_91" };
|
|
9304
9353
|
|
|
9305
9354
|
// components/Puck/components/Nav/index.tsx
|
|
9306
9355
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
9307
|
-
var
|
|
9308
|
-
var getClassNameSection = get_class_name_factory_default("NavSection",
|
|
9309
|
-
var getClassNameItem3 = get_class_name_factory_default("NavItem",
|
|
9356
|
+
var getClassName33 = get_class_name_factory_default("Nav", styles_module_default28);
|
|
9357
|
+
var getClassNameSection = get_class_name_factory_default("NavSection", styles_module_default28);
|
|
9358
|
+
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default28);
|
|
9310
9359
|
var MenuItem = ({
|
|
9311
9360
|
label,
|
|
9312
9361
|
icon,
|
|
@@ -9333,7 +9382,7 @@ var Nav = ({
|
|
|
9333
9382
|
navigation,
|
|
9334
9383
|
slim
|
|
9335
9384
|
}) => {
|
|
9336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("nav", { className:
|
|
9385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("nav", { className: getClassName33({ slim }), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { className: getClassName33("list"), children: Object.entries(navigation).map(([key, section]) => {
|
|
9337
9386
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(NavSection, { title: section.title, items: section.items }, key);
|
|
9338
9387
|
}) }) });
|
|
9339
9388
|
};
|
|
@@ -9343,9 +9392,9 @@ init_react_import();
|
|
|
9343
9392
|
|
|
9344
9393
|
// components/Puck/components/Layout/index.tsx
|
|
9345
9394
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
9346
|
-
var
|
|
9347
|
-
var getLayoutClassName = get_class_name_factory_default("PuckLayout",
|
|
9348
|
-
var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab",
|
|
9395
|
+
var getClassName34 = get_class_name_factory_default("Puck", styles_module_default20);
|
|
9396
|
+
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default20);
|
|
9397
|
+
var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default20);
|
|
9349
9398
|
var FieldSideBar = () => {
|
|
9350
9399
|
const title = useAppStore(
|
|
9351
9400
|
(s) => {
|
|
@@ -9436,7 +9485,19 @@ var Layout = ({ children }) => {
|
|
|
9436
9485
|
}
|
|
9437
9486
|
}, [ready, iframe.enabled]);
|
|
9438
9487
|
usePreviewModeHotkeys();
|
|
9439
|
-
const
|
|
9488
|
+
const layoutOptions = {};
|
|
9489
|
+
if (leftWidth) {
|
|
9490
|
+
layoutOptions["--puck-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
9491
|
+
}
|
|
9492
|
+
if (rightWidth) {
|
|
9493
|
+
layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
9494
|
+
}
|
|
9495
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
9496
|
+
const currentPlugin = useAppStore((s) => {
|
|
9497
|
+
var _a;
|
|
9498
|
+
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
9499
|
+
});
|
|
9500
|
+
const appStoreApi = useAppStoreApi();
|
|
9440
9501
|
const pluginItems = (0, import_react61.useMemo)(() => {
|
|
9441
9502
|
const details = {};
|
|
9442
9503
|
const defaultPlugins = [blocksPlugin(), outlinePlugin()];
|
|
@@ -9451,22 +9512,35 @@ var Layout = ({ children }) => {
|
|
|
9451
9512
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
9452
9513
|
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ToyBrick, {}),
|
|
9453
9514
|
onClick: () => {
|
|
9454
|
-
|
|
9515
|
+
if (plugin.name === currentPlugin) {
|
|
9516
|
+
if (leftSideBarVisible) {
|
|
9517
|
+
setUi({ leftSideBarVisible: false });
|
|
9518
|
+
} else {
|
|
9519
|
+
setUi({ leftSideBarVisible: true });
|
|
9520
|
+
}
|
|
9521
|
+
} else {
|
|
9522
|
+
if (plugin.name) {
|
|
9523
|
+
setUi({
|
|
9524
|
+
plugin: { current: plugin.name },
|
|
9525
|
+
leftSideBarVisible: true
|
|
9526
|
+
});
|
|
9527
|
+
}
|
|
9528
|
+
}
|
|
9455
9529
|
},
|
|
9456
|
-
isActive:
|
|
9530
|
+
isActive: leftSideBarVisible && currentPlugin === plugin.name,
|
|
9457
9531
|
render: plugin.render
|
|
9458
9532
|
};
|
|
9459
9533
|
}
|
|
9460
9534
|
});
|
|
9461
9535
|
return details;
|
|
9462
|
-
}, [plugins,
|
|
9536
|
+
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
9463
9537
|
(0, import_react61.useEffect)(() => {
|
|
9464
|
-
if (!
|
|
9538
|
+
if (!currentPlugin) {
|
|
9465
9539
|
const names = Object.keys(pluginItems);
|
|
9466
|
-
|
|
9540
|
+
setUi({ plugin: { current: names[0] } });
|
|
9467
9541
|
}
|
|
9468
|
-
}, [pluginItems,
|
|
9469
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `Puck ${
|
|
9542
|
+
}, [pluginItems, currentPlugin]);
|
|
9543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `Puck ${getClassName34()}`, children: [
|
|
9470
9544
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9471
9545
|
"div",
|
|
9472
9546
|
{
|
|
@@ -9479,10 +9553,7 @@ var Layout = ({ children }) => {
|
|
|
9479
9553
|
"div",
|
|
9480
9554
|
{
|
|
9481
9555
|
className: getLayoutClassName("inner"),
|
|
9482
|
-
style:
|
|
9483
|
-
"--puck-user-left-side-bar-width": `${leftWidth}px`,
|
|
9484
|
-
"--puck-user-right-side-bar-width": `${rightWidth}px`
|
|
9485
|
-
},
|
|
9556
|
+
style: layoutOptions,
|
|
9486
9557
|
children: [
|
|
9487
9558
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Header, {}),
|
|
9488
9559
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -9502,11 +9573,10 @@ var Layout = ({ children }) => {
|
|
|
9502
9573
|
position: "left",
|
|
9503
9574
|
sidebarRef: leftSidebarRef,
|
|
9504
9575
|
isVisible: leftSideBarVisible,
|
|
9505
|
-
width: leftWidth,
|
|
9506
9576
|
onResize: setLeftWidth,
|
|
9507
9577
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
9508
9578
|
children: Object.entries(pluginItems).map(
|
|
9509
|
-
([id, { render: Render2 }]) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PluginTab, { visible:
|
|
9579
|
+
([id, { render: Render2 }]) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PluginTab, { visible: currentPlugin === id, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Render2, {}) }, id)
|
|
9510
9580
|
)
|
|
9511
9581
|
}
|
|
9512
9582
|
),
|
|
@@ -9517,7 +9587,6 @@ var Layout = ({ children }) => {
|
|
|
9517
9587
|
position: "right",
|
|
9518
9588
|
sidebarRef: rightSidebarRef,
|
|
9519
9589
|
isVisible: rightSideBarVisible,
|
|
9520
|
-
width: rightWidth,
|
|
9521
9590
|
onResize: setRightWidth,
|
|
9522
9591
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
9523
9592
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldSideBar, {})
|
|
@@ -9528,7 +9597,7 @@ var Layout = ({ children }) => {
|
|
|
9528
9597
|
)
|
|
9529
9598
|
}
|
|
9530
9599
|
) }) }) }),
|
|
9531
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { id: "puck-portal-root", className:
|
|
9600
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { id: "puck-portal-root", className: getClassName34("portal") })
|
|
9532
9601
|
] });
|
|
9533
9602
|
};
|
|
9534
9603
|
|
|
@@ -9699,7 +9768,7 @@ function PuckProvider({ children }) {
|
|
|
9699
9768
|
(s) => s.state.data,
|
|
9700
9769
|
(data) => {
|
|
9701
9770
|
if (onChange) {
|
|
9702
|
-
if ((0,
|
|
9771
|
+
if ((0, import_fast_deep_equal4.default)(data, previousData.current)) return;
|
|
9703
9772
|
onChange(data);
|
|
9704
9773
|
previousData.current = data;
|
|
9705
9774
|
}
|