@measured/puck 0.21.0-canary.8358d3e1 → 0.21.0-canary.89038d0c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Editor-N46HUQEC.mjs → Editor-O447AVCX.mjs} +13 -10
- package/dist/{Render-Y567PGZ7.mjs → Render-OFE6QLI2.mjs} +6 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-ONhOkrvf.d.mts} +1 -27
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-ONhOkrvf.d.ts} +1 -27
- package/dist/{chunk-FNWOH4R6.mjs → chunk-2Q4PACDA.mjs} +8 -6
- package/dist/{chunk-DNF2EMM4.mjs → chunk-62AAYNXG.mjs} +2 -2
- package/dist/{chunk-K3V4LVUL.mjs → chunk-BSDEIOEK.mjs} +11 -9
- package/dist/{chunk-WUWXFMEM.mjs → chunk-CSSRLPHM.mjs} +1 -1
- package/dist/{chunk-7KY6RHEY.mjs → chunk-DAQLMM2T.mjs} +15 -523
- package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
- package/dist/{chunk-DJSH5REF.mjs → chunk-NLUHDYVR.mjs} +2 -123
- package/dist/{chunk-GQKMOYLG.mjs → chunk-PLXSMBAA.mjs} +2 -2
- package/dist/{chunk-3QHWXJEI.mjs → chunk-QAWJTCV5.mjs} +2 -2
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/chunk-T3WX7XJ6.mjs +132 -0
- package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{chunk-C2TVYIYC.mjs → chunk-Y656T6AQ.mjs} +10 -6
- package/dist/{chunk-N5XMZOMC.mjs → chunk-Z476VA6G.mjs} +279 -203
- package/dist/{full-NLUNPJWS.mjs → full-BEMDJKDS.mjs} +10 -7
- package/dist/index-BEoNHRI1.d.ts +116 -0
- package/dist/index-DfxZ7tZF.d.mts +116 -0
- package/dist/index.d.mts +6 -116
- package/dist/index.d.ts +6 -116
- package/dist/index.js +446 -376
- package/dist/index.mjs +14 -11
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +908 -0
- package/dist/internal.mjs +13 -0
- package/dist/{loaded-ZXOU6S6R.mjs → loaded-JU3A7Y4L.mjs} +7 -4
- package/dist/{loaded-HMSPJUZM.mjs → loaded-N3FYGF2Y.mjs} +7 -4
- package/dist/{loaded-EV34KGYJ.mjs → loaded-OBY7OMS6.mjs} +7 -4
- package/dist/no-external.d.mts +3 -1
- package/dist/no-external.d.ts +3 -1
- package/dist/no-external.js +446 -376
- package/dist/no-external.mjs +14 -11
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +6 -4
- package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
- package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
- package/package.json +9 -4
package/dist/index.js
CHANGED
|
@@ -7269,17 +7269,18 @@ function AutoFieldInternal(props) {
|
|
|
7269
7269
|
const resolvedId = id || defaultId;
|
|
7270
7270
|
const render = (0, import_react43.useMemo)(
|
|
7271
7271
|
() => {
|
|
7272
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
7272
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7273
7273
|
return __spreadProps(__spreadValues({}, overrides.fieldTypes), {
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7274
|
+
custom: (_a2 = overrides.fieldTypes) == null ? void 0 : _a2.custom,
|
|
7275
|
+
array: ((_b = overrides.fieldTypes) == null ? void 0 : _b.array) || defaultFields.array,
|
|
7276
|
+
external: ((_c = overrides.fieldTypes) == null ? void 0 : _c.external) || defaultFields.external,
|
|
7277
|
+
object: ((_d = overrides.fieldTypes) == null ? void 0 : _d.object) || defaultFields.object,
|
|
7278
|
+
select: ((_e = overrides.fieldTypes) == null ? void 0 : _e.select) || defaultFields.select,
|
|
7279
|
+
textarea: ((_f = overrides.fieldTypes) == null ? void 0 : _f.textarea) || defaultFields.textarea,
|
|
7280
|
+
radio: ((_g = overrides.fieldTypes) == null ? void 0 : _g.radio) || defaultFields.radio,
|
|
7281
|
+
text: ((_h = overrides.fieldTypes) == null ? void 0 : _h.text) || defaultFields.text,
|
|
7282
|
+
number: ((_i = overrides.fieldTypes) == null ? void 0 : _i.number) || defaultFields.number,
|
|
7283
|
+
richtext: ((_j = overrides.fieldTypes) == null ? void 0 : _j.richtext) || defaultFields.richtext
|
|
7283
7284
|
});
|
|
7284
7285
|
},
|
|
7285
7286
|
[overrides]
|
|
@@ -7326,7 +7327,7 @@ function AutoFieldInternal(props) {
|
|
|
7326
7327
|
}, [field.type]);
|
|
7327
7328
|
const fieldKey = field.type === "custom" ? field.key : void 0;
|
|
7328
7329
|
let FieldComponent = (0, import_react43.useMemo)(() => {
|
|
7329
|
-
if (field.type === "custom") {
|
|
7330
|
+
if (field.type === "custom" && !render[field.type]) {
|
|
7330
7331
|
if (!field.render) {
|
|
7331
7332
|
return null;
|
|
7332
7333
|
}
|
|
@@ -7421,19 +7422,19 @@ var styles_module_default14 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable":
|
|
|
7421
7422
|
|
|
7422
7423
|
// components/Drawer/index.tsx
|
|
7423
7424
|
init_get_class_name_factory();
|
|
7424
|
-
var
|
|
7425
|
+
var import_react65 = require("react");
|
|
7425
7426
|
init_generate_id();
|
|
7426
7427
|
|
|
7427
7428
|
// components/DragDropContext/index.tsx
|
|
7428
7429
|
init_react_import();
|
|
7429
|
-
var
|
|
7430
|
+
var import_react63 = require("@dnd-kit/react");
|
|
7430
7431
|
init_store();
|
|
7431
|
-
var
|
|
7432
|
+
var import_react64 = require("react");
|
|
7432
7433
|
var import_dom = require("@dnd-kit/dom");
|
|
7433
7434
|
|
|
7434
7435
|
// components/DropZone/index.tsx
|
|
7435
7436
|
init_react_import();
|
|
7436
|
-
var
|
|
7437
|
+
var import_react61 = require("react");
|
|
7437
7438
|
|
|
7438
7439
|
// components/DraggableComponent/index.tsx
|
|
7439
7440
|
init_react_import();
|
|
@@ -8100,7 +8101,7 @@ var styles_module_default16 = { "DropZone": "_DropZone_1i2sv_1", "DropZone--hasC
|
|
|
8100
8101
|
|
|
8101
8102
|
// components/DropZone/index.tsx
|
|
8102
8103
|
init_store();
|
|
8103
|
-
var
|
|
8104
|
+
var import_react62 = require("@dnd-kit/react");
|
|
8104
8105
|
|
|
8105
8106
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
8106
8107
|
init_react_import();
|
|
@@ -8937,12 +8938,70 @@ var getRichTextTransform = () => ({
|
|
|
8937
8938
|
}
|
|
8938
8939
|
});
|
|
8939
8940
|
|
|
8940
|
-
// components/
|
|
8941
|
+
// components/MemoizeComponent/index.tsx
|
|
8942
|
+
init_react_import();
|
|
8943
|
+
var import_fast_equals3 = require("fast-equals");
|
|
8944
|
+
var import_react60 = require("react");
|
|
8945
|
+
|
|
8946
|
+
// lib/shallow-equal.ts
|
|
8947
|
+
init_react_import();
|
|
8948
|
+
function shallowEqual(obj1, obj2, keysToIgnore = []) {
|
|
8949
|
+
if (Object.is(obj1, obj2)) return true;
|
|
8950
|
+
if (typeof obj1 !== "object" || obj1 === null || typeof obj2 !== "object" || obj2 === null) {
|
|
8951
|
+
return false;
|
|
8952
|
+
}
|
|
8953
|
+
if (Object.getPrototypeOf(obj1) !== Object.getPrototypeOf(obj2)) {
|
|
8954
|
+
return false;
|
|
8955
|
+
}
|
|
8956
|
+
const ignore = new Set(keysToIgnore);
|
|
8957
|
+
const keys1 = Object.keys(obj1).filter((k) => !ignore.has(k));
|
|
8958
|
+
const keys2 = Object.keys(obj2).filter((k) => !ignore.has(k));
|
|
8959
|
+
if (keys1.length !== keys2.length) return false;
|
|
8960
|
+
for (let i = 0; i < keys1.length; i++) {
|
|
8961
|
+
const currKey = keys1[i];
|
|
8962
|
+
if (!Object.prototype.hasOwnProperty.call(obj2, currKey)) return false;
|
|
8963
|
+
const val1 = obj1[currKey];
|
|
8964
|
+
const val2 = obj2[currKey];
|
|
8965
|
+
if (!Object.is(val1, val2)) return false;
|
|
8966
|
+
}
|
|
8967
|
+
return true;
|
|
8968
|
+
}
|
|
8969
|
+
|
|
8970
|
+
// components/MemoizeComponent/index.tsx
|
|
8941
8971
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
8972
|
+
var RenderComponent = ({
|
|
8973
|
+
Component,
|
|
8974
|
+
componentProps: renderProps
|
|
8975
|
+
}) => {
|
|
8976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Component, __spreadValues({}, renderProps));
|
|
8977
|
+
};
|
|
8978
|
+
var MemoizeComponent = (0, import_react60.memo)(RenderComponent, (prev, next) => {
|
|
8979
|
+
let puckEquals = true;
|
|
8980
|
+
if ("puck" in prev.componentProps && "puck" in next.componentProps) {
|
|
8981
|
+
puckEquals = (0, import_fast_equals3.deepEqual)(prev.componentProps.puck, next.componentProps.puck);
|
|
8982
|
+
}
|
|
8983
|
+
return prev.Component === next.Component && shallowEqual(prev.componentProps, next.componentProps, ["puck"]) && puckEquals;
|
|
8984
|
+
});
|
|
8985
|
+
|
|
8986
|
+
// components/DropZone/index.tsx
|
|
8987
|
+
var import_jsx_runtime64 = (
|
|
8988
|
+
// Safe to use this since the HTML is set by the user
|
|
8989
|
+
require("react/jsx-runtime")
|
|
8990
|
+
);
|
|
8942
8991
|
var getClassName24 = get_class_name_factory_default("DropZone", styles_module_default16);
|
|
8943
8992
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
8944
8993
|
var RENDER_DEBUG = false;
|
|
8945
|
-
var
|
|
8994
|
+
var InsertPreview = ({
|
|
8995
|
+
element,
|
|
8996
|
+
label,
|
|
8997
|
+
override
|
|
8998
|
+
}) => {
|
|
8999
|
+
if (element) {
|
|
9000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } });
|
|
9001
|
+
}
|
|
9002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DrawerItemInner, { name: label, children: override });
|
|
9003
|
+
};
|
|
9004
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZoneEdit, __spreadValues({}, props));
|
|
8946
9005
|
var DropZoneChild = ({
|
|
8947
9006
|
zoneCompound,
|
|
8948
9007
|
componentId,
|
|
@@ -8953,9 +9012,9 @@ var DropZoneChild = ({
|
|
|
8953
9012
|
}) => {
|
|
8954
9013
|
var _a, _b;
|
|
8955
9014
|
const metadata = useAppStore((s) => s.metadata);
|
|
8956
|
-
const ctx = (0,
|
|
9015
|
+
const ctx = (0, import_react61.useContext)(dropZoneContext);
|
|
8957
9016
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
8958
|
-
const zoneStore = (0,
|
|
9017
|
+
const zoneStore = (0, import_react61.useContext)(ZoneStoreContext);
|
|
8959
9018
|
const nodeProps = useAppStore(
|
|
8960
9019
|
(0, import_shallow4.useShallow)((s) => {
|
|
8961
9020
|
var _a2;
|
|
@@ -8975,7 +9034,7 @@ var DropZoneChild = ({
|
|
|
8975
9034
|
})
|
|
8976
9035
|
);
|
|
8977
9036
|
const appStore = useAppStoreApi();
|
|
8978
|
-
const item = (0,
|
|
9037
|
+
const item = (0, import_react61.useMemo)(() => {
|
|
8979
9038
|
if (nodeProps) {
|
|
8980
9039
|
const expanded = expandNode({
|
|
8981
9040
|
type: nodeType,
|
|
@@ -8997,7 +9056,7 @@ var DropZoneChild = ({
|
|
|
8997
9056
|
const componentConfig = useAppStore(
|
|
8998
9057
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
8999
9058
|
);
|
|
9000
|
-
const puckProps = (0,
|
|
9059
|
+
const puckProps = (0, import_react61.useMemo)(
|
|
9001
9060
|
() => ({
|
|
9002
9061
|
renderDropZone: DropZoneEditPure,
|
|
9003
9062
|
isEditing: true,
|
|
@@ -9020,20 +9079,7 @@ var DropZoneChild = ({
|
|
|
9020
9079
|
}
|
|
9021
9080
|
);
|
|
9022
9081
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
9023
|
-
const
|
|
9024
|
-
() => function Preview3() {
|
|
9025
|
-
var _a2;
|
|
9026
|
-
if (item && "element" in item && item.element) {
|
|
9027
|
-
return (
|
|
9028
|
-
// Safe to use this since the HTML is set by the user
|
|
9029
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
|
|
9030
|
-
);
|
|
9031
|
-
}
|
|
9032
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
|
|
9033
|
-
},
|
|
9034
|
-
[componentId, label, overrides]
|
|
9035
|
-
);
|
|
9036
|
-
const defaultsProps = (0, import_react60.useMemo)(
|
|
9082
|
+
const defaultsProps = (0, import_react61.useMemo)(
|
|
9037
9083
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
9038
9084
|
puck: puckProps,
|
|
9039
9085
|
editMode: true
|
|
@@ -9041,7 +9087,7 @@ var DropZoneChild = ({
|
|
|
9041
9087
|
}),
|
|
9042
9088
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
|
|
9043
9089
|
);
|
|
9044
|
-
const defaultedNode = (0,
|
|
9090
|
+
const defaultedNode = (0, import_react61.useMemo)(
|
|
9045
9091
|
() => {
|
|
9046
9092
|
var _a2;
|
|
9047
9093
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
@@ -9051,8 +9097,8 @@ var DropZoneChild = ({
|
|
|
9051
9097
|
const config = useAppStore((s) => s.config);
|
|
9052
9098
|
const plugins = useAppStore((s) => s.plugins);
|
|
9053
9099
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
9054
|
-
const combinedFieldTransforms = (0,
|
|
9055
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0,
|
|
9100
|
+
const combinedFieldTransforms = (0, import_react61.useMemo)(
|
|
9101
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
9056
9102
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
9057
9103
|
{}
|
|
9058
9104
|
)), userFieldTransforms),
|
|
@@ -9066,16 +9112,13 @@ var DropZoneChild = ({
|
|
|
9066
9112
|
isLoading
|
|
9067
9113
|
);
|
|
9068
9114
|
if (!item) return;
|
|
9069
|
-
|
|
9115
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
9070
9116
|
"No configuration for ",
|
|
9071
9117
|
item.type
|
|
9072
9118
|
] });
|
|
9073
9119
|
let componentType = item.type;
|
|
9074
9120
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
9075
|
-
|
|
9076
|
-
Render2 = renderPreview;
|
|
9077
|
-
}
|
|
9078
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9079
9122
|
DraggableComponent,
|
|
9080
9123
|
{
|
|
9081
9124
|
id: componentId,
|
|
@@ -9089,19 +9132,39 @@ var DropZoneChild = ({
|
|
|
9089
9132
|
autoDragAxis: dragAxis,
|
|
9090
9133
|
userDragAxis: collisionAxis,
|
|
9091
9134
|
inDroppableZone,
|
|
9092
|
-
children: (dragRef) =>
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9135
|
+
children: (dragRef) => {
|
|
9136
|
+
var _a2;
|
|
9137
|
+
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
9138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9139
|
+
MemoizeComponent,
|
|
9140
|
+
{
|
|
9141
|
+
Component: Render2,
|
|
9142
|
+
componentProps: __spreadProps(__spreadValues({}, transformedProps), {
|
|
9143
|
+
puck: __spreadProps(__spreadValues({}, transformedProps.puck), { dragRef })
|
|
9144
|
+
})
|
|
9145
|
+
}
|
|
9146
|
+
);
|
|
9147
|
+
}
|
|
9148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9149
|
+
InsertPreview,
|
|
9150
|
+
{
|
|
9151
|
+
label,
|
|
9152
|
+
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
9153
|
+
element: "element" in item && item.element ? item.element : void 0
|
|
9154
|
+
}
|
|
9155
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9156
|
+
MemoizeComponent,
|
|
9157
|
+
{
|
|
9158
|
+
Component: Render2,
|
|
9159
|
+
componentProps: transformedProps
|
|
9160
|
+
}
|
|
9161
|
+
) });
|
|
9162
|
+
}
|
|
9100
9163
|
}
|
|
9101
9164
|
);
|
|
9102
9165
|
};
|
|
9103
|
-
var DropZoneChildMemo = (0,
|
|
9104
|
-
var DropZoneEdit = (0,
|
|
9166
|
+
var DropZoneChildMemo = (0, import_react61.memo)(DropZoneChild);
|
|
9167
|
+
var DropZoneEdit = (0, import_react61.forwardRef)(
|
|
9105
9168
|
function DropZoneEditInternal({
|
|
9106
9169
|
zone,
|
|
9107
9170
|
allow,
|
|
@@ -9112,7 +9175,7 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9112
9175
|
collisionAxis,
|
|
9113
9176
|
as
|
|
9114
9177
|
}, userRef) {
|
|
9115
|
-
const ctx = (0,
|
|
9178
|
+
const ctx = (0, import_react61.useContext)(dropZoneContext);
|
|
9116
9179
|
const appStoreApi = useAppStoreApi();
|
|
9117
9180
|
const {
|
|
9118
9181
|
// These all need setting via context
|
|
@@ -9150,14 +9213,14 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9150
9213
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
|
9151
9214
|
})
|
|
9152
9215
|
);
|
|
9153
|
-
(0,
|
|
9216
|
+
(0, import_react61.useEffect)(() => {
|
|
9154
9217
|
if (!zoneType || zoneType === "dropzone") {
|
|
9155
9218
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
9156
9219
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
9157
9220
|
}
|
|
9158
9221
|
}
|
|
9159
9222
|
}, [zoneType, appStoreApi]);
|
|
9160
|
-
(0,
|
|
9223
|
+
(0, import_react61.useEffect)(() => {
|
|
9161
9224
|
if (zoneType === "dropzone") {
|
|
9162
9225
|
if (zoneCompound !== rootDroppableId) {
|
|
9163
9226
|
console.warn(
|
|
@@ -9166,11 +9229,11 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9166
9229
|
}
|
|
9167
9230
|
}
|
|
9168
9231
|
}, [zoneType]);
|
|
9169
|
-
const contentIds = (0,
|
|
9232
|
+
const contentIds = (0, import_react61.useMemo)(() => {
|
|
9170
9233
|
return zoneContentIds || [];
|
|
9171
9234
|
}, [zoneContentIds]);
|
|
9172
|
-
const ref = (0,
|
|
9173
|
-
const acceptsTarget = (0,
|
|
9235
|
+
const ref = (0, import_react61.useRef)(null);
|
|
9236
|
+
const acceptsTarget = (0, import_react61.useCallback)(
|
|
9174
9237
|
(componentType) => {
|
|
9175
9238
|
if (!componentType) {
|
|
9176
9239
|
return true;
|
|
@@ -9208,7 +9271,7 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9208
9271
|
}
|
|
9209
9272
|
return _isEnabled;
|
|
9210
9273
|
});
|
|
9211
|
-
(0,
|
|
9274
|
+
(0, import_react61.useEffect)(() => {
|
|
9212
9275
|
if (registerLocalZone) {
|
|
9213
9276
|
registerLocalZone(zoneCompound, targetAccepted || isEnabled);
|
|
9214
9277
|
}
|
|
@@ -9223,8 +9286,8 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9223
9286
|
zoneCompound
|
|
9224
9287
|
);
|
|
9225
9288
|
const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
|
|
9226
|
-
const zoneStore = (0,
|
|
9227
|
-
(0,
|
|
9289
|
+
const zoneStore = (0, import_react61.useContext)(ZoneStoreContext);
|
|
9290
|
+
(0, import_react61.useEffect)(() => {
|
|
9228
9291
|
const { enabledIndex } = zoneStore.getState();
|
|
9229
9292
|
zoneStore.setState({
|
|
9230
9293
|
enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
|
|
@@ -9243,7 +9306,7 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9243
9306
|
path: path || []
|
|
9244
9307
|
}
|
|
9245
9308
|
};
|
|
9246
|
-
const { ref: dropRef } = (0,
|
|
9309
|
+
const { ref: dropRef } = (0, import_react62.useDroppable)(droppableConfig);
|
|
9247
9310
|
const isAreaSelected = useAppStore(
|
|
9248
9311
|
(s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
|
|
9249
9312
|
);
|
|
@@ -9253,8 +9316,14 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9253
9316
|
userMinEmptyHeight,
|
|
9254
9317
|
ref
|
|
9255
9318
|
});
|
|
9319
|
+
const setRefs = (0, import_react61.useCallback)(
|
|
9320
|
+
(node) => {
|
|
9321
|
+
assignRefs([ref, dropRef, userRef], node);
|
|
9322
|
+
},
|
|
9323
|
+
[dropRef]
|
|
9324
|
+
);
|
|
9256
9325
|
const El = as != null ? as : "div";
|
|
9257
|
-
return /* @__PURE__ */ (0,
|
|
9326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9258
9327
|
El,
|
|
9259
9328
|
{
|
|
9260
9329
|
className: `${getClassName24({
|
|
@@ -9265,9 +9334,7 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9265
9334
|
hasChildren: contentIds.length > 0,
|
|
9266
9335
|
isAnimating
|
|
9267
9336
|
})}${className ? ` ${className}` : ""}`,
|
|
9268
|
-
ref:
|
|
9269
|
-
assignRefs([ref, dropRef, userRef], node);
|
|
9270
|
-
},
|
|
9337
|
+
ref: setRefs,
|
|
9271
9338
|
"data-testid": `dropzone:${zoneCompound}`,
|
|
9272
9339
|
"data-puck-dropzone": zoneCompound,
|
|
9273
9340
|
style: __spreadProps(__spreadValues({}, style), {
|
|
@@ -9275,7 +9342,7 @@ var DropZoneEdit = (0, import_react60.forwardRef)(
|
|
|
9275
9342
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
9276
9343
|
}),
|
|
9277
9344
|
children: contentIdsWithPreview.map((componentId, i) => {
|
|
9278
|
-
return /* @__PURE__ */ (0,
|
|
9345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9279
9346
|
DropZoneChildMemo,
|
|
9280
9347
|
{
|
|
9281
9348
|
zoneCompound,
|
|
@@ -9298,8 +9365,8 @@ var DropZoneRenderItem = ({
|
|
|
9298
9365
|
metadata
|
|
9299
9366
|
}) => {
|
|
9300
9367
|
const Component = config.components[item.type];
|
|
9301
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
9302
|
-
const nextContextValue = (0,
|
|
9368
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
9369
|
+
const nextContextValue = (0, import_react61.useMemo)(
|
|
9303
9370
|
() => ({
|
|
9304
9371
|
areaId: props.id,
|
|
9305
9372
|
depth: 1
|
|
@@ -9307,7 +9374,7 @@ var DropZoneRenderItem = ({
|
|
|
9307
9374
|
[props]
|
|
9308
9375
|
);
|
|
9309
9376
|
const richtextProps = useRichtextProps(Component.fields, props);
|
|
9310
|
-
return /* @__PURE__ */ (0,
|
|
9377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9311
9378
|
Component.render,
|
|
9312
9379
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
9313
9380
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
@@ -9317,15 +9384,15 @@ var DropZoneRenderItem = ({
|
|
|
9317
9384
|
})
|
|
9318
9385
|
) }, props.id);
|
|
9319
9386
|
};
|
|
9320
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0,
|
|
9321
|
-
var DropZoneRender = (0,
|
|
9387
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZoneRender, __spreadValues({}, props));
|
|
9388
|
+
var DropZoneRender = (0, import_react61.forwardRef)(
|
|
9322
9389
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
9323
|
-
const ctx = (0,
|
|
9390
|
+
const ctx = (0, import_react61.useContext)(dropZoneContext);
|
|
9324
9391
|
const { areaId = "root" } = ctx || {};
|
|
9325
|
-
const { config, data, metadata } = (0,
|
|
9392
|
+
const { config, data, metadata } = (0, import_react61.useContext)(renderContext);
|
|
9326
9393
|
let zoneCompound = `${areaId}:${zone}`;
|
|
9327
9394
|
let content = (data == null ? void 0 : data.content) || [];
|
|
9328
|
-
(0,
|
|
9395
|
+
(0, import_react61.useEffect)(() => {
|
|
9329
9396
|
if (!content) {
|
|
9330
9397
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
9331
9398
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
@@ -9339,10 +9406,10 @@ var DropZoneRender = (0, import_react60.forwardRef)(
|
|
|
9339
9406
|
if (zoneCompound !== rootDroppableId) {
|
|
9340
9407
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
9341
9408
|
}
|
|
9342
|
-
return /* @__PURE__ */ (0,
|
|
9409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
9343
9410
|
const Component = config.components[item.type];
|
|
9344
9411
|
if (Component) {
|
|
9345
|
-
return /* @__PURE__ */ (0,
|
|
9412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9346
9413
|
DropZoneRenderItem,
|
|
9347
9414
|
{
|
|
9348
9415
|
config,
|
|
@@ -9356,14 +9423,14 @@ var DropZoneRender = (0, import_react60.forwardRef)(
|
|
|
9356
9423
|
}) });
|
|
9357
9424
|
}
|
|
9358
9425
|
);
|
|
9359
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
|
9360
|
-
var DropZone = (0,
|
|
9426
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZone, __spreadValues({}, props));
|
|
9427
|
+
var DropZone = (0, import_react61.forwardRef)(
|
|
9361
9428
|
function DropZone2(props, ref) {
|
|
9362
|
-
const ctx = (0,
|
|
9429
|
+
const ctx = (0, import_react61.useContext)(dropZoneContext);
|
|
9363
9430
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
9364
|
-
return /* @__PURE__ */ (0,
|
|
9431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
9365
9432
|
}
|
|
9366
|
-
return /* @__PURE__ */ (0,
|
|
9433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
9367
9434
|
}
|
|
9368
9435
|
);
|
|
9369
9436
|
|
|
@@ -9707,14 +9774,14 @@ function getDeepDir(el) {
|
|
|
9707
9774
|
|
|
9708
9775
|
// components/DragDropContext/index.tsx
|
|
9709
9776
|
var import_state = require("@dnd-kit/state");
|
|
9710
|
-
var
|
|
9777
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
9711
9778
|
var DEBUG3 = false;
|
|
9712
|
-
var dragListenerContext = (0,
|
|
9779
|
+
var dragListenerContext = (0, import_react64.createContext)({
|
|
9713
9780
|
dragListeners: {}
|
|
9714
9781
|
});
|
|
9715
9782
|
function useDragListener(type, fn, deps = []) {
|
|
9716
|
-
const { setDragListeners } = (0,
|
|
9717
|
-
(0,
|
|
9783
|
+
const { setDragListeners } = (0, import_react64.useContext)(dragListenerContext);
|
|
9784
|
+
(0, import_react64.useEffect)(() => {
|
|
9718
9785
|
if (setDragListeners) {
|
|
9719
9786
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
9720
9787
|
[type]: [...old[type] || [], fn]
|
|
@@ -9724,8 +9791,8 @@ function useDragListener(type, fn, deps = []) {
|
|
|
9724
9791
|
}
|
|
9725
9792
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
9726
9793
|
var useTempDisableFallback = (timeout3) => {
|
|
9727
|
-
const lastFallbackDisable = (0,
|
|
9728
|
-
return (0,
|
|
9794
|
+
const lastFallbackDisable = (0, import_react64.useRef)(null);
|
|
9795
|
+
return (0, import_react64.useCallback)((manager) => {
|
|
9729
9796
|
collisionStore.setState({ fallbackEnabled: false });
|
|
9730
9797
|
const fallbackId = generateId();
|
|
9731
9798
|
lastFallbackDisable.current = fallbackId;
|
|
@@ -9744,9 +9811,9 @@ var DragDropContextClient = ({
|
|
|
9744
9811
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
9745
9812
|
const appStore = useAppStoreApi();
|
|
9746
9813
|
const id = useSafeId();
|
|
9747
|
-
const debouncedParamsRef = (0,
|
|
9814
|
+
const debouncedParamsRef = (0, import_react64.useRef)(null);
|
|
9748
9815
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
9749
|
-
const [zoneStore] = (0,
|
|
9816
|
+
const [zoneStore] = (0, import_react64.useState)(
|
|
9750
9817
|
() => (0, import_zustand5.createStore)(() => ({
|
|
9751
9818
|
zoneDepthIndex: {},
|
|
9752
9819
|
nextZoneDepthIndex: {},
|
|
@@ -9758,7 +9825,7 @@ var DragDropContextClient = ({
|
|
|
9758
9825
|
hoveringComponent: null
|
|
9759
9826
|
}))
|
|
9760
9827
|
);
|
|
9761
|
-
const getChanged2 = (0,
|
|
9828
|
+
const getChanged2 = (0, import_react64.useCallback)(
|
|
9762
9829
|
(params, id2) => {
|
|
9763
9830
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
9764
9831
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
@@ -9779,7 +9846,7 @@ var DragDropContextClient = ({
|
|
|
9779
9846
|
},
|
|
9780
9847
|
[zoneStore]
|
|
9781
9848
|
);
|
|
9782
|
-
const setDeepestAndCollide = (0,
|
|
9849
|
+
const setDeepestAndCollide = (0, import_react64.useCallback)(
|
|
9783
9850
|
(params, manager) => {
|
|
9784
9851
|
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
|
9785
9852
|
if (!zoneChanged && !areaChanged) return;
|
|
@@ -9803,7 +9870,7 @@ var DragDropContextClient = ({
|
|
|
9803
9870
|
setDeepestDb.cancel();
|
|
9804
9871
|
debouncedParamsRef.current = null;
|
|
9805
9872
|
};
|
|
9806
|
-
(0,
|
|
9873
|
+
(0, import_react64.useEffect)(() => {
|
|
9807
9874
|
if (DEBUG3) {
|
|
9808
9875
|
zoneStore.subscribe(
|
|
9809
9876
|
(s) => {
|
|
@@ -9817,7 +9884,7 @@ var DragDropContextClient = ({
|
|
|
9817
9884
|
);
|
|
9818
9885
|
}
|
|
9819
9886
|
}, []);
|
|
9820
|
-
const [plugins] = (0,
|
|
9887
|
+
const [plugins] = (0, import_react64.useState)(() => [
|
|
9821
9888
|
...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
|
|
9822
9889
|
createNestedDroppablePlugin(
|
|
9823
9890
|
{
|
|
@@ -9865,10 +9932,10 @@ var DragDropContextClient = ({
|
|
|
9865
9932
|
)
|
|
9866
9933
|
]);
|
|
9867
9934
|
const sensors = useSensors();
|
|
9868
|
-
const [dragListeners, setDragListeners] = (0,
|
|
9869
|
-
const dragMode = (0,
|
|
9870
|
-
const initialSelector = (0,
|
|
9871
|
-
const nextContextValue = (0,
|
|
9935
|
+
const [dragListeners, setDragListeners] = (0, import_react64.useState)({});
|
|
9936
|
+
const dragMode = (0, import_react64.useRef)(null);
|
|
9937
|
+
const initialSelector = (0, import_react64.useRef)(void 0);
|
|
9938
|
+
const nextContextValue = (0, import_react64.useMemo)(
|
|
9872
9939
|
() => ({
|
|
9873
9940
|
mode: "edit",
|
|
9874
9941
|
areaId: "root",
|
|
@@ -9876,15 +9943,15 @@ var DragDropContextClient = ({
|
|
|
9876
9943
|
}),
|
|
9877
9944
|
[]
|
|
9878
9945
|
);
|
|
9879
|
-
return /* @__PURE__ */ (0,
|
|
9946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
9880
9947
|
dragListenerContext.Provider,
|
|
9881
9948
|
{
|
|
9882
9949
|
value: {
|
|
9883
9950
|
dragListeners,
|
|
9884
9951
|
setDragListeners
|
|
9885
9952
|
},
|
|
9886
|
-
children: /* @__PURE__ */ (0,
|
|
9887
|
-
|
|
9953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
9954
|
+
import_react63.DragDropProvider,
|
|
9888
9955
|
{
|
|
9889
9956
|
plugins,
|
|
9890
9957
|
sensors,
|
|
@@ -10099,7 +10166,7 @@ var DragDropContextClient = ({
|
|
|
10099
10166
|
const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
|
|
10100
10167
|
entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
|
|
10101
10168
|
},
|
|
10102
|
-
children: /* @__PURE__ */ (0,
|
|
10169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
|
10103
10170
|
}
|
|
10104
10171
|
)
|
|
10105
10172
|
}
|
|
@@ -10113,12 +10180,12 @@ var DragDropContext = ({
|
|
|
10113
10180
|
if (status === "LOADING") {
|
|
10114
10181
|
return children;
|
|
10115
10182
|
}
|
|
10116
|
-
return /* @__PURE__ */ (0,
|
|
10183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
|
10117
10184
|
};
|
|
10118
10185
|
|
|
10119
10186
|
// components/Drawer/index.tsx
|
|
10120
|
-
var
|
|
10121
|
-
var
|
|
10187
|
+
var import_react66 = require("@dnd-kit/react");
|
|
10188
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
10122
10189
|
var getClassName25 = get_class_name_factory_default("Drawer", styles_module_default14);
|
|
10123
10190
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default14);
|
|
10124
10191
|
var DrawerItemInner = ({
|
|
@@ -10128,11 +10195,11 @@ var DrawerItemInner = ({
|
|
|
10128
10195
|
dragRef,
|
|
10129
10196
|
isDragDisabled
|
|
10130
10197
|
}) => {
|
|
10131
|
-
const CustomInner = (0,
|
|
10132
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
|
10198
|
+
const CustomInner = (0, import_react65.useMemo)(
|
|
10199
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
10133
10200
|
[children]
|
|
10134
10201
|
);
|
|
10135
|
-
return /* @__PURE__ */ (0,
|
|
10202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
10136
10203
|
"div",
|
|
10137
10204
|
{
|
|
10138
10205
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -10140,9 +10207,9 @@ var DrawerItemInner = ({
|
|
|
10140
10207
|
onMouseDown: (e) => e.preventDefault(),
|
|
10141
10208
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
10142
10209
|
"data-puck-drawer-item": true,
|
|
10143
|
-
children: /* @__PURE__ */ (0,
|
|
10144
|
-
/* @__PURE__ */ (0,
|
|
10145
|
-
/* @__PURE__ */ (0,
|
|
10210
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
|
10211
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
|
10212
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DragIcon, {}) })
|
|
10146
10213
|
] }) }) })
|
|
10147
10214
|
}
|
|
10148
10215
|
);
|
|
@@ -10154,15 +10221,15 @@ var DrawerItemDraggable = ({
|
|
|
10154
10221
|
id,
|
|
10155
10222
|
isDragDisabled
|
|
10156
10223
|
}) => {
|
|
10157
|
-
const { ref } = (0,
|
|
10224
|
+
const { ref } = (0, import_react66.useDraggable)({
|
|
10158
10225
|
id,
|
|
10159
10226
|
data: { componentType: name },
|
|
10160
10227
|
disabled: isDragDisabled,
|
|
10161
10228
|
type: "drawer"
|
|
10162
10229
|
});
|
|
10163
|
-
return /* @__PURE__ */ (0,
|
|
10164
|
-
/* @__PURE__ */ (0,
|
|
10165
|
-
/* @__PURE__ */ (0,
|
|
10230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getClassName25("draggable"), children: [
|
|
10231
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassName25("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DrawerItemInner, { name, label, children }) }),
|
|
10232
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: getClassName25("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
10166
10233
|
DrawerItemInner,
|
|
10167
10234
|
{
|
|
10168
10235
|
name,
|
|
@@ -10183,7 +10250,7 @@ var DrawerItem = ({
|
|
|
10183
10250
|
isDragDisabled
|
|
10184
10251
|
}) => {
|
|
10185
10252
|
const resolvedId = id || name;
|
|
10186
|
-
const [dynamicId, setDynamicId] = (0,
|
|
10253
|
+
const [dynamicId, setDynamicId] = (0, import_react65.useState)(generateId(resolvedId));
|
|
10187
10254
|
if (typeof index !== "undefined") {
|
|
10188
10255
|
console.error(
|
|
10189
10256
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -10196,7 +10263,7 @@ var DrawerItem = ({
|
|
|
10196
10263
|
},
|
|
10197
10264
|
[resolvedId]
|
|
10198
10265
|
);
|
|
10199
|
-
return /* @__PURE__ */ (0,
|
|
10266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
10200
10267
|
DrawerItemDraggable,
|
|
10201
10268
|
{
|
|
10202
10269
|
name,
|
|
@@ -10223,13 +10290,13 @@ var Drawer = ({
|
|
|
10223
10290
|
);
|
|
10224
10291
|
}
|
|
10225
10292
|
const id = useSafeId();
|
|
10226
|
-
const { ref } = (0,
|
|
10293
|
+
const { ref } = (0, import_react66.useDroppable)({
|
|
10227
10294
|
id,
|
|
10228
10295
|
type: "void",
|
|
10229
10296
|
collisionPriority: 0
|
|
10230
10297
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
10231
10298
|
});
|
|
10232
|
-
return /* @__PURE__ */ (0,
|
|
10299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
10233
10300
|
"div",
|
|
10234
10301
|
{
|
|
10235
10302
|
className: getClassName25(),
|
|
@@ -10248,7 +10315,7 @@ init_IconButton2();
|
|
|
10248
10315
|
|
|
10249
10316
|
// components/Puck/index.tsx
|
|
10250
10317
|
init_react_import();
|
|
10251
|
-
var
|
|
10318
|
+
var import_react87 = require("react");
|
|
10252
10319
|
|
|
10253
10320
|
// components/SidebarSection/index.tsx
|
|
10254
10321
|
init_react_import();
|
|
@@ -10263,7 +10330,7 @@ init_lucide_react();
|
|
|
10263
10330
|
|
|
10264
10331
|
// lib/use-breadcrumbs.ts
|
|
10265
10332
|
init_react_import();
|
|
10266
|
-
var
|
|
10333
|
+
var import_react67 = require("react");
|
|
10267
10334
|
init_store();
|
|
10268
10335
|
var useBreadcrumbs = (renderCount) => {
|
|
10269
10336
|
const selectedId = useAppStore((s) => {
|
|
@@ -10276,7 +10343,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
10276
10343
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
10277
10344
|
});
|
|
10278
10345
|
const appStore = useAppStoreApi();
|
|
10279
|
-
return (0,
|
|
10346
|
+
return (0, import_react67.useMemo)(() => {
|
|
10280
10347
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
10281
10348
|
var _a, _b, _c;
|
|
10282
10349
|
const [componentId] = zoneCompound.split(":");
|
|
@@ -10309,7 +10376,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
10309
10376
|
// components/SidebarSection/index.tsx
|
|
10310
10377
|
init_store();
|
|
10311
10378
|
init_Loader();
|
|
10312
|
-
var
|
|
10379
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
10313
10380
|
var getClassName26 = get_class_name_factory_default("SidebarSection", styles_module_default18);
|
|
10314
10381
|
var SidebarSection = ({
|
|
10315
10382
|
children,
|
|
@@ -10322,15 +10389,15 @@ var SidebarSection = ({
|
|
|
10322
10389
|
}) => {
|
|
10323
10390
|
const setUi = useAppStore((s) => s.setUi);
|
|
10324
10391
|
const breadcrumbs = useBreadcrumbs(1);
|
|
10325
|
-
return /* @__PURE__ */ (0,
|
|
10392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
10326
10393
|
"div",
|
|
10327
10394
|
{
|
|
10328
10395
|
className: getClassName26({ noBorderTop, noPadding }),
|
|
10329
10396
|
style: { background },
|
|
10330
10397
|
children: [
|
|
10331
|
-
/* @__PURE__ */ (0,
|
|
10332
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
|
10333
|
-
/* @__PURE__ */ (0,
|
|
10398
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName26("title"), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: getClassName26("breadcrumbs"), children: [
|
|
10399
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: getClassName26("breadcrumb"), children: [
|
|
10400
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
10334
10401
|
"button",
|
|
10335
10402
|
{
|
|
10336
10403
|
type: "button",
|
|
@@ -10339,12 +10406,12 @@ var SidebarSection = ({
|
|
|
10339
10406
|
children: breadcrumb.label
|
|
10340
10407
|
}
|
|
10341
10408
|
),
|
|
10342
|
-
/* @__PURE__ */ (0,
|
|
10409
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChevronRight, { size: 16 })
|
|
10343
10410
|
] }, i)) : null,
|
|
10344
|
-
/* @__PURE__ */ (0,
|
|
10411
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName26("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Heading7, { rank: "2", size: "xs", children: title }) })
|
|
10345
10412
|
] }) }),
|
|
10346
|
-
/* @__PURE__ */ (0,
|
|
10347
|
-
isLoading && /* @__PURE__ */ (0,
|
|
10413
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName26("content"), children }),
|
|
10414
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getClassName26("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Loader, { size: 32 }) })
|
|
10348
10415
|
]
|
|
10349
10416
|
}
|
|
10350
10417
|
);
|
|
@@ -10370,15 +10437,15 @@ var styles_module_default20 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
|
10370
10437
|
|
|
10371
10438
|
// components/Puck/components/Fields/index.tsx
|
|
10372
10439
|
init_lib();
|
|
10373
|
-
var
|
|
10440
|
+
var import_react68 = require("react");
|
|
10374
10441
|
init_fields();
|
|
10375
10442
|
var import_shallow5 = require("zustand/react/shallow");
|
|
10376
|
-
var
|
|
10443
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
10377
10444
|
var getClassName27 = get_class_name_factory_default("PuckFields", styles_module_default20);
|
|
10378
10445
|
var DefaultFields = ({
|
|
10379
10446
|
children
|
|
10380
10447
|
}) => {
|
|
10381
|
-
return /* @__PURE__ */ (0,
|
|
10448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, { children });
|
|
10382
10449
|
};
|
|
10383
10450
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
10384
10451
|
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
@@ -10443,13 +10510,13 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
10443
10510
|
})
|
|
10444
10511
|
);
|
|
10445
10512
|
const appStore = useAppStoreApi();
|
|
10446
|
-
const onChange = (0,
|
|
10513
|
+
const onChange = (0, import_react68.useCallback)(createOnChange(fieldName, appStore), [
|
|
10447
10514
|
fieldName
|
|
10448
10515
|
]);
|
|
10449
10516
|
const { visible = true } = field != null ? field : {};
|
|
10450
10517
|
if (!field || !id || !visible) return null;
|
|
10451
10518
|
if (field.type === "slot") return null;
|
|
10452
|
-
return /* @__PURE__ */ (0,
|
|
10519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: getClassName27("field"), children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10453
10520
|
AutoFieldPrivate,
|
|
10454
10521
|
{
|
|
10455
10522
|
field,
|
|
@@ -10461,7 +10528,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
10461
10528
|
}
|
|
10462
10529
|
) }, id);
|
|
10463
10530
|
};
|
|
10464
|
-
var FieldsChildMemo = (0,
|
|
10531
|
+
var FieldsChildMemo = (0, import_react68.memo)(FieldsChild);
|
|
10465
10532
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
10466
10533
|
const overrides = useAppStore((s) => s.overrides);
|
|
10467
10534
|
const componentResolving = useAppStore((s) => {
|
|
@@ -10486,8 +10553,8 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
10486
10553
|
})
|
|
10487
10554
|
);
|
|
10488
10555
|
const isLoading = fieldsLoading || componentResolving;
|
|
10489
|
-
const Wrapper = (0,
|
|
10490
|
-
return /* @__PURE__ */ (0,
|
|
10556
|
+
const Wrapper = (0, import_react68.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
10557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
10491
10558
|
"form",
|
|
10492
10559
|
{
|
|
10493
10560
|
className: getClassName27({ wrapFields }),
|
|
@@ -10495,20 +10562,20 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
10495
10562
|
e.preventDefault();
|
|
10496
10563
|
},
|
|
10497
10564
|
children: [
|
|
10498
|
-
/* @__PURE__ */ (0,
|
|
10499
|
-
isLoading && /* @__PURE__ */ (0,
|
|
10565
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
10566
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: getClassName27("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: getClassName27("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Loader, { size: 16 }) }) })
|
|
10500
10567
|
]
|
|
10501
10568
|
}
|
|
10502
10569
|
);
|
|
10503
10570
|
};
|
|
10504
|
-
var Fields = (0,
|
|
10571
|
+
var Fields = (0, import_react68.memo)(FieldsInternal);
|
|
10505
10572
|
|
|
10506
10573
|
// components/Puck/components/Components/index.tsx
|
|
10507
10574
|
init_react_import();
|
|
10508
10575
|
|
|
10509
10576
|
// lib/use-component-list.tsx
|
|
10510
10577
|
init_react_import();
|
|
10511
|
-
var
|
|
10578
|
+
var import_react70 = require("react");
|
|
10512
10579
|
|
|
10513
10580
|
// components/ComponentList/index.tsx
|
|
10514
10581
|
init_react_import();
|
|
@@ -10519,10 +10586,10 @@ var styles_module_default21 = { "ComponentList": "_ComponentList_1rrlt_1", "Comp
|
|
|
10519
10586
|
|
|
10520
10587
|
// components/ComponentList/index.tsx
|
|
10521
10588
|
init_get_class_name_factory();
|
|
10522
|
-
var
|
|
10589
|
+
var import_react69 = require("react");
|
|
10523
10590
|
init_store();
|
|
10524
10591
|
init_lucide_react();
|
|
10525
|
-
var
|
|
10592
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10526
10593
|
var getClassName28 = get_class_name_factory_default("ComponentList", styles_module_default21);
|
|
10527
10594
|
var ComponentListItem = ({
|
|
10528
10595
|
name,
|
|
@@ -10535,14 +10602,14 @@ var ComponentListItem = ({
|
|
|
10535
10602
|
type: name
|
|
10536
10603
|
}).insert
|
|
10537
10604
|
);
|
|
10538
|
-
(0,
|
|
10605
|
+
(0, import_react69.useEffect)(() => {
|
|
10539
10606
|
if (overrides.componentItem) {
|
|
10540
10607
|
console.warn(
|
|
10541
10608
|
"The `componentItem` override has been deprecated and renamed to `drawerItem`"
|
|
10542
10609
|
);
|
|
10543
10610
|
}
|
|
10544
10611
|
}, [overrides]);
|
|
10545
|
-
return /* @__PURE__ */ (0,
|
|
10612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
10546
10613
|
};
|
|
10547
10614
|
var ComponentList = ({
|
|
10548
10615
|
children,
|
|
@@ -10553,8 +10620,8 @@ var ComponentList = ({
|
|
|
10553
10620
|
const setUi = useAppStore((s) => s.setUi);
|
|
10554
10621
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
10555
10622
|
const { expanded = true } = componentList[id] || {};
|
|
10556
|
-
return /* @__PURE__ */ (0,
|
|
10557
|
-
title && /* @__PURE__ */ (0,
|
|
10623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: getClassName28({ isExpanded: expanded }), children: [
|
|
10624
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
10558
10625
|
"button",
|
|
10559
10626
|
{
|
|
10560
10627
|
type: "button",
|
|
@@ -10568,14 +10635,14 @@ var ComponentList = ({
|
|
|
10568
10635
|
}),
|
|
10569
10636
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
10570
10637
|
children: [
|
|
10571
|
-
/* @__PURE__ */ (0,
|
|
10572
|
-
/* @__PURE__ */ (0,
|
|
10638
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { children: title }),
|
|
10639
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: getClassName28("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChevronDown, { size: 12 }) })
|
|
10573
10640
|
]
|
|
10574
10641
|
}
|
|
10575
10642
|
),
|
|
10576
|
-
/* @__PURE__ */ (0,
|
|
10643
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: getClassName28("content"), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
10577
10644
|
var _a;
|
|
10578
|
-
return /* @__PURE__ */ (0,
|
|
10645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10579
10646
|
ComponentListItem,
|
|
10580
10647
|
{
|
|
10581
10648
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -10590,12 +10657,12 @@ ComponentList.Item = ComponentListItem;
|
|
|
10590
10657
|
|
|
10591
10658
|
// lib/use-component-list.tsx
|
|
10592
10659
|
init_store();
|
|
10593
|
-
var
|
|
10660
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10594
10661
|
var useComponentList = () => {
|
|
10595
|
-
const [componentList, setComponentList] = (0,
|
|
10662
|
+
const [componentList, setComponentList] = (0, import_react70.useState)();
|
|
10596
10663
|
const config = useAppStore((s) => s.config);
|
|
10597
10664
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
10598
|
-
(0,
|
|
10665
|
+
(0, import_react70.useEffect)(() => {
|
|
10599
10666
|
var _a, _b, _c;
|
|
10600
10667
|
if (Object.keys(uiComponentList).length > 0) {
|
|
10601
10668
|
const matchedComponents = [];
|
|
@@ -10611,7 +10678,7 @@ var useComponentList = () => {
|
|
|
10611
10678
|
if (category.visible === false) {
|
|
10612
10679
|
return null;
|
|
10613
10680
|
}
|
|
10614
|
-
return /* @__PURE__ */ (0,
|
|
10681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10615
10682
|
ComponentList,
|
|
10616
10683
|
{
|
|
10617
10684
|
id: categoryKey,
|
|
@@ -10619,7 +10686,7 @@ var useComponentList = () => {
|
|
|
10619
10686
|
children: category.components.map((componentName, i) => {
|
|
10620
10687
|
var _a2;
|
|
10621
10688
|
const componentConf = config.components[componentName] || {};
|
|
10622
|
-
return /* @__PURE__ */ (0,
|
|
10689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10623
10690
|
ComponentList.Item,
|
|
10624
10691
|
{
|
|
10625
10692
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -10639,7 +10706,7 @@ var useComponentList = () => {
|
|
|
10639
10706
|
);
|
|
10640
10707
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
10641
10708
|
_componentList.push(
|
|
10642
|
-
/* @__PURE__ */ (0,
|
|
10709
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10643
10710
|
ComponentList,
|
|
10644
10711
|
{
|
|
10645
10712
|
id: "other",
|
|
@@ -10647,7 +10714,7 @@ var useComponentList = () => {
|
|
|
10647
10714
|
children: remainingComponents.map((componentName, i) => {
|
|
10648
10715
|
var _a2;
|
|
10649
10716
|
const componentConf = config.components[componentName] || {};
|
|
10650
|
-
return /* @__PURE__ */ (0,
|
|
10717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10651
10718
|
ComponentList.Item,
|
|
10652
10719
|
{
|
|
10653
10720
|
name: componentName,
|
|
@@ -10670,12 +10737,12 @@ var useComponentList = () => {
|
|
|
10670
10737
|
|
|
10671
10738
|
// components/Puck/components/Components/index.tsx
|
|
10672
10739
|
init_store();
|
|
10673
|
-
var
|
|
10674
|
-
var
|
|
10740
|
+
var import_react71 = require("react");
|
|
10741
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10675
10742
|
var Components = () => {
|
|
10676
10743
|
const overrides = useAppStore((s) => s.overrides);
|
|
10677
10744
|
const componentList = useComponentList();
|
|
10678
|
-
const Wrapper = (0,
|
|
10745
|
+
const Wrapper = (0, import_react71.useMemo)(() => {
|
|
10679
10746
|
if (overrides.components) {
|
|
10680
10747
|
console.warn(
|
|
10681
10748
|
"The `components` override has been deprecated and renamed to `drawer`"
|
|
@@ -10683,21 +10750,21 @@ var Components = () => {
|
|
|
10683
10750
|
}
|
|
10684
10751
|
return overrides.components || overrides.drawer || "div";
|
|
10685
10752
|
}, [overrides]);
|
|
10686
|
-
return /* @__PURE__ */ (0,
|
|
10753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ComponentList, { id: "all" }) });
|
|
10687
10754
|
};
|
|
10688
10755
|
|
|
10689
10756
|
// components/Puck/components/Preview/index.tsx
|
|
10690
10757
|
init_react_import();
|
|
10691
10758
|
init_root_droppable_id();
|
|
10692
|
-
var
|
|
10759
|
+
var import_react73 = require("react");
|
|
10693
10760
|
init_store();
|
|
10694
10761
|
|
|
10695
10762
|
// components/AutoFrame/index.tsx
|
|
10696
10763
|
init_react_import();
|
|
10697
|
-
var
|
|
10764
|
+
var import_react72 = require("react");
|
|
10698
10765
|
var import_object_hash = __toESM(require("object-hash"));
|
|
10699
10766
|
var import_react_dom3 = require("react-dom");
|
|
10700
|
-
var
|
|
10767
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10701
10768
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
10702
10769
|
var collectStyles = (doc) => {
|
|
10703
10770
|
const collected = [];
|
|
@@ -10747,7 +10814,7 @@ var CopyHostStyles = ({
|
|
|
10747
10814
|
onStylesLoaded = () => null
|
|
10748
10815
|
}) => {
|
|
10749
10816
|
const { document: doc, window: win } = useFrame();
|
|
10750
|
-
(0,
|
|
10817
|
+
(0, import_react72.useEffect)(() => {
|
|
10751
10818
|
if (!win || !doc) {
|
|
10752
10819
|
return () => {
|
|
10753
10820
|
};
|
|
@@ -10904,10 +10971,10 @@ var CopyHostStyles = ({
|
|
|
10904
10971
|
observer.disconnect();
|
|
10905
10972
|
};
|
|
10906
10973
|
}, []);
|
|
10907
|
-
return /* @__PURE__ */ (0,
|
|
10974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children });
|
|
10908
10975
|
};
|
|
10909
|
-
var autoFrameContext = (0,
|
|
10910
|
-
var useFrame = () => (0,
|
|
10976
|
+
var autoFrameContext = (0, import_react72.createContext)({});
|
|
10977
|
+
var useFrame = () => (0, import_react72.useContext)(autoFrameContext);
|
|
10911
10978
|
function AutoFrame(_a) {
|
|
10912
10979
|
var _b = _a, {
|
|
10913
10980
|
children,
|
|
@@ -10928,11 +10995,11 @@ function AutoFrame(_a) {
|
|
|
10928
10995
|
"onNotReady",
|
|
10929
10996
|
"frameRef"
|
|
10930
10997
|
]);
|
|
10931
|
-
const [loaded, setLoaded] = (0,
|
|
10932
|
-
const [ctx, setCtx] = (0,
|
|
10933
|
-
const [mountTarget, setMountTarget] = (0,
|
|
10934
|
-
const [stylesLoaded, setStylesLoaded] = (0,
|
|
10935
|
-
(0,
|
|
10998
|
+
const [loaded, setLoaded] = (0, import_react72.useState)(false);
|
|
10999
|
+
const [ctx, setCtx] = (0, import_react72.useState)({});
|
|
11000
|
+
const [mountTarget, setMountTarget] = (0, import_react72.useState)();
|
|
11001
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react72.useState)(false);
|
|
11002
|
+
(0, import_react72.useEffect)(() => {
|
|
10936
11003
|
var _a2;
|
|
10937
11004
|
if (frameRef.current) {
|
|
10938
11005
|
const doc = frameRef.current.contentDocument;
|
|
@@ -10951,7 +11018,7 @@ function AutoFrame(_a) {
|
|
|
10951
11018
|
}
|
|
10952
11019
|
}
|
|
10953
11020
|
}, [frameRef, loaded, stylesLoaded]);
|
|
10954
|
-
return /* @__PURE__ */ (0,
|
|
11021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10955
11022
|
"iframe",
|
|
10956
11023
|
__spreadProps(__spreadValues({}, props), {
|
|
10957
11024
|
className,
|
|
@@ -10961,7 +11028,7 @@ function AutoFrame(_a) {
|
|
|
10961
11028
|
onLoad: () => {
|
|
10962
11029
|
setLoaded(true);
|
|
10963
11030
|
},
|
|
10964
|
-
children: /* @__PURE__ */ (0,
|
|
11031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10965
11032
|
CopyHostStyles,
|
|
10966
11033
|
{
|
|
10967
11034
|
debug,
|
|
@@ -10981,11 +11048,11 @@ var styles_module_default22 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
|
|
|
10981
11048
|
|
|
10982
11049
|
// components/Puck/components/Preview/index.tsx
|
|
10983
11050
|
init_lib();
|
|
10984
|
-
var
|
|
11051
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10985
11052
|
var getClassName29 = get_class_name_factory_default("PuckPreview", styles_module_default22);
|
|
10986
11053
|
var useBubbleIframeEvents = (ref) => {
|
|
10987
11054
|
const status = useAppStore((s) => s.status);
|
|
10988
|
-
(0,
|
|
11055
|
+
(0, import_react73.useEffect)(() => {
|
|
10989
11056
|
if (ref.current && status === "READY") {
|
|
10990
11057
|
const iframe = ref.current;
|
|
10991
11058
|
const handlePointerMove = (event) => {
|
|
@@ -11034,7 +11101,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11034
11101
|
const renderData = useAppStore(
|
|
11035
11102
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
11036
11103
|
);
|
|
11037
|
-
const Page = (0,
|
|
11104
|
+
const Page = (0, import_react73.useCallback)(
|
|
11038
11105
|
(pageProps) => {
|
|
11039
11106
|
var _a, _b, _c, _d;
|
|
11040
11107
|
const propsWithSlots = useSlots(
|
|
@@ -11048,15 +11115,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11048
11115
|
);
|
|
11049
11116
|
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
|
|
11050
11117
|
id: "puck-root"
|
|
11051
|
-
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ (0,
|
|
11118
|
+
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_jsx_runtime73.Fragment, { children: propsWithSlots.children });
|
|
11052
11119
|
},
|
|
11053
11120
|
[config]
|
|
11054
11121
|
);
|
|
11055
|
-
const Frame = (0,
|
|
11122
|
+
const Frame = (0, import_react73.useMemo)(() => overrides.iframe, [overrides]);
|
|
11056
11123
|
const rootProps = root.props || root;
|
|
11057
|
-
const ref = (0,
|
|
11124
|
+
const ref = (0, import_react73.useRef)(null);
|
|
11058
11125
|
useBubbleIframeEvents(ref);
|
|
11059
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
|
11126
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11060
11127
|
Page,
|
|
11061
11128
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
11062
11129
|
puck: {
|
|
@@ -11066,15 +11133,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11066
11133
|
metadata
|
|
11067
11134
|
},
|
|
11068
11135
|
editMode: true,
|
|
11069
|
-
children: /* @__PURE__ */ (0,
|
|
11136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DropZonePure, { zone: rootDroppableId })
|
|
11070
11137
|
})
|
|
11071
|
-
) : /* @__PURE__ */ (0,
|
|
11072
|
-
(0,
|
|
11138
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Render, { data: renderData, config, metadata });
|
|
11139
|
+
(0, import_react73.useEffect)(() => {
|
|
11073
11140
|
if (!iframe.enabled) {
|
|
11074
11141
|
setStatus("READY");
|
|
11075
11142
|
}
|
|
11076
11143
|
}, [iframe.enabled]);
|
|
11077
|
-
return /* @__PURE__ */ (0,
|
|
11144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11078
11145
|
"div",
|
|
11079
11146
|
{
|
|
11080
11147
|
className: getClassName29(),
|
|
@@ -11086,7 +11153,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11086
11153
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
11087
11154
|
}
|
|
11088
11155
|
},
|
|
11089
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
|
11156
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11090
11157
|
AutoFrame_default,
|
|
11091
11158
|
{
|
|
11092
11159
|
id: "preview-frame",
|
|
@@ -11099,14 +11166,14 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11099
11166
|
setStatus("MOUNTED");
|
|
11100
11167
|
},
|
|
11101
11168
|
frameRef: ref,
|
|
11102
|
-
children: /* @__PURE__ */ (0,
|
|
11169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
11103
11170
|
if (Frame) {
|
|
11104
|
-
return /* @__PURE__ */ (0,
|
|
11171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Frame, { document: document2, children: inner });
|
|
11105
11172
|
}
|
|
11106
11173
|
return inner;
|
|
11107
11174
|
} })
|
|
11108
11175
|
}
|
|
11109
|
-
) : /* @__PURE__ */ (0,
|
|
11176
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11110
11177
|
"div",
|
|
11111
11178
|
{
|
|
11112
11179
|
id: "preview-frame",
|
|
@@ -11147,7 +11214,7 @@ var scrollIntoView = (el) => {
|
|
|
11147
11214
|
// components/LayerTree/index.tsx
|
|
11148
11215
|
init_lucide_react();
|
|
11149
11216
|
init_root_droppable_id();
|
|
11150
|
-
var
|
|
11217
|
+
var import_react74 = require("react");
|
|
11151
11218
|
|
|
11152
11219
|
// lib/on-scroll-end.ts
|
|
11153
11220
|
init_react_import();
|
|
@@ -11171,7 +11238,7 @@ var onScrollEnd = (frame, cb) => {
|
|
|
11171
11238
|
// components/LayerTree/index.tsx
|
|
11172
11239
|
init_store();
|
|
11173
11240
|
var import_shallow6 = require("zustand/react/shallow");
|
|
11174
|
-
var
|
|
11241
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11175
11242
|
var getClassName30 = get_class_name_factory_default("LayerTree", styles_module_default23);
|
|
11176
11243
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default23);
|
|
11177
11244
|
var Layer = ({
|
|
@@ -11183,7 +11250,7 @@ var Layer = ({
|
|
|
11183
11250
|
const config = useAppStore((s) => s.config);
|
|
11184
11251
|
const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
|
|
11185
11252
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
11186
|
-
const setItemSelector = (0,
|
|
11253
|
+
const setItemSelector = (0, import_react74.useCallback)(
|
|
11187
11254
|
(itemSelector2) => {
|
|
11188
11255
|
dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
|
|
11189
11256
|
},
|
|
@@ -11203,7 +11270,7 @@ var Layer = ({
|
|
|
11203
11270
|
)
|
|
11204
11271
|
);
|
|
11205
11272
|
const containsZone = zonesForItem.length > 0;
|
|
11206
|
-
const zoneStore = (0,
|
|
11273
|
+
const zoneStore = (0, import_react74.useContext)(ZoneStoreContext);
|
|
11207
11274
|
const isHovering = useContextStore(
|
|
11208
11275
|
ZoneStoreContext,
|
|
11209
11276
|
(s) => s.hoveringComponent === itemId
|
|
@@ -11218,7 +11285,7 @@ var Layer = ({
|
|
|
11218
11285
|
});
|
|
11219
11286
|
const componentConfig = config.components[nodeData.data.type];
|
|
11220
11287
|
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
|
11221
|
-
return /* @__PURE__ */ (0,
|
|
11288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
11222
11289
|
"li",
|
|
11223
11290
|
{
|
|
11224
11291
|
className: getClassNameLayer({
|
|
@@ -11228,7 +11295,7 @@ var Layer = ({
|
|
|
11228
11295
|
childIsSelected
|
|
11229
11296
|
}),
|
|
11230
11297
|
children: [
|
|
11231
|
-
/* @__PURE__ */ (0,
|
|
11298
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
11232
11299
|
"button",
|
|
11233
11300
|
{
|
|
11234
11301
|
type: "button",
|
|
@@ -11266,22 +11333,22 @@ var Layer = ({
|
|
|
11266
11333
|
zoneStore.setState({ hoveringComponent: null });
|
|
11267
11334
|
},
|
|
11268
11335
|
children: [
|
|
11269
|
-
containsZone && /* @__PURE__ */ (0,
|
|
11336
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
11270
11337
|
"div",
|
|
11271
11338
|
{
|
|
11272
11339
|
className: getClassNameLayer("chevron"),
|
|
11273
11340
|
title: isSelected ? "Collapse" : "Expand",
|
|
11274
|
-
children: /* @__PURE__ */ (0,
|
|
11341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ChevronDown, { size: "12" })
|
|
11275
11342
|
}
|
|
11276
11343
|
),
|
|
11277
|
-
/* @__PURE__ */ (0,
|
|
11278
|
-
/* @__PURE__ */ (0,
|
|
11279
|
-
/* @__PURE__ */ (0,
|
|
11344
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
|
11345
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(LayoutGrid, { size: "16" }) }),
|
|
11346
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassNameLayer("name"), children: label })
|
|
11280
11347
|
] })
|
|
11281
11348
|
]
|
|
11282
11349
|
}
|
|
11283
11350
|
) }),
|
|
11284
|
-
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0,
|
|
11351
|
+
containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
|
|
11285
11352
|
]
|
|
11286
11353
|
}
|
|
11287
11354
|
);
|
|
@@ -11307,15 +11374,15 @@ var LayerTree = ({
|
|
|
11307
11374
|
}
|
|
11308
11375
|
)
|
|
11309
11376
|
);
|
|
11310
|
-
return /* @__PURE__ */ (0,
|
|
11311
|
-
label && /* @__PURE__ */ (0,
|
|
11312
|
-
/* @__PURE__ */ (0,
|
|
11377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
11378
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: getClassName30("zoneTitle"), children: [
|
|
11379
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName30("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Layers, { size: "16" }) }),
|
|
11313
11380
|
label
|
|
11314
11381
|
] }),
|
|
11315
|
-
/* @__PURE__ */ (0,
|
|
11316
|
-
contentIds.length === 0 && /* @__PURE__ */ (0,
|
|
11382
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("ul", { className: getClassName30(), children: [
|
|
11383
|
+
contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName30("helper"), children: "No items" }),
|
|
11317
11384
|
contentIds.map((itemId, i) => {
|
|
11318
|
-
return /* @__PURE__ */ (0,
|
|
11385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
11319
11386
|
Layer,
|
|
11320
11387
|
{
|
|
11321
11388
|
index: i,
|
|
@@ -11331,7 +11398,7 @@ var LayerTree = ({
|
|
|
11331
11398
|
|
|
11332
11399
|
// components/Puck/components/Outline/index.tsx
|
|
11333
11400
|
init_store();
|
|
11334
|
-
var
|
|
11401
|
+
var import_react75 = require("react");
|
|
11335
11402
|
|
|
11336
11403
|
// lib/data/find-zones-for-area.ts
|
|
11337
11404
|
init_react_import();
|
|
@@ -11343,14 +11410,14 @@ var findZonesForArea = (state, area) => {
|
|
|
11343
11410
|
|
|
11344
11411
|
// components/Puck/components/Outline/index.tsx
|
|
11345
11412
|
var import_shallow7 = require("zustand/react/shallow");
|
|
11346
|
-
var
|
|
11413
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11347
11414
|
var Outline = () => {
|
|
11348
11415
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
11349
11416
|
const rootZones = useAppStore(
|
|
11350
11417
|
(0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
|
|
11351
11418
|
);
|
|
11352
|
-
const Wrapper = (0,
|
|
11353
|
-
return /* @__PURE__ */ (0,
|
|
11419
|
+
const Wrapper = (0, import_react75.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
|
11420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11354
11421
|
LayerTree,
|
|
11355
11422
|
{
|
|
11356
11423
|
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
@@ -11363,7 +11430,7 @@ var Outline = () => {
|
|
|
11363
11430
|
// components/Puck/components/Canvas/index.tsx
|
|
11364
11431
|
init_react_import();
|
|
11365
11432
|
init_css_box_model_esm();
|
|
11366
|
-
var
|
|
11433
|
+
var import_react78 = require("react");
|
|
11367
11434
|
init_store();
|
|
11368
11435
|
|
|
11369
11436
|
// components/ViewportControls/index.tsx
|
|
@@ -11371,7 +11438,7 @@ init_react_import();
|
|
|
11371
11438
|
init_lucide_react();
|
|
11372
11439
|
init_IconButton2();
|
|
11373
11440
|
init_store();
|
|
11374
|
-
var
|
|
11441
|
+
var import_react76 = require("react");
|
|
11375
11442
|
init_lib();
|
|
11376
11443
|
|
|
11377
11444
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
@@ -11379,11 +11446,11 @@ init_react_import();
|
|
|
11379
11446
|
var styles_module_default24 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
|
|
11380
11447
|
|
|
11381
11448
|
// components/ViewportControls/index.tsx
|
|
11382
|
-
var
|
|
11449
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11383
11450
|
var icons = {
|
|
11384
|
-
Smartphone: /* @__PURE__ */ (0,
|
|
11385
|
-
Tablet: /* @__PURE__ */ (0,
|
|
11386
|
-
Monitor: /* @__PURE__ */ (0,
|
|
11451
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Smartphone, { size: 16 }),
|
|
11452
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Tablet, { size: 16 }),
|
|
11453
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Monitor, { size: 16 })
|
|
11387
11454
|
};
|
|
11388
11455
|
var getClassName31 = get_class_name_factory_default("ViewportControls", styles_module_default24);
|
|
11389
11456
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default24);
|
|
@@ -11395,11 +11462,11 @@ var ViewportButton = ({
|
|
|
11395
11462
|
onClick
|
|
11396
11463
|
}) => {
|
|
11397
11464
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
11398
|
-
const [isActive, setIsActive] = (0,
|
|
11399
|
-
(0,
|
|
11465
|
+
const [isActive, setIsActive] = (0, import_react76.useState)(false);
|
|
11466
|
+
(0, import_react76.useEffect)(() => {
|
|
11400
11467
|
setIsActive(width === viewports.current.width);
|
|
11401
11468
|
}, [width, viewports.current.width]);
|
|
11402
|
-
return /* @__PURE__ */ (0,
|
|
11469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11403
11470
|
IconButton,
|
|
11404
11471
|
{
|
|
11405
11472
|
type: "button",
|
|
@@ -11409,7 +11476,7 @@ var ViewportButton = ({
|
|
|
11409
11476
|
e.stopPropagation();
|
|
11410
11477
|
onClick({ width, height });
|
|
11411
11478
|
},
|
|
11412
|
-
children: /* @__PURE__ */ (0,
|
|
11479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: getClassNameButton("inner"), children })
|
|
11413
11480
|
}
|
|
11414
11481
|
) });
|
|
11415
11482
|
};
|
|
@@ -11433,7 +11500,7 @@ var ViewportControls = ({
|
|
|
11433
11500
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
11434
11501
|
(option) => option.value === autoZoom
|
|
11435
11502
|
);
|
|
11436
|
-
const zoomOptions = (0,
|
|
11503
|
+
const zoomOptions = (0, import_react76.useMemo)(
|
|
11437
11504
|
() => [
|
|
11438
11505
|
...defaultZoomOptions,
|
|
11439
11506
|
...defaultsContainAutoZoom ? [] : [
|
|
@@ -11445,8 +11512,8 @@ var ViewportControls = ({
|
|
|
11445
11512
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
11446
11513
|
[autoZoom]
|
|
11447
11514
|
);
|
|
11448
|
-
return /* @__PURE__ */ (0,
|
|
11449
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
|
11515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: getClassName31(), children: [
|
|
11516
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11450
11517
|
ViewportButton,
|
|
11451
11518
|
{
|
|
11452
11519
|
height: viewport.height,
|
|
@@ -11457,8 +11524,8 @@ var ViewportControls = ({
|
|
|
11457
11524
|
},
|
|
11458
11525
|
i
|
|
11459
11526
|
)),
|
|
11460
|
-
/* @__PURE__ */ (0,
|
|
11461
|
-
/* @__PURE__ */ (0,
|
|
11527
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: getClassName31("divider") }),
|
|
11528
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11462
11529
|
IconButton,
|
|
11463
11530
|
{
|
|
11464
11531
|
type: "button",
|
|
@@ -11473,10 +11540,10 @@ var ViewportControls = ({
|
|
|
11473
11540
|
)].value
|
|
11474
11541
|
);
|
|
11475
11542
|
},
|
|
11476
|
-
children: /* @__PURE__ */ (0,
|
|
11543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ZoomOut, { size: 16 })
|
|
11477
11544
|
}
|
|
11478
11545
|
),
|
|
11479
|
-
/* @__PURE__ */ (0,
|
|
11546
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11480
11547
|
IconButton,
|
|
11481
11548
|
{
|
|
11482
11549
|
type: "button",
|
|
@@ -11491,11 +11558,11 @@ var ViewportControls = ({
|
|
|
11491
11558
|
)].value
|
|
11492
11559
|
);
|
|
11493
11560
|
},
|
|
11494
|
-
children: /* @__PURE__ */ (0,
|
|
11561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ZoomIn, { size: 16 })
|
|
11495
11562
|
}
|
|
11496
11563
|
),
|
|
11497
|
-
/* @__PURE__ */ (0,
|
|
11498
|
-
/* @__PURE__ */ (0,
|
|
11564
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: getClassName31("divider") }),
|
|
11565
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11499
11566
|
"select",
|
|
11500
11567
|
{
|
|
11501
11568
|
className: getClassName31("zoomSelect"),
|
|
@@ -11506,7 +11573,7 @@ var ViewportControls = ({
|
|
|
11506
11573
|
onChange: (e) => {
|
|
11507
11574
|
onZoom(parseFloat(e.currentTarget.value));
|
|
11508
11575
|
},
|
|
11509
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
|
11576
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11510
11577
|
"option",
|
|
11511
11578
|
{
|
|
11512
11579
|
value: option.value,
|
|
@@ -11530,23 +11597,23 @@ var import_shallow8 = require("zustand/react/shallow");
|
|
|
11530
11597
|
|
|
11531
11598
|
// lib/frame-context.tsx
|
|
11532
11599
|
init_react_import();
|
|
11533
|
-
var
|
|
11534
|
-
var
|
|
11535
|
-
var FrameContext = (0,
|
|
11600
|
+
var import_react77 = require("react");
|
|
11601
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11602
|
+
var FrameContext = (0, import_react77.createContext)(null);
|
|
11536
11603
|
var FrameProvider = ({
|
|
11537
11604
|
children
|
|
11538
11605
|
}) => {
|
|
11539
|
-
const frameRef = (0,
|
|
11540
|
-
const value = (0,
|
|
11606
|
+
const frameRef = (0, import_react77.useRef)(null);
|
|
11607
|
+
const value = (0, import_react77.useMemo)(
|
|
11541
11608
|
() => ({
|
|
11542
11609
|
frameRef
|
|
11543
11610
|
}),
|
|
11544
11611
|
[]
|
|
11545
11612
|
);
|
|
11546
|
-
return /* @__PURE__ */ (0,
|
|
11613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FrameContext.Provider, { value, children });
|
|
11547
11614
|
};
|
|
11548
11615
|
var useCanvasFrame = () => {
|
|
11549
|
-
const context = (0,
|
|
11616
|
+
const context = (0, import_react77.useContext)(FrameContext);
|
|
11550
11617
|
if (context === null) {
|
|
11551
11618
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
11552
11619
|
}
|
|
@@ -11554,7 +11621,7 @@ var useCanvasFrame = () => {
|
|
|
11554
11621
|
};
|
|
11555
11622
|
|
|
11556
11623
|
// components/Puck/components/Canvas/index.tsx
|
|
11557
|
-
var
|
|
11624
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11558
11625
|
var getClassName32 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
|
|
11559
11626
|
var ZOOM_ON_CHANGE = true;
|
|
11560
11627
|
var TRANSITION_DURATION = 150;
|
|
@@ -11595,17 +11662,17 @@ var Canvas = () => {
|
|
|
11595
11662
|
viewports: s.state.ui.viewports
|
|
11596
11663
|
}))
|
|
11597
11664
|
);
|
|
11598
|
-
const [showTransition, setShowTransition] = (0,
|
|
11599
|
-
const isResizingRef = (0,
|
|
11600
|
-
const defaultRender = (0,
|
|
11601
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
|
11665
|
+
const [showTransition, setShowTransition] = (0, import_react78.useState)(false);
|
|
11666
|
+
const isResizingRef = (0, import_react78.useRef)(false);
|
|
11667
|
+
const defaultRender = (0, import_react78.useMemo)(() => {
|
|
11668
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children });
|
|
11602
11669
|
return PuckDefault;
|
|
11603
11670
|
}, []);
|
|
11604
|
-
const CustomPreview = (0,
|
|
11671
|
+
const CustomPreview = (0, import_react78.useMemo)(
|
|
11605
11672
|
() => overrides.preview || defaultRender,
|
|
11606
11673
|
[overrides]
|
|
11607
11674
|
);
|
|
11608
|
-
const getFrameDimensions = (0,
|
|
11675
|
+
const getFrameDimensions = (0, import_react78.useCallback)(() => {
|
|
11609
11676
|
if (frameRef.current) {
|
|
11610
11677
|
const frame = frameRef.current;
|
|
11611
11678
|
const box = getBox(frame);
|
|
@@ -11613,7 +11680,7 @@ var Canvas = () => {
|
|
|
11613
11680
|
}
|
|
11614
11681
|
return { width: 0, height: 0 };
|
|
11615
11682
|
}, [frameRef]);
|
|
11616
|
-
(0,
|
|
11683
|
+
(0, import_react78.useEffect)(() => {
|
|
11617
11684
|
resetAutoZoom();
|
|
11618
11685
|
}, [
|
|
11619
11686
|
frameRef,
|
|
@@ -11623,7 +11690,7 @@ var Canvas = () => {
|
|
|
11623
11690
|
rightSideBarWidth,
|
|
11624
11691
|
viewports
|
|
11625
11692
|
]);
|
|
11626
|
-
(0,
|
|
11693
|
+
(0, import_react78.useEffect)(() => {
|
|
11627
11694
|
const { height: frameHeight } = getFrameDimensions();
|
|
11628
11695
|
if (viewports.current.height === "auto") {
|
|
11629
11696
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
@@ -11631,12 +11698,12 @@ var Canvas = () => {
|
|
|
11631
11698
|
}));
|
|
11632
11699
|
}
|
|
11633
11700
|
}, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
|
|
11634
|
-
(0,
|
|
11701
|
+
(0, import_react78.useEffect)(() => {
|
|
11635
11702
|
if (ZOOM_ON_CHANGE) {
|
|
11636
11703
|
resetAutoZoom();
|
|
11637
11704
|
}
|
|
11638
11705
|
}, [viewports.current.width, viewports]);
|
|
11639
|
-
(0,
|
|
11706
|
+
(0, import_react78.useEffect)(() => {
|
|
11640
11707
|
if (!frameRef.current) return;
|
|
11641
11708
|
const resizeObserver = new ResizeObserver(() => {
|
|
11642
11709
|
if (!isResizingRef.current) {
|
|
@@ -11648,13 +11715,13 @@ var Canvas = () => {
|
|
|
11648
11715
|
resizeObserver.disconnect();
|
|
11649
11716
|
};
|
|
11650
11717
|
}, [frameRef.current]);
|
|
11651
|
-
const [showLoader, setShowLoader] = (0,
|
|
11652
|
-
(0,
|
|
11718
|
+
const [showLoader, setShowLoader] = (0, import_react78.useState)(false);
|
|
11719
|
+
(0, import_react78.useEffect)(() => {
|
|
11653
11720
|
setTimeout(() => {
|
|
11654
11721
|
setShowLoader(true);
|
|
11655
11722
|
}, 500);
|
|
11656
11723
|
}, []);
|
|
11657
|
-
return /* @__PURE__ */ (0,
|
|
11724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
11658
11725
|
"div",
|
|
11659
11726
|
{
|
|
11660
11727
|
className: getClassName32({
|
|
@@ -11672,7 +11739,7 @@ var Canvas = () => {
|
|
|
11672
11739
|
}
|
|
11673
11740
|
},
|
|
11674
11741
|
children: [
|
|
11675
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
|
11742
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: getClassName32("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11676
11743
|
ViewportControls,
|
|
11677
11744
|
{
|
|
11678
11745
|
autoZoom: zoomConfig.autoZoom,
|
|
@@ -11701,8 +11768,8 @@ var Canvas = () => {
|
|
|
11701
11768
|
}
|
|
11702
11769
|
}
|
|
11703
11770
|
) }),
|
|
11704
|
-
/* @__PURE__ */ (0,
|
|
11705
|
-
/* @__PURE__ */ (0,
|
|
11771
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: getClassName32("inner"), ref: frameRef, children: [
|
|
11772
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11706
11773
|
"div",
|
|
11707
11774
|
{
|
|
11708
11775
|
className: getClassName32("root"),
|
|
@@ -11719,10 +11786,10 @@ var Canvas = () => {
|
|
|
11719
11786
|
setShowTransition(false);
|
|
11720
11787
|
isResizingRef.current = false;
|
|
11721
11788
|
},
|
|
11722
|
-
children: /* @__PURE__ */ (0,
|
|
11789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Preview2, {}) })
|
|
11723
11790
|
}
|
|
11724
11791
|
),
|
|
11725
|
-
/* @__PURE__ */ (0,
|
|
11792
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: getClassName32("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Loader, { size: 24 }) })
|
|
11726
11793
|
] })
|
|
11727
11794
|
]
|
|
11728
11795
|
}
|
|
@@ -11734,7 +11801,7 @@ init_default_viewports();
|
|
|
11734
11801
|
|
|
11735
11802
|
// lib/use-loaded-overrides.ts
|
|
11736
11803
|
init_react_import();
|
|
11737
|
-
var
|
|
11804
|
+
var import_react79 = require("react");
|
|
11738
11805
|
|
|
11739
11806
|
// lib/load-overrides.ts
|
|
11740
11807
|
init_react_import();
|
|
@@ -11776,26 +11843,26 @@ var useLoadedOverrides = ({
|
|
|
11776
11843
|
overrides,
|
|
11777
11844
|
plugins
|
|
11778
11845
|
}) => {
|
|
11779
|
-
return (0,
|
|
11846
|
+
return (0, import_react79.useMemo)(() => {
|
|
11780
11847
|
return loadOverrides({ overrides, plugins });
|
|
11781
11848
|
}, [plugins, overrides]);
|
|
11782
11849
|
};
|
|
11783
11850
|
|
|
11784
11851
|
// components/DefaultOverride/index.tsx
|
|
11785
11852
|
init_react_import();
|
|
11786
|
-
var
|
|
11787
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
|
11853
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11854
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, { children });
|
|
11788
11855
|
|
|
11789
11856
|
// lib/use-inject-css.ts
|
|
11790
11857
|
init_react_import();
|
|
11791
|
-
var
|
|
11858
|
+
var import_react80 = require("react");
|
|
11792
11859
|
var styles = ``;
|
|
11793
11860
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
11794
|
-
const [el, setEl] = (0,
|
|
11795
|
-
(0,
|
|
11861
|
+
const [el, setEl] = (0, import_react80.useState)();
|
|
11862
|
+
(0, import_react80.useEffect)(() => {
|
|
11796
11863
|
setEl(document.createElement("style"));
|
|
11797
11864
|
}, []);
|
|
11798
|
-
(0,
|
|
11865
|
+
(0, import_react80.useEffect)(() => {
|
|
11799
11866
|
var _a;
|
|
11800
11867
|
if (!el || typeof window === "undefined") {
|
|
11801
11868
|
return;
|
|
@@ -11815,12 +11882,12 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
|
11815
11882
|
|
|
11816
11883
|
// lib/use-preview-mode-hotkeys.ts
|
|
11817
11884
|
init_react_import();
|
|
11818
|
-
var
|
|
11885
|
+
var import_react81 = require("react");
|
|
11819
11886
|
init_use_hotkey();
|
|
11820
11887
|
init_store();
|
|
11821
11888
|
var usePreviewModeHotkeys = () => {
|
|
11822
11889
|
const appStore = useAppStoreApi();
|
|
11823
|
-
const toggleInteractive = (0,
|
|
11890
|
+
const toggleInteractive = (0, import_react81.useCallback)(() => {
|
|
11824
11891
|
const dispatch = appStore.getState().dispatch;
|
|
11825
11892
|
dispatch({
|
|
11826
11893
|
type: "setUi",
|
|
@@ -11835,7 +11902,7 @@ var usePreviewModeHotkeys = () => {
|
|
|
11835
11902
|
|
|
11836
11903
|
// lib/use-delete-hotkeys.ts
|
|
11837
11904
|
init_react_import();
|
|
11838
|
-
var
|
|
11905
|
+
var import_react82 = require("react");
|
|
11839
11906
|
init_use_hotkey();
|
|
11840
11907
|
init_store();
|
|
11841
11908
|
var isElementVisible = (element) => {
|
|
@@ -11872,7 +11939,7 @@ var shouldBlockDeleteHotkey = (e) => {
|
|
|
11872
11939
|
};
|
|
11873
11940
|
var useDeleteHotkeys = () => {
|
|
11874
11941
|
const appStore = useAppStoreApi();
|
|
11875
|
-
const deleteSelectedComponent = (0,
|
|
11942
|
+
const deleteSelectedComponent = (0, import_react82.useCallback)(
|
|
11876
11943
|
(e) => {
|
|
11877
11944
|
var _a;
|
|
11878
11945
|
if (shouldBlockDeleteHotkey(e)) {
|
|
@@ -11903,7 +11970,7 @@ init_use_hotkey();
|
|
|
11903
11970
|
|
|
11904
11971
|
// lib/use-puck.ts
|
|
11905
11972
|
init_react_import();
|
|
11906
|
-
var
|
|
11973
|
+
var import_react83 = require("react");
|
|
11907
11974
|
var import_zustand6 = require("zustand");
|
|
11908
11975
|
init_make_state_public();
|
|
11909
11976
|
init_get_item();
|
|
@@ -11938,9 +12005,12 @@ var generateUsePuck = (store) => {
|
|
|
11938
12005
|
return parentNode.data;
|
|
11939
12006
|
}
|
|
11940
12007
|
};
|
|
12008
|
+
storeData.__private = {
|
|
12009
|
+
appState: store.state
|
|
12010
|
+
};
|
|
11941
12011
|
return storeData;
|
|
11942
12012
|
};
|
|
11943
|
-
var UsePuckStoreContext = (0,
|
|
12013
|
+
var UsePuckStoreContext = (0, import_react83.createContext)(
|
|
11944
12014
|
null
|
|
11945
12015
|
);
|
|
11946
12016
|
var convertToPickedStore = (store) => {
|
|
@@ -11954,12 +12024,12 @@ var convertToPickedStore = (store) => {
|
|
|
11954
12024
|
};
|
|
11955
12025
|
};
|
|
11956
12026
|
var useRegisterUsePuckStore = (appStore) => {
|
|
11957
|
-
const [usePuckStore] = (0,
|
|
12027
|
+
const [usePuckStore] = (0, import_react83.useState)(
|
|
11958
12028
|
() => (0, import_zustand6.createStore)(
|
|
11959
12029
|
() => generateUsePuck(convertToPickedStore(appStore.getState()))
|
|
11960
12030
|
)
|
|
11961
12031
|
);
|
|
11962
|
-
(0,
|
|
12032
|
+
(0, import_react83.useEffect)(() => {
|
|
11963
12033
|
return appStore.subscribe(
|
|
11964
12034
|
(store) => convertToPickedStore(store),
|
|
11965
12035
|
(pickedStore) => {
|
|
@@ -11971,7 +12041,7 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
|
11971
12041
|
};
|
|
11972
12042
|
function createUsePuck() {
|
|
11973
12043
|
return function usePuck2(selector) {
|
|
11974
|
-
const usePuckApi = (0,
|
|
12044
|
+
const usePuckApi = (0, import_react83.useContext)(UsePuckStoreContext);
|
|
11975
12045
|
if (!usePuckApi) {
|
|
11976
12046
|
throw new Error("usePuck must be used inside <Puck>.");
|
|
11977
12047
|
}
|
|
@@ -11983,7 +12053,7 @@ function createUsePuck() {
|
|
|
11983
12053
|
};
|
|
11984
12054
|
}
|
|
11985
12055
|
function usePuck() {
|
|
11986
|
-
(0,
|
|
12056
|
+
(0, import_react83.useEffect)(() => {
|
|
11987
12057
|
console.warn(
|
|
11988
12058
|
"You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
|
|
11989
12059
|
);
|
|
@@ -11991,7 +12061,7 @@ function usePuck() {
|
|
|
11991
12061
|
return createUsePuck()((s) => s);
|
|
11992
12062
|
}
|
|
11993
12063
|
function useGetPuck() {
|
|
11994
|
-
const usePuckApi = (0,
|
|
12064
|
+
const usePuckApi = (0, import_react83.useContext)(UsePuckStoreContext);
|
|
11995
12065
|
if (!usePuckApi) {
|
|
11996
12066
|
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
11997
12067
|
}
|
|
@@ -12004,7 +12074,7 @@ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
|
12004
12074
|
|
|
12005
12075
|
// components/Puck/components/Header/index.tsx
|
|
12006
12076
|
init_react_import();
|
|
12007
|
-
var
|
|
12077
|
+
var import_react84 = require("react");
|
|
12008
12078
|
init_store();
|
|
12009
12079
|
init_lucide_react();
|
|
12010
12080
|
init_IconButton();
|
|
@@ -12021,7 +12091,7 @@ var styles_module_default26 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpe
|
|
|
12021
12091
|
|
|
12022
12092
|
// components/MenuBar/index.tsx
|
|
12023
12093
|
init_store();
|
|
12024
|
-
var
|
|
12094
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12025
12095
|
var getClassName33 = get_class_name_factory_default("MenuBar", styles_module_default26);
|
|
12026
12096
|
function MenuBar({
|
|
12027
12097
|
menuOpen = false,
|
|
@@ -12032,7 +12102,7 @@ function MenuBar({
|
|
|
12032
12102
|
const forward = useAppStore((s) => s.history.forward);
|
|
12033
12103
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
12034
12104
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
12035
|
-
return /* @__PURE__ */ (0,
|
|
12105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12036
12106
|
"div",
|
|
12037
12107
|
{
|
|
12038
12108
|
className: getClassName33({ menuOpen }),
|
|
@@ -12046,30 +12116,30 @@ function MenuBar({
|
|
|
12046
12116
|
setMenuOpen(false);
|
|
12047
12117
|
}
|
|
12048
12118
|
},
|
|
12049
|
-
children: /* @__PURE__ */ (0,
|
|
12050
|
-
/* @__PURE__ */ (0,
|
|
12051
|
-
/* @__PURE__ */ (0,
|
|
12119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName33("inner"), children: [
|
|
12120
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName33("history"), children: [
|
|
12121
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12052
12122
|
IconButton,
|
|
12053
12123
|
{
|
|
12054
12124
|
type: "button",
|
|
12055
12125
|
title: "undo",
|
|
12056
12126
|
disabled: !hasPast,
|
|
12057
12127
|
onClick: back,
|
|
12058
|
-
children: /* @__PURE__ */ (0,
|
|
12128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Undo2, { size: 21 })
|
|
12059
12129
|
}
|
|
12060
12130
|
),
|
|
12061
|
-
/* @__PURE__ */ (0,
|
|
12131
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12062
12132
|
IconButton,
|
|
12063
12133
|
{
|
|
12064
12134
|
type: "button",
|
|
12065
12135
|
title: "redo",
|
|
12066
12136
|
disabled: !hasFuture,
|
|
12067
12137
|
onClick: forward,
|
|
12068
|
-
children: /* @__PURE__ */ (0,
|
|
12138
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Redo2, { size: 21 })
|
|
12069
12139
|
}
|
|
12070
12140
|
)
|
|
12071
12141
|
] }),
|
|
12072
|
-
/* @__PURE__ */ (0,
|
|
12142
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
|
12073
12143
|
] })
|
|
12074
12144
|
}
|
|
12075
12145
|
);
|
|
@@ -12083,7 +12153,7 @@ init_react_import();
|
|
|
12083
12153
|
var styles_module_default27 = { "PuckHeader": "_PuckHeader_15xnq_1", "PuckHeader-inner": "_PuckHeader-inner_15xnq_10", "PuckHeader-toggle": "_PuckHeader-toggle_15xnq_20", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_15xnq_27", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_15xnq_27", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_15xnq_28", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_15xnq_28", "PuckHeader-title": "_PuckHeader-title_15xnq_32", "PuckHeader-path": "_PuckHeader-path_15xnq_36", "PuckHeader-tools": "_PuckHeader-tools_15xnq_43", "PuckHeader-menuButton": "_PuckHeader-menuButton_15xnq_49", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_15xnq_54" };
|
|
12084
12154
|
|
|
12085
12155
|
// components/Puck/components/Header/index.tsx
|
|
12086
|
-
var
|
|
12156
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12087
12157
|
var getClassName34 = get_class_name_factory_default("PuckHeader", styles_module_default27);
|
|
12088
12158
|
var HeaderInner = () => {
|
|
12089
12159
|
const {
|
|
@@ -12096,7 +12166,7 @@ var HeaderInner = () => {
|
|
|
12096
12166
|
} = usePropsContext();
|
|
12097
12167
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
12098
12168
|
const appStore = useAppStoreApi();
|
|
12099
|
-
const defaultHeaderRender = (0,
|
|
12169
|
+
const defaultHeaderRender = (0, import_react84.useMemo)(() => {
|
|
12100
12170
|
if (renderHeader) {
|
|
12101
12171
|
console.warn(
|
|
12102
12172
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -12105,13 +12175,13 @@ var HeaderInner = () => {
|
|
|
12105
12175
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
12106
12176
|
const Comp = renderHeader;
|
|
12107
12177
|
const appState = useAppStore((s) => s.state);
|
|
12108
|
-
return /* @__PURE__ */ (0,
|
|
12178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
12109
12179
|
};
|
|
12110
12180
|
return RenderHeader;
|
|
12111
12181
|
}
|
|
12112
12182
|
return DefaultOverride;
|
|
12113
12183
|
}, [renderHeader]);
|
|
12114
|
-
const defaultHeaderActionsRender = (0,
|
|
12184
|
+
const defaultHeaderActionsRender = (0, import_react84.useMemo)(() => {
|
|
12115
12185
|
if (renderHeaderActions) {
|
|
12116
12186
|
console.warn(
|
|
12117
12187
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
@@ -12119,7 +12189,7 @@ var HeaderInner = () => {
|
|
|
12119
12189
|
const RenderHeader = (props) => {
|
|
12120
12190
|
const Comp = renderHeaderActions;
|
|
12121
12191
|
const appState = useAppStore((s) => s.state);
|
|
12122
|
-
return /* @__PURE__ */ (0,
|
|
12192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
12123
12193
|
};
|
|
12124
12194
|
return RenderHeader;
|
|
12125
12195
|
}
|
|
@@ -12131,7 +12201,7 @@ var HeaderInner = () => {
|
|
|
12131
12201
|
const CustomHeaderActions = useAppStore(
|
|
12132
12202
|
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
12133
12203
|
);
|
|
12134
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
12204
|
+
const [menuOpen, setMenuOpen] = (0, import_react84.useState)(false);
|
|
12135
12205
|
const rootTitle = useAppStore((s) => {
|
|
12136
12206
|
var _a, _b;
|
|
12137
12207
|
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
@@ -12141,7 +12211,7 @@ var HeaderInner = () => {
|
|
|
12141
12211
|
const rightSideBarVisible = useAppStore(
|
|
12142
12212
|
(s) => s.state.ui.rightSideBarVisible
|
|
12143
12213
|
);
|
|
12144
|
-
const toggleSidebars = (0,
|
|
12214
|
+
const toggleSidebars = (0, import_react84.useCallback)(
|
|
12145
12215
|
(sidebar) => {
|
|
12146
12216
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
12147
12217
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -12155,27 +12225,27 @@ var HeaderInner = () => {
|
|
|
12155
12225
|
},
|
|
12156
12226
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
12157
12227
|
);
|
|
12158
|
-
return /* @__PURE__ */ (0,
|
|
12228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12159
12229
|
CustomHeader,
|
|
12160
12230
|
{
|
|
12161
|
-
actions: /* @__PURE__ */ (0,
|
|
12231
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12162
12232
|
Button,
|
|
12163
12233
|
{
|
|
12164
12234
|
onClick: () => {
|
|
12165
12235
|
const data = appStore.getState().state.data;
|
|
12166
12236
|
onPublish && onPublish(data);
|
|
12167
12237
|
},
|
|
12168
|
-
icon: /* @__PURE__ */ (0,
|
|
12238
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Globe, { size: "14px" }),
|
|
12169
12239
|
children: "Publish"
|
|
12170
12240
|
}
|
|
12171
12241
|
) }) }),
|
|
12172
|
-
children: /* @__PURE__ */ (0,
|
|
12242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12173
12243
|
"header",
|
|
12174
12244
|
{
|
|
12175
12245
|
className: getClassName34({ leftSideBarVisible, rightSideBarVisible }),
|
|
12176
|
-
children: /* @__PURE__ */ (0,
|
|
12177
|
-
/* @__PURE__ */ (0,
|
|
12178
|
-
/* @__PURE__ */ (0,
|
|
12246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getClassName34("inner"), children: [
|
|
12247
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getClassName34("toggle"), children: [
|
|
12248
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName34("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12179
12249
|
IconButton,
|
|
12180
12250
|
{
|
|
12181
12251
|
type: "button",
|
|
@@ -12183,10 +12253,10 @@ var HeaderInner = () => {
|
|
|
12183
12253
|
toggleSidebars("left");
|
|
12184
12254
|
},
|
|
12185
12255
|
title: "Toggle left sidebar",
|
|
12186
|
-
children: /* @__PURE__ */ (0,
|
|
12256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PanelLeft, { focusable: "false" })
|
|
12187
12257
|
}
|
|
12188
12258
|
) }),
|
|
12189
|
-
/* @__PURE__ */ (0,
|
|
12259
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName34("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12190
12260
|
IconButton,
|
|
12191
12261
|
{
|
|
12192
12262
|
type: "button",
|
|
@@ -12194,19 +12264,19 @@ var HeaderInner = () => {
|
|
|
12194
12264
|
toggleSidebars("right");
|
|
12195
12265
|
},
|
|
12196
12266
|
title: "Toggle right sidebar",
|
|
12197
|
-
children: /* @__PURE__ */ (0,
|
|
12267
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PanelRight, { focusable: "false" })
|
|
12198
12268
|
}
|
|
12199
12269
|
) })
|
|
12200
12270
|
] }),
|
|
12201
|
-
/* @__PURE__ */ (0,
|
|
12271
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName34("title"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Heading7, { rank: "2", size: "xs", children: [
|
|
12202
12272
|
headerTitle || rootTitle || "Page",
|
|
12203
|
-
headerPath && /* @__PURE__ */ (0,
|
|
12273
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
12204
12274
|
" ",
|
|
12205
|
-
/* @__PURE__ */ (0,
|
|
12275
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("code", { className: getClassName34("path"), children: headerPath })
|
|
12206
12276
|
] })
|
|
12207
12277
|
] }) }),
|
|
12208
|
-
/* @__PURE__ */ (0,
|
|
12209
|
-
/* @__PURE__ */ (0,
|
|
12278
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getClassName34("tools"), children: [
|
|
12279
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName34("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12210
12280
|
IconButton,
|
|
12211
12281
|
{
|
|
12212
12282
|
type: "button",
|
|
@@ -12214,23 +12284,23 @@ var HeaderInner = () => {
|
|
|
12214
12284
|
return setMenuOpen(!menuOpen);
|
|
12215
12285
|
},
|
|
12216
12286
|
title: "Toggle menu bar",
|
|
12217
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
|
12287
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChevronDown, { focusable: "false" })
|
|
12218
12288
|
}
|
|
12219
12289
|
) }),
|
|
12220
|
-
/* @__PURE__ */ (0,
|
|
12290
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12221
12291
|
MenuBar,
|
|
12222
12292
|
{
|
|
12223
12293
|
dispatch,
|
|
12224
12294
|
onPublish,
|
|
12225
12295
|
menuOpen,
|
|
12226
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
|
12296
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12227
12297
|
Button,
|
|
12228
12298
|
{
|
|
12229
12299
|
onClick: () => {
|
|
12230
12300
|
const data = appStore.getState().state.data;
|
|
12231
12301
|
onPublish && onPublish(data);
|
|
12232
12302
|
},
|
|
12233
|
-
icon: /* @__PURE__ */ (0,
|
|
12303
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Globe, { size: "14px" }),
|
|
12234
12304
|
children: "Publish"
|
|
12235
12305
|
}
|
|
12236
12306
|
) }),
|
|
@@ -12244,14 +12314,14 @@ var HeaderInner = () => {
|
|
|
12244
12314
|
}
|
|
12245
12315
|
);
|
|
12246
12316
|
};
|
|
12247
|
-
var Header = (0,
|
|
12317
|
+
var Header = (0, import_react84.memo)(HeaderInner);
|
|
12248
12318
|
|
|
12249
12319
|
// components/Puck/components/Sidebar/index.tsx
|
|
12250
12320
|
init_react_import();
|
|
12251
12321
|
|
|
12252
12322
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
12253
12323
|
init_react_import();
|
|
12254
|
-
var
|
|
12324
|
+
var import_react85 = require("react");
|
|
12255
12325
|
init_get_class_name_factory();
|
|
12256
12326
|
|
|
12257
12327
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
@@ -12260,7 +12330,7 @@ var styles_module_default28 = { "ResizeHandle": "_ResizeHandle_144bf_2", "Resize
|
|
|
12260
12330
|
|
|
12261
12331
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
12262
12332
|
init_lib();
|
|
12263
|
-
var
|
|
12333
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12264
12334
|
var getClassName35 = get_class_name_factory_default("ResizeHandle", styles_module_default28);
|
|
12265
12335
|
var ResizeHandle = ({
|
|
12266
12336
|
position,
|
|
@@ -12270,11 +12340,11 @@ var ResizeHandle = ({
|
|
|
12270
12340
|
}) => {
|
|
12271
12341
|
const { frameRef } = useCanvasFrame();
|
|
12272
12342
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
12273
|
-
const handleRef = (0,
|
|
12274
|
-
const isDragging = (0,
|
|
12275
|
-
const startX = (0,
|
|
12276
|
-
const startWidth = (0,
|
|
12277
|
-
const handleMouseMove = (0,
|
|
12343
|
+
const handleRef = (0, import_react85.useRef)(null);
|
|
12344
|
+
const isDragging = (0, import_react85.useRef)(false);
|
|
12345
|
+
const startX = (0, import_react85.useRef)(0);
|
|
12346
|
+
const startWidth = (0, import_react85.useRef)(0);
|
|
12347
|
+
const handleMouseMove = (0, import_react85.useCallback)(
|
|
12278
12348
|
(e) => {
|
|
12279
12349
|
if (!isDragging.current) return;
|
|
12280
12350
|
const delta = e.clientX - startX.current;
|
|
@@ -12285,7 +12355,7 @@ var ResizeHandle = ({
|
|
|
12285
12355
|
},
|
|
12286
12356
|
[onResize, position]
|
|
12287
12357
|
);
|
|
12288
|
-
const handleMouseUp = (0,
|
|
12358
|
+
const handleMouseUp = (0, import_react85.useCallback)(() => {
|
|
12289
12359
|
var _a;
|
|
12290
12360
|
if (!isDragging.current) return;
|
|
12291
12361
|
isDragging.current = false;
|
|
@@ -12301,7 +12371,7 @@ var ResizeHandle = ({
|
|
|
12301
12371
|
onResizeEnd(finalWidth);
|
|
12302
12372
|
resetAutoZoom();
|
|
12303
12373
|
}, [onResizeEnd]);
|
|
12304
|
-
const handleMouseDown = (0,
|
|
12374
|
+
const handleMouseDown = (0, import_react85.useCallback)(
|
|
12305
12375
|
(e) => {
|
|
12306
12376
|
var _a;
|
|
12307
12377
|
isDragging.current = true;
|
|
@@ -12319,7 +12389,7 @@ var ResizeHandle = ({
|
|
|
12319
12389
|
},
|
|
12320
12390
|
[position, handleMouseMove, handleMouseUp]
|
|
12321
12391
|
);
|
|
12322
|
-
return /* @__PURE__ */ (0,
|
|
12392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
12323
12393
|
"div",
|
|
12324
12394
|
{
|
|
12325
12395
|
ref: handleRef,
|
|
@@ -12337,7 +12407,7 @@ init_react_import();
|
|
|
12337
12407
|
var styles_module_default29 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
|
|
12338
12408
|
|
|
12339
12409
|
// components/Puck/components/Sidebar/index.tsx
|
|
12340
|
-
var
|
|
12410
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
12341
12411
|
var getClassName36 = get_class_name_factory_default("Sidebar", styles_module_default29);
|
|
12342
12412
|
var Sidebar = ({
|
|
12343
12413
|
position,
|
|
@@ -12348,9 +12418,9 @@ var Sidebar = ({
|
|
|
12348
12418
|
children
|
|
12349
12419
|
}) => {
|
|
12350
12420
|
if (!isVisible) return null;
|
|
12351
|
-
return /* @__PURE__ */ (0,
|
|
12352
|
-
/* @__PURE__ */ (0,
|
|
12353
|
-
/* @__PURE__ */ (0,
|
|
12421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
12422
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { ref: sidebarRef, className: getClassName36({ [position]: true }), children }),
|
|
12423
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `${getClassName36("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
12354
12424
|
ResizeHandle,
|
|
12355
12425
|
{
|
|
12356
12426
|
position,
|
|
@@ -12364,15 +12434,15 @@ var Sidebar = ({
|
|
|
12364
12434
|
|
|
12365
12435
|
// lib/use-sidebar-resize.ts
|
|
12366
12436
|
init_react_import();
|
|
12367
|
-
var
|
|
12437
|
+
var import_react86 = require("react");
|
|
12368
12438
|
init_store();
|
|
12369
12439
|
function useSidebarResize(position, dispatch) {
|
|
12370
|
-
const [width, setWidth] = (0,
|
|
12371
|
-
const sidebarRef = (0,
|
|
12440
|
+
const [width, setWidth] = (0, import_react86.useState)(null);
|
|
12441
|
+
const sidebarRef = (0, import_react86.useRef)(null);
|
|
12372
12442
|
const storeWidth = useAppStore(
|
|
12373
12443
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
12374
12444
|
);
|
|
12375
|
-
(0,
|
|
12445
|
+
(0, import_react86.useEffect)(() => {
|
|
12376
12446
|
if (typeof window !== "undefined" && !storeWidth) {
|
|
12377
12447
|
try {
|
|
12378
12448
|
const savedWidths = localStorage.getItem("puck-sidebar-widths");
|
|
@@ -12397,12 +12467,12 @@ function useSidebarResize(position, dispatch) {
|
|
|
12397
12467
|
}
|
|
12398
12468
|
}
|
|
12399
12469
|
}, [dispatch, position, storeWidth]);
|
|
12400
|
-
(0,
|
|
12470
|
+
(0, import_react86.useEffect)(() => {
|
|
12401
12471
|
if (storeWidth !== void 0) {
|
|
12402
12472
|
setWidth(storeWidth);
|
|
12403
12473
|
}
|
|
12404
12474
|
}, [storeWidth]);
|
|
12405
|
-
const handleResizeEnd = (0,
|
|
12475
|
+
const handleResizeEnd = (0, import_react86.useCallback)(
|
|
12406
12476
|
(width2) => {
|
|
12407
12477
|
dispatch({
|
|
12408
12478
|
type: "setUi",
|
|
@@ -12457,7 +12527,7 @@ var toComponent = (item) => {
|
|
|
12457
12527
|
};
|
|
12458
12528
|
|
|
12459
12529
|
// components/Puck/index.tsx
|
|
12460
|
-
var
|
|
12530
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
12461
12531
|
var getClassName37 = get_class_name_factory_default("Puck", styles_module_default19);
|
|
12462
12532
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default19);
|
|
12463
12533
|
var FieldSideBar = () => {
|
|
@@ -12467,13 +12537,13 @@ var FieldSideBar = () => {
|
|
|
12467
12537
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
|
|
12468
12538
|
}
|
|
12469
12539
|
);
|
|
12470
|
-
return /* @__PURE__ */ (0,
|
|
12540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Fields, {}) });
|
|
12471
12541
|
};
|
|
12472
|
-
var propsContext = (0,
|
|
12542
|
+
var propsContext = (0, import_react87.createContext)({});
|
|
12473
12543
|
function PropsProvider(props) {
|
|
12474
|
-
return /* @__PURE__ */ (0,
|
|
12544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
12475
12545
|
}
|
|
12476
|
-
var usePropsContext = () => (0,
|
|
12546
|
+
var usePropsContext = () => (0, import_react87.useContext)(propsContext);
|
|
12477
12547
|
function PuckProvider({ children }) {
|
|
12478
12548
|
const {
|
|
12479
12549
|
config,
|
|
@@ -12490,14 +12560,14 @@ function PuckProvider({ children }) {
|
|
|
12490
12560
|
onAction,
|
|
12491
12561
|
fieldTransforms
|
|
12492
12562
|
} = usePropsContext();
|
|
12493
|
-
const iframe = (0,
|
|
12563
|
+
const iframe = (0, import_react87.useMemo)(
|
|
12494
12564
|
() => __spreadValues({
|
|
12495
12565
|
enabled: true,
|
|
12496
12566
|
waitForStyles: true
|
|
12497
12567
|
}, _iframe),
|
|
12498
12568
|
[_iframe]
|
|
12499
12569
|
);
|
|
12500
|
-
const [generatedAppState] = (0,
|
|
12570
|
+
const [generatedAppState] = (0, import_react87.useState)(() => {
|
|
12501
12571
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12502
12572
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
12503
12573
|
let clientUiState = {};
|
|
@@ -12561,7 +12631,7 @@ function PuckProvider({ children }) {
|
|
|
12561
12631
|
return walkAppState(newAppState, config);
|
|
12562
12632
|
});
|
|
12563
12633
|
const { appendData = true } = _initialHistory || {};
|
|
12564
|
-
const [blendedHistories] = (0,
|
|
12634
|
+
const [blendedHistories] = (0, import_react87.useState)(
|
|
12565
12635
|
[
|
|
12566
12636
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
12567
12637
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -12575,7 +12645,7 @@ function PuckProvider({ children }) {
|
|
|
12575
12645
|
});
|
|
12576
12646
|
})
|
|
12577
12647
|
);
|
|
12578
|
-
const initialHistoryIndex = (0,
|
|
12648
|
+
const initialHistoryIndex = (0, import_react87.useMemo)(() => {
|
|
12579
12649
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
12580
12650
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
12581
12651
|
}
|
|
@@ -12586,7 +12656,7 @@ function PuckProvider({ children }) {
|
|
|
12586
12656
|
overrides,
|
|
12587
12657
|
plugins
|
|
12588
12658
|
});
|
|
12589
|
-
const loadedFieldTransforms = (0,
|
|
12659
|
+
const loadedFieldTransforms = (0, import_react87.useMemo)(() => {
|
|
12590
12660
|
const _plugins = plugins || [];
|
|
12591
12661
|
const pluginFieldTransforms = _plugins.reduce(
|
|
12592
12662
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -12594,7 +12664,7 @@ function PuckProvider({ children }) {
|
|
|
12594
12664
|
);
|
|
12595
12665
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
12596
12666
|
}, [fieldTransforms, plugins]);
|
|
12597
|
-
const generateAppStore = (0,
|
|
12667
|
+
const generateAppStore = (0, import_react87.useCallback)(
|
|
12598
12668
|
(state) => {
|
|
12599
12669
|
return {
|
|
12600
12670
|
state,
|
|
@@ -12620,15 +12690,15 @@ function PuckProvider({ children }) {
|
|
|
12620
12690
|
loadedFieldTransforms
|
|
12621
12691
|
]
|
|
12622
12692
|
);
|
|
12623
|
-
const [appStore] = (0,
|
|
12693
|
+
const [appStore] = (0, import_react87.useState)(
|
|
12624
12694
|
() => createAppStore(generateAppStore(initialAppState))
|
|
12625
12695
|
);
|
|
12626
|
-
(0,
|
|
12696
|
+
(0, import_react87.useEffect)(() => {
|
|
12627
12697
|
if (process.env.NODE_ENV !== "production") {
|
|
12628
12698
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
12629
12699
|
}
|
|
12630
12700
|
}, [appStore]);
|
|
12631
|
-
(0,
|
|
12701
|
+
(0, import_react87.useEffect)(() => {
|
|
12632
12702
|
const state = appStore.getState().state;
|
|
12633
12703
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
12634
12704
|
}, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
|
|
@@ -12637,8 +12707,8 @@ function PuckProvider({ children }) {
|
|
|
12637
12707
|
index: initialHistoryIndex,
|
|
12638
12708
|
initialAppState
|
|
12639
12709
|
});
|
|
12640
|
-
const previousData = (0,
|
|
12641
|
-
(0,
|
|
12710
|
+
const previousData = (0, import_react87.useRef)(null);
|
|
12711
|
+
(0, import_react87.useEffect)(() => {
|
|
12642
12712
|
return appStore.subscribe(
|
|
12643
12713
|
(s) => s.state.data,
|
|
12644
12714
|
(data) => {
|
|
@@ -12652,11 +12722,11 @@ function PuckProvider({ children }) {
|
|
|
12652
12722
|
}, [onChange]);
|
|
12653
12723
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
12654
12724
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
12655
|
-
(0,
|
|
12725
|
+
(0, import_react87.useEffect)(() => {
|
|
12656
12726
|
const { resolveAndCommitData } = appStore.getState();
|
|
12657
12727
|
resolveAndCommitData();
|
|
12658
12728
|
}, []);
|
|
12659
|
-
return /* @__PURE__ */ (0,
|
|
12729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
12660
12730
|
}
|
|
12661
12731
|
function PuckLayout({ children }) {
|
|
12662
12732
|
const {
|
|
@@ -12664,7 +12734,7 @@ function PuckLayout({ children }) {
|
|
|
12664
12734
|
dnd,
|
|
12665
12735
|
initialHistory: _initialHistory
|
|
12666
12736
|
} = usePropsContext();
|
|
12667
|
-
const iframe = (0,
|
|
12737
|
+
const iframe = (0, import_react87.useMemo)(
|
|
12668
12738
|
() => __spreadValues({
|
|
12669
12739
|
enabled: true,
|
|
12670
12740
|
waitForStyles: true
|
|
@@ -12689,7 +12759,7 @@ function PuckLayout({ children }) {
|
|
|
12689
12759
|
sidebarRef: rightSidebarRef,
|
|
12690
12760
|
handleResizeEnd: handleRightSidebarResizeEnd
|
|
12691
12761
|
} = useSidebarResize("right", dispatch);
|
|
12692
|
-
(0,
|
|
12762
|
+
(0, import_react87.useEffect)(() => {
|
|
12693
12763
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
12694
12764
|
dispatch({
|
|
12695
12765
|
type: "setUi",
|
|
@@ -12713,18 +12783,18 @@ function PuckLayout({ children }) {
|
|
|
12713
12783
|
};
|
|
12714
12784
|
}, []);
|
|
12715
12785
|
const overrides = useAppStore((s) => s.overrides);
|
|
12716
|
-
const CustomPuck = (0,
|
|
12786
|
+
const CustomPuck = (0, import_react87.useMemo)(
|
|
12717
12787
|
() => overrides.puck || DefaultOverride,
|
|
12718
12788
|
[overrides]
|
|
12719
12789
|
);
|
|
12720
|
-
const [mounted, setMounted] = (0,
|
|
12721
|
-
(0,
|
|
12790
|
+
const [mounted, setMounted] = (0, import_react87.useState)(false);
|
|
12791
|
+
(0, import_react87.useEffect)(() => {
|
|
12722
12792
|
setMounted(true);
|
|
12723
12793
|
}, []);
|
|
12724
12794
|
const ready = useAppStore((s) => s.status === "READY");
|
|
12725
12795
|
useMonitorHotkeys();
|
|
12726
12796
|
useDeleteHotkeys();
|
|
12727
|
-
(0,
|
|
12797
|
+
(0, import_react87.useEffect)(() => {
|
|
12728
12798
|
if (ready && iframe.enabled) {
|
|
12729
12799
|
const frameDoc = getFrame();
|
|
12730
12800
|
if (frameDoc) {
|
|
@@ -12740,8 +12810,8 @@ function PuckLayout({ children }) {
|
|
|
12740
12810
|
if (rightWidth) {
|
|
12741
12811
|
layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
12742
12812
|
}
|
|
12743
|
-
return /* @__PURE__ */ (0,
|
|
12744
|
-
/* @__PURE__ */ (0,
|
|
12813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `Puck ${getClassName37()}`, children: [
|
|
12814
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12745
12815
|
"div",
|
|
12746
12816
|
{
|
|
12747
12817
|
className: getLayoutClassName({
|
|
@@ -12749,14 +12819,14 @@ function PuckLayout({ children }) {
|
|
|
12749
12819
|
mounted,
|
|
12750
12820
|
rightSideBarVisible
|
|
12751
12821
|
}),
|
|
12752
|
-
children: /* @__PURE__ */ (0,
|
|
12822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
12753
12823
|
"div",
|
|
12754
12824
|
{
|
|
12755
12825
|
className: getLayoutClassName("inner"),
|
|
12756
12826
|
style: layoutOptions,
|
|
12757
12827
|
children: [
|
|
12758
|
-
/* @__PURE__ */ (0,
|
|
12759
|
-
/* @__PURE__ */ (0,
|
|
12828
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Header, {}),
|
|
12829
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
12760
12830
|
Sidebar,
|
|
12761
12831
|
{
|
|
12762
12832
|
position: "left",
|
|
@@ -12765,13 +12835,13 @@ function PuckLayout({ children }) {
|
|
|
12765
12835
|
onResize: setLeftWidth,
|
|
12766
12836
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
12767
12837
|
children: [
|
|
12768
|
-
/* @__PURE__ */ (0,
|
|
12769
|
-
/* @__PURE__ */ (0,
|
|
12838
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Components, {}) }),
|
|
12839
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Outline, {}) })
|
|
12770
12840
|
]
|
|
12771
12841
|
}
|
|
12772
12842
|
),
|
|
12773
|
-
/* @__PURE__ */ (0,
|
|
12774
|
-
/* @__PURE__ */ (0,
|
|
12843
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Canvas, {}),
|
|
12844
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12775
12845
|
Sidebar,
|
|
12776
12846
|
{
|
|
12777
12847
|
position: "right",
|
|
@@ -12779,7 +12849,7 @@ function PuckLayout({ children }) {
|
|
|
12779
12849
|
isVisible: rightSideBarVisible,
|
|
12780
12850
|
onResize: setRightWidth,
|
|
12781
12851
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
12782
|
-
children: /* @__PURE__ */ (0,
|
|
12852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(FieldSideBar, {})
|
|
12783
12853
|
}
|
|
12784
12854
|
)
|
|
12785
12855
|
]
|
|
@@ -12787,11 +12857,11 @@ function PuckLayout({ children }) {
|
|
|
12787
12857
|
)
|
|
12788
12858
|
}
|
|
12789
12859
|
) }) }) }),
|
|
12790
|
-
/* @__PURE__ */ (0,
|
|
12860
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { id: "puck-portal-root", className: getClassName37("portal") })
|
|
12791
12861
|
] });
|
|
12792
12862
|
}
|
|
12793
12863
|
function Puck(props) {
|
|
12794
|
-
return /* @__PURE__ */ (0,
|
|
12864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
|
|
12795
12865
|
}
|
|
12796
12866
|
Puck.Components = Components;
|
|
12797
12867
|
Puck.Fields = Fields;
|