@measured/puck 0.18.0-canary.b355ddd → 0.18.0-canary.beb05b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +344 -345
- package/dist/index.mjs +275 -276
- package/dist/{resolve-all-data-GYzT3ont.d.mts → resolve-all-data-DzJEE28m.d.mts} +2 -1
- package/dist/{resolve-all-data-GYzT3ont.d.ts → resolve-all-data-DzJEE28m.d.ts} +2 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +1 -3
package/dist/index.js
CHANGED
@@ -1161,6 +1161,7 @@ var defaultAppState = {
|
|
1161
1161
|
itemSelector: null,
|
1162
1162
|
componentList: {},
|
1163
1163
|
isDragging: false,
|
1164
|
+
previewMode: "edit",
|
1164
1165
|
viewports: {
|
1165
1166
|
current: {
|
1166
1167
|
width: defaultViewports[0].width,
|
@@ -2523,52 +2524,26 @@ init_react_import();
|
|
2523
2524
|
var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
|
2524
2525
|
|
2525
2526
|
// components/Drawer/index.tsx
|
2526
|
-
var
|
2527
|
+
var import_react26 = require("react");
|
2527
2528
|
|
2528
2529
|
// components/DragDropContext/index.tsx
|
2529
2530
|
init_react_import();
|
2530
|
-
var
|
2531
|
-
var
|
2531
|
+
var import_react24 = require("@dnd-kit/react");
|
2532
|
+
var import_react25 = require("react");
|
2532
2533
|
var import_dom = require("@dnd-kit/dom");
|
2533
2534
|
|
2534
2535
|
// components/DropZone/index.tsx
|
2535
2536
|
init_react_import();
|
2536
|
-
var
|
2537
|
+
var import_react23 = require("react");
|
2537
2538
|
|
2538
2539
|
// components/DraggableComponent/index.tsx
|
2539
2540
|
init_react_import();
|
2540
|
-
var
|
2541
|
+
var import_react20 = require("react");
|
2541
2542
|
|
2542
2543
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
2543
2544
|
init_react_import();
|
2544
2545
|
var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_1ukn8_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1ukn8_29", "DraggableComponent--hover": "_DraggableComponent--hover_1ukn8_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1ukn8_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1ukn8_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1ukn8_66", "DraggableComponent-actions": "_DraggableComponent-actions_1ukn8_66" };
|
2545
2546
|
|
2546
|
-
// lib/use-modifier-held.ts
|
2547
|
-
init_react_import();
|
2548
|
-
var import_react20 = require("react");
|
2549
|
-
var useModifierHeld = (modifier) => {
|
2550
|
-
const [modifierHeld, setModifierHeld] = (0, import_react20.useState)(false);
|
2551
|
-
(0, import_react20.useEffect)(() => {
|
2552
|
-
function downHandler({ key }) {
|
2553
|
-
if (key === modifier) {
|
2554
|
-
setModifierHeld(true);
|
2555
|
-
}
|
2556
|
-
}
|
2557
|
-
function upHandler({ key }) {
|
2558
|
-
if (key === modifier) {
|
2559
|
-
setModifierHeld(false);
|
2560
|
-
}
|
2561
|
-
}
|
2562
|
-
window.addEventListener("keydown", downHandler);
|
2563
|
-
window.addEventListener("keyup", upHandler);
|
2564
|
-
return () => {
|
2565
|
-
window.removeEventListener("keydown", downHandler);
|
2566
|
-
window.removeEventListener("keyup", upHandler);
|
2567
|
-
};
|
2568
|
-
}, [modifier]);
|
2569
|
-
return modifierHeld;
|
2570
|
-
};
|
2571
|
-
|
2572
2547
|
// components/DraggableComponent/index.tsx
|
2573
2548
|
var import_react_dom2 = require("react-dom");
|
2574
2549
|
|
@@ -2970,10 +2945,9 @@ var DraggableComponent = ({
|
|
2970
2945
|
iframe,
|
2971
2946
|
state
|
2972
2947
|
} = useAppContext();
|
2973
|
-
const
|
2974
|
-
const
|
2975
|
-
const
|
2976
|
-
const registerLocalZone = (0, import_react21.useCallback)(
|
2948
|
+
const ctx = (0, import_react20.useContext)(dropZoneContext);
|
2949
|
+
const [localZones, setLocalZones] = (0, import_react20.useState)({});
|
2950
|
+
const registerLocalZone = (0, import_react20.useCallback)(
|
2977
2951
|
(zoneCompound2, active) => {
|
2978
2952
|
var _a;
|
2979
2953
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
@@ -2983,7 +2957,7 @@ var DraggableComponent = ({
|
|
2983
2957
|
},
|
2984
2958
|
[setLocalZones]
|
2985
2959
|
);
|
2986
|
-
const unregisterLocalZone = (0,
|
2960
|
+
const unregisterLocalZone = (0, import_react20.useCallback)(
|
2987
2961
|
(zoneCompound2) => {
|
2988
2962
|
var _a;
|
2989
2963
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
@@ -2997,8 +2971,8 @@ var DraggableComponent = ({
|
|
2997
2971
|
);
|
2998
2972
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
2999
2973
|
const { path = [] } = ctx || {};
|
3000
|
-
const [canDrag, setCanDrag] = (0,
|
3001
|
-
(0,
|
2974
|
+
const [canDrag, setCanDrag] = (0, import_react20.useState)(false);
|
2975
|
+
(0, import_react20.useEffect)(() => {
|
3002
2976
|
var _a;
|
3003
2977
|
const item = getItem({ index, zone: zoneCompound }, state.data);
|
3004
2978
|
if (item) {
|
@@ -3011,7 +2985,7 @@ var DraggableComponent = ({
|
|
3011
2985
|
const userIsDragging = !!(ctx == null ? void 0 : ctx.draggedItem);
|
3012
2986
|
const canCollide = canDrag || userIsDragging;
|
3013
2987
|
const disabled = !isEnabled || !canCollide;
|
3014
|
-
const [dragAxis, setDragAxis] = (0,
|
2988
|
+
const [dragAxis, setDragAxis] = (0, import_react20.useState)(userDragAxis || autoDragAxis);
|
3015
2989
|
const { ref: sortableRef, status } = useSortableSafe({
|
3016
2990
|
id,
|
3017
2991
|
index,
|
@@ -3037,8 +3011,8 @@ var DraggableComponent = ({
|
|
3037
3011
|
}
|
3038
3012
|
});
|
3039
3013
|
const thisIsDragging = status === "dragging";
|
3040
|
-
const ref = (0,
|
3041
|
-
const refSetter = (0,
|
3014
|
+
const ref = (0, import_react20.useRef)(null);
|
3015
|
+
const refSetter = (0, import_react20.useCallback)(
|
3042
3016
|
(el) => {
|
3043
3017
|
sortableRef(el);
|
3044
3018
|
if (el) {
|
@@ -3047,14 +3021,14 @@ var DraggableComponent = ({
|
|
3047
3021
|
},
|
3048
3022
|
[sortableRef]
|
3049
3023
|
);
|
3050
|
-
const [portalEl, setPortalEl] = (0,
|
3051
|
-
(0,
|
3024
|
+
const [portalEl, setPortalEl] = (0, import_react20.useState)();
|
3025
|
+
(0, import_react20.useEffect)(() => {
|
3052
3026
|
var _a, _b, _c;
|
3053
3027
|
setPortalEl(
|
3054
3028
|
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
|
3055
3029
|
);
|
3056
3030
|
}, [iframe.enabled, ref.current]);
|
3057
|
-
const getStyle = (0,
|
3031
|
+
const getStyle = (0, import_react20.useCallback)(() => {
|
3058
3032
|
var _a, _b, _c;
|
3059
3033
|
if (!ref.current) return;
|
3060
3034
|
const rect = ref.current.getBoundingClientRect();
|
@@ -3074,11 +3048,11 @@ var DraggableComponent = ({
|
|
3074
3048
|
};
|
3075
3049
|
return style2;
|
3076
3050
|
}, [ref.current]);
|
3077
|
-
const [style, setStyle] = (0,
|
3078
|
-
const sync = (0,
|
3051
|
+
const [style, setStyle] = (0, import_react20.useState)();
|
3052
|
+
const sync = (0, import_react20.useCallback)(() => {
|
3079
3053
|
setStyle(getStyle());
|
3080
3054
|
}, [ref.current, iframe]);
|
3081
|
-
(0,
|
3055
|
+
(0, import_react20.useEffect)(() => {
|
3082
3056
|
if (ref.current) {
|
3083
3057
|
const observer = new ResizeObserver(sync);
|
3084
3058
|
observer.observe(ref.current);
|
@@ -3087,20 +3061,20 @@ var DraggableComponent = ({
|
|
3087
3061
|
};
|
3088
3062
|
}
|
3089
3063
|
}, [ref.current]);
|
3090
|
-
(0,
|
3064
|
+
(0, import_react20.useEffect)(() => {
|
3091
3065
|
ctx == null ? void 0 : ctx.registerPath({
|
3092
3066
|
index,
|
3093
3067
|
zone: zoneCompound
|
3094
3068
|
});
|
3095
3069
|
}, [isSelected]);
|
3096
|
-
const CustomActionBar = (0,
|
3070
|
+
const CustomActionBar = (0, import_react20.useMemo)(
|
3097
3071
|
() => overrides.actionBar || DefaultActionBar,
|
3098
3072
|
[overrides.actionBar]
|
3099
3073
|
);
|
3100
3074
|
const permissions = getPermissions({
|
3101
3075
|
item: selectedItem
|
3102
3076
|
});
|
3103
|
-
const onClick = (0,
|
3077
|
+
const onClick = (0, import_react20.useCallback)(
|
3104
3078
|
(e) => {
|
3105
3079
|
e.stopPropagation();
|
3106
3080
|
dispatch({
|
@@ -3112,7 +3086,7 @@ var DraggableComponent = ({
|
|
3112
3086
|
},
|
3113
3087
|
[index, zoneCompound, id]
|
3114
3088
|
);
|
3115
|
-
const onSelectParent = (0,
|
3089
|
+
const onSelectParent = (0, import_react20.useCallback)(() => {
|
3116
3090
|
if (!(ctx == null ? void 0 : ctx.areaId)) {
|
3117
3091
|
return;
|
3118
3092
|
}
|
@@ -3130,23 +3104,23 @@ var DraggableComponent = ({
|
|
3130
3104
|
}
|
3131
3105
|
});
|
3132
3106
|
}, [ctx, path]);
|
3133
|
-
const onDuplicate = (0,
|
3107
|
+
const onDuplicate = (0, import_react20.useCallback)(() => {
|
3134
3108
|
dispatch({
|
3135
3109
|
type: "duplicate",
|
3136
3110
|
sourceIndex: index,
|
3137
3111
|
sourceZone: zoneCompound
|
3138
3112
|
});
|
3139
3113
|
}, [index, zoneCompound]);
|
3140
|
-
const onDelete = (0,
|
3114
|
+
const onDelete = (0, import_react20.useCallback)(() => {
|
3141
3115
|
dispatch({
|
3142
3116
|
type: "remove",
|
3143
3117
|
index,
|
3144
3118
|
zone: zoneCompound
|
3145
3119
|
});
|
3146
3120
|
}, [index, zoneCompound]);
|
3147
|
-
const [hover, setHover] = (0,
|
3121
|
+
const [hover, setHover] = (0, import_react20.useState)(false);
|
3148
3122
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
3149
|
-
(0,
|
3123
|
+
(0, import_react20.useEffect)(() => {
|
3150
3124
|
if (!ref.current) {
|
3151
3125
|
return;
|
3152
3126
|
}
|
@@ -3196,7 +3170,7 @@ var DraggableComponent = ({
|
|
3196
3170
|
thisIsDragging,
|
3197
3171
|
inDroppableZone
|
3198
3172
|
]);
|
3199
|
-
(0,
|
3173
|
+
(0, import_react20.useEffect)(() => {
|
3200
3174
|
if (ref.current && disabled) {
|
3201
3175
|
ref.current.setAttribute("data-puck-disabled", "");
|
3202
3176
|
return () => {
|
@@ -3205,8 +3179,8 @@ var DraggableComponent = ({
|
|
3205
3179
|
};
|
3206
3180
|
}
|
3207
3181
|
}, [disabled, ref]);
|
3208
|
-
const [isVisible, setIsVisible] = (0,
|
3209
|
-
(0,
|
3182
|
+
const [isVisible, setIsVisible] = (0, import_react20.useState)(false);
|
3183
|
+
(0, import_react20.useEffect)(() => {
|
3210
3184
|
sync();
|
3211
3185
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
3212
3186
|
setIsVisible(true);
|
@@ -3214,7 +3188,7 @@ var DraggableComponent = ({
|
|
3214
3188
|
setIsVisible(false);
|
3215
3189
|
}
|
3216
3190
|
}, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
|
3217
|
-
const syncActionsPosition = (0,
|
3191
|
+
const syncActionsPosition = (0, import_react20.useCallback)(
|
3218
3192
|
(el) => {
|
3219
3193
|
if (el) {
|
3220
3194
|
const view = el.ownerDocument.defaultView;
|
@@ -3231,7 +3205,7 @@ var DraggableComponent = ({
|
|
3231
3205
|
},
|
3232
3206
|
[zoomConfig]
|
3233
3207
|
);
|
3234
|
-
(0,
|
3208
|
+
(0, import_react20.useEffect)(() => {
|
3235
3209
|
if (userDragAxis) {
|
3236
3210
|
setDragAxis(userDragAxis);
|
3237
3211
|
return;
|
@@ -3266,7 +3240,6 @@ var DraggableComponent = ({
|
|
3266
3240
|
className: getClassName16({
|
3267
3241
|
isSelected,
|
3268
3242
|
isDragging: thisIsDragging,
|
3269
|
-
isModifierHeld,
|
3270
3243
|
hover: hover || indicativeHover
|
3271
3244
|
}),
|
3272
3245
|
style: __spreadValues({}, style),
|
@@ -3326,26 +3299,26 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
|
|
3326
3299
|
|
3327
3300
|
// components/DropZone/context.tsx
|
3328
3301
|
init_react_import();
|
3329
|
-
var
|
3302
|
+
var import_react21 = require("react");
|
3330
3303
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
3331
|
-
var dropZoneContext = (0,
|
3304
|
+
var dropZoneContext = (0, import_react21.createContext)(null);
|
3332
3305
|
var DropZoneProvider = ({
|
3333
3306
|
children,
|
3334
3307
|
value
|
3335
3308
|
}) => {
|
3336
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
3337
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
3309
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
|
3310
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
|
3338
3311
|
{}
|
3339
3312
|
);
|
3340
|
-
const [activeZones, setActiveZones] = (0,
|
3341
|
-
const { dispatch
|
3342
|
-
const registerZoneArea = (0,
|
3313
|
+
const [activeZones, setActiveZones] = (0, import_react21.useState)({});
|
3314
|
+
const { dispatch } = useAppContext();
|
3315
|
+
const registerZoneArea = (0, import_react21.useCallback)(
|
3343
3316
|
(area) => {
|
3344
3317
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
3345
3318
|
},
|
3346
3319
|
[setAreasWithZones]
|
3347
3320
|
);
|
3348
|
-
const registerZone = (0,
|
3321
|
+
const registerZone = (0, import_react21.useCallback)(
|
3349
3322
|
(zoneCompound) => {
|
3350
3323
|
if (!dispatch) {
|
3351
3324
|
return;
|
@@ -3358,7 +3331,7 @@ var DropZoneProvider = ({
|
|
3358
3331
|
},
|
3359
3332
|
[setActiveZones, dispatch]
|
3360
3333
|
);
|
3361
|
-
const unregisterZone = (0,
|
3334
|
+
const unregisterZone = (0, import_react21.useCallback)(
|
3362
3335
|
(zoneCompound) => {
|
3363
3336
|
if (!dispatch) {
|
3364
3337
|
return;
|
@@ -3373,7 +3346,7 @@ var DropZoneProvider = ({
|
|
3373
3346
|
},
|
3374
3347
|
[setActiveZones, dispatch]
|
3375
3348
|
);
|
3376
|
-
const memoValue = (0,
|
3349
|
+
const memoValue = (0, import_react21.useMemo)(
|
3377
3350
|
() => __spreadValues({
|
3378
3351
|
hoveringComponent,
|
3379
3352
|
setHoveringComponent,
|
@@ -3398,16 +3371,16 @@ var insert = (list, index, item) => {
|
|
3398
3371
|
|
3399
3372
|
// components/DropZone/use-min-empty-height.ts
|
3400
3373
|
init_react_import();
|
3401
|
-
var
|
3374
|
+
var import_react22 = require("react");
|
3402
3375
|
var useMinEmptyHeight = ({
|
3403
3376
|
draggedItem,
|
3404
3377
|
zoneCompound,
|
3405
3378
|
userMinEmptyHeight,
|
3406
3379
|
ref
|
3407
3380
|
}) => {
|
3408
|
-
const [prevHeight, setPrevHeight] = (0,
|
3409
|
-
const [isAnimating, setIsAnimating] = (0,
|
3410
|
-
(0,
|
3381
|
+
const [prevHeight, setPrevHeight] = (0, import_react22.useState)(0);
|
3382
|
+
const [isAnimating, setIsAnimating] = (0, import_react22.useState)(false);
|
3383
|
+
(0, import_react22.useEffect)(() => {
|
3411
3384
|
if (draggedItem && ref.current) {
|
3412
3385
|
const componentData = draggedItem.data;
|
3413
3386
|
if (componentData.zone === zoneCompound) {
|
@@ -3447,7 +3420,7 @@ var DEBUG3 = false;
|
|
3447
3420
|
var GRID_DRAG_AXIS = "dynamic";
|
3448
3421
|
var FLEX_ROW_DRAG_AXIS = "x";
|
3449
3422
|
var DEFAULT_DRAG_AXIS = "y";
|
3450
|
-
var DropZoneEdit = (0,
|
3423
|
+
var DropZoneEdit = (0, import_react23.forwardRef)(
|
3451
3424
|
function DropZoneEdit2({
|
3452
3425
|
zone,
|
3453
3426
|
allow,
|
@@ -3458,7 +3431,7 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3458
3431
|
collisionAxis
|
3459
3432
|
}, userRef) {
|
3460
3433
|
const appContext2 = useAppContext();
|
3461
|
-
const ctx = (0,
|
3434
|
+
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
3462
3435
|
const {
|
3463
3436
|
// These all need setting via context
|
3464
3437
|
data,
|
@@ -3477,12 +3450,12 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3477
3450
|
} = ctx;
|
3478
3451
|
const { itemSelector } = appContext2.state.ui;
|
3479
3452
|
let zoneCompound = rootDroppableId;
|
3480
|
-
(0,
|
3453
|
+
(0, import_react23.useEffect)(() => {
|
3481
3454
|
if (areaId && registerZoneArea) {
|
3482
3455
|
registerZoneArea(areaId);
|
3483
3456
|
}
|
3484
3457
|
}, [areaId]);
|
3485
|
-
(0,
|
3458
|
+
(0, import_react23.useEffect)(() => {
|
3486
3459
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
3487
3460
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
3488
3461
|
}
|
@@ -3497,14 +3470,14 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3497
3470
|
zoneCompound = `${areaId}:${zone}`;
|
3498
3471
|
}
|
3499
3472
|
}
|
3500
|
-
const content = (0,
|
3473
|
+
const content = (0, import_react23.useMemo)(() => {
|
3501
3474
|
if (areaId && zone !== rootDroppableId) {
|
3502
3475
|
return setupZone(data, zoneCompound).zones[zoneCompound];
|
3503
3476
|
}
|
3504
3477
|
return data.content || [];
|
3505
3478
|
}, [data, zoneCompound]);
|
3506
|
-
const ref = (0,
|
3507
|
-
const acceptsTarget = (0,
|
3479
|
+
const ref = (0, import_react23.useRef)(null);
|
3480
|
+
const acceptsTarget = (0, import_react23.useCallback)(
|
3508
3481
|
(target) => {
|
3509
3482
|
if (!target) {
|
3510
3483
|
return true;
|
@@ -3528,7 +3501,7 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3528
3501
|
},
|
3529
3502
|
[allow, disallow]
|
3530
3503
|
);
|
3531
|
-
(0,
|
3504
|
+
(0, import_react23.useEffect)(() => {
|
3532
3505
|
if (registerLocalZone) {
|
3533
3506
|
registerLocalZone(zoneCompound, acceptsTarget(draggedItem));
|
3534
3507
|
}
|
@@ -3548,9 +3521,9 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3548
3521
|
if (isEnabled) {
|
3549
3522
|
isEnabled = acceptsTarget(draggedItem);
|
3550
3523
|
}
|
3551
|
-
const preview = (0,
|
3524
|
+
const preview = (0, import_react23.useContext)(previewContext);
|
3552
3525
|
const previewInZone = (preview == null ? void 0 : preview.zone) === zoneCompound;
|
3553
|
-
const contentWithPreview = (0,
|
3526
|
+
const contentWithPreview = (0, import_react23.useMemo)(() => {
|
3554
3527
|
let contentWithPreview2 = preview ? content.filter((item) => item.props.id !== preview.props.id) : content;
|
3555
3528
|
if (previewInZone) {
|
3556
3529
|
contentWithPreview2 = content.filter(
|
@@ -3587,10 +3560,10 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3587
3560
|
const { ref: dropRef } = useDroppableSafe(droppableConfig);
|
3588
3561
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
3589
3562
|
const isAreaSelected = selectedItem && areaId === selectedItem.props.id;
|
3590
|
-
const [dragAxis, setDragAxis] = (0,
|
3563
|
+
const [dragAxis, setDragAxis] = (0, import_react23.useState)(
|
3591
3564
|
collisionAxis || DEFAULT_DRAG_AXIS
|
3592
3565
|
);
|
3593
|
-
const calculateDragAxis = (0,
|
3566
|
+
const calculateDragAxis = (0, import_react23.useCallback)(() => {
|
3594
3567
|
if (ref.current) {
|
3595
3568
|
const computedStyle = window.getComputedStyle(ref.current);
|
3596
3569
|
if (computedStyle.display === "grid") {
|
@@ -3602,8 +3575,8 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3602
3575
|
}
|
3603
3576
|
}
|
3604
3577
|
}, [ref.current]);
|
3605
|
-
(0,
|
3606
|
-
(0,
|
3578
|
+
(0, import_react23.useEffect)(calculateDragAxis, [appContext2.status, collisionAxis]);
|
3579
|
+
(0, import_react23.useEffect)(() => {
|
3607
3580
|
const onViewportChange = () => {
|
3608
3581
|
calculateDragAxis();
|
3609
3582
|
};
|
@@ -3713,12 +3686,22 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
|
|
3713
3686
|
);
|
3714
3687
|
}
|
3715
3688
|
);
|
3716
|
-
var DropZoneRender = (0,
|
3689
|
+
var DropZoneRender = (0, import_react23.forwardRef)(
|
3717
3690
|
function DropZoneRender2({ className, style, zone }, ref) {
|
3718
|
-
const ctx = (0,
|
3691
|
+
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
3719
3692
|
const { data, areaId = "root", config } = ctx || {};
|
3720
3693
|
let zoneCompound = rootDroppableId;
|
3721
3694
|
let content = (data == null ? void 0 : data.content) || [];
|
3695
|
+
(0, import_react23.useEffect)(() => {
|
3696
|
+
if (ctx == null ? void 0 : ctx.registerZone) {
|
3697
|
+
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
3698
|
+
}
|
3699
|
+
return () => {
|
3700
|
+
if (ctx == null ? void 0 : ctx.unregisterZone) {
|
3701
|
+
ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
|
3702
|
+
}
|
3703
|
+
};
|
3704
|
+
}, []);
|
3722
3705
|
if (!data || !config) {
|
3723
3706
|
return null;
|
3724
3707
|
}
|
@@ -3753,9 +3736,9 @@ var DropZoneRender = (0, import_react24.forwardRef)(
|
|
3753
3736
|
}) });
|
3754
3737
|
}
|
3755
3738
|
);
|
3756
|
-
var DropZone = (0,
|
3739
|
+
var DropZone = (0, import_react23.forwardRef)(
|
3757
3740
|
function DropZone2(props, ref) {
|
3758
|
-
const ctx = (0,
|
3741
|
+
const ctx = (0, import_react23.useContext)(dropZoneContext);
|
3759
3742
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
3760
3743
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
3761
3744
|
}
|
@@ -4631,12 +4614,12 @@ function patchWindow(window2) {
|
|
4631
4614
|
|
4632
4615
|
// components/DragDropContext/index.tsx
|
4633
4616
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
4634
|
-
var dragListenerContext = (0,
|
4617
|
+
var dragListenerContext = (0, import_react25.createContext)({
|
4635
4618
|
dragListeners: {}
|
4636
4619
|
});
|
4637
4620
|
function useDragListener(type, fn, deps = []) {
|
4638
|
-
const { setDragListeners } = (0,
|
4639
|
-
(0,
|
4621
|
+
const { setDragListeners } = (0, import_react25.useContext)(dragListenerContext);
|
4622
|
+
(0, import_react25.useEffect)(() => {
|
4640
4623
|
if (setDragListeners) {
|
4641
4624
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
4642
4625
|
[type]: [...old[type] || [], fn]
|
@@ -4644,21 +4627,21 @@ function useDragListener(type, fn, deps = []) {
|
|
4644
4627
|
}
|
4645
4628
|
}, deps);
|
4646
4629
|
}
|
4647
|
-
var previewContext = (0,
|
4630
|
+
var previewContext = (0, import_react25.createContext)(null);
|
4648
4631
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
4649
4632
|
var DragDropContextClient = ({
|
4650
4633
|
children,
|
4651
4634
|
disableAutoScroll
|
4652
4635
|
}) => {
|
4653
4636
|
const { state, config, dispatch, resolveData } = useAppContext();
|
4654
|
-
const [preview, setPreview] = (0,
|
4655
|
-
const previewRef = (0,
|
4637
|
+
const [preview, setPreview] = (0, import_react25.useState)(null);
|
4638
|
+
const previewRef = (0, import_react25.useRef)(null);
|
4656
4639
|
const { data } = state;
|
4657
|
-
const [deepest, setDeepest] = (0,
|
4658
|
-
const [nextDeepest, setNextDeepest] = (0,
|
4659
|
-
const deepestRef = (0,
|
4660
|
-
const debouncedParamsRef = (0,
|
4661
|
-
const setDeepestAndCollide = (0,
|
4640
|
+
const [deepest, setDeepest] = (0, import_react25.useState)(null);
|
4641
|
+
const [nextDeepest, setNextDeepest] = (0, import_react25.useState)(null);
|
4642
|
+
const deepestRef = (0, import_react25.useRef)(deepest);
|
4643
|
+
const debouncedParamsRef = (0, import_react25.useRef)(null);
|
4644
|
+
const setDeepestAndCollide = (0, import_react25.useCallback)(
|
4662
4645
|
(params, manager) => {
|
4663
4646
|
setDeepest(params);
|
4664
4647
|
setTimeout(() => {
|
@@ -4672,14 +4655,14 @@ var DragDropContextClient = ({
|
|
4672
4655
|
setDeepestAndCollide,
|
4673
4656
|
AREA_CHANGE_DEBOUNCE_MS
|
4674
4657
|
);
|
4675
|
-
(0,
|
4658
|
+
(0, import_react25.useEffect)(() => {
|
4676
4659
|
deepestRef.current = deepest;
|
4677
4660
|
}, [deepest]);
|
4678
4661
|
const cancelDb = () => {
|
4679
4662
|
setDeepestDb.cancel();
|
4680
4663
|
debouncedParamsRef.current = null;
|
4681
4664
|
};
|
4682
|
-
const [plugins] = (0,
|
4665
|
+
const [plugins] = (0, import_react25.useState)(() => [
|
4683
4666
|
...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
|
4684
4667
|
createNestedDroppablePlugin({
|
4685
4668
|
onChange: (params, manager) => {
|
@@ -4717,7 +4700,7 @@ var DragDropContextClient = ({
|
|
4717
4700
|
}
|
4718
4701
|
})
|
4719
4702
|
]);
|
4720
|
-
const [sensors] = (0,
|
4703
|
+
const [sensors] = (0, import_react25.useState)(() => [
|
4721
4704
|
PointerSensor.configure({
|
4722
4705
|
activationConstraints(event, source) {
|
4723
4706
|
var _a;
|
@@ -4736,11 +4719,11 @@ var DragDropContextClient = ({
|
|
4736
4719
|
}
|
4737
4720
|
})
|
4738
4721
|
]);
|
4739
|
-
const [draggedItem, setDraggedItem] = (0,
|
4740
|
-
const [dragListeners, setDragListeners] = (0,
|
4741
|
-
const [pathData, setPathData] = (0,
|
4742
|
-
const dragMode = (0,
|
4743
|
-
const registerPath = (0,
|
4722
|
+
const [draggedItem, setDraggedItem] = (0, import_react25.useState)();
|
4723
|
+
const [dragListeners, setDragListeners] = (0, import_react25.useState)({});
|
4724
|
+
const [pathData, setPathData] = (0, import_react25.useState)();
|
4725
|
+
const dragMode = (0, import_react25.useRef)(null);
|
4726
|
+
const registerPath = (0, import_react25.useCallback)(
|
4744
4727
|
(selector) => {
|
4745
4728
|
const item = getItem(selector, data);
|
4746
4729
|
if (!item) {
|
@@ -4762,7 +4745,7 @@ var DragDropContextClient = ({
|
|
4762
4745
|
},
|
4763
4746
|
[data, setPathData]
|
4764
4747
|
);
|
4765
|
-
const initialSelector = (0,
|
4748
|
+
const initialSelector = (0, import_react25.useRef)(void 0);
|
4766
4749
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
4767
4750
|
dragListenerContext.Provider,
|
4768
4751
|
{
|
@@ -4771,7 +4754,7 @@ var DragDropContextClient = ({
|
|
4771
4754
|
setDragListeners
|
4772
4755
|
},
|
4773
4756
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(previewContext.Provider, { value: preview, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
4774
|
-
|
4757
|
+
import_react24.DragDropProvider,
|
4775
4758
|
{
|
4776
4759
|
plugins,
|
4777
4760
|
sensors,
|
@@ -4926,7 +4909,6 @@ var DragDropContextClient = ({
|
|
4926
4909
|
value: {
|
4927
4910
|
data,
|
4928
4911
|
config,
|
4929
|
-
dispatch,
|
4930
4912
|
draggedItem,
|
4931
4913
|
mode: "edit",
|
4932
4914
|
areaId: "root",
|
@@ -4969,7 +4951,7 @@ var DrawerItemInner = ({
|
|
4969
4951
|
dragRef,
|
4970
4952
|
isDragDisabled
|
4971
4953
|
}) => {
|
4972
|
-
const CustomInner = (0,
|
4954
|
+
const CustomInner = (0, import_react26.useMemo)(
|
4973
4955
|
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
4974
4956
|
[children]
|
4975
4957
|
);
|
@@ -5023,7 +5005,7 @@ var DrawerItem = ({
|
|
5023
5005
|
isDragDisabled
|
5024
5006
|
}) => {
|
5025
5007
|
const resolvedId = id || name;
|
5026
|
-
const [dynamicId, setDynamicId] = (0,
|
5008
|
+
const [dynamicId, setDynamicId] = (0, import_react26.useState)(generateId(resolvedId));
|
5027
5009
|
if (typeof index !== "undefined") {
|
5028
5010
|
console.error(
|
5029
5011
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -5062,7 +5044,7 @@ var Drawer = ({
|
|
5062
5044
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
5063
5045
|
);
|
5064
5046
|
}
|
5065
|
-
const [id] = (0,
|
5047
|
+
const [id] = (0, import_react26.useState)(generateId());
|
5066
5048
|
const { ref } = useDroppableSafe({
|
5067
5049
|
id,
|
5068
5050
|
type: "void",
|
@@ -5095,7 +5077,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
|
|
5095
5077
|
|
5096
5078
|
// lib/use-breadcrumbs.ts
|
5097
5079
|
init_react_import();
|
5098
|
-
var
|
5080
|
+
var import_react27 = require("react");
|
5099
5081
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
5100
5082
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
5101
5083
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -5145,8 +5127,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
5145
5127
|
state: { data },
|
5146
5128
|
selectedItem
|
5147
5129
|
} = useAppContext();
|
5148
|
-
const dzContext = (0,
|
5149
|
-
return (0,
|
5130
|
+
const dzContext = (0, import_react27.useContext)(dropZoneContext);
|
5131
|
+
return (0, import_react27.useMemo)(() => {
|
5150
5132
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
5151
5133
|
selectedItem,
|
5152
5134
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -5280,15 +5262,15 @@ init_react_import();
|
|
5280
5262
|
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
5281
5263
|
|
5282
5264
|
// components/Puck/components/Fields/index.tsx
|
5283
|
-
var
|
5265
|
+
var import_react29 = require("react");
|
5284
5266
|
|
5285
5267
|
// lib/use-parent.ts
|
5286
5268
|
init_react_import();
|
5287
|
-
var
|
5269
|
+
var import_react28 = require("react");
|
5288
5270
|
var useParent = (itemSelector) => {
|
5289
5271
|
var _a;
|
5290
5272
|
const { selectedItem, state } = useAppContext();
|
5291
|
-
const { pathData } = (0,
|
5273
|
+
const { pathData } = (0, import_react28.useContext)(dropZoneContext) || {};
|
5292
5274
|
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
5293
5275
|
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
5294
5276
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
@@ -5314,20 +5296,20 @@ var useResolvedFields = () => {
|
|
5314
5296
|
const { data } = state;
|
5315
5297
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
5316
5298
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
5317
|
-
const defaultFields = (0,
|
5299
|
+
const defaultFields = (0, import_react29.useMemo)(
|
5318
5300
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
5319
5301
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
5320
5302
|
);
|
5321
5303
|
const rootProps = data.root.props || data.root;
|
5322
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
5323
|
-
const [resolvedFields, setResolvedFields] = (0,
|
5324
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
5304
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react29.useState)({});
|
5305
|
+
const [resolvedFields, setResolvedFields] = (0, import_react29.useState)(defaultFields);
|
5306
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react29.useState)(false);
|
5325
5307
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5326
5308
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
5327
5309
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
5328
5310
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
5329
5311
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
5330
|
-
const resolveFields = (0,
|
5312
|
+
const resolveFields = (0, import_react29.useCallback)(
|
5331
5313
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
5332
5314
|
var _a2;
|
5333
5315
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
@@ -5365,7 +5347,7 @@ var useResolvedFields = () => {
|
|
5365
5347
|
}),
|
5366
5348
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
5367
5349
|
);
|
5368
|
-
(0,
|
5350
|
+
(0, import_react29.useEffect)(() => {
|
5369
5351
|
if (hasResolver) {
|
5370
5352
|
setFieldsLoading(true);
|
5371
5353
|
resolveFields(defaultFields).then((fields) => {
|
@@ -5396,7 +5378,7 @@ var Fields = () => {
|
|
5396
5378
|
const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
|
5397
5379
|
const isLoading = fieldsResolving || componentResolving;
|
5398
5380
|
const rootProps = data.root.props || data.root;
|
5399
|
-
const Wrapper = (0,
|
5381
|
+
const Wrapper = (0, import_react29.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
5400
5382
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
5401
5383
|
"form",
|
5402
5384
|
{
|
@@ -5519,7 +5501,7 @@ init_react_import();
|
|
5519
5501
|
|
5520
5502
|
// lib/use-component-list.tsx
|
5521
5503
|
init_react_import();
|
5522
|
-
var
|
5504
|
+
var import_react30 = require("react");
|
5523
5505
|
|
5524
5506
|
// components/ComponentList/index.tsx
|
5525
5507
|
init_react_import();
|
@@ -5586,8 +5568,8 @@ ComponentList.Item = ComponentListItem;
|
|
5586
5568
|
// lib/use-component-list.tsx
|
5587
5569
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
5588
5570
|
var useComponentList = (config, ui) => {
|
5589
|
-
const [componentList, setComponentList] = (0,
|
5590
|
-
(0,
|
5571
|
+
const [componentList, setComponentList] = (0, import_react30.useState)();
|
5572
|
+
(0, import_react30.useEffect)(() => {
|
5591
5573
|
var _a, _b, _c;
|
5592
5574
|
if (Object.keys(ui.componentList).length > 0) {
|
5593
5575
|
const matchedComponents = [];
|
@@ -5656,22 +5638,22 @@ var useComponentList = (config, ui) => {
|
|
5656
5638
|
};
|
5657
5639
|
|
5658
5640
|
// components/Puck/components/Components/index.tsx
|
5659
|
-
var
|
5641
|
+
var import_react31 = require("react");
|
5660
5642
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
5661
5643
|
var Components = () => {
|
5662
5644
|
const { config, state, overrides } = useAppContext();
|
5663
5645
|
const componentList = useComponentList(config, state.ui);
|
5664
|
-
const Wrapper = (0,
|
5646
|
+
const Wrapper = (0, import_react31.useMemo)(() => overrides.components || "div", [overrides]);
|
5665
5647
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ComponentList, { id: "all" }) });
|
5666
5648
|
};
|
5667
5649
|
|
5668
5650
|
// components/Puck/components/Preview/index.tsx
|
5669
5651
|
init_react_import();
|
5670
|
-
var
|
5652
|
+
var import_react33 = require("react");
|
5671
5653
|
|
5672
5654
|
// components/AutoFrame/index.tsx
|
5673
5655
|
init_react_import();
|
5674
|
-
var
|
5656
|
+
var import_react32 = require("react");
|
5675
5657
|
var import_object_hash = __toESM(require("object-hash"));
|
5676
5658
|
var import_react_dom3 = require("react-dom");
|
5677
5659
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
@@ -5717,7 +5699,7 @@ var CopyHostStyles = ({
|
|
5717
5699
|
onStylesLoaded = () => null
|
5718
5700
|
}) => {
|
5719
5701
|
const { document: doc, window: win } = useFrame();
|
5720
|
-
(0,
|
5702
|
+
(0, import_react32.useEffect)(() => {
|
5721
5703
|
if (!win || !doc) {
|
5722
5704
|
return () => {
|
5723
5705
|
};
|
@@ -5876,8 +5858,8 @@ var CopyHostStyles = ({
|
|
5876
5858
|
}, []);
|
5877
5859
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
5878
5860
|
};
|
5879
|
-
var autoFrameContext = (0,
|
5880
|
-
var useFrame = () => (0,
|
5861
|
+
var autoFrameContext = (0, import_react32.createContext)({});
|
5862
|
+
var useFrame = () => (0, import_react32.useContext)(autoFrameContext);
|
5881
5863
|
function AutoFrame(_a) {
|
5882
5864
|
var _b = _a, {
|
5883
5865
|
children,
|
@@ -5894,10 +5876,10 @@ function AutoFrame(_a) {
|
|
5894
5876
|
"onStylesLoaded",
|
5895
5877
|
"frameRef"
|
5896
5878
|
]);
|
5897
|
-
const [loaded, setLoaded] = (0,
|
5898
|
-
const [ctx, setCtx] = (0,
|
5899
|
-
const [mountTarget, setMountTarget] = (0,
|
5900
|
-
(0,
|
5879
|
+
const [loaded, setLoaded] = (0, import_react32.useState)(false);
|
5880
|
+
const [ctx, setCtx] = (0, import_react32.useState)({});
|
5881
|
+
const [mountTarget, setMountTarget] = (0, import_react32.useState)();
|
5882
|
+
(0, import_react32.useEffect)(() => {
|
5901
5883
|
var _a2;
|
5902
5884
|
if (frameRef.current) {
|
5903
5885
|
setCtx({
|
@@ -5930,12 +5912,68 @@ var AutoFrame_default = AutoFrame;
|
|
5930
5912
|
init_react_import();
|
5931
5913
|
var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
5932
5914
|
|
5933
|
-
// components/
|
5915
|
+
// components/Render/index.tsx
|
5916
|
+
init_react_import();
|
5934
5917
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
5918
|
+
function Render({
|
5919
|
+
config,
|
5920
|
+
data
|
5921
|
+
}) {
|
5922
|
+
var _a;
|
5923
|
+
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
5924
|
+
root: data.root || {},
|
5925
|
+
content: data.content || []
|
5926
|
+
});
|
5927
|
+
const rootProps = defaultedData.root.props || defaultedData.root;
|
5928
|
+
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
5929
|
+
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
5931
|
+
DropZoneProvider,
|
5932
|
+
{
|
5933
|
+
value: {
|
5934
|
+
data: defaultedData,
|
5935
|
+
config,
|
5936
|
+
mode: "render",
|
5937
|
+
depth: 0,
|
5938
|
+
path: []
|
5939
|
+
},
|
5940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
5941
|
+
config.root.render,
|
5942
|
+
__spreadProps(__spreadValues({}, rootProps), {
|
5943
|
+
puck: {
|
5944
|
+
renderDropZone: DropZone,
|
5945
|
+
isEditing: false
|
5946
|
+
},
|
5947
|
+
title,
|
5948
|
+
editMode: false,
|
5949
|
+
id: "puck-root",
|
5950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
|
5951
|
+
})
|
5952
|
+
)
|
5953
|
+
}
|
5954
|
+
);
|
5955
|
+
}
|
5956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
5957
|
+
DropZoneProvider,
|
5958
|
+
{
|
5959
|
+
value: {
|
5960
|
+
data: defaultedData,
|
5961
|
+
config,
|
5962
|
+
mode: "render",
|
5963
|
+
depth: 0,
|
5964
|
+
path: []
|
5965
|
+
},
|
5966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
|
5967
|
+
}
|
5968
|
+
);
|
5969
|
+
}
|
5970
|
+
|
5971
|
+
// components/Puck/components/Preview/index.tsx
|
5972
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
5935
5973
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
5936
5974
|
var useBubbleIframeEvents = (ref) => {
|
5937
5975
|
const { status } = useAppContext();
|
5938
|
-
(0,
|
5976
|
+
(0, import_react33.useEffect)(() => {
|
5939
5977
|
var _a;
|
5940
5978
|
if (ref.current && status === "READY") {
|
5941
5979
|
const iframe = ref.current;
|
@@ -5974,20 +6012,32 @@ var useBubbleIframeEvents = (ref) => {
|
|
5974
6012
|
};
|
5975
6013
|
var Preview = ({ id = "puck-preview" }) => {
|
5976
6014
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
5977
|
-
const Page = (0,
|
6015
|
+
const Page = (0, import_react33.useCallback)(
|
5978
6016
|
(pageProps) => {
|
5979
6017
|
var _a, _b;
|
5980
6018
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
5981
6019
|
id: "puck-root"
|
5982
|
-
}, pageProps)) : /* @__PURE__ */ (0,
|
6020
|
+
}, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: pageProps.children });
|
5983
6021
|
},
|
5984
6022
|
[config.root]
|
5985
6023
|
);
|
5986
|
-
const Frame = (0,
|
6024
|
+
const Frame = (0, import_react33.useMemo)(() => overrides.iframe, [overrides]);
|
5987
6025
|
const rootProps = state.data.root.props || state.data.root;
|
5988
|
-
const ref = (0,
|
6026
|
+
const ref = (0, import_react33.useRef)(null);
|
5989
6027
|
useBubbleIframeEvents(ref);
|
5990
|
-
|
6028
|
+
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6029
|
+
Page,
|
6030
|
+
__spreadProps(__spreadValues({}, rootProps), {
|
6031
|
+
puck: {
|
6032
|
+
renderDropZone: DropZone,
|
6033
|
+
isEditing: true,
|
6034
|
+
dragRef: null
|
6035
|
+
},
|
6036
|
+
editMode: true,
|
6037
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
|
6038
|
+
})
|
6039
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Render, { data: state.data, config });
|
6040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
5991
6041
|
"div",
|
5992
6042
|
{
|
5993
6043
|
className: getClassName23(),
|
@@ -5996,7 +6046,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
5996
6046
|
onClick: () => {
|
5997
6047
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
5998
6048
|
},
|
5999
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
6049
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6000
6050
|
AutoFrame_default,
|
6001
6051
|
{
|
6002
6052
|
id: "preview-frame",
|
@@ -6006,40 +6056,21 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
6006
6056
|
setStatus("READY");
|
6007
6057
|
},
|
6008
6058
|
frameRef: ref,
|
6009
|
-
children: /* @__PURE__ */ (0,
|
6010
|
-
const inner = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
6011
|
-
Page,
|
6012
|
-
__spreadProps(__spreadValues({}, rootProps), {
|
6013
|
-
puck: {
|
6014
|
-
renderDropZone: DropZone,
|
6015
|
-
isEditing: true,
|
6016
|
-
dragRef: null
|
6017
|
-
},
|
6018
|
-
editMode: true,
|
6019
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
|
6020
|
-
})
|
6021
|
-
);
|
6059
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
6022
6060
|
if (Frame) {
|
6023
|
-
return /* @__PURE__ */ (0,
|
6061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Frame, { document: document2, children: inner });
|
6024
6062
|
}
|
6025
6063
|
return inner;
|
6026
6064
|
} })
|
6027
6065
|
}
|
6028
|
-
) : /* @__PURE__ */ (0,
|
6066
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6029
6067
|
"div",
|
6030
6068
|
{
|
6031
6069
|
id: "preview-frame",
|
6032
6070
|
className: getClassName23("frame"),
|
6033
6071
|
ref,
|
6034
6072
|
"data-puck-entry": true,
|
6035
|
-
children:
|
6036
|
-
Page,
|
6037
|
-
__spreadProps(__spreadValues({}, rootProps), {
|
6038
|
-
puck: { renderDropZone: DropZone, isEditing: true, dragRef: null },
|
6039
|
-
editMode: true,
|
6040
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
|
6041
|
-
})
|
6042
|
-
)
|
6073
|
+
children: inner
|
6043
6074
|
}
|
6044
6075
|
)
|
6045
6076
|
}
|
@@ -6089,7 +6120,7 @@ var scrollIntoView = (el) => {
|
|
6089
6120
|
};
|
6090
6121
|
|
6091
6122
|
// components/LayerTree/index.tsx
|
6092
|
-
var
|
6123
|
+
var import_react34 = require("react");
|
6093
6124
|
|
6094
6125
|
// lib/is-child-of-zone.ts
|
6095
6126
|
init_react_import();
|
@@ -6122,7 +6153,7 @@ var onScrollEnd = (frame, cb) => {
|
|
6122
6153
|
};
|
6123
6154
|
|
6124
6155
|
// components/LayerTree/index.tsx
|
6125
|
-
var
|
6156
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
6126
6157
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
6127
6158
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
6128
6159
|
var LayerTree = ({
|
@@ -6135,15 +6166,15 @@ var LayerTree = ({
|
|
6135
6166
|
label
|
6136
6167
|
}) => {
|
6137
6168
|
const zones = data.zones || {};
|
6138
|
-
const ctx = (0,
|
6139
|
-
return /* @__PURE__ */ (0,
|
6140
|
-
label && /* @__PURE__ */ (0,
|
6141
|
-
/* @__PURE__ */ (0,
|
6169
|
+
const ctx = (0, import_react34.useContext)(dropZoneContext);
|
6170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
6171
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
6172
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Layers, { size: "16" }) }),
|
6142
6173
|
" ",
|
6143
6174
|
label
|
6144
6175
|
] }),
|
6145
|
-
/* @__PURE__ */ (0,
|
6146
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
6176
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("ul", { className: getClassName24(), children: [
|
6177
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
6147
6178
|
zoneContent.map((item, i) => {
|
6148
6179
|
var _a;
|
6149
6180
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -6156,7 +6187,7 @@ var LayerTree = ({
|
|
6156
6187
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
6157
6188
|
const componentConfig = config.components[item.type];
|
6158
6189
|
const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
|
6159
|
-
return /* @__PURE__ */ (0,
|
6190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
6160
6191
|
"li",
|
6161
6192
|
{
|
6162
6193
|
className: getClassNameLayer({
|
@@ -6166,7 +6197,7 @@ var LayerTree = ({
|
|
6166
6197
|
childIsSelected
|
6167
6198
|
}),
|
6168
6199
|
children: [
|
6169
|
-
/* @__PURE__ */ (0,
|
6200
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
6170
6201
|
"button",
|
6171
6202
|
{
|
6172
6203
|
type: "button",
|
@@ -6205,22 +6236,22 @@ var LayerTree = ({
|
|
6205
6236
|
setHoveringComponent(null);
|
6206
6237
|
},
|
6207
6238
|
children: [
|
6208
|
-
containsZone && /* @__PURE__ */ (0,
|
6239
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
6209
6240
|
"div",
|
6210
6241
|
{
|
6211
6242
|
className: getClassNameLayer("chevron"),
|
6212
6243
|
title: isSelected ? "Collapse" : "Expand",
|
6213
|
-
children: /* @__PURE__ */ (0,
|
6244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChevronDown, { size: "12" })
|
6214
6245
|
}
|
6215
6246
|
),
|
6216
|
-
/* @__PURE__ */ (0,
|
6217
|
-
/* @__PURE__ */ (0,
|
6218
|
-
/* @__PURE__ */ (0,
|
6247
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
6248
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LayoutGrid, { size: "16" }) }),
|
6249
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
6219
6250
|
] })
|
6220
6251
|
]
|
6221
6252
|
}
|
6222
6253
|
) }),
|
6223
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
6254
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
6224
6255
|
LayerTree,
|
6225
6256
|
{
|
6226
6257
|
config,
|
@@ -6242,13 +6273,13 @@ var LayerTree = ({
|
|
6242
6273
|
};
|
6243
6274
|
|
6244
6275
|
// components/Puck/components/Outline/index.tsx
|
6245
|
-
var
|
6246
|
-
var
|
6276
|
+
var import_react35 = require("react");
|
6277
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
6247
6278
|
var Outline = () => {
|
6248
6279
|
const { dispatch, state, overrides, config } = useAppContext();
|
6249
6280
|
const { data, ui } = state;
|
6250
6281
|
const { itemSelector } = ui;
|
6251
|
-
const setItemSelector = (0,
|
6282
|
+
const setItemSelector = (0, import_react35.useCallback)(
|
6252
6283
|
(newItemSelector) => {
|
6253
6284
|
dispatch({
|
6254
6285
|
type: "setUi",
|
@@ -6257,9 +6288,9 @@ var Outline = () => {
|
|
6257
6288
|
},
|
6258
6289
|
[]
|
6259
6290
|
);
|
6260
|
-
const Wrapper = (0,
|
6261
|
-
return /* @__PURE__ */ (0,
|
6262
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
6291
|
+
const Wrapper = (0, import_react35.useMemo)(() => overrides.outline || "div", [overrides]);
|
6292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
6293
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
6263
6294
|
LayerTree,
|
6264
6295
|
{
|
6265
6296
|
config,
|
@@ -6272,7 +6303,7 @@ var Outline = () => {
|
|
6272
6303
|
),
|
6273
6304
|
Object.entries(findZonesForArea(data, "root")).map(
|
6274
6305
|
([zoneKey, zone]) => {
|
6275
|
-
return /* @__PURE__ */ (0,
|
6306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
6276
6307
|
LayerTree,
|
6277
6308
|
{
|
6278
6309
|
config,
|
@@ -6371,19 +6402,19 @@ function usePuckHistory({
|
|
6371
6402
|
|
6372
6403
|
// lib/use-history-store.ts
|
6373
6404
|
init_react_import();
|
6374
|
-
var
|
6405
|
+
var import_react36 = require("react");
|
6375
6406
|
var import_use_debounce3 = require("use-debounce");
|
6376
6407
|
var EMPTY_HISTORY_INDEX = 0;
|
6377
6408
|
function useHistoryStore(initialHistory) {
|
6378
6409
|
var _a, _b;
|
6379
|
-
const [histories, setHistories] = (0,
|
6410
|
+
const [histories, setHistories] = (0, import_react36.useState)(
|
6380
6411
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6381
6412
|
);
|
6382
6413
|
const updateHistories = (histories2) => {
|
6383
6414
|
setHistories(histories2);
|
6384
6415
|
setIndex(histories2.length - 1);
|
6385
6416
|
};
|
6386
|
-
const [index, setIndex] = (0,
|
6417
|
+
const [index, setIndex] = (0, import_react36.useState)(
|
6387
6418
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6388
6419
|
);
|
6389
6420
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -6543,22 +6574,22 @@ var getBox = function getBox2(el) {
|
|
6543
6574
|
};
|
6544
6575
|
|
6545
6576
|
// components/Puck/components/Canvas/index.tsx
|
6546
|
-
var
|
6577
|
+
var import_react38 = require("react");
|
6547
6578
|
|
6548
6579
|
// components/ViewportControls/index.tsx
|
6549
6580
|
init_react_import();
|
6550
|
-
var
|
6581
|
+
var import_react37 = require("react");
|
6551
6582
|
|
6552
6583
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
6553
6584
|
init_react_import();
|
6554
6585
|
var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
|
6555
6586
|
|
6556
6587
|
// components/ViewportControls/index.tsx
|
6557
|
-
var
|
6588
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
6558
6589
|
var icons = {
|
6559
|
-
Smartphone: /* @__PURE__ */ (0,
|
6560
|
-
Tablet: /* @__PURE__ */ (0,
|
6561
|
-
Monitor: /* @__PURE__ */ (0,
|
6590
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Smartphone, { size: 16 }),
|
6591
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Tablet, { size: 16 }),
|
6592
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Monitor, { size: 16 })
|
6562
6593
|
};
|
6563
6594
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
6564
6595
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -6570,11 +6601,11 @@ var ViewportButton = ({
|
|
6570
6601
|
onClick
|
6571
6602
|
}) => {
|
6572
6603
|
const { state } = useAppContext();
|
6573
|
-
const [isActive, setIsActive] = (0,
|
6574
|
-
(0,
|
6604
|
+
const [isActive, setIsActive] = (0, import_react37.useState)(false);
|
6605
|
+
(0, import_react37.useEffect)(() => {
|
6575
6606
|
setIsActive(width === state.ui.viewports.current.width);
|
6576
6607
|
}, [width, state.ui.viewports.current.width]);
|
6577
|
-
return /* @__PURE__ */ (0,
|
6608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6578
6609
|
IconButton,
|
6579
6610
|
{
|
6580
6611
|
title,
|
@@ -6583,7 +6614,7 @@ var ViewportButton = ({
|
|
6583
6614
|
e.stopPropagation();
|
6584
6615
|
onClick({ width, height });
|
6585
6616
|
},
|
6586
|
-
children: /* @__PURE__ */ (0,
|
6617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton("inner"), children })
|
6587
6618
|
}
|
6588
6619
|
) });
|
6589
6620
|
};
|
@@ -6607,7 +6638,7 @@ var ViewportControls = ({
|
|
6607
6638
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
6608
6639
|
(option) => option.value === autoZoom
|
6609
6640
|
);
|
6610
|
-
const zoomOptions = (0,
|
6641
|
+
const zoomOptions = (0, import_react37.useMemo)(
|
6611
6642
|
() => [
|
6612
6643
|
...defaultZoomOptions,
|
6613
6644
|
...defaultsContainAutoZoom ? [] : [
|
@@ -6619,8 +6650,8 @@ var ViewportControls = ({
|
|
6619
6650
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
6620
6651
|
[autoZoom]
|
6621
6652
|
);
|
6622
|
-
return /* @__PURE__ */ (0,
|
6623
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
6653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25(), children: [
|
6654
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6624
6655
|
ViewportButton,
|
6625
6656
|
{
|
6626
6657
|
height: viewport.height,
|
@@ -6631,8 +6662,8 @@ var ViewportControls = ({
|
|
6631
6662
|
},
|
6632
6663
|
i
|
6633
6664
|
)),
|
6634
|
-
/* @__PURE__ */ (0,
|
6635
|
-
/* @__PURE__ */ (0,
|
6665
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("divider") }),
|
6666
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6636
6667
|
IconButton,
|
6637
6668
|
{
|
6638
6669
|
title: "Zoom viewport out",
|
@@ -6646,10 +6677,10 @@ var ViewportControls = ({
|
|
6646
6677
|
)].value
|
6647
6678
|
);
|
6648
6679
|
},
|
6649
|
-
children: /* @__PURE__ */ (0,
|
6680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ZoomOut, { size: 16 })
|
6650
6681
|
}
|
6651
6682
|
),
|
6652
|
-
/* @__PURE__ */ (0,
|
6683
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6653
6684
|
IconButton,
|
6654
6685
|
{
|
6655
6686
|
title: "Zoom viewport in",
|
@@ -6663,11 +6694,11 @@ var ViewportControls = ({
|
|
6663
6694
|
)].value
|
6664
6695
|
);
|
6665
6696
|
},
|
6666
|
-
children: /* @__PURE__ */ (0,
|
6697
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ZoomIn, { size: 16 })
|
6667
6698
|
}
|
6668
6699
|
),
|
6669
|
-
/* @__PURE__ */ (0,
|
6670
|
-
/* @__PURE__ */ (0,
|
6700
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("divider") }),
|
6701
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6671
6702
|
"select",
|
6672
6703
|
{
|
6673
6704
|
className: getClassName25("zoomSelect"),
|
@@ -6675,7 +6706,7 @@ var ViewportControls = ({
|
|
6675
6706
|
onChange: (e) => {
|
6676
6707
|
onZoom(parseFloat(e.currentTarget.value));
|
6677
6708
|
},
|
6678
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
6709
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6679
6710
|
"option",
|
6680
6711
|
{
|
6681
6712
|
value: option.value,
|
@@ -6723,24 +6754,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
6723
6754
|
};
|
6724
6755
|
|
6725
6756
|
// components/Puck/components/Canvas/index.tsx
|
6726
|
-
var
|
6757
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
6727
6758
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
6728
6759
|
var ZOOM_ON_CHANGE = true;
|
6729
6760
|
var Canvas = () => {
|
6730
6761
|
const { status, iframe } = useAppContext();
|
6731
6762
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
6732
6763
|
const { ui } = state;
|
6733
|
-
const frameRef = (0,
|
6734
|
-
const [showTransition, setShowTransition] = (0,
|
6735
|
-
const defaultRender = (0,
|
6736
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
6764
|
+
const frameRef = (0, import_react38.useRef)(null);
|
6765
|
+
const [showTransition, setShowTransition] = (0, import_react38.useState)(false);
|
6766
|
+
const defaultRender = (0, import_react38.useMemo)(() => {
|
6767
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
6737
6768
|
return PuckDefault;
|
6738
6769
|
}, []);
|
6739
|
-
const CustomPreview = (0,
|
6770
|
+
const CustomPreview = (0, import_react38.useMemo)(
|
6740
6771
|
() => overrides.preview || defaultRender,
|
6741
6772
|
[overrides]
|
6742
6773
|
);
|
6743
|
-
const getFrameDimensions = (0,
|
6774
|
+
const getFrameDimensions = (0, import_react38.useCallback)(() => {
|
6744
6775
|
if (frameRef.current) {
|
6745
6776
|
const frame = frameRef.current;
|
6746
6777
|
const box = getBox(frame);
|
@@ -6748,7 +6779,7 @@ var Canvas = () => {
|
|
6748
6779
|
}
|
6749
6780
|
return { width: 0, height: 0 };
|
6750
6781
|
}, [frameRef]);
|
6751
|
-
const resetAutoZoom = (0,
|
6782
|
+
const resetAutoZoom = (0, import_react38.useCallback)(
|
6752
6783
|
(ui2 = state.ui) => {
|
6753
6784
|
if (frameRef.current) {
|
6754
6785
|
setZoomConfig(
|
@@ -6758,11 +6789,11 @@ var Canvas = () => {
|
|
6758
6789
|
},
|
6759
6790
|
[frameRef, zoomConfig, state.ui]
|
6760
6791
|
);
|
6761
|
-
(0,
|
6792
|
+
(0, import_react38.useEffect)(() => {
|
6762
6793
|
setShowTransition(false);
|
6763
6794
|
resetAutoZoom();
|
6764
6795
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
6765
|
-
(0,
|
6796
|
+
(0, import_react38.useEffect)(() => {
|
6766
6797
|
const { height: frameHeight } = getFrameDimensions();
|
6767
6798
|
if (ui.viewports.current.height === "auto") {
|
6768
6799
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -6770,13 +6801,13 @@ var Canvas = () => {
|
|
6770
6801
|
}));
|
6771
6802
|
}
|
6772
6803
|
}, [zoomConfig.zoom]);
|
6773
|
-
(0,
|
6804
|
+
(0, import_react38.useEffect)(() => {
|
6774
6805
|
if (ZOOM_ON_CHANGE) {
|
6775
6806
|
setShowTransition(true);
|
6776
6807
|
resetAutoZoom(ui);
|
6777
6808
|
}
|
6778
6809
|
}, [ui.viewports.current.width]);
|
6779
|
-
(0,
|
6810
|
+
(0, import_react38.useEffect)(() => {
|
6780
6811
|
const cb = () => {
|
6781
6812
|
setShowTransition(false);
|
6782
6813
|
resetAutoZoom();
|
@@ -6786,13 +6817,13 @@ var Canvas = () => {
|
|
6786
6817
|
window.removeEventListener("resize", cb);
|
6787
6818
|
};
|
6788
6819
|
}, []);
|
6789
|
-
const [showLoader, setShowLoader] = (0,
|
6790
|
-
(0,
|
6820
|
+
const [showLoader, setShowLoader] = (0, import_react38.useState)(false);
|
6821
|
+
(0, import_react38.useEffect)(() => {
|
6791
6822
|
setTimeout(() => {
|
6792
6823
|
setShowLoader(true);
|
6793
6824
|
}, 500);
|
6794
6825
|
}, []);
|
6795
|
-
return /* @__PURE__ */ (0,
|
6826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
6796
6827
|
"div",
|
6797
6828
|
{
|
6798
6829
|
className: getClassName26({
|
@@ -6805,7 +6836,7 @@ var Canvas = () => {
|
|
6805
6836
|
recordHistory: true
|
6806
6837
|
}),
|
6807
6838
|
children: [
|
6808
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
6839
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
6809
6840
|
ViewportControls,
|
6810
6841
|
{
|
6811
6842
|
autoZoom: zoomConfig.autoZoom,
|
@@ -6831,8 +6862,8 @@ var Canvas = () => {
|
|
6831
6862
|
}
|
6832
6863
|
}
|
6833
6864
|
) }),
|
6834
|
-
/* @__PURE__ */ (0,
|
6835
|
-
/* @__PURE__ */ (0,
|
6865
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
6866
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
6836
6867
|
"div",
|
6837
6868
|
{
|
6838
6869
|
className: getClassName26("root"),
|
@@ -6853,10 +6884,10 @@ var Canvas = () => {
|
|
6853
6884
|
})
|
6854
6885
|
);
|
6855
6886
|
},
|
6856
|
-
children: /* @__PURE__ */ (0,
|
6887
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Preview, {}) })
|
6857
6888
|
}
|
6858
6889
|
),
|
6859
|
-
/* @__PURE__ */ (0,
|
6890
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Loader, { size: 24 }) })
|
6860
6891
|
] })
|
6861
6892
|
]
|
6862
6893
|
}
|
@@ -6865,7 +6896,7 @@ var Canvas = () => {
|
|
6865
6896
|
|
6866
6897
|
// lib/use-loaded-overrides.ts
|
6867
6898
|
init_react_import();
|
6868
|
-
var
|
6899
|
+
var import_react39 = require("react");
|
6869
6900
|
|
6870
6901
|
// lib/load-overrides.ts
|
6871
6902
|
init_react_import();
|
@@ -6904,29 +6935,26 @@ var useLoadedOverrides = ({
|
|
6904
6935
|
overrides,
|
6905
6936
|
plugins
|
6906
6937
|
}) => {
|
6907
|
-
return (0,
|
6938
|
+
return (0, import_react39.useMemo)(() => {
|
6908
6939
|
return loadOverrides({ overrides, plugins });
|
6909
6940
|
}, [plugins, overrides]);
|
6910
6941
|
};
|
6911
6942
|
|
6912
6943
|
// components/DefaultOverride/index.tsx
|
6913
6944
|
init_react_import();
|
6914
|
-
var
|
6915
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0,
|
6916
|
-
|
6917
|
-
// components/Puck/index.tsx
|
6918
|
-
var import_dom2 = require("@dnd-kit/dom");
|
6945
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
6946
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
6919
6947
|
|
6920
6948
|
// lib/use-inject-css.ts
|
6921
6949
|
init_react_import();
|
6922
|
-
var
|
6950
|
+
var import_react40 = require("react");
|
6923
6951
|
var styles = ``;
|
6924
6952
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
6925
|
-
const [el, setEl] = (0,
|
6926
|
-
(0,
|
6953
|
+
const [el, setEl] = (0, import_react40.useState)();
|
6954
|
+
(0, import_react40.useEffect)(() => {
|
6927
6955
|
setEl(document.createElement("style"));
|
6928
6956
|
}, []);
|
6929
|
-
(0,
|
6957
|
+
(0, import_react40.useEffect)(() => {
|
6930
6958
|
var _a;
|
6931
6959
|
if (!el || typeof window === "undefined") {
|
6932
6960
|
return;
|
@@ -6944,8 +6972,35 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
6944
6972
|
return useInjectStyleSheet(styles, iframeEnabled);
|
6945
6973
|
};
|
6946
6974
|
|
6975
|
+
// lib/use-preview-mode-hotkeys.ts
|
6976
|
+
init_react_import();
|
6977
|
+
var import_react41 = require("react");
|
6978
|
+
var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
|
6979
|
+
var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
6980
|
+
const toggleInteractive = (0, import_react41.useCallback)(() => {
|
6981
|
+
dispatch({
|
6982
|
+
type: "setUi",
|
6983
|
+
ui: (ui) => ({
|
6984
|
+
previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
|
6985
|
+
})
|
6986
|
+
});
|
6987
|
+
}, [dispatch]);
|
6988
|
+
const toggleInteractiveIframe = () => {
|
6989
|
+
if (iframeEnabled) {
|
6990
|
+
toggleInteractive();
|
6991
|
+
}
|
6992
|
+
};
|
6993
|
+
const frame = getFrame();
|
6994
|
+
const resolvedFrame = typeof window !== "undefined" && frame !== document ? frame : void 0;
|
6995
|
+
(0, import_react_hotkeys_hook2.useHotkeys)("meta+i", toggleInteractive, { preventDefault: true });
|
6996
|
+
(0, import_react_hotkeys_hook2.useHotkeys)("meta+i", toggleInteractiveIframe, {
|
6997
|
+
preventDefault: true,
|
6998
|
+
document: resolvedFrame
|
6999
|
+
});
|
7000
|
+
};
|
7001
|
+
|
6947
7002
|
// components/Puck/index.tsx
|
6948
|
-
var
|
7003
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
6949
7004
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
6950
7005
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
6951
7006
|
function Puck({
|
@@ -7116,7 +7171,7 @@ function Puck({
|
|
7116
7171
|
const RenderHeader = (_a2) => {
|
7117
7172
|
var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
|
7118
7173
|
const Comp = renderHeader;
|
7119
|
-
return /* @__PURE__ */ (0,
|
7174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
7120
7175
|
};
|
7121
7176
|
return RenderHeader;
|
7122
7177
|
}
|
@@ -7129,7 +7184,7 @@ function Puck({
|
|
7129
7184
|
);
|
7130
7185
|
const RenderHeader = (props) => {
|
7131
7186
|
const Comp = renderHeaderActions;
|
7132
|
-
return /* @__PURE__ */ (0,
|
7187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
7133
7188
|
};
|
7134
7189
|
return RenderHeader;
|
7135
7190
|
}
|
@@ -7157,9 +7212,9 @@ function Puck({
|
|
7157
7212
|
}, []);
|
7158
7213
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
7159
7214
|
const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
|
7160
|
-
|
7161
|
-
return /* @__PURE__ */ (0,
|
7162
|
-
/* @__PURE__ */ (0,
|
7215
|
+
usePreviewModeHotkeys(dispatch, iframe.enabled);
|
7216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
7217
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7163
7218
|
AppProvider,
|
7164
7219
|
{
|
7165
7220
|
value: {
|
@@ -7181,7 +7236,7 @@ function Puck({
|
|
7181
7236
|
getPermissions: () => ({}),
|
7182
7237
|
refreshPermissions: () => null
|
7183
7238
|
},
|
7184
|
-
children: /* @__PURE__ */ (0,
|
7239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7185
7240
|
"div",
|
7186
7241
|
{
|
7187
7242
|
className: getLayoutClassName({
|
@@ -7190,60 +7245,60 @@ function Puck({
|
|
7190
7245
|
mounted,
|
7191
7246
|
rightSideBarVisible
|
7192
7247
|
}),
|
7193
|
-
children: /* @__PURE__ */ (0,
|
7194
|
-
/* @__PURE__ */ (0,
|
7248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
7249
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7195
7250
|
CustomHeader,
|
7196
7251
|
{
|
7197
|
-
actions: /* @__PURE__ */ (0,
|
7252
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7198
7253
|
Button,
|
7199
7254
|
{
|
7200
7255
|
onClick: () => {
|
7201
7256
|
onPublish && onPublish(data);
|
7202
7257
|
},
|
7203
|
-
icon: /* @__PURE__ */ (0,
|
7258
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
7204
7259
|
children: "Publish"
|
7205
7260
|
}
|
7206
7261
|
) }) }),
|
7207
|
-
children: /* @__PURE__ */ (0,
|
7208
|
-
/* @__PURE__ */ (0,
|
7209
|
-
/* @__PURE__ */ (0,
|
7262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
7263
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
7264
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7210
7265
|
"div",
|
7211
7266
|
{
|
7212
7267
|
className: getLayoutClassName("leftSideBarToggle"),
|
7213
|
-
children: /* @__PURE__ */ (0,
|
7268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7214
7269
|
IconButton,
|
7215
7270
|
{
|
7216
7271
|
onClick: () => {
|
7217
7272
|
toggleSidebars("left");
|
7218
7273
|
},
|
7219
7274
|
title: "Toggle left sidebar",
|
7220
|
-
children: /* @__PURE__ */ (0,
|
7275
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
7221
7276
|
}
|
7222
7277
|
)
|
7223
7278
|
}
|
7224
7279
|
),
|
7225
|
-
/* @__PURE__ */ (0,
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7226
7281
|
"div",
|
7227
7282
|
{
|
7228
7283
|
className: getLayoutClassName("rightSideBarToggle"),
|
7229
|
-
children: /* @__PURE__ */ (0,
|
7284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7230
7285
|
IconButton,
|
7231
7286
|
{
|
7232
7287
|
onClick: () => {
|
7233
7288
|
toggleSidebars("right");
|
7234
7289
|
},
|
7235
7290
|
title: "Toggle right sidebar",
|
7236
|
-
children: /* @__PURE__ */ (0,
|
7291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
7237
7292
|
}
|
7238
7293
|
)
|
7239
7294
|
}
|
7240
7295
|
)
|
7241
7296
|
] }),
|
7242
|
-
/* @__PURE__ */ (0,
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: "2", size: "xs", children: [
|
7243
7298
|
headerTitle || rootProps.title || "Page",
|
7244
|
-
headerPath && /* @__PURE__ */ (0,
|
7299
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
7245
7300
|
" ",
|
7246
|
-
/* @__PURE__ */ (0,
|
7301
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7247
7302
|
"code",
|
7248
7303
|
{
|
7249
7304
|
className: getLayoutClassName("headerPath"),
|
@@ -7252,31 +7307,31 @@ function Puck({
|
|
7252
7307
|
)
|
7253
7308
|
] })
|
7254
7309
|
] }) }),
|
7255
|
-
/* @__PURE__ */ (0,
|
7256
|
-
/* @__PURE__ */ (0,
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
7311
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7257
7312
|
IconButton,
|
7258
7313
|
{
|
7259
7314
|
onClick: () => {
|
7260
7315
|
return setMenuOpen(!menuOpen);
|
7261
7316
|
},
|
7262
7317
|
title: "Toggle menu bar",
|
7263
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
7318
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
7264
7319
|
}
|
7265
7320
|
) }),
|
7266
|
-
/* @__PURE__ */ (0,
|
7321
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7267
7322
|
MenuBar,
|
7268
7323
|
{
|
7269
7324
|
appState,
|
7270
7325
|
dispatch,
|
7271
7326
|
onPublish,
|
7272
7327
|
menuOpen,
|
7273
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
7328
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7274
7329
|
Button,
|
7275
7330
|
{
|
7276
7331
|
onClick: () => {
|
7277
7332
|
onPublish && onPublish(data);
|
7278
7333
|
},
|
7279
|
-
icon: /* @__PURE__ */ (0,
|
7334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
7280
7335
|
children: "Publish"
|
7281
7336
|
}
|
7282
7337
|
) }),
|
@@ -7287,19 +7342,19 @@ function Puck({
|
|
7287
7342
|
] }) })
|
7288
7343
|
}
|
7289
7344
|
),
|
7290
|
-
/* @__PURE__ */ (0,
|
7291
|
-
/* @__PURE__ */ (0,
|
7292
|
-
/* @__PURE__ */ (0,
|
7345
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
7346
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
7347
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
7293
7348
|
] }),
|
7294
|
-
/* @__PURE__ */ (0,
|
7295
|
-
/* @__PURE__ */ (0,
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
7350
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7296
7351
|
SidebarSection,
|
7297
7352
|
{
|
7298
7353
|
noPadding: true,
|
7299
7354
|
noBorderTop: true,
|
7300
7355
|
showBreadcrumbs: true,
|
7301
7356
|
title: selectedItem ? selectedComponentLabel : "Page",
|
7302
|
-
children: /* @__PURE__ */ (0,
|
7357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
7303
7358
|
}
|
7304
7359
|
) })
|
7305
7360
|
] })
|
@@ -7307,7 +7362,7 @@ function Puck({
|
|
7307
7362
|
) }) })
|
7308
7363
|
}
|
7309
7364
|
),
|
7310
|
-
/* @__PURE__ */ (0,
|
7365
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
7311
7366
|
] });
|
7312
7367
|
}
|
7313
7368
|
Puck.Components = Components;
|
@@ -7315,62 +7370,6 @@ Puck.Fields = Fields;
|
|
7315
7370
|
Puck.Outline = Outline;
|
7316
7371
|
Puck.Preview = Preview;
|
7317
7372
|
|
7318
|
-
// components/Render/index.tsx
|
7319
|
-
init_react_import();
|
7320
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
7321
|
-
function Render({
|
7322
|
-
config,
|
7323
|
-
data
|
7324
|
-
}) {
|
7325
|
-
var _a;
|
7326
|
-
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
7327
|
-
root: data.root || {},
|
7328
|
-
content: data.content || []
|
7329
|
-
});
|
7330
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
7331
|
-
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
7332
|
-
if ((_a = config.root) == null ? void 0 : _a.render) {
|
7333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7334
|
-
DropZoneProvider,
|
7335
|
-
{
|
7336
|
-
value: {
|
7337
|
-
data: defaultedData,
|
7338
|
-
config,
|
7339
|
-
mode: "render",
|
7340
|
-
depth: 0,
|
7341
|
-
path: []
|
7342
|
-
},
|
7343
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7344
|
-
config.root.render,
|
7345
|
-
__spreadProps(__spreadValues({}, rootProps), {
|
7346
|
-
puck: {
|
7347
|
-
renderDropZone: DropZone,
|
7348
|
-
isEditing: false
|
7349
|
-
},
|
7350
|
-
title,
|
7351
|
-
editMode: false,
|
7352
|
-
id: "puck-root",
|
7353
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DropZone, { zone: rootDroppableId })
|
7354
|
-
})
|
7355
|
-
)
|
7356
|
-
}
|
7357
|
-
);
|
7358
|
-
}
|
7359
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
7360
|
-
DropZoneProvider,
|
7361
|
-
{
|
7362
|
-
value: {
|
7363
|
-
data: defaultedData,
|
7364
|
-
config,
|
7365
|
-
mode: "render",
|
7366
|
-
depth: 0,
|
7367
|
-
path: []
|
7368
|
-
},
|
7369
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DropZone, { zone: rootDroppableId })
|
7370
|
-
}
|
7371
|
-
);
|
7372
|
-
}
|
7373
|
-
|
7374
7373
|
// lib/migrate.ts
|
7375
7374
|
init_react_import();
|
7376
7375
|
var migrations = [
|