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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -171,8 +171,10 @@ __export(no_external_exports, {
171
171
  createUsePuck: () => createUsePuck,
172
172
  migrate: () => migrate,
173
173
  overrideKeys: () => overrideKeys,
174
+ registerOverlayPortal: () => registerOverlayPortal,
174
175
  renderContext: () => renderContext,
175
176
  resolveAllData: () => resolveAllData,
177
+ setDeep: () => setDeep,
176
178
  transformProps: () => transformProps,
177
179
  useGetPuck: () => useGetPuck,
178
180
  usePuck: () => usePuck,
@@ -193,6 +195,9 @@ init_react_import();
193
195
  // types/API/Viewports.ts
194
196
  init_react_import();
195
197
 
198
+ // types/API/FieldTransforms.ts
199
+ init_react_import();
200
+
196
201
  // types/index.ts
197
202
  init_react_import();
198
203
 
@@ -203,8 +208,9 @@ var overrideKeys = [
203
208
  "headerActions",
204
209
  "fields",
205
210
  "fieldLabel",
206
- "components",
207
- "componentItem",
211
+ "drawer",
212
+ "drawerItem",
213
+ "componentOverlay",
208
214
  "outline",
209
215
  "puck",
210
216
  "preview"
@@ -306,10 +312,10 @@ init_react_import();
306
312
 
307
313
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
308
314
  init_react_import();
309
- 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" };
310
316
 
311
317
  // components/AutoField/index.tsx
312
- var import_react22 = require("react");
318
+ var import_react20 = require("react");
313
319
 
314
320
  // components/AutoField/fields/index.tsx
315
321
  init_react_import();
@@ -653,7 +659,7 @@ init_react_import();
653
659
 
654
660
  // components/IconButton/IconButton.tsx
655
661
  init_react_import();
656
- var import_react4 = require("react");
662
+ var import_react9 = require("react");
657
663
 
658
664
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
659
665
  init_react_import();
@@ -686,102 +692,8 @@ var replace = (list, index, newItem) => {
686
692
  return result;
687
693
  };
688
694
 
689
- // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
690
- init_react_import();
691
- var styles_module_default4 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
692
-
693
- // components/Loader/index.tsx
694
- var import_jsx_runtime2 = require("react/jsx-runtime");
695
- var getClassName2 = get_class_name_factory_default("Loader", styles_module_default4);
696
- var Loader = (_a) => {
697
- var _b = _a, {
698
- color,
699
- size = 16
700
- } = _b, props = __objRest(_b, [
701
- "color",
702
- "size"
703
- ]);
704
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
705
- "span",
706
- __spreadValues({
707
- className: getClassName2(),
708
- style: {
709
- width: size,
710
- height: size,
711
- color
712
- },
713
- "aria-label": "loading"
714
- }, props)
715
- );
716
- };
717
-
718
- // components/IconButton/IconButton.tsx
719
- var import_jsx_runtime3 = require("react/jsx-runtime");
720
- var getClassName3 = get_class_name_factory_default("IconButton", IconButton_module_default);
721
- var IconButton = ({
722
- children,
723
- href,
724
- onClick,
725
- variant = "primary",
726
- type,
727
- disabled,
728
- tabIndex,
729
- newTab,
730
- fullWidth,
731
- title
732
- }) => {
733
- const [loading, setLoading] = (0, import_react4.useState)(false);
734
- const ElementType = href ? "a" : "button";
735
- const el = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
736
- ElementType,
737
- {
738
- className: getClassName3({
739
- primary: variant === "primary",
740
- secondary: variant === "secondary",
741
- disabled,
742
- fullWidth
743
- }),
744
- onClick: (e) => {
745
- if (!onClick) return;
746
- setLoading(true);
747
- Promise.resolve(onClick(e)).then(() => {
748
- setLoading(false);
749
- });
750
- },
751
- type,
752
- disabled: disabled || loading,
753
- tabIndex,
754
- target: newTab ? "_blank" : void 0,
755
- rel: newTab ? "noreferrer" : void 0,
756
- href,
757
- title,
758
- children: [
759
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: getClassName3("title"), children: title }),
760
- children,
761
- loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
762
- "\xA0\xA0",
763
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 14 })
764
- ] })
765
- ]
766
- }
767
- );
768
- return el;
769
- };
770
-
771
- // components/AutoField/fields/ArrayField/index.tsx
772
- var import_react14 = require("react");
773
-
774
- // components/DragIcon/index.tsx
775
- init_react_import();
776
-
777
- // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
695
+ // lib/use-reset-auto-zoom.ts
778
696
  init_react_import();
779
- var styles_module_default5 = { "DragIcon": "_DragIcon_17p8x_1", "DragIcon--disabled": "_DragIcon--disabled_17p8x_8" };
780
-
781
- // components/DragIcon/index.tsx
782
- var import_jsx_runtime4 = require("react/jsx-runtime");
783
- var getClassName4 = get_class_name_factory_default("DragIcon", styles_module_default5);
784
- var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassName4({ disabled: isDragDisabled }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
785
697
 
786
698
  // store/index.ts
787
699
  init_react_import();
@@ -828,7 +740,7 @@ function forRelatedZones(item, data, cb, path = []) {
828
740
  });
829
741
  }
830
742
 
831
- // lib/data/map-slots.ts
743
+ // lib/data/map-fields.ts
832
744
  init_react_import();
833
745
 
834
746
  // lib/data/default-slots.ts
@@ -838,14 +750,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
838
750
  value
839
751
  );
840
752
 
841
- // lib/data/map-slots.ts
753
+ // lib/data/map-fields.ts
842
754
  var isPromise = (v) => !!v && typeof v.then === "function";
843
755
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
844
756
  var containsPromise = (arr) => arr.some(isPromise);
