@measured/puck 0.20.0-canary.88a4251d → 0.20.0-canary.8c56aa8b

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.
@@ -93,8 +93,9 @@ var overrideKeys = [
93
93
  "headerActions",
94
94
  "fields",
95
95
  "fieldLabel",
96
- "components",
97
- "componentItem",
96
+ "drawer",
97
+ "drawerItem",
98
+ "componentOverlay",
98
99
  "outline",
99
100
  "puck",
100
101
  "preview"
@@ -3862,7 +3863,7 @@ import {
3862
3863
 
3863
3864
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
3864
3865
  init_react_import();
3865
- var styles_module_default10 = { "DraggableComponent": "_DraggableComponent_qzbgx_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_qzbgx_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_qzbgx_29", "DraggableComponent--hover": "_DraggableComponent--hover_qzbgx_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_qzbgx_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_qzbgx_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_qzbgx_66", "DraggableComponent-actions": "_DraggableComponent-actions_qzbgx_66" };
3866
+ var styles_module_default10 = { "DraggableComponent": "_DraggableComponent_1vaqy_1", "DraggableComponent-overlayWrapper": "_DraggableComponent-overlayWrapper_1vaqy_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_1vaqy_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1vaqy_34", "DraggableComponent--hover": "_DraggableComponent--hover_1vaqy_50", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1vaqy_57", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1vaqy_71", "DraggableComponent-actions": "_DraggableComponent-actions_1vaqy_71" };
3866
3867
 
3867
3868
  // components/DraggableComponent/index.tsx
3868
3869
  import { createPortal as createPortal2 } from "react-dom";
@@ -4002,7 +4003,7 @@ var useOnDragFinished = (cb, deps = []) => {
4002
4003
  };
4003
4004
 
4004
4005
  // components/DraggableComponent/index.tsx
4005
- import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
4006
+ import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
4006
4007
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default10);
4007
4008
  var DEBUG2 = false;
4008
4009
  var space = 8;
@@ -4020,6 +4021,9 @@ var DefaultActionBar = ({
4020
4021
  ] }),
4021
4022
  /* @__PURE__ */ jsx20(ActionBar.Group, { children })
4022
4023
  ] });
