@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.
@@ -174,6 +174,7 @@ __export(no_external_exports, {
174
174
  registerOverlayPortal: () => registerOverlayPortal,
175
175
  renderContext: () => renderContext,
176
176
  resolveAllData: () => resolveAllData,
177
+ setDeep: () => setDeep,
177
178
  transformProps: () => transformProps,
178
179
  useGetPuck: () => useGetPuck,
179
180
  usePuck: () => usePuck,
@@ -194,6 +195,9 @@ init_react_import();
194
195
  // types/API/Viewports.ts
195
196
  init_react_import();
196
197
 
198
+ // types/API/FieldTransforms.ts
199
+ init_react_import();
200
+
197
201
  // types/index.ts
198
202
  init_react_import();
199
203
 
@@ -308,10 +312,10 @@ init_react_import();
308
312
 
309
313
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
310
314
  init_react_import();
311
- var styles_module_default2 = { "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" };
315
+ var styles_module_default2 = { "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" };
312
316
 
313
317
  // components/AutoField/index.tsx
314
- var import_react21 = require("react");
318
+ var import_react20 = require("react");
315
319
 
316
320
  // components/AutoField/fields/index.tsx
317
321
  init_react_import();
@@ -655,7 +659,7 @@ init_react_import();
655
659
 
656
660
  // components/IconButton/IconButton.tsx
657
661
  init_react_import();
658
- var import_react10 = require("react");
662
+ var import_react9 = require("react");
659
663
 
660
664
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
661
665
  init_react_import();
@@ -690,7 +694,6 @@ var replace = (list, index, newItem) => {
690
694
 
691
695
  // lib/use-reset-auto-zoom.ts
692
696
  init_react_import();
693
- var import_react9 = require("react");
694
697
 
695
698
  // store/index.ts
696
699
  init_react_import();
@@ -737,7 +740,7 @@ function forRelatedZones(item, data, cb, path = []) {
737
740
  });
738
741
  }
739
742
 
740
- // lib/data/map-slots.ts
743
+ // lib/data/map-fields.ts
741
744
  init_react_import();
742
745
 
743
746
  // lib/data/default-slots.ts
@@ -747,14 +750,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
747
750
  value
748
751
  );
749
752
 
750
- // lib/data/map-slots.ts
753
+ // lib/data/map-fields.ts
751
754
  var isPromise = (v) => !!v && typeof v.then === "function";
752
755
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
753
756
  var containsPromise = (arr) => arr.some(isPromise);
