@measured/puck 0.18.3-canary.098fdd1 → 0.18.3-canary.1d484ee
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/{chunk-CHWFBYEM.mjs → chunk-4QIG6FWS.mjs} +44 -8
- package/dist/index.css +13 -0
- package/dist/index.d.mts +3 -14
- package/dist/index.d.ts +3 -14
- package/dist/index.js +434 -433
- package/dist/index.mjs +275 -308
- package/dist/{resolve-all-data-ppm982Jh.d.mts → resolve-all-data-ChsqfT2w.d.mts} +12 -1
- package/dist/{resolve-all-data-ppm982Jh.d.ts → resolve-all-data-ChsqfT2w.d.ts} +12 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +37 -2
- package/dist/rsc.mjs +5 -3
- package/package.json +1 -1
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
|
-
|
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
|
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,
|
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
|
1411
|
+
return mouse;
|
1405
1412
|
}
|
1406
|
-
const delay = { value: 200, tolerance: 10 };
|
1407
1413
|
if (pointerType === "touch") {
|
1408
|
-
return
|
1414
|
+
return touch;
|
1409
1415
|
}
|
1410
|
-
return
|
1411
|
-
delay,
|
1412
|
-
distance: { value: 5 }
|
1413
|
-
};
|
1416
|
+
return other;
|
1414
1417
|
}
|
1415
1418
|
})
|
1416
1419
|
]);
|
@@ -1756,31 +1759,27 @@ 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
|
-
container,
|
1763
1764
|
children,
|
1764
1765
|
onDragStart,
|
1765
1766
|
onDragEnd,
|
1766
1767
|
onMove
|
1767
1768
|
}) => {
|
1768
|
-
const
|
1769
|
-
|
1769
|
+
const sensors = useSensors({
|
1770
|
+
mouse: { distance: { value: 5 } }
|
1771
|
+
});
|
1770
1772
|
return /* @__PURE__ */ jsx6(
|
1771
1773
|
DragDropProvider,
|
1772
1774
|
{
|
1773
1775
|
sensors,
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
}
|
1779
|
-
})
|
1780
|
-
],
|
1781
|
-
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
|
+
},
|
1782
1780
|
onDragOver: (event, manager) => {
|
1783
1781
|
var _a, _b;
|
1782
|
+
event.preventDefault();
|
1784
1783
|
const { operation } = event;
|
1785
1784
|
const { source, target } = operation;
|
1786
1785
|
if (!source || !target) return;
|
@@ -1788,14 +1787,14 @@ var SortableProvider = ({
|
|
1788
1787
|
let targetIndex = target.data.index;
|
1789
1788
|
const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
|
1790
1789
|
if (sourceIndex !== targetIndex && source.id !== target.id) {
|
1791
|
-
const collisionPosition =
|
1790
|
+
const collisionPosition = collisionData.direction === "up" ? "before" : "after";
|
1792
1791
|
if (targetIndex >= sourceIndex) {
|
1793
1792
|
targetIndex = targetIndex - 1;
|
1794
1793
|
}
|
1795
1794
|
if (collisionPosition === "after") {
|
1796
1795
|
targetIndex = targetIndex + 1;
|
1797
1796
|
}
|
1798
|
-
|
1797
|
+
onMove({
|
1799
1798
|
source: sourceIndex,
|
1800
1799
|
target: targetIndex
|
1801
1800
|
});
|
@@ -1803,12 +1802,8 @@ var SortableProvider = ({
|
|
1803
1802
|
},
|
1804
1803
|
onDragEnd: () => {
|
1805
1804
|
setTimeout(() => {
|
1806
|
-
if (move.source !== -1 && move.target !== -1) {
|
1807
|
-
onMove(move);
|
1808
|
-
}
|
1809
1805
|
onDragEnd();
|
1810
1806
|
}, 250);
|
1811
|
-
setMove({ source: -1, target: -1 });
|
1812
1807
|
},
|
1813
1808
|
children
|
1814
1809
|
}
|
@@ -1821,7 +1816,11 @@ var Sortable = ({
|
|
1821
1816
|
children,
|
1822
1817
|
type = "item"
|
1823
1818
|
}) => {
|
1824
|
-
const {
|
1819
|
+
const {
|
1820
|
+
ref: sortableRef,
|
1821
|
+
status,
|
1822
|
+
handleRef
|
1823
|
+
} = useSortableSafe({
|
1825
1824
|
id,
|
1826
1825
|
type,
|
1827
1826
|
index,
|
@@ -1829,7 +1828,7 @@ var Sortable = ({
|
|
1829
1828
|
data: { index },
|
1830
1829
|
collisionDetector: createDynamicCollisionDetector("y")
|
1831
1830
|
});
|
1832
|
-
return children({ status, ref: sortableRef });
|
1831
|
+
return children({ status, ref: sortableRef, handleRef });
|
1833
1832
|
};
|
1834
1833
|
|
1835
1834
|
// components/AutoField/context.tsx
|
@@ -1903,10 +1902,16 @@ var ArrayField = ({
|
|
1903
1902
|
}),
|
1904
1903
|
openId: ""
|
1905
1904
|
};
|
1906
|
-
const [localState, setLocalState] =
|
1905
|
+
const [localState, setLocalState] = useState6({ arrayState, value });
|
1906
|
+
const updateLocalState = useCallback3(
|
1907
|
+
(value2) => {
|
1908
|
+
setLocalState({ arrayState, value: value2 });
|
1909
|
+
},
|
1910
|
+
[arrayState]
|
1911
|
+
);
|
1907
1912
|
useEffect4(() => {
|
1908
|
-
|
1909
|
-
}, [value
|
1913
|
+
updateLocalState(value);
|
1914
|
+
}, [value]);
|
1910
1915
|
const mapArrayStateToUi = useCallback3(
|
1911
1916
|
(partialArrayState) => {
|
1912
1917
|
return {
|
@@ -1947,8 +1952,8 @@ var ArrayField = ({
|
|
1947
1952
|
setUi(mapArrayStateToUi(arrayState));
|
1948
1953
|
}
|
1949
1954
|
}, []);
|
1950
|
-
const [
|
1951
|
-
const
|
1955
|
+
const [draggedItem, setDraggedItem] = useState6("");
|
1956
|
+
const isDragging = !!draggedItem;
|
1952
1957
|
const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
|
1953
1958
|
if (field.type !== "array" || !field.arrayFields) {
|
1954
1959
|
return null;
|
@@ -1964,11 +1969,16 @@ var ArrayField = ({
|
|
1964
1969
|
children: /* @__PURE__ */ jsx8(
|
1965
1970
|
SortableProvider,
|
1966
1971
|
{
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1972
|
+
onDragStart: (id2) => setDraggedItem(id2),
|
1973
|
+
onDragEnd: () => {
|
1974
|
+
setDraggedItem("");
|
1975
|
+
onChange(localState.value);
|
1976
|
+
},
|
1970
1977
|
onMove: (move) => {
|
1971
|
-
|
1978
|
+
if (arrayState.items[move.source]._arrayId !== draggedItem) {
|
1979
|
+
return;
|
1980
|
+
}
|
1981
|
+
const newValue = reorder(localState.value, move.source, move.target);
|
1972
1982
|
const newArrayStateItems = reorder(
|
1973
1983
|
arrayState.items,
|
1974
1984
|
move.source,
|
@@ -1980,7 +1990,6 @@ var ArrayField = ({
|
|
1980
1990
|
})
|
1981
1991
|
};
|
1982
1992
|
setUi(newUi, false);
|
1983
|
-
onChange(newValue, newUi);
|
1984
1993
|
setLocalState({
|
1985
1994
|
value: newValue,
|
1986
1995
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
@@ -1994,172 +2003,156 @@ var ArrayField = ({
|
|
1994
2003
|
addDisabled
|
1995
2004
|
}),
|
1996
2005
|
children: [
|
1997
|
-
/* @__PURE__ */ jsx8(
|
1998
|
-
|
1999
|
-
{
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2006
|
+
localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx8("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
|
2007
|
+
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
2008
|
+
const data = Array.from(localState.value || [])[i] || {};
|
2009
|
+
return /* @__PURE__ */ jsx8(
|
2010
|
+
Sortable,
|
2011
|
+
{
|
2012
|
+
id: _arrayId,
|
2013
|
+
index: i,
|
2014
|
+
disabled: readOnly,
|
2015
|
+
children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
|
2016
|
+
"div",
|
2008
2017
|
{
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
{
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
setUi(
|
2037
|
-
mapArrayStateToUi({
|
2038
|
-
openId: _arrayId
|
2039
|
-
})
|
2040
|
-
);
|
2041
|
-
}
|
2042
|
-
},
|
2043
|
-
className: getClassNameItem("summary"),
|
2044
|
-
children: [
|
2045
|
-
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
2046
|
-
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
2047
|
-
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
2048
|
-
/* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
|
2049
|
-
IconButton,
|
2050
|
-
{
|
2051
|
-
type: "button",
|
2052
|
-
disabled: !!addDisabled,
|
2053
|
-
onClick: (e) => {
|
2054
|
-
e.stopPropagation();
|
2055
|
-
const existingValue = [...value || []];
|
2056
|
-
existingValue.splice(
|
2057
|
-
i,
|
2058
|
-
0,
|
2059
|
-
existingValue[i]
|
2060
|
-
);
|
2061
|
-
onChange(
|
2062
|
-
existingValue,
|
2063
|
-
mapArrayStateToUi(
|
2064
|
-
regenerateArrayState(existingValue)
|
2065
|
-
)
|
2066
|
-
);
|
2067
|
-
},
|
2068
|
-
title: "Duplicate",
|
2069
|
-
children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
|
2070
|
-
}
|
2071
|
-
) }),
|
2072
|
-
/* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
|
2073
|
-
IconButton,
|
2074
|
-
{
|
2075
|
-
type: "button",
|
2076
|
-
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
2077
|
-
onClick: (e) => {
|
2078
|
-
e.stopPropagation();
|
2079
|
-
const existingValue = [...value || []];
|
2080
|
-
const existingItems = [
|
2081
|
-
...arrayState.items || []
|
2082
|
-
];
|
2083
|
-
existingValue.splice(i, 1);
|
2084
|
-
existingItems.splice(i, 1);
|
2085
|
-
onChange(
|
2086
|
-
existingValue,
|
2087
|
-
mapArrayStateToUi({
|
2088
|
-
items: existingItems
|
2089
|
-
})
|
2090
|
-
);
|
2091
|
-
},
|
2092
|
-
title: "Delete",
|
2093
|
-
children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
|
2094
|
-
}
|
2095
|
-
) })
|
2096
|
-
] }),
|
2097
|
-
/* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(DragIcon, {}) })
|
2098
|
-
] })
|
2099
|
-
]
|
2018
|
+
ref,
|
2019
|
+
className: getClassNameItem({
|
2020
|
+
isExpanded: arrayState.openId === _arrayId,
|
2021
|
+
isDragging: status === "dragging",
|
2022
|
+
readOnly
|
2023
|
+
}),
|
2024
|
+
children: [
|
2025
|
+
/* @__PURE__ */ jsxs3(
|
2026
|
+
"div",
|
2027
|
+
{
|
2028
|
+
ref: handleRef,
|
2029
|
+
onClick: (e) => {
|
2030
|
+
if (isDragging) return;
|
2031
|
+
e.preventDefault();
|
2032
|
+
e.stopPropagation();
|
2033
|
+
if (arrayState.openId === _arrayId) {
|
2034
|
+
setUi(
|
2035
|
+
mapArrayStateToUi({
|
2036
|
+
openId: ""
|
2037
|
+
})
|
2038
|
+
);
|
2039
|
+
} else {
|
2040
|
+
setUi(
|
2041
|
+
mapArrayStateToUi({
|
2042
|
+
openId: _arrayId
|
2043
|
+
})
|
2044
|
+
);
|
2100
2045
|
}
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
{
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
children: Object.keys(field.arrayFields).map((subName) => {
|
2110
|
-
const subField = field.arrayFields[subName];
|
2111
|
-
const indexName = `${name}[${i}]`;
|
2112
|
-
const subPath = `${indexName}.${subName}`;
|
2113
|
-
const localIndexName = `${localName}[${i}]`;
|
2114
|
-
const localWildcardName = `${localName}[*]`;
|
2115
|
-
const localSubPath = `${localIndexName}.${subName}`;
|
2116
|
-
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
2117
|
-
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
2118
|
-
const label2 = subField.label || subName;
|
2119
|
-
return /* @__PURE__ */ jsx8(
|
2120
|
-
NestedFieldProvider,
|
2046
|
+
},
|
2047
|
+
className: getClassNameItem("summary"),
|
2048
|
+
children: [
|
2049
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
2050
|
+
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
2051
|
+
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
2052
|
+
/* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
|
2053
|
+
IconButton,
|
2121
2054
|
{
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2055
|
+
type: "button",
|
2056
|
+
disabled: !!addDisabled,
|
2057
|
+
onClick: (e) => {
|
2058
|
+
e.stopPropagation();
|
2059
|
+
const existingValue = [...value || []];
|
2060
|
+
existingValue.splice(
|
2061
|
+
i,
|
2062
|
+
0,
|
2063
|
+
existingValue[i]
|
2064
|
+
);
|
2065
|
+
onChange(
|
2066
|
+
existingValue,
|
2067
|
+
mapArrayStateToUi(
|
2068
|
+
regenerateArrayState(existingValue)
|
2069
|
+
)
|
2070
|
+
);
|
2071
|
+
},
|
2072
|
+
title: "Duplicate",
|
2073
|
+
children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
|
2074
|
+
}
|
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
|
+
onChange(
|
2090
|
+
existingValue,
|
2091
|
+
mapArrayStateToUi({
|
2092
|
+
items: existingItems
|
2093
|
+
})
|
2094
|
+
);
|
2095
|
+
},
|
2096
|
+
title: "Delete",
|
2097
|
+
children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
|
2098
|
+
}
|
2099
|
+
) })
|
2100
|
+
] }),
|
2101
|
+
/* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(DragIcon, {}) })
|
2102
|
+
] })
|
2103
|
+
]
|
2104
|
+
}
|
2105
|
+
),
|
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,
|
2125
|
+
{
|
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
|
+
}) }) })
|
2149
|
+
]
|
2150
|
+
}
|
2151
|
+
)
|
2152
|
+
},
|
2153
|
+
_arrayId
|
2154
|
+
);
|
2155
|
+
}) }),
|
2163
2156
|
!addDisabled && /* @__PURE__ */ jsx8(
|
2164
2157
|
"button",
|
2165
2158
|
{
|
@@ -2254,7 +2247,7 @@ init_react_import();
|
|
2254
2247
|
import {
|
2255
2248
|
useMemo as useMemo2,
|
2256
2249
|
useEffect as useEffect7,
|
2257
|
-
useState as
|
2250
|
+
useState as useState9,
|
2258
2251
|
useCallback as useCallback4,
|
2259
2252
|
isValidElement
|
2260
2253
|
} from "react";
|
@@ -2265,7 +2258,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
|
|
2265
2258
|
|
2266
2259
|
// components/Modal/index.tsx
|
2267
2260
|
init_react_import();
|
2268
|
-
import { useEffect as useEffect5, useState as
|
2261
|
+
import { useEffect as useEffect5, useState as useState7 } from "react";
|
2269
2262
|
|
2270
2263
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
2271
2264
|
init_react_import();
|
@@ -2280,7 +2273,7 @@ var Modal = ({
|
|
2280
2273
|
onClose,
|
2281
2274
|
isOpen
|
2282
2275
|
}) => {
|
2283
|
-
const [rootEl, setRootEl] =
|
2276
|
+
const [rootEl, setRootEl] = useState7(null);
|
2284
2277
|
useEffect5(() => {
|
2285
2278
|
setRootEl(document.getElementById("puck-portal-root"));
|
2286
2279
|
}, []);
|
@@ -2328,7 +2321,7 @@ init_react_import();
|
|
2328
2321
|
|
2329
2322
|
// components/Button/Button.tsx
|
2330
2323
|
init_react_import();
|
2331
|
-
import { useEffect as useEffect6, useState as
|
2324
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
2332
2325
|
|
2333
2326
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
2334
2327
|
init_react_import();
|
@@ -2378,7 +2371,7 @@ var Button = (_a) => {
|
|
2378
2371
|
"size",
|
2379
2372
|
"loading"
|
2380
2373
|
]);
|
2381
|
-
const [loading, setLoading] =
|
2374
|
+
const [loading, setLoading] = useState8(loadingProp);
|
2382
2375
|
useEffect6(() => setLoading(loadingProp), [loadingProp]);
|
2383
2376
|
const ElementType = href ? "a" : type ? "button" : "span";
|
2384
2377
|
const dataAttrs = filterDataAttrs(props);
|
@@ -2434,12 +2427,12 @@ var ExternalInput = ({
|
|
2434
2427
|
mapRow = (val) => val,
|
2435
2428
|
filterFields
|
2436
2429
|
} = field || {};
|
2437
|
-
const [data, setData] =
|
2438
|
-
const [isOpen, setOpen] =
|
2439
|
-
const [isLoading, setIsLoading] =
|
2430
|
+
const [data, setData] = useState9([]);
|
2431
|
+
const [isOpen, setOpen] = useState9(false);
|
2432
|
+
const [isLoading, setIsLoading] = useState9(true);
|
2440
2433
|
const hasFilterFields = !!filterFields;
|
2441
|
-
const [filters, setFilters] =
|
2442
|
-
const [filtersToggled, setFiltersToggled] =
|
2434
|
+
const [filters, setFilters] = useState9(field.initialFilters || {});
|
2435
|
+
const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
|
2443
2436
|
const mappedData = useMemo2(() => {
|
2444
2437
|
return data.map(mapRow);
|
2445
2438
|
}, [data]);
|
@@ -2454,7 +2447,7 @@ var ExternalInput = ({
|
|
2454
2447
|
}
|
2455
2448
|
return Array.from(validKeys);
|
2456
2449
|
}, [mappedData]);
|
2457
|
-
const [searchQuery, setSearchQuery] =
|
2450
|
+
const [searchQuery, setSearchQuery] = useState9(field.initialQuery || "");
|
2458
2451
|
const search = useCallback4(
|
2459
2452
|
(query, filters2) => __async(void 0, null, function* () {
|
2460
2453
|
setIsLoading(true);
|
@@ -2923,7 +2916,7 @@ var ObjectField = ({
|
|
2923
2916
|
|
2924
2917
|
// lib/use-safe-id.ts
|
2925
2918
|
init_react_import();
|
2926
|
-
import React2, { useState as
|
2919
|
+
import React2, { useState as useState10 } from "react";
|
2927
2920
|
|
2928
2921
|
// lib/generate-id.ts
|
2929
2922
|
init_react_import();
|
@@ -2935,7 +2928,7 @@ var useSafeId = () => {
|
|
2935
2928
|
if (typeof React2.useId !== "undefined") {
|
2936
2929
|
return React2.useId();
|
2937
2930
|
}
|
2938
|
-
const [id] =
|
2931
|
+
const [id] = useState10(generateId());
|
2939
2932
|
return id;
|
2940
2933
|
};
|
2941
2934
|
|
@@ -3081,7 +3074,7 @@ function AutoFieldInternal(props) {
|
|
3081
3074
|
function AutoFieldPrivate(props) {
|
3082
3075
|
const { state } = useAppContext();
|
3083
3076
|
const { value, onChange } = props;
|
3084
|
-
const [localValue, setLocalValue] =
|
3077
|
+
const [localValue, setLocalValue] = useState11(value);
|
3085
3078
|
const onChangeDb = useDebouncedCallback(
|
3086
3079
|
(val, ui) => {
|
3087
3080
|
onChange(val, ui);
|
@@ -3128,7 +3121,7 @@ init_react_import();
|
|
3128
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" };
|
3129
3122
|
|
3130
3123
|
// components/Drawer/index.tsx
|
3131
|
-
import { useMemo as useMemo9, useState as
|
3124
|
+
import { useMemo as useMemo9, useState as useState18 } from "react";
|
3132
3125
|
|
3133
3126
|
// components/DragDropContext/index.tsx
|
3134
3127
|
init_react_import();
|
@@ -3139,7 +3132,7 @@ import {
|
|
3139
3132
|
useContext as useContext7,
|
3140
3133
|
useEffect as useEffect15,
|
3141
3134
|
useRef as useRef4,
|
3142
|
-
useState as
|
3135
|
+
useState as useState17
|
3143
3136
|
} from "react";
|
3144
3137
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
3145
3138
|
|
@@ -3162,7 +3155,7 @@ import {
|
|
3162
3155
|
useEffect as useEffect10,
|
3163
3156
|
useMemo as useMemo7,
|
3164
3157
|
useRef as useRef2,
|
3165
|
-
useState as
|
3158
|
+
useState as useState13
|
3166
3159
|
} from "react";
|
3167
3160
|
|
3168
3161
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -3197,7 +3190,7 @@ import {
|
|
3197
3190
|
createContext as createContext3,
|
3198
3191
|
useCallback as useCallback6,
|
3199
3192
|
useMemo as useMemo6,
|
3200
|
-
useState as
|
3193
|
+
useState as useState12
|
3201
3194
|
} from "react";
|
3202
3195
|
import { createStore as createStore2 } from "zustand";
|
3203
3196
|
import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
|
@@ -3222,11 +3215,11 @@ var DropZoneProvider = ({
|
|
3222
3215
|
children,
|
3223
3216
|
value
|
3224
3217
|
}) => {
|
3225
|
-
const [hoveringComponent, setHoveringComponent] =
|
3226
|
-
const [areasWithZones, setAreasWithZones] =
|
3218
|
+
const [hoveringComponent, setHoveringComponent] = useState12();
|
3219
|
+
const [areasWithZones, setAreasWithZones] = useState12(
|
3227
3220
|
{}
|
3228
3221
|
);
|
3229
|
-
const [activeZones, setActiveZones] =
|
3222
|
+
const [activeZones, setActiveZones] = useState12({});
|
3230
3223
|
const { dispatch } = useAppContext();
|
3231
3224
|
const registerZoneArea = useCallback6(
|
3232
3225
|
(area) => {
|
@@ -3343,7 +3336,7 @@ var DraggableComponent = ({
|
|
3343
3336
|
state
|
3344
3337
|
} = useAppContext();
|
3345
3338
|
const ctx = useContext5(dropZoneContext);
|
3346
|
-
const [localZones, setLocalZones] =
|
3339
|
+
const [localZones, setLocalZones] = useState13({});
|
3347
3340
|
const registerLocalZone = useCallback7(
|
3348
3341
|
(zoneCompound2, active) => {
|
3349
3342
|
var _a;
|
@@ -3368,7 +3361,7 @@ var DraggableComponent = ({
|
|
3368
3361
|
);
|
3369
3362
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
3370
3363
|
const { path = [] } = ctx || {};
|
3371
|
-
const [canDrag, setCanDrag] =
|
3364
|
+
const [canDrag, setCanDrag] = useState13(false);
|
3372
3365
|
useEffect10(() => {
|
3373
3366
|
var _a;
|
3374
3367
|
const item = getItem({ index, zone: zoneCompound }, state.data);
|
@@ -3385,7 +3378,7 @@ var DraggableComponent = ({
|
|
3385
3378
|
);
|
3386
3379
|
const canCollide = canDrag || userIsDragging;
|
3387
3380
|
const disabled = !isEnabled || !canCollide;
|
3388
|
-
const [dragAxis, setDragAxis] =
|
3381
|
+
const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
|
3389
3382
|
const { ref: sortableRef, status } = useSortableSafe({
|
3390
3383
|
id,
|
3391
3384
|
index,
|
@@ -3421,7 +3414,7 @@ var DraggableComponent = ({
|
|
3421
3414
|
},
|
3422
3415
|
[sortableRef]
|
3423
3416
|
);
|
3424
|
-
const [portalEl, setPortalEl] =
|
3417
|
+
const [portalEl, setPortalEl] = useState13();
|
3425
3418
|
useEffect10(() => {
|
3426
3419
|
var _a, _b, _c;
|
3427
3420
|
setPortalEl(
|
@@ -3448,7 +3441,7 @@ var DraggableComponent = ({
|
|
3448
3441
|
};
|
3449
3442
|
return style2;
|
3450
3443
|
}, [ref.current]);
|
3451
|
-
const [style, setStyle] =
|
3444
|
+
const [style, setStyle] = useState13();
|
3452
3445
|
const sync = useCallback7(() => {
|
3453
3446
|
setStyle(getStyle());
|
3454
3447
|
}, [ref.current, iframe]);
|
@@ -3526,7 +3519,7 @@ var DraggableComponent = ({
|
|
3526
3519
|
zone: zoneCompound
|
3527
3520
|
});
|
3528
3521
|
}, [index, zoneCompound]);
|
3529
|
-
const [hover, setHover] =
|
3522
|
+
const [hover, setHover] = useState13(false);
|
3530
3523
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
3531
3524
|
useEffect10(() => {
|
3532
3525
|
if (!ref.current) {
|
@@ -3587,7 +3580,7 @@ var DraggableComponent = ({
|
|
3587
3580
|
};
|
3588
3581
|
}
|
3589
3582
|
}, [disabled, ref]);
|
3590
|
-
const [isVisible, setIsVisible] =
|
3583
|
+
const [isVisible, setIsVisible] = useState13(false);
|
3591
3584
|
useEffect10(() => {
|
3592
3585
|
sync();
|
3593
3586
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
@@ -3604,10 +3597,18 @@ var DraggableComponent = ({
|
|
3604
3597
|
const rect = el.getBoundingClientRect();
|
3605
3598
|
const diffLeft = rect.x;
|
3606
3599
|
const exceedsBoundsLeft = diffLeft < 0;
|
3600
|
+
const diffTop = rect.y;
|
3601
|
+
const exceedsBoundsTop = diffTop < 0;
|
3607
3602
|
if (exceedsBoundsLeft) {
|
3608
3603
|
el.style.transformOrigin = "left top";
|
3609
3604
|
el.style.left = "0px";
|
3610
3605
|
}
|
3606
|
+
if (exceedsBoundsTop) {
|
3607
|
+
el.style.top = "12px";
|
3608
|
+
if (!exceedsBoundsLeft) {
|
3609
|
+
el.style.transformOrigin = "right top";
|
3610
|
+
}
|
3611
|
+
}
|
3611
3612
|
}
|
3612
3613
|
}
|
3613
3614
|
},
|
@@ -3707,14 +3708,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
|
|
3707
3708
|
|
3708
3709
|
// components/DropZone/lib/use-min-empty-height.ts
|
3709
3710
|
init_react_import();
|
3710
|
-
import { useEffect as useEffect11, useState as
|
3711
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
3711
3712
|
var useMinEmptyHeight = ({
|
3712
3713
|
zoneCompound,
|
3713
3714
|
userMinEmptyHeight,
|
3714
3715
|
ref
|
3715
3716
|
}) => {
|
3716
|
-
const [prevHeight, setPrevHeight] =
|
3717
|
-
const [isAnimating, setIsAnimating] =
|
3717
|
+
const [prevHeight, setPrevHeight] = useState14(0);
|
3718
|
+
const [isAnimating, setIsAnimating] = useState14(false);
|
3718
3719
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
3719
3720
|
var _a, _b;
|
3720
3721
|
return {
|
@@ -3756,7 +3757,7 @@ function assignRefs(refs, node) {
|
|
3756
3757
|
|
3757
3758
|
// components/DropZone/lib/use-content-with-preview.ts
|
3758
3759
|
init_react_import();
|
3759
|
-
import { useEffect as useEffect12, useState as
|
3760
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
3760
3761
|
|
3761
3762
|
// lib/dnd/use-rendered-callback.ts
|
3762
3763
|
init_react_import();
|
@@ -3799,8 +3800,8 @@ var useContentWithPreview = (content, zoneCompound) => {
|
|
3799
3800
|
ui: { isDragging }
|
3800
3801
|
}
|
3801
3802
|
} = useAppContext();
|
3802
|
-
const [contentWithPreview, setContentWithPreview] =
|
3803
|
-
const [localPreview, setLocalPreview] =
|
3803
|
+
const [contentWithPreview, setContentWithPreview] = useState15(content);
|
3804
|
+
const [localPreview, setLocalPreview] = useState15(
|
3804
3805
|
preview
|
3805
3806
|
);
|
3806
3807
|
const updateContent = useRenderedCallback(
|
@@ -3849,13 +3850,13 @@ var useContentWithPreview = (content, zoneCompound) => {
|
|
3849
3850
|
|
3850
3851
|
// components/DropZone/lib/use-drag-axis.ts
|
3851
3852
|
init_react_import();
|
3852
|
-
import { useCallback as useCallback9, useEffect as useEffect13, useState as
|
3853
|
+
import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
|
3853
3854
|
var GRID_DRAG_AXIS = "dynamic";
|
3854
3855
|
var FLEX_ROW_DRAG_AXIS = "x";
|
3855
3856
|
var DEFAULT_DRAG_AXIS = "y";
|
3856
3857
|
var useDragAxis = (ref, collisionAxis) => {
|
3857
3858
|
const { status } = useAppContext();
|
3858
|
-
const [dragAxis, setDragAxis] =
|
3859
|
+
const [dragAxis, setDragAxis] = useState16(
|
3859
3860
|
collisionAxis || DEFAULT_DRAG_AXIS
|
3860
3861
|
);
|
3861
3862
|
const calculateDragAxis = useCallback9(() => {
|
@@ -4902,7 +4903,7 @@ var DragDropContextClient = ({
|
|
4902
4903
|
const { data } = state;
|
4903
4904
|
const debouncedParamsRef = useRef4(null);
|
4904
4905
|
const tempDisableFallback = useTempDisableFallback(100);
|
4905
|
-
const [zoneStore] =
|
4906
|
+
const [zoneStore] = useState17(
|
4906
4907
|
() => createStore3(() => ({
|
4907
4908
|
zoneDepthIndex: {},
|
4908
4909
|
nextZoneDepthIndex: {},
|
@@ -4971,7 +4972,7 @@ var DragDropContextClient = ({
|
|
4971
4972
|
);
|
4972
4973
|
}
|
4973
4974
|
}, []);
|
4974
|
-
const [plugins] =
|
4975
|
+
const [plugins] = useState17(() => [
|
4975
4976
|
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
4976
4977
|
createNestedDroppablePlugin(
|
4977
4978
|
{
|
@@ -5019,8 +5020,8 @@ var DragDropContextClient = ({
|
|
5019
5020
|
)
|
5020
5021
|
]);
|
5021
5022
|
const sensors = useSensors();
|
5022
|
-
const [dragListeners, setDragListeners] =
|
5023
|
-
const [pathData, setPathData] =
|
5023
|
+
const [dragListeners, setDragListeners] = useState17({});
|
5024
|
+
const [pathData, setPathData] = useState17();
|
5024
5025
|
const dragMode = useRef4(null);
|
5025
5026
|
const registerPath = useCallback11(
|
5026
5027
|
(id2, selector, label) => {
|
@@ -5342,7 +5343,7 @@ var DrawerItem = ({
|
|
5342
5343
|
isDragDisabled
|
5343
5344
|
}) => {
|
5344
5345
|
const resolvedId = id || name;
|
5345
|
-
const [dynamicId, setDynamicId] =
|
5346
|
+
const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
|
5346
5347
|
if (typeof index !== "undefined") {
|
5347
5348
|
console.error(
|
5348
5349
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -5408,7 +5409,7 @@ import {
|
|
5408
5409
|
useEffect as useEffect24,
|
5409
5410
|
useMemo as useMemo19,
|
5410
5411
|
useReducer,
|
5411
|
-
useState as
|
5412
|
+
useState as useState26
|
5412
5413
|
} from "react";
|
5413
5414
|
|
5414
5415
|
// components/SidebarSection/index.tsx
|
@@ -5609,7 +5610,7 @@ import { useMemo as useMemo12 } from "react";
|
|
5609
5610
|
|
5610
5611
|
// lib/use-resolved-fields.ts
|
5611
5612
|
init_react_import();
|
5612
|
-
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as
|
5613
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as useState19 } from "react";
|
5613
5614
|
|
5614
5615
|
// lib/use-parent.ts
|
5615
5616
|
init_react_import();
|
@@ -5672,12 +5673,12 @@ var useResolvedFields = ({
|
|
5672
5673
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
5673
5674
|
);
|
5674
5675
|
const rootProps = data.root.props || data.root;
|
5675
|
-
const [lastSelectedData, setLastSelectedData] =
|
5676
|
-
const [resolvedFields, setResolvedFields] =
|
5676
|
+
const [lastSelectedData, setLastSelectedData] = useState19({});
|
5677
|
+
const [resolvedFields, setResolvedFields] = useState19({
|
5677
5678
|
fields: defaultFields,
|
5678
5679
|
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5679
5680
|
});
|
5680
|
-
const [fieldsLoading, setFieldsLoading] =
|
5681
|
+
const [fieldsLoading, setFieldsLoading] = useState19(false);
|
5681
5682
|
const lastFields = useRef6(defaultFields);
|
5682
5683
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5683
5684
|
const componentData = useMemo11(
|
@@ -5921,7 +5922,7 @@ init_react_import();
|
|
5921
5922
|
|
5922
5923
|
// lib/use-component-list.tsx
|
5923
5924
|
init_react_import();
|
5924
|
-
import { useEffect as useEffect18, useState as
|
5925
|
+
import { useEffect as useEffect18, useState as useState20 } from "react";
|
5925
5926
|
|
5926
5927
|
// components/ComponentList/index.tsx
|
5927
5928
|
init_react_import();
|
@@ -5988,7 +5989,7 @@ ComponentList.Item = ComponentListItem;
|
|
5988
5989
|
// lib/use-component-list.tsx
|
5989
5990
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
5990
5991
|
var useComponentList = (config, ui) => {
|
5991
|
-
const [componentList, setComponentList] =
|
5992
|
+
const [componentList, setComponentList] = useState20();
|
5992
5993
|
useEffect18(() => {
|
5993
5994
|
var _a, _b, _c;
|
5994
5995
|
if (Object.keys(ui.componentList).length > 0) {
|
@@ -6077,7 +6078,7 @@ import {
|
|
6077
6078
|
createContext as createContext5,
|
6078
6079
|
useContext as useContext10,
|
6079
6080
|
useEffect as useEffect19,
|
6080
|
-
useState as
|
6081
|
+
useState as useState21
|
6081
6082
|
} from "react";
|
6082
6083
|
import hash from "object-hash";
|
6083
6084
|
import { createPortal as createPortal3 } from "react-dom";
|
@@ -6301,9 +6302,9 @@ function AutoFrame(_a) {
|
|
6301
6302
|
"onStylesLoaded",
|
6302
6303
|
"frameRef"
|
6303
6304
|
]);
|
6304
|
-
const [loaded, setLoaded] =
|
6305
|
-
const [ctx, setCtx] =
|
6306
|
-
const [mountTarget, setMountTarget] =
|
6305
|
+
const [loaded, setLoaded] = useState21(false);
|
6306
|
+
const [ctx, setCtx] = useState21({});
|
6307
|
+
const [mountTarget, setMountTarget] = useState21();
|
6307
6308
|
useEffect19(() => {
|
6308
6309
|
var _a2;
|
6309
6310
|
if (frameRef.current) {
|
@@ -6822,19 +6823,19 @@ function usePuckHistory({
|
|
6822
6823
|
|
6823
6824
|
// lib/use-history-store.ts
|
6824
6825
|
init_react_import();
|
6825
|
-
import { useState as
|
6826
|
+
import { useState as useState22 } from "react";
|
6826
6827
|
import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
|
6827
6828
|
var EMPTY_HISTORY_INDEX = 0;
|
6828
6829
|
function useHistoryStore(initialHistory) {
|
6829
6830
|
var _a, _b;
|
6830
|
-
const [histories, setHistories] =
|
6831
|
+
const [histories, setHistories] = useState22(
|
6831
6832
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6832
6833
|
);
|
6833
6834
|
const updateHistories = (histories2) => {
|
6834
6835
|
setHistories(histories2);
|
6835
6836
|
setIndex(histories2.length - 1);
|
6836
6837
|
};
|
6837
|
-
const [index, setIndex] =
|
6838
|
+
const [index, setIndex] = useState22(
|
6838
6839
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6839
6840
|
);
|
6840
6841
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -6999,12 +7000,12 @@ import {
|
|
6999
7000
|
useEffect as useEffect22,
|
7000
7001
|
useMemo as useMemo17,
|
7001
7002
|
useRef as useRef9,
|
7002
|
-
useState as
|
7003
|
+
useState as useState24
|
7003
7004
|
} from "react";
|
7004
7005
|
|
7005
7006
|
// components/ViewportControls/index.tsx
|
7006
7007
|
init_react_import();
|
7007
|
-
import { useEffect as useEffect21, useMemo as useMemo16, useState as
|
7008
|
+
import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
|
7008
7009
|
|
7009
7010
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
7010
7011
|
init_react_import();
|
@@ -7027,7 +7028,7 @@ var ViewportButton = ({
|
|
7027
7028
|
onClick
|
7028
7029
|
}) => {
|
7029
7030
|
const { state } = useAppContext();
|
7030
|
-
const [isActive, setIsActive] =
|
7031
|
+
const [isActive, setIsActive] = useState23(false);
|
7031
7032
|
useEffect21(() => {
|
7032
7033
|
setIsActive(width === state.ui.viewports.current.width);
|
7033
7034
|
}, [width, state.ui.viewports.current.width]);
|
@@ -7188,7 +7189,7 @@ var Canvas = () => {
|
|
7188
7189
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
7189
7190
|
const { ui } = state;
|
7190
7191
|
const frameRef = useRef9(null);
|
7191
|
-
const [showTransition, setShowTransition] =
|
7192
|
+
const [showTransition, setShowTransition] = useState24(false);
|
7192
7193
|
const defaultRender = useMemo17(() => {
|
7193
7194
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
|
7194
7195
|
return PuckDefault;
|
@@ -7243,7 +7244,7 @@ var Canvas = () => {
|
|
7243
7244
|
window.removeEventListener("resize", cb);
|
7244
7245
|
};
|
7245
7246
|
}, []);
|
7246
|
-
const [showLoader, setShowLoader] =
|
7247
|
+
const [showLoader, setShowLoader] = useState24(false);
|
7247
7248
|
useEffect22(() => {
|
7248
7249
|
setTimeout(() => {
|
7249
7250
|
setShowLoader(true);
|
@@ -7373,10 +7374,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
|
|
7373
7374
|
|
7374
7375
|
// lib/use-inject-css.ts
|
7375
7376
|
init_react_import();
|
7376
|
-
import { useEffect as useEffect23, useState as
|
7377
|
+
import { useEffect as useEffect23, useState as useState25 } from "react";
|
7377
7378
|
var styles = ``;
|
7378
7379
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7379
|
-
const [el, setEl] =
|
7380
|
+
const [el, setEl] = useState25();
|
7380
7381
|
useEffect23(() => {
|
7381
7382
|
setEl(document.createElement("style"));
|
7382
7383
|
}, []);
|
@@ -7460,7 +7461,7 @@ function Puck({
|
|
7460
7461
|
waitForStyles: true
|
7461
7462
|
}, _iframe);
|
7462
7463
|
useInjectGlobalCss(iframe.enabled);
|
7463
|
-
const [generatedAppState] =
|
7464
|
+
const [generatedAppState] = useState26(() => {
|
7464
7465
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7465
7466
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7466
7467
|
let clientUiState = {};
|
@@ -7532,7 +7533,7 @@ function Puck({
|
|
7532
7533
|
histories,
|
7533
7534
|
index: initialHistoryIndex
|
7534
7535
|
});
|
7535
|
-
const [reducer] =
|
7536
|
+
const [reducer] = useState26(
|
7536
7537
|
() => createReducer({
|
7537
7538
|
config,
|
7538
7539
|
record: historyStore.record,
|
@@ -7550,7 +7551,7 @@ function Puck({
|
|
7550
7551
|
historyStore,
|
7551
7552
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
7552
7553
|
});
|
7553
|
-
const [menuOpen, setMenuOpen] =
|
7554
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
7554
7555
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
7555
7556
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
7556
7557
|
useEffect24(() => {
|
@@ -7637,7 +7638,7 @@ function Puck({
|
|
7637
7638
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7638
7639
|
[loadedOverrides]
|
7639
7640
|
);
|
7640
|
-
const [mounted, setMounted] =
|
7641
|
+
const [mounted, setMounted] = useState26(false);
|
7641
7642
|
useEffect24(() => {
|
7642
7643
|
setMounted(true);
|
7643
7644
|
}, []);
|
@@ -7824,40 +7825,6 @@ function migrate(data) {
|
|
7824
7825
|
return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
|
7825
7826
|
}
|
7826
7827
|
|
7827
|
-
// lib/transform-props.ts
|
7828
|
-
init_react_import();
|
7829
|
-
function transformProps(data, propTransforms) {
|
7830
|
-
const mapItem = (item) => {
|
7831
|
-
if (propTransforms[item.type]) {
|
7832
|
-
return __spreadProps(__spreadValues({}, item), {
|
7833
|
-
props: propTransforms[item.type](item.props)
|
7834
|
-
});
|
7835
|
-
}
|
7836
|
-
return item;
|
7837
|
-
};
|
7838
|
-
const defaultedData = defaultData(data);
|
7839
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
7840
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
7841
|
-
if (propTransforms["root"]) {
|
7842
|
-
if (defaultedData.root.props) {
|
7843
|
-
newRoot.props = propTransforms["root"](rootProps);
|
7844
|
-
} else {
|
7845
|
-
newRoot = propTransforms["root"](rootProps);
|
7846
|
-
}
|
7847
|
-
}
|
7848
|
-
const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
|
7849
|
-
root: newRoot,
|
7850
|
-
content: defaultedData.content.map(mapItem),
|
7851
|
-
zones: Object.keys(data.zones || {}).reduce(
|
7852
|
-
(acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
|
7853
|
-
[zoneKey]: data.zones[zoneKey].map(mapItem)
|
7854
|
-
}),
|
7855
|
-
{}
|
7856
|
-
)
|
7857
|
-
});
|
7858
|
-
return afterPropTransforms;
|
7859
|
-
}
|
7860
|
-
|
7861
7828
|
// lib/use-puck.ts
|
7862
7829
|
init_react_import();
|
7863
7830
|
var usePuck = () => {
|