@puckeditor/core 0.21.2-canary.edc81920 → 0.21.2
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-JHS34JLP.mjs → Editor-EPSED64A.mjs} +6 -6
- package/dist/{actions-BRYM0ifH.d.mts → actions-C3e2nJ9v.d.mts} +1 -1
- package/dist/{actions-BRYM0ifH.d.ts → actions-C3e2nJ9v.d.ts} +1 -1
- package/dist/{chunk-AFOEZCNE.mjs → chunk-22UJFAFA.mjs} +35 -37
- package/dist/{chunk-JGZBBNEW.mjs → chunk-BCL7VBTL.mjs} +1 -1
- package/dist/{chunk-46RDHJGL.mjs → chunk-G74MZKKD.mjs} +7 -7
- package/dist/{chunk-BSAENBPL.mjs → chunk-K23YHISE.mjs} +1 -1
- package/dist/{chunk-LBGOSTI5.mjs → chunk-PK2F2YZX.mjs} +1128 -633
- package/dist/{chunk-TVE6QYBR.mjs → chunk-U6THAD4G.mjs} +1 -1
- package/dist/{chunk-GYDP2UKB.mjs → chunk-WCC2G7U7.mjs} +3 -3
- package/dist/{full-ATSD2DNB.mjs → full-N67EAB2Q.mjs} +5 -5
- package/dist/{index-D_Idfrfb.d.ts → index-Cx46WIFC.d.ts} +9 -10
- package/dist/{index-BVLGipsj.d.mts → index-zHrchQGY.d.mts} +9 -10
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1192 -717
- package/dist/index.mjs +7 -7
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-BKAMJ2FS.mjs → loaded-F37CNCVG.mjs} +2 -2
- package/dist/{loaded-2765LE3N.mjs → loaded-H325ZSK5.mjs} +2 -2
- package/dist/{loaded-ANEJLSYJ.mjs → loaded-MIY725CK.mjs} +2 -2
- package/dist/no-external.d.mts +3 -3
- package/dist/no-external.d.ts +3 -3
- package/dist/no-external.js +1192 -717
- package/dist/no-external.mjs +7 -7
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +42 -24
- package/dist/rsc.mjs +42 -24
- package/dist/{walk-tree-C1Zdgx7d.d.mts → walk-tree-BJoNgZ0l.d.mts} +1 -1
- package/dist/{walk-tree-DQyC1GA7.d.ts → walk-tree-f8Yzs5o3.d.ts} +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2807,44 +2807,39 @@ var init_nodes = __esm({
|
|
|
2807
2807
|
"store/slices/nodes.ts"() {
|
|
2808
2808
|
"use strict";
|
|
2809
2809
|
init_react_import();
|
|
2810
|
-
createNodesSlice = (
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
})
|
|
2830
|
-
})
|
|
2831
|
-
})
|
|
2832
|
-
});
|
|
2833
|
-
},
|
|
2834
|
-
unregisterNode: (id) => {
|
|
2835
|
-
const s = get().nodes;
|
|
2836
|
-
const existingNode = s.nodes[id];
|
|
2837
|
-
if (existingNode) {
|
|
2838
|
-
const newNodes = __spreadValues({}, s.nodes);
|
|
2839
|
-
delete newNodes[id];
|
|
2840
|
-
set({
|
|
2841
|
-
nodes: __spreadProps(__spreadValues({}, s), {
|
|
2842
|
-
nodes: newNodes
|
|
2843
|
-
})
|
|
2810
|
+
createNodesSlice = (_set, _get) => {
|
|
2811
|
+
const registry = /* @__PURE__ */ new Map();
|
|
2812
|
+
return {
|
|
2813
|
+
registerNode: (id, handle) => {
|
|
2814
|
+
registry.set(id, handle);
|
|
2815
|
+
},
|
|
2816
|
+
unregisterNode: (id) => {
|
|
2817
|
+
registry.delete(id);
|
|
2818
|
+
},
|
|
2819
|
+
syncNode: (id) => {
|
|
2820
|
+
var _a;
|
|
2821
|
+
if (!id) return;
|
|
2822
|
+
(_a = registry.get(id)) == null ? void 0 : _a.sync();
|
|
2823
|
+
},
|
|
2824
|
+
syncNodes: (ids) => {
|
|
2825
|
+
ids.forEach((id) => {
|
|
2826
|
+
var _a;
|
|
2827
|
+
if (!id) return;
|
|
2828
|
+
(_a = registry.get(id)) == null ? void 0 : _a.sync();
|
|
2844
2829
|
});
|
|
2830
|
+
},
|
|
2831
|
+
setOverlayVisible: (id, visible) => {
|
|
2832
|
+
if (!id) return;
|
|
2833
|
+
const node = registry.get(id);
|
|
2834
|
+
if (!node) return;
|
|
2835
|
+
if (visible) {
|
|
2836
|
+
node.showOverlay();
|
|
2837
|
+
return;
|
|
2838
|
+
}
|
|
2839
|
+
node.hideOverlay();
|
|
2845
2840
|
}
|
|
2846
|
-
}
|
|
2847
|
-
}
|
|
2841
|
+
};
|
|
2842
|
+
};
|
|
2848
2843
|
}
|
|
2849
2844
|
});
|
|
2850
2845
|
|
|
@@ -3327,6 +3322,8 @@ var init_store = __esm({
|
|
|
3327
3322
|
},
|
|
3328
3323
|
status: "LOADING",
|
|
3329
3324
|
iframe: {},
|
|
3325
|
+
_experimentalFullScreenCanvas: false,
|
|
3326
|
+
_experimentalVirtualization: false,
|
|
3330
3327
|
metadata: {},
|
|
3331
3328
|
fieldTransforms: {}
|
|
3332
3329
|
}, initialAppStore), {
|
|
@@ -3462,7 +3459,8 @@ var init_store = __esm({
|
|
|
3462
3459
|
state,
|
|
3463
3460
|
config,
|
|
3464
3461
|
(content) => content,
|
|
3465
|
-
(childItem) => {
|
|
3462
|
+
(childItem, path) => {
|
|
3463
|
+
if (path.length > 1) return childItem;
|
|
3466
3464
|
resolveComponentData2(childItem, "load").then((resolved) => {
|
|
3467
3465
|
const { state: state2 } = get();
|
|
3468
3466
|
const node = state2.indexes.nodes[resolved.node.props.id];
|
|
@@ -6773,10 +6771,13 @@ var useLocalValue = (path, onChange) => {
|
|
|
6773
6771
|
const value = useDeepField(path);
|
|
6774
6772
|
const isFocused = useIsFocused(path);
|
|
6775
6773
|
const [localValue, setLocalValue] = (0, import_react18.useState)(value == null ? void 0 : value.toString());
|
|
6776
|
-
const onChangeLocal = (0, import_react18.useCallback)(
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6774
|
+
const onChangeLocal = (0, import_react18.useCallback)(
|
|
6775
|
+
(val) => {
|
|
6776
|
+
setLocalValue(val);
|
|
6777
|
+
onChange(val);
|
|
6778
|
+
},
|
|
6779
|
+
[onChange]
|
|
6780
|
+
);
|
|
6780
6781
|
(0, import_react18.useEffect)(() => {
|
|
6781
6782
|
if (!isFocused) {
|
|
6782
6783
|
setLocalValue(value);
|
|
@@ -7867,19 +7868,19 @@ var styles_module_default14 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable":
|
|
|
7867
7868
|
|
|
7868
7869
|
// components/Drawer/index.tsx
|
|
7869
7870
|
init_get_class_name_factory();
|
|
7870
|
-
var
|
|
7871
|
+
var import_react71 = require("react");
|
|
7871
7872
|
init_generate_id();
|
|
7872
7873
|
|
|
7873
7874
|
// components/DragDropContext/index.tsx
|
|
7874
7875
|
init_react_import();
|
|
7875
|
-
var
|
|
7876
|
+
var import_react69 = require("@dnd-kit/react");
|
|
7876
7877
|
init_store();
|
|
7877
|
-
var
|
|
7878
|
+
var import_react70 = require("react");
|
|
7878
7879
|
var import_dom = require("@dnd-kit/dom");
|
|
7879
7880
|
|
|
7880
7881
|
// components/DropZone/index.tsx
|
|
7881
7882
|
init_react_import();
|
|
7882
|
-
var
|
|
7883
|
+
var import_react67 = require("react");
|
|
7883
7884
|
|
|
7884
7885
|
// components/DraggableComponent/index.tsx
|
|
7885
7886
|
init_react_import();
|
|
@@ -7932,7 +7933,12 @@ var ZoneStoreContext = (0, import_react49.createContext)(
|
|
|
7932
7933
|
draggedItem: null,
|
|
7933
7934
|
previewIndex: {},
|
|
7934
7935
|
enabledIndex: {},
|
|
7935
|
-
hoveringComponent: null
|
|
7936
|
+
hoveringComponent: null,
|
|
7937
|
+
registerRootVirtualizer: () => {
|
|
7938
|
+
},
|
|
7939
|
+
unregisterRootVirtualizer: () => {
|
|
7940
|
+
},
|
|
7941
|
+
scrollToComponent: () => false
|
|
7936
7942
|
}))
|
|
7937
7943
|
);
|
|
7938
7944
|
var ZoneStoreProvider = ({
|
|
@@ -7969,21 +7975,6 @@ var import_shallow4 = require("zustand/react/shallow");
|
|
|
7969
7975
|
init_get_item();
|
|
7970
7976
|
var import_sortable2 = require("@dnd-kit/react/sortable");
|
|
7971
7977
|
|
|
7972
|
-
// lib/accumulate-transform.ts
|
|
7973
|
-
init_react_import();
|
|
7974
|
-
function accumulateTransform(el) {
|
|
7975
|
-
let matrix = new DOMMatrixReadOnly();
|
|
7976
|
-
let n = el.parentElement;
|
|
7977
|
-
while (n && n !== document.documentElement) {
|
|
7978
|
-
const t = getComputedStyle(n).transform;
|
|
7979
|
-
if (t && t !== "none") {
|
|
7980
|
-
matrix = new DOMMatrixReadOnly(t).multiply(matrix);
|
|
7981
|
-
}
|
|
7982
|
-
n = n.parentElement;
|
|
7983
|
-
}
|
|
7984
|
-
return { scaleX: matrix.a, scaleY: matrix.d };
|
|
7985
|
-
}
|
|
7986
|
-
|
|
7987
7978
|
// lib/dnd/use-on-drag-finished.ts
|
|
7988
7979
|
init_react_import();
|
|
7989
7980
|
var import_react50 = require("react");
|
|
@@ -8019,9 +8010,27 @@ var useOnDragFinished = (cb, deps = []) => {
|
|
|
8019
8010
|
|
|
8020
8011
|
// components/DraggableComponent/index.tsx
|
|
8021
8012
|
init_RichTextMenu();
|
|
8013
|
+
|
|
8014
|
+
// lib/assign-refs.ts
|
|
8015
|
+
init_react_import();
|
|
8016
|
+
function assignRef(ref, node) {
|
|
8017
|
+
if (typeof ref === "function") {
|
|
8018
|
+
ref(node);
|
|
8019
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
8020
|
+
ref.current = node;
|
|
8021
|
+
}
|
|
8022
|
+
}
|
|
8023
|
+
function assignRefs(refs, node) {
|
|
8024
|
+
refs.forEach((ref) => {
|
|
8025
|
+
assignRef(ref, node);
|
|
8026
|
+
});
|
|
8027
|
+
}
|
|
8028
|
+
|
|
8029
|
+
// components/DraggableComponent/index.tsx
|
|
8022
8030
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
8023
8031
|
var getClassName21 = get_class_name_factory_default("DraggableComponent", styles_module_default15);
|
|
8024
8032
|
var DEBUG2 = false;
|
|
8033
|
+
var MEASURE_EVERY_MS = 100;
|
|
8025
8034
|
var space = 8;
|
|
8026
8035
|
var actionsOverlayTop = space * 6.5;
|
|
8027
8036
|
var actionsTop = -(actionsOverlayTop - 8);
|
|
@@ -8053,7 +8062,8 @@ var DraggableComponent = ({
|
|
|
8053
8062
|
label,
|
|
8054
8063
|
autoDragAxis,
|
|
8055
8064
|
userDragAxis,
|
|
8056
|
-
inDroppableZone = true
|
|
8065
|
+
inDroppableZone = true,
|
|
8066
|
+
itemRef
|
|
8057
8067
|
}) => {
|
|
8058
8068
|
const zoom = useAppStore(
|
|
8059
8069
|
(s) => {
|
|
@@ -8061,9 +8071,13 @@ var DraggableComponent = ({
|
|
|
8061
8071
|
return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) === id ? s.zoomConfig.zoom : 1;
|
|
8062
8072
|
}
|
|
8063
8073
|
);
|
|
8074
|
+
const _experimentalFullScreenCanvas = useAppStore(
|
|
8075
|
+
(s) => s._experimentalFullScreenCanvas
|
|
8076
|
+
);
|
|
8064
8077
|
const overrides = useAppStore((s) => s.overrides);
|
|
8065
8078
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
8066
8079
|
const iframe = useAppStore((s) => s.iframe);
|
|
8080
|
+
const lastMeasureRef = (0, import_react51.useRef)(0);
|
|
8067
8081
|
const ctx = (0, import_react51.useContext)(dropZoneContext);
|
|
8068
8082
|
const [localZones, setLocalZones] = (0, import_react51.useState)({});
|
|
8069
8083
|
const registerLocalZone = (0, import_react51.useCallback)(
|
|
@@ -8158,9 +8172,12 @@ var DraggableComponent = ({
|
|
|
8158
8172
|
if (ref.current !== el) {
|
|
8159
8173
|
ref.current = el;
|
|
8160
8174
|
setRerender((update) => update + 1);
|
|
8175
|
+
if (itemRef) {
|
|
8176
|
+
assignRefs([itemRef], el);
|
|
8177
|
+
}
|
|
8161
8178
|
}
|
|
8162
8179
|
},
|
|
8163
|
-
[sortableRef]
|
|
8180
|
+
[itemRef, sortableRef]
|
|
8164
8181
|
);
|
|
8165
8182
|
const [portalEl, setPortalEl] = (0, import_react51.useState)();
|
|
8166
8183
|
(0, import_react51.useEffect)(() => {
|
|
@@ -8168,69 +8185,98 @@ var DraggableComponent = ({
|
|
|
8168
8185
|
setPortalEl(
|
|
8169
8186
|
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
|
|
8170
8187
|
);
|
|
8171
|
-
}, [iframe.enabled
|
|
8188
|
+
}, [iframe.enabled]);
|
|
8172
8189
|
const getStyle = (0, import_react51.useCallback)(() => {
|
|
8173
|
-
var _a, _b
|
|
8190
|
+
var _a, _b;
|
|
8174
8191
|
if (!ref.current) return;
|
|
8175
|
-
const
|
|
8176
|
-
const
|
|
8177
|
-
const portalContainerEl = iframe.enabled ? null :
|
|
8192
|
+
const el = ref.current;
|
|
8193
|
+
const rect = el.getBoundingClientRect();
|
|
8194
|
+
const portalContainerEl = iframe.enabled ? null : el.closest("[data-puck-preview]");
|
|
8195
|
+
const targetIsFixed = (() => {
|
|
8196
|
+
let node = el;
|
|
8197
|
+
while (node && node !== document.documentElement) {
|
|
8198
|
+
if (getComputedStyle(node).position === "fixed") {
|
|
8199
|
+
return true;
|
|
8200
|
+
}
|
|
8201
|
+
node = node.parentElement;
|
|
8202
|
+
}
|
|
8203
|
+
return false;
|
|
8204
|
+
})();
|
|
8178
8205
|
const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
|
|
8179
8206
|
const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
|
|
8180
|
-
const
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
const untransformed = {
|
|
8185
|
-
height: ref.current.offsetHeight,
|
|
8186
|
-
width: ref.current.offsetWidth
|
|
8207
|
+
const deepScrollPosition = targetIsFixed ? { x: 0, y: 0 } : getDeepScrollPosition(el);
|
|
8208
|
+
const scroll = targetIsFixed ? { x: 0, y: 0 } : {
|
|
8209
|
+
x: deepScrollPosition.x - portalScroll.x - ((_a = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _a : 0),
|
|
8210
|
+
y: deepScrollPosition.y - portalScroll.y - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _b : 0)
|
|
8187
8211
|
};
|
|
8188
|
-
const transform = accumulateTransform(ref.current);
|
|
8189
8212
|
const style2 = {
|
|
8190
|
-
left: `${
|
|
8191
|
-
top: `${
|
|
8192
|
-
height: `${
|
|
8193
|
-
width: `${
|
|
8213
|
+
left: `${rect.left + scroll.x}px`,
|
|
8214
|
+
top: `${rect.top + scroll.y}px`,
|
|
8215
|
+
height: `${rect.height}px`,
|
|
8216
|
+
width: `${rect.width}px`,
|
|
8217
|
+
position: targetIsFixed ? "fixed" : void 0
|
|
8194
8218
|
};
|
|
8195
8219
|
return style2;
|
|
8196
|
-
}, [
|
|
8220
|
+
}, [iframe.enabled]);
|
|
8197
8221
|
const [style, setStyle] = (0, import_react51.useState)();
|
|
8222
|
+
const lastRectRef = (0, import_react51.useRef)(null);
|
|
8223
|
+
const syncRafRef = (0, import_react51.useRef)(null);
|
|
8198
8224
|
const sync = (0, import_react51.useCallback)(() => {
|
|
8199
8225
|
setStyle(getStyle());
|
|
8200
|
-
|
|
8226
|
+
if (itemRef) {
|
|
8227
|
+
assignRefs([itemRef], ref.current);
|
|
8228
|
+
}
|
|
8229
|
+
}, [getStyle, itemRef]);
|
|
8230
|
+
const scheduleSync = (0, import_react51.useCallback)(() => {
|
|
8231
|
+
if (syncRafRef.current != null) return;
|
|
8232
|
+
syncRafRef.current = requestAnimationFrame(() => {
|
|
8233
|
+
syncRafRef.current = null;
|
|
8234
|
+
sync();
|
|
8235
|
+
});
|
|
8236
|
+
}, [sync]);
|
|
8237
|
+
(0, import_react51.useEffect)(() => {
|
|
8238
|
+
return () => {
|
|
8239
|
+
if (syncRafRef.current != null) {
|
|
8240
|
+
cancelAnimationFrame(syncRafRef.current);
|
|
8241
|
+
syncRafRef.current = null;
|
|
8242
|
+
}
|
|
8243
|
+
};
|
|
8244
|
+
}, []);
|
|
8201
8245
|
(0, import_react51.useEffect)(() => {
|
|
8202
8246
|
if (ref.current) {
|
|
8203
|
-
const observer = new ResizeObserver(
|
|
8247
|
+
const observer = new ResizeObserver(() => {
|
|
8248
|
+
scheduleSync();
|
|
8249
|
+
});
|
|
8204
8250
|
observer.observe(ref.current);
|
|
8205
8251
|
return () => {
|
|
8206
8252
|
observer.disconnect();
|
|
8207
8253
|
};
|
|
8208
8254
|
}
|
|
8209
|
-
}, [
|
|
8255
|
+
}, [scheduleSync, itemRef]);
|
|
8210
8256
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
|
8257
|
+
const unregisterNode = useAppStore((s) => s.nodes.unregisterNode);
|
|
8211
8258
|
const hideOverlay = (0, import_react51.useCallback)(() => {
|
|
8212
8259
|
setIsVisible(false);
|
|
8213
8260
|
}, []);
|
|
8214
8261
|
const showOverlay = (0, import_react51.useCallback)(() => {
|
|
8215
8262
|
setIsVisible(true);
|
|
8216
8263
|
}, []);
|
|
8264
|
+
const nodeHandleRef = (0, import_react51.useRef)({
|
|
8265
|
+
sync: () => null,
|
|
8266
|
+
hideOverlay: () => null,
|
|
8267
|
+
showOverlay: () => null
|
|
8268
|
+
});
|
|
8269
|
+
(0, import_react51.useLayoutEffect)(() => {
|
|
8270
|
+
nodeHandleRef.current.sync = sync;
|
|
8271
|
+
nodeHandleRef.current.hideOverlay = hideOverlay;
|
|
8272
|
+
nodeHandleRef.current.showOverlay = showOverlay;
|
|
8273
|
+
}, [hideOverlay, showOverlay, sync]);
|
|
8217
8274
|
(0, import_react51.useEffect)(() => {
|
|
8218
|
-
|
|
8219
|
-
registerNode(id, {
|
|
8220
|
-
methods: { sync, showOverlay, hideOverlay },
|
|
8221
|
-
element: (_a = ref.current) != null ? _a : null
|
|
8222
|
-
});
|
|
8275
|
+
registerNode(id, nodeHandleRef.current);
|
|
8223
8276
|
return () => {
|
|
8224
|
-
|
|
8225
|
-
methods: {
|
|
8226
|
-
sync: () => null,
|
|
8227
|
-
hideOverlay: () => null,
|
|
8228
|
-
showOverlay: () => null
|
|
8229
|
-
},
|
|
8230
|
-
element: null
|
|
8231
|
-
});
|
|
8277
|
+
unregisterNode(id);
|
|
8232
8278
|
};
|
|
8233
|
-
}, [id,
|
|
8279
|
+
}, [id, registerNode, unregisterNode]);
|
|
8234
8280
|
const CustomActionBar = (0, import_react51.useMemo)(
|
|
8235
8281
|
() => overrides.actionBar || DefaultActionBar,
|
|
8236
8282
|
[overrides.actionBar]
|
|
@@ -8245,11 +8291,11 @@ var DraggableComponent = ({
|
|
|
8245
8291
|
if (!el.closest("[data-puck-overlay-portal]")) {
|
|
8246
8292
|
e.stopPropagation();
|
|
8247
8293
|
}
|
|
8248
|
-
if (
|
|
8294
|
+
if (_experimentalFullScreenCanvas) {
|
|
8249
8295
|
dispatch({
|
|
8250
8296
|
type: "setUi",
|
|
8251
8297
|
ui: {
|
|
8252
|
-
itemSelector: null
|
|
8298
|
+
itemSelector: isSelected ? null : { index, zone: zoneCompound }
|
|
8253
8299
|
}
|
|
8254
8300
|
});
|
|
8255
8301
|
} else {
|
|
@@ -8261,7 +8307,7 @@ var DraggableComponent = ({
|
|
|
8261
8307
|
});
|
|
8262
8308
|
}
|
|
8263
8309
|
},
|
|
8264
|
-
[index, zoneCompound, id, isSelected]
|
|
8310
|
+
[index, zoneCompound, id, isSelected, _experimentalFullScreenCanvas]
|
|
8265
8311
|
);
|
|
8266
8312
|
const appStore = useAppStoreApi();
|
|
8267
8313
|
const onSelectParent = (0, import_react51.useCallback)(() => {
|
|
@@ -8355,7 +8401,7 @@ var DraggableComponent = ({
|
|
|
8355
8401
|
(0, import_react51.useEffect)(() => {
|
|
8356
8402
|
startTransition(() => {
|
|
8357
8403
|
if (hover || indicativeHover || isSelected) {
|
|
8358
|
-
|
|
8404
|
+
scheduleSync();
|
|
8359
8405
|
setIsVisible(true);
|
|
8360
8406
|
setThisWasDragging(false);
|
|
8361
8407
|
} else {
|
|
@@ -8382,6 +8428,43 @@ var DraggableComponent = ({
|
|
|
8382
8428
|
(0, import_react51.useEffect)(() => {
|
|
8383
8429
|
if (thisWasDragging) return onDragFinished();
|
|
8384
8430
|
}, [thisWasDragging, onDragFinished]);
|
|
8431
|
+
(0, import_react51.useEffect)(() => {
|
|
8432
|
+
if (!dragFinished || !(isSelected || thisIsDragging)) return;
|
|
8433
|
+
const el = ref.current;
|
|
8434
|
+
if (!el) return;
|
|
8435
|
+
const doc = el.ownerDocument;
|
|
8436
|
+
const view = doc.defaultView;
|
|
8437
|
+
if (!view) return;
|
|
8438
|
+
lastMeasureRef.current = 0;
|
|
8439
|
+
scheduleSync();
|
|
8440
|
+
const onScroll = () => scheduleSync();
|
|
8441
|
+
const onResize = () => scheduleSync();
|
|
8442
|
+
doc.addEventListener("scroll", onScroll, true);
|
|
8443
|
+
view.addEventListener("resize", onResize);
|
|
8444
|
+
let frame = 0;
|
|
8445
|
+
const tick = (t) => {
|
|
8446
|
+
if (t - lastMeasureRef.current >= MEASURE_EVERY_MS) {
|
|
8447
|
+
lastMeasureRef.current = t;
|
|
8448
|
+
const node = ref.current;
|
|
8449
|
+
if (node) {
|
|
8450
|
+
const rect = node.getBoundingClientRect();
|
|
8451
|
+
const prev = lastRectRef.current;
|
|
8452
|
+
const changed = !prev || Math.abs(rect.x - prev.x) > 0.5 || Math.abs(rect.y - prev.y) > 0.5 || Math.abs(rect.width - prev.width) > 0.5 || Math.abs(rect.height - prev.height) > 0.5;
|
|
8453
|
+
if (changed) {
|
|
8454
|
+
lastRectRef.current = rect;
|
|
8455
|
+
scheduleSync();
|
|
8456
|
+
}
|
|
8457
|
+
}
|
|
8458
|
+
}
|
|
8459
|
+
frame = requestAnimationFrame(tick);
|
|
8460
|
+
};
|
|
8461
|
+
frame = requestAnimationFrame(tick);
|
|
8462
|
+
return () => {
|
|
8463
|
+
doc.removeEventListener("scroll", onScroll, true);
|
|
8464
|
+
view.removeEventListener("resize", onResize);
|
|
8465
|
+
cancelAnimationFrame(frame);
|
|
8466
|
+
};
|
|
8467
|
+
}, [dragFinished, isSelected, thisIsDragging, scheduleSync]);
|
|
8385
8468
|
const syncActionsPosition = (0, import_react51.useCallback)(
|
|
8386
8469
|
(el) => {
|
|
8387
8470
|
if (el) {
|
|
@@ -8542,7 +8625,7 @@ var styles_module_default16 = { "DropZone": "_DropZone_1i2sv_1", "DropZone--hasC
|
|
|
8542
8625
|
|
|
8543
8626
|
// components/DropZone/index.tsx
|
|
8544
8627
|
init_store();
|
|
8545
|
-
var
|
|
8628
|
+
var import_react68 = require("@dnd-kit/react");
|
|
8546
8629
|
|
|
8547
8630
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
8548
8631
|
init_react_import();
|
|
@@ -8567,7 +8650,6 @@ var useMinEmptyHeight = ({
|
|
|
8567
8650
|
const numItems = (0, import_react52.useRef)(0);
|
|
8568
8651
|
const onDragFinished = useOnDragFinished(
|
|
8569
8652
|
(finished) => {
|
|
8570
|
-
var _a;
|
|
8571
8653
|
if (finished) {
|
|
8572
8654
|
const newNumItems = getNumItems(appStore, zoneCompound);
|
|
8573
8655
|
setPrevHeight(0);
|
|
@@ -8578,19 +8660,15 @@ var useMinEmptyHeight = ({
|
|
|
8578
8660
|
const selectedItem = appStore.getState().selectedItem;
|
|
8579
8661
|
const zones = appStore.getState().state.indexes.zones;
|
|
8580
8662
|
const nodes = appStore.getState().nodes;
|
|
8581
|
-
|
|
8663
|
+
nodes.setOverlayVisible(selectedItem == null ? void 0 : selectedItem.props.id, false);
|
|
8582
8664
|
setTimeout(() => {
|
|
8583
|
-
var
|
|
8584
|
-
const contentIds = ((
|
|
8585
|
-
|
|
8586
|
-
const node = nodes.nodes[contentId];
|
|
8587
|
-
node == null ? void 0 : node.methods.sync();
|
|
8588
|
-
});
|
|
8665
|
+
var _a;
|
|
8666
|
+
const contentIds = ((_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) || [];
|
|
8667
|
+
nodes.syncNodes(contentIds);
|
|
8589
8668
|
if (selectedItem) {
|
|
8590
8669
|
setTimeout(() => {
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
(_b = nodes.nodes[selectedItem.props.id]) == null ? void 0 : _b.methods.showOverlay();
|
|
8670
|
+
nodes.syncNode(selectedItem.props.id);
|
|
8671
|
+
nodes.setOverlayVisible(selectedItem.props.id, true);
|
|
8594
8672
|
}, 200);
|
|
8595
8673
|
}
|
|
8596
8674
|
setIsAnimating(false);
|
|
@@ -8614,21 +8692,6 @@ var useMinEmptyHeight = ({
|
|
|
8614
8692
|
return [prevHeight ? `${prevHeight}px` : returnedMinHeight, isAnimating];
|
|
8615
8693
|
};
|
|
8616
8694
|
|
|
8617
|
-
// lib/assign-refs.ts
|
|
8618
|
-
init_react_import();
|
|
8619
|
-
function assignRef(ref, node) {
|
|
8620
|
-
if (typeof ref === "function") {
|
|
8621
|
-
ref(node);
|
|
8622
|
-
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
8623
|
-
ref.current = node;
|
|
8624
|
-
}
|
|
8625
|
-
}
|
|
8626
|
-
function assignRefs(refs, node) {
|
|
8627
|
-
refs.forEach((ref) => {
|
|
8628
|
-
assignRef(ref, node);
|
|
8629
|
-
});
|
|
8630
|
-
}
|
|
8631
|
-
|
|
8632
8695
|
// components/DropZone/lib/use-content-with-preview.ts
|
|
8633
8696
|
init_react_import();
|
|
8634
8697
|
var import_react55 = require("react");
|
|
@@ -9487,8 +9550,209 @@ var MemoizeComponent = (0, import_react65.memo)(RenderComponent, (prev, next) =>
|
|
|
9487
9550
|
return prev.Component === next.Component && shallowEqual(prev.componentProps, next.componentProps, ["puck"]) && puckEquals;
|
|
9488
9551
|
});
|
|
9489
9552
|
|
|
9553
|
+
// components/DropZone/VirtualizedDropZone.tsx
|
|
9554
|
+
init_react_import();
|
|
9555
|
+
var import_react66 = require("react");
|
|
9556
|
+
init_store();
|
|
9557
|
+
var import_react_virtual = require("@tanstack/react-virtual");
|
|
9558
|
+
|
|
9559
|
+
// lib/get-frame.ts
|
|
9560
|
+
init_react_import();
|
|
9561
|
+
var getFrame = () => {
|
|
9562
|
+
if (typeof window === "undefined") return;
|
|
9563
|
+
let frameEl = document.querySelector("#preview-frame");
|
|
9564
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
9565
|
+
return frameEl.contentDocument || document;
|
|
9566
|
+
}
|
|
9567
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
9568
|
+
};
|
|
9569
|
+
|
|
9570
|
+
// components/DropZone/VirtualizedDropZone.tsx
|
|
9571
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9572
|
+
var ROOT_ZONE_VIRTUALIZATION_OVERSCAN = 5;
|
|
9573
|
+
var DEFAULT_VIRTUALIZED_ITEM_HEIGHT = 320;
|
|
9574
|
+
var measuredItemHeights = /* @__PURE__ */ new Map();
|
|
9575
|
+
var getEstimatedItemHeight = (componentId) => {
|
|
9576
|
+
var _a;
|
|
9577
|
+
return (_a = measuredItemHeights.get(componentId)) != null ? _a : DEFAULT_VIRTUALIZED_ITEM_HEIGHT;
|
|
9578
|
+
};
|
|
9579
|
+
var cacheMeasuredItemHeight = (componentId, height) => {
|
|
9580
|
+
if (height <= 0) {
|
|
9581
|
+
return;
|
|
9582
|
+
}
|
|
9583
|
+
measuredItemHeights.set(componentId, height);
|
|
9584
|
+
};
|
|
9585
|
+
var VirtualizedDropZone = ({
|
|
9586
|
+
contentIds,
|
|
9587
|
+
zoneCompound,
|
|
9588
|
+
renderItem
|
|
9589
|
+
}) => {
|
|
9590
|
+
const selectedId = useAppStore((s) => {
|
|
9591
|
+
var _a, _b;
|
|
9592
|
+
return (_b = (_a = s.selectedItem) == null ? void 0 : _a.props.id) != null ? _b : null;
|
|
9593
|
+
});
|
|
9594
|
+
const frame = getFrame();
|
|
9595
|
+
const zoneStore = (0, import_react66.useContext)(ZoneStoreContext);
|
|
9596
|
+
const draggedItemId = useContextStore(ZoneStoreContext, (s) => {
|
|
9597
|
+
var _a;
|
|
9598
|
+
const draggedId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
9599
|
+
return draggedId ? String(draggedId) : null;
|
|
9600
|
+
});
|
|
9601
|
+
const dragTargetParentId = useContextStore(ZoneStoreContext, (s) => {
|
|
9602
|
+
var _a, _b;
|
|
9603
|
+
if ((_a = s.draggedItem) == null ? void 0 : _a.id) {
|
|
9604
|
+
const parentZone = Object.keys((_b = s.previewIndex) != null ? _b : {})[0];
|
|
9605
|
+
return parentZone == null ? void 0 : parentZone.split(":")[0];
|
|
9606
|
+
}
|
|
9607
|
+
return null;
|
|
9608
|
+
});
|
|
9609
|
+
const iframeWindow = frame == null ? void 0 : frame.defaultView;
|
|
9610
|
+
const measureRefsRef = (0, import_react66.useRef)(/* @__PURE__ */ new Map());
|
|
9611
|
+
const appStoreApi = useAppStoreApi();
|
|
9612
|
+
const resolveIndex = (0, import_react66.useCallback)(
|
|
9613
|
+
(targetId) => {
|
|
9614
|
+
var _a, _b, _c, _d;
|
|
9615
|
+
if (!targetId || targetId === "root") {
|
|
9616
|
+
return -1;
|
|
9617
|
+
}
|
|
9618
|
+
const directIndex = contentIds.indexOf(targetId);
|
|
9619
|
+
if (directIndex > -1) {
|
|
9620
|
+
return directIndex;
|
|
9621
|
+
}
|
|
9622
|
+
const path = (_c = (_b = (_a = appStoreApi.getState().state.indexes.nodes) == null ? void 0 : _a[targetId]) == null ? void 0 : _b.path) != null ? _c : [];
|
|
9623
|
+
for (let i = path.length - 1; i >= 0; i -= 1) {
|
|
9624
|
+
const candidateId = (_d = path[i]) == null ? void 0 : _d.split(":")[0];
|
|
9625
|
+
if (!candidateId || candidateId === "root") {
|
|
9626
|
+
continue;
|
|
9627
|
+
}
|
|
9628
|
+
const index = contentIds.indexOf(candidateId);
|
|
9629
|
+
if (index > -1) {
|
|
9630
|
+
return index;
|
|
9631
|
+
}
|
|
9632
|
+
}
|
|
9633
|
+
return -1;
|
|
9634
|
+
},
|
|
9635
|
+
[appStoreApi, contentIds]
|
|
9636
|
+
);
|
|
9637
|
+
const pinnedIndexes = (0, import_react66.useMemo)(() => {
|
|
9638
|
+
const nextPinnedIndexes = /* @__PURE__ */ new Set();
|
|
9639
|
+
[selectedId, draggedItemId, dragTargetParentId].forEach((targetId) => {
|
|
9640
|
+
const currentIndex = resolveIndex(targetId);
|
|
9641
|
+
if (currentIndex > -1) {
|
|
9642
|
+
nextPinnedIndexes.add(currentIndex);
|
|
9643
|
+
}
|
|
9644
|
+
});
|
|
9645
|
+
return Array.from(nextPinnedIndexes).sort((a, b) => a - b);
|
|
9646
|
+
}, [dragTargetParentId, draggedItemId, resolveIndex, selectedId]);
|
|
9647
|
+
const rangeExtractor = (0, import_react66.useCallback)(
|
|
9648
|
+
(range) => {
|
|
9649
|
+
const indexes = (0, import_react_virtual.defaultRangeExtractor)(range);
|
|
9650
|
+
pinnedIndexes.forEach((index) => {
|
|
9651
|
+
if (!indexes.includes(index)) {
|
|
9652
|
+
indexes.push(index);
|
|
9653
|
+
}
|
|
9654
|
+
});
|
|
9655
|
+
indexes.sort((a, b) => a - b);
|
|
9656
|
+
return indexes;
|
|
9657
|
+
},
|
|
9658
|
+
[pinnedIndexes]
|
|
9659
|
+
);
|
|
9660
|
+
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
9661
|
+
count: contentIds.length,
|
|
9662
|
+
getItemKey: (index) => contentIds[index],
|
|
9663
|
+
estimateSize: (index) => getEstimatedItemHeight(contentIds[index]),
|
|
9664
|
+
getScrollElement: () => iframeWindow != null ? iframeWindow : null,
|
|
9665
|
+
overscan: ROOT_ZONE_VIRTUALIZATION_OVERSCAN,
|
|
9666
|
+
observeElementRect: (instance, cb) => iframeWindow ? (0, import_react_virtual.observeWindowRect)(instance, cb) : (0, import_react_virtual.observeElementRect)(instance, cb),
|
|
9667
|
+
observeElementOffset: (instance, cb) => iframeWindow ? (0, import_react_virtual.observeWindowOffset)(instance, cb) : (0, import_react_virtual.observeElementOffset)(instance, cb),
|
|
9668
|
+
scrollToFn: (offset, options, instance) => iframeWindow ? (0, import_react_virtual.windowScroll)(offset, options, instance) : (0, import_react_virtual.elementScroll)(offset, options, instance),
|
|
9669
|
+
rangeExtractor,
|
|
9670
|
+
initialOffset: () => iframeWindow ? iframeWindow.scrollY : 0
|
|
9671
|
+
});
|
|
9672
|
+
(0, import_react66.useEffect)(() => {
|
|
9673
|
+
zoneStore.getState().registerRootVirtualizer(zoneCompound, {
|
|
9674
|
+
resolveIndex: (targetId) => resolveIndex(targetId),
|
|
9675
|
+
virtualizer
|
|
9676
|
+
});
|
|
9677
|
+
return () => {
|
|
9678
|
+
zoneStore.getState().unregisterRootVirtualizer(zoneCompound);
|
|
9679
|
+
};
|
|
9680
|
+
}, [resolveIndex, virtualizer, zoneCompound, zoneStore]);
|
|
9681
|
+
const getMeasureRef = (0, import_react66.useCallback)((componentId) => {
|
|
9682
|
+
const cachedRef = measureRefsRef.current.get(componentId);
|
|
9683
|
+
if (cachedRef) {
|
|
9684
|
+
return cachedRef;
|
|
9685
|
+
}
|
|
9686
|
+
const measureRef = (element) => {
|
|
9687
|
+
if (!element) {
|
|
9688
|
+
return;
|
|
9689
|
+
}
|
|
9690
|
+
const height = Math.ceil(element.getBoundingClientRect().height) || DEFAULT_VIRTUALIZED_ITEM_HEIGHT;
|
|
9691
|
+
if (typeof height === "number" && height > 0) {
|
|
9692
|
+
cacheMeasuredItemHeight(componentId, height);
|
|
9693
|
+
}
|
|
9694
|
+
};
|
|
9695
|
+
measureRefsRef.current.set(componentId, measureRef);
|
|
9696
|
+
return measureRef;
|
|
9697
|
+
}, []);
|
|
9698
|
+
(0, import_react66.useEffect)(() => {
|
|
9699
|
+
const validIds = new Set(contentIds);
|
|
9700
|
+
Array.from(measureRefsRef.current.keys()).forEach((componentId) => {
|
|
9701
|
+
if (!validIds.has(componentId)) {
|
|
9702
|
+
measureRefsRef.current.delete(componentId);
|
|
9703
|
+
}
|
|
9704
|
+
});
|
|
9705
|
+
}, [contentIds]);
|
|
9706
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
9707
|
+
const totalSize = virtualizer.getTotalSize();
|
|
9708
|
+
const renderedItems = (0, import_react66.useMemo)(() => {
|
|
9709
|
+
const items = [];
|
|
9710
|
+
let previousEnd = 0;
|
|
9711
|
+
let previousIndex = -1;
|
|
9712
|
+
virtualItems.forEach((virtualItem) => {
|
|
9713
|
+
if (!virtualItem) return;
|
|
9714
|
+
const componentId = contentIds[virtualItem.index];
|
|
9715
|
+
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
9716
|
+
if (gapSize > 0) {
|
|
9717
|
+
items.push(
|
|
9718
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9719
|
+
"div",
|
|
9720
|
+
{
|
|
9721
|
+
style: { height: `${gapSize}px` }
|
|
9722
|
+
},
|
|
9723
|
+
`gap:${previousIndex}:${virtualItem.index}`
|
|
9724
|
+
)
|
|
9725
|
+
);
|
|
9726
|
+
}
|
|
9727
|
+
items.push(
|
|
9728
|
+
renderItem({
|
|
9729
|
+
componentId,
|
|
9730
|
+
index: virtualItem.index,
|
|
9731
|
+
measureRef: getMeasureRef(componentId)
|
|
9732
|
+
})
|
|
9733
|
+
);
|
|
9734
|
+
previousEnd = virtualItem.end;
|
|
9735
|
+
previousIndex = virtualItem.index;
|
|
9736
|
+
});
|
|
9737
|
+
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
9738
|
+
if (trailingGap > 0) {
|
|
9739
|
+
items.push(
|
|
9740
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9741
|
+
"div",
|
|
9742
|
+
{
|
|
9743
|
+
style: { height: `${trailingGap}px` }
|
|
9744
|
+
},
|
|
9745
|
+
`gap:${previousIndex}:end`
|
|
9746
|
+
)
|
|
9747
|
+
);
|
|
9748
|
+
}
|
|
9749
|
+
return items;
|
|
9750
|
+
}, [totalSize, virtualItems, getMeasureRef]);
|
|
9751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_jsx_runtime67.Fragment, { children: renderedItems });
|
|
9752
|
+
};
|
|
9753
|
+
|
|
9490
9754
|
// components/DropZone/index.tsx
|
|
9491
|
-
var
|
|
9755
|
+
var import_jsx_runtime68 = (
|
|
9492
9756
|
// Safe to use this since the HTML is set by the user
|
|
9493
9757
|
require("react/jsx-runtime")
|
|
9494
9758
|
);
|
|
@@ -9501,24 +9765,25 @@ var InsertPreview = ({
|
|
|
9501
9765
|
override
|
|
9502
9766
|
}) => {
|
|
9503
9767
|
if (element) {
|
|
9504
|
-
return /* @__PURE__ */ (0,
|
|
9768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } });
|
|
9505
9769
|
}
|
|
9506
|
-
return /* @__PURE__ */ (0,
|
|
9770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DrawerItemInner, { name: label, children: override });
|
|
9507
9771
|
};
|
|
9508
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */ (0,
|
|
9772
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropZoneEdit, __spreadValues({}, props));
|
|
9509
9773
|
var DropZoneChild = ({
|
|
9510
9774
|
zoneCompound,
|
|
9511
9775
|
componentId,
|
|
9512
9776
|
index,
|
|
9513
9777
|
dragAxis,
|
|
9514
9778
|
collisionAxis,
|
|
9515
|
-
inDroppableZone
|
|
9779
|
+
inDroppableZone,
|
|
9780
|
+
itemRef
|
|
9516
9781
|
}) => {
|
|
9517
9782
|
var _a, _b;
|
|
9518
9783
|
const metadata = useAppStore((s) => s.metadata);
|
|
9519
|
-
const ctx = (0,
|
|
9784
|
+
const ctx = (0, import_react67.useContext)(dropZoneContext);
|
|
9520
9785
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
9521
|
-
const zoneStore = (0,
|
|
9786
|
+
const zoneStore = (0, import_react67.useContext)(ZoneStoreContext);
|
|
9522
9787
|
const nodeProps = useAppStore(
|
|
9523
9788
|
(0, import_shallow6.useShallow)((s) => {
|
|
9524
9789
|
var _a2;
|
|
@@ -9538,7 +9803,7 @@ var DropZoneChild = ({
|
|
|
9538
9803
|
})
|
|
9539
9804
|
);
|
|
9540
9805
|
const appStore = useAppStoreApi();
|
|
9541
|
-
const item = (0,
|
|
9806
|
+
const item = (0, import_react67.useMemo)(() => {
|
|
9542
9807
|
if (nodeProps) {
|
|
9543
9808
|
const expanded = expandNode({
|
|
9544
9809
|
type: nodeType,
|
|
@@ -9560,7 +9825,7 @@ var DropZoneChild = ({
|
|
|
9560
9825
|
const componentConfig = useAppStore(
|
|
9561
9826
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
9562
9827
|
);
|
|
9563
|
-
const puckProps = (0,
|
|
9828
|
+
const puckProps = (0, import_react67.useMemo)(
|
|
9564
9829
|
() => ({
|
|
9565
9830
|
renderDropZone: DropZoneEditPure,
|
|
9566
9831
|
isEditing: true,
|
|
@@ -9583,7 +9848,7 @@ var DropZoneChild = ({
|
|
|
9583
9848
|
}
|
|
9584
9849
|
);
|
|
9585
9850
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
9586
|
-
const defaultsProps = (0,
|
|
9851
|
+
const defaultsProps = (0, import_react67.useMemo)(
|
|
9587
9852
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
9588
9853
|
puck: puckProps,
|
|
9589
9854
|
editMode: true
|
|
@@ -9591,7 +9856,7 @@ var DropZoneChild = ({
|
|
|
9591
9856
|
}),
|
|
9592
9857
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
|
|
9593
9858
|
);
|
|
9594
|
-
const defaultedNode = (0,
|
|
9859
|
+
const defaultedNode = (0, import_react67.useMemo)(
|
|
9595
9860
|
() => {
|
|
9596
9861
|
var _a2;
|
|
9597
9862
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
@@ -9601,8 +9866,8 @@ var DropZoneChild = ({
|
|
|
9601
9866
|
const config = useAppStore((s) => s.config);
|
|
9602
9867
|
const plugins = useAppStore((s) => s.plugins);
|
|
9603
9868
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
9604
|
-
const combinedFieldTransforms = (0,
|
|
9605
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0,
|
|
9869
|
+
const combinedFieldTransforms = (0, import_react67.useMemo)(
|
|
9870
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
9606
9871
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
9607
9872
|
{}
|
|
9608
9873
|
)), userFieldTransforms),
|
|
@@ -9616,13 +9881,13 @@ var DropZoneChild = ({
|
|
|
9616
9881
|
isLoading
|
|
9617
9882
|
);
|
|
9618
9883
|
if (!item) return;
|
|
9619
|
-
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0,
|
|
9884
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
9620
9885
|
"No configuration for ",
|
|
9621
9886
|
item.type
|
|
9622
9887
|
] });
|
|
9623
9888
|
let componentType = item.type;
|
|
9624
9889
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
9625
|
-
return /* @__PURE__ */ (0,
|
|
9890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9626
9891
|
DraggableComponent,
|
|
9627
9892
|
{
|
|
9628
9893
|
id: componentId,
|
|
@@ -9636,10 +9901,11 @@ var DropZoneChild = ({
|
|
|
9636
9901
|
autoDragAxis: dragAxis,
|
|
9637
9902
|
userDragAxis: collisionAxis,
|
|
9638
9903
|
inDroppableZone,
|
|
9904
|
+
itemRef,
|
|
9639
9905
|
children: (dragRef) => {
|
|
9640
9906
|
var _a2;
|
|
9641
9907
|
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
9642
|
-
return /* @__PURE__ */ (0,
|
|
9908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9643
9909
|
MemoizeComponent,
|
|
9644
9910
|
{
|
|
9645
9911
|
Component: Render2,
|
|
@@ -9649,14 +9915,14 @@ var DropZoneChild = ({
|
|
|
9649
9915
|
}
|
|
9650
9916
|
);
|
|
9651
9917
|
}
|
|
9652
|
-
return /* @__PURE__ */ (0,
|
|
9918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9653
9919
|
InsertPreview,
|
|
9654
9920
|
{
|
|
9655
9921
|
label,
|
|
9656
9922
|
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
9657
9923
|
element: "element" in item && item.element ? item.element : void 0
|
|
9658
9924
|
}
|
|
9659
|
-
) : /* @__PURE__ */ (0,
|
|
9925
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9660
9926
|
MemoizeComponent,
|
|
9661
9927
|
{
|
|
9662
9928
|
Component: Render2,
|
|
@@ -9667,8 +9933,8 @@ var DropZoneChild = ({
|
|
|
9667
9933
|
}
|
|
9668
9934
|
);
|
|
9669
9935
|
};
|
|
9670
|
-
var DropZoneChildMemo = (0,
|
|
9671
|
-
var DropZoneEdit = (0,
|
|
9936
|
+
var DropZoneChildMemo = (0, import_react67.memo)(DropZoneChild);
|
|
9937
|
+
var DropZoneEdit = (0, import_react67.forwardRef)(
|
|
9672
9938
|
function DropZoneEditInternal({
|
|
9673
9939
|
zone,
|
|
9674
9940
|
allow,
|
|
@@ -9679,7 +9945,7 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9679
9945
|
collisionAxis,
|
|
9680
9946
|
as
|
|
9681
9947
|
}, userRef) {
|
|
9682
|
-
const ctx = (0,
|
|
9948
|
+
const ctx = (0, import_react67.useContext)(dropZoneContext);
|
|
9683
9949
|
const appStoreApi = useAppStoreApi();
|
|
9684
9950
|
const {
|
|
9685
9951
|
// These all need setting via context
|
|
@@ -9717,14 +9983,14 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9717
9983
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
|
9718
9984
|
})
|
|
9719
9985
|
);
|
|
9720
|
-
(0,
|
|
9986
|
+
(0, import_react67.useEffect)(() => {
|
|
9721
9987
|
if (!zoneType || zoneType === "dropzone") {
|
|
9722
9988
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
9723
9989
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
9724
9990
|
}
|
|
9725
9991
|
}
|
|
9726
9992
|
}, [zoneType, appStoreApi]);
|
|
9727
|
-
(0,
|
|
9993
|
+
(0, import_react67.useEffect)(() => {
|
|
9728
9994
|
if (zoneType === "dropzone") {
|
|
9729
9995
|
if (zoneCompound !== rootDroppableId) {
|
|
9730
9996
|
console.warn(
|
|
@@ -9733,11 +9999,11 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9733
9999
|
}
|
|
9734
10000
|
}
|
|
9735
10001
|
}, [zoneType]);
|
|
9736
|
-
const contentIds = (0,
|
|
10002
|
+
const contentIds = (0, import_react67.useMemo)(() => {
|
|
9737
10003
|
return zoneContentIds || [];
|
|
9738
10004
|
}, [zoneContentIds]);
|
|
9739
|
-
const ref = (0,
|
|
9740
|
-
const acceptsTarget = (0,
|
|
10005
|
+
const ref = (0, import_react67.useRef)(null);
|
|
10006
|
+
const acceptsTarget = (0, import_react67.useCallback)(
|
|
9741
10007
|
(componentType) => {
|
|
9742
10008
|
if (!componentType) {
|
|
9743
10009
|
return true;
|
|
@@ -9775,7 +10041,7 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9775
10041
|
}
|
|
9776
10042
|
return _isEnabled;
|
|
9777
10043
|
});
|
|
9778
|
-
(0,
|
|
10044
|
+
(0, import_react67.useEffect)(() => {
|
|
9779
10045
|
if (registerLocalZone) {
|
|
9780
10046
|
registerLocalZone(zoneCompound, targetAccepted || isEnabled);
|
|
9781
10047
|
}
|
|
@@ -9790,8 +10056,8 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9790
10056
|
zoneCompound
|
|
9791
10057
|
);
|
|
9792
10058
|
const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
|
|
9793
|
-
const zoneStore = (0,
|
|
9794
|
-
(0,
|
|
10059
|
+
const zoneStore = (0, import_react67.useContext)(ZoneStoreContext);
|
|
10060
|
+
(0, import_react67.useEffect)(() => {
|
|
9795
10061
|
const { enabledIndex } = zoneStore.getState();
|
|
9796
10062
|
zoneStore.setState({
|
|
9797
10063
|
enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
|
|
@@ -9810,7 +10076,7 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9810
10076
|
path: path || []
|
|
9811
10077
|
}
|
|
9812
10078
|
};
|
|
9813
|
-
const { ref: dropRef } = (0,
|
|
10079
|
+
const { ref: dropRef } = (0, import_react68.useDroppable)(droppableConfig);
|
|
9814
10080
|
const isAreaSelected = useAppStore(
|
|
9815
10081
|
(s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
|
|
9816
10082
|
);
|
|
@@ -9820,14 +10086,19 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9820
10086
|
userMinEmptyHeight,
|
|
9821
10087
|
ref
|
|
9822
10088
|
});
|
|
9823
|
-
const setRefs = (0,
|
|
10089
|
+
const setRefs = (0, import_react67.useCallback)(
|
|
9824
10090
|
(node) => {
|
|
9825
10091
|
assignRefs([ref, dropRef, userRef], node);
|
|
9826
10092
|
},
|
|
9827
10093
|
[dropRef]
|
|
9828
10094
|
);
|
|
10095
|
+
const _experimentalVirtualization = useAppStore(
|
|
10096
|
+
(s) => s._experimentalVirtualization
|
|
10097
|
+
);
|
|
9829
10098
|
const El = as != null ? as : "div";
|
|
9830
|
-
|
|
10099
|
+
const isRootAreaZone = (areaId != null ? areaId : rootAreaId) === rootAreaId && depth === 0;
|
|
10100
|
+
const shouldVirtualizeItems = _experimentalVirtualization && isRootAreaZone;
|
|
10101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9831
10102
|
El,
|
|
9832
10103
|
{
|
|
9833
10104
|
className: `${getClassName25({
|
|
@@ -9845,20 +10116,37 @@ var DropZoneEdit = (0, import_react66.forwardRef)(
|
|
|
9845
10116
|
"--min-empty-height": minEmptyHeight,
|
|
9846
10117
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
9847
10118
|
}),
|
|
9848
|
-
children:
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
10119
|
+
children: shouldVirtualizeItems ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10120
|
+
VirtualizedDropZone,
|
|
10121
|
+
{
|
|
10122
|
+
contentIds: contentIdsWithPreview,
|
|
10123
|
+
zoneCompound,
|
|
10124
|
+
renderItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10125
|
+
DropZoneChildMemo,
|
|
10126
|
+
{
|
|
10127
|
+
zoneCompound,
|
|
10128
|
+
componentId: props.componentId,
|
|
10129
|
+
dragAxis,
|
|
10130
|
+
index: props.index,
|
|
10131
|
+
collisionAxis,
|
|
10132
|
+
inDroppableZone: targetAccepted,
|
|
10133
|
+
itemRef: props.measureRef
|
|
10134
|
+
},
|
|
10135
|
+
props.componentId
|
|
10136
|
+
)
|
|
10137
|
+
}
|
|
10138
|
+
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10139
|
+
DropZoneChildMemo,
|
|
10140
|
+
{
|
|
10141
|
+
zoneCompound,
|
|
10142
|
+
componentId,
|
|
10143
|
+
dragAxis,
|
|
10144
|
+
index: i,
|
|
10145
|
+
collisionAxis,
|
|
10146
|
+
inDroppableZone: targetAccepted
|
|
10147
|
+
},
|
|
10148
|
+
componentId
|
|
10149
|
+
))
|
|
9862
10150
|
}
|
|
9863
10151
|
);
|
|
9864
10152
|
}
|
|
@@ -9869,8 +10157,8 @@ var DropZoneRenderItem = ({
|
|
|
9869
10157
|
metadata
|
|
9870
10158
|
}) => {
|
|
9871
10159
|
const Component = config.components[item.type];
|
|
9872
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
9873
|
-
const nextContextValue = (0,
|
|
10160
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
10161
|
+
const nextContextValue = (0, import_react67.useMemo)(
|
|
9874
10162
|
() => ({
|
|
9875
10163
|
areaId: props.id,
|
|
9876
10164
|
depth: 1
|
|
@@ -9878,7 +10166,7 @@ var DropZoneRenderItem = ({
|
|
|
9878
10166
|
[props]
|
|
9879
10167
|
);
|
|
9880
10168
|
const richtextProps = useRichtextProps(Component.fields, props);
|
|
9881
|
-
return /* @__PURE__ */ (0,
|
|
10169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9882
10170
|
Component.render,
|
|
9883
10171
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
9884
10172
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
@@ -9888,15 +10176,15 @@ var DropZoneRenderItem = ({
|
|
|
9888
10176
|
})
|
|
9889
10177
|
) }, props.id);
|
|
9890
10178
|
};
|
|
9891
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0,
|
|
9892
|
-
var DropZoneRender = (0,
|
|
10179
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropZoneRender, __spreadValues({}, props));
|
|
10180
|
+
var DropZoneRender = (0, import_react67.forwardRef)(
|
|
9893
10181
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
9894
|
-
const ctx = (0,
|
|
10182
|
+
const ctx = (0, import_react67.useContext)(dropZoneContext);
|
|
9895
10183
|
const { areaId = "root" } = ctx || {};
|
|
9896
|
-
const { config, data, metadata } = (0,
|
|
10184
|
+
const { config, data, metadata } = (0, import_react67.useContext)(renderContext);
|
|
9897
10185
|
let zoneCompound = `${areaId}:${zone}`;
|
|
9898
10186
|
let content = (data == null ? void 0 : data.content) || [];
|
|
9899
|
-
(0,
|
|
10187
|
+
(0, import_react67.useEffect)(() => {
|
|
9900
10188
|
if (!content) {
|
|
9901
10189
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
9902
10190
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
@@ -9910,10 +10198,10 @@ var DropZoneRender = (0, import_react66.forwardRef)(
|
|
|
9910
10198
|
if (zoneCompound !== rootDroppableId) {
|
|
9911
10199
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
9912
10200
|
}
|
|
9913
|
-
return /* @__PURE__ */ (0,
|
|
10201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
9914
10202
|
const Component = config.components[item.type];
|
|
9915
10203
|
if (Component) {
|
|
9916
|
-
return /* @__PURE__ */ (0,
|
|
10204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9917
10205
|
DropZoneRenderItem,
|
|
9918
10206
|
{
|
|
9919
10207
|
config,
|
|
@@ -9927,14 +10215,14 @@ var DropZoneRender = (0, import_react66.forwardRef)(
|
|
|
9927
10215
|
}) });
|
|
9928
10216
|
}
|
|
9929
10217
|
);
|
|
9930
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
|
9931
|
-
var DropZone = (0,
|
|
10218
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropZone, __spreadValues({}, props));
|
|
10219
|
+
var DropZone = (0, import_react67.forwardRef)(
|
|
9932
10220
|
function DropZone2(props, ref) {
|
|
9933
|
-
const ctx = (0,
|
|
10221
|
+
const ctx = (0, import_react67.useContext)(dropZoneContext);
|
|
9934
10222
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
9935
|
-
return /* @__PURE__ */ (0,
|
|
10223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
9936
10224
|
}
|
|
9937
|
-
return /* @__PURE__ */ (0,
|
|
10225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
9938
10226
|
}
|
|
9939
10227
|
);
|
|
9940
10228
|
|
|
@@ -9971,17 +10259,6 @@ function throttle(func, limit) {
|
|
|
9971
10259
|
};
|
|
9972
10260
|
}
|
|
9973
10261
|
|
|
9974
|
-
// lib/get-frame.ts
|
|
9975
|
-
init_react_import();
|
|
9976
|
-
var getFrame = () => {
|
|
9977
|
-
if (typeof window === "undefined") return;
|
|
9978
|
-
let frameEl = document.querySelector("#preview-frame");
|
|
9979
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
9980
|
-
return frameEl.contentDocument || document;
|
|
9981
|
-
}
|
|
9982
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
9983
|
-
};
|
|
9984
|
-
|
|
9985
10262
|
// lib/global-position.ts
|
|
9986
10263
|
init_react_import();
|
|
9987
10264
|
var GlobalPosition = class {
|
|
@@ -10310,14 +10587,14 @@ function getDeepDir(el) {
|
|
|
10310
10587
|
|
|
10311
10588
|
// components/DragDropContext/index.tsx
|
|
10312
10589
|
var import_state = require("@dnd-kit/state");
|
|
10313
|
-
var
|
|
10590
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10314
10591
|
var DEBUG3 = false;
|
|
10315
|
-
var dragListenerContext = (0,
|
|
10592
|
+
var dragListenerContext = (0, import_react70.createContext)({
|
|
10316
10593
|
dragListeners: {}
|
|
10317
10594
|
});
|
|
10318
10595
|
function useDragListener(type, fn, deps = []) {
|
|
10319
|
-
const { setDragListeners } = (0,
|
|
10320
|
-
(0,
|
|
10596
|
+
const { setDragListeners } = (0, import_react70.useContext)(dragListenerContext);
|
|
10597
|
+
(0, import_react70.useEffect)(() => {
|
|
10321
10598
|
if (setDragListeners) {
|
|
10322
10599
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
10323
10600
|
[type]: [...old[type] || [], fn]
|
|
@@ -10327,8 +10604,8 @@ function useDragListener(type, fn, deps = []) {
|
|
|
10327
10604
|
}
|
|
10328
10605
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
10329
10606
|
var useTempDisableFallback = (timeout3) => {
|
|
10330
|
-
const lastFallbackDisable = (0,
|
|
10331
|
-
return (0,
|
|
10607
|
+
const lastFallbackDisable = (0, import_react70.useRef)(null);
|
|
10608
|
+
return (0, import_react70.useCallback)((manager) => {
|
|
10332
10609
|
collisionStore.setState({ fallbackEnabled: false });
|
|
10333
10610
|
const fallbackId = generateId();
|
|
10334
10611
|
lastFallbackDisable.current = fallbackId;
|
|
@@ -10347,10 +10624,11 @@ var DragDropContextClient = ({
|
|
|
10347
10624
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
10348
10625
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
10349
10626
|
const appStore = useAppStoreApi();
|
|
10350
|
-
const debouncedParamsRef = (0,
|
|
10627
|
+
const debouncedParamsRef = (0, import_react70.useRef)(null);
|
|
10351
10628
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
10352
|
-
const [zoneStore] = (0,
|
|
10353
|
-
|
|
10629
|
+
const [zoneStore] = (0, import_react70.useState)(() => {
|
|
10630
|
+
const rootVirtualizers = /* @__PURE__ */ new Map();
|
|
10631
|
+
return (0, import_zustand6.createStore)(() => ({
|
|
10354
10632
|
zoneDepthIndex: {},
|
|
10355
10633
|
nextZoneDepthIndex: {},
|
|
10356
10634
|
areaDepthIndex: {},
|
|
@@ -10358,10 +10636,36 @@ var DragDropContextClient = ({
|
|
|
10358
10636
|
draggedItem: null,
|
|
10359
10637
|
previewIndex: {},
|
|
10360
10638
|
enabledIndex: {},
|
|
10361
|
-
hoveringComponent: null
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10639
|
+
hoveringComponent: null,
|
|
10640
|
+
registerRootVirtualizer: (zoneCompound, handle) => {
|
|
10641
|
+
rootVirtualizers.set(zoneCompound, handle);
|
|
10642
|
+
},
|
|
10643
|
+
unregisterRootVirtualizer: (zoneCompound) => {
|
|
10644
|
+
rootVirtualizers.delete(zoneCompound);
|
|
10645
|
+
},
|
|
10646
|
+
scrollToComponent: (id) => {
|
|
10647
|
+
const virtualizers = Array.from(rootVirtualizers.values());
|
|
10648
|
+
if (virtualizers.length > 0) {
|
|
10649
|
+
for (const handle of virtualizers) {
|
|
10650
|
+
const index = handle.resolveIndex(id);
|
|
10651
|
+
if (index < 0) {
|
|
10652
|
+
continue;
|
|
10653
|
+
}
|
|
10654
|
+
handle.virtualizer.scrollToIndex(index, {
|
|
10655
|
+
behavior: "auto",
|
|
10656
|
+
// We avoid smooth scroll as this triggers virtualizer renders
|
|
10657
|
+
align: "auto"
|
|
10658
|
+
});
|
|
10659
|
+
}
|
|
10660
|
+
} else {
|
|
10661
|
+
const frame = getFrame();
|
|
10662
|
+
const el = frame == null ? void 0 : frame.querySelector(`[data-puck-component="${id}"]`);
|
|
10663
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
10664
|
+
}
|
|
10665
|
+
}
|
|
10666
|
+
}));
|
|
10667
|
+
});
|
|
10668
|
+
const getChanged2 = (0, import_react70.useCallback)(
|
|
10365
10669
|
(params) => {
|
|
10366
10670
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
10367
10671
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
@@ -10382,7 +10686,7 @@ var DragDropContextClient = ({
|
|
|
10382
10686
|
},
|
|
10383
10687
|
[zoneStore]
|
|
10384
10688
|
);
|
|
10385
|
-
const setDeepestAndCollide = (0,
|
|
10689
|
+
const setDeepestAndCollide = (0, import_react70.useCallback)(
|
|
10386
10690
|
(params, manager) => {
|
|
10387
10691
|
const { zoneChanged, areaChanged } = getChanged2(params);
|
|
10388
10692
|
if (!zoneChanged && !areaChanged) return;
|
|
@@ -10406,7 +10710,7 @@ var DragDropContextClient = ({
|
|
|
10406
10710
|
setDeepestDb.cancel();
|
|
10407
10711
|
debouncedParamsRef.current = null;
|
|
10408
10712
|
};
|
|
10409
|
-
(0,
|
|
10713
|
+
(0, import_react70.useEffect)(() => {
|
|
10410
10714
|
if (DEBUG3) {
|
|
10411
10715
|
zoneStore.subscribe(
|
|
10412
10716
|
(s) => {
|
|
@@ -10420,7 +10724,7 @@ var DragDropContextClient = ({
|
|
|
10420
10724
|
);
|
|
10421
10725
|
}
|
|
10422
10726
|
}, []);
|
|
10423
|
-
const [plugins] = (0,
|
|
10727
|
+
const [plugins] = (0, import_react70.useState)(() => [
|
|
10424
10728
|
...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
|
|
10425
10729
|
createNestedDroppablePlugin(
|
|
10426
10730
|
{
|
|
@@ -10468,10 +10772,10 @@ var DragDropContextClient = ({
|
|
|
10468
10772
|
)
|
|
10469
10773
|
]);
|
|
10470
10774
|
const sensors = useSensors();
|
|
10471
|
-
const [dragListeners, setDragListeners] = (0,
|
|
10472
|
-
const dragMode = (0,
|
|
10473
|
-
const initialSelector = (0,
|
|
10474
|
-
const nextContextValue = (0,
|
|
10775
|
+
const [dragListeners, setDragListeners] = (0, import_react70.useState)({});
|
|
10776
|
+
const dragMode = (0, import_react70.useRef)(null);
|
|
10777
|
+
const initialSelector = (0, import_react70.useRef)(void 0);
|
|
10778
|
+
const nextContextValue = (0, import_react70.useMemo)(
|
|
10475
10779
|
() => ({
|
|
10476
10780
|
mode: "edit",
|
|
10477
10781
|
areaId: "root",
|
|
@@ -10479,15 +10783,15 @@ var DragDropContextClient = ({
|
|
|
10479
10783
|
}),
|
|
10480
10784
|
[]
|
|
10481
10785
|
);
|
|
10482
|
-
return /* @__PURE__ */ (0,
|
|
10786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10483
10787
|
dragListenerContext.Provider,
|
|
10484
10788
|
{
|
|
10485
10789
|
value: {
|
|
10486
10790
|
dragListeners,
|
|
10487
10791
|
setDragListeners
|
|
10488
10792
|
},
|
|
10489
|
-
children: /* @__PURE__ */ (0,
|
|
10490
|
-
|
|
10793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
10794
|
+
import_react69.DragDropProvider,
|
|
10491
10795
|
{
|
|
10492
10796
|
plugins,
|
|
10493
10797
|
sensors,
|
|
@@ -10508,24 +10812,9 @@ var DragDropContextClient = ({
|
|
|
10508
10812
|
zoneStore.setState({ draggedItem: null });
|
|
10509
10813
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
|
10510
10814
|
zoneStore.setState({ previewIndex: {} });
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
insertComponent(
|
|
10515
|
-
thisPreview.componentType,
|
|
10516
|
-
thisPreview.zone,
|
|
10517
|
-
thisPreview.index,
|
|
10518
|
-
appStore
|
|
10519
|
-
);
|
|
10520
|
-
} else if (initialSelector.current) {
|
|
10521
|
-
moveComponent(
|
|
10522
|
-
thisPreview.props.id,
|
|
10523
|
-
initialSelector.current,
|
|
10524
|
-
thisPreview,
|
|
10525
|
-
appStore
|
|
10526
|
-
);
|
|
10527
|
-
}
|
|
10528
|
-
}
|
|
10815
|
+
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
|
10816
|
+
fn(event, manager);
|
|
10817
|
+
});
|
|
10529
10818
|
dispatch({
|
|
10530
10819
|
type: "setUi",
|
|
10531
10820
|
ui: {
|
|
@@ -10533,9 +10822,6 @@ var DragDropContextClient = ({
|
|
|
10533
10822
|
isDragging: false
|
|
10534
10823
|
}
|
|
10535
10824
|
});
|
|
10536
|
-
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
|
10537
|
-
fn(event, manager);
|
|
10538
|
-
});
|
|
10539
10825
|
return;
|
|
10540
10826
|
}
|
|
10541
10827
|
if (thisPreview) {
|
|
@@ -10548,14 +10834,12 @@ var DragDropContextClient = ({
|
|
|
10548
10834
|
appStore
|
|
10549
10835
|
);
|
|
10550
10836
|
} else if (initialSelector.current) {
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
recordHistory: false
|
|
10558
|
-
});
|
|
10837
|
+
moveComponent(
|
|
10838
|
+
thisPreview.props.id,
|
|
10839
|
+
initialSelector.current,
|
|
10840
|
+
thisPreview,
|
|
10841
|
+
appStore
|
|
10842
|
+
);
|
|
10559
10843
|
}
|
|
10560
10844
|
}
|
|
10561
10845
|
dispatch({
|
|
@@ -10564,7 +10848,7 @@ var DragDropContextClient = ({
|
|
|
10564
10848
|
itemSelector: { index, zone },
|
|
10565
10849
|
isDragging: false
|
|
10566
10850
|
},
|
|
10567
|
-
recordHistory:
|
|
10851
|
+
recordHistory: false
|
|
10568
10852
|
});
|
|
10569
10853
|
(_b2 = dragListeners.dragend) == null ? void 0 : _b2.forEach((fn) => {
|
|
10570
10854
|
fn(event, manager);
|
|
@@ -10720,7 +11004,7 @@ var DragDropContextClient = ({
|
|
|
10720
11004
|
const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
|
|
10721
11005
|
entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
|
|
10722
11006
|
},
|
|
10723
|
-
children: /* @__PURE__ */ (0,
|
|
11007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
|
10724
11008
|
}
|
|
10725
11009
|
)
|
|
10726
11010
|
}
|
|
@@ -10734,12 +11018,12 @@ var DragDropContext = ({
|
|
|
10734
11018
|
if (status === "LOADING") {
|
|
10735
11019
|
return children;
|
|
10736
11020
|
}
|
|
10737
|
-
return /* @__PURE__ */ (0,
|
|
11021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
|
10738
11022
|
};
|
|
10739
11023
|
|
|
10740
11024
|
// components/Drawer/index.tsx
|
|
10741
|
-
var
|
|
10742
|
-
var
|
|
11025
|
+
var import_react72 = require("@dnd-kit/react");
|
|
11026
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10743
11027
|
var getClassName26 = get_class_name_factory_default("Drawer", styles_module_default14);
|
|
10744
11028
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default14);
|
|
10745
11029
|
var DrawerItemInner = ({
|
|
@@ -10749,11 +11033,11 @@ var DrawerItemInner = ({
|
|
|
10749
11033
|
dragRef,
|
|
10750
11034
|
isDragDisabled
|
|
10751
11035
|
}) => {
|
|
10752
|
-
const CustomInner = (0,
|
|
10753
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
|
11036
|
+
const CustomInner = (0, import_react71.useMemo)(
|
|
11037
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
10754
11038
|
[children]
|
|
10755
11039
|
);
|
|
10756
|
-
return /* @__PURE__ */ (0,
|
|
11040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10757
11041
|
"div",
|
|
10758
11042
|
{
|
|
10759
11043
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -10761,9 +11045,9 @@ var DrawerItemInner = ({
|
|
|
10761
11045
|
onMouseDown: (e) => e.preventDefault(),
|
|
10762
11046
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
10763
11047
|
"data-puck-drawer-item": true,
|
|
10764
|
-
children: /* @__PURE__ */ (0,
|
|
10765
|
-
/* @__PURE__ */ (0,
|
|
10766
|
-
/* @__PURE__ */ (0,
|
|
11048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
|
11049
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
|
11050
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DragIcon, {}) })
|
|
10767
11051
|
] }) }) })
|
|
10768
11052
|
}
|
|
10769
11053
|
);
|
|
@@ -10775,15 +11059,15 @@ var DrawerItemDraggable = ({
|
|
|
10775
11059
|
id,
|
|
10776
11060
|
isDragDisabled
|
|
10777
11061
|
}) => {
|
|
10778
|
-
const { ref } = (0,
|
|
11062
|
+
const { ref } = (0, import_react72.useDraggable)({
|
|
10779
11063
|
id,
|
|
10780
11064
|
data: { componentType: name },
|
|
10781
11065
|
disabled: isDragDisabled,
|
|
10782
11066
|
type: "drawer"
|
|
10783
11067
|
});
|
|
10784
|
-
return /* @__PURE__ */ (0,
|
|
10785
|
-
/* @__PURE__ */ (0,
|
|
10786
|
-
/* @__PURE__ */ (0,
|
|
11068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: getClassName26("draggable"), children: [
|
|
11069
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getClassName26("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DrawerItemInner, { name, label, children }) }),
|
|
11070
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: getClassName26("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10787
11071
|
DrawerItemInner,
|
|
10788
11072
|
{
|
|
10789
11073
|
name,
|
|
@@ -10804,7 +11088,7 @@ var DrawerItem = ({
|
|
|
10804
11088
|
isDragDisabled
|
|
10805
11089
|
}) => {
|
|
10806
11090
|
const resolvedId = id || name;
|
|
10807
|
-
const [dynamicId, setDynamicId] = (0,
|
|
11091
|
+
const [dynamicId, setDynamicId] = (0, import_react71.useState)(generateId(resolvedId));
|
|
10808
11092
|
if (typeof index !== "undefined") {
|
|
10809
11093
|
console.error(
|
|
10810
11094
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -10817,7 +11101,7 @@ var DrawerItem = ({
|
|
|
10817
11101
|
},
|
|
10818
11102
|
[resolvedId]
|
|
10819
11103
|
);
|
|
10820
|
-
return /* @__PURE__ */ (0,
|
|
11104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10821
11105
|
DrawerItemDraggable,
|
|
10822
11106
|
{
|
|
10823
11107
|
name,
|
|
@@ -10844,13 +11128,13 @@ var Drawer = ({
|
|
|
10844
11128
|
);
|
|
10845
11129
|
}
|
|
10846
11130
|
const id = useSafeId();
|
|
10847
|
-
const { ref } = (0,
|
|
11131
|
+
const { ref } = (0, import_react72.useDroppable)({
|
|
10848
11132
|
id,
|
|
10849
11133
|
type: "void",
|
|
10850
11134
|
collisionPriority: 0
|
|
10851
11135
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
10852
11136
|
});
|
|
10853
|
-
return /* @__PURE__ */ (0,
|
|
11137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10854
11138
|
"div",
|
|
10855
11139
|
{
|
|
10856
11140
|
className: getClassName26(),
|
|
@@ -10869,7 +11153,7 @@ init_IconButton2();
|
|
|
10869
11153
|
|
|
10870
11154
|
// components/Puck/index.tsx
|
|
10871
11155
|
init_react_import();
|
|
10872
|
-
var
|
|
11156
|
+
var import_react94 = require("react");
|
|
10873
11157
|
init_store();
|
|
10874
11158
|
|
|
10875
11159
|
// components/Puck/components/Fields/index.tsx
|
|
@@ -10884,15 +11168,15 @@ var styles_module_default18 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
|
10884
11168
|
|
|
10885
11169
|
// components/Puck/components/Fields/index.tsx
|
|
10886
11170
|
init_lib();
|
|
10887
|
-
var
|
|
11171
|
+
var import_react73 = require("react");
|
|
10888
11172
|
init_fields();
|
|
10889
11173
|
var import_shallow7 = require("zustand/react/shallow");
|
|
10890
|
-
var
|
|
11174
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10891
11175
|
var getClassName27 = get_class_name_factory_default("PuckFields", styles_module_default18);
|
|
10892
11176
|
var DefaultFields = ({
|
|
10893
11177
|
children
|
|
10894
11178
|
}) => {
|
|
10895
|
-
return /* @__PURE__ */ (0,
|
|
11179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children });
|
|
10896
11180
|
};
|
|
10897
11181
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
10898
11182
|
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
@@ -10953,12 +11237,12 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
10953
11237
|
})
|
|
10954
11238
|
);
|
|
10955
11239
|
const appStore = useAppStoreApi();
|
|
10956
|
-
const onChange = (0,
|
|
11240
|
+
const onChange = (0, import_react73.useCallback)(createOnChange(fieldName, appStore), [
|
|
10957
11241
|
fieldName
|
|
10958
11242
|
]);
|
|
10959
11243
|
const { visible = true } = field != null ? field : {};
|
|
10960
|
-
const fieldStore = (0,
|
|
10961
|
-
(0,
|
|
11244
|
+
const fieldStore = (0, import_react73.useContext)(fieldContextStore.ctx);
|
|
11245
|
+
(0, import_react73.useEffect)(() => {
|
|
10962
11246
|
return appStore.subscribe(
|
|
10963
11247
|
(s) => {
|
|
10964
11248
|
var _a;
|
|
@@ -10972,7 +11256,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
10972
11256
|
}, [appStore, fieldStore]);
|
|
10973
11257
|
if (!field || !id || !visible) return null;
|
|
10974
11258
|
if (field.type === "slot") return null;
|
|
10975
|
-
return /* @__PURE__ */ (0,
|
|
11259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: getClassName27("field"), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10976
11260
|
AutoFieldPrivate,
|
|
10977
11261
|
{
|
|
10978
11262
|
field,
|
|
@@ -10985,14 +11269,14 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
10985
11269
|
};
|
|
10986
11270
|
var FieldsChild = ({ fieldName }) => {
|
|
10987
11271
|
const appStore = useAppStoreApi();
|
|
10988
|
-
const initialValue = (0,
|
|
11272
|
+
const initialValue = (0, import_react73.useMemo)(() => {
|
|
10989
11273
|
var _a;
|
|
10990
11274
|
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
10991
11275
|
return { [fieldName]: value };
|
|
10992
11276
|
}, []);
|
|
10993
|
-
return /* @__PURE__ */ (0,
|
|
11277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FieldsChildInner, { fieldName }) });
|
|
10994
11278
|
};
|
|
10995
|
-
var FieldsChildMemo = (0,
|
|
11279
|
+
var FieldsChildMemo = (0, import_react73.memo)(FieldsChild);
|
|
10996
11280
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
10997
11281
|
const overrides = useAppStore((s) => s.overrides);
|
|
10998
11282
|
const componentResolving = useAppStore((s) => {
|
|
@@ -11017,8 +11301,8 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
11017
11301
|
})
|
|
11018
11302
|
);
|
|
11019
11303
|
const isLoading = fieldsLoading || componentResolving;
|
|
11020
|
-
const Wrapper = (0,
|
|
11021
|
-
return /* @__PURE__ */ (0,
|
|
11304
|
+
const Wrapper = (0, import_react73.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
11305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
11022
11306
|
"form",
|
|
11023
11307
|
{
|
|
11024
11308
|
className: getClassName27({ wrapFields }),
|
|
@@ -11026,20 +11310,20 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
11026
11310
|
e.preventDefault();
|
|
11027
11311
|
},
|
|
11028
11312
|
children: [
|
|
11029
|
-
/* @__PURE__ */ (0,
|
|
11030
|
-
isLoading && /* @__PURE__ */ (0,
|
|
11313
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
11314
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: getClassName27("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: getClassName27("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loader, { size: 16 }) }) })
|
|
11031
11315
|
]
|
|
11032
11316
|
}
|
|
11033
11317
|
);
|
|
11034
11318
|
};
|
|
11035
|
-
var Fields = (0,
|
|
11319
|
+
var Fields = (0, import_react73.memo)(FieldsInternal);
|
|
11036
11320
|
|
|
11037
11321
|
// components/Puck/components/Components/index.tsx
|
|
11038
11322
|
init_react_import();
|
|
11039
11323
|
|
|
11040
11324
|
// lib/use-component-list.tsx
|
|
11041
11325
|
init_react_import();
|
|
11042
|
-
var
|
|
11326
|
+
var import_react75 = require("react");
|
|
11043
11327
|
|
|
11044
11328
|
// components/ComponentList/index.tsx
|
|
11045
11329
|
init_react_import();
|
|
@@ -11050,10 +11334,10 @@ var styles_module_default19 = { "ComponentList": "_ComponentList_1rrlt_1", "Comp
|
|
|
11050
11334
|
|
|
11051
11335
|
// components/ComponentList/index.tsx
|
|
11052
11336
|
init_get_class_name_factory();
|
|
11053
|
-
var
|
|
11337
|
+
var import_react74 = require("react");
|
|
11054
11338
|
init_store();
|
|
11055
11339
|
init_lucide_react();
|
|
11056
|
-
var
|
|
11340
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11057
11341
|
var getClassName28 = get_class_name_factory_default("ComponentList", styles_module_default19);
|
|
11058
11342
|
var ComponentListItem = ({
|
|
11059
11343
|
name,
|
|
@@ -11066,14 +11350,14 @@ var ComponentListItem = ({
|
|
|
11066
11350
|
type: name
|
|
11067
11351
|
}).insert
|
|
11068
11352
|
);
|
|
11069
|
-
(0,
|
|
11353
|
+
(0, import_react74.useEffect)(() => {
|
|
11070
11354
|
if (overrides.componentItem) {
|
|
11071
11355
|
console.warn(
|
|
11072
11356
|
"The `componentItem` override has been deprecated and renamed to `drawerItem`"
|
|
11073
11357
|
);
|
|
11074
11358
|
}
|
|
11075
11359
|
}, [overrides]);
|
|
11076
|
-
return /* @__PURE__ */ (0,
|
|
11360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
11077
11361
|
};
|
|
11078
11362
|
var ComponentList = ({
|
|
11079
11363
|
children,
|
|
@@ -11084,8 +11368,8 @@ var ComponentList = ({
|
|
|
11084
11368
|
const setUi = useAppStore((s) => s.setUi);
|
|
11085
11369
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
11086
11370
|
const { expanded = true } = componentList[id] || {};
|
|
11087
|
-
return /* @__PURE__ */ (0,
|
|
11088
|
-
title && /* @__PURE__ */ (0,
|
|
11371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: getClassName28({ isExpanded: expanded }), children: [
|
|
11372
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
11089
11373
|
"button",
|
|
11090
11374
|
{
|
|
11091
11375
|
type: "button",
|
|
@@ -11099,14 +11383,14 @@ var ComponentList = ({
|
|
|
11099
11383
|
}),
|
|
11100
11384
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
11101
11385
|
children: [
|
|
11102
|
-
/* @__PURE__ */ (0,
|
|
11103
|
-
/* @__PURE__ */ (0,
|
|
11386
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { children: title }),
|
|
11387
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getClassName28("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronDown, { size: 12 }) })
|
|
11104
11388
|
]
|
|
11105
11389
|
}
|
|
11106
11390
|
),
|
|
11107
|
-
/* @__PURE__ */ (0,
|
|
11391
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getClassName28("content"), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
11108
11392
|
var _a;
|
|
11109
|
-
return /* @__PURE__ */ (0,
|
|
11393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
11110
11394
|
ComponentListItem,
|
|
11111
11395
|
{
|
|
11112
11396
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -11121,12 +11405,12 @@ ComponentList.Item = ComponentListItem;
|
|
|
11121
11405
|
|
|
11122
11406
|
// lib/use-component-list.tsx
|
|
11123
11407
|
init_store();
|
|
11124
|
-
var
|
|
11408
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11125
11409
|
var useComponentList = () => {
|
|
11126
|
-
const [componentList, setComponentList] = (0,
|
|
11410
|
+
const [componentList, setComponentList] = (0, import_react75.useState)();
|
|
11127
11411
|
const config = useAppStore((s) => s.config);
|
|
11128
11412
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
11129
|
-
(0,
|
|
11413
|
+
(0, import_react75.useEffect)(() => {
|
|
11130
11414
|
var _a, _b, _c;
|
|
11131
11415
|
if (Object.keys(uiComponentList).length > 0) {
|
|
11132
11416
|
const matchedComponents = [];
|
|
@@ -11142,7 +11426,7 @@ var useComponentList = () => {
|
|
|
11142
11426
|
if (category.visible === false) {
|
|
11143
11427
|
return null;
|
|
11144
11428
|
}
|
|
11145
|
-
return /* @__PURE__ */ (0,
|
|
11429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11146
11430
|
ComponentList,
|
|
11147
11431
|
{
|
|
11148
11432
|
id: categoryKey,
|
|
@@ -11150,7 +11434,7 @@ var useComponentList = () => {
|
|
|
11150
11434
|
children: category.components.map((componentName, i) => {
|
|
11151
11435
|
var _a2;
|
|
11152
11436
|
const componentConf = config.components[componentName] || {};
|
|
11153
|
-
return /* @__PURE__ */ (0,
|
|
11437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11154
11438
|
ComponentList.Item,
|
|
11155
11439
|
{
|
|
11156
11440
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -11170,7 +11454,7 @@ var useComponentList = () => {
|
|
|
11170
11454
|
);
|
|
11171
11455
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
11172
11456
|
_componentList.push(
|
|
11173
|
-
/* @__PURE__ */ (0,
|
|
11457
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11174
11458
|
ComponentList,
|
|
11175
11459
|
{
|
|
11176
11460
|
id: "other",
|
|
@@ -11178,7 +11462,7 @@ var useComponentList = () => {
|
|
|
11178
11462
|
children: remainingComponents.map((componentName, i) => {
|
|
11179
11463
|
var _a2;
|
|
11180
11464
|
const componentConf = config.components[componentName] || {};
|
|
11181
|
-
return /* @__PURE__ */ (0,
|
|
11465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11182
11466
|
ComponentList.Item,
|
|
11183
11467
|
{
|
|
11184
11468
|
name: componentName,
|
|
@@ -11201,12 +11485,12 @@ var useComponentList = () => {
|
|
|
11201
11485
|
|
|
11202
11486
|
// components/Puck/components/Components/index.tsx
|
|
11203
11487
|
init_store();
|
|
11204
|
-
var
|
|
11205
|
-
var
|
|
11488
|
+
var import_react76 = require("react");
|
|
11489
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11206
11490
|
var Components = () => {
|
|
11207
11491
|
const overrides = useAppStore((s) => s.overrides);
|
|
11208
11492
|
const componentList = useComponentList();
|
|
11209
|
-
const Wrapper = (0,
|
|
11493
|
+
const Wrapper = (0, import_react76.useMemo)(() => {
|
|
11210
11494
|
if (overrides.components) {
|
|
11211
11495
|
console.warn(
|
|
11212
11496
|
"The `components` override has been deprecated and renamed to `drawer`"
|
|
@@ -11214,21 +11498,21 @@ var Components = () => {
|
|
|
11214
11498
|
}
|
|
11215
11499
|
return overrides.components || overrides.drawer || "div";
|
|
11216
11500
|
}, [overrides]);
|
|
11217
|
-
return /* @__PURE__ */ (0,
|
|
11501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ComponentList, { id: "all" }) });
|
|
11218
11502
|
};
|
|
11219
11503
|
|
|
11220
11504
|
// components/Puck/components/Preview/index.tsx
|
|
11221
11505
|
init_react_import();
|
|
11222
11506
|
init_root_droppable_id();
|
|
11223
|
-
var
|
|
11507
|
+
var import_react78 = require("react");
|
|
11224
11508
|
init_store();
|
|
11225
11509
|
|
|
11226
11510
|
// components/AutoFrame/index.tsx
|
|
11227
11511
|
init_react_import();
|
|
11228
|
-
var
|
|
11512
|
+
var import_react77 = require("react");
|
|
11229
11513
|
var import_object_hash = __toESM(require("object-hash"));
|
|
11230
11514
|
var import_react_dom3 = require("react-dom");
|
|
11231
|
-
var
|
|
11515
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11232
11516
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
11233
11517
|
var collectStyles = (doc) => {
|
|
11234
11518
|
const collected = [];
|
|
@@ -11278,7 +11562,7 @@ var CopyHostStyles = ({
|
|
|
11278
11562
|
onStylesLoaded = () => null
|
|
11279
11563
|
}) => {
|
|
11280
11564
|
const { document: doc, window: win } = useFrame();
|
|
11281
|
-
(0,
|
|
11565
|
+
(0, import_react77.useEffect)(() => {
|
|
11282
11566
|
if (!win || !doc) {
|
|
11283
11567
|
return () => {
|
|
11284
11568
|
};
|
|
@@ -11443,10 +11727,10 @@ var CopyHostStyles = ({
|
|
|
11443
11727
|
observer.disconnect();
|
|
11444
11728
|
};
|
|
11445
11729
|
}, []);
|
|
11446
|
-
return /* @__PURE__ */ (0,
|
|
11730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_jsx_runtime75.Fragment, { children });
|
|
11447
11731
|
};
|
|
11448
|
-
var autoFrameContext = (0,
|
|
11449
|
-
var useFrame = () => (0,
|
|
11732
|
+
var autoFrameContext = (0, import_react77.createContext)({});
|
|
11733
|
+
var useFrame = () => (0, import_react77.useContext)(autoFrameContext);
|
|
11450
11734
|
function AutoFrame(_a) {
|
|
11451
11735
|
var _b = _a, {
|
|
11452
11736
|
children,
|
|
@@ -11467,11 +11751,11 @@ function AutoFrame(_a) {
|
|
|
11467
11751
|
"onNotReady",
|
|
11468
11752
|
"frameRef"
|
|
11469
11753
|
]);
|
|
11470
|
-
const [loaded, setLoaded] = (0,
|
|
11471
|
-
const [ctx, setCtx] = (0,
|
|
11472
|
-
const [mountTarget, setMountTarget] = (0,
|
|
11473
|
-
const [stylesLoaded, setStylesLoaded] = (0,
|
|
11474
|
-
(0,
|
|
11754
|
+
const [loaded, setLoaded] = (0, import_react77.useState)(false);
|
|
11755
|
+
const [ctx, setCtx] = (0, import_react77.useState)({});
|
|
11756
|
+
const [mountTarget, setMountTarget] = (0, import_react77.useState)();
|
|
11757
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react77.useState)(false);
|
|
11758
|
+
(0, import_react77.useEffect)(() => {
|
|
11475
11759
|
var _a2;
|
|
11476
11760
|
if (frameRef.current) {
|
|
11477
11761
|
const doc = frameRef.current.contentDocument;
|
|
@@ -11490,7 +11774,7 @@ function AutoFrame(_a) {
|
|
|
11490
11774
|
}
|
|
11491
11775
|
}
|
|
11492
11776
|
}, [frameRef, loaded, stylesLoaded]);
|
|
11493
|
-
return /* @__PURE__ */ (0,
|
|
11777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11494
11778
|
"iframe",
|
|
11495
11779
|
__spreadProps(__spreadValues({}, props), {
|
|
11496
11780
|
className,
|
|
@@ -11500,7 +11784,7 @@ function AutoFrame(_a) {
|
|
|
11500
11784
|
onLoad: () => {
|
|
11501
11785
|
setLoaded(true);
|
|
11502
11786
|
},
|
|
11503
|
-
children: /* @__PURE__ */ (0,
|
|
11787
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
11504
11788
|
CopyHostStyles,
|
|
11505
11789
|
{
|
|
11506
11790
|
debug,
|
|
@@ -11520,11 +11804,11 @@ var styles_module_default20 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
|
|
|
11520
11804
|
|
|
11521
11805
|
// components/Puck/components/Preview/index.tsx
|
|
11522
11806
|
init_lib();
|
|
11523
|
-
var
|
|
11807
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11524
11808
|
var getClassName29 = get_class_name_factory_default("PuckPreview", styles_module_default20);
|
|
11525
11809
|
var useBubbleIframeEvents = (ref) => {
|
|
11526
11810
|
const status = useAppStore((s) => s.status);
|
|
11527
|
-
(0,
|
|
11811
|
+
(0, import_react78.useEffect)(() => {
|
|
11528
11812
|
if (ref.current && status === "READY") {
|
|
11529
11813
|
const iframe = ref.current;
|
|
11530
11814
|
const handlePointerMove = (event) => {
|
|
@@ -11573,7 +11857,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11573
11857
|
const renderData = useAppStore(
|
|
11574
11858
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
11575
11859
|
);
|
|
11576
|
-
const Page = (0,
|
|
11860
|
+
const Page = (0, import_react78.useCallback)(
|
|
11577
11861
|
(pageProps) => {
|
|
11578
11862
|
var _a, _b, _c, _d;
|
|
11579
11863
|
const propsWithSlots = useSlots(
|
|
@@ -11587,15 +11871,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11587
11871
|
);
|
|
11588
11872
|
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
|
|
11589
11873
|
id: "puck-root"
|
|
11590
|
-
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ (0,
|
|
11874
|
+
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children: propsWithSlots.children });
|
|
11591
11875
|
},
|
|
11592
11876
|
[config]
|
|
11593
11877
|
);
|
|
11594
|
-
const Frame = (0,
|
|
11878
|
+
const Frame = (0, import_react78.useMemo)(() => overrides.iframe, [overrides]);
|
|
11595
11879
|
const rootProps = root.props || root;
|
|
11596
|
-
const ref = (0,
|
|
11880
|
+
const ref = (0, import_react78.useRef)(null);
|
|
11597
11881
|
useBubbleIframeEvents(ref);
|
|
11598
|
-
const inner = !renderData ? /* @__PURE__ */ (0,
|
|
11882
|
+
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11599
11883
|
Page,
|
|
11600
11884
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
11601
11885
|
puck: {
|
|
@@ -11605,15 +11889,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11605
11889
|
metadata
|
|
11606
11890
|
},
|
|
11607
11891
|
editMode: true,
|
|
11608
|
-
children: /* @__PURE__ */ (0,
|
|
11892
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DropZonePure, { zone: rootDroppableId })
|
|
11609
11893
|
})
|
|
11610
|
-
) : /* @__PURE__ */ (0,
|
|
11611
|
-
(0,
|
|
11894
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Render, { data: renderData, config, metadata });
|
|
11895
|
+
(0, import_react78.useEffect)(() => {
|
|
11612
11896
|
if (!iframe.enabled) {
|
|
11613
11897
|
setStatus("READY");
|
|
11614
11898
|
}
|
|
11615
11899
|
}, [iframe.enabled]);
|
|
11616
|
-
return /* @__PURE__ */ (0,
|
|
11900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11617
11901
|
"div",
|
|
11618
11902
|
{
|
|
11619
11903
|
className: getClassName29(),
|
|
@@ -11625,7 +11909,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11625
11909
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
11626
11910
|
}
|
|
11627
11911
|
},
|
|
11628
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
|
11912
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11629
11913
|
AutoFrame_default,
|
|
11630
11914
|
{
|
|
11631
11915
|
id: "preview-frame",
|
|
@@ -11638,14 +11922,14 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
11638
11922
|
setStatus("MOUNTED");
|
|
11639
11923
|
},
|
|
11640
11924
|
frameRef: ref,
|
|
11641
|
-
children: /* @__PURE__ */ (0,
|
|
11925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
11642
11926
|
if (Frame) {
|
|
11643
|
-
return /* @__PURE__ */ (0,
|
|
11927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Frame, { document: document2, children: inner });
|
|
11644
11928
|
}
|
|
11645
11929
|
return inner;
|
|
11646
11930
|
} })
|
|
11647
11931
|
}
|
|
11648
|
-
) : /* @__PURE__ */ (0,
|
|
11932
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11649
11933
|
"div",
|
|
11650
11934
|
{
|
|
11651
11935
|
id: "preview-frame",
|
|
@@ -11671,103 +11955,154 @@ var styles_module_default21 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zo
|
|
|
11671
11955
|
|
|
11672
11956
|
// components/LayerTree/index.tsx
|
|
11673
11957
|
init_get_class_name_factory();
|
|
11674
|
-
|
|
11675
|
-
// lib/scroll-into-view.ts
|
|
11676
|
-
init_react_import();
|
|
11677
|
-
var scrollIntoView = (el) => {
|
|
11678
|
-
const oldStyle = __spreadValues({}, el.style);
|
|
11679
|
-
el.style.scrollMargin = "256px";
|
|
11680
|
-
if (el) {
|
|
11681
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
11682
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
11683
|
-
}
|
|
11684
|
-
};
|
|
11685
|
-
|
|
11686
|
-
// components/LayerTree/index.tsx
|
|
11687
11958
|
init_lucide_react();
|
|
11688
11959
|
init_root_droppable_id();
|
|
11689
|
-
var
|
|
11690
|
-
|
|
11691
|
-
// lib/on-scroll-end.ts
|
|
11692
|
-
init_react_import();
|
|
11693
|
-
var onScrollEnd = (frame, cb) => {
|
|
11694
|
-
let scrollTimeout;
|
|
11695
|
-
const callback = function() {
|
|
11696
|
-
clearTimeout(scrollTimeout);
|
|
11697
|
-
scrollTimeout = setTimeout(function() {
|
|
11698
|
-
cb();
|
|
11699
|
-
frame == null ? void 0 : frame.removeEventListener("scroll", callback);
|
|
11700
|
-
}, 50);
|
|
11701
|
-
};
|
|
11702
|
-
frame == null ? void 0 : frame.addEventListener("scroll", callback);
|
|
11703
|
-
setTimeout(() => {
|
|
11704
|
-
if (!scrollTimeout) {
|
|
11705
|
-
cb();
|
|
11706
|
-
}
|
|
11707
|
-
}, 50);
|
|
11708
|
-
};
|
|
11709
|
-
|
|
11710
|
-
// components/LayerTree/index.tsx
|
|
11960
|
+
var import_react79 = require("react");
|
|
11711
11961
|
init_store();
|
|
11712
|
-
var
|
|
11713
|
-
var
|
|
11962
|
+
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
11963
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11714
11964
|
var getClassName30 = get_class_name_factory_default("LayerTree", styles_module_default21);
|
|
11715
11965
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default21);
|
|
11716
|
-
var
|
|
11717
|
-
|
|
11966
|
+
var DEFAULT_LAYER_ROW_HEIGHT = 32;
|
|
11967
|
+
var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
|
|
11968
|
+
var MIN_VIRTUALIZED_LAYER_COUNT = 25;
|
|
11969
|
+
var measuredRowHeights = /* @__PURE__ */ new Map();
|
|
11970
|
+
var getZonesByParent = (zones) => {
|
|
11971
|
+
return Object.keys(zones).reduce((acc, zone) => {
|
|
11972
|
+
const [parentId] = zone.split(":");
|
|
11973
|
+
acc[parentId] = [...acc[parentId] || [], zone];
|
|
11974
|
+
return acc;
|
|
11975
|
+
}, {});
|
|
11976
|
+
};
|
|
11977
|
+
var getZoneLabel = (zoneCompound, nodes, config, label) => {
|
|
11978
|
+
var _a, _b, _c, _d;
|
|
11979
|
+
if (label !== void 0) {
|
|
11980
|
+
return label;
|
|
11981
|
+
}
|
|
11982
|
+
const [componentId, slotId] = zoneCompound.split(":");
|
|
11983
|
+
if (!slotId) {
|
|
11984
|
+
return;
|
|
11985
|
+
}
|
|
11986
|
+
const componentType = (_a = nodes[componentId]) == null ? void 0 : _a.data.type;
|
|
11987
|
+
const configForComponent = componentType && componentType !== rootAreaId ? config.components[componentType] : config.root;
|
|
11988
|
+
return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
|
|
11989
|
+
};
|
|
11990
|
+
var buildLayerNode = ({
|
|
11991
|
+
config,
|
|
11718
11992
|
itemId,
|
|
11719
|
-
|
|
11993
|
+
index,
|
|
11994
|
+
nodes,
|
|
11995
|
+
zoneCompound,
|
|
11996
|
+
zones,
|
|
11997
|
+
zonesByParent
|
|
11720
11998
|
}) => {
|
|
11999
|
+
var _a, _b, _c;
|
|
12000
|
+
const nodeData = nodes[itemId];
|
|
12001
|
+
const componentType = ((_a = nodeData == null ? void 0 : nodeData.data.type) == null ? void 0 : _a.toString()) || "Component";
|
|
12002
|
+
const label = (_c = (_b = config.components[componentType]) == null ? void 0 : _b.label) != null ? _c : componentType;
|
|
12003
|
+
const childZoneCompounds = zonesByParent[itemId] || [];
|
|
12004
|
+
return {
|
|
12005
|
+
childZones: childZoneCompounds.map(
|
|
12006
|
+
(childZoneCompound) => buildLayerTree({
|
|
12007
|
+
config,
|
|
12008
|
+
nodes,
|
|
12009
|
+
zoneCompound: childZoneCompound,
|
|
12010
|
+
zones,
|
|
12011
|
+
zonesByParent
|
|
12012
|
+
})
|
|
12013
|
+
),
|
|
12014
|
+
componentType,
|
|
12015
|
+
index,
|
|
12016
|
+
itemId,
|
|
12017
|
+
label,
|
|
12018
|
+
zoneCompound
|
|
12019
|
+
};
|
|
12020
|
+
};
|
|
12021
|
+
var buildLayerTree = ({
|
|
12022
|
+
config,
|
|
12023
|
+
label,
|
|
12024
|
+
nodes,
|
|
12025
|
+
zoneCompound,
|
|
12026
|
+
zones,
|
|
12027
|
+
zonesByParent = getZonesByParent(zones)
|
|
12028
|
+
}) => {
|
|
12029
|
+
var _a, _b;
|
|
12030
|
+
const contentIds = (_b = (_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
12031
|
+
return {
|
|
12032
|
+
items: contentIds.map(
|
|
12033
|
+
(itemId, index) => buildLayerNode({
|
|
12034
|
+
config,
|
|
12035
|
+
itemId,
|
|
12036
|
+
index,
|
|
12037
|
+
nodes,
|
|
12038
|
+
zoneCompound,
|
|
12039
|
+
zones,
|
|
12040
|
+
zonesByParent
|
|
12041
|
+
})
|
|
12042
|
+
),
|
|
12043
|
+
label: getZoneLabel(zoneCompound, nodes, config, label),
|
|
12044
|
+
zoneCompound
|
|
12045
|
+
};
|
|
12046
|
+
};
|
|
12047
|
+
var getEstimatedRowHeight = (itemId) => {
|
|
11721
12048
|
var _a;
|
|
11722
|
-
|
|
11723
|
-
|
|
12049
|
+
return (_a = measuredRowHeights.get(itemId)) != null ? _a : DEFAULT_LAYER_ROW_HEIGHT;
|
|
12050
|
+
};
|
|
12051
|
+
var cacheMeasuredRowHeight = (itemId, height) => {
|
|
12052
|
+
if (height <= 0) {
|
|
12053
|
+
return;
|
|
12054
|
+
}
|
|
12055
|
+
measuredRowHeights.set(itemId, height);
|
|
12056
|
+
};
|
|
12057
|
+
var getScrollParent = (el) => {
|
|
12058
|
+
var _a;
|
|
12059
|
+
let current = (_a = el == null ? void 0 : el.parentElement) != null ? _a : null;
|
|
12060
|
+
while (current) {
|
|
12061
|
+
const { overflow, overflowY } = getComputedStyle(current);
|
|
12062
|
+
if ([overflow, overflowY].some((value) => /auto|scroll/.test(value))) {
|
|
12063
|
+
return current;
|
|
12064
|
+
}
|
|
12065
|
+
current = current.parentElement;
|
|
12066
|
+
}
|
|
12067
|
+
return null;
|
|
12068
|
+
};
|
|
12069
|
+
var Layer = (0, import_react79.forwardRef)(function Layer2({
|
|
12070
|
+
childIsSelected,
|
|
12071
|
+
dataIndex,
|
|
12072
|
+
depth,
|
|
12073
|
+
isSelected,
|
|
12074
|
+
node,
|
|
12075
|
+
selectedId,
|
|
12076
|
+
selectedPathIds
|
|
12077
|
+
}, ref) {
|
|
11724
12078
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
11725
|
-
const
|
|
11726
|
-
(itemSelector2) => {
|
|
11727
|
-
dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
|
|
11728
|
-
},
|
|
11729
|
-
[dispatch]
|
|
11730
|
-
);
|
|
11731
|
-
const selecedItemId = useAppStore((s) => {
|
|
11732
|
-
var _a2;
|
|
11733
|
-
return (_a2 = s.selectedItem) == null ? void 0 : _a2.props.id;
|
|
11734
|
-
});
|
|
11735
|
-
const isSelected = selecedItemId === itemId || itemSelector && itemSelector.zone === rootDroppableId && !zoneCompound;
|
|
11736
|
-
const nodeData = useAppStore((s) => s.state.indexes.nodes[itemId]);
|
|
11737
|
-
const zonesForItem = useAppStore(
|
|
11738
|
-
(0, import_shallow8.useShallow)(
|
|
11739
|
-
(s) => Object.keys(s.state.indexes.zones).filter(
|
|
11740
|
-
(z) => z.split(":")[0] === itemId
|
|
11741
|
-
)
|
|
11742
|
-
)
|
|
11743
|
-
);
|
|
11744
|
-
const containsZone = zonesForItem.length > 0;
|
|
11745
|
-
const zoneStore = (0, import_react78.useContext)(ZoneStoreContext);
|
|
12079
|
+
const zoneStore = (0, import_react79.useContext)(ZoneStoreContext);
|
|
11746
12080
|
const isHovering = useContextStore(
|
|
11747
12081
|
ZoneStoreContext,
|
|
11748
|
-
(s) => s.hoveringComponent === itemId
|
|
12082
|
+
(s) => s.hoveringComponent === node.itemId
|
|
11749
12083
|
);
|
|
11750
|
-
const
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
|
11760
|
-
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
12084
|
+
const containsZone = node.childZones.length > 0;
|
|
12085
|
+
const setItemSelector = (0, import_react79.useCallback)(
|
|
12086
|
+
(itemSelector) => {
|
|
12087
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
12088
|
+
},
|
|
12089
|
+
[dispatch]
|
|
12090
|
+
);
|
|
12091
|
+
const shouldRenderChildren = isSelected || childIsSelected;
|
|
12092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
11761
12093
|
"li",
|
|
11762
12094
|
{
|
|
12095
|
+
ref,
|
|
11763
12096
|
className: getClassNameLayer({
|
|
11764
|
-
|
|
11765
|
-
isHovering,
|
|
12097
|
+
childIsSelected,
|
|
11766
12098
|
containsZone,
|
|
11767
|
-
|
|
12099
|
+
isHovering,
|
|
12100
|
+
isSelected
|
|
11768
12101
|
}),
|
|
12102
|
+
"data-index": dataIndex,
|
|
12103
|
+
"data-puck-layer-tree-id": node.itemId,
|
|
11769
12104
|
children: [
|
|
11770
|
-
/* @__PURE__ */ (0,
|
|
12105
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
11771
12106
|
"button",
|
|
11772
12107
|
{
|
|
11773
12108
|
type: "button",
|
|
@@ -11777,100 +12112,208 @@ var Layer = ({
|
|
|
11777
12112
|
setItemSelector(null);
|
|
11778
12113
|
return;
|
|
11779
12114
|
}
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
);
|
|
11784
|
-
if (!el) {
|
|
11785
|
-
setItemSelector({
|
|
11786
|
-
index,
|
|
11787
|
-
zone: zoneCompound
|
|
11788
|
-
});
|
|
11789
|
-
return;
|
|
11790
|
-
}
|
|
11791
|
-
scrollIntoView(el);
|
|
11792
|
-
onScrollEnd(frame, () => {
|
|
11793
|
-
setItemSelector({
|
|
11794
|
-
index,
|
|
11795
|
-
zone: zoneCompound
|
|
11796
|
-
});
|
|
12115
|
+
setItemSelector({
|
|
12116
|
+
index: node.index,
|
|
12117
|
+
zone: node.zoneCompound
|
|
11797
12118
|
});
|
|
12119
|
+
zoneStore.getState().scrollToComponent(node.itemId);
|
|
11798
12120
|
},
|
|
11799
12121
|
onMouseEnter: (e) => {
|
|
11800
12122
|
e.stopPropagation();
|
|
11801
|
-
zoneStore.setState({ hoveringComponent: itemId });
|
|
12123
|
+
zoneStore.setState({ hoveringComponent: node.itemId });
|
|
11802
12124
|
},
|
|
11803
12125
|
onMouseLeave: (e) => {
|
|
11804
12126
|
e.stopPropagation();
|
|
11805
12127
|
zoneStore.setState({ hoveringComponent: null });
|
|
11806
12128
|
},
|
|
11807
12129
|
children: [
|
|
11808
|
-
containsZone && /* @__PURE__ */ (0,
|
|
12130
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
11809
12131
|
"div",
|
|
11810
12132
|
{
|
|
11811
12133
|
className: getClassNameLayer("chevron"),
|
|
11812
12134
|
title: isSelected ? "Collapse" : "Expand",
|
|
11813
|
-
children: /* @__PURE__ */ (0,
|
|
12135
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ChevronDown, { size: "12" })
|
|
11814
12136
|
}
|
|
11815
12137
|
),
|
|
11816
|
-
/* @__PURE__ */ (0,
|
|
11817
|
-
/* @__PURE__ */ (0,
|
|
11818
|
-
/* @__PURE__ */ (0,
|
|
12138
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
|
12139
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassNameLayer("icon"), children: node.componentType === "Text" || node.componentType === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(LayoutGrid, { size: "16" }) }),
|
|
12140
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassNameLayer("name"), children: node.label })
|
|
11819
12141
|
] })
|
|
11820
12142
|
]
|
|
11821
12143
|
}
|
|
11822
12144
|
) }),
|
|
11823
|
-
containsZone &&
|
|
12145
|
+
containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12146
|
+
"div",
|
|
12147
|
+
{
|
|
12148
|
+
className: getClassNameLayer("zones"),
|
|
12149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12150
|
+
LayerTreeZone,
|
|
12151
|
+
{
|
|
12152
|
+
depth: depth + 1,
|
|
12153
|
+
selectedId,
|
|
12154
|
+
selectedPathIds,
|
|
12155
|
+
tree: childZone
|
|
12156
|
+
}
|
|
12157
|
+
)
|
|
12158
|
+
},
|
|
12159
|
+
childZone.zoneCompound
|
|
12160
|
+
))
|
|
11824
12161
|
]
|
|
11825
12162
|
}
|
|
11826
12163
|
);
|
|
11827
|
-
};
|
|
11828
|
-
var
|
|
11829
|
-
|
|
11830
|
-
|
|
12164
|
+
});
|
|
12165
|
+
var LayerTreeZone = ({
|
|
12166
|
+
depth,
|
|
12167
|
+
selectedId,
|
|
12168
|
+
selectedPathIds,
|
|
12169
|
+
tree
|
|
11831
12170
|
}) => {
|
|
11832
|
-
const
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
12171
|
+
const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
|
|
12172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
12173
|
+
tree.label && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: getClassName30("zoneTitle"), children: [
|
|
12174
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassName30("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Layers, { size: "16" }) }),
|
|
12175
|
+
tree.label
|
|
12176
|
+
] }),
|
|
12177
|
+
shouldVirtualize ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12178
|
+
VirtualizedLayerTreeItems,
|
|
12179
|
+
{
|
|
12180
|
+
depth,
|
|
12181
|
+
selectedId,
|
|
12182
|
+
selectedPathIds,
|
|
12183
|
+
tree
|
|
12184
|
+
}
|
|
12185
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12186
|
+
StaticLayerTreeItems,
|
|
12187
|
+
{
|
|
12188
|
+
depth,
|
|
12189
|
+
selectedId,
|
|
12190
|
+
selectedPathIds,
|
|
12191
|
+
tree
|
|
11846
12192
|
}
|
|
11847
12193
|
)
|
|
11848
|
-
);
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
12194
|
+
] });
|
|
12195
|
+
};
|
|
12196
|
+
var StaticLayerTreeItems = ({
|
|
12197
|
+
depth,
|
|
12198
|
+
selectedId,
|
|
12199
|
+
selectedPathIds,
|
|
12200
|
+
tree
|
|
12201
|
+
}) => {
|
|
12202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("ul", { className: getClassName30(), children: [
|
|
12203
|
+
tree.items.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassName30("helper"), children: "No items" }),
|
|
12204
|
+
tree.items.map((node) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12205
|
+
Layer,
|
|
12206
|
+
{
|
|
12207
|
+
childIsSelected: selectedPathIds.has(node.itemId),
|
|
12208
|
+
depth,
|
|
12209
|
+
isSelected: selectedId === node.itemId,
|
|
12210
|
+
node,
|
|
12211
|
+
selectedId,
|
|
12212
|
+
selectedPathIds
|
|
12213
|
+
},
|
|
12214
|
+
node.itemId
|
|
12215
|
+
))
|
|
12216
|
+
] });
|
|
12217
|
+
};
|
|
12218
|
+
var VirtualizedLayerTreeItems = ({
|
|
12219
|
+
depth,
|
|
12220
|
+
selectedId,
|
|
12221
|
+
selectedPathIds,
|
|
12222
|
+
tree
|
|
12223
|
+
}) => {
|
|
12224
|
+
const listRef = (0, import_react79.useRef)(null);
|
|
12225
|
+
const virtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
12226
|
+
count: tree.items.length,
|
|
12227
|
+
estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
|
|
12228
|
+
getItemKey: (index) => tree.items[index].itemId,
|
|
12229
|
+
getScrollElement: () => getScrollParent(listRef.current),
|
|
12230
|
+
overscan: LAYER_TREE_VIRTUALIZATION_OVERSCAN,
|
|
12231
|
+
measureElement: (element) => {
|
|
12232
|
+
const height = Math.ceil(element.getBoundingClientRect().height);
|
|
12233
|
+
const itemId = element.dataset.puckLayerTreeId;
|
|
12234
|
+
if (itemId) {
|
|
12235
|
+
cacheMeasuredRowHeight(itemId, height);
|
|
12236
|
+
}
|
|
12237
|
+
return height || DEFAULT_LAYER_ROW_HEIGHT;
|
|
12238
|
+
}
|
|
12239
|
+
});
|
|
12240
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
12241
|
+
const totalSize = virtualizer.getTotalSize();
|
|
12242
|
+
const renderedItems = [];
|
|
12243
|
+
let previousEnd = 0;
|
|
12244
|
+
let previousIndex = -1;
|
|
12245
|
+
virtualItems.forEach((virtualItem) => {
|
|
12246
|
+
const node = tree.items[virtualItem.index];
|
|
12247
|
+
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
12248
|
+
if (gapSize > 0) {
|
|
12249
|
+
renderedItems.push(
|
|
12250
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12251
|
+
"li",
|
|
11859
12252
|
{
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
zoneCompound
|
|
12253
|
+
"aria-hidden": "true",
|
|
12254
|
+
style: { height: `${gapSize}px` }
|
|
11863
12255
|
},
|
|
11864
|
-
|
|
11865
|
-
)
|
|
11866
|
-
|
|
11867
|
-
|
|
12256
|
+
`gap:${tree.zoneCompound}:${previousIndex}:${virtualItem.index}`
|
|
12257
|
+
)
|
|
12258
|
+
);
|
|
12259
|
+
}
|
|
12260
|
+
renderedItems.push(
|
|
12261
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12262
|
+
Layer,
|
|
12263
|
+
{
|
|
12264
|
+
childIsSelected: selectedPathIds.has(node.itemId),
|
|
12265
|
+
dataIndex: virtualItem.index,
|
|
12266
|
+
depth,
|
|
12267
|
+
isSelected: selectedId === node.itemId,
|
|
12268
|
+
node,
|
|
12269
|
+
ref: virtualizer.measureElement,
|
|
12270
|
+
selectedId,
|
|
12271
|
+
selectedPathIds
|
|
12272
|
+
},
|
|
12273
|
+
node.itemId
|
|
12274
|
+
)
|
|
12275
|
+
);
|
|
12276
|
+
previousEnd = virtualItem.end;
|
|
12277
|
+
previousIndex = virtualItem.index;
|
|
12278
|
+
});
|
|
12279
|
+
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
12280
|
+
if (trailingGap > 0) {
|
|
12281
|
+
renderedItems.push(
|
|
12282
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12283
|
+
"li",
|
|
12284
|
+
{
|
|
12285
|
+
"aria-hidden": "true",
|
|
12286
|
+
style: { height: `${trailingGap}px` }
|
|
12287
|
+
},
|
|
12288
|
+
`gap:${tree.zoneCompound}:${previousIndex}:end`
|
|
12289
|
+
)
|
|
12290
|
+
);
|
|
12291
|
+
}
|
|
12292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("ul", { className: getClassName30(), ref: listRef, children: [
|
|
12293
|
+
tree.items.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: getClassName30("helper"), children: "No items" }),
|
|
12294
|
+
renderedItems
|
|
11868
12295
|
] });
|
|
11869
12296
|
};
|
|
12297
|
+
var LayerTree = ({
|
|
12298
|
+
selectedId,
|
|
12299
|
+
selectedPathIds,
|
|
12300
|
+
trees
|
|
12301
|
+
}) => {
|
|
12302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: trees.map((tree) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12303
|
+
LayerTreeZone,
|
|
12304
|
+
{
|
|
12305
|
+
depth: 0,
|
|
12306
|
+
selectedId,
|
|
12307
|
+
selectedPathIds,
|
|
12308
|
+
tree
|
|
12309
|
+
},
|
|
12310
|
+
tree.zoneCompound
|
|
12311
|
+
)) });
|
|
12312
|
+
};
|
|
11870
12313
|
|
|
11871
12314
|
// components/Puck/components/Outline/index.tsx
|
|
11872
12315
|
init_store();
|
|
11873
|
-
var
|
|
12316
|
+
var import_react80 = require("react");
|
|
11874
12317
|
|
|
11875
12318
|
// lib/data/find-zones-for-area.ts
|
|
11876
12319
|
init_react_import();
|
|
@@ -11881,22 +12324,48 @@ var findZonesForArea = (state, area) => {
|
|
|
11881
12324
|
};
|
|
11882
12325
|
|
|
11883
12326
|
// components/Puck/components/Outline/index.tsx
|
|
11884
|
-
var
|
|
11885
|
-
var
|
|
12327
|
+
var import_shallow8 = require("zustand/react/shallow");
|
|
12328
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11886
12329
|
var Outline = () => {
|
|
11887
12330
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
12331
|
+
const config = useAppStore((s) => s.config);
|
|
12332
|
+
const nodes = useAppStore((s) => s.state.indexes.nodes);
|
|
12333
|
+
const zones = useAppStore((s) => s.state.indexes.zones);
|
|
12334
|
+
const selectedId = useAppStore((s) => {
|
|
12335
|
+
var _a;
|
|
12336
|
+
return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) || null;
|
|
12337
|
+
});
|
|
11888
12338
|
const rootZones = useAppStore(
|
|
11889
|
-
(0,
|
|
12339
|
+
(0, import_shallow8.useShallow)((s) => findZonesForArea(s.state, "root"))
|
|
12340
|
+
);
|
|
12341
|
+
const selectedPathIds = (0, import_react80.useMemo)(() => {
|
|
12342
|
+
var _a;
|
|
12343
|
+
const selectedPath = selectedId ? (_a = nodes[selectedId]) == null ? void 0 : _a.path : null;
|
|
12344
|
+
return new Set(
|
|
12345
|
+
(selectedPath == null ? void 0 : selectedPath.map((candidate) => candidate.split(":")[0]).filter(Boolean)) || []
|
|
12346
|
+
);
|
|
12347
|
+
}, [nodes, selectedId]);
|
|
12348
|
+
const trees = (0, import_react80.useMemo)(
|
|
12349
|
+
() => rootZones.map(
|
|
12350
|
+
(zoneCompound) => buildLayerTree({
|
|
12351
|
+
config,
|
|
12352
|
+
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
12353
|
+
nodes,
|
|
12354
|
+
zoneCompound,
|
|
12355
|
+
zones
|
|
12356
|
+
})
|
|
12357
|
+
),
|
|
12358
|
+
[config, nodes, rootZones, zones]
|
|
11890
12359
|
);
|
|
11891
|
-
const Wrapper = (0,
|
|
11892
|
-
return /* @__PURE__ */ (0,
|
|
12360
|
+
const Wrapper = (0, import_react80.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
|
12361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11893
12362
|
LayerTree,
|
|
11894
12363
|
{
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
)
|
|
12364
|
+
selectedId,
|
|
12365
|
+
selectedPathIds,
|
|
12366
|
+
trees
|
|
12367
|
+
}
|
|
12368
|
+
) });
|
|
11900
12369
|
};
|
|
11901
12370
|
|
|
11902
12371
|
// components/Puck/index.tsx
|
|
@@ -11904,7 +12373,7 @@ init_default_viewports();
|
|
|
11904
12373
|
|
|
11905
12374
|
// lib/use-loaded-overrides.ts
|
|
11906
12375
|
init_react_import();
|
|
11907
|
-
var
|
|
12376
|
+
var import_react81 = require("react");
|
|
11908
12377
|
|
|
11909
12378
|
// lib/load-overrides.ts
|
|
11910
12379
|
init_react_import();
|
|
@@ -11946,7 +12415,7 @@ var useLoadedOverrides = ({
|
|
|
11946
12415
|
overrides,
|
|
11947
12416
|
plugins
|
|
11948
12417
|
}) => {
|
|
11949
|
-
return (0,
|
|
12418
|
+
return (0, import_react81.useMemo)(() => {
|
|
11950
12419
|
return loadOverrides({ overrides, plugins });
|
|
11951
12420
|
}, [plugins, overrides]);
|
|
11952
12421
|
};
|
|
@@ -11957,7 +12426,7 @@ init_permissions();
|
|
|
11957
12426
|
|
|
11958
12427
|
// lib/use-puck.ts
|
|
11959
12428
|
init_react_import();
|
|
11960
|
-
var
|
|
12429
|
+
var import_react82 = require("react");
|
|
11961
12430
|
var import_zustand7 = require("zustand");
|
|
11962
12431
|
init_make_state_public();
|
|
11963
12432
|
init_get_item();
|
|
@@ -12067,7 +12536,7 @@ var generateUsePuck = (store, getState) => {
|
|
|
12067
12536
|
};
|
|
12068
12537
|
return storeData;
|
|
12069
12538
|
};
|
|
12070
|
-
var UsePuckStoreContext = (0,
|
|
12539
|
+
var UsePuckStoreContext = (0, import_react82.createContext)(
|
|
12071
12540
|
null
|
|
12072
12541
|
);
|
|
12073
12542
|
var convertToPickedStore = (store) => {
|
|
@@ -12081,7 +12550,7 @@ var convertToPickedStore = (store) => {
|
|
|
12081
12550
|
};
|
|
12082
12551
|
};
|
|
12083
12552
|
var useRegisterUsePuckStore = (appStore) => {
|
|
12084
|
-
const [usePuckStore] = (0,
|
|
12553
|
+
const [usePuckStore] = (0, import_react82.useState)(
|
|
12085
12554
|
() => (0, import_zustand7.createStore)(
|
|
12086
12555
|
() => generateUsePuck(
|
|
12087
12556
|
convertToPickedStore(appStore.getState()),
|
|
@@ -12089,7 +12558,7 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
|
12089
12558
|
)
|
|
12090
12559
|
)
|
|
12091
12560
|
);
|
|
12092
|
-
(0,
|
|
12561
|
+
(0, import_react82.useEffect)(() => {
|
|
12093
12562
|
return appStore.subscribe(
|
|
12094
12563
|
(store) => convertToPickedStore(store),
|
|
12095
12564
|
(pickedStore) => {
|
|
@@ -12101,7 +12570,7 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
|
12101
12570
|
};
|
|
12102
12571
|
function createUsePuck() {
|
|
12103
12572
|
return function usePuck2(selector) {
|
|
12104
|
-
const usePuckApi = (0,
|
|
12573
|
+
const usePuckApi = (0, import_react82.useContext)(UsePuckStoreContext);
|
|
12105
12574
|
if (!usePuckApi) {
|
|
12106
12575
|
throw new Error("usePuck must be used inside <Puck>.");
|
|
12107
12576
|
}
|
|
@@ -12113,7 +12582,7 @@ function createUsePuck() {
|
|
|
12113
12582
|
};
|
|
12114
12583
|
}
|
|
12115
12584
|
function usePuck() {
|
|
12116
|
-
(0,
|
|
12585
|
+
(0, import_react82.useEffect)(() => {
|
|
12117
12586
|
console.warn(
|
|
12118
12587
|
"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."
|
|
12119
12588
|
);
|
|
@@ -12121,7 +12590,7 @@ function usePuck() {
|
|
|
12121
12590
|
return createUsePuck()((s) => s);
|
|
12122
12591
|
}
|
|
12123
12592
|
function useGetPuck() {
|
|
12124
|
-
const usePuckApi = (0,
|
|
12593
|
+
const usePuckApi = (0, import_react82.useContext)(UsePuckStoreContext);
|
|
12125
12594
|
if (!usePuckApi) {
|
|
12126
12595
|
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
12127
12596
|
}
|
|
@@ -12136,7 +12605,7 @@ init_to_component();
|
|
|
12136
12605
|
|
|
12137
12606
|
// components/Puck/components/Layout/index.tsx
|
|
12138
12607
|
init_react_import();
|
|
12139
|
-
var
|
|
12608
|
+
var import_react93 = require("react");
|
|
12140
12609
|
init_lib();
|
|
12141
12610
|
|
|
12142
12611
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
|
|
@@ -12145,14 +12614,14 @@ var styles_module_default22 = { "Puck": "_Puck_1dd16_19", "Puck-portal": "_Puck-
|
|
|
12145
12614
|
|
|
12146
12615
|
// lib/use-inject-css.ts
|
|
12147
12616
|
init_react_import();
|
|
12148
|
-
var
|
|
12617
|
+
var import_react83 = require("react");
|
|
12149
12618
|
var styles = ``;
|
|
12150
12619
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
12151
|
-
const [el, setEl] = (0,
|
|
12152
|
-
(0,
|
|
12620
|
+
const [el, setEl] = (0, import_react83.useState)();
|
|
12621
|
+
(0, import_react83.useEffect)(() => {
|
|
12153
12622
|
setEl(document.createElement("style"));
|
|
12154
12623
|
}, []);
|
|
12155
|
-
(0,
|
|
12624
|
+
(0, import_react83.useEffect)(() => {
|
|
12156
12625
|
var _a;
|
|
12157
12626
|
if (!el || typeof window === "undefined") {
|
|
12158
12627
|
return;
|
|
@@ -12175,20 +12644,20 @@ init_store();
|
|
|
12175
12644
|
|
|
12176
12645
|
// components/DefaultOverride/index.tsx
|
|
12177
12646
|
init_react_import();
|
|
12178
|
-
var
|
|
12179
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
|
12647
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
12648
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, { children });
|
|
12180
12649
|
|
|
12181
12650
|
// components/Puck/components/Layout/index.tsx
|
|
12182
12651
|
init_use_hotkey();
|
|
12183
12652
|
|
|
12184
12653
|
// lib/use-preview-mode-hotkeys.ts
|
|
12185
12654
|
init_react_import();
|
|
12186
|
-
var
|
|
12655
|
+
var import_react84 = require("react");
|
|
12187
12656
|
init_use_hotkey();
|
|
12188
12657
|
init_store();
|
|
12189
12658
|
var usePreviewModeHotkeys = () => {
|
|
12190
12659
|
const appStore = useAppStoreApi();
|
|
12191
|
-
const toggleInteractive = (0,
|
|
12660
|
+
const toggleInteractive = (0, import_react84.useCallback)(() => {
|
|
12192
12661
|
const dispatch = appStore.getState().dispatch;
|
|
12193
12662
|
dispatch({
|
|
12194
12663
|
type: "setUi",
|
|
@@ -12203,7 +12672,7 @@ var usePreviewModeHotkeys = () => {
|
|
|
12203
12672
|
|
|
12204
12673
|
// components/Puck/components/Header/index.tsx
|
|
12205
12674
|
init_react_import();
|
|
12206
|
-
var
|
|
12675
|
+
var import_react85 = require("react");
|
|
12207
12676
|
init_store();
|
|
12208
12677
|
init_lucide_react();
|
|
12209
12678
|
init_IconButton();
|
|
@@ -12220,7 +12689,7 @@ var styles_module_default23 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpe
|
|
|
12220
12689
|
|
|
12221
12690
|
// components/MenuBar/index.tsx
|
|
12222
12691
|
init_store();
|
|
12223
|
-
var
|
|
12692
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12224
12693
|
var getClassName31 = get_class_name_factory_default("MenuBar", styles_module_default23);
|
|
12225
12694
|
function MenuBar({
|
|
12226
12695
|
menuOpen = false,
|
|
@@ -12231,7 +12700,7 @@ function MenuBar({
|
|
|
12231
12700
|
const forward = useAppStore((s) => s.history.forward);
|
|
12232
12701
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
12233
12702
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
12234
|
-
return /* @__PURE__ */ (0,
|
|
12703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12235
12704
|
"div",
|
|
12236
12705
|
{
|
|
12237
12706
|
className: getClassName31({ menuOpen }),
|
|
@@ -12245,30 +12714,30 @@ function MenuBar({
|
|
|
12245
12714
|
setMenuOpen(false);
|
|
12246
12715
|
}
|
|
12247
12716
|
},
|
|
12248
|
-
children: /* @__PURE__ */ (0,
|
|
12249
|
-
/* @__PURE__ */ (0,
|
|
12250
|
-
/* @__PURE__ */ (0,
|
|
12717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName31("inner"), children: [
|
|
12718
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getClassName31("history"), children: [
|
|
12719
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12251
12720
|
IconButton,
|
|
12252
12721
|
{
|
|
12253
12722
|
type: "button",
|
|
12254
12723
|
title: "undo",
|
|
12255
12724
|
disabled: !hasPast,
|
|
12256
12725
|
onClick: back,
|
|
12257
|
-
children: /* @__PURE__ */ (0,
|
|
12726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Undo2, { size: 21 })
|
|
12258
12727
|
}
|
|
12259
12728
|
),
|
|
12260
|
-
/* @__PURE__ */ (0,
|
|
12729
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12261
12730
|
IconButton,
|
|
12262
12731
|
{
|
|
12263
12732
|
type: "button",
|
|
12264
12733
|
title: "redo",
|
|
12265
12734
|
disabled: !hasFuture,
|
|
12266
12735
|
onClick: forward,
|
|
12267
|
-
children: /* @__PURE__ */ (0,
|
|
12736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Redo2, { size: 21 })
|
|
12268
12737
|
}
|
|
12269
12738
|
)
|
|
12270
12739
|
] }),
|
|
12271
|
-
/* @__PURE__ */ (0,
|
|
12740
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children: renderHeaderActions && renderHeaderActions() })
|
|
12272
12741
|
] })
|
|
12273
12742
|
}
|
|
12274
12743
|
);
|
|
@@ -12282,7 +12751,7 @@ init_react_import();
|
|
|
12282
12751
|
var styles_module_default24 = { "PuckHeader": "_PuckHeader_63pti_1", "PuckHeader--hidePlugins": "_PuckHeader--hidePlugins_63pti_15", "PuckHeader-inner": "_PuckHeader-inner_63pti_20", "PuckHeader-toggle": "_PuckHeader-toggle_63pti_40", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_63pti_47", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_63pti_47", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_63pti_48", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_63pti_48", "PuckHeader-title": "_PuckHeader-title_63pti_64", "PuckHeader-path": "_PuckHeader-path_63pti_68", "PuckHeader-tools": "_PuckHeader-tools_63pti_75", "PuckHeader-menuButton": "_PuckHeader-menuButton_63pti_81", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_63pti_86" };
|
|
12283
12752
|
|
|
12284
12753
|
// components/Puck/components/Header/index.tsx
|
|
12285
|
-
var
|
|
12754
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12286
12755
|
var getClassName32 = get_class_name_factory_default("PuckHeader", styles_module_default24);
|
|
12287
12756
|
var HeaderInner = ({
|
|
12288
12757
|
hidePlugins
|
|
@@ -12297,7 +12766,7 @@ var HeaderInner = ({
|
|
|
12297
12766
|
} = usePropsContext();
|
|
12298
12767
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
12299
12768
|
const appStore = useAppStoreApi();
|
|
12300
|
-
const defaultHeaderRender = (0,
|
|
12769
|
+
const defaultHeaderRender = (0, import_react85.useMemo)(() => {
|
|
12301
12770
|
if (renderHeader) {
|
|
12302
12771
|
console.warn(
|
|
12303
12772
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -12306,13 +12775,13 @@ var HeaderInner = ({
|
|
|
12306
12775
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
12307
12776
|
const Comp = renderHeader;
|
|
12308
12777
|
const appState = useAppStore((s) => s.state);
|
|
12309
|
-
return /* @__PURE__ */ (0,
|
|
12778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
12310
12779
|
};
|
|
12311
12780
|
return RenderHeader;
|
|
12312
12781
|
}
|
|
12313
12782
|
return DefaultOverride;
|
|
12314
12783
|
}, [renderHeader]);
|
|
12315
|
-
const defaultHeaderActionsRender = (0,
|
|
12784
|
+
const defaultHeaderActionsRender = (0, import_react85.useMemo)(() => {
|
|
12316
12785
|
if (renderHeaderActions) {
|
|
12317
12786
|
console.warn(
|
|
12318
12787
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
@@ -12320,7 +12789,7 @@ var HeaderInner = ({
|
|
|
12320
12789
|
const RenderHeader = (props) => {
|
|
12321
12790
|
const Comp = renderHeaderActions;
|
|
12322
12791
|
const appState = useAppStore((s) => s.state);
|
|
12323
|
-
return /* @__PURE__ */ (0,
|
|
12792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
12324
12793
|
};
|
|
12325
12794
|
return RenderHeader;
|
|
12326
12795
|
}
|
|
@@ -12332,7 +12801,7 @@ var HeaderInner = ({
|
|
|
12332
12801
|
const CustomHeaderActions = useAppStore(
|
|
12333
12802
|
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
12334
12803
|
);
|
|
12335
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
12804
|
+
const [menuOpen, setMenuOpen] = (0, import_react85.useState)(false);
|
|
12336
12805
|
const rootTitle = useAppStore((s) => {
|
|
12337
12806
|
var _a, _b;
|
|
12338
12807
|
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
@@ -12342,7 +12811,7 @@ var HeaderInner = ({
|
|
|
12342
12811
|
const rightSideBarVisible = useAppStore(
|
|
12343
12812
|
(s) => s.state.ui.rightSideBarVisible
|
|
12344
12813
|
);
|
|
12345
|
-
const toggleSidebars = (0,
|
|
12814
|
+
const toggleSidebars = (0, import_react85.useCallback)(
|
|
12346
12815
|
(sidebar) => {
|
|
12347
12816
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
12348
12817
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -12356,21 +12825,21 @@ var HeaderInner = ({
|
|
|
12356
12825
|
},
|
|
12357
12826
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
12358
12827
|
);
|
|
12359
|
-
return /* @__PURE__ */ (0,
|
|
12828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12360
12829
|
CustomHeader,
|
|
12361
12830
|
{
|
|
12362
|
-
actions: /* @__PURE__ */ (0,
|
|
12831
|
+
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)(
|
|
12363
12832
|
Button,
|
|
12364
12833
|
{
|
|
12365
12834
|
onClick: () => {
|
|
12366
12835
|
const data = appStore.getState().state.data;
|
|
12367
12836
|
onPublish && onPublish(data);
|
|
12368
12837
|
},
|
|
12369
|
-
icon: /* @__PURE__ */ (0,
|
|
12838
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Globe, { size: "14px" }),
|
|
12370
12839
|
children: "Publish"
|
|
12371
12840
|
}
|
|
12372
12841
|
) }) }),
|
|
12373
|
-
children: /* @__PURE__ */ (0,
|
|
12842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12374
12843
|
"header",
|
|
12375
12844
|
{
|
|
12376
12845
|
className: getClassName32({
|
|
@@ -12378,9 +12847,9 @@ var HeaderInner = ({
|
|
|
12378
12847
|
rightSideBarVisible,
|
|
12379
12848
|
hidePlugins
|
|
12380
12849
|
}),
|
|
12381
|
-
children: /* @__PURE__ */ (0,
|
|
12382
|
-
/* @__PURE__ */ (0,
|
|
12383
|
-
/* @__PURE__ */ (0,
|
|
12850
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getClassName32("inner"), children: [
|
|
12851
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getClassName32("toggle"), children: [
|
|
12852
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName32("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12384
12853
|
IconButton,
|
|
12385
12854
|
{
|
|
12386
12855
|
type: "button",
|
|
@@ -12388,10 +12857,10 @@ var HeaderInner = ({
|
|
|
12388
12857
|
toggleSidebars("left");
|
|
12389
12858
|
},
|
|
12390
12859
|
title: "Toggle left sidebar",
|
|
12391
|
-
children: /* @__PURE__ */ (0,
|
|
12860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PanelLeft, { focusable: "false" })
|
|
12392
12861
|
}
|
|
12393
12862
|
) }),
|
|
12394
|
-
/* @__PURE__ */ (0,
|
|
12863
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName32("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12395
12864
|
IconButton,
|
|
12396
12865
|
{
|
|
12397
12866
|
type: "button",
|
|
@@ -12399,19 +12868,19 @@ var HeaderInner = ({
|
|
|
12399
12868
|
toggleSidebars("right");
|
|
12400
12869
|
},
|
|
12401
12870
|
title: "Toggle right sidebar",
|
|
12402
|
-
children: /* @__PURE__ */ (0,
|
|
12871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PanelRight, { focusable: "false" })
|
|
12403
12872
|
}
|
|
12404
12873
|
) })
|
|
12405
12874
|
] }),
|
|
12406
|
-
/* @__PURE__ */ (0,
|
|
12875
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName32("title"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Heading7, { rank: "2", size: "xs", children: [
|
|
12407
12876
|
headerTitle || rootTitle || "Page",
|
|
12408
|
-
headerPath && /* @__PURE__ */ (0,
|
|
12877
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
12409
12878
|
" ",
|
|
12410
|
-
/* @__PURE__ */ (0,
|
|
12879
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("code", { className: getClassName32("path"), children: headerPath })
|
|
12411
12880
|
] })
|
|
12412
12881
|
] }) }),
|
|
12413
|
-
/* @__PURE__ */ (0,
|
|
12414
|
-
/* @__PURE__ */ (0,
|
|
12882
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getClassName32("tools"), children: [
|
|
12883
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: getClassName32("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12415
12884
|
IconButton,
|
|
12416
12885
|
{
|
|
12417
12886
|
type: "button",
|
|
@@ -12419,23 +12888,23 @@ var HeaderInner = ({
|
|
|
12419
12888
|
return setMenuOpen(!menuOpen);
|
|
12420
12889
|
},
|
|
12421
12890
|
title: "Toggle menu bar",
|
|
12422
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
|
12891
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChevronDown, { focusable: "false" })
|
|
12423
12892
|
}
|
|
12424
12893
|
) }),
|
|
12425
|
-
/* @__PURE__ */ (0,
|
|
12894
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12426
12895
|
MenuBar,
|
|
12427
12896
|
{
|
|
12428
12897
|
dispatch,
|
|
12429
12898
|
onPublish,
|
|
12430
12899
|
menuOpen,
|
|
12431
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
|
12900
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12432
12901
|
Button,
|
|
12433
12902
|
{
|
|
12434
12903
|
onClick: () => {
|
|
12435
12904
|
const data = appStore.getState().state.data;
|
|
12436
12905
|
onPublish && onPublish(data);
|
|
12437
12906
|
},
|
|
12438
|
-
icon: /* @__PURE__ */ (0,
|
|
12907
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Globe, { size: "14px" }),
|
|
12439
12908
|
children: "Publish"
|
|
12440
12909
|
}
|
|
12441
12910
|
) }),
|
|
@@ -12449,7 +12918,7 @@ var HeaderInner = ({
|
|
|
12449
12918
|
}
|
|
12450
12919
|
);
|
|
12451
12920
|
};
|
|
12452
|
-
var Header = (0,
|
|
12921
|
+
var Header = (0, import_react85.memo)(HeaderInner);
|
|
12453
12922
|
|
|
12454
12923
|
// components/SidebarSection/index.tsx
|
|
12455
12924
|
init_react_import();
|
|
@@ -12475,7 +12944,7 @@ init_lucide_react();
|
|
|
12475
12944
|
|
|
12476
12945
|
// lib/use-breadcrumbs.ts
|
|
12477
12946
|
init_react_import();
|
|
12478
|
-
var
|
|
12947
|
+
var import_react86 = require("react");
|
|
12479
12948
|
init_store();
|
|
12480
12949
|
var useBreadcrumbs = (renderCount) => {
|
|
12481
12950
|
const selectedId = useAppStore((s) => {
|
|
@@ -12488,7 +12957,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
12488
12957
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
12489
12958
|
});
|
|
12490
12959
|
const appStore = useAppStoreApi();
|
|
12491
|
-
return (0,
|
|
12960
|
+
return (0, import_react86.useMemo)(() => {
|
|
12492
12961
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
12493
12962
|
var _a, _b, _c, _d;
|
|
12494
12963
|
const [componentId] = zoneCompound.split(":");
|
|
@@ -12520,7 +12989,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
12520
12989
|
|
|
12521
12990
|
// components/Breadcrumbs/index.tsx
|
|
12522
12991
|
init_store();
|
|
12523
|
-
var
|
|
12992
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12524
12993
|
var getClassName33 = get_class_name_factory_default("Breadcrumbs", styles_module_default26);
|
|
12525
12994
|
var Breadcrumbs = ({
|
|
12526
12995
|
children,
|
|
@@ -12528,9 +12997,9 @@ var Breadcrumbs = ({
|
|
|
12528
12997
|
}) => {
|
|
12529
12998
|
const setUi = useAppStore((s) => s.setUi);
|
|
12530
12999
|
const breadcrumbs = useBreadcrumbs(numParents);
|
|
12531
|
-
return /* @__PURE__ */ (0,
|
|
12532
|
-
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
|
12533
|
-
/* @__PURE__ */ (0,
|
|
13000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassName33(), children: [
|
|
13001
|
+
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassName33("breadcrumb"), children: [
|
|
13002
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
12534
13003
|
"button",
|
|
12535
13004
|
{
|
|
12536
13005
|
type: "button",
|
|
@@ -12539,14 +13008,14 @@ var Breadcrumbs = ({
|
|
|
12539
13008
|
children: breadcrumb.label
|
|
12540
13009
|
}
|
|
12541
13010
|
),
|
|
12542
|
-
/* @__PURE__ */ (0,
|
|
13011
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ChevronRight, { size: 16 })
|
|
12543
13012
|
] }, i)),
|
|
12544
13013
|
children
|
|
12545
13014
|
] });
|
|
12546
13015
|
};
|
|
12547
13016
|
|
|
12548
13017
|
// components/SidebarSection/index.tsx
|
|
12549
|
-
var
|
|
13018
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
12550
13019
|
var getClassName34 = get_class_name_factory_default("SidebarSection", styles_module_default25);
|
|
12551
13020
|
var SidebarSection = ({
|
|
12552
13021
|
children,
|
|
@@ -12556,20 +13025,20 @@ var SidebarSection = ({
|
|
|
12556
13025
|
noBorderTop,
|
|
12557
13026
|
isLoading
|
|
12558
13027
|
}) => {
|
|
12559
|
-
return /* @__PURE__ */ (0,
|
|
12560
|
-
/* @__PURE__ */ (0,
|
|
12561
|
-
showBreadcrumbs && /* @__PURE__ */ (0,
|
|
12562
|
-
/* @__PURE__ */ (0,
|
|
13028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: getClassName34({ noBorderTop }), style: { background }, children: [
|
|
13029
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: getClassName34("title"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: getClassName34("breadcrumbs"), children: [
|
|
13030
|
+
showBreadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Breadcrumbs, {}),
|
|
13031
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: getClassName34("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Heading7, { rank: "2", size: "xs", children: title }) })
|
|
12563
13032
|
] }) }),
|
|
12564
|
-
/* @__PURE__ */ (0,
|
|
12565
|
-
isLoading && /* @__PURE__ */ (0,
|
|
13033
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: getClassName34("content"), children }),
|
|
13034
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: getClassName34("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Loader, { size: 32 }) })
|
|
12566
13035
|
] });
|
|
12567
13036
|
};
|
|
12568
13037
|
|
|
12569
13038
|
// components/Puck/components/Canvas/index.tsx
|
|
12570
13039
|
init_react_import();
|
|
12571
13040
|
init_css_box_model_esm();
|
|
12572
|
-
var
|
|
13041
|
+
var import_react89 = require("react");
|
|
12573
13042
|
init_store();
|
|
12574
13043
|
|
|
12575
13044
|
// components/ViewportControls/index.tsx
|
|
@@ -12577,7 +13046,7 @@ init_react_import();
|
|
|
12577
13046
|
init_lucide_react();
|
|
12578
13047
|
init_IconButton2();
|
|
12579
13048
|
init_store();
|
|
12580
|
-
var
|
|
13049
|
+
var import_react87 = require("react");
|
|
12581
13050
|
init_lib();
|
|
12582
13051
|
|
|
12583
13052
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
@@ -12585,12 +13054,12 @@ init_react_import();
|
|
|
12585
13054
|
var styles_module_default27 = { "ViewportControls": "_ViewportControls_e3unb_1", "ViewportControls--fullScreen": "_ViewportControls--fullScreen_e3unb_5", "ViewportControls-toggleButton": "_ViewportControls-toggleButton_e3unb_14", "ViewportControls--isExpanded": "_ViewportControls--isExpanded_e3unb_38", "ViewportControls-actions": "_ViewportControls-actions_e3unb_42", "ViewportControls-actionsInner": "_ViewportControls-actionsInner_e3unb_46", "ViewportControls-divider": "_ViewportControls-divider_e3unb_75", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_e3unb_81", "ViewportControls-zoom": "_ViewportControls-zoom_e3unb_81", "ViewportButton-inner": "_ViewportButton-inner_e3unb_111", "ViewportButton--isActive": "_ViewportButton--isActive_e3unb_119" };
|
|
12586
13055
|
|
|
12587
13056
|
// components/ViewportControls/index.tsx
|
|
12588
|
-
var
|
|
13057
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
12589
13058
|
var icons = {
|
|
12590
|
-
Smartphone: /* @__PURE__ */ (0,
|
|
12591
|
-
Tablet: /* @__PURE__ */ (0,
|
|
12592
|
-
Monitor: /* @__PURE__ */ (0,
|
|
12593
|
-
FullWidth: /* @__PURE__ */ (0,
|
|
13059
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Smartphone, { size: 16 }),
|
|
13060
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Tablet, { size: 16 }),
|
|
13061
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Monitor, { size: 16 }),
|
|
13062
|
+
FullWidth: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Expand, { size: 16 })
|
|
12594
13063
|
};
|
|
12595
13064
|
var getClassName35 = get_class_name_factory_default("ViewportControls", styles_module_default27);
|
|
12596
13065
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default27);
|
|
@@ -12601,7 +13070,7 @@ var ActionButton = ({
|
|
|
12601
13070
|
isActive,
|
|
12602
13071
|
disabled
|
|
12603
13072
|
}) => {
|
|
12604
|
-
return /* @__PURE__ */ (0,
|
|
13073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassNameButton({ isActive }), suppressHydrationWarning: true, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12605
13074
|
IconButton,
|
|
12606
13075
|
{
|
|
12607
13076
|
type: "button",
|
|
@@ -12609,7 +13078,7 @@ var ActionButton = ({
|
|
|
12609
13078
|
disabled: disabled || isActive,
|
|
12610
13079
|
onClick,
|
|
12611
13080
|
suppressHydrationWarning: true,
|
|
12612
|
-
children: /* @__PURE__ */ (0,
|
|
13081
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassNameButton("inner"), children })
|
|
12613
13082
|
}
|
|
12614
13083
|
) });
|
|
12615
13084
|
};
|
|
@@ -12635,7 +13104,7 @@ var ViewportControls = ({
|
|
|
12635
13104
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
12636
13105
|
(option) => option.value === autoZoom
|
|
12637
13106
|
);
|
|
12638
|
-
const zoomOptions = (0,
|
|
13107
|
+
const zoomOptions = (0, import_react87.useMemo)(
|
|
12639
13108
|
() => [
|
|
12640
13109
|
...defaultZoomOptions,
|
|
12641
13110
|
...defaultsContainAutoZoom ? [] : [
|
|
@@ -12647,21 +13116,21 @@ var ViewportControls = ({
|
|
|
12647
13116
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
12648
13117
|
[autoZoom]
|
|
12649
13118
|
);
|
|
12650
|
-
const [activeViewport, setActiveViewport] = (0,
|
|
13119
|
+
const [activeViewport, setActiveViewport] = (0, import_react87.useState)(
|
|
12651
13120
|
uiViewports.current.width
|
|
12652
13121
|
);
|
|
12653
|
-
(0,
|
|
13122
|
+
(0, import_react87.useEffect)(() => {
|
|
12654
13123
|
setActiveViewport(uiViewports.current.width);
|
|
12655
13124
|
}, [uiViewports.current]);
|
|
12656
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12657
|
-
return /* @__PURE__ */ (0,
|
|
13125
|
+
const [isExpanded, setIsExpanded] = (0, import_react87.useState)(false);
|
|
13126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
12658
13127
|
"div",
|
|
12659
13128
|
{
|
|
12660
13129
|
className: getClassName35({ isExpanded, fullScreen }),
|
|
12661
13130
|
suppressHydrationWarning: true,
|
|
12662
13131
|
children: [
|
|
12663
|
-
/* @__PURE__ */ (0,
|
|
12664
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
|
13132
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: getClassName35("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getClassName35("actionsInner"), children: [
|
|
13133
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12665
13134
|
ActionButton,
|
|
12666
13135
|
{
|
|
12667
13136
|
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
|
@@ -12674,8 +13143,8 @@ var ViewportControls = ({
|
|
|
12674
13143
|
},
|
|
12675
13144
|
i
|
|
12676
13145
|
)),
|
|
12677
|
-
/* @__PURE__ */ (0,
|
|
12678
|
-
/* @__PURE__ */ (0,
|
|
13146
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: getClassName35("divider") }),
|
|
13147
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12679
13148
|
ActionButton,
|
|
12680
13149
|
{
|
|
12681
13150
|
title: "Zoom viewport out",
|
|
@@ -12689,10 +13158,10 @@ var ViewportControls = ({
|
|
|
12689
13158
|
)].value
|
|
12690
13159
|
);
|
|
12691
13160
|
},
|
|
12692
|
-
children: /* @__PURE__ */ (0,
|
|
13161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ZoomOut, { size: 16 })
|
|
12693
13162
|
}
|
|
12694
13163
|
),
|
|
12695
|
-
/* @__PURE__ */ (0,
|
|
13164
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12696
13165
|
ActionButton,
|
|
12697
13166
|
{
|
|
12698
13167
|
title: "Zoom viewport in",
|
|
@@ -12706,12 +13175,12 @@ var ViewportControls = ({
|
|
|
12706
13175
|
)].value
|
|
12707
13176
|
);
|
|
12708
13177
|
},
|
|
12709
|
-
children: /* @__PURE__ */ (0,
|
|
13178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ZoomIn, { size: 16 })
|
|
12710
13179
|
}
|
|
12711
13180
|
),
|
|
12712
|
-
/* @__PURE__ */ (0,
|
|
12713
|
-
/* @__PURE__ */ (0,
|
|
12714
|
-
/* @__PURE__ */ (0,
|
|
13181
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getClassName35("zoom"), children: [
|
|
13182
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: getClassName35("divider") }),
|
|
13183
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12715
13184
|
"select",
|
|
12716
13185
|
{
|
|
12717
13186
|
className: getClassName35("zoomSelect"),
|
|
@@ -12722,7 +13191,7 @@ var ViewportControls = ({
|
|
|
12722
13191
|
onChange: (e) => {
|
|
12723
13192
|
onZoom(parseFloat(e.currentTarget.value));
|
|
12724
13193
|
},
|
|
12725
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
|
13194
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12726
13195
|
"option",
|
|
12727
13196
|
{
|
|
12728
13197
|
value: option.value,
|
|
@@ -12734,13 +13203,13 @@ var ViewportControls = ({
|
|
|
12734
13203
|
)
|
|
12735
13204
|
] })
|
|
12736
13205
|
] }) }),
|
|
12737
|
-
/* @__PURE__ */ (0,
|
|
13206
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12738
13207
|
"button",
|
|
12739
13208
|
{
|
|
12740
13209
|
className: getClassName35("toggleButton"),
|
|
12741
13210
|
title: "Toggle viewport menu",
|
|
12742
13211
|
onClick: () => setIsExpanded((s) => !s),
|
|
12743
|
-
children: isExpanded ? /* @__PURE__ */ (0,
|
|
13212
|
+
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(X, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Monitor, { size: 16 })
|
|
12744
13213
|
}
|
|
12745
13214
|
)
|
|
12746
13215
|
]
|
|
@@ -12755,27 +13224,27 @@ var styles_module_default28 = { "PuckCanvas": "_PuckCanvas_t6s9b_1", "PuckCanvas
|
|
|
12755
13224
|
// components/Puck/components/Canvas/index.tsx
|
|
12756
13225
|
init_lib();
|
|
12757
13226
|
init_Loader();
|
|
12758
|
-
var
|
|
13227
|
+
var import_shallow9 = require("zustand/react/shallow");
|
|
12759
13228
|
|
|
12760
13229
|
// lib/frame-context.tsx
|
|
12761
13230
|
init_react_import();
|
|
12762
|
-
var
|
|
12763
|
-
var
|
|
12764
|
-
var FrameContext = (0,
|
|
13231
|
+
var import_react88 = require("react");
|
|
13232
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13233
|
+
var FrameContext = (0, import_react88.createContext)(null);
|
|
12765
13234
|
var FrameProvider = ({
|
|
12766
13235
|
children
|
|
12767
13236
|
}) => {
|
|
12768
|
-
const frameRef = (0,
|
|
12769
|
-
const value = (0,
|
|
13237
|
+
const frameRef = (0, import_react88.useRef)(null);
|
|
13238
|
+
const value = (0, import_react88.useMemo)(
|
|
12770
13239
|
() => ({
|
|
12771
13240
|
frameRef
|
|
12772
13241
|
}),
|
|
12773
13242
|
[]
|
|
12774
13243
|
);
|
|
12775
|
-
return /* @__PURE__ */ (0,
|
|
13244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(FrameContext.Provider, { value, children });
|
|
12776
13245
|
};
|
|
12777
13246
|
var useCanvasFrame = () => {
|
|
12778
|
-
const context = (0,
|
|
13247
|
+
const context = (0, import_react88.useContext)(FrameContext);
|
|
12779
13248
|
if (context === null) {
|
|
12780
13249
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
12781
13250
|
}
|
|
@@ -12784,7 +13253,7 @@ var useCanvasFrame = () => {
|
|
|
12784
13253
|
|
|
12785
13254
|
// components/Puck/components/Canvas/index.tsx
|
|
12786
13255
|
init_default_viewports();
|
|
12787
|
-
var
|
|
13256
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
12788
13257
|
var getClassName36 = get_class_name_factory_default("PuckCanvas", styles_module_default28);
|
|
12789
13258
|
var ZOOM_ON_CHANGE = true;
|
|
12790
13259
|
var TRANSITION_DURATION = 150;
|
|
@@ -12792,11 +13261,7 @@ var Canvas = () => {
|
|
|
12792
13261
|
var _a;
|
|
12793
13262
|
const { frameRef } = useCanvasFrame();
|
|
12794
13263
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
12795
|
-
const {
|
|
12796
|
-
_experimentalFullScreenCanvas,
|
|
12797
|
-
viewports: viewportOptions = defaultViewports,
|
|
12798
|
-
ui: uiProp
|
|
12799
|
-
} = usePropsContext();
|
|
13264
|
+
const { viewports: viewportOptions = defaultViewports, ui: uiProp } = usePropsContext();
|
|
12800
13265
|
const {
|
|
12801
13266
|
dispatch,
|
|
12802
13267
|
overrides,
|
|
@@ -12804,16 +13269,18 @@ var Canvas = () => {
|
|
|
12804
13269
|
zoomConfig,
|
|
12805
13270
|
setZoomConfig,
|
|
12806
13271
|
status,
|
|
12807
|
-
iframe
|
|
13272
|
+
iframe,
|
|
13273
|
+
_experimentalFullScreenCanvas
|
|
12808
13274
|
} = useAppStore(
|
|
12809
|
-
(0,
|
|
13275
|
+
(0, import_shallow9.useShallow)((s) => ({
|
|
12810
13276
|
dispatch: s.dispatch,
|
|
12811
13277
|
overrides: s.overrides,
|
|
12812
13278
|
setUi: s.setUi,
|
|
12813
13279
|
zoomConfig: s.zoomConfig,
|
|
12814
13280
|
setZoomConfig: s.setZoomConfig,
|
|
12815
13281
|
status: s.status,
|
|
12816
|
-
iframe: s.iframe
|
|
13282
|
+
iframe: s.iframe,
|
|
13283
|
+
_experimentalFullScreenCanvas: s._experimentalFullScreenCanvas
|
|
12817
13284
|
}))
|
|
12818
13285
|
);
|
|
12819
13286
|
const {
|
|
@@ -12823,7 +13290,7 @@ var Canvas = () => {
|
|
|
12823
13290
|
rightSideBarWidth,
|
|
12824
13291
|
viewports
|
|
12825
13292
|
} = useAppStore(
|
|
12826
|
-
(0,
|
|
13293
|
+
(0, import_shallow9.useShallow)((s) => ({
|
|
12827
13294
|
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
|
12828
13295
|
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
|
12829
13296
|
leftSideBarWidth: s.state.ui.leftSideBarWidth,
|
|
@@ -12831,17 +13298,17 @@ var Canvas = () => {
|
|
|
12831
13298
|
viewports: s.state.ui.viewports
|
|
12832
13299
|
}))
|
|
12833
13300
|
);
|
|
12834
|
-
const [showTransition, setShowTransition] = (0,
|
|
12835
|
-
const isResizingRef = (0,
|
|
12836
|
-
const defaultRender = (0,
|
|
12837
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
|
13301
|
+
const [showTransition, setShowTransition] = (0, import_react89.useState)(false);
|
|
13302
|
+
const isResizingRef = (0, import_react89.useRef)(false);
|
|
13303
|
+
const defaultRender = (0, import_react89.useMemo)(() => {
|
|
13304
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_jsx_runtime86.Fragment, { children });
|
|
12838
13305
|
return PuckDefault;
|
|
12839
13306
|
}, []);
|
|
12840
|
-
const CustomPreview = (0,
|
|
13307
|
+
const CustomPreview = (0, import_react89.useMemo)(
|
|
12841
13308
|
() => overrides.preview || defaultRender,
|
|
12842
13309
|
[overrides]
|
|
12843
13310
|
);
|
|
12844
|
-
const getFrameDimensions = (0,
|
|
13311
|
+
const getFrameDimensions = (0, import_react89.useCallback)(() => {
|
|
12845
13312
|
if (frameRef.current) {
|
|
12846
13313
|
const frame = frameRef.current;
|
|
12847
13314
|
const box = getBox(frame);
|
|
@@ -12849,7 +13316,7 @@ var Canvas = () => {
|
|
|
12849
13316
|
}
|
|
12850
13317
|
return { width: 0, height: 0 };
|
|
12851
13318
|
}, [frameRef]);
|
|
12852
|
-
(0,
|
|
13319
|
+
(0, import_react89.useEffect)(() => {
|
|
12853
13320
|
resetAutoZoom();
|
|
12854
13321
|
}, [
|
|
12855
13322
|
frameRef,
|
|
@@ -12859,7 +13326,7 @@ var Canvas = () => {
|
|
|
12859
13326
|
rightSideBarWidth,
|
|
12860
13327
|
viewports
|
|
12861
13328
|
]);
|
|
12862
|
-
(0,
|
|
13329
|
+
(0, import_react89.useEffect)(() => {
|
|
12863
13330
|
const { height: frameHeight } = getFrameDimensions();
|
|
12864
13331
|
if (viewports.current.height === "auto") {
|
|
12865
13332
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
|
@@ -12867,12 +13334,12 @@ var Canvas = () => {
|
|
|
12867
13334
|
}));
|
|
12868
13335
|
}
|
|
12869
13336
|
}, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
|
|
12870
|
-
(0,
|
|
13337
|
+
(0, import_react89.useEffect)(() => {
|
|
12871
13338
|
if (ZOOM_ON_CHANGE) {
|
|
12872
13339
|
resetAutoZoom();
|
|
12873
13340
|
}
|
|
12874
13341
|
}, [viewports.current.width, viewports]);
|
|
12875
|
-
(0,
|
|
13342
|
+
(0, import_react89.useEffect)(() => {
|
|
12876
13343
|
if (!frameRef.current) return;
|
|
12877
13344
|
const resizeObserver = new ResizeObserver(() => {
|
|
12878
13345
|
if (!isResizingRef.current) {
|
|
@@ -12884,14 +13351,14 @@ var Canvas = () => {
|
|
|
12884
13351
|
resizeObserver.disconnect();
|
|
12885
13352
|
};
|
|
12886
13353
|
}, [frameRef.current]);
|
|
12887
|
-
const [showLoader, setShowLoader] = (0,
|
|
12888
|
-
(0,
|
|
13354
|
+
const [showLoader, setShowLoader] = (0, import_react89.useState)(false);
|
|
13355
|
+
(0, import_react89.useEffect)(() => {
|
|
12889
13356
|
setTimeout(() => {
|
|
12890
13357
|
setShowLoader(true);
|
|
12891
13358
|
}, 500);
|
|
12892
13359
|
}, []);
|
|
12893
13360
|
const appStoreApi = useAppStoreApi();
|
|
12894
|
-
(0,
|
|
13361
|
+
(0, import_react89.useEffect)(() => {
|
|
12895
13362
|
var _a2, _b;
|
|
12896
13363
|
if (typeof window === "undefined") return;
|
|
12897
13364
|
if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
|
|
@@ -12942,7 +13409,7 @@ var Canvas = () => {
|
|
|
12942
13409
|
appStoreApi,
|
|
12943
13410
|
(_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
|
|
12944
13411
|
]);
|
|
12945
|
-
return /* @__PURE__ */ (0,
|
|
13412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
12946
13413
|
"div",
|
|
12947
13414
|
{
|
|
12948
13415
|
className: getClassName36({
|
|
@@ -12956,12 +13423,12 @@ var Canvas = () => {
|
|
|
12956
13423
|
dispatch({
|
|
12957
13424
|
type: "setUi",
|
|
12958
13425
|
ui: { itemSelector: null },
|
|
12959
|
-
recordHistory:
|
|
13426
|
+
recordHistory: false
|
|
12960
13427
|
});
|
|
12961
13428
|
}
|
|
12962
13429
|
},
|
|
12963
13430
|
children: [
|
|
12964
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
|
13431
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName36("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12965
13432
|
ViewportControls,
|
|
12966
13433
|
{
|
|
12967
13434
|
fullScreen: _experimentalFullScreenCanvas,
|
|
@@ -12991,8 +13458,8 @@ var Canvas = () => {
|
|
|
12991
13458
|
}
|
|
12992
13459
|
}
|
|
12993
13460
|
) }),
|
|
12994
|
-
/* @__PURE__ */ (0,
|
|
12995
|
-
/* @__PURE__ */ (0,
|
|
13461
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: getClassName36("inner"), ref: frameRef, children: [
|
|
13462
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12996
13463
|
"div",
|
|
12997
13464
|
{
|
|
12998
13465
|
className: getClassName36("root"),
|
|
@@ -13009,10 +13476,10 @@ var Canvas = () => {
|
|
|
13009
13476
|
setShowTransition(false);
|
|
13010
13477
|
isResizingRef.current = false;
|
|
13011
13478
|
},
|
|
13012
|
-
children: /* @__PURE__ */ (0,
|
|
13479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Preview2, {}) })
|
|
13013
13480
|
}
|
|
13014
13481
|
),
|
|
13015
|
-
/* @__PURE__ */ (0,
|
|
13482
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName36("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Loader, { size: 24 }) })
|
|
13016
13483
|
] })
|
|
13017
13484
|
]
|
|
13018
13485
|
}
|
|
@@ -13021,15 +13488,15 @@ var Canvas = () => {
|
|
|
13021
13488
|
|
|
13022
13489
|
// lib/use-sidebar-resize.ts
|
|
13023
13490
|
init_react_import();
|
|
13024
|
-
var
|
|
13491
|
+
var import_react90 = require("react");
|
|
13025
13492
|
init_store();
|
|
13026
13493
|
function useSidebarResize(position, dispatch) {
|
|
13027
|
-
const [width, setWidth] = (0,
|
|
13028
|
-
const sidebarRef = (0,
|
|
13494
|
+
const [width, setWidth] = (0, import_react90.useState)(null);
|
|
13495
|
+
const sidebarRef = (0, import_react90.useRef)(null);
|
|
13029
13496
|
const storeWidth = useAppStore(
|
|
13030
13497
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
13031
13498
|
);
|
|
13032
|
-
(0,
|
|
13499
|
+
(0, import_react90.useEffect)(() => {
|
|
13033
13500
|
if (typeof window !== "undefined" && !storeWidth) {
|
|
13034
13501
|
try {
|
|
13035
13502
|
const savedWidths = localStorage.getItem("puck-sidebar-widths");
|
|
@@ -13054,12 +13521,12 @@ function useSidebarResize(position, dispatch) {
|
|
|
13054
13521
|
}
|
|
13055
13522
|
}
|
|
13056
13523
|
}, [dispatch, position, storeWidth]);
|
|
13057
|
-
(0,
|
|
13524
|
+
(0, import_react90.useEffect)(() => {
|
|
13058
13525
|
if (storeWidth !== void 0) {
|
|
13059
13526
|
setWidth(storeWidth);
|
|
13060
13527
|
}
|
|
13061
13528
|
}, [storeWidth]);
|
|
13062
|
-
const handleResizeEnd = (0,
|
|
13529
|
+
const handleResizeEnd = (0, import_react90.useCallback)(
|
|
13063
13530
|
(width2) => {
|
|
13064
13531
|
dispatch({
|
|
13065
13532
|
type: "setUi",
|
|
@@ -13106,7 +13573,7 @@ init_react_import();
|
|
|
13106
13573
|
|
|
13107
13574
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
13108
13575
|
init_react_import();
|
|
13109
|
-
var
|
|
13576
|
+
var import_react91 = require("react");
|
|
13110
13577
|
init_get_class_name_factory();
|
|
13111
13578
|
|
|
13112
13579
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
@@ -13115,7 +13582,7 @@ var styles_module_default29 = { "ResizeHandle": "_ResizeHandle_144bf_2", "Resize
|
|
|
13115
13582
|
|
|
13116
13583
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
13117
13584
|
init_lib();
|
|
13118
|
-
var
|
|
13585
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13119
13586
|
var getClassName37 = get_class_name_factory_default("ResizeHandle", styles_module_default29);
|
|
13120
13587
|
var ResizeHandle = ({
|
|
13121
13588
|
position,
|
|
@@ -13125,11 +13592,11 @@ var ResizeHandle = ({
|
|
|
13125
13592
|
}) => {
|
|
13126
13593
|
const { frameRef } = useCanvasFrame();
|
|
13127
13594
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
13128
|
-
const handleRef = (0,
|
|
13129
|
-
const isDragging = (0,
|
|
13130
|
-
const startX = (0,
|
|
13131
|
-
const startWidth = (0,
|
|
13132
|
-
const handleMouseMove = (0,
|
|
13595
|
+
const handleRef = (0, import_react91.useRef)(null);
|
|
13596
|
+
const isDragging = (0, import_react91.useRef)(false);
|
|
13597
|
+
const startX = (0, import_react91.useRef)(0);
|
|
13598
|
+
const startWidth = (0, import_react91.useRef)(0);
|
|
13599
|
+
const handleMouseMove = (0, import_react91.useCallback)(
|
|
13133
13600
|
(e) => {
|
|
13134
13601
|
if (!isDragging.current) return;
|
|
13135
13602
|
const delta = e.clientX - startX.current;
|
|
@@ -13140,7 +13607,7 @@ var ResizeHandle = ({
|
|
|
13140
13607
|
},
|
|
13141
13608
|
[onResize, position]
|
|
13142
13609
|
);
|
|
13143
|
-
const handleMouseUp = (0,
|
|
13610
|
+
const handleMouseUp = (0, import_react91.useCallback)(() => {
|
|
13144
13611
|
var _a;
|
|
13145
13612
|
if (!isDragging.current) return;
|
|
13146
13613
|
isDragging.current = false;
|
|
@@ -13156,7 +13623,7 @@ var ResizeHandle = ({
|
|
|
13156
13623
|
onResizeEnd(finalWidth);
|
|
13157
13624
|
resetAutoZoom();
|
|
13158
13625
|
}, [onResizeEnd]);
|
|
13159
|
-
const handleMouseDown = (0,
|
|
13626
|
+
const handleMouseDown = (0, import_react91.useCallback)(
|
|
13160
13627
|
(e) => {
|
|
13161
13628
|
var _a;
|
|
13162
13629
|
isDragging.current = true;
|
|
@@ -13174,7 +13641,7 @@ var ResizeHandle = ({
|
|
|
13174
13641
|
},
|
|
13175
13642
|
[position, handleMouseMove, handleMouseUp]
|
|
13176
13643
|
);
|
|
13177
|
-
return /* @__PURE__ */ (0,
|
|
13644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
13178
13645
|
"div",
|
|
13179
13646
|
{
|
|
13180
13647
|
ref: handleRef,
|
|
@@ -13192,7 +13659,7 @@ init_react_import();
|
|
|
13192
13659
|
var styles_module_default30 = { "Sidebar": "_Sidebar_o396p_1", "Sidebar--isVisible": "_Sidebar--isVisible_o396p_9", "Sidebar--left": "_Sidebar--left_o396p_13", "Sidebar--right": "_Sidebar--right_o396p_25", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_o396p_37" };
|
|
13193
13660
|
|
|
13194
13661
|
// components/Puck/components/Sidebar/index.tsx
|
|
13195
|
-
var
|
|
13662
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
13196
13663
|
var getClassName38 = get_class_name_factory_default("Sidebar", styles_module_default30);
|
|
13197
13664
|
var Sidebar = ({
|
|
13198
13665
|
position,
|
|
@@ -13202,8 +13669,8 @@ var Sidebar = ({
|
|
|
13202
13669
|
onResizeEnd,
|
|
13203
13670
|
children
|
|
13204
13671
|
}) => {
|
|
13205
|
-
return /* @__PURE__ */ (0,
|
|
13206
|
-
/* @__PURE__ */ (0,
|
|
13672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
13673
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13207
13674
|
"div",
|
|
13208
13675
|
{
|
|
13209
13676
|
ref: sidebarRef,
|
|
@@ -13211,7 +13678,7 @@ var Sidebar = ({
|
|
|
13211
13678
|
children
|
|
13212
13679
|
}
|
|
13213
13680
|
),
|
|
13214
|
-
/* @__PURE__ */ (0,
|
|
13681
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `${getClassName38("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13215
13682
|
ResizeHandle,
|
|
13216
13683
|
{
|
|
13217
13684
|
position,
|
|
@@ -13225,7 +13692,7 @@ var Sidebar = ({
|
|
|
13225
13692
|
|
|
13226
13693
|
// lib/use-delete-hotkeys.ts
|
|
13227
13694
|
init_react_import();
|
|
13228
|
-
var
|
|
13695
|
+
var import_react92 = require("react");
|
|
13229
13696
|
init_use_hotkey();
|
|
13230
13697
|
init_store();
|
|
13231
13698
|
var isElementVisible = (element) => {
|
|
@@ -13262,7 +13729,7 @@ var shouldBlockDeleteHotkey = (e) => {
|
|
|
13262
13729
|
};
|
|
13263
13730
|
var useDeleteHotkeys = () => {
|
|
13264
13731
|
const appStore = useAppStoreApi();
|
|
13265
|
-
const deleteSelectedComponent = (0,
|
|
13732
|
+
const deleteSelectedComponent = (0, import_react92.useCallback)(
|
|
13266
13733
|
(e) => {
|
|
13267
13734
|
var _a;
|
|
13268
13735
|
if (shouldBlockDeleteHotkey(e)) {
|
|
@@ -13295,7 +13762,7 @@ var styles_module_default31 = { "Nav": "_Nav_1tvxq_1", "Nav-list": "_Nav-list_1t
|
|
|
13295
13762
|
|
|
13296
13763
|
// components/Puck/components/Nav/index.tsx
|
|
13297
13764
|
init_lib();
|
|
13298
|
-
var
|
|
13765
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
13299
13766
|
var getClassName39 = get_class_name_factory_default("Nav", styles_module_default31);
|
|
13300
13767
|
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default31);
|
|
13301
13768
|
var MenuItem = ({
|
|
@@ -13306,7 +13773,7 @@ var MenuItem = ({
|
|
|
13306
13773
|
mobileOnly,
|
|
13307
13774
|
desktopOnly
|
|
13308
13775
|
}) => {
|
|
13309
|
-
return /* @__PURE__ */ (0,
|
|
13776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
13310
13777
|
"li",
|
|
13311
13778
|
{
|
|
13312
13779
|
className: getClassNameItem3({
|
|
@@ -13314,9 +13781,9 @@ var MenuItem = ({
|
|
|
13314
13781
|
mobileOnly,
|
|
13315
13782
|
desktopOnly
|
|
13316
13783
|
}),
|
|
13317
|
-
children: onClick && /* @__PURE__ */ (0,
|
|
13318
|
-
icon && /* @__PURE__ */ (0,
|
|
13319
|
-
/* @__PURE__ */ (0,
|
|
13784
|
+
children: onClick && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
13785
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
13786
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
13320
13787
|
] })
|
|
13321
13788
|
}
|
|
13322
13789
|
);
|
|
@@ -13325,9 +13792,9 @@ var Nav = ({
|
|
|
13325
13792
|
items,
|
|
13326
13793
|
mobileActions
|
|
13327
13794
|
}) => {
|
|
13328
|
-
return /* @__PURE__ */ (0,
|
|
13329
|
-
/* @__PURE__ */ (0,
|
|
13330
|
-
mobileActions && /* @__PURE__ */ (0,
|
|
13795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("nav", { className: getClassName39(), children: [
|
|
13796
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("ul", { className: getClassName39("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(MenuItem, __spreadValues({}, item), key)) }),
|
|
13797
|
+
mobileActions && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: getClassName39("mobileActions"), children: mobileActions })
|
|
13331
13798
|
] });
|
|
13332
13799
|
};
|
|
13333
13800
|
|
|
@@ -13345,13 +13812,13 @@ var styles_module_default32 = { "BlocksPlugin": "_BlocksPlugin_1ey1i_1" };
|
|
|
13345
13812
|
|
|
13346
13813
|
// plugins/blocks/index.tsx
|
|
13347
13814
|
init_lib();
|
|
13348
|
-
var
|
|
13815
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
13349
13816
|
var getClassName40 = get_class_name_factory_default("BlocksPlugin", styles_module_default32);
|
|
13350
13817
|
var blocksPlugin = () => ({
|
|
13351
13818
|
name: "blocks",
|
|
13352
13819
|
label: "Blocks",
|
|
13353
|
-
render: () => /* @__PURE__ */ (0,
|
|
13354
|
-
icon: /* @__PURE__ */ (0,
|
|
13820
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: getClassName40(), children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Components, {}) }),
|
|
13821
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Hammer, {})
|
|
13355
13822
|
});
|
|
13356
13823
|
|
|
13357
13824
|
// plugins/outline/index.tsx
|
|
@@ -13364,13 +13831,13 @@ var styles_module_default33 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
|
13364
13831
|
|
|
13365
13832
|
// plugins/outline/index.tsx
|
|
13366
13833
|
init_lib();
|
|
13367
|
-
var
|
|
13834
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
13368
13835
|
var getClassName41 = get_class_name_factory_default("OutlinePlugin", styles_module_default33);
|
|
13369
13836
|
var outlinePlugin = () => ({
|
|
13370
13837
|
name: "outline",
|
|
13371
13838
|
label: "Outline",
|
|
13372
|
-
render: () => /* @__PURE__ */ (0,
|
|
13373
|
-
icon: /* @__PURE__ */ (0,
|
|
13839
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getClassName41(), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Outline, {}) }),
|
|
13840
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Layers, {})
|
|
13374
13841
|
});
|
|
13375
13842
|
|
|
13376
13843
|
// plugins/fields/index.tsx
|
|
@@ -13384,7 +13851,7 @@ var styles_module_default34 = { "FieldsPlugin": "_FieldsPlugin_nd930_1", "Fields
|
|
|
13384
13851
|
|
|
13385
13852
|
// plugins/fields/index.tsx
|
|
13386
13853
|
init_lib();
|
|
13387
|
-
var
|
|
13854
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
13388
13855
|
var getClassName42 = get_class_name_factory_default("FieldsPlugin", styles_module_default34);
|
|
13389
13856
|
var CurrentTitle = () => {
|
|
13390
13857
|
const label = useAppStore((s) => {
|
|
@@ -13397,16 +13864,16 @@ var CurrentTitle = () => {
|
|
|
13397
13864
|
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
13398
13865
|
name: "fields",
|
|
13399
13866
|
label: "Fields",
|
|
13400
|
-
render: () => /* @__PURE__ */ (0,
|
|
13401
|
-
/* @__PURE__ */ (0,
|
|
13402
|
-
/* @__PURE__ */ (0,
|
|
13867
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassName42(), children: [
|
|
13868
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassName42("header"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CurrentTitle, {}) }) }),
|
|
13869
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Fields, {})
|
|
13403
13870
|
] }),
|
|
13404
|
-
icon: /* @__PURE__ */ (0,
|
|
13871
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(RectangleEllipsis, {}),
|
|
13405
13872
|
mobileOnly: desktopSideBar === "right"
|
|
13406
13873
|
});
|
|
13407
13874
|
|
|
13408
13875
|
// components/Puck/components/Layout/index.tsx
|
|
13409
|
-
var
|
|
13876
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
13410
13877
|
var getClassName43 = get_class_name_factory_default("Puck", styles_module_default22);
|
|
13411
13878
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default22);
|
|
13412
13879
|
var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default22);
|
|
@@ -13417,14 +13884,14 @@ var FieldSideBar = () => {
|
|
|
13417
13884
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
|
|
13418
13885
|
}
|
|
13419
13886
|
);
|
|
13420
|
-
return /* @__PURE__ */ (0,
|
|
13887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Fields, {}) });
|
|
13421
13888
|
};
|
|
13422
13889
|
var PluginTab = ({
|
|
13423
13890
|
children,
|
|
13424
13891
|
visible,
|
|
13425
13892
|
mobileOnly
|
|
13426
13893
|
}) => {
|
|
13427
|
-
return /* @__PURE__ */ (0,
|
|
13894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getPluginTabClassName("body"), children }) });
|
|
13428
13895
|
};
|
|
13429
13896
|
var Layout = ({ children }) => {
|
|
13430
13897
|
const {
|
|
@@ -13434,7 +13901,7 @@ var Layout = ({ children }) => {
|
|
|
13434
13901
|
plugins,
|
|
13435
13902
|
height
|
|
13436
13903
|
} = usePropsContext();
|
|
13437
|
-
const iframe = (0,
|
|
13904
|
+
const iframe = (0, import_react93.useMemo)(
|
|
13438
13905
|
() => __spreadValues({
|
|
13439
13906
|
enabled: true,
|
|
13440
13907
|
waitForStyles: true
|
|
@@ -13460,7 +13927,7 @@ var Layout = ({ children }) => {
|
|
|
13460
13927
|
sidebarRef: rightSidebarRef,
|
|
13461
13928
|
handleResizeEnd: handleRightSidebarResizeEnd
|
|
13462
13929
|
} = useSidebarResize("right", dispatch);
|
|
13463
|
-
(0,
|
|
13930
|
+
(0, import_react93.useEffect)(() => {
|
|
13464
13931
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
13465
13932
|
dispatch({
|
|
13466
13933
|
type: "setUi",
|
|
@@ -13484,17 +13951,17 @@ var Layout = ({ children }) => {
|
|
|
13484
13951
|
};
|
|
13485
13952
|
}, []);
|
|
13486
13953
|
const overrides = useAppStore((s) => s.overrides);
|
|
13487
|
-
const CustomPuck = (0,
|
|
13954
|
+
const CustomPuck = (0, import_react93.useMemo)(
|
|
13488
13955
|
() => overrides.puck || DefaultOverride,
|
|
13489
13956
|
[overrides]
|
|
13490
13957
|
);
|
|
13491
|
-
const [mounted, setMounted] = (0,
|
|
13492
|
-
(0,
|
|
13958
|
+
const [mounted, setMounted] = (0, import_react93.useState)(false);
|
|
13959
|
+
(0, import_react93.useEffect)(() => {
|
|
13493
13960
|
setMounted(true);
|
|
13494
13961
|
}, []);
|
|
13495
13962
|
const ready = useAppStore((s) => s.status === "READY");
|
|
13496
13963
|
useMonitorHotkeys();
|
|
13497
|
-
(0,
|
|
13964
|
+
(0, import_react93.useEffect)(() => {
|
|
13498
13965
|
if (ready && iframe.enabled) {
|
|
13499
13966
|
const frameDoc = getFrame();
|
|
13500
13967
|
if (frameDoc) {
|
|
@@ -13517,12 +13984,12 @@ var Layout = ({ children }) => {
|
|
|
13517
13984
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
13518
13985
|
});
|
|
13519
13986
|
const appStoreApi = useAppStoreApi();
|
|
13520
|
-
const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0,
|
|
13521
|
-
const hasLegacySideBarPlugin = (0,
|
|
13987
|
+
const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0, import_react93.useState)("toggle");
|
|
13988
|
+
const hasLegacySideBarPlugin = (0, import_react93.useMemo)(
|
|
13522
13989
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
13523
13990
|
[plugins]
|
|
13524
13991
|
);
|
|
13525
|
-
const pluginItems = (0,
|
|
13992
|
+
const pluginItems = (0, import_react93.useMemo)(() => {
|
|
13526
13993
|
const details = {};
|
|
13527
13994
|
const defaultPlugins = [blocksPlugin(), outlinePlugin()];
|
|
13528
13995
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
@@ -13541,7 +14008,7 @@ var Layout = ({ children }) => {
|
|
|
13541
14008
|
}
|
|
13542
14009
|
details[plugin.name] = {
|
|
13543
14010
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
13544
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0,
|
|
14011
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToyBrick, {}),
|
|
13545
14012
|
onClick: () => {
|
|
13546
14013
|
var _a2;
|
|
13547
14014
|
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
@@ -13569,7 +14036,7 @@ var Layout = ({ children }) => {
|
|
|
13569
14036
|
});
|
|
13570
14037
|
return details;
|
|
13571
14038
|
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
13572
|
-
(0,
|
|
14039
|
+
(0, import_react93.useEffect)(() => {
|
|
13573
14040
|
if (!currentPlugin) {
|
|
13574
14041
|
const names = Object.keys(pluginItems);
|
|
13575
14042
|
setUi({ plugin: { current: names[0] } });
|
|
@@ -13582,7 +14049,7 @@ var Layout = ({ children }) => {
|
|
|
13582
14049
|
return (_a = s.state.ui.mobilePanelExpanded) != null ? _a : false;
|
|
13583
14050
|
}
|
|
13584
14051
|
);
|
|
13585
|
-
return /* @__PURE__ */ (0,
|
|
14052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
13586
14053
|
"div",
|
|
13587
14054
|
{
|
|
13588
14055
|
className: `Puck ${getClassName43({
|
|
@@ -13591,7 +14058,7 @@ var Layout = ({ children }) => {
|
|
|
13591
14058
|
id: instanceId,
|
|
13592
14059
|
style: { height },
|
|
13593
14060
|
children: [
|
|
13594
|
-
/* @__PURE__ */ (0,
|
|
14061
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13595
14062
|
"div",
|
|
13596
14063
|
{
|
|
13597
14064
|
className: getLayoutClassName({
|
|
@@ -13603,18 +14070,18 @@ var Layout = ({ children }) => {
|
|
|
13603
14070
|
mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content"
|
|
13604
14071
|
}),
|
|
13605
14072
|
style: { height },
|
|
13606
|
-
children: /* @__PURE__ */ (0,
|
|
14073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
13607
14074
|
"div",
|
|
13608
14075
|
{
|
|
13609
14076
|
className: getLayoutClassName("inner"),
|
|
13610
14077
|
style: layoutOptions,
|
|
13611
14078
|
children: [
|
|
13612
|
-
/* @__PURE__ */ (0,
|
|
13613
|
-
/* @__PURE__ */ (0,
|
|
14079
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Header, { hidePlugins: hasLegacySideBarPlugin }) }),
|
|
14080
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13614
14081
|
Nav,
|
|
13615
14082
|
{
|
|
13616
14083
|
items: pluginItems,
|
|
13617
|
-
mobileActions: leftSideBarVisible && mobilePanelHeightMode === "toggle" && /* @__PURE__ */ (0,
|
|
14084
|
+
mobileActions: leftSideBarVisible && mobilePanelHeightMode === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13618
14085
|
IconButton,
|
|
13619
14086
|
{
|
|
13620
14087
|
type: "button",
|
|
@@ -13624,12 +14091,12 @@ var Layout = ({ children }) => {
|
|
|
13624
14091
|
mobilePanelExpanded: !mobilePanelExpanded
|
|
13625
14092
|
});
|
|
13626
14093
|
},
|
|
13627
|
-
children: mobilePanelExpanded ? /* @__PURE__ */ (0,
|
|
14094
|
+
children: mobilePanelExpanded ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Minimize2, { size: 21 }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Maximize2, { size: 21 })
|
|
13628
14095
|
}
|
|
13629
14096
|
)
|
|
13630
14097
|
}
|
|
13631
14098
|
) }),
|
|
13632
|
-
/* @__PURE__ */ (0,
|
|
14099
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13633
14100
|
Sidebar,
|
|
13634
14101
|
{
|
|
13635
14102
|
position: "left",
|
|
@@ -13638,20 +14105,20 @@ var Layout = ({ children }) => {
|
|
|
13638
14105
|
onResize: setLeftWidth,
|
|
13639
14106
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
13640
14107
|
children: Object.entries(pluginItems).map(
|
|
13641
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0,
|
|
14108
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13642
14109
|
PluginTab,
|
|
13643
14110
|
{
|
|
13644
14111
|
visible: currentPlugin === id,
|
|
13645
14112
|
mobileOnly,
|
|
13646
|
-
children: /* @__PURE__ */ (0,
|
|
14113
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Render2, {})
|
|
13647
14114
|
},
|
|
13648
14115
|
id
|
|
13649
14116
|
)
|
|
13650
14117
|
)
|
|
13651
14118
|
}
|
|
13652
14119
|
),
|
|
13653
|
-
/* @__PURE__ */ (0,
|
|
13654
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0,
|
|
14120
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Canvas, {}),
|
|
14121
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
13655
14122
|
Sidebar,
|
|
13656
14123
|
{
|
|
13657
14124
|
position: "right",
|
|
@@ -13659,7 +14126,7 @@ var Layout = ({ children }) => {
|
|
|
13659
14126
|
isVisible: rightSideBarVisible,
|
|
13660
14127
|
onResize: setRightWidth,
|
|
13661
14128
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
13662
|
-
children: /* @__PURE__ */ (0,
|
|
14129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FieldSideBar, {})
|
|
13663
14130
|
}
|
|
13664
14131
|
)
|
|
13665
14132
|
]
|
|
@@ -13667,19 +14134,19 @@ var Layout = ({ children }) => {
|
|
|
13667
14134
|
)
|
|
13668
14135
|
}
|
|
13669
14136
|
) }) }) }),
|
|
13670
|
-
/* @__PURE__ */ (0,
|
|
14137
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { id: "puck-portal-root", className: getClassName43("portal") })
|
|
13671
14138
|
]
|
|
13672
14139
|
}
|
|
13673
14140
|
);
|
|
13674
14141
|
};
|
|
13675
14142
|
|
|
13676
14143
|
// components/Puck/index.tsx
|
|
13677
|
-
var
|
|
13678
|
-
var propsContext = (0,
|
|
14144
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
14145
|
+
var propsContext = (0, import_react94.createContext)({});
|
|
13679
14146
|
function PropsProvider(props) {
|
|
13680
|
-
return /* @__PURE__ */ (0,
|
|
14147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
13681
14148
|
}
|
|
13682
|
-
var usePropsContext = () => (0,
|
|
14149
|
+
var usePropsContext = () => (0, import_react94.useContext)(propsContext);
|
|
13683
14150
|
function PuckProvider({ children }) {
|
|
13684
14151
|
const {
|
|
13685
14152
|
config,
|
|
@@ -13694,16 +14161,18 @@ function PuckProvider({ children }) {
|
|
|
13694
14161
|
initialHistory: _initialHistory,
|
|
13695
14162
|
metadata,
|
|
13696
14163
|
onAction,
|
|
13697
|
-
fieldTransforms
|
|
14164
|
+
fieldTransforms,
|
|
14165
|
+
_experimentalFullScreenCanvas,
|
|
14166
|
+
_experimentalVirtualization
|
|
13698
14167
|
} = usePropsContext();
|
|
13699
|
-
const iframe = (0,
|
|
14168
|
+
const iframe = (0, import_react94.useMemo)(
|
|
13700
14169
|
() => __spreadValues({
|
|
13701
14170
|
enabled: true,
|
|
13702
14171
|
waitForStyles: true
|
|
13703
14172
|
}, _iframe),
|
|
13704
14173
|
[_iframe]
|
|
13705
14174
|
);
|
|
13706
|
-
const [generatedAppState] = (0,
|
|
14175
|
+
const [generatedAppState] = (0, import_react94.useState)(() => {
|
|
13707
14176
|
var _a, _b, _c;
|
|
13708
14177
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
13709
14178
|
let clientUiState = {};
|
|
@@ -13743,7 +14212,7 @@ function PuckProvider({ children }) {
|
|
|
13743
14212
|
return walkAppState(newAppState, config);
|
|
13744
14213
|
});
|
|
13745
14214
|
const { appendData = true } = _initialHistory || {};
|
|
13746
|
-
const [blendedHistories] = (0,
|
|
14215
|
+
const [blendedHistories] = (0, import_react94.useState)(
|
|
13747
14216
|
[
|
|
13748
14217
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
13749
14218
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -13757,7 +14226,7 @@ function PuckProvider({ children }) {
|
|
|
13757
14226
|
});
|
|
13758
14227
|
})
|
|
13759
14228
|
);
|
|
13760
|
-
const initialHistoryIndex = (0,
|
|
14229
|
+
const initialHistoryIndex = (0, import_react94.useMemo)(() => {
|
|
13761
14230
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
13762
14231
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
13763
14232
|
}
|
|
@@ -13768,7 +14237,7 @@ function PuckProvider({ children }) {
|
|
|
13768
14237
|
overrides,
|
|
13769
14238
|
plugins
|
|
13770
14239
|
});
|
|
13771
|
-
const loadedFieldTransforms = (0,
|
|
14240
|
+
const loadedFieldTransforms = (0, import_react94.useMemo)(() => {
|
|
13772
14241
|
const _plugins = plugins || [];
|
|
13773
14242
|
const pluginFieldTransforms = _plugins.reduce(
|
|
13774
14243
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -13777,7 +14246,7 @@ function PuckProvider({ children }) {
|
|
|
13777
14246
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
13778
14247
|
}, [fieldTransforms, plugins]);
|
|
13779
14248
|
const instanceId = useSafeId();
|
|
13780
|
-
const generateAppStore = (0,
|
|
14249
|
+
const generateAppStore = (0, import_react94.useCallback)(
|
|
13781
14250
|
(state) => {
|
|
13782
14251
|
return {
|
|
13783
14252
|
instanceId,
|
|
@@ -13787,6 +14256,8 @@ function PuckProvider({ children }) {
|
|
|
13787
14256
|
overrides: loadedOverrides,
|
|
13788
14257
|
viewports,
|
|
13789
14258
|
iframe,
|
|
14259
|
+
_experimentalFullScreenCanvas: !!_experimentalFullScreenCanvas,
|
|
14260
|
+
_experimentalVirtualization: !!_experimentalVirtualization,
|
|
13790
14261
|
onAction,
|
|
13791
14262
|
metadata,
|
|
13792
14263
|
fieldTransforms: loadedFieldTransforms
|
|
@@ -13800,30 +14271,32 @@ function PuckProvider({ children }) {
|
|
|
13800
14271
|
loadedOverrides,
|
|
13801
14272
|
viewports,
|
|
13802
14273
|
iframe,
|
|
14274
|
+
_experimentalFullScreenCanvas,
|
|
14275
|
+
_experimentalVirtualization,
|
|
13803
14276
|
onAction,
|
|
13804
14277
|
metadata,
|
|
13805
14278
|
loadedFieldTransforms
|
|
13806
14279
|
]
|
|
13807
14280
|
);
|
|
13808
|
-
const [appStore] = (0,
|
|
14281
|
+
const [appStore] = (0, import_react94.useState)(
|
|
13809
14282
|
() => createAppStore(generateAppStore(initialAppState))
|
|
13810
14283
|
);
|
|
13811
|
-
(0,
|
|
14284
|
+
(0, import_react94.useEffect)(() => {
|
|
13812
14285
|
if (process.env.NODE_ENV !== "production") {
|
|
13813
14286
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
13814
14287
|
}
|
|
13815
14288
|
}, [appStore]);
|
|
13816
|
-
(0,
|
|
14289
|
+
(0, import_react94.useEffect)(() => {
|
|
13817
14290
|
const state = appStore.getState().state;
|
|
13818
14291
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
13819
|
-
}, [
|
|
14292
|
+
}, [generateAppStore]);
|
|
13820
14293
|
useRegisterHistorySlice(appStore, {
|
|
13821
14294
|
histories: blendedHistories,
|
|
13822
14295
|
index: initialHistoryIndex,
|
|
13823
14296
|
initialAppState
|
|
13824
14297
|
});
|
|
13825
|
-
const previousData = (0,
|
|
13826
|
-
(0,
|
|
14298
|
+
const previousData = (0, import_react94.useRef)(null);
|
|
14299
|
+
(0, import_react94.useEffect)(() => {
|
|
13827
14300
|
return appStore.subscribe(
|
|
13828
14301
|
(s) => s.state.data,
|
|
13829
14302
|
(data) => {
|
|
@@ -13837,14 +14310,16 @@ function PuckProvider({ children }) {
|
|
|
13837
14310
|
}, [onChange]);
|
|
13838
14311
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
13839
14312
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
13840
|
-
(0,
|
|
14313
|
+
(0, import_react94.useEffect)(() => {
|
|
13841
14314
|
const { resolveAndCommitData } = appStore.getState();
|
|
13842
|
-
|
|
14315
|
+
setTimeout(() => {
|
|
14316
|
+
resolveAndCommitData();
|
|
14317
|
+
}, 0);
|
|
13843
14318
|
}, []);
|
|
13844
|
-
return /* @__PURE__ */ (0,
|
|
14319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
13845
14320
|
}
|
|
13846
14321
|
function Puck(props) {
|
|
13847
|
-
return /* @__PURE__ */ (0,
|
|
14322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Layout, { children: props.children }) })) }));
|
|
13848
14323
|
}
|
|
13849
14324
|
Puck.Components = Components;
|
|
13850
14325
|
Puck.Fields = Fields;
|
|
@@ -14107,12 +14582,12 @@ init_walk_tree();
|
|
|
14107
14582
|
|
|
14108
14583
|
// plugins/legacy-side-bar/index.tsx
|
|
14109
14584
|
init_react_import();
|
|
14110
|
-
var
|
|
14585
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
14111
14586
|
var legacySideBarPlugin = () => ({
|
|
14112
14587
|
name: "legacy-side-bar",
|
|
14113
|
-
render: () => /* @__PURE__ */ (0,
|
|
14114
|
-
/* @__PURE__ */ (0,
|
|
14115
|
-
/* @__PURE__ */ (0,
|
|
14588
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { style: { overflowY: "auto" }, children: [
|
|
14589
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Components, {}) }),
|
|
14590
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Outline, {}) })
|
|
14116
14591
|
] })
|
|
14117
14592
|
});
|
|
14118
14593
|
// Annotate the CommonJS export names for ESM import in node:
|