@measured/puck 0.20.0-canary.def0ecb5 → 0.20.0-canary.e25949a6

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.
@@ -12,17 +12,19 @@ import {
12
12
  defaultViewports,
13
13
  expandNode,
14
14
  getChanged,
15
+ getSlotTransform,
15
16
  init_react_import,
16
17
  resolveComponentData,
17
18
  rootAreaId,
18
19
  rootDroppableId,
19
20
  rootZone,
20
21
  setupZone,
22
+ useFieldTransforms,
21
23
  useSlots,
22
24
  walkAppState,
23
25
  walkField,
24
26
  walkTree
25
- } from "./chunk-32MJ3X3H.mjs";
27
+ } from "./chunk-HUKJ36SA.mjs";
26
28
 
27
29
  // ../../node_modules/classnames/index.js
28
30
  var require_classnames = __commonJS({
@@ -211,7 +213,6 @@ var replace = (list, index, newItem) => {
211
213
 
212
214
  // lib/use-reset-auto-zoom.ts
213
215
  init_react_import();
214
- import { useCallback as useCallback2 } from "react";
215
216
 
216
217
  // store/index.ts
217
218
  init_react_import();
@@ -1272,7 +1273,8 @@ var createAppStore = (initialAppStore) => create2()(
1272
1273
  },
1273
1274
  status: "LOADING",
1274
1275
  iframe: {},
1275
- metadata: {}
1276
+ metadata: {},
1277
+ fieldTransforms: {}
1276
1278
  }, initialAppStore), {
1277
1279
  fields: createFieldsSlice(set, get),
1278
1280
  history: createHistorySlice(set, get),
@@ -1588,56 +1590,18 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
1588
1590
  };
1589
1591
 
1590
1592
  // lib/use-reset-auto-zoom.ts
1591
- import { useShallow } from "zustand/react/shallow";
1592
1593
  var useResetAutoZoom = (frameRef) => {
1593
- const { viewports, zoomConfig, setZoomConfig } = useAppStore(
1594
- useShallow((s) => ({
1595
- viewports: s.state.ui.viewports,
1596
- zoomConfig: s.zoomConfig,
1597
- setZoomConfig: s.setZoomConfig
1598
- }))
1599
- );
1600
- const resetAutoZoom = useCallback2(
1601
- (options) => {
1602
- const newViewports = (options == null ? void 0 : options.viewports) || viewports;
1603
- if (!(options == null ? void 0 : options.isResettingRef)) {
1604
- if (frameRef.current) {
1605
- setZoomConfig(
1606
- getZoomConfig(
1607
- newViewports == null ? void 0 : newViewports.current,
1608
- frameRef.current,
1609
- zoomConfig.zoom
1610
- )
1611
- );
1612
- }
1613
- return;
1614
- }
1615
- const {
1616
- isResettingRef,
1617
- setShowTransition,
1618
- showTransition = false
1619
- } = options;
1620
- if (!isResettingRef.current) {
1621
- isResettingRef.current = true;
1622
- if (setShowTransition) {
1623
- setShowTransition(showTransition);
1624
- }
1625
- if (frameRef.current) {
1626
- setZoomConfig(
1627
- getZoomConfig(
1628
- newViewports == null ? void 0 : newViewports.current,
1629
- frameRef.current,
1630
- zoomConfig.zoom
1631
- )
1632
- );
1633
- }
1634
- setTimeout(() => {
1635
- isResettingRef.current = false;
1636
- }, 0);
1637
- }
1638
- },
1639
- [frameRef, zoomConfig, viewports, setZoomConfig]
1640
- );
1594
+ const appStoreApi = useAppStoreApi();
1595
+ const resetAutoZoom = (options) => {
1596
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
1597
+ const { viewports } = state.ui;
1598
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
1599
+ if (frameRef.current) {
1600
+ setZoomConfig(
1601
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
1602
+ );
1603
+ }
1604
+ };
1641
1605
  return resetAutoZoom;
1642
1606
  };
1643
1607
 
@@ -1818,11 +1782,11 @@ init_react_import();
1818
1782
 
1819
1783
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
1820
1784
  init_react_import();
1821
- var styles_module_default3 = { "InputWrapper": "_InputWrapper_py9hf_1", "Input-label": "_Input-label_py9hf_5", "Input-labelIcon": "_Input-labelIcon_py9hf_14", "Input-disabledIcon": "_Input-disabledIcon_py9hf_21", "Input-input": "_Input-input_py9hf_26", "Input": "_Input_py9hf_1", "Input--readOnly": "_Input--readOnly_py9hf_76", "Input-radioGroupItems": "_Input-radioGroupItems_py9hf_87", "Input-radio": "_Input-radio_py9hf_87", "Input-radioInner": "_Input-radioInner_py9hf_104", "Input-radioInput": "_Input-radioInput_py9hf_149" };
1785
+ var styles_module_default3 = { "InputWrapper": "_InputWrapper_bsxfo_1", "Input-label": "_Input-label_bsxfo_5", "Input-labelIcon": "_Input-labelIcon_bsxfo_14", "Input-disabledIcon": "_Input-disabledIcon_bsxfo_21", "Input-input": "_Input-input_bsxfo_26", "Input": "_Input_bsxfo_1", "Input--readOnly": "_Input--readOnly_bsxfo_82", "Input-radioGroupItems": "_Input-radioGroupItems_bsxfo_93", "Input-radio": "_Input-radio_bsxfo_93", "Input-radioInner": "_Input-radioInner_bsxfo_110", "Input-radioInput": "_Input-radioInput_bsxfo_155" };
1822
1786
 
1823
1787
  // components/AutoField/index.tsx
1824
1788
  import {
1825
- useCallback as useCallback5,
1789
+ useCallback as useCallback4,
1826
1790
  useContext as useContext3,
1827
1791
  useEffect as useEffect10,
1828
1792
  useMemo as useMemo3,
@@ -2170,7 +2134,7 @@ var ZoomOut = createLucideIcon("ZoomOut", [
2170
2134
  init_react_import();
2171
2135
 
2172
2136
  // components/AutoField/fields/ArrayField/index.tsx
2173
- import { useCallback as useCallback3, useEffect as useEffect6, useRef, useState as useState4 } from "react";
2137
+ import { useCallback as useCallback2, useEffect as useEffect6, useRef, useState as useState4 } from "react";
2174
2138
 
2175
2139
  // components/DragIcon/index.tsx
2176
2140
  init_react_import();
@@ -2698,7 +2662,7 @@ var ArrayField = ({
2698
2662
  setLocalState({ arrayState: _arrayState, value });
2699
2663
  }, [value]);
2700
2664
  const appStore = useAppStoreApi();
2701
- const mapArrayStateToUi = useCallback3(
2665
+ const mapArrayStateToUi = useCallback2(
2702
2666
  (partialArrayState) => {
2703
2667
  const state = appStore.getState().state;
2704
2668
  return {
@@ -2709,13 +2673,13 @@ var ArrayField = ({
2709
2673
  },
2710
2674
  [arrayState, appStore]
2711
2675
  );
2712
- const getHighestIndex = useCallback3(() => {
2676
+ const getHighestIndex = useCallback2(() => {
2713
2677
  return arrayState.items.reduce(
2714
2678
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
2715
2679
  -1
2716
2680
  );
2717
2681
  }, [arrayState]);
2718
- const regenerateArrayState = useCallback3(
2682
+ const regenerateArrayState = useCallback2(
2719
2683
  (value2) => {
2720
2684
  let highestIndex = getHighestIndex();
2721
2685
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -2746,14 +2710,19 @@ var ArrayField = ({
2746
2710
  );
2747
2711
  const forceReadOnly = !canEdit;
2748
2712
  const valueRef = useRef(value);
2749
- const uniqifyItem = useCallback3(
2713
+ const uniqifyItem = useCallback2(
2750
2714
  (val) => {
2751
2715
  if (field.type !== "array" || !field.arrayFields) return;
2752
2716
  const config = appStore.getState().config;
2753
2717
  return walkField({
2754
2718
  value: val,
2755
2719
  fields: field.arrayFields,
2756
- map: (content) => content.map((item) => populateIds(item, config, true)),
2720
+ mappers: {
2721
+ slot: ({ value: value2 }) => {
2722
+ const content = value2;
2723
+ return content.map((item) => populateIds(item, config, true));
2724
+ }
2725
+ },
2757
2726
  config
2758
2727
  });
2759
2728
  },
@@ -2908,49 +2877,51 @@ var ArrayField = ({
2908
2877
  ]
2909
2878
  }
2910
2879
  ),
2911
- /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2912
- const subField = field.arrayFields[subName];
2913
- const indexName = `${name}[${i}]`;
2914
- const subPath = `${indexName}.${subName}`;
2915
- const localIndexName = `${localName}[${i}]`;
2916
- const localWildcardName = `${localName}[*]`;
2917
- const localSubPath = `${localIndexName}.${subName}`;
2918
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
2919
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2920
- const label2 = subField.label || subName;
2921
- return /* @__PURE__ */ jsx8(
2922
- NestedFieldProvider,
2923
- {
2924
- name: localIndexName,
2925
- wildcardName: localWildcardName,
2926
- subName,
2927
- readOnlyFields,
2928
- children: /* @__PURE__ */ jsx8(
2929
- AutoFieldPrivate,
2930
- {
2931
- name: subPath,
2932
- label: label2,
2933
- id: `${_arrayId}_${subName}`,
2934
- readOnly: subReadOnly,
2935
- field: __spreadProps(__spreadValues({}, subField), {
2936
- label: label2
2937
- // May be used by custom fields
2938
- }),
2939
- value: data[subName],
2940
- onChange: (val, ui) => {
2941
- onChange(
2942
- replace(value, i, __spreadProps(__spreadValues({}, data), {
2943
- [subName]: val
2944
- })),
2945
- ui
2946
- );
2880
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: arrayState.openId === _arrayId && /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
2881
+ (subName) => {
2882
+ const subField = field.arrayFields[subName];
2883
+ const indexName = `${name}[${i}]`;
2884
+ const subPath = `${indexName}.${subName}`;
2885
+ const localIndexName = `${localName}[${i}]`;
2886
+ const localWildcardName = `${localName}[*]`;
2887
+ const localSubPath = `${localIndexName}.${subName}`;
2888
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
2889
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2890
+ const label2 = subField.label || subName;
2891
+ return /* @__PURE__ */ jsx8(
2892
+ NestedFieldProvider,
2893
+ {
2894
+ name: localIndexName,
2895
+ wildcardName: localWildcardName,
2896
+ subName,
2897
+ readOnlyFields,
2898
+ children: /* @__PURE__ */ jsx8(
2899
+ AutoFieldPrivate,
2900
+ {
2901
+ name: subPath,
2902
+ label: label2,
2903
+ id: `${_arrayId}_${subName}`,
2904
+ readOnly: subReadOnly,
2905
+ field: __spreadProps(__spreadValues({}, subField), {
2906
+ label: label2
2907
+ // May be used by custom fields
2908
+ }),
2909
+ value: data[subName],
2910
+ onChange: (val, ui) => {
2911
+ onChange(
2912
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
2913
+ [subName]: val
2914
+ })),
2915
+ ui
2916
+ );
2917
+ }
2947
2918
  }
2948
- }
2949
- )
2950
- },
2951
- subPath
2952
- );
2953
- }) }) })
2919
+ )
2920
+ },
2921
+ subPath
2922
+ );
2923
+ }
2924
+ ) }) })
2954
2925
  ]
2955
2926
  }
2956
2927
  )
@@ -3059,7 +3030,7 @@ import {
3059
3030
  useMemo as useMemo2,
3060
3031
  useEffect as useEffect8,
3061
3032
  useState as useState6,
3062
- useCallback as useCallback4,
3033
+ useCallback as useCallback3,
3063
3034
  isValidElement
3064
3035
  } from "react";
3065
3036
 
@@ -3169,7 +3140,7 @@ var ExternalInput = ({
3169
3140
  return Array.from(validKeys);
3170
3141
  }, [mappedData]);
3171
3142
  const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
