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

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,247 @@ 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
+ e.stopPropagation();
5702
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5703
+ e.preventDefault();
5704
+ }
5705
+ },
5706
+ onKeyUp: (e) => {
5707
+ e.stopPropagation();
5708
+ e.preventDefault();
5709
+ },
5710
+ onMouseOverCapture: () => setIsHovering(true),
5711
+ onMouseOutCapture: () => setIsHovering(false),
5712
+ onFocus: () => setIsFocused(true),
5713
+ onBlur: () => setIsFocused(false)
5714
+ }
5715
+ );
5716
+ };
5717
+ var InlineTextField = (0, import_react33.memo)(InlineTextFieldInternal);
5718
+
5719
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5720
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5721
+ var getInlineTextTransform = () => ({
5722
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5723
+ if (field.contentEditable) {
5724
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5725
+ InlineTextField,
5726
+ {
5727
+ propPath,
5728
+ componentId,
5729
+ value,
5730
+ opts: { disableLineBreaks: true },
5731
+ isReadOnly
5732
+ }
5733
+ );
5734
+ }
5735
+ return value;
5736
+ },
5737
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5738
+ if (field.contentEditable) {
5739
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5740
+ InlineTextField,
5741
+ {
5742
+ propPath,
5743
+ componentId,
5744
+ value,
5745
+ isReadOnly
5746
+ }
5747
+ );
5748
+ }
5749
+ return value;
5750
+ },
5751
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5752
+ if (field.contentEditable && typeof value === "string") {
5753
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5754
+ InlineTextField,
5755
+ {
5756
+ propPath,
5757
+ componentId,
5758
+ value,
5759
+ isReadOnly
5760
+ }
5761
+ );
5762
+ }
5763
+ return value;
5764
+ }
5765
+ });
5303
5766
 
5304
5767
  // 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);
5768
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5769
+ var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
5307
5770
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
5308
5771
  var RENDER_DEBUG = false;
