@measured/puck 0.17.0-canary.8ea38c3 → 0.17.0-canary.9991c07
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.css +85 -83
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +224 -133
- package/dist/index.mjs +160 -70
- package/dist/{resolve-all-data-CaVk1fIL.d.mts → resolve-all-data-C7aAQCY3.d.mts} +7 -0
- package/dist/{resolve-all-data-CaVk1fIL.d.ts → resolve-all-data-C7aAQCY3.d.ts} +7 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -178,14 +178,13 @@ init_react_import();
|
|
178
178
|
|
179
179
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
180
180
|
init_react_import();
|
181
|
-
var styles_module_default2 = { "Input": "
|
181
|
+
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
|
182
182
|
|
183
183
|
// components/AutoField/index.tsx
|
184
184
|
import {
|
185
185
|
useCallback as useCallback5,
|
186
186
|
useEffect as useEffect9,
|
187
187
|
useMemo as useMemo2,
|
188
|
-
useRef as useRef2,
|
189
188
|
useState as useState10
|
190
189
|
} from "react";
|
191
190
|
|
@@ -880,7 +879,8 @@ var defaultAppState = {
|
|
880
879
|
},
|
881
880
|
options: [],
|
882
881
|
controlsVisible: true
|
883
|
-
}
|
882
|
+
},
|
883
|
+
field: { focus: null }
|
884
884
|
}
|
885
885
|
};
|
886
886
|
var defaultContext = {
|
@@ -1228,11 +1228,13 @@ var ArrayField = ({
|
|
1228
1228
|
event.source.index,
|
1229
1229
|
(_b = event.destination) == null ? void 0 : _b.index
|
1230
1230
|
);
|
1231
|
-
|
1231
|
+
const newUi = {
|
1232
1232
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
1233
1233
|
[id]: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
1234
1234
|
})
|
1235
|
-
}
|
1235
|
+
};
|
1236
|
+
setUi(newUi, false);
|
1237
|
+
onChange(newValue, newUi);
|
1236
1238
|
setLocalState({
|
1237
1239
|
value: newValue,
|
1238
1240
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
@@ -1298,32 +1300,60 @@ var ArrayField = ({
|
|
1298
1300
|
children: [
|
1299
1301
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1300
1302
|
/* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
|
1301
|
-
!readOnly && /* @__PURE__ */
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
e
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1303
|
+
!readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
|
1304
|
+
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
|
1305
|
+
IconButton,
|
1306
|
+
{
|
1307
|
+
type: "button",
|
1308
|
+
disabled: !!addDisabled,
|
1309
|
+
onClick: (e) => {
|
1310
|
+
e.stopPropagation();
|
1311
|
+
const existingValue = [
|
1312
|
+
...value || []
|
1313
|
+
];
|
1314
|
+
existingValue.splice(
|
1315
|
+
i,
|
1316
|
+
0,
|
1317
|
+
existingValue[i]
|
1318
|
+
);
|
1319
|
+
onChange(
|
1320
|
+
existingValue,
|
1321
|
+
mapArrayStateToUi(
|
1322
|
+
regenerateArrayState(existingValue)
|
1323
|
+
)
|
1324
|
+
);
|
1325
|
+
},
|
1326
|
+
title: "Duplicate",
|
1327
|
+
children: /* @__PURE__ */ jsx9(Copy, { size: 16 })
|
1328
|
+
}
|
1329
|
+
) }),
|
1330
|
+
/* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
|
1331
|
+
IconButton,
|
1332
|
+
{
|
1333
|
+
type: "button",
|
1334
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
1335
|
+
onClick: (e) => {
|
1336
|
+
e.stopPropagation();
|
1337
|
+
const existingValue = [
|
1338
|
+
...value || []
|
1339
|
+
];
|
1340
|
+
const existingItems = [
|
1341
|
+
...arrayState.items || []
|
1342
|
+
];
|
1343
|
+
existingValue.splice(i, 1);
|
1344
|
+
existingItems.splice(i, 1);
|
1345
|
+
onChange(
|
1346
|
+
existingValue,
|
1347
|
+
mapArrayStateToUi({
|
1348
|
+
items: existingItems
|
1349
|
+
})
|
1350
|
+
);
|
1351
|
+
},
|
1352
|
+
title: "Delete",
|
1353
|
+
children: /* @__PURE__ */ jsx9(Trash, { size: 16 })
|
1354
|
+
}
|
1355
|
+
) })
|
1356
|
+
] }),
|
1327
1357
|
/* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9(DragIcon, {}) })
|
1328
1358
|
] })
|
1329
1359
|
]
|
@@ -1419,6 +1449,7 @@ var DefaultField = ({
|
|
1419
1449
|
className: getClassName6("input"),
|
1420
1450
|
autoComplete: "off",
|
1421
1451
|
type: field.type,
|
1452
|
+
title: label || name,
|
1422
1453
|
name,
|
1423
1454
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1424
1455
|
onChange: (e) => {
|
@@ -1455,7 +1486,7 @@ import {
|
|
1455
1486
|
|
1456
1487
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
1457
1488
|
init_react_import();
|
1458
|
-
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-
|
1489
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_8wgzm_1", "ExternalInput-button": "_ExternalInput-button_8wgzm_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_8wgzm_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_8wgzm_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_8wgzm_35", "ExternalInput": "_ExternalInput_8wgzm_1", "ExternalInputModal": "_ExternalInputModal_8wgzm_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_8wgzm_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_8wgzm_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_8wgzm_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_8wgzm_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_8wgzm_133", "ExternalInputModal-table": "_ExternalInputModal-table_8wgzm_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_8wgzm_149", "ExternalInputModal-th": "_ExternalInputModal-th_8wgzm_149", "ExternalInputModal-td": "_ExternalInputModal-td_8wgzm_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_8wgzm_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_8wgzm_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_8wgzm_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_8wgzm_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_8wgzm_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_8wgzm_227", "ExternalInputModal-search": "_ExternalInputModal-search_8wgzm_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_8wgzm_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_8wgzm_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_8wgzm_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_8wgzm_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_8wgzm_326", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_8wgzm_330", "ExternalInputModal-footer": "_ExternalInputModal-footer_8wgzm_330" };
|
1459
1490
|
|
1460
1491
|
// components/Modal/index.tsx
|
1461
1492
|
init_react_import();
|
@@ -1633,6 +1664,14 @@ var ExternalInput = ({
|
|
1633
1664
|
}),
|
1634
1665
|
[id, field]
|
1635
1666
|
);
|
1667
|
+
const Footer = useCallback4(
|
1668
|
+
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs7("span", { className: getClassNameModal("footer"), children: [
|
1669
|
+
props.items.length,
|
1670
|
+
" result",
|
1671
|
+
props.items.length === 1 ? "" : "s"
|
1672
|
+
] }),
|
1673
|
+
[field.renderFooter]
|
1674
|
+
);
|
1636
1675
|
useEffect7(() => {
|
1637
1676
|
search(searchQuery, filters);
|
1638
1677
|
}, []);
|
@@ -1772,11 +1811,7 @@ var ExternalInput = ({
|
|
1772
1811
|
/* @__PURE__ */ jsx14("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx14(Loader, { size: 24 }) })
|
1773
1812
|
] })
|
1774
1813
|
] }),
|
1775
|
-
/* @__PURE__ */
|
1776
|
-
mappedData.length,
|
1777
|
-
" result",
|
1778
|
-
mappedData.length === 1 ? "" : "s"
|
1779
|
-
] })
|
1814
|
+
/* @__PURE__ */ jsx14("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx14(Footer, { items: mappedData }) })
|
1780
1815
|
]
|
1781
1816
|
}
|
1782
1817
|
) })
|
@@ -1835,6 +1870,19 @@ var ExternalField = ({
|
|
1835
1870
|
|
1836
1871
|
// components/AutoField/fields/RadioField/index.tsx
|
1837
1872
|
init_react_import();
|
1873
|
+
|
1874
|
+
// lib/safe-json-parse.ts
|
1875
|
+
init_react_import();
|
1876
|
+
var safeJsonParse = (str) => {
|
1877
|
+
try {
|
1878
|
+
const jsonValue = JSON.parse(str);
|
1879
|
+
return jsonValue;
|
1880
|
+
} catch (e) {
|
1881
|
+
return str;
|
1882
|
+
}
|
1883
|
+
};
|
1884
|
+
|
1885
|
+
// components/AutoField/fields/RadioField/index.tsx
|
1838
1886
|
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
1839
1887
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
1840
1888
|
var RadioField = ({
|
@@ -1869,13 +1917,7 @@ var RadioField = ({
|
|
1869
1917
|
className: getClassName11("radioInput"),
|
1870
1918
|
value: option.value,
|
1871
1919
|
name,
|
1872
|
-
onChange: (
|
1873
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1874
|
-
onChange(JSON.parse(e.currentTarget.value));
|
1875
|
-
return;
|
1876
|
-
}
|
1877
|
-
onChange(e.currentTarget.value);
|
1878
|
-
},
|
1920
|
+
onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
|
1879
1921
|
disabled: readOnly,
|
1880
1922
|
checked: value === option.value
|
1881
1923
|
}
|
@@ -1916,15 +1958,10 @@ var SelectField = ({
|
|
1916
1958
|
"select",
|
1917
1959
|
{
|
1918
1960
|
id,
|
1961
|
+
title: label || name,
|
1919
1962
|
className: getClassName12("input"),
|
1920
1963
|
disabled: readOnly,
|
1921
|
-
onChange: (
|
1922
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1923
|
-
onChange(JSON.parse(e.currentTarget.value));
|
1924
|
-
return;
|
1925
|
-
}
|
1926
|
-
onChange(e.currentTarget.value);
|
1927
|
-
},
|
1964
|
+
onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
|
1928
1965
|
value,
|
1929
1966
|
children: field.options.map((option) => /* @__PURE__ */ jsx17(
|
1930
1967
|
"option",
|
@@ -2056,6 +2093,7 @@ var useSafeId = () => {
|
|
2056
2093
|
// components/AutoField/index.tsx
|
2057
2094
|
import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
2058
2095
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
2096
|
+
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
2059
2097
|
var FieldLabel = ({
|
2060
2098
|
children,
|
2061
2099
|
icon,
|
@@ -2103,7 +2141,7 @@ var FieldLabelInternal2 = ({
|
|
2103
2141
|
};
|
2104
2142
|
function AutoFieldInternal(props) {
|
2105
2143
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2106
|
-
const { overrides } = useAppContext();
|
2144
|
+
const { dispatch, overrides } = useAppContext();
|
2107
2145
|
const { id, Label = FieldLabelInternal2 } = props;
|
2108
2146
|
const field = props.field;
|
2109
2147
|
const label = field.label;
|
@@ -2135,23 +2173,56 @@ function AutoFieldInternal(props) {
|
|
2135
2173
|
Label,
|
2136
2174
|
id: resolvedId
|
2137
2175
|
});
|
2176
|
+
const onFocus = useCallback5(
|
2177
|
+
(e) => {
|
2178
|
+
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2179
|
+
e.stopPropagation();
|
2180
|
+
dispatch({
|
2181
|
+
type: "setUi",
|
2182
|
+
ui: {
|
2183
|
+
field: { focus: mergedProps.name }
|
2184
|
+
}
|
2185
|
+
});
|
2186
|
+
}
|
2187
|
+
},
|
2188
|
+
[mergedProps.name]
|
2189
|
+
);
|
2190
|
+
const onBlur = useCallback5((e) => {
|
2191
|
+
if ("name" in e.target) {
|
2192
|
+
dispatch({
|
2193
|
+
type: "setUi",
|
2194
|
+
ui: {
|
2195
|
+
field: { focus: null }
|
2196
|
+
}
|
2197
|
+
});
|
2198
|
+
}
|
2199
|
+
}, []);
|
2138
2200
|
if (field.type === "custom") {
|
2139
2201
|
if (!field.render) {
|
2140
2202
|
return null;
|
2141
2203
|
}
|
2142
2204
|
const CustomField = field.render;
|
2143
|
-
return /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) });
|
2205
|
+
return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) }) });
|
2144
2206
|
}
|
2145
2207
|
const children = defaultFields[field.type](mergedProps);
|
2146
2208
|
const Render2 = render[field.type];
|
2147
|
-
return /* @__PURE__ */ jsx20(
|
2209
|
+
return /* @__PURE__ */ jsx20(
|
2210
|
+
"div",
|
2211
|
+
{
|
2212
|
+
className: getClassNameWrapper(),
|
2213
|
+
onFocus,
|
2214
|
+
onBlur,
|
2215
|
+
onClick: (e) => {
|
2216
|
+
e.stopPropagation();
|
2217
|
+
},
|
2218
|
+
children: /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2219
|
+
}
|
2220
|
+
);
|
2148
2221
|
}
|
2149
|
-
var RECENT_CHANGE_TIMEOUT = 200;
|
2150
2222
|
function AutoFieldPrivate(props) {
|
2223
|
+
const { state } = useAppContext();
|
2151
2224
|
const { value, onChange } = props;
|
2152
2225
|
const [localValue, setLocalValue] = useState10(value);
|
2153
|
-
const [recentlyChanged, setRecentlyChanged] = useState10(false);
|
2154
|
-
const timeoutRef = useRef2();
|
2155
2226
|
const onChangeDb = useDebouncedCallback(
|
2156
2227
|
(val, ui) => {
|
2157
2228
|
onChange(val, ui);
|
@@ -2161,15 +2232,10 @@ function AutoFieldPrivate(props) {
|
|
2161
2232
|
);
|
2162
2233
|
const onChangeLocal = useCallback5((val, ui) => {
|
2163
2234
|
setLocalValue(val);
|
2164
|
-
setRecentlyChanged(true);
|
2165
|
-
clearTimeout(timeoutRef.current);
|
2166
|
-
timeoutRef.current = setTimeout(() => {
|
2167
|
-
setRecentlyChanged(false);
|
2168
|
-
}, RECENT_CHANGE_TIMEOUT);
|
2169
2235
|
onChangeDb(val, ui);
|
2170
2236
|
}, []);
|
2171
2237
|
useEffect9(() => {
|
2172
|
-
if (
|
2238
|
+
if (state.ui.field.focus !== props.name) {
|
2173
2239
|
setLocalValue(value);
|
2174
2240
|
}
|
2175
2241
|
}, [value]);
|
@@ -3520,6 +3586,22 @@ var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields
|
|
3520
3586
|
|
3521
3587
|
// components/Puck/components/Fields/index.tsx
|
3522
3588
|
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useState as useState15 } from "react";
|
3589
|
+
|
3590
|
+
// lib/use-parent.ts
|
3591
|
+
init_react_import();
|
3592
|
+
import { useContext as useContext5 } from "react";
|
3593
|
+
var useParent = (itemSelector) => {
|
3594
|
+
var _a;
|
3595
|
+
const { selectedItem, state } = useAppContext();
|
3596
|
+
const { pathData } = useContext5(dropZoneContext) || {};
|
3597
|
+
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
3598
|
+
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
3599
|
+
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
3600
|
+
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
|
3601
|
+
return parent || null;
|
3602
|
+
};
|
3603
|
+
|
3604
|
+
// components/Puck/components/Fields/index.tsx
|
3523
3605
|
import { Fragment as Fragment12, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
3524
3606
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3525
3607
|
var defaultPageFields = {
|
@@ -3533,6 +3615,7 @@ var DefaultFields = ({
|
|
3533
3615
|
var useResolvedFields = () => {
|
3534
3616
|
var _a, _b;
|
3535
3617
|
const { selectedItem, state, config } = useAppContext();
|
3618
|
+
const parent = useParent();
|
3536
3619
|
const { data } = state;
|
3537
3620
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
3538
3621
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
@@ -3563,7 +3646,8 @@ var useResolvedFields = () => {
|
|
3563
3646
|
fields,
|
3564
3647
|
lastFields: resolvedFields,
|
3565
3648
|
lastData,
|
3566
|
-
appState: state
|
3649
|
+
appState: state,
|
3650
|
+
parent
|
3567
3651
|
}
|
3568
3652
|
);
|
3569
3653
|
}
|
@@ -3573,7 +3657,8 @@ var useResolvedFields = () => {
|
|
3573
3657
|
fields,
|
3574
3658
|
lastFields: resolvedFields,
|
3575
3659
|
lastData,
|
3576
|
-
appState: state
|
3660
|
+
appState: state,
|
3661
|
+
parent
|
3577
3662
|
});
|
3578
3663
|
}
|
3579
3664
|
return defaultResolveFields(componentData, {
|
@@ -3595,7 +3680,7 @@ var useResolvedFields = () => {
|
|
3595
3680
|
} else {
|
3596
3681
|
setResolvedFields(defaultFields);
|
3597
3682
|
}
|
3598
|
-
}, [data, defaultFields,
|
3683
|
+
}, [data, defaultFields, selectedItem, hasResolver]);
|
3599
3684
|
return [resolvedFields, fieldsLoading];
|
3600
3685
|
};
|
3601
3686
|
var Fields = () => {
|
@@ -3902,7 +3987,7 @@ import { useCallback as useCallback8, useMemo as useMemo8 } from "react";
|
|
3902
3987
|
init_react_import();
|
3903
3988
|
import {
|
3904
3989
|
createContext as createContext4,
|
3905
|
-
useContext as
|
3990
|
+
useContext as useContext6,
|
3906
3991
|
useEffect as useEffect15,
|
3907
3992
|
useRef as useRef3,
|
3908
3993
|
useState as useState17
|
@@ -4112,7 +4197,7 @@ var CopyHostStyles = ({
|
|
4112
4197
|
return /* @__PURE__ */ jsx31(Fragment13, { children });
|
4113
4198
|
};
|
4114
4199
|
var autoFrameContext = createContext4({});
|
4115
|
-
var useFrame = () =>
|
4200
|
+
var useFrame = () => useContext6(autoFrameContext);
|
4116
4201
|
function AutoFrame(_a) {
|
4117
4202
|
var _b = _a, {
|
4118
4203
|
children,
|
@@ -4265,7 +4350,7 @@ var scrollIntoView = (el) => {
|
|
4265
4350
|
};
|
4266
4351
|
|
4267
4352
|
// components/LayerTree/index.tsx
|
4268
|
-
import { useContext as
|
4353
|
+
import { useContext as useContext7 } from "react";
|
4269
4354
|
|
4270
4355
|
// lib/is-child-of-zone.ts
|
4271
4356
|
init_react_import();
|
@@ -4292,7 +4377,7 @@ var LayerTree = ({
|
|
4292
4377
|
label
|
4293
4378
|
}) => {
|
4294
4379
|
const zones = data.zones || {};
|
4295
|
-
const ctx =
|
4380
|
+
const ctx = useContext7(dropZoneContext);
|
4296
4381
|
return /* @__PURE__ */ jsxs17(Fragment15, { children: [
|
4297
4382
|
label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
|
4298
4383
|
/* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
|
@@ -5656,6 +5741,11 @@ var usePuck = () => {
|
|
5656
5741
|
getPermissions,
|
5657
5742
|
refreshPermissions
|
5658
5743
|
} = useAppContext();
|
5744
|
+
if (dispatch === defaultContext.dispatch) {
|
5745
|
+
throw new Error(
|
5746
|
+
"usePuck was used outside of the <Puck> component. The usePuck hook must be rendered within the <Puck> context as children, overrides or plugins as described in https://puckeditor.com/docs/api-reference/functions/use-puck."
|
5747
|
+
);
|
5748
|
+
}
|
5659
5749
|
return {
|
5660
5750
|
appState,
|
5661
5751
|
config,
|
@@ -94,6 +94,9 @@ type ExternalField<Props extends {
|
|
94
94
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
95
95
|
getItemSummary?: (item: Props, index?: number) => string;
|
96
96
|
showSearch?: boolean;
|
97
|
+
renderFooter?: (props: {
|
98
|
+
items: any[];
|
99
|
+
}) => ReactElement;
|
97
100
|
initialQuery?: string;
|
98
101
|
filterFields?: Record<string, Field>;
|
99
102
|
initialFilters?: Record<string, any>;
|
@@ -142,6 +145,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
142
145
|
lastFields: Fields<FieldProps>;
|
143
146
|
lastData: DataShape | null;
|
144
147
|
appState: AppState;
|
148
|
+
parent: ComponentData | null;
|
145
149
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
146
150
|
resolveData?: (data: DataShape, params: {
|
147
151
|
changed: Partial<Record<keyof FieldProps, boolean>>;
|
@@ -271,6 +275,9 @@ type UiState = {
|
|
271
275
|
controlsVisible: boolean;
|
272
276
|
options: Viewport[];
|
273
277
|
};
|
278
|
+
field: {
|
279
|
+
focus?: string | null;
|
280
|
+
};
|
274
281
|
};
|
275
282
|
type AppState<UserData extends Data = Data> = {
|
276
283
|
data: UserData;
|
@@ -94,6 +94,9 @@ type ExternalField<Props extends {
|
|
94
94
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
95
95
|
getItemSummary?: (item: Props, index?: number) => string;
|
96
96
|
showSearch?: boolean;
|
97
|
+
renderFooter?: (props: {
|
98
|
+
items: any[];
|
99
|
+
}) => ReactElement;
|
97
100
|
initialQuery?: string;
|
98
101
|
filterFields?: Record<string, Field>;
|
99
102
|
initialFilters?: Record<string, any>;
|
@@ -142,6 +145,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
142
145
|
lastFields: Fields<FieldProps>;
|
143
146
|
lastData: DataShape | null;
|
144
147
|
appState: AppState;
|
148
|
+
parent: ComponentData | null;
|
145
149
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
146
150
|
resolveData?: (data: DataShape, params: {
|
147
151
|
changed: Partial<Record<keyof FieldProps, boolean>>;
|
@@ -271,6 +275,9 @@ type UiState = {
|
|
271
275
|
controlsVisible: boolean;
|
272
276
|
options: Viewport[];
|
273
277
|
};
|
278
|
+
field: {
|
279
|
+
focus?: string | null;
|
280
|
+
};
|
274
281
|
};
|
275
282
|
type AppState<UserData extends Data = Data> = {
|
276
283
|
data: UserData;
|
package/dist/rsc.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './resolve-all-data-
|
3
|
-
export { a4 as resolveAllData } from './resolve-all-data-
|
2
|
+
import { C as Config, D as Data } from './resolve-all-data-C7aAQCY3.mjs';
|
3
|
+
export { a4 as resolveAllData } from './resolve-all-data-C7aAQCY3.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './resolve-all-data-
|
3
|
-
export { a4 as resolveAllData } from './resolve-all-data-
|
2
|
+
import { C as Config, D as Data } from './resolve-all-data-C7aAQCY3.js';
|
3
|
+
export { a4 as resolveAllData } from './resolve-all-data-C7aAQCY3.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
package/package.json
CHANGED