@measured/puck 0.20.0-canary.8c56aa8b → 0.20.0-canary.8f2f0f46

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,7 +4192,7 @@ 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
4197
  const el = e.target;
4227
4198
  if (!el.closest("[data-puck-overlay-portal]")) {
@@ -4237,7 +4208,7 @@ var DraggableComponent = ({
4237
4208
  [index, zoneCompound, id]
4238
4209
  );
4239
4210
  const appStore = useAppStoreApi();
4240
- const onSelectParent = useCallback8(() => {
4211
+ const onSelectParent = useCallback7(() => {
4241
4212
  const { nodes, zones } = appStore.getState().state.indexes;
4242
4213
  const node = nodes[id];
4243
4214
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -4258,14 +4229,14 @@ var DraggableComponent = ({
4258
4229
  }
4259
4230
  });
4260
4231
  }, [ctx, path]);
4261
- const onDuplicate = useCallback8(() => {
4232
+ const onDuplicate = useCallback7(() => {
4262
4233
  dispatch({
4263
4234
  type: "duplicate",
4264
4235
  sourceIndex: index,
4265
4236
  sourceZone: zoneCompound
4266
4237
  });
4267
4238
  }, [index, zoneCompound]);
4268
- const onDelete = useCallback8(() => {
4239
+ const onDelete = useCallback7(() => {
4269
4240
  dispatch({
4270
4241
  type: "remove",
4271
4242
  index,
@@ -4355,7 +4326,7 @@ var DraggableComponent = ({
4355
4326
  useEffect12(() => {
4356
4327
  if (thisWasDragging) return onDragFinished();
4357
4328
  }, [thisWasDragging, onDragFinished]);
4358
- const syncActionsPosition = useCallback8(
4329
+ const syncActionsPosition = useCallback7(
4359
4330
  (el) => {
4360
4331
  if (el) {
4361
4332
  const view = el.ownerDocument.defaultView;
@@ -4507,7 +4478,7 @@ init_react_import();
4507
4478
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
4508
4479
  import {
4509
4480
  createContext as createContext4,
4510
- useCallback as useCallback9,
4481
+ useCallback as useCallback8,
4511
4482
  useContext as useContext6,
4512
4483
  useEffect as useEffect13,
4513
4484
  useMemo as useMemo6,
@@ -4866,7 +4837,7 @@ function useDragListener(type, fn, deps = []) {
4866
4837
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4867
4838
  var useTempDisableFallback = (timeout3) => {
4868
4839
  const lastFallbackDisable = useRef3(null);
4869
- return useCallback9((manager) => {
4840
+ return useCallback8((manager) => {
4870
4841
  collisionStore.setState({ fallbackEnabled: false });
4871
4842
  const fallbackId = generateId();
4872
4843
  lastFallbackDisable.current = fallbackId;
@@ -4899,7 +4870,7 @@ var DragDropContextClient = ({
4899
4870
  hoveringComponent: null
4900
4871
  }))
4901
4872
  );
4902
- const getChanged2 = useCallback9(
4873
+ const getChanged2 = useCallback8(
4903
4874
  (params, id2) => {
4904
4875
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4905
4876
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -4920,7 +4891,7 @@ var DragDropContextClient = ({
4920
4891
  },
4921
4892
  [zoneStore]
4922
4893
  );
4923
- const setDeepestAndCollide = useCallback9(
4894
+ const setDeepestAndCollide = useCallback8(
4924
4895
  (params, manager) => {
4925
4896
  const { zoneChanged, areaChanged } = getChanged2(params, id);
4926
4897
  if (!zoneChanged && !areaChanged) return;
@@ -5474,10 +5445,10 @@ import { useContext as useContext7, useEffect as useEffect15, useState as useSta
5474
5445
  // lib/dnd/use-rendered-callback.ts
5475
5446
  init_react_import();
5476
5447
  import { useDragDropManager } from "@dnd-kit/react";
5477
- import { useCallback as useCallback10 } from "react";
5448
+ import { useCallback as useCallback9 } from "react";
5478
5449
  function useRenderedCallback(callback, deps) {
5479
5450
  const manager = useDragDropManager();
5480
- return useCallback10(
5451
+ return useCallback9(
5481
5452
  (...args) => __async(this, null, function* () {
5482
5453
  yield manager == null ? void 0 : manager.renderer.rendering;
5483
5454
  return callback(...args);
@@ -5548,7 +5519,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5548
5519
 
5549
5520
  // components/DropZone/lib/use-drag-axis.ts
5550
5521
  init_react_import();
5551
- 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";
5552
5523
  var GRID_DRAG_AXIS = "dynamic";
5553
5524
  var FLEX_ROW_DRAG_AXIS = "x";
5554
5525
  var DEFAULT_DRAG_AXIS = "y";
@@ -5557,7 +5528,7 @@ var useDragAxis = (ref, collisionAxis) => {
5557
5528
  const [dragAxis, setDragAxis] = useState15(
5558
5529
  collisionAxis || DEFAULT_DRAG_AXIS
5559
5530
  );
5560
- const calculateDragAxis = useCallback11(() => {
5531
+ const calculateDragAxis = useCallback10(() => {
5561
5532
  if (ref.current) {
5562
5533
  const computedStyle = window.getComputedStyle(ref.current);
5563
5534
  if (computedStyle.display === "grid") {
@@ -5583,11 +5554,11 @@ var useDragAxis = (ref, collisionAxis) => {
5583
5554
  };
5584
5555
 
5585
5556
  // components/DropZone/index.tsx
5586
- import { useShallow as useShallow5 } from "zustand/react/shallow";
5557
+ import { useShallow as useShallow4 } from "zustand/react/shallow";
5587
5558
 
5588
5559
  // components/SlotRender/index.tsx
5589
5560
  init_react_import();
5590
- import { useShallow as useShallow4 } from "zustand/react/shallow";
5561
+ import { useShallow as useShallow3 } from "zustand/react/shallow";
5591
5562
  import { jsx as jsx23 } from "react/jsx-runtime";
5592
5563
  var ContextSlotRender = ({
5593
5564
  componentId,
@@ -5596,7 +5567,7 @@ var ContextSlotRender = ({
5596
5567
  const config = useAppStore((s) => s.config);
5597
5568
  const metadata = useAppStore((s) => s.metadata);
5598
5569
  const slotContent = useAppStore(
5599
- useShallow4((s) => {
5570
+ useShallow3((s) => {
5600
5571
  var _a, _b;
5601
5572
  const indexes = s.state.indexes;
5602
5573
  const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
@@ -5614,12 +5585,259 @@ var ContextSlotRender = ({
5614
5585
  );
5615
5586
  };
5616
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
+ // lib/get-selector-for-id.ts
5682
+ init_react_import();
5683
+ var getSelectorForId = (state, id) => {
5684
+ const node = state.indexes.nodes[id];
5685
+ if (!node) return;
5686
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5687
+ const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
5688
+ return { zone: zoneCompound, index };
5689
+ };
5690
+
5691
+ // components/InlineTextField/index.tsx
5692
+ import { jsx as jsx24 } from "react/jsx-runtime";
5693
+ var getClassName18 = get_class_name_factory_default("InlineTextField", styles_module_default13);
5694
+ var InlineTextFieldInternal = ({
5695
+ propPath,
5696
+ componentId,
5697
+ value,
5698
+ isReadOnly,
5699
+ opts = {}
5700
+ }) => {
5701
+ var _a;
5702
+ const ref = useRef5(null);
5703
+ const appStoreApi = useAppStoreApi();
5704
+ const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
5705
+ useEffect17(() => {
5706
+ const appStore = appStoreApi.getState();
5707
+ const data = appStore.state.indexes.nodes[componentId].data;
5708
+ const componentConfig = appStore.getComponentConfig(data.type);
5709
+ if (!componentConfig) {
5710
+ throw new Error(
5711
+ `InlineTextField Error: No config defined for ${data.type}`
5712
+ );
5713
+ }
5714
+ if (ref.current) {
5715
+ if (value !== ref.current.innerText) {
5716
+ ref.current.replaceChildren(value);
5717
+ }
5718
+ const cleanupPortal = registerOverlayPortal(ref.current);
5719
+ const handleInput = (e) => __async(void 0, null, function* () {
5720
+ var _a2;
5721
+ const appStore2 = appStoreApi.getState();
5722
+ const node = appStore2.state.indexes.nodes[componentId];
5723
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5724
+ const index = (_a2 = appStore2.state.indexes.zones[zoneCompound]) == null ? void 0 : _a2.contentIds.indexOf(
5725
+ componentId
5726
+ );
5727
+ const newProps = setDeep(node.data.props, propPath, e.target.innerText);
5728
+ const resolvedData = yield appStore2.resolveComponentData(
5729
+ __spreadProps(__spreadValues({}, node.data), { props: newProps }),
5730
+ "replace"
5731
+ );
5732
+ appStore2.dispatch({
5733
+ type: "replace",
5734
+ data: resolvedData.node,
5735
+ destinationIndex: index,
5736
+ destinationZone: zoneCompound
5737
+ });
5738
+ });
5739
+ ref.current.addEventListener("input", handleInput);
5740
+ return () => {
5741
+ var _a2;
5742
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("input", handleInput);
5743
+ cleanupPortal == null ? void 0 : cleanupPortal();
5744
+ };
5745
+ }
5746
+ }, [appStoreApi, ref.current, value]);
5747
+ const [isHovering, setIsHovering] = useState16(false);
5748
+ const [isFocused, setIsFocused] = useState16(false);
5749
+ return /* @__PURE__ */ jsx24(
5750
+ "span",
5751
+ {
5752
+ className: getClassName18(),
5753
+ ref,
5754
+ contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
5755
+ onClick: (e) => {
5756
+ e.preventDefault();
5757
+ e.stopPropagation();
5758
+ },
5759
+ onClickCapture: (e) => {
5760
+ e.preventDefault();
5761
+ e.stopPropagation();
5762
+ const itemSelector = getSelectorForId(
5763
+ appStoreApi.getState().state,
5764
+ componentId
5765
+ );
5766
+ appStoreApi.getState().setUi({ itemSelector });
5767
+ },
5768
+ onKeyDown: (e) => {
5769
+ e.stopPropagation();
5770
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5771
+ e.preventDefault();
5772
+ }
5773
+ },
5774
+ onKeyUp: (e) => {
5775
+ e.stopPropagation();
5776
+ e.preventDefault();
5777
+ },
5778
+ onMouseOverCapture: () => setIsHovering(true),
5779
+ onMouseOutCapture: () => setIsHovering(false),
5780
+ onFocus: () => setIsFocused(true),
5781
+ onBlur: () => setIsFocused(false)
5782
+ }
5783
+ );
5784
+ };
5785
+ var InlineTextField = memo(InlineTextFieldInternal);
5786
+
5787
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5788
+ import { jsx as jsx25 } from "react/jsx-runtime";
5789
+ var getInlineTextTransform = () => ({
5790
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5791
+ if (field.contentEditable) {
5792
+ return /* @__PURE__ */ jsx25(
5793
+ InlineTextField,
5794
+ {
5795
+ propPath,
5796
+ componentId,
5797
+ value,
5798
+ opts: { disableLineBreaks: true },
5799
+ isReadOnly
5800
+ }
5801
+ );
5802
+ }
5803
+ return value;
5804
+ },
5805
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5806
+ if (field.contentEditable) {
5807
+ return /* @__PURE__ */ jsx25(
5808
+ InlineTextField,
5809
+ {
5810
+ propPath,
5811
+ componentId,
5812
+ value,
5813
+ isReadOnly
5814
+ }
5815
+ );
5816
+ }
5817
+ return value;
5818
+ },
5819
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5820
+ if (field.contentEditable && typeof value === "string") {
5821
+ return /* @__PURE__ */ jsx25(
5822
+ InlineTextField,
5823
+ {
5824
+ propPath,
5825
+ componentId,
5826
+ value,
5827
+ isReadOnly
5828
+ }
5829
+ );
5830
+ }
5831
+ return value;
5832
+ }
5833
+ });
5834
+
5617
5835
  // components/DropZone/index.tsx
5618
- import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
5619
- var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default11);
5836
+ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
5837
+ var getClassName19 = get_class_name_factory_default("DropZone", styles_module_default11);
5620
5838
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5621
5839
  var RENDER_DEBUG = false;
5622
- var DropZoneEditPure = (props) => /* @__PURE__ */ jsx24(DropZoneEdit, __spreadValues({}, props));
5840
+ var DropZoneEditPure = (props) => /* @__PURE__ */ jsx26(DropZoneEdit, __spreadValues({}, props));
5623
5841
  var DropZoneChild = ({
5624
5842
  zoneCompound,
5625
5843
  componentId,
@@ -5634,7 +5852,7 @@ var DropZoneChild = ({
5634
5852
  const { depth = 1 } = ctx != null ? ctx : {};
5635
5853
  const zoneStore = useContext8(ZoneStoreContext);
5636
5854
  const nodeProps = useAppStore(
5637
- useShallow5((s) => {
5855
+ useShallow4((s) => {
5638
5856
  var _a2;
5639
5857
  return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
5640
5858
  })
@@ -5646,7 +5864,7 @@ var DropZoneChild = ({
5646
5864
  }
5647
5865
  );
5648
5866
  const nodeReadOnly = useAppStore(
5649
- useShallow5((s) => {
5867
+ useShallow4((s) => {
5650
5868
  var _a2;
5651
5869
  return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
5652
5870
  })
@@ -5703,10 +5921,10 @@ var DropZoneChild = ({
5703
5921
  if (item && "element" in item && item.element) {
5704
5922
  return (
5705
5923
  // Safe to use this since the HTML is set by the user
5706
- /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5924
+ /* @__PURE__ */ jsx26("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5707
5925
  );
5708
5926
  }
5709
- return /* @__PURE__ */ jsx24(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5927
+ return /* @__PURE__ */ jsx26(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5710
5928
  },
5711
5929
  [componentId, label, overrides]
5712
5930
  );
@@ -5726,11 +5944,19 @@ var DropZoneChild = ({
5726
5944
  [item == null ? void 0 : item.type, nodeType, defaultsProps]
5727
5945
  );
5728
5946
  const config = useAppStore((s) => s.config);
5729
- const defaultedPropsWithSlots = useSlots(
5947
+ const plugins = useAppStore((s) => s.plugins);
5948
+ const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
5949
+ const combinedFieldTransforms = useMemo8(
5950
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx26(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5951
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
5952
+ {}
5953
+ )), userFieldTransforms),
5954
+ [plugins, userFieldTransforms]
5955
+ );
5956
+ const transformedProps = useFieldTransforms(
5730
5957
  config,
5731
5958
  defaultedNode,
5732
- DropZoneEditPure,
5733
- (slotProps) => /* @__PURE__ */ jsx24(ContextSlotRender, { componentId, zone: slotProps.zone }),
5959
+ combinedFieldTransforms,
5734
5960
  nodeReadOnly,
5735
5961
  isLoading
5736
5962
  );
@@ -5744,7 +5970,7 @@ var DropZoneChild = ({
5744
5970
  if (isInserting) {
5745
5971
  Render2 = renderPreview;
5746
5972
  }
5747
- return /* @__PURE__ */ jsx24(
5973
+ return /* @__PURE__ */ jsx26(
5748
5974
  DraggableComponent,
5749
5975
  {
5750
5976
  id: componentId,
@@ -5758,18 +5984,18 @@ var DropZoneChild = ({
5758
5984
  autoDragAxis: dragAxis,
5759
5985
  userDragAxis: collisionAxis,
5760
5986
  inDroppableZone,
5761
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(
5987
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx26(Fragment7, { children: /* @__PURE__ */ jsx26(
5762
5988
  Render2,
5763
- __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5764
- puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5989
+ __spreadProps(__spreadValues({}, transformedProps), {
5990
+ puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
5765
5991
  dragRef
5766
5992
  })
5767
5993
  })
5768
- ) }) : /* @__PURE__ */ jsx24("div", { ref: dragRef, children: /* @__PURE__ */ jsx24(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5994
+ ) }) : /* @__PURE__ */ jsx26("div", { ref: dragRef, children: /* @__PURE__ */ jsx26(Render2, __spreadValues({}, transformedProps)) })
5769
5995
  }
5770
5996
  );
5771
5997
  };
5772
- var DropZoneChildMemo = memo(DropZoneChild);
5998
+ var DropZoneChildMemo = memo2(DropZoneChild);
5773
5999
  var DropZoneEdit = forwardRef3(
5774
6000
  function DropZoneEditInternal({
5775
6001
  zone,
@@ -5790,7 +6016,7 @@ var DropZoneEdit = forwardRef3(
5790
6016
  unregisterLocalZone
5791
6017
  } = ctx != null ? ctx : {};
5792
6018
  const path = useAppStore(
5793
- useShallow5((s) => {
6019
+ useShallow4((s) => {
5794
6020
  var _a;
5795
6021
  return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
5796
6022
  })
@@ -5807,25 +6033,25 @@ var DropZoneEdit = forwardRef3(
5807
6033
  (s) => s.nextAreaDepthIndex[areaId || ""]
5808
6034
  );
5809
6035
  const zoneContentIds = useAppStore(
5810
- useShallow5((s) => {
6036
+ useShallow4((s) => {
5811
6037
  var _a;
5812
6038
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
5813
6039
  })
5814
6040
  );
5815
6041
  const zoneType = useAppStore(
5816
- useShallow5((s) => {
6042
+ useShallow4((s) => {
5817
6043
  var _a;
5818
6044
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
5819
6045
  })
5820
6046
  );
5821
- useEffect17(() => {
6047
+ useEffect18(() => {
5822
6048
  if (!zoneType || zoneType === "dropzone") {
5823
6049
  if (ctx == null ? void 0 : ctx.registerZone) {
5824
6050
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
5825
6051
  }
5826
6052
  }
5827
6053
  }, [zoneType, appStoreApi]);
5828
- useEffect17(() => {
6054
+ useEffect18(() => {
5829
6055
  if (zoneType === "dropzone") {
5830
6056
  if (zoneCompound !== rootDroppableId) {
5831
6057
  console.warn(
@@ -5837,8 +6063,8 @@ var DropZoneEdit = forwardRef3(
5837
6063
  const contentIds = useMemo8(() => {
5838
6064
  return zoneContentIds || [];
5839
6065
  }, [zoneContentIds]);
5840
- const ref = useRef5(null);
5841
- const acceptsTarget = useCallback12(
6066
+ const ref = useRef6(null);
6067
+ const acceptsTarget = useCallback11(
5842
6068
  (componentType) => {
5843
6069
  if (!componentType) {
5844
6070
  return true;
@@ -5876,7 +6102,7 @@ var DropZoneEdit = forwardRef3(
5876
6102
  }
5877
6103
  return _isEnabled;
5878
6104
  });
5879
- useEffect17(() => {
6105
+ useEffect18(() => {
5880
6106
  if (registerLocalZone) {
5881
6107
  registerLocalZone(zoneCompound, targetAccepted || isEnabled);
5882
6108
  }
@@ -5892,7 +6118,7 @@ var DropZoneEdit = forwardRef3(
5892
6118
  );
5893
6119
  const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
5894
6120
  const zoneStore = useContext8(ZoneStoreContext);
5895
- useEffect17(() => {
6121
+ useEffect18(() => {
5896
6122
  const { enabledIndex } = zoneStore.getState();
5897
6123
  zoneStore.setState({
5898
6124
  enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
@@ -5921,10 +6147,10 @@ var DropZoneEdit = forwardRef3(
5921
6147
  userMinEmptyHeight,
5922
6148
  ref
5923
6149
  });
5924
- return /* @__PURE__ */ jsx24(
6150
+ return /* @__PURE__ */ jsx26(
5925
6151
  "div",
5926
6152
  {
5927
- className: `${getClassName18({
6153
+ className: `${getClassName19({
5928
6154
  isRootZone,
5929
6155
  hoveringOverArea,
5930
6156
  isEnabled,
@@ -5942,7 +6168,7 @@ var DropZoneEdit = forwardRef3(
5942
6168
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
5943
6169
  }),
5944
6170
  children: contentIdsWithPreview.map((componentId, i) => {
5945
- return /* @__PURE__ */ jsx24(
6171
+ return /* @__PURE__ */ jsx26(
5946
6172
  DropZoneChildMemo,
5947
6173
  {
5948
6174
  zoneCompound,
@@ -5965,7 +6191,7 @@ var DropZoneRenderItem = ({
5965
6191
  metadata
5966
6192
  }) => {
5967
6193
  const Component = config.components[item.type];
5968
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx24(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
6194
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx26(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5969
6195
  const nextContextValue = useMemo8(
5970
6196
  () => ({
5971
6197
  areaId: props.id,
@@ -5973,7 +6199,7 @@ var DropZoneRenderItem = ({
5973
6199
  }),
5974
6200
  [props]
5975
6201
  );
5976
- return /* @__PURE__ */ jsx24(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx24(
6202
+ return /* @__PURE__ */ jsx26(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx26(
5977
6203
  Component.render,
5978
6204
  __spreadProps(__spreadValues({}, props), {
5979
6205
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -5983,7 +6209,7 @@ var DropZoneRenderItem = ({
5983
6209
  })
5984
6210
  ) }, props.id);
5985
6211
  };
5986
- var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx24(DropZoneRender, __spreadValues({}, props));
6212
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
5987
6213
  var DropZoneRender = forwardRef3(
5988
6214
  function DropZoneRenderInternal({ className, style, zone }, ref) {
5989
6215
  const ctx = useContext8(dropZoneContext);
@@ -5991,7 +6217,7 @@ var DropZoneRender = forwardRef3(
5991
6217
  const { config, data, metadata } = useContext8(renderContext);
5992
6218
  let zoneCompound = `${areaId}:${zone}`;
5993
6219
  let content = (data == null ? void 0 : data.content) || [];
5994
- useEffect17(() => {
6220
+ useEffect18(() => {
5995
6221
  if (!content) {
5996
6222
  if (ctx == null ? void 0 : ctx.registerZone) {
5997
6223
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
@@ -6004,10 +6230,10 @@ var DropZoneRender = forwardRef3(
6004
6230
  if (zoneCompound !== rootDroppableId) {
6005
6231
  content = setupZone(data, zoneCompound).zones[zoneCompound];
6006
6232
  }
6007
- return /* @__PURE__ */ jsx24("div", { className, style, ref, children: content.map((item) => {
6233
+ return /* @__PURE__ */ jsx26("div", { className, style, ref, children: content.map((item) => {
6008
6234
  const Component = config.components[item.type];
6009
6235
  if (Component) {
6010
- return /* @__PURE__ */ jsx24(
6236
+ return /* @__PURE__ */ jsx26(
6011
6237
  DropZoneRenderItem,
6012
6238
  {
6013
6239
  config,
@@ -6021,20 +6247,20 @@ var DropZoneRender = forwardRef3(
6021
6247
  }) });
6022
6248
  }
6023
6249
  );
6024
- var DropZonePure = (props) => /* @__PURE__ */ jsx24(DropZone, __spreadValues({}, props));
6250
+ var DropZonePure = (props) => /* @__PURE__ */ jsx26(DropZone, __spreadValues({}, props));
6025
6251
  var DropZone = forwardRef3(
6026
6252
  function DropZone2(props, ref) {
6027
6253
  const ctx = useContext8(dropZoneContext);
6028
6254
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
6029
- return /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6255
+ return /* @__PURE__ */ jsx26(Fragment7, { children: /* @__PURE__ */ jsx26(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6030
6256
  }
6031
- return /* @__PURE__ */ jsx24(Fragment7, { children: /* @__PURE__ */ jsx24(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
6257
+ return /* @__PURE__ */ jsx26(Fragment7, { children: /* @__PURE__ */ jsx26(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
6032
6258
  }
6033
6259
  );
6034
6260
 
6035
6261
  // components/Render/index.tsx
6036
6262
  import React3, { useMemo as useMemo9 } from "react";
6037
- import { jsx as jsx25 } from "react/jsx-runtime";
6263
+ import { jsx as jsx27 } from "react/jsx-runtime";
6038
6264
  var renderContext = React3.createContext({
6039
6265
  config: { components: {} },
6040
6266
  data: { root: {}, content: [] },
@@ -6066,7 +6292,7 @@ function Render({
6066
6292
  const propsWithSlots = useSlots(
6067
6293
  config,
6068
6294
  { type: "root", props: pageProps },
6069
- (props) => /* @__PURE__ */ jsx25(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
6295
+ (props) => /* @__PURE__ */ jsx27(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
6070
6296
  );
6071
6297
  const nextContextValue = useMemo9(
6072
6298
  () => ({
@@ -6076,14 +6302,14 @@ function Render({
6076
6302
  []
6077
6303
  );
6078
6304
  if ((_a = config.root) == null ? void 0 : _a.render) {
6079
- 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 }) })) }) });
6305
+ 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 }) })) }) });
6080
6306
  }
6081
- return /* @__PURE__ */ jsx25(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx25(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx25(DropZoneRenderPure, { zone: rootZone }) }) });
6307
+ return /* @__PURE__ */ jsx27(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx27(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx27(DropZoneRenderPure, { zone: rootZone }) }) });
6082
6308
  }
6083
6309
 
6084
6310
  // lib/use-puck.ts
6085
6311
  init_react_import();
6086
- import { createContext as createContext5, useContext as useContext9, useEffect as useEffect18, useState as useState16 } from "react";
6312
+ import { createContext as createContext5, useContext as useContext9, useEffect as useEffect19, useState as useState17 } from "react";
6087
6313
  import { createStore as createStore4, useStore as useStore3 } from "zustand";
6088
6314
  var generateUsePuck = (store) => {
6089
6315
  const history = {
@@ -6106,13 +6332,7 @@ var generateUsePuck = (store) => {
6106
6332
  selectedItem: store.selectedItem || null,
6107
6333
  getItemBySelector: (selector) => getItem(selector, store.state),
6108
6334
  getItemById: (id) => store.state.indexes.nodes[id].data,
6109
- getSelectorForId: (id) => {
6110
- const node = store.state.indexes.nodes[id];
6111
- if (!node) return;
6112
- const zoneCompound = `${node.parentId}:${node.zone}`;
6113
- const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
6114
- return { zone: zoneCompound, index };
6115
- }
6335
+ getSelectorForId: (id) => getSelectorForId(store.state, id)
6116
6336
  };
6117
6337
  return storeData;
6118
6338
  };
@@ -6130,12 +6350,12 @@ var convertToPickedStore = (store) => {
6130
6350
  };
6131
6351
  };
6132
6352
  var useRegisterUsePuckStore = (appStore) => {
6133
- const [usePuckStore] = useState16(
6353
+ const [usePuckStore] = useState17(
6134
6354
  () => createStore4(
6135
6355
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
6136
6356
  )
6137
6357
  );
6138
- useEffect18(() => {
6358
+ useEffect19(() => {
6139
6359
  return appStore.subscribe(
6140
6360
  (store) => convertToPickedStore(store),
6141
6361
  (pickedStore) => {
@@ -6159,7 +6379,7 @@ function createUsePuck() {
6159
6379
  };
6160
6380
  }
6161
6381
  function usePuck() {
6162
- useEffect18(() => {
6382
+ useEffect19(() => {
6163
6383
  console.warn(
6164
6384
  "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."
6165
6385
  );
@@ -6178,12 +6398,12 @@ function useGetPuck() {
6178
6398
  init_react_import();
6179
6399
  import {
6180
6400
  createContext as createContext8,
6181
- useCallback as useCallback21,
6401
+ useCallback as useCallback20,
6182
6402
  useContext as useContext13,
6183
- useEffect as useEffect28,
6403
+ useEffect as useEffect29,
6184
6404
  useMemo as useMemo20,
6185
- useRef as useRef11,
6186
- useState as useState24
6405
+ useRef as useRef12,
6406
+ useState as useState25
6187
6407
  } from "react";
6188
6408
 
6189
6409
  // components/SidebarSection/index.tsx
@@ -6191,7 +6411,7 @@ init_react_import();
6191
6411
 
6192
6412
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6193
6413
  init_react_import();
6194
- 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" };
6414
+ 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" };
6195
6415
 
6196
6416
  // lib/use-breadcrumbs.ts
6197
6417
  init_react_import();
@@ -6238,8 +6458,8 @@ var useBreadcrumbs = (renderCount) => {
6238
6458
  };
6239
6459
 
6240
6460
  // components/SidebarSection/index.tsx
6241
- import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
6242
- var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
6461
+ import { jsx as jsx28, jsxs as jsxs12 } from "react/jsx-runtime";
6462
+ var getClassName20 = get_class_name_factory_default("SidebarSection", styles_module_default14);
6243
6463
  var SidebarSection = ({
6244
6464
  children,
6245
6465
  title,
@@ -6254,26 +6474,26 @@ var SidebarSection = ({
6254
6474
  return /* @__PURE__ */ jsxs12(
6255
6475
  "div",
6256
6476
  {
6257
- className: getClassName19({ noBorderTop, noPadding }),
6477
+ className: getClassName20({ noBorderTop, noPadding }),
6258
6478
  style: { background },
6259
6479
  children: [
6260
- /* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumbs"), children: [
6261
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumb"), children: [
6262
- /* @__PURE__ */ jsx26(
6480
+ /* @__PURE__ */ jsx28("div", { className: getClassName20("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName20("breadcrumbs"), children: [
6481
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName20("breadcrumb"), children: [
6482
+ /* @__PURE__ */ jsx28(
6263
6483
  "button",
6264
6484
  {
6265
6485
  type: "button",
6266
- className: getClassName19("breadcrumbLabel"),
6486
+ className: getClassName20("breadcrumbLabel"),
6267
6487
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6268
6488
  children: breadcrumb.label
6269
6489
  }
6270
6490
  ),
6271
- /* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
6491
+ /* @__PURE__ */ jsx28(ChevronRight, { size: 16 })
6272
6492
  ] }, i)) : null,
6273
- /* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
6493
+ /* @__PURE__ */ jsx28("div", { className: getClassName20("heading"), children: /* @__PURE__ */ jsx28(Heading, { rank: "2", size: "xs", children: title }) })
6274
6494
  ] }) }),
6275
- /* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
6276
- isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx26(Loader, { size: 32 }) })
6495
+ /* @__PURE__ */ jsx28("div", { className: getClassName20("content"), children }),
6496
+ isLoading && /* @__PURE__ */ jsx28("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ jsx28(Loader, { size: 32 }) })
6277
6497
  ]
6278
6498
  }
6279
6499
  );
@@ -6281,24 +6501,24 @@ var SidebarSection = ({
6281
6501
 
6282
6502
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
6283
6503
  init_react_import();
6284
- 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" };
6504
+ var styles_module_default15 = { "Puck": "_Puck_1yxlw_19", "Puck-portal": "_Puck-portal_1yxlw_31", "PuckLayout-inner": "_PuckLayout-inner_1yxlw_38", "PuckLayout--mounted": "_PuckLayout--mounted_1yxlw_59", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1yxlw_63", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1yxlw_69", "PuckLayout-mounted": "_PuckLayout-mounted_1yxlw_83", "PuckLayout": "_PuckLayout_1yxlw_38" };
6285
6505
 
6286
6506
  // components/Puck/components/Fields/index.tsx
6287
6507
  init_react_import();
6288
6508
 
6289
6509
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
6290
6510
  init_react_import();
6291
- 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" };
6511
+ 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" };
6292
6512
 
6293
6513
  // components/Puck/components/Fields/index.tsx
6294
- import { memo as memo2, useCallback as useCallback13, useMemo as useMemo11 } from "react";
6295
- import { useShallow as useShallow6 } from "zustand/react/shallow";
6296
- import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
6297
- var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
6514
+ import { memo as memo3, useCallback as useCallback12, useMemo as useMemo11 } from "react";
6515
+ import { useShallow as useShallow5 } from "zustand/react/shallow";
6516
+ import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
6517
+ var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
6298
6518
  var DefaultFields = ({
6299
6519
  children
6300
6520
  }) => {
6301
- return /* @__PURE__ */ jsx27(Fragment8, { children });
6521
+ return /* @__PURE__ */ jsx29(Fragment8, { children });
6302
6522
  };
6303
6523
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6304
6524
  let currentProps;
@@ -6358,19 +6578,19 @@ var FieldsChild = ({ fieldName }) => {
6358
6578
  return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
6359
6579
  });
6360
6580
  const permissions = useAppStore(
6361
- useShallow6((s) => {
6581
+ useShallow5((s) => {
6362
6582
  const { selectedItem, permissions: permissions2 } = s;
6363
6583
  return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
6364
6584
  })
6365
6585
  );
6366
6586
  const appStore = useAppStoreApi();
6367
- const onChange = useCallback13(createOnChange(fieldName, appStore), [
6587
+ const onChange = useCallback12(createOnChange(fieldName, appStore), [
6368
6588
  fieldName
6369
6589
  ]);
6370
6590
  const { visible = true } = field != null ? field : {};
6371
6591
  if (!field || !id || !visible) return null;
6372
6592
  if (field.type === "slot") return null;
6373
- return /* @__PURE__ */ jsx27("div", { className: getClassName20("field"), children: /* @__PURE__ */ jsx27(
6593
+ return /* @__PURE__ */ jsx29("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx29(
6374
6594
  AutoFieldPrivate,
6375
6595
  {
6376
6596
  field,
@@ -6382,7 +6602,7 @@ var FieldsChild = ({ fieldName }) => {
6382
6602
  }
6383
6603
  ) }, id);
6384
6604
  };
6385
- var FieldsChildMemo = memo2(FieldsChild);
6605
+ var FieldsChildMemo = memo3(FieldsChild);
6386
6606
  var FieldsInternal = ({ wrapFields = true }) => {
6387
6607
  const overrides = useAppStore((s) => s.overrides);
6388
6608
  const componentResolving = useAppStore((s) => {
@@ -6390,7 +6610,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
6390
6610
  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;
6391
6611
  return (loadingCount != null ? loadingCount : 0) > 0;
6392
6612
  });
6393
- const itemSelector = useAppStore(useShallow6((s) => s.state.ui.itemSelector));
6613
+ const itemSelector = useAppStore(useShallow5((s) => s.state.ui.itemSelector));
6394
6614
  const id = useAppStore((s) => {
6395
6615
  var _a;
6396
6616
  return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
@@ -6399,7 +6619,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
6399
6619
  useRegisterFieldsSlice(appStore, id);
6400
6620
  const fieldsLoading = useAppStore((s) => s.fields.loading);
6401
6621
  const fieldNames = useAppStore(
6402
- useShallow6((s) => {
6622
+ useShallow5((s) => {
6403
6623
  if (s.fields.id === id) {
6404
6624
  return Object.keys(s.fields.fields);
6405
6625
  }
@@ -6411,37 +6631,37 @@ var FieldsInternal = ({ wrapFields = true }) => {
6411
6631
  return /* @__PURE__ */ jsxs13(
6412
6632
  "form",
6413
6633
  {
6414
- className: getClassName20({ wrapFields }),
6634
+ className: getClassName21({ wrapFields }),
6415
6635
  onSubmit: (e) => {
6416
6636
  e.preventDefault();
6417
6637
  },
6418
6638
  children: [
6419
- /* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx27(FieldsChildMemo, { fieldName }, fieldName)) }),
6420
- isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName20("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
6639
+ /* @__PURE__ */ jsx29(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx29(FieldsChildMemo, { fieldName }, fieldName)) }),
6640
+ isLoading && /* @__PURE__ */ jsx29("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx29("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx29(Loader, { size: 16 }) }) })
6421
6641
  ]
6422
6642
  }
6423
6643
  );
6424
6644
  };
6425
- var Fields = memo2(FieldsInternal);
6645
+ var Fields = memo3(FieldsInternal);
6426
6646
 
6427
6647
  // components/Puck/components/Components/index.tsx
6428
6648
  init_react_import();
6429
6649
 
6430
6650
  // lib/use-component-list.tsx
6431
6651
  init_react_import();
6432
- import { useEffect as useEffect20, useState as useState17 } from "react";
6652
+ import { useEffect as useEffect21, useState as useState18 } from "react";
6433
6653
 
6434
6654
  // components/ComponentList/index.tsx
6435
6655
  init_react_import();
6436
6656
 
6437
6657
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
6438
6658
  init_react_import();
6439
- var styles_module_default16 = { "ComponentList": "_ComponentList_1rrlt_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1rrlt_5", "ComponentList-content": "_ComponentList-content_1rrlt_9", "ComponentList-title": "_ComponentList-title_1rrlt_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1rrlt_53" };
6659
+ 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" };
6440
6660
 
6441
6661
  // components/ComponentList/index.tsx
6442
- import { useEffect as useEffect19 } from "react";
6443
- import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
6444
- var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
6662
+ import { useEffect as useEffect20 } from "react";
6663
+ import { jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
6664
+ var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
6445
6665
  var ComponentListItem = ({
6446
6666
  name,
6447
6667
  label
@@ -6453,14 +6673,14 @@ var ComponentListItem = ({
6453
6673
  type: name
6454
6674
  }).insert
6455
6675
  );
6456
- useEffect19(() => {
6676
+ useEffect20(() => {
6457
6677
  if (overrides.componentItem) {
6458
6678
  console.warn(
6459
6679
  "The `componentItem` override has been deprecated and renamed to `drawerItem`"
6460
6680
  );
6461
6681
  }
6462
6682
  }, [overrides]);
6463
- return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6683
+ return /* @__PURE__ */ jsx30(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6464
6684
  };
6465
6685
  var ComponentList = ({
6466
6686
  children,
@@ -6471,12 +6691,12 @@ var ComponentList = ({
6471
6691
  const setUi = useAppStore((s) => s.setUi);
6472
6692
  const componentList = useAppStore((s) => s.state.ui.componentList);
6473
6693
  const { expanded = true } = componentList[id] || {};
6474
- return /* @__PURE__ */ jsxs14("div", { className: getClassName21({ isExpanded: expanded }), children: [
6694
+ return /* @__PURE__ */ jsxs14("div", { className: getClassName22({ isExpanded: expanded }), children: [
6475
6695
  title && /* @__PURE__ */ jsxs14(
6476
6696
  "button",
6477
6697
  {
6478
6698
  type: "button",
6479
- className: getClassName21("title"),
6699
+ className: getClassName22("title"),
6480
6700
  onClick: () => setUi({
6481
6701
  componentList: __spreadProps(__spreadValues({}, componentList), {
6482
6702
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -6486,14 +6706,14 @@ var ComponentList = ({
6486
6706
  }),
6487
6707
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
6488
6708
  children: [
6489
- /* @__PURE__ */ jsx28("div", { children: title }),
6490
- /* @__PURE__ */ jsx28("div", { className: getClassName21("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
6709
+ /* @__PURE__ */ jsx30("div", { children: title }),
6710
+ /* @__PURE__ */ jsx30("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx30(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx30(ChevronDown, { size: 12 }) })
6491
6711
  ]
6492
6712
  }
6493
6713
  ),
6494
- /* @__PURE__ */ jsx28("div", { className: getClassName21("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6714
+ /* @__PURE__ */ jsx30("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx30(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6495
6715
  var _a;
6496
- return /* @__PURE__ */ jsx28(
6716
+ return /* @__PURE__ */ jsx30(
6497
6717
  ComponentListItem,
6498
6718
  {
6499
6719
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -6507,12 +6727,12 @@ var ComponentList = ({
6507
6727
  ComponentList.Item = ComponentListItem;
6508
6728
 
6509
6729
  // lib/use-component-list.tsx
6510
- import { jsx as jsx29 } from "react/jsx-runtime";
6730
+ import { jsx as jsx31 } from "react/jsx-runtime";
6511
6731
  var useComponentList = () => {
6512
- const [componentList, setComponentList] = useState17();
6732
+ const [componentList, setComponentList] = useState18();
6513
6733
  const config = useAppStore((s) => s.config);
6514
6734
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
6515
- useEffect20(() => {
6735
+ useEffect21(() => {
6516
6736
  var _a, _b, _c;
6517
6737
  if (Object.keys(uiComponentList).length > 0) {
6518
6738
  const matchedComponents = [];
@@ -6522,7 +6742,7 @@ var useComponentList = () => {
6522
6742
  if (category.visible === false || !category.components) {
6523
6743
  return null;
6524
6744
  }
6525
- return /* @__PURE__ */ jsx29(
6745
+ return /* @__PURE__ */ jsx31(
6526
6746
  ComponentList,
6527
6747
  {
6528
6748
  id: categoryKey,
@@ -6531,7 +6751,7 @@ var useComponentList = () => {
6531
6751
  var _a2;
6532
6752
  matchedComponents.push(componentName);
6533
6753
  const componentConf = config.components[componentName] || {};
6534
- return /* @__PURE__ */ jsx29(
6754
+ return /* @__PURE__ */ jsx31(
6535
6755
  ComponentList.Item,
6536
6756
  {
6537
6757
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -6551,7 +6771,7 @@ var useComponentList = () => {
6551
6771
  );
6552
6772
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
6553
6773
  _componentList.push(
6554
- /* @__PURE__ */ jsx29(
6774
+ /* @__PURE__ */ jsx31(
6555
6775
  ComponentList,
6556
6776
  {
6557
6777
  id: "other",
@@ -6559,7 +6779,7 @@ var useComponentList = () => {
6559
6779
  children: remainingComponents.map((componentName, i) => {
6560
6780
  var _a2;
6561
6781
  const componentConf = config.components[componentName] || {};
6562
- return /* @__PURE__ */ jsx29(
6782
+ return /* @__PURE__ */ jsx31(
6563
6783
  ComponentList.Item,
6564
6784
  {
6565
6785
  name: componentName,
@@ -6582,7 +6802,7 @@ var useComponentList = () => {
6582
6802
 
6583
6803
  // components/Puck/components/Components/index.tsx
6584
6804
  import { useMemo as useMemo12 } from "react";
6585
- import { jsx as jsx30 } from "react/jsx-runtime";
6805
+ import { jsx as jsx32 } from "react/jsx-runtime";
6586
6806
  var Components = () => {
6587
6807
  const overrides = useAppStore((s) => s.overrides);
6588
6808
  const componentList = useComponentList();
@@ -6594,24 +6814,24 @@ var Components = () => {
6594
6814
  }
6595
6815
  return overrides.components || overrides.drawer || "div";
6596
6816
  }, [overrides]);
6597
- return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
6817
+ return /* @__PURE__ */ jsx32(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx32(ComponentList, { id: "all" }) });
6598
6818
  };
6599
6819
 
6600
6820
  // components/Puck/components/Preview/index.tsx
6601
6821
  init_react_import();
6602
- import { useCallback as useCallback14, useEffect as useEffect22, useRef as useRef6, useMemo as useMemo13 } from "react";
6822
+ import { useCallback as useCallback13, useEffect as useEffect23, useRef as useRef7, useMemo as useMemo13 } from "react";
6603
6823
 
6604
6824
  // components/AutoFrame/index.tsx
6605
6825
  init_react_import();
6606
6826
  import {
6607
6827
  createContext as createContext6,
6608
6828
  useContext as useContext10,
6609
- useEffect as useEffect21,
6610
- useState as useState18
6829
+ useEffect as useEffect22,
6830
+ useState as useState19
6611
6831
  } from "react";
6612
6832
  import hash from "object-hash";
6613
6833
  import { createPortal as createPortal3 } from "react-dom";
6614
- import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
6834
+ import { Fragment as Fragment9, jsx as jsx33 } from "react/jsx-runtime";
6615
6835
  var styleSelector = 'style, link[rel="stylesheet"]';
6616
6836
  var collectStyles = (doc) => {
6617
6837
  const collected = [];
@@ -6661,7 +6881,7 @@ var CopyHostStyles = ({
6661
6881
  onStylesLoaded = () => null
6662
6882
  }) => {
6663
6883
  const { document: doc, window: win } = useFrame();
6664
- useEffect21(() => {
6884
+ useEffect22(() => {
6665
6885
  if (!win || !doc) {
6666
6886
  return () => {
6667
6887
  };
@@ -6818,7 +7038,7 @@ var CopyHostStyles = ({
6818
7038
  observer.disconnect();
6819
7039
  };
6820
7040
  }, []);
6821
- return /* @__PURE__ */ jsx31(Fragment9, { children });
7041
+ return /* @__PURE__ */ jsx33(Fragment9, { children });
6822
7042
  };
6823
7043
  var autoFrameContext = createContext6({});
6824
7044
  var useFrame = () => useContext10(autoFrameContext);
@@ -6842,11 +7062,11 @@ function AutoFrame(_a) {
6842
7062
  "onNotReady",
6843
7063
  "frameRef"
6844
7064
  ]);
6845
- const [loaded, setLoaded] = useState18(false);
6846
- const [ctx, setCtx] = useState18({});
6847
- const [mountTarget, setMountTarget] = useState18();
6848
- const [stylesLoaded, setStylesLoaded] = useState18(false);
6849
- useEffect21(() => {
7065
+ const [loaded, setLoaded] = useState19(false);
7066
+ const [ctx, setCtx] = useState19({});
7067
+ const [mountTarget, setMountTarget] = useState19();
7068
+ const [stylesLoaded, setStylesLoaded] = useState19(false);
7069
+ useEffect22(() => {
6850
7070
  var _a2;
6851
7071
  if (frameRef.current) {
6852
7072
  const doc = frameRef.current.contentDocument;
@@ -6865,7 +7085,7 @@ function AutoFrame(_a) {
6865
7085
  }
6866
7086
  }
6867
7087
  }, [frameRef, loaded, stylesLoaded]);
6868
- return /* @__PURE__ */ jsx31(
7088
+ return /* @__PURE__ */ jsx33(
6869
7089
  "iframe",
6870
7090
  __spreadProps(__spreadValues({}, props), {
6871
7091
  className,
@@ -6875,7 +7095,7 @@ function AutoFrame(_a) {
6875
7095
  onLoad: () => {
6876
7096
  setLoaded(true);
6877
7097
  },
6878
- children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(
7098
+ children: /* @__PURE__ */ jsx33(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx33(
6879
7099
  CopyHostStyles,
6880
7100
  {
6881
7101
  debug,
@@ -6891,14 +7111,14 @@ var AutoFrame_default = AutoFrame;
6891
7111
 
6892
7112
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
6893
7113
  init_react_import();
6894
- var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7114
+ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
6895
7115
 
6896
7116
  // components/Puck/components/Preview/index.tsx
6897
- import { Fragment as Fragment10, jsx as jsx32 } from "react/jsx-runtime";
6898
- var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
7117
+ import { Fragment as Fragment10, jsx as jsx34 } from "react/jsx-runtime";
7118
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
6899
7119
  var useBubbleIframeEvents = (ref) => {
6900
7120
  const status = useAppStore((s) => s.status);
6901
- useEffect22(() => {
7121
+ useEffect23(() => {
6902
7122
  if (ref.current && status === "READY") {
6903
7123
  const iframe = ref.current;
6904
7124
  const handlePointerMove = (event) => {
@@ -6947,7 +7167,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
6947
7167
  const renderData = useAppStore(
6948
7168
  (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
6949
7169
  );
6950
- const Page = useCallback14(
7170
+ const Page = useCallback13(
6951
7171
  (pageProps) => {
6952
7172
  var _a, _b;
6953
7173
  const propsWithSlots = useSlots(
@@ -6957,15 +7177,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
6957
7177
  );
6958
7178
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
6959
7179
  id: "puck-root"
6960
- }, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment10, { children: propsWithSlots.children });
7180
+ }, propsWithSlots)) : /* @__PURE__ */ jsx34(Fragment10, { children: propsWithSlots.children });
6961
7181
  },
6962
7182
  [config]
6963
7183
  );
6964
7184
  const Frame = useMemo13(() => overrides.iframe, [overrides]);
6965
7185
  const rootProps = root.props || root;
6966
- const ref = useRef6(null);
7186
+ const ref = useRef7(null);
6967
7187
  useBubbleIframeEvents(ref);
6968
- const inner = !renderData ? /* @__PURE__ */ jsx32(
7188
+ const inner = !renderData ? /* @__PURE__ */ jsx34(
6969
7189
  Page,
6970
7190
  __spreadProps(__spreadValues({}, rootProps), {
6971
7191
  puck: {
@@ -6975,18 +7195,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
6975
7195
  metadata
6976
7196
  },
6977
7197
  editMode: true,
6978
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
7198
+ children: /* @__PURE__ */ jsx34(DropZonePure, { zone: rootDroppableId })
6979
7199
  })
6980
- ) : /* @__PURE__ */ jsx32(Render, { data: renderData, config, metadata });
6981
- useEffect22(() => {
7200
+ ) : /* @__PURE__ */ jsx34(Render, { data: renderData, config, metadata });
7201
+ useEffect23(() => {
6982
7202
  if (!iframe.enabled) {
6983
7203
  setStatus("READY");
6984
7204
  }
6985
7205
  }, [iframe.enabled]);
6986
- return /* @__PURE__ */ jsx32(
7206
+ return /* @__PURE__ */ jsx34(
6987
7207
  "div",
6988
7208
  {
6989
- className: getClassName22(),
7209
+ className: getClassName23(),
6990
7210
  id,
6991
7211
  "data-puck-preview": true,
6992
7212
  onClick: (e) => {
@@ -6995,11 +7215,11 @@ var Preview2 = ({ id = "puck-preview" }) => {
6995
7215
  dispatch({ type: "setUi", ui: { itemSelector: null } });
6996
7216
  }
6997
7217
  },
6998
- children: iframe.enabled ? /* @__PURE__ */ jsx32(
7218
+ children: iframe.enabled ? /* @__PURE__ */ jsx34(
6999
7219
  AutoFrame_default,
7000
7220
  {
7001
7221
  id: "preview-frame",
7002
- className: getClassName22("frame"),
7222
+ className: getClassName23("frame"),
7003
7223
  "data-rfd-iframe": true,
7004
7224
  onReady: () => {
7005
7225
  setStatus("READY");
@@ -7008,18 +7228,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
7008
7228
  setStatus("MOUNTED");
7009
7229
  },
7010
7230
  frameRef: ref,
7011
- children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7231
+ children: /* @__PURE__ */ jsx34(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7012
7232
  if (Frame) {
7013
- return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
7233
+ return /* @__PURE__ */ jsx34(Frame, { document: document2, children: inner });
7014
7234
  }
7015
7235
  return inner;
7016
7236
  } })
7017
7237
  }
7018
- ) : /* @__PURE__ */ jsx32(
7238
+ ) : /* @__PURE__ */ jsx34(
7019
7239
  "div",
7020
7240
  {
7021
7241
  id: "preview-frame",
7022
- className: getClassName22("frame"),
7242
+ className: getClassName23("frame"),
7023
7243
  ref,
7024
7244
  "data-puck-entry": true,
7025
7245
  children: inner
@@ -7037,7 +7257,7 @@ init_react_import();
7037
7257
 
7038
7258
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
7039
7259
  init_react_import();
7040
- 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" };
7260
+ 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" };
7041
7261
 
7042
7262
  // lib/scroll-into-view.ts
7043
7263
  init_react_import();
@@ -7051,7 +7271,7 @@ var scrollIntoView = (el) => {
7051
7271
  };
7052
7272
 
7053
7273
  // components/LayerTree/index.tsx
7054
- import { useCallback as useCallback15, useContext as useContext11 } from "react";
7274
+ import { useCallback as useCallback14, useContext as useContext11 } from "react";
7055
7275
 
7056
7276
  // lib/on-scroll-end.ts
7057
7277
  init_react_import();
@@ -7073,10 +7293,10 @@ var onScrollEnd = (frame, cb) => {
7073
7293
  };
7074
7294
 
7075
7295
  // components/LayerTree/index.tsx
7076
- import { useShallow as useShallow7 } from "zustand/react/shallow";
7077
- import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
7078
- var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
7079
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
7296
+ import { useShallow as useShallow6 } from "zustand/react/shallow";
7297
+ import { Fragment as Fragment11, jsx as jsx35, jsxs as jsxs15 } from "react/jsx-runtime";
7298
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
7299
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
7080
7300
  var Layer = ({
7081
7301
  index,
7082
7302
  itemId,
@@ -7086,7 +7306,7 @@ var Layer = ({
7086
7306
  const config = useAppStore((s) => s.config);
7087
7307
  const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
7088
7308
  const dispatch = useAppStore((s) => s.dispatch);
7089
- const setItemSelector = useCallback15(
7309
+ const setItemSelector = useCallback14(
7090
7310
  (itemSelector2) => {
7091
7311
  dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
7092
7312
  },
@@ -7099,7 +7319,7 @@ var Layer = ({
7099
7319
  const isSelected = selecedItemId === itemId || itemSelector && itemSelector.zone === rootDroppableId && !zoneCompound;
7100
7320
  const nodeData = useAppStore((s) => s.state.indexes.nodes[itemId]);
7101
7321
  const zonesForItem = useAppStore(
7102
- useShallow7(
7322
+ useShallow6(
7103
7323
  (s) => Object.keys(s.state.indexes.zones).filter(
7104
7324
  (z) => z.split(":")[0] === itemId
7105
7325
  )
@@ -7131,7 +7351,7 @@ var Layer = ({
7131
7351
  childIsSelected
7132
7352
  }),
7133
7353
  children: [
7134
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs15(
7354
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs15(
7135
7355
  "button",
7136
7356
  {
7137
7357
  type: "button",
@@ -7169,22 +7389,22 @@ var Layer = ({
7169
7389
  zoneStore.setState({ hoveringComponent: null });
7170
7390
  },
7171
7391
  children: [
7172
- containsZone && /* @__PURE__ */ jsx33(
7392
+ containsZone && /* @__PURE__ */ jsx35(
7173
7393
  "div",
7174
7394
  {
7175
7395
  className: getClassNameLayer("chevron"),
7176
7396
  title: isSelected ? "Collapse" : "Expand",
7177
- children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
7397
+ children: /* @__PURE__ */ jsx35(ChevronDown, { size: "12" })
7178
7398
  }
7179
7399
  ),
7180
7400
  /* @__PURE__ */ jsxs15("div", { className: getClassNameLayer("title"), children: [
7181
- /* @__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" }) }),
7182
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label })
7401
+ /* @__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" }) }),
7402
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("name"), children: label })
7183
7403
  ] })
7184
7404
  ]
7185
7405
  }
7186
7406
  ) }),
7187
- containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(LayerTree, { zoneCompound: subzone }) }, subzone))
7407
+ containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx35(LayerTree, { zoneCompound: subzone }) }, subzone))
7188
7408
  ]
7189
7409
  }
7190
7410
  );
@@ -7203,7 +7423,7 @@ var LayerTree = ({
7203
7423
  return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
7204
7424
  });
7205
7425
  const contentIds = useAppStore(
7206
- useShallow7(
7426
+ useShallow6(
7207
7427
  (s) => {
7208
7428
  var _a, _b;
7209
7429
  return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
@@ -7211,14 +7431,14 @@ var LayerTree = ({
7211
7431
  )
7212
7432
  );
7213
7433
  return /* @__PURE__ */ jsxs15(Fragment11, { children: [
7214
- label && /* @__PURE__ */ jsxs15("div", { className: getClassName23("zoneTitle"), children: [
7215
- /* @__PURE__ */ jsx33("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
7434
+ label && /* @__PURE__ */ jsxs15("div", { className: getClassName24("zoneTitle"), children: [
7435
+ /* @__PURE__ */ jsx35("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx35(Layers, { size: "16" }) }),
7216
7436
  label
7217
7437
  ] }),
7218
- /* @__PURE__ */ jsxs15("ul", { className: getClassName23(), children: [
7219
- contentIds.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName23("helper"), children: "No items" }),
7438
+ /* @__PURE__ */ jsxs15("ul", { className: getClassName24(), children: [
7439
+ contentIds.length === 0 && /* @__PURE__ */ jsx35("div", { className: getClassName24("helper"), children: "No items" }),
7220
7440
  contentIds.map((itemId, i) => {
7221
- return /* @__PURE__ */ jsx33(
7441
+ return /* @__PURE__ */ jsx35(
7222
7442
  Layer,
7223
7443
  {
7224
7444
  index: i,
@@ -7244,15 +7464,15 @@ var findZonesForArea = (state, area) => {
7244
7464
  };
7245
7465
 
7246
7466
  // components/Puck/components/Outline/index.tsx
7247
- import { useShallow as useShallow8 } from "zustand/react/shallow";
7248
- import { jsx as jsx34 } from "react/jsx-runtime";
7467
+ import { useShallow as useShallow7 } from "zustand/react/shallow";
7468
+ import { jsx as jsx36 } from "react/jsx-runtime";
7249
7469
  var Outline = () => {
7250
7470
  const outlineOverride = useAppStore((s) => s.overrides.outline);
7251
7471
  const rootZones = useAppStore(
7252
- useShallow8((s) => findZonesForArea(s.state, "root"))
7472
+ useShallow7((s) => findZonesForArea(s.state, "root"))
7253
7473
  );
7254
7474
  const Wrapper = useMemo14(() => outlineOverride || "div", [outlineOverride]);
7255
- return /* @__PURE__ */ jsx34(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx34(
7475
+ return /* @__PURE__ */ jsx36(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx36(
7256
7476
  LayerTree,
7257
7477
  {
7258
7478
  label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
@@ -7265,30 +7485,30 @@ var Outline = () => {
7265
7485
  // components/Puck/components/Canvas/index.tsx
7266
7486
  init_react_import();
7267
7487
  import {
7268
- useCallback as useCallback16,
7269
- useEffect as useEffect24,
7488
+ useCallback as useCallback15,
7489
+ useEffect as useEffect25,
7270
7490
  useMemo as useMemo17,
7271
- useRef as useRef8,
7272
- useState as useState20
7491
+ useRef as useRef9,
7492
+ useState as useState21
7273
7493
  } from "react";
7274
7494
 
7275
7495
  // components/ViewportControls/index.tsx
7276
7496
  init_react_import();
7277
- import { useEffect as useEffect23, useMemo as useMemo15, useState as useState19 } from "react";
7497
+ import { useEffect as useEffect24, useMemo as useMemo15, useState as useState20 } from "react";
7278
7498
 
7279
7499
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7280
7500
  init_react_import();
7281
- 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" };
7501
+ 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" };
7282
7502
 
7283
7503
  // components/ViewportControls/index.tsx
7284
- import { jsx as jsx35, jsxs as jsxs16 } from "react/jsx-runtime";
7504
+ import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
7285
7505
  var icons = {
7286
- Smartphone: /* @__PURE__ */ jsx35(Smartphone, { size: 16 }),
7287
- Tablet: /* @__PURE__ */ jsx35(Tablet, { size: 16 }),
7288
- Monitor: /* @__PURE__ */ jsx35(Monitor, { size: 16 })
7506
+ Smartphone: /* @__PURE__ */ jsx37(Smartphone, { size: 16 }),
7507
+ Tablet: /* @__PURE__ */ jsx37(Tablet, { size: 16 }),
7508
+ Monitor: /* @__PURE__ */ jsx37(Monitor, { size: 16 })
7289
7509
  };
7290
- var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
7291
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
7510
+ var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
7511
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
7292
7512
  var ViewportButton = ({
7293
7513
  children,
7294
7514
  height = "auto",
@@ -7297,11 +7517,11 @@ var ViewportButton = ({
7297
7517
  onClick
7298
7518
  }) => {
7299
7519
  const viewports = useAppStore((s) => s.state.ui.viewports);
7300
- const [isActive, setIsActive] = useState19(false);
7301
- useEffect23(() => {
7520
+ const [isActive, setIsActive] = useState20(false);
7521
+ useEffect24(() => {
7302
7522
  setIsActive(width === viewports.current.width);
7303
7523
  }, [width, viewports.current.width]);
7304
- return /* @__PURE__ */ jsx35("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx35(
7524
+ return /* @__PURE__ */ jsx37("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx37(
7305
7525
  IconButton,
7306
7526
  {
7307
7527
  type: "button",
@@ -7311,7 +7531,7 @@ var ViewportButton = ({
7311
7531
  e.stopPropagation();
7312
7532
  onClick({ width, height });
7313
7533
  },
7314
- children: /* @__PURE__ */ jsx35("span", { className: getClassNameButton("inner"), children })
7534
+ children: /* @__PURE__ */ jsx37("span", { className: getClassNameButton("inner"), children })
7315
7535
  }
7316
7536
  ) });
7317
7537
  };
@@ -7347,8 +7567,8 @@ var ViewportControls = ({
7347
7567
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7348
7568
  [autoZoom]
7349
7569
  );
7350
- return /* @__PURE__ */ jsxs16("div", { className: getClassName24(), children: [
7351
- viewports.map((viewport, i) => /* @__PURE__ */ jsx35(
7570
+ return /* @__PURE__ */ jsxs16("div", { className: getClassName25(), children: [
7571
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx37(
7352
7572
  ViewportButton,
7353
7573
  {
7354
7574
  height: viewport.height,
@@ -7359,8 +7579,8 @@ var ViewportControls = ({
7359
7579
  },
7360
7580
  i
7361
7581
  )),
7362
- /* @__PURE__ */ jsx35("div", { className: getClassName24("divider") }),
7363
- /* @__PURE__ */ jsx35(
7582
+ /* @__PURE__ */ jsx37("div", { className: getClassName25("divider") }),
7583
+ /* @__PURE__ */ jsx37(
7364
7584
  IconButton,
7365
7585
  {
7366
7586
  type: "button",
@@ -7375,10 +7595,10 @@ var ViewportControls = ({
7375
7595
  )].value
7376
7596
  );
7377
7597
  },
7378
- children: /* @__PURE__ */ jsx35(ZoomOut, { size: 16 })
7598
+ children: /* @__PURE__ */ jsx37(ZoomOut, { size: 16 })
7379
7599
  }
7380
7600
  ),
7381
- /* @__PURE__ */ jsx35(
7601
+ /* @__PURE__ */ jsx37(
7382
7602
  IconButton,
7383
7603
  {
7384
7604
  type: "button",
@@ -7393,19 +7613,19 @@ var ViewportControls = ({
7393
7613
  )].value
7394
7614
  );
7395
7615
  },
7396
- children: /* @__PURE__ */ jsx35(ZoomIn, { size: 16 })
7616
+ children: /* @__PURE__ */ jsx37(ZoomIn, { size: 16 })
7397
7617
  }
7398
7618
  ),
7399
- /* @__PURE__ */ jsx35("div", { className: getClassName24("divider") }),
7400
- /* @__PURE__ */ jsx35(
7619
+ /* @__PURE__ */ jsx37("div", { className: getClassName25("divider") }),
7620
+ /* @__PURE__ */ jsx37(
7401
7621
  "select",
7402
7622
  {
7403
- className: getClassName24("zoomSelect"),
7623
+ className: getClassName25("zoomSelect"),
7404
7624
  value: zoom.toString(),
7405
7625
  onChange: (e) => {
7406
7626
  onZoom(parseFloat(e.currentTarget.value));
7407
7627
  },
7408
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx35(
7628
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx37(
7409
7629
  "option",
7410
7630
  {
7411
7631
  value: option.value,
@@ -7420,32 +7640,32 @@ var ViewportControls = ({
7420
7640
 
7421
7641
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
7422
7642
  init_react_import();
7423
- 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" };
7643
+ 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" };
7424
7644
 
7425
7645
  // components/Puck/components/Canvas/index.tsx
7426
- import { useShallow as useShallow9 } from "zustand/react/shallow";
7646
+ import { useShallow as useShallow8 } from "zustand/react/shallow";
7427
7647
 
7428
7648
  // lib/frame-context.tsx
7429
7649
  init_react_import();
7430
7650
  import {
7431
7651
  createContext as createContext7,
7432
7652
  useContext as useContext12,
7433
- useRef as useRef7,
7653
+ useRef as useRef8,
7434
7654
  useMemo as useMemo16
7435
7655
  } from "react";
7436
- import { jsx as jsx36 } from "react/jsx-runtime";
7656
+ import { jsx as jsx38 } from "react/jsx-runtime";
7437
7657
  var FrameContext = createContext7(null);
7438
7658
  var FrameProvider = ({
7439
7659
  children
7440
7660
  }) => {
7441
- const frameRef = useRef7(null);
7661
+ const frameRef = useRef8(null);
7442
7662
  const value = useMemo16(
7443
7663
  () => ({
7444
7664
  frameRef
7445
7665
  }),
7446
7666
  []
7447
7667
  );
7448
- return /* @__PURE__ */ jsx36(FrameContext.Provider, { value, children });
7668
+ return /* @__PURE__ */ jsx38(FrameContext.Provider, { value, children });
7449
7669
  };
7450
7670
  var useCanvasFrame = () => {
7451
7671
  const context = useContext12(FrameContext);
@@ -7456,9 +7676,10 @@ var useCanvasFrame = () => {
7456
7676
  };
7457
7677
 
7458
7678
  // components/Puck/components/Canvas/index.tsx
7459
- import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
7460
- var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
7679
+ import { Fragment as Fragment12, jsx as jsx39, jsxs as jsxs17 } from "react/jsx-runtime";
7680
+ var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
7461
7681
  var ZOOM_ON_CHANGE = true;
7682
+ var TRANSITION_DURATION = 150;
7462
7683
  var Canvas = () => {
7463
7684
  const { frameRef } = useCanvasFrame();
7464
7685
  const resetAutoZoom = useResetAutoZoom(frameRef);
@@ -7471,7 +7692,7 @@ var Canvas = () => {
7471
7692
  status,
7472
7693
  iframe
7473
7694
  } = useAppStore(
7474
- useShallow9((s) => ({
7695
+ useShallow8((s) => ({
7475
7696
  dispatch: s.dispatch,
7476
7697
  overrides: s.overrides,
7477
7698
  setUi: s.setUi,
@@ -7488,7 +7709,7 @@ var Canvas = () => {
7488
7709
  rightSideBarWidth,
7489
7710
  viewports
7490
7711
  } = useAppStore(
7491
- useShallow9((s) => ({
7712
+ useShallow8((s) => ({
7492
7713
  leftSideBarVisible: s.state.ui.leftSideBarVisible,
7493
7714
  rightSideBarVisible: s.state.ui.rightSideBarVisible,
7494
7715
  leftSideBarWidth: s.state.ui.leftSideBarWidth,
@@ -7496,17 +7717,17 @@ var Canvas = () => {
7496
7717
  viewports: s.state.ui.viewports
7497
7718
  }))
7498
7719
  );
7499
- const [showTransition, setShowTransition] = useState20(false);
7500
- const isResettingZoomRef = useRef8(false);
7720
+ const [showTransition, setShowTransition] = useState21(false);
7721
+ const isResizingRef = useRef9(false);
7501
7722
  const defaultRender = useMemo17(() => {
7502
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment12, { children });
7723
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx39(Fragment12, { children });
7503
7724
  return PuckDefault;
7504
7725
  }, []);
7505
7726
  const CustomPreview = useMemo17(
7506
7727
  () => overrides.preview || defaultRender,
7507
7728
  [overrides]
7508
7729
  );
7509
- const getFrameDimensions = useCallback16(() => {
7730
+ const getFrameDimensions = useCallback15(() => {
7510
7731
  if (frameRef.current) {
7511
7732
  const frame = frameRef.current;
7512
7733
  const box = getBox(frame);
@@ -7514,23 +7735,17 @@ var Canvas = () => {
7514
7735
  }
7515
7736
  return { width: 0, height: 0 };
7516
7737
  }, [frameRef]);
7517
- useEffect24(() => {
7518
- resetAutoZoom({
7519
- isResettingRef: isResettingZoomRef,
7520
- setShowTransition,
7521
- showTransition: false,
7522
- viewports
7523
- });
7738
+ useEffect25(() => {
7739
+ resetAutoZoom();
7524
7740
  }, [
7525
7741
  frameRef,
7526
7742
  leftSideBarVisible,
7527
7743
  rightSideBarVisible,
7528
7744
  leftSideBarWidth,
7529
7745
  rightSideBarWidth,
7530
- resetAutoZoom,
7531
7746
  viewports
7532
7747
  ]);
7533
- useEffect24(() => {
7748
+ useEffect25(() => {
7534
7749
  const { height: frameHeight } = getFrameDimensions();
7535
7750
  if (viewports.current.height === "auto") {
7536
7751
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -7538,31 +7753,25 @@ var Canvas = () => {
7538
7753
  }));
7539
7754
  }
7540
7755
  }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
7541
- useEffect24(() => {
7756
+ useEffect25(() => {
7542
7757
  if (ZOOM_ON_CHANGE) {
7543
- resetAutoZoom({
7544
- isResettingRef: isResettingZoomRef,
7545
- setShowTransition,
7546
- showTransition: true,
7547
- viewports
7548
- });
7758
+ resetAutoZoom();
7549
7759
  }
7550
- }, [viewports.current.width, resetAutoZoom, viewports]);
7551
- useEffect24(() => {
7552
- const cb = () => {
7553
- resetAutoZoom({
7554
- isResettingRef: isResettingZoomRef,
7555
- setShowTransition,
7556
- showTransition: false
7557
- });
7558
- };
7559
- window.addEventListener("resize", cb);
7760
+ }, [viewports.current.width, viewports]);
7761
+ useEffect25(() => {
7762
+ if (!frameRef.current) return;
7763
+ const resizeObserver = new ResizeObserver(() => {
7764
+ if (!isResizingRef.current) {
7765
+ resetAutoZoom();
7766
+ }
7767
+ });
7768
+ resizeObserver.observe(frameRef.current);
7560
7769
  return () => {
7561
- window.removeEventListener("resize", cb);
7770
+ resizeObserver.disconnect();
7562
7771
  };
7563
- }, [resetAutoZoom]);
7564
- const [showLoader, setShowLoader] = useState20(false);
7565
- useEffect24(() => {
7772
+ }, [frameRef.current]);
7773
+ const [showLoader, setShowLoader] = useState21(false);
7774
+ useEffect25(() => {
7566
7775
  setTimeout(() => {
7567
7776
  setShowLoader(true);
7568
7777
  }, 500);
@@ -7570,7 +7779,7 @@ var Canvas = () => {
7570
7779
  return /* @__PURE__ */ jsxs17(
7571
7780
  "div",
7572
7781
  {
7573
- className: getClassName25({
7782
+ className: getClassName26({
7574
7783
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
7575
7784
  showLoader
7576
7785
  }),
@@ -7585,13 +7794,14 @@ var Canvas = () => {
7585
7794
  }
7586
7795
  },
7587
7796
  children: [
7588
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName25("controls"), children: /* @__PURE__ */ jsx37(
7797
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx39("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx39(
7589
7798
  ViewportControls,
7590
7799
  {
7591
7800
  autoZoom: zoomConfig.autoZoom,
7592
7801
  zoom: zoomConfig.zoom,
7593
7802
  onViewportChange: (viewport) => {
7594
7803
  setShowTransition(true);
7804
+ isResizingRef.current = true;
7595
7805
  const uiViewport = __spreadProps(__spreadValues({}, viewport), {
7596
7806
  height: viewport.height || "auto",
7597
7807
  zoom: zoomConfig.zoom
@@ -7603,42 +7813,39 @@ var Canvas = () => {
7603
7813
  setUi(newUi);
7604
7814
  if (ZOOM_ON_CHANGE) {
7605
7815
  resetAutoZoom({
7606
- isResettingRef: isResettingZoomRef,
7607
- setShowTransition,
7608
- showTransition: true,
7609
7816
  viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
7610
7817
  });
7611
7818
  }
7612
7819
  },
7613
7820
  onZoom: (zoom) => {
7614
7821
  setShowTransition(true);
7822
+ isResizingRef.current = true;
7615
7823
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
7616
7824
  }
7617
7825
  }
7618
7826
  ) }),
7619
- /* @__PURE__ */ jsxs17("div", { className: getClassName25("inner"), ref: frameRef, children: [
7620
- /* @__PURE__ */ jsx37(
7827
+ /* @__PURE__ */ jsxs17("div", { className: getClassName26("inner"), ref: frameRef, children: [
7828
+ /* @__PURE__ */ jsx39(
7621
7829
  "div",
7622
7830
  {
7623
- className: getClassName25("root"),
7831
+ className: getClassName26("root"),
7624
7832
  style: {
7625
7833
  width: iframe.enabled ? viewports.current.width : "100%",
7626
7834
  height: zoomConfig.rootHeight,
7627
7835
  transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
7628
- transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
7836
+ transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, height ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : "",
7629
7837
  overflow: iframe.enabled ? void 0 : "auto"
7630
7838
  },
7631
7839
  suppressHydrationWarning: true,
7632
7840
  id: "puck-canvas-root",
7633
7841
  onTransitionEnd: () => {
7634
- resetAutoZoom({
7635
- isResettingRef: isResettingZoomRef
7636
- });
7842
+ setShowTransition(false);
7843
+ isResizingRef.current = false;
7637
7844
  },
7638
- children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview2, {}) })
7845
+ children: /* @__PURE__ */ jsx39(CustomPreview, { children: /* @__PURE__ */ jsx39(Preview2, {}) })
7639
7846
  }
7640
7847
  ),
7641
- /* @__PURE__ */ jsx37("div", { className: getClassName25("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
7848
+ /* @__PURE__ */ jsx39("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx39(Loader, { size: 24 }) })
7642
7849
  ] })
7643
7850
  ]
7644
7851
  }
@@ -7657,8 +7864,11 @@ var loadOverrides = ({
7657
7864
  }) => {
7658
7865
  const collected = __spreadValues({}, overrides);
7659
7866
  plugins == null ? void 0 : plugins.forEach((plugin) => {
7867
+ if (!plugin.overrides) return;
7660
7868
  Object.keys(plugin.overrides).forEach((_overridesType) => {
7869
+ var _a;
7661
7870
  const overridesType = _overridesType;
7871
+ if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
7662
7872
  if (overridesType === "fieldTypes") {
7663
7873
  const fieldTypes = plugin.overrides.fieldTypes;
7664
7874
  Object.keys(fieldTypes).forEach((fieldType) => {
@@ -7693,19 +7903,19 @@ var useLoadedOverrides = ({
7693
7903
 
7694
7904
  // components/DefaultOverride/index.tsx
7695
7905
  init_react_import();
7696
- import { Fragment as Fragment13, jsx as jsx38 } from "react/jsx-runtime";
7697
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment13, { children });
7906
+ import { Fragment as Fragment13, jsx as jsx40 } from "react/jsx-runtime";
7907
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx40(Fragment13, { children });
7698
7908
 
7699
7909
  // lib/use-inject-css.ts
7700
7910
  init_react_import();
7701
- import { useEffect as useEffect25, useState as useState21 } from "react";
7911
+ import { useEffect as useEffect26, useState as useState22 } from "react";
7702
7912
  var styles = ``;
7703
7913
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7704
- const [el, setEl] = useState21();
7705
- useEffect25(() => {
7914
+ const [el, setEl] = useState22();
7915
+ useEffect26(() => {
7706
7916
  setEl(document.createElement("style"));
7707
7917
  }, []);
7708
- useEffect25(() => {
7918
+ useEffect26(() => {
7709
7919
  var _a;
7710
7920
  if (!el || typeof window === "undefined") {
7711
7921
  return;
@@ -7725,10 +7935,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
7725
7935
 
7726
7936
  // lib/use-preview-mode-hotkeys.ts
7727
7937
  init_react_import();
7728
- import { useCallback as useCallback17 } from "react";
7938
+ import { useCallback as useCallback16 } from "react";
7729
7939
  var usePreviewModeHotkeys = () => {
7730
7940
  const appStore = useAppStoreApi();
7731
- const toggleInteractive = useCallback17(() => {
7941
+ const toggleInteractive = useCallback16(() => {
7732
7942
  const dispatch = appStore.getState().dispatch;
7733
7943
  dispatch({
7734
7944
  type: "setUi",
@@ -7746,18 +7956,18 @@ import fdeq from "fast-deep-equal";
7746
7956
 
7747
7957
  // components/Puck/components/Header/index.tsx
7748
7958
  init_react_import();
7749
- import { memo as memo3, useCallback as useCallback18, useMemo as useMemo19, useState as useState22 } from "react";
7959
+ import { memo as memo4, useCallback as useCallback17, useMemo as useMemo19, useState as useState23 } from "react";
7750
7960
 
7751
7961
  // components/MenuBar/index.tsx
7752
7962
  init_react_import();
7753
7963
 
7754
7964
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
7755
7965
  init_react_import();
7756
- var styles_module_default21 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
7966
+ 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" };
7757
7967
 
7758
7968
  // components/MenuBar/index.tsx
7759
- import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
7760
- var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
7969
+ import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
7970
+ var getClassName27 = get_class_name_factory_default("MenuBar", styles_module_default22);
7761
7971
  function MenuBar({
7762
7972
  menuOpen = false,
7763
7973
  renderHeaderActions,
@@ -7767,10 +7977,10 @@ function MenuBar({
7767
7977
  const forward = useAppStore((s) => s.history.forward);
7768
7978
  const hasFuture = useAppStore((s) => s.history.hasFuture());
7769
7979
  const hasPast = useAppStore((s) => s.history.hasPast());
7770
- return /* @__PURE__ */ jsx39(
7980
+ return /* @__PURE__ */ jsx41(
7771
7981
  "div",
7772
7982
  {
7773
- className: getClassName26({ menuOpen }),
7983
+ className: getClassName27({ menuOpen }),
7774
7984
  onClick: (event) => {
7775
7985
  var _a;
7776
7986
  const element = event.target;
@@ -7781,30 +7991,30 @@ function MenuBar({
7781
7991
  setMenuOpen(false);
7782
7992
  }
7783
7993
  },
7784
- children: /* @__PURE__ */ jsxs18("div", { className: getClassName26("inner"), children: [
7785
- /* @__PURE__ */ jsxs18("div", { className: getClassName26("history"), children: [
7786
- /* @__PURE__ */ jsx39(
7994
+ children: /* @__PURE__ */ jsxs18("div", { className: getClassName27("inner"), children: [
7995
+ /* @__PURE__ */ jsxs18("div", { className: getClassName27("history"), children: [
7996
+ /* @__PURE__ */ jsx41(
7787
7997
  IconButton,
7788
7998
  {
7789
7999
  type: "button",
7790
8000
  title: "undo",
7791
8001
  disabled: !hasPast,
7792
8002
  onClick: back,
7793
- children: /* @__PURE__ */ jsx39(Undo2, { size: 21 })
8003
+ children: /* @__PURE__ */ jsx41(Undo2, { size: 21 })
7794
8004
  }
7795
8005
  ),
7796
- /* @__PURE__ */ jsx39(
8006
+ /* @__PURE__ */ jsx41(
7797
8007
  IconButton,
7798
8008
  {
7799
8009
  type: "button",
7800
8010
  title: "redo",
7801
8011
  disabled: !hasFuture,
7802
8012
  onClick: forward,
7803
- children: /* @__PURE__ */ jsx39(Redo2, { size: 21 })
8013
+ children: /* @__PURE__ */ jsx41(Redo2, { size: 21 })
7804
8014
  }
7805
8015
  )
7806
8016
  ] }),
7807
- /* @__PURE__ */ jsx39(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
8017
+ /* @__PURE__ */ jsx41(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
7808
8018
  ] })
7809
8019
  }
7810
8020
  );
@@ -7812,11 +8022,11 @@ function MenuBar({
7812
8022
 
7813
8023
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
7814
8024
  init_react_import();
7815
- var styles_module_default22 = { "PuckHeader": "_PuckHeader_15xnq_1", "PuckHeader-inner": "_PuckHeader-inner_15xnq_10", "PuckHeader-toggle": "_PuckHeader-toggle_15xnq_20", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_15xnq_27", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_15xnq_27", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_15xnq_28", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_15xnq_28", "PuckHeader-title": "_PuckHeader-title_15xnq_32", "PuckHeader-path": "_PuckHeader-path_15xnq_36", "PuckHeader-tools": "_PuckHeader-tools_15xnq_43", "PuckHeader-menuButton": "_PuckHeader-menuButton_15xnq_49", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_15xnq_54" };
8025
+ 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" };
7816
8026
 
7817
8027
  // components/Puck/components/Header/index.tsx
7818
- import { Fragment as Fragment15, jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
7819
- var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
8028
+ import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs19 } from "react/jsx-runtime";
8029
+ var getClassName28 = get_class_name_factory_default("PuckHeader", styles_module_default23);
7820
8030
  var HeaderInner = () => {
7821
8031
  const {
7822
8032
  onPublish,
@@ -7837,7 +8047,7 @@ var HeaderInner = () => {
7837
8047
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
7838
8048
  const Comp = renderHeader;
7839
8049
  const appState = useAppStore((s) => s.state);
7840
- return /* @__PURE__ */ jsx40(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8050
+ return /* @__PURE__ */ jsx42(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7841
8051
  };
7842
8052
  return RenderHeader;
7843
8053
  }
@@ -7851,19 +8061,19 @@ var HeaderInner = () => {
7851
8061
  const RenderHeader = (props) => {
7852
8062
  const Comp = renderHeaderActions;
7853
8063
  const appState = useAppStore((s) => s.state);
7854
- return /* @__PURE__ */ jsx40(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8064
+ return /* @__PURE__ */ jsx42(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7855
8065
  };
7856
8066
  return RenderHeader;
7857
8067
  }
7858
8068
  return DefaultOverride;
7859
- }, [renderHeader]);
8069
+ }, [renderHeaderActions]);
7860
8070
  const CustomHeader = useAppStore(
7861
8071
  (s) => s.overrides.header || defaultHeaderRender
7862
8072
  );
7863
8073
  const CustomHeaderActions = useAppStore(
7864
8074
  (s) => s.overrides.headerActions || defaultHeaderActionsRender
7865
8075
  );
7866
- const [menuOpen, setMenuOpen] = useState22(false);
8076
+ const [menuOpen, setMenuOpen] = useState23(false);
7867
8077
  const rootTitle = useAppStore((s) => {
7868
8078
  var _a, _b;
7869
8079
  const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
@@ -7873,7 +8083,7 @@ var HeaderInner = () => {
7873
8083
  const rightSideBarVisible = useAppStore(
7874
8084
  (s) => s.state.ui.rightSideBarVisible
7875
8085
  );
7876
- const toggleSidebars = useCallback18(
8086
+ const toggleSidebars = useCallback17(
7877
8087
  (sidebar) => {
7878
8088
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
7879
8089
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7887,27 +8097,27 @@ var HeaderInner = () => {
7887
8097
  },
7888
8098
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7889
8099
  );
7890
- return /* @__PURE__ */ jsx40(
8100
+ return /* @__PURE__ */ jsx42(
7891
8101
  CustomHeader,
7892
8102
  {
7893
- actions: /* @__PURE__ */ jsx40(Fragment15, { children: /* @__PURE__ */ jsx40(CustomHeaderActions, { children: /* @__PURE__ */ jsx40(
8103
+ actions: /* @__PURE__ */ jsx42(Fragment15, { children: /* @__PURE__ */ jsx42(CustomHeaderActions, { children: /* @__PURE__ */ jsx42(
7894
8104
  Button,
7895
8105
  {
7896
8106
  onClick: () => {
7897
8107
  const data = appStore.getState().state.data;
7898
8108
  onPublish && onPublish(data);
7899
8109
  },
7900
- icon: /* @__PURE__ */ jsx40(Globe, { size: "14px" }),
8110
+ icon: /* @__PURE__ */ jsx42(Globe, { size: "14px" }),
7901
8111
  children: "Publish"
7902
8112
  }
7903
8113
  ) }) }),
7904
- children: /* @__PURE__ */ jsx40(
8114
+ children: /* @__PURE__ */ jsx42(
7905
8115
  "header",
7906
8116
  {
7907
- className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
7908
- children: /* @__PURE__ */ jsxs19("div", { className: getClassName27("inner"), children: [
7909
- /* @__PURE__ */ jsxs19("div", { className: getClassName27("toggle"), children: [
7910
- /* @__PURE__ */ jsx40("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ jsx40(
8117
+ className: getClassName28({ leftSideBarVisible, rightSideBarVisible }),
8118
+ children: /* @__PURE__ */ jsxs19("div", { className: getClassName28("inner"), children: [
8119
+ /* @__PURE__ */ jsxs19("div", { className: getClassName28("toggle"), children: [
8120
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("leftSideBarToggle"), children: /* @__PURE__ */ jsx42(
7911
8121
  IconButton,
7912
8122
  {
7913
8123
  type: "button",
@@ -7915,10 +8125,10 @@ var HeaderInner = () => {
7915
8125
  toggleSidebars("left");
7916
8126
  },
7917
8127
  title: "Toggle left sidebar",
7918
- children: /* @__PURE__ */ jsx40(PanelLeft, { focusable: "false" })
8128
+ children: /* @__PURE__ */ jsx42(PanelLeft, { focusable: "false" })
7919
8129
  }
7920
8130
  ) }),
7921
- /* @__PURE__ */ jsx40("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ jsx40(
8131
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("rightSideBarToggle"), children: /* @__PURE__ */ jsx42(
7922
8132
  IconButton,
7923
8133
  {
7924
8134
  type: "button",
@@ -7926,19 +8136,19 @@ var HeaderInner = () => {
7926
8136
  toggleSidebars("right");
7927
8137
  },
7928
8138
  title: "Toggle right sidebar",
7929
- children: /* @__PURE__ */ jsx40(PanelRight, { focusable: "false" })
8139
+ children: /* @__PURE__ */ jsx42(PanelRight, { focusable: "false" })
7930
8140
  }
7931
8141
  ) })
7932
8142
  ] }),
7933
- /* @__PURE__ */ jsx40("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs19(Heading, { rank: "2", size: "xs", children: [
8143
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs19(Heading, { rank: "2", size: "xs", children: [
7934
8144
  headerTitle || rootTitle || "Page",
7935
8145
  headerPath && /* @__PURE__ */ jsxs19(Fragment15, { children: [
7936
8146
  " ",
7937
- /* @__PURE__ */ jsx40("code", { className: getClassName27("path"), children: headerPath })
8147
+ /* @__PURE__ */ jsx42("code", { className: getClassName28("path"), children: headerPath })
7938
8148
  ] })
7939
8149
  ] }) }),
7940
- /* @__PURE__ */ jsxs19("div", { className: getClassName27("tools"), children: [
7941
- /* @__PURE__ */ jsx40("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ jsx40(
8150
+ /* @__PURE__ */ jsxs19("div", { className: getClassName28("tools"), children: [
8151
+ /* @__PURE__ */ jsx42("div", { className: getClassName28("menuButton"), children: /* @__PURE__ */ jsx42(
7942
8152
  IconButton,
7943
8153
  {
7944
8154
  type: "button",
@@ -7946,23 +8156,23 @@ var HeaderInner = () => {
7946
8156
  return setMenuOpen(!menuOpen);
7947
8157
  },
7948
8158
  title: "Toggle menu bar",
7949
- children: menuOpen ? /* @__PURE__ */ jsx40(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx40(ChevronDown, { focusable: "false" })
8159
+ children: menuOpen ? /* @__PURE__ */ jsx42(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx42(ChevronDown, { focusable: "false" })
7950
8160
  }
7951
8161
  ) }),
7952
- /* @__PURE__ */ jsx40(
8162
+ /* @__PURE__ */ jsx42(
7953
8163
  MenuBar,
7954
8164
  {
7955
8165
  dispatch,
7956
8166
  onPublish,
7957
8167
  menuOpen,
7958
- renderHeaderActions: () => /* @__PURE__ */ jsx40(CustomHeaderActions, { children: /* @__PURE__ */ jsx40(
8168
+ renderHeaderActions: () => /* @__PURE__ */ jsx42(CustomHeaderActions, { children: /* @__PURE__ */ jsx42(
7959
8169
  Button,
7960
8170
  {
7961
8171
  onClick: () => {
7962
8172
  const data = appStore.getState().state.data;
7963
8173
  onPublish && onPublish(data);
7964
8174
  },
7965
- icon: /* @__PURE__ */ jsx40(Globe, { size: "14px" }),
8175
+ icon: /* @__PURE__ */ jsx42(Globe, { size: "14px" }),
7966
8176
  children: "Publish"
7967
8177
  }
7968
8178
  ) }),
@@ -7976,22 +8186,22 @@ var HeaderInner = () => {
7976
8186
  }
7977
8187
  );
7978
8188
  };
7979
- var Header = memo3(HeaderInner);
8189
+ var Header = memo4(HeaderInner);
7980
8190
 
7981
8191
  // components/Puck/components/Sidebar/index.tsx
7982
8192
  init_react_import();
7983
8193
 
7984
8194
  // components/Puck/components/ResizeHandle/index.tsx
7985
8195
  init_react_import();
7986
- import { useCallback as useCallback19, useRef as useRef9 } from "react";
8196
+ import { useCallback as useCallback18, useRef as useRef10 } from "react";
7987
8197
 
7988
8198
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
7989
8199
  init_react_import();
7990
- var styles_module_default23 = { "ResizeHandle": "_ResizeHandle_v7w0r_1", "ResizeHandle--left": "_ResizeHandle--left_v7w0r_15", "ResizeHandle--right": "_ResizeHandle--right_v7w0r_19" };
8200
+ var styles_module_default24 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
7991
8201
 
7992
8202
  // components/Puck/components/ResizeHandle/index.tsx
7993
- import { jsx as jsx41 } from "react/jsx-runtime";
7994
- var getClassName28 = get_class_name_factory_default("ResizeHandle", styles_module_default23);
8203
+ import { jsx as jsx43 } from "react/jsx-runtime";
8204
+ var getClassName29 = get_class_name_factory_default("ResizeHandle", styles_module_default24);
7995
8205
  var ResizeHandle = ({
7996
8206
  position,
7997
8207
  sidebarRef,
@@ -8000,11 +8210,11 @@ var ResizeHandle = ({
8000
8210
  }) => {
8001
8211
  const { frameRef } = useCanvasFrame();
8002
8212
  const resetAutoZoom = useResetAutoZoom(frameRef);
8003
- const handleRef = useRef9(null);
8004
- const isDragging = useRef9(false);
8005
- const startX = useRef9(0);
8006
- const startWidth = useRef9(0);
8007
- const handleMouseMove = useCallback19(
8213
+ const handleRef = useRef10(null);
8214
+ const isDragging = useRef10(false);
8215
+ const startX = useRef10(0);
8216
+ const startWidth = useRef10(0);
8217
+ const handleMouseMove = useCallback18(
8008
8218
  (e) => {
8009
8219
  if (!isDragging.current) return;
8010
8220
  const delta = e.clientX - startX.current;
@@ -8015,7 +8225,7 @@ var ResizeHandle = ({
8015
8225
  },
8016
8226
  [onResize, position]
8017
8227
  );
8018
- const handleMouseUp = useCallback19(() => {
8228
+ const handleMouseUp = useCallback18(() => {
8019
8229
  var _a;
8020
8230
  if (!isDragging.current) return;
8021
8231
  isDragging.current = false;
@@ -8030,8 +8240,8 @@ var ResizeHandle = ({
8030
8240
  const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8031
8241
  onResizeEnd(finalWidth);
8032
8242
  resetAutoZoom();
8033
- }, [onResizeEnd, resetAutoZoom]);
8034
- const handleMouseDown = useCallback19(
8243
+ }, [onResizeEnd]);
8244
+ const handleMouseDown = useCallback18(
8035
8245
  (e) => {
8036
8246
  var _a;
8037
8247
  isDragging.current = true;
@@ -8049,11 +8259,11 @@ var ResizeHandle = ({
8049
8259
  },
8050
8260
  [position, handleMouseMove, handleMouseUp]
8051
8261
  );
8052
- return /* @__PURE__ */ jsx41(
8262
+ return /* @__PURE__ */ jsx43(
8053
8263
  "div",
8054
8264
  {
8055
8265
  ref: handleRef,
8056
- className: getClassName28({ [position]: true }),
8266
+ className: getClassName29({ [position]: true }),
8057
8267
  onMouseDown: handleMouseDown
8058
8268
  }
8059
8269
  );
@@ -8061,24 +8271,23 @@ var ResizeHandle = ({
8061
8271
 
8062
8272
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
8063
8273
  init_react_import();
8064
- var styles_module_default24 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
8274
+ 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" };
8065
8275
 
8066
8276
  // components/Puck/components/Sidebar/index.tsx
8067
- import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
8068
- var getClassName29 = get_class_name_factory_default("Sidebar", styles_module_default24);
8277
+ import { Fragment as Fragment16, jsx as jsx44, jsxs as jsxs20 } from "react/jsx-runtime";
8278
+ var getClassName30 = get_class_name_factory_default("Sidebar", styles_module_default25);
8069
8279
  var Sidebar = ({
8070
8280
  position,
8071
8281
  sidebarRef,
8072
8282
  isVisible,
8073
- width,
8074
8283
  onResize,
8075
8284
  onResizeEnd,
8076
8285
  children
8077
8286
  }) => {
8078
8287
  if (!isVisible) return null;
8079
8288
  return /* @__PURE__ */ jsxs20(Fragment16, { children: [
8080
- /* @__PURE__ */ jsx42("div", { ref: sidebarRef, className: getClassName29({ [position]: true }), children }),
8081
- /* @__PURE__ */ jsx42("div", { className: `${getClassName29("resizeHandle")}`, children: /* @__PURE__ */ jsx42(
8289
+ /* @__PURE__ */ jsx44("div", { ref: sidebarRef, className: getClassName30({ [position]: true }), children }),
8290
+ /* @__PURE__ */ jsx44("div", { className: `${getClassName30("resizeHandle")}`, children: /* @__PURE__ */ jsx44(
8082
8291
  ResizeHandle,
8083
8292
  {
8084
8293
  position,
@@ -8092,25 +8301,26 @@ var Sidebar = ({
8092
8301
 
8093
8302
  // lib/use-sidebar-resize.ts
8094
8303
  init_react_import();
8095
- import { useCallback as useCallback20, useEffect as useEffect27, useRef as useRef10, useState as useState23 } from "react";
8304
+ import { useCallback as useCallback19, useEffect as useEffect28, useRef as useRef11, useState as useState24 } from "react";
8096
8305
  function useSidebarResize(position, dispatch) {
8097
- const [width, setWidth] = useState23(null);
8098
- const sidebarRef = useRef10(null);
8306
+ const [width, setWidth] = useState24(null);
8307
+ const sidebarRef = useRef11(null);
8099
8308
  const storeWidth = useAppStore(
8100
8309
  (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
8101
8310
  );
8102
- useEffect27(() => {
8311
+ useEffect28(() => {
8103
8312
  if (typeof window !== "undefined" && !storeWidth) {
8104
8313
  try {
8105
8314
  const savedWidths = localStorage.getItem("puck-sidebar-widths");
8106
8315
  if (savedWidths) {
8107
8316
  const widths = JSON.parse(savedWidths);
8108
8317
  const savedWidth = widths[position];
8318
+ const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
8109
8319
  if (savedWidth) {
8110
8320
  dispatch({
8111
8321
  type: "setUi",
8112
8322
  ui: {
8113
- [position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: savedWidth
8323
+ [key]: savedWidth
8114
8324
  }
8115
8325
  });
8116
8326
  }
@@ -8123,12 +8333,12 @@ function useSidebarResize(position, dispatch) {
8123
8333
  }
8124
8334
  }
8125
8335
  }, [dispatch, position, storeWidth]);
8126
- useEffect27(() => {
8336
+ useEffect28(() => {
8127
8337
  if (storeWidth !== void 0) {
8128
8338
  setWidth(storeWidth);
8129
8339
  }
8130
8340
  }, [storeWidth]);
8131
- const handleResizeEnd = useCallback20(
8341
+ const handleResizeEnd = useCallback19(
8132
8342
  (width2) => {
8133
8343
  dispatch({
8134
8344
  type: "setUi",
@@ -8171,9 +8381,9 @@ function useSidebarResize(position, dispatch) {
8171
8381
  }
8172
8382
 
8173
8383
  // components/Puck/index.tsx
8174
- import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
8175
- var getClassName30 = get_class_name_factory_default("Puck", styles_module_default14);
8176
- var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default14);
8384
+ import { jsx as jsx45, jsxs as jsxs21 } from "react/jsx-runtime";
8385
+ var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
8386
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
8177
8387
  var FieldSideBar = () => {
8178
8388
  const title = useAppStore(
8179
8389
  (s) => {
@@ -8181,11 +8391,11 @@ var FieldSideBar = () => {
8181
8391
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
8182
8392
  }
8183
8393
  );
8184
- return /* @__PURE__ */ jsx43(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx43(Fields, {}) });
8394
+ return /* @__PURE__ */ jsx45(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx45(Fields, {}) });
8185
8395
  };
8186
8396
  var propsContext = createContext8({});
8187
8397
  function PropsProvider(props) {
8188
- return /* @__PURE__ */ jsx43(propsContext.Provider, { value: props, children: props.children });
8398
+ return /* @__PURE__ */ jsx45(propsContext.Provider, { value: props, children: props.children });
8189
8399
  }
8190
8400
  var usePropsContext = () => useContext13(propsContext);
8191
8401
  function PuckProvider({ children }) {
@@ -8201,7 +8411,8 @@ function PuckProvider({ children }) {
8201
8411
  iframe: _iframe,
8202
8412
  initialHistory: _initialHistory,
8203
8413
  metadata,
8204
- onAction
8414
+ onAction,
8415
+ fieldTransforms
8205
8416
  } = usePropsContext();
8206
8417
  const iframe = useMemo20(
8207
8418
  () => __spreadValues({
@@ -8210,7 +8421,7 @@ function PuckProvider({ children }) {
8210
8421
  }, _iframe),
8211
8422
  [_iframe]
8212
8423
  );
8213
- const [generatedAppState] = useState24(() => {
8424
+ const [generatedAppState] = useState25(() => {
8214
8425
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8215
8426
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
8216
8427
  let clientUiState = {};
@@ -8270,7 +8481,7 @@ function PuckProvider({ children }) {
8270
8481
  return walkAppState(newAppState, config);
8271
8482
  });
8272
8483
  const { appendData = true } = _initialHistory || {};
8273
- const [blendedHistories] = useState24(
8484
+ const [blendedHistories] = useState25(
8274
8485
  [
8275
8486
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
8276
8487
  ...appendData ? [{ state: generatedAppState }] : []
@@ -8290,7 +8501,15 @@ function PuckProvider({ children }) {
8290
8501
  overrides,
8291
8502
  plugins
8292
8503
  });
8293
- const generateAppStore = useCallback21(
8504
+ const loadedFieldTransforms = useMemo20(() => {
8505
+ const _plugins = plugins || [];
8506
+ const pluginFieldTransforms = _plugins.reduce(
8507
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
8508
+ {}
8509
+ );
8510
+ return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
8511
+ }, [fieldTransforms, plugins]);
8512
+ const generateAppStore = useCallback20(
8294
8513
  (state) => {
8295
8514
  return {
8296
8515
  state,
@@ -8300,7 +8519,8 @@ function PuckProvider({ children }) {
8300
8519
  viewports,
8301
8520
  iframe,
8302
8521
  onAction,
8303
- metadata
8522
+ metadata,
8523
+ fieldTransforms: loadedFieldTransforms
8304
8524
  };
8305
8525
  },
8306
8526
  [
@@ -8311,18 +8531,19 @@ function PuckProvider({ children }) {
8311
8531
  viewports,
8312
8532
  iframe,
8313
8533
  onAction,
8314
- metadata
8534
+ metadata,
8535
+ loadedFieldTransforms
8315
8536
  ]
8316
8537
  );
8317
- const [appStore] = useState24(
8538
+ const [appStore] = useState25(
8318
8539
  () => createAppStore(generateAppStore(initialAppState))
8319
8540
  );
8320
- useEffect28(() => {
8541
+ useEffect29(() => {
8321
8542
  if (process.env.NODE_ENV !== "production") {
8322
8543
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
8323
8544
  }
8324
8545
  }, [appStore]);
8325
- useEffect28(() => {
8546
+ useEffect29(() => {
8326
8547
  const state = appStore.getState().state;
8327
8548
  appStore.setState(__spreadValues({}, generateAppStore(state)));
8328
8549
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -8331,8 +8552,8 @@ function PuckProvider({ children }) {
8331
8552
  index: initialHistoryIndex,
8332
8553
  initialAppState
8333
8554
  });
8334
- const previousData = useRef11(null);
8335
- useEffect28(() => {
8555
+ const previousData = useRef12(null);
8556
+ useEffect29(() => {
8336
8557
  appStore.subscribe(
8337
8558
  (s) => s.state.data,
8338
8559
  (data) => {
@@ -8346,11 +8567,11 @@ function PuckProvider({ children }) {
8346
8567
  }, []);
8347
8568
  useRegisterPermissionsSlice(appStore, permissions);
8348
8569
  const uPuckStore = useRegisterUsePuckStore(appStore);
8349
- useEffect28(() => {
8570
+ useEffect29(() => {
8350
8571
  const { resolveAndCommitData } = appStore.getState();
8351
8572
  resolveAndCommitData();
8352
8573
  }, []);
8353
- return /* @__PURE__ */ jsx43(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx43(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8574
+ return /* @__PURE__ */ jsx45(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx45(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8354
8575
  }
8355
8576
  function PuckLayout({ children }) {
8356
8577
  const {
@@ -8383,7 +8604,7 @@ function PuckLayout({ children }) {
8383
8604
  sidebarRef: rightSidebarRef,
8384
8605
  handleResizeEnd: handleRightSidebarResizeEnd
8385
8606
  } = useSidebarResize("right", dispatch);
8386
- useEffect28(() => {
8607
+ useEffect29(() => {
8387
8608
  if (!window.matchMedia("(min-width: 638px)").matches) {
8388
8609
  dispatch({
8389
8610
  type: "setUi",
@@ -8411,13 +8632,13 @@ function PuckLayout({ children }) {
8411
8632
  () => overrides.puck || DefaultOverride,
8412
8633
  [overrides]
8413
8634
  );
8414
- const [mounted, setMounted] = useState24(false);
8415
- useEffect28(() => {
8635
+ const [mounted, setMounted] = useState25(false);
8636
+ useEffect29(() => {
8416
8637
  setMounted(true);
8417
8638
  }, []);
8418
8639
  const ready = useAppStore((s) => s.status === "READY");
8419
8640
  useMonitorHotkeys();
8420
- useEffect28(() => {
8641
+ useEffect29(() => {
8421
8642
  if (ready && iframe.enabled) {
8422
8643
  const frameDoc = getFrame();
8423
8644
  if (frameDoc) {
@@ -8426,8 +8647,15 @@ function PuckLayout({ children }) {
8426
8647
  }
8427
8648
  }, [ready, iframe.enabled]);
8428
8649
  usePreviewModeHotkeys();
8429
- return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName30()}`, children: [
8430
- /* @__PURE__ */ jsx43(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx43(CustomPuck, { children: children || /* @__PURE__ */ jsx43(FrameProvider, { children: /* @__PURE__ */ jsx43(
8650
+ const layoutOptions = {};
8651
+ if (leftWidth) {
8652
+ layoutOptions["--puck-user-left-side-bar-width"] = `${leftWidth}px`;
8653
+ }
8654
+ if (rightWidth) {
8655
+ layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
8656
+ }
8657
+ return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName31()}`, children: [
8658
+ /* @__PURE__ */ jsx45(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx45(CustomPuck, { children: children || /* @__PURE__ */ jsx45(FrameProvider, { children: /* @__PURE__ */ jsx45(
8431
8659
  "div",
8432
8660
  {
8433
8661
  className: getLayoutClassName({
@@ -8439,41 +8667,33 @@ function PuckLayout({ children }) {
8439
8667
  "div",
8440
8668
  {
8441
8669
  className: getLayoutClassName("inner"),
8442
- style: {
8443
- gridTemplateColumns: `
8444
- ${leftSideBarVisible ? leftWidth ? `${leftWidth}px` : "var(--puck-side-bar-width)" : "0"}
8445
- var(--puck-frame-width)
8446
- ${rightSideBarVisible ? rightWidth ? `${rightWidth}px` : "var(--puck-side-bar-width)" : "0"}
8447
- `
8448
- },
8670
+ style: layoutOptions,
8449
8671
  children: [
8450
- /* @__PURE__ */ jsx43(Header, {}),
8672
+ /* @__PURE__ */ jsx45(Header, {}),
8451
8673
  /* @__PURE__ */ jsxs21(
8452
8674
  Sidebar,
8453
8675
  {
8454
8676
  position: "left",
8455
8677
  sidebarRef: leftSidebarRef,
8456
8678
  isVisible: leftSideBarVisible,
8457
- width: leftWidth,
8458
8679
  onResize: setLeftWidth,
8459
8680
  onResizeEnd: handleLeftSidebarResizeEnd,
8460
8681
  children: [
8461
- /* @__PURE__ */ jsx43(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx43(Components, {}) }),
8462
- /* @__PURE__ */ jsx43(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx43(Outline, {}) })
8682
+ /* @__PURE__ */ jsx45(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx45(Components, {}) }),
8683
+ /* @__PURE__ */ jsx45(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx45(Outline, {}) })
8463
8684
  ]
8464
8685
  }
8465
8686
  ),
8466
- /* @__PURE__ */ jsx43(Canvas, {}),
8467
- /* @__PURE__ */ jsx43(
8687
+ /* @__PURE__ */ jsx45(Canvas, {}),
8688
+ /* @__PURE__ */ jsx45(
8468
8689
  Sidebar,
8469
8690
  {
8470
8691
  position: "right",
8471
8692
  sidebarRef: rightSidebarRef,
8472
8693
  isVisible: rightSideBarVisible,
8473
- width: rightWidth,
8474
8694
  onResize: setRightWidth,
8475
8695
  onResizeEnd: handleRightSidebarResizeEnd,
8476
- children: /* @__PURE__ */ jsx43(FieldSideBar, {})
8696
+ children: /* @__PURE__ */ jsx45(FieldSideBar, {})
8477
8697
  }
8478
8698
  )
8479
8699
  ]
@@ -8481,47 +8701,17 @@ function PuckLayout({ children }) {
8481
8701
  )
8482
8702
  }
8483
8703
  ) }) }) }),
8484
- /* @__PURE__ */ jsx43("div", { id: "puck-portal-root", className: getClassName30("portal") })
8704
+ /* @__PURE__ */ jsx45("div", { id: "puck-portal-root", className: getClassName31("portal") })
8485
8705
  ] });
8486
8706
  }
8487
8707
  function Puck(props) {
8488
- return /* @__PURE__ */ jsx43(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx43(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx43(PuckLayout, __spreadValues({}, props)) })) }));
8708
+ return /* @__PURE__ */ jsx45(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx45(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx45(PuckLayout, __spreadValues({}, props)) })) }));
8489
8709
  }
8490
8710
  Puck.Components = Components;
8491
8711
  Puck.Fields = Fields;
8492
8712
  Puck.Outline = Outline;
8493
8713
  Puck.Preview = Preview2;
8494
8714
 
8495
- // lib/overlay-portal/index.tsx
8496
- init_react_import();
8497
- var registerOverlayPortal = (el, opts = {}) => {
8498
- if (!el) return;
8499
- const { disableDrag = true } = opts;
8500
- const stopPropagation = (e) => {
8501
- e.stopPropagation();
8502
- };
8503
- el.addEventListener("mouseover", stopPropagation, {
8504
- capture: true
8505
- });
8506
- if (disableDrag) {
8507
- el.addEventListener("pointerdown", stopPropagation, {
8508
- capture: true
8509
- });
8510
- }
8511
- el.setAttribute("data-puck-overlay-portal", "true");
8512
- return () => {
8513
- el.removeEventListener("mouseover", stopPropagation, {
8514
- capture: true
8515
- });
8516
- if (disableDrag) {
8517
- el.removeEventListener("pointerdown", stopPropagation, {
8518
- capture: true
8519
- });
8520
- }
8521
- el.removeAttribute("data-puck-overlay-portal");
8522
- };
8523
- };
8524
-
8525
8715
  // bundle/core.ts
8526
8716
  init_react_import();
8527
8717
 
@@ -8534,6 +8724,9 @@ init_react_import();
8534
8724
  // types/API/Viewports.ts
8535
8725
  init_react_import();
8536
8726
 
8727
+ // types/API/FieldTransforms.ts
8728
+ init_react_import();
8729
+
8537
8730
  // types/index.ts
8538
8731
  init_react_import();
8539
8732
 
@@ -8567,13 +8760,14 @@ export {
8567
8760
  AutoField,
8568
8761
  renderContext,
8569
8762
  Render,
8763
+ registerOverlayPortal,
8764
+ setDeep,
8570
8765
  DropZone,
8571
8766
  Drawer,
8572
8767
  createUsePuck,
8573
8768
  usePuck,
8574
8769
  useGetPuck,
8575
- Puck,
8576
- registerOverlayPortal
8770
+ Puck
8577
8771
  };
8578
8772
  /*! Bundled license information:
8579
8773