@measured/puck 0.18.0-canary.007a413 → 0.18.0-canary.01d9695
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/index.js +11 -9
- package/dist/index.mjs +11 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -3663,6 +3663,7 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3663
3663
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
|
3664
3664
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
3665
3665
|
var RENDER_DEBUG = false;
|
3666
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadValues({}, props));
|
3666
3667
|
var DropZoneEdit = (0, import_react29.forwardRef)(
|
3667
3668
|
function DropZoneEditInternal({
|
3668
3669
|
zone,
|
@@ -3822,10 +3823,10 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3822
3823
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
|
3823
3824
|
}),
|
3824
3825
|
children: contentWithPreview.map((item, i) => {
|
3825
|
-
var _a, _b, _c, _d, _e;
|
3826
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
3826
3827
|
const componentId = item.props.id;
|
3827
3828
|
const puckProps = {
|
3828
|
-
renderDropZone:
|
3829
|
+
renderDropZone: DropZoneEditPure,
|
3829
3830
|
isEditing: true,
|
3830
3831
|
dragRef: null
|
3831
3832
|
};
|
@@ -3842,13 +3843,13 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3842
3843
|
const componentConfig = config.components[item.type];
|
3843
3844
|
let componentType = item.type;
|
3844
3845
|
let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
3845
|
-
if (item.type === "preview"
|
3846
|
+
if (item.type === "preview") {
|
3846
3847
|
let Preview4 = function() {
|
3847
3848
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
|
3848
3849
|
};
|
3849
3850
|
var Preview3 = Preview4;
|
3850
|
-
componentType = preview.componentType;
|
3851
|
-
label = (
|
3851
|
+
componentType = (_c = preview == null ? void 0 : preview.componentType) != null ? _c : "__preview";
|
3852
|
+
label = (_f = (_e = (_d = config.components[componentType]) == null ? void 0 : _d.label) != null ? _e : componentType) != null ? _f : "Preview";
|
3852
3853
|
Render2 = Preview4;
|
3853
3854
|
}
|
3854
3855
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
@@ -3863,7 +3864,7 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3863
3864
|
zoneCompound,
|
3864
3865
|
depth: depth + 1,
|
3865
3866
|
index: i,
|
3866
|
-
isLoading: ((
|
3867
|
+
isLoading: ((_g = appContext2.componentState[componentId]) == null ? void 0 : _g.loadingCount) > 0,
|
3867
3868
|
isSelected,
|
3868
3869
|
label,
|
3869
3870
|
isEnabled,
|
@@ -3888,6 +3889,7 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3888
3889
|
);
|
3889
3890
|
}
|
3890
3891
|
);
|
3892
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadValues({}, props));
|
3891
3893
|
var DropZoneRender = (0, import_react29.forwardRef)(
|
3892
3894
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
3893
3895
|
const ctx = (0, import_react29.useContext)(dropZoneContext);
|
@@ -3928,7 +3930,7 @@ var DropZoneRender = (0, import_react29.forwardRef)(
|
|
3928
3930
|
Component.render,
|
3929
3931
|
__spreadProps(__spreadValues({}, item.props), {
|
3930
3932
|
puck: {
|
3931
|
-
renderDropZone:
|
3933
|
+
renderDropZone: DropZoneRenderPure
|
3932
3934
|
}
|
3933
3935
|
})
|
3934
3936
|
)
|
@@ -5687,8 +5689,8 @@ var useResolvedFields = () => {
|
|
5687
5689
|
setHasParent(!!parent);
|
5688
5690
|
}, [parent]);
|
5689
5691
|
(0, import_react35.useEffect)(() => {
|
5690
|
-
var _a2;
|
5691
|
-
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || hasParent) {
|
5692
|
+
var _a2, _b2;
|
5693
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || hasParent) {
|
5692
5694
|
if (hasResolver) {
|
5693
5695
|
setFieldsLoading(true);
|
5694
5696
|
resolveFields(defaultFields).then((fields) => {
|
package/dist/index.mjs
CHANGED
@@ -3506,6 +3506,7 @@ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-r
|
|
3506
3506
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
|
3507
3507
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
3508
3508
|
var RENDER_DEBUG = false;
|
3509
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ jsx22(DropZoneEdit, __spreadValues({}, props));
|
3509
3510
|
var DropZoneEdit = forwardRef3(
|
3510
3511
|
function DropZoneEditInternal({
|
3511
3512
|
zone,
|
@@ -3665,10 +3666,10 @@ var DropZoneEdit = forwardRef3(
|
|
3665
3666
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
|
3666
3667
|
}),
|
3667
3668
|
children: contentWithPreview.map((item, i) => {
|
3668
|
-
var _a, _b, _c, _d, _e;
|
3669
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
3669
3670
|
const componentId = item.props.id;
|
3670
3671
|
const puckProps = {
|
3671
|
-
renderDropZone:
|
3672
|
+
renderDropZone: DropZoneEditPure,
|
3672
3673
|
isEditing: true,
|
3673
3674
|
dragRef: null
|
3674
3675
|
};
|
@@ -3685,13 +3686,13 @@ var DropZoneEdit = forwardRef3(
|
|
3685
3686
|
const componentConfig = config.components[item.type];
|
3686
3687
|
let componentType = item.type;
|
3687
3688
|
let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
3688
|
-
if (item.type === "preview"
|
3689
|
+
if (item.type === "preview") {
|
3689
3690
|
let Preview4 = function() {
|
3690
3691
|
return /* @__PURE__ */ jsx22(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
|
3691
3692
|
};
|
3692
3693
|
var Preview3 = Preview4;
|
3693
|
-
componentType = preview.componentType;
|
3694
|
-
label = (
|
3694
|
+
componentType = (_c = preview == null ? void 0 : preview.componentType) != null ? _c : "__preview";
|
3695
|
+
label = (_f = (_e = (_d = config.components[componentType]) == null ? void 0 : _d.label) != null ? _e : componentType) != null ? _f : "Preview";
|
3695
3696
|
Render2 = Preview4;
|
3696
3697
|
}
|
3697
3698
|
return /* @__PURE__ */ jsx22(
|
@@ -3706,7 +3707,7 @@ var DropZoneEdit = forwardRef3(
|
|
3706
3707
|
zoneCompound,
|
3707
3708
|
depth: depth + 1,
|
3708
3709
|
index: i,
|
3709
|
-
isLoading: ((
|
3710
|
+
isLoading: ((_g = appContext2.componentState[componentId]) == null ? void 0 : _g.loadingCount) > 0,
|
3710
3711
|
isSelected,
|
3711
3712
|
label,
|
3712
3713
|
isEnabled,
|
@@ -3731,6 +3732,7 @@ var DropZoneEdit = forwardRef3(
|
|
3731
3732
|
);
|
3732
3733
|
}
|
3733
3734
|
);
|
3735
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx22(DropZoneRender, __spreadValues({}, props));
|
3734
3736
|
var DropZoneRender = forwardRef3(
|
3735
3737
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
3736
3738
|
const ctx = useContext6(dropZoneContext);
|
@@ -3771,7 +3773,7 @@ var DropZoneRender = forwardRef3(
|
|
3771
3773
|
Component.render,
|
3772
3774
|
__spreadProps(__spreadValues({}, item.props), {
|
3773
3775
|
puck: {
|
3774
|
-
renderDropZone:
|
3776
|
+
renderDropZone: DropZoneRenderPure
|
3775
3777
|
}
|
3776
3778
|
})
|
3777
3779
|
)
|
@@ -5545,8 +5547,8 @@ var useResolvedFields = () => {
|
|
5545
5547
|
setHasParent(!!parent);
|
5546
5548
|
}, [parent]);
|
5547
5549
|
useEffect16(() => {
|
5548
|
-
var _a2;
|
5549
|
-
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || hasParent) {
|
5550
|
+
var _a2, _b2;
|
5551
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || hasParent) {
|
5550
5552
|
if (hasResolver) {
|
5551
5553
|
setFieldsLoading(true);
|
5552
5554
|
resolveFields(defaultFields).then((fields) => {
|
package/package.json
CHANGED