5309
- var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
5772
+ var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneEdit, __spreadValues({}, props));
5310
5773
  var DropZoneChild = ({
5311
5774
  zoneCompound,
5312
5775
  componentId,
@@ -5317,9 +5780,9 @@ var DropZoneChild = ({
5317
5780
  }) => {
5318
5781
  var _a, _b;
5319
5782
  const metadata = useAppStore((s) => s.metadata);
5320
- const ctx = (0, import_react35.useContext)(dropZoneContext);
5783
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5321
5784
  const { depth = 1 } = ctx != null ? ctx : {};
5322
- const zoneStore = (0, import_react35.useContext)(ZoneStoreContext);
5785
+ const zoneStore = (0, import_react34.useContext)(ZoneStoreContext);
5323
5786
  const nodeProps = useAppStore(
5324
5787
  (0, import_shallow4.useShallow)((s) => {
5325
5788
  var _a2;
@@ -5339,7 +5802,7 @@ var DropZoneChild = ({
5339
5802
  })
5340
5803
  );
5341
5804
  const appStore = useAppStoreApi();
5342
- const item = (0, import_react35.useMemo)(() => {
5805
+ const item = (0, import_react34.useMemo)(() => {
5343
5806
  if (nodeProps) {
5344
5807
  const expanded = expandNode({
5345
5808
  type: nodeType,
@@ -5361,7 +5824,7 @@ var DropZoneChild = ({
5361
5824
  const componentConfig = useAppStore(
5362
5825
  (s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
5363
5826
  );
5364
- const puckProps = (0, import_react35.useMemo)(
5827
+ const puckProps = (0, import_react34.useMemo)(
5365
5828
  () => ({
5366
5829
  renderDropZone: DropZoneEditPure,
5367
5830
  isEditing: true,
@@ -5384,19 +5847,20 @@ var DropZoneChild = ({
5384
5847
  }
5385
5848
  );
5386
5849
  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)(
5850
+ const renderPreview = (0, import_react34.useMemo)(
5388
5851
  () => function Preview3() {
5852
+ var _a2;
5389
5853
  if (item && "element" in item && item.element) {
5390
5854
  return (
5391
5855
  // 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 } })
5856
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5393
5857
  );
5394
5858
  }
5395
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
5859
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5396
5860
  },
5397
5861
  [componentId, label, overrides]
5398
5862
  );
5399
- const defaultsProps = (0, import_react35.useMemo)(
5863
+ const defaultsProps = (0, import_react34.useMemo)(
5400
5864
  () => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
5401
5865
  puck: puckProps,
5402
5866
  editMode: true
@@ -5404,7 +5868,7 @@ var DropZoneChild = ({
5404
5868
  }),
5405
5869
  [componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
5406
5870
  );
5407
- const defaultedNode = (0, import_react35.useMemo)(
5871
+ const defaultedNode = (0, import_react34.useMemo)(
5408
5872
  () => {
5409
5873
  var _a2;
5410
5874
  return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
@@ -5412,16 +5876,24 @@ var DropZoneChild = ({
5412
5876
  [item == null ? void 0 : item.type, nodeType, defaultsProps]
5413
5877
  );
5414
5878
  const config = useAppStore((s) => s.config);
5415
- const defaultedPropsWithSlots = useSlots(
5879
+ const plugins = useAppStore((s) => s.plugins);
5880
+ const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
5881
+ const combinedFieldTransforms = (0, import_react34.useMemo)(
5882
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5883
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
5884
+ {}
5885
+ )), userFieldTransforms),
5886
+ [plugins, userFieldTransforms]
5887
+ );
5888
+ const transformedProps = useFieldTransforms(
5416
5889
  config,
5417
5890
  defaultedNode,
5418
- DropZoneEditPure,
5419
- (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }),
5891
+ combinedFieldTransforms,
5420
5892
  nodeReadOnly,
5421
5893
  isLoading
5422
5894
  );
5423
5895
  if (!item) return;
5424
- let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5896
+ let Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
5425
5897
  "No configuration for ",
5426
5898
  item.type
5427
5899
  ] });
@@ -5430,7 +5902,7 @@ var DropZoneChild = ({
5430
5902
  if (isInserting) {
5431
5903
  Render2 = renderPreview;
5432
5904
  }
5433
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5905
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5434
5906
  DraggableComponent,
5435
5907
  {
5436
5908
  id: componentId,
@@ -5444,19 +5916,19 @@ var DropZoneChild = ({
5444
5916
  autoDragAxis: dragAxis,
5445
5917
  userDragAxis: collisionAxis,
5446
5918
  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)(
5919
+ 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
5920
  Render2,
5449
- __spreadProps(__spreadValues({}, defaultedPropsWithSlots), {
5450
- puck: __spreadProps(__spreadValues({}, defaultedPropsWithSlots.puck), {
5921
+ __spreadProps(__spreadValues({}, transformedProps), {
5922
+ puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
5451
5923
  dragRef
5452
5924
  })
5453
5925
  })
5454
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedPropsWithSlots)) })
5926
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Render2, __spreadValues({}, transformedProps)) })
5455
5927
  }
5456
5928
  );
5457
5929
  };
5458
- var DropZoneChildMemo = (0, import_react35.memo)(DropZoneChild);
5459
- var DropZoneEdit = (0, import_react35.forwardRef)(
5930
+ var DropZoneChildMemo = (0, import_react34.memo)(DropZoneChild);
5931
+ var DropZoneEdit = (0, import_react34.forwardRef)(
5460
5932
  function DropZoneEditInternal({
5461
5933
  zone,
5462
5934
  allow,
@@ -5466,7 +5938,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5466
5938
  minEmptyHeight: userMinEmptyHeight = 128,
5467
5939
  collisionAxis
5468
5940
  }, userRef) {
5469
- const ctx = (0, import_react35.useContext)(dropZoneContext);
5941
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5470
5942
  const appStoreApi = useAppStoreApi();
5471
5943
  const {
5472
5944
  // These all need setting via context
@@ -5504,14 +5976,14 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5504
5976
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
5505
5977
  })
5506
5978
  );
5507
- (0, import_react35.useEffect)(() => {
5979
+ (0, import_react34.useEffect)(() => {
5508
5980
  if (!zoneType || zoneType === "dropzone") {
5509
5981
  if (ctx == null ? void 0 : ctx.registerZone) {
5510
5982
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
5511
5983
  }
5512
5984
  }
5513
5985
  }, [zoneType, appStoreApi]);
5514
- (0, import_react35.useEffect)(() => {
5986
+ (0, import_react34.useEffect)(() => {
5515
5987
  if (zoneType === "dropzone") {
5516
5988
  if (zoneCompound !== rootDroppableId) {
5517
5989
  console.warn(
@@ -5520,11 +5992,11 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5520
5992
  }
5521
5993
  }
5522
5994
  }, [zoneType]);
5523
- const contentIds = (0, import_react35.useMemo)(() => {
5995
+ const contentIds = (0, import_react34.useMemo)(() => {
5524
5996
  return zoneContentIds || [];
5525
5997
  }, [zoneContentIds]);
5526
- const ref = (0, import_react35.useRef)(null);
5527
- const acceptsTarget = (0, import_react35.useCallback)(
5998
+ const ref = (0, import_react34.useRef)(null);
5999
+ const acceptsTarget = (0, import_react34.useCallback)(
5528
6000
  (componentType) => {
5529
6001
  if (!componentType) {
5530
6002
  return true;
@@ -5562,7 +6034,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5562
6034
  }
5563
6035
  return _isEnabled;
5564
6036
  });
5565
- (0, import_react35.useEffect)(() => {
6037
+ (0, import_react34.useEffect)(() => {
5566
6038
  if (registerLocalZone) {
5567
6039
  registerLocalZone(zoneCompound, targetAccepted || isEnabled);
5568
6040
  }
@@ -5577,8 +6049,8 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5577
6049
  zoneCompound
5578
6050
  );
5579
6051
  const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
5580
- const zoneStore = (0, import_react35.useContext)(ZoneStoreContext);
5581
- (0, import_react35.useEffect)(() => {
6052
+ const zoneStore = (0, import_react34.useContext)(ZoneStoreContext);
6053
+ (0, import_react34.useEffect)(() => {
5582
6054
  const { enabledIndex } = zoneStore.getState();
5583
6055
  zoneStore.setState({
5584
6056
  enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
@@ -5597,7 +6069,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5597
6069
  path: path || []
5598
6070
  }
5599
6071
  };
5600
- const { ref: dropRef } = (0, import_react36.useDroppable)(droppableConfig);
6072
+ const { ref: dropRef } = (0, import_react35.useDroppable)(droppableConfig);
5601
6073
  const isAreaSelected = useAppStore(
5602
6074
  (s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
5603
6075
  );
@@ -5607,10 +6079,10 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5607
6079
  userMinEmptyHeight,
5608
6080
  ref
5609
6081
  });
5610
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6082
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5611
6083
  "div",
5612
6084
  {
5613
- className: `${getClassName17({
6085
+ className: `${getClassName18({
5614
6086
  isRootZone,
5615
6087
  hoveringOverArea,
5616
6088
  isEnabled,
@@ -5628,7 +6100,7 @@ var DropZoneEdit = (0, import_react35.forwardRef)(
5628
6100
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
5629
6101
  }),
5630
6102
  children: contentIdsWithPreview.map((componentId, i) => {
5631
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6103
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5632
6104
  DropZoneChildMemo,
5633
6105
  {
5634
6106
  zoneCompound,
@@ -5651,15 +6123,15 @@ var DropZoneRenderItem = ({
5651
6123
  metadata
5652
6124
  }) => {
5653
6125
  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)(
6126
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
6127
+ const nextContextValue = (0, import_react34.useMemo)(
5656
6128
  () => ({
5657
6129
  areaId: props.id,
5658
6130
  depth: 1
5659
6131
  }),
5660
6132
  [props]
5661
6133
  );
5662
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6134
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5663
6135
  Component.render,
5664
6136
  __spreadProps(__spreadValues({}, props), {
5665
6137
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -5669,15 +6141,15 @@ var DropZoneRenderItem = ({
5669
6141
  })
5670
6142
  ) }, props.id);
5671
6143
  };
5672
- var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadValues({}, props));
5673
- var DropZoneRender2 = (0, import_react35.forwardRef)(
6144
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRender2, __spreadValues({}, props));
6145
+ var DropZoneRender2 = (0, import_react34.forwardRef)(
5674
6146
  function DropZoneRenderInternal({ className, style, zone }, ref) {
5675
- const ctx = (0, import_react35.useContext)(dropZoneContext);
6147
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5676
6148
  const { areaId = "root" } = ctx || {};
5677
- const { config, data, metadata } = (0, import_react35.useContext)(renderContext);
6149
+ const { config, data, metadata } = (0, import_react34.useContext)(renderContext);
5678
6150
  let zoneCompound = `${areaId}:${zone}`;
5679
6151
  let content = (data == null ? void 0 : data.content) || [];
5680
- (0, import_react35.useEffect)(() => {
6152
+ (0, import_react34.useEffect)(() => {
5681
6153
  if (!content) {
5682
6154
  if (ctx == null ? void 0 : ctx.registerZone) {
5683
6155
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
@@ -5690,10 +6162,10 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
5690
6162
  if (zoneCompound !== rootDroppableId) {
5691
6163
  content = setupZone(data, zoneCompound).zones[zoneCompound];
5692
6164
  }
5693
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, style, ref, children: content.map((item) => {
6165
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className, style, ref, children: content.map((item) => {
5694
6166
  const Component = config.components[item.type];
5695
6167
  if (Component) {
5696
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6168
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5697
6169
  DropZoneRenderItem,
5698
6170
  {
5699
6171
  config,
@@ -5707,14 +6179,14 @@ var DropZoneRender2 = (0, import_react35.forwardRef)(
5707
6179
  }) });
5708
6180
  }
5709
6181
  );
5710
- var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZone, __spreadValues({}, props));
5711
- var DropZone = (0, import_react35.forwardRef)(
6182
+ var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZone, __spreadValues({}, props));
6183
+ var DropZone = (0, import_react34.forwardRef)(
5712
6184
  function DropZone2(props, ref) {
5713
- const ctx = (0, import_react35.useContext)(dropZoneContext);
6185
+ const ctx = (0, import_react34.useContext)(dropZoneContext);
5714
6186
  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 })) });
6187
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5716
6188
  }
5717
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
6189
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZoneRender2, __spreadProps(__spreadValues({}, props), { ref })) });
5718
6190
  }
5719
6191
  );
5720
6192
 
@@ -6050,14 +6522,14 @@ function getDeepDir(el) {
6050
6522
 
6051
6523
  // components/DragDropContext/index.tsx
6052
6524
  var import_state = require("@dnd-kit/state");
6053
- var import_jsx_runtime26 = require("react/jsx-runtime");
6525
+ var import_jsx_runtime28 = require("react/jsx-runtime");
6054
6526
  var DEBUG3 = false;
6055
- var dragListenerContext = (0, import_react38.createContext)({
6527
+ var dragListenerContext = (0, import_react37.createContext)({
6056
6528
  dragListeners: {}
6057
6529
  });
6058
6530
  function useDragListener(type, fn, deps = []) {
6059
- const { setDragListeners } = (0, import_react38.useContext)(dragListenerContext);
6060
- (0, import_react38.useEffect)(() => {
6531
+ const { setDragListeners } = (0, import_react37.useContext)(dragListenerContext);
6532
+ (0, import_react37.useEffect)(() => {
6061
6533
  if (setDragListeners) {
6062
6534
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
6063
6535
  [type]: [...old[type] || [], fn]
@@ -6067,8 +6539,8 @@ function useDragListener(type, fn, deps = []) {
6067
6539
  }
6068
6540
  var AREA_CHANGE_DEBOUNCE_MS = 100;
6069
6541
  var useTempDisableFallback = (timeout3) => {
6070
- const lastFallbackDisable = (0, import_react38.useRef)(null);
6071
- return (0, import_react38.useCallback)((manager) => {
6542
+ const lastFallbackDisable = (0, import_react37.useRef)(null);
6543
+ return (0, import_react37.useCallback)((manager) => {
6072
6544
  collisionStore.setState({ fallbackEnabled: false });
6073
6545
  const fallbackId = generateId();
6074
6546
  lastFallbackDisable.current = fallbackId;
@@ -6087,9 +6559,9 @@ var DragDropContextClient = ({
6087
6559
  const dispatch = useAppStore((s) => s.dispatch);
6088
6560
  const appStore = useAppStoreApi();
6089
6561
  const id = useSafeId();
6090
- const debouncedParamsRef = (0, import_react38.useRef)(null);
6562
+ const debouncedParamsRef = (0, import_react37.useRef)(null);
6091
6563
  const tempDisableFallback = useTempDisableFallback(100);
6092
- const [zoneStore] = (0, import_react38.useState)(
6564
+ const [zoneStore] = (0, import_react37.useState)(
6093
6565
  () => (0, import_zustand5.createStore)(() => ({
6094
6566
  zoneDepthIndex: {},
6095
6567
  nextZoneDepthIndex: {},
@@ -6101,7 +6573,7 @@ var DragDropContextClient = ({
6101
6573
  hoveringComponent: null
6102
6574
  }))
6103
6575
  );
6104
- const getChanged2 = (0, import_react38.useCallback)(
6576
+ const getChanged2 = (0, import_react37.useCallback)(
6105
6577
  (params, id2) => {
6106
6578
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
6107
6579
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -6122,7 +6594,7 @@ var DragDropContextClient = ({
6122
6594
  },
6123
6595
  [zoneStore]
6124
6596
  );
6125
- const setDeepestAndCollide = (0, import_react38.useCallback)(
6597
+ const setDeepestAndCollide = (0, import_react37.useCallback)(
6126
6598
  (params, manager) => {
6127
6599
  const { zoneChanged, areaChanged } = getChanged2(params, id);
6128
6600
  if (!zoneChanged && !areaChanged) return;
@@ -6146,7 +6618,7 @@ var DragDropContextClient = ({
6146
6618
  setDeepestDb.cancel();
6147
6619
  debouncedParamsRef.current = null;
6148
6620
  };
6149
- (0, import_react38.useEffect)(() => {
6621
+ (0, import_react37.useEffect)(() => {
6150
6622
  if (DEBUG3) {
6151
6623
  zoneStore.subscribe(
6152
6624
  (s) => {
@@ -6160,7 +6632,7 @@ var DragDropContextClient = ({
6160
6632
  );
6161
6633
  }
6162
6634
  }, []);
6163
- const [plugins] = (0, import_react38.useState)(() => [
6635
+ const [plugins] = (0, import_react37.useState)(() => [
6164
6636
  ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
6165
6637
  createNestedDroppablePlugin(
6166
6638
  {
@@ -6208,10 +6680,10 @@ var DragDropContextClient = ({
6208
6680
  )
6209
6681
  ]);
6210
6682
  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)(
6683
+ const [dragListeners, setDragListeners] = (0, import_react37.useState)({});
6684
+ const dragMode = (0, import_react37.useRef)(null);
6685
+ const initialSelector = (0, import_react37.useRef)(void 0);
6686
+ const nextContextValue = (0, import_react37.useMemo)(
6215
6687
  () => ({
6216
6688
  mode: "edit",
6217
6689
  areaId: "root",
@@ -6219,15 +6691,15 @@ var DragDropContextClient = ({
6219
6691
  }),
6220
6692
  []
6221
6693
  );
6222
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6694
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6223
6695
  dragListenerContext.Provider,
6224
6696
  {
6225
6697
  value: {
6226
6698
  dragListeners,
6227
6699
  setDragListeners
6228
6700
  },
6229
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6230
- import_react37.DragDropProvider,
6701
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6702
+ import_react36.DragDropProvider,
6231
6703
  {
6232
6704
  plugins,
6233
6705
  sensors,
@@ -6442,7 +6914,7 @@ var DragDropContextClient = ({
6442
6914
  const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
6443
6915
  entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
6444
6916
  },
6445
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6917
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
6446
6918
  }
6447
6919
  )
6448
6920
  }
@@ -6456,13 +6928,13 @@ var DragDropContext = ({
6456
6928
  if (status === "LOADING") {
6457
6929
  return children;
6458
6930
  }
6459
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DragDropContextClient, { disableAutoScroll, children });
6931
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DragDropContextClient, { disableAutoScroll, children });
6460
6932
  };
6461
6933
 
6462
6934
  // 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);
6935
+ var import_react39 = require("@dnd-kit/react");
6936
+ var import_jsx_runtime29 = require("react/jsx-runtime");
6937
+ var getClassName19 = get_class_name_factory_default("Drawer", styles_module_default10);
6466
6938
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
6467
6939
  var DrawerItemInner = ({
6468
6940
  children,
@@ -6471,11 +6943,11 @@ var DrawerItemInner = ({
6471
6943
  dragRef,
6472
6944
  isDragDisabled
6473
6945
  }) => {
6474
- const CustomInner = (0, import_react39.useMemo)(
6475
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6946
+ const CustomInner = (0, import_react38.useMemo)(
6947
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
6476
6948
  [children]
6477
6949
  );
6478
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6950
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6479
6951
  "div",
6480
6952
  {
6481
6953
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -6483,9 +6955,9 @@ var DrawerItemInner = ({
6483
6955
  onMouseDown: (e) => e.preventDefault(),
6484
6956
  "data-testid": dragRef ? `drawer-item:${name}` : "",
6485
6957
  "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, {}) })
6958
+ 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: [
6959
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6960
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DragIcon, {}) })
6489
6961
  ] }) }) })
6490
6962
  }
6491
6963
  );
@@ -6497,15 +6969,15 @@ var DrawerItemDraggable = ({
6497
6969
  id,
6498
6970
  isDragDisabled
6499
6971
  }) => {
6500
- const { ref } = (0, import_react40.useDraggable)({
6972
+ const { ref } = (0, import_react39.useDraggable)({
6501
6973
  id,
6502
6974
  data: { componentType: name },
6503
6975
  disabled: isDragDisabled,
6504
6976
  type: "drawer"
6505
6977
  });
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)(
6978
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName19("draggable"), children: [
6979
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName19("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DrawerItemInner, { name, label, children }) }),
6980
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName19("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6509
6981
  DrawerItemInner,
6510
6982
  {
6511
6983
  name,
@@ -6526,7 +6998,7 @@ var DrawerItem = ({
6526
6998
  isDragDisabled
6527
6999
  }) => {
6528
7000
  const resolvedId = id || name;
6529
- const [dynamicId, setDynamicId] = (0, import_react39.useState)(generateId(resolvedId));
7001
+ const [dynamicId, setDynamicId] = (0, import_react38.useState)(generateId(resolvedId));
6530
7002
  if (typeof index !== "undefined") {
6531
7003
  console.error(
6532
7004
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -6539,7 +7011,7 @@ var DrawerItem = ({
6539
7011
  },
6540
7012
  [resolvedId]
6541
7013
  );
6542
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7014
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6543
7015
  DrawerItemDraggable,
6544
7016
  {
6545
7017
  name,
@@ -6566,16 +7038,16 @@ var Drawer = ({
6566
7038
  );
6567
7039
  }
6568
7040
  const id = useSafeId();
6569
- const { ref } = (0, import_react40.useDroppable)({
7041
+ const { ref } = (0, import_react39.useDroppable)({
6570
7042
  id,
6571
7043
  type: "void",
6572
7044
  collisionPriority: 0
6573
7045
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
6574
7046
  });
6575
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
7047
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6576
7048
  "div",
6577
7049
  {
6578
- className: getClassName18(),
7050
+ className: getClassName19(),
6579
7051
  ref,
6580
7052
  "data-puck-dnd": id,
6581
7053
  "data-puck-drawer": true,
@@ -6588,18 +7060,18 @@ Drawer.Item = DrawerItem;
6588
7060
 
6589
7061
  // components/Puck/index.tsx
6590
7062
  init_react_import();
6591
- var import_react56 = require("react");
7063
+ var import_react59 = require("react");
6592
7064
 
6593
7065
  // components/SidebarSection/index.tsx
6594
7066
  init_react_import();
6595
7067
 
6596
7068
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6597
7069
  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" };
7070
+ 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
7071
 
6600
7072
  // lib/use-breadcrumbs.ts
6601
7073
  init_react_import();
6602
- var import_react41 = require("react");
7074
+ var import_react40 = require("react");
6603
7075
  var useBreadcrumbs = (renderCount) => {
6604
7076
  const selectedId = useAppStore((s) => {
6605
7077
  var _a;
@@ -6611,7 +7083,7 @@ var useBreadcrumbs = (renderCount) => {
6611
7083
  return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
6612
7084
  });
6613
7085
  const appStore = useAppStoreApi();
6614
- return (0, import_react41.useMemo)(() => {
7086
+ return (0, import_react40.useMemo)(() => {
6615
7087
  const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
6616
7088
  var _a, _b, _c;
6617
7089
  const [componentId] = zoneCompound.split(":");
@@ -6642,8 +7114,8 @@ var useBreadcrumbs = (renderCount) => {
6642
7114
  };
6643
7115
 
6644
7116
  // 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);
7117
+ var import_jsx_runtime30 = require("react/jsx-runtime");
7118
+ var getClassName20 = get_class_name_factory_default("SidebarSection", styles_module_default14);
6647
7119
  var SidebarSection = ({
6648
7120
  children,
6649
7121
  title,
@@ -6655,29 +7127,29 @@ var SidebarSection = ({
6655
7127
  }) => {
6656
7128
  const setUi = useAppStore((s) => s.setUi);
6657
7129
  const breadcrumbs = useBreadcrumbs(1);
6658
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
7130
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6659
7131
  "div",
6660
7132
  {
6661
- className: getClassName19({ noBorderTop, noPadding }),
7133
+ className: getClassName20({ noBorderTop, noPadding }),
6662
7134
  style: { background },
6663
7135
  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)(
7136
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("title"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName20("breadcrumbs"), children: [
7137
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName20("breadcrumb"), children: [
7138
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6667
7139
  "button",
6668
7140
  {
6669
7141
  type: "button",
6670
- className: getClassName19("breadcrumbLabel"),
7142
+ className: getClassName20("breadcrumbLabel"),
6671
7143
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6672
7144
  children: breadcrumb.label
6673
7145
  }
6674
7146
  ),
6675
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { size: 16 })
7147
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronRight, { size: 16 })
6676
7148
  ] }, 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 }) })
7149
+ /* @__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
7150
  ] }) }),
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 }) })
7151
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("content"), children }),
7152
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Loader, { size: 32 }) })
6681
7153
  ]
6682
7154
  }
6683
7155
  );
@@ -6685,24 +7157,24 @@ var SidebarSection = ({
6685
7157
 
6686
7158
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
6687
7159
  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" };
7160
+ var styles_module_default15 = { "Puck": "_Puck_1yxlw_19", "Puck-portal": "_Puck-portal_1yxlw_31", "PuckLayout-inner": "_PuckLayout-inner_1yxlw_38", "PuckLayout--mounted": "_PuckLayout--mounted_1yxlw_59", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1yxlw_63", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1yxlw_69", "PuckLayout-mounted": "_PuckLayout-mounted_1yxlw_83", "PuckLayout": "_PuckLayout_1yxlw_38" };
6689
7161
 
6690
7162
  // components/Puck/components/Fields/index.tsx
6691
7163
  init_react_import();
6692
7164
 
6693
7165
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
6694
7166
  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" };
7167
+ 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
7168
 
6697
7169
  // components/Puck/components/Fields/index.tsx
6698
- var import_react42 = require("react");
7170
+ var import_react41 = require("react");
6699
7171
  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);
7172
+ var import_jsx_runtime31 = require("react/jsx-runtime");
7173
+ var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
6702
7174
  var DefaultFields = ({
6703
7175
  children
6704
7176
  }) => {
6705
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
7177
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
6706
7178
  };
6707
7179
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
6708
7180
  let currentProps;
@@ -6768,13 +7240,13 @@ var FieldsChild = ({ fieldName }) => {
6768
7240
  })
6769
7241
  );
6770
7242
  const appStore = useAppStoreApi();
6771
- const onChange = (0, import_react42.useCallback)(createOnChange(fieldName, appStore), [
7243
+ const onChange = (0, import_react41.useCallback)(createOnChange(fieldName, appStore), [
6772
7244
  fieldName
6773
7245
  ]);
6774
7246
  const { visible = true } = field != null ? field : {};
6775
7247
  if (!field || !id || !visible) return null;
6776
7248
  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)(
7249
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6778
7250
  AutoFieldPrivate,
6779
7251
  {
6780
7252
  field,
@@ -6786,7 +7258,7 @@ var FieldsChild = ({ fieldName }) => {
6786
7258
  }
6787
7259
  ) }, id);
6788
7260
  };
6789
- var FieldsChildMemo = (0, import_react42.memo)(FieldsChild);
7261
+ var FieldsChildMemo = (0, import_react41.memo)(FieldsChild);
6790
7262
  var FieldsInternal = ({ wrapFields = true }) => {
6791
7263
  const overrides = useAppStore((s) => s.overrides);
6792
7264
  const componentResolving = useAppStore((s) => {
@@ -6811,22 +7283,22 @@ var FieldsInternal = ({ wrapFields = true }) => {
6811
7283
  })
6812
7284
  );
6813
7285
  const isLoading = fieldsLoading || componentResolving;
6814
- const Wrapper = (0, import_react42.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
6815
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
7286
+ const Wrapper = (0, import_react41.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
7287
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
6816
7288
  "form",
6817
7289
  {
6818
- className: getClassName20({ wrapFields }),
7290
+ className: getClassName21({ wrapFields }),
6819
7291
  onSubmit: (e) => {
6820
7292
  e.preventDefault();
6821
7293
  },
6822
7294
  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 }) }) })
7295
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldsChildMemo, { fieldName }, fieldName)) }),
7296
+ 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
7297
  ]
6826
7298
  }
6827
7299
  );
6828
7300
  };
6829
- var Fields = (0, import_react42.memo)(FieldsInternal);
7301
+ var Fields = (0, import_react41.memo)(FieldsInternal);
6830
7302
 
6831
7303
  // components/Puck/components/Components/index.tsx
6832
7304
  init_react_import();
@@ -6840,22 +7312,31 @@ init_react_import();
6840
7312
 
6841
7313
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
6842
7314
  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" };
7315
+ 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
7316
 
6845
7317
  // 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);
7318
+ var import_react42 = require("react");
7319
+ var import_jsx_runtime32 = require("react/jsx-runtime");
7320
+ var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
6848
7321
  var ComponentListItem = ({
6849
7322
  name,
6850
7323
  label
6851
7324
  }) => {
7325
+ var _a;
6852
7326
  const overrides = useAppStore((s) => s.overrides);
6853
7327
  const canInsert = useAppStore(
6854
7328
  (s) => s.permissions.getPermissions({
6855
7329
  type: name
6856
7330
  }).insert
6857
7331
  );
6858
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
7332
+ (0, import_react42.useEffect)(() => {
7333
+ if (overrides.componentItem) {
7334
+ console.warn(
7335
+ "The `componentItem` override has been deprecated and renamed to `drawerItem`"
7336
+ );
7337
+ }
7338
+ }, [overrides]);
7339
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6859
7340
  };
6860
7341
  var ComponentList = ({
6861
7342
  children,
@@ -6866,12 +7347,12 @@ var ComponentList = ({
6866
7347
  const setUi = useAppStore((s) => s.setUi);
6867
7348
  const componentList = useAppStore((s) => s.state.ui.componentList);
6868
7349
  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)(
7350
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
7351
+ title && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6871
7352
  "button",
6872
7353
  {
6873
7354
  type: "button",
6874
- className: getClassName21("title"),
7355
+ className: getClassName22("title"),
6875
7356
  onClick: () => setUi({
6876
7357
  componentList: __spreadProps(__spreadValues({}, componentList), {
6877
7358
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -6881,14 +7362,14 @@ var ComponentList = ({
6881
7362
  }),
6882
7363
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
6883
7364
  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 }) })
7365
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: title }),
7366
+ /* @__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
7367
  ]
6887
7368
  }
6888
7369
  ),
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) => {
7370
+ /* @__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
7371
  var _a;
6891
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
7372
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6892
7373
  ComponentListItem,
6893
7374
  {
6894
7375
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -6902,7 +7383,7 @@ var ComponentList = ({
6902
7383
  ComponentList.Item = ComponentListItem;
6903
7384
 
6904
7385
  // lib/use-component-list.tsx
6905
- var import_jsx_runtime31 = require("react/jsx-runtime");
7386
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6906
7387
  var useComponentList = () => {
6907
7388
  const [componentList, setComponentList] = (0, import_react43.useState)();
6908
7389
  const config = useAppStore((s) => s.config);
@@ -6917,7 +7398,7 @@ var useComponentList = () => {
6917
7398
  if (category.visible === false || !category.components) {
6918
7399
  return null;
6919
7400
  }
6920
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7401
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6921
7402
  ComponentList,
6922
7403
  {
6923
7404
  id: categoryKey,
@@ -6926,7 +7407,7 @@ var useComponentList = () => {
6926
7407
  var _a2;
6927
7408
  matchedComponents.push(componentName);
6928
7409
  const componentConf = config.components[componentName] || {};
6929
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7410
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6930
7411
  ComponentList.Item,
6931
7412
  {
6932
7413
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -6946,7 +7427,7 @@ var useComponentList = () => {
6946
7427
  );
6947
7428
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
6948
7429
  _componentList.push(
6949
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7430
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6950
7431
  ComponentList,
6951
7432
  {
6952
7433
  id: "other",
@@ -6954,7 +7435,7 @@ var useComponentList = () => {
6954
7435
  children: remainingComponents.map((componentName, i) => {
6955
7436
  var _a2;
6956
7437
  const componentConf = config.components[componentName] || {};
6957
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
7438
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6958
7439
  ComponentList.Item,
6959
7440
  {
6960
7441
  name: componentName,
@@ -6977,12 +7458,19 @@ var useComponentList = () => {
6977
7458
 
6978
7459
  // components/Puck/components/Components/index.tsx
6979
7460
  var import_react44 = require("react");
6980
- var import_jsx_runtime32 = require("react/jsx-runtime");
7461
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6981
7462
  var Components = () => {
6982
7463
  const overrides = useAppStore((s) => s.overrides);
6983
7464
  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" }) });
7465
+ const Wrapper = (0, import_react44.useMemo)(() => {
7466
+ if (overrides.components) {
7467
+ console.warn(
7468
+ "The `components` override has been deprecated and renamed to `drawer`"
7469
+ );
7470
+ }
7471
+ return overrides.components || overrides.drawer || "div";
7472
+ }, [overrides]);
7473
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComponentList, { id: "all" }) });
6986
7474
  };
6987
7475
 
6988
7476
  // components/Puck/components/Preview/index.tsx
@@ -6994,7 +7482,7 @@ init_react_import();
6994
7482
  var import_react45 = require("react");
6995
7483
  var import_object_hash = __toESM(require("object-hash"));
6996
7484
  var import_react_dom3 = require("react-dom");
6997
- var import_jsx_runtime33 = require("react/jsx-runtime");
7485
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6998
7486
  var styleSelector = 'style, link[rel="stylesheet"]';
6999
7487
  var collectStyles = (doc) => {
7000
7488
  const collected = [];
@@ -7201,7 +7689,7 @@ var CopyHostStyles = ({
7201
7689
  observer.disconnect();
7202
7690
  };
7203
7691
  }, []);
7204
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
7692
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children });
7205
7693
  };
7206
7694
  var autoFrameContext = (0, import_react45.createContext)({});
7207
7695
  var useFrame = () => (0, import_react45.useContext)(autoFrameContext);
@@ -7248,7 +7736,7 @@ function AutoFrame(_a) {
7248
7736
  }
7249
7737
  }
7250
7738
  }, [frameRef, loaded, stylesLoaded]);
7251
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7739
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7252
7740
  "iframe",
7253
7741
  __spreadProps(__spreadValues({}, props), {
7254
7742
  className,
@@ -7258,7 +7746,7 @@ function AutoFrame(_a) {
7258
7746
  onLoad: () => {
7259
7747
  setLoaded(true);
7260
7748
  },
7261
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7749
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7262
7750
  CopyHostStyles,
7263
7751
  {
7264
7752
  debug,
@@ -7274,11 +7762,11 @@ var AutoFrame_default = AutoFrame;
7274
7762
 
7275
7763
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
7276
7764
  init_react_import();
7277
- var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7765
+ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7278
7766
 
7279
7767
  // 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);
7768
+ var import_jsx_runtime36 = require("react/jsx-runtime");
7769
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
7282
7770
  var useBubbleIframeEvents = (ref) => {
7283
7771
  const status = useAppStore((s) => s.status);
7284
7772
  (0, import_react46.useEffect)(() => {
@@ -7340,7 +7828,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7340
7828
  );
7341
7829
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
7342
7830
  id: "puck-root"
7343
- }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: propsWithSlots.children });
7831
+ }, propsWithSlots)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: propsWithSlots.children });
7344
7832
  },
7345
7833
  [config]
7346
7834
  );
@@ -7348,7 +7836,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
7348
7836
  const rootProps = root.props || root;
7349
7837
  const ref = (0, import_react46.useRef)(null);
7350
7838
  useBubbleIframeEvents(ref);
7351
- const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7839
+ const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7352
7840
  Page,
7353
7841
  __spreadProps(__spreadValues({}, rootProps), {
7354
7842
  puck: {
@@ -7358,28 +7846,31 @@ var Preview2 = ({ id = "puck-preview" }) => {
7358
7846
  metadata
7359
7847
  },
7360
7848
  editMode: true,
7361
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropZonePure, { zone: rootDroppableId })
7849
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZonePure, { zone: rootDroppableId })
7362
7850
  })
7363
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Render, { data: renderData, config, metadata });
7851
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Render, { data: renderData, config, metadata });
7364
7852
  (0, import_react46.useEffect)(() => {
7365
7853
  if (!iframe.enabled) {
7366
7854
  setStatus("READY");
7367
7855
  }
7368
7856
  }, [iframe.enabled]);
7369
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7857
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7370
7858
  "div",
7371
7859
  {
7372
- className: getClassName22(),
7860
+ className: getClassName23(),
7373
7861
  id,
7374
7862
  "data-puck-preview": true,
7375
- onClick: () => {
7376
- dispatch({ type: "setUi", ui: { itemSelector: null } });
7863
+ onClick: (e) => {
7864
+ const el = e.target;
7865
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
7866
+ dispatch({ type: "setUi", ui: { itemSelector: null } });
7867
+ }
7377
7868
  },
7378
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7869
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7379
7870
  AutoFrame_default,
7380
7871
  {
7381
7872
  id: "preview-frame",
7382
- className: getClassName22("frame"),
7873
+ className: getClassName23("frame"),
7383
7874
  "data-rfd-iframe": true,
7384
7875
  onReady: () => {
7385
7876
  setStatus("READY");
@@ -7388,18 +7879,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
7388
7879
  setStatus("MOUNTED");
7389
7880
  },
7390
7881
  frameRef: ref,
7391
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7882
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7392
7883
  if (Frame) {
7393
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Frame, { document: document2, children: inner });
7884
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Frame, { document: document2, children: inner });
7394
7885
  }
7395
7886
  return inner;
7396
7887
  } })
7397
7888
  }
7398
- ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7889
+ ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7399
7890
  "div",
7400
7891
  {
7401
7892
  id: "preview-frame",
7402
- className: getClassName22("frame"),
7893
+ className: getClassName23("frame"),
7403
7894
  ref,
7404
7895
  "data-puck-entry": true,
7405
7896
  children: inner
@@ -7417,7 +7908,7 @@ init_react_import();
7417
7908
 
7418
7909
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
7419
7910
  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" };
7911
+ 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
7912
 
7422
7913
  // lib/scroll-into-view.ts
7423
7914
  init_react_import();
@@ -7454,9 +7945,9 @@ var onScrollEnd = (frame, cb) => {
7454
7945
 
7455
7946
  // components/LayerTree/index.tsx
7456
7947
  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);
7948
+ var import_jsx_runtime37 = require("react/jsx-runtime");
7949
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
7950
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
7460
7951
  var Layer = ({
7461
7952
  index,
7462
7953
  itemId,
@@ -7501,7 +7992,7 @@ var Layer = ({
7501
7992
  });
7502
7993
  const componentConfig = config.components[nodeData.data.type];
7503
7994
  const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
7504
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7995
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7505
7996
  "li",
7506
7997
  {
7507
7998
  className: getClassNameLayer({
@@ -7511,7 +8002,7 @@ var Layer = ({
7511
8002
  childIsSelected
7512
8003
  }),
7513
8004
  children: [
7514
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
8005
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7515
8006
  "button",
7516
8007
  {
7517
8008
  type: "button",
@@ -7549,223 +8040,102 @@ var Layer = ({
7549
8040
  zoneStore.setState({ hoveringComponent: null });
7550
8041
  },
7551
8042
  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
8043
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8044
+ "div",
8045
+ {
8046
+ className: getClassNameLayer("chevron"),
8047
+ title: isSelected ? "Collapse" : "Expand",
8048
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDown, { size: "12" })
8049
+ }
8050
+ ),
8051
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassNameLayer("title"), children: [
8052
+ /* @__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" }) }),
8053
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassNameLayer("name"), children: label })
8054
+ ] })
8055
+ ]
8056
+ }
8057
+ ) }),
8058
+ 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))
8059
+ ]
8060
+ }
8061
+ );
8062
+ };
8063
+ var LayerTree = ({
8064
+ label: _label,
8065
+ zoneCompound
8066
+ }) => {
8067
+ const label = useAppStore((s) => {
8068
+ var _a, _b, _c, _d;
8069
+ if (_label) return _label;
8070
+ if (zoneCompound === rootDroppableId) return;
8071
+ const [componentId, slotId] = zoneCompound.split(":");
8072
+ const componentType = (_a = s.state.indexes.nodes[componentId]) == null ? void 0 : _a.data.type;
8073
+ const configForComponent = componentType && componentType !== rootAreaId ? s.config.components[componentType] : s.config.root;
8074
+ return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
7759
8075
  });
8076
+ const contentIds = useAppStore(
8077
+ (0, import_shallow6.useShallow)(
8078
+ (s) => {
8079
+ var _a, _b;
8080
+ return zoneCompound ? (_b = (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [] : [];
8081
+ }
8082
+ )
8083
+ );
8084
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
8085
+ label && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
8086
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Layers, { size: "16" }) }),
8087
+ label
8088
+ ] }),
8089
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("ul", { className: getClassName24(), children: [
8090
+ contentIds.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
8091
+ contentIds.map((itemId, i) => {
8092
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8093
+ Layer,
8094
+ {
8095
+ index: i,
8096
+ itemId,
8097
+ zoneCompound
8098
+ },
8099
+ itemId
8100
+ );
8101
+ })
8102
+ ] })
8103
+ ] });
7760
8104
  };
7761
- var getBox = function getBox2(el) {
7762
- var borderBox = el.getBoundingClientRect();
7763
- var styles2 = window.getComputedStyle(el);
7764
- return calculateBox(borderBox, styles2);
8105
+
8106
+ // components/Puck/components/Outline/index.tsx
8107
+ var import_react48 = require("react");
8108
+
8109
+ // lib/data/find-zones-for-area.ts
8110
+ init_react_import();
8111
+ var findZonesForArea = (state, area) => {
8112
+ return Object.keys(state.indexes.zones).filter(
8113
+ (zone) => zone.split(":")[0] === area
8114
+ );
8115
+ };
8116
+
8117
+ // components/Puck/components/Outline/index.tsx
8118
+ var import_shallow7 = require("zustand/react/shallow");
8119
+ var import_jsx_runtime38 = require("react/jsx-runtime");
8120
+ var Outline = () => {
8121
+ const outlineOverride = useAppStore((s) => s.overrides.outline);
8122
+ const rootZones = useAppStore(
8123
+ (0, import_shallow7.useShallow)((s) => findZonesForArea(s.state, "root"))
8124
+ );
8125
+ const Wrapper = (0, import_react48.useMemo)(() => outlineOverride || "div", [outlineOverride]);
8126
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8127
+ LayerTree,
8128
+ {
8129
+ label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
8130
+ zoneCompound
8131
+ },
8132
+ zoneCompound
8133
+ )) });
7765
8134
  };
7766
8135
 
7767
8136
  // components/Puck/components/Canvas/index.tsx
7768
- var import_react50 = require("react");
8137
+ init_react_import();
8138
+ var import_react51 = require("react");
7769
8139
 
7770
8140
  // components/ViewportControls/index.tsx
7771
8141
  init_react_import();
@@ -7773,17 +8143,17 @@ var import_react49 = require("react");
7773
8143
 
7774
8144
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7775
8145
  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" };
8146
+ 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
8147
 
7778
8148
  // components/ViewportControls/index.tsx
7779
- var import_jsx_runtime37 = require("react/jsx-runtime");
8149
+ var import_jsx_runtime39 = require("react/jsx-runtime");
7780
8150
  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 })
8151
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Smartphone, { size: 16 }),
8152
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Tablet, { size: 16 }),
8153
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Monitor, { size: 16 })
7784
8154
  };
7785
- var getClassName24 = get_class_name_factory_default("ViewportControls", styles_module_default19);
7786
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default19);
8155
+ var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
8156
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
7787
8157
  var ViewportButton = ({
7788
8158
  children,
7789
8159
  height = "auto",
@@ -7796,7 +8166,7 @@ var ViewportButton = ({
7796
8166
  (0, import_react49.useEffect)(() => {
7797
8167
  setIsActive(width === viewports.current.width);
7798
8168
  }, [width, viewports.current.width]);
7799
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8169
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7800
8170
  IconButton,
7801
8171
  {
7802
8172
  type: "button",
@@ -7806,7 +8176,7 @@ var ViewportButton = ({
7806
8176
  e.stopPropagation();
7807
8177
  onClick({ width, height });
7808
8178
  },
7809
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: getClassNameButton("inner"), children })
8179
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: getClassNameButton("inner"), children })
7810
8180
  }
7811
8181
  ) });
7812
8182
  };
@@ -7842,8 +8212,8 @@ var ViewportControls = ({
7842
8212
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
7843
8213
  [autoZoom]
7844
8214
  );
7845
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName24(), children: [
7846
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8215
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getClassName25(), children: [
8216
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7847
8217
  ViewportButton,
7848
8218
  {
7849
8219
  height: viewport.height,
@@ -7854,8 +8224,8 @@ var ViewportControls = ({
7854
8224
  },
7855
8225
  i
7856
8226
  )),
7857
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
7858
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8227
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("divider") }),
8228
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7859
8229
  IconButton,
7860
8230
  {
7861
8231
  type: "button",
@@ -7870,10 +8240,10 @@ var ViewportControls = ({
7870
8240
  )].value
7871
8241
  );
7872
8242
  },
7873
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomOut, { size: 16 })
8243
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ZoomOut, { size: 16 })
7874
8244
  }
7875
8245
  ),
7876
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8246
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7877
8247
  IconButton,
7878
8248
  {
7879
8249
  type: "button",
@@ -7888,19 +8258,19 @@ var ViewportControls = ({
7888
8258
  )].value
7889
8259
  );
7890
8260
  },
7891
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ZoomIn, { size: 16 })
8261
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ZoomIn, { size: 16 })
7892
8262
  }
7893
8263
  ),
7894
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName24("divider") }),
7895
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8264
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getClassName25("divider") }),
8265
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7896
8266
  "select",
7897
8267
  {
7898
- className: getClassName24("zoomSelect"),
8268
+ className: getClassName25("zoomSelect"),
7899
8269
  value: zoom.toString(),
7900
8270
  onChange: (e) => {
7901
8271
  onZoom(parseFloat(e.currentTarget.value));
7902
8272
  },
7903
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8273
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7904
8274
  "option",
7905
8275
  {
7906
8276
  value: option.value,
@@ -7915,44 +8285,44 @@ var ViewportControls = ({
7915
8285
 
7916
8286
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
7917
8287
  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" };
8288
+ 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
8289
 
7920
- // lib/get-zoom-config.ts
8290
+ // components/Puck/components/Canvas/index.tsx
8291
+ var import_shallow8 = require("zustand/react/shallow");
8292
+
8293
+ // lib/frame-context.tsx
7921
8294
  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
- }
8295
+ var import_react50 = require("react");
8296
+ var import_jsx_runtime40 = require("react/jsx-runtime");
8297
+ var FrameContext = (0, import_react50.createContext)(null);
8298
+ var FrameProvider = ({
8299
+ children
8300
+ }) => {
8301
+ const frameRef = (0, import_react50.useRef)(null);
8302
+ const value = (0, import_react50.useMemo)(
8303
+ () => ({
8304
+ frameRef
8305
+ }),
8306
+ []
8307
+ );
8308
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FrameContext.Provider, { value, children });
8309
+ };
8310
+ var useCanvasFrame = () => {
8311
+ const context = (0, import_react50.useContext)(FrameContext);
8312
+ if (context === null) {
8313
+ throw new Error("useCanvasFrame must be used within a FrameProvider");
7946
8314
  }
7947
- return { autoZoom, rootHeight, zoom };
8315
+ return context;
7948
8316
  };
7949
8317
 
7950
8318
  // 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);
8319
+ var import_jsx_runtime41 = require("react/jsx-runtime");
8320
+ var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
7954
8321
  var ZOOM_ON_CHANGE = true;
8322
+ var TRANSITION_DURATION = 150;
7955
8323
  var Canvas = () => {
8324
+ const { frameRef } = useCanvasFrame();
8325
+ const resetAutoZoom = useResetAutoZoom(frameRef);
7956
8326
  const {
7957
8327
  dispatch,
7958
8328
  overrides,
@@ -7972,24 +8342,32 @@ var Canvas = () => {
7972
8342
  iframe: s.iframe
7973
8343
  }))
7974
8344
  );
7975
- const { leftSideBarVisible, rightSideBarVisible, viewports } = useAppStore(
8345
+ const {
8346
+ leftSideBarVisible,
8347
+ rightSideBarVisible,
8348
+ leftSideBarWidth,
8349
+ rightSideBarWidth,
8350
+ viewports
8351
+ } = useAppStore(
7976
8352
  (0, import_shallow8.useShallow)((s) => ({
7977
8353
  leftSideBarVisible: s.state.ui.leftSideBarVisible,
7978
8354
  rightSideBarVisible: s.state.ui.rightSideBarVisible,
8355
+ leftSideBarWidth: s.state.ui.leftSideBarWidth,
8356
+ rightSideBarWidth: s.state.ui.rightSideBarWidth,
7979
8357
  viewports: s.state.ui.viewports
7980
8358
  }))
7981
8359
  );
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 });
8360
+ const [showTransition, setShowTransition] = (0, import_react51.useState)(false);
8361
+ const isResizingRef = (0, import_react51.useRef)(false);
8362
+ const defaultRender = (0, import_react51.useMemo)(() => {
8363
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
7986
8364
  return PuckDefault;
7987
8365
  }, []);
7988
- const CustomPreview = (0, import_react50.useMemo)(
8366
+ const CustomPreview = (0, import_react51.useMemo)(
7989
8367
  () => overrides.preview || defaultRender,
7990
8368
  [overrides]
7991
8369
  );
7992
- const getFrameDimensions = (0, import_react50.useCallback)(() => {
8370
+ const getFrameDimensions = (0, import_react51.useCallback)(() => {
7993
8371
  if (frameRef.current) {
7994
8372
  const frame = frameRef.current;
7995
8373
  const box = getBox(frame);
@@ -7997,74 +8375,73 @@ var Canvas = () => {
7997
8375
  }
7998
8376
  return { width: 0, height: 0 };
7999
8377
  }, [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)(() => {
8378
+ (0, import_react51.useEffect)(() => {
8379
+ resetAutoZoom();
8380
+ }, [
8381
+ frameRef,
8382
+ leftSideBarVisible,
8383
+ rightSideBarVisible,
8384
+ leftSideBarWidth,
8385
+ rightSideBarWidth,
8386
+ viewports
8387
+ ]);
8388
+ (0, import_react51.useEffect)(() => {
8019
8389
  const { height: frameHeight } = getFrameDimensions();
8020
8390
  if (viewports.current.height === "auto") {
8021
8391
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
8022
8392
  rootHeight: frameHeight / zoomConfig.zoom
8023
8393
  }));
8024
8394
  }
8025
- }, [zoomConfig.zoom]);
8026
- (0, import_react50.useEffect)(() => {
8395
+ }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
8396
+ (0, import_react51.useEffect)(() => {
8027
8397
  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
8398
  resetAutoZoom();
8036
- };
8037
- window.addEventListener("resize", cb);
8399
+ }
8400
+ }, [viewports.current.width, viewports]);
8401
+ (0, import_react51.useEffect)(() => {
8402
+ if (!frameRef.current) return;
8403
+ const resizeObserver = new ResizeObserver(() => {
8404
+ if (!isResizingRef.current) {
8405
+ resetAutoZoom();
8406
+ }
8407
+ });
8408
+ resizeObserver.observe(frameRef.current);
8038
8409
  return () => {
8039
- window.removeEventListener("resize", cb);
8410
+ resizeObserver.disconnect();
8040
8411
  };
8041
- }, []);
8042
- const [showLoader, setShowLoader] = (0, import_react50.useState)(false);
8043
- (0, import_react50.useEffect)(() => {
8412
+ }, [frameRef.current]);
8413
+ const [showLoader, setShowLoader] = (0, import_react51.useState)(false);
8414
+ (0, import_react51.useEffect)(() => {
8044
8415
  setTimeout(() => {
8045
8416
  setShowLoader(true);
8046
8417
  }, 500);
8047
8418
  }, []);
8048
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8419
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8049
8420
  "div",
8050
8421
  {
8051
- className: getClassName25({
8422
+ className: getClassName26({
8052
8423
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
8053
8424
  showLoader
8054
8425
  }),
8055
- onClick: () => dispatch({
8056
- type: "setUi",
8057
- ui: { itemSelector: null },
8058
- recordHistory: true
8059
- }),
8426
+ onClick: (e) => {
8427
+ const el = e.target;
8428
+ if (!el.hasAttribute("data-puck-component") && !el.hasAttribute("data-puck-dropzone")) {
8429
+ dispatch({
8430
+ type: "setUi",
8431
+ ui: { itemSelector: null },
8432
+ recordHistory: true
8433
+ });
8434
+ }
8435
+ },
8060
8436
  children: [
8061
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8437
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8062
8438
  ViewportControls,
8063
8439
  {
8064
8440
  autoZoom: zoomConfig.autoZoom,
8065
8441
  zoom: zoomConfig.zoom,
8066
8442
  onViewportChange: (viewport) => {
8067
8443
  setShowTransition(true);
8444
+ isResizingRef.current = true;
8068
8445
  const uiViewport = __spreadProps(__spreadValues({}, viewport), {
8069
8446
  height: viewport.height || "auto",
8070
8447
  zoom: zoomConfig.zoom
@@ -8075,41 +8452,40 @@ var Canvas = () => {
8075
8452
  };
8076
8453
  setUi(newUi);
8077
8454
  if (ZOOM_ON_CHANGE) {
8078
- resetAutoZoom(__spreadProps(__spreadValues({}, viewports), { current: uiViewport }));
8455
+ resetAutoZoom({
8456
+ viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
8457
+ });
8079
8458
  }
8080
8459
  },
8081
8460
  onZoom: (zoom) => {
8082
8461
  setShowTransition(true);
8462
+ isResizingRef.current = true;
8083
8463
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
8084
8464
  }
8085
8465
  }
8086
8466
  ) }),
8087
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getClassName25("inner"), ref: frameRef, children: [
8088
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8467
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
8468
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8089
8469
  "div",
8090
8470
  {
8091
- className: getClassName25("root"),
8471
+ className: getClassName26("root"),
8092
8472
  style: {
8093
8473
  width: iframe.enabled ? viewports.current.width : "100%",
8094
8474
  height: zoomConfig.rootHeight,
8095
8475
  transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
8096
- transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
8476
+ transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, height ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : "",
8097
8477
  overflow: iframe.enabled ? void 0 : "auto"
8098
8478
  },
8099
8479
  suppressHydrationWarning: true,
8100
8480
  id: "puck-canvas-root",
8101
8481
  onTransitionEnd: () => {
8102
- window.dispatchEvent(
8103
- new CustomEvent("viewportchange", {
8104
- bubbles: true,
8105
- cancelable: false
8106
- })
8107
- );
8482
+ setShowTransition(false);
8483
+ isResizingRef.current = false;
8108
8484
  },
8109
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Preview2, {}) })
8485
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Preview2, {}) })
8110
8486
  }
8111
8487
  ),
8112
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getClassName25("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Loader, { size: 24 }) })
8488
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Loader, { size: 24 }) })
8113
8489
  ] })
8114
8490
  ]
8115
8491
  }
@@ -8118,7 +8494,7 @@ var Canvas = () => {
8118
8494
 
8119
8495
  // lib/use-loaded-overrides.ts
8120
8496
  init_react_import();
8121
- var import_react51 = require("react");
8497
+ var import_react52 = require("react");
8122
8498
 
8123
8499
  // lib/load-overrides.ts
8124
8500
  init_react_import();
@@ -8128,8 +8504,11 @@ var loadOverrides = ({
8128
8504
  }) => {
8129
8505
  const collected = __spreadValues({}, overrides);
8130
8506
  plugins == null ? void 0 : plugins.forEach((plugin) => {
8507
+ if (!plugin.overrides) return;
8131
8508
  Object.keys(plugin.overrides).forEach((_overridesType) => {
8509
+ var _a;
8132
8510
  const overridesType = _overridesType;
8511
+ if (!((_a = plugin.overrides) == null ? void 0 : _a[overridesType])) return;
8133
8512
  if (overridesType === "fieldTypes") {
8134
8513
  const fieldTypes = plugin.overrides.fieldTypes;
8135
8514
  Object.keys(fieldTypes).forEach((fieldType) => {
@@ -8157,26 +8536,26 @@ var useLoadedOverrides = ({
8157
8536
  overrides,
8158
8537
  plugins
8159
8538
  }) => {
8160
- return (0, import_react51.useMemo)(() => {
8539
+ return (0, import_react52.useMemo)(() => {
8161
8540
  return loadOverrides({ overrides, plugins });
8162
8541
  }, [plugins, overrides]);
8163
8542
  };
8164
8543
 
8165
8544
  // components/DefaultOverride/index.tsx
8166
8545
  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 });
8546
+ var import_jsx_runtime42 = require("react/jsx-runtime");
8547
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children });
8169
8548
 
8170
8549
  // lib/use-inject-css.ts
8171
8550
  init_react_import();
8172
- var import_react52 = require("react");
8551
+ var import_react53 = require("react");
8173
8552
  var styles = ``;
8174
8553
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
8175
- const [el, setEl] = (0, import_react52.useState)();
8176
- (0, import_react52.useEffect)(() => {
8554
+ const [el, setEl] = (0, import_react53.useState)();
8555
+ (0, import_react53.useEffect)(() => {
8177
8556
  setEl(document.createElement("style"));
8178
8557
  }, []);
8179
- (0, import_react52.useEffect)(() => {
8558
+ (0, import_react53.useEffect)(() => {
8180
8559
  var _a;
8181
8560
  if (!el || typeof window === "undefined") {
8182
8561
  return;
@@ -8196,10 +8575,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
8196
8575
 
8197
8576
  // lib/use-preview-mode-hotkeys.ts
8198
8577
  init_react_import();
8199
- var import_react53 = require("react");
8578
+ var import_react54 = require("react");
8200
8579
  var usePreviewModeHotkeys = () => {
8201
8580
  const appStore = useAppStoreApi();
8202
- const toggleInteractive = (0, import_react53.useCallback)(() => {
8581
+ const toggleInteractive = (0, import_react54.useCallback)(() => {
8203
8582
  const dispatch = appStore.getState().dispatch;
8204
8583
  dispatch({
8205
8584
  type: "setUi",
@@ -8214,7 +8593,7 @@ var usePreviewModeHotkeys = () => {
8214
8593
 
8215
8594
  // lib/use-puck.ts
8216
8595
  init_react_import();
8217
- var import_react54 = require("react");
8596
+ var import_react55 = require("react");
8218
8597
  var import_zustand6 = require("zustand");
8219
8598
  var generateUsePuck = (store) => {
8220
8599
  const history = {
@@ -8247,7 +8626,7 @@ var generateUsePuck = (store) => {
8247
8626
  };
8248
8627
  return storeData;
8249
8628
  };
8250
- var UsePuckStoreContext = (0, import_react54.createContext)(
8629
+ var UsePuckStoreContext = (0, import_react55.createContext)(
8251
8630
  null
8252
8631
  );
8253
8632
  var convertToPickedStore = (store) => {
@@ -8261,12 +8640,12 @@ var convertToPickedStore = (store) => {
8261
8640
  };
8262
8641
  };
8263
8642
  var useRegisterUsePuckStore = (appStore) => {
8264
- const [usePuckStore] = (0, import_react54.useState)(
8643
+ const [usePuckStore] = (0, import_react55.useState)(
8265
8644
  () => (0, import_zustand6.createStore)(
8266
8645
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
8267
8646
  )
8268
8647
  );
8269
- (0, import_react54.useEffect)(() => {
8648
+ (0, import_react55.useEffect)(() => {
8270
8649
  return appStore.subscribe(
8271
8650
  (store) => convertToPickedStore(store),
8272
8651
  (pickedStore) => {
@@ -8278,7 +8657,7 @@ var useRegisterUsePuckStore = (appStore) => {
8278
8657
  };
8279
8658
  function createUsePuck() {
8280
8659
  return function usePuck2(selector) {
8281
- const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
8660
+ const usePuckApi = (0, import_react55.useContext)(UsePuckStoreContext);
8282
8661
  if (!usePuckApi) {
8283
8662
  throw new Error("usePuck must be used inside <Puck>.");
8284
8663
  }
@@ -8290,7 +8669,7 @@ function createUsePuck() {
8290
8669
  };
8291
8670
  }
8292
8671
  function usePuck() {
8293
- (0, import_react54.useEffect)(() => {
8672
+ (0, import_react55.useEffect)(() => {
8294
8673
  console.warn(
8295
8674
  "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
8675
  );
@@ -8298,7 +8677,7 @@ function usePuck() {
8298
8677
  return createUsePuck()((s) => s);
8299
8678
  }
8300
8679
  function useGetPuck() {
8301
- const usePuckApi = (0, import_react54.useContext)(UsePuckStoreContext);
8680
+ const usePuckApi = (0, import_react55.useContext)(UsePuckStoreContext);
8302
8681
  if (!usePuckApi) {
8303
8682
  throw new Error("usePuckGet must be used inside <Puck>.");
8304
8683
  }
@@ -8310,18 +8689,18 @@ var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
8310
8689
 
8311
8690
  // components/Puck/components/Header/index.tsx
8312
8691
  init_react_import();
8313
- var import_react55 = require("react");
8692
+ var import_react56 = require("react");
8314
8693
 
8315
8694
  // components/MenuBar/index.tsx
8316
8695
  init_react_import();
8317
8696
 
8318
8697
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
8319
8698
  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" };
8699
+ 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
8700
 
8322
8701
  // 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);
8702
+ var import_jsx_runtime43 = require("react/jsx-runtime");
8703
+ var getClassName27 = get_class_name_factory_default("MenuBar", styles_module_default22);
8325
8704
  function MenuBar({
8326
8705
  menuOpen = false,
8327
8706
  renderHeaderActions,
@@ -8331,10 +8710,10 @@ function MenuBar({
8331
8710
  const forward = useAppStore((s) => s.history.forward);
8332
8711
  const hasFuture = useAppStore((s) => s.history.hasFuture());
8333
8712
  const hasPast = useAppStore((s) => s.history.hasPast());
8334
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8713
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8335
8714
  "div",
8336
8715
  {
8337
- className: getClassName26({ menuOpen }),
8716
+ className: getClassName27({ menuOpen }),
8338
8717
  onClick: (event) => {
8339
8718
  var _a;
8340
8719
  const element = event.target;
@@ -8345,30 +8724,30 @@ function MenuBar({
8345
8724
  setMenuOpen(false);
8346
8725
  }
8347
8726
  },
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)(
8727
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName27("inner"), children: [
8728
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getClassName27("history"), children: [
8729
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8351
8730
  IconButton,
8352
8731
  {
8353
8732
  type: "button",
8354
8733
  title: "undo",
8355
8734
  disabled: !hasPast,
8356
8735
  onClick: back,
8357
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Undo2, { size: 21 })
8736
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Undo2, { size: 21 })
8358
8737
  }
8359
8738
  ),
8360
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8739
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
8361
8740
  IconButton,
8362
8741
  {
8363
8742
  type: "button",
8364
8743
  title: "redo",
8365
8744
  disabled: !hasFuture,
8366
8745
  onClick: forward,
8367
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Redo2, { size: 21 })
8746
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Redo2, { size: 21 })
8368
8747
  }
8369
8748
  )
8370
8749
  ] }),
8371
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children: renderHeaderActions && renderHeaderActions() })
8750
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children: renderHeaderActions && renderHeaderActions() })
8372
8751
  ] })
8373
8752
  }
8374
8753
  );
@@ -8376,11 +8755,11 @@ function MenuBar({
8376
8755
 
8377
8756
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
8378
8757
  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" };
8758
+ 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
8759
 
8381
8760
  // 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);
8761
+ var import_jsx_runtime44 = require("react/jsx-runtime");
8762
+ var getClassName28 = get_class_name_factory_default("PuckHeader", styles_module_default23);
8384
8763
  var HeaderInner = () => {
8385
8764
  const {
8386
8765
  onPublish,
@@ -8392,7 +8771,7 @@ var HeaderInner = () => {
8392
8771
  } = usePropsContext();
8393
8772
  const dispatch = useAppStore((s) => s.dispatch);
8394
8773
  const appStore = useAppStoreApi();
8395
- const defaultHeaderRender = (0, import_react55.useMemo)(() => {
8774
+ const defaultHeaderRender = (0, import_react56.useMemo)(() => {
8396
8775
  if (renderHeader) {
8397
8776
  console.warn(
8398
8777
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -8401,13 +8780,13 @@ var HeaderInner = () => {
8401
8780
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
8402
8781
  const Comp = renderHeader;
8403
8782
  const appState = useAppStore((s) => s.state);
8404
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8783
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
8405
8784
  };
8406
8785
  return RenderHeader;
8407
8786
  }
8408
8787
  return DefaultOverride;
8409
8788
  }, [renderHeader]);
8410
- const defaultHeaderActionsRender = (0, import_react55.useMemo)(() => {
8789
+ const defaultHeaderActionsRender = (0, import_react56.useMemo)(() => {
8411
8790
  if (renderHeaderActions) {
8412
8791
  console.warn(
8413
8792
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
@@ -8415,19 +8794,19 @@ var HeaderInner = () => {
8415
8794
  const RenderHeader = (props) => {
8416
8795
  const Comp = renderHeaderActions;
8417
8796
  const appState = useAppStore((s) => s.state);
8418
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8797
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
8419
8798
  };
8420
8799
  return RenderHeader;
8421
8800
  }
8422
8801
  return DefaultOverride;
8423
- }, [renderHeader]);
8802
+ }, [renderHeaderActions]);
8424
8803
  const CustomHeader = useAppStore(
8425
8804
  (s) => s.overrides.header || defaultHeaderRender
8426
8805
  );
8427
8806
  const CustomHeaderActions = useAppStore(
8428
8807
  (s) => s.overrides.headerActions || defaultHeaderActionsRender
8429
8808
  );
8430
- const [menuOpen, setMenuOpen] = (0, import_react55.useState)(false);
8809
+ const [menuOpen, setMenuOpen] = (0, import_react56.useState)(false);
8431
8810
  const rootTitle = useAppStore((s) => {
8432
8811
  var _a, _b;
8433
8812
  const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
@@ -8437,7 +8816,7 @@ var HeaderInner = () => {
8437
8816
  const rightSideBarVisible = useAppStore(
8438
8817
  (s) => s.state.ui.rightSideBarVisible
8439
8818
  );
8440
- const toggleSidebars = (0, import_react55.useCallback)(
8819
+ const toggleSidebars = (0, import_react56.useCallback)(
8441
8820
  (sidebar) => {
8442
8821
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
8443
8822
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -8451,27 +8830,27 @@ var HeaderInner = () => {
8451
8830
  },
8452
8831
  [dispatch, leftSideBarVisible, rightSideBarVisible]
8453
8832
  );
8454
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8833
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8455
8834
  CustomHeader,
8456
8835
  {
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)(
8836
+ 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
8837
  Button,
8459
8838
  {
8460
8839
  onClick: () => {
8461
8840
  const data = appStore.getState().state.data;
8462
8841
  onPublish && onPublish(data);
8463
8842
  },
8464
- icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
8843
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Globe, { size: "14px" }),
8465
8844
  children: "Publish"
8466
8845
  }
8467
8846
  ) }) }),
8468
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8847
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8469
8848
  "header",
8470
8849
  {
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)(
8850
+ className: getClassName28({ leftSideBarVisible, rightSideBarVisible }),
8851
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("inner"), children: [
8852
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("toggle"), children: [
8853
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8475
8854
  IconButton,
8476
8855
  {
8477
8856
  type: "button",
@@ -8479,10 +8858,10 @@ var HeaderInner = () => {
8479
8858
  toggleSidebars("left");
8480
8859
  },
8481
8860
  title: "Toggle left sidebar",
8482
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelLeft, { focusable: "false" })
8861
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PanelLeft, { focusable: "false" })
8483
8862
  }
8484
8863
  ) }),
8485
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8864
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8486
8865
  IconButton,
8487
8866
  {
8488
8867
  type: "button",
@@ -8490,19 +8869,19 @@ var HeaderInner = () => {
8490
8869
  toggleSidebars("right");
8491
8870
  },
8492
8871
  title: "Toggle right sidebar",
8493
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { focusable: "false" })
8872
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PanelRight, { focusable: "false" })
8494
8873
  }
8495
8874
  ) })
8496
8875
  ] }),
8497
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getClassName27("title"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Heading, { rank: "2", size: "xs", children: [
8876
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("title"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Heading, { rank: "2", size: "xs", children: [
8498
8877
  headerTitle || rootTitle || "Page",
8499
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
8878
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
8500
8879
  " ",
8501
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("code", { className: getClassName27("path"), children: headerPath })
8880
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("code", { className: getClassName28("path"), children: headerPath })
8502
8881
  ] })
8503
8882
  ] }) }),
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)(
8883
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getClassName28("tools"), children: [
8884
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: getClassName28("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8506
8885
  IconButton,
8507
8886
  {
8508
8887
  type: "button",
@@ -8510,23 +8889,23 @@ var HeaderInner = () => {
8510
8889
  return setMenuOpen(!menuOpen);
8511
8890
  },
8512
8891
  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" })
8892
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { focusable: "false" })
8514
8893
  }
8515
8894
  ) }),
8516
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8895
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8517
8896
  MenuBar,
8518
8897
  {
8519
8898
  dispatch,
8520
8899
  onPublish,
8521
8900
  menuOpen,
8522
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8901
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8523
8902
  Button,
8524
8903
  {
8525
8904
  onClick: () => {
8526
8905
  const data = appStore.getState().state.data;
8527
8906
  onPublish && onPublish(data);
8528
8907
  },
8529
- icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Globe, { size: "14px" }),
8908
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Globe, { size: "14px" }),
8530
8909
  children: "Publish"
8531
8910
  }
8532
8911
  ) }),
@@ -8540,12 +8919,204 @@ var HeaderInner = () => {
8540
8919
  }
8541
8920
  );
8542
8921
  };
8543
- var Header = (0, import_react55.memo)(HeaderInner);
8922
+ var Header = (0, import_react56.memo)(HeaderInner);
8923
+
8924
+ // components/Puck/components/Sidebar/index.tsx
8925
+ init_react_import();
8926
+
8927
+ // components/Puck/components/ResizeHandle/index.tsx
8928
+ init_react_import();
8929
+ var import_react57 = require("react");
8930
+
8931
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
8932
+ init_react_import();
8933
+ var styles_module_default24 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
8934
+
8935
+ // components/Puck/components/ResizeHandle/index.tsx
8936
+ var import_jsx_runtime45 = require("react/jsx-runtime");
8937
+ var getClassName29 = get_class_name_factory_default("ResizeHandle", styles_module_default24);
8938
+ var ResizeHandle = ({
8939
+ position,
8940
+ sidebarRef,
8941
+ onResize,
8942
+ onResizeEnd
8943
+ }) => {
8944
+ const { frameRef } = useCanvasFrame();
8945
+ const resetAutoZoom = useResetAutoZoom(frameRef);
8946
+ const handleRef = (0, import_react57.useRef)(null);
8947
+ const isDragging = (0, import_react57.useRef)(false);
8948
+ const startX = (0, import_react57.useRef)(0);
8949
+ const startWidth = (0, import_react57.useRef)(0);
8950
+ const handleMouseMove = (0, import_react57.useCallback)(
8951
+ (e) => {
8952
+ if (!isDragging.current) return;
8953
+ const delta = e.clientX - startX.current;
8954
+ const newWidth = position === "left" ? startWidth.current + delta : startWidth.current - delta;
8955
+ const width = Math.max(192, newWidth);
8956
+ onResize(width);
8957
+ e.preventDefault();
8958
+ },
8959
+ [onResize, position]
8960
+ );
8961
+ const handleMouseUp = (0, import_react57.useCallback)(() => {
8962
+ var _a;
8963
+ if (!isDragging.current) return;
8964
+ isDragging.current = false;
8965
+ document.body.style.cursor = "";
8966
+ document.body.style.userSelect = "";
8967
+ const overlay = document.getElementById("resize-overlay");
8968
+ if (overlay) {
8969
+ document.body.removeChild(overlay);
8970
+ }
8971
+ document.removeEventListener("mousemove", handleMouseMove);
8972
+ document.removeEventListener("mouseup", handleMouseUp);
8973
+ const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8974
+ onResizeEnd(finalWidth);
8975
+ resetAutoZoom();
8976
+ }, [onResizeEnd]);
8977
+ const handleMouseDown = (0, import_react57.useCallback)(
8978
+ (e) => {
8979
+ var _a;
8980
+ isDragging.current = true;
8981
+ startX.current = e.clientX;
8982
+ startWidth.current = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
8983
+ document.body.style.cursor = "col-resize";
8984
+ document.body.style.userSelect = "none";
8985
+ const overlay = document.createElement("div");
8986
+ overlay.id = "resize-overlay";
8987
+ overlay.setAttribute("data-resize-overlay", "");
8988
+ document.body.appendChild(overlay);
8989
+ document.addEventListener("mousemove", handleMouseMove);
8990
+ document.addEventListener("mouseup", handleMouseUp);
8991
+ e.preventDefault();
8992
+ },
8993
+ [position, handleMouseMove, handleMouseUp]
8994
+ );
8995
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
8996
+ "div",
8997
+ {
8998
+ ref: handleRef,
8999
+ className: getClassName29({ [position]: true }),
9000
+ onMouseDown: handleMouseDown
9001
+ }
9002
+ );
9003
+ };
9004
+
9005
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
9006
+ init_react_import();
9007
+ 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" };
9008
+
9009
+ // components/Puck/components/Sidebar/index.tsx
9010
+ var import_jsx_runtime46 = require("react/jsx-runtime");
9011
+ var getClassName30 = get_class_name_factory_default("Sidebar", styles_module_default25);
9012
+ var Sidebar = ({
9013
+ position,
9014
+ sidebarRef,
9015
+ isVisible,
9016
+ onResize,
9017
+ onResizeEnd,
9018
+ children
9019
+ }) => {
9020
+ if (!isVisible) return null;
9021
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
9022
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { ref: sidebarRef, className: getClassName30({ [position]: true }), children }),
9023
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `${getClassName30("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9024
+ ResizeHandle,
9025
+ {
9026
+ position,
9027
+ sidebarRef,
9028
+ onResize,
9029
+ onResizeEnd
9030
+ }
9031
+ ) })
9032
+ ] });
9033
+ };
9034
+
9035
+ // lib/use-sidebar-resize.ts
9036
+ init_react_import();
9037
+ var import_react58 = require("react");
9038
+ function useSidebarResize(position, dispatch) {
9039
+ const [width, setWidth] = (0, import_react58.useState)(null);
9040
+ const sidebarRef = (0, import_react58.useRef)(null);
9041
+ const storeWidth = useAppStore(
9042
+ (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
9043
+ );
9044
+ (0, import_react58.useEffect)(() => {
9045
+ if (typeof window !== "undefined" && !storeWidth) {
9046
+ try {
9047
+ const savedWidths = localStorage.getItem("puck-sidebar-widths");
9048
+ if (savedWidths) {
9049
+ const widths = JSON.parse(savedWidths);
9050
+ const savedWidth = widths[position];
9051
+ const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
9052
+ if (savedWidth) {
9053
+ dispatch({
9054
+ type: "setUi",
9055
+ ui: {
9056
+ [key]: savedWidth
9057
+ }
9058
+ });
9059
+ }
9060
+ }
9061
+ } catch (error) {
9062
+ console.error(
9063
+ `Failed to load ${position} sidebar width from localStorage`,
9064
+ error
9065
+ );
9066
+ }
9067
+ }
9068
+ }, [dispatch, position, storeWidth]);
9069
+ (0, import_react58.useEffect)(() => {
9070
+ if (storeWidth !== void 0) {
9071
+ setWidth(storeWidth);
9072
+ }
9073
+ }, [storeWidth]);
9074
+ const handleResizeEnd = (0, import_react58.useCallback)(
9075
+ (width2) => {
9076
+ dispatch({
9077
+ type: "setUi",
9078
+ ui: {
9079
+ [position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: width2
9080
+ }
9081
+ });
9082
+ let widths = {};
9083
+ try {
9084
+ const savedWidths = localStorage.getItem("puck-sidebar-widths");
9085
+ widths = savedWidths ? JSON.parse(savedWidths) : {};
9086
+ } catch (error) {
9087
+ console.error(
9088
+ `Failed to save ${position} sidebar width to localStorage`,
9089
+ error
9090
+ );
9091
+ } finally {
9092
+ localStorage.setItem(
9093
+ "puck-sidebar-widths",
9094
+ JSON.stringify(__spreadProps(__spreadValues({}, widths), {
9095
+ [position]: width2
9096
+ }))
9097
+ );
9098
+ }
9099
+ window.dispatchEvent(
9100
+ new CustomEvent("viewportchange", {
9101
+ bubbles: true,
9102
+ cancelable: false
9103
+ })
9104
+ );
9105
+ },
9106
+ [dispatch, position]
9107
+ );
9108
+ return {
9109
+ width,
9110
+ setWidth,
9111
+ sidebarRef,
9112
+ handleResizeEnd
9113
+ };
9114
+ }
8544
9115
 
8545
9116
  // 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);
9117
+ var import_jsx_runtime47 = require("react/jsx-runtime");
9118
+ var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
9119
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
8549
9120
  var FieldSideBar = () => {
8550
9121
  const title = useAppStore(
8551
9122
  (s) => {
@@ -8553,13 +9124,13 @@ var FieldSideBar = () => {
8553
9124
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
8554
9125
  }
8555
9126
  );
8556
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Fields, {}) });
9127
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Fields, {}) });
8557
9128
  };
8558
- var propsContext = (0, import_react56.createContext)({});
9129
+ var propsContext = (0, import_react59.createContext)({});
8559
9130
  function PropsProvider(props) {
8560
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(propsContext.Provider, { value: props, children: props.children });
9131
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(propsContext.Provider, { value: props, children: props.children });
8561
9132
  }
8562
- var usePropsContext = () => (0, import_react56.useContext)(propsContext);
9133
+ var usePropsContext = () => (0, import_react59.useContext)(propsContext);
8563
9134
  function PuckProvider({ children }) {
8564
9135
  const {
8565
9136
  config,
@@ -8573,16 +9144,17 @@ function PuckProvider({ children }) {
8573
9144
  iframe: _iframe,
8574
9145
  initialHistory: _initialHistory,
8575
9146
  metadata,
8576
- onAction
9147
+ onAction,
9148
+ fieldTransforms
8577
9149
  } = usePropsContext();
8578
- const iframe = (0, import_react56.useMemo)(
9150
+ const iframe = (0, import_react59.useMemo)(
8579
9151
  () => __spreadValues({
8580
9152
  enabled: true,
8581
9153
  waitForStyles: true
8582
9154
  }, _iframe),
8583
9155
  [_iframe]
8584
9156
  );
8585
- const [generatedAppState] = (0, import_react56.useState)(() => {
9157
+ const [generatedAppState] = (0, import_react59.useState)(() => {
8586
9158
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8587
9159
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
8588
9160
  let clientUiState = {};
@@ -8611,7 +9183,7 @@ function PuckProvider({ children }) {
8611
9183
  }
8612
9184
  }
8613
9185
  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(
9186
+ console.warn(
8615
9187
  "Warning: Defining props on `root` is deprecated. Please use `root.props`, or republish this page to migrate automatically."
8616
9188
  );
8617
9189
  }
@@ -8642,7 +9214,7 @@ function PuckProvider({ children }) {
8642
9214
  return walkAppState(newAppState, config);
8643
9215
  });
8644
9216
  const { appendData = true } = _initialHistory || {};
8645
- const [blendedHistories] = (0, import_react56.useState)(
9217
+ const [blendedHistories] = (0, import_react59.useState)(
8646
9218
  [
8647
9219
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
8648
9220
  ...appendData ? [{ state: generatedAppState }] : []
@@ -8662,7 +9234,15 @@ function PuckProvider({ children }) {
8662
9234
  overrides,
8663
9235
  plugins
8664
9236
  });
8665
- const generateAppStore = (0, import_react56.useCallback)(
9237
+ const loadedFieldTransforms = (0, import_react59.useMemo)(() => {
9238
+ const _plugins = plugins || [];
9239
+ const pluginFieldTransforms = _plugins.reduce(
9240
+ (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
9241
+ {}
9242
+ );
9243
+ return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
9244
+ }, [fieldTransforms, plugins]);
9245
+ const generateAppStore = (0, import_react59.useCallback)(
8666
9246
  (state) => {
8667
9247
  return {
8668
9248
  state,
@@ -8672,7 +9252,8 @@ function PuckProvider({ children }) {
8672
9252
  viewports,
8673
9253
  iframe,
8674
9254
  onAction,
8675
- metadata
9255
+ metadata,
9256
+ fieldTransforms: loadedFieldTransforms
8676
9257
  };
8677
9258
  },
8678
9259
  [
@@ -8683,18 +9264,19 @@ function PuckProvider({ children }) {
8683
9264
  viewports,
8684
9265
  iframe,
8685
9266
  onAction,
8686
- metadata
9267
+ metadata,
9268
+ loadedFieldTransforms
8687
9269
  ]
8688
9270
  );
8689
- const [appStore] = (0, import_react56.useState)(
9271
+ const [appStore] = (0, import_react59.useState)(
8690
9272
  () => createAppStore(generateAppStore(initialAppState))
8691
9273
  );
8692
- (0, import_react56.useEffect)(() => {
9274
+ (0, import_react59.useEffect)(() => {
8693
9275
  if (process.env.NODE_ENV !== "production") {
8694
9276
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
8695
9277
  }
8696
9278
  }, [appStore]);
8697
- (0, import_react56.useEffect)(() => {
9279
+ (0, import_react59.useEffect)(() => {
8698
9280
  const state = appStore.getState().state;
8699
9281
  appStore.setState(__spreadValues({}, generateAppStore(state)));
8700
9282
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -8703,8 +9285,8 @@ function PuckProvider({ children }) {
8703
9285
  index: initialHistoryIndex,
8704
9286
  initialAppState
8705
9287
  });
8706
- const previousData = (0, import_react56.useRef)(null);
8707
- (0, import_react56.useEffect)(() => {
9288
+ const previousData = (0, import_react59.useRef)(null);
9289
+ (0, import_react59.useEffect)(() => {
8708
9290
  appStore.subscribe(
8709
9291
  (s) => s.state.data,
8710
9292
  (data) => {
@@ -8718,11 +9300,11 @@ function PuckProvider({ children }) {
8718
9300
  }, []);
8719
9301
  useRegisterPermissionsSlice(appStore, permissions);
8720
9302
  const uPuckStore = useRegisterUsePuckStore(appStore);
8721
- (0, import_react56.useEffect)(() => {
9303
+ (0, import_react59.useEffect)(() => {
8722
9304
  const { resolveAndCommitData } = appStore.getState();
8723
9305
  resolveAndCommitData();
8724
9306
  }, []);
8725
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
9307
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
8726
9308
  }
8727
9309
  function PuckLayout({ children }) {
8728
9310
  const {
@@ -8730,7 +9312,7 @@ function PuckLayout({ children }) {
8730
9312
  dnd,
8731
9313
  initialHistory: _initialHistory
8732
9314
  } = usePropsContext();
8733
- const iframe = (0, import_react56.useMemo)(
9315
+ const iframe = (0, import_react59.useMemo)(
8734
9316
  () => __spreadValues({
8735
9317
  enabled: true,
8736
9318
  waitForStyles: true
@@ -8738,12 +9320,24 @@ function PuckLayout({ children }) {
8738
9320
  [_iframe]
8739
9321
  );
8740
9322
  useInjectGlobalCss(iframe.enabled);
9323
+ const dispatch = useAppStore((s) => s.dispatch);
8741
9324
  const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
8742
9325
  const rightSideBarVisible = useAppStore(
8743
9326
  (s) => s.state.ui.rightSideBarVisible
8744
9327
  );
8745
- const dispatch = useAppStore((s) => s.dispatch);
8746
- (0, import_react56.useEffect)(() => {
9328
+ const {
9329
+ width: leftWidth,
9330
+ setWidth: setLeftWidth,
9331
+ sidebarRef: leftSidebarRef,
9332
+ handleResizeEnd: handleLeftSidebarResizeEnd
9333
+ } = useSidebarResize("left", dispatch);
9334
+ const {
9335
+ width: rightWidth,
9336
+ setWidth: setRightWidth,
9337
+ sidebarRef: rightSidebarRef,
9338
+ handleResizeEnd: handleRightSidebarResizeEnd
9339
+ } = useSidebarResize("right", dispatch);
9340
+ (0, import_react59.useEffect)(() => {
8747
9341
  if (!window.matchMedia("(min-width: 638px)").matches) {
8748
9342
  dispatch({
8749
9343
  type: "setUi",
@@ -8767,17 +9361,17 @@ function PuckLayout({ children }) {
8767
9361
  };
8768
9362
  }, []);
8769
9363
  const overrides = useAppStore((s) => s.overrides);
8770
- const CustomPuck = (0, import_react56.useMemo)(
9364
+ const CustomPuck = (0, import_react59.useMemo)(
8771
9365
  () => overrides.puck || DefaultOverride,
8772
9366
  [overrides]
8773
9367
  );
8774
- const [mounted, setMounted] = (0, import_react56.useState)(false);
8775
- (0, import_react56.useEffect)(() => {
9368
+ const [mounted, setMounted] = (0, import_react59.useState)(false);
9369
+ (0, import_react59.useEffect)(() => {
8776
9370
  setMounted(true);
8777
9371
  }, []);
8778
9372
  const ready = useAppStore((s) => s.status === "READY");
8779
9373
  useMonitorHotkeys();
8780
- (0, import_react56.useEffect)(() => {
9374
+ (0, import_react59.useEffect)(() => {
8781
9375
  if (ready && iframe.enabled) {
8782
9376
  const frameDoc = getFrame();
8783
9377
  if (frameDoc) {
@@ -8786,8 +9380,15 @@ function PuckLayout({ children }) {
8786
9380
  }
8787
9381
  }, [ready, iframe.enabled]);
8788
9382
  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)(
9383
+ const layoutOptions = {};
9384
+ if (leftWidth) {
9385
+ layoutOptions["--puck-user-left-side-bar-width"] = `${leftWidth}px`;
9386
+ }
9387
+ if (rightWidth) {
9388
+ layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
9389
+ }
9390
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `Puck ${getClassName31()}`, children: [
9391
+ /* @__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
9392
  "div",
8792
9393
  {
8793
9394
  className: getLayoutClassName({
@@ -8795,22 +9396,49 @@ function PuckLayout({ children }) {
8795
9396
  mounted,
8796
9397
  rightSideBarVisible
8797
9398
  }),
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
- ] })
9399
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9400
+ "div",
9401
+ {
9402
+ className: getLayoutClassName("inner"),
9403
+ style: layoutOptions,
9404
+ children: [
9405
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header, {}),
9406
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
9407
+ Sidebar,
9408
+ {
9409
+ position: "left",
9410
+ sidebarRef: leftSidebarRef,
9411
+ isVisible: leftSideBarVisible,
9412
+ onResize: setLeftWidth,
9413
+ onResizeEnd: handleLeftSidebarResizeEnd,
9414
+ children: [
9415
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Components, {}) }),
9416
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Outline, {}) })
9417
+ ]
9418
+ }
9419
+ ),
9420
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Canvas, {}),
9421
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9422
+ Sidebar,
9423
+ {
9424
+ position: "right",
9425
+ sidebarRef: rightSidebarRef,
9426
+ isVisible: rightSideBarVisible,
9427
+ onResize: setRightWidth,
9428
+ onResizeEnd: handleRightSidebarResizeEnd,
9429
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldSideBar, {})
9430
+ }
9431
+ )
9432
+ ]
9433
+ }
9434
+ )
8807
9435
  }
8808
- ) }) }),
8809
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: "puck-portal-root", className: getClassName28("portal") })
9436
+ ) }) }) }),
9437
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { id: "puck-portal-root", className: getClassName31("portal") })
8810
9438
  ] });
8811
9439
  }
8812
9440
  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)) })) }));
9441
+ 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
9442
  }
8815
9443
  Puck.Components = Components;
8816
9444
  Puck.Fields = Fields;
@@ -9009,9 +9637,9 @@ function resolveAllData(_0, _1) {
9009
9637
  },
9010
9638
  "force"
9011
9639
  )).node;
9012
- const resolvedDeep = yield mapSlots(
9640
+ const resolvedDeep = yield mapFields(
9013
9641
  resolved,
9014
- processContent,
9642
+ { slot: ({ value }) => processContent(value) },
9015
9643
  config
9016
9644
  );
9017
9645
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
@@ -9057,8 +9685,10 @@ function resolveAllData(_0, _1) {
9057
9685
  createUsePuck,
9058
9686
  migrate,
9059
9687
  overrideKeys,
9688
+ registerOverlayPortal,
9060
9689
  renderContext,
9061
9690
  resolveAllData,
9691
+ setDeep,
9062
9692
  transformProps,
9063
9693
  useGetPuck,
9064
9694
  usePuck,