@measured/puck 0.19.0-canary.91cb9cee → 0.19.0-canary.a60c81eb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GL73J54P.mjs → chunk-HGAPIQP5.mjs} +231 -161
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +352 -226
- package/dist/index.mjs +117 -53
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +232 -167
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-DOB5QZVq.d.mts → walk-tree-DBd3aQ_5.d.mts} +26 -21
- package/dist/{walk-tree-DOB5QZVq.d.ts → walk-tree-DBd3aQ_5.d.ts} +26 -21
- package/package.json +12 -7
package/dist/index.mjs
CHANGED
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
__toESM,
|
10
10
|
defaultAppState,
|
11
11
|
defaultViewports,
|
12
|
+
expandNode,
|
12
13
|
getChanged,
|
13
14
|
init_react_import,
|
14
15
|
migrate,
|
@@ -21,8 +22,9 @@ import {
|
|
21
22
|
transformProps,
|
22
23
|
useSlots,
|
23
24
|
walkAppState,
|
25
|
+
walkField,
|
24
26
|
walkTree
|
25
|
-
} from "./chunk-
|
27
|
+
} from "./chunk-HGAPIQP5.mjs";
|
26
28
|
|
27
29
|
// ../../node_modules/classnames/index.js
|
28
30
|
var require_classnames = __commonJS({
|
@@ -746,7 +748,7 @@ var populateIds = (data, config, override = false) => {
|
|
746
748
|
const id = generateId(data.type);
|
747
749
|
return walkTree(
|
748
750
|
__spreadProps(__spreadValues({}, data), {
|
749
|
-
props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({
|
751
|
+
props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
|
750
752
|
}),
|
751
753
|
config,
|
752
754
|
(contents) => contents.map((item) => {
|
@@ -1901,13 +1903,18 @@ init_react_import();
|
|
1901
1903
|
import { useState as useState2 } from "react";
|
1902
1904
|
import { PointerSensor } from "@dnd-kit/react";
|
1903
1905
|
import { isElement } from "@dnd-kit/dom/utilities";
|
1906
|
+
var touchDefault = { delay: { value: 200, tolerance: 10 } };
|
1907
|
+
var otherDefault = {
|
1908
|
+
delay: { value: 200, tolerance: 10 },
|
1909
|
+
distance: { value: 5 }
|
1910
|
+
};
|
1904
1911
|
var useSensors = ({
|
1905
|
-
other,
|
1912
|
+
other = otherDefault,
|
1906
1913
|
mouse,
|
1907
|
-
touch
|
1914
|
+
touch = touchDefault
|
1908
1915
|
} = {
|
1909
|
-
touch:
|
1910
|
-
other:
|
1916
|
+
touch: touchDefault,
|
1917
|
+
other: otherDefault
|
1911
1918
|
}) => {
|
1912
1919
|
const [sensors] = useState2(() => [
|
1913
1920
|
PointerSensor.configure({
|
@@ -2449,6 +2456,19 @@ var ArrayField = ({
|
|
2449
2456
|
);
|
2450
2457
|
const forceReadOnly = !canEdit;
|
2451
2458
|
const valueRef = useRef(value);
|
2459
|
+
const uniqifyItem = useCallback2(
|
2460
|
+
(val) => {
|
2461
|
+
if (field.type !== "array" || !field.arrayFields) return;
|
2462
|
+
const config = appStore.getState().config;
|
2463
|
+
return walkField({
|
2464
|
+
value: val,
|
2465
|
+
fields: field.arrayFields,
|
2466
|
+
map: (content) => content.map((item) => populateIds(item, config, true)),
|
2467
|
+
config
|
2468
|
+
});
|
2469
|
+
},
|
2470
|
+
[appStore, field]
|
2471
|
+
);
|
2452
2472
|
if (field.type !== "array" || !field.arrayFields) {
|
2453
2473
|
return null;
|
2454
2474
|
}
|
@@ -2553,11 +2573,10 @@ var ArrayField = ({
|
|
2553
2573
|
onClick: (e) => {
|
2554
2574
|
e.stopPropagation();
|
2555
2575
|
const existingValue = [...value || []];
|
2556
|
-
|
2557
|
-
i,
|
2558
|
-
0,
|
2576
|
+
const newItem = uniqifyItem(
|
2559
2577
|
existingValue[i]
|
2560
2578
|
);
|
2579
|
+
existingValue.splice(i, 0, newItem);
|
2561
2580
|
const newUi = mapArrayStateToUi(
|
2562
2581
|
regenerateArrayState(existingValue)
|
2563
2582
|
);
|
@@ -2655,12 +2674,11 @@ var ArrayField = ({
|
|
2655
2674
|
type: "button",
|
2656
2675
|
className: getClassName5("addButton"),
|
2657
2676
|
onClick: () => {
|
2677
|
+
var _a;
|
2658
2678
|
if (isDraggingAny) return;
|
2659
2679
|
const existingValue = value || [];
|
2660
|
-
const
|
2661
|
-
|
2662
|
-
field.defaultItemProps || {}
|
2663
|
-
];
|
2680
|
+
const newItem = uniqifyItem((_a = field.defaultItemProps) != null ? _a : {});
|
2681
|
+
const newValue = [...existingValue, newItem];
|
2664
2682
|
const newArrayState = regenerateArrayState(newValue);
|
2665
2683
|
setUi(mapArrayStateToUi(newArrayState), false);
|
2666
2684
|
onChange(newValue);
|
@@ -3560,6 +3578,10 @@ function AutoFieldInternal(props) {
|
|
3560
3578
|
});
|
3561
3579
|
}
|
3562
3580
|
}, []);
|
3581
|
+
const { visible = true } = props.field;
|
3582
|
+
if (!visible) {
|
3583
|
+
return null;
|
3584
|
+
}
|
3563
3585
|
if (field.type === "slot") {
|
3564
3586
|
return null;
|
3565
3587
|
}
|
@@ -4423,10 +4445,10 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4423
4445
|
preview
|
4424
4446
|
);
|
4425
4447
|
const updateContent = useRenderedCallback(
|
4426
|
-
(contentIds2, preview2) => {
|
4427
|
-
|
4428
|
-
|
4429
|
-
|
4448
|
+
(contentIds2, preview2, isDragging2, draggedItemId, previewExists) => {
|
4449
|
+
if (isDragging2 && !previewExists) {
|
4450
|
+
return;
|
4451
|
+
}
|
4430
4452
|
if (preview2) {
|
4431
4453
|
if (preview2.type === "insert") {
|
4432
4454
|
setContentIdsWithPreview(
|
@@ -4447,7 +4469,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4447
4469
|
}
|
4448
4470
|
} else {
|
4449
4471
|
setContentIdsWithPreview(
|
4450
|
-
contentIds2.filter((id) => id !== draggedItemId)
|
4472
|
+
previewExists ? contentIds2.filter((id) => id !== draggedItemId) : contentIds2
|
4451
4473
|
);
|
4452
4474
|
}
|
4453
4475
|
setLocalPreview(preview2);
|
@@ -4455,7 +4477,17 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4455
4477
|
[]
|
4456
4478
|
);
|
4457
4479
|
useEffect14(() => {
|
4458
|
-
|
4480
|
+
var _a;
|
4481
|
+
const s = zoneStore.getState();
|
4482
|
+
const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
4483
|
+
const previewExists = Object.keys(s.previewIndex || {}).length > 0;
|
4484
|
+
updateContent(
|
4485
|
+
contentIds,
|
4486
|
+
preview,
|
4487
|
+
isDragging,
|
4488
|
+
draggedItemId,
|
4489
|
+
previewExists
|
4490
|
+
);
|
4459
4491
|
}, [contentIds, preview, isDragging]);
|
4460
4492
|
return [contentIdsWithPreview, localPreview];
|
4461
4493
|
};
|
@@ -4497,7 +4529,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
4497
4529
|
};
|
4498
4530
|
|
4499
4531
|
// components/DropZone/index.tsx
|
4500
|
-
import { useShallow as
|
4532
|
+
import { useShallow as useShallow4 } from "zustand/react/shallow";
|
4501
4533
|
|
4502
4534
|
// components/Render/index.tsx
|
4503
4535
|
init_react_import();
|
@@ -4505,6 +4537,7 @@ import React3, { useMemo as useMemo8 } from "react";
|
|
4505
4537
|
|
4506
4538
|
// components/SlotRender/index.tsx
|
4507
4539
|
init_react_import();
|
4540
|
+
import { useShallow as useShallow3 } from "zustand/react/shallow";
|
4508
4541
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
4509
4542
|
var ContextSlotRender = ({
|
4510
4543
|
componentId,
|
@@ -4513,10 +4546,12 @@ var ContextSlotRender = ({
|
|
4513
4546
|
const config = useAppStore((s) => s.config);
|
4514
4547
|
const metadata = useAppStore((s) => s.metadata);
|
4515
4548
|
const slotContent = useAppStore(
|
4516
|
-
(s) => {
|
4549
|
+
useShallow3((s) => {
|
4517
4550
|
var _a, _b;
|
4518
|
-
|
4519
|
-
|
4551
|
+
const indexes = s.state.indexes;
|
4552
|
+
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
4553
|
+
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
4554
|
+
})
|
4520
4555
|
);
|
4521
4556
|
return /* @__PURE__ */ jsx21(
|
4522
4557
|
SlotRenderPure,
|
@@ -4546,7 +4581,7 @@ function Render({
|
|
4546
4581
|
root: data.root || {},
|
4547
4582
|
content: data.content || []
|
4548
4583
|
});
|
4549
|
-
const rootProps = defaultedData.root.props
|
4584
|
+
const rootProps = "props" in defaultedData.root ? defaultedData.root.props : defaultedData.root;
|
4550
4585
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
4551
4586
|
const pageProps = __spreadProps(__spreadValues({}, rootProps), {
|
4552
4587
|
puck: {
|
@@ -4559,7 +4594,11 @@ function Render({
|
|
4559
4594
|
editMode: false,
|
4560
4595
|
id: "puck-root"
|
4561
4596
|
});
|
4562
|
-
const propsWithSlots = useSlots(
|
4597
|
+
const propsWithSlots = useSlots(
|
4598
|
+
config,
|
4599
|
+
{ type: "root", props: pageProps },
|
4600
|
+
(props) => /* @__PURE__ */ jsx22(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
4601
|
+
);
|
4563
4602
|
const nextContextValue = useMemo8(
|
4564
4603
|
() => ({
|
4565
4604
|
mode: "render",
|
@@ -4593,7 +4632,7 @@ var DropZoneChild = ({
|
|
4593
4632
|
const { depth = 1 } = ctx != null ? ctx : {};
|
4594
4633
|
const zoneStore = useContext7(ZoneStoreContext);
|
4595
4634
|
const nodeProps = useAppStore(
|
4596
|
-
|
4635
|
+
useShallow4((s) => {
|
4597
4636
|
var _a2;
|
4598
4637
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
|
4599
4638
|
})
|
@@ -4605,14 +4644,19 @@ var DropZoneChild = ({
|
|
4605
4644
|
}
|
4606
4645
|
);
|
4607
4646
|
const nodeReadOnly = useAppStore(
|
4608
|
-
|
4647
|
+
useShallow4((s) => {
|
4609
4648
|
var _a2;
|
4610
4649
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
4611
4650
|
})
|
4612
4651
|
);
|
4652
|
+
const appStore = useAppStoreApi();
|
4613
4653
|
const item = useMemo9(() => {
|
4614
4654
|
if (nodeProps) {
|
4615
|
-
|
4655
|
+
const expanded = expandNode({
|
4656
|
+
type: nodeType,
|
4657
|
+
props: nodeProps
|
4658
|
+
});
|
4659
|
+
return expanded;
|
4616
4660
|
}
|
4617
4661
|
const preview = zoneStore.getState().previewIndex[zoneCompound];
|
4618
4662
|
if (componentId === (preview == null ? void 0 : preview.props.id)) {
|
@@ -4623,7 +4667,7 @@ var DropZoneChild = ({
|
|
4623
4667
|
};
|
4624
4668
|
}
|
4625
4669
|
return null;
|
4626
|
-
}, [componentId, zoneCompound, nodeType, nodeProps]);
|
4670
|
+
}, [appStore, componentId, zoneCompound, nodeType, nodeProps]);
|
4627
4671
|
const componentConfig = useAppStore(
|
4628
4672
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
4629
4673
|
);
|
@@ -4664,9 +4708,17 @@ var DropZoneChild = ({
|
|
4664
4708
|
}),
|
4665
4709
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
|
4666
4710
|
);
|
4711
|
+
const defaultedNode = useMemo9(
|
4712
|
+
() => {
|
4713
|
+
var _a2;
|
4714
|
+
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
4715
|
+
},
|
4716
|
+
[item == null ? void 0 : item.type, nodeType, defaultsProps]
|
4717
|
+
);
|
4718
|
+
const config = useAppStore((s) => s.config);
|
4667
4719
|
const defaultedPropsWithSlots = useSlots(
|
4668
|
-
|
4669
|
-
|
4720
|
+
config,
|
4721
|
+
defaultedNode,
|
4670
4722
|
DropZoneEditPure,
|
4671
4723
|
(slotProps) => /* @__PURE__ */ jsx23(ContextSlotRender, { componentId, zone: slotProps.zone }),
|
4672
4724
|
nodeReadOnly,
|
@@ -4678,7 +4730,7 @@ var DropZoneChild = ({
|
|
4678
4730
|
item.type
|
4679
4731
|
] });
|
4680
4732
|
let componentType = item.type;
|
4681
|
-
const isInserting = item.previewType === "insert";
|
4733
|
+
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
4682
4734
|
if (isInserting) {
|
4683
4735
|
Render2 = renderPreview;
|
4684
4736
|
}
|
@@ -4727,7 +4779,7 @@ var DropZoneEdit = forwardRef3(
|
|
4727
4779
|
unregisterLocalZone
|
4728
4780
|
} = ctx != null ? ctx : {};
|
4729
4781
|
const path = useAppStore(
|
4730
|
-
|
4782
|
+
useShallow4((s) => {
|
4731
4783
|
var _a;
|
4732
4784
|
return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
|
4733
4785
|
})
|
@@ -4744,13 +4796,13 @@ var DropZoneEdit = forwardRef3(
|
|
4744
4796
|
(s) => s.nextAreaDepthIndex[areaId || ""]
|
4745
4797
|
);
|
4746
4798
|
const zoneContentIds = useAppStore(
|
4747
|
-
|
4799
|
+
useShallow4((s) => {
|
4748
4800
|
var _a;
|
4749
4801
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
|
4750
4802
|
})
|
4751
4803
|
);
|
4752
4804
|
const zoneType = useAppStore(
|
4753
|
-
|
4805
|
+
useShallow4((s) => {
|
4754
4806
|
var _a;
|
4755
4807
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
4756
4808
|
})
|
@@ -4907,7 +4959,7 @@ var DropZoneRenderItem = ({
|
|
4907
4959
|
metadata
|
4908
4960
|
}) => {
|
4909
4961
|
const Component = config.components[item.type];
|
4910
|
-
const props = useSlots(
|
4962
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx23(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
4911
4963
|
const nextContextValue = useMemo9(
|
4912
4964
|
() => ({
|
4913
4965
|
areaId: props.id,
|
@@ -5959,7 +6011,7 @@ var styles_module_default15 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
5959
6011
|
|
5960
6012
|
// components/Puck/components/Fields/index.tsx
|
5961
6013
|
import { memo as memo2, useCallback as useCallback12, useMemo as useMemo13 } from "react";
|
5962
|
-
import { useShallow as
|
6014
|
+
import { useShallow as useShallow5 } from "zustand/react/shallow";
|
5963
6015
|
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
5964
6016
|
var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
|
5965
6017
|
var DefaultFields = ({
|
@@ -6025,7 +6077,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
6025
6077
|
return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
|
6026
6078
|
});
|
6027
6079
|
const permissions = useAppStore(
|
6028
|
-
|
6080
|
+
useShallow5((s) => {
|
6029
6081
|
const { selectedItem, permissions: permissions2 } = s;
|
6030
6082
|
return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
|
6031
6083
|
})
|
@@ -6034,7 +6086,8 @@ var FieldsChild = ({ fieldName }) => {
|
|
6034
6086
|
const onChange = useCallback12(createOnChange(fieldName, appStore), [
|
6035
6087
|
fieldName
|
6036
6088
|
]);
|
6037
|
-
|
6089
|
+
const { visible = true } = field != null ? field : {};
|
6090
|
+
if (!field || !id || !visible) return null;
|
6038
6091
|
if (field.type === "slot") return null;
|
6039
6092
|
return /* @__PURE__ */ jsx27("div", { className: getClassName20("field"), children: /* @__PURE__ */ jsx27(
|
6040
6093
|
AutoFieldPrivate,
|
@@ -6056,7 +6109,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
6056
6109
|
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;
|
6057
6110
|
return (loadingCount != null ? loadingCount : 0) > 0;
|
6058
6111
|
});
|
6059
|
-
const itemSelector = useAppStore(
|
6112
|
+
const itemSelector = useAppStore(useShallow5((s) => s.state.ui.itemSelector));
|
6060
6113
|
const id = useAppStore((s) => {
|
6061
6114
|
var _a;
|
6062
6115
|
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
@@ -6065,7 +6118,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
6065
6118
|
useRegisterFieldsSlice(appStore, id);
|
6066
6119
|
const fieldsLoading = useAppStore((s) => s.fields.loading);
|
6067
6120
|
const fieldNames = useAppStore(
|
6068
|
-
|
6121
|
+
useShallow5((s) => {
|
6069
6122
|
if (s.fields.id === id) {
|
6070
6123
|
return Object.keys(s.fields.fields);
|
6071
6124
|
}
|
@@ -6593,13 +6646,16 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
6593
6646
|
const Page = useCallback13(
|
6594
6647
|
(pageProps) => {
|
6595
6648
|
var _a, _b;
|
6596
|
-
const
|
6597
|
-
|
6649
|
+
const propsWithSlots = useSlots(
|
6650
|
+
config,
|
6651
|
+
{ type: "root", props: pageProps },
|
6652
|
+
DropZoneEditPure
|
6653
|
+
);
|
6598
6654
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
6599
6655
|
id: "puck-root"
|
6600
6656
|
}, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment9, { children: propsWithSlots.children });
|
6601
6657
|
},
|
6602
|
-
[config
|
6658
|
+
[config]
|
6603
6659
|
);
|
6604
6660
|
const Frame = useMemo15(() => overrides.iframe, [overrides]);
|
6605
6661
|
const rootProps = root.props || root;
|
@@ -6710,7 +6766,7 @@ var onScrollEnd = (frame, cb) => {
|
|
6710
6766
|
};
|
6711
6767
|
|
6712
6768
|
// components/LayerTree/index.tsx
|
6713
|
-
import { useShallow as
|
6769
|
+
import { useShallow as useShallow6 } from "zustand/react/shallow";
|
6714
6770
|
import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
|
6715
6771
|
var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
|
6716
6772
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
|
@@ -6737,7 +6793,7 @@ var Layer = ({
|
|
6737
6793
|
const isSelected = selecedItemId === itemId || itemSelector && itemSelector.zone === rootDroppableId && !zoneCompound;
|
6738
6794
|
const nodeData = useAppStore((s) => s.state.indexes.nodes[itemId]);
|
6739
6795
|
const zonesForItem = useAppStore(
|
6740
|
-
|
6796
|
+
useShallow6(
|
6741
6797
|
(s) => Object.keys(s.state.indexes.zones).filter(
|
6742
6798
|
(z) => z.split(":")[0] === itemId
|
6743
6799
|
)
|
@@ -6784,7 +6840,10 @@ var Layer = ({
|
|
6784
6840
|
`[data-puck-component="${itemId}"]`
|
6785
6841
|
);
|
6786
6842
|
if (!el) {
|
6787
|
-
|
6843
|
+
setItemSelector({
|
6844
|
+
index,
|
6845
|
+
zone: zoneCompound
|
6846
|
+
});
|
6788
6847
|
return;
|
6789
6848
|
}
|
6790
6849
|
scrollIntoView(el);
|
@@ -6830,7 +6889,7 @@ var LayerTree = ({
|
|
6830
6889
|
}) => {
|
6831
6890
|
const label = _label != null ? _label : zoneCompound.split(":")[1];
|
6832
6891
|
const contentIds = useAppStore(
|
6833
|
-
|
6892
|
+
useShallow6(
|
6834
6893
|
(s) => {
|
6835
6894
|
var _a, _b;
|
6836
6895
|
return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
|
@@ -6871,12 +6930,12 @@ var findZonesForArea = (state, area) => {
|
|
6871
6930
|
};
|
6872
6931
|
|
6873
6932
|
// components/Puck/components/Outline/index.tsx
|
6874
|
-
import { useShallow as
|
6933
|
+
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
6875
6934
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
6876
6935
|
var Outline = () => {
|
6877
6936
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
6878
6937
|
const rootZones = useAppStore(
|
6879
|
-
|
6938
|
+
useShallow7((s) => findZonesForArea(s.state, "root"))
|
6880
6939
|
);
|
6881
6940
|
const Wrapper = useMemo16(() => outlineOverride || "div", [outlineOverride]);
|
6882
6941
|
return /* @__PURE__ */ jsx34(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx34(
|
@@ -7198,7 +7257,7 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
7198
7257
|
};
|
7199
7258
|
|
7200
7259
|
// components/Puck/components/Canvas/index.tsx
|
7201
|
-
import { useShallow as
|
7260
|
+
import { useShallow as useShallow8 } from "zustand/react/shallow";
|
7202
7261
|
import { Fragment as Fragment11, jsx as jsx36, jsxs as jsxs17 } from "react/jsx-runtime";
|
7203
7262
|
var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
|
7204
7263
|
var ZOOM_ON_CHANGE = true;
|
@@ -7212,7 +7271,7 @@ var Canvas = () => {
|
|
7212
7271
|
status,
|
7213
7272
|
iframe
|
7214
7273
|
} = useAppStore(
|
7215
|
-
|
7274
|
+
useShallow8((s) => ({
|
7216
7275
|
dispatch: s.dispatch,
|
7217
7276
|
overrides: s.overrides,
|
7218
7277
|
setUi: s.setUi,
|
@@ -7223,7 +7282,7 @@ var Canvas = () => {
|
|
7223
7282
|
}))
|
7224
7283
|
);
|
7225
7284
|
const { leftSideBarVisible, rightSideBarVisible, viewports } = useAppStore(
|
7226
|
-
|
7285
|
+
useShallow8((s) => ({
|
7227
7286
|
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
7228
7287
|
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
7229
7288
|
viewports: s.state.ui.viewports
|
@@ -7919,6 +7978,11 @@ function PuckProvider({ children }) {
|
|
7919
7978
|
const [appStore] = useState23(
|
7920
7979
|
() => createAppStore(generateAppStore(initialAppState))
|
7921
7980
|
);
|
7981
|
+
useEffect25(() => {
|
7982
|
+
if (process.env.NODE_ENV !== "production") {
|
7983
|
+
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
7984
|
+
}
|
7985
|
+
}, [appStore]);
|
7922
7986
|
useEffect25(() => {
|
7923
7987
|
const state = appStore.getState().state;
|
7924
7988
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
package/dist/rsc.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
3
|
-
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-DBd3aQ_5.mjs';
|
3
|
+
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DBd3aQ_5.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
3
|
-
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-DBd3aQ_5.js';
|
3
|
+
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DBd3aQ_5.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|