@measured/puck 0.18.0-canary.b355ddd → 0.18.0-canary.beb05b5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -962,6 +962,7 @@ var defaultAppState = {
962
962
  itemSelector: null,
963
963
  componentList: {},
964
964
  isDragging: false,
965
+ previewMode: "edit",
965
966
  viewports: {
966
967
  current: {
967
968
  width: defaultViewports[0].width,
@@ -2333,7 +2334,7 @@ init_react_import();
2333
2334
  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" };
2334
2335
 
2335
2336
  // components/Drawer/index.tsx
2336
- import { useMemo as useMemo8, useState as useState18 } from "react";
2337
+ import { useMemo as useMemo8, useState as useState17 } from "react";
2337
2338
 
2338
2339
  // components/DragDropContext/index.tsx
2339
2340
  init_react_import();
@@ -2342,9 +2343,9 @@ import {
2342
2343
  createContext as createContext3,
2343
2344
  useCallback as useCallback9,
2344
2345
  useContext as useContext4,
2345
- useEffect as useEffect14,
2346
+ useEffect as useEffect13,
2346
2347
  useRef as useRef5,
2347
- useState as useState17
2348
+ useState as useState16
2348
2349
  } from "react";
2349
2350
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2350
2351
 
@@ -2354,10 +2355,10 @@ import {
2354
2355
  forwardRef as forwardRef3,
2355
2356
  useCallback as useCallback8,
2356
2357
  useContext as useContext3,
2357
- useEffect as useEffect13,
2358
+ useEffect as useEffect12,
2358
2359
  useMemo as useMemo7,
2359
2360
  useRef as useRef4,
2360
- useState as useState16
2361
+ useState as useState15
2361
2362
  } from "react";
2362
2363
 
2363
2364
  // components/DraggableComponent/index.tsx
@@ -2365,42 +2366,16 @@ init_react_import();
2365
2366
  import {
2366
2367
  useCallback as useCallback6,
2367
2368
  useContext as useContext2,
2368
- useEffect as useEffect11,
2369
+ useEffect as useEffect10,
2369
2370
  useMemo as useMemo5,
2370
2371
  useRef as useRef3,
2371
- useState as useState13
2372
+ useState as useState12
2372
2373
  } from "react";
2373
2374
 
2374
2375
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2375
2376
  init_react_import();
2376
2377
  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" };
2377
2378
 
2378
- // lib/use-modifier-held.ts
2379
- init_react_import();
2380
- import { useEffect as useEffect10, useState as useState12 } from "react";
2381
- var useModifierHeld = (modifier) => {
2382
- const [modifierHeld, setModifierHeld] = useState12(false);
2383
- useEffect10(() => {
2384
- function downHandler({ key }) {
2385
- if (key === modifier) {
2386
- setModifierHeld(true);
2387
- }
2388
- }
2389
- function upHandler({ key }) {
2390
- if (key === modifier) {
2391
- setModifierHeld(false);
2392
- }
2393
- }
2394
- window.addEventListener("keydown", downHandler);
2395
- window.addEventListener("keyup", upHandler);
2396
- return () => {
2397
- window.removeEventListener("keydown", downHandler);
2398
- window.removeEventListener("keyup", upHandler);
2399
- };
2400
- }, [modifier]);
2401
- return modifierHeld;
2402
- };
2403
-
2404
2379
  // components/DraggableComponent/index.tsx
2405
2380
  import { createPortal as createPortal2 } from "react-dom";
2406
2381
 
@@ -2805,9 +2780,8 @@ var DraggableComponent = ({
2805
2780
  iframe,
2806
2781
  state
2807
2782
  } = useAppContext();
2808
- const isModifierHeld = useModifierHeld("Alt");
2809
2783
  const ctx = useContext2(dropZoneContext);
2810
- const [localZones, setLocalZones] = useState13({});
2784
+ const [localZones, setLocalZones] = useState12({});
2811
2785
  const registerLocalZone = useCallback6(
2812
2786
  (zoneCompound2, active) => {
2813
2787
  var _a;
@@ -2832,8 +2806,8 @@ var DraggableComponent = ({
2832
2806
  );
2833
2807
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
2834
2808
  const { path = [] } = ctx || {};
2835
- const [canDrag, setCanDrag] = useState13(false);
2836
- useEffect11(() => {
2809
+ const [canDrag, setCanDrag] = useState12(false);
2810
+ useEffect10(() => {
2837
2811
  var _a;
2838
2812
  const item = getItem({ index, zone: zoneCompound }, state.data);
2839
2813
  if (item) {
@@ -2846,7 +2820,7 @@ var DraggableComponent = ({
2846
2820
  const userIsDragging = !!(ctx == null ? void 0 : ctx.draggedItem);
2847
2821
  const canCollide = canDrag || userIsDragging;
2848
2822
  const disabled = !isEnabled || !canCollide;
2849
- const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
2823
+ const [dragAxis, setDragAxis] = useState12(userDragAxis || autoDragAxis);
2850
2824
  const { ref: sortableRef, status } = useSortableSafe({
2851
2825
  id,
2852
2826
  index,
@@ -2882,8 +2856,8 @@ var DraggableComponent = ({
2882
2856
  },
2883
2857
  [sortableRef]
2884
2858
  );
2885
- const [portalEl, setPortalEl] = useState13();
2886
- useEffect11(() => {
2859
+ const [portalEl, setPortalEl] = useState12();
2860
+ useEffect10(() => {
2887
2861
  var _a, _b, _c;
2888
2862
  setPortalEl(
2889
2863
  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
@@ -2909,11 +2883,11 @@ var DraggableComponent = ({
2909
2883
  };
2910
2884
  return style2;
2911
2885
  }, [ref.current]);
2912
- const [style, setStyle] = useState13();
2886
+ const [style, setStyle] = useState12();
2913
2887
  const sync = useCallback6(() => {
2914
2888
  setStyle(getStyle());
2915
2889
  }, [ref.current, iframe]);
2916
- useEffect11(() => {
2890
+ useEffect10(() => {
2917
2891
  if (ref.current) {
2918
2892
  const observer = new ResizeObserver(sync);
2919
2893
  observer.observe(ref.current);
@@ -2922,7 +2896,7 @@ var DraggableComponent = ({
2922
2896
  };
2923
2897
  }
2924
2898
  }, [ref.current]);
2925
- useEffect11(() => {
2899
+ useEffect10(() => {
2926
2900
  ctx == null ? void 0 : ctx.registerPath({
2927
2901
  index,
2928
2902
  zone: zoneCompound
@@ -2979,9 +2953,9 @@ var DraggableComponent = ({
2979
2953
  zone: zoneCompound
2980
2954
  });
2981
2955
  }, [index, zoneCompound]);
2982
- const [hover, setHover] = useState13(false);
2956
+ const [hover, setHover] = useState12(false);
2983
2957
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
2984
- useEffect11(() => {
2958
+ useEffect10(() => {
2985
2959
  if (!ref.current) {
2986
2960
  return;
2987
2961
  }
@@ -3031,7 +3005,7 @@ var DraggableComponent = ({
3031
3005
  thisIsDragging,
3032
3006
  inDroppableZone
3033
3007
  ]);
3034
- useEffect11(() => {
3008
+ useEffect10(() => {
3035
3009
  if (ref.current && disabled) {
3036
3010
  ref.current.setAttribute("data-puck-disabled", "");
3037
3011
  return () => {
@@ -3040,8 +3014,8 @@ var DraggableComponent = ({
3040
3014
  };
3041
3015
  }
3042
3016
  }, [disabled, ref]);
3043
- const [isVisible, setIsVisible] = useState13(false);
3044
- useEffect11(() => {
3017
+ const [isVisible, setIsVisible] = useState12(false);
3018
+ useEffect10(() => {
3045
3019
  sync();
3046
3020
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
3047
3021
  setIsVisible(true);
@@ -3066,7 +3040,7 @@ var DraggableComponent = ({
3066
3040
  },
3067
3041
  [zoomConfig]
3068
3042
  );
3069
- useEffect11(() => {
3043
+ useEffect10(() => {
3070
3044
  if (userDragAxis) {
3071
3045
  setDragAxis(userDragAxis);
3072
3046
  return;
@@ -3101,7 +3075,6 @@ var DraggableComponent = ({
3101
3075
  className: getClassName16({
3102
3076
  isSelected,
3103
3077
  isDragging: thisIsDragging,
3104
- isModifierHeld,
3105
3078
  hover: hover || indicativeHover
3106
3079
  }),
3107
3080
  style: __spreadValues({}, style),
@@ -3165,7 +3138,7 @@ import {
3165
3138
  createContext as createContext2,
3166
3139
  useCallback as useCallback7,
3167
3140
  useMemo as useMemo6,
3168
- useState as useState14
3141
+ useState as useState13
3169
3142
  } from "react";
3170
3143
  import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
3171
3144
  var dropZoneContext = createContext2(null);
@@ -3173,12 +3146,12 @@ var DropZoneProvider = ({
3173
3146
  children,
3174
3147
  value
3175
3148
  }) => {
3176
- const [hoveringComponent, setHoveringComponent] = useState14();
3177
- const [areasWithZones, setAreasWithZones] = useState14(
3149
+ const [hoveringComponent, setHoveringComponent] = useState13();
3150
+ const [areasWithZones, setAreasWithZones] = useState13(
3178
3151
  {}
3179
3152
  );
3180
- const [activeZones, setActiveZones] = useState14({});
3181
- const { dispatch = null } = value ? value : {};
3153
+ const [activeZones, setActiveZones] = useState13({});
3154
+ const { dispatch } = useAppContext();
3182
3155
  const registerZoneArea = useCallback7(
3183
3156
  (area) => {
3184
3157
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
@@ -3238,16 +3211,16 @@ var insert = (list, index, item) => {
3238
3211
 
3239
3212
  // components/DropZone/use-min-empty-height.ts
3240
3213
  init_react_import();
3241
- import { useEffect as useEffect12, useState as useState15 } from "react";
3214
+ import { useEffect as useEffect11, useState as useState14 } from "react";
3242
3215
  var useMinEmptyHeight = ({
3243
3216
  draggedItem,
3244
3217
  zoneCompound,
3245
3218
  userMinEmptyHeight,
3246
3219
  ref
3247
3220
  }) => {
3248
- const [prevHeight, setPrevHeight] = useState15(0);
3249
- const [isAnimating, setIsAnimating] = useState15(false);
3250
- useEffect12(() => {
3221
+ const [prevHeight, setPrevHeight] = useState14(0);
3222
+ const [isAnimating, setIsAnimating] = useState14(false);
3223
+ useEffect11(() => {
3251
3224
  if (draggedItem && ref.current) {
3252
3225
  const componentData = draggedItem.data;
3253
3226
  if (componentData.zone === zoneCompound) {
@@ -3317,12 +3290,12 @@ var DropZoneEdit = forwardRef3(
3317
3290
  } = ctx;
3318
3291
  const { itemSelector } = appContext2.state.ui;
3319
3292
  let zoneCompound = rootDroppableId;
3320
- useEffect13(() => {
3293
+ useEffect12(() => {
3321
3294
  if (areaId && registerZoneArea) {
3322
3295
  registerZoneArea(areaId);
3323
3296
  }
3324
3297
  }, [areaId]);
3325
- useEffect13(() => {
3298
+ useEffect12(() => {
3326
3299
  if (ctx == null ? void 0 : ctx.registerZone) {
3327
3300
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3328
3301
  }
@@ -3368,7 +3341,7 @@ var DropZoneEdit = forwardRef3(
3368
3341
  },
3369
3342
  [allow, disallow]
3370
3343
  );
3371
- useEffect13(() => {
3344
+ useEffect12(() => {
3372
3345
  if (registerLocalZone) {
3373
3346
  registerLocalZone(zoneCompound, acceptsTarget(draggedItem));
3374
3347
  }
@@ -3427,7 +3400,7 @@ var DropZoneEdit = forwardRef3(
3427
3400
  const { ref: dropRef } = useDroppableSafe(droppableConfig);
3428
3401
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
3429
3402
  const isAreaSelected = selectedItem && areaId === selectedItem.props.id;
3430
- const [dragAxis, setDragAxis] = useState16(
3403
+ const [dragAxis, setDragAxis] = useState15(
3431
3404
  collisionAxis || DEFAULT_DRAG_AXIS
3432
3405
  );
3433
3406
  const calculateDragAxis = useCallback8(() => {
@@ -3442,8 +3415,8 @@ var DropZoneEdit = forwardRef3(
3442
3415
  }
3443
3416
  }
3444
3417
  }, [ref.current]);
3445
- useEffect13(calculateDragAxis, [appContext2.status, collisionAxis]);
3446
- useEffect13(() => {
3418
+ useEffect12(calculateDragAxis, [appContext2.status, collisionAxis]);
3419
+ useEffect12(() => {
3447
3420
  const onViewportChange = () => {
3448
3421
  calculateDragAxis();
3449
3422
  };
@@ -3559,6 +3532,16 @@ var DropZoneRender = forwardRef3(
3559
3532
  const { data, areaId = "root", config } = ctx || {};
3560
3533
  let zoneCompound = rootDroppableId;
3561
3534
  let content = (data == null ? void 0 : data.content) || [];
3535
+ useEffect12(() => {
3536
+ if (ctx == null ? void 0 : ctx.registerZone) {
3537
+ ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3538
+ }
3539
+ return () => {
3540
+ if (ctx == null ? void 0 : ctx.unregisterZone) {
3541
+ ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
3542
+ }
3543
+ };
3544
+ }, []);
3562
3545
  if (!data || !config) {
3563
3546
  return null;
3564
3547
  }
@@ -4485,7 +4468,7 @@ var dragListenerContext = createContext3({
4485
4468
  });
4486
4469
  function useDragListener(type, fn, deps = []) {
4487
4470
  const { setDragListeners } = useContext4(dragListenerContext);
4488
- useEffect14(() => {
4471
+ useEffect13(() => {
4489
4472
  if (setDragListeners) {
4490
4473
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4491
4474
  [type]: [...old[type] || [], fn]
@@ -4500,11 +4483,11 @@ var DragDropContextClient = ({
4500
4483
  disableAutoScroll
4501
4484
  }) => {
4502
4485
  const { state, config, dispatch, resolveData } = useAppContext();
4503
- const [preview, setPreview] = useState17(null);
4486
+ const [preview, setPreview] = useState16(null);
4504
4487
  const previewRef = useRef5(null);
4505
4488
  const { data } = state;
4506
- const [deepest, setDeepest] = useState17(null);
4507
- const [nextDeepest, setNextDeepest] = useState17(null);
4489
+ const [deepest, setDeepest] = useState16(null);
4490
+ const [nextDeepest, setNextDeepest] = useState16(null);
4508
4491
  const deepestRef = useRef5(deepest);
4509
4492
  const debouncedParamsRef = useRef5(null);
4510
4493
  const setDeepestAndCollide = useCallback9(
@@ -4521,14 +4504,14 @@ var DragDropContextClient = ({
4521
4504
  setDeepestAndCollide,
4522
4505
  AREA_CHANGE_DEBOUNCE_MS
4523
4506
  );
4524
- useEffect14(() => {
4507
+ useEffect13(() => {
4525
4508
  deepestRef.current = deepest;
4526
4509
  }, [deepest]);
4527
4510
  const cancelDb = () => {
4528
4511
  setDeepestDb.cancel();
4529
4512
  debouncedParamsRef.current = null;
4530
4513
  };
4531
- const [plugins] = useState17(() => [
4514
+ const [plugins] = useState16(() => [
4532
4515
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4533
4516
  createNestedDroppablePlugin({
4534
4517
  onChange: (params, manager) => {
@@ -4566,7 +4549,7 @@ var DragDropContextClient = ({
4566
4549
  }
4567
4550
  })
4568
4551
  ]);
4569
- const [sensors] = useState17(() => [
4552
+ const [sensors] = useState16(() => [
4570
4553
  PointerSensor.configure({
4571
4554
  activationConstraints(event, source) {
4572
4555
  var _a;
@@ -4585,9 +4568,9 @@ var DragDropContextClient = ({
4585
4568
  }
4586
4569
  })
4587
4570
  ]);
4588
- const [draggedItem, setDraggedItem] = useState17();
4589
- const [dragListeners, setDragListeners] = useState17({});
4590
- const [pathData, setPathData] = useState17();
4571
+ const [draggedItem, setDraggedItem] = useState16();
4572
+ const [dragListeners, setDragListeners] = useState16({});
4573
+ const [pathData, setPathData] = useState16();
4591
4574
  const dragMode = useRef5(null);
4592
4575
  const registerPath = useCallback9(
4593
4576
  (selector) => {
@@ -4775,7 +4758,6 @@ var DragDropContextClient = ({
4775
4758
  value: {
4776
4759
  data,
4777
4760
  config,
4778
- dispatch,
4779
4761
  draggedItem,
4780
4762
  mode: "edit",
4781
4763
  areaId: "root",
@@ -4872,7 +4854,7 @@ var DrawerItem = ({
4872
4854
  isDragDisabled
4873
4855
  }) => {
4874
4856
  const resolvedId = id || name;
4875
- const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
4857
+ const [dynamicId, setDynamicId] = useState17(generateId(resolvedId));
4876
4858
  if (typeof index !== "undefined") {
4877
4859
  console.error(
4878
4860
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -4911,7 +4893,7 @@ var Drawer = ({
4911
4893
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
4912
4894
  );
4913
4895
  }
4914
- const [id] = useState18(generateId());
4896
+ const [id] = useState17(generateId());
4915
4897
  const { ref } = useDroppableSafe({
4916
4898
  id,
4917
4899
  type: "void",
@@ -4934,11 +4916,11 @@ Drawer.Item = DrawerItem;
4934
4916
  // components/Puck/index.tsx
4935
4917
  init_react_import();
4936
4918
  import {
4937
- useCallback as useCallback14,
4938
- useEffect as useEffect22,
4919
+ useCallback as useCallback15,
4920
+ useEffect as useEffect21,
4939
4921
  useMemo as useMemo17,
4940
4922
  useReducer,
4941
- useState as useState26
4923
+ useState as useState25
4942
4924
  } from "react";
4943
4925
 
4944
4926
  // components/SidebarSection/index.tsx
@@ -5135,7 +5117,7 @@ init_react_import();
5135
5117
  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" };
5136
5118
 
5137
5119
  // components/Puck/components/Fields/index.tsx
5138
- import { useCallback as useCallback10, useEffect as useEffect15, useMemo as useMemo10, useState as useState19 } from "react";
5120
+ import { useCallback as useCallback10, useEffect as useEffect14, useMemo as useMemo10, useState as useState18 } from "react";
5139
5121
 
5140
5122
  // lib/use-parent.ts
5141
5123
  init_react_import();
@@ -5174,9 +5156,9 @@ var useResolvedFields = () => {
5174
5156
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5175
5157
  );
5176
5158
  const rootProps = data.root.props || data.root;
5177
- const [lastSelectedData, setLastSelectedData] = useState19({});
5178
- const [resolvedFields, setResolvedFields] = useState19(defaultFields);
5179
- const [fieldsLoading, setFieldsLoading] = useState19(false);
5159
+ const [lastSelectedData, setLastSelectedData] = useState18({});
5160
+ const [resolvedFields, setResolvedFields] = useState18(defaultFields);
5161
+ const [fieldsLoading, setFieldsLoading] = useState18(false);
5180
5162
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5181
5163
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5182
5164
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
@@ -5220,7 +5202,7 @@ var useResolvedFields = () => {
5220
5202
  }),
5221
5203
  [data, config, componentData, selectedItem, resolvedFields, state]
5222
5204
  );
5223
- useEffect15(() => {
5205
+ useEffect14(() => {
5224
5206
  if (hasResolver) {
5225
5207
  setFieldsLoading(true);
5226
5208
  resolveFields(defaultFields).then((fields) => {
@@ -5374,7 +5356,7 @@ init_react_import();
5374
5356
 
5375
5357
  // lib/use-component-list.tsx
5376
5358
  init_react_import();
5377
- import { useEffect as useEffect16, useState as useState20 } from "react";
5359
+ import { useEffect as useEffect15, useState as useState19 } from "react";
5378
5360
 
5379
5361
  // components/ComponentList/index.tsx
5380
5362
  init_react_import();
@@ -5441,8 +5423,8 @@ ComponentList.Item = ComponentListItem;
5441
5423
  // lib/use-component-list.tsx
5442
5424
  import { jsx as jsx28 } from "react/jsx-runtime";
5443
5425
  var useComponentList = (config, ui) => {
5444
- const [componentList, setComponentList] = useState20();
5445
- useEffect16(() => {
5426
+ const [componentList, setComponentList] = useState19();
5427
+ useEffect15(() => {
5446
5428
  var _a, _b, _c;
5447
5429
  if (Object.keys(ui.componentList).length > 0) {
5448
5430
  const matchedComponents = [];
@@ -5522,15 +5504,15 @@ var Components = () => {
5522
5504
 
5523
5505
  // components/Puck/components/Preview/index.tsx
5524
5506
  init_react_import();
5525
- import { useCallback as useCallback11, useEffect as useEffect18, useRef as useRef7, useMemo as useMemo12 } from "react";
5507
+ import { useCallback as useCallback11, useEffect as useEffect17, useRef as useRef7, useMemo as useMemo12 } from "react";
5526
5508
 
5527
5509
  // components/AutoFrame/index.tsx
5528
5510
  init_react_import();
5529
5511
  import {
5530
5512
  createContext as createContext4,
5531
5513
  useContext as useContext7,
5532
- useEffect as useEffect17,
5533
- useState as useState21
5514
+ useEffect as useEffect16,
5515
+ useState as useState20
5534
5516
  } from "react";
5535
5517
  import hash from "object-hash";
5536
5518
  import { createPortal as createPortal3 } from "react-dom";
@@ -5577,7 +5559,7 @@ var CopyHostStyles = ({
5577
5559
  onStylesLoaded = () => null
5578
5560
  }) => {
5579
5561
  const { document: doc, window: win } = useFrame();
5580
- useEffect17(() => {
5562
+ useEffect16(() => {
5581
5563
  if (!win || !doc) {
5582
5564
  return () => {
5583
5565
  };
@@ -5754,10 +5736,10 @@ function AutoFrame(_a) {
5754
5736
  "onStylesLoaded",
5755
5737
  "frameRef"
5756
5738
  ]);
5757
- const [loaded, setLoaded] = useState21(false);
5758
- const [ctx, setCtx] = useState21({});
5759
- const [mountTarget, setMountTarget] = useState21();
5760
- useEffect17(() => {
5739
+ const [loaded, setLoaded] = useState20(false);
5740
+ const [ctx, setCtx] = useState20({});
5741
+ const [mountTarget, setMountTarget] = useState20();
5742
+ useEffect16(() => {
5761
5743
  var _a2;
5762
5744
  if (frameRef.current) {
5763
5745
  setCtx({
@@ -5790,12 +5772,68 @@ var AutoFrame_default = AutoFrame;
5790
5772
  init_react_import();
5791
5773
  var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
5792
5774
 
5775
+ // components/Render/index.tsx
5776
+ init_react_import();
5777
+ import { jsx as jsx31 } from "react/jsx-runtime";
5778
+ function Render({
5779
+ config,
5780
+ data
5781
+ }) {
5782
+ var _a;
5783
+ const defaultedData = __spreadProps(__spreadValues({}, data), {
5784
+ root: data.root || {},
5785
+ content: data.content || []
5786
+ });
5787
+ const rootProps = defaultedData.root.props || defaultedData.root;
5788
+ const title = (rootProps == null ? void 0 : rootProps.title) || "";
5789
+ if ((_a = config.root) == null ? void 0 : _a.render) {
5790
+ return /* @__PURE__ */ jsx31(
5791
+ DropZoneProvider,
5792
+ {
5793
+ value: {
5794
+ data: defaultedData,
5795
+ config,
5796
+ mode: "render",
5797
+ depth: 0,
5798
+ path: []
5799
+ },
5800
+ children: /* @__PURE__ */ jsx31(
5801
+ config.root.render,
5802
+ __spreadProps(__spreadValues({}, rootProps), {
5803
+ puck: {
5804
+ renderDropZone: DropZone,
5805
+ isEditing: false
5806
+ },
5807
+ title,
5808
+ editMode: false,
5809
+ id: "puck-root",
5810
+ children: /* @__PURE__ */ jsx31(DropZone, { zone: rootDroppableId })
5811
+ })
5812
+ )
5813
+ }
5814
+ );
5815
+ }
5816
+ return /* @__PURE__ */ jsx31(
5817
+ DropZoneProvider,
5818
+ {
5819
+ value: {
5820
+ data: defaultedData,
5821
+ config,
5822
+ mode: "render",
5823
+ depth: 0,
5824
+ path: []
5825
+ },
5826
+ children: /* @__PURE__ */ jsx31(DropZone, { zone: rootDroppableId })
5827
+ }
5828
+ );
5829
+ }
5830
+
5793
5831
  // components/Puck/components/Preview/index.tsx
5794
- import { Fragment as Fragment10, jsx as jsx31 } from "react/jsx-runtime";
5832
+ import { Fragment as Fragment10, jsx as jsx32 } from "react/jsx-runtime";
5795
5833
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
5796
5834
  var useBubbleIframeEvents = (ref) => {
5797
5835
  const { status } = useAppContext();
5798
- useEffect18(() => {
5836
+ useEffect17(() => {
5799
5837
  var _a;
5800
5838
  if (ref.current && status === "READY") {
5801
5839
  const iframe = ref.current;
@@ -5839,7 +5877,7 @@ var Preview = ({ id = "puck-preview" }) => {
5839
5877
  var _a, _b;
5840
5878
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
5841
5879
  id: "puck-root"
5842
- }, pageProps)) : /* @__PURE__ */ jsx31(Fragment10, { children: pageProps.children });
5880
+ }, pageProps)) : /* @__PURE__ */ jsx32(Fragment10, { children: pageProps.children });
5843
5881
  },
5844
5882
  [config.root]
5845
5883
  );
@@ -5847,7 +5885,19 @@ var Preview = ({ id = "puck-preview" }) => {
5847
5885
  const rootProps = state.data.root.props || state.data.root;
5848
5886
  const ref = useRef7(null);
5849
5887
  useBubbleIframeEvents(ref);
5850
- return /* @__PURE__ */ jsx31(
5888
+ const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx32(
5889
+ Page,
5890
+ __spreadProps(__spreadValues({}, rootProps), {
5891
+ puck: {
5892
+ renderDropZone: DropZone,
5893
+ isEditing: true,
5894
+ dragRef: null
5895
+ },
5896
+ editMode: true,
5897
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
5898
+ })
5899
+ ) : /* @__PURE__ */ jsx32(Render, { data: state.data, config });
5900
+ return /* @__PURE__ */ jsx32(
5851
5901
  "div",
5852
5902
  {
5853
5903
  className: getClassName23(),
@@ -5856,7 +5906,7 @@ var Preview = ({ id = "puck-preview" }) => {
5856
5906
  onClick: () => {
5857
5907
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
5858
5908
  },
5859
- children: iframe.enabled ? /* @__PURE__ */ jsx31(
5909
+ children: iframe.enabled ? /* @__PURE__ */ jsx32(
5860
5910
  AutoFrame_default,
5861
5911
  {
5862
5912
  id: "preview-frame",
@@ -5866,40 +5916,21 @@ var Preview = ({ id = "puck-preview" }) => {
5866
5916
  setStatus("READY");
5867
5917
  },
5868
5918
  frameRef: ref,
5869
- children: /* @__PURE__ */ jsx31(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
5870
- const inner = /* @__PURE__ */ jsx31(
5871
- Page,
5872
- __spreadProps(__spreadValues({}, rootProps), {
5873
- puck: {
5874
- renderDropZone: DropZone,
5875
- isEditing: true,
5876
- dragRef: null
5877
- },
5878
- editMode: true,
5879
- children: /* @__PURE__ */ jsx31(DropZone, { zone: rootDroppableId })
5880
- })
5881
- );
5919
+ children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
5882
5920
  if (Frame) {
5883
- return /* @__PURE__ */ jsx31(Frame, { document: document2, children: inner });
5921
+ return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
5884
5922
  }
5885
5923
  return inner;
5886
5924
  } })
5887
5925
  }
5888
- ) : /* @__PURE__ */ jsx31(
5926
+ ) : /* @__PURE__ */ jsx32(
5889
5927
  "div",
5890
5928
  {
5891
5929
  id: "preview-frame",
5892
5930
  className: getClassName23("frame"),
5893
5931
  ref,
5894
5932
  "data-puck-entry": true,
5895
- children: /* @__PURE__ */ jsx31(
5896
- Page,
5897
- __spreadProps(__spreadValues({}, rootProps), {
5898
- puck: { renderDropZone: DropZone, isEditing: true, dragRef: null },
5899
- editMode: true,
5900
- children: /* @__PURE__ */ jsx31(DropZone, { zone: rootDroppableId })
5901
- })
5902
- )
5933
+ children: inner
5903
5934
  }
5904
5935
  )
5905
5936
  }
@@ -5982,7 +6013,7 @@ var onScrollEnd = (frame, cb) => {
5982
6013
  };
5983
6014
 
5984
6015
  // components/LayerTree/index.tsx
5985
- import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
6016
+ import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
5986
6017
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
5987
6018
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
5988
6019
  var LayerTree = ({
@@ -5998,12 +6029,12 @@ var LayerTree = ({
5998
6029
  const ctx = useContext8(dropZoneContext);
5999
6030
  return /* @__PURE__ */ jsxs16(Fragment11, { children: [
6000
6031
  label && /* @__PURE__ */ jsxs16("div", { className: getClassName24("zoneTitle"), children: [
6001
- /* @__PURE__ */ jsx32("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx32(Layers, { size: "16" }) }),
6032
+ /* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
6002
6033
  " ",
6003
6034
  label
6004
6035
  ] }),
6005
6036
  /* @__PURE__ */ jsxs16("ul", { className: getClassName24(), children: [
6006
- zoneContent.length === 0 && /* @__PURE__ */ jsx32("div", { className: getClassName24("helper"), children: "No items" }),
6037
+ zoneContent.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName24("helper"), children: "No items" }),
6007
6038
  zoneContent.map((item, i) => {
6008
6039
  var _a;
6009
6040
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -6026,7 +6057,7 @@ var LayerTree = ({
6026
6057
  childIsSelected
6027
6058
  }),
6028
6059
  children: [
6029
- /* @__PURE__ */ jsx32("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs16(
6060
+ /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs16(
6030
6061
  "button",
6031
6062
  {
6032
6063
  type: "button",
@@ -6065,22 +6096,22 @@ var LayerTree = ({
6065
6096
  setHoveringComponent(null);
6066
6097
  },
6067
6098
  children: [
6068
- containsZone && /* @__PURE__ */ jsx32(
6099
+ containsZone && /* @__PURE__ */ jsx33(
6069
6100
  "div",
6070
6101
  {
6071
6102
  className: getClassNameLayer("chevron"),
6072
6103
  title: isSelected ? "Collapse" : "Expand",
6073
- children: /* @__PURE__ */ jsx32(ChevronDown, { size: "12" })
6104
+ children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
6074
6105
  }
6075
6106
  ),
6076
6107
  /* @__PURE__ */ jsxs16("div", { className: getClassNameLayer("title"), children: [
6077
- /* @__PURE__ */ jsx32("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx32(Type, { size: "16" }) : /* @__PURE__ */ jsx32(LayoutGrid, { size: "16" }) }),
6078
- /* @__PURE__ */ jsx32("div", { className: getClassNameLayer("name"), children: label2 })
6108
+ /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx33(Type, { size: "16" }) : /* @__PURE__ */ jsx33(LayoutGrid, { size: "16" }) }),
6109
+ /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label2 })
6079
6110
  ] })
6080
6111
  ]
6081
6112
  }
6082
6113
  ) }),
6083
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx32("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx32(
6114
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(
6084
6115
  LayerTree,
6085
6116
  {
6086
6117
  config,
@@ -6103,7 +6134,7 @@ var LayerTree = ({
6103
6134
 
6104
6135
  // components/Puck/components/Outline/index.tsx
6105
6136
  import { useCallback as useCallback12, useMemo as useMemo13 } from "react";
6106
- import { Fragment as Fragment12, jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
6137
+ import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
6107
6138
  var Outline = () => {
6108
6139
  const { dispatch, state, overrides, config } = useAppContext();
6109
6140
  const { data, ui } = state;
@@ -6118,8 +6149,8 @@ var Outline = () => {
6118
6149
  []
6119
6150
  );
6120
6151
  const Wrapper = useMemo13(() => overrides.outline || "div", [overrides]);
6121
- return /* @__PURE__ */ jsx33(Wrapper, { children: /* @__PURE__ */ jsx33(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
6122
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx33(
6152
+ return /* @__PURE__ */ jsx34(Wrapper, { children: /* @__PURE__ */ jsx34(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
6153
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx34(
6123
6154
  LayerTree,
6124
6155
  {
6125
6156
  config,
@@ -6132,7 +6163,7 @@ var Outline = () => {
6132
6163
  ),
6133
6164
  Object.entries(findZonesForArea(data, "root")).map(
6134
6165
  ([zoneKey, zone]) => {
6135
- return /* @__PURE__ */ jsx33(
6166
+ return /* @__PURE__ */ jsx34(
6136
6167
  LayerTree,
6137
6168
  {
6138
6169
  config,
@@ -6231,19 +6262,19 @@ function usePuckHistory({
6231
6262
 
6232
6263
  // lib/use-history-store.ts
6233
6264
  init_react_import();
6234
- import { useState as useState22 } from "react";
6265
+ import { useState as useState21 } from "react";
6235
6266
  import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
6236
6267
  var EMPTY_HISTORY_INDEX = 0;
6237
6268
  function useHistoryStore(initialHistory) {
6238
6269
  var _a, _b;
6239
- const [histories, setHistories] = useState22(
6270
+ const [histories, setHistories] = useState21(
6240
6271
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6241
6272
  );
6242
6273
  const updateHistories = (histories2) => {
6243
6274
  setHistories(histories2);
6244
6275
  setIndex(histories2.length - 1);
6245
6276
  };
6246
- const [index, setIndex] = useState22(
6277
+ const [index, setIndex] = useState21(
6247
6278
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6248
6279
  );
6249
6280
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6405,26 +6436,26 @@ var getBox = function getBox2(el) {
6405
6436
  // components/Puck/components/Canvas/index.tsx
6406
6437
  import {
6407
6438
  useCallback as useCallback13,
6408
- useEffect as useEffect20,
6439
+ useEffect as useEffect19,
6409
6440
  useMemo as useMemo15,
6410
6441
  useRef as useRef8,
6411
- useState as useState24
6442
+ useState as useState23
6412
6443
  } from "react";
6413
6444
 
6414
6445
  // components/ViewportControls/index.tsx
6415
6446
  init_react_import();
6416
- import { useEffect as useEffect19, useMemo as useMemo14, useState as useState23 } from "react";
6447
+ import { useEffect as useEffect18, useMemo as useMemo14, useState as useState22 } from "react";
6417
6448
 
6418
6449
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6419
6450
  init_react_import();
6420
6451
  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" };
6421
6452
 
6422
6453
  // components/ViewportControls/index.tsx
6423
- import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
6454
+ import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
6424
6455
  var icons = {
6425
- Smartphone: /* @__PURE__ */ jsx34(Smartphone, { size: 16 }),
6426
- Tablet: /* @__PURE__ */ jsx34(Tablet, { size: 16 }),
6427
- Monitor: /* @__PURE__ */ jsx34(Monitor, { size: 16 })
6456
+ Smartphone: /* @__PURE__ */ jsx35(Smartphone, { size: 16 }),
6457
+ Tablet: /* @__PURE__ */ jsx35(Tablet, { size: 16 }),
6458
+ Monitor: /* @__PURE__ */ jsx35(Monitor, { size: 16 })
6428
6459
  };
6429
6460
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
6430
6461
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -6436,11 +6467,11 @@ var ViewportButton = ({
6436
6467
  onClick
6437
6468
  }) => {
6438
6469
  const { state } = useAppContext();
6439
- const [isActive, setIsActive] = useState23(false);
6440
- useEffect19(() => {
6470
+ const [isActive, setIsActive] = useState22(false);
6471
+ useEffect18(() => {
6441
6472
  setIsActive(width === state.ui.viewports.current.width);
6442
6473
  }, [width, state.ui.viewports.current.width]);
6443
- return /* @__PURE__ */ jsx34("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx34(
6474
+ return /* @__PURE__ */ jsx35("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx35(
6444
6475
  IconButton,
6445
6476
  {
6446
6477
  title,
@@ -6449,7 +6480,7 @@ var ViewportButton = ({
6449
6480
  e.stopPropagation();
6450
6481
  onClick({ width, height });
6451
6482
  },
6452
- children: /* @__PURE__ */ jsx34("span", { className: getClassNameButton("inner"), children })
6483
+ children: /* @__PURE__ */ jsx35("span", { className: getClassNameButton("inner"), children })
6453
6484
  }
6454
6485
  ) });
6455
6486
  };
@@ -6486,7 +6517,7 @@ var ViewportControls = ({
6486
6517
  [autoZoom]
6487
6518
  );
6488
6519
  return /* @__PURE__ */ jsxs18("div", { className: getClassName25(), children: [
6489
- viewports.map((viewport, i) => /* @__PURE__ */ jsx34(
6520
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx35(
6490
6521
  ViewportButton,
6491
6522
  {
6492
6523
  height: viewport.height,
@@ -6497,8 +6528,8 @@ var ViewportControls = ({
6497
6528
  },
6498
6529
  i
6499
6530
  )),
6500
- /* @__PURE__ */ jsx34("div", { className: getClassName25("divider") }),
6501
- /* @__PURE__ */ jsx34(
6531
+ /* @__PURE__ */ jsx35("div", { className: getClassName25("divider") }),
6532
+ /* @__PURE__ */ jsx35(
6502
6533
  IconButton,
6503
6534
  {
6504
6535
  title: "Zoom viewport out",
@@ -6512,10 +6543,10 @@ var ViewportControls = ({
6512
6543
  )].value
6513
6544
  );
6514
6545
  },
6515
- children: /* @__PURE__ */ jsx34(ZoomOut, { size: 16 })
6546
+ children: /* @__PURE__ */ jsx35(ZoomOut, { size: 16 })
6516
6547
  }
6517
6548
  ),
6518
- /* @__PURE__ */ jsx34(
6549
+ /* @__PURE__ */ jsx35(
6519
6550
  IconButton,
6520
6551
  {
6521
6552
  title: "Zoom viewport in",
@@ -6529,11 +6560,11 @@ var ViewportControls = ({
6529
6560
  )].value
6530
6561
  );
6531
6562
  },
6532
- children: /* @__PURE__ */ jsx34(ZoomIn, { size: 16 })
6563
+ children: /* @__PURE__ */ jsx35(ZoomIn, { size: 16 })
6533
6564
  }
6534
6565
  ),
6535
- /* @__PURE__ */ jsx34("div", { className: getClassName25("divider") }),
6536
- /* @__PURE__ */ jsx34(
6566
+ /* @__PURE__ */ jsx35("div", { className: getClassName25("divider") }),
6567
+ /* @__PURE__ */ jsx35(
6537
6568
  "select",
6538
6569
  {
6539
6570
  className: getClassName25("zoomSelect"),
@@ -6541,7 +6572,7 @@ var ViewportControls = ({
6541
6572
  onChange: (e) => {
6542
6573
  onZoom(parseFloat(e.currentTarget.value));
6543
6574
  },
6544
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx34(
6575
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx35(
6545
6576
  "option",
6546
6577
  {
6547
6578
  value: option.value,
@@ -6589,7 +6620,7 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
6589
6620
  };
6590
6621
 
6591
6622
  // components/Puck/components/Canvas/index.tsx
6592
- import { Fragment as Fragment13, jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
6623
+ import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
6593
6624
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
6594
6625
  var ZOOM_ON_CHANGE = true;
6595
6626
  var Canvas = () => {
@@ -6597,9 +6628,9 @@ var Canvas = () => {
6597
6628
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
6598
6629
  const { ui } = state;
6599
6630
  const frameRef = useRef8(null);
6600
- const [showTransition, setShowTransition] = useState24(false);
6631
+ const [showTransition, setShowTransition] = useState23(false);
6601
6632
  const defaultRender = useMemo15(() => {
6602
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx35(Fragment13, { children });
6633
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
6603
6634
  return PuckDefault;
6604
6635
  }, []);
6605
6636
  const CustomPreview = useMemo15(
@@ -6624,11 +6655,11 @@ var Canvas = () => {
6624
6655
  },
6625
6656
  [frameRef, zoomConfig, state.ui]
6626
6657
  );
6627
- useEffect20(() => {
6658
+ useEffect19(() => {
6628
6659
  setShowTransition(false);
6629
6660
  resetAutoZoom();
6630
6661
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
6631
- useEffect20(() => {
6662
+ useEffect19(() => {
6632
6663
  const { height: frameHeight } = getFrameDimensions();
6633
6664
  if (ui.viewports.current.height === "auto") {
6634
6665
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -6636,13 +6667,13 @@ var Canvas = () => {
6636
6667
  }));
6637
6668
  }
6638
6669
  }, [zoomConfig.zoom]);
6639
- useEffect20(() => {
6670
+ useEffect19(() => {
6640
6671
  if (ZOOM_ON_CHANGE) {
6641
6672
  setShowTransition(true);
6642
6673
  resetAutoZoom(ui);
6643
6674
  }
6644
6675
  }, [ui.viewports.current.width]);
6645
- useEffect20(() => {
6676
+ useEffect19(() => {
6646
6677
  const cb = () => {
6647
6678
  setShowTransition(false);
6648
6679
  resetAutoZoom();
@@ -6652,8 +6683,8 @@ var Canvas = () => {
6652
6683
  window.removeEventListener("resize", cb);
6653
6684
  };
6654
6685
  }, []);
6655
- const [showLoader, setShowLoader] = useState24(false);
6656
- useEffect20(() => {
6686
+ const [showLoader, setShowLoader] = useState23(false);
6687
+ useEffect19(() => {
6657
6688
  setTimeout(() => {
6658
6689
  setShowLoader(true);
6659
6690
  }, 500);
@@ -6671,7 +6702,7 @@ var Canvas = () => {
6671
6702
  recordHistory: true
6672
6703
  }),
6673
6704
  children: [
6674
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx35("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx35(
6705
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx36("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx36(
6675
6706
  ViewportControls,
6676
6707
  {
6677
6708
  autoZoom: zoomConfig.autoZoom,
@@ -6698,7 +6729,7 @@ var Canvas = () => {
6698
6729
  }
6699
6730
  ) }),
6700
6731
  /* @__PURE__ */ jsxs19("div", { className: getClassName26("inner"), ref: frameRef, children: [
6701
- /* @__PURE__ */ jsx35(
6732
+ /* @__PURE__ */ jsx36(
6702
6733
  "div",
6703
6734
  {
6704
6735
  className: getClassName26("root"),
@@ -6719,10 +6750,10 @@ var Canvas = () => {
6719
6750
  })
6720
6751
  );
6721
6752
  },
6722
- children: /* @__PURE__ */ jsx35(CustomPreview, { children: /* @__PURE__ */ jsx35(Preview, {}) })
6753
+ children: /* @__PURE__ */ jsx36(CustomPreview, { children: /* @__PURE__ */ jsx36(Preview, {}) })
6723
6754
  }
6724
6755
  ),
6725
- /* @__PURE__ */ jsx35("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx35(Loader, { size: 24 }) })
6756
+ /* @__PURE__ */ jsx36("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx36(Loader, { size: 24 }) })
6726
6757
  ] })
6727
6758
  ]
6728
6759
  }
@@ -6777,22 +6808,19 @@ var useLoadedOverrides = ({
6777
6808
 
6778
6809
  // components/DefaultOverride/index.tsx
6779
6810
  init_react_import();
6780
- import { Fragment as Fragment14, jsx as jsx36 } from "react/jsx-runtime";
6781
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx36(Fragment14, { children });
6782
-
6783
- // components/Puck/index.tsx
6784
- import { DragDropManager as DragDropManager2, Feedback } from "@dnd-kit/dom";
6811
+ import { Fragment as Fragment14, jsx as jsx37 } from "react/jsx-runtime";
6812
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment14, { children });
6785
6813
 
6786
6814
  // lib/use-inject-css.ts
6787
6815
  init_react_import();
6788
- import { useEffect as useEffect21, useState as useState25 } from "react";
6816
+ import { useEffect as useEffect20, useState as useState24 } from "react";
6789
6817
  var styles = ``;
6790
6818
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
6791
- const [el, setEl] = useState25();
6792
- useEffect21(() => {
6819
+ const [el, setEl] = useState24();
6820
+ useEffect20(() => {
6793
6821
  setEl(document.createElement("style"));
6794
6822
  }, []);
6795
- useEffect21(() => {
6823
+ useEffect20(() => {
6796
6824
  var _a;
6797
6825
  if (!el || typeof window === "undefined") {
6798
6826
  return;
@@ -6810,8 +6838,35 @@ var useInjectGlobalCss = (iframeEnabled) => {
6810
6838
  return useInjectStyleSheet(styles, iframeEnabled);
6811
6839
  };
6812
6840
 
6841
+ // lib/use-preview-mode-hotkeys.ts
6842
+ init_react_import();
6843
+ import { useCallback as useCallback14 } from "react";
6844
+ import { useHotkeys as useHotkeys2 } from "react-hotkeys-hook";
6845
+ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
6846
+ const toggleInteractive = useCallback14(() => {
6847
+ dispatch({
6848
+ type: "setUi",
6849
+ ui: (ui) => ({
6850
+ previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
6851
+ })
6852
+ });
6853
+ }, [dispatch]);
6854
+ const toggleInteractiveIframe = () => {
6855
+ if (iframeEnabled) {
6856
+ toggleInteractive();
6857
+ }
6858
+ };
6859
+ const frame = getFrame();
6860
+ const resolvedFrame = typeof window !== "undefined" && frame !== document ? frame : void 0;
6861
+ useHotkeys2("meta+i", toggleInteractive, { preventDefault: true });
6862
+ useHotkeys2("meta+i", toggleInteractiveIframe, {
6863
+ preventDefault: true,
6864
+ document: resolvedFrame
6865
+ });
6866
+ };
6867
+
6813
6868
  // components/Puck/index.tsx
6814
- import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
6869
+ import { Fragment as Fragment15, jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
6815
6870
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
6816
6871
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
6817
6872
  function Puck({
@@ -6840,7 +6895,7 @@ function Puck({
6840
6895
  waitForStyles: true
6841
6896
  }, _iframe);
6842
6897
  useInjectGlobalCss(iframe.enabled);
6843
- const [generatedAppState] = useState26(() => {
6898
+ const [generatedAppState] = useState25(() => {
6844
6899
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
6845
6900
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
6846
6901
  let clientUiState = {};
@@ -6912,7 +6967,7 @@ function Puck({
6912
6967
  histories,
6913
6968
  index: initialHistoryIndex
6914
6969
  });
6915
- const [reducer] = useState26(
6970
+ const [reducer] = useState25(
6916
6971
  () => createReducer({
6917
6972
  config,
6918
6973
  record: historyStore.record,
@@ -6930,14 +6985,14 @@ function Puck({
6930
6985
  historyStore,
6931
6986
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
6932
6987
  });
6933
- const [menuOpen, setMenuOpen] = useState26(false);
6988
+ const [menuOpen, setMenuOpen] = useState25(false);
6934
6989
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
6935
6990
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
6936
- useEffect22(() => {
6991
+ useEffect21(() => {
6937
6992
  if (onChange) onChange(data);
6938
6993
  }, [data]);
6939
6994
  const rootProps = data.root.props || data.root;
6940
- const toggleSidebars = useCallback14(
6995
+ const toggleSidebars = useCallback15(
6941
6996
  (sidebar) => {
6942
6997
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
6943
6998
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -6951,7 +7006,7 @@ function Puck({
6951
7006
  },
6952
7007
  [dispatch, leftSideBarVisible, rightSideBarVisible]
6953
7008
  );
6954
- useEffect22(() => {
7009
+ useEffect21(() => {
6955
7010
  if (!window.matchMedia("(min-width: 638px)").matches) {
6956
7011
  dispatch({
6957
7012
  type: "setUi",
@@ -6982,7 +7037,7 @@ function Puck({
6982
7037
  const RenderHeader = (_a2) => {
6983
7038
  var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
6984
7039
  const Comp = renderHeader;
6985
- return /* @__PURE__ */ jsx37(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7040
+ return /* @__PURE__ */ jsx38(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
6986
7041
  };
6987
7042
  return RenderHeader;
6988
7043
  }
@@ -6995,7 +7050,7 @@ function Puck({
6995
7050
  );
6996
7051
  const RenderHeader = (props) => {
6997
7052
  const Comp = renderHeaderActions;
6998
- return /* @__PURE__ */ jsx37(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7053
+ return /* @__PURE__ */ jsx38(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
6999
7054
  };
7000
7055
  return RenderHeader;
7001
7056
  }
@@ -7017,15 +7072,15 @@ function Puck({
7017
7072
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7018
7073
  [loadedOverrides]
7019
7074
  );
7020
- const [mounted, setMounted] = useState26(false);
7021
- useEffect22(() => {
7075
+ const [mounted, setMounted] = useState25(false);
7076
+ useEffect21(() => {
7022
7077
  setMounted(true);
7023
7078
  }, []);
7024
7079
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
7025
7080
  const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
7026
- const [manager] = useState26(new DragDropManager2({ plugins: [Feedback] }));
7081
+ usePreviewModeHotkeys(dispatch, iframe.enabled);
7027
7082
  return /* @__PURE__ */ jsxs20("div", { className: `Puck ${getClassName27()}`, children: [
7028
- /* @__PURE__ */ jsx37(
7083
+ /* @__PURE__ */ jsx38(
7029
7084
  AppProvider,
7030
7085
  {
7031
7086
  value: {
@@ -7047,7 +7102,7 @@ function Puck({
7047
7102
  getPermissions: () => ({}),
7048
7103
  refreshPermissions: () => null
7049
7104
  },
7050
- children: /* @__PURE__ */ jsx37(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx37(CustomPuck, { children: children || /* @__PURE__ */ jsx37(
7105
+ children: /* @__PURE__ */ jsx38(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx38(CustomPuck, { children: children || /* @__PURE__ */ jsx38(
7051
7106
  "div",
7052
7107
  {
7053
7108
  className: getLayoutClassName({
@@ -7057,59 +7112,59 @@ function Puck({
7057
7112
  rightSideBarVisible
7058
7113
  }),
7059
7114
  children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("inner"), children: [
7060
- /* @__PURE__ */ jsx37(
7115
+ /* @__PURE__ */ jsx38(
7061
7116
  CustomHeader,
7062
7117
  {
7063
- actions: /* @__PURE__ */ jsx37(Fragment15, { children: /* @__PURE__ */ jsx37(CustomHeaderActions, { children: /* @__PURE__ */ jsx37(
7118
+ actions: /* @__PURE__ */ jsx38(Fragment15, { children: /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
7064
7119
  Button,
7065
7120
  {
7066
7121
  onClick: () => {
7067
7122
  onPublish && onPublish(data);
7068
7123
  },
7069
- icon: /* @__PURE__ */ jsx37(Globe, { size: "14px" }),
7124
+ icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
7070
7125
  children: "Publish"
7071
7126
  }
7072
7127
  ) }) }),
7073
- children: /* @__PURE__ */ jsx37("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerInner"), children: [
7128
+ children: /* @__PURE__ */ jsx38("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerInner"), children: [
7074
7129
  /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerToggle"), children: [
7075
- /* @__PURE__ */ jsx37(
7130
+ /* @__PURE__ */ jsx38(
7076
7131
  "div",
7077
7132
  {
7078
7133
  className: getLayoutClassName("leftSideBarToggle"),
7079
- children: /* @__PURE__ */ jsx37(
7134
+ children: /* @__PURE__ */ jsx38(
7080
7135
  IconButton,
7081
7136
  {
7082
7137
  onClick: () => {
7083
7138
  toggleSidebars("left");
7084
7139
  },
7085
7140
  title: "Toggle left sidebar",
7086
- children: /* @__PURE__ */ jsx37(PanelLeft, { focusable: "false" })
7141
+ children: /* @__PURE__ */ jsx38(PanelLeft, { focusable: "false" })
7087
7142
  }
7088
7143
  )
7089
7144
  }
7090
7145
  ),
7091
- /* @__PURE__ */ jsx37(
7146
+ /* @__PURE__ */ jsx38(
7092
7147
  "div",
7093
7148
  {
7094
7149
  className: getLayoutClassName("rightSideBarToggle"),
7095
- children: /* @__PURE__ */ jsx37(
7150
+ children: /* @__PURE__ */ jsx38(
7096
7151
  IconButton,
7097
7152
  {
7098
7153
  onClick: () => {
7099
7154
  toggleSidebars("right");
7100
7155
  },
7101
7156
  title: "Toggle right sidebar",
7102
- children: /* @__PURE__ */ jsx37(PanelRight, { focusable: "false" })
7157
+ children: /* @__PURE__ */ jsx38(PanelRight, { focusable: "false" })
7103
7158
  }
7104
7159
  )
7105
7160
  }
7106
7161
  )
7107
7162
  ] }),
7108
- /* @__PURE__ */ jsx37("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs20(Heading, { rank: "2", size: "xs", children: [
7163
+ /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs20(Heading, { rank: "2", size: "xs", children: [
7109
7164
  headerTitle || rootProps.title || "Page",
7110
7165
  headerPath && /* @__PURE__ */ jsxs20(Fragment15, { children: [
7111
7166
  " ",
7112
- /* @__PURE__ */ jsx37(
7167
+ /* @__PURE__ */ jsx38(
7113
7168
  "code",
7114
7169
  {
7115
7170
  className: getLayoutClassName("headerPath"),
@@ -7119,30 +7174,30 @@ function Puck({
7119
7174
  ] })
7120
7175
  ] }) }),
7121
7176
  /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerTools"), children: [
7122
- /* @__PURE__ */ jsx37("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ jsx37(
7177
+ /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ jsx38(
7123
7178
  IconButton,
7124
7179
  {
7125
7180
  onClick: () => {
7126
7181
  return setMenuOpen(!menuOpen);
7127
7182
  },
7128
7183
  title: "Toggle menu bar",
7129
- children: menuOpen ? /* @__PURE__ */ jsx37(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx37(ChevronDown, { focusable: "false" })
7184
+ children: menuOpen ? /* @__PURE__ */ jsx38(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx38(ChevronDown, { focusable: "false" })
7130
7185
  }
7131
7186
  ) }),
7132
- /* @__PURE__ */ jsx37(
7187
+ /* @__PURE__ */ jsx38(
7133
7188
  MenuBar,
7134
7189
  {
7135
7190
  appState,
7136
7191
  dispatch,
7137
7192
  onPublish,
7138
7193
  menuOpen,
7139
- renderHeaderActions: () => /* @__PURE__ */ jsx37(CustomHeaderActions, { children: /* @__PURE__ */ jsx37(
7194
+ renderHeaderActions: () => /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
7140
7195
  Button,
7141
7196
  {
7142
7197
  onClick: () => {
7143
7198
  onPublish && onPublish(data);
7144
7199
  },
7145
- icon: /* @__PURE__ */ jsx37(Globe, { size: "14px" }),
7200
+ icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
7146
7201
  children: "Publish"
7147
7202
  }
7148
7203
  ) }),
@@ -7154,18 +7209,18 @@ function Puck({
7154
7209
  }
7155
7210
  ),
7156
7211
  /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("leftSideBar"), children: [
7157
- /* @__PURE__ */ jsx37(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx37(Components, {}) }),
7158
- /* @__PURE__ */ jsx37(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx37(Outline, {}) })
7212
+ /* @__PURE__ */ jsx38(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx38(Components, {}) }),
7213
+ /* @__PURE__ */ jsx38(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx38(Outline, {}) })
7159
7214
  ] }),
7160
- /* @__PURE__ */ jsx37(Canvas, {}),
7161
- /* @__PURE__ */ jsx37("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx37(
7215
+ /* @__PURE__ */ jsx38(Canvas, {}),
7216
+ /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx38(
7162
7217
  SidebarSection,
7163
7218
  {
7164
7219
  noPadding: true,
7165
7220
  noBorderTop: true,
7166
7221
  showBreadcrumbs: true,
7167
7222
  title: selectedItem ? selectedComponentLabel : "Page",
7168
- children: /* @__PURE__ */ jsx37(Fields, {})
7223
+ children: /* @__PURE__ */ jsx38(Fields, {})
7169
7224
  }
7170
7225
  ) })
7171
7226
  ] })
@@ -7173,7 +7228,7 @@ function Puck({
7173
7228
  ) }) })
7174
7229
  }
7175
7230
  ),
7176
- /* @__PURE__ */ jsx37("div", { id: "puck-portal-root", className: getClassName27("portal") })
7231
+ /* @__PURE__ */ jsx38("div", { id: "puck-portal-root", className: getClassName27("portal") })
7177
7232
  ] });
7178
7233
  }
7179
7234
  Puck.Components = Components;
@@ -7181,62 +7236,6 @@ Puck.Fields = Fields;
7181
7236
  Puck.Outline = Outline;
7182
7237
  Puck.Preview = Preview;
7183
7238
 
7184
- // components/Render/index.tsx
7185
- init_react_import();
7186
- import { jsx as jsx38 } from "react/jsx-runtime";
7187
- function Render({
7188
- config,
7189
- data
7190
- }) {
7191
- var _a;
7192
- const defaultedData = __spreadProps(__spreadValues({}, data), {
7193
- root: data.root || {},
7194
- content: data.content || []
7195
- });
7196
- const rootProps = defaultedData.root.props || defaultedData.root;
7197
- const title = (rootProps == null ? void 0 : rootProps.title) || "";
7198
- if ((_a = config.root) == null ? void 0 : _a.render) {
7199
- return /* @__PURE__ */ jsx38(
7200
- DropZoneProvider,
7201
- {
7202
- value: {
7203
- data: defaultedData,
7204
- config,
7205
- mode: "render",
7206
- depth: 0,
7207
- path: []
7208
- },
7209
- children: /* @__PURE__ */ jsx38(
7210
- config.root.render,
7211
- __spreadProps(__spreadValues({}, rootProps), {
7212
- puck: {
7213
- renderDropZone: DropZone,
7214
- isEditing: false
7215
- },
7216
- title,
7217
- editMode: false,
7218
- id: "puck-root",
7219
- children: /* @__PURE__ */ jsx38(DropZone, { zone: rootDroppableId })
7220
- })
7221
- )
7222
- }
7223
- );
7224
- }
7225
- return /* @__PURE__ */ jsx38(
7226
- DropZoneProvider,
7227
- {
7228
- value: {
7229
- data: defaultedData,
7230
- config,
7231
- mode: "render",
7232
- depth: 0,
7233
- path: []
7234
- },
7235
- children: /* @__PURE__ */ jsx38(DropZone, { zone: rootDroppableId })
7236
- }
7237
- );
7238
- }
7239
-
7240
7239
  // lib/migrate.ts
7241
7240
  init_react_import();
7242
7241
  var migrations = [