@measured/puck-plugin-heading-analyzer 0.16.0-canary.c7007ac → 0.16.0-canary.d08a794
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.d.ts +8 -0
- package/dist/index.js +813 -602
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -51483,7 +51483,7 @@ var require_dist = __commonJS({
|
|
51483
51483
|
var HostPortal = 4;
|
51484
51484
|
var HostComponent = 5;
|
51485
51485
|
var HostText = 6;
|
51486
|
-
var
|
51486
|
+
var Fragment20 = 7;
|
51487
51487
|
var Mode = 8;
|
51488
51488
|
var ContextConsumer = 9;
|
51489
51489
|
var ContextProvider = 10;
|
@@ -52639,7 +52639,7 @@ var require_dist = __commonJS({
|
|
52639
52639
|
return "DehydratedFragment";
|
52640
52640
|
case ForwardRef:
|
52641
52641
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
52642
|
-
case
|
52642
|
+
case Fragment20:
|
52643
52643
|
return "Fragment";
|
52644
52644
|
case HostComponent:
|
52645
52645
|
return type;
|
@@ -62290,7 +62290,7 @@ var require_dist = __commonJS({
|
|
62290
62290
|
}
|
62291
62291
|
}
|
62292
62292
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
62293
|
-
if (current2 === null || current2.tag !==
|
62293
|
+
if (current2 === null || current2.tag !== Fragment20) {
|
62294
62294
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
62295
62295
|
created.return = returnFiber;
|
62296
62296
|
return created;
|
@@ -62693,7 +62693,7 @@ var require_dist = __commonJS({
|
|
62693
62693
|
if (child.key === key) {
|
62694
62694
|
var elementType = element.type;
|
62695
62695
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
62696
|
-
if (child.tag ===
|
62696
|
+
if (child.tag === Fragment20) {
|
62697
62697
|
deleteRemainingChildren(returnFiber, child.sibling);
|
62698
62698
|
var existing = useFiber(child, element.props.children);
|
62699
62699
|
existing.return = returnFiber;
|
@@ -66868,7 +66868,7 @@ var require_dist = __commonJS({
|
|
66868
66868
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
66869
66869
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
66870
66870
|
}
|
66871
|
-
case
|
66871
|
+
case Fragment20:
|
66872
66872
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
66873
66873
|
case Mode:
|
66874
66874
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -67140,7 +67140,7 @@ var require_dist = __commonJS({
|
|
67140
67140
|
case SimpleMemoComponent:
|
67141
67141
|
case FunctionComponent:
|
67142
67142
|
case ForwardRef:
|
67143
|
-
case
|
67143
|
+
case Fragment20:
|
67144
67144
|
case Mode:
|
67145
67145
|
case Profiler:
|
67146
67146
|
case ContextConsumer:
|
@@ -71391,7 +71391,7 @@ var require_dist = __commonJS({
|
|
71391
71391
|
return fiber;
|
71392
71392
|
}
|
71393
71393
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
71394
|
-
var fiber = createFiber(
|
71394
|
+
var fiber = createFiber(Fragment20, elements, key, mode);
|
71395
71395
|
fiber.lanes = lanes;
|
71396
71396
|
return fiber;
|
71397
71397
|
}
|
@@ -72510,6 +72510,8 @@ var require_dist = __commonJS({
|
|
72510
72510
|
});
|
72511
72511
|
var core_exports = {};
|
72512
72512
|
__export2(core_exports, {
|
72513
|
+
Action: () => Action,
|
72514
|
+
ActionBar: () => ActionBar,
|
72513
72515
|
AutoField: () => AutoField,
|
72514
72516
|
AutoFieldPrivate: () => AutoFieldPrivate,
|
72515
72517
|
Button: () => Button,
|
@@ -72564,12 +72566,30 @@ var require_dist = __commonJS({
|
|
72564
72566
|
};
|
72565
72567
|
var get_class_name_factory_default2 = getClassNameFactory2;
|
72566
72568
|
init_react_import2();
|
72567
|
-
var styles_module_default5 = { "
|
72569
|
+
var styles_module_default5 = { "ActionBarComponent": "_ActionBarComponent_8nyey_1", "ActionBarComponent-actionsLabel": "_ActionBarComponent-actionsLabel_8nyey_15", "ActionBarComponent-action": "_ActionBarComponent-action_8nyey_15" };
|
72570
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
72571
|
+
var getClassName6 = get_class_name_factory_default2("ActionBarComponent", styles_module_default5);
|
72572
|
+
var ActionBar = ({
|
72573
|
+
label,
|
72574
|
+
children
|
72575
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassName6(), children: [
|
72576
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName6("actionsLabel"), children: label }),
|
72577
|
+
children
|
72578
|
+
] });
|
72579
|
+
var Action = ({
|
72580
|
+
children,
|
72581
|
+
label,
|
72582
|
+
onClick
|
72583
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { className: getClassName6("action"), onClick, title: label, children });
|
72584
|
+
ActionBar.Action = Action;
|
72585
|
+
init_react_import2();
|
72586
|
+
init_react_import2();
|
72587
|
+
var styles_module_default22 = { "Input": "_Input_3pq3z_1", "Input-label": "_Input-label_3pq3z_26", "Input-labelIcon": "_Input-labelIcon_3pq3z_35", "Input-disabledIcon": "_Input-disabledIcon_3pq3z_42", "Input-input": "_Input-input_3pq3z_47", "Input--readOnly": "_Input--readOnly_3pq3z_91", "Input-radioGroupItems": "_Input-radioGroupItems_3pq3z_102", "Input-radio": "_Input-radio_3pq3z_102", "Input-radioInner": "_Input-radioInner_3pq3z_119", "Input-radioInput": "_Input-radioInput_3pq3z_164" };
|
72568
72588
|
var import_react112 = require("react");
|
72569
72589
|
init_react_import2();
|
72570
72590
|
init_react_import2();
|
72571
72591
|
init_react_import2();
|
72572
|
-
var
|
72592
|
+
var styles_module_default32 = { "ArrayField": "_ArrayField_1go19_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1go19_13", "ArrayField-addButton": "_ArrayField-addButton_1go19_18", "ArrayField--hasItems": "_ArrayField--hasItems_1go19_33", "ArrayFieldItem": "_ArrayFieldItem_1go19_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1go19_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1go19_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1go19_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1go19_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1go19_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1go19_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1go19_181", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1go19_187" };
|
72573
72593
|
init_react_import2();
|
72574
72594
|
init_react_import2();
|
72575
72595
|
var import_react22 = require("react");
|
@@ -72799,9 +72819,9 @@ var require_dist = __commonJS({
|
|
72799
72819
|
return result;
|
72800
72820
|
};
|
72801
72821
|
init_react_import2();
|
72802
|
-
var
|
72803
|
-
var
|
72804
|
-
var
|
72822
|
+
var styles_module_default42 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
72823
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
72824
|
+
var getClassName22 = get_class_name_factory_default2("Loader", styles_module_default42);
|
72805
72825
|
var Loader2 = (_a3) => {
|
72806
72826
|
var _b2 = _a3, {
|
72807
72827
|
color,
|
@@ -72810,10 +72830,10 @@ var require_dist = __commonJS({
|
|
72810
72830
|
"color",
|
72811
72831
|
"size"
|
72812
72832
|
]);
|
72813
|
-
return /* @__PURE__ */ (0,
|
72833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
72814
72834
|
"span",
|
72815
72835
|
__spreadValues2({
|
72816
|
-
className:
|
72836
|
+
className: getClassName22(),
|
72817
72837
|
style: {
|
72818
72838
|
width: size,
|
72819
72839
|
height: size,
|
@@ -72823,8 +72843,8 @@ var require_dist = __commonJS({
|
|
72823
72843
|
}, props)
|
72824
72844
|
);
|
72825
72845
|
};
|
72826
|
-
var
|
72827
|
-
var
|
72846
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
72847
|
+
var getClassName32 = get_class_name_factory_default2("IconButton", IconButton_module_default);
|
72828
72848
|
var IconButton = ({
|
72829
72849
|
children,
|
72830
72850
|
href,
|
@@ -72839,10 +72859,10 @@ var require_dist = __commonJS({
|
|
72839
72859
|
}) => {
|
72840
72860
|
const [loading, setLoading] = (0, import_react32.useState)(false);
|
72841
72861
|
const ElementType = href ? "a" : "button";
|
72842
|
-
const el = /* @__PURE__ */ (0,
|
72862
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
72843
72863
|
ElementType,
|
72844
72864
|
{
|
72845
|
-
className:
|
72865
|
+
className: getClassName32({
|
72846
72866
|
primary: variant === "primary",
|
72847
72867
|
secondary: variant === "secondary",
|
72848
72868
|
disabled,
|
@@ -72863,11 +72883,11 @@ var require_dist = __commonJS({
|
|
72863
72883
|
href,
|
72864
72884
|
title,
|
72865
72885
|
children: [
|
72866
|
-
/* @__PURE__ */ (0,
|
72886
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassName32("title"), children: title }),
|
72867
72887
|
children,
|
72868
|
-
loading && /* @__PURE__ */ (0,
|
72888
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
72869
72889
|
"\xA0\xA0",
|
72870
|
-
/* @__PURE__ */ (0,
|
72890
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loader2, { size: 14 })
|
72871
72891
|
] })
|
72872
72892
|
]
|
72873
72893
|
}
|
@@ -72906,7 +72926,7 @@ var require_dist = __commonJS({
|
|
72906
72926
|
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
72907
72927
|
];
|
72908
72928
|
var import_ua_parser_js2 = require_ua_parser();
|
72909
|
-
var
|
72929
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
72910
72930
|
var defaultAppState2 = {
|
72911
72931
|
data: { content: [], root: { props: {} } },
|
72912
72932
|
ui: {
|
@@ -72946,7 +72966,8 @@ var require_dist = __commonJS({
|
|
72946
72966
|
status: "LOADING",
|
72947
72967
|
setStatus: () => null,
|
72948
72968
|
iframe: {},
|
72949
|
-
safariFallbackMode: false
|
72969
|
+
safariFallbackMode: false,
|
72970
|
+
globalPermissions: {}
|
72950
72971
|
};
|
72951
72972
|
var appContext2 = (0, import_react42.createContext)(defaultContext2);
|
72952
72973
|
var AppProvider = ({
|
@@ -72976,7 +72997,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
72976
72997
|
setSafariFallbackMode(true);
|
72977
72998
|
}
|
72978
72999
|
}, []);
|
72979
|
-
return /* @__PURE__ */ (0,
|
73000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
72980
73001
|
appContext2.Provider,
|
72981
73002
|
{
|
72982
73003
|
value: __spreadProps2(__spreadValues2({}, value), {
|
@@ -73005,7 +73026,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73005
73026
|
}
|
73006
73027
|
});
|
73007
73028
|
}
|
73008
|
-
var
|
73029
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
73009
73030
|
var defaultProvided = {
|
73010
73031
|
droppableProps: {
|
73011
73032
|
"data-rfd-droppable-context-id": "",
|
@@ -73020,15 +73041,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73020
73041
|
draggingFromThisWith: null,
|
73021
73042
|
isUsingPlaceholder: false
|
73022
73043
|
};
|
73023
|
-
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0,
|
73044
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
73024
73045
|
var Droppable2 = (props) => {
|
73025
73046
|
const { status } = useAppContext2();
|
73026
73047
|
const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
|
73027
|
-
return /* @__PURE__ */ (0,
|
73048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(El, __spreadValues2({}, props));
|
73028
73049
|
};
|
73029
73050
|
init_react_import2();
|
73030
73051
|
var import_dnd2 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
73031
|
-
var
|
73052
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
73032
73053
|
var defaultProvided2 = {
|
73033
73054
|
draggableProps: {
|
73034
73055
|
"data-rfd-draggable-context-id": "",
|
@@ -73052,7 +73073,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73052
73073
|
type: "",
|
73053
73074
|
source: { droppableId: "", index: 0 }
|
73054
73075
|
};
|
73055
|
-
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0,
|
73076
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_jsx_runtime62.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
73056
73077
|
var Draggable2 = ({
|
73057
73078
|
className,
|
73058
73079
|
children,
|
@@ -73064,22 +73085,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73064
73085
|
}) => {
|
73065
73086
|
const { status } = useAppContext2();
|
73066
73087
|
const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
|
73067
|
-
return /* @__PURE__ */ (0,
|
73088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
73068
73089
|
var _a3;
|
73069
|
-
return /* @__PURE__ */ (0,
|
73070
|
-
/* @__PURE__ */ (0,
|
73090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
73091
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
73071
73092
|
"div",
|
73072
73093
|
__spreadProps2(__spreadValues2(__spreadValues2({
|
73073
73094
|
className: className && className(provided, snapshot),
|
73074
73095
|
ref: provided.innerRef
|
73075
73096
|
}, provided.draggableProps), provided.dragHandleProps), {
|
73076
73097
|
style: __spreadProps2(__spreadValues2({}, provided.draggableProps.style), {
|
73077
|
-
transform: snapshot.isDragging || !disableAnimations ? (_a3 = provided.draggableProps.style) == null ? void 0 : _a3.transform : "translate(0px, 0px)"
|
73098
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a3 = provided.draggableProps.style) == null ? void 0 : _a3.transform : "translate(0px, 0px)",
|
73099
|
+
cursor: isDragDisabled ? "no-drop" : "grab"
|
73078
73100
|
}),
|
73079
73101
|
children: children(provided, snapshot)
|
73080
73102
|
})
|
73081
73103
|
),
|
73082
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0,
|
73104
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
73083
73105
|
"div",
|
73084
73106
|
{
|
73085
73107
|
className: className && className(provided, snapshot),
|
@@ -73093,22 +73115,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73093
73115
|
var import_react52 = require("react");
|
73094
73116
|
init_react_import2();
|
73095
73117
|
init_react_import2();
|
73096
|
-
var
|
73097
|
-
var
|
73098
|
-
var
|
73099
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
73118
|
+
var styles_module_default52 = { "DragIcon": "_DragIcon_17p8x_1", "DragIcon--disabled": "_DragIcon--disabled_17p8x_8" };
|
73119
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
73120
|
+
var getClassName42 = get_class_name_factory_default2("DragIcon", styles_module_default52);
|
73121
|
+
var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getClassName42({ disabled: isDragDisabled }), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
73100
73122
|
init_react_import2();
|
73101
73123
|
var import_dnd3 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
73102
|
-
var
|
73103
|
-
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0,
|
73124
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
73125
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_jsx_runtime82.Fragment, { children });
|
73104
73126
|
var DragDropContext2 = (props) => {
|
73105
73127
|
const { status } = useAppContext2();
|
73106
73128
|
const El = status !== "LOADING" ? import_dnd3.DragDropContext : DefaultDragDropContext;
|
73107
|
-
return /* @__PURE__ */ (0,
|
73129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(El, __spreadValues2({}, props));
|
73108
73130
|
};
|
73109
|
-
var
|
73110
|
-
var
|
73111
|
-
var getClassNameItem3 = get_class_name_factory_default2("ArrayFieldItem",
|
73131
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
73132
|
+
var getClassName52 = get_class_name_factory_default2("ArrayField", styles_module_default32);
|
73133
|
+
var getClassNameItem3 = get_class_name_factory_default2("ArrayFieldItem", styles_module_default32);
|
73112
73134
|
var ArrayField = ({
|
73113
73135
|
field,
|
73114
73136
|
onChange,
|
@@ -73117,7 +73139,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73117
73139
|
label,
|
73118
73140
|
readOnly,
|
73119
73141
|
id,
|
73120
|
-
Label = (props) => /* @__PURE__ */ (0,
|
73142
|
+
Label = (props) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", __spreadValues2({}, props))
|
73121
73143
|
}) => {
|
73122
73144
|
const { state, setUi, selectedItem } = useAppContext2();
|
73123
73145
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
@@ -73180,14 +73202,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73180
73202
|
return null;
|
73181
73203
|
}
|
73182
73204
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
73183
|
-
return /* @__PURE__ */ (0,
|
73205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73184
73206
|
Label,
|
73185
73207
|
{
|
73186
73208
|
label: label || name,
|
73187
|
-
icon: /* @__PURE__ */ (0,
|
73209
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(List, { size: 16 }),
|
73188
73210
|
el: "div",
|
73189
73211
|
readOnly,
|
73190
|
-
children: /* @__PURE__ */ (0,
|
73212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73191
73213
|
DragDropContext2,
|
73192
73214
|
{
|
73193
73215
|
onDragEnd: (event) => {
|
@@ -73214,12 +73236,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73214
73236
|
});
|
73215
73237
|
}
|
73216
73238
|
},
|
73217
|
-
children: /* @__PURE__ */ (0,
|
73218
|
-
return /* @__PURE__ */ (0,
|
73239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Droppable2, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
73240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
73219
73241
|
"div",
|
73220
73242
|
__spreadProps2(__spreadValues2({}, provided.droppableProps), {
|
73221
73243
|
ref: provided.innerRef,
|
73222
|
-
className:
|
73244
|
+
className: getClassName52({
|
73223
73245
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
73224
73246
|
hasItems: Array.isArray(value) && value.length > 0,
|
73225
73247
|
addDisabled
|
@@ -73236,7 +73258,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73236
73258
|
localState.arrayState.items.map((item, i2) => {
|
73237
73259
|
const { _arrayId = `${id}-${i2}`, _originalIndex = i2 } = item;
|
73238
73260
|
const data = Array.from(localState.value || [])[i2] || {};
|
73239
|
-
return /* @__PURE__ */ (0,
|
73261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73240
73262
|
Draggable2,
|
73241
73263
|
{
|
73242
73264
|
id: _arrayId,
|
@@ -73247,8 +73269,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73247
73269
|
readOnly
|
73248
73270
|
}),
|
73249
73271
|
isDragDisabled: readOnly || !hovering,
|
73250
|
-
children: () => /* @__PURE__ */ (0,
|
73251
|
-
/* @__PURE__ */ (0,
|
73272
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
73273
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
73252
73274
|
"div",
|
73253
73275
|
{
|
73254
73276
|
onClick: () => {
|
@@ -73269,8 +73291,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73269
73291
|
className: getClassNameItem3("summary"),
|
73270
73292
|
children: [
|
73271
73293
|
field.getItemSummary ? field.getItemSummary(data, i2) : `Item #${_originalIndex}`,
|
73272
|
-
/* @__PURE__ */ (0,
|
73273
|
-
!readOnly && /* @__PURE__ */ (0,
|
73294
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassNameItem3("rhs"), children: [
|
73295
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassNameItem3("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassNameItem3("action"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73274
73296
|
IconButton,
|
73275
73297
|
{
|
73276
73298
|
type: "button",
|
@@ -73293,20 +73315,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73293
73315
|
);
|
73294
73316
|
},
|
73295
73317
|
title: "Delete",
|
73296
|
-
children: /* @__PURE__ */ (0,
|
73318
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Trash, { size: 16 })
|
73297
73319
|
}
|
73298
73320
|
) }) }),
|
73299
|
-
/* @__PURE__ */ (0,
|
73321
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DragIcon, {}) })
|
73300
73322
|
] })
|
73301
73323
|
]
|
73302
73324
|
}
|
73303
73325
|
),
|
73304
|
-
/* @__PURE__ */ (0,
|
73326
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassNameItem3("body"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("fieldset", { className: getClassNameItem3("fieldset"), children: Object.keys(field.arrayFields).map(
|
73305
73327
|
(fieldName) => {
|
73306
73328
|
const subField = field.arrayFields[fieldName];
|
73307
73329
|
const subFieldName = `${name}[${i2}].${fieldName}`;
|
73308
73330
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
73309
|
-
return /* @__PURE__ */ (0,
|
73331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73310
73332
|
AutoFieldPrivate,
|
73311
73333
|
{
|
73312
73334
|
name: subFieldName,
|
@@ -73334,11 +73356,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73334
73356
|
);
|
73335
73357
|
}),
|
73336
73358
|
provided.placeholder,
|
73337
|
-
!addDisabled && /* @__PURE__ */ (0,
|
73359
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73338
73360
|
"button",
|
73339
73361
|
{
|
73340
73362
|
type: "button",
|
73341
|
-
className:
|
73363
|
+
className: getClassName52("addButton"),
|
73342
73364
|
onClick: () => {
|
73343
73365
|
const existingValue = value || [];
|
73344
73366
|
const newValue = [
|
@@ -73348,7 +73370,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73348
73370
|
const newArrayState = regenerateArrayState(newValue);
|
73349
73371
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
73350
73372
|
},
|
73351
|
-
children: /* @__PURE__ */ (0,
|
73373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Plus, { size: 21 })
|
73352
73374
|
}
|
73353
73375
|
)
|
73354
73376
|
]
|
@@ -73361,8 +73383,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73361
73383
|
);
|
73362
73384
|
};
|
73363
73385
|
init_react_import2();
|
73364
|
-
var
|
73365
|
-
var
|
73386
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
73387
|
+
var getClassName62 = get_class_name_factory_default2("Input", styles_module_default22);
|
73366
73388
|
var DefaultField = ({
|
73367
73389
|
field,
|
73368
73390
|
onChange,
|
@@ -73373,19 +73395,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73373
73395
|
Label,
|
73374
73396
|
id
|
73375
73397
|
}) => {
|
73376
|
-
return /* @__PURE__ */ (0,
|
73398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
73377
73399
|
Label,
|
73378
73400
|
{
|
73379
73401
|
label: label || name,
|
73380
|
-
icon: /* @__PURE__ */ (0,
|
73381
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
73382
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
73402
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
73403
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Type, { size: 16 }),
|
73404
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hash, { size: 16 })
|
73383
73405
|
] }),
|
73384
73406
|
readOnly,
|
73385
|
-
children: /* @__PURE__ */ (0,
|
73407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
73386
73408
|
"input",
|
73387
73409
|
{
|
73388
|
-
className:
|
73410
|
+
className: getClassName62("input"),
|
73389
73411
|
autoComplete: "off",
|
73390
73412
|
type: field.type,
|
73391
73413
|
name,
|
@@ -73412,14 +73434,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73412
73434
|
init_react_import2();
|
73413
73435
|
var import_react82 = require("react");
|
73414
73436
|
init_react_import2();
|
73415
|
-
var
|
73437
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_19obq_1", "ExternalInput-button": "_ExternalInput-button_19obq_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_19obq_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_19obq_32", "ExternalInputModal": "_ExternalInputModal_19obq_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_19obq_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_19obq_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_19obq_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_19obq_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_19obq_128", "ExternalInputModal-table": "_ExternalInputModal-table_19obq_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_19obq_144", "ExternalInputModal-th": "_ExternalInputModal-th_19obq_144", "ExternalInputModal-td": "_ExternalInputModal-td_19obq_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_19obq_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_19obq_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_19obq_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_19obq_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_19obq_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_19obq_222", "ExternalInputModal-search": "_ExternalInputModal-search_19obq_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_19obq_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_19obq_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_19obq_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_19obq_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_19obq_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_19obq_325" };
|
73416
73438
|
init_react_import2();
|
73417
73439
|
var import_react62 = require("react");
|
73418
73440
|
init_react_import2();
|
73419
|
-
var
|
73441
|
+
var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
|
73420
73442
|
var import_react_dom3 = __toESM2(require_react_dom2());
|
73421
|
-
var
|
73422
|
-
var
|
73443
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
73444
|
+
var getClassName7 = get_class_name_factory_default2("Modal", styles_module_default7);
|
73423
73445
|
var Modal = ({
|
73424
73446
|
children,
|
73425
73447
|
onClose,
|
@@ -73430,13 +73452,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73430
73452
|
setRootEl(document.getElementById("puck-portal-root"));
|
73431
73453
|
}, []);
|
73432
73454
|
if (!rootEl) {
|
73433
|
-
return /* @__PURE__ */ (0,
|
73455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {});
|
73434
73456
|
}
|
73435
73457
|
return (0, import_react_dom3.createPortal)(
|
73436
|
-
/* @__PURE__ */ (0,
|
73458
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
73437
73459
|
"div",
|
73438
73460
|
{
|
73439
|
-
className:
|
73461
|
+
className: getClassName7("inner"),
|
73440
73462
|
onClick: (e2) => e2.stopPropagation(),
|
73441
73463
|
children
|
73442
73464
|
}
|
@@ -73446,15 +73468,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73446
73468
|
};
|
73447
73469
|
init_react_import2();
|
73448
73470
|
init_react_import2();
|
73449
|
-
var
|
73450
|
-
var
|
73451
|
-
var
|
73471
|
+
var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
73472
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
73473
|
+
var getClassName8 = get_class_name_factory_default2("Heading", styles_module_default8);
|
73452
73474
|
var Heading2 = ({ children, rank, size = "m" }) => {
|
73453
73475
|
const Tag = rank ? `h${rank}` : "span";
|
73454
|
-
return /* @__PURE__ */ (0,
|
73476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
73455
73477
|
Tag,
|
73456
73478
|
{
|
73457
|
-
className:
|
73479
|
+
className: getClassName8({
|
73458
73480
|
[size]: true
|
73459
73481
|
}),
|
73460
73482
|
children
|
@@ -73466,8 +73488,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73466
73488
|
var import_react72 = require("react");
|
73467
73489
|
init_react_import2();
|
73468
73490
|
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
73469
|
-
var
|
73470
|
-
var
|
73491
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
73492
|
+
var getClassName9 = get_class_name_factory_default2("Button", Button_module_default);
|
73471
73493
|
var Button = ({
|
73472
73494
|
children,
|
73473
73495
|
href,
|
@@ -73485,10 +73507,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73485
73507
|
const [loading, setLoading] = (0, import_react72.useState)(loadingProp);
|
73486
73508
|
(0, import_react72.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
73487
73509
|
const ElementType = href ? "a" : type ? "button" : "span";
|
73488
|
-
const el = /* @__PURE__ */ (0,
|
73510
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
73489
73511
|
ElementType,
|
73490
73512
|
{
|
73491
|
-
className:
|
73513
|
+
className: getClassName9({
|
73492
73514
|
primary: variant === "primary",
|
73493
73515
|
secondary: variant === "secondary",
|
73494
73516
|
disabled,
|
@@ -73509,17 +73531,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73509
73531
|
rel: newTab ? "noreferrer" : void 0,
|
73510
73532
|
href,
|
73511
73533
|
children: [
|
73512
|
-
icon && /* @__PURE__ */ (0,
|
73534
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
73513
73535
|
children,
|
73514
|
-
loading && /* @__PURE__ */ (0,
|
73536
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader2, { size: 14 }) })
|
73515
73537
|
]
|
73516
73538
|
}
|
73517
73539
|
);
|
73518
73540
|
return el;
|
73519
73541
|
};
|
73520
|
-
var
|
73521
|
-
var
|
73522
|
-
var getClassNameModal = get_class_name_factory_default2("ExternalInputModal",
|
73542
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
73543
|
+
var getClassName10 = get_class_name_factory_default2("ExternalInput", styles_module_default6);
|
73544
|
+
var getClassNameModal = get_class_name_factory_default2("ExternalInputModal", styles_module_default6);
|
73523
73545
|
var dataCache = {};
|
73524
73546
|
var ExternalInput = ({
|
73525
73547
|
field,
|
@@ -73570,40 +73592,40 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73570
73592
|
(0, import_react82.useEffect)(() => {
|
73571
73593
|
search(searchQuery, filters);
|
73572
73594
|
}, []);
|
73573
|
-
return /* @__PURE__ */ (0,
|
73595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
73574
73596
|
"div",
|
73575
73597
|
{
|
73576
|
-
className:
|
73598
|
+
className: getClassName10({
|
73577
73599
|
dataSelected: !!value,
|
73578
73600
|
modalVisible: isOpen
|
73579
73601
|
}),
|
73580
73602
|
id,
|
73581
73603
|
children: [
|
73582
|
-
/* @__PURE__ */ (0,
|
73583
|
-
/* @__PURE__ */ (0,
|
73604
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName10("actions"), children: [
|
73605
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73584
73606
|
"button",
|
73585
73607
|
{
|
73586
73608
|
type: "button",
|
73587
73609
|
onClick: () => setOpen(true),
|
73588
|
-
className:
|
73589
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
73590
|
-
/* @__PURE__ */ (0,
|
73591
|
-
/* @__PURE__ */ (0,
|
73610
|
+
className: getClassName10("button"),
|
73611
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
73612
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: "16" }),
|
73613
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: field.placeholder })
|
73592
73614
|
] })
|
73593
73615
|
}
|
73594
73616
|
),
|
73595
|
-
value && /* @__PURE__ */ (0,
|
73617
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73596
73618
|
"button",
|
73597
73619
|
{
|
73598
|
-
className:
|
73620
|
+
className: getClassName10("detachButton"),
|
73599
73621
|
onClick: () => {
|
73600
73622
|
onChange(null);
|
73601
73623
|
},
|
73602
|
-
children: /* @__PURE__ */ (0,
|
73624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Unlock, { size: 16 })
|
73603
73625
|
}
|
73604
73626
|
)
|
73605
73627
|
] }),
|
73606
|
-
/* @__PURE__ */ (0,
|
73628
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
73607
73629
|
"form",
|
73608
73630
|
{
|
73609
73631
|
className: getClassNameModal({
|
@@ -73617,11 +73639,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73617
73639
|
search(searchQuery, filters);
|
73618
73640
|
},
|
73619
73641
|
children: [
|
73620
|
-
/* @__PURE__ */ (0,
|
73621
|
-
/* @__PURE__ */ (0,
|
73622
|
-
/* @__PURE__ */ (0,
|
73623
|
-
/* @__PURE__ */ (0,
|
73624
|
-
/* @__PURE__ */ (0,
|
73642
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
73643
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassNameModal("search"), children: [
|
73644
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
73645
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Search, { size: "18" }) }),
|
73646
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73625
73647
|
"input",
|
73626
73648
|
{
|
73627
73649
|
className: getClassNameModal("searchInput"),
|
@@ -73636,9 +73658,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73636
73658
|
}
|
73637
73659
|
)
|
73638
73660
|
] }),
|
73639
|
-
/* @__PURE__ */ (0,
|
73640
|
-
/* @__PURE__ */ (0,
|
73641
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
73661
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
73662
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
73663
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73642
73664
|
IconButton,
|
73643
73665
|
{
|
73644
73666
|
title: "Toggle filters",
|
@@ -73647,15 +73669,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73647
73669
|
e2.stopPropagation();
|
73648
73670
|
setFiltersToggled(!filtersToggled);
|
73649
73671
|
},
|
73650
|
-
children: /* @__PURE__ */ (0,
|
73672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
|
73651
73673
|
}
|
73652
73674
|
) })
|
73653
73675
|
] })
|
73654
|
-
] }) : /* @__PURE__ */ (0,
|
73655
|
-
/* @__PURE__ */ (0,
|
73656
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
73676
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading2, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
73677
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
73678
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
73657
73679
|
const filterField = filterFields[fieldName];
|
73658
|
-
return /* @__PURE__ */ (0,
|
73680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73659
73681
|
AutoFieldPrivate,
|
73660
73682
|
{
|
73661
73683
|
field: filterField,
|
@@ -73672,9 +73694,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73672
73694
|
fieldName
|
73673
73695
|
);
|
73674
73696
|
}) }),
|
73675
|
-
/* @__PURE__ */ (0,
|
73676
|
-
/* @__PURE__ */ (0,
|
73677
|
-
/* @__PURE__ */ (0,
|
73697
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
73698
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: getClassNameModal("table"), children: [
|
73699
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73678
73700
|
"th",
|
73679
73701
|
{
|
73680
73702
|
className: getClassNameModal("th"),
|
@@ -73683,8 +73705,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73683
73705
|
},
|
73684
73706
|
key
|
73685
73707
|
)) }) }),
|
73686
|
-
/* @__PURE__ */ (0,
|
73687
|
-
return /* @__PURE__ */ (0,
|
73708
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i2) => {
|
73709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73688
73710
|
"tr",
|
73689
73711
|
{
|
73690
73712
|
style: { whiteSpace: "nowrap" },
|
@@ -73693,16 +73715,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73693
73715
|
onChange(mapProp(data[i2]));
|
73694
73716
|
setOpen(false);
|
73695
73717
|
},
|
73696
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
73718
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
73697
73719
|
},
|
73698
73720
|
i2
|
73699
73721
|
);
|
73700
73722
|
}) })
|
73701
73723
|
] }),
|
73702
|
-
/* @__PURE__ */ (0,
|
73724
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader2, { size: 24 }) })
|
73703
73725
|
] })
|
73704
73726
|
] }),
|
73705
|
-
/* @__PURE__ */ (0,
|
73727
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
73706
73728
|
mappedData.length,
|
73707
73729
|
" result",
|
73708
73730
|
mappedData.length === 1 ? "" : "s"
|
@@ -73714,7 +73736,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73714
73736
|
}
|
73715
73737
|
);
|
73716
73738
|
};
|
73717
|
-
var
|
73739
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
73718
73740
|
var ExternalField = ({
|
73719
73741
|
field,
|
73720
73742
|
onChange,
|
@@ -73737,7 +73759,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73737
73759
|
if (field.type !== "external") {
|
73738
73760
|
return null;
|
73739
73761
|
}
|
73740
|
-
return /* @__PURE__ */ (0,
|
73762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
73741
73763
|
ExternalInput,
|
73742
73764
|
{
|
73743
73765
|
name,
|
@@ -73759,8 +73781,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73759
73781
|
) });
|
73760
73782
|
};
|
73761
73783
|
init_react_import2();
|
73762
|
-
var
|
73763
|
-
var
|
73784
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
73785
|
+
var getClassName11 = get_class_name_factory_default2("Input", styles_module_default22);
|
73764
73786
|
var RadioField = ({
|
73765
73787
|
field,
|
73766
73788
|
onChange,
|
@@ -73774,23 +73796,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73774
73796
|
if (field.type !== "radio" || !field.options) {
|
73775
73797
|
return null;
|
73776
73798
|
}
|
73777
|
-
return /* @__PURE__ */ (0,
|
73799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
73778
73800
|
Label,
|
73779
73801
|
{
|
73780
|
-
icon: /* @__PURE__ */ (0,
|
73802
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckCircle, { size: 16 }),
|
73781
73803
|
label: label || name,
|
73782
73804
|
readOnly,
|
73783
73805
|
el: "div",
|
73784
|
-
children: /* @__PURE__ */ (0,
|
73806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
73785
73807
|
"label",
|
73786
73808
|
{
|
73787
|
-
className:
|
73809
|
+
className: getClassName11("radio"),
|
73788
73810
|
children: [
|
73789
|
-
/* @__PURE__ */ (0,
|
73811
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
73790
73812
|
"input",
|
73791
73813
|
{
|
73792
73814
|
type: "radio",
|
73793
|
-
className:
|
73815
|
+
className: getClassName11("radioInput"),
|
73794
73816
|
value: option.value,
|
73795
73817
|
name,
|
73796
73818
|
onChange: (e2) => {
|
@@ -73804,7 +73826,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73804
73826
|
checked: value === option.value
|
73805
73827
|
}
|
73806
73828
|
),
|
73807
|
-
/* @__PURE__ */ (0,
|
73829
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
73808
73830
|
]
|
73809
73831
|
},
|
73810
73832
|
option.label + option.value
|
@@ -73813,8 +73835,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73813
73835
|
);
|
73814
73836
|
};
|
73815
73837
|
init_react_import2();
|
73816
|
-
var
|
73817
|
-
var
|
73838
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
73839
|
+
var getClassName12 = get_class_name_factory_default2("Input", styles_module_default22);
|
73818
73840
|
var SelectField = ({
|
73819
73841
|
field,
|
73820
73842
|
onChange,
|
@@ -73828,17 +73850,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73828
73850
|
if (field.type !== "select" || !field.options) {
|
73829
73851
|
return null;
|
73830
73852
|
}
|
73831
|
-
return /* @__PURE__ */ (0,
|
73853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
73832
73854
|
Label,
|
73833
73855
|
{
|
73834
73856
|
label: label || name,
|
73835
|
-
icon: /* @__PURE__ */ (0,
|
73857
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDown, { size: 16 }),
|
73836
73858
|
readOnly,
|
73837
|
-
children: /* @__PURE__ */ (0,
|
73859
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
73838
73860
|
"select",
|
73839
73861
|
{
|
73840
73862
|
id,
|
73841
|
-
className:
|
73863
|
+
className: getClassName12("input"),
|
73842
73864
|
disabled: readOnly,
|
73843
73865
|
onChange: (e2) => {
|
73844
73866
|
if (e2.currentTarget.value === "true" || e2.currentTarget.value === "false") {
|
@@ -73848,7 +73870,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73848
73870
|
onChange(e2.currentTarget.value);
|
73849
73871
|
},
|
73850
73872
|
value,
|
73851
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
73873
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
73852
73874
|
"option",
|
73853
73875
|
{
|
73854
73876
|
label: option.label,
|
@@ -73862,8 +73884,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73862
73884
|
);
|
73863
73885
|
};
|
73864
73886
|
init_react_import2();
|
73865
|
-
var
|
73866
|
-
var
|
73887
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
73888
|
+
var getClassName13 = get_class_name_factory_default2("Input", styles_module_default22);
|
73867
73889
|
var TextareaField = ({
|
73868
73890
|
onChange,
|
73869
73891
|
readOnly,
|
@@ -73873,11 +73895,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73873
73895
|
Label,
|
73874
73896
|
id
|
73875
73897
|
}) => {
|
73876
|
-
return /* @__PURE__ */ (0,
|
73898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
73877
73899
|
"textarea",
|
73878
73900
|
{
|
73879
73901
|
id,
|
73880
|
-
className:
|
73902
|
+
className: getClassName13("input"),
|
73881
73903
|
autoComplete: "off",
|
73882
73904
|
name,
|
73883
73905
|
value: typeof value === "undefined" ? "" : value,
|
@@ -73891,9 +73913,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73891
73913
|
var import_use_debounce = (init_index_module(), __toCommonJS(index_module_exports));
|
73892
73914
|
init_react_import2();
|
73893
73915
|
init_react_import2();
|
73894
|
-
var
|
73895
|
-
var
|
73896
|
-
var
|
73916
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
73917
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
73918
|
+
var getClassName14 = get_class_name_factory_default2("ObjectField", styles_module_default9);
|
73897
73919
|
var ObjectField = ({
|
73898
73920
|
field,
|
73899
73921
|
onChange,
|
@@ -73910,18 +73932,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73910
73932
|
}
|
73911
73933
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
73912
73934
|
const data = value || {};
|
73913
|
-
return /* @__PURE__ */ (0,
|
73935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
73914
73936
|
Label,
|
73915
73937
|
{
|
73916
73938
|
label: label || name,
|
73917
|
-
icon: /* @__PURE__ */ (0,
|
73939
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MoreVertical, { size: 16 }),
|
73918
73940
|
el: "div",
|
73919
73941
|
readOnly,
|
73920
|
-
children: /* @__PURE__ */ (0,
|
73942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
73921
73943
|
const subField = field.objectFields[fieldName];
|
73922
73944
|
const subFieldName = `${name}.${fieldName}`;
|
73923
73945
|
const wildcardFieldName = `${name}.${fieldName}`;
|
73924
|
-
return /* @__PURE__ */ (0,
|
73946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
73925
73947
|
AutoFieldPrivate,
|
73926
73948
|
{
|
73927
73949
|
name: subFieldName,
|
@@ -73957,8 +73979,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73957
73979
|
const [id] = (0, import_react102.useState)(generateId());
|
73958
73980
|
return id;
|
73959
73981
|
};
|
73960
|
-
var
|
73961
|
-
var
|
73982
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
73983
|
+
var getClassName15 = get_class_name_factory_default2("Input", styles_module_default22);
|
73962
73984
|
var FieldLabel = ({
|
73963
73985
|
children,
|
73964
73986
|
icon,
|
@@ -73968,11 +73990,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73968
73990
|
className
|
73969
73991
|
}) => {
|
73970
73992
|
const El = el;
|
73971
|
-
return /* @__PURE__ */ (0,
|
73972
|
-
/* @__PURE__ */ (0,
|
73973
|
-
icon ? /* @__PURE__ */ (0,
|
73993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(El, { className, children: [
|
73994
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName15("label"), children: [
|
73995
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {}),
|
73974
73996
|
label,
|
73975
|
-
readOnly && /* @__PURE__ */ (0,
|
73997
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Lock, { size: "12" }) })
|
73976
73998
|
] }),
|
73977
73999
|
children
|
73978
74000
|
] });
|
@@ -73990,14 +74012,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73990
74012
|
[overrides]
|
73991
74013
|
);
|
73992
74014
|
if (!label) {
|
73993
|
-
return /* @__PURE__ */ (0,
|
74015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
73994
74016
|
}
|
73995
|
-
return /* @__PURE__ */ (0,
|
74017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
73996
74018
|
Wrapper,
|
73997
74019
|
{
|
73998
74020
|
label,
|
73999
74021
|
icon,
|
74000
|
-
className:
|
74022
|
+
className: getClassName15({ readOnly }),
|
74001
74023
|
readOnly,
|
74002
74024
|
el,
|
74003
74025
|
children
|
@@ -74041,11 +74063,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74041
74063
|
return null;
|
74042
74064
|
}
|
74043
74065
|
const CustomField = field.render;
|
74044
|
-
return /* @__PURE__ */ (0,
|
74066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues2({}, mergedProps)) });
|
74045
74067
|
}
|
74046
74068
|
const children = defaultFields[field.type](mergedProps);
|
74047
74069
|
const Render2 = render[field.type];
|
74048
|
-
return /* @__PURE__ */ (0,
|
74070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps2(__spreadValues2({}, mergedProps), { children }));
|
74049
74071
|
}
|
74050
74072
|
function AutoFieldPrivate(props) {
|
74051
74073
|
const { value, onChange } = props;
|
@@ -74068,55 +74090,68 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74068
74090
|
value: localValue,
|
74069
74091
|
onChange: onChangeLocal
|
74070
74092
|
};
|
74071
|
-
return /* @__PURE__ */ (0,
|
74093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues2(__spreadValues2({}, props), localProps));
|
74072
74094
|
}
|
74073
|
-
var DefaultLabel = (props) => /* @__PURE__ */ (0,
|
74095
|
+
var DefaultLabel = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", __spreadValues2({}, props));
|
74074
74096
|
function AutoField(props) {
|
74075
|
-
return /* @__PURE__ */ (0,
|
74097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadProps2(__spreadValues2({}, props), { Label: DefaultLabel }));
|
74076
74098
|
}
|
74077
74099
|
init_react_import2();
|
74078
74100
|
init_react_import2();
|
74079
|
-
var
|
74101
|
+
var styles_module_default10 = { "Drawer": "_Drawer_4yfqn_1", "DrawerItem--disabled": "_DrawerItem--disabled_4yfqn_5", "DrawerItem-default": "_DrawerItem-default_4yfqn_11", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_4yfqn_11", "DrawerItem": "_DrawerItem_4yfqn_5", "DrawerItem-draggable": "_DrawerItem-draggable_4yfqn_11", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_4yfqn_36", "DrawerItem-name": "_DrawerItem-name_4yfqn_54" };
|
74080
74102
|
var import_react122 = require("react");
|
74081
|
-
var
|
74082
|
-
var
|
74083
|
-
var getClassNameItem22 = get_class_name_factory_default2("DrawerItem",
|
74103
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
74104
|
+
var getClassName16 = get_class_name_factory_default2("Drawer", styles_module_default10);
|
74105
|
+
var getClassNameItem22 = get_class_name_factory_default2("DrawerItem", styles_module_default10);
|
74084
74106
|
var drawerContext = (0, import_react122.createContext)({
|
74085
74107
|
droppableId: ""
|
74086
74108
|
});
|
74087
74109
|
var DrawerDraggable = ({
|
74088
74110
|
children,
|
74089
74111
|
id,
|
74090
|
-
index
|
74091
|
-
|
74092
|
-
|
74093
|
-
|
74094
|
-
|
74095
|
-
|
74096
|
-
|
74097
|
-
|
74098
|
-
|
74099
|
-
|
74100
|
-
|
74101
|
-
|
74102
|
-
|
74112
|
+
index,
|
74113
|
+
isDragDisabled
|
74114
|
+
}) => {
|
74115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
74116
|
+
Draggable2,
|
74117
|
+
{
|
74118
|
+
id,
|
74119
|
+
index,
|
74120
|
+
isDragDisabled,
|
74121
|
+
showShadow: true,
|
74122
|
+
disableAnimations: true,
|
74123
|
+
className: () => getClassNameItem22({ disabled: isDragDisabled }),
|
74124
|
+
children: () => children
|
74125
|
+
},
|
74126
|
+
id
|
74127
|
+
);
|
74128
|
+
};
|
74103
74129
|
var DrawerItem = ({
|
74104
74130
|
name,
|
74105
74131
|
children,
|
74106
74132
|
id,
|
74107
74133
|
label,
|
74108
|
-
index
|
74134
|
+
index,
|
74135
|
+
isDragDisabled
|
74109
74136
|
}) => {
|
74110
74137
|
const ctx = (0, import_react122.useContext)(drawerContext);
|
74111
74138
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
74112
74139
|
const CustomInner = (0, import_react122.useMemo)(
|
74113
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
74140
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("default"), children: children2 })),
|
74114
74141
|
[children]
|
74115
74142
|
);
|
74116
|
-
return /* @__PURE__ */ (0,
|
74117
|
-
|
74118
|
-
|
74119
|
-
|
74143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
74144
|
+
DrawerDraggable,
|
74145
|
+
{
|
74146
|
+
id: resolvedId,
|
74147
|
+
index,
|
74148
|
+
isDragDisabled,
|
74149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassNameItem22("draggable"), children: [
|
74150
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("name"), children: label != null ? label : name }),
|
74151
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DragIcon, { isDragDisabled }) })
|
74152
|
+
] }) }) })
|
74153
|
+
}
|
74154
|
+
);
|
74120
74155
|
};
|
74121
74156
|
var Drawer = ({
|
74122
74157
|
children,
|
@@ -74124,28 +74159,28 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74124
74159
|
direction = "vertical"
|
74125
74160
|
}) => {
|
74126
74161
|
const droppableId = `component-list:${_droppableId}`;
|
74127
|
-
return /* @__PURE__ */ (0,
|
74162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Droppable2, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
74128
74163
|
"div",
|
74129
74164
|
__spreadProps2(__spreadValues2({}, provided.droppableProps), {
|
74130
74165
|
ref: provided.innerRef,
|
74131
|
-
className:
|
74166
|
+
className: getClassName16({
|
74132
74167
|
isDraggingFrom: !!snapshot.draggingFromThisWith
|
74133
74168
|
}),
|
74134
74169
|
children: [
|
74135
74170
|
children,
|
74136
|
-
/* @__PURE__ */ (0,
|
74171
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
74137
74172
|
]
|
74138
74173
|
})
|
74139
74174
|
) }) });
|
74140
74175
|
};
|
74141
74176
|
Drawer.Item = DrawerItem;
|
74142
74177
|
init_react_import2();
|
74143
|
-
var
|
74178
|
+
var import_react17 = require("react");
|
74144
74179
|
init_react_import2();
|
74145
|
-
var
|
74180
|
+
var import_react15 = require("react");
|
74146
74181
|
var import_dnd4 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
74147
74182
|
init_react_import2();
|
74148
|
-
var
|
74183
|
+
var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1bhad_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1bhad_11", "DraggableComponent-contents": "_DraggableComponent-contents_1bhad_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1bhad_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1bhad_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1bhad_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1bhad_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1bhad_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1bhad_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1bhad_97", "DraggableComponent-actions": "_DraggableComponent-actions_1bhad_97" };
|
74149
74184
|
init_react_import2();
|
74150
74185
|
var import_react132 = require("react");
|
74151
74186
|
var useModifierHeld = (modifier) => {
|
@@ -74180,12 +74215,134 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74180
74215
|
"iPod"
|
74181
74216
|
].includes(navigator.platform) || // iPad on iOS 13 detection
|
74182
74217
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
74183
|
-
|
74184
|
-
var
|
74218
|
+
init_react_import2();
|
74219
|
+
var import_jsx_runtime222 = require("react/jsx-runtime");
|
74220
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(import_jsx_runtime222.Fragment, { children });
|
74221
|
+
init_react_import2();
|
74222
|
+
var import_react14 = require("react");
|
74223
|
+
init_react_import2();
|
74224
|
+
var loadOverrides = ({
|
74225
|
+
overrides,
|
74226
|
+
plugins
|
74227
|
+
}) => {
|
74228
|
+
const collected = __spreadValues2({}, overrides);
|
74229
|
+
plugins.forEach((plugin) => {
|
74230
|
+
Object.keys(plugin.overrides).forEach((overridesType) => {
|
74231
|
+
if (overridesType === "fieldTypes") {
|
74232
|
+
const fieldTypes = plugin.overrides.fieldTypes;
|
74233
|
+
Object.keys(fieldTypes).forEach((fieldType) => {
|
74234
|
+
collected.fieldTypes = collected.fieldTypes || {};
|
74235
|
+
const childNode2 = collected.fieldTypes[fieldType];
|
74236
|
+
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps2(__spreadValues2({}, props), {
|
74237
|
+
children: childNode2 ? childNode2(props) : props.children
|
74238
|
+
}));
|
74239
|
+
collected.fieldTypes[fieldType] = Comp2;
|
74240
|
+
});
|
74241
|
+
return;
|
74242
|
+
}
|
74243
|
+
const childNode = collected[overridesType];
|
74244
|
+
const Comp = (props) => plugin.overrides[overridesType](__spreadProps2(__spreadValues2({}, props), {
|
74245
|
+
children: childNode ? childNode(props) : props.children
|
74246
|
+
}));
|
74247
|
+
collected[overridesType] = Comp;
|
74248
|
+
});
|
74249
|
+
});
|
74250
|
+
return collected;
|
74251
|
+
};
|
74252
|
+
var useLoadedOverrides = ({
|
74253
|
+
overrides,
|
74254
|
+
plugins
|
74255
|
+
}) => {
|
74256
|
+
return (0, import_react14.useMemo)(() => {
|
74257
|
+
return loadOverrides({ overrides, plugins });
|
74258
|
+
}, [plugins, overrides]);
|
74259
|
+
};
|
74260
|
+
init_react_import2();
|
74261
|
+
init_react_import2();
|
74262
|
+
var getChanged = (newItem, oldItem) => {
|
74263
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
74264
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
74265
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
74266
|
+
return __spreadProps2(__spreadValues2({}, acc), {
|
74267
|
+
[item]: oldItemProps[item] !== newItemProps[item]
|
74268
|
+
});
|
74269
|
+
}, {}) : {};
|
74270
|
+
};
|
74271
|
+
init_react_import2();
|
74272
|
+
var resolvePermissions = ({
|
74273
|
+
selectedItem,
|
74274
|
+
config,
|
74275
|
+
changed,
|
74276
|
+
lastPermissions,
|
74277
|
+
initialPermissions,
|
74278
|
+
appState
|
74279
|
+
}) => {
|
74280
|
+
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
74281
|
+
if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolvePermissions)) {
|
74282
|
+
return componentConfig.resolvePermissions(selectedItem, {
|
74283
|
+
changed,
|
74284
|
+
lastPermissions,
|
74285
|
+
initialPermissions,
|
74286
|
+
appState
|
74287
|
+
});
|
74288
|
+
}
|
74289
|
+
return {};
|
74290
|
+
};
|
74291
|
+
var cache = { lastPermissions: {}, lastSelected: {} };
|
74292
|
+
var getPermissions = ({
|
74293
|
+
selectedItem,
|
74294
|
+
type,
|
74295
|
+
globalPermissions,
|
74296
|
+
config,
|
74297
|
+
appState
|
74298
|
+
}) => {
|
74299
|
+
const componentType = type || selectedItem && selectedItem.type || "";
|
74300
|
+
const componentId = selectedItem && selectedItem.props.id || "";
|
74301
|
+
let componentPermissions = getInitialPermissions({
|
74302
|
+
componentType,
|
74303
|
+
config,
|
74304
|
+
globalPermissions
|
74305
|
+
});
|
74306
|
+
const changed = getChanged(selectedItem, cache.lastSelected);
|
74307
|
+
if (Object.values(changed).some((el) => el === true)) {
|
74308
|
+
const resolvedPermissions = resolvePermissions({
|
74309
|
+
selectedItem,
|
74310
|
+
config,
|
74311
|
+
changed,
|
74312
|
+
lastPermissions: cache.lastPermissions[componentId] || componentPermissions,
|
74313
|
+
initialPermissions: componentPermissions,
|
74314
|
+
appState
|
74315
|
+
});
|
74316
|
+
if (resolvedPermissions !== void 0) {
|
74317
|
+
componentPermissions = __spreadValues2(__spreadValues2({}, componentPermissions), resolvedPermissions);
|
74318
|
+
}
|
74319
|
+
cache.lastSelected = selectedItem;
|
74320
|
+
cache.lastPermissions[componentId] = componentPermissions;
|
74321
|
+
return componentPermissions;
|
74322
|
+
}
|
74323
|
+
if (Object.keys(componentId && cache.lastPermissions[componentId]).length !== 0) {
|
74324
|
+
componentPermissions = cache.lastPermissions[componentId];
|
74325
|
+
}
|
74326
|
+
return componentPermissions;
|
74327
|
+
};
|
74328
|
+
var getInitialPermissions = ({
|
74329
|
+
componentType,
|
74330
|
+
globalPermissions,
|
74331
|
+
config
|
74332
|
+
}) => {
|
74333
|
+
var _a3;
|
74334
|
+
return __spreadValues2(__spreadValues2({}, globalPermissions), (_a3 = config.components[componentType]) == null ? void 0 : _a3.permissions);
|
74335
|
+
};
|
74336
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
74337
|
+
var getClassName17 = get_class_name_factory_default2("DraggableComponent", styles_module_default11);
|
74185
74338
|
var space2 = 8;
|
74186
74339
|
var actionsOverlayTop = space2 * 6.5;
|
74187
74340
|
var actionsTop = -(actionsOverlayTop - 8);
|
74188
74341
|
var actionsRight = space2;
|
74342
|
+
var DefaultActionBar = ({
|
74343
|
+
label,
|
74344
|
+
children
|
74345
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefaultOverride, { children }) });
|
74189
74346
|
var DraggableComponent = ({
|
74190
74347
|
children,
|
74191
74348
|
id,
|
@@ -74208,30 +74365,52 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74208
74365
|
indicativeHover = false,
|
74209
74366
|
style: style2
|
74210
74367
|
}) => {
|
74211
|
-
const {
|
74368
|
+
const {
|
74369
|
+
zoomConfig,
|
74370
|
+
status,
|
74371
|
+
overrides,
|
74372
|
+
plugins,
|
74373
|
+
selectedItem,
|
74374
|
+
config,
|
74375
|
+
globalPermissions,
|
74376
|
+
state
|
74377
|
+
} = useAppContext2();
|
74212
74378
|
const isModifierHeld = useModifierHeld("Alt");
|
74213
|
-
const { status } = useAppContext2();
|
74214
74379
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
74215
|
-
(0,
|
74216
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
74217
|
-
(0,
|
74380
|
+
(0, import_react15.useEffect)(onMount, []);
|
74381
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react15.useState)(false);
|
74382
|
+
(0, import_react15.useEffect)(() => {
|
74218
74383
|
if (isIos()) {
|
74219
74384
|
setDisableSecondaryAnimation(true);
|
74220
74385
|
}
|
74221
74386
|
}, []);
|
74222
|
-
|
74387
|
+
const loadedOverrides = useLoadedOverrides({
|
74388
|
+
overrides,
|
74389
|
+
plugins
|
74390
|
+
});
|
74391
|
+
const CustomActionBar = (0, import_react15.useMemo)(
|
74392
|
+
() => loadedOverrides.actionBar || DefaultActionBar,
|
74393
|
+
[loadedOverrides]
|
74394
|
+
);
|
74395
|
+
const permissions = selectedItem && getPermissions({
|
74396
|
+
selectedItem,
|
74397
|
+
globalPermissions: globalPermissions || {},
|
74398
|
+
config,
|
74399
|
+
appState: state
|
74400
|
+
});
|
74401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74223
74402
|
El,
|
74224
74403
|
{
|
74225
74404
|
draggableId: id,
|
74226
74405
|
index,
|
74227
74406
|
isDragDisabled,
|
74228
74407
|
disableSecondaryAnimation,
|
74229
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
74408
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
74230
74409
|
"div",
|
74231
74410
|
__spreadProps2(__spreadValues2(__spreadValues2({
|
74232
74411
|
ref: provided.innerRef
|
74233
74412
|
}, provided.draggableProps), provided.dragHandleProps), {
|
74234
|
-
className:
|
74413
|
+
className: getClassName17({
|
74235
74414
|
isSelected,
|
74236
74415
|
isModifierHeld,
|
74237
74416
|
isDragging: snapshot.isDragging,
|
@@ -74240,7 +74419,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74240
74419
|
indicativeHover
|
74241
74420
|
}),
|
74242
74421
|
style: __spreadProps2(__spreadValues2(__spreadValues2({}, style2), provided.draggableProps.style), {
|
74243
|
-
cursor: isModifierHeld ? "initial" : "grab"
|
74422
|
+
cursor: isModifierHeld || isDragDisabled ? "initial" : "grab"
|
74244
74423
|
}),
|
74245
74424
|
onMouseOver,
|
74246
74425
|
onMouseOut,
|
@@ -74249,34 +74428,33 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74249
74428
|
onClick,
|
74250
74429
|
children: [
|
74251
74430
|
debug,
|
74252
|
-
isLoading && /* @__PURE__ */ (0,
|
74253
|
-
/* @__PURE__ */ (0,
|
74431
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader2, {}) }),
|
74432
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74254
74433
|
"div",
|
74255
74434
|
{
|
74256
|
-
className:
|
74435
|
+
className: getClassName17("actionsOverlay"),
|
74257
74436
|
style: {
|
74258
74437
|
top: actionsOverlayTop / zoomConfig.zoom
|
74259
74438
|
},
|
74260
|
-
children: /* @__PURE__ */ (0,
|
74439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74261
74440
|
"div",
|
74262
74441
|
{
|
74263
|
-
className:
|
74442
|
+
className: getClassName17("actions"),
|
74264
74443
|
style: {
|
74265
74444
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
74266
74445
|
top: actionsTop / zoomConfig.zoom,
|
74267
74446
|
right: actionsRight / zoomConfig.zoom
|
74268
74447
|
},
|
74269
|
-
children: [
|
74270
|
-
|
74271
|
-
/* @__PURE__ */ (0,
|
74272
|
-
|
74273
|
-
]
|
74448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CustomActionBar, { label, children: [
|
74449
|
+
permissions && permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Copy, { size: 16 }) }),
|
74450
|
+
permissions && permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Trash, { size: 16 }) })
|
74451
|
+
] })
|
74274
74452
|
}
|
74275
74453
|
)
|
74276
74454
|
}
|
74277
74455
|
),
|
74278
|
-
/* @__PURE__ */ (0,
|
74279
|
-
/* @__PURE__ */ (0,
|
74456
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("overlay") }),
|
74457
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("contents"), children })
|
74280
74458
|
]
|
74281
74459
|
})
|
74282
74460
|
)
|
@@ -74285,9 +74463,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74285
74463
|
);
|
74286
74464
|
};
|
74287
74465
|
init_react_import2();
|
74288
|
-
var
|
74466
|
+
var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-content": "_DropZone-content_djoti_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_djoti_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_djoti_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_djoti_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_djoti_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_djoti_27", "DropZone--isDisabled": "_DropZone--isDisabled_djoti_28", "DropZone--isRootZone": "_DropZone--isRootZone_djoti_29", "DropZone--hasChildren": "_DropZone--hasChildren_djoti_30", "DropZone--isDestination": "_DropZone--isDestination_djoti_40", "DropZone-item": "_DropZone-item_djoti_52", "DropZone-hitbox": "_DropZone-hitbox_djoti_56" };
|
74289
74467
|
init_react_import2();
|
74290
|
-
var
|
74468
|
+
var import_react16 = require("react");
|
74291
74469
|
var import_use_debounce2 = (init_index_module(), __toCommonJS(index_module_exports));
|
74292
74470
|
init_react_import2();
|
74293
74471
|
var getZoneId2 = (zoneCompound) => {
|
@@ -74299,30 +74477,30 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74299
74477
|
}
|
74300
74478
|
return [rootDroppableId2, zoneCompound];
|
74301
74479
|
};
|
74302
|
-
var
|
74303
|
-
var dropZoneContext2 = (0,
|
74480
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
74481
|
+
var dropZoneContext2 = (0, import_react16.createContext)(null);
|
74304
74482
|
var DropZoneProvider = ({
|
74305
74483
|
children,
|
74306
74484
|
value
|
74307
74485
|
}) => {
|
74308
|
-
const [hoveringArea, setHoveringArea] = (0,
|
74309
|
-
const [hoveringZone, setHoveringZone] = (0,
|
74486
|
+
const [hoveringArea, setHoveringArea] = (0, import_react16.useState)(null);
|
74487
|
+
const [hoveringZone, setHoveringZone] = (0, import_react16.useState)(
|
74310
74488
|
rootDroppableId2
|
74311
74489
|
);
|
74312
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
74490
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react16.useState)();
|
74313
74491
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
74314
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
74492
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react16.useState)(
|
74315
74493
|
{}
|
74316
74494
|
);
|
74317
|
-
const [activeZones, setActiveZones] = (0,
|
74495
|
+
const [activeZones, setActiveZones] = (0, import_react16.useState)({});
|
74318
74496
|
const { dispatch = null } = value ? value : {};
|
74319
|
-
const registerZoneArea = (0,
|
74497
|
+
const registerZoneArea = (0, import_react16.useCallback)(
|
74320
74498
|
(area) => {
|
74321
74499
|
setAreasWithZones((latest) => __spreadProps2(__spreadValues2({}, latest), { [area]: true }));
|
74322
74500
|
},
|
74323
74501
|
[setAreasWithZones]
|
74324
74502
|
);
|
74325
|
-
const registerZone = (0,
|
74503
|
+
const registerZone = (0, import_react16.useCallback)(
|
74326
74504
|
(zoneCompound) => {
|
74327
74505
|
if (!dispatch) {
|
74328
74506
|
return;
|
@@ -74335,7 +74513,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74335
74513
|
},
|
74336
74514
|
[setActiveZones, dispatch]
|
74337
74515
|
);
|
74338
|
-
const unregisterZone = (0,
|
74516
|
+
const unregisterZone = (0, import_react16.useCallback)(
|
74339
74517
|
(zoneCompound) => {
|
74340
74518
|
if (!dispatch) {
|
74341
74519
|
return;
|
@@ -74350,8 +74528,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74350
74528
|
},
|
74351
74529
|
[setActiveZones, dispatch]
|
74352
74530
|
);
|
74353
|
-
const [pathData, setPathData] = (0,
|
74354
|
-
const registerPath = (0,
|
74531
|
+
const [pathData, setPathData] = (0, import_react16.useState)();
|
74532
|
+
const registerPath = (0, import_react16.useCallback)(
|
74355
74533
|
(selector) => {
|
74356
74534
|
if (!(value == null ? void 0 : value.data)) {
|
74357
74535
|
return;
|
@@ -74376,8 +74554,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74376
74554
|
},
|
74377
74555
|
[value, setPathData]
|
74378
74556
|
);
|
74379
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
74380
|
-
return /* @__PURE__ */ (0,
|
74557
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react16.useState)("");
|
74558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
74381
74559
|
dropZoneContext2.Provider,
|
74382
74560
|
{
|
74383
74561
|
value: __spreadValues2({
|
@@ -74401,12 +74579,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74401
74579
|
}
|
74402
74580
|
) });
|
74403
74581
|
};
|
74404
|
-
var
|
74405
|
-
var
|
74582
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
74583
|
+
var getClassName18 = get_class_name_factory_default2("DropZone", styles_module_default12);
|
74406
74584
|
function DropZoneEdit({ zone, allow, disallow, style: style2 }) {
|
74407
74585
|
var _a3;
|
74408
74586
|
const appContext22 = useAppContext2();
|
74409
|
-
const ctx = (0,
|
74587
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74410
74588
|
const {
|
74411
74589
|
// These all need setting via context
|
74412
74590
|
data,
|
@@ -74425,12 +74603,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74425
74603
|
} = ctx || {};
|
74426
74604
|
let content = data.content || [];
|
74427
74605
|
let zoneCompound = rootDroppableId2;
|
74428
|
-
(0,
|
74606
|
+
(0, import_react17.useEffect)(() => {
|
74429
74607
|
if (areaId && registerZoneArea) {
|
74430
74608
|
registerZoneArea(areaId);
|
74431
74609
|
}
|
74432
74610
|
}, [areaId]);
|
74433
|
-
(0,
|
74611
|
+
(0, import_react17.useEffect)(() => {
|
74434
74612
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
74435
74613
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
74436
74614
|
}
|
@@ -74456,7 +74634,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74456
74634
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
74457
74635
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
74458
74636
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
74459
|
-
return /* @__PURE__ */ (0,
|
74637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "DropZone requires context to work." });
|
74460
74638
|
}
|
74461
74639
|
const {
|
74462
74640
|
hoveringArea = "root",
|
@@ -74497,10 +74675,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74497
74675
|
}
|
74498
74676
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
74499
74677
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
74500
|
-
return /* @__PURE__ */ (0,
|
74678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74501
74679
|
"div",
|
74502
74680
|
{
|
74503
|
-
className:
|
74681
|
+
className: getClassName18({
|
74504
74682
|
isRootZone,
|
74505
74683
|
userIsDragging,
|
74506
74684
|
draggingOverArea,
|
@@ -74514,17 +74692,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74514
74692
|
onMouseUp: () => {
|
74515
74693
|
setZoneWillDrag("");
|
74516
74694
|
},
|
74517
|
-
children: /* @__PURE__ */ (0,
|
74695
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74518
74696
|
Droppable2,
|
74519
74697
|
{
|
74520
74698
|
droppableId: zoneCompound,
|
74521
74699
|
direction: "vertical",
|
74522
74700
|
isDropDisabled: !isEnabled,
|
74523
74701
|
children: (provided, snapshot) => {
|
74524
|
-
return /* @__PURE__ */ (0,
|
74702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
74525
74703
|
"div",
|
74526
74704
|
__spreadProps2(__spreadValues2({}, (provided || { droppableProps: {} }).droppableProps), {
|
74527
|
-
className:
|
74705
|
+
className: getClassName18("content"),
|
74528
74706
|
ref: provided == null ? void 0 : provided.innerRef,
|
74529
74707
|
style: style2,
|
74530
74708
|
id: zoneCompound,
|
@@ -74551,25 +74729,34 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74551
74729
|
"draggable-"
|
74552
74730
|
)[1] === componentId;
|
74553
74731
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
74554
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
74732
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
74555
74733
|
"No configuration for ",
|
74556
74734
|
item.type
|
74557
74735
|
] });
|
74558
74736
|
const componentConfig = config.components[item.type];
|
74559
74737
|
const label = (_b2 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b2 : item.type.toString();
|
74560
|
-
|
74738
|
+
const canDrag = getPermissions({
|
74739
|
+
selectedItem: getItem2(
|
74740
|
+
{ index: i2, zone: zoneCompound },
|
74741
|
+
appContext22.state.data
|
74742
|
+
),
|
74743
|
+
config: appContext22.config,
|
74744
|
+
globalPermissions: appContext22.globalPermissions || {},
|
74745
|
+
appState: appContext22.state
|
74746
|
+
}).drag;
|
74747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
74561
74748
|
"div",
|
74562
74749
|
{
|
74563
|
-
className:
|
74750
|
+
className: getClassName18("item"),
|
74564
74751
|
style: { zIndex: isDragging2 ? 1 : void 0 },
|
74565
74752
|
children: [
|
74566
|
-
/* @__PURE__ */ (0,
|
74753
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74567
74754
|
DropZoneProvider,
|
74568
74755
|
{
|
74569
74756
|
value: __spreadProps2(__spreadValues2({}, ctx), {
|
74570
74757
|
areaId: componentId
|
74571
74758
|
}),
|
74572
|
-
children: /* @__PURE__ */ (0,
|
74759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74573
74760
|
DraggableComponent,
|
74574
74761
|
{
|
74575
74762
|
label,
|
@@ -74578,6 +74765,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74578
74765
|
isSelected,
|
74579
74766
|
isLocked: userIsDragging,
|
74580
74767
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
74768
|
+
isDragDisabled: !canDrag,
|
74581
74769
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
74582
74770
|
isLoading: (_c = appContext22.componentState[componentId]) == null ? void 0 : _c.loading,
|
74583
74771
|
onMount: () => {
|
@@ -74636,15 +74824,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74636
74824
|
style: {
|
74637
74825
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
74638
74826
|
},
|
74639
|
-
children: /* @__PURE__ */ (0,
|
74827
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues2({}, defaultedProps)) })
|
74640
74828
|
}
|
74641
74829
|
)
|
74642
74830
|
}
|
74643
74831
|
),
|
74644
|
-
userIsDragging && /* @__PURE__ */ (0,
|
74832
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74645
74833
|
"div",
|
74646
74834
|
{
|
74647
|
-
className:
|
74835
|
+
className: getClassName18("hitbox"),
|
74648
74836
|
onMouseOver: (e2) => {
|
74649
74837
|
e2.stopPropagation();
|
74650
74838
|
setHoveringArea(zoneArea);
|
@@ -74658,7 +74846,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74658
74846
|
);
|
74659
74847
|
}),
|
74660
74848
|
provided == null ? void 0 : provided.placeholder,
|
74661
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
74849
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74662
74850
|
"div",
|
74663
74851
|
{
|
74664
74852
|
"data-puck-placeholder": true,
|
@@ -74679,7 +74867,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74679
74867
|
);
|
74680
74868
|
}
|
74681
74869
|
function DropZoneRender({ zone }) {
|
74682
|
-
const ctx = (0,
|
74870
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74683
74871
|
const { data, areaId = "root", config } = ctx || {};
|
74684
74872
|
let zoneCompound = rootDroppableId2;
|
74685
74873
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -74690,14 +74878,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74690
74878
|
zoneCompound = `${areaId}:${zone}`;
|
74691
74879
|
content = setupZone2(data, zoneCompound).zones[zoneCompound];
|
74692
74880
|
}
|
74693
|
-
return /* @__PURE__ */ (0,
|
74881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: content.map((item) => {
|
74694
74882
|
const Component = config.components[item.type];
|
74695
74883
|
if (Component) {
|
74696
|
-
return /* @__PURE__ */ (0,
|
74884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74697
74885
|
DropZoneProvider,
|
74698
74886
|
{
|
74699
74887
|
value: { data, config, areaId: item.props.id },
|
74700
|
-
children: /* @__PURE__ */ (0,
|
74888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74701
74889
|
Component.render,
|
74702
74890
|
__spreadProps2(__spreadValues2({}, item.props), {
|
74703
74891
|
puck: { renderDropZone: DropZone }
|
@@ -74711,16 +74899,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74711
74899
|
}) });
|
74712
74900
|
}
|
74713
74901
|
function DropZone(props) {
|
74714
|
-
const ctx = (0,
|
74902
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74715
74903
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
74716
|
-
return /* @__PURE__ */ (0,
|
74904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues2({}, props));
|
74717
74905
|
}
|
74718
|
-
return /* @__PURE__ */ (0,
|
74906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender, __spreadValues2({}, props));
|
74719
74907
|
}
|
74720
74908
|
init_react_import2();
|
74721
|
-
var
|
74909
|
+
var import_react31 = require("react");
|
74722
74910
|
init_react_import2();
|
74723
|
-
var
|
74911
|
+
var import_react18 = require("react");
|
74724
74912
|
init_react_import2();
|
74725
74913
|
var getFrame3 = () => {
|
74726
74914
|
let frame = document.querySelector("#preview-frame");
|
@@ -74731,7 +74919,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74731
74919
|
};
|
74732
74920
|
var usePlaceholderStyle = () => {
|
74733
74921
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
74734
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
74922
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react18.useState)();
|
74735
74923
|
const onDragStartOrUpdate = (draggedItem) => {
|
74736
74924
|
var _a3;
|
74737
74925
|
const draggableId = draggedItem.draggableId;
|
@@ -74776,9 +74964,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74776
74964
|
};
|
74777
74965
|
init_react_import2();
|
74778
74966
|
init_react_import2();
|
74779
|
-
var
|
74967
|
+
var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
|
74780
74968
|
init_react_import2();
|
74781
|
-
var
|
74969
|
+
var import_react19 = require("react");
|
74782
74970
|
var convertPathDataToBreadcrumbs2 = (selectedItem, pathData, data) => {
|
74783
74971
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
74784
74972
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues2({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -74828,8 +75016,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74828
75016
|
state: { data },
|
74829
75017
|
selectedItem
|
74830
75018
|
} = useAppContext2();
|
74831
|
-
const dzContext = (0,
|
74832
|
-
return (0,
|
75019
|
+
const dzContext = (0, import_react19.useContext)(dropZoneContext2);
|
75020
|
+
return (0, import_react19.useMemo)(() => {
|
74833
75021
|
const breadcrumbs = convertPathDataToBreadcrumbs2(
|
74834
75022
|
selectedItem,
|
74835
75023
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -74841,8 +75029,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74841
75029
|
return breadcrumbs;
|
74842
75030
|
}, [selectedItem, dzContext == null ? void 0 : dzContext.pathData, renderCount]);
|
74843
75031
|
};
|
74844
|
-
var
|
74845
|
-
var
|
75032
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
75033
|
+
var getClassName19 = get_class_name_factory_default2("SidebarSection", styles_module_default13);
|
74846
75034
|
var SidebarSection2 = ({
|
74847
75035
|
children,
|
74848
75036
|
title,
|
@@ -74854,28 +75042,28 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74854
75042
|
}) => {
|
74855
75043
|
const { setUi } = useAppContext2();
|
74856
75044
|
const breadcrumbs = useBreadcrumbs2(1);
|
74857
|
-
return /* @__PURE__ */ (0,
|
75045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
74858
75046
|
"div",
|
74859
75047
|
{
|
74860
|
-
className:
|
75048
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
74861
75049
|
style: { background },
|
74862
75050
|
children: [
|
74863
|
-
/* @__PURE__ */ (0,
|
74864
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0,
|
74865
|
-
/* @__PURE__ */ (0,
|
75051
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
75052
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
75053
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
74866
75054
|
"button",
|
74867
75055
|
{
|
74868
|
-
className:
|
75056
|
+
className: getClassName19("breadcrumbLabel"),
|
74869
75057
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
74870
75058
|
children: breadcrumb.label
|
74871
75059
|
}
|
74872
75060
|
),
|
74873
|
-
/* @__PURE__ */ (0,
|
75061
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight2, { size: 16 })
|
74874
75062
|
] }, i2)) : null,
|
74875
|
-
/* @__PURE__ */ (0,
|
75063
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading2, { rank: 2, size: "xs", children: title }) })
|
74876
75064
|
] }) }),
|
74877
|
-
/* @__PURE__ */ (0,
|
74878
|
-
isLoading && /* @__PURE__ */ (0,
|
75065
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
75066
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader2, { size: 32 }) })
|
74879
75067
|
]
|
74880
75068
|
}
|
74881
75069
|
);
|
@@ -74977,34 +75165,37 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74977
75165
|
})
|
74978
75166
|
});
|
74979
75167
|
};
|
74980
|
-
var
|
74981
|
-
|
74982
|
-
|
74983
|
-
|
74984
|
-
|
74985
|
-
|
74986
|
-
|
74987
|
-
|
74988
|
-
if (action.destinationZone === rootDroppableId2) {
|
74989
|
-
return __spreadProps2(__spreadValues2({}, data), {
|
74990
|
-
content: insert(
|
74991
|
-
data.content,
|
74992
|
-
action.destinationIndex,
|
74993
|
-
emptyComponentData
|
74994
|
-
)
|
74995
|
-
});
|
74996
|
-
}
|
74997
|
-
const newData = setupZone2(data, action.destinationZone);
|
75168
|
+
var insertAction = (data, action, config) => {
|
75169
|
+
const emptyComponentData = {
|
75170
|
+
type: action.componentType,
|
75171
|
+
props: __spreadProps2(__spreadValues2({}, config.components[action.componentType].defaultProps || {}), {
|
75172
|
+
id: action.id || generateId(action.componentType)
|
75173
|
+
})
|
75174
|
+
};
|
75175
|
+
if (action.destinationZone === rootDroppableId2) {
|
74998
75176
|
return __spreadProps2(__spreadValues2({}, data), {
|
74999
|
-
|
75000
|
-
|
75001
|
-
|
75002
|
-
|
75003
|
-
|
75004
|
-
)
|
75005
|
-
})
|
75177
|
+
content: insert(
|
75178
|
+
data.content,
|
75179
|
+
action.destinationIndex,
|
75180
|
+
emptyComponentData
|
75181
|
+
)
|
75006
75182
|
});
|
75007
75183
|
}
|
75184
|
+
const newData = setupZone2(data, action.destinationZone);
|
75185
|
+
return __spreadProps2(__spreadValues2({}, data), {
|
75186
|
+
zones: __spreadProps2(__spreadValues2({}, newData.zones), {
|
75187
|
+
[action.destinationZone]: insert(
|
75188
|
+
newData.zones[action.destinationZone],
|
75189
|
+
action.destinationIndex,
|
75190
|
+
emptyComponentData
|
75191
|
+
)
|
75192
|
+
})
|
75193
|
+
});
|
75194
|
+
};
|
75195
|
+
var reduceData = (data, action, config) => {
|
75196
|
+
if (action.type === "insert") {
|
75197
|
+
return insertAction(data, action, config);
|
75198
|
+
}
|
75008
75199
|
if (action.type === "duplicate") {
|
75009
75200
|
const item = getItem2(
|
75010
75201
|
{ index: action.sourceIndex, zone: action.sourceZone },
|
@@ -75219,19 +75410,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75219
75410
|
return appState;
|
75220
75411
|
};
|
75221
75412
|
init_react_import2();
|
75222
|
-
var
|
75223
|
-
init_react_import2();
|
75413
|
+
var import_react20 = require("react");
|
75224
75414
|
init_react_import2();
|
75225
|
-
var
|
75226
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
75227
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
75228
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
75229
|
-
return __spreadProps2(__spreadValues2({}, acc), {
|
75230
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
75231
|
-
});
|
75232
|
-
}, {}) : {};
|
75233
|
-
};
|
75234
|
-
var cache = { lastChange: {} };
|
75415
|
+
var cache2 = { lastChange: {} };
|
75235
75416
|
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
|
75236
75417
|
return yield Promise.all(
|
75237
75418
|
content.map((item) => __async2(void 0, null, function* () {
|
@@ -75247,7 +75428,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75247
75428
|
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
|
75248
75429
|
const configForItem = config.components[item.type];
|
75249
75430
|
if (configForItem.resolveData) {
|
75250
|
-
const { item: oldItem = {}, resolved = {} } =
|
75431
|
+
const { item: oldItem = {}, resolved = {} } = cache2.lastChange[item.props.id] || {};
|
75251
75432
|
if (item && item === oldItem) {
|
75252
75433
|
return resolved;
|
75253
75434
|
}
|
@@ -75264,7 +75445,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75264
75445
|
if (Object.keys(newReadOnly).length) {
|
75265
75446
|
resolvedItem.readOnly = newReadOnly;
|
75266
75447
|
}
|
75267
|
-
|
75448
|
+
cache2.lastChange[item.props.id] = {
|
75268
75449
|
item,
|
75269
75450
|
resolved: resolvedItem
|
75270
75451
|
};
|
@@ -75292,20 +75473,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75292
75473
|
});
|
75293
75474
|
};
|
75294
75475
|
init_react_import2();
|
75295
|
-
var
|
75476
|
+
var cache3 = {};
|
75296
75477
|
var resolveRootData = (data, config) => __async2(void 0, null, function* () {
|
75297
75478
|
var _a3, _b2, _c, _d, _e;
|
75298
75479
|
if (((_a3 = config.root) == null ? void 0 : _a3.resolveData) && data.root.props) {
|
75299
|
-
if (((_b2 =
|
75300
|
-
return
|
75480
|
+
if (((_b2 = cache3.lastChange) == null ? void 0 : _b2.original) === data.root) {
|
75481
|
+
return cache3.lastChange.resolved;
|
75301
75482
|
}
|
75302
|
-
const changed = getChanged(data.root, (_c =
|
75483
|
+
const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
|
75303
75484
|
const rootWithProps = data.root;
|
75304
75485
|
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
75305
75486
|
changed,
|
75306
|
-
lastData: ((_d =
|
75487
|
+
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
75307
75488
|
});
|
75308
|
-
|
75489
|
+
cache3.lastChange = {
|
75309
75490
|
original: data.root,
|
75310
75491
|
resolved: resolvedRoot
|
75311
75492
|
};
|
@@ -75316,13 +75497,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75316
75497
|
return data.root;
|
75317
75498
|
});
|
75318
75499
|
var useResolvedData = (appState, config, dispatch) => {
|
75319
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
75500
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
75320
75501
|
resolverKey: 0,
|
75321
75502
|
newAppState: appState
|
75322
75503
|
});
|
75323
|
-
const [componentState, setComponentState] = (0,
|
75504
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
75324
75505
|
const deferredSetStates = {};
|
75325
|
-
const setComponentLoading = (0,
|
75506
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
75326
75507
|
(id, loading, defer2 = 0) => {
|
75327
75508
|
if (deferredSetStates[id]) {
|
75328
75509
|
clearTimeout(deferredSetStates[id]);
|
@@ -75392,10 +75573,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75392
75573
|
});
|
75393
75574
|
yield Promise.all(promises);
|
75394
75575
|
});
|
75395
|
-
(0,
|
75576
|
+
(0, import_react20.useEffect)(() => {
|
75396
75577
|
runResolvers();
|
75397
75578
|
}, [resolverKey]);
|
75398
|
-
const resolveData = (0,
|
75579
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
75399
75580
|
setResolverState((curr) => ({
|
75400
75581
|
resolverKey: curr.resolverKey + 1,
|
75401
75582
|
newAppState: newAppState2
|
@@ -75408,9 +75589,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75408
75589
|
};
|
75409
75590
|
init_react_import2();
|
75410
75591
|
init_react_import2();
|
75411
|
-
var
|
75412
|
-
var
|
75413
|
-
var
|
75592
|
+
var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
75593
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
75594
|
+
var getClassName20 = get_class_name_factory_default2("MenuBar", styles_module_default14);
|
75414
75595
|
var MenuBar = ({
|
75415
75596
|
appState,
|
75416
75597
|
data = { content: [], root: {} },
|
@@ -75424,10 +75605,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75424
75605
|
history: { back, forward, historyStore }
|
75425
75606
|
} = useAppContext2();
|
75426
75607
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
75427
|
-
return /* @__PURE__ */ (0,
|
75608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
75428
75609
|
"div",
|
75429
75610
|
{
|
75430
|
-
className:
|
75611
|
+
className: getClassName20({ menuOpen }),
|
75431
75612
|
onClick: (event) => {
|
75432
75613
|
var _a3;
|
75433
75614
|
const element = event.target;
|
@@ -75438,24 +75619,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75438
75619
|
setMenuOpen(false);
|
75439
75620
|
}
|
75440
75621
|
},
|
75441
|
-
children: /* @__PURE__ */ (0,
|
75442
|
-
/* @__PURE__ */ (0,
|
75443
|
-
/* @__PURE__ */ (0,
|
75444
|
-
|
75445
|
-
{
|
75446
|
-
size: 21,
|
75447
|
-
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
75448
|
-
}
|
75449
|
-
) }),
|
75450
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
75451
|
-
Redo2,
|
75452
|
-
{
|
75453
|
-
size: 21,
|
75454
|
-
stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
75455
|
-
}
|
75456
|
-
) })
|
75622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
|
75623
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
|
75624
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
|
75625
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
|
75457
75626
|
] }),
|
75458
|
-
/* @__PURE__ */ (0,
|
75627
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
75459
75628
|
state: appState,
|
75460
75629
|
dispatch
|
75461
75630
|
}) })
|
@@ -75464,20 +75633,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75464
75633
|
);
|
75465
75634
|
};
|
75466
75635
|
init_react_import2();
|
75467
|
-
var
|
75636
|
+
var styles_module_default15 = { "Puck": "_Puck_1g88c_19", "Puck-portal": "_Puck-portal_1g88c_24", "PuckLayout": "_PuckLayout_1g88c_31", "PuckLayout-inner": "_PuckLayout-inner_1g88c_39", "PuckLayout--mounted": "_PuckLayout--mounted_1g88c_51", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1g88c_55", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1g88c_61", "PuckLayout-mounted": "_PuckLayout-mounted_1g88c_75", "PuckLayout-header": "_PuckLayout-header_1g88c_116", "PuckLayout-headerInner": "_PuckLayout-headerInner_1g88c_125", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_1g88c_135", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_1g88c_142", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_1g88c_143", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_1g88c_147", "PuckLayout-headerPath": "_PuckLayout-headerPath_1g88c_151", "PuckLayout-headerTools": "_PuckLayout-headerTools_1g88c_158", "PuckLayout-menuButton": "_PuckLayout-menuButton_1g88c_164", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_1g88c_169", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_1g88c_143", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_1g88c_142" };
|
75468
75637
|
init_react_import2();
|
75469
75638
|
init_react_import2();
|
75470
|
-
var
|
75471
|
-
var
|
75472
|
-
var
|
75473
|
-
var
|
75639
|
+
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
75640
|
+
var import_react21 = require("react");
|
75641
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
75642
|
+
var getClassName21 = get_class_name_factory_default2("PuckFields", styles_module_default16);
|
75474
75643
|
var defaultPageFields = {
|
75475
75644
|
title: { type: "text" }
|
75476
75645
|
};
|
75477
75646
|
var DefaultFields = ({
|
75478
75647
|
children
|
75479
75648
|
}) => {
|
75480
|
-
return /* @__PURE__ */ (0,
|
75649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
75481
75650
|
};
|
75482
75651
|
var useResolvedFields = () => {
|
75483
75652
|
var _a3;
|
@@ -75487,14 +75656,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75487
75656
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
75488
75657
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
75489
75658
|
const rootProps = data.root.props || data.root;
|
75490
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
75659
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
75491
75660
|
{}
|
75492
75661
|
);
|
75493
|
-
const [resolvedFields, setResolvedFields] = (0,
|
75494
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
75662
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
75663
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
75495
75664
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
75496
75665
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
75497
|
-
const resolveFields = (0,
|
75666
|
+
const resolveFields = (0, import_react21.useCallback)(
|
75498
75667
|
(..._0) => __async2(void 0, [..._0], function* (fields = {}) {
|
75499
75668
|
var _a22, _b2, _c;
|
75500
75669
|
const lastData = ((_a22 = lastSelectedData.props) == null ? void 0 : _a22.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -75530,7 +75699,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75530
75699
|
}),
|
75531
75700
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
75532
75701
|
);
|
75533
|
-
(0,
|
75702
|
+
(0, import_react21.useEffect)(() => {
|
75534
75703
|
setFieldsLoading(true);
|
75535
75704
|
resolveFields(defaultFields).then((fields) => {
|
75536
75705
|
setResolvedFields(fields || {});
|
@@ -75548,7 +75717,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75548
75717
|
config,
|
75549
75718
|
resolveData,
|
75550
75719
|
componentState,
|
75551
|
-
overrides
|
75720
|
+
overrides,
|
75721
|
+
globalPermissions
|
75552
75722
|
} = useAppContext2();
|
75553
75723
|
const { data, ui } = state;
|
75554
75724
|
const { itemSelector } = ui;
|
@@ -75556,16 +75726,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75556
75726
|
const componentResolving = selectedItem ? (_a3 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a3.loading : (_b2 = componentState["puck-root"]) == null ? void 0 : _b2.loading;
|
75557
75727
|
const isLoading = fieldsResolving || componentResolving;
|
75558
75728
|
const rootProps = data.root.props || data.root;
|
75559
|
-
const Wrapper = (0,
|
75560
|
-
return /* @__PURE__ */ (0,
|
75729
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
75730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
75561
75731
|
"form",
|
75562
75732
|
{
|
75563
|
-
className:
|
75733
|
+
className: getClassName21(),
|
75564
75734
|
onSubmit: (e2) => {
|
75565
75735
|
e2.preventDefault();
|
75566
75736
|
},
|
75567
75737
|
children: [
|
75568
|
-
/* @__PURE__ */ (0,
|
75738
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
75569
75739
|
const field = fields[fieldName];
|
75570
75740
|
if (!(field == null ? void 0 : field.type)) return null;
|
75571
75741
|
const onChange = (value, updatedUi) => {
|
@@ -75632,13 +75802,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75632
75802
|
};
|
75633
75803
|
if (selectedItem && itemSelector) {
|
75634
75804
|
const { readOnly = {} } = selectedItem;
|
75635
|
-
|
75805
|
+
const { edit } = getPermissions({
|
75806
|
+
selectedItem,
|
75807
|
+
config,
|
75808
|
+
globalPermissions: globalPermissions || {},
|
75809
|
+
appState: state
|
75810
|
+
});
|
75811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75636
75812
|
AutoFieldPrivate,
|
75637
75813
|
{
|
75638
75814
|
field,
|
75639
75815
|
name: fieldName,
|
75640
75816
|
id: `${selectedItem.props.id}_${fieldName}`,
|
75641
|
-
readOnly: readOnly[fieldName],
|
75817
|
+
readOnly: !edit || readOnly[fieldName],
|
75642
75818
|
value: selectedItem.props[fieldName],
|
75643
75819
|
onChange
|
75644
75820
|
},
|
@@ -75646,7 +75822,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75646
75822
|
);
|
75647
75823
|
} else {
|
75648
75824
|
const { readOnly = {} } = data.root;
|
75649
|
-
return /* @__PURE__ */ (0,
|
75825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75650
75826
|
AutoFieldPrivate,
|
75651
75827
|
{
|
75652
75828
|
field,
|
@@ -75660,26 +75836,41 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75660
75836
|
);
|
75661
75837
|
}
|
75662
75838
|
}) }),
|
75663
|
-
isLoading && /* @__PURE__ */ (0,
|
75839
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader2, { size: 16 }) }) })
|
75664
75840
|
]
|
75665
75841
|
}
|
75666
75842
|
);
|
75667
75843
|
};
|
75668
75844
|
init_react_import2();
|
75669
75845
|
init_react_import2();
|
75670
|
-
var
|
75846
|
+
var import_react222 = require("react");
|
75671
75847
|
init_react_import2();
|
75672
75848
|
init_react_import2();
|
75673
|
-
var
|
75674
|
-
var
|
75675
|
-
var
|
75849
|
+
var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
|
75850
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
75851
|
+
var getClassName222 = get_class_name_factory_default2("ComponentList", styles_module_default17);
|
75676
75852
|
var ComponentListItem = ({
|
75677
75853
|
name,
|
75678
75854
|
label,
|
75679
75855
|
index
|
75680
75856
|
}) => {
|
75681
|
-
const { overrides } = useAppContext2();
|
75682
|
-
|
75857
|
+
const { overrides, config, globalPermissions, state } = useAppContext2();
|
75858
|
+
const canInsert = getPermissions({
|
75859
|
+
type: name,
|
75860
|
+
config,
|
75861
|
+
globalPermissions: globalPermissions || {},
|
75862
|
+
appState: state
|
75863
|
+
}).insert;
|
75864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75865
|
+
Drawer.Item,
|
75866
|
+
{
|
75867
|
+
label,
|
75868
|
+
name,
|
75869
|
+
index,
|
75870
|
+
isDragDisabled: !canInsert,
|
75871
|
+
children: overrides.componentItem
|
75872
|
+
}
|
75873
|
+
);
|
75683
75874
|
};
|
75684
75875
|
var ComponentList = ({
|
75685
75876
|
children,
|
@@ -75688,11 +75879,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75688
75879
|
}) => {
|
75689
75880
|
const { config, state, setUi } = useAppContext2();
|
75690
75881
|
const { expanded = true } = state.ui.componentList[id] || {};
|
75691
|
-
return /* @__PURE__ */ (0,
|
75692
|
-
title && /* @__PURE__ */ (0,
|
75882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName222({ isExpanded: expanded }), children: [
|
75883
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
75693
75884
|
"button",
|
75694
75885
|
{
|
75695
|
-
className:
|
75886
|
+
className: getClassName222("title"),
|
75696
75887
|
onClick: () => setUi({
|
75697
75888
|
componentList: __spreadProps2(__spreadValues2({}, state.ui.componentList), {
|
75698
75889
|
[id]: __spreadProps2(__spreadValues2({}, state.ui.componentList[id]), {
|
@@ -75702,14 +75893,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75702
75893
|
}),
|
75703
75894
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
75704
75895
|
children: [
|
75705
|
-
/* @__PURE__ */ (0,
|
75706
|
-
/* @__PURE__ */ (0,
|
75896
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
|
75897
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName222("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { size: 12 }) })
|
75707
75898
|
]
|
75708
75899
|
}
|
75709
75900
|
),
|
75710
|
-
/* @__PURE__ */ (0,
|
75901
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName222("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i2) => {
|
75711
75902
|
var _a3;
|
75712
|
-
return /* @__PURE__ */ (0,
|
75903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75713
75904
|
ComponentListItem,
|
75714
75905
|
{
|
75715
75906
|
label: (_a3 = config.components[componentKey]["label"]) != null ? _a3 : componentKey,
|
@@ -75722,10 +75913,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75722
75913
|
] });
|
75723
75914
|
};
|
75724
75915
|
ComponentList.Item = ComponentListItem;
|
75725
|
-
var
|
75916
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
75726
75917
|
var useComponentList = (config, ui) => {
|
75727
|
-
const [componentList, setComponentList] = (0,
|
75728
|
-
(0,
|
75918
|
+
const [componentList, setComponentList] = (0, import_react222.useState)();
|
75919
|
+
(0, import_react222.useEffect)(() => {
|
75729
75920
|
var _a3, _b2, _c;
|
75730
75921
|
if (Object.keys(ui.componentList).length > 0) {
|
75731
75922
|
const matchedComponents = [];
|
@@ -75735,7 +75926,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75735
75926
|
if (category.visible === false || !category.components) {
|
75736
75927
|
return null;
|
75737
75928
|
}
|
75738
|
-
return /* @__PURE__ */ (0,
|
75929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75739
75930
|
ComponentList,
|
75740
75931
|
{
|
75741
75932
|
id: categoryKey,
|
@@ -75744,7 +75935,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75744
75935
|
var _a22;
|
75745
75936
|
matchedComponents.push(componentName);
|
75746
75937
|
const componentConf = config.components[componentName] || {};
|
75747
|
-
return /* @__PURE__ */ (0,
|
75938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75748
75939
|
ComponentList.Item,
|
75749
75940
|
{
|
75750
75941
|
label: (_a22 = componentConf["label"]) != null ? _a22 : componentName,
|
@@ -75764,7 +75955,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75764
75955
|
);
|
75765
75956
|
if (remainingComponents.length > 0 && !((_a3 = ui.componentList.other) == null ? void 0 : _a3.components) && ((_b2 = ui.componentList.other) == null ? void 0 : _b2.visible) !== false) {
|
75766
75957
|
_componentList.push(
|
75767
|
-
/* @__PURE__ */ (0,
|
75958
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75768
75959
|
ComponentList,
|
75769
75960
|
{
|
75770
75961
|
id: "other",
|
@@ -75772,7 +75963,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75772
75963
|
children: remainingComponents.map((componentName, i2) => {
|
75773
75964
|
var _a22;
|
75774
75965
|
const componentConf = config.components[componentName] || {};
|
75775
|
-
return /* @__PURE__ */ (0,
|
75966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75776
75967
|
ComponentList.Item,
|
75777
75968
|
{
|
75778
75969
|
name: componentName,
|
@@ -75792,21 +75983,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75792
75983
|
}, [config.categories, config.components, ui.componentList]);
|
75793
75984
|
return componentList;
|
75794
75985
|
};
|
75795
|
-
var
|
75796
|
-
var
|
75986
|
+
var import_react23 = require("react");
|
75987
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
75797
75988
|
var Components = () => {
|
75798
75989
|
const { config, state, overrides } = useAppContext2();
|
75799
75990
|
const componentList = useComponentList(config, state.ui);
|
75800
|
-
const Wrapper = (0,
|
75801
|
-
return /* @__PURE__ */ (0,
|
75991
|
+
const Wrapper = (0, import_react23.useMemo)(() => overrides.components || "div", [overrides]);
|
75992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
|
75802
75993
|
};
|
75803
75994
|
init_react_import2();
|
75804
|
-
var
|
75995
|
+
var import_react25 = require("react");
|
75805
75996
|
init_react_import2();
|
75806
|
-
var
|
75997
|
+
var import_react24 = __toESM2(require("react"));
|
75807
75998
|
var import_react_frame_component = __toESM2(require_lib());
|
75808
75999
|
var import_object_hash = __toESM2(require_object_hash());
|
75809
|
-
var
|
76000
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
75810
76001
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
75811
76002
|
var collectStyles = (doc) => {
|
75812
76003
|
const collected = [];
|
@@ -75849,7 +76040,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75849
76040
|
onStylesLoaded = () => null
|
75850
76041
|
}) => {
|
75851
76042
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
75852
|
-
(0,
|
76043
|
+
(0, import_react24.useEffect)(() => {
|
75853
76044
|
if (!win || !doc) {
|
75854
76045
|
return () => {
|
75855
76046
|
};
|
@@ -76006,23 +76197,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76006
76197
|
observer.disconnect();
|
76007
76198
|
};
|
76008
76199
|
}, []);
|
76009
|
-
return /* @__PURE__ */ (0,
|
76200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_jsx_runtime322.Fragment, { children });
|
76010
76201
|
};
|
76011
|
-
var AutoFrameComponent =
|
76202
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
76012
76203
|
function(_a3, ref2) {
|
76013
76204
|
var _b2 = _a3, { children, debug, onStylesLoaded } = _b2, props = __objRest2(_b2, ["children", "debug", "onStylesLoaded"]);
|
76014
|
-
return /* @__PURE__ */ (0,
|
76205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_react_frame_component.default, __spreadProps2(__spreadValues2({}, props), { ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
76015
76206
|
}
|
76016
76207
|
);
|
76017
76208
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
76018
76209
|
var AutoFrame_default = AutoFrameComponent;
|
76019
76210
|
init_react_import2();
|
76020
|
-
var
|
76021
|
-
var
|
76022
|
-
var
|
76211
|
+
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
76212
|
+
var import_react_frame_component2 = require_lib();
|
76213
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
76214
|
+
var getClassName23 = get_class_name_factory_default2("PuckPreview", styles_module_default18);
|
76023
76215
|
var Preview = ({ id = "puck-preview" }) => {
|
76024
|
-
const { config, dispatch, state, setStatus, iframe } = useAppContext2();
|
76025
|
-
const Page = (0,
|
76216
|
+
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext2();
|
76217
|
+
const Page = (0, import_react25.useCallback)(
|
76026
76218
|
(pageProps) => {
|
76027
76219
|
var _a3, _b2;
|
76028
76220
|
return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b2 = config.root) == null ? void 0 : _b2.render(__spreadProps2(__spreadValues2({
|
@@ -76031,33 +76223,36 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76031
76223
|
editMode: true,
|
76032
76224
|
// DEPRECATED
|
76033
76225
|
puck: { renderDropZone: DropZone, isEditing: true }
|
76034
|
-
})) : /* @__PURE__ */ (0,
|
76226
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
76035
76227
|
},
|
76036
76228
|
[config.root]
|
76037
76229
|
);
|
76230
|
+
const Frame2 = (0, import_react25.useMemo)(() => overrides.iframe || "div", [overrides]);
|
76038
76231
|
const rootProps = state.data.root.props || state.data.root;
|
76039
|
-
const ref2 = (0,
|
76040
|
-
return /* @__PURE__ */ (0,
|
76232
|
+
const ref2 = (0, import_react25.useRef)(null);
|
76233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76041
76234
|
"div",
|
76042
76235
|
{
|
76043
|
-
className:
|
76236
|
+
className: getClassName23(),
|
76044
76237
|
id,
|
76045
76238
|
onClick: () => {
|
76046
76239
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
76047
76240
|
},
|
76048
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
76241
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76049
76242
|
AutoFrame_default,
|
76050
76243
|
{
|
76051
76244
|
id: "preview-frame",
|
76052
|
-
className:
|
76245
|
+
className: getClassName23("frame"),
|
76053
76246
|
"data-rfd-iframe": true,
|
76054
76247
|
ref: ref2,
|
76055
76248
|
onStylesLoaded: () => {
|
76056
76249
|
setStatus("READY");
|
76057
76250
|
},
|
76058
|
-
children: /* @__PURE__ */ (0,
|
76251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_frame_component2.FrameContextConsumer, { children: ({ document: document2 }) => {
|
76252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame2, { document: document2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId2 }) })) });
|
76253
|
+
} })
|
76059
76254
|
}
|
76060
|
-
) : /* @__PURE__ */ (0,
|
76255
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId2 }) })) })
|
76061
76256
|
}
|
76062
76257
|
);
|
76063
76258
|
};
|
@@ -76079,7 +76274,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76079
76274
|
};
|
76080
76275
|
init_react_import2();
|
76081
76276
|
init_react_import2();
|
76082
|
-
var
|
76277
|
+
var styles_module_default19 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
|
76083
76278
|
init_react_import2();
|
76084
76279
|
var scrollIntoView2 = (el) => {
|
76085
76280
|
const oldStyle = __spreadValues2({}, el.style);
|
@@ -76089,7 +76284,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76089
76284
|
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
76090
76285
|
}
|
76091
76286
|
};
|
76092
|
-
var
|
76287
|
+
var import_react26 = require("react");
|
76093
76288
|
init_react_import2();
|
76094
76289
|
var isChildOfZone = (item, maybeChild, ctx) => {
|
76095
76290
|
var _a3;
|
@@ -76099,9 +76294,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76099
76294
|
return area === item.props.id;
|
76100
76295
|
})) : false;
|
76101
76296
|
};
|
76102
|
-
var
|
76103
|
-
var
|
76104
|
-
var getClassNameLayer = get_class_name_factory_default2("Layer",
|
76297
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
76298
|
+
var getClassName24 = get_class_name_factory_default2("LayerTree", styles_module_default19);
|
76299
|
+
var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default19);
|
76105
76300
|
var LayerTree = ({
|
76106
76301
|
data,
|
76107
76302
|
config,
|
@@ -76112,15 +76307,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76112
76307
|
label
|
76113
76308
|
}) => {
|
76114
76309
|
const zones = data.zones || {};
|
76115
|
-
const ctx = (0,
|
76116
|
-
return /* @__PURE__ */ (0,
|
76117
|
-
label && /* @__PURE__ */ (0,
|
76118
|
-
/* @__PURE__ */ (0,
|
76310
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext2);
|
76311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
76312
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
76313
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
76119
76314
|
" ",
|
76120
76315
|
label
|
76121
76316
|
] }),
|
76122
|
-
/* @__PURE__ */ (0,
|
76123
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
76317
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
76318
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
76124
76319
|
zoneContent.map((item, i2) => {
|
76125
76320
|
var _a3;
|
76126
76321
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
|
@@ -76138,7 +76333,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76138
76333
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
76139
76334
|
const componentConfig = config.components[item.type];
|
76140
76335
|
const label2 = (_a3 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a3 : item.type.toString();
|
76141
|
-
return /* @__PURE__ */ (0,
|
76336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76142
76337
|
"li",
|
76143
76338
|
{
|
76144
76339
|
className: getClassNameLayer({
|
@@ -76148,7 +76343,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76148
76343
|
childIsSelected
|
76149
76344
|
}),
|
76150
76345
|
children: [
|
76151
|
-
/* @__PURE__ */ (0,
|
76346
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76152
76347
|
"button",
|
76153
76348
|
{
|
76154
76349
|
className: getClassNameLayer("clickable"),
|
@@ -76180,22 +76375,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76180
76375
|
setHoveringComponent(null);
|
76181
76376
|
},
|
76182
76377
|
children: [
|
76183
|
-
containsZone && /* @__PURE__ */ (0,
|
76378
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76184
76379
|
"div",
|
76185
76380
|
{
|
76186
76381
|
className: getClassNameLayer("chevron"),
|
76187
76382
|
title: isSelected ? "Collapse" : "Expand",
|
76188
|
-
children: /* @__PURE__ */ (0,
|
76383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
76189
76384
|
}
|
76190
76385
|
),
|
76191
|
-
/* @__PURE__ */ (0,
|
76192
|
-
/* @__PURE__ */ (0,
|
76193
|
-
/* @__PURE__ */ (0,
|
76386
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
76387
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
|
76388
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
76194
76389
|
] })
|
76195
76390
|
]
|
76196
76391
|
}
|
76197
76392
|
) }),
|
76198
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
76393
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76199
76394
|
LayerTree,
|
76200
76395
|
{
|
76201
76396
|
config,
|
@@ -76215,13 +76410,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76215
76410
|
] })
|
76216
76411
|
] });
|
76217
76412
|
};
|
76218
|
-
var
|
76219
|
-
var
|
76413
|
+
var import_react27 = require("react");
|
76414
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
76220
76415
|
var Outline = () => {
|
76221
76416
|
const { dispatch, state, overrides, config } = useAppContext2();
|
76222
76417
|
const { data, ui } = state;
|
76223
76418
|
const { itemSelector } = ui;
|
76224
|
-
const setItemSelector = (0,
|
76419
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
76225
76420
|
(newItemSelector) => {
|
76226
76421
|
dispatch({
|
76227
76422
|
type: "setUi",
|
@@ -76230,9 +76425,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76230
76425
|
},
|
76231
76426
|
[]
|
76232
76427
|
);
|
76233
|
-
const Wrapper = (0,
|
76234
|
-
return /* @__PURE__ */ (0,
|
76235
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0,
|
76428
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.outline || "div", [overrides]);
|
76429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext2.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
76430
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76236
76431
|
LayerTree,
|
76237
76432
|
{
|
76238
76433
|
config,
|
@@ -76245,7 +76440,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76245
76440
|
),
|
76246
76441
|
Object.entries(findZonesForArea(data, "root")).map(
|
76247
76442
|
([zoneKey, zone]) => {
|
76248
|
-
return /* @__PURE__ */ (0,
|
76443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76249
76444
|
LayerTree,
|
76250
76445
|
{
|
76251
76446
|
config,
|
@@ -76263,35 +76458,6 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76263
76458
|
] }) }) });
|
76264
76459
|
};
|
76265
76460
|
init_react_import2();
|
76266
|
-
var loadOverrides = ({
|
76267
|
-
overrides,
|
76268
|
-
plugins
|
76269
|
-
}) => {
|
76270
|
-
const collected = __spreadValues2({}, overrides);
|
76271
|
-
plugins.forEach((plugin) => {
|
76272
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
76273
|
-
if (overridesType === "fieldTypes") {
|
76274
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
76275
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
76276
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
76277
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
76278
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps2(__spreadValues2({}, props), {
|
76279
|
-
children: childNode2 ? childNode2(props) : props.children
|
76280
|
-
}));
|
76281
|
-
collected.fieldTypes[fieldType] = Comp2;
|
76282
|
-
});
|
76283
|
-
return;
|
76284
|
-
}
|
76285
|
-
const childNode = collected[overridesType];
|
76286
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps2(__spreadValues2({}, props), {
|
76287
|
-
children: childNode ? childNode(props) : props.children
|
76288
|
-
}));
|
76289
|
-
collected[overridesType] = Comp;
|
76290
|
-
});
|
76291
|
-
});
|
76292
|
-
return collected;
|
76293
|
-
};
|
76294
|
-
init_react_import2();
|
76295
76461
|
var import_react_hotkeys_hook = (init_react_hotkeys_hook_esm(), __toCommonJS(react_hotkeys_hook_esm_exports));
|
76296
76462
|
function usePuckHistory({
|
76297
76463
|
dispatch,
|
@@ -76344,19 +76510,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76344
76510
|
};
|
76345
76511
|
}
|
76346
76512
|
init_react_import2();
|
76347
|
-
var
|
76513
|
+
var import_react28 = require("react");
|
76348
76514
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
76349
76515
|
var EMPTY_HISTORY_INDEX = -1;
|
76350
76516
|
function useHistoryStore(initialHistory) {
|
76351
76517
|
var _a3, _b2;
|
76352
|
-
const [histories, setHistories] = (0,
|
76518
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
76353
76519
|
(_a3 = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a3 : []
|
76354
76520
|
);
|
76355
76521
|
const updateHistories = (histories2) => {
|
76356
76522
|
setHistories(histories2);
|
76357
76523
|
setIndex(histories2.length - 1);
|
76358
76524
|
};
|
76359
|
-
const [index, setIndex] = (0,
|
76525
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
76360
76526
|
(_b2 = initialHistory == null ? void 0 : initialHistory.index) != null ? _b2 : EMPTY_HISTORY_INDEX
|
76361
76527
|
);
|
76362
76528
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -76506,19 +76672,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76506
76672
|
var styles = window.getComputedStyle(el);
|
76507
76673
|
return calculateBox3(borderBox, styles);
|
76508
76674
|
};
|
76509
|
-
var
|
76675
|
+
var import_react30 = require("react");
|
76510
76676
|
init_react_import2();
|
76511
|
-
var
|
76677
|
+
var import_react29 = require("react");
|
76512
76678
|
init_react_import2();
|
76513
|
-
var
|
76514
|
-
var
|
76679
|
+
var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
|
76680
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
76515
76681
|
var icons = {
|
76516
|
-
Smartphone: /* @__PURE__ */ (0,
|
76517
|
-
Tablet: /* @__PURE__ */ (0,
|
76518
|
-
Monitor: /* @__PURE__ */ (0,
|
76682
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
76683
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
76684
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
76519
76685
|
};
|
76520
|
-
var
|
76521
|
-
var getClassNameButton = get_class_name_factory_default2("ViewportButton",
|
76686
|
+
var getClassName25 = get_class_name_factory_default2("ViewportControls", styles_module_default20);
|
76687
|
+
var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default20);
|
76522
76688
|
var ViewportButton = ({
|
76523
76689
|
children,
|
76524
76690
|
height = "auto",
|
@@ -76527,11 +76693,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76527
76693
|
onClick
|
76528
76694
|
}) => {
|
76529
76695
|
const { state } = useAppContext2();
|
76530
|
-
const [isActive2, setIsActive] = (0,
|
76531
|
-
(0,
|
76696
|
+
const [isActive2, setIsActive] = (0, import_react29.useState)(false);
|
76697
|
+
(0, import_react29.useEffect)(() => {
|
76532
76698
|
setIsActive(width === state.ui.viewports.current.width);
|
76533
76699
|
}, [width, state.ui.viewports.current.width]);
|
76534
|
-
return /* @__PURE__ */ (0,
|
76700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76535
76701
|
IconButton,
|
76536
76702
|
{
|
76537
76703
|
title,
|
@@ -76540,7 +76706,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76540
76706
|
e2.stopPropagation();
|
76541
76707
|
onClick({ width, height });
|
76542
76708
|
},
|
76543
|
-
children: /* @__PURE__ */ (0,
|
76709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
76544
76710
|
}
|
76545
76711
|
) });
|
76546
76712
|
};
|
@@ -76564,7 +76730,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76564
76730
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
76565
76731
|
(option) => option.value === autoZoom
|
76566
76732
|
);
|
76567
|
-
const zoomOptions = (0,
|
76733
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
76568
76734
|
() => [
|
76569
76735
|
...defaultZoomOptions,
|
76570
76736
|
...defaultsContainAutoZoom ? [] : [
|
@@ -76576,8 +76742,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76576
76742
|
].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
|
76577
76743
|
[autoZoom]
|
76578
76744
|
);
|
76579
|
-
return /* @__PURE__ */ (0,
|
76580
|
-
viewports.map((viewport, i2) => /* @__PURE__ */ (0,
|
76745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
76746
|
+
viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76581
76747
|
ViewportButton,
|
76582
76748
|
{
|
76583
76749
|
height: viewport.height,
|
@@ -76588,8 +76754,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76588
76754
|
},
|
76589
76755
|
i2
|
76590
76756
|
)),
|
76591
|
-
/* @__PURE__ */ (0,
|
76592
|
-
/* @__PURE__ */ (0,
|
76757
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76758
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76593
76759
|
IconButton,
|
76594
76760
|
{
|
76595
76761
|
title: "Zoom viewport out",
|
@@ -76603,10 +76769,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76603
76769
|
)].value
|
76604
76770
|
);
|
76605
76771
|
},
|
76606
|
-
children: /* @__PURE__ */ (0,
|
76772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
76607
76773
|
}
|
76608
76774
|
),
|
76609
|
-
/* @__PURE__ */ (0,
|
76775
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76610
76776
|
IconButton,
|
76611
76777
|
{
|
76612
76778
|
title: "Zoom viewport in",
|
@@ -76620,19 +76786,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76620
76786
|
)].value
|
76621
76787
|
);
|
76622
76788
|
},
|
76623
|
-
children: /* @__PURE__ */ (0,
|
76789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
76624
76790
|
}
|
76625
76791
|
),
|
76626
|
-
/* @__PURE__ */ (0,
|
76627
|
-
/* @__PURE__ */ (0,
|
76792
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76793
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76628
76794
|
"select",
|
76629
76795
|
{
|
76630
|
-
className:
|
76796
|
+
className: getClassName25("zoomSelect"),
|
76631
76797
|
value: zoom.toString(),
|
76632
76798
|
onChange: (e2) => {
|
76633
76799
|
onZoom(parseFloat(e2.currentTarget.value));
|
76634
76800
|
},
|
76635
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
76801
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76636
76802
|
"option",
|
76637
76803
|
{
|
76638
76804
|
value: option.value,
|
@@ -76645,7 +76811,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76645
76811
|
] });
|
76646
76812
|
};
|
76647
76813
|
init_react_import2();
|
76648
|
-
var
|
76814
|
+
var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_6zd4y_1", "PuckCanvas-controls": "_PuckCanvas-controls_6zd4y_16", "PuckCanvas-inner": "_PuckCanvas-inner_6zd4y_21", "PuckCanvas-root": "_PuckCanvas-root_6zd4y_32", "PuckCanvas--ready": "_PuckCanvas--ready_6zd4y_56" };
|
76649
76815
|
init_react_import2();
|
76650
76816
|
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
76651
76817
|
var getZoomConfig = (uiViewport, frame, zoom) => {
|
@@ -76674,24 +76840,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76674
76840
|
}
|
76675
76841
|
return { autoZoom, rootHeight, zoom };
|
76676
76842
|
};
|
76677
|
-
var
|
76678
|
-
var
|
76843
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
76844
|
+
var getClassName26 = get_class_name_factory_default2("PuckCanvas", styles_module_default21);
|
76679
76845
|
var ZOOM_ON_CHANGE = true;
|
76680
76846
|
var Canvas = () => {
|
76681
76847
|
const { status, iframe } = useAppContext2();
|
76682
76848
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
|
76683
76849
|
const { ui } = state;
|
76684
|
-
const frameRef = (0,
|
76685
|
-
const [showTransition, setShowTransition] = (0,
|
76686
|
-
const defaultRender = (0,
|
76687
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
76850
|
+
const frameRef = (0, import_react30.useRef)(null);
|
76851
|
+
const [showTransition, setShowTransition] = (0, import_react30.useState)(false);
|
76852
|
+
const defaultRender = (0, import_react30.useMemo)(() => {
|
76853
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
76688
76854
|
return PuckDefault;
|
76689
76855
|
}, []);
|
76690
|
-
const CustomPreview = (0,
|
76856
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
76691
76857
|
() => overrides.preview || defaultRender,
|
76692
76858
|
[overrides]
|
76693
76859
|
);
|
76694
|
-
const getFrameDimensions = (0,
|
76860
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
76695
76861
|
if (frameRef.current) {
|
76696
76862
|
const frame = frameRef.current;
|
76697
76863
|
const box = getBox3(frame);
|
@@ -76699,7 +76865,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76699
76865
|
}
|
76700
76866
|
return { width: 0, height: 0 };
|
76701
76867
|
}, [frameRef]);
|
76702
|
-
const resetAutoZoom = (0,
|
76868
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
76703
76869
|
(ui2 = state.ui) => {
|
76704
76870
|
if (frameRef.current) {
|
76705
76871
|
setZoomConfig(
|
@@ -76709,11 +76875,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76709
76875
|
},
|
76710
76876
|
[frameRef, zoomConfig, state.ui]
|
76711
76877
|
);
|
76712
|
-
(0,
|
76878
|
+
(0, import_react30.useEffect)(() => {
|
76713
76879
|
setShowTransition(false);
|
76714
76880
|
resetAutoZoom();
|
76715
76881
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
76716
|
-
(0,
|
76882
|
+
(0, import_react30.useEffect)(() => {
|
76717
76883
|
const { height: frameHeight } = getFrameDimensions();
|
76718
76884
|
if (ui.viewports.current.height === "auto") {
|
76719
76885
|
setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
|
@@ -76721,7 +76887,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76721
76887
|
}));
|
76722
76888
|
}
|
76723
76889
|
}, [zoomConfig.zoom]);
|
76724
|
-
(0,
|
76890
|
+
(0, import_react30.useEffect)(() => {
|
76725
76891
|
const observer = new ResizeObserver(() => {
|
76726
76892
|
setShowTransition(false);
|
76727
76893
|
resetAutoZoom();
|
@@ -76733,10 +76899,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76733
76899
|
observer.disconnect();
|
76734
76900
|
};
|
76735
76901
|
}, []);
|
76736
|
-
return /* @__PURE__ */ (0,
|
76902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
76737
76903
|
"div",
|
76738
76904
|
{
|
76739
|
-
className:
|
76905
|
+
className: getClassName26({
|
76740
76906
|
ready: status === "READY" || !iframe.enabled
|
76741
76907
|
}),
|
76742
76908
|
onClick: () => dispatch({
|
@@ -76745,7 +76911,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76745
76911
|
recordHistory: true
|
76746
76912
|
}),
|
76747
76913
|
children: [
|
76748
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
76914
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76749
76915
|
ViewportControls,
|
76750
76916
|
{
|
76751
76917
|
autoZoom: zoomConfig.autoZoom,
|
@@ -76770,10 +76936,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76770
76936
|
}
|
76771
76937
|
}
|
76772
76938
|
) }),
|
76773
|
-
/* @__PURE__ */ (0,
|
76939
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76774
76940
|
"div",
|
76775
76941
|
{
|
76776
|
-
className:
|
76942
|
+
className: getClassName26("root"),
|
76777
76943
|
style: {
|
76778
76944
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
76779
76945
|
height: zoomConfig.rootHeight,
|
@@ -76782,16 +76948,46 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76782
76948
|
overflow: iframe.enabled ? void 0 : "auto"
|
76783
76949
|
},
|
76784
76950
|
suppressHydrationWarning: true,
|
76785
|
-
children: /* @__PURE__ */ (0,
|
76951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
76786
76952
|
}
|
76787
76953
|
) })
|
76788
76954
|
]
|
76789
76955
|
}
|
76790
76956
|
);
|
76791
76957
|
};
|
76792
|
-
|
76793
|
-
var
|
76794
|
-
|
76958
|
+
init_react_import2();
|
76959
|
+
var insertComponent = (componentType, zone, index, {
|
76960
|
+
config,
|
76961
|
+
dispatch,
|
76962
|
+
resolveData,
|
76963
|
+
state
|
76964
|
+
}) => {
|
76965
|
+
const id = generateId(componentType);
|
76966
|
+
const insertActionData = {
|
76967
|
+
type: "insert",
|
76968
|
+
componentType,
|
76969
|
+
destinationIndex: index,
|
76970
|
+
destinationZone: zone,
|
76971
|
+
id
|
76972
|
+
};
|
76973
|
+
const insertedData = insertAction(state.data, insertActionData, config);
|
76974
|
+
dispatch(__spreadProps2(__spreadValues2({}, insertActionData), {
|
76975
|
+
// Dispatch insert rather set, as user's may rely on this via onAction
|
76976
|
+
recordHistory: false
|
76977
|
+
}));
|
76978
|
+
const itemSelector = {
|
76979
|
+
index,
|
76980
|
+
zone
|
76981
|
+
};
|
76982
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
76983
|
+
resolveData({
|
76984
|
+
data: insertedData,
|
76985
|
+
ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector })
|
76986
|
+
});
|
76987
|
+
};
|
76988
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
76989
|
+
var getClassName27 = get_class_name_factory_default2("Puck", styles_module_default15);
|
76990
|
+
var getLayoutClassName = get_class_name_factory_default2("PuckLayout", styles_module_default15);
|
76795
76991
|
function Puck({
|
76796
76992
|
children,
|
76797
76993
|
config,
|
@@ -76800,6 +76996,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76800
76996
|
onChange,
|
76801
76997
|
onPublish,
|
76802
76998
|
onAction,
|
76999
|
+
permissions = {},
|
76803
77000
|
plugins = [],
|
76804
77001
|
overrides = {},
|
76805
77002
|
renderHeader,
|
@@ -76815,10 +77012,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76815
77012
|
}) {
|
76816
77013
|
var _a3;
|
76817
77014
|
const historyStore = useHistoryStore(initialHistory);
|
76818
|
-
const [reducer2] = (0,
|
77015
|
+
const [reducer2] = (0, import_react31.useState)(
|
76819
77016
|
() => createReducer({ config, record: historyStore.record, onAction })
|
76820
77017
|
);
|
76821
|
-
const [initialAppState] = (0,
|
77018
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
76822
77019
|
var _a22, _b2, _c, _d, _e, _f, _g;
|
76823
77020
|
const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
|
76824
77021
|
let clientUiState = {};
|
@@ -76876,7 +77073,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76876
77073
|
})
|
76877
77074
|
});
|
76878
77075
|
});
|
76879
|
-
const [appState, dispatch] = (0,
|
77076
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
76880
77077
|
reducer2,
|
76881
77078
|
flushZones(initialAppState)
|
76882
77079
|
);
|
@@ -76887,9 +77084,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76887
77084
|
config,
|
76888
77085
|
dispatch
|
76889
77086
|
);
|
76890
|
-
const [menuOpen, setMenuOpen] = (0,
|
77087
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
76891
77088
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
76892
|
-
const setItemSelector = (0,
|
77089
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
76893
77090
|
(newItemSelector) => {
|
76894
77091
|
if (newItemSelector === itemSelector) return;
|
76895
77092
|
dispatch({
|
@@ -76901,13 +77098,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76901
77098
|
[itemSelector]
|
76902
77099
|
);
|
76903
77100
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
76904
|
-
(0,
|
77101
|
+
(0, import_react31.useEffect)(() => {
|
76905
77102
|
if (onChange) onChange(data);
|
76906
77103
|
}, [data]);
|
76907
77104
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
76908
|
-
const [draggedItem, setDraggedItem] = (0,
|
77105
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
76909
77106
|
const rootProps = data.root.props || data.root;
|
76910
|
-
const toggleSidebars = (0,
|
77107
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
76911
77108
|
(sidebar) => {
|
76912
77109
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
76913
77110
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -76921,7 +77118,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76921
77118
|
},
|
76922
77119
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
76923
77120
|
);
|
76924
|
-
(0,
|
77121
|
+
(0, import_react31.useEffect)(() => {
|
76925
77122
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
76926
77123
|
dispatch({
|
76927
77124
|
type: "setUi",
|
@@ -76944,11 +77141,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76944
77141
|
window.removeEventListener("resize", handleResize);
|
76945
77142
|
};
|
76946
77143
|
}, []);
|
76947
|
-
const
|
76948
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
76949
|
-
return PuckDefault;
|
76950
|
-
}, []);
|
76951
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
77144
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
76952
77145
|
if (renderHeader) {
|
76953
77146
|
console.warn(
|
76954
77147
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -76956,48 +77149,49 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76956
77149
|
const RenderHeader = (_a22) => {
|
76957
77150
|
var _b2 = _a22, { actions } = _b2, props = __objRest2(_b2, ["actions"]);
|
76958
77151
|
const Comp = renderHeader;
|
76959
|
-
return /* @__PURE__ */ (0,
|
77152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
|
76960
77153
|
};
|
76961
77154
|
return RenderHeader;
|
76962
77155
|
}
|
76963
|
-
return
|
77156
|
+
return DefaultOverride;
|
76964
77157
|
}, [renderHeader]);
|
76965
|
-
const defaultHeaderActionsRender = (0,
|
77158
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
76966
77159
|
if (renderHeaderActions) {
|
76967
77160
|
console.warn(
|
76968
77161
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
76969
77162
|
);
|
76970
77163
|
const RenderHeader = (props) => {
|
76971
77164
|
const Comp = renderHeaderActions;
|
76972
|
-
return /* @__PURE__ */ (0,
|
77165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
|
76973
77166
|
};
|
76974
77167
|
return RenderHeader;
|
76975
77168
|
}
|
76976
|
-
return
|
77169
|
+
return DefaultOverride;
|
76977
77170
|
}, [renderHeader]);
|
76978
|
-
const loadedOverrides = (
|
76979
|
-
|
76980
|
-
|
76981
|
-
|
76982
|
-
|
77171
|
+
const loadedOverrides = useLoadedOverrides({
|
77172
|
+
overrides,
|
77173
|
+
plugins
|
77174
|
+
});
|
77175
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
77176
|
+
() => loadedOverrides.puck || DefaultOverride,
|
76983
77177
|
[loadedOverrides]
|
76984
77178
|
);
|
76985
|
-
const CustomHeader = (0,
|
77179
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
76986
77180
|
() => loadedOverrides.header || defaultHeaderRender,
|
76987
77181
|
[loadedOverrides]
|
76988
77182
|
);
|
76989
|
-
const CustomHeaderActions = (0,
|
77183
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
76990
77184
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
76991
77185
|
[loadedOverrides]
|
76992
77186
|
);
|
76993
|
-
const [mounted, setMounted] = (0,
|
76994
|
-
(0,
|
77187
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
77188
|
+
(0, import_react31.useEffect)(() => {
|
76995
77189
|
setMounted(true);
|
76996
77190
|
}, []);
|
76997
77191
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
76998
77192
|
const selectedComponentLabel = selectedItem ? (_a3 = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a3 : selectedItem.type.toString() : "";
|
76999
|
-
return /* @__PURE__ */ (0,
|
77000
|
-
/* @__PURE__ */ (0,
|
77193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
77194
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77001
77195
|
AppProvider,
|
77002
77196
|
{
|
77003
77197
|
value: {
|
@@ -77010,9 +77204,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77010
77204
|
overrides: loadedOverrides,
|
77011
77205
|
history,
|
77012
77206
|
viewports,
|
77013
|
-
iframe
|
77207
|
+
iframe,
|
77208
|
+
globalPermissions: __spreadValues2({
|
77209
|
+
delete: true,
|
77210
|
+
drag: true,
|
77211
|
+
duplicate: true,
|
77212
|
+
insert: true,
|
77213
|
+
edit: true
|
77214
|
+
}, permissions)
|
77014
77215
|
},
|
77015
|
-
children: /* @__PURE__ */ (0,
|
77216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77016
77217
|
DragDropContext2,
|
77017
77218
|
{
|
77018
77219
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -77033,16 +77234,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77033
77234
|
}
|
77034
77235
|
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
77035
77236
|
const [_, componentType] = droppedItem.draggableId.split("::");
|
77036
|
-
|
77037
|
-
|
77038
|
-
|
77039
|
-
|
77040
|
-
|
77041
|
-
|
77042
|
-
setItemSelector({
|
77043
|
-
index: droppedItem.destination.index,
|
77044
|
-
zone: droppedItem.destination.droppableId
|
77045
|
-
});
|
77237
|
+
insertComponent(
|
77238
|
+
componentType || droppedItem.draggableId,
|
77239
|
+
droppedItem.destination.droppableId,
|
77240
|
+
droppedItem.destination.index,
|
77241
|
+
{ config, dispatch, resolveData, state: appState }
|
77242
|
+
);
|
77046
77243
|
return;
|
77047
77244
|
} else {
|
77048
77245
|
const { source, destination } = droppedItem;
|
@@ -77068,7 +77265,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77068
77265
|
});
|
77069
77266
|
}
|
77070
77267
|
},
|
77071
|
-
children: /* @__PURE__ */ (0,
|
77268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77072
77269
|
DropZoneProvider,
|
77073
77270
|
{
|
77074
77271
|
value: {
|
@@ -77082,7 +77279,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77082
77279
|
mode: "edit",
|
77083
77280
|
areaId: "root"
|
77084
77281
|
},
|
77085
|
-
children: /* @__PURE__ */ (0,
|
77282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77086
77283
|
"div",
|
77087
77284
|
{
|
77088
77285
|
className: getLayoutClassName({
|
@@ -77091,64 +77288,64 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77091
77288
|
mounted,
|
77092
77289
|
rightSideBarVisible
|
77093
77290
|
}),
|
77094
|
-
children: /* @__PURE__ */ (0,
|
77095
|
-
/* @__PURE__ */ (0,
|
77291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
77292
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77096
77293
|
CustomHeader,
|
77097
77294
|
{
|
77098
|
-
actions: /* @__PURE__ */ (0,
|
77295
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77099
77296
|
Button,
|
77100
77297
|
{
|
77101
77298
|
onClick: () => {
|
77102
77299
|
onPublish && onPublish(data);
|
77103
77300
|
},
|
77104
|
-
icon: /* @__PURE__ */ (0,
|
77301
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77105
77302
|
children: "Publish"
|
77106
77303
|
}
|
77107
77304
|
) }) }),
|
77108
|
-
children: /* @__PURE__ */ (0,
|
77109
|
-
/* @__PURE__ */ (0,
|
77110
|
-
/* @__PURE__ */ (0,
|
77305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
77306
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
77307
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77111
77308
|
"div",
|
77112
77309
|
{
|
77113
77310
|
className: getLayoutClassName(
|
77114
77311
|
"leftSideBarToggle"
|
77115
77312
|
),
|
77116
|
-
children: /* @__PURE__ */ (0,
|
77313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77117
77314
|
IconButton,
|
77118
77315
|
{
|
77119
77316
|
onClick: () => {
|
77120
77317
|
toggleSidebars("left");
|
77121
77318
|
},
|
77122
77319
|
title: "Toggle left sidebar",
|
77123
|
-
children: /* @__PURE__ */ (0,
|
77320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
77124
77321
|
}
|
77125
77322
|
)
|
77126
77323
|
}
|
77127
77324
|
),
|
77128
|
-
/* @__PURE__ */ (0,
|
77325
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77129
77326
|
"div",
|
77130
77327
|
{
|
77131
77328
|
className: getLayoutClassName(
|
77132
77329
|
"rightSideBarToggle"
|
77133
77330
|
),
|
77134
|
-
children: /* @__PURE__ */ (0,
|
77331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77135
77332
|
IconButton,
|
77136
77333
|
{
|
77137
77334
|
onClick: () => {
|
77138
77335
|
toggleSidebars("right");
|
77139
77336
|
},
|
77140
77337
|
title: "Toggle right sidebar",
|
77141
|
-
children: /* @__PURE__ */ (0,
|
77338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
77142
77339
|
}
|
77143
77340
|
)
|
77144
77341
|
}
|
77145
77342
|
)
|
77146
77343
|
] }),
|
77147
|
-
/* @__PURE__ */ (0,
|
77344
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading2, { rank: 2, size: "xs", children: [
|
77148
77345
|
headerTitle || rootProps.title || "Page",
|
77149
|
-
headerPath && /* @__PURE__ */ (0,
|
77346
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
77150
77347
|
" ",
|
77151
|
-
/* @__PURE__ */ (0,
|
77348
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77152
77349
|
"code",
|
77153
77350
|
{
|
77154
77351
|
className: getLayoutClassName("headerPath"),
|
@@ -77157,18 +77354,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77157
77354
|
)
|
77158
77355
|
] })
|
77159
77356
|
] }) }),
|
77160
|
-
/* @__PURE__ */ (0,
|
77161
|
-
/* @__PURE__ */ (0,
|
77357
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
77358
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77162
77359
|
IconButton,
|
77163
77360
|
{
|
77164
77361
|
onClick: () => {
|
77165
77362
|
return setMenuOpen(!menuOpen);
|
77166
77363
|
},
|
77167
77364
|
title: "Toggle menu bar",
|
77168
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
77365
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
77169
77366
|
}
|
77170
77367
|
) }),
|
77171
|
-
/* @__PURE__ */ (0,
|
77368
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77172
77369
|
MenuBar,
|
77173
77370
|
{
|
77174
77371
|
appState,
|
@@ -77176,13 +77373,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77176
77373
|
dispatch,
|
77177
77374
|
onPublish,
|
77178
77375
|
menuOpen,
|
77179
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
77376
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77180
77377
|
Button,
|
77181
77378
|
{
|
77182
77379
|
onClick: () => {
|
77183
77380
|
onPublish && onPublish(data);
|
77184
77381
|
},
|
77185
|
-
icon: /* @__PURE__ */ (0,
|
77382
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77186
77383
|
children: "Publish"
|
77187
77384
|
}
|
77188
77385
|
) }),
|
@@ -77193,19 +77390,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77193
77390
|
] }) })
|
77194
77391
|
}
|
77195
77392
|
),
|
77196
|
-
/* @__PURE__ */ (0,
|
77197
|
-
/* @__PURE__ */ (0,
|
77198
|
-
/* @__PURE__ */ (0,
|
77393
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
77394
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
77395
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
77199
77396
|
] }),
|
77200
|
-
/* @__PURE__ */ (0,
|
77201
|
-
/* @__PURE__ */ (0,
|
77397
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
77398
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77202
77399
|
SidebarSection2,
|
77203
77400
|
{
|
77204
77401
|
noPadding: true,
|
77205
77402
|
noBorderTop: true,
|
77206
77403
|
showBreadcrumbs: true,
|
77207
77404
|
title: selectedItem ? selectedComponentLabel : "Page",
|
77208
|
-
children: /* @__PURE__ */ (0,
|
77405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
77209
77406
|
}
|
77210
77407
|
) })
|
77211
77408
|
] })
|
@@ -77217,7 +77414,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77217
77414
|
)
|
77218
77415
|
}
|
77219
77416
|
),
|
77220
|
-
/* @__PURE__ */ (0,
|
77417
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
77221
77418
|
] });
|
77222
77419
|
}
|
77223
77420
|
Puck.Components = Components;
|
@@ -77225,7 +77422,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77225
77422
|
Puck.Outline = Outline;
|
77226
77423
|
Puck.Preview = Preview;
|
77227
77424
|
init_react_import2();
|
77228
|
-
var
|
77425
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
77229
77426
|
function Render({
|
77230
77427
|
config,
|
77231
77428
|
data
|
@@ -77238,7 +77435,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77238
77435
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
77239
77436
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
77240
77437
|
if ((_a3 = config.root) == null ? void 0 : _a3.render) {
|
77241
|
-
return /* @__PURE__ */ (0,
|
77438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
77242
77439
|
config.root.render,
|
77243
77440
|
__spreadProps2(__spreadValues2({}, rootProps), {
|
77244
77441
|
puck: {
|
@@ -77248,11 +77445,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77248
77445
|
title,
|
77249
77446
|
editMode: false,
|
77250
77447
|
id: "puck-root",
|
77251
|
-
children: /* @__PURE__ */ (0,
|
77448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 })
|
77252
77449
|
})
|
77253
77450
|
) });
|
77254
77451
|
}
|
77255
|
-
return /* @__PURE__ */ (0,
|
77452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 }) });
|
77256
77453
|
}
|
77257
77454
|
init_react_import2();
|
77258
77455
|
var migrations = [
|
@@ -77348,12 +77545,25 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77348
77545
|
config,
|
77349
77546
|
history,
|
77350
77547
|
dispatch,
|
77351
|
-
selectedItem
|
77548
|
+
selectedItem: currentItem,
|
77549
|
+
globalPermissions
|
77352
77550
|
} = useAppContext2();
|
77353
77551
|
return {
|
77354
77552
|
appState,
|
77355
77553
|
config,
|
77356
77554
|
dispatch,
|
77555
|
+
getPermissions: ({
|
77556
|
+
item,
|
77557
|
+
type
|
77558
|
+
} = {}) => {
|
77559
|
+
return getPermissions({
|
77560
|
+
selectedItem: item || currentItem,
|
77561
|
+
type,
|
77562
|
+
globalPermissions: globalPermissions || {},
|
77563
|
+
config,
|
77564
|
+
appState
|
77565
|
+
});
|
77566
|
+
},
|
77357
77567
|
history: {
|
77358
77568
|
back: history.back,
|
77359
77569
|
forward: history.forward,
|
@@ -77365,7 +77575,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77365
77575
|
index: history.historyStore.index,
|
77366
77576
|
historyStore: history.historyStore
|
77367
77577
|
},
|
77368
|
-
selectedItem:
|
77578
|
+
selectedItem: currentItem || null
|
77369
77579
|
};
|
77370
77580
|
};
|
77371
77581
|
}
|
@@ -77666,7 +77876,8 @@ var defaultContext = {
|
|
77666
77876
|
status: "LOADING",
|
77667
77877
|
setStatus: () => null,
|
77668
77878
|
iframe: {},
|
77669
|
-
safariFallbackMode: false
|
77879
|
+
safariFallbackMode: false,
|
77880
|
+
globalPermissions: {}
|
77670
77881
|
};
|
77671
77882
|
var appContext = (0, import_react10.createContext)(defaultContext);
|
77672
77883
|
function useAppContext() {
|