@measured/puck 0.18.3-canary.78bb71d → 0.18.3-canary.98ad734

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.
package/dist/index.mjs CHANGED
@@ -8,15 +8,15 @@ import {
8
8
  __spreadProps,
9
9
  __spreadValues,
10
10
  __toESM,
11
- defaultData,
12
11
  getChanged,
13
12
  init_react_import,
14
13
  resolveAllData,
15
14
  resolveComponentData,
16
15
  resolveRootData,
17
16
  rootDroppableId,
18
- setupZone
19
- } from "./chunk-CHWFBYEM.mjs";
17
+ setupZone,
18
+ transformProps
19
+ } from "./chunk-4QIG6FWS.mjs";
20
20
 
21
21
  // ../../node_modules/classnames/index.js
22
22
  var require_classnames = __commonJS({
@@ -213,7 +213,7 @@ import {
213
213
  useContext as useContext3,
214
214
  useEffect as useEffect9,
215
215
  useMemo as useMemo5,
216
- useState as useState12
216
+ useState as useState11
217
217
  } from "react";
218
218
 
219
219
  // components/AutoField/fields/index.tsx
@@ -674,7 +674,7 @@ var IconButton = ({
674
674
  };
675
675
 
676
676
  // components/AutoField/fields/ArrayField/index.tsx
677
- import { useCallback as useCallback3, useEffect as useEffect4, useRef, useState as useState7 } from "react";
677
+ import { useCallback as useCallback3, useEffect as useEffect4, useState as useState6 } from "react";
678
678
 
679
679
  // components/DragIcon/index.tsx
680
680
  init_react_import();
@@ -1084,7 +1084,6 @@ function useAppContext() {
1084
1084
  // components/Sortable/index.tsx
1085
1085
  init_react_import();
1086
1086
  import { DragDropProvider } from "@dnd-kit/react";
1087
- import { useState as useState6 } from "react";
1088
1087
 
1089
1088
  // lib/dnd/dnd-kit/safe.ts
1090
1089
  init_react_import();
@@ -1760,16 +1759,13 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
1760
1759
  };
1761
1760
 
1762
1761
  // components/Sortable/index.tsx
1763
- import { RestrictToElement } from "@dnd-kit/dom/modifiers";
1764
1762
  import { jsx as jsx6 } from "react/jsx-runtime";
1765
1763
  var SortableProvider = ({
1766
- container,
1767
1764
  children,
1768
1765
  onDragStart,
1769
1766
  onDragEnd,
1770
1767
  onMove
1771
1768
  }) => {
1772
- const [move, setMove] = useState6({ source: -1, target: -1 });
1773
1769
  const sensors = useSensors({
1774
1770
  mouse: { distance: { value: 5 } }
1775
1771
  });
@@ -1777,16 +1773,13 @@ var SortableProvider = ({
1777
1773
  DragDropProvider,
1778
1774
  {
1779
1775
  sensors,
1780
- modifiers: [
1781
- RestrictToElement.configure({
1782
- element() {
1783
- return container.current;
1784
- }
1785
- })
1786
- ],
1787
- onDragStart,
1776
+ onDragStart: (event) => {
1777
+ var _a, _b;
1778
+ return onDragStart((_b = (_a = event.operation.source) == null ? void 0 : _a.id.toString()) != null ? _b : "");
1779
+ },
1788
1780
  onDragOver: (event, manager) => {
1789
1781
  var _a, _b;
1782
+ event.preventDefault();
1790
1783
  const { operation } = event;
1791
1784
  const { source, target } = operation;
1792
1785
  if (!source || !target) return;
@@ -1794,14 +1787,14 @@ var SortableProvider = ({
1794
1787
  let targetIndex = target.data.index;
1795
1788
  const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
1796
1789
  if (sourceIndex !== targetIndex && source.id !== target.id) {
1797
- const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" ? "before" : "after";
1790
+ const collisionPosition = collisionData.direction === "up" ? "before" : "after";
1798
1791
  if (targetIndex >= sourceIndex) {
1799
1792
  targetIndex = targetIndex - 1;
1800
1793
  }
1801
1794
  if (collisionPosition === "after") {
1802
1795
  targetIndex = targetIndex + 1;
1803
1796
  }
1804
- setMove({
1797
+ onMove({
1805
1798
  source: sourceIndex,
1806
1799
  target: targetIndex
1807
1800
  });
@@ -1809,12 +1802,8 @@ var SortableProvider = ({
1809
1802
  },
1810
1803
  onDragEnd: () => {
1811
1804
  setTimeout(() => {
1812
- if (move.source !== -1 && move.target !== -1) {
1813
- onMove(move);
1814
- }
1815
1805
  onDragEnd();
1816
1806
  }, 250);
1817
- setMove({ source: -1, target: -1 });
1818
1807
  },
1819
1808
  children
1820
1809
  }
@@ -1913,10 +1902,16 @@ var ArrayField = ({
1913
1902
  }),
1914
1903
  openId: ""
1915
1904
  };
1916
- const [localState, setLocalState] = useState7({ arrayState, value });
1905
+ const [localState, setLocalState] = useState6({ arrayState, value });
1906
+ const updateLocalState = useCallback3(
1907
+ (value2) => {
1908
+ setLocalState({ arrayState, value: value2 });
1909
+ },
1910
+ [arrayState]
1911
+ );
1917
1912
  useEffect4(() => {
1918
- setLocalState({ arrayState, value });
1919
- }, [value, state.ui.arrayState[id]]);
1913
+ updateLocalState(value);
1914
+ }, [value]);
1920
1915
  const mapArrayStateToUi = useCallback3(
1921
1916
  (partialArrayState) => {
1922
1917
  return {
@@ -1957,8 +1952,8 @@ var ArrayField = ({
1957
1952
  setUi(mapArrayStateToUi(arrayState));
1958
1953
  }
1959
1954
  }, []);
1960
- const [isDragging, setIsDragging] = useState7(false);
1961
- const dndContainerRef = useRef(null);
1955
+ const [draggedItem, setDraggedItem] = useState6("");
1956
+ const isDragging = !!draggedItem;
1962
1957
  const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
1963
1958
  if (field.type !== "array" || !field.arrayFields) {
1964
1959
  return null;
@@ -1974,11 +1969,17 @@ var ArrayField = ({
1974
1969
  children: /* @__PURE__ */ jsx8(
1975
1970
  SortableProvider,
1976
1971
  {
1977
- container: dndContainerRef,
1978
- onDragStart: () => setIsDragging(true),
1979
- onDragEnd: () => setIsDragging(false),
1972
+ onDragStart: (id2) => setDraggedItem(id2),
1973
+ onDragEnd: () => {
1974
+ setDraggedItem("");
1975
+ onChange(localState.value);
1976
+ },
1980
1977
  onMove: (move) => {
1981
- const newValue = reorder(value, move.source, move.target);
1978
+ var _a;
1979
+ if (((_a = arrayState.items[move.source]) == null ? void 0 : _a._arrayId) !== draggedItem) {
1980
+ return;
1981
+ }
1982
+ const newValue = reorder(localState.value, move.source, move.target);
1982
1983
  const newArrayStateItems = reorder(
1983
1984
  arrayState.items,
1984
1985
  move.source,
@@ -1990,7 +1991,6 @@ var ArrayField = ({
1990
1991
  })
1991
1992
  };
1992
1993
  setUi(newUi, false);
1993
- onChange(newValue, newUi);
1994
1994
  setLocalState({
1995
1995
  value: newValue,
1996
1996
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
@@ -2004,164 +2004,154 @@ var ArrayField = ({
2004
2004
  addDisabled
2005
2005
  }),
2006
2006
  children: [
2007
- localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx8(
2008
- "div",
2009
- {
2010
- ref: dndContainerRef,
2011
- className: getClassName5("inner"),
2012
- "data-dnd-container": true,
2013
- children: localState.arrayState.items.map((item, i) => {
2014
- const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2015
- const data = Array.from(localState.value || [])[i] || {};
2016
- return /* @__PURE__ */ jsx8(
2017
- Sortable,
2007
+ localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx8("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
2008
+ const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2009
+ const data = Array.from(localState.value || [])[i] || {};
2010
+ return /* @__PURE__ */ jsx8(
2011
+ Sortable,
2012
+ {
2013
+ id: _arrayId,
2014
+ index: i,
2015
+ disabled: readOnly,
2016
+ children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
2017
+ "div",
2018
2018
  {
2019
- id: _arrayId,
2020
- index: i,
2021
- disabled: readOnly,
2022
- children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
2023
- "div",
2024
- {
2025
- ref,
2026
- className: getClassNameItem({
2027
- isExpanded: arrayState.openId === _arrayId,
2028
- isDragging: status === "dragging",
2029
- readOnly
2030
- }),
2031
- children: [
2032
- /* @__PURE__ */ jsxs3(
2033
- "div",
2034
- {
2035
- ref: handleRef,
2036
- onClick: (e) => {
2037
- if (isDragging) return;
2038
- e.preventDefault();
2039
- e.stopPropagation();
2040
- if (arrayState.openId === _arrayId) {
2041
- setUi(
2042
- mapArrayStateToUi({
2043
- openId: ""
2044
- })
2045
- );
2046
- } else {
2047
- setUi(
2048
- mapArrayStateToUi({
2049
- openId: _arrayId
2050
- })
2051
- );
2052
- }
2053
- },
2054
- className: getClassNameItem("summary"),
2055
- children: [
2056
- field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
2057
- /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
2058
- !readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
2059
- /* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
2060
- IconButton,
2061
- {
2062
- type: "button",
2063
- disabled: !!addDisabled,
2064
- onClick: (e) => {
2065
- e.stopPropagation();
2066
- const existingValue = [...value || []];
2067
- existingValue.splice(
2068
- i,
2069
- 0,
2070
- existingValue[i]
2071
- );
2072
- onChange(
2073
- existingValue,
2074
- mapArrayStateToUi(
2075
- regenerateArrayState(existingValue)
2076
- )
2077
- );
2078
- },
2079
- title: "Duplicate",
2080
- children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
2081
- }
2082
- ) }),
2083
- /* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
2084
- IconButton,
2085
- {
2086
- type: "button",
2087
- disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
2088
- onClick: (e) => {
2089
- e.stopPropagation();
2090
- const existingValue = [...value || []];
2091
- const existingItems = [
2092
- ...arrayState.items || []
2093
- ];
2094
- existingValue.splice(i, 1);
2095
- existingItems.splice(i, 1);
2096
- onChange(
2097
- existingValue,
2098
- mapArrayStateToUi({
2099
- items: existingItems
2100
- })
2101
- );
2102
- },
2103
- title: "Delete",
2104
- children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
2105
- }
2106
- ) })
2107
- ] }),
2108
- /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(DragIcon, {}) })
2109
- ] })
2110
- ]
2019
+ ref,
2020
+ className: getClassNameItem({
2021
+ isExpanded: arrayState.openId === _arrayId,
2022
+ isDragging: status === "dragging",
2023
+ readOnly
2024
+ }),
2025
+ children: [
2026
+ /* @__PURE__ */ jsxs3(
2027
+ "div",
2028
+ {
2029
+ ref: handleRef,
2030
+ onClick: (e) => {
2031
+ if (isDragging) return;
2032
+ e.preventDefault();
2033
+ e.stopPropagation();
2034
+ if (arrayState.openId === _arrayId) {
2035
+ setUi(
2036
+ mapArrayStateToUi({
2037
+ openId: ""
2038
+ })
2039
+ );
2040
+ } else {
2041
+ setUi(
2042
+ mapArrayStateToUi({
2043
+ openId: _arrayId
2044
+ })
2045
+ );
2111
2046
  }
2112
- ),
2113
- /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2114
- const subField = field.arrayFields[subName];
2115
- const indexName = `${name}[${i}]`;
2116
- const subPath = `${indexName}.${subName}`;
2117
- const localIndexName = `${localName}[${i}]`;
2118
- const localWildcardName = `${localName}[*]`;
2119
- const localSubPath = `${localIndexName}.${subName}`;
2120
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
2121
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2122
- const label2 = subField.label || subName;
2123
- return /* @__PURE__ */ jsx8(
2124
- NestedFieldProvider,
2125
- {
2126
- name: localIndexName,
2127
- wildcardName: localWildcardName,
2128
- subName,
2129
- readOnlyFields,
2130
- children: /* @__PURE__ */ jsx8(
2131
- AutoFieldPrivate,
2047
+ },
2048
+ className: getClassNameItem("summary"),
2049
+ children: [
2050
+ field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
2051
+ /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
2052
+ !readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
2053
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
2054
+ IconButton,
2132
2055
  {
2133
- name: subPath,
2134
- label: label2,
2135
- id: `${_arrayId}_${subName}`,
2136
- readOnly: subReadOnly,
2137
- field: __spreadProps(__spreadValues({}, subField), {
2138
- label: label2
2139
- // May be used by custom fields
2140
- }),
2141
- value: data[subName],
2142
- onChange: (val, ui) => {
2143
- onChange(
2144
- replace(value, i, __spreadProps(__spreadValues({}, data), {
2145
- [subName]: val
2146
- })),
2147
- ui
2056
+ type: "button",
2057
+ disabled: !!addDisabled,
2058
+ onClick: (e) => {
2059
+ e.stopPropagation();
2060
+ const existingValue = [...value || []];
2061
+ existingValue.splice(
2062
+ i,
2063
+ 0,
2064
+ existingValue[i]
2148
2065
  );
2149
- }
2066
+ const newUi = mapArrayStateToUi(
2067
+ regenerateArrayState(existingValue)
2068
+ );
2069
+ setUi(newUi, false);
2070
+ onChange(existingValue, newUi);
2071
+ },
2072
+ title: "Duplicate",
2073
+ children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
2150
2074
  }
2151
- )
2152
- },
2153
- subPath
2154
- );
2155
- }) }) })
2156
- ]
2157
- }
2158
- )
2159
- },
2160
- _arrayId
2161
- );
2162
- })
2163
- }
2164
- ),
2075
+ ) }),
2076
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
2077
+ IconButton,
2078
+ {
2079
+ type: "button",
2080
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
2081
+ onClick: (e) => {
2082
+ e.stopPropagation();
2083
+ const existingValue = [...value || []];
2084
+ const existingItems = [
2085
+ ...arrayState.items || []
2086
+ ];
2087
+ existingValue.splice(i, 1);
2088
+ existingItems.splice(i, 1);
2089
+ const newUi = mapArrayStateToUi({
2090
+ items: existingItems
2091
+ });
2092
+ setUi(newUi, false);
2093
+ onChange(existingValue, newUi);
2094
+ },
2095
+ title: "Delete",
2096
+ children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
2097
+ }
2098
+ ) })
2099
+ ] }),
2100
+ /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(DragIcon, {}) })
2101
+ ] })
2102
+ ]
2103
+ }
2104
+ ),
2105
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2106
+ const subField = field.arrayFields[subName];
2107
+ const indexName = `${name}[${i}]`;
2108
+ const subPath = `${indexName}.${subName}`;
2109
+ const localIndexName = `${localName}[${i}]`;
2110
+ const localWildcardName = `${localName}[*]`;
2111
+ const localSubPath = `${localIndexName}.${subName}`;
2112
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
2113
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2114
+ const label2 = subField.label || subName;
2115
+ return /* @__PURE__ */ jsx8(
2116
+ NestedFieldProvider,
2117
+ {
2118
+ name: localIndexName,
2119
+ wildcardName: localWildcardName,
2120
+ subName,
2121
+ readOnlyFields,
2122
+ children: /* @__PURE__ */ jsx8(
2123
+ AutoFieldPrivate,
2124
+ {
2125
+ name: subPath,
2126
+ label: label2,
2127
+ id: `${_arrayId}_${subName}`,
2128
+ readOnly: subReadOnly,
2129
+ field: __spreadProps(__spreadValues({}, subField), {
2130
+ label: label2
2131
+ // May be used by custom fields
2132
+ }),
2133
+ value: data[subName],
2134
+ onChange: (val, ui) => {
2135
+ onChange(
2136
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
2137
+ [subName]: val
2138
+ })),
2139
+ ui
2140
+ );
2141
+ }
2142
+ }
2143
+ )
2144
+ },
2145
+ subPath
2146
+ );
2147
+ }) }) })
2148
+ ]
2149
+ }
2150
+ )
2151
+ },
2152
+ _arrayId
2153
+ );
2154
+ }) }),
2165
2155
  !addDisabled && /* @__PURE__ */ jsx8(
2166
2156
  "button",
2167
2157
  {
@@ -2175,7 +2165,9 @@ var ArrayField = ({
2175
2165
  field.defaultItemProps || {}
2176
2166
  ];
2177
2167
  const newArrayState = regenerateArrayState(newValue);
2178
- onChange(newValue, mapArrayStateToUi(newArrayState));
2168
+ const newUi = mapArrayStateToUi(newArrayState);
2169
+ setUi(newUi, false);
2170
+ onChange(newValue, newUi);
2179
2171
  },
2180
2172
  children: /* @__PURE__ */ jsx8(Plus, { size: 21 })
2181
2173
  }
@@ -2256,7 +2248,7 @@ init_react_import();
2256
2248
  import {
2257
2249
  useMemo as useMemo2,
2258
2250
  useEffect as useEffect7,
2259
- useState as useState10,
2251
+ useState as useState9,
2260
2252
  useCallback as useCallback4,
2261
2253
  isValidElement
2262
2254
  } from "react";
@@ -2267,7 +2259,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
2267
2259
 
2268
2260
  // components/Modal/index.tsx
2269
2261
  init_react_import();
2270
- import { useEffect as useEffect5, useState as useState8 } from "react";
2262
+ import { useEffect as useEffect5, useState as useState7 } from "react";
2271
2263
 
2272
2264
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
2273
2265
  init_react_import();
@@ -2282,7 +2274,7 @@ var Modal = ({
2282
2274
  onClose,
2283
2275
  isOpen
2284
2276
  }) => {
2285
- const [rootEl, setRootEl] = useState8(null);
2277
+ const [rootEl, setRootEl] = useState7(null);
2286
2278
  useEffect5(() => {
2287
2279
  setRootEl(document.getElementById("puck-portal-root"));
2288
2280
  }, []);
@@ -2330,7 +2322,7 @@ init_react_import();
2330
2322
 
2331
2323
  // components/Button/Button.tsx
2332
2324
  init_react_import();
2333
- import { useEffect as useEffect6, useState as useState9 } from "react";
2325
+ import { useEffect as useEffect6, useState as useState8 } from "react";
2334
2326
 
2335
2327
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
2336
2328
  init_react_import();
@@ -2380,7 +2372,7 @@ var Button = (_a) => {
2380
2372
  "size",
2381
2373
  "loading"
2382
2374
  ]);
2383
- const [loading, setLoading] = useState9(loadingProp);
2375
+ const [loading, setLoading] = useState8(loadingProp);
2384
2376
  useEffect6(() => setLoading(loadingProp), [loadingProp]);
2385
2377
  const ElementType = href ? "a" : type ? "button" : "span";
2386
2378
  const dataAttrs = filterDataAttrs(props);
@@ -2436,12 +2428,12 @@ var ExternalInput = ({
2436
2428
  mapRow = (val) => val,
2437
2429
  filterFields
2438
2430
  } = field || {};
2439
- const [data, setData] = useState10([]);
2440
- const [isOpen, setOpen] = useState10(false);
2441
- const [isLoading, setIsLoading] = useState10(true);
2431
+ const [data, setData] = useState9([]);
2432
+ const [isOpen, setOpen] = useState9(false);
2433
+ const [isLoading, setIsLoading] = useState9(true);
2442
2434
  const hasFilterFields = !!filterFields;
2443
- const [filters, setFilters] = useState10(field.initialFilters || {});
2444
- const [filtersToggled, setFiltersToggled] = useState10(hasFilterFields);
2435
+ const [filters, setFilters] = useState9(field.initialFilters || {});
2436
+ const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
2445
2437
  const mappedData = useMemo2(() => {
2446
2438
  return data.map(mapRow);
2447
2439
  }, [data]);
@@ -2456,7 +2448,7 @@ var ExternalInput = ({
2456
2448
  }
2457
2449
  return Array.from(validKeys);
2458
2450
  }, [mappedData]);
2459
- const [searchQuery, setSearchQuery] = useState10(field.initialQuery || "");
2451
+ const [searchQuery, setSearchQuery] = useState9(field.initialQuery || "");
2460
2452
  const search = useCallback4(
2461
2453
  (query, filters2) => __async(void 0, null, function* () {
2462
2454
  setIsLoading(true);
@@ -2925,7 +2917,7 @@ var ObjectField = ({
2925
2917
 
2926
2918
  // lib/use-safe-id.ts
2927
2919
  init_react_import();
2928
- import React2, { useState as useState11 } from "react";
2920
+ import React2, { useState as useState10 } from "react";
2929
2921
 
2930
2922
  // lib/generate-id.ts
2931
2923
  init_react_import();
@@ -2937,7 +2929,7 @@ var useSafeId = () => {
2937
2929
  if (typeof React2.useId !== "undefined") {
2938
2930
  return React2.useId();
2939
2931
  }
2940
- const [id] = useState11(generateId());
2932
+ const [id] = useState10(generateId());
2941
2933
  return id;
2942
2934
  };
2943
2935
 
@@ -3083,7 +3075,7 @@ function AutoFieldInternal(props) {
3083
3075
  function AutoFieldPrivate(props) {
3084
3076
  const { state } = useAppContext();
3085
3077
  const { value, onChange } = props;
3086
- const [localValue, setLocalValue] = useState12(value);
3078
+ const [localValue, setLocalValue] = useState11(value);
3087
3079
  const onChangeDb = useDebouncedCallback(
3088
3080
  (val, ui) => {
3089
3081
  onChange(val, ui);
@@ -3130,7 +3122,7 @@ init_react_import();
3130
3122
  var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
3131
3123
 
3132
3124
  // components/Drawer/index.tsx
3133
- import { useMemo as useMemo9, useState as useState19 } from "react";
3125
+ import { useId as useId2, useMemo as useMemo9, useState as useState18 } from "react";
3134
3126
 
3135
3127
  // components/DragDropContext/index.tsx
3136
3128
  init_react_import();
@@ -3140,8 +3132,9 @@ import {
3140
3132
  useCallback as useCallback11,
3141
3133
  useContext as useContext7,
3142
3134
  useEffect as useEffect15,
3135
+ useId,
3143
3136
  useRef as useRef4,
3144
- useState as useState18
3137
+ useState as useState17
3145
3138
  } from "react";
3146
3139
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
3147
3140
 
@@ -3164,7 +3157,7 @@ import {
3164
3157
  useEffect as useEffect10,
3165
3158
  useMemo as useMemo7,
3166
3159
  useRef as useRef2,
3167
- useState as useState14
3160
+ useState as useState13
3168
3161
  } from "react";
3169
3162
 
3170
3163
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
@@ -3199,7 +3192,7 @@ import {
3199
3192
  createContext as createContext3,
3200
3193
  useCallback as useCallback6,
3201
3194
  useMemo as useMemo6,
3202
- useState as useState13
3195
+ useState as useState12
3203
3196
  } from "react";
3204
3197
  import { createStore as createStore2 } from "zustand";
3205
3198
  import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
@@ -3224,11 +3217,11 @@ var DropZoneProvider = ({
3224
3217
  children,
3225
3218
  value
3226
3219
  }) => {
3227
- const [hoveringComponent, setHoveringComponent] = useState13();
3228
- const [areasWithZones, setAreasWithZones] = useState13(
3220
+ const [hoveringComponent, setHoveringComponent] = useState12();
3221
+ const [areasWithZones, setAreasWithZones] = useState12(
3229
3222
  {}
3230
3223
  );
3231
- const [activeZones, setActiveZones] = useState13({});
3224
+ const [activeZones, setActiveZones] = useState12({});
3232
3225
  const { dispatch } = useAppContext();
3233
3226
  const registerZoneArea = useCallback6(
3234
3227
  (area) => {
@@ -3345,7 +3338,7 @@ var DraggableComponent = ({
3345
3338
  state
3346
3339
  } = useAppContext();
3347
3340
  const ctx = useContext5(dropZoneContext);
3348
- const [localZones, setLocalZones] = useState14({});
3341
+ const [localZones, setLocalZones] = useState13({});
3349
3342
  const registerLocalZone = useCallback7(
3350
3343
  (zoneCompound2, active) => {
3351
3344
  var _a;
@@ -3370,7 +3363,7 @@ var DraggableComponent = ({
3370
3363
  );
3371
3364
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
3372
3365
  const { path = [] } = ctx || {};
3373
- const [canDrag, setCanDrag] = useState14(false);
3366
+ const [canDrag, setCanDrag] = useState13(false);
3374
3367
  useEffect10(() => {
3375
3368
  var _a;
3376
3369
  const item = getItem({ index, zone: zoneCompound }, state.data);
@@ -3387,7 +3380,7 @@ var DraggableComponent = ({
3387
3380
  );
3388
3381
  const canCollide = canDrag || userIsDragging;
3389
3382
  const disabled = !isEnabled || !canCollide;
3390
- const [dragAxis, setDragAxis] = useState14(userDragAxis || autoDragAxis);
3383
+ const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
3391
3384
  const { ref: sortableRef, status } = useSortableSafe({
3392
3385
  id,
3393
3386
  index,
@@ -3423,7 +3416,7 @@ var DraggableComponent = ({
3423
3416
  },
3424
3417
  [sortableRef]
3425
3418
  );
3426
- const [portalEl, setPortalEl] = useState14();
3419
+ const [portalEl, setPortalEl] = useState13();
3427
3420
  useEffect10(() => {
3428
3421
  var _a, _b, _c;
3429
3422
  setPortalEl(
@@ -3450,7 +3443,7 @@ var DraggableComponent = ({
3450
3443
  };
3451
3444
  return style2;
3452
3445
  }, [ref.current]);
3453
- const [style, setStyle] = useState14();
3446
+ const [style, setStyle] = useState13();
3454
3447
  const sync = useCallback7(() => {
3455
3448
  setStyle(getStyle());
3456
3449
  }, [ref.current, iframe]);
@@ -3528,7 +3521,7 @@ var DraggableComponent = ({
3528
3521
  zone: zoneCompound
3529
3522
  });
3530
3523
  }, [index, zoneCompound]);
3531
- const [hover, setHover] = useState14(false);
3524
+ const [hover, setHover] = useState13(false);
3532
3525
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3533
3526
  useEffect10(() => {
3534
3527
  if (!ref.current) {
@@ -3589,7 +3582,7 @@ var DraggableComponent = ({
3589
3582
  };
3590
3583
  }
3591
3584
  }, [disabled, ref]);
3592
- const [isVisible, setIsVisible] = useState14(false);
3585
+ const [isVisible, setIsVisible] = useState13(false);
3593
3586
  useEffect10(() => {
3594
3587
  sync();
3595
3588
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
@@ -3606,10 +3599,18 @@ var DraggableComponent = ({
3606
3599
  const rect = el.getBoundingClientRect();
3607
3600
  const diffLeft = rect.x;
3608
3601
  const exceedsBoundsLeft = diffLeft < 0;
3602
+ const diffTop = rect.y;
3603
+ const exceedsBoundsTop = diffTop < 0;
3609
3604
  if (exceedsBoundsLeft) {
3610
3605
  el.style.transformOrigin = "left top";
3611
3606
  el.style.left = "0px";
3612
3607
  }
3608
+ if (exceedsBoundsTop) {
3609
+ el.style.top = "12px";
3610
+ if (!exceedsBoundsLeft) {
3611
+ el.style.transformOrigin = "right top";
3612
+ }
3613
+ }
3613
3614
  }
3614
3615
  }
3615
3616
  },
@@ -3709,14 +3710,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
3709
3710
 
3710
3711
  // components/DropZone/lib/use-min-empty-height.ts
3711
3712
  init_react_import();
3712
- import { useEffect as useEffect11, useState as useState15 } from "react";
3713
+ import { useEffect as useEffect11, useState as useState14 } from "react";
3713
3714
  var useMinEmptyHeight = ({
3714
3715
  zoneCompound,
3715
3716
  userMinEmptyHeight,
3716
3717
  ref
3717
3718
  }) => {
3718
- const [prevHeight, setPrevHeight] = useState15(0);
3719
- const [isAnimating, setIsAnimating] = useState15(false);
3719
+ const [prevHeight, setPrevHeight] = useState14(0);
3720
+ const [isAnimating, setIsAnimating] = useState14(false);
3720
3721
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3721
3722
  var _a, _b;
3722
3723
  return {
@@ -3758,7 +3759,7 @@ function assignRefs(refs, node) {
3758
3759
 
3759
3760
  // components/DropZone/lib/use-content-with-preview.ts
3760
3761
  init_react_import();
3761
- import { useEffect as useEffect12, useState as useState16 } from "react";
3762
+ import { useEffect as useEffect12, useState as useState15 } from "react";
3762
3763
 
3763
3764
  // lib/dnd/use-rendered-callback.ts
3764
3765
  init_react_import();
@@ -3801,8 +3802,8 @@ var useContentWithPreview = (content, zoneCompound) => {
3801
3802
  ui: { isDragging }
3802
3803
  }
3803
3804
  } = useAppContext();
3804
- const [contentWithPreview, setContentWithPreview] = useState16(content);
3805
- const [localPreview, setLocalPreview] = useState16(
3805
+ const [contentWithPreview, setContentWithPreview] = useState15(content);
3806
+ const [localPreview, setLocalPreview] = useState15(
3806
3807
  preview
3807
3808
  );
3808
3809
  const updateContent = useRenderedCallback(
@@ -3851,13 +3852,13 @@ var useContentWithPreview = (content, zoneCompound) => {
3851
3852
 
3852
3853
  // components/DropZone/lib/use-drag-axis.ts
3853
3854
  init_react_import();
3854
- import { useCallback as useCallback9, useEffect as useEffect13, useState as useState17 } from "react";
3855
+ import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
3855
3856
  var GRID_DRAG_AXIS = "dynamic";
3856
3857
  var FLEX_ROW_DRAG_AXIS = "x";
3857
3858
  var DEFAULT_DRAG_AXIS = "y";
3858
3859
  var useDragAxis = (ref, collisionAxis) => {
3859
3860
  const { status } = useAppContext();
3860
- const [dragAxis, setDragAxis] = useState17(
3861
+ const [dragAxis, setDragAxis] = useState16(
3861
3862
  collisionAxis || DEFAULT_DRAG_AXIS
3862
3863
  );
3863
3864
  const calculateDragAxis = useCallback9(() => {
@@ -4900,11 +4901,11 @@ var DragDropContextClient = ({
4900
4901
  disableAutoScroll
4901
4902
  }) => {
4902
4903
  const { state, config, dispatch, resolveData } = useAppContext();
4903
- const id = useSafeId();
4904
+ const id = useId();
4904
4905
  const { data } = state;
4905
4906
  const debouncedParamsRef = useRef4(null);
4906
4907
  const tempDisableFallback = useTempDisableFallback(100);
4907
- const [zoneStore] = useState18(
4908
+ const [zoneStore] = useState17(
4908
4909
  () => createStore3(() => ({
4909
4910
  zoneDepthIndex: {},
4910
4911
  nextZoneDepthIndex: {},
@@ -4973,7 +4974,7 @@ var DragDropContextClient = ({
4973
4974
  );
4974
4975
  }
4975
4976
  }, []);
4976
- const [plugins] = useState18(() => [
4977
+ const [plugins] = useState17(() => [
4977
4978
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4978
4979
  createNestedDroppablePlugin(
4979
4980
  {
@@ -5021,8 +5022,8 @@ var DragDropContextClient = ({
5021
5022
  )
5022
5023
  ]);
5023
5024
  const sensors = useSensors();
5024
- const [dragListeners, setDragListeners] = useState18({});
5025
- const [pathData, setPathData] = useState18();
5025
+ const [dragListeners, setDragListeners] = useState17({});
5026
+ const [pathData, setPathData] = useState17();
5026
5027
  const dragMode = useRef4(null);
5027
5028
  const registerPath = useCallback11(
5028
5029
  (id2, selector, label) => {
@@ -5344,7 +5345,7 @@ var DrawerItem = ({
5344
5345
  isDragDisabled
5345
5346
  }) => {
5346
5347
  const resolvedId = id || name;
5347
- const [dynamicId, setDynamicId] = useState19(generateId(resolvedId));
5348
+ const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
5348
5349
  if (typeof index !== "undefined") {
5349
5350
  console.error(
5350
5351
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5383,7 +5384,7 @@ var Drawer = ({
5383
5384
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
5384
5385
  );
5385
5386
  }
5386
- const id = useSafeId();
5387
+ const id = useId2();
5387
5388
  const { ref } = useDroppableSafe({
5388
5389
  id,
5389
5390
  type: "void",
@@ -5410,7 +5411,7 @@ import {
5410
5411
  useEffect as useEffect24,
5411
5412
  useMemo as useMemo19,
5412
5413
  useReducer,
5413
- useState as useState27
5414
+ useState as useState26
5414
5415
  } from "react";
5415
5416
 
5416
5417
  // components/SidebarSection/index.tsx
@@ -5611,7 +5612,7 @@ import { useMemo as useMemo12 } from "react";
5611
5612
 
5612
5613
  // lib/use-resolved-fields.ts
5613
5614
  init_react_import();
5614
- import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as useState20 } from "react";
5615
+ import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as useState19 } from "react";
5615
5616
 
5616
5617
  // lib/use-parent.ts
5617
5618
  init_react_import();
@@ -5674,12 +5675,12 @@ var useResolvedFields = ({
5674
5675
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5675
5676
  );
5676
5677
  const rootProps = data.root.props || data.root;
5677
- const [lastSelectedData, setLastSelectedData] = useState20({});
5678
- const [resolvedFields, setResolvedFields] = useState20({
5678
+ const [lastSelectedData, setLastSelectedData] = useState19({});
5679
+ const [resolvedFields, setResolvedFields] = useState19({
5679
5680
  fields: defaultFields,
5680
5681
  id: selectedItem == null ? void 0 : selectedItem.props.id
5681
5682
  });
5682
- const [fieldsLoading, setFieldsLoading] = useState20(false);
5683
+ const [fieldsLoading, setFieldsLoading] = useState19(false);
5683
5684
  const lastFields = useRef6(defaultFields);
5684
5685
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5685
5686
  const componentData = useMemo11(
@@ -5923,7 +5924,7 @@ init_react_import();
5923
5924
 
5924
5925
  // lib/use-component-list.tsx
5925
5926
  init_react_import();
5926
- import { useEffect as useEffect18, useState as useState21 } from "react";
5927
+ import { useEffect as useEffect18, useState as useState20 } from "react";
5927
5928
 
5928
5929
  // components/ComponentList/index.tsx
5929
5930
  init_react_import();
@@ -5990,7 +5991,7 @@ ComponentList.Item = ComponentListItem;
5990
5991
  // lib/use-component-list.tsx
5991
5992
  import { jsx as jsx29 } from "react/jsx-runtime";
5992
5993
  var useComponentList = (config, ui) => {
5993
- const [componentList, setComponentList] = useState21();
5994
+ const [componentList, setComponentList] = useState20();
5994
5995
  useEffect18(() => {
5995
5996
  var _a, _b, _c;
5996
5997
  if (Object.keys(ui.componentList).length > 0) {
@@ -6079,7 +6080,7 @@ import {
6079
6080
  createContext as createContext5,
6080
6081
  useContext as useContext10,
6081
6082
  useEffect as useEffect19,
6082
- useState as useState22
6083
+ useState as useState21
6083
6084
  } from "react";
6084
6085
  import hash from "object-hash";
6085
6086
  import { createPortal as createPortal3 } from "react-dom";
@@ -6303,9 +6304,9 @@ function AutoFrame(_a) {
6303
6304
  "onStylesLoaded",
6304
6305
  "frameRef"
6305
6306
  ]);
6306
- const [loaded, setLoaded] = useState22(false);
6307
- const [ctx, setCtx] = useState22({});
6308
- const [mountTarget, setMountTarget] = useState22();
6307
+ const [loaded, setLoaded] = useState21(false);
6308
+ const [ctx, setCtx] = useState21({});
6309
+ const [mountTarget, setMountTarget] = useState21();
6309
6310
  useEffect19(() => {
6310
6311
  var _a2;
6311
6312
  if (frameRef.current) {
@@ -6824,19 +6825,19 @@ function usePuckHistory({
6824
6825
 
6825
6826
  // lib/use-history-store.ts
6826
6827
  init_react_import();
6827
- import { useState as useState23 } from "react";
6828
+ import { useState as useState22 } from "react";
6828
6829
  import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
6829
6830
  var EMPTY_HISTORY_INDEX = 0;
6830
6831
  function useHistoryStore(initialHistory) {
6831
6832
  var _a, _b;
6832
- const [histories, setHistories] = useState23(
6833
+ const [histories, setHistories] = useState22(
6833
6834
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6834
6835
  );
6835
6836
  const updateHistories = (histories2) => {
6836
6837
  setHistories(histories2);
6837
6838
  setIndex(histories2.length - 1);
6838
6839
  };
6839
- const [index, setIndex] = useState23(
6840
+ const [index, setIndex] = useState22(
6840
6841
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6841
6842
  );
6842
6843
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -7001,12 +7002,12 @@ import {
7001
7002
  useEffect as useEffect22,
7002
7003
  useMemo as useMemo17,
7003
7004
  useRef as useRef9,
7004
- useState as useState25
7005
+ useState as useState24
7005
7006
  } from "react";
7006
7007
 
7007
7008
  // components/ViewportControls/index.tsx
7008
7009
  init_react_import();
7009
- import { useEffect as useEffect21, useMemo as useMemo16, useState as useState24 } from "react";
7010
+ import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
7010
7011
 
7011
7012
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7012
7013
  init_react_import();
@@ -7029,7 +7030,7 @@ var ViewportButton = ({
7029
7030
  onClick
7030
7031
  }) => {
7031
7032
  const { state } = useAppContext();
7032
- const [isActive, setIsActive] = useState24(false);
7033
+ const [isActive, setIsActive] = useState23(false);
7033
7034
  useEffect21(() => {
7034
7035
  setIsActive(width === state.ui.viewports.current.width);
7035
7036
  }, [width, state.ui.viewports.current.width]);
@@ -7190,7 +7191,7 @@ var Canvas = () => {
7190
7191
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
7191
7192
  const { ui } = state;
7192
7193
  const frameRef = useRef9(null);
7193
- const [showTransition, setShowTransition] = useState25(false);
7194
+ const [showTransition, setShowTransition] = useState24(false);
7194
7195
  const defaultRender = useMemo17(() => {
7195
7196
  const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
7196
7197
  return PuckDefault;
@@ -7245,7 +7246,7 @@ var Canvas = () => {
7245
7246
  window.removeEventListener("resize", cb);
7246
7247
  };
7247
7248
  }, []);
7248
- const [showLoader, setShowLoader] = useState25(false);
7249
+ const [showLoader, setShowLoader] = useState24(false);
7249
7250
  useEffect22(() => {
7250
7251
  setTimeout(() => {
7251
7252
  setShowLoader(true);
@@ -7375,10 +7376,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
7375
7376
 
7376
7377
  // lib/use-inject-css.ts
7377
7378
  init_react_import();
7378
- import { useEffect as useEffect23, useState as useState26 } from "react";
7379
+ import { useEffect as useEffect23, useState as useState25 } from "react";
7379
7380
  var styles = ``;
7380
7381
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7381
- const [el, setEl] = useState26();
7382
+ const [el, setEl] = useState25();
7382
7383
  useEffect23(() => {
7383
7384
  setEl(document.createElement("style"));
7384
7385
  }, []);
@@ -7462,7 +7463,7 @@ function Puck({
7462
7463
  waitForStyles: true
7463
7464
  }, _iframe);
7464
7465
  useInjectGlobalCss(iframe.enabled);
7465
- const [generatedAppState] = useState27(() => {
7466
+ const [generatedAppState] = useState26(() => {
7466
7467
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
7467
7468
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7468
7469
  let clientUiState = {};
@@ -7534,7 +7535,7 @@ function Puck({
7534
7535
  histories,
7535
7536
  index: initialHistoryIndex
7536
7537
  });
7537
- const [reducer] = useState27(
7538
+ const [reducer] = useState26(
7538
7539
  () => createReducer({
7539
7540
  config,
7540
7541
  record: historyStore.record,
@@ -7552,7 +7553,7 @@ function Puck({
7552
7553
  historyStore,
7553
7554
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7554
7555
  });
7555
- const [menuOpen, setMenuOpen] = useState27(false);
7556
+ const [menuOpen, setMenuOpen] = useState26(false);
7556
7557
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7557
7558
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7558
7559
  useEffect24(() => {
@@ -7639,7 +7640,7 @@ function Puck({
7639
7640
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7640
7641
  [loadedOverrides]
7641
7642
  );
7642
- const [mounted, setMounted] = useState27(false);
7643
+ const [mounted, setMounted] = useState26(false);
7643
7644
  useEffect24(() => {
7644
7645
  setMounted(true);
7645
7646
  }, []);
@@ -7826,40 +7827,6 @@ function migrate(data) {
7826
7827
  return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
7827
7828
  }
7828
7829
 
7829
- // lib/transform-props.ts
7830
- init_react_import();
7831
- function transformProps(data, propTransforms) {
7832
- const mapItem = (item) => {
7833
- if (propTransforms[item.type]) {
7834
- return __spreadProps(__spreadValues({}, item), {
7835
- props: propTransforms[item.type](item.props)
7836
- });
7837
- }
7838
- return item;
7839
- };
7840
- const defaultedData = defaultData(data);
7841
- const rootProps = defaultedData.root.props || defaultedData.root;
7842
- let newRoot = __spreadValues({}, defaultedData.root);
7843
- if (propTransforms["root"]) {
7844
- if (defaultedData.root.props) {
7845
- newRoot.props = propTransforms["root"](rootProps);
7846
- } else {
7847
- newRoot = propTransforms["root"](rootProps);
7848
- }
7849
- }
7850
- const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
7851
- root: newRoot,
7852
- content: defaultedData.content.map(mapItem),
7853
- zones: Object.keys(data.zones || {}).reduce(
7854
- (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
7855
- [zoneKey]: data.zones[zoneKey].map(mapItem)
7856
- }),
7857
- {}
7858
- )
7859
- });
7860
- return afterPropTransforms;
7861
- }
7862
-
7863
7830
  // lib/use-puck.ts
7864
7831
  init_react_import();
7865
7832
  var usePuck = () => {