@measured/puck 0.21.0-canary.e310a175 → 0.21.0-canary.e491598a
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-EXX4ZSCK.mjs → chunk-2NYOEOP7.mjs} +2941 -2623
- package/dist/{chunk-VBJEDLUM.mjs → chunk-FY5AZKYD.mjs} +12 -10
- package/dist/index.css +649 -270
- package/dist/index.d.mts +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +2432 -2116
- package/dist/index.mjs +10 -2
- package/dist/no-external.css +649 -270
- package/dist/no-external.d.mts +2 -2
- package/dist/no-external.d.ts +2 -2
- package/dist/no-external.js +2429 -2113
- package/dist/no-external.mjs +10 -2
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +12 -10
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-DkTSFbz_.d.mts → walk-tree-CL-j099F.d.mts} +72 -50
- package/dist/{walk-tree-DkTSFbz_.d.ts → walk-tree-CL-j099F.d.ts} +72 -50
- package/package.json +1 -1
package/dist/no-external.mjs
CHANGED
|
@@ -11,21 +11,25 @@ import {
|
|
|
11
11
|
Label,
|
|
12
12
|
Puck,
|
|
13
13
|
Render,
|
|
14
|
+
blocksPlugin,
|
|
15
|
+
createReducer,
|
|
14
16
|
createUsePuck,
|
|
17
|
+
fieldsPlugin,
|
|
18
|
+
outlinePlugin,
|
|
15
19
|
overrideKeys,
|
|
16
20
|
registerOverlayPortal,
|
|
17
21
|
renderContext,
|
|
18
22
|
setDeep,
|
|
19
23
|
useGetPuck,
|
|
20
24
|
usePuck
|
|
21
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-2NYOEOP7.mjs";
|
|
22
26
|
import {
|
|
23
27
|
init_react_import,
|
|
24
28
|
migrate,
|
|
25
29
|
resolveAllData,
|
|
26
30
|
transformProps,
|
|
27
31
|
walkTree
|
|
28
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-FY5AZKYD.mjs";
|
|
29
33
|
|
|
30
34
|
// bundle/no-external.ts
|
|
31
35
|
init_react_import();
|
|
@@ -42,8 +46,12 @@ export {
|
|
|
42
46
|
Label,
|
|
43
47
|
Puck,
|
|
44
48
|
Render,
|
|
49
|
+
blocksPlugin,
|
|
50
|
+
createReducer,
|
|
45
51
|
createUsePuck,
|
|
52
|
+
fieldsPlugin,
|
|
46
53
|
migrate,
|
|
54
|
+
outlinePlugin,
|
|
47
55
|
overrideKeys,
|
|
48
56
|
registerOverlayPortal,
|
|
49
57
|
renderContext,
|
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-CL-j099F.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CL-j099F.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-CL-j099F.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CL-j099F.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.js
CHANGED
|
@@ -474,7 +474,7 @@ var getChanged = (newItem, oldItem) => {
|
|
|
474
474
|
// lib/resolve-component-data.ts
|
|
475
475
|
var import_fast_equals2 = require("fast-equals");
|
|
476
476
|
var cache = { lastChange: {} };
|
|
477
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
477
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
478
478
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
479
479
|
const resolvedItem = __spreadValues({}, item);
|
|
480
480
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -502,11 +502,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
502
502
|
let itemWithResolvedChildren = yield mapFields(
|
|
503
503
|
resolvedItem,
|
|
504
504
|
{
|
|
505
|
-
slot: (_02) => __async(
|
|
505
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
506
506
|
const content = value;
|
|
507
507
|
return yield Promise.all(
|
|
508
508
|
content.map(
|
|
509
|
-
(childItem) => __async(
|
|
509
|
+
(childItem) => __async(null, null, function* () {
|
|
510
510
|
return (yield resolveComponentData(
|
|
511
511
|
childItem,
|
|
512
512
|
config,
|
|
@@ -554,7 +554,7 @@ function resolveAllData(_0, _1) {
|
|
|
554
554
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
555
555
|
var _a;
|
|
556
556
|
const defaultedData = defaultData(data);
|
|
557
|
-
const resolveNode = (_node) => __async(
|
|
557
|
+
const resolveNode = (_node) => __async(null, null, function* () {
|
|
558
558
|
const node = toComponent(_node);
|
|
559
559
|
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
560
560
|
const resolved = (yield resolveComponentData(
|
|
@@ -575,13 +575,13 @@ function resolveAllData(_0, _1) {
|
|
|
575
575
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
576
576
|
return resolvedDeep;
|
|
577
577
|
});
|
|
578
|
-
const processContent = (content) => __async(
|
|
578
|
+
const processContent = (content) => __async(null, null, function* () {
|
|
579
579
|
return Promise.all(content.map(resolveNode));
|
|
580
580
|
});
|
|
581
|
-
const processZones = () => __async(
|
|
581
|
+
const processZones = () => __async(null, null, function* () {
|
|
582
582
|
var _a2;
|
|
583
583
|
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
584
|
-
Object.entries(zones).forEach((_02) => __async(
|
|
584
|
+
Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
|
|
585
585
|
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
586
586
|
}));
|
|
587
587
|
return zones;
|
|
@@ -591,7 +591,7 @@ function resolveAllData(_0, _1) {
|
|
|
591
591
|
content: yield processContent(defaultedData.content),
|
|
592
592
|
zones: yield processZones()
|
|
593
593
|
};
|
|
594
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(
|
|
594
|
+
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
|
|
595
595
|
const content = defaultedData.zones[zoneKey];
|
|
596
596
|
dynamic.zones[zoneKey] = yield processContent(content);
|
|
597
597
|
}), {});
|
|
@@ -671,7 +671,8 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
|
671
671
|
var defaultViewports = [
|
|
672
672
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
673
673
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
674
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
674
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
675
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
675
676
|
];
|
|
676
677
|
|
|
677
678
|
// store/default-app-state.ts
|
|
@@ -693,7 +694,8 @@ var defaultAppState = {
|
|
|
693
694
|
options: [],
|
|
694
695
|
controlsVisible: true
|
|
695
696
|
},
|
|
696
|
-
field: { focus: null }
|
|
697
|
+
field: { focus: null },
|
|
698
|
+
plugin: { current: null }
|
|
697
699
|
},
|
|
698
700
|
indexes: {
|
|
699
701
|
nodes: {},
|
package/dist/rsc.mjs
CHANGED
|
@@ -10,63 +10,63 @@ type FieldOption = {
|
|
|
10
10
|
value: string | number | boolean | undefined | null | object;
|
|
11
11
|
};
|
|
12
12
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
13
|
-
|
|
13
|
+
interface BaseField {
|
|
14
14
|
label?: string;
|
|
15
15
|
labelIcon?: ReactElement;
|
|
16
|
-
metadata?:
|
|
16
|
+
metadata?: FieldMetadata;
|
|
17
17
|
visible?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
interface TextField extends BaseField {
|
|
20
20
|
type: "text";
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
contentEditable?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
interface NumberField extends BaseField {
|
|
25
25
|
type: "number";
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
min?: number;
|
|
28
28
|
max?: number;
|
|
29
29
|
step?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
30
|
+
}
|
|
31
|
+
interface TextareaField extends BaseField {
|
|
32
32
|
type: "textarea";
|
|
33
33
|
placeholder?: string;
|
|
34
34
|
contentEditable?: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
35
|
+
}
|
|
36
|
+
interface SelectField extends BaseField {
|
|
37
37
|
type: "select";
|
|
38
38
|
options: FieldOptions;
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
interface RadioField extends BaseField {
|
|
41
41
|
type: "radio";
|
|
42
42
|
options: FieldOptions;
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
}
|
|
44
|
+
interface ArrayField<Props extends {
|
|
45
45
|
[key: string]: any;
|
|
46
46
|
}[] = {
|
|
47
47
|
[key: string]: any;
|
|
48
|
-
}[], UserField extends {} = {}>
|
|
48
|
+
}[], UserField extends {} = {}> extends BaseField {
|
|
49
49
|
type: "array";
|
|
50
50
|
arrayFields: {
|
|
51
51
|
[SubPropName in keyof Props[0]]: UserField extends {
|
|
52
52
|
type: PropertyKey;
|
|
53
53
|
} ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
|
|
54
54
|
};
|
|
55
|
-
defaultItemProps?: Props[0];
|
|
55
|
+
defaultItemProps?: Props[0] | ((index: number) => Props[0]);
|
|
56
56
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
|
57
57
|
max?: number;
|
|
58
58
|
min?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
}
|
|
60
|
+
interface ObjectField<Props extends any = {
|
|
61
61
|
[key: string]: any;
|
|
62
|
-
}, UserField extends {} = {}>
|
|
62
|
+
}, UserField extends {} = {}> extends BaseField {
|
|
63
63
|
type: "object";
|
|
64
64
|
objectFields: {
|
|
65
65
|
[SubPropName in keyof Props]: UserField extends {
|
|
66
66
|
type: PropertyKey;
|
|
67
67
|
} ? Field<Props[SubPropName]> | UserField : Field<Props[SubPropName]>;
|
|
68
68
|
};
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
|
71
71
|
name: string;
|
|
72
72
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
@@ -85,9 +85,9 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
|
85
85
|
type CacheOpts = {
|
|
86
86
|
enabled?: boolean;
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
interface ExternalField<Props extends any = {
|
|
89
89
|
[key: string]: any;
|
|
90
|
-
}>
|
|
90
|
+
}> extends BaseField {
|
|
91
91
|
type: "external";
|
|
92
92
|
cache?: CacheOpts;
|
|
93
93
|
placeholder?: string;
|
|
@@ -105,7 +105,7 @@ type ExternalField<Props extends any = {
|
|
|
105
105
|
initialQuery?: string;
|
|
106
106
|
filterFields?: Record<string, Field>;
|
|
107
107
|
initialFilters?: Record<string, any>;
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
109
|
type CustomFieldRender<Value extends any> = (props: {
|
|
110
110
|
field: CustomField<Value>;
|
|
111
111
|
name: string;
|
|
@@ -114,16 +114,17 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
|
114
114
|
onChange: (value: Value) => void;
|
|
115
115
|
readOnly?: boolean;
|
|
116
116
|
}) => ReactElement;
|
|
117
|
-
|
|
117
|
+
interface CustomField<Value extends any> extends BaseField {
|
|
118
118
|
type: "custom";
|
|
119
119
|
render: CustomFieldRender<Value>;
|
|
120
120
|
contentEditable?: boolean;
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
key?: string;
|
|
122
|
+
}
|
|
123
|
+
interface SlotField extends BaseField {
|
|
123
124
|
type: "slot";
|
|
124
125
|
allow?: string[];
|
|
125
126
|
disallow?: string[];
|
|
126
|
-
}
|
|
127
|
+
}
|
|
127
128
|
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
128
129
|
[key: string]: any;
|
|
129
130
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
@@ -151,7 +152,7 @@ type DropZoneProps = {
|
|
|
151
152
|
};
|
|
152
153
|
|
|
153
154
|
type PuckContext = {
|
|
154
|
-
renderDropZone: React.
|
|
155
|
+
renderDropZone: (props: DropZoneProps) => React.ReactNode;
|
|
155
156
|
metadata: Metadata;
|
|
156
157
|
isEditing: boolean;
|
|
157
158
|
dragRef: ((element: Element | null) => void) | null;
|
|
@@ -201,6 +202,8 @@ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
|
|
201
202
|
type WithPartialProps<T, Props extends DefaultComponentProps> = Omit<T, "props"> & {
|
|
202
203
|
props?: Partial<Props>;
|
|
203
204
|
};
|
|
205
|
+
interface ComponentConfigExtensions {
|
|
206
|
+
}
|
|
204
207
|
type ComponentConfigInternal<RenderProps extends DefaultComponentProps, FieldProps extends DefaultComponentProps, DataShape = Omit<ComponentData<FieldProps>, "type">, // NB this doesn't include AllProps, so types will not contain deep slot types. To fix, we require a breaking change.
|
|
205
208
|
UserField extends BaseField = {}> = {
|
|
206
209
|
render: PuckComponent<RenderProps>;
|
|
@@ -216,7 +219,7 @@ UserField extends BaseField = {}> = {
|
|
|
216
219
|
fields: Fields<FieldProps>;
|
|
217
220
|
lastFields: Fields<FieldProps>;
|
|
218
221
|
lastData: DataShape | null;
|
|
219
|
-
metadata:
|
|
222
|
+
metadata: ComponentMetadata;
|
|
220
223
|
appState: AppState;
|
|
221
224
|
parent: ComponentData | null;
|
|
222
225
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
|
@@ -225,7 +228,7 @@ UserField extends BaseField = {}> = {
|
|
|
225
228
|
id: string;
|
|
226
229
|
}>;
|
|
227
230
|
lastData: DataShape | null;
|
|
228
|
-
metadata:
|
|
231
|
+
metadata: ComponentMetadata;
|
|
229
232
|
trigger: ResolveDataTrigger;
|
|
230
233
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
231
234
|
resolvePermissions?: (data: DataShape, params: {
|
|
@@ -237,8 +240,8 @@ UserField extends BaseField = {}> = {
|
|
|
237
240
|
appState: AppState;
|
|
238
241
|
lastData: DataShape | null;
|
|
239
242
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
|
240
|
-
metadata?:
|
|
241
|
-
};
|
|
243
|
+
metadata?: ComponentMetadata;
|
|
244
|
+
} & ComponentConfigExtensions;
|
|
242
245
|
type ComponentConfig<RenderPropsOrParams extends LeftOrExactRight<RenderPropsOrParams, DefaultComponentProps, ComponentConfigParams> = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderPropsOrParams extends {
|
|
243
246
|
props: any;
|
|
244
247
|
} ? RenderPropsOrParams["props"] : RenderPropsOrParams, DataShape = Omit<ComponentData<FieldProps>, "type">> = RenderPropsOrParams extends ComponentConfigParams<infer ParamsRenderProps, never> ? ComponentConfigInternal<ParamsRenderProps, FieldProps, DataShape, {}> : RenderPropsOrParams extends ComponentConfigParams<infer ParamsRenderProps, infer ParamsFields> ? ComponentConfigInternal<ParamsRenderProps, FieldProps, DataShape, ParamsFields[keyof ParamsFields] & BaseField> : ComponentConfigInternal<RenderPropsOrParams, FieldProps, DataShape>;
|
|
@@ -269,6 +272,16 @@ type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends
|
|
|
269
272
|
type: string;
|
|
270
273
|
} ? UserField : Field;
|
|
271
274
|
} : never;
|
|
275
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
276
|
+
components?: Components;
|
|
277
|
+
root?: RootProps;
|
|
278
|
+
categories?: CategoryNames;
|
|
279
|
+
fields?: AssertHasValue<UserFields>;
|
|
280
|
+
};
|
|
281
|
+
type ComponentConfigParams<Props extends DefaultComponentProps = DefaultComponentProps, UserFields extends FieldsExtension = never> = {
|
|
282
|
+
props: Props;
|
|
283
|
+
fields?: AssertHasValue<UserFields>;
|
|
284
|
+
};
|
|
272
285
|
|
|
273
286
|
type BaseData<Props extends {
|
|
274
287
|
[key: string]: any;
|
|
@@ -309,10 +322,17 @@ type Data<Components extends DefaultComponents = DefaultComponents, RootProps ex
|
|
|
309
322
|
type Metadata = {
|
|
310
323
|
[key: string]: any;
|
|
311
324
|
};
|
|
325
|
+
interface PuckMetadata extends Metadata {
|
|
326
|
+
}
|
|
327
|
+
interface ComponentMetadata extends PuckMetadata {
|
|
328
|
+
}
|
|
329
|
+
interface FieldMetadata extends Metadata {
|
|
330
|
+
}
|
|
312
331
|
|
|
313
332
|
type ItemWithId = {
|
|
314
333
|
_arrayId: string;
|
|
315
334
|
_originalIndex: number;
|
|
335
|
+
_currentIndex: number;
|
|
316
336
|
};
|
|
317
337
|
type ArrayState = {
|
|
318
338
|
items: ItemWithId[];
|
|
@@ -323,6 +343,7 @@ type UiState = {
|
|
|
323
343
|
rightSideBarVisible: boolean;
|
|
324
344
|
leftSideBarWidth?: number | null;
|
|
325
345
|
rightSideBarWidth?: number | null;
|
|
346
|
+
mobilePanelExpanded?: boolean;
|
|
326
347
|
itemSelector: ItemSelector | null;
|
|
327
348
|
arrayState: Record<string, ArrayState | undefined>;
|
|
328
349
|
previewMode: "interactive" | "edit";
|
|
@@ -335,7 +356,7 @@ type UiState = {
|
|
|
335
356
|
isDragging: boolean;
|
|
336
357
|
viewports: {
|
|
337
358
|
current: {
|
|
338
|
-
width: number;
|
|
359
|
+
width: number | "100%";
|
|
339
360
|
height: number | "auto";
|
|
340
361
|
};
|
|
341
362
|
controlsVisible: boolean;
|
|
@@ -344,6 +365,9 @@ type UiState = {
|
|
|
344
365
|
field: {
|
|
345
366
|
focus?: string | null;
|
|
346
367
|
};
|
|
368
|
+
plugin: {
|
|
369
|
+
current: string | null;
|
|
370
|
+
};
|
|
347
371
|
};
|
|
348
372
|
type AppState<UserData extends Data = Data> = {
|
|
349
373
|
data: UserData;
|
|
@@ -377,26 +401,24 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
|
377
401
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
|
378
402
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
|
379
403
|
} : T;
|
|
380
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
381
|
-
components?: Components;
|
|
382
|
-
root?: RootProps;
|
|
383
|
-
categories?: CategoryNames;
|
|
384
|
-
fields?: AssertHasValue<UserFields>;
|
|
385
|
-
};
|
|
386
404
|
type FieldsExtension = {
|
|
387
405
|
[Type in string]: {
|
|
388
406
|
type: Type;
|
|
389
407
|
};
|
|
390
408
|
};
|
|
391
|
-
type ComponentConfigParams<Props extends DefaultComponentProps = DefaultComponentProps, UserFields extends FieldsExtension = never> = {
|
|
392
|
-
props: Props;
|
|
393
|
-
fields?: AssertHasValue<UserFields>;
|
|
394
|
-
};
|
|
395
409
|
type Exact<T, Target> = Record<Exclude<keyof T, keyof Target>, never>;
|
|
396
410
|
type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<Union, Right> : Left) | (Right & Exact<Union, Right>);
|
|
397
411
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
398
412
|
never
|
|
399
413
|
] ? False : True;
|
|
414
|
+
type RenderFunc<Props extends {
|
|
415
|
+
[key: string]: any;
|
|
416
|
+
} = {
|
|
417
|
+
children: ReactNode;
|
|
418
|
+
}> = (props: Props) => ReactElement;
|
|
419
|
+
type PluginInternal = Plugin & {
|
|
420
|
+
mobileOnly?: boolean;
|
|
421
|
+
};
|
|
400
422
|
|
|
401
423
|
type MapFnParams<ThisField = Field> = {
|
|
402
424
|
value: any;
|
|
@@ -420,11 +442,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
420
442
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
421
443
|
}>;
|
|
422
444
|
|
|
423
|
-
type RenderFunc<Props extends {
|
|
424
|
-
[key: string]: any;
|
|
425
|
-
} = {
|
|
426
|
-
children: ReactNode;
|
|
427
|
-
}> = (props: Props) => ReactElement;
|
|
428
445
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
429
446
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
430
447
|
type OverridesGeneric<Shape extends {
|
|
@@ -496,7 +513,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
496
513
|
|
|
497
514
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
498
515
|
type Viewport = {
|
|
499
|
-
width: number;
|
|
516
|
+
width: number | "100%";
|
|
500
517
|
height?: number | "auto";
|
|
501
518
|
label?: string;
|
|
502
519
|
icon?: iconTypes | ReactNode;
|
|
@@ -516,8 +533,13 @@ type IframeConfig = {
|
|
|
516
533
|
};
|
|
517
534
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
518
535
|
type Plugin<UserConfig extends Config = Config> = {
|
|
536
|
+
name?: string;
|
|
537
|
+
label?: string;
|
|
538
|
+
icon?: ReactNode;
|
|
539
|
+
render?: () => ReactElement;
|
|
519
540
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
520
541
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
542
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
521
543
|
};
|
|
522
544
|
type History<D = any> = {
|
|
523
545
|
state: D;
|
|
@@ -635,4 +657,4 @@ type WalkTreeOptions = {
|
|
|
635
657
|
};
|
|
636
658
|
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;
|
|
637
659
|
|
|
638
|
-
export { type
|
|
660
|
+
export { type RootData as $, type AppState as A, type FieldRenderFunctions as B, type Config as C, type Data as D, type ItemWithId as E, type Fields as F, type ArrayState as G, type History as H, type IframeConfig as I, type SlotComponent as J, type PuckComponent as K, type ComponentConfigExtensions as L, type Metadata as M, type RootConfig as N, type Overrides as O, type Permissions as P, type DefaultComponents as Q, type RootDataWithProps as R, type Slot as S, type ExtractConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ConfigParams as X, type ComponentConfigParams as Y, type BaseData as Z, type RootDataWithoutProps as _, type ComponentData as a, type ComponentDataOptionalId as a0, type MappedItem as a1, type ComponentDataMap as a2, type Content as a3, type PuckMetadata as a4, type ComponentMetadata as a5, type FieldMetadata as a6, type BaseField as a7, type TextField as a8, type NumberField as a9, type TextareaField as aa, type SelectField as ab, type RadioField as ac, type ArrayField as ad, type ObjectField as ae, type Adaptor as af, type ExternalFieldWithAdaptor as ag, type CacheOpts as ah, type ExternalField as ai, type CustomFieldRender as aj, type CustomField as ak, type SlotField as al, type PuckContext as am, type DefaultRootFieldProps as an, type DefaultRootRenderProps as ao, type DefaultRootProps as ap, type DefaultComponentProps as aq, type WithId as ar, type WithPuckProps as as, type AsFieldProps as at, type WithChildren as au, type ExtractField as av, 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 OnAction as h, type PrivateAppState as i, type Field as j, type FieldProps as k, type DropZoneProps as l, migrate as m, type InitialHistory as n, type ItemSelector as o, type PluginInternal as p, type Direction as q, resolveAllData as r, type DragAxis as s, transformProps as t, type Viewport as u, type FieldTransformFnParams as v, walkTree as w, type FieldTransformFn as x, overrideKeys as y, type OverrideKey as z };
|