@measured/puck 0.18.3-canary.154e7f7 → 0.18.3-canary.551c689

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, 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();
@@ -1110,7 +1109,8 @@ function useDraggableSafe(input) {
1110
1109
  function useSortableSafe(input) {
1111
1110
  if (typeof window === "undefined") {
1112
1111
  return { ref: () => {
1113
- }, status: "idle" };
1112
+ }, status: "idle", handleRef: () => {
1113
+ } };
1114
1114
  }
1115
1115
  return useSortable(input);
1116
1116
  }
@@ -1394,23 +1394,26 @@ function patchWindow(window2) {
1394
1394
 
1395
1395
  // lib/dnd/use-sensors.ts
1396
1396
  import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
1397
- var useSensors = () => {
1397
+ var useSensors = ({
1398
+ other,
1399
+ mouse,
1400
+ touch
1401
+ } = {
1402
+ touch: { delay: { value: 200, tolerance: 10 } },
1403
+ other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
1404
+ }) => {
1398
1405
  const [sensors] = useState5(() => [
1399
1406
  PointerSensor.configure({
1400
1407
  activationConstraints(event, source) {
1401
1408
  var _a;
1402
1409
  const { pointerType, target } = event;
1403
1410
  if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
1404
- return void 0;
1411
+ return mouse;
1405
1412
  }
1406
- const delay = { value: 200, tolerance: 10 };
1407
1413
  if (pointerType === "touch") {
1408
- return { delay };
1414
+ return touch;
1409
1415
  }
1410
- return {
1411
- delay,
1412
- distance: { value: 5 }
1413
- };
1416
+ return other;
1414
1417
  }
1415
1418
  })
1416
1419
  ]);
@@ -1756,7 +1759,6 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
1756
1759
  };
1757
1760
 
1758
1761
  // components/Sortable/index.tsx
1759
- import { RestrictToElement } from "@dnd-kit/dom/modifiers";
1760
1762
  import { jsx as jsx6 } from "react/jsx-runtime";
1761
1763
  var SortableProvider = ({
1762
1764
  children,
@@ -1764,22 +1766,20 @@ var SortableProvider = ({
1764
1766
  onDragEnd,
1765
1767
  onMove
1766
1768
  }) => {
1767
- const [move, setMove] = useState6({ source: -1, target: -1 });
1768
- const sensors = useSensors();
1769
+ const sensors = useSensors({
1770
+ mouse: { distance: { value: 5 } }
1771
+ });
1769
1772
  return /* @__PURE__ */ jsx6(
1770
1773
  DragDropProvider,
1771
1774
  {
1772
1775
  sensors,
1773
- modifiers: [
1774
- RestrictToElement.configure({
1775
- element() {
1776
- return document.querySelector("[data-dnd-container]");
1777
- }
1778
- })
1779
- ],
1780
- 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
+ },
1781
1780
  onDragOver: (event, manager) => {
1782
1781
  var _a, _b;
1782
+ event.preventDefault();
1783
1783
  const { operation } = event;
1784
1784
  const { source, target } = operation;
1785
1785
  if (!source || !target) return;
@@ -1787,14 +1787,14 @@ var SortableProvider = ({
1787
1787
  let targetIndex = target.data.index;
1788
1788
  const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
1789
1789
  if (sourceIndex !== targetIndex && source.id !== target.id) {
1790
- const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" ? "before" : "after";
1790
+ const collisionPosition = collisionData.direction === "up" ? "before" : "after";
1791
1791
  if (targetIndex >= sourceIndex) {
1792
1792
  targetIndex = targetIndex - 1;
1793
1793
  }
1794
1794
  if (collisionPosition === "after") {
1795
1795
  targetIndex = targetIndex + 1;
1796
1796
  }
1797
- setMove({
1797
+ onMove({
1798
1798
  source: sourceIndex,
1799
1799
  target: targetIndex
1800
1800
  });
@@ -1802,12 +1802,8 @@ var SortableProvider = ({
1802
1802
  },
1803
1803
  onDragEnd: () => {
1804
1804
  setTimeout(() => {
1805
- if (move.source !== -1 && move.target !== -1) {
1806
- onMove(move);
1807
- }
1808
1805
  onDragEnd();
1809
1806
  }, 250);
1810
- setMove({ source: -1, target: -1 });
1811
1807
  },
1812
1808
  children
1813
1809
  }
@@ -1820,7 +1816,11 @@ var Sortable = ({
1820
1816
  children,
1821
1817
  type = "item"
1822
1818
  }) => {
1823
- const { ref: sortableRef, status } = useSortableSafe({
1819
+ const {
1820
+ ref: sortableRef,
1821
+ status,
1822
+ handleRef
1823
+ } = useSortableSafe({
1824
1824
  id,
1825
1825
  type,
1826
1826
  index,
@@ -1828,7 +1828,7 @@ var Sortable = ({
1828
1828
  data: { index },
1829
1829
  collisionDetector: createDynamicCollisionDetector("y")
1830
1830
  });
1831
- return children({ status, ref: sortableRef });
1831
+ return children({ status, ref: sortableRef, handleRef });
1832
1832
  };
1833
1833
 
1834
1834
  // components/AutoField/context.tsx
@@ -1902,10 +1902,16 @@ var ArrayField = ({
1902
1902
  }),
1903
1903
  openId: ""
1904
1904
  };
1905
- 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
+ );
1906
1912
  useEffect4(() => {
1907
- setLocalState({ arrayState, value });
1908
- }, [value, state.ui.arrayState[id]]);
1913
+ updateLocalState(value);
1914
+ }, [value]);
1909
1915
  const mapArrayStateToUi = useCallback3(
1910
1916
  (partialArrayState) => {
1911
1917
  return {
@@ -1946,7 +1952,8 @@ var ArrayField = ({
1946
1952
  setUi(mapArrayStateToUi(arrayState));
1947
1953
  }
1948
1954
  }, []);
1949
- const [isDragging, setIsDragging] = useState7(false);
1955
+ const [draggedItem, setDraggedItem] = useState6("");
1956
+ const isDragging = !!draggedItem;
1950
1957
  const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
1951
1958
  if (field.type !== "array" || !field.arrayFields) {
1952
1959
  return null;
@@ -1962,10 +1969,16 @@ var ArrayField = ({
1962
1969
  children: /* @__PURE__ */ jsx8(
1963
1970
  SortableProvider,
1964
1971
  {
1965
- onDragStart: () => setIsDragging(true),
1966
- onDragEnd: () => setIsDragging(false),
1972
+ onDragStart: (id2) => setDraggedItem(id2),
1973
+ onDragEnd: () => {
1974
+ setDraggedItem("");
1975
+ onChange(localState.value);
1976
+ },
1967
1977
  onMove: (move) => {
1968
- const newValue = reorder(value, move.source, move.target);
1978
+ if (arrayState.items[move.source]._arrayId !== draggedItem) {
1979
+ return;
1980
+ }
1981
+ const newValue = reorder(localState.value, move.source, move.target);
1969
1982
  const newArrayStateItems = reorder(
1970
1983
  arrayState.items,
1971
1984
  move.source,
@@ -1977,7 +1990,6 @@ var ArrayField = ({
1977
1990
  })
1978
1991
  };
1979
1992
  setUi(newUi, false);
1980
- onChange(newValue, newUi);
1981
1993
  setLocalState({
1982
1994
  value: newValue,
1983
1995
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
@@ -1990,11 +2002,8 @@ var ArrayField = ({
1990
2002
  hasItems: Array.isArray(value) && value.length > 0,
1991
2003
  addDisabled
1992
2004
  }),
1993
- onClick: (e) => {
1994
- e.preventDefault();
1995
- },
1996
2005
  children: [
1997
- /* @__PURE__ */ jsx8("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
2006
+ localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx8("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
1998
2007
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1999
2008
  const data = Array.from(localState.value || [])[i] || {};
2000
2009
  return /* @__PURE__ */ jsx8(
@@ -2003,7 +2012,7 @@ var ArrayField = ({
2003
2012
  id: _arrayId,
2004
2013
  index: i,
2005
2014
  disabled: readOnly,
2006
- children: ({ status, ref }) => /* @__PURE__ */ jsxs3(
2015
+ children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
2007
2016
  "div",
2008
2017
  {
2009
2018
  ref,
@@ -2016,6 +2025,7 @@ var ArrayField = ({
2016
2025
  /* @__PURE__ */ jsxs3(
2017
2026
  "div",
2018
2027
  {
2028
+ ref: handleRef,
2019
2029
  onClick: (e) => {
2020
2030
  if (isDragging) return;
2021
2031
  e.preventDefault();
@@ -2093,58 +2103,49 @@ var ArrayField = ({
2093
2103
  ]
2094
2104
  }
2095
2105
  ),
2096
- /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8(
2097
- "fieldset",
2098
- {
2099
- className: getClassNameItem("fieldset"),
2100
- onPointerDownCapture: (e) => {
2101
- e.stopPropagation();
2102
- },
2103
- children: Object.keys(field.arrayFields).map((subName) => {
2104
- const subField = field.arrayFields[subName];
2105
- const indexName = `${name}[${i}]`;
2106
- const subPath = `${indexName}.${subName}`;
2107
- const localIndexName = `${localName}[${i}]`;
2108
- const localWildcardName = `${localName}[*]`;
2109
- const localSubPath = `${localIndexName}.${subName}`;
2110
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
2111
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2112
- const label2 = subField.label || subName;
2113
- return /* @__PURE__ */ jsx8(
2114
- NestedFieldProvider,
2106
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2107
+ const subField = field.arrayFields[subName];
2108
+ const indexName = `${name}[${i}]`;
2109
+ const subPath = `${indexName}.${subName}`;
2110
+ const localIndexName = `${localName}[${i}]`;
2111
+ const localWildcardName = `${localName}[*]`;
2112
+ const localSubPath = `${localIndexName}.${subName}`;
2113
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
2114
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2115
+ const label2 = subField.label || subName;
2116
+ return /* @__PURE__ */ jsx8(
2117
+ NestedFieldProvider,
2118
+ {
2119
+ name: localIndexName,
2120
+ wildcardName: localWildcardName,
2121
+ subName,
2122
+ readOnlyFields,
2123
+ children: /* @__PURE__ */ jsx8(
2124
+ AutoFieldPrivate,
2115
2125
  {
2116
- name: localIndexName,
2117
- wildcardName: localWildcardName,
2118
- subName,
2119
- readOnlyFields,
2120
- children: /* @__PURE__ */ jsx8(
2121
- AutoFieldPrivate,
2122
- {
2123
- name: subPath,
2124
- label: label2,
2125
- id: `${_arrayId}_${subName}`,
2126
- readOnly: subReadOnly,
2127
- field: __spreadProps(__spreadValues({}, subField), {
2128
- label: label2
2129
- // May be used by custom fields
2130
- }),
2131
- value: data[subName],
2132
- onChange: (val, ui) => {
2133
- onChange(
2134
- replace(value, i, __spreadProps(__spreadValues({}, data), {
2135
- [subName]: val
2136
- })),
2137
- ui
2138
- );
2139
- }
2140
- }
2141
- )
2142
- },
2143
- subPath
2144
- );
2145
- })
2146
- }
2147
- ) })
2126
+ name: subPath,
2127
+ label: label2,
2128
+ id: `${_arrayId}_${subName}`,
2129
+ readOnly: subReadOnly,
2130
+ field: __spreadProps(__spreadValues({}, subField), {
2131
+ label: label2
2132
+ // May be used by custom fields
2133
+ }),
2134
+ value: data[subName],
2135
+ onChange: (val, ui) => {
2136
+ onChange(
2137
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
2138
+ [subName]: val
2139
+ })),
2140
+ ui
2141
+ );
2142
+ }
2143
+ }
2144
+ )
2145
+ },
2146
+ subPath
2147
+ );
2148
+ }) }) })
2148
2149
  ]
2149
2150
  }
2150
2151
  )
@@ -2246,7 +2247,7 @@ init_react_import();
2246
2247
  import {
2247
2248
  useMemo as useMemo2,
2248
2249
  useEffect as useEffect7,
2249
- useState as useState10,
2250
+ useState as useState9,
2250
2251
  useCallback as useCallback4,
2251
2252
  isValidElement
2252
2253
  } from "react";
@@ -2257,7 +2258,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
2257
2258
 
2258
2259
  // components/Modal/index.tsx
2259
2260
  init_react_import();
2260
- import { useEffect as useEffect5, useState as useState8 } from "react";
2261
+ import { useEffect as useEffect5, useState as useState7 } from "react";
2261
2262
 
2262
2263
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
2263
2264
  init_react_import();
@@ -2272,7 +2273,7 @@ var Modal = ({
2272
2273
  onClose,
2273
2274
  isOpen
2274
2275
  }) => {
2275
- const [rootEl, setRootEl] = useState8(null);
2276
+ const [rootEl, setRootEl] = useState7(null);
2276
2277
  useEffect5(() => {
2277
2278
  setRootEl(document.getElementById("puck-portal-root"));
2278
2279
  }, []);
@@ -2320,7 +2321,7 @@ init_react_import();
2320
2321
 
2321
2322
  // components/Button/Button.tsx
2322
2323
  init_react_import();
2323
- import { useEffect as useEffect6, useState as useState9 } from "react";
2324
+ import { useEffect as useEffect6, useState as useState8 } from "react";
2324
2325
 
2325
2326
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
2326
2327
  init_react_import();
@@ -2370,7 +2371,7 @@ var Button = (_a) => {
2370
2371
  "size",
2371
2372
  "loading"
2372
2373
  ]);
2373
- const [loading, setLoading] = useState9(loadingProp);
2374
+ const [loading, setLoading] = useState8(loadingProp);
2374
2375
  useEffect6(() => setLoading(loadingProp), [loadingProp]);
2375
2376
  const ElementType = href ? "a" : type ? "button" : "span";
2376
2377
  const dataAttrs = filterDataAttrs(props);
@@ -2426,12 +2427,12 @@ var ExternalInput = ({
2426
2427
  mapRow = (val) => val,
2427
2428
  filterFields
2428
2429
  } = field || {};
2429
- const [data, setData] = useState10([]);
2430
- const [isOpen, setOpen] = useState10(false);
2431
- const [isLoading, setIsLoading] = useState10(true);
2430
+ const [data, setData] = useState9([]);
2431
+ const [isOpen, setOpen] = useState9(false);
2432
+ const [isLoading, setIsLoading] = useState9(true);
2432
2433
  const hasFilterFields = !!filterFields;
2433
- const [filters, setFilters] = useState10(field.initialFilters || {});
2434
- const [filtersToggled, setFiltersToggled] = useState10(hasFilterFields);
2434
+ const [filters, setFilters] = useState9(field.initialFilters || {});
2435
+ const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
2435
2436
  const mappedData = useMemo2(() => {
2436
2437
  return data.map(mapRow);
2437
2438
  }, [data]);
@@ -2446,7 +2447,7 @@ var ExternalInput = ({
2446
2447
  }
2447
2448
  return Array.from(validKeys);
2448
2449
  }, [mappedData]);
2449
- const [searchQuery, setSearchQuery] = useState10(field.initialQuery || "");
2450
+ const [searchQuery, setSearchQuery] = useState9(field.initialQuery || "");
2450
2451
  const search = useCallback4(
2451
2452
  (query, filters2) => __async(void 0, null, function* () {
2452
2453
  setIsLoading(true);
@@ -2915,7 +2916,7 @@ var ObjectField = ({
2915
2916
 
2916
2917
  // lib/use-safe-id.ts
2917
2918
  init_react_import();
2918
- import React2, { useState as useState11 } from "react";
2919
+ import React2, { useState as useState10 } from "react";
2919
2920
 
2920
2921
  // lib/generate-id.ts
2921
2922
  init_react_import();
@@ -2927,7 +2928,7 @@ var useSafeId = () => {
2927
2928
  if (typeof React2.useId !== "undefined") {
2928
2929
  return React2.useId();
2929
2930
  }
2930
- const [id] = useState11(generateId());
2931
+ const [id] = useState10(generateId());
2931
2932
  return id;
2932
2933
  };
2933
2934
 
@@ -3073,7 +3074,7 @@ function AutoFieldInternal(props) {
3073
3074
  function AutoFieldPrivate(props) {
3074
3075
  const { state } = useAppContext();
3075
3076
  const { value, onChange } = props;
3076
- const [localValue, setLocalValue] = useState12(value);
3077
+ const [localValue, setLocalValue] = useState11(value);
3077
3078
  const onChangeDb = useDebouncedCallback(
3078
3079
  (val, ui) => {
3079
3080
  onChange(val, ui);
@@ -3081,10 +3082,13 @@ function AutoFieldPrivate(props) {
3081
3082
  50,
3082
3083
  { leading: true }
3083
3084
  );
3084
- const onChangeLocal = useCallback5((val, ui) => {
3085
- setLocalValue(val);
3086
- onChangeDb(val, ui);
3087
- }, []);
3085
+ const onChangeLocal = useCallback5(
3086
+ (val, ui) => {
3087
+ setLocalValue(val);
3088
+ onChangeDb(val, ui);
3089
+ },
3090
+ [onChange]
3091
+ );
3088
3092
  useEffect9(() => {
3089
3093
  if (state.ui.field.focus !== props.name) {
3090
3094
  setLocalValue(value);
@@ -3117,7 +3121,7 @@ init_react_import();
3117
3121
  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" };
3118
3122
 
3119
3123
  // components/Drawer/index.tsx
3120
- import { useId as useId2, useMemo as useMemo9, useState as useState19 } from "react";
3124
+ import { useId as useId2, useMemo as useMemo9, useState as useState18 } from "react";
3121
3125
 
3122
3126
  // components/DragDropContext/index.tsx
3123
3127
  init_react_import();
@@ -3128,8 +3132,8 @@ import {
3128
3132
  useContext as useContext7,
3129
3133
  useEffect as useEffect15,
3130
3134
  useId,
3131
- useRef as useRef3,
3132
- useState as useState18
3135
+ useRef as useRef4,
3136
+ useState as useState17
3133
3137
  } from "react";
3134
3138
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
3135
3139
 
@@ -3141,7 +3145,7 @@ import {
3141
3145
  useContext as useContext6,
3142
3146
  useEffect as useEffect14,
3143
3147
  useMemo as useMemo8,
3144
- useRef as useRef2
3148
+ useRef as useRef3
3145
3149
  } from "react";
3146
3150
 
3147
3151
  // components/DraggableComponent/index.tsx
@@ -3151,8 +3155,8 @@ import {
3151
3155
  useContext as useContext5,
3152
3156
  useEffect as useEffect10,
3153
3157
  useMemo as useMemo7,
3154
- useRef,
3155
- useState as useState14
3158
+ useRef as useRef2,
3159
+ useState as useState13
3156
3160
  } from "react";
3157
3161
 
3158
3162
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
@@ -3187,7 +3191,7 @@ import {
3187
3191
  createContext as createContext3,
3188
3192
  useCallback as useCallback6,
3189
3193
  useMemo as useMemo6,
3190
- useState as useState13
3194
+ useState as useState12
3191
3195
  } from "react";
3192
3196
  import { createStore as createStore2 } from "zustand";
3193
3197
  import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
@@ -3212,11 +3216,11 @@ var DropZoneProvider = ({
3212
3216
  children,
3213
3217
  value
3214
3218
  }) => {
3215
- const [hoveringComponent, setHoveringComponent] = useState13();
3216
- const [areasWithZones, setAreasWithZones] = useState13(
3219
+ const [hoveringComponent, setHoveringComponent] = useState12();
3220
+ const [areasWithZones, setAreasWithZones] = useState12(
3217
3221
  {}
3218
3222
  );
3219
- const [activeZones, setActiveZones] = useState13({});
3223
+ const [activeZones, setActiveZones] = useState12({});
3220
3224
  const { dispatch } = useAppContext();
3221
3225
  const registerZoneArea = useCallback6(
3222
3226
  (area) => {
@@ -3333,7 +3337,7 @@ var DraggableComponent = ({
3333
3337
  state
3334
3338
  } = useAppContext();
3335
3339
  const ctx = useContext5(dropZoneContext);
3336
- const [localZones, setLocalZones] = useState14({});
3340
+ const [localZones, setLocalZones] = useState13({});
3337
3341
  const registerLocalZone = useCallback7(
3338
3342
  (zoneCompound2, active) => {
3339
3343
  var _a;
@@ -3358,7 +3362,7 @@ var DraggableComponent = ({
3358
3362
  );
3359
3363
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
3360
3364
  const { path = [] } = ctx || {};
3361
- const [canDrag, setCanDrag] = useState14(false);
3365
+ const [canDrag, setCanDrag] = useState13(false);
3362
3366
  useEffect10(() => {
3363
3367
  var _a;
3364
3368
  const item = getItem({ index, zone: zoneCompound }, state.data);
@@ -3375,7 +3379,7 @@ var DraggableComponent = ({
3375
3379
  );
3376
3380
  const canCollide = canDrag || userIsDragging;
3377
3381
  const disabled = !isEnabled || !canCollide;
3378
- const [dragAxis, setDragAxis] = useState14(userDragAxis || autoDragAxis);
3382
+ const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
3379
3383
  const { ref: sortableRef, status } = useSortableSafe({
3380
3384
  id,
3381
3385
  index,
@@ -3401,7 +3405,7 @@ var DraggableComponent = ({
3401
3405
  }
3402
3406
  });
3403
3407
  const thisIsDragging = status === "dragging";
3404
- const ref = useRef(null);
3408
+ const ref = useRef2(null);
3405
3409
  const refSetter = useCallback7(
3406
3410
  (el) => {
3407
3411
  sortableRef(el);
@@ -3411,7 +3415,7 @@ var DraggableComponent = ({
3411
3415
  },
3412
3416
  [sortableRef]
3413
3417
  );
3414
- const [portalEl, setPortalEl] = useState14();
3418
+ const [portalEl, setPortalEl] = useState13();
3415
3419
  useEffect10(() => {
3416
3420
  var _a, _b, _c;
3417
3421
  setPortalEl(
@@ -3438,7 +3442,7 @@ var DraggableComponent = ({
3438
3442
  };
3439
3443
  return style2;
3440
3444
  }, [ref.current]);
3441
- const [style, setStyle] = useState14();
3445
+ const [style, setStyle] = useState13();
3442
3446
  const sync = useCallback7(() => {
3443
3447
  setStyle(getStyle());
3444
3448
  }, [ref.current, iframe]);
@@ -3516,7 +3520,7 @@ var DraggableComponent = ({
3516
3520
  zone: zoneCompound
3517
3521
  });
3518
3522
  }, [index, zoneCompound]);
3519
- const [hover, setHover] = useState14(false);
3523
+ const [hover, setHover] = useState13(false);
3520
3524
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3521
3525
  useEffect10(() => {
3522
3526
  if (!ref.current) {
@@ -3577,7 +3581,7 @@ var DraggableComponent = ({
3577
3581
  };
3578
3582
  }
3579
3583
  }, [disabled, ref]);
3580
- const [isVisible, setIsVisible] = useState14(false);
3584
+ const [isVisible, setIsVisible] = useState13(false);
3581
3585
  useEffect10(() => {
3582
3586
  sync();
3583
3587
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
@@ -3594,10 +3598,18 @@ var DraggableComponent = ({
3594
3598
  const rect = el.getBoundingClientRect();
3595
3599
  const diffLeft = rect.x;
3596
3600
  const exceedsBoundsLeft = diffLeft < 0;
3601
+ const diffTop = rect.y;
3602
+ const exceedsBoundsTop = diffTop < 0;
3597
3603
  if (exceedsBoundsLeft) {
3598
3604
  el.style.transformOrigin = "left top";
3599
3605
  el.style.left = "0px";
3600
3606
  }
3607
+ if (exceedsBoundsTop) {
3608
+ el.style.top = "12px";
3609
+ if (!exceedsBoundsLeft) {
3610
+ el.style.transformOrigin = "right top";
3611
+ }
3612
+ }
3601
3613
  }
3602
3614
  }
3603
3615
  },
@@ -3697,14 +3709,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
3697
3709
 
3698
3710
  // components/DropZone/lib/use-min-empty-height.ts
3699
3711
  init_react_import();
3700
- import { useEffect as useEffect11, useState as useState15 } from "react";
3712
+ import { useEffect as useEffect11, useState as useState14 } from "react";
3701
3713
  var useMinEmptyHeight = ({
3702
3714
  zoneCompound,
3703
3715
  userMinEmptyHeight,
3704
3716
  ref
3705
3717
  }) => {
3706
- const [prevHeight, setPrevHeight] = useState15(0);
3707
- const [isAnimating, setIsAnimating] = useState15(false);
3718
+ const [prevHeight, setPrevHeight] = useState14(0);
3719
+ const [isAnimating, setIsAnimating] = useState14(false);
3708
3720
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3709
3721
  var _a, _b;
3710
3722
  return {
@@ -3746,7 +3758,7 @@ function assignRefs(refs, node) {
3746
3758
 
3747
3759
  // components/DropZone/lib/use-content-with-preview.ts
3748
3760
  init_react_import();
3749
- import { useEffect as useEffect12, useState as useState16 } from "react";
3761
+ import { useEffect as useEffect12, useState as useState15 } from "react";
3750
3762
 
3751
3763
  // lib/dnd/use-rendered-callback.ts
3752
3764
  init_react_import();
@@ -3789,8 +3801,8 @@ var useContentWithPreview = (content, zoneCompound) => {
3789
3801
  ui: { isDragging }
3790
3802
  }
3791
3803
  } = useAppContext();
3792
- const [contentWithPreview, setContentWithPreview] = useState16(content);
3793
- const [localPreview, setLocalPreview] = useState16(
3804
+ const [contentWithPreview, setContentWithPreview] = useState15(content);
3805
+ const [localPreview, setLocalPreview] = useState15(
3794
3806
  preview
3795
3807
  );
3796
3808
  const updateContent = useRenderedCallback(
@@ -3839,13 +3851,13 @@ var useContentWithPreview = (content, zoneCompound) => {
3839
3851
 
3840
3852
  // components/DropZone/lib/use-drag-axis.ts
3841
3853
  init_react_import();
3842
- import { useCallback as useCallback9, useEffect as useEffect13, useState as useState17 } from "react";
3854
+ import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
3843
3855
  var GRID_DRAG_AXIS = "dynamic";
3844
3856
  var FLEX_ROW_DRAG_AXIS = "x";
3845
3857
  var DEFAULT_DRAG_AXIS = "y";
3846
3858
  var useDragAxis = (ref, collisionAxis) => {
3847
3859
  const { status } = useAppContext();
3848
- const [dragAxis, setDragAxis] = useState17(
3860
+ const [dragAxis, setDragAxis] = useState16(
3849
3861
  collisionAxis || DEFAULT_DRAG_AXIS
3850
3862
  );
3851
3863
  const calculateDragAxis = useCallback9(() => {
@@ -3947,7 +3959,7 @@ var DropZoneEdit = forwardRef3(
3947
3959
  }
3948
3960
  return data.content || [];
3949
3961
  }, [data, zoneCompound]);
3950
- const ref = useRef2(null);
3962
+ const ref = useRef3(null);
3951
3963
  const acceptsTarget = useCallback10(
3952
3964
  (componentType) => {
3953
3965
  if (!componentType) {
@@ -4870,7 +4882,7 @@ function useDragListener(type, fn, deps = []) {
4870
4882
  }
4871
4883
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4872
4884
  var useTempDisableFallback = (timeout3) => {
4873
- const lastFallbackDisable = useRef3(null);
4885
+ const lastFallbackDisable = useRef4(null);
4874
4886
  return useCallback11((manager) => {
4875
4887
  collisionStore.setState({ fallbackEnabled: false });
4876
4888
  const fallbackId = generateId();
@@ -4890,9 +4902,9 @@ var DragDropContextClient = ({
4890
4902
  const { state, config, dispatch, resolveData } = useAppContext();
4891
4903
  const id = useId();
4892
4904
  const { data } = state;
4893
- const debouncedParamsRef = useRef3(null);
4905
+ const debouncedParamsRef = useRef4(null);
4894
4906
  const tempDisableFallback = useTempDisableFallback(100);
4895
- const [zoneStore] = useState18(
4907
+ const [zoneStore] = useState17(
4896
4908
  () => createStore3(() => ({
4897
4909
  zoneDepthIndex: {},
4898
4910
  nextZoneDepthIndex: {},
@@ -4961,7 +4973,7 @@ var DragDropContextClient = ({
4961
4973
  );
4962
4974
  }
4963
4975
  }, []);
4964
- const [plugins] = useState18(() => [
4976
+ const [plugins] = useState17(() => [
4965
4977
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4966
4978
  createNestedDroppablePlugin(
4967
4979
  {
@@ -5009,9 +5021,9 @@ var DragDropContextClient = ({
5009
5021
  )
5010
5022
  ]);
5011
5023
  const sensors = useSensors();
5012
- const [dragListeners, setDragListeners] = useState18({});
5013
- const [pathData, setPathData] = useState18();
5014
- const dragMode = useRef3(null);
5024
+ const [dragListeners, setDragListeners] = useState17({});
5025
+ const [pathData, setPathData] = useState17();
5026
+ const dragMode = useRef4(null);
5015
5027
  const registerPath = useCallback11(
5016
5028
  (id2, selector, label) => {
5017
5029
  const [area] = getZoneId(selector.zone);
@@ -5040,7 +5052,7 @@ var DragDropContextClient = ({
5040
5052
  },
5041
5053
  [data, setPathData]
5042
5054
  );
5043
- const initialSelector = useRef3(void 0);
5055
+ const initialSelector = useRef4(void 0);
5044
5056
  return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
5045
5057
  dragListenerContext.Provider,
5046
5058
  {
@@ -5332,7 +5344,7 @@ var DrawerItem = ({
5332
5344
  isDragDisabled
5333
5345
  }) => {
5334
5346
  const resolvedId = id || name;
5335
- const [dynamicId, setDynamicId] = useState19(generateId(resolvedId));
5347
+ const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
5336
5348
  if (typeof index !== "undefined") {
5337
5349
  console.error(
5338
5350
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5398,7 +5410,7 @@ import {
5398
5410
  useEffect as useEffect24,
5399
5411
  useMemo as useMemo19,
5400
5412
  useReducer,
5401
- useState as useState27
5413
+ useState as useState26
5402
5414
  } from "react";
5403
5415
 
5404
5416
  // components/SidebarSection/index.tsx
@@ -5599,7 +5611,7 @@ import { useMemo as useMemo12 } from "react";
5599
5611
 
5600
5612
  // lib/use-resolved-fields.ts
5601
5613
  init_react_import();
5602
- import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef5, useState as useState20 } from "react";
5614
+ import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as useState19 } from "react";
5603
5615
 
5604
5616
  // lib/use-parent.ts
5605
5617
  init_react_import();
@@ -5627,9 +5639,9 @@ var useParent = () => {
5627
5639
 
5628
5640
  // lib/use-on-value-change.ts
5629
5641
  init_react_import();
5630
- import { useRef as useRef4, useEffect as useEffect16 } from "react";
5642
+ import { useRef as useRef5, useEffect as useEffect16 } from "react";
5631
5643
  function useOnValueChange(value, onChange, compare = Object.is, deps = []) {
5632
- const tracked = useRef4(value);
5644
+ const tracked = useRef5(value);
5633
5645
  useEffect16(() => {
5634
5646
  const oldValue = tracked.current;
5635
5647
  if (!compare(value, oldValue)) {
@@ -5662,13 +5674,13 @@ var useResolvedFields = ({
5662
5674
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5663
5675
  );
5664
5676
  const rootProps = data.root.props || data.root;
5665
- const [lastSelectedData, setLastSelectedData] = useState20({});
5666
- const [resolvedFields, setResolvedFields] = useState20({
5677
+ const [lastSelectedData, setLastSelectedData] = useState19({});
5678
+ const [resolvedFields, setResolvedFields] = useState19({
5667
5679
  fields: defaultFields,
5668
5680
  id: selectedItem == null ? void 0 : selectedItem.props.id
5669
5681
  });
5670
- const [fieldsLoading, setFieldsLoading] = useState20(false);
5671
- const lastFields = useRef5(defaultFields);
5682
+ const [fieldsLoading, setFieldsLoading] = useState19(false);
5683
+ const lastFields = useRef6(defaultFields);
5672
5684
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5673
5685
  const componentData = useMemo11(
5674
5686
  () => selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly || {} },
@@ -5911,7 +5923,7 @@ init_react_import();
5911
5923
 
5912
5924
  // lib/use-component-list.tsx
5913
5925
  init_react_import();
5914
- import { useEffect as useEffect18, useState as useState21 } from "react";
5926
+ import { useEffect as useEffect18, useState as useState20 } from "react";
5915
5927
 
5916
5928
  // components/ComponentList/index.tsx
5917
5929
  init_react_import();
@@ -5978,7 +5990,7 @@ ComponentList.Item = ComponentListItem;
5978
5990
  // lib/use-component-list.tsx
5979
5991
  import { jsx as jsx29 } from "react/jsx-runtime";
5980
5992
  var useComponentList = (config, ui) => {
5981
- const [componentList, setComponentList] = useState21();
5993
+ const [componentList, setComponentList] = useState20();
5982
5994
  useEffect18(() => {
5983
5995
  var _a, _b, _c;
5984
5996
  if (Object.keys(ui.componentList).length > 0) {
@@ -6059,7 +6071,7 @@ var Components = () => {
6059
6071
 
6060
6072
  // components/Puck/components/Preview/index.tsx
6061
6073
  init_react_import();
6062
- import { useCallback as useCallback14, useEffect as useEffect20, useRef as useRef7, useMemo as useMemo14 } from "react";
6074
+ import { useCallback as useCallback14, useEffect as useEffect20, useRef as useRef8, useMemo as useMemo14 } from "react";
6063
6075
 
6064
6076
  // components/AutoFrame/index.tsx
6065
6077
  init_react_import();
@@ -6067,7 +6079,7 @@ import {
6067
6079
  createContext as createContext5,
6068
6080
  useContext as useContext10,
6069
6081
  useEffect as useEffect19,
6070
- useState as useState22
6082
+ useState as useState21
6071
6083
  } from "react";
6072
6084
  import hash from "object-hash";
6073
6085
  import { createPortal as createPortal3 } from "react-dom";
@@ -6291,9 +6303,9 @@ function AutoFrame(_a) {
6291
6303
  "onStylesLoaded",
6292
6304
  "frameRef"
6293
6305
  ]);
6294
- const [loaded, setLoaded] = useState22(false);
6295
- const [ctx, setCtx] = useState22({});
6296
- const [mountTarget, setMountTarget] = useState22();
6306
+ const [loaded, setLoaded] = useState21(false);
6307
+ const [ctx, setCtx] = useState21({});
6308
+ const [mountTarget, setMountTarget] = useState21();
6297
6309
  useEffect19(() => {
6298
6310
  var _a2;
6299
6311
  if (frameRef.current) {
@@ -6433,7 +6445,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
6433
6445
  );
6434
6446
  const Frame = useMemo14(() => overrides.iframe, [overrides]);
6435
6447
  const rootProps = state.data.root.props || state.data.root;
6436
- const ref = useRef7(null);
6448
+ const ref = useRef8(null);
6437
6449
  useBubbleIframeEvents(ref);
6438
6450
  const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx33(
6439
6451
  Page,
@@ -6812,19 +6824,19 @@ function usePuckHistory({
6812
6824
 
6813
6825
  // lib/use-history-store.ts
6814
6826
  init_react_import();
6815
- import { useState as useState23 } from "react";
6827
+ import { useState as useState22 } from "react";
6816
6828
  import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
6817
6829
  var EMPTY_HISTORY_INDEX = 0;
6818
6830
  function useHistoryStore(initialHistory) {
6819
6831
  var _a, _b;
6820
- const [histories, setHistories] = useState23(
6832
+ const [histories, setHistories] = useState22(
6821
6833
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6822
6834
  );
6823
6835
  const updateHistories = (histories2) => {
6824
6836
  setHistories(histories2);
6825
6837
  setIndex(histories2.length - 1);
6826
6838
  };
6827
- const [index, setIndex] = useState23(
6839
+ const [index, setIndex] = useState22(
6828
6840
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6829
6841
  );
6830
6842
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6988,13 +7000,13 @@ import {
6988
7000
  useCallback as useCallback16,
6989
7001
  useEffect as useEffect22,
6990
7002
  useMemo as useMemo17,
6991
- useRef as useRef8,
6992
- useState as useState25
7003
+ useRef as useRef9,
7004
+ useState as useState24
6993
7005
  } from "react";
6994
7006
 
6995
7007
  // components/ViewportControls/index.tsx
6996
7008
  init_react_import();
6997
- import { useEffect as useEffect21, useMemo as useMemo16, useState as useState24 } from "react";
7009
+ import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
6998
7010
 
6999
7011
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7000
7012
  init_react_import();
@@ -7017,7 +7029,7 @@ var ViewportButton = ({
7017
7029
  onClick
7018
7030
  }) => {
7019
7031
  const { state } = useAppContext();
7020
- const [isActive, setIsActive] = useState24(false);
7032
+ const [isActive, setIsActive] = useState23(false);
7021
7033
  useEffect21(() => {
7022
7034
  setIsActive(width === state.ui.viewports.current.width);
7023
7035
  }, [width, state.ui.viewports.current.width]);
@@ -7177,8 +7189,8 @@ var Canvas = () => {
7177
7189
  const { status, iframe } = useAppContext();
7178
7190
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
7179
7191
  const { ui } = state;
7180
- const frameRef = useRef8(null);
7181
- const [showTransition, setShowTransition] = useState25(false);
7192
+ const frameRef = useRef9(null);
7193
+ const [showTransition, setShowTransition] = useState24(false);
7182
7194
  const defaultRender = useMemo17(() => {
7183
7195
  const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
7184
7196
  return PuckDefault;
@@ -7233,7 +7245,7 @@ var Canvas = () => {
7233
7245
  window.removeEventListener("resize", cb);
7234
7246
  };
7235
7247
  }, []);
7236
- const [showLoader, setShowLoader] = useState25(false);
7248
+ const [showLoader, setShowLoader] = useState24(false);
7237
7249
  useEffect22(() => {
7238
7250
  setTimeout(() => {
7239
7251
  setShowLoader(true);
@@ -7363,10 +7375,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
7363
7375
 
7364
7376
  // lib/use-inject-css.ts
7365
7377
  init_react_import();
7366
- import { useEffect as useEffect23, useState as useState26 } from "react";
7378
+ import { useEffect as useEffect23, useState as useState25 } from "react";
7367
7379
  var styles = ``;
7368
7380
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7369
- const [el, setEl] = useState26();
7381
+ const [el, setEl] = useState25();
7370
7382
  useEffect23(() => {
7371
7383
  setEl(document.createElement("style"));
7372
7384
  }, []);
@@ -7450,7 +7462,7 @@ function Puck({
7450
7462
  waitForStyles: true
7451
7463
  }, _iframe);
7452
7464
  useInjectGlobalCss(iframe.enabled);
7453
- const [generatedAppState] = useState27(() => {
7465
+ const [generatedAppState] = useState26(() => {
7454
7466
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
7455
7467
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7456
7468
  let clientUiState = {};
@@ -7522,7 +7534,7 @@ function Puck({
7522
7534
  histories,
7523
7535
  index: initialHistoryIndex
7524
7536
  });
7525
- const [reducer] = useState27(
7537
+ const [reducer] = useState26(
7526
7538
  () => createReducer({
7527
7539
  config,
7528
7540
  record: historyStore.record,
@@ -7540,7 +7552,7 @@ function Puck({
7540
7552
  historyStore,
7541
7553
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7542
7554
  });
7543
- const [menuOpen, setMenuOpen] = useState27(false);
7555
+ const [menuOpen, setMenuOpen] = useState26(false);
7544
7556
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7545
7557
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7546
7558
  useEffect24(() => {
@@ -7627,7 +7639,7 @@ function Puck({
7627
7639
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7628
7640
  [loadedOverrides]
7629
7641
  );
7630
- const [mounted, setMounted] = useState27(false);
7642
+ const [mounted, setMounted] = useState26(false);
7631
7643
  useEffect24(() => {
7632
7644
  setMounted(true);
7633
7645
  }, []);
@@ -7814,40 +7826,6 @@ function migrate(data) {
7814
7826
  return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
7815
7827
  }
7816
7828
 
7817
- // lib/transform-props.ts
7818
- init_react_import();
7819
- function transformProps(data, propTransforms) {
7820
- const mapItem = (item) => {
7821
- if (propTransforms[item.type]) {
7822
- return __spreadProps(__spreadValues({}, item), {
7823
- props: propTransforms[item.type](item.props)
7824
- });
7825
- }
7826
- return item;
7827
- };
7828
- const defaultedData = defaultData(data);
7829
- const rootProps = defaultedData.root.props || defaultedData.root;
7830
- let newRoot = __spreadValues({}, defaultedData.root);
7831
- if (propTransforms["root"]) {
7832
- if (defaultedData.root.props) {
7833
- newRoot.props = propTransforms["root"](rootProps);
7834
- } else {
7835
- newRoot = propTransforms["root"](rootProps);
7836
- }
7837
- }
7838
- const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
7839
- root: newRoot,
7840
- content: defaultedData.content.map(mapItem),
7841
- zones: Object.keys(data.zones || {}).reduce(
7842
- (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
7843
- [zoneKey]: data.zones[zoneKey].map(mapItem)
7844
- }),
7845
- {}
7846
- )
7847
- });
7848
- return afterPropTransforms;
7849
- }
7850
-
7851
7829
  // lib/use-puck.ts
7852
7830
  init_react_import();
7853
7831
  var usePuck = () => {