4024
+ var DefaultOverlay = ({
4025
+ children
4026
+ }) => /* @__PURE__ */ jsx20(Fragment6, { children });
4023
4027
  var DraggableComponent = ({
4024
4028
  children,
4025
4029
  depth,
@@ -4213,9 +4217,16 @@ var DraggableComponent = ({
4213
4217
  () => overrides.actionBar || DefaultActionBar,
4214
4218
  [overrides.actionBar]
4215
4219
  );
4220
+ const CustomOverlay = useMemo5(
4221
+ () => overrides.componentOverlay || DefaultOverlay,
4222
+ [overrides.componentOverlay]
4223
+ );
4216
4224
  const onClick = useCallback8(
4217
4225
  (e) => {
4218
- e.stopPropagation();
4226
+ const el = e.target;
4227
+ if (!el.closest("[data-puck-overlay-portal]")) {
4228
+ e.stopPropagation();
4229
+ }
4219
4230
  dispatch({
4220
4231
  type: "setUi",
4221
4232
  ui: {
@@ -4455,7 +4466,16 @@ var DraggableComponent = ({
4455
4466
  )
4456
4467
  }
4457
4468
  ),
4458
- /* @__PURE__ */ jsx20("div", { className: getClassName16("overlay") })
4469
+ /* @__PURE__ */ jsx20("div", { className: getClassName16("overlayWrapper"), children: /* @__PURE__ */ jsx20(
4470
+ CustomOverlay,
4471
+ {
4472
+ componentId: id,
4473
+ componentType,
4474
+ hover,
4475
+ isSelected,
4476
+ children: /* @__PURE__ */ jsx20("div", { className: getClassName16("overlay") })
4477
+ }
4478
+ ) })
4459
4479
  ]
4460
4480
  }
4461
4481
  ),
@@ -5595,7 +5615,7 @@ var ContextSlotRender = ({
5595
5615
  };
5596
5616
 
5597
5617
  // components/DropZone/index.tsx
5598
- import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
5618
+ import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
5599
5619
  var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default11);
5600
5620
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5601
5621
  var RENDER_DEBUG = false;
@@ -5679,13 +5699,14 @@ var DropZoneChild = ({
5679
5699
  let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
5680
5700
  const renderPreview = useMemo8(
5681
5701
  () => function Preview3() {
5702
+ var _a2;
5682
5703
  if (item && "element" in item && item.element) {
5683
5704
  return (
5684
5705
  // Safe to use this since the HTML is set by the user
5685
5706
  /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5686
5707
  );
5687
5708
  }
5688
- return /* @__PURE__ */ jsx24(DrawerItemInner, { name: label, children: overrides.componentItem });
5709
+ return /* @__PURE__ */ jsx24(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5689
5710
  },
5690
5711
  [componentId, label, overrides]
5691
5712
  );
@@ -5737,7 +5758,7 @@ var DropZoneChild = ({
5737
5758
  autoDragAxis: dragAxis,
5738
5759
  userDragAxis: collisionAxis,
5739
5760
  inDroppableZone,
5740
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx24(Fragment6, { children: /* @__PURE__ */ jsx24(
5761
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(
5741
5762
  Render2,
5742
5763
  __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5743
5764
  puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
@@ -6005,9 +6026,9 @@ var DropZone = forwardRef3(
6005
6026
  function DropZone2(props, ref) {
6006
6027
  const ctx = useContext8(dropZoneContext);
6007
6028
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
6008
- return /* @__PURE__ */ jsx24(Fragment6, { children: /* @__PURE__ */ jsx24(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6029
+ return /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6009
6030
  }
6010
- return /* @__PURE__ */ jsx24(Fragment6, { children: /* @__PURE__ */ jsx24(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
6031
+ return /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
6011
6032
  }
6012
6033
  );
6013
6034
 
@@ -6159,7 +6180,7 @@ import {
6159
6180
  createContext as createContext8,
6160
6181
  useCallback as useCallback21,
6161
6182
  useContext as useContext13,
6162
- useEffect as useEffect27,
6183
+ useEffect as useEffect28,
6163
6184
  useMemo as useMemo20,
6164
6185
  useRef as useRef11,
6165
6186
  useState as useState24
@@ -6272,12 +6293,12 @@ var styles_module_default15 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
6272
6293
  // components/Puck/components/Fields/index.tsx
6273
6294
  import { memo as memo2, useCallback as useCallback13, useMemo as useMemo11 } from "react";
6274
6295
  import { useShallow as useShallow6 } from "zustand/react/shallow";
6275
- import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
6296
+ import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
6276
6297
  var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
6277
6298
  var DefaultFields = ({
6278
6299
  children
6279
6300
  }) => {
6280
- return /* @__PURE__ */ jsx27(Fragment7, { children });
6301
+ return /* @__PURE__ */ jsx27(Fragment8, { children });
6281
6302
  };
6282
6303
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6283
6304
  let currentProps;
@@ -6408,7 +6429,7 @@ init_react_import();
6408
6429
 
6409
6430
  // lib/use-component-list.tsx
6410
6431
  init_react_import();
6411
- import { useEffect as useEffect19, useState as useState17 } from "react";
6432
+ import { useEffect as useEffect20, useState as useState17 } from "react";
6412
6433
 
6413
6434
  // components/ComponentList/index.tsx
6414
6435
  init_react_import();
@@ -6418,19 +6439,28 @@ init_react_import();
6418
6439
  var styles_module_default16 = { "ComponentList": "_ComponentList_1rrlt_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1rrlt_5", "ComponentList-content": "_ComponentList-content_1rrlt_9", "ComponentList-title": "_ComponentList-title_1rrlt_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1rrlt_53" };
6419
6440
 
6420
6441
  // components/ComponentList/index.tsx
6442
+ import { useEffect as useEffect19 } from "react";
6421
6443
  import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
6422
6444
  var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
6423
6445
  var ComponentListItem = ({
6424
6446
  name,
6425
6447
  label
6426
6448
  }) => {
6449
+ var _a;
6427
6450
  const overrides = useAppStore((s) => s.overrides);
6428
6451
  const canInsert = useAppStore(
6429
6452
  (s) => s.permissions.getPermissions({
6430
6453
  type: name
6431
6454
  }).insert
6432
6455
  );
6433
- return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
6456
+ useEffect19(() => {
6457
+ if (overrides.componentItem) {
6458
+ console.warn(
6459
+ "The `componentItem` override has been deprecated and renamed to `drawerItem`"
6460
+ );
6461
+ }
6462
+ }, [overrides]);
6463
+ return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6434
6464
  };
6435
6465
  var ComponentList = ({
6436
6466
  children,
@@ -6482,7 +6512,7 @@ var useComponentList = () => {
6482
6512
  const [componentList, setComponentList] = useState17();
6483
6513
  const config = useAppStore((s) => s.config);
6484
6514
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
6485
- useEffect19(() => {
6515
+ useEffect20(() => {
6486
6516
  var _a, _b, _c;
6487
6517
  if (Object.keys(uiComponentList).length > 0) {
6488
6518
  const matchedComponents = [];
@@ -6556,25 +6586,32 @@ import { jsx as jsx30 } from "react/jsx-runtime";
6556
6586
  var Components = () => {
6557
6587
  const overrides = useAppStore((s) => s.overrides);
6558
6588
  const componentList = useComponentList();
6559
- const Wrapper = useMemo12(() => overrides.components || "div", [overrides]);
6589
+ const Wrapper = useMemo12(() => {
6590
+ if (overrides.components) {
6591
+ console.warn(
6592
+ "The `components` override has been deprecated and renamed to `drawer`"
6593
+ );
6594
+ }
6595
+ return overrides.components || overrides.drawer || "div";
6596
+ }, [overrides]);
6560
6597
  return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
6561
6598
  };
6562
6599
 
6563
6600
  // components/Puck/components/Preview/index.tsx
6564
6601
  init_react_import();
6565
- import { useCallback as useCallback14, useEffect as useEffect21, useRef as useRef6, useMemo as useMemo13 } from "react";
6602
+ import { useCallback as useCallback14, useEffect as useEffect22, useRef as useRef6, useMemo as useMemo13 } from "react";
6566
6603
 
6567
6604
  // components/AutoFrame/index.tsx
6568
6605
  init_react_import();
6569
6606
  import {
6570
6607
  createContext as createContext6,
6571
6608
  useContext as useContext10,
6572
- useEffect as useEffect20,
6609
+ useEffect as useEffect21,
6573
6610
  useState as useState18
6574
6611
  } from "react";
6575
6612
  import hash from "object-hash";
6576
6613
  import { createPortal as createPortal3 } from "react-dom";
6577
- import { Fragment as Fragment8, jsx as jsx31 } from "react/jsx-runtime";
6614
+ import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
6578
6615
  var styleSelector = 'style, link[rel="stylesheet"]';
6579
6616
  var collectStyles = (doc) => {
6580
6617
  const collected = [];
@@ -6624,7 +6661,7 @@ var CopyHostStyles = ({
6624
6661
  onStylesLoaded = () => null
6625
6662
  }) => {
6626
6663
  const { document: doc, window: win } = useFrame();
6627
- useEffect20(() => {
6664
+ useEffect21(() => {
6628
6665
  if (!win || !doc) {
6629
6666
  return () => {
6630
6667
  };
@@ -6781,7 +6818,7 @@ var CopyHostStyles = ({
6781
6818
  observer.disconnect();
6782
6819
  };
6783
6820
  }, []);
6784
- return /* @__PURE__ */ jsx31(Fragment8, { children });
6821
+ return /* @__PURE__ */ jsx31(Fragment9, { children });
6785
6822
  };
6786
6823
  var autoFrameContext = createContext6({});
6787
6824
  var useFrame = () => useContext10(autoFrameContext);
@@ -6809,7 +6846,7 @@ function AutoFrame(_a) {
6809
6846
  const [ctx, setCtx] = useState18({});
6810
6847
  const [mountTarget, setMountTarget] = useState18();
6811
6848
  const [stylesLoaded, setStylesLoaded] = useState18(false);
6812
- useEffect20(() => {
6849
+ useEffect21(() => {
6813
6850
  var _a2;
6814
6851
  if (frameRef.current) {
6815
6852
  const doc = frameRef.current.contentDocument;
@@ -6857,11 +6894,11 @@ init_react_import();
6857
6894
  var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
6858
6895
 
6859
6896
  // components/Puck/components/Preview/index.tsx
6860
- import { Fragment as Fragment9, jsx as jsx32 } from "react/jsx-runtime";
6897
+ import { Fragment as Fragment10, jsx as jsx32 } from "react/jsx-runtime";
6861
6898
  var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
6862
6899
  var useBubbleIframeEvents = (ref) => {
6863
6900
  const status = useAppStore((s) => s.status);
6864
- useEffect21(() => {
6901
+ useEffect22(() => {
6865
6902
  if (ref.current && status === "READY") {
6866
6903
  const iframe = ref.current;
6867
6904
  const handlePointerMove = (event) => {
@@ -6920,7 +6957,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
6920
6957
  );
6921
6958
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
6922
6959
  id: "puck-root"
6923
- }, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment9, { children: propsWithSlots.children });
6960
+ }, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment10, { children: propsWithSlots.children });
6924
6961
  },
6925
6962
  [config]
6926
6963
  );
@@ -6941,7 +6978,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
6941
6978
  children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
6942
6979
  })
6943
6980
  ) : /* @__PURE__ */ jsx32(Render, { data: renderData, config, metadata });
6944
- useEffect21(() => {
6981
+ useEffect22(() => {
6945
6982
  if (!iframe.enabled) {
6946
6983
  setStatus("READY");
6947
6984
  }
@@ -6952,8 +6989,11 @@ var Preview2 = ({ id = "puck-preview" }) => {
6952
6989
  className: getClassName22(),
6953
6990
  id,
6954
6991
  "data-puck-preview": true,
6955
- onClick: () => {
6956
- dispatch({ type: "setUi", ui: { itemSelector: null } });
6992
+ onClick: (e) => {
6993
+ const el = e.target;
6994
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
6995
+ dispatch({ type: "setUi", ui: { itemSelector: null } });
6996
+ }
6957
6997
  },
6958
6998
  children: iframe.enabled ? /* @__PURE__ */ jsx32(
6959
6999
  AutoFrame_default,
@@ -7034,7 +7074,7 @@ var onScrollEnd = (frame, cb) => {
7034
7074
 
7035
7075
  // components/LayerTree/index.tsx
7036
7076
  import { useShallow as useShallow7 } from "zustand/react/shallow";
7037
- import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
7077
+ import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
7038
7078
  var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
7039
7079
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
7040
7080
  var Layer = ({
@@ -7170,7 +7210,7 @@ var LayerTree = ({
7170
7210
  }
7171
7211
  )
7172
7212
  );
7173
- return /* @__PURE__ */ jsxs15(Fragment10, { children: [
7213
+ return /* @__PURE__ */ jsxs15(Fragment11, { children: [
7174
7214
  label && /* @__PURE__ */ jsxs15("div", { className: getClassName23("zoneTitle"), children: [
7175
7215
  /* @__PURE__ */ jsx33("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
7176
7216
  label
@@ -7226,7 +7266,7 @@ var Outline = () => {
7226
7266
  init_react_import();
7227
7267
  import {
7228
7268
  useCallback as useCallback16,
7229
- useEffect as useEffect23,
7269
+ useEffect as useEffect24,
7230
7270
  useMemo as useMemo17,
7231
7271
  useRef as useRef8,
7232
7272
  useState as useState20
@@ -7234,7 +7274,7 @@ import {
7234
7274
 
7235
7275
  // components/ViewportControls/index.tsx
7236
7276
  init_react_import();
7237
- import { useEffect as useEffect22, useMemo as useMemo15, useState as useState19 } from "react";
7277
+ import { useEffect as useEffect23, useMemo as useMemo15, useState as useState19 } from "react";
7238
7278
 
7239
7279
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7240
7280
  init_react_import();
@@ -7258,7 +7298,7 @@ var ViewportButton = ({
7258
7298
  }) => {
7259
7299
  const viewports = useAppStore((s) => s.state.ui.viewports);
7260
7300
  const [isActive, setIsActive] = useState19(false);
7261
- useEffect22(() => {
7301
+ useEffect23(() => {
7262
7302
  setIsActive(width === viewports.current.width);
7263
7303
  }, [width, viewports.current.width]);
7264
7304
  return /* @__PURE__ */ jsx35("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx35(
@@ -7416,7 +7456,7 @@ var useCanvasFrame = () => {
7416
7456
  };
7417
7457
 
7418
7458
  // components/Puck/components/Canvas/index.tsx
7419
- import { Fragment as Fragment11, jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
7459
+ import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
7420
7460
  var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
7421
7461
  var ZOOM_ON_CHANGE = true;
7422
7462
  var Canvas = () => {
@@ -7459,7 +7499,7 @@ var Canvas = () => {
7459
7499
  const [showTransition, setShowTransition] = useState20(false);
7460
7500
  const isResettingZoomRef = useRef8(false);
7461
7501
  const defaultRender = useMemo17(() => {
7462
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment11, { children });
7502
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment12, { children });
7463
7503
  return PuckDefault;
7464
7504
  }, []);
7465
7505
  const CustomPreview = useMemo17(
@@ -7474,7 +7514,7 @@ var Canvas = () => {
7474
7514
  }
7475
7515
  return { width: 0, height: 0 };
7476
7516
  }, [frameRef]);
7477
- useEffect23(() => {
7517
+ useEffect24(() => {
7478
7518
  resetAutoZoom({
7479
7519
  isResettingRef: isResettingZoomRef,
7480
7520
  setShowTransition,
@@ -7490,7 +7530,7 @@ var Canvas = () => {
7490
7530
  resetAutoZoom,
7491
7531
  viewports
7492
7532
  ]);
7493
- useEffect23(() => {
7533
+ useEffect24(() => {
7494
7534
  const { height: frameHeight } = getFrameDimensions();
7495
7535
  if (viewports.current.height === "auto") {
7496
7536
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -7498,7 +7538,7 @@ var Canvas = () => {
7498
7538
  }));
7499
7539
  }
7500
7540
  }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
7501
- useEffect23(() => {
7541
+ useEffect24(() => {
7502
7542
  if (ZOOM_ON_CHANGE) {
7503
7543
  resetAutoZoom({
7504
7544
  isResettingRef: isResettingZoomRef,
@@ -7508,7 +7548,7 @@ var Canvas = () => {
7508
7548
  });
7509
7549
  }
7510
7550
  }, [viewports.current.width, resetAutoZoom, viewports]);
7511
- useEffect23(() => {
7551
+ useEffect24(() => {
7512
7552
  const cb = () => {
7513
7553
  resetAutoZoom({
7514
7554
  isResettingRef: isResettingZoomRef,
@@ -7522,7 +7562,7 @@ var Canvas = () => {
7522
7562
  };
7523
7563
  }, [resetAutoZoom]);
7524
7564
  const [showLoader, setShowLoader] = useState20(false);
7525
- useEffect23(() => {
7565
+ useEffect24(() => {
7526
7566
  setTimeout(() => {
7527
7567
  setShowLoader(true);
7528
7568
  }, 500);
@@ -7534,11 +7574,16 @@ var Canvas = () => {
7534
7574
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
7535
7575
  showLoader
7536
7576
  }),
7537
- onClick: () => dispatch({
7538
- type: "setUi",
7539
- ui: { itemSelector: null },
7540
- recordHistory: true
7541
- }),
7577
+ onClick: (e) => {
7578
+ const el = e.target;
7579
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
7580
+ dispatch({
7581
+ type: "setUi",
7582
+ ui: { itemSelector: null },
7583
+ recordHistory: true
7584
+ });
7585
+ }
7586
+ },
7542
7587
  children: [
7543
7588
  viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName25("controls"), children: /* @__PURE__ */ jsx37(
7544
7589
  ViewportControls,
@@ -7648,19 +7693,19 @@ var useLoadedOverrides = ({
7648
7693
 
7649
7694
  // components/DefaultOverride/index.tsx
7650
7695
  init_react_import();
7651
- import { Fragment as Fragment12, jsx as jsx38 } from "react/jsx-runtime";
7652
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment12, { children });
7696
+ import { Fragment as Fragment13, jsx as jsx38 } from "react/jsx-runtime";
7697
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment13, { children });
7653
7698
 
7654
7699
  // lib/use-inject-css.ts
7655
7700
  init_react_import();
7656
- import { useEffect as useEffect24, useState as useState21 } from "react";
7701
+ import { useEffect as useEffect25, useState as useState21 } from "react";
7657
7702
  var styles = ``;
7658
7703
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7659
7704
  const [el, setEl] = useState21();
7660
- useEffect24(() => {
7705
+ useEffect25(() => {
7661
7706
  setEl(document.createElement("style"));
7662
7707
  }, []);
7663
- useEffect24(() => {
7708
+ useEffect25(() => {
7664
7709
  var _a;
7665
7710
  if (!el || typeof window === "undefined") {
7666
7711
  return;
@@ -7711,7 +7756,7 @@ init_react_import();
7711
7756
  var styles_module_default21 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
7712
7757
 
7713
7758
  // components/MenuBar/index.tsx
7714
- import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
7759
+ import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
7715
7760
  var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
7716
7761
  function MenuBar({
7717
7762
  menuOpen = false,
@@ -7759,7 +7804,7 @@ function MenuBar({
7759
7804
  }
7760
7805
  )
7761
7806
  ] }),
7762
- /* @__PURE__ */ jsx39(Fragment13, { children: renderHeaderActions && renderHeaderActions() })
7807
+ /* @__PURE__ */ jsx39(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
7763
7808
  ] })
7764
7809
  }
7765
7810
  );
@@ -7770,7 +7815,7 @@ init_react_import();
7770
7815
  var styles_module_default22 = { "PuckHeader": "_PuckHeader_15xnq_1", "PuckHeader-inner": "_PuckHeader-inner_15xnq_10", "PuckHeader-toggle": "_PuckHeader-toggle_15xnq_20", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_15xnq_27", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_15xnq_27", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_15xnq_28", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_15xnq_28", "PuckHeader-title": "_PuckHeader-title_15xnq_32", "PuckHeader-path": "_PuckHeader-path_15xnq_36", "PuckHeader-tools": "_PuckHeader-tools_15xnq_43", "PuckHeader-menuButton": "_PuckHeader-menuButton_15xnq_49", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_15xnq_54" };
7771
7816
 
7772
7817
  // components/Puck/components/Header/index.tsx
7773
- import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
7818
+ import { Fragment as Fragment15, jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
7774
7819
  var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
7775
7820
  var HeaderInner = () => {
7776
7821
  const {
@@ -7845,7 +7890,7 @@ var HeaderInner = () => {
7845
7890
  return /* @__PURE__ */ jsx40(
7846
7891
  CustomHeader,
7847
7892
  {
7848
- actions: /* @__PURE__ */ jsx40(Fragment14, { children: /* @__PURE__ */ jsx40(CustomHeaderActions, { children: /* @__PURE__ */ jsx40(
7893
+ actions: /* @__PURE__ */ jsx40(Fragment15, { children: /* @__PURE__ */ jsx40(CustomHeaderActions, { children: /* @__PURE__ */ jsx40(
7849
7894
  Button,
7850
7895
  {
7851
7896
  onClick: () => {
@@ -7887,7 +7932,7 @@ var HeaderInner = () => {
7887
7932
  ] }),
7888
7933
  /* @__PURE__ */ jsx40("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs19(Heading, { rank: "2", size: "xs", children: [
7889
7934
  headerTitle || rootTitle || "Page",
7890
- headerPath && /* @__PURE__ */ jsxs19(Fragment14, { children: [
7935
+ headerPath && /* @__PURE__ */ jsxs19(Fragment15, { children: [
7891
7936
  " ",
7892
7937
  /* @__PURE__ */ jsx40("code", { className: getClassName27("path"), children: headerPath })
7893
7938
  ] })
@@ -8019,7 +8064,7 @@ init_react_import();
8019
8064
  var styles_module_default24 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
8020
8065
 
8021
8066
  // components/Puck/components/Sidebar/index.tsx
8022
- import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
8067
+ import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
8023
8068
  var getClassName29 = get_class_name_factory_default("Sidebar", styles_module_default24);
8024
8069
  var Sidebar = ({
8025
8070
  position,
@@ -8031,7 +8076,7 @@ var Sidebar = ({
8031
8076
  children
8032
8077
  }) => {
8033
8078
  if (!isVisible) return null;
8034
- return /* @__PURE__ */ jsxs20(Fragment15, { children: [
8079
+ return /* @__PURE__ */ jsxs20(Fragment16, { children: [
8035
8080
  /* @__PURE__ */ jsx42("div", { ref: sidebarRef, className: getClassName29({ [position]: true }), children }),
8036
8081
  /* @__PURE__ */ jsx42("div", { className: `${getClassName29("resizeHandle")}`, children: /* @__PURE__ */ jsx42(
8037
8082
  ResizeHandle,
@@ -8047,14 +8092,14 @@ var Sidebar = ({
8047
8092
 
8048
8093
  // lib/use-sidebar-resize.ts
8049
8094
  init_react_import();
8050
- import { useCallback as useCallback20, useEffect as useEffect26, useRef as useRef10, useState as useState23 } from "react";
8095
+ import { useCallback as useCallback20, useEffect as useEffect27, useRef as useRef10, useState as useState23 } from "react";
8051
8096
  function useSidebarResize(position, dispatch) {
8052
8097
  const [width, setWidth] = useState23(null);
8053
8098
  const sidebarRef = useRef10(null);
8054
8099
  const storeWidth = useAppStore(
8055
8100
  (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
8056
8101
  );
8057
- useEffect26(() => {
8102
+ useEffect27(() => {
8058
8103
  if (typeof window !== "undefined" && !storeWidth) {
8059
8104
  try {
8060
8105
  const savedWidths = localStorage.getItem("puck-sidebar-widths");
@@ -8078,7 +8123,7 @@ function useSidebarResize(position, dispatch) {
8078
8123
  }
8079
8124
  }
8080
8125
  }, [dispatch, position, storeWidth]);
8081
- useEffect26(() => {
8126
+ useEffect27(() => {
8082
8127
  if (storeWidth !== void 0) {
8083
8128
  setWidth(storeWidth);
8084
8129
  }
@@ -8194,7 +8239,7 @@ function PuckProvider({ children }) {
8194
8239
  }
8195
8240
  }
8196
8241
  if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_g = initialData == null ? void 0 : initialData.root) == null ? void 0 : _g.props)) {
8197
- console.error(
8242
+ console.warn(
8198
8243
  "Warning: Defining props on `root` is deprecated. Please use `root.props`, or republish this page to migrate automatically."
8199
8244
  );
8200
8245
  }
@@ -8272,12 +8317,12 @@ function PuckProvider({ children }) {
8272
8317
  const [appStore] = useState24(
8273
8318
  () => createAppStore(generateAppStore(initialAppState))
8274
8319
  );
8275
- useEffect27(() => {
8320
+ useEffect28(() => {
8276
8321
  if (process.env.NODE_ENV !== "production") {
8277
8322
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
8278
8323
  }
8279
8324
  }, [appStore]);
8280
- useEffect27(() => {
8325
+ useEffect28(() => {
8281
8326
  const state = appStore.getState().state;
8282
8327
  appStore.setState(__spreadValues({}, generateAppStore(state)));
8283
8328
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -8287,7 +8332,7 @@ function PuckProvider({ children }) {
8287
8332
  initialAppState
8288
8333
  });
8289
8334
  const previousData = useRef11(null);
8290
- useEffect27(() => {
8335
+ useEffect28(() => {
8291
8336
  appStore.subscribe(
8292
8337
  (s) => s.state.data,
8293
8338
  (data) => {
@@ -8301,7 +8346,7 @@ function PuckProvider({ children }) {
8301
8346
  }, []);
8302
8347
  useRegisterPermissionsSlice(appStore, permissions);
8303
8348
  const uPuckStore = useRegisterUsePuckStore(appStore);
8304
- useEffect27(() => {
8349
+ useEffect28(() => {
8305
8350
  const { resolveAndCommitData } = appStore.getState();
8306
8351
  resolveAndCommitData();
8307
8352
  }, []);
@@ -8338,7 +8383,7 @@ function PuckLayout({ children }) {
8338
8383
  sidebarRef: rightSidebarRef,
8339
8384
  handleResizeEnd: handleRightSidebarResizeEnd
8340
8385
  } = useSidebarResize("right", dispatch);
8341
- useEffect27(() => {
8386
+ useEffect28(() => {
8342
8387
  if (!window.matchMedia("(min-width: 638px)").matches) {
8343
8388
  dispatch({
8344
8389
  type: "setUi",
@@ -8367,12 +8412,12 @@ function PuckLayout({ children }) {
8367
8412
  [overrides]
8368
8413
  );
8369
8414
  const [mounted, setMounted] = useState24(false);
8370
- useEffect27(() => {
8415
+ useEffect28(() => {
8371
8416
  setMounted(true);
8372
8417
  }, []);
8373
8418
  const ready = useAppStore((s) => s.status === "READY");
8374
8419
  useMonitorHotkeys();
8375
- useEffect27(() => {
8420
+ useEffect28(() => {
8376
8421
  if (ready && iframe.enabled) {
8377
8422
  const frameDoc = getFrame();
8378
8423
  if (frameDoc) {
@@ -8447,6 +8492,36 @@ Puck.Fields = Fields;
8447
8492
  Puck.Outline = Outline;
8448
8493
  Puck.Preview = Preview2;
8449
8494
 
8495
+ // lib/overlay-portal/index.tsx
8496
+ init_react_import();
8497
+ var registerOverlayPortal = (el, opts = {}) => {
8498
+ if (!el) return;
8499
+ const { disableDrag = true } = opts;
8500
+ const stopPropagation = (e) => {
8501
+ e.stopPropagation();
8502
+ };
8503
+ el.addEventListener("mouseover", stopPropagation, {
8504
+ capture: true
8505
+ });
8506
+ if (disableDrag) {
8507
+ el.addEventListener("pointerdown", stopPropagation, {
8508
+ capture: true
8509
+ });
8510
+ }
8511
+ el.setAttribute("data-puck-overlay-portal", "true");
8512
+ return () => {
8513
+ el.removeEventListener("mouseover", stopPropagation, {
8514
+ capture: true
8515
+ });
8516
+ if (disableDrag) {
8517
+ el.removeEventListener("pointerdown", stopPropagation, {
8518
+ capture: true
8519
+ });
8520
+ }
8521
+ el.removeAttribute("data-puck-overlay-portal");
8522
+ };
8523
+ };
8524
+
8450
8525
  // bundle/core.ts
8451
8526
  init_react_import();
8452
8527
 
@@ -8497,7 +8572,8 @@ export {
8497
8572
  createUsePuck,
8498
8573
  usePuck,
8499
8574
  useGetPuck,
8500
- Puck
8575
+ Puck,
8576
+ registerOverlayPortal
8501
8577
  };
8502
8578
  /*! Bundled license information:
8503
8579