@measured/puck 0.18.3-canary.934cfae → 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/{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 +438 -436
- package/dist/index.mjs +277 -309
- 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 +2 -2
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,17 @@ 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
|
+
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);
|
1972
1983
|
const newArrayStateItems = reorder(
|
1973
1984
|
arrayState.items,
|
1974
1985
|
move.source,
|
@@ -1980,7 +1991,6 @@ var ArrayField = ({
|
|
1980
1991
|
})
|
1981
1992
|
};
|
1982
1993
|
setUi(newUi, false);
|
1983
|
-
onChange(newValue, newUi);
|
1984
1994
|
setLocalState({
|
1985
1995
|
value: newValue,
|
1986
1996
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
@@ -1994,172 +2004,154 @@ var ArrayField = ({
|
|
1994
2004
|
addDisabled
|
1995
2005
|
}),
|
1996
2006
|
children: [
|
1997
|
-
/* @__PURE__ */ jsx8(
|
1998
|
-
|
1999
|
-
{
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
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",
|
2008
2018
|
{
|
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
|
-
]
|
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
|
+
);
|
2100
2046
|
}
|
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,
|
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,
|
2121
2055
|
{
|
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
|
-
|
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]
|
2065
|
+
);
|
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 })
|
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
|
+
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
|
+
}) }),
|
2163
2155
|
!addDisabled && /* @__PURE__ */ jsx8(
|
2164
2156
|
"button",
|
2165
2157
|
{
|
@@ -2173,7 +2165,9 @@ var ArrayField = ({
|
|
2173
2165
|
field.defaultItemProps || {}
|
2174
2166
|
];
|
2175
2167
|
const newArrayState = regenerateArrayState(newValue);
|
2176
|
-
|
2168
|
+
const newUi = mapArrayStateToUi(newArrayState);
|
2169
|
+
setUi(newUi, false);
|
2170
|
+
onChange(newValue, newUi);
|
2177
2171
|
},
|
2178
2172
|
children: /* @__PURE__ */ jsx8(Plus, { size: 21 })
|
2179
2173
|
}
|
@@ -2254,7 +2248,7 @@ init_react_import();
|
|
2254
2248
|
import {
|
2255
2249
|
useMemo as useMemo2,
|
2256
2250
|
useEffect as useEffect7,
|
2257
|
-
useState as
|
2251
|
+
useState as useState9,
|
2258
2252
|
useCallback as useCallback4,
|
2259
2253
|
isValidElement
|
2260
2254
|
} from "react";
|
@@ -2265,7 +2259,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
|
|
2265
2259
|
|
2266
2260
|
// components/Modal/index.tsx
|
2267
2261
|
init_react_import();
|
2268
|
-
import { useEffect as useEffect5, useState as
|
2262
|
+
import { useEffect as useEffect5, useState as useState7 } from "react";
|
2269
2263
|
|
2270
2264
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
2271
2265
|
init_react_import();
|
@@ -2280,7 +2274,7 @@ var Modal = ({
|
|
2280
2274
|
onClose,
|
2281
2275
|
isOpen
|
2282
2276
|
}) => {
|
2283
|
-
const [rootEl, setRootEl] =
|
2277
|
+
const [rootEl, setRootEl] = useState7(null);
|
2284
2278
|
useEffect5(() => {
|
2285
2279
|
setRootEl(document.getElementById("puck-portal-root"));
|
2286
2280
|
}, []);
|
@@ -2328,7 +2322,7 @@ init_react_import();
|
|
2328
2322
|
|
2329
2323
|
// components/Button/Button.tsx
|
2330
2324
|
init_react_import();
|
2331
|
-
import { useEffect as useEffect6, useState as
|
2325
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
2332
2326
|
|
2333
2327
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
2334
2328
|
init_react_import();
|
@@ -2378,7 +2372,7 @@ var Button = (_a) => {
|
|
2378
2372
|
"size",
|
2379
2373
|
"loading"
|
2380
2374
|
]);
|
2381
|
-
const [loading, setLoading] =
|
2375
|
+
const [loading, setLoading] = useState8(loadingProp);
|
2382
2376
|
useEffect6(() => setLoading(loadingProp), [loadingProp]);
|
2383
2377
|
const ElementType = href ? "a" : type ? "button" : "span";
|
2384
2378
|
const dataAttrs = filterDataAttrs(props);
|
@@ -2434,12 +2428,12 @@ var ExternalInput = ({
|
|
2434
2428
|
mapRow = (val) => val,
|
2435
2429
|
filterFields
|
2436
2430
|
} = field || {};
|
2437
|
-
const [data, setData] =
|
2438
|
-
const [isOpen, setOpen] =
|
2439
|
-
const [isLoading, setIsLoading] =
|
2431
|
+
const [data, setData] = useState9([]);
|
2432
|
+
const [isOpen, setOpen] = useState9(false);
|
2433
|
+
const [isLoading, setIsLoading] = useState9(true);
|
2440
2434
|
const hasFilterFields = !!filterFields;
|
2441
|
-
const [filters, setFilters] =
|
2442
|
-
const [filtersToggled, setFiltersToggled] =
|
2435
|
+
const [filters, setFilters] = useState9(field.initialFilters || {});
|
2436
|
+
const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
|
2443
2437
|
const mappedData = useMemo2(() => {
|
2444
2438
|
return data.map(mapRow);
|
2445
2439
|
}, [data]);
|
@@ -2454,7 +2448,7 @@ var ExternalInput = ({
|
|
2454
2448
|
}
|
2455
2449
|
return Array.from(validKeys);
|
2456
2450
|
}, [mappedData]);
|
2457
|
-
const [searchQuery, setSearchQuery] =
|
2451
|
+
const [searchQuery, setSearchQuery] = useState9(field.initialQuery || "");
|
2458
2452
|
const search = useCallback4(
|
2459
2453
|
(query, filters2) => __async(void 0, null, function* () {
|
2460
2454
|
setIsLoading(true);
|
@@ -2923,7 +2917,7 @@ var ObjectField = ({
|
|
2923
2917
|
|
2924
2918
|
// lib/use-safe-id.ts
|
2925
2919
|
init_react_import();
|
2926
|
-
import React2, { useState as
|
2920
|
+
import React2, { useState as useState10 } from "react";
|
2927
2921
|
|
2928
2922
|
// lib/generate-id.ts
|
2929
2923
|
init_react_import();
|
@@ -2935,7 +2929,7 @@ var useSafeId = () => {
|
|
2935
2929
|
if (typeof React2.useId !== "undefined") {
|
2936
2930
|
return React2.useId();
|
2937
2931
|
}
|
2938
|
-
const [id] =
|
2932
|
+
const [id] = useState10(generateId());
|
2939
2933
|
return id;
|
2940
2934
|
};
|
2941
2935
|
|
@@ -3081,7 +3075,7 @@ function AutoFieldInternal(props) {
|
|
3081
3075
|
function AutoFieldPrivate(props) {
|
3082
3076
|
const { state } = useAppContext();
|
3083
3077
|
const { value, onChange } = props;
|
3084
|
-
const [localValue, setLocalValue] =
|
3078
|
+
const [localValue, setLocalValue] = useState11(value);
|
3085
3079
|
const onChangeDb = useDebouncedCallback(
|
3086
3080
|
(val, ui) => {
|
3087
3081
|
onChange(val, ui);
|
@@ -3128,7 +3122,7 @@ init_react_import();
|
|
3128
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" };
|
3129
3123
|
|
3130
3124
|
// components/Drawer/index.tsx
|
3131
|
-
import { useId as useId2, useMemo as useMemo9, useState as
|
3125
|
+
import { useId as useId2, useMemo as useMemo9, useState as useState18 } from "react";
|
3132
3126
|
|
3133
3127
|
// components/DragDropContext/index.tsx
|
3134
3128
|
init_react_import();
|
@@ -3140,7 +3134,7 @@ import {
|
|
3140
3134
|
useEffect as useEffect15,
|
3141
3135
|
useId,
|
3142
3136
|
useRef as useRef4,
|
3143
|
-
useState as
|
3137
|
+
useState as useState17
|
3144
3138
|
} from "react";
|
3145
3139
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
3146
3140
|
|
@@ -3163,7 +3157,7 @@ import {
|
|
3163
3157
|
useEffect as useEffect10,
|
3164
3158
|
useMemo as useMemo7,
|
3165
3159
|
useRef as useRef2,
|
3166
|
-
useState as
|
3160
|
+
useState as useState13
|
3167
3161
|
} from "react";
|
3168
3162
|
|
3169
3163
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -3198,7 +3192,7 @@ import {
|
|
3198
3192
|
createContext as createContext3,
|
3199
3193
|
useCallback as useCallback6,
|
3200
3194
|
useMemo as useMemo6,
|
3201
|
-
useState as
|
3195
|
+
useState as useState12
|
3202
3196
|
} from "react";
|
3203
3197
|
import { createStore as createStore2 } from "zustand";
|
3204
3198
|
import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
|
@@ -3223,11 +3217,11 @@ var DropZoneProvider = ({
|
|
3223
3217
|
children,
|
3224
3218
|
value
|
3225
3219
|
}) => {
|
3226
|
-
const [hoveringComponent, setHoveringComponent] =
|
3227
|
-
const [areasWithZones, setAreasWithZones] =
|
3220
|
+
const [hoveringComponent, setHoveringComponent] = useState12();
|
3221
|
+
const [areasWithZones, setAreasWithZones] = useState12(
|
3228
3222
|
{}
|
3229
3223
|
);
|
3230
|
-
const [activeZones, setActiveZones] =
|
3224
|
+
const [activeZones, setActiveZones] = useState12({});
|
3231
3225
|
const { dispatch } = useAppContext();
|
3232
3226
|
const registerZoneArea = useCallback6(
|
3233
3227
|
(area) => {
|
@@ -3344,7 +3338,7 @@ var DraggableComponent = ({
|
|
3344
3338
|
state
|
3345
3339
|
} = useAppContext();
|
3346
3340
|
const ctx = useContext5(dropZoneContext);
|
3347
|
-
const [localZones, setLocalZones] =
|
3341
|
+
const [localZones, setLocalZones] = useState13({});
|
3348
3342
|
const registerLocalZone = useCallback7(
|
3349
3343
|
(zoneCompound2, active) => {
|
3350
3344
|
var _a;
|
@@ -3369,7 +3363,7 @@ var DraggableComponent = ({
|
|
3369
3363
|
);
|
3370
3364
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
3371
3365
|
const { path = [] } = ctx || {};
|
3372
|
-
const [canDrag, setCanDrag] =
|
3366
|
+
const [canDrag, setCanDrag] = useState13(false);
|
3373
3367
|
useEffect10(() => {
|
3374
3368
|
var _a;
|
3375
3369
|
const item = getItem({ index, zone: zoneCompound }, state.data);
|
@@ -3386,7 +3380,7 @@ var DraggableComponent = ({
|
|
3386
3380
|
);
|
3387
3381
|
const canCollide = canDrag || userIsDragging;
|
3388
3382
|
const disabled = !isEnabled || !canCollide;
|
3389
|
-
const [dragAxis, setDragAxis] =
|
3383
|
+
const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
|
3390
3384
|
const { ref: sortableRef, status } = useSortableSafe({
|
3391
3385
|
id,
|
3392
3386
|
index,
|
@@ -3422,7 +3416,7 @@ var DraggableComponent = ({
|
|
3422
3416
|
},
|
3423
3417
|
[sortableRef]
|
3424
3418
|
);
|
3425
|
-
const [portalEl, setPortalEl] =
|
3419
|
+
const [portalEl, setPortalEl] = useState13();
|
3426
3420
|
useEffect10(() => {
|
3427
3421
|
var _a, _b, _c;
|
3428
3422
|
setPortalEl(
|
@@ -3449,7 +3443,7 @@ var DraggableComponent = ({
|
|
3449
3443
|
};
|
3450
3444
|
return style2;
|
3451
3445
|
}, [ref.current]);
|
3452
|
-
const [style, setStyle] =
|
3446
|
+
const [style, setStyle] = useState13();
|
3453
3447
|
const sync = useCallback7(() => {
|
3454
3448
|
setStyle(getStyle());
|
3455
3449
|
}, [ref.current, iframe]);
|
@@ -3527,7 +3521,7 @@ var DraggableComponent = ({
|
|
3527
3521
|
zone: zoneCompound
|
3528
3522
|
});
|
3529
3523
|
}, [index, zoneCompound]);
|
3530
|
-
const [hover, setHover] =
|
3524
|
+
const [hover, setHover] = useState13(false);
|
3531
3525
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
3532
3526
|
useEffect10(() => {
|
3533
3527
|
if (!ref.current) {
|
@@ -3588,7 +3582,7 @@ var DraggableComponent = ({
|
|
3588
3582
|
};
|
3589
3583
|
}
|
3590
3584
|
}, [disabled, ref]);
|
3591
|
-
const [isVisible, setIsVisible] =
|
3585
|
+
const [isVisible, setIsVisible] = useState13(false);
|
3592
3586
|
useEffect10(() => {
|
3593
3587
|
sync();
|
3594
3588
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
@@ -3605,10 +3599,18 @@ var DraggableComponent = ({
|
|
3605
3599
|
const rect = el.getBoundingClientRect();
|
3606
3600
|
const diffLeft = rect.x;
|
3607
3601
|
const exceedsBoundsLeft = diffLeft < 0;
|
3602
|
+
const diffTop = rect.y;
|
3603
|
+
const exceedsBoundsTop = diffTop < 0;
|
3608
3604
|
if (exceedsBoundsLeft) {
|
3609
3605
|
el.style.transformOrigin = "left top";
|
3610
3606
|
el.style.left = "0px";
|
3611
3607
|
}
|
3608
|
+
if (exceedsBoundsTop) {
|
3609
|
+
el.style.top = "12px";
|
3610
|
+
if (!exceedsBoundsLeft) {
|
3611
|
+
el.style.transformOrigin = "right top";
|
3612
|
+
}
|
3613
|
+
}
|
3612
3614
|
}
|
3613
3615
|
}
|
3614
3616
|
},
|
@@ -3708,14 +3710,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
|
|
3708
3710
|
|
3709
3711
|
// components/DropZone/lib/use-min-empty-height.ts
|
3710
3712
|
init_react_import();
|
3711
|
-
import { useEffect as useEffect11, useState as
|
3713
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
3712
3714
|
var useMinEmptyHeight = ({
|
3713
3715
|
zoneCompound,
|
3714
3716
|
userMinEmptyHeight,
|
3715
3717
|
ref
|
3716
3718
|
}) => {
|
3717
|
-
const [prevHeight, setPrevHeight] =
|
3718
|
-
const [isAnimating, setIsAnimating] =
|
3719
|
+
const [prevHeight, setPrevHeight] = useState14(0);
|
3720
|
+
const [isAnimating, setIsAnimating] = useState14(false);
|
3719
3721
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
3720
3722
|
var _a, _b;
|
3721
3723
|
return {
|
@@ -3757,7 +3759,7 @@ function assignRefs(refs, node) {
|
|
3757
3759
|
|
3758
3760
|
// components/DropZone/lib/use-content-with-preview.ts
|
3759
3761
|
init_react_import();
|
3760
|
-
import { useEffect as useEffect12, useState as
|
3762
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
3761
3763
|
|
3762
3764
|
// lib/dnd/use-rendered-callback.ts
|
3763
3765
|
init_react_import();
|
@@ -3800,8 +3802,8 @@ var useContentWithPreview = (content, zoneCompound) => {
|
|
3800
3802
|
ui: { isDragging }
|
3801
3803
|
}
|
3802
3804
|
} = useAppContext();
|
3803
|
-
const [contentWithPreview, setContentWithPreview] =
|
3804
|
-
const [localPreview, setLocalPreview] =
|
3805
|
+
const [contentWithPreview, setContentWithPreview] = useState15(content);
|
3806
|
+
const [localPreview, setLocalPreview] = useState15(
|
3805
3807
|
preview
|
3806
3808
|
);
|
3807
3809
|
const updateContent = useRenderedCallback(
|
@@ -3850,13 +3852,13 @@ var useContentWithPreview = (content, zoneCompound) => {
|
|
3850
3852
|
|
3851
3853
|
// components/DropZone/lib/use-drag-axis.ts
|
3852
3854
|
init_react_import();
|
3853
|
-
import { useCallback as useCallback9, useEffect as useEffect13, useState as
|
3855
|
+
import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
|
3854
3856
|
var GRID_DRAG_AXIS = "dynamic";
|
3855
3857
|
var FLEX_ROW_DRAG_AXIS = "x";
|
3856
3858
|
var DEFAULT_DRAG_AXIS = "y";
|
3857
3859
|
var useDragAxis = (ref, collisionAxis) => {
|
3858
3860
|
const { status } = useAppContext();
|
3859
|
-
const [dragAxis, setDragAxis] =
|
3861
|
+
const [dragAxis, setDragAxis] = useState16(
|
3860
3862
|
collisionAxis || DEFAULT_DRAG_AXIS
|
3861
3863
|
);
|
3862
3864
|
const calculateDragAxis = useCallback9(() => {
|
@@ -4903,7 +4905,7 @@ var DragDropContextClient = ({
|
|
4903
4905
|
const { data } = state;
|
4904
4906
|
const debouncedParamsRef = useRef4(null);
|
4905
4907
|
const tempDisableFallback = useTempDisableFallback(100);
|
4906
|
-
const [zoneStore] =
|
4908
|
+
const [zoneStore] = useState17(
|
4907
4909
|
() => createStore3(() => ({
|
4908
4910
|
zoneDepthIndex: {},
|
4909
4911
|
nextZoneDepthIndex: {},
|
@@ -4972,7 +4974,7 @@ var DragDropContextClient = ({
|
|
4972
4974
|
);
|
4973
4975
|
}
|
4974
4976
|
}, []);
|
4975
|
-
const [plugins] =
|
4977
|
+
const [plugins] = useState17(() => [
|
4976
4978
|
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
4977
4979
|
createNestedDroppablePlugin(
|
4978
4980
|
{
|
@@ -5020,8 +5022,8 @@ var DragDropContextClient = ({
|
|
5020
5022
|
)
|
5021
5023
|
]);
|
5022
5024
|
const sensors = useSensors();
|
5023
|
-
const [dragListeners, setDragListeners] =
|
5024
|
-
const [pathData, setPathData] =
|
5025
|
+
const [dragListeners, setDragListeners] = useState17({});
|
5026
|
+
const [pathData, setPathData] = useState17();
|
5025
5027
|
const dragMode = useRef4(null);
|
5026
5028
|
const registerPath = useCallback11(
|
5027
5029
|
(id2, selector, label) => {
|
@@ -5343,7 +5345,7 @@ var DrawerItem = ({
|
|
5343
5345
|
isDragDisabled
|
5344
5346
|
}) => {
|
5345
5347
|
const resolvedId = id || name;
|
5346
|
-
const [dynamicId, setDynamicId] =
|
5348
|
+
const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
|
5347
5349
|
if (typeof index !== "undefined") {
|
5348
5350
|
console.error(
|
5349
5351
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -5409,7 +5411,7 @@ import {
|
|
5409
5411
|
useEffect as useEffect24,
|
5410
5412
|
useMemo as useMemo19,
|
5411
5413
|
useReducer,
|
5412
|
-
useState as
|
5414
|
+
useState as useState26
|
5413
5415
|
} from "react";
|
5414
5416
|
|
5415
5417
|
// components/SidebarSection/index.tsx
|
@@ -5610,7 +5612,7 @@ import { useMemo as useMemo12 } from "react";
|
|
5610
5612
|
|
5611
5613
|
// lib/use-resolved-fields.ts
|
5612
5614
|
init_react_import();
|
5613
|
-
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as
|
5615
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef6, useState as useState19 } from "react";
|
5614
5616
|
|
5615
5617
|
// lib/use-parent.ts
|
5616
5618
|
init_react_import();
|
@@ -5673,12 +5675,12 @@ var useResolvedFields = ({
|
|
5673
5675
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
5674
5676
|
);
|
5675
5677
|
const rootProps = data.root.props || data.root;
|
5676
|
-
const [lastSelectedData, setLastSelectedData] =
|
5677
|
-
const [resolvedFields, setResolvedFields] =
|
5678
|
+
const [lastSelectedData, setLastSelectedData] = useState19({});
|
5679
|
+
const [resolvedFields, setResolvedFields] = useState19({
|
5678
5680
|
fields: defaultFields,
|
5679
5681
|
id: selectedItem == null ? void 0 : selectedItem.props.id
|
5680
5682
|
});
|
5681
|
-
const [fieldsLoading, setFieldsLoading] =
|
5683
|
+
const [fieldsLoading, setFieldsLoading] = useState19(false);
|
5682
5684
|
const lastFields = useRef6(defaultFields);
|
5683
5685
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5684
5686
|
const componentData = useMemo11(
|
@@ -5922,7 +5924,7 @@ init_react_import();
|
|
5922
5924
|
|
5923
5925
|
// lib/use-component-list.tsx
|
5924
5926
|
init_react_import();
|
5925
|
-
import { useEffect as useEffect18, useState as
|
5927
|
+
import { useEffect as useEffect18, useState as useState20 } from "react";
|
5926
5928
|
|
5927
5929
|
// components/ComponentList/index.tsx
|
5928
5930
|
init_react_import();
|
@@ -5989,7 +5991,7 @@ ComponentList.Item = ComponentListItem;
|
|
5989
5991
|
// lib/use-component-list.tsx
|
5990
5992
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
5991
5993
|
var useComponentList = (config, ui) => {
|
5992
|
-
const [componentList, setComponentList] =
|
5994
|
+
const [componentList, setComponentList] = useState20();
|
5993
5995
|
useEffect18(() => {
|
5994
5996
|
var _a, _b, _c;
|
5995
5997
|
if (Object.keys(ui.componentList).length > 0) {
|
@@ -6078,7 +6080,7 @@ import {
|
|
6078
6080
|
createContext as createContext5,
|
6079
6081
|
useContext as useContext10,
|
6080
6082
|
useEffect as useEffect19,
|
6081
|
-
useState as
|
6083
|
+
useState as useState21
|
6082
6084
|
} from "react";
|
6083
6085
|
import hash from "object-hash";
|
6084
6086
|
import { createPortal as createPortal3 } from "react-dom";
|
@@ -6302,9 +6304,9 @@ function AutoFrame(_a) {
|
|
6302
6304
|
"onStylesLoaded",
|
6303
6305
|
"frameRef"
|
6304
6306
|
]);
|
6305
|
-
const [loaded, setLoaded] =
|
6306
|
-
const [ctx, setCtx] =
|
6307
|
-
const [mountTarget, setMountTarget] =
|
6307
|
+
const [loaded, setLoaded] = useState21(false);
|
6308
|
+
const [ctx, setCtx] = useState21({});
|
6309
|
+
const [mountTarget, setMountTarget] = useState21();
|
6308
6310
|
useEffect19(() => {
|
6309
6311
|
var _a2;
|
6310
6312
|
if (frameRef.current) {
|
@@ -6823,19 +6825,19 @@ function usePuckHistory({
|
|
6823
6825
|
|
6824
6826
|
// lib/use-history-store.ts
|
6825
6827
|
init_react_import();
|
6826
|
-
import { useState as
|
6828
|
+
import { useState as useState22 } from "react";
|
6827
6829
|
import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
|
6828
6830
|
var EMPTY_HISTORY_INDEX = 0;
|
6829
6831
|
function useHistoryStore(initialHistory) {
|
6830
6832
|
var _a, _b;
|
6831
|
-
const [histories, setHistories] =
|
6833
|
+
const [histories, setHistories] = useState22(
|
6832
6834
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6833
6835
|
);
|
6834
6836
|
const updateHistories = (histories2) => {
|
6835
6837
|
setHistories(histories2);
|
6836
6838
|
setIndex(histories2.length - 1);
|
6837
6839
|
};
|
6838
|
-
const [index, setIndex] =
|
6840
|
+
const [index, setIndex] = useState22(
|
6839
6841
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6840
6842
|
);
|
6841
6843
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -7000,12 +7002,12 @@ import {
|
|
7000
7002
|
useEffect as useEffect22,
|
7001
7003
|
useMemo as useMemo17,
|
7002
7004
|
useRef as useRef9,
|
7003
|
-
useState as
|
7005
|
+
useState as useState24
|
7004
7006
|
} from "react";
|
7005
7007
|
|
7006
7008
|
// components/ViewportControls/index.tsx
|
7007
7009
|
init_react_import();
|
7008
|
-
import { useEffect as useEffect21, useMemo as useMemo16, useState as
|
7010
|
+
import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
|
7009
7011
|
|
7010
7012
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
7011
7013
|
init_react_import();
|
@@ -7028,7 +7030,7 @@ var ViewportButton = ({
|
|
7028
7030
|
onClick
|
7029
7031
|
}) => {
|
7030
7032
|
const { state } = useAppContext();
|
7031
|
-
const [isActive, setIsActive] =
|
7033
|
+
const [isActive, setIsActive] = useState23(false);
|
7032
7034
|
useEffect21(() => {
|
7033
7035
|
setIsActive(width === state.ui.viewports.current.width);
|
7034
7036
|
}, [width, state.ui.viewports.current.width]);
|
@@ -7189,7 +7191,7 @@ var Canvas = () => {
|
|
7189
7191
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
7190
7192
|
const { ui } = state;
|
7191
7193
|
const frameRef = useRef9(null);
|
7192
|
-
const [showTransition, setShowTransition] =
|
7194
|
+
const [showTransition, setShowTransition] = useState24(false);
|
7193
7195
|
const defaultRender = useMemo17(() => {
|
7194
7196
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
|
7195
7197
|
return PuckDefault;
|
@@ -7244,7 +7246,7 @@ var Canvas = () => {
|
|
7244
7246
|
window.removeEventListener("resize", cb);
|
7245
7247
|
};
|
7246
7248
|
}, []);
|
7247
|
-
const [showLoader, setShowLoader] =
|
7249
|
+
const [showLoader, setShowLoader] = useState24(false);
|
7248
7250
|
useEffect22(() => {
|
7249
7251
|
setTimeout(() => {
|
7250
7252
|
setShowLoader(true);
|
@@ -7374,10 +7376,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
|
|
7374
7376
|
|
7375
7377
|
// lib/use-inject-css.ts
|
7376
7378
|
init_react_import();
|
7377
|
-
import { useEffect as useEffect23, useState as
|
7379
|
+
import { useEffect as useEffect23, useState as useState25 } from "react";
|
7378
7380
|
var styles = ``;
|
7379
7381
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7380
|
-
const [el, setEl] =
|
7382
|
+
const [el, setEl] = useState25();
|
7381
7383
|
useEffect23(() => {
|
7382
7384
|
setEl(document.createElement("style"));
|
7383
7385
|
}, []);
|
@@ -7461,7 +7463,7 @@ function Puck({
|
|
7461
7463
|
waitForStyles: true
|
7462
7464
|
}, _iframe);
|
7463
7465
|
useInjectGlobalCss(iframe.enabled);
|
7464
|
-
const [generatedAppState] =
|
7466
|
+
const [generatedAppState] = useState26(() => {
|
7465
7467
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7466
7468
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7467
7469
|
let clientUiState = {};
|
@@ -7533,7 +7535,7 @@ function Puck({
|
|
7533
7535
|
histories,
|
7534
7536
|
index: initialHistoryIndex
|
7535
7537
|
});
|
7536
|
-
const [reducer] =
|
7538
|
+
const [reducer] = useState26(
|
7537
7539
|
() => createReducer({
|
7538
7540
|
config,
|
7539
7541
|
record: historyStore.record,
|
@@ -7551,7 +7553,7 @@ function Puck({
|
|
7551
7553
|
historyStore,
|
7552
7554
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
7553
7555
|
});
|
7554
|
-
const [menuOpen, setMenuOpen] =
|
7556
|
+
const [menuOpen, setMenuOpen] = useState26(false);
|
7555
7557
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
7556
7558
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
7557
7559
|
useEffect24(() => {
|
@@ -7638,7 +7640,7 @@ function Puck({
|
|
7638
7640
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7639
7641
|
[loadedOverrides]
|
7640
7642
|
);
|
7641
|
-
const [mounted, setMounted] =
|
7643
|
+
const [mounted, setMounted] = useState26(false);
|
7642
7644
|
useEffect24(() => {
|
7643
7645
|
setMounted(true);
|
7644
7646
|
}, []);
|
@@ -7825,40 +7827,6 @@ function migrate(data) {
|
|
7825
7827
|
return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
|
7826
7828
|
}
|
7827
7829
|
|
7828
|
-
// lib/transform-props.ts
|
7829
|
-
init_react_import();
|
7830
|
-
function transformProps(data, propTransforms) {
|
7831
|
-
const mapItem = (item) => {
|
7832
|
-
if (propTransforms[item.type]) {
|
7833
|
-
return __spreadProps(__spreadValues({}, item), {
|
7834
|
-
props: propTransforms[item.type](item.props)
|
7835
|
-
});
|
7836
|
-
}
|
7837
|
-
return item;
|
7838
|
-
};
|
7839
|
-
const defaultedData = defaultData(data);
|
7840
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
7841
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
7842
|
-
if (propTransforms["root"]) {
|
7843
|
-
if (defaultedData.root.props) {
|
7844
|
-
newRoot.props = propTransforms["root"](rootProps);
|
7845
|
-
} else {
|
7846
|
-
newRoot = propTransforms["root"](rootProps);
|
7847
|
-
}
|
7848
|
-
}
|
7849
|
-
const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
|
7850
|
-
root: newRoot,
|
7851
|
-
content: defaultedData.content.map(mapItem),
|
7852
|
-
zones: Object.keys(data.zones || {}).reduce(
|
7853
|
-
(acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
|
7854
|
-
[zoneKey]: data.zones[zoneKey].map(mapItem)
|
7855
|
-
}),
|
7856
|
-
{}
|
7857
|
-
)
|
7858
|
-
});
|
7859
|
-
return afterPropTransforms;
|
7860
|
-
}
|
7861
|
-
|
7862
7830
|
// lib/use-puck.ts
|
7863
7831
|
init_react_import();
|
7864
7832
|
var usePuck = () => {
|