3172
- const search = useCallback4(
3143
+ const search = useCallback3(
3173
3144
  (query, filters2) => __async(void 0, null, function* () {
3174
3145
  setIsLoading(true);
3175
3146
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -3182,7 +3153,7 @@ var ExternalInput = ({
3182
3153
  }),
3183
3154
  [id, field]
3184
3155
  );
3185
- const Footer = useCallback4(
3156
+ const Footer = useCallback3(
3186
3157
  (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs6("span", { className: getClassNameModal("footer"), children: [
3187
3158
  props.items.length,
3188
3159
  " result",
@@ -3725,7 +3696,7 @@ function AutoFieldInternal(props) {
3725
3696
  Label: Label2,
3726
3697
  id: resolvedId
3727
3698
  });
3728
- const onFocus = useCallback5(
3699
+ const onFocus = useCallback4(
3729
3700
  (e) => {
3730
3701
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
3731
3702
  e.stopPropagation();
@@ -3739,7 +3710,7 @@ function AutoFieldInternal(props) {
3739
3710
  },
3740
3711
  [mergedProps.name]
3741
3712
  );
3742
- const onBlur = useCallback5((e) => {
3713
+ const onBlur = useCallback4((e) => {
3743
3714
  if ("name" in e.target) {
3744
3715
  dispatch({
3745
3716
  type: "setUi",
@@ -3793,7 +3764,7 @@ function AutoFieldPrivate(props) {
3793
3764
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
3794
3765
  const { value, onChange } = props;
3795
3766
  const [localValue, setLocalValue] = useState8(value);
3796
- const onChangeLocal = useCallback5(
3767
+ const onChangeLocal = useCallback4(
3797
3768
  (val, ui) => {
3798
3769
  setLocalValue(val);
3799
3770
  onChange(val, ui);
@@ -3841,18 +3812,18 @@ init_react_import();
3841
3812
  init_react_import();
3842
3813
  import {
3843
3814
  forwardRef as forwardRef3,
3844
- memo,
3845
- useCallback as useCallback12,
3815
+ memo as memo2,
3816
+ useCallback as useCallback11,
3846
3817
  useContext as useContext8,
3847
- useEffect as useEffect17,
3818
+ useEffect as useEffect18,
3848
3819
  useMemo as useMemo8,
3849
- useRef as useRef5
3820
+ useRef as useRef6
3850
3821
  } from "react";
3851
3822
 
3852
3823
  // components/DraggableComponent/index.tsx
3853
3824
  init_react_import();
3854
3825
  import {
3855
- useCallback as useCallback8,
3826
+ useCallback as useCallback7,
3856
3827
  useContext as useContext5,
3857
3828
  useEffect as useEffect12,
3858
3829
  useMemo as useMemo5,
@@ -3891,7 +3862,7 @@ function getDeepScrollPosition(element) {
3891
3862
  init_react_import();
3892
3863
  import {
3893
3864
  createContext as createContext3,
3894
- useCallback as useCallback6,
3865
+ useCallback as useCallback5,
3895
3866
  useMemo as useMemo4
3896
3867
  } from "react";
3897
3868
  import { createStore as createStore2 } from "zustand";
@@ -3920,7 +3891,7 @@ var DropZoneProvider = ({
3920
3891
  value
3921
3892
  }) => {
3922
3893
  const dispatch = useAppStore((s) => s.dispatch);
3923
- const registerZone = useCallback6(
3894
+ const registerZone = useCallback5(
3924
3895
  (zoneCompound) => {
3925
3896
  dispatch({
3926
3897
  type: "registerZone",
@@ -3939,7 +3910,7 @@ var DropZoneProvider = ({
3939
3910
  };
3940
3911
 
3941
3912
  // components/DraggableComponent/index.tsx
3942
- import { useShallow as useShallow3 } from "zustand/react/shallow";
3913
+ import { useShallow as useShallow2 } from "zustand/react/shallow";
3943
3914
  import { useSortable as useSortable2 } from "@dnd-kit/react/sortable";
3944
3915
 
3945
3916
  // lib/accumulate-transform.ts
@@ -3961,21 +3932,21 @@ function accumulateTransform(el) {
3961
3932
  init_react_import();
3962
3933
  import { useContext as useContext4 } from "react";
3963
3934
  import { useStore as useStore2 } from "zustand";
3964
- import { useShallow as useShallow2 } from "zustand/react/shallow";
3935
+ import { useShallow } from "zustand/react/shallow";
3965
3936
  function useContextStore(context, selector) {
3966
3937
  const store = useContext4(context);
3967
3938
  if (!store) {
3968
3939
  throw new Error("useContextStore must be used inside context");
3969
3940
  }
3970
- return useStore2(store, useShallow2(selector));
3941
+ return useStore2(store, useShallow(selector));
3971
3942
  }
3972
3943
 
3973
3944
  // lib/dnd/use-on-drag-finished.ts
3974
3945
  init_react_import();
3975
- import { useCallback as useCallback7 } from "react";
3946
+ import { useCallback as useCallback6 } from "react";
3976
3947
  var useOnDragFinished = (cb, deps = []) => {
3977
3948
  const appStore = useAppStoreApi();
3978
- return useCallback7(() => {
3949
+ return useCallback6(() => {
3979
3950
  let dispose = () => {
3980
3951
  };
3981
3952
  const processDragging = (isDragging2) => {
@@ -4050,7 +4021,7 @@ var DraggableComponent = ({
4050
4021
  const iframe = useAppStore((s) => s.iframe);
4051
4022
  const ctx = useContext5(dropZoneContext);
4052
4023
  const [localZones, setLocalZones] = useState10({});
4053
- const registerLocalZone = useCallback8(
4024
+ const registerLocalZone = useCallback7(
4054
4025
  (zoneCompound2, active) => {
4055
4026
  var _a;
4056
4027
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -4060,7 +4031,7 @@ var DraggableComponent = ({
4060
4031
  },
4061
4032
  [setLocalZones]
4062
4033
  );
4063
- const unregisterLocalZone = useCallback8(
4034
+ const unregisterLocalZone = useCallback7(
4064
4035
  (zoneCompound2) => {
4065
4036
  var _a;
4066
4037
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -4073,12 +4044,12 @@ var DraggableComponent = ({
4073
4044
  [setLocalZones]
4074
4045
  );
4075
4046
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
4076
- const path = useAppStore(useShallow3((s) => {
4047
+ const path = useAppStore(useShallow2((s) => {
4077
4048
  var _a;
4078
4049
  return (_a = s.state.indexes.nodes[id]) == null ? void 0 : _a.path;
4079
4050
  }));
4080
4051
  const permissions = useAppStore(
4081
- useShallow3((s) => {
4052
+ useShallow2((s) => {
4082
4053
  const item = getItem({ index, zone: zoneCompound }, s.state);
4083
4054
  return s.permissions.getPermissions({ item });
4084
4055
  })
@@ -4135,7 +4106,7 @@ var DraggableComponent = ({
4135
4106
  return cleanup;
4136
4107
  }, [permissions.drag, zoneCompound]);
4137
4108
  const ref = useRef2(null);
4138
- const refSetter = useCallback8(
4109
+ const refSetter = useCallback7(
4139
4110
  (el) => {
4140
4111
  sortableRef(el);
4141
4112
  if (el) {
@@ -4151,7 +4122,7 @@ var DraggableComponent = ({
4151
4122
  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
4152
4123
  );
4153
4124
  }, [iframe.enabled, ref.current]);
4154
- const getStyle = useCallback8(() => {
4125
+ const getStyle = useCallback7(() => {
4155
4126
  var _a, _b, _c;
4156
4127
  if (!ref.current) return;
4157
4128
  const rect = ref.current.getBoundingClientRect();
@@ -4177,7 +4148,7 @@ var DraggableComponent = ({
4177
4148
  return style2;
4178
4149
  }, [ref.current]);
4179
4150
  const [style, setStyle] = useState10();
4180
- const sync = useCallback8(() => {
4151
+ const sync = useCallback7(() => {
4181
4152
  setStyle(getStyle());
4182
4153
  }, [ref.current, iframe]);
4183
4154
  useEffect12(() => {
@@ -4190,10 +4161,10 @@ var DraggableComponent = ({
4190
4161
  }
4191
4162
  }, [ref.current]);
4192
4163
  const registerNode = useAppStore((s) => s.nodes.registerNode);
4193
- const hideOverlay = useCallback8(() => {
4164
+ const hideOverlay = useCallback7(() => {
4194
4165
  setIsVisible(false);
4195
4166
  }, []);
4196
- const showOverlay = useCallback8(() => {
4167
+ const showOverlay = useCallback7(() => {
4197
4168
  setIsVisible(true);
4198
4169
  }, []);
4199
4170
  useEffect12(() => {
@@ -4221,9 +4192,12 @@ var DraggableComponent = ({
4221
4192
  () => overrides.componentOverlay || DefaultOverlay,
4222
4193
  [overrides.componentOverlay]
4223
4194
  );
4224
- const onClick = useCallback8(
4195
+ const onClick = useCallback7(
4225
4196
  (e) => {
4226
- e.stopPropagation();
4197
+ const el = e.target;
4198
+ if (!el.closest("[data-puck-overlay-portal]")) {
4199
+ e.stopPropagation();
4200
+ }
4227
4201
  dispatch({
4228
4202
  type: "setUi",
4229
4203
  ui: {
@@ -4234,7 +4208,7 @@ var DraggableComponent = ({
4234
4208
  [index, zoneCompound, id]
4235
4209
  );
4236
4210
  const appStore = useAppStoreApi();
4237
- const onSelectParent = useCallback8(() => {
4211
+ const onSelectParent = useCallback7(() => {
4238
4212
  const { nodes, zones } = appStore.getState().state.indexes;
4239
4213
  const node = nodes[id];
4240
4214
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -4255,14 +4229,14 @@ var DraggableComponent = ({
4255
4229
  }
4256
4230
  });
4257
4231
  }, [ctx, path]);
4258
- const onDuplicate = useCallback8(() => {
4232
+ const onDuplicate = useCallback7(() => {
4259
4233
  dispatch({
4260
4234
  type: "duplicate",
4261
4235
  sourceIndex: index,
4262
4236
  sourceZone: zoneCompound
4263
4237
  });
4264
4238
  }, [index, zoneCompound]);
4265
- const onDelete = useCallback8(() => {
4239
+ const onDelete = useCallback7(() => {
4266
4240
  dispatch({
4267
4241
  type: "remove",
4268
4242
  index,
@@ -4352,7 +4326,7 @@ var DraggableComponent = ({
4352
4326
  useEffect12(() => {
4353
4327
  if (thisWasDragging) return onDragFinished();
4354
4328
  }, [thisWasDragging, onDragFinished]);
4355
- const syncActionsPosition = useCallback8(
4329
+ const syncActionsPosition = useCallback7(
4356
4330
  (el) => {
4357
4331
  if (el) {
4358
4332
  const view = el.ownerDocument.defaultView;
@@ -4504,7 +4478,7 @@ init_react_import();
4504
4478
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
4505
4479
  import {
4506
4480
  createContext as createContext4,
4507
- useCallback as useCallback9,
4481
+ useCallback as useCallback8,
4508
4482
  useContext as useContext6,
4509
4483
  useEffect as useEffect13,
4510
4484
  useMemo as useMemo6,
@@ -4863,7 +4837,7 @@ function useDragListener(type, fn, deps = []) {
4863
4837
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4864
4838
  var useTempDisableFallback = (timeout3) => {
4865
4839
  const lastFallbackDisable = useRef3(null);
4866
- return useCallback9((manager) => {
4840
+ return useCallback8((manager) => {
4867
4841
  collisionStore.setState({ fallbackEnabled: false });
4868
4842
  const fallbackId = generateId();
4869
4843
  lastFallbackDisable.current = fallbackId;
@@ -4896,7 +4870,7 @@ var DragDropContextClient = ({
4896
4870
  hoveringComponent: null
4897
4871
  }))
4898
4872
  );
4899
- const getChanged2 = useCallback9(
4873
+ const getChanged2 = useCallback8(
4900
4874
  (params, id2) => {
4901
4875
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4902
4876
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -4917,7 +4891,7 @@ var DragDropContextClient = ({
4917
4891
  },
4918
4892
  [zoneStore]
4919
4893
  );
4920
- const setDeepestAndCollide = useCallback9(
4894
+ const setDeepestAndCollide = useCallback8(
4921
4895
  (params, manager) => {
4922
4896
  const { zoneChanged, areaChanged } = getChanged2(params, id);
4923
4897
  if (!zoneChanged && !areaChanged) return;
@@ -5471,10 +5445,10 @@ import { useContext as useContext7, useEffect as useEffect15, useState as useSta
5471
5445
  // lib/dnd/use-rendered-callback.ts
5472
5446
  init_react_import();
5473
5447
  import { useDragDropManager } from "@dnd-kit/react";
5474
- import { useCallback as useCallback10 } from "react";
5448
+ import { useCallback as useCallback9 } from "react";
5475
5449
  function useRenderedCallback(callback, deps) {
5476
5450
  const manager = useDragDropManager();
5477
- return useCallback10(
5451
+ return useCallback9(
5478
5452
  (...args) => __async(this, null, function* () {
5479
5453
  yield manager == null ? void 0 : manager.renderer.rendering;
5480
5454
  return callback(...args);
@@ -5545,7 +5519,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5545
5519
 
5546
5520
  // components/DropZone/lib/use-drag-axis.ts
5547
5521
  init_react_import();
5548
- import { useCallback as useCallback11, useEffect as useEffect16, useState as useState15 } from "react";
5522
+ import { useCallback as useCallback10, useEffect as useEffect16, useState as useState15 } from "react";
5549
5523
  var GRID_DRAG_AXIS = "dynamic";
5550
5524
  var FLEX_ROW_DRAG_AXIS = "x";
5551
5525
  var DEFAULT_DRAG_AXIS = "y";
@@ -5554,7 +5528,7 @@ var useDragAxis = (ref, collisionAxis) => {
5554
5528
  const [dragAxis, setDragAxis] = useState15(
5555
5529
  collisionAxis || DEFAULT_DRAG_AXIS
5556
5530
  );
5557
- const calculateDragAxis = useCallback11(() => {
5531
+ const calculateDragAxis = useCallback10(() => {
5558
5532
  if (ref.current) {
5559
5533
  const computedStyle = window.getComputedStyle(ref.current);
5560
5534
  if (computedStyle.display === "grid") {
@@ -5580,11 +5554,11 @@ var useDragAxis = (ref, collisionAxis) => {
5580
5554
  };
5581
5555
 
5582
5556
  // components/DropZone/index.tsx
5583
- import { useShallow as useShallow5 } from "zustand/react/shallow";
5557
+ import { useShallow as useShallow4 } from "zustand/react/shallow";
5584
5558
 
5585
5559
  // components/SlotRender/index.tsx
5586
5560
  init_react_import();
5587
- import { useShallow as useShallow4 } from "zustand/react/shallow";
5561
+ import { useShallow as useShallow3 } from "zustand/react/shallow";
5588
5562
  import { jsx as jsx23 } from "react/jsx-runtime";
5589
5563
  var ContextSlotRender = ({
5590
5564
  componentId,
@@ -5593,7 +5567,7 @@ var ContextSlotRender = ({
5593
5567
  const config = useAppStore((s) => s.config);
5594
5568
  const metadata = useAppStore((s) => s.metadata);
5595
5569
  const slotContent = useAppStore(
5596
- useShallow4((s) => {
5570
+ useShallow3((s) => {
5597
5571
  var _a, _b;
5598
5572
  const indexes = s.state.indexes;
5599
5573
  const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
@@ -5611,12 +5585,239 @@ var ContextSlotRender = ({
5611
5585
  );
5612
5586
  };
5613
5587
 
5588
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5589
+ init_react_import();
5590
+
5591
+ // components/InlineTextField/index.tsx
5592
+ init_react_import();
5593
+ import { memo, useEffect as useEffect17, useRef as useRef5, useState as useState16 } from "react";
5594
+
5595
+ // lib/overlay-portal/index.tsx
5596
+ init_react_import();
5597
+ var registerOverlayPortal = (el, opts = {}) => {
5598
+ if (!el) return;
5599
+ const { disableDrag = false, disableDragOnFocus = true } = opts;
5600
+ const stopPropagation = (e) => {
5601
+ e.stopPropagation();
5602
+ };
5603
+ el.addEventListener("mouseover", stopPropagation, {
5604
+ capture: true
5605
+ });
5606
+ const onFocus = () => {
5607
+ setTimeout(() => {
5608
+ el.addEventListener("pointerdown", stopPropagation, {
5609
+ capture: true
5610
+ });
5611
+ }, 200);
5612
+ };
5613
+ const onBlur = () => {
5614
+ el.removeEventListener("pointerdown", stopPropagation, {
5615
+ capture: true
5616
+ });
5617
+ };
5618
+ if (disableDragOnFocus) {
5619
+ el.addEventListener("focus", onFocus, { capture: true });
5620
+ el.addEventListener("blur", onBlur, { capture: true });
5621
+ } else if (disableDrag) {
5622
+ el.addEventListener("pointerdown", stopPropagation, {
5623
+ capture: true
5624
+ });
5625
+ }
5626
+ el.setAttribute("data-puck-overlay-portal", "true");
5627
+ return () => {
5628
+ el.removeEventListener("mouseover", stopPropagation, {
5629
+ capture: true
5630
+ });
5631
+ if (disableDragOnFocus) {
5632
+ el.removeEventListener("focus", onFocus, { capture: true });
5633
+ el.removeEventListener("blur", onFocus, { capture: true });
5634
+ } else if (disableDrag) {
5635
+ el.removeEventListener("pointerdown", stopPropagation, {
5636
+ capture: true
5637
+ });
5638
+ }
5639
+ el.removeAttribute("data-puck-overlay-portal");
5640
+ };
5641
+ };
5642
+
5643
+ // css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css#css-module
5644
+ init_react_import();
5645
+ var styles_module_default13 = { "InlineTextField": "_InlineTextField_ilw2a_1" };
5646
+
5647
+ // lib/data/set-deep.ts
5648
+ init_react_import();
5649
+ function setDeep(node, path, newVal) {
5650
+ const parts = path.split(".");
5651
+ const newNode = __spreadValues({}, node);
5652
+ let cur = newNode;
5653
+ for (let i = 0; i < parts.length; i++) {
5654
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
5655
+ const isLast = i === parts.length - 1;
5656
+ if (idxStr !== void 0) {
5657
+ if (!Array.isArray(cur[prop])) {
5658
+ cur[prop] = [];
5659
+ }
5660
+ const idx = Number(idxStr);
5661
+ if (isLast) {
5662
+ cur[prop][idx] = newVal;
5663
+ continue;
5664
+ }
5665
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
5666
+ cur = cur[prop][idx];
5667
+ continue;
5668
+ }
5669
+ if (isLast) {
5670
+ cur[prop] = newVal;
5671
+ continue;
5672
+ }
5673
+ if (cur[prop] === void 0) {
5674
+ cur[prop] = {};
5675
+ }
5676
+ cur = cur[prop];
5677
+ }
5678
+ return __spreadValues(__spreadValues({}, node), newNode);
5679
+ }
5680
+
5681
+ // components/InlineTextField/index.tsx
5682
+ import { jsx as jsx24 } from "react/jsx-runtime";
5683
+ var getClassName18 = get_class_name_factory_default("InlineTextField", styles_module_default13);
5684
+ var InlineTextFieldInternal = ({
5685
+ propPath,
5686
+ componentId,
5687
+ value,
5688
+ isReadOnly,
5689
+ opts = {}
5690
+ }) => {
5691
+ var _a;
5692
+ const ref = useRef5(null);
5693
+ const appStoreApi = useAppStoreApi();
5694
+ const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
5695
+ useEffect17(() => {
5696
+ const appStore = appStoreApi.getState();
5697
+ const data = appStore.state.indexes.nodes[componentId].data;
5698
+ const componentConfig = appStore.getComponentConfig(data.type);
5699
+ if (!componentConfig) {
5700
+ throw new Error(
5701
+ `InlineTextField Error: No config defined for ${data.type}`
5702
+ );
5703
+ }
5704
+ if (ref.current) {
5705
+ if (value !== ref.current.innerText) {
5706
+ ref.current.replaceChildren(value);
5707
+ }
5708
+ const cleanupPortal = registerOverlayPortal(ref.current);
5709
+ const handleInput = (e) => __async(void 0, null, function* () {
5710
+ var _a2;
5711
+ const appStore2 = appStoreApi.getState();
5712
+ const node = appStore2.state.indexes.nodes[componentId];
5713
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5714
+ const index = (_a2 = appStore2.state.indexes.zones[zoneCompound]) == null ? void 0 : _a2.contentIds.indexOf(
5715
+ componentId
5716
+ );
5717
+ const newProps = setDeep(node.data.props, propPath, e.target.innerText);
5718
+ const resolvedData = yield appStore2.resolveComponentData(
5719
+ __spreadProps(__spreadValues({}, node.data), { props: newProps }),
5720
+ "replace"
5721
+ );
5722
+ appStore2.dispatch({
5723
+ type: "replace",
5724
+ data: resolvedData.node,
5725
+ destinationIndex: index,
5726
+ destinationZone: zoneCompound
5727
+ });
5728
+ });
5729
+ ref.current.addEventListener("input", handleInput);
5730
+ return () => {
5731
+ var _a2;
5732
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("input", handleInput);
5733
+ cleanupPortal == null ? void 0 : cleanupPortal();
5734
+ };
5735
+ }
5736
+ }, [appStoreApi, ref.current, value]);
5737
+ const [isHovering, setIsHovering] = useState16(false);
5738
+ const [isFocused, setIsFocused] = useState16(false);
5739
+ return /* @__PURE__ */ jsx24(
5740
+ "span",
5741
+ {
5742
+ className: getClassName18(),
5743
+ ref,
5744
+ contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
5745
+ onClick: (e) => {
5746
+ e.preventDefault();
5747
+ e.stopPropagation();
5748
+ },
5749
+ onClickCapture: (e) => {
5750
+ e.preventDefault();
5751
+ e.stopPropagation();
5752
+ },
5753
+ onKeyDown: (e) => {
5754
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5755
+ e.preventDefault();
5756
+ }
5757
+ },
5758
+ onMouseOverCapture: () => setIsHovering(true),
5759
+ onMouseOutCapture: () => setIsHovering(false),
5760
+ onFocus: () => setIsFocused(true),
5761
+ onBlur: () => setIsFocused(false)
5762
+ }
5763
+ );
5764
+ };
5765
+ var InlineTextField = memo(InlineTextFieldInternal);
5766
+
5767
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5768
+ import { jsx as jsx25 } from "react/jsx-runtime";
5769
+ var getInlineTextTransform = () => ({
5770
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5771
+ if (field.contentEditable) {
5772
+ return /* @__PURE__ */ jsx25(
5773
+ InlineTextField,
5774
+ {
5775
+ propPath,
5776
+ componentId,
5777
+ value,
5778
+ opts: { disableLineBreaks: true },
5779
+ isReadOnly
5780
+ }
5781
+ );
5782
+ }
5783
+ return value;
5784
+ },
5785
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5786
+ if (field.contentEditable) {
5787
+ return /* @__PURE__ */ jsx25(
5788
+ InlineTextField,
5789
+ {
5790
+ propPath,
5791
+ componentId,
5792
+ value,
5793
+ isReadOnly
5794
+ }
5795
+ );
5796
+ }
5797
+ return value;
5798
+ },
5799
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5800
+ if (field.contentEditable && typeof value === "string") {
5801
+ return /* @__PURE__ */ jsx25(
5802
+ InlineTextField,
5803
+ {
5804
+ propPath,
5805
+ componentId,
5806
+ value,
5807
+ isReadOnly
5808
+ }
5809
+ );
5810
+ }
5811
+ return value;
5812
+ }
5813
+ });
5814
+
5614
5815
  // components/DropZone/index.tsx
5615
- import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
5616
- var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default11);
5816
+ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
5817
+ var getClassName19 = get_class_name_factory_default("DropZone", styles_module_default11);
5617
5818
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5618
5819
  var RENDER_DEBUG = false;
5619
- var DropZoneEditPure = (props) => /* @__PURE__ */ jsx24(DropZoneEdit, __spreadValues({}, props));
5820
+ var DropZoneEditPure = (props) => /* @__PURE__ */ jsx26(DropZoneEdit, __spreadValues({}, props));
5620
5821
  var DropZoneChild = ({
5621
5822
  zoneCompound,
5622
5823
  componentId,
@@ -5631,7 +5832,7 @@ var DropZoneChild = ({
5631
5832
  const { depth = 1 } = ctx != null ? ctx : {};
5632
5833
  const zoneStore = useContext8(ZoneStoreContext);
5633
5834
  const nodeProps = useAppStore(
5634
- useShallow5((s) => {
5835
+ useShallow4((s) => {
5635
5836
  var _a2;
5636
5837
  return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
5637
5838
  })
@@ -5643,7 +5844,7 @@ var DropZoneChild = ({
5643
5844
  }
5644
5845
  );
5645
5846
  const nodeReadOnly = useAppStore(
5646
- useShallow5((s) => {
5847
+ useShallow4((s) => {
5647
5848
  var _a2;
5648
5849
  return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
5649
5850
  })
@@ -5700,10 +5901,10 @@ var DropZoneChild = ({
5700
5901
  if (item && "element" in item && item.element) {
5701
5902
  return (
5702
5903
  // Safe to use this since the HTML is set by the user
5703
- /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5904
+ /* @__PURE__ */ jsx26("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5704
5905
  );
5705
5906
  }
5706
- return /* @__PURE__ */ jsx24(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5907
+ return /* @__PURE__ */ jsx26(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5707
5908
  },
5708
5909
  [componentId, label, overrides]
5709
5910
  );
@@ -5723,11 +5924,19 @@ var DropZoneChild = ({
5723
5924
  [item == null ? void 0 : item.type, nodeType, defaultsProps]
5724
5925
  );
5725
5926
  const config = useAppStore((s) => s.config);
5726
- const defaultedPropsWithSlots = useSlots(
5927
+ const plugins = useAppStore((s) => s.plugins);
5928
+ const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
5929
+ const combinedFieldTransforms = useMemo8(
5930
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx26(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5931
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
5932
+ {}
5933
+ )), userFieldTransforms),
5934
+ [plugins, userFieldTransforms]
5935
+ );
5936
+ const transformedProps = useFieldTransforms(
5727
5937
  config,
5728
5938
  defaultedNode,
5729
- DropZoneEditPure,
5730
- (slotProps) => /* @__PURE__ */ jsx24(ContextSlotRender, { componentId, zone: slotProps.zone }),
5939
+ combinedFieldTransforms,
5731
5940
  nodeReadOnly,
5732
5941
  isLoading
5733
5942
  );
@@ -5741,7 +5950,7 @@ var DropZoneChild = ({
5741
5950
  if (isInserting) {
5742
5951
  Render2 = renderPreview;
5743
5952
  }
5744
- return /* @__PURE__ */ jsx24(
5953
+ return /* @__PURE__ */ jsx26(
5745
5954
  DraggableComponent,
5746
5955
  {
5747
5956
  id: componentId,
@@ -5755,18 +5964,18 @@ var DropZoneChild = ({
5755
5964
  autoDragAxis: dragAxis,
5756
5965
  userDragAxis: collisionAxis,
5757
5966
  inDroppableZone,
5758
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(
5967
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx26(Fragment7, { children: /* @__PURE__ */ jsx26(
5759
5968
  Render2,
5760
- __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5761
- puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5969
+ __spreadProps(__spreadValues({}, transformedProps), {
5970
+ puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
5762
5971
  dragRef
5763
5972
  })
5764
5973
  })
5765
- ) }) : /* @__PURE__ */ jsx24("div", { ref: dragRef, children: /* @__PURE__ */ jsx24(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5974
+ ) }) : /* @__PURE__ */ jsx26("div", { ref: dragRef, children: /* @__PURE__ */ jsx26(Render2, __spreadValues({}, transformedProps)) })
5766
5975
  }
5767
5976
  );
5768
5977
  };
5769
- var DropZoneChildMemo = memo(DropZoneChild);
5978
+ var DropZoneChildMemo = memo2(DropZoneChild);
5770
5979
  var DropZoneEdit = forwardRef3(
5771
5980
  function DropZoneEditInternal({
5772
5981
  zone,
@@ -5787,7 +5996,7 @@ var DropZoneEdit = forwardRef3(
5787
5996
  unregisterLocalZone
5788
5997
  } = ctx != null ? ctx : {};
5789
5998
  const path = useAppStore(
5790
- useShallow5((s) => {
5999
+ useShallow4((s) => {
5791
6000
  var _a;
5792
6001
  return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
5793
6002
  })
@@ -5804,25 +6013,25 @@ var DropZoneEdit = forwardRef3(
5804
6013
  (s) => s.nextAreaDepthIndex[areaId || ""]
5805
6014
  );
5806
6015
  const zoneContentIds = useAppStore(
5807
- useShallow5((s) => {
6016
+ useShallow4((s) => {
5808
6017
  var _a;
5809
6018
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
5810
6019
  })
5811
6020
  );
5812
6021
  const zoneType = useAppStore(
5813
- useShallow5((s) => {
6022
+ useShallow4((s) => {
5814
6023
  var _a;
5815
6024
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
5816
6025
  })
5817
6026
  );
5818
- useEffect17(() => {
6027
+ useEffect18(() => {
5819
6028
  if (!zoneType || zoneType === "dropzone") {
5820
6029
  if (ctx == null ? void 0 : ctx.registerZone) {
5821
6030
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
5822
6031
  }
5823
6032
  }
5824
6033
  }, [zoneType, appStoreApi]);
5825
- useEffect17(() => {
6034
+ useEffect18(() => {
5826
6035
  if (zoneType === "dropzone") {
5827
6036
  if (zoneCompound !== rootDroppableId) {
5828
6037
  console.warn(
@@ -5834,8 +6043,8 @@ var DropZoneEdit = forwardRef3(
5834
6043
  const contentIds = useMemo8(() => {
5835
6044
  return zoneContentIds || [];
5836
6045
  }, [zoneContentIds]);
5837
- const ref = useRef5(null);
5838
- const acceptsTarget = useCallback12(
6046
+ const ref = useRef6(null);
6047
+ const acceptsTarget = useCallback11(
5839
6048
  (componentType) => {
5840
6049
  if (!componentType) {
5841
6050
  return true;
@@ -5873,7 +6082,7 @@ var DropZoneEdit = forwardRef3(
5873
6082
  }
5874
6083
  return _isEnabled;
5875
6084
  });
5876
- useEffect17(() => {
6085
+ useEffect18(() => {
5877
6086
  if (registerLocalZone) {
5878
6087
  registerLocalZone(zoneCompound, targetAccepted || isEnabled);
5879
6088
  }
@@ -5889,7 +6098,7 @@ var DropZoneEdit = forwardRef3(
5889
6098
  );
5890
6099
  const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
5891
6100
  const zoneStore = useContext8(ZoneStoreContext);
5892
- useEffect17(() => {
6101
+ useEffect18(() => {
5893
6102
  const { enabledIndex } = zoneStore.getState();
5894
6103
  zoneStore.setState({
5895
6104
  enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
@@ -5918,10 +6127,10 @@ var DropZoneEdit = forwardRef3(
5918
6127
  userMinEmptyHeight,
5919
6128
  ref
5920
6129
  });
5921
- return /* @__PURE__ */ jsx24(
6130
+ return /* @__PURE__ */ jsx26(
5922
6131
  "div",
5923
6132
  {
5924
- className: `${getClassName18({
6133
+ className: `${getClassName19({
5925
6134
  isRootZone,
5926
6135
  hoveringOverArea,
5927
6136
  isEnabled,
@@ -5939,7 +6148,7 @@ var DropZoneEdit = forwardRef3(
5939
6148
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
5940
6149
  }),
5941
6150
  children: contentIdsWithPreview.map((componentId, i) => {
5942
- return /* @__PURE__ */ jsx24(
6151
+ return /* @__PURE__ */ jsx26(
5943
6152
  DropZoneChildMemo,
5944
6153
  {
5945
6154
  zoneCompound,
@@ -5962,7 +6171,7 @@ var DropZoneRenderItem = ({
5962
6171
  metadata
5963
6172
  }) => {
5964
6173
  const Component = config.components[item.type];
5965
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx24(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
6174
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx26(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5966
6175
  const nextContextValue = useMemo8(
5967
6176
  () => ({
5968
6177
  areaId: props.id,
@@ -5970,7 +6179,7 @@ var DropZoneRenderItem = ({
5970
6179
  }),
5971
6180
  [props]
5972
6181
  );
5973
- return /* @__PURE__ */ jsx24(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx24(
6182
+ return /* @__PURE__ */ jsx26(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx26(
5974
6183
  Component.render,
5975
6184
  __spreadProps(__spreadValues({}, props), {
5976
6185
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -5980,7 +6189,7 @@ var DropZoneRenderItem = ({
5980
6189
  })
5981
6190
  ) }, props.id);
5982
6191
  };
5983
- var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx24(DropZoneRender, __spreadValues({}, props));
6192
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
5984
6193
  var DropZoneRender = forwardRef3(
5985
6194
  function DropZoneRenderInternal({ className, style, zone }, ref) {
5986
6195
  const ctx = useContext8(dropZoneContext);
@@ -5988,7 +6197,7 @@ var DropZoneRender = forwardRef3(
5988
6197
  const { config, data, metadata } = useContext8(renderContext);
5989
6198
  let zoneCompound = `${areaId}:${zone}`;
5990
6199
  let content = (data == null ? void 0 : data.content) || [];
5991
- useEffect17(() => {
6200
+ useEffect18(() => {
5992
6201
  if (!content) {
5993
6202
  if (ctx == null ? void 0 : ctx.registerZone) {
5994
6203
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
@@ -6001,10 +6210,10 @@ var DropZoneRender = forwardRef3(
6001
6210
  if (zoneCompound !== rootDroppableId) {
6002
6211
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6003
6212
  }
6004
- return /* @__PURE__ */ jsx24("div", { className, style, ref, children: content.map((item) => {
6213
+ return /* @__PURE__ */ jsx26("div", { className, style, ref, children: content.map((item) => {
6005
6214
  const Component = config.components[item.type];
6006
6215
  if (Component) {
6007
- return /* @__PURE__ */ jsx24(
6216
+ return /* @__PURE__ */ jsx26(
6008
6217
  DropZoneRenderItem,
6009
6218
  {
6010
6219
  config,
@@ -6018,20 +6227,20 @@ var DropZoneRender = forwardRef3(
6018
6227
  }) });
6019
6228
  }
6020
6229
  );
6021
- var DropZonePure = (props) => /* @__PURE__ */ jsx24(DropZone, __spreadValues({}, props));
6230
+ var DropZonePure = (props) => /* @__PURE__ */ jsx26(DropZone, __spreadValues({}, props));
6022
6231
  var DropZone = forwardRef3(
6023
6232
  function DropZone2(props, ref) {
6024
6233
  const ctx = useContext8(dropZoneContext);
6025
6234
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
6026
- return /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6235
+ return /* @__PURE__ */ jsx26(Fragment7, { children: /* @__PURE__ */ jsx26(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6027
6236
  }
6028
- return /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
6237
+ return /* @__PURE__ */ jsx26(Fragment7, { children: /* @__PURE__ */ jsx26(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
6029
6238
  }
6030
6239
  );
6031
6240
 
6032
6241
  // components/Render/index.tsx
6033
6242
  import React3, { useMemo as useMemo9 } from "react";
6034
- import { jsx as jsx25 } from "react/jsx-runtime";
6243
+ import { jsx as jsx27 } from "react/jsx-runtime";
6035
6244
  var renderContext = React3.createContext({
6036
6245
  config: { components: {} },
6037
6246
  data: { root: {}, content: [] },
@@ -6063,7 +6272,7 @@ function Render({
6063
6272
  const propsWithSlots = useSlots(
6064
6273
  config,
6065
6274
  { type: "root", props: pageProps },
6066
- (props) => /* @__PURE__ */ jsx25(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
6275
+ (props) => /* @__PURE__ */ jsx27(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
6067
6276
  );
6068
6277
  const nextContextValue = useMemo9(
6069
6278
  () => ({
@@ -6073,14 +6282,14 @@ function Render({
6073
6282
  []
6074
6283
  );
6075
6284
  if ((_a = config.root) == null ? void 0 : _a.render) {
6076
- return /* @__PURE__ */ jsx25(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx25(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx25(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ jsx25(DropZoneRenderPure, { zone: rootZone }) })) }) });
6285
+ return /* @__PURE__ */ jsx27(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx27(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx27(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ jsx27(DropZoneRenderPure, { zone: rootZone }) })) }) });
6077
6286
  }
6078
- return /* @__PURE__ */ jsx25(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx25(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx25(DropZoneRenderPure, { zone: rootZone }) }) });
6287
+ return /* @__PURE__ */ jsx27(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx27(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx27(DropZoneRenderPure, { zone: rootZone }) }) });
6079
6288
  }
6080
6289
 
6081
6290
  // lib/use-puck.ts
6082
6291
  init_react_import();
6083
- import { createContext as createContext5, useContext as useContext9, useEffect as useEffect18, useState as useState16 } from "react";
6292
+ import { createContext as createContext5, useContext as useContext9, useEffect as useEffect19, useState as useState17 } from "react";
6084
6293
  import { createStore as createStore4, useStore as useStore3 } from "zustand";
6085
6294
  var generateUsePuck = (store) => {
6086
6295
  const history = {
@@ -6127,12 +6336,12 @@ var convertToPickedStore = (store) => {
6127
6336
  };
6128
6337
  };
6129
6338
  var useRegisterUsePuckStore = (appStore) => {
6130
- const [usePuckStore] = useState16(
6339
+ const [usePuckStore] = useState17(
6131
6340
  () => createStore4(
6132
6341
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
6133
6342
  )
6134
6343
  );
6135
- useEffect18(() => {
6344
+ useEffect19(() => {
6136
6345
  return appStore.subscribe(
6137
6346
  (store) => convertToPickedStore(store),
6138
6347
  (pickedStore) => {
@@ -6156,7 +6365,7 @@ function createUsePuck() {
6156
6365
  };
6157
6366
  }
6158
6367
  function usePuck() {
6159
- useEffect18(() => {
6368
+ useEffect19(() => {
6160
6369
  console.warn(
6161
6370
  "You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
6162
6371
  );
@@ -6175,12 +6384,12 @@ function useGetPuck() {
6175
6384
  init_react_import();
6176
6385
  import {
6177
6386
  createContext as createContext8,
6178
- useCallback as useCallback21,
6387
+ useCallback as useCallback20,
6179
6388
  useContext as useContext13,
6180
- useEffect as useEffect28,
6389
+ useEffect as useEffect29,
6181
6390
  useMemo as useMemo20,
6182
- useRef as useRef11,
6183
- useState as useState24
6391
+ useRef as useRef12,
6392
+ useState as useState25
6184
6393
  } from "react";
6185
6394
 
6186
6395
  // components/SidebarSection/index.tsx
@@ -6188,7 +6397,7 @@ init_react_import();
6188
6397
 
6189
6398
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6190
6399
  init_react_import();
6191
- var styles_module_default13 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
6400
+ var styles_module_default14 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
6192
6401
 
6193
6402
  // lib/use-breadcrumbs.ts
6194
6403
  init_react_import();
@@ -6235,8 +6444,8 @@ var useBreadcrumbs = (renderCount) => {
6235
6444
  };
6236
6445
 
6237
6446
  // components/SidebarSection/index.tsx
6238
- import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
6239
- var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
6447
+ import { jsx as jsx28, jsxs as jsxs12 } from "react/jsx-runtime";
6448
+ var getClassName20 = get_class_name_factory_default("SidebarSection", styles_module_default14);
6240
6449
  var SidebarSection = ({
6241
6450
  children,
6242
6451
  title,
@@ -6251,26 +6460,26 @@ var SidebarSection = ({
6251
6460
  return /* @__PURE__ */ jsxs12(
6252
6461
  "div",
6253
6462
  {
6254
- className: getClassName19({ noBorderTop, noPadding }),
6463
+ className: getClassName20({ noBorderTop, noPadding }),
6255
6464
  style: { background },
6256
6465
  children: [
6257
- /* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumbs"), children: [
6258
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumb"), children: [
6259
- /* @__PURE__ */ jsx26(
6466
+ /* @__PURE__ */ jsx28("div", { className: getClassName20("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName20("breadcrumbs"), children: [
6467
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName20("breadcrumb"), children: [
6468
+ /* @__PURE__ */ jsx28(
6260
6469
  "button",
6261
6470
  {
6262
6471
  type: "button",
6263
- className: getClassName19("breadcrumbLabel"),
6472
+ className: getClassName20("breadcrumbLabel"),
6264
6473
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6265
6474
  children: breadcrumb.label
6266
6475
  }
6267
6476
  ),
6268
- /* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
6477
+ /* @__PURE__ */ jsx28(ChevronRight, { size: 16 })
6269
6478
  ] }, i)) : null,
6270
- /* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
6479
+ /* @__PURE__ */ jsx28("div", { className: getClassName20("heading"), children: /* @__PURE__ */ jsx28(Heading, { rank: "2", size: "xs", children: title }) })
6271
6480
  ] }) }),
6272
- /* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
6273
- isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx26(Loader, { size: 32 }) })
6481
+ /* @__PURE__ */ jsx28("div", { className: getClassName20("content"), children }),
6482
+ isLoading && /* @__PURE__ */ jsx28("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ jsx28(Loader, { size: 32 }) })
6274
6483
  ]
6275
6484
  }
6276
6485
  );
@@ -6278,24 +6487,24 @@ var SidebarSection = ({
6278
6487
 
6279
6488
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
6280
6489
  init_react_import();
6281
- var styles_module_default14 = { "Puck": "_Puck_vnhjy_19", "Puck-portal": "_Puck-portal_vnhjy_31", "PuckLayout-inner": "_PuckLayout-inner_vnhjy_38", "PuckLayout--mounted": "_PuckLayout--mounted_vnhjy_50", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_vnhjy_54", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_vnhjy_60", "PuckLayout-mounted": "_PuckLayout-mounted_vnhjy_74", "PuckLayout": "_PuckLayout_vnhjy_38" };
6490
+ var styles_module_default15 = { "Puck": "_Puck_vnhjy_19", "Puck-portal": "_Puck-portal_vnhjy_31", "PuckLayout-inner": "_PuckLayout-inner_vnhjy_38", "PuckLayout--mounted": "_PuckLayout--mounted_vnhjy_50", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_vnhjy_54", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_vnhjy_60", "PuckLayout-mounted": "_PuckLayout-mounted_vnhjy_74", "PuckLayout": "_PuckLayout_vnhjy_38" };
6282
6491
 
6283
6492
  // components/Puck/components/Fields/index.tsx
6284
6493
  init_react_import();
6285
6494
 
6286
6495
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
6287
6496
  init_react_import();
6288
- var styles_module_default15 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
6497
+ var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
6289
6498
 
6290
6499
  // components/Puck/components/Fields/index.tsx
6291
- import { memo as memo2, useCallback as useCallback13, useMemo as useMemo11 } from "react";
6292
- import { useShallow as useShallow6 } from "zustand/react/shallow";
6293
- import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
6294
- var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
6500
+ import { memo as memo3, useCallback as useCallback12, useMemo as useMemo11 } from "react";
6501
+ import { useShallow as useShallow5 } from "zustand/react/shallow";
6502
+ import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
6503
+ var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
6295
6504
  var DefaultFields = ({
6296
6505
  children
6297
6506
  }) => {
6298
- return /* @__PURE__ */ jsx27(Fragment8, { children });
6507
+ return /* @__PURE__ */ jsx29(Fragment8, { children });
6299
6508
  };
6300
6509
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6301
6510
  let currentProps;
@@ -6355,19 +6564,19 @@ var FieldsChild = ({ fieldName }) => {
6355
6564
  return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
6356
6565
  });
6357
6566
  const permissions = useAppStore(
6358
- useShallow6((s) => {
6567
+ useShallow5((s) => {
6359
6568
  const { selectedItem, permissions: permissions2 } = s;
6360
6569
  return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
6361
6570
  })
6362
6571
  );
6363
6572
  const appStore = useAppStoreApi();
6364
- const onChange = useCallback13(createOnChange(fieldName, appStore), [
6573
+ const onChange = useCallback12(createOnChange(fieldName, appStore), [
6365
6574
  fieldName
6366
6575
  ]);
6367
6576
  const { visible = true } = field != null ? field : {};
6368
6577
  if (!field || !id || !visible) return null;
6369
6578
  if (field.type === "slot") return null;
6370
- return /* @__PURE__ */ jsx27("div", { className: getClassName20("field"), children: /* @__PURE__ */ jsx27(
6579
+ return /* @__PURE__ */ jsx29("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx29(
6371
6580
  AutoFieldPrivate,
6372
6581
  {
6373
6582
  field,
@@ -6379,7 +6588,7 @@ var FieldsChild = ({ fieldName }) => {
6379
6588
  }
6380
6589
  ) }, id);
6381
6590
  };
6382
- var FieldsChildMemo = memo2(FieldsChild);
6591
+ var FieldsChildMemo = memo3(FieldsChild);
6383
6592
  var FieldsInternal = ({ wrapFields = true }) => {
6384
6593
  const overrides = useAppStore((s) => s.overrides);
6385
6594
  const componentResolving = useAppStore((s) => {
@@ -6387,7 +6596,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
6387
6596
  const loadingCount = s.selectedItem ? (_a = s.componentState[s.selectedItem.props.id]) == null ? void 0 : _a.loadingCount : (_b = s.componentState["root"]) == null ? void 0 : _b.loadingCount;
6388
6597
  return (loadingCount != null ? loadingCount : 0) > 0;
6389
6598
  });
6390
- const itemSelector = useAppStore(useShallow6((s) => s.state.ui.itemSelector));
6599
+ const itemSelector = useAppStore(useShallow5((s) => s.state.ui.itemSelector));
6391
6600
  const id = useAppStore((s) => {
6392
6601
  var _a;
6393
6602
  return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
@@ -6396,7 +6605,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
6396
6605
  useRegisterFieldsSlice(appStore, id);
6397
6606
  const fieldsLoading = useAppStore((s) => s.fields.loading);
6398
6607
  const fieldNames = useAppStore(
6399
- useShallow6((s) => {
6608
+ useShallow5((s) => {
6400
6609
  if (s.fields.id === id) {
6401
6610
  return Object.keys(s.fields.fields);
6402
6611
  }
@@ -6408,37 +6617,37 @@ var FieldsInternal = ({ wrapFields = true }) => {
6408
6617
  return /* @__PURE__ */ jsxs13(
6409
6618
  "form",
6410
6619
  {
6411
- className: getClassName20({ wrapFields }),
6620
+ className: getClassName21({ wrapFields }),
6412
6621
  onSubmit: (e) => {
6413
6622
  e.preventDefault();
6414
6623
  },
6415
6624
  children: [
6416
- /* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx27(FieldsChildMemo, { fieldName }, fieldName)) }),
6417
- isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName20("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
6625
+ /* @__PURE__ */ jsx29(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx29(FieldsChildMemo, { fieldName }, fieldName)) }),
6626
+ isLoading && /* @__PURE__ */ jsx29("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx29("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx29(Loader, { size: 16 }) }) })
6418
6627
  ]
6419
6628
  }
6420
6629
  );
6421
6630
  };
6422
- var Fields = memo2(FieldsInternal);
6631
+ var Fields = memo3(FieldsInternal);
6423
6632
 
6424
6633
  // components/Puck/components/Components/index.tsx
6425
6634
  init_react_import();
6426
6635
 
6427
6636
  // lib/use-component-list.tsx
6428
6637
  init_react_import();
6429
- import { useEffect as useEffect20, useState as useState17 } from "react";
6638
+ import { useEffect as useEffect21, useState as useState18 } from "react";
6430
6639
 
6431
6640
  // components/ComponentList/index.tsx
6432
6641
  init_react_import();
6433
6642
 
6434
6643
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
6435
6644
  init_react_import();
6436
- 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" };
6645
+ var styles_module_default17 = { "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" };
6437
6646
 
6438
6647
  // components/ComponentList/index.tsx
6439
- import { useEffect as useEffect19 } from "react";
6440
- import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
6441
- var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
6648
+ import { useEffect as useEffect20 } from "react";
6649
+ import { jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
6650
+ var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
6442
6651
  var ComponentListItem = ({
6443
6652
  name,
6444
6653
  label
@@ -6450,14 +6659,14 @@ var ComponentListItem = ({
6450
6659
  type: name
6451
6660
  }).insert
6452
6661
  );
6453
- useEffect19(() => {
6662
+ useEffect20(() => {
6454
6663
  if (overrides.componentItem) {
6455
6664
  console.warn(
6456
6665
  "The `componentItem` override has been deprecated and renamed to `drawerItem`"
6457
6666
  );
6458
6667
  }
6459
6668
  }, [overrides]);
6460
- return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6669
+ return /* @__PURE__ */ jsx30(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6461
6670
  };
6462
6671
  var ComponentList = ({
6463
6672
  children,
@@ -6468,12 +6677,12 @@ var ComponentList = ({
6468
6677
  const setUi = useAppStore((s) => s.setUi);
6469
6678
  const componentList = useAppStore((s) => s.state.ui.componentList);
6470
6679
  const { expanded = true } = componentList[id] || {};
6471
- return /* @__PURE__ */ jsxs14("div", { className: getClassName21({ isExpanded: expanded }), children: [
6680
+ return /* @__PURE__ */ jsxs14("div", { className: getClassName22({ isExpanded: expanded }), children: [
6472
6681
  title && /* @__PURE__ */ jsxs14(
6473
6682
  "button",
6474
6683
  {
6475
6684
  type: "button",
6476
- className: getClassName21("title"),
6685
+ className: getClassName22("title"),
6477
6686
  onClick: () => setUi({
6478
6687
  componentList: __spreadProps(__spreadValues({}, componentList), {
6479
6688
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -6483,14 +6692,14 @@ var ComponentList = ({
6483
6692
  }),
6484
6693
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
6485
6694
  children: [
6486
- /* @__PURE__ */ jsx28("div", { children: title }),
6487
- /* @__PURE__ */ jsx28("div", { className: getClassName21("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
6695
+ /* @__PURE__ */ jsx30("div", { children: title }),
6696
+ /* @__PURE__ */ jsx30("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx30(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx30(ChevronDown, { size: 12 }) })
6488
6697
  ]
6489
6698
  }
6490
6699
  ),
6491
- /* @__PURE__ */ jsx28("div", { className: getClassName21("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6700
+ /* @__PURE__ */ jsx30("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx30(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6492
6701
  var _a;
6493
- return /* @__PURE__ */ jsx28(
6702
+ return /* @__PURE__ */ jsx30(
6494
6703
  ComponentListItem,
6495
6704
  {
6496
6705
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -6504,12 +6713,12 @@ var ComponentList = ({
6504
6713
  ComponentList.Item = ComponentListItem;
6505
6714
 
6506
6715
  // lib/use-component-list.tsx
6507
- import { jsx as jsx29 } from "react/jsx-runtime";
6716
+ import { jsx as jsx31 } from "react/jsx-runtime";
6508
6717
  var useComponentList = () => {
6509
- const [componentList, setComponentList] = useState17();
6718
+ const [componentList, setComponentList] = useState18();
6510
6719
  const config = useAppStore((s) => s.config);
6511
6720
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
6512
- useEffect20(() => {
6721
+ useEffect21(() => {
6513
6722
  var _a, _b, _c;
6514
6723
  if (Object.keys(uiComponentList).length > 0) {
6515
6724
  const matchedComponents = [];
@@ -6519,7 +6728,7 @@ var useComponentList = () => {
6519
6728
  if (category.visible === false || !category.components) {
6520
6729
  return null;
6521
6730
  }
6522
- return /* @__PURE__ */ jsx29(
6731
+ return /* @__PURE__ */ jsx31(
6523
6732
  ComponentList,
6524
6733
  {
6525
6734
  id: categoryKey,
@@ -6528,7 +6737,7 @@ var useComponentList = () => {
6528
6737
  var _a2;
6529
6738
  matchedComponents.push(componentName);
6530
6739
  const componentConf = config.components[componentName] || {};
6531
- return /* @__PURE__ */ jsx29(
6740
+ return /* @__PURE__ */ jsx31(
6532
6741
  ComponentList.Item,
6533
6742
  {
6534
6743
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -6548,7 +6757,7 @@ var useComponentList = () => {
6548
6757
  );
6549
6758
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
6550
6759
  _componentList.push(
6551
- /* @__PURE__ */ jsx29(
6760
+ /* @__PURE__ */ jsx31(
6552
6761
  ComponentList,
6553
6762
  {
6554
6763
  id: "other",
@@ -6556,7 +6765,7 @@ var useComponentList = () => {
6556
6765
  children: remainingComponents.map((componentName, i) => {
6557
6766
  var _a2;
6558
6767
  const componentConf = config.components[componentName] || {};
6559
- return /* @__PURE__ */ jsx29(
6768
+ return /* @__PURE__ */ jsx31(
6560
6769
  ComponentList.Item,
6561
6770
  {
6562
6771
  name: componentName,
@@ -6579,7 +6788,7 @@ var useComponentList = () => {
6579
6788
 
6580
6789
  // components/Puck/components/Components/index.tsx
6581
6790
  import { useMemo as useMemo12 } from "react";
6582
- import { jsx as jsx30 } from "react/jsx-runtime";
6791
+ import { jsx as jsx32 } from "react/jsx-runtime";
6583
6792
  var Components = () => {
6584
6793
  const overrides = useAppStore((s) => s.overrides);
6585
6794
  const componentList = useComponentList();
@@ -6591,24 +6800,24 @@ var Components = () => {
6591
6800
  }
6592
6801
  return overrides.components || overrides.drawer || "div";
6593
6802
  }, [overrides]);
6594
- return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
6803
+ return /* @__PURE__ */ jsx32(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx32(ComponentList, { id: "all" }) });
6595
6804
  };
6596
6805
 
6597
6806
  // components/Puck/components/Preview/index.tsx
6598
6807
  init_react_import();
6599
- import { useCallback as useCallback14, useEffect as useEffect22, useRef as useRef6, useMemo as useMemo13 } from "react";
6808
+ import { useCallback as useCallback13, useEffect as useEffect23, useRef as useRef7, useMemo as useMemo13 } from "react";
6600
6809
 
6601
6810
  // components/AutoFrame/index.tsx
6602
6811
  init_react_import();
6603
6812
  import {
6604
6813
  createContext as createContext6,
6605
6814
  useContext as useContext10,
6606
- useEffect as useEffect21,
6607
- useState as useState18
6815
+ useEffect as useEffect22,
6816
+ useState as useState19
6608
6817
  } from "react";
6609
6818
  import hash from "object-hash";
6610
6819
  import { createPortal as createPortal3 } from "react-dom";
6611
- import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
6820
+ import { Fragment as Fragment9, jsx as jsx33 } from "react/jsx-runtime";
6612
6821
  var styleSelector = 'style, link[rel="stylesheet"]';
6613
6822
  var collectStyles = (doc) => {
6614
6823
  const collected = [];
@@ -6658,7 +6867,7 @@ var CopyHostStyles = ({
6658
6867
  onStylesLoaded = () => null
6659
6868
  }) => {
6660
6869
  const { document: doc, window: win } = useFrame();
6661
- useEffect21(() => {
6870
+ useEffect22(() => {
6662
6871
  if (!win || !doc) {
6663
6872
  return () => {
6664
6873
  };
@@ -6815,7 +7024,7 @@ var CopyHostStyles = ({
6815
7024
  observer.disconnect();
6816
7025
  };
6817
7026
  }, []);
6818
- return /* @__PURE__ */ jsx31(Fragment9, { children });
7027
+ return /* @__PURE__ */ jsx33(Fragment9, { children });
6819
7028
  };
6820
7029
  var autoFrameContext = createContext6({});
6821
7030
  var useFrame = () => useContext10(autoFrameContext);
@@ -6839,11 +7048,11 @@ function AutoFrame(_a) {
6839
7048
  "onNotReady",
6840
7049
  "frameRef"
6841
7050
  ]);
6842
- const [loaded, setLoaded] = useState18(false);
6843
- const [ctx, setCtx] = useState18({});
6844
- const [mountTarget, setMountTarget] = useState18();
6845
- const [stylesLoaded, setStylesLoaded] = useState18(false);
6846
- useEffect21(() => {
7051
+ const [loaded, setLoaded] = useState19(false);
7052
+ const [ctx, setCtx] = useState19({});
7053
+ const [mountTarget, setMountTarget] = useState19();
7054
+ const [stylesLoaded, setStylesLoaded] = useState19(false);
7055
+ useEffect22(() => {
6847
7056
  var _a2;
6848
7057
  if (frameRef.current) {
6849
7058
  const doc = frameRef.current.contentDocument;
@@ -6862,7 +7071,7 @@ function AutoFrame(_a) {
6862
7071
  }
6863
7072
  }
6864
7073
  }, [frameRef, loaded, stylesLoaded]);
6865
- return /* @__PURE__ */ jsx31(
7074
+ return /* @__PURE__ */ jsx33(
6866
7075
  "iframe",
6867
7076
  __spreadProps(__spreadValues({}, props), {
6868
7077
  className,
@@ -6872,7 +7081,7 @@ function AutoFrame(_a) {
6872
7081
  onLoad: () => {
6873
7082
  setLoaded(true);
6874
7083
  },
6875
- children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(
7084
+ children: /* @__PURE__ */ jsx33(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx33(
6876
7085
  CopyHostStyles,
6877
7086
  {
6878
7087
  debug,
@@ -6888,14 +7097,14 @@ var AutoFrame_default = AutoFrame;
6888
7097
 
6889
7098
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
6890
7099
  init_react_import();
6891
- var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7100
+ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
6892
7101
 
6893
7102
  // components/Puck/components/Preview/index.tsx
6894
- import { Fragment as Fragment10, jsx as jsx32 } from "react/jsx-runtime";
6895
- var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
7103
+ import { Fragment as Fragment10, jsx as jsx34 } from "react/jsx-runtime";
7104
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
6896
7105
  var useBubbleIframeEvents = (ref) => {
6897
7106
  const status = useAppStore((s) => s.status);
6898
- useEffect22(() => {
7107
+ useEffect23(() => {
6899
7108
  if (ref.current && status === "READY") {
6900
7109
  const iframe = ref.current;
6901
7110
  const handlePointerMove = (event) => {
@@ -6944,7 +7153,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
6944
7153
  const renderData = useAppStore(
6945
7154
  (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
6946
7155
  );
6947
- const Page = useCallback14(
7156
+ const Page = useCallback13(
6948
7157
  (pageProps) => {
6949
7158
  var _a, _b;
6950
7159
  const propsWithSlots = useSlots(
@@ -6954,15 +7163,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
6954
7163
  );
6955
7164
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
6956
7165
  id: "puck-root"
6957
- }, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment10, { children: propsWithSlots.children });
7166
+ }, propsWithSlots)) : /* @__PURE__ */ jsx34(Fragment10, { children: propsWithSlots.children });
6958
7167
  },
6959
7168
  [config]
6960
7169
  );
6961
7170
  const Frame = useMemo13(() => overrides.iframe, [overrides]);
6962
7171
  const rootProps = root.props || root;
6963
- const ref = useRef6(null);
7172
+ const ref = useRef7(null);
6964
7173
  useBubbleIframeEvents(ref);
6965
- const inner = !renderData ? /* @__PURE__ */ jsx32(
7174
+ const inner = !renderData ? /* @__PURE__ */ jsx34(
6966
7175
  Page,
6967
7176
  __spreadProps(__spreadValues({}, rootProps), {
6968
7177
  puck: {
@@ -6972,28 +7181,31 @@ var Preview2 = ({ id = "puck-preview" }) => {
6972
7181
  metadata
6973
7182
  },
6974
7183
  editMode: true,
6975
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
7184
+ children: /* @__PURE__ */ jsx34(DropZonePure, { zone: rootDroppableId })
6976
7185
  })
6977
- ) : /* @__PURE__ */ jsx32(Render, { data: renderData, config, metadata });
6978
- useEffect22(() => {
7186
+ ) : /* @__PURE__ */ jsx34(Render, { data: renderData, config, metadata });
7187
+ useEffect23(() => {
6979
7188
  if (!iframe.enabled) {
6980
7189
  setStatus("READY");
6981
7190
  }
6982
7191
  }, [iframe.enabled]);
6983
- return /* @__PURE__ */ jsx32(
7192
+ return /* @__PURE__ */ jsx34(
6984
7193
  "div",
6985
7194
  {
6986
- className: getClassName22(),
7195
+ className: getClassName23(),
6987
7196
  id,
6988
7197
  "data-puck-preview": true,
6989
- onClick: () => {
6990
- dispatch({ type: "setUi", ui: { itemSelector: null } });
7198
+ onClick: (e) => {
7199
+ const el = e.target;
7200
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
7201
+ dispatch({ type: "setUi", ui: { itemSelector: null } });
7202
+ }
6991
7203
  },
6992
- children: iframe.enabled ? /* @__PURE__ */ jsx32(
7204
+ children: iframe.enabled ? /* @__PURE__ */ jsx34(
6993
7205
  AutoFrame_default,
6994
7206
  {
6995
7207
  id: "preview-frame",
6996
- className: getClassName22("frame"),
7208
+ className: getClassName23("frame"),
6997
7209
  "data-rfd-iframe": true,
6998
7210
  onReady: () => {
6999
7211
  setStatus("READY");
@@ -7002,18 +7214,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
7002
7214
  setStatus("MOUNTED");
7003
7215
  },
7004
7216
  frameRef: ref,
7005
- children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7217
+ children: /* @__PURE__ */ jsx34(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7006
7218
  if (Frame) {
7007
- return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
7219
+ return /* @__PURE__ */ jsx34(Frame, { document: document2, children: inner });
7008
7220
  }
7009
7221
  return inner;
7010
7222
  } })
7011
7223
  }
7012
- ) : /* @__PURE__ */ jsx32(
7224
+ ) : /* @__PURE__ */ jsx34(
7013
7225
  "div",
7014
7226
  {
7015
7227
  id: "preview-frame",
7016
- className: getClassName22("frame"),
7228
+ className: getClassName23("frame"),
7017
7229
  ref,
7018
7230
  "data-puck-entry": true,
7019
7231
  children: inner
@@ -7031,7 +7243,7 @@ init_react_import();
7031
7243
 
7032
7244
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
7033
7245
  init_react_import();
7034
- var styles_module_default18 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
7246
+ var styles_module_default19 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
7035
7247
 
7036
7248
  // lib/scroll-into-view.ts
7037
7249
  init_react_import();
@@ -7045,7 +7257,7 @@ var scrollIntoView = (el) => {
7045
7257
  };
7046
7258
 
7047
7259
  // components/LayerTree/index.tsx
7048
- import { useCallback as useCallback15, useContext as useContext11 } from "react";
7260
+ import { useCallback as useCallback14, useContext as useContext11 } from "react";
7049
7261
 
7050
7262
  // lib/on-scroll-end.ts
7051
7263
  init_react_import();
@@ -7067,10 +7279,10 @@ var onScrollEnd = (frame, cb) => {
7067
7279
  };
7068
7280
 
7069
7281
  // components/LayerTree/index.tsx
7070
- import { useShallow as useShallow7 } from "zustand/react/shallow";
7071
- import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
7072
- var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
7073
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
7282
+ import { useShallow as useShallow6 } from "zustand/react/shallow";
7283
+ import { Fragment as Fragment11, jsx as jsx35, jsxs as jsxs15 } from "react/jsx-runtime";
7284
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
7285
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
7074
7286
  var Layer = ({
7075
7287
  index,
7076
7288
  itemId,
@@ -7080,7 +7292,7 @@ var Layer = ({
7080
7292
  const config = useAppStore((s) => s.config);
7081
7293
  const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
7082
7294
  const dispatch = useAppStore((s) => s.dispatch);
7083
- const setItemSelector = useCallback15(
7295
+ const setItemSelector = useCallback14(
7084
7296
  (itemSelector2) => {
7085
7297
  dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
7086
7298
  },
@@ -7093,7 +7305,7 @@ var Layer = ({
7093
7305
  const isSelected = selecedItemId === itemId || itemSelector && itemSelector.zone === rootDroppableId && !zoneCompound;
7094
7306
  const nodeData = useAppStore((s) => s.state.indexes.nodes[itemId]);
7095
7307
  const zonesForItem = useAppStore(
7096
- useShallow7(
7308
+ useShallow6(
7097
7309
  (s) => Object.keys(s.state.indexes.zones).filter(
7098
7310
  (z) => z.split(":")[0] === itemId
7099
7311
  )
@@ -7125,7 +7337,7 @@ var Layer = ({
7125
7337
  childIsSelected
7126
7338
  }),
7127
7339
  children: [
7128
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs15(
7340
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs15(
7129
7341
  "button",
7130
7342
  {
7131
7343
  type: "button",
@@ -7163,22 +7375,22 @@ var Layer = ({
7163
7375
  zoneStore.setState({ hoveringComponent: null });
7164
7376
  },
7165
7377
  children: [
7166
- containsZone && /* @__PURE__ */ jsx33(
7378
+ containsZone && /* @__PURE__ */ jsx35(
7167
7379
  "div",
7168
7380
  {
7169
7381
  className: getClassNameLayer("chevron"),
7170
7382
  title: isSelected ? "Collapse" : "Expand",
7171
- children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
7383
+ children: /* @__PURE__ */ jsx35(ChevronDown, { size: "12" })
7172
7384
  }
7173
7385
  ),
7174
7386
  /* @__PURE__ */ jsxs15("div", { className: getClassNameLayer("title"), children: [
7175
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ jsx33(Type, { size: "16" }) : /* @__PURE__ */ jsx33(LayoutGrid, { size: "16" }) }),
7176
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label })
7387
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ jsx35(Type, { size: "16" }) : /* @__PURE__ */ jsx35(LayoutGrid, { size: "16" }) }),
7388
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("name"), children: label })
7177
7389
  ] })
7178
7390
  ]
7179
7391
  }
7180
7392
  ) }),
7181
- containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(LayerTree, { zoneCompound: subzone }) }, subzone))
7393
+ containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx35(LayerTree, { zoneCompound: subzone }) }, subzone))
7182
7394
  ]
7183
7395
  }
7184
7396
  );
@@ -7197,7 +7409,7 @@ var LayerTree = ({
7197
7409
  return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
7198
7410
  });
7199
7411
  const contentIds = useAppStore(
7200
- useShallow7(
7412
+ useShallow6(
7201
7413
  (s) => {
7202
7414
  var _a, _b;
7203
7415
  return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
@@ -7205,14 +7417,14 @@ var LayerTree = ({
7205
7417
  )
7206
7418
  );
7207
7419
  return /* @__PURE__ */ jsxs15(Fragment11, { children: [
7208
- label && /* @__PURE__ */ jsxs15("div", { className: getClassName23("zoneTitle"), children: [
7209
- /* @__PURE__ */ jsx33("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
7420
+ label && /* @__PURE__ */ jsxs15("div", { className: getClassName24("zoneTitle"), children: [
7421
+ /* @__PURE__ */ jsx35("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx35(Layers, { size: "16" }) }),
7210
7422
  label
7211
7423
  ] }),
7212
- /* @__PURE__ */ jsxs15("ul", { className: getClassName23(), children: [
7213
- contentIds.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName23("helper"), children: "No items" }),
7424
+ /* @__PURE__ */ jsxs15("ul", { className: getClassName24(), children: [
7425
+ contentIds.length === 0 && /* @__PURE__ */ jsx35("div", { className: getClassName24("helper"), children: "No items" }),
7214
7426
  contentIds.map((itemId, i) => {
7215
- return /* @__PURE__ */ jsx33(
7427
+ return /* @__PURE__ */ jsx35(
7216
7428
  Layer,
7217
7429
  {
7218
7430
  index: i,
@@ -7238,15 +7450,15 @@ var findZonesForArea = (state, area) => {
7238
7450
  };
7239
7451
 
7240
7452
  // components/Puck/components/Outline/index.tsx
7241
- import { useShallow as useShallow8 } from "zustand/react/shallow";
7242
- import { jsx as jsx34 } from "react/jsx-runtime";
7453
+ import { useShallow as useShallow7 } from "zustand/react/shallow";
7454
+ import { jsx as jsx36 } from "react/jsx-runtime";
7243
7455
  var Outline = () => {
7244
7456
  const outlineOverride = useAppStore((s) => s.overrides.outline);
7245
7457
  const rootZones = useAppStore(
7246
- useShallow8((s) => findZonesForArea(s.state, "root"))
7458
+ useShallow7((s) => findZonesForArea(s.state, "root"))
7247
7459
  );
7248
7460
  const Wrapper = useMemo14(() => outlineOverride || "div", [outlineOverride]);
7249
- return /* @__PURE__ */ jsx34(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx34(
7461
+ return /* @__PURE__ */ jsx36(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx36(
7250
7462
  LayerTree,
7251
7463
  {
7252
7464
  label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
@@ -7259,30 +7471,30 @@ var Outline = () => {
7259
7471
  // components/Puck/components/Canvas/index.tsx
7260
7472
  init_react_import();
7261
7473
  import {
7262
- useCallback as useCallback16,
7263
- useEffect as useEffect24,
7474
+ useCallback as useCallback15,
7475
+ useEffect as useEffect25,
7264
7476
  useMemo as useMemo17,
7265
- useRef as useRef8,
7266
- useState as useState20
7477
+ useRef as useRef9,
7478
+ useState as useState21
7267
7479
  } from "react";
7268
7480
 
7269
7481
  // components/ViewportControls/index.tsx
7270
7482
  init_react_import();
7271
- import { useEffect as useEffect23, useMemo as useMemo15, useState as useState19 } from "react";
7483
+ import { useEffect as useEffect24, useMemo as useMemo15, useState as useState20 } from "react";
7272
7484
 
7273
7485
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7274
7486
  init_react_import();
7275
- var styles_module_default19 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
7487
+ var styles_module_default20 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
7276
7488
 
7277
7489
  // components/ViewportControls/index.tsx
7278
- import { jsx as jsx35, jsxs as jsxs16 } from "react/jsx-runtime";
7490
+ import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
7279
7491
  var icons = {
7280
- Smartphone: /* @__PURE__ */ jsx35(Smartphone, { size: 16 }),
7281
- Tablet: /* @__PURE__ */ jsx35(Tablet, { size: 16 }),
7282
- Monitor: /* @__PURE__ */ jsx35(Monitor, { size: 16 })
7492
+ Smartphone: /* @__PURE__ */ jsx37(Smartphone, { size: 16 }),
7493
+ Tablet: /* @__PURE__ */ jsx37(Tablet, { size: 16 }),
7494
+ Monitor: /* @__PURE__ */ jsx37(Monitor, { size: 16 })
7283
7495
  };
7284
- var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
7285
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
7496
+ var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
7497
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
7286
7498
  var ViewportButton = ({
7287
7499
  children,
7288
7500
  height = "auto",
@@ -7291,11 +7503,11 @@ var ViewportButton = ({
7291
7503
  onClick
7292
7504
  }) => {
7293
7505
  const viewports = useAppStore((s) => s.state.ui.viewports);
7294
- const [isActive, setIsActive] = useState19(false);
7295
- useEffect23(() => {
7506
+ const [isActive, setIsActive] = useState20(false);
7507
+ useEffect24(() => {
7296
7508
  setIsActive(width === viewports.current.width);
7297
7509
  }, [width, viewports.current.width]);
7298
- return /* @__PURE__ */ jsx35("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx35(
7510
+ return /* @__PURE__ */ jsx37("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx37(
7299
7511
  IconButton,
7300
7512
  {
7301
7513
  type: "button",
@@ -7305,7 +7517,7 @@ var ViewportButton = ({
7305
7517
  e.stopPropagation();
7306
7518
  onClick({ width, height });
7307
7519
  },
7308
- children: /* @__PURE__ */ jsx35("span", { className: getClassNameButton("inner"), children })
7520
+ children: /* @__PURE__ */ jsx37("span", { className: getClassNameButton("inner"), children })
7309
7521
  }
7310
7522
  ) });
7311
7523
  };
@@ -7341,8 +7553,8 @@ var ViewportControls = ({
7341
7553
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7342
7554
  [autoZoom]
7343
7555
  );
7344
- return /* @__PURE__ */ jsxs16("div", { className: getClassName24(), children: [
7345
- viewports.map((viewport, i) => /* @__PURE__ */ jsx35(
7556
+ return /* @__PURE__ */ jsxs16("div", { className: getClassName25(), children: [
7557
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx37(
7346
7558
  ViewportButton,
7347
7559
  {
7348
7560
  height: viewport.height,
@@ -7353,8 +7565,8 @@ var ViewportControls = ({
7353
7565
  },
7354
7566
  i
7355
7567
  )),
7356
- /* @__PURE__ */ jsx35("div", { className: getClassName24("divider") }),
7357
- /* @__PURE__ */ jsx35(
7568
+ /* @__PURE__ */ jsx37("div", { className: getClassName25("divider") }),
7569
+ /* @__PURE__ */ jsx37(
7358
7570
  IconButton,
7359
7571
  {
7360
7572
  type: "button",
@@ -7369,10 +7581,10 @@ var ViewportControls = ({
7369
7581
  )].value
7370
7582
  );
7371
7583
  },
7372
- children: /* @__PURE__ */ jsx35(ZoomOut, { size: 16 })
7584
+ children: /* @__PURE__ */ jsx37(ZoomOut, { size: 16 })
7373
7585
  }
7374
7586
  ),
7375
- /* @__PURE__ */ jsx35(
7587
+ /* @__PURE__ */ jsx37(
7376
7588
  IconButton,
7377
7589
  {
7378
7590
  type: "button",
@@ -7387,19 +7599,19 @@ var ViewportControls = ({
7387
7599
  )].value
7388
7600
  );
7389
7601
  },
7390
- children: /* @__PURE__ */ jsx35(ZoomIn, { size: 16 })
7602
+ children: /* @__PURE__ */ jsx37(ZoomIn, { size: 16 })
7391
7603
  }
7392
7604
  ),
7393
- /* @__PURE__ */ jsx35("div", { className: getClassName24("divider") }),
7394
- /* @__PURE__ */ jsx35(
7605
+ /* @__PURE__ */ jsx37("div", { className: getClassName25("divider") }),
7606
+ /* @__PURE__ */ jsx37(
7395
7607
  "select",
7396
7608
  {
7397
- className: getClassName24("zoomSelect"),
7609
+ className: getClassName25("zoomSelect"),
7398
7610
  value: zoom.toString(),
7399
7611
  onChange: (e) => {
7400
7612
  onZoom(parseFloat(e.currentTarget.value));
7401
7613
  },
7402
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx35(
7614
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx37(
7403
7615
  "option",
7404
7616
  {
7405
7617
  value: option.value,
@@ -7414,32 +7626,32 @@ var ViewportControls = ({
7414
7626
 
7415
7627
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
7416
7628
  init_react_import();
7417
- var styles_module_default20 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
7629
+ var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
7418
7630
 
7419
7631
  // components/Puck/components/Canvas/index.tsx
7420
- import { useShallow as useShallow9 } from "zustand/react/shallow";
7632
+ import { useShallow as useShallow8 } from "zustand/react/shallow";
7421
7633
 
7422
7634
  // lib/frame-context.tsx
7423
7635
  init_react_import();
7424
7636
  import {
7425
7637
  createContext as createContext7,
7426
7638
  useContext as useContext12,
7427
- useRef as useRef7,
7639
+ useRef as useRef8,
7428
7640
  useMemo as useMemo16
7429
7641
  } from "react";
7430
- import { jsx as jsx36 } from "react/jsx-runtime";
7642
+ import { jsx as jsx38 } from "react/jsx-runtime";
7431
7643
  var FrameContext = createContext7(null);
7432
7644
  var FrameProvider = ({
7433
7645
  children
7434
7646
  }) => {
7435
- const frameRef = useRef7(null);
7647
+ const frameRef = useRef8(null);
7436
7648
  const value = useMemo16(
7437
7649
  () => ({
7438
7650
  frameRef
7439
7651
  }),
7440
7652
  []
7441
7653
  );
7442
- return /* @__PURE__ */ jsx36(FrameContext.Provider, { value, children });
7654
+ return /* @__PURE__ */ jsx38(FrameContext.Provider, { value, children });
7443
7655
  };
7444
7656
  var useCanvasFrame = () => {
7445
7657
  const context = useContext12(FrameContext);
@@ -7450,9 +7662,10 @@ var useCanvasFrame = () => {
7450
7662
  };
7451
7663
 
7452
7664
  // components/Puck/components/Canvas/index.tsx
7453
- import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
7454
- var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
7665
+ import { Fragment as Fragment12, jsx as jsx39, jsxs as jsxs17 } from "react/jsx-runtime";
7666
+ var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
7455
7667
  var ZOOM_ON_CHANGE = true;
7668
+ var TRANSITION_DURATION = 150;
7456
7669
  var Canvas = () => {
7457
7670
  const { frameRef } = useCanvasFrame();
7458
7671
  const resetAutoZoom = useResetAutoZoom(frameRef);
@@ -7465,7 +7678,7 @@ var Canvas = () => {
7465
7678
  status,
7466
7679
  iframe
7467
7680
  } = useAppStore(
7468
- useShallow9((s) => ({
7681
+ useShallow8((s) => ({
7469
7682
  dispatch: s.dispatch,
7470
7683
  overrides: s.overrides,
7471
7684
  setUi: s.setUi,
@@ -7482,7 +7695,7 @@ var Canvas = () => {
7482
7695
  rightSideBarWidth,
7483
7696
  viewports
7484
7697
  } = useAppStore(
7485
- useShallow9((s) => ({
7698
+ useShallow8((s) => ({
7486
7699
  leftSideBarVisible: s.state.ui.leftSideBarVisible,
7487
7700
  rightSideBarVisible: s.state.ui.rightSideBarVisible,
7488
7701
  leftSideBarWidth: s.state.ui.leftSideBarWidth,
@@ -7490,17 +7703,17 @@ var Canvas = () => {
7490
7703
  viewports: s.state.ui.viewports
7491
7704
  }))
7492
7705
  );
7493
- const [showTransition, setShowTransition] = useState20(false);
7494
- const isResettingZoomRef = useRef8(false);
7706
+ const [showTransition, setShowTransition] = useState21(false);
7707
+ const isResizingRef = useRef9(false);
7495
7708
  const defaultRender = useMemo17(() => {
7496
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment12, { children });
7709
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx39(Fragment12, { children });
7497
7710
  return PuckDefault;
7498
7711
  }, []);
7499
7712
  const CustomPreview = useMemo17(
7500
7713
  () => overrides.preview || defaultRender,
7501
7714
  [overrides]
7502
7715
  );
7503
- const getFrameDimensions = useCallback16(() => {
7716
+ const getFrameDimensions = useCallback15(() => {
7504
7717
  if (frameRef.current) {
7505
7718
  const frame = frameRef.current;
7506
7719
  const box = getBox(frame);
@@ -7508,23 +7721,17 @@ var Canvas = () => {
7508
7721
  }
7509
7722
  return { width: 0, height: 0 };
7510
7723
  }, [frameRef]);
7511
- useEffect24(() => {
7512
- resetAutoZoom({
7513
- isResettingRef: isResettingZoomRef,
7514
- setShowTransition,
7515
- showTransition: false,
7516
- viewports
7517
- });
7724
+ useEffect25(() => {
7725
+ resetAutoZoom();
7518
7726
  }, [
7519
7727
  frameRef,
7520
7728
  leftSideBarVisible,
7521
7729
  rightSideBarVisible,
7522
7730
  leftSideBarWidth,
7523
7731
  rightSideBarWidth,
7524
- resetAutoZoom,
7525
7732
  viewports
7526
7733
  ]);
7527
- useEffect24(() => {
7734
+ useEffect25(() => {
7528
7735
  const { height: frameHeight } = getFrameDimensions();
7529
7736
  if (viewports.current.height === "auto") {
7530
7737
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -7532,31 +7739,25 @@ var Canvas = () => {
7532
7739
  }));
7533
7740
  }
7534
7741
  }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
7535
- useEffect24(() => {
7742
+ useEffect25(() => {
7536
7743
  if (ZOOM_ON_CHANGE) {
7537
- resetAutoZoom({
7538
- isResettingRef: isResettingZoomRef,
7539
- setShowTransition,
7540
- showTransition: true,
7541
- viewports
7542
- });
7744
+ resetAutoZoom();
7543
7745
  }
7544
- }, [viewports.current.width, resetAutoZoom, viewports]);
7545
- useEffect24(() => {
7546
- const cb = () => {
7547
- resetAutoZoom({
7548
- isResettingRef: isResettingZoomRef,
7549
- setShowTransition,
7550
- showTransition: false
7551
- });
7552
- };
7553
- window.addEventListener("resize", cb);
7746
+ }, [viewports.current.width, viewports]);
7747
+ useEffect25(() => {
7748
+ if (!frameRef.current) return;
7749
+ const resizeObserver = new ResizeObserver(() => {
7750
+ if (!isResizingRef.current) {
7751
+ resetAutoZoom();
7752
+ }
7753
+ });
7754
+ resizeObserver.observe(frameRef.current);
7554
7755
  return () => {
7555
- window.removeEventListener("resize", cb);
7756
+ resizeObserver.disconnect();
7556
7757
  };
7557
- }, [resetAutoZoom]);
7558
- const [showLoader, setShowLoader] = useState20(false);
7559
- useEffect24(() => {
7758
+ }, [frameRef.current]);
7759
+ const [showLoader, setShowLoader] = useState21(false);
7760
+ useEffect25(() => {
7560
7761
  setTimeout(() => {
7561
7762
  setShowLoader(true);
7562
7763
  }, 500);
@@ -7564,23 +7765,29 @@ var Canvas = () => {
7564
7765
  return /* @__PURE__ */ jsxs17(
7565
7766
  "div",
7566
7767
  {
7567
- className: getClassName25({
7768
+ className: getClassName26({
7568
7769
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
7569
7770
  showLoader
7570
7771
  }),
7571
- onClick: () => dispatch({
7572
- type: "setUi",
7573
- ui: { itemSelector: null },
7574
- recordHistory: true
7575
- }),
7772
+ onClick: (e) => {
7773
+ const el = e.target;
7774
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
7775
+ dispatch({
7776
+ type: "setUi",
7777
+ ui: { itemSelector: null },
7778
+ recordHistory: true
7779
+ });
7780
+ }
7781
+ },
7576
7782
  children: [
7577
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName25("controls"), children: /* @__PURE__ */ jsx37(
7783
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx39("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx39(
7578
7784
  ViewportControls,
7579
7785
  {
7580
7786
  autoZoom: zoomConfig.autoZoom,
7581
7787
  zoom: zoomConfig.zoom,
7582
7788
  onViewportChange: (viewport) => {
7583
7789
  setShowTransition(true);
7790
+ isResizingRef.current = true;
7584
7791
  const uiViewport = __spreadProps(__spreadValues({}, viewport), {
7585
7792
  height: viewport.height || "auto",
7586
7793
  zoom: zoomConfig.zoom
@@ -7592,42 +7799,39 @@ var Canvas = () => {
7592
7799
  setUi(newUi);
7593
7800
  if (ZOOM_ON_CHANGE) {
7594
7801
  resetAutoZoom({
7595
- isResettingRef: isResettingZoomRef,
7596
- setShowTransition,
7597
- showTransition: true,
7598
7802
  viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
7599
7803
  });
7600
7804
  }
7601
7805
  },
7602
7806
  onZoom: (zoom) => {
7603
7807
  setShowTransition(true);
7808
+ isResizingRef.current = true;
7604
7809
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
7605
7810
  }
7606
7811
  }
7607
7812
  ) }),
7608
- /* @__PURE__ */ jsxs17("div", { className: getClassName25("inner"), ref: frameRef, children: [
7609
- /* @__PURE__ */ jsx37(
7813
+ /* @__PURE__ */ jsxs17("div", { className: getClassName26("inner"), ref: frameRef, children: [
7814
+ /* @__PURE__ */ jsx39(
7610
7815
  "div",
7611
7816
  {
7612
- className: getClassName25("root"),
7817
+ className: getClassName26("root"),
7613
7818
  style: {
7614
7819
  width: iframe.enabled ? viewports.current.width : "100%",
7615
7820
  height: zoomConfig.rootHeight,
7616
7821
  transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
7617
- transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
7822
+ transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, height ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : "",
7618
7823
  overflow: iframe.enabled ? void 0 : "auto"
7619
7824
  },
7620
7825
  suppressHydrationWarning: true,
7621
7826
  id: "puck-canvas-root",
7622
7827
  onTransitionEnd: () => {
7623
- resetAutoZoom({
7624
- isResettingRef: isResettingZoomRef
7625
- });
7828
+ setShowTransition(false);
7829
+ isResizingRef.current = false;
7626
7830
  },
7627
- children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview2, {}) })
7831
+ children: /* @__PURE__ */ jsx39(CustomPreview, { children: /* @__PURE__ */ jsx39(Preview2, {}) })
7628
7832
  }
7629
7833
  ),
7630
- /* @__PURE__ */ jsx37("div", { className: getClassName25("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
7834
+ /* @__PURE__ */ jsx39("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx39(Loader, { size: 24 }) })
7631
7835
  ] })
7632
7836
  ]
7633
7837
  }
@@ -7646,8 +7850,11 @@ var loadOverrides = ({
7646
7850
  }) => {
7647
7851
  const collected = __spreadValues({}, overrides);
7648
7852
  plugins == null ? void 0 : plugins.forEach((plugin) => {
7853
+ if (!plugin.overrides) return;
7649
7854
  Object.keys(plugin.overrides).forEach((_overridesType) => {
7855
+ var _a;
7650
7856
  const overridesType = _overridesType;
7857
+ if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
7651
7858
  if (overridesType === "fieldTypes") {
7652
7859
  const fieldTypes = plugin.overrides.fieldTypes;
7653
7860
  Object.keys(fieldTypes).forEach((fieldType) => {
@@ -7682,19 +7889,19 @@ var useLoadedOverrides = ({
7682
7889
 
7683
7890
  // components/DefaultOverride/index.tsx
7684
7891
  init_react_import();
7685
- import { Fragment as Fragment13, jsx as jsx38 } from "react/jsx-runtime";
7686
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment13, { children });
7892
+ import { Fragment as Fragment13, jsx as jsx40 } from "react/jsx-runtime";
7893
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx40(Fragment13, { children });
7687
7894
 
7688
7895
  // lib/use-inject-css.ts
7689
7896
  init_react_import();
7690
- import { useEffect as useEffect25, useState as useState21 } from "react";
7897
+ import { useEffect as useEffect26, useState as useState22 } from "react";
7691
7898
  var styles = ``;
7692
7899
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7693
- const [el, setEl] = useState21();
7694
- useEffect25(() => {
7900
+ const [el, setEl] = useState22();
7901
+ useEffect26(() => {
7695
7902
  setEl(document.createElement("style"));
7696
7903
  }, []);
7697
- useEffect25(() => {
7904
+ useEffect26(() => {
7698
7905
  var _a;
7699
7906
  if (!el || typeof window === "undefined") {
7700
7907
  return;
@@ -7714,10 +7921,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
7714
7921
 
7715
7922
  // lib/use-preview-mode-hotkeys.ts
7716
7923
  init_react_import();
7717
- import { useCallback as useCallback17 } from "react";
7924
+ import { useCallback as useCallback16 } from "react";
7718
7925
  var usePreviewModeHotkeys = () => {
7719
7926
  const appStore = useAppStoreApi();
7720
- const toggleInteractive = useCallback17(() => {
7927
+ const toggleInteractive = useCallback16(() => {
7721
7928
  const dispatch = appStore.getState().dispatch;
7722
7929
  dispatch({
7723
7930
  type: "setUi",
@@ -7735,18 +7942,18 @@ import fdeq from "fast-deep-equal";
7735
7942
 
7736
7943
  // components/Puck/components/Header/index.tsx
7737
7944
  init_react_import();
7738
- import { memo as memo3, useCallback as useCallback18, useMemo as useMemo19, useState as useState22 } from "react";
7945
+ import { memo as memo4, useCallback as useCallback17, useMemo as useMemo19, useState as useState23 } from "react";
7739
7946
 
7740
7947
  // components/MenuBar/index.tsx
7741
7948
  init_react_import();
7742
7949
 
7743
7950
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
7744
7951
  init_react_import();
7745
- 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" };
7952
+ var styles_module_default22 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
7746
7953
 
7747
7954
  // components/MenuBar/index.tsx
7748
- import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
7749
- var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
7955
+ import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
7956
+ var getClassName27 = get_class_name_factory_default("MenuBar", styles_module_default22);
7750
7957
  function MenuBar({
7751
7958
  menuOpen = false,
7752
7959
  renderHeaderActions,
@@ -7756,10 +7963,10 @@ function MenuBar({
7756
7963
  const forward = useAppStore((s) => s.history.forward);
7757
7964
  const hasFuture = useAppStore((s) => s.history.hasFuture());
7758
7965
  const hasPast = useAppStore((s) => s.history.hasPast());
7759
- return /* @__PURE__ */ jsx39(
7966
+ return /* @__PURE__ */ jsx41(
7760
7967
  "div",
7761
7968
  {
7762
- className: getClassName26({ menuOpen }),
7969
+ className: getClassName27({ menuOpen }),
7763
7970
  onClick: (event) => {
7764
7971
  var _a;
7765
7972
  const element = event.target;
@@ -7770,30 +7977,30 @@ function MenuBar({
7770
7977
  setMenuOpen(false);
7771
7978
  }
7772
7979
  },
7773
- children: /* @__PURE__ */ jsxs18("div", { className: getClassName26("inner"), children: [
7774
- /* @__PURE__ */ jsxs18("div", { className: getClassName26("history"), children: [
7775
- /* @__PURE__ */ jsx39(
7980
+ children: /* @__PURE__ */ jsxs18("div", { className: getClassName27("inner"), children: [
7981
+ /* @__PURE__ */ jsxs18("div", { className: getClassName27("history"), children: [
7982
+ /* @__PURE__ */ jsx41(
7776
7983
  IconButton,
7777
7984
  {
7778
7985
  type: "button",
7779
7986
  title: "undo",
7780
7987
  disabled: !hasPast,
7781
7988
  onClick: back,
7782
- children: /* @__PURE__ */ jsx39(Undo2, { size: 21 })
7989
+ children: /* @__PURE__ */ jsx41(Undo2, { size: 21 })
7783
7990
  }
7784
7991
  ),
7785
- /* @__PURE__ */ jsx39(
7992
+ /* @__PURE__ */ jsx41(
7786
7993
  IconButton,
7787
7994
  {
7788
7995
  type: "button",
7789
7996
  title: "redo",
7790
7997
  disabled: !hasFuture,
7791
7998
  onClick: forward,
7792
- children: /* @__PURE__ */ jsx39(Redo2, { size: 21 })
7999
+ children: /* @__PURE__ */ jsx41(Redo2, { size: 21 })
7793
8000
  }
7794
8001
  )
7795
8002
  ] }),
7796
- /* @__PURE__ */ jsx39(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
8003
+ /* @__PURE__ */ jsx41(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
7797
8004
  ] })
7798
8005
  }
7799
8006
  );
@@ -7801,11 +8008,11 @@ function MenuBar({
7801
8008
 
7802
8009
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
7803
8010
  init_react_import();
7804
- 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" };
8011
+ var styles_module_default23 = { "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" };
7805
8012
 
7806
8013
  // components/Puck/components/Header/index.tsx
7807
- import { Fragment as Fragment15, jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
7808
- var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
8014
+ import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs19 } from "react/jsx-runtime";
8015
+ var getClassName28 = get_class_name_factory_default("PuckHeader", styles_module_default23);
7809
8016
  var HeaderInner = () => {
7810
8017
  const {
7811
8018
  onPublish,
@@ -7826,7 +8033,7 @@ var HeaderInner = () => {
7826
8033
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
7827
8034
  const Comp = renderHeader;
7828
8035
  const appState = useAppStore((s) => s.state);
7829
- return /* @__PURE__ */ jsx40(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8036
+ return /* @__PURE__ */ jsx42(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7830
8037
  };
7831
8038
  return RenderHeader;
7832
8039
  }
@@ -7840,19 +8047,19 @@ var HeaderInner = () => {
7840
8047
  const RenderHeader = (props) => {
7841
8048
  const Comp = renderHeaderActions;
7842
8049
  const appState = useAppStore((s) => s.state);
7843
- return /* @__PURE__ */ jsx40(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8050
+ return /* @__PURE__ */ jsx42(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7844
8051
  };
7845
8052
  return RenderHeader;
7846
8053
  }
7847
8054
  return DefaultOverride;
7848
- }, [renderHeader]);
8055
+ }, [renderHeaderActions]);
7849
8056
  const CustomHeader = useAppStore(
7850
8057
  (s) => s.overrides.header || defaultHeaderRender
7851
8058
  );
7852
8059
  const CustomHeaderActions = useAppStore(
7853
8060
  (s) => s.overrides.headerActions || defaultHeaderActionsRender
7854
8061
  );
7855
- const [menuOpen, setMenuOpen] = useState22(false);
8062
+ const [menuOpen, setMenuOpen] = useState23(false);
7856
8063
  const rootTitle = useAppStore((s) => {
7857
8064
  var _a, _b;
7858
8065
  const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
@@ -7862,7 +8069,7 @@ var HeaderInner = () => {
7862
8069
  const rightSideBarVisible = useAppStore(
7863
8070
  (s) => s.state.ui.rightSideBarVisible
7864
8071
  );
7865
- const toggleSidebars = useCallback18(
8072
+ const toggleSidebars = useCallback17(
7866
8073
  (sidebar) => {
7867
8074
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
7868
8075
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7876,27 +8083,27 @@ var HeaderInner = () => {
7876
8083
  },
7877
8084
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7878
8085
  );
7879
- return /* @__PURE__ */ jsx40(
8086
+ return /* @__PURE__ */ jsx42(
7880
8087
  CustomHeader,
7881
8088
  {
7882
- actions: /* @__PURE__ */ jsx40(Fragment15, { children: /* @__PURE__ */ jsx40(CustomHeaderActions, { children: /* @__PURE__ */ jsx40(
8089
+ actions: /* @__PURE__ */ jsx42(Fragment15, { children: /* @__PURE__ */ jsx42(CustomHeaderActions, { children: /* @__PURE__ */ jsx42(
7883
8090
  Button,
7884
8091
  {
7885
8092
  onClick: () => {
7886
8093
  const data = appStore.getState().state.data;
7887
8094
  onPublish && onPublish(data);
7888
8095
  },
7889
- icon: /* @__PURE__ */ jsx40(Globe, { size: "14px" }),
8096
+ icon: /* @__PURE__ */ jsx42(Globe, { size: "14px" }),
7890
8097
  children: "Publish"
7891
8098
  }
7892
8099
  ) }) }),
7893
- children: /* @__PURE__ */ jsx40(
8100
+ children: /* @__PURE__ */ jsx42(
7894
8101
  "header",
7895
8102
  {
7896
- className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
7897
- children: /* @__PURE__ */ jsxs19("div", { className: getClassName27("inner"), children: [
7898
- /* @__PURE__ */ jsxs19("div", { className: getClassName27("toggle"), children: [
7899
- /* @__PURE__ */ jsx40("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ jsx40(
8103
+ className: getClassName28({ leftSideBarVisible, rightSideBarVisible }),
8104
+ children: /* @__PURE__ */ jsxs19("div", { className: getClassName28("inner"), children: [
8105
+ /* @__PURE__ */ jsxs19("div", { className: getClassName28("toggle"), children: [
8106
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("leftSideBarToggle"), children: /* @__PURE__ */ jsx42(
7900
8107
  IconButton,
7901
8108
  {
7902
8109
  type: "button",
@@ -7904,10 +8111,10 @@ var HeaderInner = () => {
7904
8111
  toggleSidebars("left");
7905
8112
  },
7906
8113
  title: "Toggle left sidebar",
7907
- children: /* @__PURE__ */ jsx40(PanelLeft, { focusable: "false" })
8114
+ children: /* @__PURE__ */ jsx42(PanelLeft, { focusable: "false" })
7908
8115
  }
7909
8116
  ) }),
7910
- /* @__PURE__ */ jsx40("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ jsx40(
8117
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("rightSideBarToggle"), children: /* @__PURE__ */ jsx42(
7911
8118
  IconButton,
7912
8119
  {
7913
8120
  type: "button",
@@ -7915,19 +8122,19 @@ var HeaderInner = () => {
7915
8122
  toggleSidebars("right");
7916
8123
  },
7917
8124
  title: "Toggle right sidebar",
7918
- children: /* @__PURE__ */ jsx40(PanelRight, { focusable: "false" })
8125
+ children: /* @__PURE__ */ jsx42(PanelRight, { focusable: "false" })
7919
8126
  }
7920
8127
  ) })
7921
8128
  ] }),
7922
- /* @__PURE__ */ jsx40("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs19(Heading, { rank: "2", size: "xs", children: [
8129
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs19(Heading, { rank: "2", size: "xs", children: [
7923
8130
  headerTitle || rootTitle || "Page",
7924
8131
  headerPath && /* @__PURE__ */ jsxs19(Fragment15, { children: [
7925
8132
  " ",
7926
- /* @__PURE__ */ jsx40("code", { className: getClassName27("path"), children: headerPath })
8133
+ /* @__PURE__ */ jsx42("code", { className: getClassName28("path"), children: headerPath })
7927
8134
  ] })
7928
8135
  ] }) }),
7929
- /* @__PURE__ */ jsxs19("div", { className: getClassName27("tools"), children: [
7930
- /* @__PURE__ */ jsx40("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ jsx40(
8136
+ /* @__PURE__ */ jsxs19("div", { className: getClassName28("tools"), children: [
8137
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("menuButton"), children: /* @__PURE__ */ jsx42(
7931
8138
  IconButton,
7932
8139
  {
7933
8140
  type: "button",
@@ -7935,23 +8142,23 @@ var HeaderInner = () => {
7935
8142
  return setMenuOpen(!menuOpen);
7936
8143
  },
7937
8144
  title: "Toggle menu bar",
7938
- children: menuOpen ? /* @__PURE__ */ jsx40(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx40(ChevronDown, { focusable: "false" })
8145
+ children: menuOpen ? /* @__PURE__ */ jsx42(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx42(ChevronDown, { focusable: "false" })
7939
8146
  }
7940
8147
  ) }),
7941
- /* @__PURE__ */ jsx40(
8148
+ /* @__PURE__ */ jsx42(
7942
8149
  MenuBar,
7943
8150
  {
7944
8151
  dispatch,
7945
8152
  onPublish,
7946
8153
  menuOpen,
7947
- renderHeaderActions: () => /* @__PURE__ */ jsx40(CustomHeaderActions, { children: /* @__PURE__ */ jsx40(
8154
+ renderHeaderActions: () => /* @__PURE__ */ jsx42(CustomHeaderActions, { children: /* @__PURE__ */ jsx42(
7948
8155
  Button,
7949
8156
  {
7950
8157
  onClick: () => {
7951
8158
  const data = appStore.getState().state.data;
7952
8159
  onPublish && onPublish(data);
7953
8160
  },
7954
- icon: /* @__PURE__ */ jsx40(Globe, { size: "14px" }),
8161
+ icon: /* @__PURE__ */ jsx42(Globe, { size: "14px" }),
7955
8162
  children: "Publish"
7956
8163
  }
7957
8164
  ) }),
@@ -7965,22 +8172,22 @@ var HeaderInner = () => {
7965
8172
  }
7966
8173
  );
7967
8174
  };
7968
- var Header = memo3(HeaderInner);
8175
+ var Header = memo4(HeaderInner);
7969
8176
 
7970
8177
  // components/Puck/components/Sidebar/index.tsx
7971
8178
  init_react_import();
7972
8179
 
7973
8180
  // components/Puck/components/ResizeHandle/index.tsx
7974
8181
  init_react_import();
7975
- import { useCallback as useCallback19, useRef as useRef9 } from "react";
8182
+ import { useCallback as useCallback18, useRef as useRef10 } from "react";
7976
8183
 
7977
8184
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
7978
8185
  init_react_import();
7979
- var styles_module_default23 = { "ResizeHandle": "_ResizeHandle_v7w0r_1", "ResizeHandle--left": "_ResizeHandle--left_v7w0r_15", "ResizeHandle--right": "_ResizeHandle--right_v7w0r_19" };
8186
+ var styles_module_default24 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
7980
8187
 
7981
8188
  // components/Puck/components/ResizeHandle/index.tsx
7982
- import { jsx as jsx41 } from "react/jsx-runtime";
7983
- var getClassName28 = get_class_name_factory_default("ResizeHandle", styles_module_default23);
8189
+ import { jsx as jsx43 } from "react/jsx-runtime";
8190
+ var getClassName29 = get_class_name_factory_default("ResizeHandle", styles_module_default24);
7984
8191
  var ResizeHandle = ({
7985
8192
  position,
7986
8193
  sidebarRef,
@@ -7989,11 +8196,11 @@ var ResizeHandle = ({
7989
8196
  }) => {
7990
8197
  const { frameRef } = useCanvasFrame();
7991
8198
  const resetAutoZoom = useResetAutoZoom(frameRef);
7992
- const handleRef = useRef9(null);
7993
- const isDragging = useRef9(false);
7994
- const startX = useRef9(0);
7995
- const startWidth = useRef9(0);
7996
- const handleMouseMove = useCallback19(
8199
+ const handleRef = useRef10(null);
8200
+ const isDragging = useRef10(false);
8201
+ const startX = useRef10(0);
8202
+ const startWidth = useRef10(0);
8203
+ const handleMouseMove = useCallback18(
7997
8204
  (e) => {
7998
8205
  if (!isDragging.current) return;
7999
8206
  const delta = e.clientX - startX.current;
@@ -8004,7 +8211,7 @@ var ResizeHandle = ({
8004
8211
  },
8005
8212
  [onResize, position]
8006
8213
  );
8007
- const handleMouseUp = useCallback19(() => {
8214
+ const handleMouseUp = useCallback18(() => {
8008
8215
  var _a;
8009
8216
  if (!isDragging.current) return;
8010
8217
  isDragging.current = false;
@@ -8019,8 +8226,8 @@ var ResizeHandle = ({
8019
8226
  const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8020
8227
  onResizeEnd(finalWidth);
8021
8228
  resetAutoZoom();
8022
- }, [onResizeEnd, resetAutoZoom]);
8023
- const handleMouseDown = useCallback19(
8229
+ }, [onResizeEnd]);
8230
+ const handleMouseDown = useCallback18(
8024
8231
  (e) => {
8025
8232
  var _a;
8026
8233
  isDragging.current = true;
@@ -8038,11 +8245,11 @@ var ResizeHandle = ({
8038
8245
  },
8039
8246
  [position, handleMouseMove, handleMouseUp]
8040
8247
  );
8041
- return /* @__PURE__ */ jsx41(
8248
+ return /* @__PURE__ */ jsx43(
8042
8249
  "div",
8043
8250
  {
8044
8251
  ref: handleRef,
8045
- className: getClassName28({ [position]: true }),
8252
+ className: getClassName29({ [position]: true }),
8046
8253
  onMouseDown: handleMouseDown
8047
8254
  }
8048
8255
  );
@@ -8050,11 +8257,11 @@ var ResizeHandle = ({
8050
8257
 
8051
8258
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
8052
8259
  init_react_import();
8053
- 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" };
8260
+ var styles_module_default25 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
8054
8261
 
8055
8262
  // components/Puck/components/Sidebar/index.tsx
8056
- import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
8057
- var getClassName29 = get_class_name_factory_default("Sidebar", styles_module_default24);
8263
+ import { Fragment as Fragment16, jsx as jsx44, jsxs as jsxs20 } from "react/jsx-runtime";
8264
+ var getClassName30 = get_class_name_factory_default("Sidebar", styles_module_default25);
8058
8265
  var Sidebar = ({
8059
8266
  position,
8060
8267
  sidebarRef,
@@ -8066,8 +8273,8 @@ var Sidebar = ({
8066
8273
  }) => {
8067
8274
  if (!isVisible) return null;
8068
8275
  return /* @__PURE__ */ jsxs20(Fragment16, { children: [
8069
- /* @__PURE__ */ jsx42("div", { ref: sidebarRef, className: getClassName29({ [position]: true }), children }),
8070
- /* @__PURE__ */ jsx42("div", { className: `${getClassName29("resizeHandle")}`, children: /* @__PURE__ */ jsx42(
8276
+ /* @__PURE__ */ jsx44("div", { ref: sidebarRef, className: getClassName30({ [position]: true }), children }),
8277
+ /* @__PURE__ */ jsx44("div", { className: `${getClassName30("resizeHandle")}`, children: /* @__PURE__ */ jsx44(
8071
8278
  ResizeHandle,
8072
8279
  {
8073
8280
  position,
@@ -8081,25 +8288,26 @@ var Sidebar = ({
8081
8288
 
8082
8289
  // lib/use-sidebar-resize.ts
8083
8290
  init_react_import();
8084
- import { useCallback as useCallback20, useEffect as useEffect27, useRef as useRef10, useState as useState23 } from "react";
8291
+ import { useCallback as useCallback19, useEffect as useEffect28, useRef as useRef11, useState as useState24 } from "react";
8085
8292
  function useSidebarResize(position, dispatch) {
8086
- const [width, setWidth] = useState23(null);
8087
- const sidebarRef = useRef10(null);
8293
+ const [width, setWidth] = useState24(null);
8294
+ const sidebarRef = useRef11(null);
8088
8295
  const storeWidth = useAppStore(
8089
8296
  (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
8090
8297
  );
8091
- useEffect27(() => {
8298
+ useEffect28(() => {
8092
8299
  if (typeof window !== "undefined" && !storeWidth) {
8093
8300
  try {
8094
8301
  const savedWidths = localStorage.getItem("puck-sidebar-widths");
8095
8302
  if (savedWidths) {
8096
8303
  const widths = JSON.parse(savedWidths);
8097
8304
  const savedWidth = widths[position];
8305
+ const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
8098
8306
  if (savedWidth) {
8099
8307
  dispatch({
8100
8308
  type: "setUi",
8101
8309
  ui: {
8102
- [position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: savedWidth
8310
+ [key]: savedWidth
8103
8311
  }
8104
8312
  });
8105
8313
  }
@@ -8112,12 +8320,12 @@ function useSidebarResize(position, dispatch) {
8112
8320
  }
8113
8321
  }
8114
8322
  }, [dispatch, position, storeWidth]);
8115
- useEffect27(() => {
8323
+ useEffect28(() => {
8116
8324
  if (storeWidth !== void 0) {
8117
8325
  setWidth(storeWidth);
8118
8326
  }
8119
8327
  }, [storeWidth]);
8120
- const handleResizeEnd = useCallback20(
8328
+ const handleResizeEnd = useCallback19(
8121
8329
  (width2) => {
8122
8330
  dispatch({
8123
8331
  type: "setUi",
@@ -8160,9 +8368,9 @@ function useSidebarResize(position, dispatch) {
8160
8368
  }
8161
8369
 
8162
8370
  // components/Puck/index.tsx
8163
- import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
8164
- var getClassName30 = get_class_name_factory_default("Puck", styles_module_default14);
8165
- var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default14);
8371
+ import { jsx as jsx45, jsxs as jsxs21 } from "react/jsx-runtime";
8372
+ var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
8373
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
8166
8374
  var FieldSideBar = () => {
8167
8375
  const title = useAppStore(
8168
8376
  (s) => {
@@ -8170,11 +8378,11 @@ var FieldSideBar = () => {
8170
8378
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
8171
8379
  }
8172
8380
  );
8173
- return /* @__PURE__ */ jsx43(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx43(Fields, {}) });
8381
+ return /* @__PURE__ */ jsx45(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx45(Fields, {}) });
8174
8382
  };
8175
8383
  var propsContext = createContext8({});
8176
8384
  function PropsProvider(props) {
8177
- return /* @__PURE__ */ jsx43(propsContext.Provider, { value: props, children: props.children });
8385
+ return /* @__PURE__ */ jsx45(propsContext.Provider, { value: props, children: props.children });
8178
8386
  }
8179
8387
  var usePropsContext = () => useContext13(propsContext);
8180
8388
  function PuckProvider({ children }) {
@@ -8190,7 +8398,8 @@ function PuckProvider({ children }) {
8190
8398
  iframe: _iframe,
8191
8399
  initialHistory: _initialHistory,
8192
8400
  metadata,
8193
- onAction
8401
+ onAction,
8402
+ fieldTransforms
8194
8403
  } = usePropsContext();
8195
8404
  const iframe = useMemo20(
8196
8405
  () => __spreadValues({
@@ -8199,7 +8408,7 @@ function PuckProvider({ children }) {
8199
8408
  }, _iframe),
8200
8409
  [_iframe]
8201
8410
  );
8202
- const [generatedAppState] = useState24(() => {
8411
+ const [generatedAppState] = useState25(() => {
8203
8412
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8204
8413
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
8205
8414
  let clientUiState = {};
@@ -8259,7 +8468,7 @@ function PuckProvider({ children }) {
8259
8468
  return walkAppState(newAppState, config);
8260
8469
  });
8261
8470
  const { appendData = true } = _initialHistory || {};
8262
- const [blendedHistories] = useState24(
8471
+ const [blendedHistories] = useState25(
8263
8472
  [
8264
8473
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
8265
8474
  ...appendData ? [{ state: generatedAppState }] : []
@@ -8279,7 +8488,15 @@ function PuckProvider({ children }) {
8279
8488
  overrides,
8280
8489
  plugins
8281
8490
  });
8282
- const generateAppStore = useCallback21(
8491
+ const loadedFieldTransforms = useMemo20(() => {
8492
+ const _plugins = plugins || [];
8493
+ const pluginFieldTransforms = _plugins.reduce(
8494
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
8495
+ {}
8496
+ );
8497
+ return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
8498
+ }, [fieldTransforms, plugins]);
8499
+ const generateAppStore = useCallback20(
8283
8500
  (state) => {
8284
8501
  return {
8285
8502
  state,
@@ -8289,7 +8506,8 @@ function PuckProvider({ children }) {
8289
8506
  viewports,
8290
8507
  iframe,
8291
8508
  onAction,
8292
- metadata
8509
+ metadata,
8510
+ fieldTransforms: loadedFieldTransforms
8293
8511
  };
8294
8512
  },
8295
8513
  [
@@ -8300,18 +8518,19 @@ function PuckProvider({ children }) {
8300
8518
  viewports,
8301
8519
  iframe,
8302
8520
  onAction,
8303
- metadata
8521
+ metadata,
8522
+ loadedFieldTransforms
8304
8523
  ]
8305
8524
  );
8306
- const [appStore] = useState24(
8525
+ const [appStore] = useState25(
8307
8526
  () => createAppStore(generateAppStore(initialAppState))
8308
8527
  );
8309
- useEffect28(() => {
8528
+ useEffect29(() => {
8310
8529
  if (process.env.NODE_ENV !== "production") {
8311
8530
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
8312
8531
  }
8313
8532
  }, [appStore]);
8314
- useEffect28(() => {
8533
+ useEffect29(() => {
8315
8534
  const state = appStore.getState().state;
8316
8535
  appStore.setState(__spreadValues({}, generateAppStore(state)));
8317
8536
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -8320,8 +8539,8 @@ function PuckProvider({ children }) {
8320
8539
  index: initialHistoryIndex,
8321
8540
  initialAppState
8322
8541
  });
8323
- const previousData = useRef11(null);
8324
- useEffect28(() => {
8542
+ const previousData = useRef12(null);
8543
+ useEffect29(() => {
8325
8544
  appStore.subscribe(
8326
8545
  (s) => s.state.data,
8327
8546
  (data) => {
@@ -8335,11 +8554,11 @@ function PuckProvider({ children }) {
8335
8554
  }, []);
8336
8555
  useRegisterPermissionsSlice(appStore, permissions);
8337
8556
  const uPuckStore = useRegisterUsePuckStore(appStore);
8338
- useEffect28(() => {
8557
+ useEffect29(() => {
8339
8558
  const { resolveAndCommitData } = appStore.getState();
8340
8559
  resolveAndCommitData();
8341
8560
  }, []);
8342
- return /* @__PURE__ */ jsx43(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx43(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8561
+ return /* @__PURE__ */ jsx45(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx45(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8343
8562
  }
8344
8563
  function PuckLayout({ children }) {
8345
8564
  const {
@@ -8372,7 +8591,7 @@ function PuckLayout({ children }) {
8372
8591
  sidebarRef: rightSidebarRef,
8373
8592
  handleResizeEnd: handleRightSidebarResizeEnd
8374
8593
  } = useSidebarResize("right", dispatch);
8375
- useEffect28(() => {
8594
+ useEffect29(() => {
8376
8595
  if (!window.matchMedia("(min-width: 638px)").matches) {
8377
8596
  dispatch({
8378
8597
  type: "setUi",
@@ -8400,13 +8619,13 @@ function PuckLayout({ children }) {
8400
8619
  () => overrides.puck || DefaultOverride,
8401
8620
  [overrides]
8402
8621
  );
8403
- const [mounted, setMounted] = useState24(false);
8404
- useEffect28(() => {
8622
+ const [mounted, setMounted] = useState25(false);
8623
+ useEffect29(() => {
8405
8624
  setMounted(true);
8406
8625
  }, []);
8407
8626
  const ready = useAppStore((s) => s.status === "READY");
8408
8627
  useMonitorHotkeys();
8409
- useEffect28(() => {
8628
+ useEffect29(() => {
8410
8629
  if (ready && iframe.enabled) {
8411
8630
  const frameDoc = getFrame();
8412
8631
  if (frameDoc) {
@@ -8415,8 +8634,8 @@ function PuckLayout({ children }) {
8415
8634
  }
8416
8635
  }, [ready, iframe.enabled]);
8417
8636
  usePreviewModeHotkeys();
8418
- return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName30()}`, children: [
8419
- /* @__PURE__ */ jsx43(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx43(CustomPuck, { children: children || /* @__PURE__ */ jsx43(FrameProvider, { children: /* @__PURE__ */ jsx43(
8637
+ return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName31()}`, children: [
8638
+ /* @__PURE__ */ jsx45(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx45(CustomPuck, { children: children || /* @__PURE__ */ jsx45(FrameProvider, { children: /* @__PURE__ */ jsx45(
8420
8639
  "div",
8421
8640
  {
8422
8641
  className: getLayoutClassName({
@@ -8436,7 +8655,7 @@ function PuckLayout({ children }) {
8436
8655
  `
8437
8656
  },
8438
8657
  children: [
8439
- /* @__PURE__ */ jsx43(Header, {}),
8658
+ /* @__PURE__ */ jsx45(Header, {}),
8440
8659
  /* @__PURE__ */ jsxs21(
8441
8660
  Sidebar,
8442
8661
  {
@@ -8447,13 +8666,13 @@ function PuckLayout({ children }) {
8447
8666
  onResize: setLeftWidth,
8448
8667
  onResizeEnd: handleLeftSidebarResizeEnd,
8449
8668
  children: [
8450
- /* @__PURE__ */ jsx43(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx43(Components, {}) }),
8451
- /* @__PURE__ */ jsx43(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx43(Outline, {}) })
8669
+ /* @__PURE__ */ jsx45(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx45(Components, {}) }),
8670
+ /* @__PURE__ */ jsx45(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx45(Outline, {}) })
8452
8671
  ]
8453
8672
  }
8454
8673
  ),
8455
- /* @__PURE__ */ jsx43(Canvas, {}),
8456
- /* @__PURE__ */ jsx43(
8674
+ /* @__PURE__ */ jsx45(Canvas, {}),
8675
+ /* @__PURE__ */ jsx45(
8457
8676
  Sidebar,
8458
8677
  {
8459
8678
  position: "right",
@@ -8462,7 +8681,7 @@ function PuckLayout({ children }) {
8462
8681
  width: rightWidth,
8463
8682
  onResize: setRightWidth,
8464
8683
  onResizeEnd: handleRightSidebarResizeEnd,
8465
- children: /* @__PURE__ */ jsx43(FieldSideBar, {})
8684
+ children: /* @__PURE__ */ jsx45(FieldSideBar, {})
8466
8685
  }
8467
8686
  )
8468
8687
  ]
@@ -8470,11 +8689,11 @@ function PuckLayout({ children }) {
8470
8689
  )
8471
8690
  }
8472
8691
  ) }) }) }),
8473
- /* @__PURE__ */ jsx43("div", { id: "puck-portal-root", className: getClassName30("portal") })
8692
+ /* @__PURE__ */ jsx45("div", { id: "puck-portal-root", className: getClassName31("portal") })
8474
8693
  ] });
8475
8694
  }
8476
8695
  function Puck(props) {
8477
- return /* @__PURE__ */ jsx43(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx43(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx43(PuckLayout, __spreadValues({}, props)) })) }));
8696
+ return /* @__PURE__ */ jsx45(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx45(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx45(PuckLayout, __spreadValues({}, props)) })) }));
8478
8697
  }
8479
8698
  Puck.Components = Components;
8480
8699
  Puck.Fields = Fields;
@@ -8493,6 +8712,9 @@ init_react_import();
8493
8712
  // types/API/Viewports.ts
8494
8713
  init_react_import();
8495
8714
 
8715
+ // types/API/FieldTransforms.ts
8716
+ init_react_import();
8717
+
8496
8718
  // types/index.ts
8497
8719
  init_react_import();
8498
8720
 
@@ -8526,6 +8748,8 @@ export {
8526
8748
  AutoField,
8527
8749
  renderContext,
8528
8750
  Render,
8751
+ registerOverlayPortal,
8752
+ setDeep,
8529
8753
  DropZone,
8530
8754
  Drawer,
8531
8755
  createUsePuck,