845
757
  var walkField = ({
846
758
  value,
847
759
  fields,
848
- map,
760
+ mappers,
849
761
  propKey = "",
850
762
  propPath = "",
851
763
  id = "",
@@ -853,7 +765,9 @@ var walkField = ({
853
765
  recurseSlots = false
854
766
  }) => {
855
767
  var _a, _b, _c;
856
- 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") {
857
771
  const content = value || [];
858
772
  const mappedContent = recurseSlots ? content.map((el) => {
859
773
  var _a2;
@@ -865,7 +779,7 @@ var walkField = ({
865
779
  return walkField({
866
780
  value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
867
781
  fields: fields2,
868
- map,
782
+ mappers,
869
783
  id: el.props.id,
870
784
  config,
871
785
  recurseSlots
@@ -874,7 +788,21 @@ var walkField = ({
874
788
  if (containsPromise(mappedContent)) {
875
789
  return Promise.all(mappedContent);
876
790
  }
877
- 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
+ });
878
806
  }
879
807
  if (value && typeof value === "object") {
880
808
  if (Array.isArray(value)) {
@@ -884,7 +812,7 @@ var walkField = ({
884
812
  (el, idx) => walkField({
885
813
  value: el,
886
814
  fields: arrayFields,
887
- map,
815
+ mappers,
888
816
  propKey,
889
817
  propPath: `${propPath}[${idx}]`,
890
818
  id,
@@ -903,7 +831,7 @@ var walkField = ({
903
831
  return walkObject({
904
832
  value,
905
833
  fields: objectFields,
906
- map,
834
+ mappers,
907
835
  id,
908
836
  getPropPath: (k) => `${propPath}.${k}`,
909
837
  config,
@@ -916,7 +844,7 @@ var walkField = ({
916
844
  var walkObject = ({
917
845
  value,
918
846
  fields,
919
- map,
847
+ mappers,
920
848
  id,
921
849
  getPropPath,
922
850
  config,
@@ -926,7 +854,7 @@ var walkObject = ({
926
854
  const opts = {
927
855
  value: v,
928
856
  fields,
929
- map,
857
+ mappers,
930
858
  propKey: k,
931
859
  propPath: getPropPath(k),
932
860
  id,
@@ -948,14 +876,14 @@ var walkObject = ({
948
876
  }
949
877
  return flatten(newProps);
950
878
  };
951
- function mapSlots(item, map, config, recurseSlots = false) {
879
+ function mapFields(item, mappers, config, recurseSlots = false) {
952
880
  var _a, _b, _c, _d, _e;
953
881
  const itemType = "type" in item ? item.type : "root";
954
882
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
955
883
  const newProps = walkObject({
956
884
  value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
957
885
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
958
- map,
886
+ mappers,
959
887
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
960
888
  getPropPath: (k) => k,
961
889
  config,
@@ -978,7 +906,7 @@ var import_flat = __toESM(require("flat"));
978
906
  // lib/data/strip-slots.ts
979
907
  init_react_import();
980
908
  var stripSlots = (data, config) => {
981
- return mapSlots(data, () => null, config);
909
+ return mapFields(data, { slot: () => null }, config);
982
910
  };
983
911
 
984
912
  // lib/data/flatten-node.ts
@@ -1037,18 +965,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
1037
965
  const mappedItem = mapNodeOrSkip(item, path, index);
1038
966
  if (!mappedItem) return item;
1039
967
  const id = mappedItem.props.id;
1040
- const newProps = __spreadProps(__spreadValues({}, mapSlots(
968
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
1041
969
  mappedItem,
1042
- (content, parentId2, slotId) => {
1043
- const zoneCompound = `${parentId2}:${slotId}`;
1044
- const [_2, newContent2] = processContent(
1045
- path,
1046
- zoneCompound,
1047
- content,
1048
- "slot",
1049
- parentId2
1050
- );
1051
- 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
+ }
1052
983
  },
1053
984
  config
1054
985
  ).props), {
@@ -1166,11 +1097,14 @@ init_react_import();
1166
1097
  function walkTree(data, config, callbackFn) {
1167
1098
  var _a, _b;
1168
1099
  const walkItem = (item) => {
1169
- return mapSlots(
1100
+ return mapFields(
1170
1101
  item,
1171
- (content, parentId, propName) => {
1172
- var _a2;
1173
- 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
+ }
1174
1108
  },
1175
1109
  config,
1176
1110
  true
@@ -1684,15 +1618,15 @@ var defaultViewports = [
1684
1618
  // store/index.ts
1685
1619
  var import_zustand2 = require("zustand");
1686
1620
  var import_middleware2 = require("zustand/middleware");
1687
- var import_react9 = require("react");
1621
+ var import_react8 = require("react");
1688
1622
 
1689
1623
  // store/slices/history.ts
1690
1624
  init_react_import();
1691
- var import_react6 = require("react");
1625
+ var import_react5 = require("react");
1692
1626
 
1693
1627
  // lib/use-hotkey.ts
1694
1628
  init_react_import();
1695
- var import_react5 = require("react");
1629
+ var import_react4 = require("react");
1696
1630
  var import_zustand = require("zustand");
1697
1631
  var import_middleware = require("zustand/middleware");
1698
1632
  var keyCodeMap = {
@@ -1785,10 +1719,10 @@ var monitorHotkeys = (doc) => {
1785
1719
  };
1786
1720
  };
1787
1721
  var useMonitorHotkeys = () => {
1788
- (0, import_react5.useEffect)(() => monitorHotkeys(document), []);
1722
+ (0, import_react4.useEffect)(() => monitorHotkeys(document), []);
1789
1723
  };
1790
1724
  var useHotkey = (combo, cb) => {
1791
- (0, import_react5.useEffect)(
1725
+ (0, import_react4.useEffect)(
1792
1726
  () => useHotkeyStore.setState((s) => ({
1793
1727
  triggers: __spreadProps(__spreadValues({}, s.triggers), {
1794
1728
  [`${Object.keys(combo).join("+")}`]: { combo, cb }
@@ -1897,7 +1831,7 @@ function useRegisterHistorySlice(appStore, {
1897
1831
  index,
1898
1832
  initialAppState
1899
1833
  }) {
1900
- (0, import_react6.useEffect)(
1834
+ (0, import_react5.useEffect)(
1901
1835
  () => appStore.setState({
1902
1836
  history: __spreadProps(__spreadValues({}, appStore.getState().history), {
1903
1837
  histories,
@@ -1964,7 +1898,7 @@ var createNodesSlice = (set, get) => ({
1964
1898
 
1965
1899
  // store/slices/permissions.ts
1966
1900
  init_react_import();
1967
- var import_react7 = require("react");
1901
+ var import_react6 = require("react");
1968
1902
 
1969
1903
  // lib/data/flatten-data.ts
1970
1904
  init_react_import();
@@ -2101,7 +2035,7 @@ var createPermissionsSlice = (set, get) => {
2101
2035
  };
2102
2036
  };
2103
2037
  var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2104
- (0, import_react7.useEffect)(() => {
2038
+ (0, import_react6.useEffect)(() => {
2105
2039
  const { permissions } = appStore.getState();
2106
2040
  const { globalPermissions: existingGlobalPermissions } = permissions;
2107
2041
  appStore.setState({
@@ -2111,7 +2045,7 @@ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2111
2045
  });
2112
2046
  permissions.resolvePermissions();
2113
2047
  }, [globalPermissions]);
2114
- (0, import_react7.useEffect)(() => {
2048
+ (0, import_react6.useEffect)(() => {
2115
2049
  return appStore.subscribe(
2116
2050
  (s) => s.state.data,
2117
2051
  () => {
@@ -2119,7 +2053,7 @@ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2119
2053
  }
2120
2054
  );
2121
2055
  }, []);
2122
- (0, import_react7.useEffect)(() => {
2056
+ (0, import_react6.useEffect)(() => {
2123
2057
  return appStore.subscribe(
2124
2058
  (s) => s.config,
2125
2059
  () => {
@@ -2131,7 +2065,7 @@ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
2131
2065
 
2132
2066
  // store/slices/fields.ts
2133
2067
  init_react_import();
2134
- var import_react8 = require("react");
2068
+ var import_react7 = require("react");
2135
2069
  var createFieldsSlice = (_set, _get) => {
2136
2070
  return {
2137
2071
  fields: {},
@@ -2141,7 +2075,7 @@ var createFieldsSlice = (_set, _get) => {
2141
2075
  };
2142
2076
  };
2143
2077
  var useRegisterFieldsSlice = (appStore, id) => {
2144
- const resolveFields = (0, import_react8.useCallback)(
2078
+ const resolveFields = (0, import_react7.useCallback)(
2145
2079
  (reset) => __async(void 0, null, function* () {
2146
2080
  var _a, _b;
2147
2081
  const { fields, lastResolvedData } = appStore.getState().fields;
@@ -2198,7 +2132,7 @@ var useRegisterFieldsSlice = (appStore, id) => {
2198
2132
  }),
2199
2133
  [id]
2200
2134
  );
2201
- (0, import_react8.useEffect)(() => {
2135
+ (0, import_react7.useEffect)(() => {
2202
2136
  resolveFields(true);
2203
2137
  return appStore.subscribe(
2204
2138
  (s) => s.state.indexes.nodes[id || "root"],
@@ -2236,24 +2170,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2236
2170
  resolvedItem.readOnly = readOnly;
2237
2171
  }
2238
2172
  }
2239
- let itemWithResolvedChildren = yield mapSlots(
2173
+ let itemWithResolvedChildren = yield mapFields(
2240
2174
  resolvedItem,
2241
- (content) => __async(void 0, null, function* () {
2242
- return yield Promise.all(
2243
- content.map(
2244
- (childItem) => __async(void 0, null, function* () {
2245
- return (yield resolveComponentData(
2246
- childItem,
2247
- config,
2248
- metadata,
2249
- onResolveStart,
2250
- onResolveEnd,
2251
- trigger
2252
- )).node;
2253
- })
2254
- )
2255
- );
2256
- }),
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
+ },
2257
2194
  config
2258
2195
  );
2259
2196
  if (shouldRunResolver && onResolveEnd) {
@@ -2335,7 +2272,8 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2335
2272
  },
2336
2273
  status: "LOADING",
2337
2274
  iframe: {},
2338
- metadata: {}
2275
+ metadata: {},
2276
+ fieldTransforms: {}
2339
2277
  }, initialAppStore), {
2340
2278
  fields: createFieldsSlice(set, get),
2341
2279
  history: createHistorySlice(set, get),
@@ -2490,108 +2428,372 @@ var createAppStore = (initialAppStore) => (0, import_zustand2.create)()(
2490
2428
  });
2491
2429
  })
2492
2430
  );
2493
- var appStoreContext = (0, import_react9.createContext)(createAppStore());
2431
+ var appStoreContext = (0, import_react8.createContext)(createAppStore());
2494
2432
  function useAppStore(selector) {
2495
- const context = (0, import_react9.useContext)(appStoreContext);
2433
+ const context = (0, import_react8.useContext)(appStoreContext);
2496
2434
  return (0, import_zustand2.useStore)(context, selector);
2497
2435
  }
2498
2436
  function useAppStoreApi() {
2499
- return (0, import_react9.useContext)(appStoreContext);
2437
+ return (0, import_react8.useContext)(appStoreContext);
2500
2438
  }
2501
2439
 
2502
- // components/Sortable/index.tsx
2503
- init_react_import();
2504
- var import_react12 = require("@dnd-kit/react");
2505
-
2506
- // lib/dnd/use-sensors.ts
2440
+ // lib/get-zoom-config.ts
2507
2441
  init_react_import();
2508
- var import_react10 = require("react");
2509
- var import_react11 = require("@dnd-kit/react");
2510
- var import_utilities = require("@dnd-kit/dom/utilities");
2511
- var touchDefault = { delay: { value: 200, tolerance: 10 } };
2512
- var otherDefault = {
2513
- delay: { value: 200, tolerance: 10 },
2514
- distance: { value: 5 }
2515
- };
2516
- var useSensors = ({
2517
- other = otherDefault,
2518
- mouse,
2519
- touch = touchDefault
2520
- } = {
2521
- touch: touchDefault,
2522
- other: otherDefault
2523
- }) => {
2524
- const [sensors] = (0, import_react10.useState)(() => [
2525
- import_react11.PointerSensor.configure({
2526
- activationConstraints(event, source) {
2527
- var _a;
2528
- const { pointerType, target } = event;
2529
- if (pointerType === "mouse" && (0, import_utilities.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
2530
- return mouse;
2531
- }
2532
- if (pointerType === "touch") {
2533
- return touch;
2534
- }
2535
- return other;
2536
- }
2537
- })
2538
- ]);
2539
- return sensors;
2540
- };
2541
2442
 
2542
- // lib/dnd/collision/dynamic/index.ts
2443
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
2543
2444
  init_react_import();
2544
- var import_abstract8 = require("@dnd-kit/abstract");
2545
2445
 
2546
- // lib/dnd/collision/directional/index.ts
2446
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
2547
2447
  init_react_import();
2548
- var import_abstract = require("@dnd-kit/abstract");
2448
+ var isProduction = process.env.NODE_ENV === "production";
2449
+ var prefix = "Invariant failed";
2450
+ function invariant(condition, message) {
2451
+ if (condition) {
2452
+ return;
2453
+ }
2454
+ if (isProduction) {
2455
+ throw new Error(prefix);
2456
+ }
2457
+ var provided = typeof message === "function" ? message() : message;
2458
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
2459
+ throw new Error(value);
2460
+ }
2549
2461
 
2550
- // lib/dnd/collision/collision-debug.ts
2551
- init_react_import();
2552
- var DEBUG = false;
2553
- var debugElements = {};
2554
- var timeout;
2555
- var collisionDebug = (a, b, id, color, label) => {
2556
- if (!DEBUG) return;
2557
- const debugId = `${id}-debug`;
2558
- clearTimeout(timeout);
2559
- timeout = setTimeout(() => {
2560
- Object.entries(debugElements).forEach(([id2, { svg }]) => {
2561
- svg.remove();
2562
- delete debugElements[id2];
2563
- });
2564
- }, 1e3);
2565
- requestAnimationFrame(() => {
2566
- var _a, _b;
2567
- const existingEl = debugElements[debugId];
2568
- let line = (_a = debugElements[debugId]) == null ? void 0 : _a.line;
2569
- let text = (_b = debugElements[debugId]) == null ? void 0 : _b.text;
2570
- if (!existingEl) {
2571
- const svgNs = "http://www.w3.org/2000/svg";
2572
- const svg = document.createElementNS(svgNs, "svg");
2573
- line = document.createElementNS(svgNs, "line");
2574
- text = document.createElementNS(svgNs, "text");
2575
- svg.setAttribute("id", debugId);
2576
- svg.setAttribute(
2577
- "style",
2578
- "position: fixed; height: 100%; width: 100%; pointer-events: none; top: 0px; left: 0px;"
2579
- );
2580
- svg.appendChild(line);
2581
- svg.appendChild(text);
2582
- text.setAttribute("fill", `black`);
2583
- document.body.appendChild(svg);
2584
- debugElements[debugId] = { svg, line, text };
2462
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
2463
+ var getRect = function getRect2(_ref) {
2464
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
2465
+ var width = right - left;
2466
+ var height = bottom - top;
2467
+ var rect = {
2468
+ top,
2469
+ right,
2470
+ bottom,
2471
+ left,
2472
+ width,
2473
+ height,
2474
+ x: left,
2475
+ y: top,
2476
+ center: {
2477
+ x: (right + left) / 2,
2478
+ y: (bottom + top) / 2
2585
2479
  }
2586
- line.setAttribute("x1", a.x.toString());
2587
- line.setAttribute("x2", b.x.toString());
2588
- line.setAttribute("y1", a.y.toString());
2589
- line.setAttribute("y2", b.y.toString());
2590
- line.setAttribute("style", `stroke:${color};stroke-width:2`);
2591
- text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
2592
- text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
2593
- if (label) {
2594
- text.innerHTML = label;
2480
+ };
2481
+ return rect;
2482
+ };
2483
+ var expand = function expand2(target, expandBy) {
2484
+ return {
2485
+ top: target.top - expandBy.top,
2486
+ left: target.left - expandBy.left,
2487
+ bottom: target.bottom + expandBy.bottom,
2488
+ right: target.right + expandBy.right
2489
+ };
2490
+ };
2491
+ var shrink = function shrink2(target, shrinkBy) {
2492
+ return {
2493
+ top: target.top + shrinkBy.top,
2494
+ left: target.left + shrinkBy.left,
2495
+ bottom: target.bottom - shrinkBy.bottom,
2496
+ right: target.right - shrinkBy.right
2497
+ };
2498
+ };
2499
+ var noSpacing = {
2500
+ top: 0,
2501
+ right: 0,
2502
+ bottom: 0,
2503
+ left: 0
2504
+ };
2505
+ var createBox = function createBox2(_ref2) {
2506
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
2507
+ var marginBox = getRect(expand(borderBox, margin));
2508
+ var paddingBox = getRect(shrink(borderBox, border));
2509
+ var contentBox = getRect(shrink(paddingBox, padding));
2510
+ return {
2511
+ marginBox,
2512
+ borderBox: getRect(borderBox),
2513
+ paddingBox,
2514
+ contentBox,
2515
+ margin,
2516
+ border,
2517
+ padding
2518
+ };
2519
+ };
2520
+ var parse = function parse2(raw) {
2521
+ var value = raw.slice(0, -2);
2522
+ var suffix = raw.slice(-2);
2523
+ if (suffix !== "px") {
2524
+ return 0;
2525
+ }
2526
+ var result = Number(value);
2527
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
2528
+ return result;
2529
+ };
2530
+ var calculateBox = function calculateBox2(borderBox, styles2) {
2531
+ var margin = {
2532
+ top: parse(styles2.marginTop),
2533
+ right: parse(styles2.marginRight),
2534
+ bottom: parse(styles2.marginBottom),
2535
+ left: parse(styles2.marginLeft)
2536
+ };
2537
+ var padding = {
2538
+ top: parse(styles2.paddingTop),
2539
+ right: parse(styles2.paddingRight),
2540
+ bottom: parse(styles2.paddingBottom),
2541
+ left: parse(styles2.paddingLeft)
2542
+ };
2543
+ var border = {
2544
+ top: parse(styles2.borderTopWidth),
2545
+ right: parse(styles2.borderRightWidth),
2546
+ bottom: parse(styles2.borderBottomWidth),
2547
+ left: parse(styles2.borderLeftWidth)
2548
+ };
2549
+ return createBox({
2550
+ borderBox,
2551
+ margin,
2552
+ padding,
2553
+ border
2554
+ });
2555
+ };
2556
+ var getBox = function getBox2(el) {
2557
+ var borderBox = el.getBoundingClientRect();
2558
+ var styles2 = window.getComputedStyle(el);
2559
+ return calculateBox(borderBox, styles2);
2560
+ };
2561
+
2562
+ // lib/get-zoom-config.ts
2563
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
2564
+ var getZoomConfig = (uiViewport, frame, zoom) => {
2565
+ const box = getBox(frame);
2566
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
2567
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
2568
+ let rootHeight = 0;
2569
+ let autoZoom = 1;
2570
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
2571
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
2572
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
2573
+ zoom = widthZoom;
2574
+ if (widthZoom < heightZoom) {
2575
+ rootHeight = viewportHeight / zoom;
2576
+ } else {
2577
+ rootHeight = viewportHeight;
2578
+ zoom = heightZoom;
2579
+ }
2580
+ autoZoom = zoom;
2581
+ } else {
2582
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
2583
+ autoZoom = 1;
2584
+ zoom = 1;
2585
+ rootHeight = viewportHeight;
2586
+ }
2587
+ }
2588
+ return { autoZoom, rootHeight, zoom };
2589
+ };
2590
+
2591
+ // lib/use-reset-auto-zoom.ts
2592
+ var useResetAutoZoom = (frameRef) => {
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
+ };
2604
+ return resetAutoZoom;
2605
+ };
2606
+
2607
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2608
+ init_react_import();
2609
+ var styles_module_default4 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2610
+
2611
+ // components/Loader/index.tsx
2612
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2613
+ var getClassName2 = get_class_name_factory_default("Loader", styles_module_default4);
2614
+ var Loader = (_a) => {
2615
+ var _b = _a, {
2616
+ color,
2617
+ size = 16
2618
+ } = _b, props = __objRest(_b, [
2619
+ "color",
2620
+ "size"
2621
+ ]);
2622
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2623
+ "span",
2624
+ __spreadValues({
2625
+ className: getClassName2(),
2626
+ style: {
2627
+ width: size,
2628
+ height: size,
2629
+ color
2630
+ },
2631
+ "aria-label": "loading"
2632
+ }, props)
2633
+ );
2634
+ };
2635
+
2636
+ // components/IconButton/IconButton.tsx
2637
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2638
+ var getClassName3 = get_class_name_factory_default("IconButton", IconButton_module_default);
2639
+ var IconButton = ({
2640
+ children,
2641
+ href,
2642
+ onClick,
2643
+ variant = "primary",
2644
+ type,
2645
+ disabled,
2646
+ tabIndex,
2647
+ newTab,
2648
+ fullWidth,
2649
+ title
2650
+ }) => {
2651
+ const [loading, setLoading] = (0, import_react9.useState)(false);
2652
+ const ElementType = href ? "a" : "button";
2653
+ const el = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2654
+ ElementType,
2655
+ {
2656
+ className: getClassName3({
2657
+ primary: variant === "primary",
2658
+ secondary: variant === "secondary",
2659
+ disabled,
2660
+ fullWidth
2661
+ }),
2662
+ onClick: (e) => {
2663
+ if (!onClick) return;
2664
+ setLoading(true);
2665
+ Promise.resolve(onClick(e)).then(() => {
2666
+ setLoading(false);
2667
+ });
2668
+ },
2669
+ type,
2670
+ disabled: disabled || loading,
2671
+ tabIndex,
2672
+ target: newTab ? "_blank" : void 0,
2673
+ rel: newTab ? "noreferrer" : void 0,
2674
+ href,
2675
+ title,
2676
+ children: [
2677
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: getClassName3("title"), children: title }),
2678
+ children,
2679
+ loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
2680
+ "\xA0\xA0",
2681
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 14 })
2682
+ ] })
2683
+ ]
2684
+ }
2685
+ );
2686
+ return el;
2687
+ };
2688
+
2689
+ // components/AutoField/fields/ArrayField/index.tsx
2690
+ var import_react14 = require("react");
2691
+
2692
+ // components/DragIcon/index.tsx
2693
+ init_react_import();
2694
+
2695
+ // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
2696
+ init_react_import();
2697
+ var styles_module_default5 = { "DragIcon": "_DragIcon_17p8x_1", "DragIcon--disabled": "_DragIcon--disabled_17p8x_8" };
2698
+
2699
+ // components/DragIcon/index.tsx
2700
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2701
+ var getClassName4 = get_class_name_factory_default("DragIcon", styles_module_default5);
2702
+ var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassName4({ disabled: isDragDisabled }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
2703
+
2704
+ // components/Sortable/index.tsx
2705
+ init_react_import();
2706
+ var import_react12 = require("@dnd-kit/react");
2707
+
2708
+ // lib/dnd/use-sensors.ts
2709
+ init_react_import();
2710
+ var import_react10 = require("react");
2711
+ var import_react11 = require("@dnd-kit/react");
2712
+ var import_utilities = require("@dnd-kit/dom/utilities");
2713
+ var touchDefault = { delay: { value: 200, tolerance: 10 } };
2714
+ var otherDefault = {
2715
+ delay: { value: 200, tolerance: 10 },
2716
+ distance: { value: 5 }
2717
+ };
2718
+ var useSensors = ({
2719
+ other = otherDefault,
2720
+ mouse,
2721
+ touch = touchDefault
2722
+ } = {
2723
+ touch: touchDefault,
2724
+ other: otherDefault
2725
+ }) => {
2726
+ const [sensors] = (0, import_react10.useState)(() => [
2727
+ import_react11.PointerSensor.configure({
2728
+ activationConstraints(event, source) {
2729
+ var _a;
2730
+ const { pointerType, target } = event;
2731
+ if (pointerType === "mouse" && (0, import_utilities.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
2732
+ return mouse;
2733
+ }
2734
+ if (pointerType === "touch") {
2735
+ return touch;
2736
+ }
2737
+ return other;
2738
+ }
2739
+ })
2740
+ ]);
2741
+ return sensors;
2742
+ };
2743
+
2744
+ // lib/dnd/collision/dynamic/index.ts
2745
+ init_react_import();
2746
+ var import_abstract8 = require("@dnd-kit/abstract");
2747
+
2748
+ // lib/dnd/collision/directional/index.ts
2749
+ init_react_import();
2750
+ var import_abstract = require("@dnd-kit/abstract");
2751
+
2752
+ // lib/dnd/collision/collision-debug.ts
2753
+ init_react_import();
2754
+ var DEBUG = false;
2755
+ var debugElements = {};
2756
+ var timeout;
2757
+ var collisionDebug = (a, b, id, color, label) => {
2758
+ if (!DEBUG) return;
2759
+ const debugId = `${id}-debug`;
2760
+ clearTimeout(timeout);
2761
+ timeout = setTimeout(() => {
2762
+ Object.entries(debugElements).forEach(([id2, { svg }]) => {
2763
+ svg.remove();
2764
+ delete debugElements[id2];
2765
+ });
2766
+ }, 1e3);
2767
+ requestAnimationFrame(() => {
2768
+ var _a, _b;
2769
+ const existingEl = debugElements[debugId];
2770
+ let line = (_a = debugElements[debugId]) == null ? void 0 : _a.line;
2771
+ let text = (_b = debugElements[debugId]) == null ? void 0 : _b.text;
2772
+ if (!existingEl) {
2773
+ const svgNs = "http://www.w3.org/2000/svg";
2774
+ const svg = document.createElementNS(svgNs, "svg");
2775
+ line = document.createElementNS(svgNs, "line");
2776
+ text = document.createElementNS(svgNs, "text");
2777
+ svg.setAttribute("id", debugId);
2778
+ svg.setAttribute(
2779
+ "style",
2780
+ "position: fixed; height: 100%; width: 100%; pointer-events: none; top: 0px; left: 0px;"
2781
+ );
2782
+ svg.appendChild(line);
2783
+ svg.appendChild(text);
2784
+ text.setAttribute("fill", `black`);
2785
+ document.body.appendChild(svg);
2786
+ debugElements[debugId] = { svg, line, text };
2787
+ }
2788
+ line.setAttribute("x1", a.x.toString());
2789
+ line.setAttribute("x2", b.x.toString());
2790
+ line.setAttribute("y1", a.y.toString());
2791
+ line.setAttribute("y2", b.y.toString());
2792
+ line.setAttribute("style", `stroke:${color};stroke-width:2`);
2793
+ text.setAttribute("x", (a.x - (a.x - b.x) / 2).toString());
2794
+ text.setAttribute("y", (a.y - (a.y - b.y) / 2).toString());
2795
+ if (label) {
2796
+ text.innerHTML = label;
2595
2797
  }
2596
2798
  });
2597
2799
  };
@@ -3065,7 +3267,12 @@ var ArrayField = ({
3065
3267
  return walkField({
3066
3268
  value: val,
3067
3269
  fields: field.arrayFields,
3068
- 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
+ },
3069
3276
  config
3070
3277
  });
3071
3278
  },
@@ -3220,49 +3427,51 @@ var ArrayField = ({
3220
3427
  ]
3221
3428
  }
3222
3429
  ),
3223
- /* @__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) => {
3224
- const subField = field.arrayFields[subName];
3225
- const indexName = `${name}[${i}]`;
3226
- const subPath = `${indexName}.${subName}`;
3227
- const localIndexName = `${localName}[${i}]`;
3228
- const localWildcardName = `${localName}[*]`;
3229
- const localSubPath = `${localIndexName}.${subName}`;
3230
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
3231
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
3232
- const label2 = subField.label || subName;
3233
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3234
- NestedFieldProvider,
3235
- {
3236
- name: localIndexName,
3237
- wildcardName: localWildcardName,
3238
- subName,
3239
- readOnlyFields,
3240
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3241
- AutoFieldPrivate,
3242
- {
3243
- name: subPath,
3244
- label: label2,
3245
- id: `${_arrayId}_${subName}`,
3246
- readOnly: subReadOnly,
3247
- field: __spreadProps(__spreadValues({}, subField), {
3248
- label: label2
3249
- // May be used by custom fields
3250
- }),
3251
- value: data[subName],
3252
- onChange: (val, ui) => {
3253
- onChange(
3254
- replace(value, i, __spreadProps(__spreadValues({}, data), {
3255
- [subName]: val
3256
- })),
3257
- ui
3258
- );
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
+ }
3259
3468
  }
3260
- }
3261
- )
3262
- },
3263
- subPath
3264
- );
3265
- }) }) })
3469
+ )
3470
+ },
3471
+ subPath
3472
+ );
3473
+ }
3474
+ ) }) })
3266
3475
  ]
3267
3476
  }
3268
3477
  )
@@ -3802,20 +4011,6 @@ var ExternalField = ({
3802
4011
 
3803
4012
  // components/AutoField/fields/RadioField/index.tsx
3804
4013
  init_react_import();
3805
- var import_react19 = require("react");
3806
-
3807
- // lib/safe-json-parse.ts
3808
- init_react_import();
3809
- var safeJsonParse = (str) => {
3810
- try {
3811
- const jsonValue = JSON.parse(str);
3812
- return jsonValue;
3813
- } catch (e) {
3814
- return str;
3815
- }
3816
- };
3817
-
3818
- // components/AutoField/fields/RadioField/index.tsx
3819
4014
  var import_jsx_runtime14 = require("react/jsx-runtime");
3820
4015
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
3821
4016
  var RadioField = ({
@@ -3829,10 +4024,6 @@ var RadioField = ({
3829
4024
  labelIcon,
3830
4025
  Label: Label2
3831
4026
  }) => {
3832
- const flatOptions = (0, import_react19.useMemo)(
3833
- () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
3834
- [field]
3835
- );
3836
4027
  if (field.type !== "radio" || !field.options) {
3837
4028
  return null;
3838
4029
  }
@@ -3843,43 +4034,39 @@ var RadioField = ({
3843
4034
  label: label || name,
3844
4035
  readOnly,
3845
4036
  el: "div",
3846
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3847
- "label",
3848
- {
3849
- className: getClassName11("radio"),
3850
- children: [
3851
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3852
- "input",
3853
- {
3854
- type: "radio",
3855
- className: getClassName11("radioInput"),
3856
- value: option.value,
3857
- name,
3858
- onChange: (e) => {
3859
- var _a;
3860
- const jsonValue = (_a = safeJsonParse(e.target.value)) != null ? _a : e.target.value;
3861
- if (flatOptions.indexOf(jsonValue) > -1) {
3862
- onChange(jsonValue);
3863
- } else {
3864
- onChange(e.target.value);
3865
- }
3866
- },
3867
- disabled: readOnly,
3868
- checked: value === option.value
3869
- }
3870
- ),
3871
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
3872
- ]
3873
- },
3874
- option.label + option.value
3875
- )) })
4037
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => {
4038
+ var _a;
4039
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4040
+ "label",
4041
+ {
4042
+ className: getClassName11("radio"),
4043
+ children: [
4044
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4045
+ "input",
4046
+ {
4047
+ type: "radio",
4048
+ className: getClassName11("radioInput"),
4049
+ value: JSON.stringify({ value: option.value }),
4050
+ name,
4051
+ onChange: (e) => {
4052
+ onChange(JSON.parse(e.target.value).value);
4053
+ },
4054
+ disabled: readOnly,
4055
+ checked: value === option.value
4056
+ }
4057
+ ),
4058
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || ((_a = option.value) == null ? void 0 : _a.toString()) })
4059
+ ]
4060
+ },
4061
+ option.label + option.value
4062
+ );
4063
+ }) })
3876
4064
  }
3877
4065
  );
3878
4066
  };
3879
4067
 
3880
4068
  // components/AutoField/fields/SelectField/index.tsx
3881
4069
  init_react_import();
3882
- var import_react20 = require("react");
3883
4070
  var import_jsx_runtime15 = require("react/jsx-runtime");
3884
4071
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
3885
4072
  var SelectField = ({
@@ -3893,10 +4080,6 @@ var SelectField = ({
3893
4080
  readOnly,
3894
4081
  id
3895
4082
  }) => {
3896
- const flatOptions = (0, import_react20.useMemo)(
3897
- () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
3898
- [field]
3899
- );
3900
4083
  if (field.type !== "select" || !field.options) {
3901
4084
  return null;
3902
4085
  }
@@ -3914,22 +4097,16 @@ var SelectField = ({
3914
4097
  className: getClassName12("input"),
3915
4098
  disabled: readOnly,
3916
4099
  onChange: (e) => {
3917
- var _a;
3918
- const jsonValue = (_a = safeJsonParse(e.target.value)) != null ? _a : e.target.value;
3919
- if (flatOptions.indexOf(jsonValue) > -1) {
3920
- onChange(jsonValue);
3921
- } else {
3922
- onChange(e.target.value);
3923
- }
4100
+ onChange(JSON.parse(e.target.value).value);
3924
4101
  },
3925
- value,
4102
+ value: JSON.stringify({ value }),
3926
4103
  children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3927
4104
  "option",
3928
4105
  {
3929
4106
  label: option.label,
3930
- value: option.value
4107
+ value: JSON.stringify({ value: option.value })
3931
4108
  },
3932
- option.label + option.value
4109
+ option.label + JSON.stringify(option.value)
3933
4110
  ))
3934
4111
  }
3935
4112
  )
@@ -4053,12 +4230,12 @@ var ObjectField = ({
4053
4230
 
4054
4231
  // lib/use-safe-id.ts
4055
4232
  init_react_import();
4056
- var import_react21 = __toESM(require("react"));
4233
+ var import_react19 = __toESM(require("react"));
4057
4234
  var useSafeId = () => {
4058
- if (typeof import_react21.default.useId !== "undefined") {
4059
- return import_react21.default.useId();
4235
+ if (typeof import_react19.default.useId !== "undefined") {
4236
+ return import_react19.default.useId();
4060
4237
  }
4061
- const [id] = (0, import_react21.useState)(generateId());
4238
+ const [id] = (0, import_react19.useState)(generateId());
4062
4239
  return id;
4063
4240
  };
4064
4241
 
@@ -4092,7 +4269,7 @@ var FieldLabelInternal = ({
4092
4269
  readOnly
4093
4270
  }) => {
4094
4271
  const overrides = useAppStore((s) => s.overrides);
4095
- const Wrapper = (0, import_react22.useMemo)(
4272
+ const Wrapper = (0, import_react20.useMemo)(
4096
4273
  () => overrides.fieldLabel || FieldLabel,
4097
4274
  [overrides]
4098
4275
  );
@@ -4119,7 +4296,7 @@ function AutoFieldInternal(props) {
4119
4296
  var _a2;
4120
4297
  return (_a2 = s.selectedItem) == null ? void 0 : _a2.readOnly;
4121
4298
  });
4122
- const nestedFieldContext = (0, import_react22.useContext)(NestedFieldContext);
4299
+ const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
4123
4300
  const { id, Label: Label2 = FieldLabelInternal } = props;
4124
4301
  const field = props.field;
4125
4302
  const label = field.label;
@@ -4153,7 +4330,7 @@ function AutoFieldInternal(props) {
4153
4330
  Label: Label2,
4154
4331
  id: resolvedId
4155
4332
  });
4156
- const onFocus = (0, import_react22.useCallback)(
4333
+ const onFocus = (0, import_react20.useCallback)(
4157
4334
  (e) => {
4158
4335
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
4159
4336
  e.stopPropagation();
@@ -4167,7 +4344,7 @@ function AutoFieldInternal(props) {
4167
4344
  },
4168
4345
  [mergedProps.name]
4169
4346
  );
4170
- const onBlur = (0, import_react22.useCallback)((e) => {
4347
+ const onBlur = (0, import_react20.useCallback)((e) => {
4171
4348
  if ("name" in e.target) {
4172
4349
  dispatch({
4173
4350
  type: "setUi",
@@ -4220,20 +4397,20 @@ function AutoFieldInternal(props) {
4220
4397
  function AutoFieldPrivate(props) {
4221
4398
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
4222
4399
  const { value, onChange } = props;
4223
- const [localValue, setLocalValue] = (0, import_react22.useState)(value);
4224
- const onChangeLocal = (0, import_react22.useCallback)(
4400
+ const [localValue, setLocalValue] = (0, import_react20.useState)(value);
4401
+ const onChangeLocal = (0, import_react20.useCallback)(
4225
4402
  (val, ui) => {
4226
4403
  setLocalValue(val);
4227
4404
  onChange(val, ui);
4228
4405
  },
4229
4406
  [onChange]
4230
4407
  );
4231
- (0, import_react22.useEffect)(() => {
4408
+ (0, import_react20.useEffect)(() => {
4232
4409
  if (!isFocused) {
4233
4410
  setLocalValue(value);
4234
4411
  }
4235
4412
  }, [value]);
4236
- (0, import_react22.useEffect)(() => {
4413
+ (0, import_react20.useEffect)(() => {
4237
4414
  if (!isFocused) {
4238
4415
  if (value !== localValue) {
4239
4416
  setLocalValue(value);
@@ -4247,7 +4424,7 @@ function AutoFieldPrivate(props) {
4247
4424
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
4248
4425
  }
4249
4426
  function AutoField(props) {
4250
- const DefaultLabel = (0, import_react22.useMemo)(() => {
4427
+ const DefaultLabel = (0, import_react20.useMemo)(() => {
4251
4428
  const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4252
4429
  "div",
4253
4430
  __spreadProps(__spreadValues({}, labelProps), {
@@ -4270,25 +4447,25 @@ init_react_import();
4270
4447
  var styles_module_default10 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable": "_Drawer-draggable_pl7z0_8", "Drawer-draggableBg": "_Drawer-draggableBg_pl7z0_12", "DrawerItem-draggable": "_DrawerItem-draggable_pl7z0_22", "DrawerItem--disabled": "_DrawerItem--disabled_pl7z0_35", "DrawerItem": "_DrawerItem_pl7z0_22", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_pl7z0_45", "DrawerItem-name": "_DrawerItem-name_pl7z0_63" };
4271
4448
 
4272
4449
  // components/Drawer/index.tsx
4273
- var import_react39 = require("react");
4450
+ var import_react38 = require("react");
4274
4451
 
4275
4452
  // components/DragDropContext/index.tsx
4276
4453
  init_react_import();
4277
- var import_react37 = require("@dnd-kit/react");
4278
- var import_react38 = require("react");
4454
+ var import_react36 = require("@dnd-kit/react");
4455
+ var import_react37 = require("react");
4279
4456
  var import_dom = require("@dnd-kit/dom");
4280
4457
 
4281
4458
  // components/DropZone/index.tsx
4282
4459
  init_react_import();
4283
- var import_react35 = require("react");
4460
+ var import_react34 = require("react");
4284
4461
 
4285
4462
  // components/DraggableComponent/index.tsx
4286
4463
  init_react_import();
4287
- var import_react26 = require("react");
4464
+ var import_react24 = require("react");
4288
4465
 
4289
4466
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
4290
4467
  init_react_import();
4291
- var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_qzbgx_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_qzbgx_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_qzbgx_29", "DraggableComponent--hover": "_DraggableComponent--hover_qzbgx_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_qzbgx_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_qzbgx_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_qzbgx_66", "DraggableComponent-actions": "_DraggableComponent-actions_qzbgx_66" };
4468
+ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1vaqy_1", "DraggableComponent-overlayWrapper": "_DraggableComponent-overlayWrapper_1vaqy_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_1vaqy_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1vaqy_34", "DraggableComponent--hover": "_DraggableComponent--hover_1vaqy_50", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1vaqy_57", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1vaqy_71", "DraggableComponent-actions": "_DraggableComponent-actions_1vaqy_71" };
4292
4469
 
4293
4470
  // components/DraggableComponent/index.tsx
4294
4471
  var import_react_dom2 = require("react-dom");
@@ -4314,11 +4491,11 @@ function getDeepScrollPosition(element) {
4314
4491
 
4315
4492
  // components/DropZone/context.tsx
4316
4493
  init_react_import();
4317
- var import_react23 = require("react");
4494
+ var import_react21 = require("react");
4318
4495
  var import_zustand3 = require("zustand");
4319
4496
  var import_jsx_runtime19 = require("react/jsx-runtime");
4320
- var dropZoneContext = (0, import_react23.createContext)(null);
4321
- var ZoneStoreContext = (0, import_react23.createContext)(
4497
+ var dropZoneContext = (0, import_react21.createContext)(null);
4498
+ var ZoneStoreContext = (0, import_react21.createContext)(
4322
4499
  (0, import_zustand3.createStore)(() => ({
4323
4500
  zoneDepthIndex: {},
4324
4501
  nextZoneDepthIndex: {},
@@ -4341,7 +4518,7 @@ var DropZoneProvider = ({
4341
4518
  value
4342
4519
  }) => {
4343
4520
  const dispatch = useAppStore((s) => s.dispatch);
4344
- const registerZone = (0, import_react23.useCallback)(
4521
+ const registerZone = (0, import_react21.useCallback)(
4345
4522
  (zoneCompound) => {
4346
4523
  dispatch({
4347
4524
  type: "registerZone",
@@ -4350,7 +4527,7 @@ var DropZoneProvider = ({
4350
4527
  },
4351
4528
  [dispatch]
4352
4529
  );
4353
- const memoValue = (0, import_react23.useMemo)(
4530
+ const memoValue = (0, import_react21.useMemo)(
4354
4531
  () => __spreadValues({
4355
4532
  registerZone
4356
4533
  }, value),
@@ -4380,11 +4557,11 @@ function accumulateTransform(el) {
4380
4557
 
4381
4558
  // lib/use-context-store.ts
4382
4559
  init_react_import();
4383
- var import_react24 = require("react");
4560
+ var import_react22 = require("react");
4384
4561
  var import_zustand4 = require("zustand");
4385
4562
  var import_shallow = require("zustand/react/shallow");
4386
4563
  function useContextStore(context, selector) {
4387
- const store = (0, import_react24.useContext)(context);
4564
+ const store = (0, import_react22.useContext)(context);
4388
4565
  if (!store) {
4389
4566
  throw new Error("useContextStore must be used inside context");
4390
4567
  }
@@ -4393,10 +4570,10 @@ function useContextStore(context, selector) {
4393
4570
 
4394
4571
  // lib/dnd/use-on-drag-finished.ts
4395
4572
  init_react_import();
4396
- var import_react25 = require("react");
4573
+ var import_react23 = require("react");
4397
4574
  var useOnDragFinished = (cb, deps = []) => {
4398
4575
  const appStore = useAppStoreApi();
4399
- return (0, import_react25.useCallback)(() => {
4576
+ return (0, import_react23.useCallback)(() => {
4400
4577
  let dispose = () => {
4401
4578
  };
4402
4579
  const processDragging = (isDragging2) => {
@@ -4442,6 +4619,9 @@ var DefaultActionBar = ({
4442
4619
  ] }),
4443
4620
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Group, { children })
4444
4621
  ] });
4622
+ var DefaultOverlay = ({
4623
+ children
4624
+ }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
4445
4625
  var DraggableComponent = ({
4446
4626
  children,
4447
4627
  depth,
@@ -4466,9 +4646,9 @@ var DraggableComponent = ({
4466
4646
  const overrides = useAppStore((s) => s.overrides);
4467
4647
  const dispatch = useAppStore((s) => s.dispatch);
4468
4648
  const iframe = useAppStore((s) => s.iframe);
4469
- const ctx = (0, import_react26.useContext)(dropZoneContext);
4470
- const [localZones, setLocalZones] = (0, import_react26.useState)({});
4471
- const registerLocalZone = (0, import_react26.useCallback)(
4649
+ const ctx = (0, import_react24.useContext)(dropZoneContext);
4650
+ const [localZones, setLocalZones] = (0, import_react24.useState)({});
4651
+ const registerLocalZone = (0, import_react24.useCallback)(
4472
4652
  (zoneCompound2, active) => {
4473
4653
  var _a;
4474
4654
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -4478,7 +4658,7 @@ var DraggableComponent = ({
4478
4658
  },
4479
4659
  [setLocalZones]
4480
4660
  );
4481
- const unregisterLocalZone = (0, import_react26.useCallback)(
4661
+ const unregisterLocalZone = (0, import_react24.useCallback)(
4482
4662
  (zoneCompound2) => {
4483
4663
  var _a;
4484
4664
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -4501,9 +4681,9 @@ var DraggableComponent = ({
4501
4681
  return s.permissions.getPermissions({ item });
4502
4682
  })
4503
4683
  );
4504
- const zoneStore = (0, import_react26.useContext)(ZoneStoreContext);
4505
- const [dragAxis, setDragAxis] = (0, import_react26.useState)(userDragAxis || autoDragAxis);
4506
- const dynamicCollisionDetector = (0, import_react26.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)(
4507
4687
  () => createDynamicCollisionDetector(dragAxis),
4508
4688
  [dragAxis]
4509
4689
  );
@@ -4535,7 +4715,7 @@ var DraggableComponent = ({
4535
4715
  },
4536
4716
  feedback: "clone"
4537
4717
  });
4538
- (0, import_react26.useEffect)(() => {
4718
+ (0, import_react24.useEffect)(() => {
4539
4719
  const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
4540
4720
  sortable.droppable.disabled = !isEnabled;
4541
4721
  sortable.draggable.disabled = !permissions.drag;
@@ -4552,8 +4732,8 @@ var DraggableComponent = ({
4552
4732
  }
4553
4733
  return cleanup;
4554
4734
  }, [permissions.drag, zoneCompound]);
4555
- const ref = (0, import_react26.useRef)(null);
4556
- const refSetter = (0, import_react26.useCallback)(
4735
+ const ref = (0, import_react24.useRef)(null);
4736
+ const refSetter = (0, import_react24.useCallback)(
4557
4737
  (el) => {
4558
4738
  sortableRef(el);
4559
4739
  if (el) {
@@ -4562,14 +4742,14 @@ var DraggableComponent = ({
4562
4742
  },
4563
4743
  [sortableRef]
4564
4744
  );
4565
- const [portalEl, setPortalEl] = (0, import_react26.useState)();
4566
- (0, import_react26.useEffect)(() => {
4745
+ const [portalEl, setPortalEl] = (0, import_react24.useState)();
4746
+ (0, import_react24.useEffect)(() => {
4567
4747
  var _a, _b, _c;
4568
4748
  setPortalEl(
4569
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
4570
4750
  );
4571
4751
  }, [iframe.enabled, ref.current]);
4572
- const getStyle = (0, import_react26.useCallback)(() => {
4752
+ const getStyle = (0, import_react24.useCallback)(() => {
4573
4753
  var _a, _b, _c;
4574
4754
  if (!ref.current) return;
4575
4755
  const rect = ref.current.getBoundingClientRect();
@@ -4594,11 +4774,11 @@ var DraggableComponent = ({
4594
4774
  };
4595
4775
  return style2;
4596
4776
  }, [ref.current]);
4597
- const [style, setStyle] = (0, import_react26.useState)();
4598
- const sync = (0, import_react26.useCallback)(() => {
4777
+ const [style, setStyle] = (0, import_react24.useState)();
4778
+ const sync = (0, import_react24.useCallback)(() => {
4599
4779
  setStyle(getStyle());
4600
4780
  }, [ref.current, iframe]);
4601
- (0, import_react26.useEffect)(() => {
4781
+ (0, import_react24.useEffect)(() => {
4602
4782
  if (ref.current) {
4603
4783
  const observer = new ResizeObserver(sync);
4604
4784
  observer.observe(ref.current);
@@ -4608,13 +4788,13 @@ var DraggableComponent = ({
4608
4788
  }
4609
4789
  }, [ref.current]);
4610
4790
  const registerNode = useAppStore((s) => s.nodes.registerNode);
4611
- const hideOverlay = (0, import_react26.useCallback)(() => {
4791
+ const hideOverlay = (0, import_react24.useCallback)(() => {
4612
4792
  setIsVisible(false);
4613
4793
  }, []);
4614
- const showOverlay = (0, import_react26.useCallback)(() => {
4794
+ const showOverlay = (0, import_react24.useCallback)(() => {
4615
4795
  setIsVisible(true);
4616
4796
  }, []);
4617
- (0, import_react26.useEffect)(() => {
4797
+ (0, import_react24.useEffect)(() => {
4618
4798
  var _a;
4619
4799
  registerNode(id, {
4620
4800
  methods: { sync, showOverlay, hideOverlay },
@@ -4631,13 +4811,20 @@ var DraggableComponent = ({
4631
4811
  });
4632
4812
  };
4633
4813
  }, [id, zoneCompound, index, componentType, sync]);
4634
- const CustomActionBar = (0, import_react26.useMemo)(
4814
+ const CustomActionBar = (0, import_react24.useMemo)(
4635
4815
  () => overrides.actionBar || DefaultActionBar,
4636
4816
  [overrides.actionBar]
4637
4817
  );
4638
- const onClick = (0, import_react26.useCallback)(
4818
+ const CustomOverlay = (0, import_react24.useMemo)(
4819
+ () => overrides.componentOverlay || DefaultOverlay,
4820
+ [overrides.componentOverlay]
4821
+ );
4822
+ const onClick = (0, import_react24.useCallback)(
4639
4823
  (e) => {
4640
- e.stopPropagation();
4824
+ const el = e.target;
4825
+ if (!el.closest("[data-puck-overlay-portal]")) {
4826
+ e.stopPropagation();
4827
+ }
4641
4828
  dispatch({
4642
4829
  type: "setUi",
4643
4830
  ui: {
@@ -4648,7 +4835,7 @@ var DraggableComponent = ({
4648
4835
  [index, zoneCompound, id]
4649
4836
  );
4650
4837
  const appStore = useAppStoreApi();
4651
- const onSelectParent = (0, import_react26.useCallback)(() => {
4838
+ const onSelectParent = (0, import_react24.useCallback)(() => {
4652
4839
  const { nodes, zones } = appStore.getState().state.indexes;
4653
4840
  const node = nodes[id];
4654
4841
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -4669,26 +4856,26 @@ var DraggableComponent = ({
4669
4856
  }
4670
4857
  });
4671
4858
  }, [ctx, path]);
4672
- const onDuplicate = (0, import_react26.useCallback)(() => {
4859
+ const onDuplicate = (0, import_react24.useCallback)(() => {
4673
4860
  dispatch({
4674
4861
  type: "duplicate",
4675
4862
  sourceIndex: index,
4676
4863
  sourceZone: zoneCompound
4677
4864
  });
4678
4865
  }, [index, zoneCompound]);
4679
- const onDelete = (0, import_react26.useCallback)(() => {
4866
+ const onDelete = (0, import_react24.useCallback)(() => {
4680
4867
  dispatch({
4681
4868
  type: "remove",
4682
4869
  index,
4683
4870
  zone: zoneCompound
4684
4871
  });
4685
4872
  }, [index, zoneCompound]);
4686
- const [hover, setHover] = (0, import_react26.useState)(false);
4873
+ const [hover, setHover] = (0, import_react24.useState)(false);
4687
4874
  const indicativeHover = useContextStore(
4688
4875
  ZoneStoreContext,
4689
4876
  (s) => s.hoveringComponent === id
4690
4877
  );
4691
- (0, import_react26.useEffect)(() => {
4878
+ (0, import_react24.useEffect)(() => {
4692
4879
  if (!ref.current) {
4693
4880
  return;
4694
4881
  }
@@ -4733,10 +4920,10 @@ var DraggableComponent = ({
4733
4920
  thisIsDragging,
4734
4921
  inDroppableZone
4735
4922
  ]);
4736
- const [isVisible, setIsVisible] = (0, import_react26.useState)(false);
4737
- const [dragFinished, setDragFinished] = (0, import_react26.useState)(true);
4738
- const [_, startTransition] = (0, import_react26.useTransition)();
4739
- (0, import_react26.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)(() => {
4740
4927
  startTransition(() => {
4741
4928
  if (hover || indicativeHover || isSelected) {
4742
4929
  sync();
@@ -4747,7 +4934,7 @@ var DraggableComponent = ({
4747
4934
  }
4748
4935
  });
4749
4936
  }, [hover, indicativeHover, isSelected, iframe]);
4750
- const [thisWasDragging, setThisWasDragging] = (0, import_react26.useState)(false);
4937
+ const [thisWasDragging, setThisWasDragging] = (0, import_react24.useState)(false);
4751
4938
  const onDragFinished = useOnDragFinished((finished) => {
4752
4939
  if (finished) {
4753
4940
  startTransition(() => {
@@ -4758,15 +4945,15 @@ var DraggableComponent = ({
4758
4945
  setDragFinished(false);
4759
4946
  }
4760
4947
  });
4761
- (0, import_react26.useEffect)(() => {
4948
+ (0, import_react24.useEffect)(() => {
4762
4949
  if (thisIsDragging) {
4763
4950
  setThisWasDragging(true);
4764
4951
  }
4765
4952
  }, [thisIsDragging]);
4766
- (0, import_react26.useEffect)(() => {
4953
+ (0, import_react24.useEffect)(() => {
4767
4954
  if (thisWasDragging) return onDragFinished();
4768
4955
  }, [thisWasDragging, onDragFinished]);
4769
- const syncActionsPosition = (0, import_react26.useCallback)(
4956
+ const syncActionsPosition = (0, import_react24.useCallback)(
4770
4957
  (el) => {
4771
4958
  if (el) {
4772
4959
  const view = el.ownerDocument.defaultView;
@@ -4791,7 +4978,7 @@ var DraggableComponent = ({
4791
4978
  },
4792
4979
  [zoom]
4793
4980
  );
4794
- (0, import_react26.useEffect)(() => {
4981
+ (0, import_react24.useEffect)(() => {
4795
4982
  if (userDragAxis) {
4796
4983
  setDragAxis(userDragAxis);
4797
4984
  return;
@@ -4805,11 +4992,11 @@ var DraggableComponent = ({
4805
4992
  }
4806
4993
  setDragAxis(autoDragAxis);
4807
4994
  }, [ref, userDragAxis, autoDragAxis]);
4808
- const parentAction = (0, import_react26.useMemo)(
4995
+ const parentAction = (0, import_react24.useMemo)(
4809
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 }) }),
4810
4997
  [ctx == null ? void 0 : ctx.areaId]
4811
4998
  );
4812
- const nextContextValue = (0, import_react26.useMemo)(
4999
+ const nextContextValue = (0, import_react24.useMemo)(
4813
5000
  () => __spreadProps(__spreadValues({}, ctx), {
4814
5001
  areaId: id,
4815
5002
  zoneCompound,
@@ -4877,7 +5064,16 @@ var DraggableComponent = ({
4877
5064
  )
4878
5065
  }
4879
5066
  ),
4880
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("overlay") })
5067
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("overlayWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5068
+ CustomOverlay,
5069
+ {
5070
+ componentId: id,
5071
+ componentType,
5072
+ hover,
5073
+ isSelected,
5074
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("overlay") })
5075
+ }
5076
+ ) })
4881
5077
  ]
4882
5078
  }
4883
5079
  ),
@@ -4892,11 +5088,11 @@ init_react_import();
4892
5088
  var styles_module_default12 = { "DropZone": "_DropZone_1i2sv_1", "DropZone--hasChildren": "_DropZone--hasChildren_1i2sv_11", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_1i2sv_24", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_1i2sv_25", "DropZone--isRootZone": "_DropZone--isRootZone_1i2sv_25", "DropZone--isDestination": "_DropZone--isDestination_1i2sv_35", "DropZone-item": "_DropZone-item_1i2sv_47", "DropZone-hitbox": "_DropZone-hitbox_1i2sv_51", "DropZone--isEnabled": "_DropZone--isEnabled_1i2sv_59", "DropZone--isAnimating": "_DropZone--isAnimating_1i2sv_68" };
4893
5089
 
4894
5090
  // components/DropZone/index.tsx
4895
- var import_react36 = require("@dnd-kit/react");
5091
+ var import_react35 = require("@dnd-kit/react");
4896
5092
 
4897
5093
  // components/DropZone/lib/use-min-empty-height.ts
4898
5094
  init_react_import();
4899
- var import_react27 = require("react");
5095
+ var import_react25 = require("react");
4900
5096
  var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
4901
5097
  var useMinEmptyHeight = ({
4902
5098
  zoneCompound,
@@ -4904,8 +5100,8 @@ var useMinEmptyHeight = ({
4904
5100
  ref
4905
5101
  }) => {
4906
5102
  const appStore = useAppStoreApi();
4907
- const [prevHeight, setPrevHeight] = (0, import_react27.useState)(0);
4908
- const [isAnimating, setIsAnimating] = (0, import_react27.useState)(false);
5103
+ const [prevHeight, setPrevHeight] = (0, import_react25.useState)(0);
5104
+ const [isAnimating, setIsAnimating] = (0, import_react25.useState)(false);
4909
5105
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
4910
5106
  var _a, _b;
4911
5107
  return {
@@ -4913,7 +5109,7 @@ var useMinEmptyHeight = ({
4913
5109
  isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
4914
5110
  };
4915
5111
  });
4916
- const numItems = (0, import_react27.useRef)(0);
5112
+ const numItems = (0, import_react25.useRef)(0);
4917
5113
  const onDragFinished = useOnDragFinished(
4918
5114
  (finished) => {
4919
5115
  var _a;
@@ -4948,7 +5144,7 @@ var useMinEmptyHeight = ({
4948
5144
  },
4949
5145
  [appStore, prevHeight, zoneCompound]
4950
5146
  );
4951
- (0, import_react27.useEffect)(() => {
5147
+ (0, import_react25.useEffect)(() => {
4952
5148
  if (draggedItem && ref.current) {
4953
5149
  if (isZone) {
4954
5150
  const rect = ref.current.getBoundingClientRect();
@@ -4979,15 +5175,15 @@ function assignRefs(refs, node) {
4979
5175
 
4980
5176
  // components/DropZone/lib/use-content-with-preview.ts
4981
5177
  init_react_import();
4982
- var import_react30 = require("react");
5178
+ var import_react28 = require("react");
4983
5179
 
4984
5180
  // lib/dnd/use-rendered-callback.ts
4985
5181
  init_react_import();
4986
- var import_react28 = require("@dnd-kit/react");
4987
- var import_react29 = require("react");
5182
+ var import_react26 = require("@dnd-kit/react");
5183
+ var import_react27 = require("react");
4988
5184
  function useRenderedCallback(callback, deps) {
4989
- const manager = (0, import_react28.useDragDropManager)();
4990
- return (0, import_react29.useCallback)(
5185
+ const manager = (0, import_react26.useDragDropManager)();
5186
+ return (0, import_react27.useCallback)(
4991
5187
  (...args) => __async(this, null, function* () {
4992
5188
  yield manager == null ? void 0 : manager.renderer.rendering;
4993
5189
  return callback(...args);
@@ -4998,14 +5194,14 @@ function useRenderedCallback(callback, deps) {
4998
5194
 
4999
5195
  // components/DropZone/lib/use-content-with-preview.ts
5000
5196
  var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5001
- const zoneStore = (0, import_react30.useContext)(ZoneStoreContext);
5197
+ const zoneStore = (0, import_react28.useContext)(ZoneStoreContext);
5002
5198
  const preview = useContextStore(
5003
5199
  ZoneStoreContext,
5004
5200
  (s) => s.previewIndex[zoneCompound]
5005
5201
  );
5006
5202
  const isDragging = useAppStore((s) => s.state.ui.isDragging);
5007
- const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react30.useState)(contentIds);
5008
- const [localPreview, setLocalPreview] = (0, import_react30.useState)(
5203
+ const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react28.useState)(contentIds);
5204
+ const [localPreview, setLocalPreview] = (0, import_react28.useState)(
5009
5205
  preview
5010
5206
  );
5011
5207
  const updateContent = useRenderedCallback(
@@ -5040,7 +5236,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5040
5236
  },
5041
5237
  []
5042
5238
  );
5043
- (0, import_react30.useEffect)(() => {
5239
+ (0, import_react28.useEffect)(() => {
5044
5240
  var _a;
5045
5241
  const s = zoneStore.getState();
5046
5242
  const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
@@ -5058,16 +5254,16 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
5058
5254
 
5059
5255
  // components/DropZone/lib/use-drag-axis.ts
5060
5256
  init_react_import();
5061
- var import_react31 = require("react");
5257
+ var import_react29 = require("react");
5062
5258
  var GRID_DRAG_AXIS = "dynamic";
5063
5259
  var FLEX_ROW_DRAG_AXIS = "x";
5064
5260
  var DEFAULT_DRAG_AXIS = "y";
5065
5261
  var useDragAxis = (ref, collisionAxis) => {
5066
5262
  const status = useAppStore((s) => s.status);
5067
- const [dragAxis, setDragAxis] = (0, import_react31.useState)(
5263
+ const [dragAxis, setDragAxis] = (0, import_react29.useState)(
5068
5264
  collisionAxis || DEFAULT_DRAG_AXIS
5069
5265
  );
5070
- const calculateDragAxis = (0, import_react31.useCallback)(() => {
5266
+ const calculateDragAxis = (0, import_react29.useCallback)(() => {
5071
5267
  if (ref.current) {
5072
5268
  const computedStyle = window.getComputedStyle(ref.current);
5073
5269
  if (computedStyle.display === "grid") {
@@ -5079,7 +5275,7 @@ var useDragAxis = (ref, collisionAxis) => {
5079
5275
  }
5080
5276
  }
5081
5277
  }, [ref.current]);
5082
- (0, import_react31.useEffect)(() => {
5278
+ (0, import_react29.useEffect)(() => {
5083
5279
  const onViewportChange = () => {
5084
5280
  calculateDragAxis();
5085
5281
  };
@@ -5088,7 +5284,7 @@ var useDragAxis = (ref, collisionAxis) => {
5088
5284
  window.removeEventListener("viewportchange", onViewportChange);
5089
5285
  };
5090
5286
  }, []);
5091
- (0, import_react31.useEffect)(calculateDragAxis, [status, collisionAxis]);
5287
+ (0, import_react29.useEffect)(calculateDragAxis, [status, collisionAxis]);
5092
5288
  return [dragAxis, calculateDragAxis];
5093
5289
  };
5094
5290
 
@@ -5100,37 +5296,72 @@ init_react_import();
5100
5296
 
5101
5297
  // lib/use-slots.tsx
5102
5298
  init_react_import();
5103
- var import_react32 = require("react");
5104
- function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
5105
- const slotProps = (0, import_react32.useMemo)(() => {
5106
- const mapped = mapSlots(
5107
- item,
5108
- (content, _parentId, propName, field, propPath) => {
5109
- const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
5110
- const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
5111
- const render = isReadOnly ? renderSlotRender : renderSlotEdit;
5112
- const Slot = (dzProps) => render(__spreadProps(__spreadValues({
5113
- allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
5114
- disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
5115
- }, dzProps), {
5116
- zone: propName,
5117
- content
5118
- }));
5119
- return Slot;
5120
- },
5121
- config
5122
- ).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;
5123
5327
  return mapped;
5124
- }, [config, item, readOnly, forceReadOnly]);
5125
- const mergedProps = (0, import_react32.useMemo)(
5126
- () => __spreadValues(__spreadValues({}, item.props), slotProps),
5127
- [item.props, slotProps]
5328
+ }, [config, item, mappers]);
5329
+ const mergedProps = (0, import_react30.useMemo)(
5330
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
5331
+ [item.props, transformedProps]
5128
5332
  );
5129
5333
  return mergedProps;
5130
5334
  }
5131
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
+
5132
5363
  // components/Render/index.tsx
5133
- var import_react34 = __toESM(require("react"));
5364
+ var import_react32 = __toESM(require("react"));
5134
5365
 
5135
5366
  // components/SlotRender/index.tsx
5136
5367
  init_react_import();
@@ -5138,7 +5369,7 @@ var import_shallow3 = require("zustand/react/shallow");
5138
5369
 
5139
5370
  // components/SlotRender/server.tsx
5140
5371
  init_react_import();
5141
- var import_react33 = require("react");
5372
+ var import_react31 = require("react");
5142
5373
 
5143
5374
  // components/ServerRender/index.tsx
5144
5375
  init_react_import();
@@ -5207,7 +5438,7 @@ var Item = ({
5207
5438
  })
5208
5439
  );
5209
5440
  };
5210
- var SlotRender = (0, import_react33.forwardRef)(
5441
+ var SlotRender = (0, import_react31.forwardRef)(
5211
5442
  function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
5212
5443
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
5213
5444
  if (!config.components[item.type]) {
@@ -5255,7 +5486,7 @@ var ContextSlotRender = ({
5255
5486
 
5256
5487
  // components/Render/index.tsx
5257
5488
  var import_jsx_runtime24 = require("react/jsx-runtime");
5258
- var renderContext = import_react34.default.createContext({
5489
+ var renderContext = import_react32.default.createContext({
5259
5490
  config: { components: {} },
5260
5491
  data: { root: {}, content: [] },
5261
5492
  metadata: {}
@@ -5288,7 +5519,7 @@ function Render({
5288
5519
  { type: "root", props: pageProps },
5289
5520
  (props) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
5290
5521
  );
5291
- const nextContextValue = (0, import_react34.useMemo)(
5522
+ const nextContextValue = (0, import_react32.useMemo)(
5292
5523
  () => ({
5293
5524
  mode: "render",
5294
5525
  depth: 0
@@ -5298,15 +5529,242 @@ function Render({
5298
5529
  if ((_a = config.root) == null ? void 0 : _a.render) {
5299
5530
  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)(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
5300
5531
  }
5301
- 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 }) }) });
5302
- }
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 }) }) });
5533
+ }
5534
+
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
+ // components/InlineTextField/index.tsx
5629
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5630
+ var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
5631
+ var InlineTextFieldInternal = ({
5632
+ propPath,
5633
+ componentId,
5634
+ value,
5635
+ isReadOnly,
5636
+ opts = {}
5637
+ }) => {
5638
+ var _a;
5639
+ const ref = (0, import_react33.useRef)(null);
5640
+ const appStoreApi = useAppStoreApi();
5641
+ const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
5642
+ (0, import_react33.useEffect)(() => {
5643
+ const appStore = appStoreApi.getState();
5644
+ const data = appStore.state.indexes.nodes[componentId].data;
5645
+ const componentConfig = appStore.getComponentConfig(data.type);
5646
+ if (!componentConfig) {
5647
+ throw new Error(
5648
+ `InlineTextField Error: No config defined for ${data.type}`
5649
+ );
5650
+ }
5651
+ if (ref.current) {
5652
+ if (value !== ref.current.innerText) {
5653
+ ref.current.replaceChildren(value);
5654
+ }
5655
+ const cleanupPortal = registerOverlayPortal(ref.current);
5656
+ const handleInput = (e) => __async(void 0, null, function* () {
5657
+ var _a2;
5658
+ const appStore2 = appStoreApi.getState();
5659
+ const node = appStore2.state.indexes.nodes[componentId];
5660
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5661
+ const index = (_a2 = appStore2.state.indexes.zones[zoneCompound]) == null ? void 0 : _a2.contentIds.indexOf(
5662
+ componentId
5663
+ );
5664
+ const newProps = setDeep(node.data.props, propPath, e.target.innerText);
5665
+ const resolvedData = yield appStore2.resolveComponentData(
5666
+ __spreadProps(__spreadValues({}, node.data), { props: newProps }),
5667
+ "replace"
5668
+ );
5669
+ appStore2.dispatch({
5670
+ type: "replace",
5671
+ data: resolvedData.node,
5672
+ destinationIndex: index,
5673
+ destinationZone: zoneCompound
5674
+ });
5675
+ });
5676
+ ref.current.addEventListener("input", handleInput);
5677
+ return () => {
5678
+ var _a2;
5679
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("input", handleInput);
5680
+ cleanupPortal == null ? void 0 : cleanupPortal();
5681
+ };
5682
+ }
5683
+ }, [appStoreApi, ref.current, value]);
5684
+ const [isHovering, setIsHovering] = (0, import_react33.useState)(false);
5685
+ const [isFocused, setIsFocused] = (0, import_react33.useState)(false);
5686
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5687
+ "span",
5688
+ {
5689
+ className: getClassName17(),
5690
+ ref,
5691
+ contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
5692
+ onClick: (e) => {
5693
+ e.preventDefault();
5694
+ e.stopPropagation();
5695
+ },
5696
+ onClickCapture: (e) => {
5697
+ e.preventDefault();
5698
+ e.stopPropagation();
5699
+ },
5700
+ onKeyDown: (e) => {
5701
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5702
+ e.preventDefault();
5703
+ }
5704
+ },
5705
+ onMouseOverCapture: () => setIsHovering(true),
5706
+ onMouseOutCapture: () => setIsHovering(false),
5707
+ onFocus: () => setIsFocused(true),
5708
+ onBlur: () => setIsFocused(false)
5709
+ }
5710
+ );
5711
+ };
5712
+ var InlineTextField = (0, import_react33.memo)(InlineTextFieldInternal);
5713
+
5714
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5715
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5716
+ var getInlineTextTransform = () => ({
5717
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5718
+ if (field.contentEditable) {
5719
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5720
+ InlineTextField,
5721
+ {
5722
+ propPath,
5723
+ componentId,
5724
+ value,
5725
+ opts: { disableLineBreaks: true },
5726
+ isReadOnly
5727
+ }
5728
+ );
5729
+ }
5730
+ return value;
5731
+ },
5732
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5733
+ if (field.contentEditable) {
5734
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5735
+ InlineTextField,
5736
+ {
5737
+ propPath,
5738
+ componentId,
5739
+ value,
5740
+ isReadOnly
5741
+ }
5742
+ );
5743
+ }
5744
+ return value;
5745
+ },
5746
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5747
+ if (field.contentEditable && typeof value === "string") {
5748
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5749
+ InlineTextField,
5750
+ {
5751
+ propPath,
5752
+ componentId,
5753
+ value,
5754
+ isReadOnly
5755
+ }
5756
+ );
5757
+ }
5758
+ return value;
5759
+ }
5760
+ });
5303
5761
 
5304
5762
  // components/DropZone/index.tsx
5305
- var import_jsx_runtime25 = require("react/jsx-runtime");
5306
- var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
5763
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5764
+ var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
5307
5765
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5308
5766
  var RENDER_DEBUG = false;
5309
- var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
5767
+ var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneEdit, __spreadValues({}, props));
5310
5768
  var DropZoneChild = ({
5311
5769
  zoneCompound,
5312
5770
  componentId,
@@ -5317,9 +5775,9 @@ var DropZoneChild = ({
5317
5775
  }) => {
5318
5776
  var _a, _b;
5319
5777
  const metadata = useAppStore((s) => s.metadata);
5320
- const ctx = (0, import_react35.useContext)(dropZoneContext);
5778
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5321
5779
  const { depth = 1 } = ctx != null ? ctx : {};
5322
- const zoneStore = (0, import_react35.useContext)(ZoneStoreContext);
5780
+ const zoneStore = (0, import_react34.useContext)(ZoneStoreContext);
5323
5781
  const nodeProps = useAppStore(
5324
5782
  (0, import_shallow4.useShallow)((s) => {
5325
5783
  var _a2;
@@ -5339,7 +5797,7 @@ var DropZoneChild = ({
5339
5797
  })
5340
5798
  );
5341
5799
  const appStore = useAppStoreApi();
5342
- const item = (0, import_react35.useMemo)(() => {
5800
+ const item = (0, import_react34.useMemo)(() => {
5343
5801
  if (nodeProps) {
5344
5802
  const expanded = expandNode({
5345
5803
  type: nodeType,
@@ -5361,7 +5819,7 @@ var DropZoneChild = ({
5361
5819
  const componentConfig = useAppStore(
5362
5820
  (s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
5363
5821
  );
5364
- const puckProps = (0, import_react35.useMemo)(
5822
+ const puckProps = (0, import_react34.useMemo)(
5365
5823
  () => ({
5366
5824
  renderDropZone: DropZoneEditPure,
5367
5825
  isEditing: true,
@@ -5384,19 +5842,20 @@ var DropZoneChild = ({
5384
5842
  }
5385
5843
  );
5386
5844
  let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
5387
- const renderPreview = (0, import_react35.useMemo)(
5845
+ const renderPreview = (0, import_react34.useMemo)(
5388
5846
  () => function Preview3() {
5847
+ var _a2;
5389
5848
  if (item && "element" in item && item.element) {
5390
5849
  return (
5391
5850
  // Safe to use this since the HTML is set by the user
5392
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5851
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5393
5852
  );
5394
5853
  }
5395
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
5854
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5396
5855
  },
5397
5856
  [componentId, label, overrides]
5398
5857
  );
5399
- const defaultsProps = (0, import_react35.useMemo)(
5858
+ const defaultsProps = (0, import_react34.useMemo)(
5400
5859
  () => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
5401
5860
  puck: puckProps,
5402
5861
  editMode: true
@@ -5404,7 +5863,7 @@ var DropZoneChild = ({
5404
5863
  }),
5405
5864
  [componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
5406
5865
  );
5407
- const defaultedNode = (0, import_react35.useMemo)(
5866
+ const defaultedNode = (0, import_react34.useMemo)(
5408
5867
  () => {
5409
5868
  var _a2;
5410
5869
  return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
@@ -5412,16 +5871,24 @@ var DropZoneChild = ({
5412
5871
  [item == null ? void 0 : item.type, nodeType, defaultsProps]
5413
5872
  );
5414
5873
  const config = useAppStore((s) => s.config);
5415
- const defaultedPropsWithSlots = useSlots(
5874
+ const plugins = useAppStore((s) => s.plugins);
5875
+ const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
5876
+ const combinedFieldTransforms = (0, import_react34.useMemo)(
5877
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5878
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
5879
+ {}
5880
+ )), userFieldTransforms),
5881
+ [plugins, userFieldTransforms]
5882
+ );
5883
+ const transformedProps = useFieldTransforms(
5416
5884
  config,
5417
5885
  defaultedNode,
5418
- DropZoneEditPure,
5419
- (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
5886
+ combinedFieldTransforms,
5420
5887
  nodeReadOnly,
5421
5888
  isLoading
5422
5889
  );
5423
5890
  if (!item) return;
5424
- let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5891
+ let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5425
5892
  "No configuration for ",
5426
5893
  item.type
5427
5894
  ] });
@@ -5430,7 +5897,7 @@ var DropZoneChild = ({
5430
5897
  if (isInserting) {
5431
5898
  Render2 = renderPreview;
5432
5899
  }
5433
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5900
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5434
5901
  DraggableComponent,
5435
5902
  {
5436
5903
  id: componentId,
@@ -5444,19 +5911,19 @@ var DropZoneChild = ({
5444
5911
  autoDragAxis: dragAxis,
5445
5912
  userDragAxis: collisionAxis,
5446
5913
  inDroppableZone,
5447
- 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)(
5914
+ 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)(
5448
5915
  Render2,
5449
- __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5450
- puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5916
+ __spreadProps(__spreadValues({}, transformedProps), {
5917
+ puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
5451
5918
  dragRef
5452
5919
  })
5453
5920
  })
5454
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5921
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Render2, __spreadValues({}, transformedProps)) })
5455
5922
  }
5456
5923
  );
5457
5924
  };
5458
- var DropZoneChildMemo = (0, import_react35.memo)(DropZoneChild);
5459
- var DropZoneEdit = (0, import_react35.forwardRef)(
5925
+ var DropZoneChildMemo = (0, import_react34.memo)(DropZoneChild);
5926
+ var DropZoneEdit = (0, import_react34.forwardRef)(
5460
5927
  function DropZoneEditInternal({
5461
5928
  zone,
5462
5929
  allow,
@@ -5466,7 +5933,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5466
5933
  minEmptyHeight: userMinEmptyHeight = 128,
5467
5934
  collisionAxis
5468
5935
  }, userRef) {
5469
- const ctx = (0, import_react35.useContext)(dropZoneContext);
5936
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5470
5937
  const appStoreApi = useAppStoreApi();
5471
5938
  const {
5472
5939
  // These all need setting via context
@@ -5504,14 +5971,14 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5504
5971
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
5505
5972
  })
5506
5973
  );
5507
- (0, import_react35.useEffect)(() => {
5974
+ (0, import_react34.useEffect)(() => {
5508
5975
  if (!zoneType || zoneType === "dropzone") {
5509
5976
  if (ctx == null ? void 0 : ctx.registerZone) {
5510
5977
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
5511
5978
  }
5512
5979
  }
5513
5980
  }, [zoneType, appStoreApi]);
5514
- (0, import_react35.useEffect)(() => {
5981
+ (0, import_react34.useEffect)(() => {
5515
5982
  if (zoneType === "dropzone") {
5516
5983
  if (zoneCompound !== rootDroppableId) {
5517
5984
  console.warn(
@@ -5520,11 +5987,11 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5520
5987
  }
5521
5988
  }
5522
5989
  }, [zoneType]);
5523
- const contentIds = (0, import_react35.useMemo)(() => {
5990
+ const contentIds = (0, import_react34.useMemo)(() => {
5524
5991
  return zoneContentIds || [];
5525
5992
  }, [zoneContentIds]);
5526
- const ref = (0, import_react35.useRef)(null);
5527
- const acceptsTarget = (0, import_react35.useCallback)(
5993
+ const ref = (0, import_react34.useRef)(null);
5994
+ const acceptsTarget = (0, import_react34.useCallback)(
5528
5995
  (componentType) => {
5529
5996
  if (!componentType) {
5530
5997
  return true;
@@ -5562,7 +6029,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5562
6029
  }
5563
6030
  return _isEnabled;
5564
6031
  });
5565
- (0, import_react35.useEffect)(() => {
6032
+ (0, import_react34.useEffect)(() => {
5566
6033
  if (registerLocalZone) {
5567
6034
  registerLocalZone(zoneCompound, targetAccepted || isEnabled);
5568
6035
  }
@@ -5577,8 +6044,8 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5577
6044
  zoneCompound
5578
6045
  );
5579
6046
  const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
5580
- const zoneStore = (0, import_react35.useContext)(ZoneStoreContext);
5581
- (0, import_react35.useEffect)(() => {
6047
+ const zoneStore = (0, import_react34.useContext)(ZoneStoreContext);
6048
+ (0, import_react34.useEffect)(() => {
5582
6049
  const { enabledIndex } = zoneStore.getState();
5583
6050
  zoneStore.setState({
5584
6051
  enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
@@ -5597,7 +6064,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5597
6064
  path: path || []
5598
6065
  }
5599
6066
  };
5600
- const { ref: dropRef } = (0, import_react36.useDroppable)(droppableConfig);
6067
+ const { ref: dropRef } = (0, import_react35.useDroppable)(droppableConfig);
5601
6068
  const isAreaSelected = useAppStore(
5602
6069
  (s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
5603
6070
  );
@@ -5607,10 +6074,10 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5607
6074
  userMinEmptyHeight,
5608
6075
  ref
5609
6076
  });
5610
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6077
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5611
6078
  "div",
5612
6079
  {
5613
- className: `${getClassName17({
6080
+ className: `${getClassName18({
5614
6081
  isRootZone,
5615
6082
  hoveringOverArea,
5616
6083
  isEnabled,
@@ -5628,7 +6095,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5628
6095
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
5629
6096
  }),
5630
6097
  children: contentIdsWithPreview.map((componentId, i) => {
5631
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6098
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5632
6099
  DropZoneChildMemo,
5633
6100
  {
5634
6101
  zoneCompound,
@@ -5651,15 +6118,15 @@ var DropZoneRenderItem = ({
5651
6118
  metadata
5652
6119
  }) => {
5653
6120
  const Component = config.components[item.type];
5654
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5655
- const nextContextValue = (0, import_react35.useMemo)(
6121
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
6122
+ const nextContextValue = (0, import_react34.useMemo)(
5656
6123
  () => ({
5657
6124
  areaId: props.id,
5658
6125
  depth: 1
5659
6126
  }),
5660
6127
  [props]
5661
6128
  );
5662
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6129
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5663
6130
  Component.render,
5664
6131
  __spreadProps(__spreadValues({}, props), {
5665
6132
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -5669,15 +6136,15 @@ var DropZoneRenderItem = ({
5669
6136
  })
5670
6137
  ) }, props.id);
5671
6138
  };
5672
- var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadValues({}, props));
5673
- var DropZoneRender2 = (0, import_react35.forwardRef)(
6139
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRender2, __spreadValues({}, props));
6140
+ var DropZoneRender2 = (0, import_react34.forwardRef)(
5674
6141
  function DropZoneRenderInternal({ className, style, zone }, ref) {
5675
- const ctx = (0, import_react35.useContext)(dropZoneContext);
6142
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5676
6143
  const { areaId = "root" } = ctx || {};
5677
- const { config, data, metadata } = (0, import_react35.useContext)(renderContext);
6144
+ const { config, data, metadata } = (0, import_react34.useContext)(renderContext);
5678
6145
  let zoneCompound = `${areaId}:${zone}`;
5679
6146
  let content = (data == null ? void 0 : data.content) || [];
5680
- (0, import_react35.useEffect)(() => {
6147
+ (0, import_react34.useEffect)(() => {
5681
6148
  if (!content) {
5682
6149
  if (ctx == null ? void 0 : ctx.registerZone) {
5683
6150
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
@@ -5690,10 +6157,10 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
5690
6157
  if (zoneCompound !== rootDroppableId) {
5691
6158
  content = setupZone(data, zoneCompound).zones[zoneCompound];
5692
6159
  }
5693
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
6160
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, style, ref, children: content.map((item) => {
5694
6161
  const Component = config.components[item.type];
5695
6162
  if (Component) {
5696
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6163
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5697
6164
  DropZoneRenderItem,
5698
6165
  {
5699
6166
  config,
@@ -5707,14 +6174,14 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
5707
6174
  }) });
5708
6175
  }
5709
6176
  );
5710
- var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, __spreadValues({}, props));
5711
- var DropZone = (0, import_react35.forwardRef)(
6177
+ var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZone, __spreadValues({}, props));
6178
+ var DropZone = (0, import_react34.forwardRef)(
5712
6179
  function DropZone2(props, ref) {
5713
- const ctx = (0, import_react35.useContext)(dropZoneContext);
6180
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5714
6181
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
5715
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
6182
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5716
6183
  }
5717
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
6184
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
5718
6185
  }
5719
6186
  );
5720
6187
 
@@ -6050,14 +6517,14 @@ function getDeepDir(el) {
6050
6517
 
6051
6518
  // components/DragDropContext/index.tsx
6052
6519
  var import_state = require("@dnd-kit/state");
6053
- var import_jsx_runtime26 = require("react/jsx-runtime");
6520
+ var import_jsx_runtime28 = require("react/jsx-runtime");
6054
6521
  var DEBUG3 = false;
6055
- var dragListenerContext = (0, import_react38.createContext)({
6522
+ var dragListenerContext = (0, import_react37.createContext)({
6056
6523
  dragListeners: {}
6057
6524
  });
6058
6525
  function useDragListener(type, fn, deps = []) {
6059
- const { setDragListeners } = (0, import_react38.useContext)(dragListenerContext);
6060
- (0, import_react38.useEffect)(() => {
6526
+ const { setDragListeners } = (0, import_react37.useContext)(dragListenerContext);
6527
+ (0, import_react37.useEffect)(() => {
6061
6528
  if (setDragListeners) {
6062
6529
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
6063
6530
  [type]: [...old[type] || [], fn]
@@ -6067,8 +6534,8 @@ function useDragListener(type, fn, deps = []) {
6067
6534
  }
6068
6535
  var AREA_CHANGE_DEBOUNCE_MS = 100;
6069
6536
  var useTempDisableFallback = (timeout3) => {
6070
- const lastFallbackDisable = (0, import_react38.useRef)(null);
6071
- return (0, import_react38.useCallback)((manager) => {
6537
+ const lastFallbackDisable = (0, import_react37.useRef)(null);
6538
+ return (0, import_react37.useCallback)((manager) => {
6072
6539
  collisionStore.setState({ fallbackEnabled: false });
6073
6540
  const fallbackId = generateId();
6074
6541
  lastFallbackDisable.current = fallbackId;
@@ -6087,9 +6554,9 @@ var DragDropContextClient = ({
6087
6554
  const dispatch = useAppStore((s) => s.dispatch);
6088
6555
  const appStore = useAppStoreApi();
6089
6556
  const id = useSafeId();
6090
- const debouncedParamsRef = (0, import_react38.useRef)(null);
6557
+ const debouncedParamsRef = (0, import_react37.useRef)(null);
6091
6558
  const tempDisableFallback = useTempDisableFallback(100);
6092
- const [zoneStore] = (0, import_react38.useState)(
6559
+ const [zoneStore] = (0, import_react37.useState)(
6093
6560
  () => (0, import_zustand5.createStore)(() => ({
6094
6561
  zoneDepthIndex: {},
6095
6562
  nextZoneDepthIndex: {},
@@ -6101,7 +6568,7 @@ var DragDropContextClient = ({
6101
6568
  hoveringComponent: null
6102
6569
  }))
6103
6570
  );
6104
- const getChanged2 = (0, import_react38.useCallback)(
6571
+ const getChanged2 = (0, import_react37.useCallback)(
6105
6572
  (params, id2) => {
6106
6573
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
6107
6574
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -6122,7 +6589,7 @@ var DragDropContextClient = ({
6122
6589
  },
6123
6590
  [zoneStore]
6124
6591
  );
6125
- const setDeepestAndCollide = (0, import_react38.useCallback)(
6592
+ const setDeepestAndCollide = (0, import_react37.useCallback)(
6126
6593
  (params, manager) => {
6127
6594
  const { zoneChanged, areaChanged } = getChanged2(params, id);
6128
6595
  if (!zoneChanged && !areaChanged) return;
@@ -6146,7 +6613,7 @@ var DragDropContextClient = ({
6146
6613
  setDeepestDb.cancel();
6147
6614
  debouncedParamsRef.current = null;
6148
6615
  };
6149
- (0, import_react38.useEffect)(() => {
6616
+ (0, import_react37.useEffect)(() => {
6150
6617
  if (DEBUG3) {
6151
6618
  zoneStore.subscribe(
6152
6619
  (s) => {
@@ -6160,7 +6627,7 @@ var DragDropContextClient = ({
6160
6627
  );
6161
6628
  }
6162
6629
  }, []);
6163
- const [plugins] = (0, import_react38.useState)(() => [
6630
+ const [plugins] = (0, import_react37.useState)(() => [
6164
6631
  ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
6165
6632
  createNestedDroppablePlugin(
6166
6633
  {
@@ -6208,10 +6675,10 @@ var DragDropContextClient = ({
6208
6675
  )
6209
6676
  ]);
6210
6677
  const sensors = useSensors();
6211
- const [dragListeners, setDragListeners] = (0, import_react38.useState)({});
6212
- const dragMode = (0, import_react38.useRef)(null);
6213
- const initialSelector = (0, import_react38.useRef)(void 0);
6214
- const nextContextValue = (0, import_react38.useMemo)(
6678
+ const [dragListeners, setDragListeners] = (0, import_react37.useState)({});
6679
+ const dragMode = (0, import_react37.useRef)(null);
6680
+ const initialSelector = (0, import_react37.useRef)(void 0);
6681
+ const nextContextValue = (0, import_react37.useMemo)(
6215
6682
  () => ({
6216
6683
  mode: "edit",
6217
6684
  areaId: "root",
@@ -6219,15 +6686,15 @@ var DragDropContextClient = ({
6219
6686
  }),
6220
6687
  []
6221
6688
  );
6222
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6689
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6223
6690
  dragListenerContext.Provider,
6224
6691
  {
6225
6692
  value: {
6226
6693
  dragListeners,
6227
6694
  setDragListeners
6228
6695
  },
6229
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6230
- import_react37.DragDropProvider,
6696
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6697
+ import_react36.DragDropProvider,
6231
6698
  {
6232
6699
  plugins,
6233
6700
  sensors,
@@ -6442,7 +6909,7 @@ var DragDropContextClient = ({
6442
6909
  const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
6443
6910
  entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
6444
6911
  },
6445
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6912
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6446
6913
  }
6447
6914
  )
6448
6915
  }
@@ -6456,13 +6923,13 @@ var DragDropContext = ({
6456
6923
  if (status === "LOADING") {
6457
6924
  return children;
6458
6925
  }
6459
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DragDropContextClient, { disableAutoScroll, children });
6926
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DragDropContextClient, { disableAutoScroll, children });
6460
6927
  };
6461
6928
 
6462
6929
  // components/Drawer/index.tsx
6463
- var import_react40 = require("@dnd-kit/react");
6464
- var import_jsx_runtime27 = require("react/jsx-runtime");
6465
- var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
6930
+ var import_react39 = require("@dnd-kit/react");
6931
+ var import_jsx_runtime29 = require("react/jsx-runtime");
6932
+ var getClassName19 = get_class_name_factory_default("Drawer", styles_module_default10);
6466
6933
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
6467
6934
  var DrawerItemInner = ({
6468
6935
  children,
@@ -6471,11 +6938,11 @@ var DrawerItemInner = ({
6471
6938
  dragRef,
6472
6939
  isDragDisabled
6473
6940
  }) => {
6474
- const CustomInner = (0, import_react39.useMemo)(
6475
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6941
+ const CustomInner = (0, import_react38.useMemo)(
6942
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6476
6943
  [children]
6477
6944
  );
6478
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6945
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6479
6946
  "div",
6480
6947
  {
6481
6948
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -6483,9 +6950,9 @@ var DrawerItemInner = ({
6483
6950
  onMouseDown: (e) => e.preventDefault(),
6484
6951
  "data-testid": dragRef ? `drawer-item:${name}` : "",
6485
6952
  "data-puck-drawer-item": true,
6486
- 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: [
6487
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6488
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DragIcon, {}) })
6953
+ 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: [
6954
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6955
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DragIcon, {}) })
6489
6956
  ] }) }) })
6490
6957
  }
6491
6958
  );
@@ -6497,15 +6964,15 @@ var DrawerItemDraggable = ({
6497
6964
  id,
6498
6965
  isDragDisabled
6499
6966
  }) => {
6500
- const { ref } = (0, import_react40.useDraggable)({
6967
+ const { ref } = (0, import_react39.useDraggable)({
6501
6968
  id,
6502
6969
  data: { componentType: name },
6503
6970
  disabled: isDragDisabled,
6504
6971
  type: "drawer"
6505
6972
  });
6506
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName18("draggable"), children: [
6507
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name, label, children }) }),
6508
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6973
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName19("draggable"), children: [
6974
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName19("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DrawerItemInner, { name, label, children }) }),
6975
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName19("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6509
6976
  DrawerItemInner,
6510
6977
  {
6511
6978
  name,
@@ -6526,7 +6993,7 @@ var DrawerItem = ({
6526
6993
  isDragDisabled
6527
6994
  }) => {
6528
6995
  const resolvedId = id || name;
6529
- const [dynamicId, setDynamicId] = (0, import_react39.useState)(generateId(resolvedId));
6996
+ const [dynamicId, setDynamicId] = (0, import_react38.useState)(generateId(resolvedId));
6530
6997
  if (typeof index !== "undefined") {
6531
6998
  console.error(
6532
6999
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -6539,7 +7006,7 @@ var DrawerItem = ({
6539
7006
  },
6540
7007
  [resolvedId]
6541
7008
  );
6542
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7009
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6543
7010
  DrawerItemDraggable,
6544
7011
  {
6545
7012
  name,
@@ -6566,16 +7033,16 @@ var Drawer = ({
6566
7033
  );
6567
7034
  }
6568
7035
  const id = useSafeId();
6569
- const { ref } = (0, import_react40.useDroppable)({
7036
+ const { ref } = (0, import_react39.useDroppable)({
6570
7037
  id,
6571
7038
  type: "void",
6572
7039
  collisionPriority: 0
6573
7040
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
6574
7041
  });
6575
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7042
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6576
7043
  "div",
6577
7044
  {
6578
- className: getClassName18(),
7045
+ className: getClassName19(),
6579
7046
  ref,
6580
7047
  "data-puck-dnd": id,
6581
7048
  "data-puck-drawer": true,
@@ -6588,18 +7055,18 @@ Drawer.Item = DrawerItem;
6588
7055
 
6589
7056
  // components/Puck/index.tsx
6590
7057
  init_react_import();
6591
- var import_react56 = require("react");
7058
+ var import_react59 = require("react");
6592
7059
 
6593
7060
  // components/SidebarSection/index.tsx
6594
7061
  init_react_import();
6595
7062
 
6596
7063
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6597
7064
  init_react_import();
6598
- 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" };
7065
+ 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" };
6599
7066
 
6600
7067
  // lib/use-breadcrumbs.ts
6601
7068
  init_react_import();
6602
- var import_react41 = require("react");
7069
+ var import_react40 = require("react");
6603
7070
  var useBreadcrumbs = (renderCount) => {
6604
7071
  const selectedId = useAppStore((s) => {
6605
7072
  var _a;
@@ -6611,7 +7078,7 @@ var useBreadcrumbs = (renderCount) => {
6611
7078
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
6612
7079
  });
6613
7080
  const appStore = useAppStoreApi();
6614
- return (0, import_react41.useMemo)(() => {
7081
+ return (0, import_react40.useMemo)(() => {
6615
7082
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
6616
7083
  var _a, _b, _c;
6617
7084
  const [componentId] = zoneCompound.split(":");
@@ -6642,8 +7109,8 @@ var useBreadcrumbs = (renderCount) => {
6642
7109
  };
6643
7110
 
6644
7111
  // components/SidebarSection/index.tsx
6645
- var import_jsx_runtime28 = require("react/jsx-runtime");
6646
- var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
7112
+ var import_jsx_runtime30 = require("react/jsx-runtime");
7113
+ var getClassName20 = get_class_name_factory_default("SidebarSection", styles_module_default14);
6647
7114
  var SidebarSection = ({
6648
7115
  children,
6649
7116
  title,
@@ -6655,29 +7122,29 @@ var SidebarSection = ({
6655
7122
  }) => {
6656
7123
  const setUi = useAppStore((s) => s.setUi);
6657
7124
  const breadcrumbs = useBreadcrumbs(1);
6658
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
7125
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6659
7126
  "div",
6660
7127
  {
6661
- className: getClassName19({ noBorderTop, noPadding }),
7128
+ className: getClassName20({ noBorderTop, noPadding }),
6662
7129
  style: { background },
6663
7130
  children: [
6664
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
6665
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
6666
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7131
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("title"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName20("breadcrumbs"), children: [
7132
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName20("breadcrumb"), children: [
7133
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6667
7134
  "button",
6668
7135
  {
6669
7136
  type: "button",
6670
- className: getClassName19("breadcrumbLabel"),
7137
+ className: getClassName20("breadcrumbLabel"),
6671
7138
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6672
7139
  children: breadcrumb.label
6673
7140
  }
6674
7141
  ),
6675
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
7142
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronRight, { size: 16 })
6676
7143
  ] }, i)) : null,
6677
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
7144
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
6678
7145
  ] }) }),
6679
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("content"), children }),
6680
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 32 }) })
7146
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("content"), children }),
7147
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Loader, { size: 32 }) })
6681
7148
  ]
6682
7149
  }
6683
7150
  );
@@ -6685,24 +7152,24 @@ var SidebarSection = ({
6685
7152
 
6686
7153
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
6687
7154
  init_react_import();
6688
- var styles_module_default14 = { "Puck": "_Puck_dnlfp_19", "Puck-portal": "_Puck-portal_dnlfp_31", "PuckLayout-inner": "_PuckLayout-inner_dnlfp_38", "PuckLayout--mounted": "_PuckLayout--mounted_dnlfp_50", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_dnlfp_54", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_dnlfp_60", "PuckLayout-mounted": "_PuckLayout-mounted_dnlfp_74", "PuckLayout": "_PuckLayout_dnlfp_38", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_dnlfp_115", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_dnlfp_124" };
7155
+ var styles_module_default15 = { "Puck": "_Puck_vnhjy_19", "Puck-portal": "_Puck-portal_vnhjy_31", "PuckLayout-inner": "_PuckLayout-inner_vnhjy_38", "PuckLayout--mounted": "_PuckLayout--mounted_vnhjy_50", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_vnhjy_54", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_vnhjy_60", "PuckLayout-mounted": "_PuckLayout-mounted_vnhjy_74", "PuckLayout": "_PuckLayout_vnhjy_38" };
6689
7156
 
6690
7157
  // components/Puck/components/Fields/index.tsx
6691
7158
  init_react_import();
6692
7159
 
6693
7160
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
6694
7161
  init_react_import();
6695
- 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" };
7162
+ 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" };
6696
7163
 
6697
7164
  // components/Puck/components/Fields/index.tsx
6698
- var import_react42 = require("react");
7165
+ var import_react41 = require("react");
6699
7166
  var import_shallow5 = require("zustand/react/shallow");
6700
- var import_jsx_runtime29 = require("react/jsx-runtime");
6701
- var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default15);
7167
+ var import_jsx_runtime31 = require("react/jsx-runtime");
7168
+ var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
6702
7169
  var DefaultFields = ({
6703
7170
  children
6704
7171
  }) => {
6705
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
7172
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
6706
7173
  };
6707
7174
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6708
7175
  let currentProps;
@@ -6768,13 +7235,13 @@ var FieldsChild = ({ fieldName }) => {
6768
7235
  })
6769
7236
  );
6770
7237
  const appStore = useAppStoreApi();
6771
- const onChange = (0, import_react42.useCallback)(createOnChange(fieldName, appStore), [
7238
+ const onChange = (0, import_react41.useCallback)(createOnChange(fieldName, appStore), [
6772
7239
  fieldName
6773
7240
  ]);
6774
7241
  const { visible = true } = field != null ? field : {};
6775
7242
  if (!field || !id || !visible) return null;
6776
7243
  if (field.type === "slot") return null;
6777
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName20("field"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7244
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6778
7245
  AutoFieldPrivate,
6779
7246
  {
6780
7247
  field,
@@ -6786,7 +7253,7 @@ var FieldsChild = ({ fieldName }) => {
6786
7253
  }
6787
7254
  ) }, id);
6788
7255
  };
6789
- var FieldsChildMemo = (0, import_react42.memo)(FieldsChild);
7256
+ var FieldsChildMemo = (0, import_react41.memo)(FieldsChild);
6790
7257
  var FieldsInternal = ({ wrapFields = true }) => {
6791
7258
  const overrides = useAppStore((s) => s.overrides);
6792
7259
  const componentResolving = useAppStore((s) => {
@@ -6811,22 +7278,22 @@ var FieldsInternal = ({ wrapFields = true }) => {
6811
7278
  })
6812
7279
  );
6813
7280
  const isLoading = fieldsLoading || componentResolving;
6814
- const Wrapper = (0, import_react42.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
6815
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
7281
+ const Wrapper = (0, import_react41.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
7282
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6816
7283
  "form",
6817
7284
  {
6818
- className: getClassName20({ wrapFields }),
7285
+ className: getClassName21({ wrapFields }),
6819
7286
  onSubmit: (e) => {
6820
7287
  e.preventDefault();
6821
7288
  },
6822
7289
  children: [
6823
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
6824
- 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 }) }) })
7290
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
7291
+ 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 }) }) })
6825
7292
  ]
6826
7293
  }
6827
7294
  );
6828
7295
  };
6829
- var Fields = (0, import_react42.memo)(FieldsInternal);
7296
+ var Fields = (0, import_react41.memo)(FieldsInternal);
6830
7297
 
6831
7298
  // components/Puck/components/Components/index.tsx
6832
7299
  init_react_import();
@@ -6840,22 +7307,31 @@ init_react_import();
6840
7307
 
6841
7308
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
6842
7309
  init_react_import();
6843
- 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" };
7310
+ 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" };
6844
7311
 
6845
7312
  // components/ComponentList/index.tsx
6846
- var import_jsx_runtime30 = require("react/jsx-runtime");
6847
- var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default16);
7313
+ var import_react42 = require("react");
7314
+ var import_jsx_runtime32 = require("react/jsx-runtime");
7315
+ var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
6848
7316
  var ComponentListItem = ({
6849
7317
  name,
6850
7318
  label
6851
7319
  }) => {
7320
+ var _a;
6852
7321
  const overrides = useAppStore((s) => s.overrides);
6853
7322
  const canInsert = useAppStore(
6854
7323
  (s) => s.permissions.getPermissions({
6855
7324
  type: name
6856
7325
  }).insert
6857
7326
  );
6858
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
7327
+ (0, import_react42.useEffect)(() => {
7328
+ if (overrides.componentItem) {
7329
+ console.warn(
7330
+ "The `componentItem` override has been deprecated and renamed to `drawerItem`"
7331
+ );
7332
+ }
7333
+ }, [overrides]);
7334
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6859
7335
  };
6860
7336
  var ComponentList = ({
6861
7337
  children,
@@ -6866,12 +7342,12 @@ var ComponentList = ({
6866
7342
  const setUi = useAppStore((s) => s.setUi);
6867
7343
  const componentList = useAppStore((s) => s.state.ui.componentList);
6868
7344
  const { expanded = true } = componentList[id] || {};
6869
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName21({ isExpanded: expanded }), children: [
6870
- title && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
7345
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
7346
+ title && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6871
7347
  "button",
6872
7348
  {
6873
7349
  type: "button",
6874
- className: getClassName21("title"),
7350
+ className: getClassName22("title"),
6875
7351
  onClick: () => setUi({
6876
7352
  componentList: __spreadProps(__spreadValues({}, componentList), {
6877
7353
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -6881,14 +7357,14 @@ var ComponentList = ({
6881
7357
  }),
6882
7358
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
6883
7359
  children: [
6884
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: title }),
6885
- /* @__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 }) })
7360
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: title }),
7361
+ /* @__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 }) })
6886
7362
  ]
6887
7363
  }
6888
7364
  ),
6889
- /* @__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) => {
7365
+ /* @__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) => {
6890
7366
  var _a;
6891
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7367
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6892
7368
  ComponentListItem,
6893
7369
  {
6894
7370
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -6902,7 +7378,7 @@ var ComponentList = ({
6902
7378
  ComponentList.Item = ComponentListItem;
6903
7379
 
6904
7380
  // lib/use-component-list.tsx
6905
- var import_jsx_runtime31 = require("react/jsx-runtime");
7381
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6906
7382
  var useComponentList = () => {
6907
7383
  const [componentList, setComponentList] = (0, import_react43.useState)();
6908
7384
  const config = useAppStore((s) => s.config);
@@ -6917,7 +7393,7 @@ var useComponentList = () => {
6917
7393
  if (category.visible === false || !category.components) {
6918
7394
  return null;
6919
7395
  }
6920
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7396
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6921
7397
  ComponentList,
6922
7398
  {
6923
7399
  id: categoryKey,
@@ -6926,7 +7402,7 @@ var useComponentList = () => {
6926
7402
  var _a2;
6927
7403
  matchedComponents.push(componentName);
6928
7404
  const componentConf = config.components[componentName] || {};
6929
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7405
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6930
7406
  ComponentList.Item,
6931
7407
  {
6932
7408
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -6946,7 +7422,7 @@ var useComponentList = () => {
6946
7422
  );
6947
7423
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
6948
7424
  _componentList.push(
6949
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7425
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6950
7426
  ComponentList,
6951
7427
  {
6952
7428
  id: "other",
@@ -6954,7 +7430,7 @@ var useComponentList = () => {
6954
7430
  children: remainingComponents.map((componentName, i) => {
6955
7431
  var _a2;
6956
7432
  const componentConf = config.components[componentName] || {};
6957
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7433
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6958
7434
  ComponentList.Item,
6959
7435
  {
6960
7436
  name: componentName,
@@ -6977,12 +7453,19 @@ var useComponentList = () => {
6977
7453
 
6978
7454
  // components/Puck/components/Components/index.tsx
6979
7455
  var import_react44 = require("react");
6980
- var import_jsx_runtime32 = require("react/jsx-runtime");
7456
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6981
7457
  var Components = () => {
6982
7458
  const overrides = useAppStore((s) => s.overrides);
6983
7459
  const componentList = useComponentList();
6984
- const Wrapper = (0, import_react44.useMemo)(() => overrides.components || "div", [overrides]);
6985
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ComponentList, { id: "all" }) });
7460
+ const Wrapper = (0, import_react44.useMemo)(() => {
7461
+ if (overrides.components) {
7462
+ console.warn(
7463
+ "The `components` override has been deprecated and renamed to `drawer`"
7464
+ );
7465
+ }
7466
+ return overrides.components || overrides.drawer || "div";
7467
+ }, [overrides]);
7468
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComponentList, { id: "all" }) });
6986
7469
  };
6987
7470
 
6988
7471
  // components/Puck/components/Preview/index.tsx
@@ -6994,7 +7477,7 @@ init_react_import();
6994
7477
  var import_react45 = require("react");
6995
7478
  var import_object_hash = __toESM(require("object-hash"));
6996
7479
  var import_react_dom3 = require("react-dom");
6997
- var import_jsx_runtime33 = require("react/jsx-runtime");
7480
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6998
7481
  var styleSelector = 'style, link[rel="stylesheet"]';
6999
7482
  var collectStyles = (doc) => {
7000
7483
  const collected = [];
@@ -7201,7 +7684,7 @@ var CopyHostStyles = ({
7201
7684
  observer.disconnect();
7202
7685
  };
7203
7686
  }, []);
7204
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
7687
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children });
7205
7688
  };
7206
7689
  var autoFrameContext = (0, import_react45.createContext)({});
7207
7690
  var useFrame = () => (0, import_react45.useContext)(autoFrameContext);
@@ -7248,7 +7731,7 @@ function AutoFrame(_a) {
7248
7731
  }
7249
7732
  }
7250
7733
  }, [frameRef, loaded, stylesLoaded]);
7251
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7734
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7252
7735
  "iframe",
7253
7736
  __spreadProps(__spreadValues({}, props), {
7254
7737
  className,
@@ -7258,7 +7741,7 @@ function AutoFrame(_a) {
7258
7741
  onLoad: () => {
7259
7742
  setLoaded(true);
7260
7743
  },
7261
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7744
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7262
7745
  CopyHostStyles,
7263
7746
  {
7264
7747
  debug,
@@ -7274,11 +7757,11 @@ var AutoFrame_default = AutoFrame;
7274
7757
 
7275
7758
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
7276
7759
  init_react_import();
7277
- var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7760
+ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7278
7761
 
7279
7762
  // components/Puck/components/Preview/index.tsx
7280
- var import_jsx_runtime34 = require("react/jsx-runtime");
7281
- var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default17);
7763
+ var import_jsx_runtime36 = require("react/jsx-runtime");
7764
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
7282
7765
  var useBubbleIframeEvents = (ref) => {
7283
7766
  const status = useAppStore((s) => s.status);
7284
7767
  (0, import_react46.useEffect)(() => {
@@ -7340,7 +7823,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7340
7823
  );
7341
7824
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
7342
7825
  id: "puck-root"
7343
- }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: propsWithSlots.children });
7826
+ }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: propsWithSlots.children });
7344
7827
  },
7345
7828
  [config]
7346
7829
  );
@@ -7348,7 +7831,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7348
7831
  const rootProps = root.props || root;
7349
7832
  const ref = (0, import_react46.useRef)(null);
7350
7833
  useBubbleIframeEvents(ref);
7351
- const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7834
+ const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7352
7835
  Page,
7353
7836
  __spreadProps(__spreadValues({}, rootProps), {
7354
7837
  puck: {
@@ -7358,28 +7841,31 @@ var Preview2 = ({ id = "puck-preview" }) => {
7358
7841
  metadata
7359
7842
  },
7360
7843
  editMode: true,
7361
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
7844
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZonePure, { zone: rootDroppableId })
7362
7845
  })
7363
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render, { data: renderData, config, metadata });
7846
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Render, { data: renderData, config, metadata });
7364
7847
  (0, import_react46.useEffect)(() => {
7365
7848
  if (!iframe.enabled) {
7366
7849
  setStatus("READY");
7367
7850
  }
7368
7851
  }, [iframe.enabled]);
7369
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7852
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7370
7853
  "div",
7371
7854
  {
7372
- className: getClassName22(),
7855
+ className: getClassName23(),
7373
7856
  id,
7374
7857
  "data-puck-preview": true,
7375
- onClick: () => {
7376
- dispatch({ type: "setUi", ui: { itemSelector: null } });
7858
+ onClick: (e) => {
7859
+ const el = e.target;
7860
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
7861
+ dispatch({ type: "setUi", ui: { itemSelector: null } });
7862
+ }
7377
7863
  },
7378
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7864
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7379
7865
  AutoFrame_default,
7380
7866
  {
7381
7867
  id: "preview-frame",
7382
- className: getClassName22("frame"),
7868
+ className: getClassName23("frame"),
7383
7869
  "data-rfd-iframe": true,
7384
7870
  onReady: () => {
7385
7871
  setStatus("READY");
@@ -7388,18 +7874,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
7388
7874
  setStatus("MOUNTED");
7389
7875
  },
7390
7876
  frameRef: ref,
7391
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7877
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7392
7878
  if (Frame) {
7393
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Frame, { document: document2, children: inner });
7879
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Frame, { document: document2, children: inner });
7394
7880
  }
7395
7881
  return inner;
7396
7882
  } })
7397
7883
  }
7398
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7884
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7399
7885
  "div",
7400
7886
  {
7401
7887
  id: "preview-frame",
7402
- className: getClassName22("frame"),
7888
+ className: getClassName23("frame"),
7403
7889
  ref,
7404
7890
  "data-puck-entry": true,
7405
7891
  children: inner
@@ -7417,7 +7903,7 @@ init_react_import();
7417
7903
 
7418
7904
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
7419
7905
  init_react_import();
7420
- 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" };
7906
+ 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" };
7421
7907
 
7422
7908
  // lib/scroll-into-view.ts
7423
7909
  init_react_import();
@@ -7454,9 +7940,9 @@ var onScrollEnd = (frame, cb) => {
7454
7940
 
7455
7941
  // components/LayerTree/index.tsx
7456
7942
  var import_shallow6 = require("zustand/react/shallow");
7457
- var import_jsx_runtime35 = require("react/jsx-runtime");
7458
- var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default18);
7459
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
7943
+ var import_jsx_runtime37 = require("react/jsx-runtime");
7944
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
7945
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
7460
7946
  var Layer = ({
7461
7947
  index,
7462
7948
  itemId,
@@ -7501,7 +7987,7 @@ var Layer = ({
7501
7987
  });
7502
7988
  const componentConfig = config.components[nodeData.data.type];
7503
7989
  const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
7504
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7990
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7505
7991
  "li",
7506
7992
  {
7507
7993
  className: getClassNameLayer({
@@ -7511,7 +7997,7 @@ var Layer = ({
7511
7997
  childIsSelected
7512
7998
  }),
7513
7999
  children: [
7514
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
8000
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7515
8001
  "button",
7516
8002
  {
7517
8003
  type: "button",
@@ -7549,223 +8035,102 @@ var Layer = ({
7549
8035
  zoneStore.setState({ hoveringComponent: null });
7550
8036
  },
7551
8037
  children: [
7552
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7553
- "div",
7554
- {
7555
- className: getClassNameLayer("chevron"),
7556
- title: isSelected ? "Collapse" : "Expand",
7557
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { size: "12" })
7558
- }
7559
- ),
7560
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassNameLayer("title"), children: [
7561
- /* @__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" }) }),
7562
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("name"), children: label })
7563
- ] })
7564
- ]
7565
- }
7566
- ) }),
7567
- 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))
7568
- ]
7569
- }
7570
- );
7571
- };
7572
- var LayerTree = ({
7573
- label: _label,
7574
- zoneCompound
7575
- }) => {
7576
- const label = useAppStore((s) => {
7577
- var _a, _b, _c, _d;
7578
- if (_label) return _label;
7579
- if (zoneCompound === rootDroppableId) return;
7580
- const [componentId, slotId] = zoneCompound.split(":");
7581
- const componentType = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.type;
7582
- const configForComponent = componentType && componentType !== rootAreaId ? s.config.components[componentType] : s.config.root;
7583
- return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
7584
- });
7585
- const contentIds = useAppStore(
7586
- (0, import_shallow6.useShallow)(
7587
- (s) => {
7588
- var _a, _b;
7589
- return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
7590
- }
7591
- )
7592
- );
7593
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
7594
- label && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName23("zoneTitle"), children: [
7595
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Layers, { size: "16" }) }),
7596
- label
7597
- ] }),
7598
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("ul", { className: getClassName23(), children: [
7599
- contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName23("helper"), children: "No items" }),
7600
- contentIds.map((itemId, i) => {
7601
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7602
- Layer,
7603
- {
7604
- index: i,
7605
- itemId,
7606
- zoneCompound
7607
- },
7608
- itemId
7609
- );
7610
- })
7611
- ] })
7612
- ] });
7613
- };
7614
-
7615
- // components/Puck/components/Outline/index.tsx
7616
- var import_react48 = require("react");
7617
-
7618
- // lib/data/find-zones-for-area.ts
7619
- init_react_import();
7620
- var findZonesForArea = (state, area) => {
7621
- return Object.keys(state.indexes.zones).filter(
7622
- (zone) => zone.split(":")[0] === area
7623
- );
7624
- };
7625
-
7626
- // components/Puck/components/Outline/index.tsx
7627
- var import_shallow7 = require("zustand/react/shallow");
7628
- var import_jsx_runtime36 = require("react/jsx-runtime");
7629
- var Outline = () => {
7630
- const outlineOverride = useAppStore((s) => s.overrides.outline);
7631
- const rootZones = useAppStore(
7632
- (0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
7633
- );
7634
- const Wrapper = (0, import_react48.useMemo)(() => outlineOverride || "div", [outlineOverride]);
7635
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7636
- LayerTree,
7637
- {
7638
- label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
7639
- zoneCompound
7640
- },
7641
- zoneCompound
7642
- )) });
7643
- };
7644
-
7645
- // components/Puck/components/Canvas/index.tsx
7646
- init_react_import();
7647
-
7648
- // ../../node_modules/css-box-model/dist/css-box-model.esm.js
7649
- init_react_import();
7650
-
7651
- // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
7652
- init_react_import();
7653
- var isProduction = process.env.NODE_ENV === "production";
7654
- var prefix = "Invariant failed";
7655
- function invariant(condition, message) {
7656
- if (condition) {
7657
- return;
7658
- }
7659
- if (isProduction) {
7660
- throw new Error(prefix);
7661
- }
7662
- var provided = typeof message === "function" ? message() : message;
7663
- var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
7664
- throw new Error(value);
7665
- }
7666
-
7667
- // ../../node_modules/css-box-model/dist/css-box-model.esm.js
7668
- var getRect = function getRect2(_ref) {
7669
- var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
7670
- var width = right - left;
7671
- var height = bottom - top;
7672
- var rect = {
7673
- top,
7674
- right,
7675
- bottom,
7676
- left,
7677
- width,
7678
- height,
7679
- x: left,
7680
- y: top,
7681
- center: {
7682
- x: (right + left) / 2,
7683
- y: (bottom + top) / 2
7684
- }
7685
- };
7686
- return rect;
7687
- };
7688
- var expand = function expand2(target, expandBy) {
7689
- return {
7690
- top: target.top - expandBy.top,
7691
- left: target.left - expandBy.left,
7692
- bottom: target.bottom + expandBy.bottom,
7693
- right: target.right + expandBy.right
7694
- };
7695
- };
7696
- var shrink = function shrink2(target, shrinkBy) {
7697
- return {
7698
- top: target.top + shrinkBy.top,
7699
- left: target.left + shrinkBy.left,
7700
- bottom: target.bottom - shrinkBy.bottom,
7701
- right: target.right - shrinkBy.right
7702
- };
7703
- };
7704
- var noSpacing = {
7705
- top: 0,
7706
- right: 0,
7707
- bottom: 0,
7708
- left: 0
7709
- };
7710
- var createBox = function createBox2(_ref2) {
7711
- var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
7712
- var marginBox = getRect(expand(borderBox, margin));
7713
- var paddingBox = getRect(shrink(borderBox, border));
7714
- var contentBox = getRect(shrink(paddingBox, padding));
7715
- return {
7716
- marginBox,
7717
- borderBox: getRect(borderBox),
7718
- paddingBox,
7719
- contentBox,
7720
- margin,
7721
- border,
7722
- padding
7723
- };
7724
- };
7725
- var parse = function parse2(raw) {
7726
- var value = raw.slice(0, -2);
7727
- var suffix = raw.slice(-2);
7728
- if (suffix !== "px") {
7729
- return 0;
7730
- }
7731
- var result = Number(value);
7732
- !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
7733
- return result;
7734
- };
7735
- var calculateBox = function calculateBox2(borderBox, styles2) {
7736
- var margin = {
7737
- top: parse(styles2.marginTop),
7738
- right: parse(styles2.marginRight),
7739
- bottom: parse(styles2.marginBottom),
7740
- left: parse(styles2.marginLeft)
7741
- };
7742
- var padding = {
7743
- top: parse(styles2.paddingTop),
7744
- right: parse(styles2.paddingRight),
7745
- bottom: parse(styles2.paddingBottom),
7746
- left: parse(styles2.paddingLeft)
7747
- };
7748
- var border = {
7749
- top: parse(styles2.borderTopWidth),
7750
- right: parse(styles2.borderRightWidth),
7751
- bottom: parse(styles2.borderBottomWidth),
7752
- left: parse(styles2.borderLeftWidth)
7753
- };
7754
- return createBox({
7755
- borderBox,
7756
- margin,
7757
- padding,
7758
- border
8038
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8039
+ "div",
8040
+ {
8041
+ className: getClassNameLayer("chevron"),
8042
+ title: isSelected ? "Collapse" : "Expand",
8043
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDown, { size: "12" })
8044
+ }
8045
+ ),
8046
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassNameLayer("title"), children: [
8047
+ /* @__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" }) }),
8048
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("name"), children: label })
8049
+ ] })
8050
+ ]
8051
+ }
8052
+ ) }),
8053
+ 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))
8054
+ ]
8055
+ }
8056
+ );
8057
+ };
8058
+ var LayerTree = ({
8059
+ label: _label,
8060
+ zoneCompound
8061
+ }) => {
8062
+ const label = useAppStore((s) => {
8063
+ var _a, _b, _c, _d;
8064
+ if (_label) return _label;
8065
+ if (zoneCompound === rootDroppableId) return;
8066
+ const [componentId, slotId] = zoneCompound.split(":");
8067
+ const componentType = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.type;
8068
+ const configForComponent = componentType && componentType !== rootAreaId ? s.config.components[componentType] : s.config.root;
8069
+ return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
7759
8070
  });
8071
+ const contentIds = useAppStore(
8072
+ (0, import_shallow6.useShallow)(
8073
+ (s) => {
8074
+ var _a, _b;
8075
+ return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
8076
+ }
8077
+ )
8078
+ );
8079
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
8080
+ label && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
8081
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Layers, { size: "16" }) }),
8082
+ label
8083
+ ] }),
8084
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("ul", { className: getClassName24(), children: [
8085
+ contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
8086
+ contentIds.map((itemId, i) => {
8087
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8088
+ Layer,
8089
+ {
8090
+ index: i,
8091
+ itemId,
8092
+ zoneCompound
8093
+ },
8094
+ itemId
8095
+ );
8096
+ })
8097
+ ] })
8098
+ ] });
7760
8099
  };
7761
- var getBox = function getBox2(el) {
7762
- var borderBox = el.getBoundingClientRect();
7763
- var styles2 = window.getComputedStyle(el);
7764
- return calculateBox(borderBox, styles2);
8100
+
8101
+ // components/Puck/components/Outline/index.tsx
8102
+ var import_react48 = require("react");
8103
+
8104
+ // lib/data/find-zones-for-area.ts
8105
+ init_react_import();
8106
+ var findZonesForArea = (state, area) => {
8107
+ return Object.keys(state.indexes.zones).filter(
8108
+ (zone) => zone.split(":")[0] === area
8109
+ );
8110
+ };
8111
+
8112
+ // components/Puck/components/Outline/index.tsx
8113
+ var import_shallow7 = require("zustand/react/shallow");
8114
+ var import_jsx_runtime38 = require("react/jsx-runtime");
8115
+ var Outline = () => {
8116
+ const outlineOverride = useAppStore((s) => s.overrides.outline);
8117
+ const rootZones = useAppStore(
8118
+ (0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
8119
+ );
8120
+ const Wrapper = (0, import_react48.useMemo)(() => outlineOverride || "div", [outlineOverride]);
8121
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8122
+ LayerTree,
8123
+ {
8124
+ label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
8125
+ zoneCompound
8126
+ },
8127
+ zoneCompound
8128
+ )) });
7765
8129
  };
7766
8130
 
7767
8131
  // components/Puck/components/Canvas/index.tsx
7768
- var import_react50 = require("react");
8132
+ init_react_import();
8133
+ var import_react51 = require("react");
7769
8134
 
7770
8135
  // components/ViewportControls/index.tsx
7771
8136
  init_react_import();
@@ -7773,17 +8138,17 @@ var import_react49 = require("react");
7773
8138
 
7774
8139
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7775
8140
  init_react_import();
7776
- 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" };
8141
+ 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" };
7777
8142
 
7778
8143
  // components/ViewportControls/index.tsx
7779
- var import_jsx_runtime37 = require("react/jsx-runtime");
8144
+ var import_jsx_runtime39 = require("react/jsx-runtime");
7780
8145
  var icons = {
7781
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Smartphone, { size: 16 }),
7782
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tablet, { size: 16 }),
7783
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Monitor, { size: 16 })
8146
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Smartphone, { size: 16 }),
8147
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Tablet, { size: 16 }),
8148
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Monitor, { size: 16 })
7784
8149
  };
7785
- var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
7786
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
8150
+ var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
8151
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
7787
8152
  var ViewportButton = ({
7788
8153
  children,
7789
8154
  height = "auto",
@@ -7796,7 +8161,7 @@ var ViewportButton = ({
7796
8161
  (0, import_react49.useEffect)(() => {
7797
8162
  setIsActive(width === viewports.current.width);
7798
8163
  }, [width, viewports.current.width]);
7799
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8164
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7800
8165
  IconButton,
7801
8166
  {
7802
8167
  type: "button",
@@ -7806,7 +8171,7 @@ var ViewportButton = ({
7806
8171
  e.stopPropagation();
7807
8172
  onClick({ width, height });
7808
8173
  },
7809
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton("inner"), children })
8174
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: getClassNameButton("inner"), children })
7810
8175
  }
7811
8176
  ) });
7812
8177
  };
@@ -7842,8 +8207,8 @@ var ViewportControls = ({
7842
8207
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7843
8208
  [autoZoom]
7844
8209
  );
7845
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24(), children: [
7846
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8210
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName25(), children: [
8211
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7847
8212
  ViewportButton,
7848
8213
  {
7849
8214
  height: viewport.height,
@@ -7854,8 +8219,8 @@ var ViewportControls = ({
7854
8219
  },
7855
8220
  i
7856
8221
  )),
7857
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
7858
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8222
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("divider") }),
8223
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7859
8224
  IconButton,
7860
8225
  {
7861
8226
  type: "button",
@@ -7870,10 +8235,10 @@ var ViewportControls = ({
7870
8235
  )].value
7871
8236
  );
7872
8237
  },
7873
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomOut, { size: 16 })
8238
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ZoomOut, { size: 16 })
7874
8239
  }
7875
8240
  ),
7876
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8241
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7877
8242
  IconButton,
7878
8243
  {
7879
8244
  type: "button",
@@ -7888,19 +8253,19 @@ var ViewportControls = ({
7888
8253
  )].value
7889
8254
  );
7890
8255
  },
7891
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomIn, { size: 16 })
8256
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ZoomIn, { size: 16 })
7892
8257
  }
7893
8258
  ),
7894
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
7895
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8259
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("divider") }),
8260
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7896
8261
  "select",
7897
8262
  {
7898
- className: getClassName24("zoomSelect"),
8263
+ className: getClassName25("zoomSelect"),
7899
8264
  value: zoom.toString(),
7900
8265
  onChange: (e) => {
7901
8266
  onZoom(parseFloat(e.currentTarget.value));
7902
8267
  },
7903
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8268
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7904
8269
  "option",
7905
8270
  {
7906
8271
  value: option.value,
@@ -7915,44 +8280,44 @@ var ViewportControls = ({
7915
8280
 
7916
8281
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
7917
8282
  init_react_import();
7918
- 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" };
8283
+ 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" };
7919
8284
 
7920
- // lib/get-zoom-config.ts
8285
+ // components/Puck/components/Canvas/index.tsx
8286
+ var import_shallow8 = require("zustand/react/shallow");
8287
+
8288
+ // lib/frame-context.tsx
7921
8289
  init_react_import();
7922
- var RESET_ZOOM_SMALLER_THAN_FRAME = true;
7923
- var getZoomConfig = (uiViewport, frame, zoom) => {
7924
- const box = getBox(frame);
7925
- const { width: frameWidth, height: frameHeight } = box.contentBox;
7926
- const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
7927
- let rootHeight = 0;
7928
- let autoZoom = 1;
7929
- if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
7930
- const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
7931
- const heightZoom = Math.min(frameHeight / viewportHeight, 1);
7932
- zoom = widthZoom;
7933
- if (widthZoom < heightZoom) {
7934
- rootHeight = viewportHeight / zoom;
7935
- } else {
7936
- rootHeight = viewportHeight;
7937
- zoom = heightZoom;
7938
- }
7939
- autoZoom = zoom;
7940
- } else {
7941
- if (RESET_ZOOM_SMALLER_THAN_FRAME) {
7942
- autoZoom = 1;
7943
- zoom = 1;
7944
- rootHeight = viewportHeight;
7945
- }
8290
+ var import_react50 = require("react");
8291
+ var import_jsx_runtime40 = require("react/jsx-runtime");
8292
+ var FrameContext = (0, import_react50.createContext)(null);
8293
+ var FrameProvider = ({
8294
+ children
8295
+ }) => {
8296
+ const frameRef = (0, import_react50.useRef)(null);
8297
+ const value = (0, import_react50.useMemo)(
8298
+ () => ({
8299
+ frameRef
8300
+ }),
8301
+ []
8302
+ );
8303
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FrameContext.Provider, { value, children });
8304
+ };
8305
+ var useCanvasFrame = () => {
8306
+ const context = (0, import_react50.useContext)(FrameContext);
8307
+ if (context === null) {
8308
+ throw new Error("useCanvasFrame must be used within a FrameProvider");
7946
8309
  }
7947
- return { autoZoom, rootHeight, zoom };
8310
+ return context;
7948
8311
  };
7949
8312
 
7950
8313
  // components/Puck/components/Canvas/index.tsx
7951
- var import_shallow8 = require("zustand/react/shallow");
7952
- var import_jsx_runtime38 = require("react/jsx-runtime");
7953
- var getClassName25 = get_class_name_factory_default("PuckCanvas", styles_module_default20);
8314
+ var import_jsx_runtime41 = require("react/jsx-runtime");
8315
+ var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
7954
8316
  var ZOOM_ON_CHANGE = true;
8317
+ var TRANSITION_DURATION = 150;
7955
8318
  var Canvas = () => {
8319
+ const { frameRef } = useCanvasFrame();
8320
+ const resetAutoZoom = useResetAutoZoom(frameRef);
7956
8321
  const {
7957
8322
  dispatch,
7958
8323
  overrides,
@@ -7972,24 +8337,32 @@ var Canvas = () => {
7972
8337
  iframe: s.iframe
7973
8338
  }))
7974
8339
  );
7975
- const { leftSideBarVisible, rightSideBarVisible, viewports } = useAppStore(
8340
+ const {
8341
+ leftSideBarVisible,
8342
+ rightSideBarVisible,
8343
+ leftSideBarWidth,
8344
+ rightSideBarWidth,
8345
+ viewports
8346
+ } = useAppStore(
7976
8347
  (0, import_shallow8.useShallow)((s) => ({
7977
8348
  leftSideBarVisible: s.state.ui.leftSideBarVisible,
7978
8349
  rightSideBarVisible: s.state.ui.rightSideBarVisible,
8350
+ leftSideBarWidth: s.state.ui.leftSideBarWidth,
8351
+ rightSideBarWidth: s.state.ui.rightSideBarWidth,
7979
8352
  viewports: s.state.ui.viewports
7980
8353
  }))
7981
8354
  );
7982
- const frameRef = (0, import_react50.useRef)(null);
7983
- const [showTransition, setShowTransition] = (0, import_react50.useState)(false);
7984
- const defaultRender = (0, import_react50.useMemo)(() => {
7985
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
8355
+ const [showTransition, setShowTransition] = (0, import_react51.useState)(false);
8356
+ const isResizingRef = (0, import_react51.useRef)(false);
8357
+ const defaultRender = (0, import_react51.useMemo)(() => {
8358
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
7986
8359
  return PuckDefault;
7987
8360
  }, []);
7988
- const CustomPreview = (0, import_react50.useMemo)(
8361
+ const CustomPreview = (0, import_react51.useMemo)(
7989
8362
  () => overrides.preview || defaultRender,
7990
8363
  [overrides]
7991
8364
  );
7992
- const getFrameDimensions = (0, import_react50.useCallback)(() => {
8365
+ const getFrameDimensions = (0, import_react51.useCallback)(() => {
7993
8366
  if (frameRef.current) {
7994
8367
  const frame = frameRef.current;
7995
8368
  const box = getBox(frame);
@@ -7997,74 +8370,73 @@ var Canvas = () => {
7997
8370
  }
7998
8371
  return { width: 0, height: 0 };
7999
8372
  }, [frameRef]);
8000
- const resetAutoZoom = (0, import_react50.useCallback)(
8001
- (newViewports = viewports) => {
8002
- if (frameRef.current) {
8003
- setZoomConfig(
8004
- getZoomConfig(
8005
- newViewports == null ? void 0 : newViewports.current,
8006
- frameRef.current,
8007
- zoomConfig.zoom
8008
- )
8009
- );
8010
- }
8011
- },
8012
- [frameRef, zoomConfig, viewports]
8013
- );
8014
- (0, import_react50.useEffect)(() => {
8015
- setShowTransition(false);
8016
- resetAutoZoom(viewports);
8017
- }, [frameRef, leftSideBarVisible, rightSideBarVisible]);
8018
- (0, import_react50.useEffect)(() => {
8373
+ (0, import_react51.useEffect)(() => {
8374
+ resetAutoZoom();
8375
+ }, [
8376
+ frameRef,
8377
+ leftSideBarVisible,
8378
+ rightSideBarVisible,
8379
+ leftSideBarWidth,
8380
+ rightSideBarWidth,
8381
+ viewports
8382
+ ]);
8383
+ (0, import_react51.useEffect)(() => {
8019
8384
  const { height: frameHeight } = getFrameDimensions();
8020
8385
  if (viewports.current.height === "auto") {
8021
8386
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
8022
8387
  rootHeight: frameHeight / zoomConfig.zoom
8023
8388
  }));
8024
8389
  }
8025
- }, [zoomConfig.zoom]);
8026
- (0, import_react50.useEffect)(() => {
8390
+ }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
8391
+ (0, import_react51.useEffect)(() => {
8027
8392
  if (ZOOM_ON_CHANGE) {
8028
- setShowTransition(true);
8029
- resetAutoZoom(viewports);
8030
- }
8031
- }, [viewports.current.width]);
8032
- (0, import_react50.useEffect)(() => {
8033
- const cb = () => {
8034
- setShowTransition(false);
8035
8393
  resetAutoZoom();
8036
- };
8037
- window.addEventListener("resize", cb);
8394
+ }
8395
+ }, [viewports.current.width, viewports]);
8396
+ (0, import_react51.useEffect)(() => {
8397
+ if (!frameRef.current) return;
8398
+ const resizeObserver = new ResizeObserver(() => {
8399
+ if (!isResizingRef.current) {
8400
+ resetAutoZoom();
8401
+ }
8402
+ });
8403
+ resizeObserver.observe(frameRef.current);
8038
8404
  return () => {
8039
- window.removeEventListener("resize", cb);
8405
+ resizeObserver.disconnect();
8040
8406
  };
8041
- }, []);
8042
- const [showLoader, setShowLoader] = (0, import_react50.useState)(false);
8043
- (0, import_react50.useEffect)(() => {
8407
+ }, [frameRef.current]);
8408
+ const [showLoader, setShowLoader] = (0, import_react51.useState)(false);
8409
+ (0, import_react51.useEffect)(() => {
8044
8410
  setTimeout(() => {
8045
8411
  setShowLoader(true);
8046
8412
  }, 500);
8047
8413
  }, []);
8048
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8414
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8049
8415
  "div",
8050
8416
  {
8051
- className: getClassName25({
8417
+ className: getClassName26({
8052
8418
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
8053
8419
  showLoader
8054
8420
  }),
8055
- onClick: () => dispatch({
8056
- type: "setUi",
8057
- ui: { itemSelector: null },
8058
- recordHistory: true
8059
- }),
8421
+ onClick: (e) => {
8422
+ const el = e.target;
8423
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
8424
+ dispatch({
8425
+ type: "setUi",
8426
+ ui: { itemSelector: null },
8427
+ recordHistory: true
8428
+ });
8429
+ }
8430
+ },
8060
8431
  children: [
8061
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8432
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8062
8433
  ViewportControls,
8063
8434
  {
8064
8435
  autoZoom: zoomConfig.autoZoom,
8065
8436
  zoom: zoomConfig.zoom,
8066
8437
  onViewportChange: (viewport) => {
8067
8438
  setShowTransition(true);
8439
+ isResizingRef.current = true;
8068
8440
  const uiViewport = __spreadProps(__spreadValues({}, viewport), {
8069
8441
  height: viewport.height || "auto",
8070
8442
  zoom: zoomConfig.zoom
@@ -8075,41 +8447,40 @@ var Canvas = () => {
8075
8447
  };
8076
8448
  setUi(newUi);
8077
8449
  if (ZOOM_ON_CHANGE) {
8078
- resetAutoZoom(__spreadProps(__spreadValues({}, viewports), { current: uiViewport }));
8450
+ resetAutoZoom({
8451
+ viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
8452
+ });
8079
8453
  }
8080
8454
  },
8081
8455
  onZoom: (zoom) => {
8082
8456
  setShowTransition(true);
8457
+ isResizingRef.current = true;
8083
8458
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
8084
8459
  }
8085
8460
  }
8086
8461
  ) }),
8087
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25("inner"), ref: frameRef, children: [
8088
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8462
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
8463
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8089
8464
  "div",
8090
8465
  {
8091
- className: getClassName25("root"),
8466
+ className: getClassName26("root"),
8092
8467
  style: {
8093
8468
  width: iframe.enabled ? viewports.current.width : "100%",
8094
8469
  height: zoomConfig.rootHeight,
8095
8470
  transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
8096
- transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
8471
+ transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, height ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : "",
8097
8472
  overflow: iframe.enabled ? void 0 : "auto"
8098
8473
  },
8099
8474
  suppressHydrationWarning: true,
8100
8475
  id: "puck-canvas-root",
8101
8476
  onTransitionEnd: () => {
8102
- window.dispatchEvent(
8103
- new CustomEvent("viewportchange", {
8104
- bubbles: true,
8105
- cancelable: false
8106
- })
8107
- );
8477
+ setShowTransition(false);
8478
+ isResizingRef.current = false;
8108
8479
  },
8109
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Preview2, {}) })
8480
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Preview2, {}) })
8110
8481
  }
8111
8482
  ),
8112
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Loader, { size: 24 }) })
8483
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Loader, { size: 24 }) })
8113
8484
  ] })
8114
8485
  ]
8115
8486
  }
@@ -8118,7 +8489,7 @@ var Canvas = () => {
8118
8489
 
8119
8490
  // lib/use-loaded-overrides.ts
8120
8491
  init_react_import();
8121
- var import_react51 = require("react");
8492
+ var import_react52 = require("react");
8122
8493
 
8123
8494
  // lib/load-overrides.ts
8124
8495
  init_react_import();
@@ -8128,8 +8499,11 @@ var loadOverrides = ({
8128
8499
  }) => {
8129
8500
  const collected = __spreadValues({}, overrides);
8130
8501
  plugins == null ? void 0 : plugins.forEach((plugin) => {
8502
+ if (!plugin.overrides) return;
8131
8503
  Object.keys(plugin.overrides).forEach((_overridesType) => {
8504
+ var _a;
8132
8505
  const overridesType = _overridesType;
8506
+ if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
8133
8507
  if (overridesType === "fieldTypes") {
8134
8508
  const fieldTypes = plugin.overrides.fieldTypes;
8135
8509
  Object.keys(fieldTypes).forEach((fieldType) => {
@@ -8157,26 +8531,26 @@ var useLoadedOverrides = ({
8157
8531
  overrides,
8158
8532
  plugins
8159
8533
  }) => {
8160
- return (0, import_react51.useMemo)(() => {
8534
+ return (0, import_react52.useMemo)(() => {
8161
8535
  return loadOverrides({ overrides, plugins });
8162
8536
  }, [plugins, overrides]);
8163
8537
  };
8164
8538
 
8165
8539
  // components/DefaultOverride/index.tsx
8166
8540
  init_react_import();
8167
- var import_jsx_runtime39 = require("react/jsx-runtime");
8168
- var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children });
8541
+ var import_jsx_runtime42 = require("react/jsx-runtime");
8542
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children });
8169
8543
 
8170
8544
  // lib/use-inject-css.ts
8171
8545
  init_react_import();
8172
- var import_react52 = require("react");
8546
+ var import_react53 = require("react");
8173
8547
  var styles = ``;
8174
8548
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
8175
- const [el, setEl] = (0, import_react52.useState)();
8176
- (0, import_react52.useEffect)(() => {
8549
+ const [el, setEl] = (0, import_react53.useState)();
8550
+ (0, import_react53.useEffect)(() => {
8177
8551
  setEl(document.createElement("style"));
8178
8552
  }, []);
8179
- (0, import_react52.useEffect)(() => {
8553
+ (0, import_react53.useEffect)(() => {
8180
8554
  var _a;
8181
8555
  if (!el || typeof window === "undefined") {
8182
8556
  return;
@@ -8196,10 +8570,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
8196
8570
 
8197
8571
  // lib/use-preview-mode-hotkeys.ts
8198
8572
  init_react_import();
8199
- var import_react53 = require("react");
8573
+ var import_react54 = require("react");
8200
8574
  var usePreviewModeHotkeys = () => {
8201
8575
  const appStore = useAppStoreApi();
8202
- const toggleInteractive = (0, import_react53.useCallback)(() => {
8576
+ const toggleInteractive = (0, import_react54.useCallback)(() => {
8203
8577
  const dispatch = appStore.getState().dispatch;
8204
8578
  dispatch({
8205
8579
  type: "setUi",
@@ -8214,7 +8588,7 @@ var usePreviewModeHotkeys = () => {
8214
8588
 
8215
8589
  // lib/use-puck.ts
8216
8590
  init_react_import();
8217
- var import_react54 = require("react");
8591
+ var import_react55 = require("react");
8218
8592
  var import_zustand6 = require("zustand");
8219
8593
  var generateUsePuck = (store) => {
8220
8594
  const history = {
@@ -8247,7 +8621,7 @@ var generateUsePuck = (store) => {
8247
8621
  };
8248
8622
  return storeData;
8249
8623
  };
8250
- var UsePuckStoreContext = (0, import_react54.createContext)(
8624
+ var UsePuckStoreContext = (0, import_react55.createContext)(
8251
8625
  null
8252
8626
  );
8253
8627
  var convertToPickedStore = (store) => {
@@ -8261,12 +8635,12 @@ var convertToPickedStore = (store) => {
8261
8635
  };
8262
8636
  };
8263
8637
  var useRegisterUsePuckStore = (appStore) => {
8264
- const [usePuckStore] = (0, import_react54.useState)(
8638
+ const [usePuckStore] = (0, import_react55.useState)(
8265
8639
  () => (0, import_zustand6.createStore)(
8266
8640
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
8267
8641
  )
8268
8642
  );
8269
- (0, import_react54.useEffect)(() => {
8643
+ (0, import_react55.useEffect)(() => {
8270
8644
  return appStore.subscribe(
8271
8645
  (store) => convertToPickedStore(store),
8272
8646
  (pickedStore) => {
@@ -8278,7 +8652,7 @@ var useRegisterUsePuckStore = (appStore) => {
8278
8652
  };
8279
8653
  function createUsePuck() {
8280
8654
  return function usePuck2(selector) {
8281
- const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
8655
+ const usePuckApi = (0, import_react55.useContext)(UsePuckStoreContext);
8282
8656
  if (!usePuckApi) {
8283
8657
  throw new Error("usePuck must be used inside <Puck>.");
8284
8658
  }
@@ -8290,7 +8664,7 @@ function createUsePuck() {
8290
8664
  };
8291
8665
  }
8292
8666
  function usePuck() {
8293
- (0, import_react54.useEffect)(() => {
8667
+ (0, import_react55.useEffect)(() => {
8294
8668
  console.warn(
8295
8669
  "You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
8296
8670
  );
@@ -8298,7 +8672,7 @@ function usePuck() {
8298
8672
  return createUsePuck()((s) => s);
8299
8673
  }
8300
8674
  function useGetPuck() {
8301
- const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
8675
+ const usePuckApi = (0, import_react55.useContext)(UsePuckStoreContext);
8302
8676
  if (!usePuckApi) {
8303
8677
  throw new Error("usePuckGet must be used inside <Puck>.");
8304
8678
  }
@@ -8310,18 +8684,18 @@ var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
8310
8684
 
8311
8685
  // components/Puck/components/Header/index.tsx
8312
8686
  init_react_import();
8313
- var import_react55 = require("react");
8687
+ var import_react56 = require("react");
8314
8688
 
8315
8689
  // components/MenuBar/index.tsx
8316
8690
  init_react_import();
8317
8691
 
8318
8692
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
8319
8693
  init_react_import();
8320
- 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" };
8694
+ 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" };
8321
8695
 
8322
8696
  // components/MenuBar/index.tsx
8323
- var import_jsx_runtime40 = require("react/jsx-runtime");
8324
- var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
8697
+ var import_jsx_runtime43 = require("react/jsx-runtime");
8698
+ var getClassName27 = get_class_name_factory_default("MenuBar", styles_module_default22);
8325
8699
  function MenuBar({
8326
8700
  menuOpen = false,
8327
8701
  renderHeaderActions,
@@ -8331,10 +8705,10 @@ function MenuBar({
8331
8705
  const forward = useAppStore((s) => s.history.forward);
8332
8706
  const hasFuture = useAppStore((s) => s.history.hasFuture());
8333
8707
  const hasPast = useAppStore((s) => s.history.hasPast());
8334
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8708
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8335
8709
  "div",
8336
8710
  {
8337
- className: getClassName26({ menuOpen }),
8711
+ className: getClassName27({ menuOpen }),
8338
8712
  onClick: (event) => {
8339
8713
  var _a;
8340
8714
  const element = event.target;
@@ -8345,30 +8719,30 @@ function MenuBar({
8345
8719
  setMenuOpen(false);
8346
8720
  }
8347
8721
  },
8348
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("inner"), children: [
8349
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getClassName26("history"), children: [
8350
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8722
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName27("inner"), children: [
8723
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName27("history"), children: [
8724
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8351
8725
  IconButton,
8352
8726
  {
8353
8727
  type: "button",
8354
8728
  title: "undo",
8355
8729
  disabled: !hasPast,
8356
8730
  onClick: back,
8357
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Undo2, { size: 21 })
8731
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Undo2, { size: 21 })
8358
8732
  }
8359
8733
  ),
8360
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8734
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8361
8735
  IconButton,
8362
8736
  {
8363
8737
  type: "button",
8364
8738
  title: "redo",
8365
8739
  disabled: !hasFuture,
8366
8740
  onClick: forward,
8367
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Redo2, { size: 21 })
8741
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Redo2, { size: 21 })
8368
8742
  }
8369
8743
  )
8370
8744
  ] }),
8371
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children: renderHeaderActions && renderHeaderActions() })
8745
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children: renderHeaderActions && renderHeaderActions() })
8372
8746
  ] })
8373
8747
  }
8374
8748
  );
@@ -8376,11 +8750,11 @@ function MenuBar({
8376
8750
 
8377
8751
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
8378
8752
  init_react_import();
8379
- 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" };
8753
+ 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" };
8380
8754
 
8381
8755
  // components/Puck/components/Header/index.tsx
8382
- var import_jsx_runtime41 = require("react/jsx-runtime");
8383
- var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
8756
+ var import_jsx_runtime44 = require("react/jsx-runtime");
8757
+ var getClassName28 = get_class_name_factory_default("PuckHeader", styles_module_default23);
8384
8758
  var HeaderInner = () => {
8385
8759
  const {
8386
8760
  onPublish,
@@ -8392,7 +8766,7 @@ var HeaderInner = () => {
8392
8766
  } = usePropsContext();
8393
8767
  const dispatch = useAppStore((s) => s.dispatch);
8394
8768
  const appStore = useAppStoreApi();
8395
- const defaultHeaderRender = (0, import_react55.useMemo)(() => {
8769
+ const defaultHeaderRender = (0, import_react56.useMemo)(() => {
8396
8770
  if (renderHeader) {
8397
8771
  console.warn(
8398
8772
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -8401,13 +8775,13 @@ var HeaderInner = () => {
8401
8775
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
8402
8776
  const Comp = renderHeader;
8403
8777
  const appState = useAppStore((s) => s.state);
8404
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8778
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8405
8779
  };
8406
8780
  return RenderHeader;
8407
8781
  }
8408
8782
  return DefaultOverride;
8409
8783
  }, [renderHeader]);
8410
- const defaultHeaderActionsRender = (0, import_react55.useMemo)(() => {
8784
+ const defaultHeaderActionsRender = (0, import_react56.useMemo)(() => {
8411
8785
  if (renderHeaderActions) {
8412
8786
  console.warn(
8413
8787
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
@@ -8415,19 +8789,19 @@ var HeaderInner = () => {
8415
8789
  const RenderHeader = (props) => {
8416
8790
  const Comp = renderHeaderActions;
8417
8791
  const appState = useAppStore((s) => s.state);
8418
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8792
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8419
8793
  };
8420
8794
  return RenderHeader;
8421
8795
  }
8422
8796
  return DefaultOverride;
8423
- }, [renderHeader]);
8797
+ }, [renderHeaderActions]);
8424
8798
  const CustomHeader = useAppStore(
8425
8799
  (s) => s.overrides.header || defaultHeaderRender
8426
8800
  );
8427
8801
  const CustomHeaderActions = useAppStore(
8428
8802
  (s) => s.overrides.headerActions || defaultHeaderActionsRender
8429
8803
  );
8430
- const [menuOpen, setMenuOpen] = (0, import_react55.useState)(false);
8804
+ const [menuOpen, setMenuOpen] = (0, import_react56.useState)(false);
8431
8805
  const rootTitle = useAppStore((s) => {
8432
8806
  var _a, _b;
8433
8807
  const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
@@ -8437,7 +8811,7 @@ var HeaderInner = () => {
8437
8811
  const rightSideBarVisible = useAppStore(
8438
8812
  (s) => s.state.ui.rightSideBarVisible
8439
8813
  );
8440
- const toggleSidebars = (0, import_react55.useCallback)(
8814
+ const toggleSidebars = (0, import_react56.useCallback)(
8441
8815
  (sidebar) => {
8442
8816
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
8443
8817
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -8451,27 +8825,27 @@ var HeaderInner = () => {
8451
8825
  },
8452
8826
  [dispatch, leftSideBarVisible, rightSideBarVisible]
8453
8827
  );
8454
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8828
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8455
8829
  CustomHeader,
8456
8830
  {
8457
- actions: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8831
+ 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)(
8458
8832
  Button,
8459
8833
  {
8460
8834
  onClick: () => {
8461
8835
  const data = appStore.getState().state.data;
8462
8836
  onPublish && onPublish(data);
8463
8837
  },
8464
- icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
8838
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Globe, { size: "14px" }),
8465
8839
  children: "Publish"
8466
8840
  }
8467
8841
  ) }) }),
8468
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8842
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8469
8843
  "header",
8470
8844
  {
8471
- className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
8472
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("inner"), children: [
8473
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("toggle"), children: [
8474
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8845
+ className: getClassName28({ leftSideBarVisible, rightSideBarVisible }),
8846
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("inner"), children: [
8847
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("toggle"), children: [
8848
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8475
8849
  IconButton,
8476
8850
  {
8477
8851
  type: "button",
@@ -8479,10 +8853,10 @@ var HeaderInner = () => {
8479
8853
  toggleSidebars("left");
8480
8854
  },
8481
8855
  title: "Toggle left sidebar",
8482
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
8856
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PanelLeft, { focusable: "false" })
8483
8857
  }
8484
8858
  ) }),
8485
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8859
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8486
8860
  IconButton,
8487
8861
  {
8488
8862
  type: "button",
@@ -8490,19 +8864,19 @@ var HeaderInner = () => {
8490
8864
  toggleSidebars("right");
8491
8865
  },
8492
8866
  title: "Toggle right sidebar",
8493
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
8867
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PanelRight, { focusable: "false" })
8494
8868
  }
8495
8869
  ) })
8496
8870
  ] }),
8497
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("title"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
8871
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("title"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Heading, { rank: "2", size: "xs", children: [
8498
8872
  headerTitle || rootTitle || "Page",
8499
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
8873
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
8500
8874
  " ",
8501
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: getClassName27("path"), children: headerPath })
8875
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("code", { className: getClassName28("path"), children: headerPath })
8502
8876
  ] })
8503
8877
  ] }) }),
8504
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName27("tools"), children: [
8505
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8878
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("tools"), children: [
8879
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8506
8880
  IconButton,
8507
8881
  {
8508
8882
  type: "button",
@@ -8510,23 +8884,23 @@ var HeaderInner = () => {
8510
8884
  return setMenuOpen(!menuOpen);
8511
8885
  },
8512
8886
  title: "Toggle menu bar",
8513
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronDown, { focusable: "false" })
8887
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { focusable: "false" })
8514
8888
  }
8515
8889
  ) }),
8516
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8890
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8517
8891
  MenuBar,
8518
8892
  {
8519
8893
  dispatch,
8520
8894
  onPublish,
8521
8895
  menuOpen,
8522
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8896
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8523
8897
  Button,
8524
8898
  {
8525
8899
  onClick: () => {
8526
8900
  const data = appStore.getState().state.data;
8527
8901
  onPublish && onPublish(data);
8528
8902
  },
8529
- icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
8903
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Globe, { size: "14px" }),
8530
8904
  children: "Publish"
8531
8905
  }
8532
8906
  ) }),
@@ -8540,12 +8914,205 @@ var HeaderInner = () => {
8540
8914
  }
8541
8915
  );
8542
8916
  };
8543
- var Header = (0, import_react55.memo)(HeaderInner);
8917
+ var Header = (0, import_react56.memo)(HeaderInner);
8918
+
8919
+ // components/Puck/components/Sidebar/index.tsx
8920
+ init_react_import();
8921
+
8922
+ // components/Puck/components/ResizeHandle/index.tsx
8923
+ init_react_import();
8924
+ var import_react57 = require("react");
8925
+
8926
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
8927
+ init_react_import();
8928
+ var styles_module_default24 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
8929
+
8930
+ // components/Puck/components/ResizeHandle/index.tsx
8931
+ var import_jsx_runtime45 = require("react/jsx-runtime");
8932
+ var getClassName29 = get_class_name_factory_default("ResizeHandle", styles_module_default24);
8933
+ var ResizeHandle = ({
8934
+ position,
8935
+ sidebarRef,
8936
+ onResize,
8937
+ onResizeEnd
8938
+ }) => {
8939
+ const { frameRef } = useCanvasFrame();
8940
+ const resetAutoZoom = useResetAutoZoom(frameRef);
8941
+ const handleRef = (0, import_react57.useRef)(null);
8942
+ const isDragging = (0, import_react57.useRef)(false);
8943
+ const startX = (0, import_react57.useRef)(0);
8944
+ const startWidth = (0, import_react57.useRef)(0);
8945
+ const handleMouseMove = (0, import_react57.useCallback)(
8946
+ (e) => {
8947
+ if (!isDragging.current) return;
8948
+ const delta = e.clientX - startX.current;
8949
+ const newWidth = position === "left" ? startWidth.current + delta : startWidth.current - delta;
8950
+ const width = Math.max(192, newWidth);
8951
+ onResize(width);
8952
+ e.preventDefault();
8953
+ },
8954
+ [onResize, position]
8955
+ );
8956
+ const handleMouseUp = (0, import_react57.useCallback)(() => {
8957
+ var _a;
8958
+ if (!isDragging.current) return;
8959
+ isDragging.current = false;
8960
+ document.body.style.cursor = "";
8961
+ document.body.style.userSelect = "";
8962
+ const overlay = document.getElementById("resize-overlay");
8963
+ if (overlay) {
8964
+ document.body.removeChild(overlay);
8965
+ }
8966
+ document.removeEventListener("mousemove", handleMouseMove);
8967
+ document.removeEventListener("mouseup", handleMouseUp);
8968
+ const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8969
+ onResizeEnd(finalWidth);
8970
+ resetAutoZoom();
8971
+ }, [onResizeEnd]);
8972
+ const handleMouseDown = (0, import_react57.useCallback)(
8973
+ (e) => {
8974
+ var _a;
8975
+ isDragging.current = true;
8976
+ startX.current = e.clientX;
8977
+ startWidth.current = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8978
+ document.body.style.cursor = "col-resize";
8979
+ document.body.style.userSelect = "none";
8980
+ const overlay = document.createElement("div");
8981
+ overlay.id = "resize-overlay";
8982
+ overlay.setAttribute("data-resize-overlay", "");
8983
+ document.body.appendChild(overlay);
8984
+ document.addEventListener("mousemove", handleMouseMove);
8985
+ document.addEventListener("mouseup", handleMouseUp);
8986
+ e.preventDefault();
8987
+ },
8988
+ [position, handleMouseMove, handleMouseUp]
8989
+ );
8990
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8991
+ "div",
8992
+ {
8993
+ ref: handleRef,
8994
+ className: getClassName29({ [position]: true }),
8995
+ onMouseDown: handleMouseDown
8996
+ }
8997
+ );
8998
+ };
8999
+
9000
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
9001
+ init_react_import();
9002
+ 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" };
9003
+
9004
+ // components/Puck/components/Sidebar/index.tsx
9005
+ var import_jsx_runtime46 = require("react/jsx-runtime");
9006
+ var getClassName30 = get_class_name_factory_default("Sidebar", styles_module_default25);
9007
+ var Sidebar = ({
9008
+ position,
9009
+ sidebarRef,
9010
+ isVisible,
9011
+ width,
9012
+ onResize,
9013
+ onResizeEnd,
9014
+ children
9015
+ }) => {
9016
+ if (!isVisible) return null;
9017
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
9018
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { ref: sidebarRef, className: getClassName30({ [position]: true }), children }),
9019
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `${getClassName30("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9020
+ ResizeHandle,
9021
+ {
9022
+ position,
9023
+ sidebarRef,
9024
+ onResize,
9025
+ onResizeEnd
9026
+ }
9027
+ ) })
9028
+ ] });
9029
+ };
9030
+
9031
+ // lib/use-sidebar-resize.ts
9032
+ init_react_import();
9033
+ var import_react58 = require("react");
9034
+ function useSidebarResize(position, dispatch) {
9035
+ const [width, setWidth] = (0, import_react58.useState)(null);
9036
+ const sidebarRef = (0, import_react58.useRef)(null);
9037
+ const storeWidth = useAppStore(
9038
+ (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
9039
+ );
9040
+ (0, import_react58.useEffect)(() => {
9041
+ if (typeof window !== "undefined" && !storeWidth) {
9042
+ try {
9043
+ const savedWidths = localStorage.getItem("puck-sidebar-widths");
9044
+ if (savedWidths) {
9045
+ const widths = JSON.parse(savedWidths);
9046
+ const savedWidth = widths[position];
9047
+ const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
9048
+ if (savedWidth) {
9049
+ dispatch({
9050
+ type: "setUi",
9051
+ ui: {
9052
+ [key]: savedWidth
9053
+ }
9054
+ });
9055
+ }
9056
+ }
9057
+ } catch (error) {
9058
+ console.error(
9059
+ `Failed to load ${position} sidebar width from localStorage`,
9060
+ error
9061
+ );
9062
+ }
9063
+ }
9064
+ }, [dispatch, position, storeWidth]);
9065
+ (0, import_react58.useEffect)(() => {
9066
+ if (storeWidth !== void 0) {
9067
+ setWidth(storeWidth);
9068
+ }
9069
+ }, [storeWidth]);
9070
+ const handleResizeEnd = (0, import_react58.useCallback)(
9071
+ (width2) => {
9072
+ dispatch({
9073
+ type: "setUi",
9074
+ ui: {
9075
+ [position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: width2
9076
+ }
9077
+ });
9078
+ let widths = {};
9079
+ try {
9080
+ const savedWidths = localStorage.getItem("puck-sidebar-widths");
9081
+ widths = savedWidths ? JSON.parse(savedWidths) : {};
9082
+ } catch (error) {
9083
+ console.error(
9084
+ `Failed to save ${position} sidebar width to localStorage`,
9085
+ error
9086
+ );
9087
+ } finally {
9088
+ localStorage.setItem(
9089
+ "puck-sidebar-widths",
9090
+ JSON.stringify(__spreadProps(__spreadValues({}, widths), {
9091
+ [position]: width2
9092
+ }))
9093
+ );
9094
+ }
9095
+ window.dispatchEvent(
9096
+ new CustomEvent("viewportchange", {
9097
+ bubbles: true,
9098
+ cancelable: false
9099
+ })
9100
+ );
9101
+ },
9102
+ [dispatch, position]
9103
+ );
9104
+ return {
9105
+ width,
9106
+ setWidth,
9107
+ sidebarRef,
9108
+ handleResizeEnd
9109
+ };
9110
+ }
8544
9111
 
8545
9112
  // components/Puck/index.tsx
8546
- var import_jsx_runtime42 = require("react/jsx-runtime");
8547
- var getClassName28 = get_class_name_factory_default("Puck", styles_module_default14);
8548
- var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default14);
9113
+ var import_jsx_runtime47 = require("react/jsx-runtime");
9114
+ var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
9115
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
8549
9116
  var FieldSideBar = () => {
8550
9117
  const title = useAppStore(
8551
9118
  (s) => {
@@ -8553,13 +9120,13 @@ var FieldSideBar = () => {
8553
9120
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
8554
9121
  }
8555
9122
  );
8556
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Fields, {}) });
9123
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Fields, {}) });
8557
9124
  };
8558
- var propsContext = (0, import_react56.createContext)({});
9125
+ var propsContext = (0, import_react59.createContext)({});
8559
9126
  function PropsProvider(props) {
8560
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(propsContext.Provider, { value: props, children: props.children });
9127
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(propsContext.Provider, { value: props, children: props.children });
8561
9128
  }
8562
- var usePropsContext = () => (0, import_react56.useContext)(propsContext);
9129
+ var usePropsContext = () => (0, import_react59.useContext)(propsContext);
8563
9130
  function PuckProvider({ children }) {
8564
9131
  const {
8565
9132
  config,
@@ -8573,16 +9140,17 @@ function PuckProvider({ children }) {
8573
9140
  iframe: _iframe,
8574
9141
  initialHistory: _initialHistory,
8575
9142
  metadata,
8576
- onAction
9143
+ onAction,
9144
+ fieldTransforms
8577
9145
  } = usePropsContext();
8578
- const iframe = (0, import_react56.useMemo)(
9146
+ const iframe = (0, import_react59.useMemo)(
8579
9147
  () => __spreadValues({
8580
9148
  enabled: true,
8581
9149
  waitForStyles: true
8582
9150
  }, _iframe),
8583
9151
  [_iframe]
8584
9152
  );
8585
- const [generatedAppState] = (0, import_react56.useState)(() => {
9153
+ const [generatedAppState] = (0, import_react59.useState)(() => {
8586
9154
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8587
9155
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
8588
9156
  let clientUiState = {};
@@ -8611,7 +9179,7 @@ function PuckProvider({ children }) {
8611
9179
  }
8612
9180
  }
8613
9181
  if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_g = initialData == null ? void 0 : initialData.root) == null ? void 0 : _g.props)) {
8614
- console.error(
9182
+ console.warn(
8615
9183
  "Warning: Defining props on `root` is deprecated. Please use `root.props`, or republish this page to migrate automatically."
8616
9184
  );
8617
9185
  }
@@ -8642,7 +9210,7 @@ function PuckProvider({ children }) {
8642
9210
  return walkAppState(newAppState, config);
8643
9211
  });
8644
9212
  const { appendData = true } = _initialHistory || {};
8645
- const [blendedHistories] = (0, import_react56.useState)(
9213
+ const [blendedHistories] = (0, import_react59.useState)(
8646
9214
  [
8647
9215
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
8648
9216
  ...appendData ? [{ state: generatedAppState }] : []
@@ -8662,7 +9230,15 @@ function PuckProvider({ children }) {
8662
9230
  overrides,
8663
9231
  plugins
8664
9232
  });
8665
- const generateAppStore = (0, import_react56.useCallback)(
9233
+ const loadedFieldTransforms = (0, import_react59.useMemo)(() => {
9234
+ const _plugins = plugins || [];
9235
+ const pluginFieldTransforms = _plugins.reduce(
9236
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
9237
+ {}
9238
+ );
9239
+ return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
9240
+ }, [fieldTransforms, plugins]);
9241
+ const generateAppStore = (0, import_react59.useCallback)(
8666
9242
  (state) => {
8667
9243
  return {
8668
9244
  state,
@@ -8672,7 +9248,8 @@ function PuckProvider({ children }) {
8672
9248
  viewports,
8673
9249
  iframe,
8674
9250
  onAction,
8675
- metadata
9251
+ metadata,
9252
+ fieldTransforms: loadedFieldTransforms
8676
9253
  };
8677
9254
  },
8678
9255
  [
@@ -8683,18 +9260,19 @@ function PuckProvider({ children }) {
8683
9260
  viewports,
8684
9261
  iframe,
8685
9262
  onAction,
8686
- metadata
9263
+ metadata,
9264
+ loadedFieldTransforms
8687
9265
  ]
8688
9266
  );
8689
- const [appStore] = (0, import_react56.useState)(
9267
+ const [appStore] = (0, import_react59.useState)(
8690
9268
  () => createAppStore(generateAppStore(initialAppState))
8691
9269
  );
8692
- (0, import_react56.useEffect)(() => {
9270
+ (0, import_react59.useEffect)(() => {
8693
9271
  if (process.env.NODE_ENV !== "production") {
8694
9272
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
8695
9273
  }
8696
9274
  }, [appStore]);
8697
- (0, import_react56.useEffect)(() => {
9275
+ (0, import_react59.useEffect)(() => {
8698
9276
  const state = appStore.getState().state;
8699
9277
  appStore.setState(__spreadValues({}, generateAppStore(state)));
8700
9278
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -8703,8 +9281,8 @@ function PuckProvider({ children }) {
8703
9281
  index: initialHistoryIndex,
8704
9282
  initialAppState
8705
9283
  });
8706
- const previousData = (0, import_react56.useRef)(null);
8707
- (0, import_react56.useEffect)(() => {
9284
+ const previousData = (0, import_react59.useRef)(null);
9285
+ (0, import_react59.useEffect)(() => {
8708
9286
  appStore.subscribe(
8709
9287
  (s) => s.state.data,
8710
9288
  (data) => {
@@ -8718,11 +9296,11 @@ function PuckProvider({ children }) {
8718
9296
  }, []);
8719
9297
  useRegisterPermissionsSlice(appStore, permissions);
8720
9298
  const uPuckStore = useRegisterUsePuckStore(appStore);
8721
- (0, import_react56.useEffect)(() => {
9299
+ (0, import_react59.useEffect)(() => {
8722
9300
  const { resolveAndCommitData } = appStore.getState();
8723
9301
  resolveAndCommitData();
8724
9302
  }, []);
8725
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
9303
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8726
9304
  }
8727
9305
  function PuckLayout({ children }) {
8728
9306
  const {
@@ -8730,7 +9308,7 @@ function PuckLayout({ children }) {
8730
9308
  dnd,
8731
9309
  initialHistory: _initialHistory
8732
9310
  } = usePropsContext();
8733
- const iframe = (0, import_react56.useMemo)(
9311
+ const iframe = (0, import_react59.useMemo)(
8734
9312
  () => __spreadValues({
8735
9313
  enabled: true,
8736
9314
  waitForStyles: true
@@ -8738,12 +9316,24 @@ function PuckLayout({ children }) {
8738
9316
  [_iframe]
8739
9317
  );
8740
9318
  useInjectGlobalCss(iframe.enabled);
9319
+ const dispatch = useAppStore((s) => s.dispatch);
8741
9320
  const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
8742
9321
  const rightSideBarVisible = useAppStore(
8743
9322
  (s) => s.state.ui.rightSideBarVisible
8744
9323
  );
8745
- const dispatch = useAppStore((s) => s.dispatch);
8746
- (0, import_react56.useEffect)(() => {
9324
+ const {
9325
+ width: leftWidth,
9326
+ setWidth: setLeftWidth,
9327
+ sidebarRef: leftSidebarRef,
9328
+ handleResizeEnd: handleLeftSidebarResizeEnd
9329
+ } = useSidebarResize("left", dispatch);
9330
+ const {
9331
+ width: rightWidth,
9332
+ setWidth: setRightWidth,
9333
+ sidebarRef: rightSidebarRef,
9334
+ handleResizeEnd: handleRightSidebarResizeEnd
9335
+ } = useSidebarResize("right", dispatch);
9336
+ (0, import_react59.useEffect)(() => {
8747
9337
  if (!window.matchMedia("(min-width: 638px)").matches) {
8748
9338
  dispatch({
8749
9339
  type: "setUi",
@@ -8767,17 +9357,17 @@ function PuckLayout({ children }) {
8767
9357
  };
8768
9358
  }, []);
8769
9359
  const overrides = useAppStore((s) => s.overrides);
8770
- const CustomPuck = (0, import_react56.useMemo)(
9360
+ const CustomPuck = (0, import_react59.useMemo)(
8771
9361
  () => overrides.puck || DefaultOverride,
8772
9362
  [overrides]
8773
9363
  );
8774
- const [mounted, setMounted] = (0, import_react56.useState)(false);
8775
- (0, import_react56.useEffect)(() => {
9364
+ const [mounted, setMounted] = (0, import_react59.useState)(false);
9365
+ (0, import_react59.useEffect)(() => {
8776
9366
  setMounted(true);
8777
9367
  }, []);
8778
9368
  const ready = useAppStore((s) => s.status === "READY");
8779
9369
  useMonitorHotkeys();
8780
- (0, import_react56.useEffect)(() => {
9370
+ (0, import_react59.useEffect)(() => {
8781
9371
  if (ready && iframe.enabled) {
8782
9372
  const frameDoc = getFrame();
8783
9373
  if (frameDoc) {
@@ -8786,8 +9376,8 @@ function PuckLayout({ children }) {
8786
9376
  }
8787
9377
  }, [ready, iframe.enabled]);
8788
9378
  usePreviewModeHotkeys();
8789
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `Puck ${getClassName28()}`, children: [
8790
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
9379
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `Puck ${getClassName31()}`, children: [
9380
+ /* @__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)(
8791
9381
  "div",
8792
9382
  {
8793
9383
  className: getLayoutClassName({
@@ -8795,22 +9385,57 @@ function PuckLayout({ children }) {
8795
9385
  mounted,
8796
9386
  rightSideBarVisible
8797
9387
  }),
8798
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getLayoutClassName("inner"), children: [
8799
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Header, {}),
8800
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
8801
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Components, {}) }),
8802
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Outline, {}) })
8803
- ] }),
8804
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Canvas, {}),
8805
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FieldSideBar, {}) })
8806
- ] })
9388
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9389
+ "div",
9390
+ {
9391
+ className: getLayoutClassName("inner"),
9392
+ style: {
9393
+ gridTemplateColumns: `
9394
+ ${leftSideBarVisible ? leftWidth ? `${leftWidth}px` : "var(--puck-side-bar-width)" : "0"}
9395
+ var(--puck-frame-width)
9396
+ ${rightSideBarVisible ? rightWidth ? `${rightWidth}px` : "var(--puck-side-bar-width)" : "0"}
9397
+ `
9398
+ },
9399
+ children: [
9400
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header, {}),
9401
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9402
+ Sidebar,
9403
+ {
9404
+ position: "left",
9405
+ sidebarRef: leftSidebarRef,
9406
+ isVisible: leftSideBarVisible,
9407
+ width: leftWidth,
9408
+ onResize: setLeftWidth,
9409
+ onResizeEnd: handleLeftSidebarResizeEnd,
9410
+ children: [
9411
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Components, {}) }),
9412
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Outline, {}) })
9413
+ ]
9414
+ }
9415
+ ),
9416
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Canvas, {}),
9417
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9418
+ Sidebar,
9419
+ {
9420
+ position: "right",
9421
+ sidebarRef: rightSidebarRef,
9422
+ isVisible: rightSideBarVisible,
9423
+ width: rightWidth,
9424
+ onResize: setRightWidth,
9425
+ onResizeEnd: handleRightSidebarResizeEnd,
9426
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldSideBar, {})
9427
+ }
9428
+ )
9429
+ ]
9430
+ }
9431
+ )
8807
9432
  }
8808
- ) }) }),
8809
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: "puck-portal-root", className: getClassName28("portal") })
9433
+ ) }) }) }),
9434
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { id: "puck-portal-root", className: getClassName31("portal") })
8810
9435
  ] });
8811
9436
  }
8812
9437
  function Puck(props) {
8813
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PuckLayout, __spreadValues({}, props)) })) }));
9438
+ 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)) })) }));
8814
9439
  }
8815
9440
  Puck.Components = Components;
8816
9441
  Puck.Fields = Fields;
@@ -9009,9 +9634,9 @@ function resolveAllData(_0, _1) {
9009
9634
  },
9010
9635
  "force"
9011
9636
  )).node;
9012
- const resolvedDeep = yield mapSlots(
9637
+ const resolvedDeep = yield mapFields(
9013
9638
  resolved,
9014
- processContent,
9639
+ { slot: ({ value }) => processContent(value) },
9015
9640
  config
9016
9641
  );
9017
9642
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
@@ -9057,8 +9682,10 @@ function resolveAllData(_0, _1) {
9057
9682
  createUsePuck,
9058
9683
  migrate,
9059
9684
  overrideKeys,
9685
+ registerOverlayPortal,
9060
9686
  renderContext,
9061
9687
  resolveAllData,
9688
+ setDeep,
9062
9689
  transformProps,
9063
9690
  useGetPuck,
9064
9691
  usePuck,