754
757
  var walkField = ({
755
758
  value,
756
759
  fields,
757
- map,
760
+ mappers,
758
761
  propKey = "",
759
762
  propPath = "",
760
763
  id = "",
@@ -762,7 +765,9 @@ var walkField = ({
762
765
  recurseSlots = false
763
766
  }) => {
764
767
  var _a, _b, _c;
765
- if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
768
+ const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
769
+ const map = mappers[fieldType];
770
+ if (map && fieldType === "slot") {
766
771
  const content = value || [];
767
772
  const mappedContent = recurseSlots ? content.map((el) => {
768
773
  var _a2;
@@ -774,7 +779,7 @@ var walkField = ({
774
779
  return walkField({
775
780
  value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
776
781
  fields: fields2,
777
- map,
782
+ mappers,
778
783
  id: el.props.id,
779
784
  config,
780
785
  recurseSlots
@@ -783,7 +788,21 @@ var walkField = ({
783
788
  if (containsPromise(mappedContent)) {
784
789
  return Promise.all(mappedContent);
785
790
  }
786
- return map(mappedContent, id, propPath, fields[propKey], propPath);
791
+ return map({
792
+ value: mappedContent,
793
+ parentId: id,
794
+ propName: propKey,
795
+ field: fields[propKey],
796
+ propPath
797
+ });
798
+ } else if (map && fields[propKey]) {
799
+ return map({
800
+ value,
801
+ parentId: id,
802
+ propName: propKey,
803
+ field: fields[propKey],
804
+ propPath
805
+ });
787
806
  }
788
807
  if (value && typeof value === "object") {
789
808
  if (Array.isArray(value)) {
@@ -793,7 +812,7 @@ var walkField = ({
793
812
  (el, idx) => walkField({
794
813
  value: el,
795
814
  fields: arrayFields,
796
- map,
815
+ mappers,
797
816
  propKey,
798
817
  propPath: `${propPath}[${idx}]`,
799
818
  id,
@@ -812,7 +831,7 @@ var walkField = ({
812
831
  return walkObject({
813
832
  value,
814
833
  fields: objectFields,
815
- map,
834
+ mappers,
816
835
  id,
817
836
  getPropPath: (k) => `${propPath}.${k}`,
818
837
  config,
@@ -825,7 +844,7 @@ var walkField = ({
825
844
  var walkObject = ({
826
845
  value,
827
846
  fields,
828
- map,
847
+ mappers,
829
848
  id,
830
849
  getPropPath,
831
850
  config,
@@ -835,7 +854,7 @@ var walkObject = ({
835
854
  const opts = {
836
855
  value: v,
837
856
  fields,
838
- map,
857
+ mappers,
839
858
  propKey: k,
840
859
  propPath: getPropPath(k),
841
860
  id,
@@ -857,14 +876,14 @@ var walkObject = ({
857
876
  }
858
877
  return flatten(newProps);
859
878
  };
860
- function mapSlots(item, map, config, recurseSlots = false) {
879
+ function mapFields(item, mappers, config, recurseSlots = false) {
861
880
  var _a, _b, _c, _d, _e;
862
881
  const itemType = "type" in item ? item.type : "root";
863
882
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
864
883
  const newProps = walkObject({
865
884
  value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
866
885
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
867
- map,
886
+ mappers,
868
887
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
869
888
  getPropPath: (k) => k,
870
889
  config,
@@ -887,7 +906,7 @@ var import_flat = __toESM(require("flat"));
887
906
  // lib/data/strip-slots.ts
888
907
  init_react_import();
889
908
  var stripSlots = (data, config) => {
890
- return mapSlots(data, () => null, config);
909
+ return mapFields(data, { slot: () => null }, config);
891
910
  };
892
911
 
893
912
  // lib/data/flatten-node.ts
@@ -946,18 +965,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
946
965
  const mappedItem = mapNodeOrSkip(item, path, index);
947
966
  if (!mappedItem) return item;
948
967
  const id = mappedItem.props.id;
949
- const newProps = __spreadProps(__spreadValues({}, mapSlots(
968
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
950
969
  mappedItem,
951
- (content, parentId2, slotId) => {
952
- const zoneCompound = `${parentId2}:${slotId}`;
953
- const [_2, newContent2] = processContent(
954
- path,
955
- zoneCompound,
956
- content,
957
- "slot",
958
- parentId2
959
- );
960
- return newContent2;
970
+ {
971
+ slot: ({ value, parentId: parentId2, propPath }) => {
972
+ const content = value;
973
+ const zoneCompound = `${parentId2}:${propPath}`;
974
+ const [_2, newContent2] = processContent(
975
+ path,
976
+ zoneCompound,
977
+ content,
978
+ "slot",
979
+ parentId2
980
+ );
981
+ return newContent2;
982
+ }
961
983
  },
962
984
  config
963
985
  ).props), {
@@ -1075,11 +1097,14 @@ init_react_import();
1075
1097
  function walkTree(data, config, callbackFn) {
1076
1098
  var _a, _b;
1077
1099
  const walkItem = (item) => {
1078
- return mapSlots(
1100
+ return mapFields(
1079
1101
  item,
1080
- (content, parentId, propName) => {
1081
- var _a2;
1082
- return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
1102
+ {
1103
+ slot: ({ value, parentId, propName }) => {
1104
+ var _a2;
1105
+ const content = value;
1106
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
1107
+ }
1083
1108
  },
1084
1109
  config,
1085
1110
  true
@@ -2145,24 +2170,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2145
2170
  resolvedItem.readOnly = readOnly;
2146
2171
  }
2147
2172
  }
2148
- let itemWithResolvedChildren = yield mapSlots(
2173
+ let itemWithResolvedChildren = yield mapFields(
2149
2174
  resolvedItem,
2150
- (content) => __async(void 0, null, function* () {
2151
- return yield Promise.all(
2152
- content.map(
2153
- (childItem) => __async(void 0, null, function* () {
2154
- return (yield resolveComponentData(
2155
- childItem,
2156
- config,
2157
- metadata,
2158
- onResolveStart,
2159
- onResolveEnd,
2160
- trigger
2161
- )).node;
2162
- })
2163
- )
2164
- );
2165
- }),
2175
+ {
2176
+ slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2177
+ const content = value;
2178
+ return yield Promise.all(
2179
+ content.map(
2180
+ (childItem) => __async(void 0, null, function* () {
2181
+ return (yield resolveComponentData(
2182
+ childItem,
2183
+ config,
2184
+ metadata,
2185
+ onResolveStart,
2186
+ onResolveEnd,
2187
+ trigger
2188
+ )).node;
2189
+ })
2190
+ )
2191
+ );
2192
+ })
2193
+ },
2166
2194
  config
2167
2195
  );
2168
2196
  if (shouldRunResolver && onResolveEnd) {
@@ -2244,7 +2272,8 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2244
2272
  },
2245
2273
  status: "LOADING",
2246
2274
  iframe: {},
2247
- metadata: {}
2275
+ metadata: {},
2276
+ fieldTransforms: {}
2248
2277
  }, initialAppStore), {
2249
2278
  fields: createFieldsSlice(set, get),
2250
2279
  history: createHistorySlice(set, get),
@@ -2560,56 +2589,18 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
2560
2589
  };
2561
2590
 
2562
2591
  // lib/use-reset-auto-zoom.ts
2563
- var import_shallow = require("zustand/react/shallow");
2564
2592
  var useResetAutoZoom = (frameRef) => {
2565
- const { viewports, zoomConfig, setZoomConfig } = useAppStore(
2566
- (0, import_shallow.useShallow)((s) => ({
2567
- viewports: s.state.ui.viewports,
2568
- zoomConfig: s.zoomConfig,
2569
- setZoomConfig: s.setZoomConfig
2570
- }))
2571
- );
2572
- const resetAutoZoom = (0, import_react9.useCallback)(
2573
- (options) => {
2574
- const newViewports = (options == null ? void 0 : options.viewports) || viewports;
2575
- if (!(options == null ? void 0 : options.isResettingRef)) {
2576
- if (frameRef.current) {
2577
- setZoomConfig(
2578
- getZoomConfig(
2579
- newViewports == null ? void 0 : newViewports.current,
2580
- frameRef.current,
2581
- zoomConfig.zoom
2582
- )
2583
- );
2584
- }
2585
- return;
2586
- }
2587
- const {
2588
- isResettingRef,
2589
- setShowTransition,
2590
- showTransition = false
2591
- } = options;
2592
- if (!isResettingRef.current) {
2593
- isResettingRef.current = true;
2594
- if (setShowTransition) {
2595
- setShowTransition(showTransition);
2596
- }
2597
- if (frameRef.current) {
2598
- setZoomConfig(
2599
- getZoomConfig(
2600
- newViewports == null ? void 0 : newViewports.current,
2601
- frameRef.current,
2602
- zoomConfig.zoom
2603
- )
2604
- );
2605
- }
2606
- setTimeout(() => {
2607
- isResettingRef.current = false;
2608
- }, 0);
2609
- }
2610
- },
2611
- [frameRef, zoomConfig, viewports, setZoomConfig]
2612
- );
2593
+ const appStoreApi = useAppStoreApi();
2594
+ const resetAutoZoom = (options) => {
2595
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
2596
+ const { viewports } = state.ui;
2597
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
2598
+ if (frameRef.current) {
2599
+ setZoomConfig(
2600
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
2601
+ );
2602
+ }
2603
+ };
2613
2604
  return resetAutoZoom;
2614
2605
  };
2615
2606
 
@@ -2657,7 +2648,7 @@ var IconButton = ({
2657
2648
  fullWidth,
2658
2649
  title
2659
2650
  }) => {
2660
- const [loading, setLoading] = (0, import_react10.useState)(false);
2651
+ const [loading, setLoading] = (0, import_react9.useState)(false);
2661
2652
  const ElementType = href ? "a" : "button";
2662
2653
  const el = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2663
2654
  ElementType,
@@ -2696,7 +2687,7 @@ var IconButton = ({
2696
2687
  };
2697
2688
 
2698
2689
  // components/AutoField/fields/ArrayField/index.tsx
2699
- var import_react15 = require("react");
2690
+ var import_react14 = require("react");
2700
2691
 
2701
2692
  // components/DragIcon/index.tsx
2702
2693
  init_react_import();
@@ -2712,12 +2703,12 @@ var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime4.j
2712
2703
 
2713
2704
  // components/Sortable/index.tsx
2714
2705
  init_react_import();
2715
- var import_react13 = require("@dnd-kit/react");
2706
+ var import_react12 = require("@dnd-kit/react");
2716
2707
 
2717
2708
  // lib/dnd/use-sensors.ts
2718
2709
  init_react_import();
2719
- var import_react11 = require("react");
2720
- var import_react12 = require("@dnd-kit/react");
2710
+ var import_react10 = require("react");
2711
+ var import_react11 = require("@dnd-kit/react");
2721
2712
  var import_utilities = require("@dnd-kit/dom/utilities");
2722
2713
  var touchDefault = { delay: { value: 200, tolerance: 10 } };
2723
2714
  var otherDefault = {
@@ -2732,8 +2723,8 @@ var useSensors = ({
2732
2723
  touch: touchDefault,
2733
2724
  other: otherDefault
2734
2725
  }) => {
2735
- const [sensors] = (0, import_react11.useState)(() => [
2736
- import_react12.PointerSensor.configure({
2726
+ const [sensors] = (0, import_react10.useState)(() => [
2727
+ import_react11.PointerSensor.configure({
2737
2728
  activationConstraints(event, source) {
2738
2729
  var _a;
2739
2730
  const { pointerType, target } = event;
@@ -3079,7 +3070,7 @@ var SortableProvider = ({
3079
3070
  mouse: { distance: { value: 5 } }
3080
3071
  });
3081
3072
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3082
- import_react13.DragDropProvider,
3073
+ import_react12.DragDropProvider,
3083
3074
  {
3084
3075
  sensors,
3085
3076
  onDragStart: (event) => {
@@ -3143,11 +3134,11 @@ var Sortable = ({
3143
3134
 
3144
3135
  // components/AutoField/context.tsx
3145
3136
  init_react_import();
3146
- var import_react14 = require("react");
3137
+ var import_react13 = require("react");
3147
3138
  var import_jsx_runtime6 = require("react/jsx-runtime");
3148
- var NestedFieldContext = (0, import_react14.createContext)({});
3139
+ var NestedFieldContext = (0, import_react13.createContext)({});
3149
3140
  var useNestedFieldContext = () => {
3150
- const context = (0, import_react14.useContext)(NestedFieldContext);
3141
+ const context = (0, import_react13.useContext)(NestedFieldContext);
3151
3142
  return __spreadProps(__spreadValues({}, context), {
3152
3143
  readOnlyFields: context.readOnlyFields || {}
3153
3144
  });
@@ -3161,7 +3152,7 @@ var NestedFieldProvider = ({
3161
3152
  }) => {
3162
3153
  const subPath = `${name}.${subName}`;
3163
3154
  const wildcardSubPath = `${wildcardName}.${subName}`;
3164
- const subReadOnlyFields = (0, import_react14.useMemo)(
3155
+ const subReadOnlyFields = (0, import_react13.useMemo)(
3165
3156
  () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
3166
3157
  const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
3167
3158
  if (isLocal) {
@@ -3214,14 +3205,14 @@ var ArrayField = ({
3214
3205
  }),
3215
3206
  openId: ""
3216
3207
  };
3217
- const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
3218
- (0, import_react15.useEffect)(() => {
3208
+ const [localState, setLocalState] = (0, import_react14.useState)({ arrayState, value });
3209
+ (0, import_react14.useEffect)(() => {
3219
3210
  var _a;
3220
3211
  const _arrayState = (_a = appStore.getState().state.ui.arrayState[id]) != null ? _a : arrayState;
3221
3212
  setLocalState({ arrayState: _arrayState, value });
3222
3213
  }, [value]);
3223
3214
  const appStore = useAppStoreApi();
3224
- const mapArrayStateToUi = (0, import_react15.useCallback)(
3215
+ const mapArrayStateToUi = (0, import_react14.useCallback)(
3225
3216
  (partialArrayState) => {
3226
3217
  const state = appStore.getState().state;
3227
3218
  return {
@@ -3232,13 +3223,13 @@ var ArrayField = ({
3232
3223
  },
3233
3224
  [arrayState, appStore]
3234
3225
  );
3235
- const getHighestIndex = (0, import_react15.useCallback)(() => {
3226
+ const getHighestIndex = (0, import_react14.useCallback)(() => {
3236
3227
  return arrayState.items.reduce(
3237
3228
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
3238
3229
  -1
3239
3230
  );
3240
3231
  }, [arrayState]);
3241
- const regenerateArrayState = (0, import_react15.useCallback)(
3232
+ const regenerateArrayState = (0, import_react14.useCallback)(
3242
3233
  (value2) => {
3243
3234
  let highestIndex = getHighestIndex();
3244
3235
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -3257,26 +3248,31 @@ var ArrayField = ({
3257
3248
  },
3258
3249
  [arrayState]
3259
3250
  );
3260
- (0, import_react15.useEffect)(() => {
3251
+ (0, import_react14.useEffect)(() => {
3261
3252
  if (arrayState.items.length > 0) {
3262
3253
  setUi(mapArrayStateToUi(arrayState));
3263
3254
  }
3264
3255
  }, []);
3265
- const [draggedItem, setDraggedItem] = (0, import_react15.useState)("");
3256
+ const [draggedItem, setDraggedItem] = (0, import_react14.useState)("");
3266
3257
  const isDraggingAny = !!draggedItem;
3267
3258
  const canEdit = useAppStore(
3268
3259
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
3269
3260
  );
3270
3261
  const forceReadOnly = !canEdit;
3271
- const valueRef = (0, import_react15.useRef)(value);
3272
- const uniqifyItem = (0, import_react15.useCallback)(
3262
+ const valueRef = (0, import_react14.useRef)(value);
3263
+ const uniqifyItem = (0, import_react14.useCallback)(
3273
3264
  (val) => {
3274
3265
  if (field.type !== "array" || !field.arrayFields) return;
3275
3266
  const config = appStore.getState().config;
3276
3267
  return walkField({
3277
3268
  value: val,
3278
3269
  fields: field.arrayFields,
3279
- map: (content) => content.map((item) => populateIds(item, config, true)),
3270
+ mappers: {
3271
+ slot: ({ value: value2 }) => {
3272
+ const content = value2;
3273
+ return content.map((item) => populateIds(item, config, true));
3274
+ }
3275
+ },
3280
3276
  config
3281
3277
  });
3282
3278
  },
@@ -3431,49 +3427,51 @@ var ArrayField = ({
3431
3427
  ]
3432
3428
  }
3433
3429
  ),
3434
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
3435
- const subField = field.arrayFields[subName];
3436
- const indexName = `${name}[${i}]`;
3437
- const subPath = `${indexName}.${subName}`;
3438
- const localIndexName = `${localName}[${i}]`;
3439
- const localWildcardName = `${localName}[*]`;
3440
- const localSubPath = `${localIndexName}.${subName}`;
3441
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
3442
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
3443
- const label2 = subField.label || subName;
3444
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3445
- NestedFieldProvider,
3446
- {
3447
- name: localIndexName,
3448
- wildcardName: localWildcardName,
3449
- subName,
3450
- readOnlyFields,
3451
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3452
- AutoFieldPrivate,
3453
- {
3454
- name: subPath,
3455
- label: label2,
3456
- id: `${_arrayId}_${subName}`,
3457
- readOnly: subReadOnly,
3458
- field: __spreadProps(__spreadValues({}, subField), {
3459
- label: label2
3460
- // May be used by custom fields
3461
- }),
3462
- value: data[subName],
3463
- onChange: (val, ui) => {
3464
- onChange(
3465
- replace(value, i, __spreadProps(__spreadValues({}, data), {
3466
- [subName]: val
3467
- })),
3468
- ui
3469
- );
3430
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: arrayState.openId === _arrayId && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
3431
+ (subName) => {
3432
+ const subField = field.arrayFields[subName];
3433
+ const indexName = `${name}[${i}]`;
3434
+ const subPath = `${indexName}.${subName}`;
3435
+ const localIndexName = `${localName}[${i}]`;
3436
+ const localWildcardName = `${localName}[*]`;
3437
+ const localSubPath = `${localIndexName}.${subName}`;
3438
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
3439
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
3440
+ const label2 = subField.label || subName;
3441
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3442
+ NestedFieldProvider,
3443
+ {
3444
+ name: localIndexName,
3445
+ wildcardName: localWildcardName,
3446
+ subName,
3447
+ readOnlyFields,
3448
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3449
+ AutoFieldPrivate,
3450
+ {
3451
+ name: subPath,
3452
+ label: label2,
3453
+ id: `${_arrayId}_${subName}`,
3454
+ readOnly: subReadOnly,
3455
+ field: __spreadProps(__spreadValues({}, subField), {
3456
+ label: label2
3457
+ // May be used by custom fields
3458
+ }),
3459
+ value: data[subName],
3460
+ onChange: (val, ui) => {
3461
+ onChange(
3462
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
3463
+ [subName]: val
3464
+ })),
3465
+ ui
3466
+ );
3467
+ }
3470
3468
  }
3471
- }
3472
- )
3473
- },
3474
- subPath
3475
- );
3476
- }) }) })
3469
+ )
3470
+ },
3471
+ subPath
3472
+ );
3473
+ }
3474
+ ) }) })
3477
3475
  ]
3478
3476
  }
3479
3477
  )
@@ -3574,11 +3572,11 @@ var DefaultField = ({
3574
3572
 
3575
3573
  // components/AutoField/fields/ExternalField/index.tsx
3576
3574
  init_react_import();
3577
- var import_react19 = require("react");
3575
+ var import_react18 = require("react");
3578
3576
 
3579
3577
  // components/ExternalInput/index.tsx
3580
3578
  init_react_import();
3581
- var import_react18 = require("react");
3579
+ var import_react17 = require("react");
3582
3580
 
3583
3581
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
3584
3582
  init_react_import();
@@ -3586,7 +3584,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
3586
3584
 
3587
3585
  // components/Modal/index.tsx
3588
3586
  init_react_import();
3589
- var import_react16 = require("react");
3587
+ var import_react15 = require("react");
3590
3588
 
3591
3589
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
3592
3590
  init_react_import();
@@ -3601,8 +3599,8 @@ var Modal = ({
3601
3599
  onClose,
3602
3600
  isOpen
3603
3601
  }) => {
3604
- const [rootEl, setRootEl] = (0, import_react16.useState)(null);
3605
- (0, import_react16.useEffect)(() => {
3602
+ const [rootEl, setRootEl] = (0, import_react15.useState)(null);
3603
+ (0, import_react15.useEffect)(() => {
3606
3604
  setRootEl(document.getElementById("puck-portal-root"));
3607
3605
  }, []);
3608
3606
  if (!rootEl) {
@@ -3649,7 +3647,7 @@ init_react_import();
3649
3647
 
3650
3648
  // components/Button/Button.tsx
3651
3649
  init_react_import();
3652
- var import_react17 = require("react");
3650
+ var import_react16 = require("react");
3653
3651
 
3654
3652
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
3655
3653
  init_react_import();
@@ -3699,8 +3697,8 @@ var Button = (_a) => {
3699
3697
  "size",
3700
3698
  "loading"
3701
3699
  ]);
3702
- const [loading, setLoading] = (0, import_react17.useState)(loadingProp);
3703
- (0, import_react17.useEffect)(() => setLoading(loadingProp), [loadingProp]);
3700
+ const [loading, setLoading] = (0, import_react16.useState)(loadingProp);
3701
+ (0, import_react16.useEffect)(() => setLoading(loadingProp), [loadingProp]);
3704
3702
  const ElementType = href ? "a" : type ? "button" : "span";
3705
3703
  const dataAttrs = filterDataAttrs(props);
3706
3704
  const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
@@ -3755,28 +3753,28 @@ var ExternalInput = ({
3755
3753
  mapRow = (val) => val,
3756
3754
  filterFields
3757
3755
  } = field || {};
3758
- const [data, setData] = (0, import_react18.useState)([]);
3759
- const [isOpen, setOpen] = (0, import_react18.useState)(false);
3760
- const [isLoading, setIsLoading] = (0, import_react18.useState)(true);
3756
+ const [data, setData] = (0, import_react17.useState)([]);
3757
+ const [isOpen, setOpen] = (0, import_react17.useState)(false);
3758
+ const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
3761
3759
  const hasFilterFields = !!filterFields;
3762
- const [filters, setFilters] = (0, import_react18.useState)(field.initialFilters || {});
3763
- const [filtersToggled, setFiltersToggled] = (0, import_react18.useState)(hasFilterFields);
3764
- const mappedData = (0, import_react18.useMemo)(() => {
3760
+ const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
3761
+ const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
3762
+ const mappedData = (0, import_react17.useMemo)(() => {
3765
3763
  return data.map(mapRow);
3766
3764
  }, [data]);
3767
- const keys = (0, import_react18.useMemo)(() => {
3765
+ const keys = (0, import_react17.useMemo)(() => {
3768
3766
  const validKeys = /* @__PURE__ */ new Set();
3769
3767
  for (const item of mappedData) {
3770
3768
  for (const key of Object.keys(item)) {
3771
- if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react18.isValidElement)(item[key])) {
3769
+ if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react17.isValidElement)(item[key])) {
3772
3770
  validKeys.add(key);
3773
3771
  }
3774
3772
  }
3775
3773
  }
3776
3774
  return Array.from(validKeys);
3777
3775
  }, [mappedData]);
3778
- const [searchQuery, setSearchQuery] = (0, import_react18.useState)(field.initialQuery || "");
3779
- const search = (0, import_react18.useCallback)(
3776
+ const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
3777
+ const search = (0, import_react17.useCallback)(
3780
3778
  (query, filters2) => __async(void 0, null, function* () {
3781
3779
  setIsLoading(true);
3782
3780
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -3789,7 +3787,7 @@ var ExternalInput = ({
3789
3787
  }),
3790
3788
  [id, field]
3791
3789
  );
3792
- const Footer = (0, import_react18.useCallback)(
3790
+ const Footer = (0, import_react17.useCallback)(
3793
3791
  (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: getClassNameModal("footer"), children: [
3794
3792
  props.items.length,
3795
3793
  " result",
@@ -3797,7 +3795,7 @@ var ExternalInput = ({
3797
3795
  ] }),
3798
3796
  [field.renderFooter]
3799
3797
  );
3800
- (0, import_react18.useEffect)(() => {
3798
+ (0, import_react17.useEffect)(() => {
3801
3799
  search(searchQuery, filters);
3802
3800
  }, []);
3803
3801
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
@@ -3970,7 +3968,7 @@ var ExternalField = ({
3970
3968
  var _a, _b, _c;
3971
3969
  const validField = field;
3972
3970
  const deprecatedField = field;
3973
- (0, import_react19.useEffect)(() => {
3971
+ (0, import_react18.useEffect)(() => {
3974
3972
  if (deprecatedField.adaptor) {
3975
3973
  console.error(
3976
3974
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -4232,12 +4230,12 @@ var ObjectField = ({
4232
4230
 
4233
4231
  // lib/use-safe-id.ts
4234
4232
  init_react_import();
4235
- var import_react20 = __toESM(require("react"));
4233
+ var import_react19 = __toESM(require("react"));
4236
4234
  var useSafeId = () => {
4237
- if (typeof import_react20.default.useId !== "undefined") {
4238
- return import_react20.default.useId();
4235
+ if (typeof import_react19.default.useId !== "undefined") {
4236
+ return import_react19.default.useId();
4239
4237
  }
4240
- const [id] = (0, import_react20.useState)(generateId());
4238
+ const [id] = (0, import_react19.useState)(generateId());
4241
4239
  return id;
4242
4240
  };
4243
4241
 
@@ -4271,7 +4269,7 @@ var FieldLabelInternal = ({
4271
4269
  readOnly
4272
4270
  }) => {
4273
4271
  const overrides = useAppStore((s) => s.overrides);
4274
- const Wrapper = (0, import_react21.useMemo)(
4272
+ const Wrapper = (0, import_react20.useMemo)(
4275
4273
  () => overrides.fieldLabel || FieldLabel,
4276
4274
  [overrides]
4277
4275
  );
@@ -4298,7 +4296,7 @@ function AutoFieldInternal(props) {
4298
4296
  var _a2;
4299
4297
  return (_a2 = s.selectedItem) == null ? void 0 : _a2.readOnly;
4300
4298
  });
4301
- const nestedFieldContext = (0, import_react21.useContext)(NestedFieldContext);
4299
+ const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
4302
4300
  const { id, Label: Label2 = FieldLabelInternal } = props;
4303
4301
  const field = props.field;
4304
4302
  const label = field.label;
@@ -4332,7 +4330,7 @@ function AutoFieldInternal(props) {
4332
4330
  Label: Label2,
4333
4331
  id: resolvedId
4334
4332
  });
4335
- const onFocus = (0, import_react21.useCallback)(
4333
+ const onFocus = (0, import_react20.useCallback)(
4336
4334
  (e) => {
4337
4335
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
4338
4336
  e.stopPropagation();
@@ -4346,7 +4344,7 @@ function AutoFieldInternal(props) {
4346
4344
  },
4347
4345
  [mergedProps.name]
4348
4346
  );
4349
- const onBlur = (0, import_react21.useCallback)((e) => {
4347
+ const onBlur = (0, import_react20.useCallback)((e) => {
4350
4348
  if ("name" in e.target) {
4351
4349
  dispatch({
4352
4350
  type: "setUi",
@@ -4399,20 +4397,20 @@ function AutoFieldInternal(props) {
4399
4397
  function AutoFieldPrivate(props) {
4400
4398
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
4401
4399
  const { value, onChange } = props;
4402
- const [localValue, setLocalValue] = (0, import_react21.useState)(value);
4403
- const onChangeLocal = (0, import_react21.useCallback)(
4400
+ const [localValue, setLocalValue] = (0, import_react20.useState)(value);
4401
+ const onChangeLocal = (0, import_react20.useCallback)(
4404
4402
  (val, ui) => {
4405
4403
  setLocalValue(val);
4406
4404
  onChange(val, ui);
4407
4405
  },
4408
4406
  [onChange]
4409
4407
  );
4410
- (0, import_react21.useEffect)(() => {
4408
+ (0, import_react20.useEffect)(() => {
4411
4409
  if (!isFocused) {
4412
4410
  setLocalValue(value);
4413
4411
  }
4414
4412
  }, [value]);
4415
- (0, import_react21.useEffect)(() => {
4413
+ (0, import_react20.useEffect)(() => {
4416
4414
  if (!isFocused) {
4417
4415
  if (value !== localValue) {
4418
4416
  setLocalValue(value);
@@ -4426,7 +4424,7 @@ function AutoFieldPrivate(props) {
4426
4424
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
4427
4425
  }
4428
4426
  function AutoField(props) {
4429
- const DefaultLabel = (0, import_react21.useMemo)(() => {
4427
+ const DefaultLabel = (0, import_react20.useMemo)(() => {
4430
4428
  const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4431
4429
  "div",
4432
4430
  __spreadProps(__spreadValues({}, labelProps), {
@@ -4463,7 +4461,7 @@ var import_react34 = require("react");
4463
4461
 
4464
4462
  // components/DraggableComponent/index.tsx
4465
4463
  init_react_import();
4466
- var import_react25 = require("react");
4464
+ var import_react24 = require("react");
4467
4465
 
4468
4466
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
4469
4467
  init_react_import();
@@ -4493,11 +4491,11 @@ function getDeepScrollPosition(element) {
4493
4491
 
4494
4492
  // components/DropZone/context.tsx
4495
4493
  init_react_import();
4496
- var import_react22 = require("react");
4494
+ var import_react21 = require("react");
4497
4495
  var import_zustand3 = require("zustand");
4498
4496
  var import_jsx_runtime19 = require("react/jsx-runtime");
4499
- var dropZoneContext = (0, import_react22.createContext)(null);
4500
- var ZoneStoreContext = (0, import_react22.createContext)(
4497
+ var dropZoneContext = (0, import_react21.createContext)(null);
4498
+ var ZoneStoreContext = (0, import_react21.createContext)(
4501
4499
  (0, import_zustand3.createStore)(() => ({
4502
4500
  zoneDepthIndex: {},
4503
4501
  nextZoneDepthIndex: {},
@@ -4520,7 +4518,7 @@ var DropZoneProvider = ({
4520
4518
  value
4521
4519
  }) => {
4522
4520
  const dispatch = useAppStore((s) => s.dispatch);
4523
- const registerZone = (0, import_react22.useCallback)(
4521
+ const registerZone = (0, import_react21.useCallback)(
4524
4522
  (zoneCompound) => {
4525
4523
  dispatch({
4526
4524
  type: "registerZone",
@@ -4529,7 +4527,7 @@ var DropZoneProvider = ({
4529
4527
  },
4530
4528
  [dispatch]
4531
4529
  );
4532
- const memoValue = (0, import_react22.useMemo)(
4530
+ const memoValue = (0, import_react21.useMemo)(
4533
4531
  () => __spreadValues({
4534
4532
  registerZone
4535
4533
  }, value),
@@ -4539,7 +4537,7 @@ var DropZoneProvider = ({
4539
4537
  };
4540
4538
 
4541
4539
  // components/DraggableComponent/index.tsx
4542
- var import_shallow3 = require("zustand/react/shallow");
4540
+ var import_shallow2 = require("zustand/react/shallow");
4543
4541
  var import_sortable2 = require("@dnd-kit/react/sortable");
4544
4542
 
4545
4543
  // lib/accumulate-transform.ts
@@ -4559,23 +4557,23 @@ function accumulateTransform(el) {
4559
4557
 
4560
4558
  // lib/use-context-store.ts
4561
4559
  init_react_import();
4562
- var import_react23 = require("react");
4560
+ var import_react22 = require("react");
4563
4561
  var import_zustand4 = require("zustand");
4564
- var import_shallow2 = require("zustand/react/shallow");
4562
+ var import_shallow = require("zustand/react/shallow");
4565
4563
  function useContextStore(context, selector) {
4566
- const store = (0, import_react23.useContext)(context);
4564
+ const store = (0, import_react22.useContext)(context);
4567
4565
  if (!store) {
4568
4566
  throw new Error("useContextStore must be used inside context");
4569
4567
  }
4570
- return (0, import_zustand4.useStore)(store, (0, import_shallow2.useShallow)(selector));
4568
+ return (0, import_zustand4.useStore)(store, (0, import_shallow.useShallow)(selector));
4571
4569
  }
4572
4570
 
4573
4571
  // lib/dnd/use-on-drag-finished.ts
4574
4572
  init_react_import();
4575
- var import_react24 = require("react");
4573
+ var import_react23 = require("react");
4576
4574
  var useOnDragFinished = (cb, deps = []) => {
4577
4575
  const appStore = useAppStoreApi();
4578
- return (0, import_react24.useCallback)(() => {
4576
+ return (0, import_react23.useCallback)(() => {
4579
4577
  let dispose = () => {
4580
4578
  };
4581
4579
  const processDragging = (isDragging2) => {
@@ -4648,9 +4646,9 @@ var DraggableComponent = ({
4648
4646
  const overrides = useAppStore((s) => s.overrides);
4649
4647
  const dispatch = useAppStore((s) => s.dispatch);
4650
4648
  const iframe = useAppStore((s) => s.iframe);
4651
- const ctx = (0, import_react25.useContext)(dropZoneContext);
4652
- const [localZones, setLocalZones] = (0, import_react25.useState)({});
4653
- const registerLocalZone = (0, import_react25.useCallback)(
4649
+ const ctx = (0, import_react24.useContext)(dropZoneContext);
4650
+ const [localZones, setLocalZones] = (0, import_react24.useState)({});
4651
+ const registerLocalZone = (0, import_react24.useCallback)(
4654
4652
  (zoneCompound2, active) => {
4655
4653
  var _a;
4656
4654
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -4660,7 +4658,7 @@ var DraggableComponent = ({
4660
4658
  },
4661
4659
  [setLocalZones]
4662
4660
  );
4663
- const unregisterLocalZone = (0, import_react25.useCallback)(
4661
+ const unregisterLocalZone = (0, import_react24.useCallback)(
4664
4662
  (zoneCompound2) => {
4665
4663
  var _a;
4666
4664
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -4673,19 +4671,19 @@ var DraggableComponent = ({
4673
4671
  [setLocalZones]
4674
4672
  );
4675
4673
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
4676
- const path = useAppStore((0, import_shallow3.useShallow)((s) => {
4674
+ const path = useAppStore((0, import_shallow2.useShallow)((s) => {
4677
4675
  var _a;
4678
4676
  return (_a = s.state.indexes.nodes[id]) == null ? void 0 : _a.path;
4679
4677
  }));
4680
4678
  const permissions = useAppStore(
4681
- (0, import_shallow3.useShallow)((s) => {
4679
+ (0, import_shallow2.useShallow)((s) => {
4682
4680
  const item = getItem({ index, zone: zoneCompound }, s.state);
4683
4681
  return s.permissions.getPermissions({ item });
4684
4682
  })
4685
4683
  );
4686
- const zoneStore = (0, import_react25.useContext)(ZoneStoreContext);
4687
- const [dragAxis, setDragAxis] = (0, import_react25.useState)(userDragAxis || autoDragAxis);
4688
- const dynamicCollisionDetector = (0, import_react25.useMemo)(
4684
+ const zoneStore = (0, import_react24.useContext)(ZoneStoreContext);
4685
+ const [dragAxis, setDragAxis] = (0, import_react24.useState)(userDragAxis || autoDragAxis);
4686
+ const dynamicCollisionDetector = (0, import_react24.useMemo)(
4689
4687
  () => createDynamicCollisionDetector(dragAxis),
4690
4688
  [dragAxis]
4691
4689
  );
@@ -4717,7 +4715,7 @@ var DraggableComponent = ({
4717
4715
  },
4718
4716
  feedback: "clone"
4719
4717
  });
4720
- (0, import_react25.useEffect)(() => {
4718
+ (0, import_react24.useEffect)(() => {
4721
4719
  const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
4722
4720
  sortable.droppable.disabled = !isEnabled;
4723
4721
  sortable.draggable.disabled = !permissions.drag;
@@ -4734,8 +4732,8 @@ var DraggableComponent = ({
4734
4732
  }
4735
4733
  return cleanup;
4736
4734
  }, [permissions.drag, zoneCompound]);
4737
- const ref = (0, import_react25.useRef)(null);
4738
- const refSetter = (0, import_react25.useCallback)(
4735
+ const ref = (0, import_react24.useRef)(null);
4736
+ const refSetter = (0, import_react24.useCallback)(
4739
4737
  (el) => {
4740
4738
  sortableRef(el);
4741
4739
  if (el) {
@@ -4744,14 +4742,14 @@ var DraggableComponent = ({
4744
4742
  },
4745
4743
  [sortableRef]
4746
4744
  );
4747
- const [portalEl, setPortalEl] = (0, import_react25.useState)();
4748
- (0, import_react25.useEffect)(() => {
4745
+ const [portalEl, setPortalEl] = (0, import_react24.useState)();
4746
+ (0, import_react24.useEffect)(() => {
4749
4747
  var _a, _b, _c;
4750
4748
  setPortalEl(
4751
4749
  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
4752
4750
  );
4753
4751
  }, [iframe.enabled, ref.current]);
4754
- const getStyle = (0, import_react25.useCallback)(() => {
4752
+ const getStyle = (0, import_react24.useCallback)(() => {
4755
4753
  var _a, _b, _c;
4756
4754
  if (!ref.current) return;
4757
4755
  const rect = ref.current.getBoundingClientRect();
@@ -4776,11 +4774,11 @@ var DraggableComponent = ({
4776
4774
  };
4777
4775
  return style2;
4778
4776
  }, [ref.current]);
4779
- const [style, setStyle] = (0, import_react25.useState)();
4780
- const sync = (0, import_react25.useCallback)(() => {
4777
+ const [style, setStyle] = (0, import_react24.useState)();
4778
+ const sync = (0, import_react24.useCallback)(() => {
4781
4779
  setStyle(getStyle());
4782
4780
  }, [ref.current, iframe]);
4783
- (0, import_react25.useEffect)(() => {
4781
+ (0, import_react24.useEffect)(() => {
4784
4782
  if (ref.current) {
4785
4783
  const observer = new ResizeObserver(sync);
4786
4784
  observer.observe(ref.current);
@@ -4790,13 +4788,13 @@ var DraggableComponent = ({
4790
4788
  }
4791
4789
  }, [ref.current]);
4792
4790
  const registerNode = useAppStore((s) => s.nodes.registerNode);
4793
- const hideOverlay = (0, import_react25.useCallback)(() => {
4791
+ const hideOverlay = (0, import_react24.useCallback)(() => {
4794
4792
  setIsVisible(false);
4795
4793
  }, []);
4796
- const showOverlay = (0, import_react25.useCallback)(() => {
4794
+ const showOverlay = (0, import_react24.useCallback)(() => {
4797
4795
  setIsVisible(true);
4798
4796
  }, []);
4799
- (0, import_react25.useEffect)(() => {
4797
+ (0, import_react24.useEffect)(() => {
4800
4798
  var _a;
4801
4799
  registerNode(id, {
4802
4800
  methods: { sync, showOverlay, hideOverlay },
@@ -4813,15 +4811,15 @@ var DraggableComponent = ({
4813
4811
  });
4814
4812
  };
4815
4813
  }, [id, zoneCompound, index, componentType, sync]);
4816
- const CustomActionBar = (0, import_react25.useMemo)(
4814
+ const CustomActionBar = (0, import_react24.useMemo)(
4817
4815
  () => overrides.actionBar || DefaultActionBar,
4818
4816
  [overrides.actionBar]
4819
4817
  );
4820
- const CustomOverlay = (0, import_react25.useMemo)(
4818
+ const CustomOverlay = (0, import_react24.useMemo)(
4821
4819
  () => overrides.componentOverlay || DefaultOverlay,
4822
4820
  [overrides.componentOverlay]
4823
4821
  );
4824
- const onClick = (0, import_react25.useCallback)(
4822
+ const onClick = (0, import_react24.useCallback)(
4825
4823
  (e) => {
4826
4824
  const el = e.target;
4827
4825
  if (!el.closest("[data-puck-overlay-portal]")) {
@@ -4837,7 +4835,7 @@ var DraggableComponent = ({
4837
4835
  [index, zoneCompound, id]
4838
4836
  );
4839
4837
  const appStore = useAppStoreApi();
4840
- const onSelectParent = (0, import_react25.useCallback)(() => {
4838
+ const onSelectParent = (0, import_react24.useCallback)(() => {
4841
4839
  const { nodes, zones } = appStore.getState().state.indexes;
4842
4840
  const node = nodes[id];
4843
4841
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -4858,26 +4856,26 @@ var DraggableComponent = ({
4858
4856
  }
4859
4857
  });
4860
4858
  }, [ctx, path]);
4861
- const onDuplicate = (0, import_react25.useCallback)(() => {
4859
+ const onDuplicate = (0, import_react24.useCallback)(() => {
4862
4860
  dispatch({
4863
4861
  type: "duplicate",
4864
4862
  sourceIndex: index,
4865
4863
  sourceZone: zoneCompound
4866
4864
  });
4867
4865
  }, [index, zoneCompound]);
4868
- const onDelete = (0, import_react25.useCallback)(() => {
4866
+ const onDelete = (0, import_react24.useCallback)(() => {
4869
4867
  dispatch({
4870
4868
  type: "remove",
4871
4869
  index,
4872
4870
  zone: zoneCompound
4873
4871
  });
4874
4872
  }, [index, zoneCompound]);
4875
- const [hover, setHover] = (0, import_react25.useState)(false);
4873
+ const [hover, setHover] = (0, import_react24.useState)(false);
4876
4874
  const indicativeHover = useContextStore(
4877
4875
  ZoneStoreContext,
4878
4876
  (s) => s.hoveringComponent === id
4879
4877
  );
4880
- (0, import_react25.useEffect)(() => {
4878
+ (0, import_react24.useEffect)(() => {
4881
4879
  if (!ref.current) {
4882
4880
  return;
4883
4881
  }
@@ -4922,10 +4920,10 @@ var DraggableComponent = ({
4922
4920
  thisIsDragging,
4923
4921
  inDroppableZone
4924
4922
  ]);
4925
- const [isVisible, setIsVisible] = (0, import_react25.useState)(false);
4926
- const [dragFinished, setDragFinished] = (0, import_react25.useState)(true);
4927
- const [_, startTransition] = (0, import_react25.useTransition)();
4928
- (0, import_react25.useEffect)(() => {
4923
+ const [isVisible, setIsVisible] = (0, import_react24.useState)(false);
4924
+ const [dragFinished, setDragFinished] = (0, import_react24.useState)(true);
4925
+ const [_, startTransition] = (0, import_react24.useTransition)();
4926
+ (0, import_react24.useEffect)(() => {
4929
4927
  startTransition(() => {
4930
4928
  if (hover || indicativeHover || isSelected) {
4931
4929
  sync();
@@ -4936,7 +4934,7 @@ var DraggableComponent = ({
4936
4934
  }
4937
4935
  });
4938
4936
  }, [hover, indicativeHover, isSelected, iframe]);
4939
- const [thisWasDragging, setThisWasDragging] = (0, import_react25.useState)(false);
4937
+ const [thisWasDragging, setThisWasDragging] = (0, import_react24.useState)(false);
4940
4938
  const onDragFinished = useOnDragFinished((finished) => {
4941
4939
  if (finished) {
4942
4940
  startTransition(() => {
@@ -4947,15 +4945,15 @@ var DraggableComponent = ({
4947
4945
  setDragFinished(false);
4948
4946
  }
4949
4947
  });
4950
- (0, import_react25.useEffect)(() => {
4948
+ (0, import_react24.useEffect)(() => {
4951
4949
  if (thisIsDragging) {
4952
4950
  setThisWasDragging(true);
4953
4951
  }
4954
4952
  }, [thisIsDragging]);
4955
- (0, import_react25.useEffect)(() => {
4953
+ (0, import_react24.useEffect)(() => {
4956
4954
  if (thisWasDragging) return onDragFinished();
4957
4955
  }, [thisWasDragging, onDragFinished]);
4958
- const syncActionsPosition = (0, import_react25.useCallback)(
4956
+ const syncActionsPosition = (0, import_react24.useCallback)(
4959
4957
  (el) => {
4960
4958
  if (el) {
4961
4959
  const view = el.ownerDocument.defaultView;
@@ -4980,7 +4978,7 @@ var DraggableComponent = ({
4980
4978
  },
4981
4979
  [zoom]
4982
4980
  );
4983
- (0, import_react25.useEffect)(() => {
4981
+ (0, import_react24.useEffect)(() => {
4984
4982
  if (userDragAxis) {
4985
4983
  setDragAxis(userDragAxis);
4986
4984
  return;
@@ -4994,11 +4992,11 @@ var DraggableComponent = ({
4994
4992
  }
4995
4993
  setDragAxis(autoDragAxis);
4996
4994
  }, [ref, userDragAxis, autoDragAxis]);
4997
- const parentAction = (0, import_react25.useMemo)(
4995
+ const parentAction = (0, import_react24.useMemo)(
4998
4996
  () => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CornerLeftUp, { size: 16 }) }),
4999
4997
  [ctx == null ? void 0 : ctx.areaId]
5000
4998
  );
5001
- const nextContextValue = (0, import_react25.useMemo)(
4999
+ const nextContextValue = (0, import_react24.useMemo)(
5002
5000
  () => __spreadProps(__spreadValues({}, ctx), {
5003
5001
  areaId: id,
5004
5002
  zoneCompound,
@@ -5094,7 +5092,7 @@ var import_react35 = require("@dnd-kit/react");
5094
5092
 
5095
5093
  // components/DropZone/lib/use-min-empty-height.ts
5096
5094
  init_react_import();
5097
- var import_react26 = require("react");
5095
+ var import_react25 = require("react");
5098
5096
  var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
5099
5097
  var useMinEmptyHeight = ({
5100
5098
  zoneCompound,
@@ -5102,8 +5100,8 @@ var useMinEmptyHeight = ({
5102
5100
  ref
5103
5101
  }) => {
5104
5102
  const appStore = useAppStoreApi();
5105
- const [prevHeight, setPrevHeight] = (0, import_react26.useState)(0);
5106
- const [isAnimating, setIsAnimating] = (0, import_react26.useState)(false);
5103
+ const [prevHeight, setPrevHeight] = (0, import_react25.useState)(0);
5104
+ const [isAnimating, setIsAnimating] = (0, import_react25.useState)(false);
5107
5105
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
5108
5106
  var _a, _b;
5109
5107
  return {
@@ -5111,7 +5109,7 @@ var useMinEmptyHeight = ({
5111
5109
  isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
5112
5110
  };
5113
5111
  });
5114
- const numItems = (0, import_react26.useRef)(0);
5112
+ const numItems = (0, import_react25.useRef)(0);
5115
5113
  const onDragFinished = useOnDragFinished(
5116
5114
  (finished) => {
5117
5115
  var _a;
@@ -5146,7 +5144,7 @@ var useMinEmptyHeight = ({
5146
5144
  },
5147
5145
  [appStore, prevHeight, zoneCompound]
5148
5146
  );
5149
- (0, import_react26.useEffect)(() => {
5147
+ (0, import_react25.useEffect)(() => {
5150
5148
  if (draggedItem && ref.current) {
5151
5149
  if (isZone) {
5152
5150
  const rect = ref.current.getBoundingClientRect();
@@ -5177,15 +5175,15 @@ function assignRefs(refs, node) {
5177
5175
 
5178
5176
  // components/DropZone/lib/use-content-with-preview.ts
5179
5177
  init_react_import();
5180
- var import_react29 = require("react");
5178
+ var import_react28 = require("react");
5181
5179
 
5182
5180
  // lib/dnd/use-rendered-callback.ts
5183
5181
  init_react_import();
5184
- var import_react27 = require("@dnd-kit/react");
5185
- var import_react28 = require("react");
5182
+ var import_react26 = require("@dnd-kit/react");
5183
+ var import_react27 = require("react");
5186
5184
  function useRenderedCallback(callback, deps) {
5187
- const manager = (0, import_react27.useDragDropManager)();
5188
- return (0, import_react28.useCallback)(
5185
+ const manager = (0, import_react26.useDragDropManager)();
5186
+ return (0, import_react27.useCallback)(
5189
5187
  (...args) => __async(this, null, function* () {
5190
5188
  yield manager == null ? void 0 : manager.renderer.rendering;
5191
5189
  return callback(...args);
@@ -5196,14 +5194,14 @@ function useRenderedCallback(callback, deps) {
5196
5194
 
5197
5195
  // components/DropZone/lib/use-content-with-preview.ts
5198
5196
  var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5199
- const zoneStore = (0, import_react29.useContext)(ZoneStoreContext);
5197
+ const zoneStore = (0, import_react28.useContext)(ZoneStoreContext);
5200
5198
  const preview = useContextStore(
5201
5199
  ZoneStoreContext,
5202
5200
  (s) => s.previewIndex[zoneCompound]
5203
5201
  );
5204
5202
  const isDragging = useAppStore((s) => s.state.ui.isDragging);
5205
- const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react29.useState)(contentIds);
5206
- const [localPreview, setLocalPreview] = (0, import_react29.useState)(
5203
+ const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react28.useState)(contentIds);
5204
+ const [localPreview, setLocalPreview] = (0, import_react28.useState)(
5207
5205
  preview
5208
5206
  );
5209
5207
  const updateContent = useRenderedCallback(
@@ -5238,7 +5236,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5238
5236
  },
5239
5237
  []
5240
5238
  );
5241
- (0, import_react29.useEffect)(() => {
5239
+ (0, import_react28.useEffect)(() => {
5242
5240
  var _a;
5243
5241
  const s = zoneStore.getState();
5244
5242
  const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
@@ -5256,16 +5254,16 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5256
5254
 
5257
5255
  // components/DropZone/lib/use-drag-axis.ts
5258
5256
  init_react_import();
5259
- var import_react30 = require("react");
5257
+ var import_react29 = require("react");
5260
5258
  var GRID_DRAG_AXIS = "dynamic";
5261
5259
  var FLEX_ROW_DRAG_AXIS = "x";
5262
5260
  var DEFAULT_DRAG_AXIS = "y";
5263
5261
  var useDragAxis = (ref, collisionAxis) => {
5264
5262
  const status = useAppStore((s) => s.status);
5265
- const [dragAxis, setDragAxis] = (0, import_react30.useState)(
5263
+ const [dragAxis, setDragAxis] = (0, import_react29.useState)(
5266
5264
  collisionAxis || DEFAULT_DRAG_AXIS
5267
5265
  );
5268
- const calculateDragAxis = (0, import_react30.useCallback)(() => {
5266
+ const calculateDragAxis = (0, import_react29.useCallback)(() => {
5269
5267
  if (ref.current) {
5270
5268
  const computedStyle = window.getComputedStyle(ref.current);
5271
5269
  if (computedStyle.display === "grid") {
@@ -5277,7 +5275,7 @@ var useDragAxis = (ref, collisionAxis) => {
5277
5275
  }
5278
5276
  }
5279
5277
  }, [ref.current]);
5280
- (0, import_react30.useEffect)(() => {
5278
+ (0, import_react29.useEffect)(() => {
5281
5279
  const onViewportChange = () => {
5282
5280
  calculateDragAxis();
5283
5281
  };
@@ -5286,57 +5284,92 @@ var useDragAxis = (ref, collisionAxis) => {
5286
5284
  window.removeEventListener("viewportchange", onViewportChange);
5287
5285
  };
5288
5286
  }, []);
5289
- (0, import_react30.useEffect)(calculateDragAxis, [status, collisionAxis]);
5287
+ (0, import_react29.useEffect)(calculateDragAxis, [status, collisionAxis]);
5290
5288
  return [dragAxis, calculateDragAxis];
5291
5289
  };
5292
5290
 
5293
5291
  // components/DropZone/index.tsx
5294
- var import_shallow5 = require("zustand/react/shallow");
5292
+ var import_shallow4 = require("zustand/react/shallow");
5295
5293
 
5296
5294
  // components/Render/index.tsx
5297
5295
  init_react_import();
5298
5296
 
5299
5297
  // lib/use-slots.tsx
5300
5298
  init_react_import();
5301
- var import_react31 = require("react");
5302
- function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
5303
- const slotProps = (0, import_react31.useMemo)(() => {
5304
- const mapped = mapSlots(
5305
- item,
5306
- (content, _parentId, propName, field, propPath) => {
5307
- const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
5308
- const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
5309
- const render = isReadOnly ? renderSlotRender : renderSlotEdit;
5310
- const Slot = (dzProps) => render(__spreadProps(__spreadValues({
5311
- allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
5312
- disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
5313
- }, dzProps), {
5314
- zone: propName,
5315
- content
5316
- }));
5317
- return Slot;
5318
- },
5319
- config
5320
- ).props;
5299
+
5300
+ // lib/field-transforms/use-field-transforms.tsx
5301
+ init_react_import();
5302
+ var import_react30 = require("react");
5303
+ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
5304
+ const mappers = (0, import_react30.useMemo)(() => {
5305
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
5306
+ const fieldType = _fieldType;
5307
+ return __spreadProps(__spreadValues({}, acc), {
5308
+ [fieldType]: (_a) => {
5309
+ var _b = _a, {
5310
+ parentId
5311
+ } = _b, params = __objRest(_b, [
5312
+ "parentId"
5313
+ ]);
5314
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
5315
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
5316
+ const fn = transforms[fieldType];
5317
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
5318
+ isReadOnly,
5319
+ componentId: parentId
5320
+ }));
5321
+ }
5322
+ });
5323
+ }, {});
5324
+ }, [transforms, readOnly, forceReadOnly]);
5325
+ const transformedProps = (0, import_react30.useMemo)(() => {
5326
+ const mapped = mapFields(item, mappers, config).props;
5321
5327
  return mapped;
5322
- }, [config, item, readOnly, forceReadOnly]);
5323
- const mergedProps = (0, import_react31.useMemo)(
5324
- () => __spreadValues(__spreadValues({}, item.props), slotProps),
5325
- [item.props, slotProps]
5328
+ }, [config, item, mappers]);
5329
+ const mergedProps = (0, import_react30.useMemo)(
5330
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
5331
+ [item.props, transformedProps]
5326
5332
  );
5327
5333
  return mergedProps;
5328
5334
  }
5329
5335
 
5336
+ // lib/field-transforms/default-transforms/slot-transform.tsx
5337
+ init_react_import();
5338
+ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
5339
+ slot: ({ value: content, propName, field, isReadOnly }) => {
5340
+ const render = isReadOnly ? renderSlotRender : renderSlotEdit;
5341
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
5342
+ allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
5343
+ disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
5344
+ }, dzProps), {
5345
+ zone: propName,
5346
+ content
5347
+ }));
5348
+ return Slot;
5349
+ }
5350
+ });
5351
+
5352
+ // lib/use-slots.tsx
5353
+ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
5354
+ return useFieldTransforms(
5355
+ config,
5356
+ item,
5357
+ getSlotTransform(renderSlotEdit, renderSlotRender),
5358
+ readOnly,
5359
+ forceReadOnly
5360
+ );
5361
+ }
5362
+
5330
5363
  // components/Render/index.tsx
5331
- var import_react33 = __toESM(require("react"));
5364
+ var import_react32 = __toESM(require("react"));
5332
5365
 
5333
5366
  // components/SlotRender/index.tsx
5334
5367
  init_react_import();
5335
- var import_shallow4 = require("zustand/react/shallow");
5368
+ var import_shallow3 = require("zustand/react/shallow");
5336
5369
 
5337
5370
  // components/SlotRender/server.tsx
5338
5371
  init_react_import();
5339
- var import_react32 = require("react");
5372
+ var import_react31 = require("react");
5340
5373
 
5341
5374
  // components/ServerRender/index.tsx
5342
5375
  init_react_import();
@@ -5405,7 +5438,7 @@ var Item = ({
5405
5438
  })
5406
5439
  );
5407
5440
  };
5408
- var SlotRender = (0, import_react32.forwardRef)(
5441
+ var SlotRender = (0, import_react31.forwardRef)(
5409
5442
  function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5410
5443
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
5411
5444
  if (!config.components[item.type]) {
@@ -5433,7 +5466,7 @@ var ContextSlotRender = ({
5433
5466
  const config = useAppStore((s) => s.config);
5434
5467
  const metadata = useAppStore((s) => s.metadata);
5435
5468
  const slotContent = useAppStore(
5436
- (0, import_shallow4.useShallow)((s) => {
5469
+ (0, import_shallow3.useShallow)((s) => {
5437
5470
  var _a, _b;
5438
5471
  const indexes = s.state.indexes;
5439
5472
  const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
@@ -5453,7 +5486,7 @@ var ContextSlotRender = ({
5453
5486
 
5454
5487
  // components/Render/index.tsx
5455
5488
  var import_jsx_runtime24 = require("react/jsx-runtime");
5456
- var renderContext = import_react33.default.createContext({
5489
+ var renderContext = import_react32.default.createContext({
5457
5490
  config: { components: {} },
5458
5491
  data: { root: {}, content: [] },
5459
5492
  metadata: {}
@@ -5486,7 +5519,7 @@ function Render({
5486
5519
  { type: "root", props: pageProps },
5487
5520
  (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
5488
5521
  );
5489
- const nextContextValue = (0, import_react33.useMemo)(
5522
+ const nextContextValue = (0, import_react32.useMemo)(
5490
5523
  () => ({
5491
5524
  mode: "render",
5492
5525
  depth: 0
@@ -5499,12 +5532,259 @@ function Render({
5499
5532
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
5500
5533
  }
5501
5534
 
5502
- // components/DropZone/index.tsx
5535
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5536
+ init_react_import();
5537
+
5538
+ // components/InlineTextField/index.tsx
5539
+ init_react_import();
5540
+ var import_react33 = require("react");
5541
+
5542
+ // lib/overlay-portal/index.tsx
5543
+ init_react_import();
5544
+ var registerOverlayPortal = (el, opts = {}) => {
5545
+ if (!el) return;
5546
+ const { disableDrag = false, disableDragOnFocus = true } = opts;
5547
+ const stopPropagation = (e) => {
5548
+ e.stopPropagation();
5549
+ };
5550
+ el.addEventListener("mouseover", stopPropagation, {
5551
+ capture: true
5552
+ });
5553
+ const onFocus = () => {
5554
+ setTimeout(() => {
5555
+ el.addEventListener("pointerdown", stopPropagation, {
5556
+ capture: true
5557
+ });
5558
+ }, 200);
5559
+ };
5560
+ const onBlur = () => {
5561
+ el.removeEventListener("pointerdown", stopPropagation, {
5562
+ capture: true
5563
+ });
5564
+ };
5565
+ if (disableDragOnFocus) {
5566
+ el.addEventListener("focus", onFocus, { capture: true });
5567
+ el.addEventListener("blur", onBlur, { capture: true });
5568
+ } else if (disableDrag) {
5569
+ el.addEventListener("pointerdown", stopPropagation, {
5570
+ capture: true
5571
+ });
5572
+ }
5573
+ el.setAttribute("data-puck-overlay-portal", "true");
5574
+ return () => {
5575
+ el.removeEventListener("mouseover", stopPropagation, {
5576
+ capture: true
5577
+ });
5578
+ if (disableDragOnFocus) {
5579
+ el.removeEventListener("focus", onFocus, { capture: true });
5580
+ el.removeEventListener("blur", onFocus, { capture: true });
5581
+ } else if (disableDrag) {
5582
+ el.removeEventListener("pointerdown", stopPropagation, {
5583
+ capture: true
5584
+ });
5585
+ }
5586
+ el.removeAttribute("data-puck-overlay-portal");
5587
+ };
5588
+ };
5589
+
5590
+ // css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css#css-module
5591
+ init_react_import();
5592
+ var styles_module_default13 = { "InlineTextField": "_InlineTextField_ilw2a_1" };
5593
+
5594
+ // lib/data/set-deep.ts
5595
+ init_react_import();
5596
+ function setDeep(node, path, newVal) {
5597
+ const parts = path.split(".");
5598
+ const newNode = __spreadValues({}, node);
5599
+ let cur = newNode;
5600
+ for (let i = 0; i < parts.length; i++) {
5601
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
5602
+ const isLast = i === parts.length - 1;
5603
+ if (idxStr !== void 0) {
5604
+ if (!Array.isArray(cur[prop])) {
5605
+ cur[prop] = [];
5606
+ }
5607
+ const idx = Number(idxStr);
5608
+ if (isLast) {
5609
+ cur[prop][idx] = newVal;
5610
+ continue;
5611
+ }
5612
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
5613
+ cur = cur[prop][idx];
5614
+ continue;
5615
+ }
5616
+ if (isLast) {
5617
+ cur[prop] = newVal;
5618
+ continue;
5619
+ }
5620
+ if (cur[prop] === void 0) {
5621
+ cur[prop] = {};
5622
+ }
5623
+ cur = cur[prop];
5624
+ }
5625
+ return __spreadValues(__spreadValues({}, node), newNode);
5626
+ }
5627
+
5628
+ // lib/get-selector-for-id.ts
5629
+ init_react_import();
5630
+ var getSelectorForId = (state, id) => {
5631
+ const node = state.indexes.nodes[id];
5632
+ if (!node) return;
5633
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5634
+ const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
5635
+ return { zone: zoneCompound, index };
5636
+ };
5637
+
5638
+ // components/InlineTextField/index.tsx
5503
5639
  var import_jsx_runtime25 = require("react/jsx-runtime");
5504
- var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
5640
+ var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
5641
+ var InlineTextFieldInternal = ({
5642
+ propPath,
5643
+ componentId,
5644
+ value,
5645
+ isReadOnly,
5646
+ opts = {}
5647
+ }) => {
5648
+ var _a;
5649
+ const ref = (0, import_react33.useRef)(null);
5650
+ const appStoreApi = useAppStoreApi();
5651
+ const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
5652
+ (0, import_react33.useEffect)(() => {
5653
+ const appStore = appStoreApi.getState();
5654
+ const data = appStore.state.indexes.nodes[componentId].data;
5655
+ const componentConfig = appStore.getComponentConfig(data.type);
5656
+ if (!componentConfig) {
5657
+ throw new Error(
5658
+ `InlineTextField Error: No config defined for ${data.type}`
5659
+ );
5660
+ }
5661
+ if (ref.current) {
5662
+ if (value !== ref.current.innerText) {
5663
+ ref.current.replaceChildren(value);
5664
+ }
5665
+ const cleanupPortal = registerOverlayPortal(ref.current);
5666
+ const handleInput = (e) => __async(void 0, null, function* () {
5667
+ var _a2;
5668
+ const appStore2 = appStoreApi.getState();
5669
+ const node = appStore2.state.indexes.nodes[componentId];
5670
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5671
+ const index = (_a2 = appStore2.state.indexes.zones[zoneCompound]) == null ? void 0 : _a2.contentIds.indexOf(
5672
+ componentId
5673
+ );
5674
+ const newProps = setDeep(node.data.props, propPath, e.target.innerText);
5675
+ const resolvedData = yield appStore2.resolveComponentData(
5676
+ __spreadProps(__spreadValues({}, node.data), { props: newProps }),
5677
+ "replace"
5678
+ );
5679
+ appStore2.dispatch({
5680
+ type: "replace",
5681
+ data: resolvedData.node,
5682
+ destinationIndex: index,
5683
+ destinationZone: zoneCompound
5684
+ });
5685
+ });
5686
+ ref.current.addEventListener("input", handleInput);
5687
+ return () => {
5688
+ var _a2;
5689
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("input", handleInput);
5690
+ cleanupPortal == null ? void 0 : cleanupPortal();
5691
+ };
5692
+ }
5693
+ }, [appStoreApi, ref.current, value]);
5694
+ const [isHovering, setIsHovering] = (0, import_react33.useState)(false);
5695
+ const [isFocused, setIsFocused] = (0, import_react33.useState)(false);
5696
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5697
+ "span",
5698
+ {
5699
+ className: getClassName17(),
5700
+ ref,
5701
+ contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
5702
+ onClick: (e) => {
5703
+ e.preventDefault();
5704
+ e.stopPropagation();
5705
+ },
5706
+ onClickCapture: (e) => {
5707
+ e.preventDefault();
5708
+ e.stopPropagation();
5709
+ const itemSelector = getSelectorForId(
5710
+ appStoreApi.getState().state,
5711
+ componentId
5712
+ );
5713
+ appStoreApi.getState().setUi({ itemSelector });
5714
+ },
5715
+ onKeyDown: (e) => {
5716
+ e.stopPropagation();
5717
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5718
+ e.preventDefault();
5719
+ }
5720
+ },
5721
+ onKeyUp: (e) => {
5722
+ e.stopPropagation();
5723
+ e.preventDefault();
5724
+ },
5725
+ onMouseOverCapture: () => setIsHovering(true),
5726
+ onMouseOutCapture: () => setIsHovering(false),
5727
+ onFocus: () => setIsFocused(true),
5728
+ onBlur: () => setIsFocused(false)
5729
+ }
5730
+ );
5731
+ };
5732
+ var InlineTextField = (0, import_react33.memo)(InlineTextFieldInternal);
5733
+
5734
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5735
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5736
+ var getInlineTextTransform = () => ({
5737
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5738
+ if (field.contentEditable) {
5739
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5740
+ InlineTextField,
5741
+ {
5742
+ propPath,
5743
+ componentId,
5744
+ value,
5745
+ opts: { disableLineBreaks: true },
5746
+ isReadOnly
5747
+ }
5748
+ );
5749
+ }
5750
+ return value;
5751
+ },
5752
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5753
+ if (field.contentEditable) {
5754
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5755
+ InlineTextField,
5756
+ {
5757
+ propPath,
5758
+ componentId,
5759
+ value,
5760
+ isReadOnly
5761
+ }
5762
+ );
5763
+ }
5764
+ return value;
5765
+ },
5766
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5767
+ if (field.contentEditable && typeof value === "string") {
5768
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5769
+ InlineTextField,
5770
+ {
5771
+ propPath,
5772
+ componentId,
5773
+ value,
5774
+ isReadOnly
5775
+ }
5776
+ );
5777
+ }
5778
+ return value;
5779
+ }
5780
+ });
5781
+
5782
+ // components/DropZone/index.tsx
5783
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5784
+ var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
5505
5785
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5506
5786
  var RENDER_DEBUG = false;
5507
- var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
5787
+ var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneEdit, __spreadValues({}, props));
5508
5788
  var DropZoneChild = ({
5509
5789
  zoneCompound,
5510
5790
  componentId,
@@ -5519,7 +5799,7 @@ var DropZoneChild = ({
5519
5799
  const { depth = 1 } = ctx != null ? ctx : {};
5520
5800
  const zoneStore = (0, import_react34.useContext)(ZoneStoreContext);
5521
5801
  const nodeProps = useAppStore(
5522
- (0, import_shallow5.useShallow)((s) => {
5802
+ (0, import_shallow4.useShallow)((s) => {
5523
5803
  var _a2;
5524
5804
  return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
5525
5805
  })
@@ -5531,7 +5811,7 @@ var DropZoneChild = ({
5531
5811
  }
5532
5812
  );
5533
5813
  const nodeReadOnly = useAppStore(
5534
- (0, import_shallow5.useShallow)((s) => {
5814
+ (0, import_shallow4.useShallow)((s) => {
5535
5815
  var _a2;
5536
5816
  return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
5537
5817
  })
@@ -5588,10 +5868,10 @@ var DropZoneChild = ({
5588
5868
  if (item && "element" in item && item.element) {
5589
5869
  return (
5590
5870
  // Safe to use this since the HTML is set by the user
5591
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5871
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5592
5872
  );
5593
5873
  }
5594
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5874
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5595
5875
  },
5596
5876
  [componentId, label, overrides]
5597
5877
  );
@@ -5611,16 +5891,24 @@ var DropZoneChild = ({
5611
5891
  [item == null ? void 0 : item.type, nodeType, defaultsProps]
5612
5892
  );
5613
5893
  const config = useAppStore((s) => s.config);
5614
- const defaultedPropsWithSlots = useSlots(
5894
+ const plugins = useAppStore((s) => s.plugins);
5895
+ const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
5896
+ const combinedFieldTransforms = (0, import_react34.useMemo)(
5897
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5898
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
5899
+ {}
5900
+ )), userFieldTransforms),
5901
+ [plugins, userFieldTransforms]
5902
+ );
5903
+ const transformedProps = useFieldTransforms(
5615
5904
  config,
5616
5905
  defaultedNode,
5617
- DropZoneEditPure,
5618
- (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
5906
+ combinedFieldTransforms,
5619
5907
  nodeReadOnly,
5620
5908
  isLoading
5621
5909
  );
5622
5910
  if (!item) return;
5623
- let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5911
+ let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5624
5912
  "No configuration for ",
5625
5913
  item.type
5626
5914
  ] });
@@ -5629,7 +5917,7 @@ var DropZoneChild = ({
5629
5917
  if (isInserting) {
5630
5918
  Render2 = renderPreview;
5631
5919
  }
5632
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5920
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5633
5921
  DraggableComponent,
5634
5922
  {
5635
5923
  id: componentId,
@@ -5643,14 +5931,14 @@ var DropZoneChild = ({
5643
5931
  autoDragAxis: dragAxis,
5644
5932
  userDragAxis: collisionAxis,
5645
5933
  inDroppableZone,
5646
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5934
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5647
5935
  Render2,
5648
- __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5649
- puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5936
+ __spreadProps(__spreadValues({}, transformedProps), {
5937
+ puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
5650
5938
  dragRef
5651
5939
  })
5652
5940
  })
5653
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5941
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Render2, __spreadValues({}, transformedProps)) })
5654
5942
  }
5655
5943
  );
5656
5944
  };
@@ -5675,7 +5963,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5675
5963
  unregisterLocalZone
5676
5964
  } = ctx != null ? ctx : {};
5677
5965
  const path = useAppStore(
5678
- (0, import_shallow5.useShallow)((s) => {
5966
+ (0, import_shallow4.useShallow)((s) => {
5679
5967
  var _a;
5680
5968
  return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
5681
5969
  })
@@ -5692,13 +5980,13 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5692
5980
  (s) => s.nextAreaDepthIndex[areaId || ""]
5693
5981
  );
5694
5982
  const zoneContentIds = useAppStore(
5695
- (0, import_shallow5.useShallow)((s) => {
5983
+ (0, import_shallow4.useShallow)((s) => {
5696
5984
  var _a;
5697
5985
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
5698
5986
  })
5699
5987
  );
5700
5988
  const zoneType = useAppStore(
5701
- (0, import_shallow5.useShallow)((s) => {
5989
+ (0, import_shallow4.useShallow)((s) => {
5702
5990
  var _a;
5703
5991
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
5704
5992
  })
@@ -5806,10 +6094,10 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5806
6094
  userMinEmptyHeight,
5807
6095
  ref
5808
6096
  });
5809
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6097
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5810
6098
  "div",
5811
6099
  {
5812
- className: `${getClassName17({
6100
+ className: `${getClassName18({
5813
6101
  isRootZone,
5814
6102
  hoveringOverArea,
5815
6103
  isEnabled,
@@ -5827,7 +6115,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
5827
6115
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
5828
6116
  }),
5829
6117
  children: contentIdsWithPreview.map((componentId, i) => {
5830
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6118
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5831
6119
  DropZoneChildMemo,
5832
6120
  {
5833
6121
  zoneCompound,
@@ -5850,7 +6138,7 @@ var DropZoneRenderItem = ({
5850
6138
  metadata
5851
6139
  }) => {
5852
6140
  const Component = config.components[item.type];
5853
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
6141
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5854
6142
  const nextContextValue = (0, import_react34.useMemo)(
5855
6143
  () => ({
5856
6144
  areaId: props.id,
@@ -5858,7 +6146,7 @@ var DropZoneRenderItem = ({
5858
6146
  }),
5859
6147
  [props]
5860
6148
  );
5861
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6149
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5862
6150
  Component.render,
5863
6151
  __spreadProps(__spreadValues({}, props), {
5864
6152
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -5868,7 +6156,7 @@ var DropZoneRenderItem = ({
5868
6156
  })
5869
6157
  ) }, props.id);
5870
6158
  };
5871
- var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadValues({}, props));
6159
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRender2, __spreadValues({}, props));
5872
6160
  var DropZoneRender2 = (0, import_react34.forwardRef)(
5873
6161
  function DropZoneRenderInternal({ className, style, zone }, ref) {
5874
6162
  const ctx = (0, import_react34.useContext)(dropZoneContext);
@@ -5889,10 +6177,10 @@ var DropZoneRender2 = (0, import_react34.forwardRef)(
5889
6177
  if (zoneCompound !== rootDroppableId) {
5890
6178
  content = setupZone(data, zoneCompound).zones[zoneCompound];
5891
6179
  }
5892
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
6180
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, style, ref, children: content.map((item) => {
5893
6181
  const Component = config.components[item.type];
5894
6182
  if (Component) {
5895
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6183
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5896
6184
  DropZoneRenderItem,
5897
6185
  {
5898
6186
  config,
@@ -5906,14 +6194,14 @@ var DropZoneRender2 = (0, import_react34.forwardRef)(
5906
6194
  }) });
5907
6195
  }
5908
6196
  );
5909
- var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, __spreadValues({}, props));
6197
+ var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZone, __spreadValues({}, props));
5910
6198
  var DropZone = (0, import_react34.forwardRef)(
5911
6199
  function DropZone2(props, ref) {
5912
6200
  const ctx = (0, import_react34.useContext)(dropZoneContext);
5913
6201
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
5914
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6202
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5915
6203
  }
5916
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
6204
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
5917
6205
  }
5918
6206
  );
5919
6207
 
@@ -6249,7 +6537,7 @@ function getDeepDir(el) {
6249
6537
 
6250
6538
  // components/DragDropContext/index.tsx
6251
6539
  var import_state = require("@dnd-kit/state");
6252
- var import_jsx_runtime26 = require("react/jsx-runtime");
6540
+ var import_jsx_runtime28 = require("react/jsx-runtime");
6253
6541
  var DEBUG3 = false;
6254
6542
  var dragListenerContext = (0, import_react37.createContext)({
6255
6543
  dragListeners: {}
@@ -6418,14 +6706,14 @@ var DragDropContextClient = ({
6418
6706
  }),
6419
6707
  []
6420
6708
  );
6421
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6709
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6422
6710
  dragListenerContext.Provider,
6423
6711
  {
6424
6712
  value: {
6425
6713
  dragListeners,
6426
6714
  setDragListeners
6427
6715
  },
6428
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6716
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6429
6717
  import_react36.DragDropProvider,
6430
6718
  {
6431
6719
  plugins,
@@ -6641,7 +6929,7 @@ var DragDropContextClient = ({
6641
6929
  const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
6642
6930
  entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
6643
6931
  },
6644
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6932
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6645
6933
  }
6646
6934
  )
6647
6935
  }
@@ -6655,13 +6943,13 @@ var DragDropContext = ({
6655
6943
  if (status === "LOADING") {
6656
6944
  return children;
6657
6945
  }
6658
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DragDropContextClient, { disableAutoScroll, children });
6946
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DragDropContextClient, { disableAutoScroll, children });
6659
6947
  };
6660
6948
 
6661
6949
  // components/Drawer/index.tsx
6662
6950
  var import_react39 = require("@dnd-kit/react");
6663
- var import_jsx_runtime27 = require("react/jsx-runtime");
6664
- var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
6951
+ var import_jsx_runtime29 = require("react/jsx-runtime");
6952
+ var getClassName19 = get_class_name_factory_default("Drawer", styles_module_default10);
6665
6953
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
6666
6954
  var DrawerItemInner = ({
6667
6955
  children,
@@ -6671,10 +6959,10 @@ var DrawerItemInner = ({
6671
6959
  isDragDisabled
6672
6960
  }) => {
6673
6961
  const CustomInner = (0, import_react38.useMemo)(
6674
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6962
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6675
6963
  [children]
6676
6964
  );
6677
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6965
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6678
6966
  "div",
6679
6967
  {
6680
6968
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -6682,9 +6970,9 @@ var DrawerItemInner = ({
6682
6970
  onMouseDown: (e) => e.preventDefault(),
6683
6971
  "data-testid": dragRef ? `drawer-item:${name}` : "",
6684
6972
  "data-puck-drawer-item": true,
6685
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
6686
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6687
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DragIcon, {}) })
6973
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
6974
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6975
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DragIcon, {}) })
6688
6976
  ] }) }) })
6689
6977
  }
6690
6978
  );
@@ -6702,9 +6990,9 @@ var DrawerItemDraggable = ({
6702
6990
  disabled: isDragDisabled,
6703
6991
  type: "drawer"
6704
6992
  });
6705
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName18("draggable"), children: [
6706
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name, label, children }) }),
6707
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6993
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName19("draggable"), children: [
6994
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName19("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DrawerItemInner, { name, label, children }) }),
6995
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName19("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6708
6996
  DrawerItemInner,
6709
6997
  {
6710
6998
  name,
@@ -6738,7 +7026,7 @@ var DrawerItem = ({
6738
7026
  },
6739
7027
  [resolvedId]
6740
7028
  );
6741
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7029
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6742
7030
  DrawerItemDraggable,
6743
7031
  {
6744
7032
  name,
@@ -6771,10 +7059,10 @@ var Drawer = ({
6771
7059
  collisionPriority: 0
6772
7060
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
6773
7061
  });
6774
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7062
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6775
7063
  "div",
6776
7064
  {
6777
- className: getClassName18(),
7065
+ className: getClassName19(),
6778
7066
  ref,
6779
7067
  "data-puck-dnd": id,
6780
7068
  "data-puck-drawer": true,
@@ -6794,7 +7082,7 @@ init_react_import();
6794
7082
 
6795
7083
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6796
7084
  init_react_import();
6797
- 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" };
7085
+ 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" };
6798
7086
 
6799
7087
  // lib/use-breadcrumbs.ts
6800
7088
  init_react_import();
@@ -6841,8 +7129,8 @@ var useBreadcrumbs = (renderCount) => {
6841
7129
  };
6842
7130
 
6843
7131
  // components/SidebarSection/index.tsx
6844
- var import_jsx_runtime28 = require("react/jsx-runtime");
6845
- var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
7132
+ var import_jsx_runtime30 = require("react/jsx-runtime");
7133
+ var getClassName20 = get_class_name_factory_default("SidebarSection", styles_module_default14);
6846
7134
  var SidebarSection = ({
6847
7135
  children,
6848
7136
  title,
@@ -6854,29 +7142,29 @@ var SidebarSection = ({
6854
7142
  }) => {
6855
7143
  const setUi = useAppStore((s) => s.setUi);
6856
7144
  const breadcrumbs = useBreadcrumbs(1);
6857
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
7145
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6858
7146
  "div",
6859
7147
  {
6860
- className: getClassName19({ noBorderTop, noPadding }),
7148
+ className: getClassName20({ noBorderTop, noPadding }),
6861
7149
  style: { background },
6862
7150
  children: [
6863
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
6864
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
6865
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7151
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("title"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName20("breadcrumbs"), children: [
7152
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName20("breadcrumb"), children: [
7153
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6866
7154
  "button",
6867
7155
  {
6868
7156
  type: "button",
6869
- className: getClassName19("breadcrumbLabel"),
7157
+ className: getClassName20("breadcrumbLabel"),
6870
7158
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6871
7159
  children: breadcrumb.label
6872
7160
  }
6873
7161
  ),
6874
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
7162
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronRight, { size: 16 })
6875
7163
  ] }, i)) : null,
6876
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
7164
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
6877
7165
  ] }) }),
6878
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
6879
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
7166
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("content"), children }),
7167
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Loader, { size: 32 }) })
6880
7168
  ]
6881
7169
  }
6882
7170
  );
@@ -6884,24 +7172,24 @@ var SidebarSection = ({
6884
7172
 
6885
7173
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
6886
7174
  init_react_import();
6887
- 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" };
7175
+ 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" };
6888
7176
 
6889
7177
  // components/Puck/components/Fields/index.tsx
6890
7178
  init_react_import();
6891
7179
 
6892
7180
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
6893
7181
  init_react_import();
6894
- 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" };
7182
+ 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" };
6895
7183
 
6896
7184
  // components/Puck/components/Fields/index.tsx
6897
7185
  var import_react41 = require("react");
6898
- var import_shallow6 = require("zustand/react/shallow");
6899
- var import_jsx_runtime29 = require("react/jsx-runtime");
6900
- var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
7186
+ var import_shallow5 = require("zustand/react/shallow");
7187
+ var import_jsx_runtime31 = require("react/jsx-runtime");
7188
+ var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
6901
7189
  var DefaultFields = ({
6902
7190
  children
6903
7191
  }) => {
6904
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
7192
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
6905
7193
  };
6906
7194
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6907
7195
  let currentProps;
@@ -6961,7 +7249,7 @@ var FieldsChild = ({ fieldName }) => {
6961
7249
  return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
6962
7250
  });
6963
7251
  const permissions = useAppStore(
6964
- (0, import_shallow6.useShallow)((s) => {
7252
+ (0, import_shallow5.useShallow)((s) => {
6965
7253
  const { selectedItem, permissions: permissions2 } = s;
6966
7254
  return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
6967
7255
  })
@@ -6973,7 +7261,7 @@ var FieldsChild = ({ fieldName }) => {
6973
7261
  const { visible = true } = field != null ? field : {};
6974
7262
  if (!field || !id || !visible) return null;
6975
7263
  if (field.type === "slot") return null;
6976
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("field"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7264
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6977
7265
  AutoFieldPrivate,
6978
7266
  {
6979
7267
  field,
@@ -6993,7 +7281,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
6993
7281
  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;
6994
7282
  return (loadingCount != null ? loadingCount : 0) > 0;
6995
7283
  });
6996
- const itemSelector = useAppStore((0, import_shallow6.useShallow)((s) => s.state.ui.itemSelector));
7284
+ const itemSelector = useAppStore((0, import_shallow5.useShallow)((s) => s.state.ui.itemSelector));
6997
7285
  const id = useAppStore((s) => {
6998
7286
  var _a;
6999
7287
  return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
@@ -7002,7 +7290,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
7002
7290
  useRegisterFieldsSlice(appStore, id);
7003
7291
  const fieldsLoading = useAppStore((s) => s.fields.loading);
7004
7292
  const fieldNames = useAppStore(
7005
- (0, import_shallow6.useShallow)((s) => {
7293
+ (0, import_shallow5.useShallow)((s) => {
7006
7294
  if (s.fields.id === id) {
7007
7295
  return Object.keys(s.fields.fields);
7008
7296
  }
@@ -7011,16 +7299,16 @@ var FieldsInternal = ({ wrapFields = true }) => {
7011
7299
  );
7012
7300
  const isLoading = fieldsLoading || componentResolving;
7013
7301
  const Wrapper = (0, import_react41.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
7014
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
7302
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
7015
7303
  "form",
7016
7304
  {
7017
- className: getClassName20({ wrapFields }),
7305
+ className: getClassName21({ wrapFields }),
7018
7306
  onSubmit: (e) => {
7019
7307
  e.preventDefault();
7020
7308
  },
7021
7309
  children: [
7022
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
7023
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Loader, { size: 16 }) }) })
7310
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
7311
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Loader, { size: 16 }) }) })
7024
7312
  ]
7025
7313
  }
7026
7314
  );
@@ -7039,12 +7327,12 @@ init_react_import();
7039
7327
 
7040
7328
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
7041
7329
  init_react_import();
7042
- 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" };
7330
+ 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" };
7043
7331
 
7044
7332
  // components/ComponentList/index.tsx
7045
7333
  var import_react42 = require("react");
7046
- var import_jsx_runtime30 = require("react/jsx-runtime");
7047
- var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
7334
+ var import_jsx_runtime32 = require("react/jsx-runtime");
7335
+ var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
7048
7336
  var ComponentListItem = ({
7049
7337
  name,
7050
7338
  label
@@ -7063,7 +7351,7 @@ var ComponentListItem = ({
7063
7351
  );
7064
7352
  }
7065
7353
  }, [overrides]);
7066
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
7354
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
7067
7355
  };
7068
7356
  var ComponentList = ({
7069
7357
  children,
@@ -7074,12 +7362,12 @@ var ComponentList = ({
7074
7362
  const setUi = useAppStore((s) => s.setUi);
7075
7363
  const componentList = useAppStore((s) => s.state.ui.componentList);
7076
7364
  const { expanded = true } = componentList[id] || {};
7077
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName21({ isExpanded: expanded }), children: [
7078
- title && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
7365
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
7366
+ title && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
7079
7367
  "button",
7080
7368
  {
7081
7369
  type: "button",
7082
- className: getClassName21("title"),
7370
+ className: getClassName22("title"),
7083
7371
  onClick: () => setUi({
7084
7372
  componentList: __spreadProps(__spreadValues({}, componentList), {
7085
7373
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -7089,14 +7377,14 @@ var ComponentList = ({
7089
7377
  }),
7090
7378
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
7091
7379
  children: [
7092
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: title }),
7093
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: 12 }) })
7380
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: title }),
7381
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDown, { size: 12 }) })
7094
7382
  ]
7095
7383
  }
7096
7384
  ),
7097
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName21("content"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
7385
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
7098
7386
  var _a;
7099
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7387
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
7100
7388
  ComponentListItem,
7101
7389
  {
7102
7390
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -7110,7 +7398,7 @@ var ComponentList = ({
7110
7398
  ComponentList.Item = ComponentListItem;
7111
7399
 
7112
7400
  // lib/use-component-list.tsx
7113
- var import_jsx_runtime31 = require("react/jsx-runtime");
7401
+ var import_jsx_runtime33 = require("react/jsx-runtime");
7114
7402
  var useComponentList = () => {
7115
7403
  const [componentList, setComponentList] = (0, import_react43.useState)();
7116
7404
  const config = useAppStore((s) => s.config);
@@ -7125,7 +7413,7 @@ var useComponentList = () => {
7125
7413
  if (category.visible === false || !category.components) {
7126
7414
  return null;
7127
7415
  }
7128
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7416
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7129
7417
  ComponentList,
7130
7418
  {
7131
7419
  id: categoryKey,
@@ -7134,7 +7422,7 @@ var useComponentList = () => {
7134
7422
  var _a2;
7135
7423
  matchedComponents.push(componentName);
7136
7424
  const componentConf = config.components[componentName] || {};
7137
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7425
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7138
7426
  ComponentList.Item,
7139
7427
  {
7140
7428
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -7154,7 +7442,7 @@ var useComponentList = () => {
7154
7442
  );
7155
7443
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
7156
7444
  _componentList.push(
7157
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7445
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7158
7446
  ComponentList,
7159
7447
  {
7160
7448
  id: "other",
@@ -7162,7 +7450,7 @@ var useComponentList = () => {
7162
7450
  children: remainingComponents.map((componentName, i) => {
7163
7451
  var _a2;
7164
7452
  const componentConf = config.components[componentName] || {};
7165
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7453
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7166
7454
  ComponentList.Item,
7167
7455
  {
7168
7456
  name: componentName,
@@ -7185,7 +7473,7 @@ var useComponentList = () => {
7185
7473
 
7186
7474
  // components/Puck/components/Components/index.tsx
7187
7475
  var import_react44 = require("react");
7188
- var import_jsx_runtime32 = require("react/jsx-runtime");
7476
+ var import_jsx_runtime34 = require("react/jsx-runtime");
7189
7477
  var Components = () => {
7190
7478
  const overrides = useAppStore((s) => s.overrides);
7191
7479
  const componentList = useComponentList();
@@ -7197,7 +7485,7 @@ var Components = () => {
7197
7485
  }
7198
7486
  return overrides.components || overrides.drawer || "div";
7199
7487
  }, [overrides]);
7200
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComponentList, { id: "all" }) });
7488
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComponentList, { id: "all" }) });
7201
7489
  };
7202
7490
 
7203
7491
  // components/Puck/components/Preview/index.tsx
@@ -7209,7 +7497,7 @@ init_react_import();
7209
7497
  var import_react45 = require("react");
7210
7498
  var import_object_hash = __toESM(require("object-hash"));
7211
7499
  var import_react_dom3 = require("react-dom");
7212
- var import_jsx_runtime33 = require("react/jsx-runtime");
7500
+ var import_jsx_runtime35 = require("react/jsx-runtime");
7213
7501
  var styleSelector = 'style, link[rel="stylesheet"]';
7214
7502
  var collectStyles = (doc) => {
7215
7503
  const collected = [];
@@ -7416,7 +7704,7 @@ var CopyHostStyles = ({
7416
7704
  observer.disconnect();
7417
7705
  };
7418
7706
  }, []);
7419
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
7707
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children });
7420
7708
  };
7421
7709
  var autoFrameContext = (0, import_react45.createContext)({});
7422
7710
  var useFrame = () => (0, import_react45.useContext)(autoFrameContext);
@@ -7463,7 +7751,7 @@ function AutoFrame(_a) {
7463
7751
  }
7464
7752
  }
7465
7753
  }, [frameRef, loaded, stylesLoaded]);
7466
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7754
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7467
7755
  "iframe",
7468
7756
  __spreadProps(__spreadValues({}, props), {
7469
7757
  className,
@@ -7473,7 +7761,7 @@ function AutoFrame(_a) {
7473
7761
  onLoad: () => {
7474
7762
  setLoaded(true);
7475
7763
  },
7476
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7764
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7477
7765
  CopyHostStyles,
7478
7766
  {
7479
7767
  debug,
@@ -7489,11 +7777,11 @@ var AutoFrame_default = AutoFrame;
7489
7777
 
7490
7778
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
7491
7779
  init_react_import();
7492
- var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7780
+ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7493
7781
 
7494
7782
  // components/Puck/components/Preview/index.tsx
7495
- var import_jsx_runtime34 = require("react/jsx-runtime");
7496
- var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
7783
+ var import_jsx_runtime36 = require("react/jsx-runtime");
7784
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
7497
7785
  var useBubbleIframeEvents = (ref) => {
7498
7786
  const status = useAppStore((s) => s.status);
7499
7787
  (0, import_react46.useEffect)(() => {
@@ -7555,7 +7843,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7555
7843
  );
7556
7844
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
7557
7845
  id: "puck-root"
7558
- }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: propsWithSlots.children });
7846
+ }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: propsWithSlots.children });
7559
7847
  },
7560
7848
  [config]
7561
7849
  );
@@ -7563,7 +7851,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7563
7851
  const rootProps = root.props || root;
7564
7852
  const ref = (0, import_react46.useRef)(null);
7565
7853
  useBubbleIframeEvents(ref);
7566
- const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7854
+ const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7567
7855
  Page,
7568
7856
  __spreadProps(__spreadValues({}, rootProps), {
7569
7857
  puck: {
@@ -7573,18 +7861,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
7573
7861
  metadata
7574
7862
  },
7575
7863
  editMode: true,
7576
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
7864
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZonePure, { zone: rootDroppableId })
7577
7865
  })
7578
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render, { data: renderData, config, metadata });
7866
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Render, { data: renderData, config, metadata });
7579
7867
  (0, import_react46.useEffect)(() => {
7580
7868
  if (!iframe.enabled) {
7581
7869
  setStatus("READY");
7582
7870
  }
7583
7871
  }, [iframe.enabled]);
7584
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7872
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7585
7873
  "div",
7586
7874
  {
7587
- className: getClassName22(),
7875
+ className: getClassName23(),
7588
7876
  id,
7589
7877
  "data-puck-preview": true,
7590
7878
  onClick: (e) => {
@@ -7593,11 +7881,11 @@ var Preview2 = ({ id = "puck-preview" }) => {
7593
7881
  dispatch({ type: "setUi", ui: { itemSelector: null } });
7594
7882
  }
7595
7883
  },
7596
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7884
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7597
7885
  AutoFrame_default,
7598
7886
  {
7599
7887
  id: "preview-frame",
7600
- className: getClassName22("frame"),
7888
+ className: getClassName23("frame"),
7601
7889
  "data-rfd-iframe": true,
7602
7890
  onReady: () => {
7603
7891
  setStatus("READY");
@@ -7606,18 +7894,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
7606
7894
  setStatus("MOUNTED");
7607
7895
  },
7608
7896
  frameRef: ref,
7609
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7897
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7610
7898
  if (Frame) {
7611
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Frame, { document: document2, children: inner });
7899
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Frame, { document: document2, children: inner });
7612
7900
  }
7613
7901
  return inner;
7614
7902
  } })
7615
7903
  }
7616
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7904
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7617
7905
  "div",
7618
7906
  {
7619
7907
  id: "preview-frame",
7620
- className: getClassName22("frame"),
7908
+ className: getClassName23("frame"),
7621
7909
  ref,
7622
7910
  "data-puck-entry": true,
7623
7911
  children: inner
@@ -7635,7 +7923,7 @@ init_react_import();
7635
7923
 
7636
7924
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
7637
7925
  init_react_import();
7638
- 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" };
7926
+ 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" };
7639
7927
 
7640
7928
  // lib/scroll-into-view.ts
7641
7929
  init_react_import();
@@ -7671,10 +7959,10 @@ var onScrollEnd = (frame, cb) => {
7671
7959
  };
7672
7960
 
7673
7961
  // components/LayerTree/index.tsx
7674
- var import_shallow7 = require("zustand/react/shallow");
7675
- var import_jsx_runtime35 = require("react/jsx-runtime");
7676
- var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
7677
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
7962
+ var import_shallow6 = require("zustand/react/shallow");
7963
+ var import_jsx_runtime37 = require("react/jsx-runtime");
7964
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
7965
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
7678
7966
  var Layer = ({
7679
7967
  index,
7680
7968
  itemId,
@@ -7697,7 +7985,7 @@ var Layer = ({
7697
7985
  const isSelected = selecedItemId === itemId || itemSelector && itemSelector.zone === rootDroppableId && !zoneCompound;
7698
7986
  const nodeData = useAppStore((s) => s.state.indexes.nodes[itemId]);
7699
7987
  const zonesForItem = useAppStore(
7700
- (0, import_shallow7.useShallow)(
7988
+ (0, import_shallow6.useShallow)(
7701
7989
  (s) => Object.keys(s.state.indexes.zones).filter(
7702
7990
  (z) => z.split(":")[0] === itemId
7703
7991
  )
@@ -7719,7 +8007,7 @@ var Layer = ({
7719
8007
  });
7720
8008
  const componentConfig = config.components[nodeData.data.type];
7721
8009
  const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
7722
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
8010
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7723
8011
  "li",
7724
8012
  {
7725
8013
  className: getClassNameLayer({
@@ -7729,7 +8017,7 @@ var Layer = ({
7729
8017
  childIsSelected
7730
8018
  }),
7731
8019
  children: [
7732
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
8020
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7733
8021
  "button",
7734
8022
  {
7735
8023
  type: "button",
@@ -7767,22 +8055,22 @@ var Layer = ({
7767
8055
  zoneStore.setState({ hoveringComponent: null });
7768
8056
  },
7769
8057
  children: [
7770
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
8058
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7771
8059
  "div",
7772
8060
  {
7773
8061
  className: getClassNameLayer("chevron"),
7774
8062
  title: isSelected ? "Collapse" : "Expand",
7775
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { size: "12" })
8063
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDown, { size: "12" })
7776
8064
  }
7777
8065
  ),
7778
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassNameLayer("title"), children: [
7779
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayoutGrid, { size: "16" }) }),
7780
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("name"), children: label })
8066
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassNameLayer("title"), children: [
8067
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LayoutGrid, { size: "16" }) }),
8068
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("name"), children: label })
7781
8069
  ] })
7782
8070
  ]
7783
8071
  }
7784
8072
  ) }),
7785
- containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
8073
+ containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LayerTree, { zoneCompound: subzone }) }, subzone))
7786
8074
  ]
7787
8075
  }
7788
8076
  );
@@ -7801,22 +8089,22 @@ var LayerTree = ({
7801
8089
  return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
7802
8090
  });
7803
8091
  const contentIds = useAppStore(
7804
- (0, import_shallow7.useShallow)(
8092
+ (0, import_shallow6.useShallow)(
7805
8093
  (s) => {
7806
8094
  var _a, _b;
7807
8095
  return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
7808
8096
  }
7809
8097
  )
7810
8098
  );
7811
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7812
- label && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName23("zoneTitle"), children: [
7813
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Layers, { size: "16" }) }),
8099
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
8100
+ label && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
8101
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Layers, { size: "16" }) }),
7814
8102
  label
7815
8103
  ] }),
7816
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("ul", { className: getClassName23(), children: [
7817
- contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("helper"), children: "No items" }),
8104
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("ul", { className: getClassName24(), children: [
8105
+ contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
7818
8106
  contentIds.map((itemId, i) => {
7819
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
8107
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7820
8108
  Layer,
7821
8109
  {
7822
8110
  index: i,
@@ -7842,15 +8130,15 @@ var findZonesForArea = (state, area) => {
7842
8130
  };
7843
8131
 
7844
8132
  // components/Puck/components/Outline/index.tsx
7845
- var import_shallow8 = require("zustand/react/shallow");
7846
- var import_jsx_runtime36 = require("react/jsx-runtime");
8133
+ var import_shallow7 = require("zustand/react/shallow");
8134
+ var import_jsx_runtime38 = require("react/jsx-runtime");
7847
8135
  var Outline = () => {
7848
8136
  const outlineOverride = useAppStore((s) => s.overrides.outline);
7849
8137
  const rootZones = useAppStore(
7850
- (0, import_shallow8.useShallow)((s) => findZonesForArea(s.state, "root"))
8138
+ (0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
7851
8139
  );
7852
8140
  const Wrapper = (0, import_react48.useMemo)(() => outlineOverride || "div", [outlineOverride]);
7853
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8141
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7854
8142
  LayerTree,
7855
8143
  {
7856
8144
  label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
@@ -7870,17 +8158,17 @@ var import_react49 = require("react");
7870
8158
 
7871
8159
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7872
8160
  init_react_import();
7873
- 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" };
8161
+ 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" };
7874
8162
 
7875
8163
  // components/ViewportControls/index.tsx
7876
- var import_jsx_runtime37 = require("react/jsx-runtime");
8164
+ var import_jsx_runtime39 = require("react/jsx-runtime");
7877
8165
  var icons = {
7878
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Smartphone, { size: 16 }),
7879
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tablet, { size: 16 }),
7880
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Monitor, { size: 16 })
8166
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Smartphone, { size: 16 }),
8167
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Tablet, { size: 16 }),
8168
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Monitor, { size: 16 })
7881
8169
  };
7882
- var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
7883
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
8170
+ var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
8171
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
7884
8172
  var ViewportButton = ({
7885
8173
  children,
7886
8174
  height = "auto",
@@ -7893,7 +8181,7 @@ var ViewportButton = ({
7893
8181
  (0, import_react49.useEffect)(() => {
7894
8182
  setIsActive(width === viewports.current.width);
7895
8183
  }, [width, viewports.current.width]);
7896
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8184
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7897
8185
  IconButton,
7898
8186
  {
7899
8187
  type: "button",
@@ -7903,7 +8191,7 @@ var ViewportButton = ({
7903
8191
  e.stopPropagation();
7904
8192
  onClick({ width, height });
7905
8193
  },
7906
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton("inner"), children })
8194
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: getClassNameButton("inner"), children })
7907
8195
  }
7908
8196
  ) });
7909
8197
  };
@@ -7939,8 +8227,8 @@ var ViewportControls = ({
7939
8227
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7940
8228
  [autoZoom]
7941
8229
  );
7942
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24(), children: [
7943
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8230
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName25(), children: [
8231
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7944
8232
  ViewportButton,
7945
8233
  {
7946
8234
  height: viewport.height,
@@ -7951,8 +8239,8 @@ var ViewportControls = ({
7951
8239
  },
7952
8240
  i
7953
8241
  )),
7954
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
7955
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8242
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("divider") }),
8243
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7956
8244
  IconButton,
7957
8245
  {
7958
8246
  type: "button",
@@ -7967,10 +8255,10 @@ var ViewportControls = ({
7967
8255
  )].value
7968
8256
  );
7969
8257
  },
7970
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomOut, { size: 16 })
8258
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ZoomOut, { size: 16 })
7971
8259
  }
7972
8260
  ),
7973
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8261
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7974
8262
  IconButton,
7975
8263
  {
7976
8264
  type: "button",
@@ -7985,19 +8273,19 @@ var ViewportControls = ({
7985
8273
  )].value
7986
8274
  );
7987
8275
  },
7988
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomIn, { size: 16 })
8276
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ZoomIn, { size: 16 })
7989
8277
  }
7990
8278
  ),
7991
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
7992
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8279
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("divider") }),
8280
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7993
8281
  "select",
7994
8282
  {
7995
- className: getClassName24("zoomSelect"),
8283
+ className: getClassName25("zoomSelect"),
7996
8284
  value: zoom.toString(),
7997
8285
  onChange: (e) => {
7998
8286
  onZoom(parseFloat(e.currentTarget.value));
7999
8287
  },
8000
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8288
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8001
8289
  "option",
8002
8290
  {
8003
8291
  value: option.value,
@@ -8012,15 +8300,15 @@ var ViewportControls = ({
8012
8300
 
8013
8301
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
8014
8302
  init_react_import();
8015
- 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" };
8303
+ 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" };
8016
8304
 
8017
8305
  // components/Puck/components/Canvas/index.tsx
8018
- var import_shallow9 = require("zustand/react/shallow");
8306
+ var import_shallow8 = require("zustand/react/shallow");
8019
8307
 
8020
8308
  // lib/frame-context.tsx
8021
8309
  init_react_import();
8022
8310
  var import_react50 = require("react");
8023
- var import_jsx_runtime38 = require("react/jsx-runtime");
8311
+ var import_jsx_runtime40 = require("react/jsx-runtime");
8024
8312
  var FrameContext = (0, import_react50.createContext)(null);
8025
8313
  var FrameProvider = ({
8026
8314
  children
@@ -8032,7 +8320,7 @@ var FrameProvider = ({
8032
8320
  }),
8033
8321
  []
8034
8322
  );
8035
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FrameContext.Provider, { value, children });
8323
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FrameContext.Provider, { value, children });
8036
8324
  };
8037
8325
  var useCanvasFrame = () => {
8038
8326
  const context = (0, import_react50.useContext)(FrameContext);
@@ -8043,9 +8331,10 @@ var useCanvasFrame = () => {
8043
8331
  };
8044
8332
 
8045
8333
  // components/Puck/components/Canvas/index.tsx
8046
- var import_jsx_runtime39 = require("react/jsx-runtime");
8047
- var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
8334
+ var import_jsx_runtime41 = require("react/jsx-runtime");
8335
+ var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
8048
8336
  var ZOOM_ON_CHANGE = true;
8337
+ var TRANSITION_DURATION = 150;
8049
8338
  var Canvas = () => {
8050
8339
  const { frameRef } = useCanvasFrame();
8051
8340
  const resetAutoZoom = useResetAutoZoom(frameRef);
@@ -8058,7 +8347,7 @@ var Canvas = () => {
8058
8347
  status,
8059
8348
  iframe
8060
8349
  } = useAppStore(
8061
- (0, import_shallow9.useShallow)((s) => ({
8350
+ (0, import_shallow8.useShallow)((s) => ({
8062
8351
  dispatch: s.dispatch,
8063
8352
  overrides: s.overrides,
8064
8353
  setUi: s.setUi,
@@ -8075,7 +8364,7 @@ var Canvas = () => {
8075
8364
  rightSideBarWidth,
8076
8365
  viewports
8077
8366
  } = useAppStore(
8078
- (0, import_shallow9.useShallow)((s) => ({
8367
+ (0, import_shallow8.useShallow)((s) => ({
8079
8368
  leftSideBarVisible: s.state.ui.leftSideBarVisible,
8080
8369
  rightSideBarVisible: s.state.ui.rightSideBarVisible,
8081
8370
  leftSideBarWidth: s.state.ui.leftSideBarWidth,
@@ -8084,9 +8373,9 @@ var Canvas = () => {
8084
8373
  }))
8085
8374
  );
8086
8375
  const [showTransition, setShowTransition] = (0, import_react51.useState)(false);
8087
- const isResettingZoomRef = (0, import_react51.useRef)(false);
8376
+ const isResizingRef = (0, import_react51.useRef)(false);
8088
8377
  const defaultRender = (0, import_react51.useMemo)(() => {
8089
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
8378
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
8090
8379
  return PuckDefault;
8091
8380
  }, []);
8092
8381
  const CustomPreview = (0, import_react51.useMemo)(
@@ -8102,19 +8391,13 @@ var Canvas = () => {
8102
8391
  return { width: 0, height: 0 };
8103
8392
  }, [frameRef]);
8104
8393
  (0, import_react51.useEffect)(() => {
8105
- resetAutoZoom({
8106
- isResettingRef: isResettingZoomRef,
8107
- setShowTransition,
8108
- showTransition: false,
8109
- viewports
8110
- });
8394
+ resetAutoZoom();
8111
8395
  }, [
8112
8396
  frameRef,
8113
8397
  leftSideBarVisible,
8114
8398
  rightSideBarVisible,
8115
8399
  leftSideBarWidth,
8116
8400
  rightSideBarWidth,
8117
- resetAutoZoom,
8118
8401
  viewports
8119
8402
  ]);
8120
8403
  (0, import_react51.useEffect)(() => {
@@ -8127,37 +8410,31 @@ var Canvas = () => {
8127
8410
  }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
8128
8411
  (0, import_react51.useEffect)(() => {
8129
8412
  if (ZOOM_ON_CHANGE) {
8130
- resetAutoZoom({
8131
- isResettingRef: isResettingZoomRef,
8132
- setShowTransition,
8133
- showTransition: true,
8134
- viewports
8135
- });
8413
+ resetAutoZoom();
8136
8414
  }
8137
- }, [viewports.current.width, resetAutoZoom, viewports]);
8415
+ }, [viewports.current.width, viewports]);
8138
8416
  (0, import_react51.useEffect)(() => {
8139
- const cb = () => {
8140
- resetAutoZoom({
8141
- isResettingRef: isResettingZoomRef,
8142
- setShowTransition,
8143
- showTransition: false
8144
- });
8145
- };
8146
- window.addEventListener("resize", cb);
8417
+ if (!frameRef.current) return;
8418
+ const resizeObserver = new ResizeObserver(() => {
8419
+ if (!isResizingRef.current) {
8420
+ resetAutoZoom();
8421
+ }
8422
+ });
8423
+ resizeObserver.observe(frameRef.current);
8147
8424
  return () => {
8148
- window.removeEventListener("resize", cb);
8425
+ resizeObserver.disconnect();
8149
8426
  };
8150
- }, [resetAutoZoom]);
8427
+ }, [frameRef.current]);
8151
8428
  const [showLoader, setShowLoader] = (0, import_react51.useState)(false);
8152
8429
  (0, import_react51.useEffect)(() => {
8153
8430
  setTimeout(() => {
8154
8431
  setShowLoader(true);
8155
8432
  }, 500);
8156
8433
  }, []);
8157
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
8434
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8158
8435
  "div",
8159
8436
  {
8160
- className: getClassName25({
8437
+ className: getClassName26({
8161
8438
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
8162
8439
  showLoader
8163
8440
  }),
@@ -8172,13 +8449,14 @@ var Canvas = () => {
8172
8449
  }
8173
8450
  },
8174
8451
  children: [
8175
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8452
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8176
8453
  ViewportControls,
8177
8454
  {
8178
8455
  autoZoom: zoomConfig.autoZoom,
8179
8456
  zoom: zoomConfig.zoom,
8180
8457
  onViewportChange: (viewport) => {
8181
8458
  setShowTransition(true);
8459
+ isResizingRef.current = true;
8182
8460
  const uiViewport = __spreadProps(__spreadValues({}, viewport), {
8183
8461
  height: viewport.height || "auto",
8184
8462
  zoom: zoomConfig.zoom
@@ -8190,42 +8468,39 @@ var Canvas = () => {
8190
8468
  setUi(newUi);
8191
8469
  if (ZOOM_ON_CHANGE) {
8192
8470
  resetAutoZoom({
8193
- isResettingRef: isResettingZoomRef,
8194
- setShowTransition,
8195
- showTransition: true,
8196
8471
  viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
8197
8472
  });
8198
8473
  }
8199
8474
  },
8200
8475
  onZoom: (zoom) => {
8201
8476
  setShowTransition(true);
8477
+ isResizingRef.current = true;
8202
8478
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
8203
8479
  }
8204
8480
  }
8205
8481
  ) }),
8206
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName25("inner"), ref: frameRef, children: [
8207
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8482
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
8483
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8208
8484
  "div",
8209
8485
  {
8210
- className: getClassName25("root"),
8486
+ className: getClassName26("root"),
8211
8487
  style: {
8212
8488
  width: iframe.enabled ? viewports.current.width : "100%",
8213
8489
  height: zoomConfig.rootHeight,
8214
8490
  transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
8215
- transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
8491
+ transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, height ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : "",
8216
8492
  overflow: iframe.enabled ? void 0 : "auto"
8217
8493
  },
8218
8494
  suppressHydrationWarning: true,
8219
8495
  id: "puck-canvas-root",
8220
8496
  onTransitionEnd: () => {
8221
- resetAutoZoom({
8222
- isResettingRef: isResettingZoomRef
8223
- });
8497
+ setShowTransition(false);
8498
+ isResizingRef.current = false;
8224
8499
  },
8225
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Preview2, {}) })
8500
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Preview2, {}) })
8226
8501
  }
8227
8502
  ),
8228
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Loader, { size: 24 }) })
8503
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Loader, { size: 24 }) })
8229
8504
  ] })
8230
8505
  ]
8231
8506
  }
@@ -8244,8 +8519,11 @@ var loadOverrides = ({
8244
8519
  }) => {
8245
8520
  const collected = __spreadValues({}, overrides);
8246
8521
  plugins == null ? void 0 : plugins.forEach((plugin) => {
8522
+ if (!plugin.overrides) return;
8247
8523
  Object.keys(plugin.overrides).forEach((_overridesType) => {
8524
+ var _a;
8248
8525
  const overridesType = _overridesType;
8526
+ if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
8249
8527
  if (overridesType === "fieldTypes") {
8250
8528
  const fieldTypes = plugin.overrides.fieldTypes;
8251
8529
  Object.keys(fieldTypes).forEach((fieldType) => {
@@ -8280,8 +8558,8 @@ var useLoadedOverrides = ({
8280
8558
 
8281
8559
  // components/DefaultOverride/index.tsx
8282
8560
  init_react_import();
8283
- var import_jsx_runtime40 = require("react/jsx-runtime");
8284
- var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
8561
+ var import_jsx_runtime42 = require("react/jsx-runtime");
8562
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children });
8285
8563
 
8286
8564
  // lib/use-inject-css.ts
8287
8565
  init_react_import();
@@ -8353,13 +8631,7 @@ var generateUsePuck = (store) => {
8353
8631
  selectedItem: store.selectedItem || null,
8354
8632
  getItemBySelector: (selector) => getItem(selector, store.state),
8355
8633
  getItemById: (id) => store.state.indexes.nodes[id].data,
8356
- getSelectorForId: (id) => {
8357
- const node = store.state.indexes.nodes[id];
8358
- if (!node) return;
8359
- const zoneCompound = `${node.parentId}:${node.zone}`;
8360
- const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
8361
- return { zone: zoneCompound, index };
8362
- }
8634
+ getSelectorForId: (id) => getSelectorForId(store.state, id)
8363
8635
  };
8364
8636
  return storeData;
8365
8637
  };
@@ -8433,11 +8705,11 @@ init_react_import();
8433
8705
 
8434
8706
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
8435
8707
  init_react_import();
8436
- 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" };
8708
+ 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" };
8437
8709
 
8438
8710
  // components/MenuBar/index.tsx
8439
- var import_jsx_runtime41 = require("react/jsx-runtime");
8440
- var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
8711
+ var import_jsx_runtime43 = require("react/jsx-runtime");
8712
+ var getClassName27 = get_class_name_factory_default("MenuBar", styles_module_default22);
8441
8713
  function MenuBar({
8442
8714
  menuOpen = false,
8443
8715
  renderHeaderActions,
@@ -8447,10 +8719,10 @@ function MenuBar({
8447
8719
  const forward = useAppStore((s) => s.history.forward);
8448
8720
  const hasFuture = useAppStore((s) => s.history.hasFuture());
8449
8721
  const hasPast = useAppStore((s) => s.history.hasPast());
8450
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8722
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8451
8723
  "div",
8452
8724
  {
8453
- className: getClassName26({ menuOpen }),
8725
+ className: getClassName27({ menuOpen }),
8454
8726
  onClick: (event) => {
8455
8727
  var _a;
8456
8728
  const element = event.target;
@@ -8461,30 +8733,30 @@ function MenuBar({
8461
8733
  setMenuOpen(false);
8462
8734
  }
8463
8735
  },
8464
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName26("inner"), children: [
8465
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName26("history"), children: [
8466
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8736
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName27("inner"), children: [
8737
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName27("history"), children: [
8738
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8467
8739
  IconButton,
8468
8740
  {
8469
8741
  type: "button",
8470
8742
  title: "undo",
8471
8743
  disabled: !hasPast,
8472
8744
  onClick: back,
8473
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Undo2, { size: 21 })
8745
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Undo2, { size: 21 })
8474
8746
  }
8475
8747
  ),
8476
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8748
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8477
8749
  IconButton,
8478
8750
  {
8479
8751
  type: "button",
8480
8752
  title: "redo",
8481
8753
  disabled: !hasFuture,
8482
8754
  onClick: forward,
8483
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Redo2, { size: 21 })
8755
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Redo2, { size: 21 })
8484
8756
  }
8485
8757
  )
8486
8758
  ] }),
8487
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: renderHeaderActions && renderHeaderActions() })
8759
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children: renderHeaderActions && renderHeaderActions() })
8488
8760
  ] })
8489
8761
  }
8490
8762
  );
@@ -8492,11 +8764,11 @@ function MenuBar({
8492
8764
 
8493
8765
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
8494
8766
  init_react_import();
8495
- 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" };
8767
+ 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" };
8496
8768
 
8497
8769
  // components/Puck/components/Header/index.tsx
8498
- var import_jsx_runtime42 = require("react/jsx-runtime");
8499
- var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
8770
+ var import_jsx_runtime44 = require("react/jsx-runtime");
8771
+ var getClassName28 = get_class_name_factory_default("PuckHeader", styles_module_default23);
8500
8772
  var HeaderInner = () => {
8501
8773
  const {
8502
8774
  onPublish,
@@ -8517,7 +8789,7 @@ var HeaderInner = () => {
8517
8789
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
8518
8790
  const Comp = renderHeader;
8519
8791
  const appState = useAppStore((s) => s.state);
8520
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8792
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8521
8793
  };
8522
8794
  return RenderHeader;
8523
8795
  }
@@ -8531,12 +8803,12 @@ var HeaderInner = () => {
8531
8803
  const RenderHeader = (props) => {
8532
8804
  const Comp = renderHeaderActions;
8533
8805
  const appState = useAppStore((s) => s.state);
8534
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8806
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8535
8807
  };
8536
8808
  return RenderHeader;
8537
8809
  }
8538
8810
  return DefaultOverride;
8539
- }, [renderHeader]);
8811
+ }, [renderHeaderActions]);
8540
8812
  const CustomHeader = useAppStore(
8541
8813
  (s) => s.overrides.header || defaultHeaderRender
8542
8814
  );
@@ -8567,27 +8839,27 @@ var HeaderInner = () => {
8567
8839
  },
8568
8840
  [dispatch, leftSideBarVisible, rightSideBarVisible]
8569
8841
  );
8570
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8842
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8571
8843
  CustomHeader,
8572
8844
  {
8573
- actions: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8845
+ actions: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8574
8846
  Button,
8575
8847
  {
8576
8848
  onClick: () => {
8577
8849
  const data = appStore.getState().state.data;
8578
8850
  onPublish && onPublish(data);
8579
8851
  },
8580
- icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Globe, { size: "14px" }),
8852
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Globe, { size: "14px" }),
8581
8853
  children: "Publish"
8582
8854
  }
8583
8855
  ) }) }),
8584
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8856
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8585
8857
  "header",
8586
8858
  {
8587
- className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
8588
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassName27("inner"), children: [
8589
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassName27("toggle"), children: [
8590
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8859
+ className: getClassName28({ leftSideBarVisible, rightSideBarVisible }),
8860
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("inner"), children: [
8861
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("toggle"), children: [
8862
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8591
8863
  IconButton,
8592
8864
  {
8593
8865
  type: "button",
@@ -8595,10 +8867,10 @@ var HeaderInner = () => {
8595
8867
  toggleSidebars("left");
8596
8868
  },
8597
8869
  title: "Toggle left sidebar",
8598
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelLeft, { focusable: "false" })
8870
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PanelLeft, { focusable: "false" })
8599
8871
  }
8600
8872
  ) }),
8601
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8873
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8602
8874
  IconButton,
8603
8875
  {
8604
8876
  type: "button",
@@ -8606,19 +8878,19 @@ var HeaderInner = () => {
8606
8878
  toggleSidebars("right");
8607
8879
  },
8608
8880
  title: "Toggle right sidebar",
8609
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRight, { focusable: "false" })
8881
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PanelRight, { focusable: "false" })
8610
8882
  }
8611
8883
  ) })
8612
8884
  ] }),
8613
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName27("title"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Heading, { rank: "2", size: "xs", children: [
8885
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("title"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Heading, { rank: "2", size: "xs", children: [
8614
8886
  headerTitle || rootTitle || "Page",
8615
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
8887
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
8616
8888
  " ",
8617
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("code", { className: getClassName27("path"), children: headerPath })
8889
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("code", { className: getClassName28("path"), children: headerPath })
8618
8890
  ] })
8619
8891
  ] }) }),
8620
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassName27("tools"), children: [
8621
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8892
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("tools"), children: [
8893
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8622
8894
  IconButton,
8623
8895
  {
8624
8896
  type: "button",
@@ -8626,23 +8898,23 @@ var HeaderInner = () => {
8626
8898
  return setMenuOpen(!menuOpen);
8627
8899
  },
8628
8900
  title: "Toggle menu bar",
8629
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronDown, { focusable: "false" })
8901
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { focusable: "false" })
8630
8902
  }
8631
8903
  ) }),
8632
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8904
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8633
8905
  MenuBar,
8634
8906
  {
8635
8907
  dispatch,
8636
8908
  onPublish,
8637
8909
  menuOpen,
8638
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8910
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8639
8911
  Button,
8640
8912
  {
8641
8913
  onClick: () => {
8642
8914
  const data = appStore.getState().state.data;
8643
8915
  onPublish && onPublish(data);
8644
8916
  },
8645
- icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Globe, { size: "14px" }),
8917
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Globe, { size: "14px" }),
8646
8918
  children: "Publish"
8647
8919
  }
8648
8920
  ) }),
@@ -8667,11 +8939,11 @@ var import_react57 = require("react");
8667
8939
 
8668
8940
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
8669
8941
  init_react_import();
8670
- var styles_module_default23 = { "ResizeHandle": "_ResizeHandle_v7w0r_1", "ResizeHandle--left": "_ResizeHandle--left_v7w0r_15", "ResizeHandle--right": "_ResizeHandle--right_v7w0r_19" };
8942
+ var styles_module_default24 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
8671
8943
 
8672
8944
  // components/Puck/components/ResizeHandle/index.tsx
8673
- var import_jsx_runtime43 = require("react/jsx-runtime");
8674
- var getClassName28 = get_class_name_factory_default("ResizeHandle", styles_module_default23);
8945
+ var import_jsx_runtime45 = require("react/jsx-runtime");
8946
+ var getClassName29 = get_class_name_factory_default("ResizeHandle", styles_module_default24);
8675
8947
  var ResizeHandle = ({
8676
8948
  position,
8677
8949
  sidebarRef,
@@ -8710,7 +8982,7 @@ var ResizeHandle = ({
8710
8982
  const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8711
8983
  onResizeEnd(finalWidth);
8712
8984
  resetAutoZoom();
8713
- }, [onResizeEnd, resetAutoZoom]);
8985
+ }, [onResizeEnd]);
8714
8986
  const handleMouseDown = (0, import_react57.useCallback)(
8715
8987
  (e) => {
8716
8988
  var _a;
@@ -8729,11 +9001,11 @@ var ResizeHandle = ({
8729
9001
  },
8730
9002
  [position, handleMouseMove, handleMouseUp]
8731
9003
  );
8732
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
9004
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8733
9005
  "div",
8734
9006
  {
8735
9007
  ref: handleRef,
8736
- className: getClassName28({ [position]: true }),
9008
+ className: getClassName29({ [position]: true }),
8737
9009
  onMouseDown: handleMouseDown
8738
9010
  }
8739
9011
  );
@@ -8741,24 +9013,23 @@ var ResizeHandle = ({
8741
9013
 
8742
9014
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
8743
9015
  init_react_import();
8744
- 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" };
9016
+ 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" };
8745
9017
 
8746
9018
  // components/Puck/components/Sidebar/index.tsx
8747
- var import_jsx_runtime44 = require("react/jsx-runtime");
8748
- var getClassName29 = get_class_name_factory_default("Sidebar", styles_module_default24);
9019
+ var import_jsx_runtime46 = require("react/jsx-runtime");
9020
+ var getClassName30 = get_class_name_factory_default("Sidebar", styles_module_default25);
8749
9021
  var Sidebar = ({
8750
9022
  position,
8751
9023
  sidebarRef,
8752
9024
  isVisible,
8753
- width,
8754
9025
  onResize,
8755
9026
  onResizeEnd,
8756
9027
  children
8757
9028
  }) => {
8758
9029
  if (!isVisible) return null;
8759
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
8760
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { ref: sidebarRef, className: getClassName29({ [position]: true }), children }),
8761
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `${getClassName29("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9030
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
9031
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { ref: sidebarRef, className: getClassName30({ [position]: true }), children }),
9032
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `${getClassName30("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8762
9033
  ResizeHandle,
8763
9034
  {
8764
9035
  position,
@@ -8786,11 +9057,12 @@ function useSidebarResize(position, dispatch) {
8786
9057
  if (savedWidths) {
8787
9058
  const widths = JSON.parse(savedWidths);
8788
9059
  const savedWidth = widths[position];
9060
+ const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
8789
9061
  if (savedWidth) {
8790
9062
  dispatch({
8791
9063
  type: "setUi",
8792
9064
  ui: {
8793
- [position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: savedWidth
9065
+ [key]: savedWidth
8794
9066
  }
8795
9067
  });
8796
9068
  }
@@ -8851,9 +9123,9 @@ function useSidebarResize(position, dispatch) {
8851
9123
  }
8852
9124
 
8853
9125
  // components/Puck/index.tsx
8854
- var import_jsx_runtime45 = require("react/jsx-runtime");
8855
- var getClassName30 = get_class_name_factory_default("Puck", styles_module_default14);
8856
- var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default14);
9126
+ var import_jsx_runtime47 = require("react/jsx-runtime");
9127
+ var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
9128
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
8857
9129
  var FieldSideBar = () => {
8858
9130
  const title = useAppStore(
8859
9131
  (s) => {
@@ -8861,11 +9133,11 @@ var FieldSideBar = () => {
8861
9133
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
8862
9134
  }
8863
9135
  );
8864
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Fields, {}) });
9136
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Fields, {}) });
8865
9137
  };
8866
9138
  var propsContext = (0, import_react59.createContext)({});
8867
9139
  function PropsProvider(props) {
8868
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(propsContext.Provider, { value: props, children: props.children });
9140
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(propsContext.Provider, { value: props, children: props.children });
8869
9141
  }
8870
9142
  var usePropsContext = () => (0, import_react59.useContext)(propsContext);
8871
9143
  function PuckProvider({ children }) {
@@ -8881,7 +9153,8 @@ function PuckProvider({ children }) {
8881
9153
  iframe: _iframe,
8882
9154
  initialHistory: _initialHistory,
8883
9155
  metadata,
8884
- onAction
9156
+ onAction,
9157
+ fieldTransforms
8885
9158
  } = usePropsContext();
8886
9159
  const iframe = (0, import_react59.useMemo)(
8887
9160
  () => __spreadValues({
@@ -8970,6 +9243,14 @@ function PuckProvider({ children }) {
8970
9243
  overrides,
8971
9244
  plugins
8972
9245
  });
9246
+ const loadedFieldTransforms = (0, import_react59.useMemo)(() => {
9247
+ const _plugins = plugins || [];
9248
+ const pluginFieldTransforms = _plugins.reduce(
9249
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
9250
+ {}
9251
+ );
9252
+ return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
9253
+ }, [fieldTransforms, plugins]);
8973
9254
  const generateAppStore = (0, import_react59.useCallback)(
8974
9255
  (state) => {
8975
9256
  return {
@@ -8980,7 +9261,8 @@ function PuckProvider({ children }) {
8980
9261
  viewports,
8981
9262
  iframe,
8982
9263
  onAction,
8983
- metadata
9264
+ metadata,
9265
+ fieldTransforms: loadedFieldTransforms
8984
9266
  };
8985
9267
  },
8986
9268
  [
@@ -8991,7 +9273,8 @@ function PuckProvider({ children }) {
8991
9273
  viewports,
8992
9274
  iframe,
8993
9275
  onAction,
8994
- metadata
9276
+ metadata,
9277
+ loadedFieldTransforms
8995
9278
  ]
8996
9279
  );
8997
9280
  const [appStore] = (0, import_react59.useState)(
@@ -9030,7 +9313,7 @@ function PuckProvider({ children }) {
9030
9313
  const { resolveAndCommitData } = appStore.getState();
9031
9314
  resolveAndCommitData();
9032
9315
  }, []);
9033
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
9316
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
9034
9317
  }
9035
9318
  function PuckLayout({ children }) {
9036
9319
  const {
@@ -9106,8 +9389,15 @@ function PuckLayout({ children }) {
9106
9389
  }
9107
9390
  }, [ready, iframe.enabled]);
9108
9391
  usePreviewModeHotkeys();
9109
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `Puck ${getClassName30()}`, children: [
9110
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9392
+ const layoutOptions = {};
9393
+ if (leftWidth) {
9394
+ layoutOptions["--puck-user-left-side-bar-width"] = `${leftWidth}px`;
9395
+ }
9396
+ if (rightWidth) {
9397
+ layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
9398
+ }
9399
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `Puck ${getClassName31()}`, children: [
9400
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9111
9401
  "div",
9112
9402
  {
9113
9403
  className: getLayoutClassName({
@@ -9115,45 +9405,37 @@ function PuckLayout({ children }) {
9115
9405
  mounted,
9116
9406
  rightSideBarVisible
9117
9407
  }),
9118
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
9408
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9119
9409
  "div",
9120
9410
  {
9121
9411
  className: getLayoutClassName("inner"),
9122
- style: {
9123
- gridTemplateColumns: `
9124
- ${leftSideBarVisible ? leftWidth ? `${leftWidth}px` : "var(--puck-side-bar-width)" : "0"}
9125
- var(--puck-frame-width)
9126
- ${rightSideBarVisible ? rightWidth ? `${rightWidth}px` : "var(--puck-side-bar-width)" : "0"}
9127
- `
9128
- },
9412
+ style: layoutOptions,
9129
9413
  children: [
9130
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Header, {}),
9131
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
9414
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header, {}),
9415
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9132
9416
  Sidebar,
9133
9417
  {
9134
9418
  position: "left",
9135
9419
  sidebarRef: leftSidebarRef,
9136
9420
  isVisible: leftSideBarVisible,
9137
- width: leftWidth,
9138
9421
  onResize: setLeftWidth,
9139
9422
  onResizeEnd: handleLeftSidebarResizeEnd,
9140
9423
  children: [
9141
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Components, {}) }),
9142
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Outline, {}) })
9424
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Components, {}) }),
9425
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Outline, {}) })
9143
9426
  ]
9144
9427
  }
9145
9428
  ),
9146
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Canvas, {}),
9147
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9429
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Canvas, {}),
9430
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9148
9431
  Sidebar,
9149
9432
  {
9150
9433
  position: "right",
9151
9434
  sidebarRef: rightSidebarRef,
9152
9435
  isVisible: rightSideBarVisible,
9153
- width: rightWidth,
9154
9436
  onResize: setRightWidth,
9155
9437
  onResizeEnd: handleRightSidebarResizeEnd,
9156
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FieldSideBar, {})
9438
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldSideBar, {})
9157
9439
  }
9158
9440
  )
9159
9441
  ]
@@ -9161,11 +9443,11 @@ function PuckLayout({ children }) {
9161
9443
  )
9162
9444
  }
9163
9445
  ) }) }) }),
9164
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { id: "puck-portal-root", className: getClassName30("portal") })
9446
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { id: "puck-portal-root", className: getClassName31("portal") })
9165
9447
  ] });
9166
9448
  }
9167
9449
  function Puck(props) {
9168
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
9450
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
9169
9451
  }
9170
9452
  Puck.Components = Components;
9171
9453
  Puck.Fields = Fields;
@@ -9334,36 +9616,6 @@ function transformProps(data, propTransforms, config = { components: {} }) {
9334
9616
  return updatedData;
9335
9617
  }
9336
9618
 
9337
- // lib/overlay-portal/index.tsx
9338
- init_react_import();
9339
- var registerOverlayPortal = (el, opts = {}) => {
9340
- if (!el) return;
9341
- const { disableDrag = true } = opts;
9342
- const stopPropagation = (e) => {
9343
- e.stopPropagation();
9344
- };
9345
- el.addEventListener("mouseover", stopPropagation, {
9346
- capture: true
9347
- });
9348
- if (disableDrag) {
9349
- el.addEventListener("pointerdown", stopPropagation, {
9350
- capture: true
9351
- });
9352
- }
9353
- el.setAttribute("data-puck-overlay-portal", "true");
9354
- return () => {
9355
- el.removeEventListener("mouseover", stopPropagation, {
9356
- capture: true
9357
- });
9358
- if (disableDrag) {
9359
- el.removeEventListener("pointerdown", stopPropagation, {
9360
- capture: true
9361
- });
9362
- }
9363
- el.removeAttribute("data-puck-overlay-portal");
9364
- };
9365
- };
9366
-
9367
9619
  // lib/resolve-all-data.ts
9368
9620
  init_react_import();
9369
9621
 
@@ -9394,9 +9646,9 @@ function resolveAllData(_0, _1) {
9394
9646
  },
9395
9647
  "force"
9396
9648
  )).node;
9397
- const resolvedDeep = yield mapSlots(
9649
+ const resolvedDeep = yield mapFields(
9398
9650
  resolved,
9399
- processContent,
9651
+ { slot: ({ value }) => processContent(value) },
9400
9652
  config
9401
9653
  );
9402
9654
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
@@ -9445,6 +9697,7 @@ function resolveAllData(_0, _1) {
9445
9697
  registerOverlayPortal,
9446
9698
  renderContext,
9447
9699
  resolveAllData,
9700
+ setDeep,
9448
9701
  transformProps,
9449
9702
  useGetPuck,
9450
9703
  usePuck,