@measured/puck 0.21.0-canary.9c2c8fe9 → 0.21.0-canary.a5160e5d
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-KNAV6QTS.mjs → chunk-LAV6OYHN.mjs} +27 -12
- package/dist/{chunk-X7YZ3YE7.mjs → chunk-VBJEDLUM.mjs} +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -22
- package/dist/index.mjs +2 -2
- package/dist/no-external.d.mts +1 -1
- package/dist/no-external.d.ts +1 -1
- package/dist/no-external.js +34 -22
- package/dist/no-external.mjs +2 -2
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-Ctf3FZQI.d.mts → walk-tree-DkTSFbz_.d.mts} +5 -1
- package/dist/{walk-tree-Ctf3FZQI.d.ts → walk-tree-DkTSFbz_.d.ts} +5 -1
- package/package.json +1 -1
@@ -19,12 +19,13 @@ import {
|
|
19
19
|
rootDroppableId,
|
20
20
|
rootZone,
|
21
21
|
setupZone,
|
22
|
+
toComponent,
|
22
23
|
useFieldTransforms,
|
23
24
|
useSlots,
|
24
25
|
walkAppState,
|
25
26
|
walkField,
|
26
27
|
walkTree
|
27
|
-
} from "./chunk-
|
28
|
+
} from "./chunk-VBJEDLUM.mjs";
|
28
29
|
|
29
30
|
// ../../node_modules/classnames/index.js
|
30
31
|
var require_classnames = __commonJS({
|
@@ -3161,11 +3162,13 @@ var ExternalInput = ({
|
|
3161
3162
|
id,
|
3162
3163
|
readOnly
|
3163
3164
|
}) => {
|
3165
|
+
var _a;
|
3164
3166
|
const {
|
3165
3167
|
mapProp = (val) => val,
|
3166
3168
|
mapRow = (val) => val,
|
3167
3169
|
filterFields
|
3168
3170
|
} = field || {};
|
3171
|
+
const { enabled: shouldCacheData } = (_a = field.cache) != null ? _a : { enabled: true };
|
3169
3172
|
const [data, setData] = useState6([]);
|
3170
3173
|
const [isOpen, setOpen] = useState6(false);
|
3171
3174
|
const [isLoading, setIsLoading] = useState6(true);
|
@@ -3191,11 +3194,18 @@ var ExternalInput = ({
|
|
3191
3194
|
(query, filters2) => __async(void 0, null, function* () {
|
3192
3195
|
setIsLoading(true);
|
3193
3196
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
3194
|
-
|
3197
|
+
let listData;
|
3198
|
+
if (shouldCacheData && dataCache[cacheKey]) {
|
3199
|
+
listData = dataCache[cacheKey];
|
3200
|
+
} else {
|
3201
|
+
listData = yield field.fetchList({ query, filters: filters2 });
|
3202
|
+
}
|
3195
3203
|
if (listData) {
|
3196
3204
|
setData(listData);
|
3197
3205
|
setIsLoading(false);
|
3198
|
-
|
3206
|
+
if (shouldCacheData) {
|
3207
|
+
dataCache[cacheKey] = listData;
|
3208
|
+
}
|
3199
3209
|
}
|
3200
3210
|
}),
|
3201
3211
|
[id, field]
|
@@ -3259,6 +3269,7 @@ var ExternalInput = ({
|
|
3259
3269
|
}),
|
3260
3270
|
onSubmit: (e) => {
|
3261
3271
|
e.preventDefault();
|
3272
|
+
e.stopPropagation();
|
3262
3273
|
search(searchQuery, filters);
|
3263
3274
|
},
|
3264
3275
|
children: [
|
@@ -5679,26 +5690,26 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
5679
5690
|
capture: true
|
5680
5691
|
});
|
5681
5692
|
};
|
5682
|
-
if (
|
5683
|
-
el.addEventListener("focus", onFocus, { capture: true });
|
5684
|
-
el.addEventListener("blur", onBlur, { capture: true });
|
5685
|
-
} else if (disableDrag) {
|
5693
|
+
if (disableDrag) {
|
5686
5694
|
el.addEventListener("pointerdown", stopPropagation, {
|
5687
5695
|
capture: true
|
5688
5696
|
});
|
5697
|
+
} else if (disableDragOnFocus) {
|
5698
|
+
el.addEventListener("focus", onFocus, { capture: true });
|
5699
|
+
el.addEventListener("blur", onBlur, { capture: true });
|
5689
5700
|
}
|
5690
5701
|
el.setAttribute("data-puck-overlay-portal", "true");
|
5691
5702
|
return () => {
|
5692
5703
|
el.removeEventListener("mouseover", stopPropagation, {
|
5693
5704
|
capture: true
|
5694
5705
|
});
|
5695
|
-
if (
|
5696
|
-
el.removeEventListener("focus", onFocus, { capture: true });
|
5697
|
-
el.removeEventListener("blur", onFocus, { capture: true });
|
5698
|
-
} else if (disableDrag) {
|
5706
|
+
if (disableDrag) {
|
5699
5707
|
el.removeEventListener("pointerdown", stopPropagation, {
|
5700
5708
|
capture: true
|
5701
5709
|
});
|
5710
|
+
} else if (disableDragOnFocus) {
|
5711
|
+
el.removeEventListener("focus", onFocus, { capture: true });
|
5712
|
+
el.removeEventListener("blur", onBlur, { capture: true });
|
5702
5713
|
}
|
5703
5714
|
el.removeAttribute("data-puck-overlay-portal");
|
5704
5715
|
};
|
@@ -8592,9 +8603,13 @@ function PuckProvider({ children }) {
|
|
8592
8603
|
}
|
8593
8604
|
const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
|
8594
8605
|
const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
|
8606
|
+
const root = populateIds(
|
8607
|
+
toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
|
8608
|
+
config
|
8609
|
+
);
|
8595
8610
|
const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
8596
8611
|
data: __spreadProps(__spreadValues({}, initialData), {
|
8597
|
-
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props:
|
8612
|
+
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
|
8598
8613
|
content: initialData.content || []
|
8599
8614
|
}),
|
8600
8615
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-
|
2
|
-
export { a7 as Adaptor, a5 as ArrayField, B as ArrayState,
|
1
|
+
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-DkTSFbz_.mjs';
|
2
|
+
export { a7 as Adaptor, a5 as ArrayField, B as ArrayState, al as AsFieldProps, N as BaseData, $ as BaseField, a9 as CacheOpts, Z as ComponentDataMap, X as ComponentDataOptionalId, _ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, K as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, o as Direction, p as DragAxis, aa as ExternalField, a8 as ExternalFieldWithAdaptor, L as ExtractConfigParams, an as ExtractField, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, Y as MappedItem, a1 as NumberField, a6 as ObjectField, x as OverrideKey, G as PuckComponent, ae as PuckContext, a4 as RadioField, J as RootConfig, T as RootData, Q as RootDataWithoutProps, a3 as SelectField, S as Slot, E as SlotComponent, ad as SlotField, a0 as TextField, a2 as TextareaField, q as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DkTSFbz_.mjs';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-
|
2
|
-
export { a7 as Adaptor, a5 as ArrayField, B as ArrayState,
|
1
|
+
import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-DkTSFbz_.js';
|
2
|
+
export { a7 as Adaptor, a5 as ArrayField, B as ArrayState, al as AsFieldProps, N as BaseData, $ as BaseField, a9 as CacheOpts, Z as ComponentDataMap, X as ComponentDataOptionalId, _ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, K as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, o as Direction, p as DragAxis, aa as ExternalField, a8 as ExternalFieldWithAdaptor, L as ExtractConfigParams, an as ExtractField, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, Y as MappedItem, a1 as NumberField, a6 as ObjectField, x as OverrideKey, G as PuckComponent, ae as PuckContext, a4 as RadioField, J as RootConfig, T as RootData, Q as RootDataWithoutProps, a3 as SelectField, S as Slot, E as SlotComponent, ad as SlotField, a0 as TextField, a2 as TextareaField, q as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DkTSFbz_.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
package/dist/index.js
CHANGED
@@ -3795,11 +3795,13 @@ var ExternalInput = ({
|
|
3795
3795
|
id,
|
3796
3796
|
readOnly
|
3797
3797
|
}) => {
|
3798
|
+
var _a;
|
3798
3799
|
const {
|
3799
3800
|
mapProp = (val) => val,
|
3800
3801
|
mapRow = (val) => val,
|
3801
3802
|
filterFields
|
3802
3803
|
} = field || {};
|
3804
|
+
const { enabled: shouldCacheData } = (_a = field.cache) != null ? _a : { enabled: true };
|
3803
3805
|
const [data, setData] = (0, import_react17.useState)([]);
|
3804
3806
|
const [isOpen, setOpen] = (0, import_react17.useState)(false);
|
3805
3807
|
const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
|
@@ -3825,11 +3827,18 @@ var ExternalInput = ({
|
|
3825
3827
|
(query, filters2) => __async(void 0, null, function* () {
|
3826
3828
|
setIsLoading(true);
|
3827
3829
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
3828
|
-
|
3830
|
+
let listData;
|
3831
|
+
if (shouldCacheData && dataCache[cacheKey]) {
|
3832
|
+
listData = dataCache[cacheKey];
|
3833
|
+
} else {
|
3834
|
+
listData = yield field.fetchList({ query, filters: filters2 });
|
3835
|
+
}
|
3829
3836
|
if (listData) {
|
3830
3837
|
setData(listData);
|
3831
3838
|
setIsLoading(false);
|
3832
|
-
|
3839
|
+
if (shouldCacheData) {
|
3840
|
+
dataCache[cacheKey] = listData;
|
3841
|
+
}
|
3833
3842
|
}
|
3834
3843
|
}),
|
3835
3844
|
[id, field]
|
@@ -3893,6 +3902,7 @@ var ExternalInput = ({
|
|
3893
3902
|
}),
|
3894
3903
|
onSubmit: (e) => {
|
3895
3904
|
e.preventDefault();
|
3905
|
+
e.stopPropagation();
|
3896
3906
|
search(searchQuery, filters);
|
3897
3907
|
},
|
3898
3908
|
children: [
|
@@ -5576,26 +5586,26 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
5576
5586
|
capture: true
|
5577
5587
|
});
|
5578
5588
|
};
|
5579
|
-
if (
|
5580
|
-
el.addEventListener("focus", onFocus, { capture: true });
|
5581
|
-
el.addEventListener("blur", onBlur, { capture: true });
|
5582
|
-
} else if (disableDrag) {
|
5589
|
+
if (disableDrag) {
|
5583
5590
|
el.addEventListener("pointerdown", stopPropagation, {
|
5584
5591
|
capture: true
|
5585
5592
|
});
|
5593
|
+
} else if (disableDragOnFocus) {
|
5594
|
+
el.addEventListener("focus", onFocus, { capture: true });
|
5595
|
+
el.addEventListener("blur", onBlur, { capture: true });
|
5586
5596
|
}
|
5587
5597
|
el.setAttribute("data-puck-overlay-portal", "true");
|
5588
5598
|
return () => {
|
5589
5599
|
el.removeEventListener("mouseover", stopPropagation, {
|
5590
5600
|
capture: true
|
5591
5601
|
});
|
5592
|
-
if (
|
5593
|
-
el.removeEventListener("focus", onFocus, { capture: true });
|
5594
|
-
el.removeEventListener("blur", onFocus, { capture: true });
|
5595
|
-
} else if (disableDrag) {
|
5602
|
+
if (disableDrag) {
|
5596
5603
|
el.removeEventListener("pointerdown", stopPropagation, {
|
5597
5604
|
capture: true
|
5598
5605
|
});
|
5606
|
+
} else if (disableDragOnFocus) {
|
5607
|
+
el.removeEventListener("focus", onFocus, { capture: true });
|
5608
|
+
el.removeEventListener("blur", onBlur, { capture: true });
|
5599
5609
|
}
|
5600
5610
|
el.removeAttribute("data-puck-overlay-portal");
|
5601
5611
|
};
|
@@ -9208,6 +9218,15 @@ function useSidebarResize(position, dispatch) {
|
|
9208
9218
|
};
|
9209
9219
|
}
|
9210
9220
|
|
9221
|
+
// lib/data/to-component.ts
|
9222
|
+
init_react_import();
|
9223
|
+
var toComponent = (item) => {
|
9224
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
9225
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
9226
|
+
type: "root"
|
9227
|
+
});
|
9228
|
+
};
|
9229
|
+
|
9211
9230
|
// components/Puck/index.tsx
|
9212
9231
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
9213
9232
|
var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
|
@@ -9284,9 +9303,13 @@ function PuckProvider({ children }) {
|
|
9284
9303
|
}
|
9285
9304
|
const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
|
9286
9305
|
const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
|
9306
|
+
const root = populateIds(
|
9307
|
+
toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
|
9308
|
+
config
|
9309
|
+
);
|
9287
9310
|
const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
9288
9311
|
data: __spreadProps(__spreadValues({}, initialData), {
|
9289
|
-
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props:
|
9312
|
+
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
|
9290
9313
|
content: initialData.content || []
|
9291
9314
|
}),
|
9292
9315
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
@@ -9705,17 +9728,6 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
9705
9728
|
|
9706
9729
|
// lib/resolve-all-data.ts
|
9707
9730
|
init_react_import();
|
9708
|
-
|
9709
|
-
// lib/data/to-component.ts
|
9710
|
-
init_react_import();
|
9711
|
-
var toComponent = (item) => {
|
9712
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
9713
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
9714
|
-
type: "root"
|
9715
|
-
});
|
9716
|
-
};
|
9717
|
-
|
9718
|
-
// lib/resolve-all-data.ts
|
9719
9731
|
function resolveAllData(_0, _1) {
|
9720
9732
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
9721
9733
|
var _a;
|
package/dist/index.mjs
CHANGED
@@ -18,14 +18,14 @@ import {
|
|
18
18
|
setDeep,
|
19
19
|
useGetPuck,
|
20
20
|
usePuck
|
21
|
-
} from "./chunk-
|
21
|
+
} from "./chunk-LAV6OYHN.mjs";
|
22
22
|
import {
|
23
23
|
init_react_import,
|
24
24
|
migrate,
|
25
25
|
resolveAllData,
|
26
26
|
transformProps,
|
27
27
|
walkTree
|
28
|
-
} from "./chunk-
|
28
|
+
} from "./chunk-VBJEDLUM.mjs";
|
29
29
|
|
30
30
|
// bundle/index.ts
|
31
31
|
init_react_import();
|
package/dist/no-external.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { a7 as Adaptor, A as AppState, a5 as ArrayField, B as ArrayState,
|
1
|
+
export { a7 as Adaptor, A as AppState, a5 as ArrayField, B as ArrayState, al as AsFieldProps, N as BaseData, $ as BaseField, a9 as CacheOpts, f as ComponentConfig, a as ComponentData, Z as ComponentDataMap, X as ComponentDataOptionalId, C as Config, _ as Content, ac as CustomField, ab as CustomFieldRender, j as Data, ai as DefaultComponentProps, K as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, o as Direction, p as DragAxis, aa as ExternalField, a8 as ExternalFieldWithAdaptor, L as ExtractConfigParams, an as ExtractField, h as Field, i as FieldProps, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, g as FieldTransforms, F as Fields, H as History, I as IframeConfig, l as InitialHistory, z as ItemWithId, Y as MappedItem, M as Metadata, a1 as NumberField, a6 as ObjectField, k as OnAction, x as OverrideKey, O as Overrides, P as Permissions, d as Plugin, b as PuckAction, G as PuckComponent, ae as PuckContext, a4 as RadioField, c as ResolveDataTrigger, J as RootConfig, T as RootData, R as RootDataWithProps, Q as RootDataWithoutProps, a3 as SelectField, S as Slot, E as SlotComponent, ad as SlotField, a0 as TextField, a2 as TextareaField, e as UiState, U as UserGenerics, q as Viewport, V as Viewports, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DkTSFbz_.mjs';
|
2
2
|
export { Action, ActionBar, AutoField, Button, Drawer, DropZone, FieldLabel, Group, IconButton, Label, Puck, PuckApi, Render, UsePuckData, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck } from './index.mjs';
|
3
3
|
import 'react';
|
4
4
|
import 'react/jsx-runtime';
|
package/dist/no-external.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { a7 as Adaptor, A as AppState, a5 as ArrayField, B as ArrayState,
|
1
|
+
export { a7 as Adaptor, A as AppState, a5 as ArrayField, B as ArrayState, al as AsFieldProps, N as BaseData, $ as BaseField, a9 as CacheOpts, f as ComponentConfig, a as ComponentData, Z as ComponentDataMap, X as ComponentDataOptionalId, C as Config, _ as Content, ac as CustomField, ab as CustomFieldRender, j as Data, ai as DefaultComponentProps, K as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, o as Direction, p as DragAxis, aa as ExternalField, a8 as ExternalFieldWithAdaptor, L as ExtractConfigParams, an as ExtractField, h as Field, i as FieldProps, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, g as FieldTransforms, F as Fields, H as History, I as IframeConfig, l as InitialHistory, z as ItemWithId, Y as MappedItem, M as Metadata, a1 as NumberField, a6 as ObjectField, k as OnAction, x as OverrideKey, O as Overrides, P as Permissions, d as Plugin, b as PuckAction, G as PuckComponent, ae as PuckContext, a4 as RadioField, c as ResolveDataTrigger, J as RootConfig, T as RootData, R as RootDataWithProps, Q as RootDataWithoutProps, a3 as SelectField, S as Slot, E as SlotComponent, ad as SlotField, a0 as TextField, a2 as TextareaField, e as UiState, U as UserGenerics, q as Viewport, V as Viewports, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DkTSFbz_.js';
|
2
2
|
export { Action, ActionBar, AutoField, Button, Drawer, DropZone, FieldLabel, Group, IconButton, Label, Puck, PuckApi, Render, UsePuckData, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck } from './index.js';
|
3
3
|
import 'react';
|
4
4
|
import 'react/jsx-runtime';
|
package/dist/no-external.js
CHANGED
@@ -3795,11 +3795,13 @@ var ExternalInput = ({
|
|
3795
3795
|
id,
|
3796
3796
|
readOnly
|
3797
3797
|
}) => {
|
3798
|
+
var _a;
|
3798
3799
|
const {
|
3799
3800
|
mapProp = (val) => val,
|
3800
3801
|
mapRow = (val) => val,
|
3801
3802
|
filterFields
|
3802
3803
|
} = field || {};
|
3804
|
+
const { enabled: shouldCacheData } = (_a = field.cache) != null ? _a : { enabled: true };
|
3803
3805
|
const [data, setData] = (0, import_react17.useState)([]);
|
3804
3806
|
const [isOpen, setOpen] = (0, import_react17.useState)(false);
|
3805
3807
|
const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
|
@@ -3825,11 +3827,18 @@ var ExternalInput = ({
|
|
3825
3827
|
(query, filters2) => __async(void 0, null, function* () {
|
3826
3828
|
setIsLoading(true);
|
3827
3829
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
3828
|
-
|
3830
|
+
let listData;
|
3831
|
+
if (shouldCacheData && dataCache[cacheKey]) {
|
3832
|
+
listData = dataCache[cacheKey];
|
3833
|
+
} else {
|
3834
|
+
listData = yield field.fetchList({ query, filters: filters2 });
|
3835
|
+
}
|
3829
3836
|
if (listData) {
|
3830
3837
|
setData(listData);
|
3831
3838
|
setIsLoading(false);
|
3832
|
-
|
3839
|
+
if (shouldCacheData) {
|
3840
|
+
dataCache[cacheKey] = listData;
|
3841
|
+
}
|
3833
3842
|
}
|
3834
3843
|
}),
|
3835
3844
|
[id, field]
|
@@ -3893,6 +3902,7 @@ var ExternalInput = ({
|
|
3893
3902
|
}),
|
3894
3903
|
onSubmit: (e) => {
|
3895
3904
|
e.preventDefault();
|
3905
|
+
e.stopPropagation();
|
3896
3906
|
search(searchQuery, filters);
|
3897
3907
|
},
|
3898
3908
|
children: [
|
@@ -5576,26 +5586,26 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
5576
5586
|
capture: true
|
5577
5587
|
});
|
5578
5588
|
};
|
5579
|
-
if (
|
5580
|
-
el.addEventListener("focus", onFocus, { capture: true });
|
5581
|
-
el.addEventListener("blur", onBlur, { capture: true });
|
5582
|
-
} else if (disableDrag) {
|
5589
|
+
if (disableDrag) {
|
5583
5590
|
el.addEventListener("pointerdown", stopPropagation, {
|
5584
5591
|
capture: true
|
5585
5592
|
});
|
5593
|
+
} else if (disableDragOnFocus) {
|
5594
|
+
el.addEventListener("focus", onFocus, { capture: true });
|
5595
|
+
el.addEventListener("blur", onBlur, { capture: true });
|
5586
5596
|
}
|
5587
5597
|
el.setAttribute("data-puck-overlay-portal", "true");
|
5588
5598
|
return () => {
|
5589
5599
|
el.removeEventListener("mouseover", stopPropagation, {
|
5590
5600
|
capture: true
|
5591
5601
|
});
|
5592
|
-
if (
|
5593
|
-
el.removeEventListener("focus", onFocus, { capture: true });
|
5594
|
-
el.removeEventListener("blur", onFocus, { capture: true });
|
5595
|
-
} else if (disableDrag) {
|
5602
|
+
if (disableDrag) {
|
5596
5603
|
el.removeEventListener("pointerdown", stopPropagation, {
|
5597
5604
|
capture: true
|
5598
5605
|
});
|
5606
|
+
} else if (disableDragOnFocus) {
|
5607
|
+
el.removeEventListener("focus", onFocus, { capture: true });
|
5608
|
+
el.removeEventListener("blur", onBlur, { capture: true });
|
5599
5609
|
}
|
5600
5610
|
el.removeAttribute("data-puck-overlay-portal");
|
5601
5611
|
};
|
@@ -9208,6 +9218,15 @@ function useSidebarResize(position, dispatch) {
|
|
9208
9218
|
};
|
9209
9219
|
}
|
9210
9220
|
|
9221
|
+
// lib/data/to-component.ts
|
9222
|
+
init_react_import();
|
9223
|
+
var toComponent = (item) => {
|
9224
|
+
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
9225
|
+
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
9226
|
+
type: "root"
|
9227
|
+
});
|
9228
|
+
};
|
9229
|
+
|
9211
9230
|
// components/Puck/index.tsx
|
9212
9231
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
9213
9232
|
var getClassName31 = get_class_name_factory_default("Puck", styles_module_default15);
|
@@ -9284,9 +9303,13 @@ function PuckProvider({ children }) {
|
|
9284
9303
|
}
|
9285
9304
|
const rootProps = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
|
9286
9305
|
const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps);
|
9306
|
+
const root = populateIds(
|
9307
|
+
toComponent(__spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps })),
|
9308
|
+
config
|
9309
|
+
);
|
9287
9310
|
const newAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
9288
9311
|
data: __spreadProps(__spreadValues({}, initialData), {
|
9289
|
-
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props:
|
9312
|
+
root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: root.props }),
|
9290
9313
|
content: initialData.content || []
|
9291
9314
|
}),
|
9292
9315
|
ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
|
@@ -9705,17 +9728,6 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
9705
9728
|
|
9706
9729
|
// lib/resolve-all-data.ts
|
9707
9730
|
init_react_import();
|
9708
|
-
|
9709
|
-
// lib/data/to-component.ts
|
9710
|
-
init_react_import();
|
9711
|
-
var toComponent = (item) => {
|
9712
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
9713
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
9714
|
-
type: "root"
|
9715
|
-
});
|
9716
|
-
};
|
9717
|
-
|
9718
|
-
// lib/resolve-all-data.ts
|
9719
9731
|
function resolveAllData(_0, _1) {
|
9720
9732
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
9721
9733
|
var _a;
|
package/dist/no-external.mjs
CHANGED
@@ -18,14 +18,14 @@ import {
|
|
18
18
|
setDeep,
|
19
19
|
useGetPuck,
|
20
20
|
usePuck
|
21
|
-
} from "./chunk-
|
21
|
+
} from "./chunk-LAV6OYHN.mjs";
|
22
22
|
import {
|
23
23
|
init_react_import,
|
24
24
|
migrate,
|
25
25
|
resolveAllData,
|
26
26
|
transformProps,
|
27
27
|
walkTree
|
28
|
-
} from "./chunk-
|
28
|
+
} from "./chunk-VBJEDLUM.mjs";
|
29
29
|
|
30
30
|
// bundle/no-external.ts
|
31
31
|
init_react_import();
|
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, U as UserGenerics, M as Metadata } from './walk-tree-
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
2
|
+
import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-DkTSFbz_.mjs';
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DkTSFbz_.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
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, U as UserGenerics, M as Metadata } from './walk-tree-
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
2
|
+
import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-DkTSFbz_.js';
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DkTSFbz_.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
package/dist/rsc.mjs
CHANGED
@@ -82,10 +82,14 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
82
82
|
adaptorParams?: object;
|
83
83
|
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
84
84
|
};
|
85
|
+
type CacheOpts = {
|
86
|
+
enabled?: boolean;
|
87
|
+
};
|
85
88
|
type ExternalField<Props extends any = {
|
86
89
|
[key: string]: any;
|
87
90
|
}> = BaseField & {
|
88
91
|
type: "external";
|
92
|
+
cache?: CacheOpts;
|
89
93
|
placeholder?: string;
|
90
94
|
fetchList: (params: {
|
91
95
|
query: string;
|
@@ -631,4 +635,4 @@ type WalkTreeOptions = {
|
|
631
635
|
};
|
632
636
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
633
637
|
|
634
|
-
export { type BaseField as $, type AppState as A, type ArrayState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Fields as F, type PuckComponent as G, type History as H, type IframeConfig as I, type RootConfig as J, type DefaultComponents as K, type ExtractConfigParams as L, type Metadata as M, type BaseData as N, type Overrides as O, type Permissions as P, type RootDataWithoutProps as Q, type RootDataWithProps as R, type Slot as S, type RootData as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataOptionalId as X, type MappedItem as Y, type ComponentDataMap as Z, type Content as _, type ComponentData as a, type TextField as a0, type NumberField as a1, type TextareaField as a2, type SelectField as a3, type RadioField as a4, type ArrayField as a5, type ObjectField as a6, type Adaptor as a7, type ExternalFieldWithAdaptor as a8, type
|
638
|
+
export { type BaseField as $, type AppState as A, type ArrayState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Fields as F, type PuckComponent as G, type History as H, type IframeConfig as I, type RootConfig as J, type DefaultComponents as K, type ExtractConfigParams as L, type Metadata as M, type BaseData as N, type Overrides as O, type Permissions as P, type RootDataWithoutProps as Q, type RootDataWithProps as R, type Slot as S, type RootData as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataOptionalId as X, type MappedItem as Y, type ComponentDataMap as Z, type Content as _, type ComponentData as a, type TextField as a0, type NumberField as a1, type TextareaField as a2, type SelectField as a3, type RadioField as a4, type ArrayField as a5, type ObjectField as a6, type Adaptor as a7, type ExternalFieldWithAdaptor as a8, type CacheOpts as a9, type ExternalField as aa, type CustomFieldRender as ab, type CustomField as ac, type SlotField as ad, type PuckContext as ae, type DefaultRootFieldProps as af, type DefaultRootRenderProps as ag, type DefaultRootProps as ah, type DefaultComponentProps as ai, type WithId as aj, type WithPuckProps as ak, type AsFieldProps as al, type WithChildren as am, type ExtractField as an, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type FieldTransforms as g, type Field as h, type FieldProps as i, type Data as j, type OnAction as k, type InitialHistory as l, migrate as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, resolveAllData as r, type FieldTransformFnParams as s, transformProps as t, type FieldTransformFn as u, overrideKeys as v, walkTree as w, type OverrideKey as x, type FieldRenderFunctions as y, type ItemWithId as z };
|
@@ -82,10 +82,14 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
82
82
|
adaptorParams?: object;
|
83
83
|
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
84
84
|
};
|
85
|
+
type CacheOpts = {
|
86
|
+
enabled?: boolean;
|
87
|
+
};
|
85
88
|
type ExternalField<Props extends any = {
|
86
89
|
[key: string]: any;
|
87
90
|
}> = BaseField & {
|
88
91
|
type: "external";
|
92
|
+
cache?: CacheOpts;
|
89
93
|
placeholder?: string;
|
90
94
|
fetchList: (params: {
|
91
95
|
query: string;
|
@@ -631,4 +635,4 @@ type WalkTreeOptions = {
|
|
631
635
|
};
|
632
636
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
633
637
|
|
634
|
-
export { type BaseField as $, type AppState as A, type ArrayState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Fields as F, type PuckComponent as G, type History as H, type IframeConfig as I, type RootConfig as J, type DefaultComponents as K, type ExtractConfigParams as L, type Metadata as M, type BaseData as N, type Overrides as O, type Permissions as P, type RootDataWithoutProps as Q, type RootDataWithProps as R, type Slot as S, type RootData as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataOptionalId as X, type MappedItem as Y, type ComponentDataMap as Z, type Content as _, type ComponentData as a, type TextField as a0, type NumberField as a1, type TextareaField as a2, type SelectField as a3, type RadioField as a4, type ArrayField as a5, type ObjectField as a6, type Adaptor as a7, type ExternalFieldWithAdaptor as a8, type
|
638
|
+
export { type BaseField as $, type AppState as A, type ArrayState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Fields as F, type PuckComponent as G, type History as H, type IframeConfig as I, type RootConfig as J, type DefaultComponents as K, type ExtractConfigParams as L, type Metadata as M, type BaseData as N, type Overrides as O, type Permissions as P, type RootDataWithoutProps as Q, type RootDataWithProps as R, type Slot as S, type RootData as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataOptionalId as X, type MappedItem as Y, type ComponentDataMap as Z, type Content as _, type ComponentData as a, type TextField as a0, type NumberField as a1, type TextareaField as a2, type SelectField as a3, type RadioField as a4, type ArrayField as a5, type ObjectField as a6, type Adaptor as a7, type ExternalFieldWithAdaptor as a8, type CacheOpts as a9, type ExternalField as aa, type CustomFieldRender as ab, type CustomField as ac, type SlotField as ad, type PuckContext as ae, type DefaultRootFieldProps as af, type DefaultRootRenderProps as ag, type DefaultRootProps as ah, type DefaultComponentProps as ai, type WithId as aj, type WithPuckProps as ak, type AsFieldProps as al, type WithChildren as am, type ExtractField as an, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type FieldTransforms as g, type Field as h, type FieldProps as i, type Data as j, type OnAction as k, type InitialHistory as l, migrate as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, resolveAllData as r, type FieldTransformFnParams as s, transformProps as t, type FieldTransformFn as u, overrideKeys as v, walkTree as w, type OverrideKey as x, type FieldRenderFunctions as y, type ItemWithId as z };
|
package/package.json
CHANGED