@measured/puck 0.20.0-canary.68dd73b8 → 0.20.0-canary.6aefde61

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.
@@ -0,0 +1,62 @@
1
+ import {
2
+ Action,
3
+ ActionBar,
4
+ AutoField,
5
+ Button,
6
+ Drawer,
7
+ DropZone,
8
+ FieldLabel,
9
+ Group,
10
+ IconButton,
11
+ Label,
12
+ Puck,
13
+ Render,
14
+ blocksPlugin,
15
+ createUsePuck,
16
+ fieldsPlugin,
17
+ outlinePlugin,
18
+ overrideKeys,
19
+ registerOverlayPortal,
20
+ renderContext,
21
+ setDeep,
22
+ useGetPuck,
23
+ usePuck
24
+ } from "./chunk-5X2PB4G7.mjs";
25
+ import {
26
+ init_react_import,
27
+ migrate,
28
+ resolveAllData,
29
+ transformProps,
30
+ walkTree
31
+ } from "./chunk-BNXRZWNI.mjs";
32
+
33
+ // bundle/no-external.ts
34
+ init_react_import();
35
+ export {
36
+ Action,
37
+ ActionBar,
38
+ AutoField,
39
+ Button,
40
+ Drawer,
41
+ DropZone,
42
+ FieldLabel,
43
+ Group,
44
+ IconButton,
45
+ Label,
46
+ Puck,
47
+ Render,
48
+ blocksPlugin,
49
+ createUsePuck,
50
+ fieldsPlugin,
51
+ migrate,
52
+ outlinePlugin,
53
+ overrideKeys,
54
+ registerOverlayPortal,
55
+ renderContext,
56
+ resolveAllData,
57
+ setDeep,
58
+ transformProps,
59
+ useGetPuck,
60
+ usePuck,
61
+ walkTree
62
+ };
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-BOSl1o0G.mjs';
3
- export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-BOSl1o0G.mjs';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CU8Fq-KC.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CU8Fq-KC.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 { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-BOSl1o0G.js';
3
- export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-BOSl1o0G.js';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CU8Fq-KC.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CU8Fq-KC.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
@@ -22,6 +22,18 @@ var __spreadValues = (a, b) => {
22
22
  return a;
23
23
  };
24
24
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
25
37
  var __export = (target, all) => {
26
38
  for (var name in all)
27
39
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -64,7 +76,7 @@ var __async = (__this, __arguments, generator) => {
64
76
  });
65
77
  };
66
78
 
67
- // rsc.tsx
79
+ // bundle/rsc.tsx
68
80
  var rsc_exports = {};
69
81
  __export(rsc_exports, {
70
82
  Render: () => Render,
@@ -95,7 +107,7 @@ var setupZone = (data, zoneKey) => {
95
107
  return newData;
96
108
  };
97
109
 
98
- // lib/use-slots.tsx
110
+ // lib/field-transforms/use-field-transforms.tsx
99
111
  var import_react2 = require("react");
100
112
 
101
113
  // lib/data/default-slots.ts
@@ -104,14 +116,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
104
116
  value
105
117
  );
106
118
 
107
- // lib/data/map-slots.ts
119
+ // lib/data/map-fields.ts
108
120
  var isPromise = (v) => !!v && typeof v.then === "function";
109
121
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
110
122
  var containsPromise = (arr) => arr.some(isPromise);
111
123
  var walkField = ({
112
124
  value,
113
125
  fields,
114
- map,
126
+ mappers,
115
127
  propKey = "",
116
128
  propPath = "",
117
129
  id = "",
@@ -119,7 +131,9 @@ var walkField = ({
119
131
  recurseSlots = false
120
132
  }) => {
121
133
  var _a, _b, _c;
122
- if (((_a = fields[propKey]) == null ? void 0 : _a.type) === "slot") {
134
+ const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
135
+ const map = mappers[fieldType];
136
+ if (map && fieldType === "slot") {
123
137
  const content = value || [];
124
138
  const mappedContent = recurseSlots ? content.map((el) => {
125
139
  var _a2;
@@ -131,7 +145,7 @@ var walkField = ({
131
145
  return walkField({
132
146
  value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
133
147
  fields: fields2,
134
- map,
148
+ mappers,
135
149
  id: el.props.id,
136
150
  config,
137
151
  recurseSlots
@@ -140,7 +154,21 @@ var walkField = ({
140
154
  if (containsPromise(mappedContent)) {
141
155
  return Promise.all(mappedContent);
142
156
  }
143
- return map(mappedContent, id, propPath, fields[propKey], propPath);
157
+ return map({
158
+ value: mappedContent,
159
+ parentId: id,
160
+ propName: propKey,
161
+ field: fields[propKey],
162
+ propPath
163
+ });
164
+ } else if (map && fields[propKey]) {
165
+ return map({
166
+ value,
167
+ parentId: id,
168
+ propName: propKey,
169
+ field: fields[propKey],
170
+ propPath
171
+ });
144
172
  }
145
173
  if (value && typeof value === "object") {
146
174
  if (Array.isArray(value)) {
@@ -150,7 +178,7 @@ var walkField = ({
150
178
  (el, idx) => walkField({
151
179
  value: el,
152
180
  fields: arrayFields,
153
- map,
181
+ mappers,
154
182
  propKey,
155
183
  propPath: `${propPath}[${idx}]`,
156
184
  id,
@@ -169,7 +197,7 @@ var walkField = ({
169
197
  return walkObject({
170
198
  value,
171
199
  fields: objectFields,
172
- map,
200
+ mappers,
173
201
  id,
174
202
  getPropPath: (k) => `${propPath}.${k}`,
175
203
  config,
@@ -182,7 +210,7 @@ var walkField = ({
182
210
  var walkObject = ({
183
211
  value,
184
212
  fields,
185
- map,
213
+ mappers,
186
214
  id,
187
215
  getPropPath,
188
216
  config,
@@ -192,7 +220,7 @@ var walkObject = ({
192
220
  const opts = {
193
221
  value: v,
194
222
  fields,
195
- map,
223
+ mappers,
196
224
  propKey: k,
197
225
  propPath: getPropPath(k),
198
226
  id,
@@ -214,14 +242,14 @@ var walkObject = ({
214
242
  }
215
243
  return flatten(newProps);
216
244
  };
217
- function mapSlots(item, map, config, recurseSlots = false) {
245
+ function mapFields(item, mappers, config, recurseSlots = false) {
218
246
  var _a, _b, _c, _d, _e;
219
247
  const itemType = "type" in item ? item.type : "root";
220
248
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
221
249
  const newProps = walkObject({
222
250
  value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
223
251
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
224
- map,
252
+ mappers,
225
253
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
226
254
  getPropPath: (k) => k,
227
255
  config,
@@ -237,35 +265,66 @@ function mapSlots(item, map, config, recurseSlots = false) {
237
265
  });
238
266
  }
239
267
 
240
- // lib/use-slots.tsx
241
- function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
242
- const slotProps = (0, import_react2.useMemo)(() => {
243
- const mapped = mapSlots(
244
- item,
245
- (content, _parentId, propName, field, propPath) => {
246
- const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
247
- const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
248
- const render = isReadOnly ? renderSlotRender : renderSlotEdit;
249
- const Slot = (dzProps) => render(__spreadProps(__spreadValues({
250
- allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
251
- disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
252
- }, dzProps), {
253
- zone: propName,
254
- content
255
- }));
256
- return Slot;
257
- },
258
- config
259
- ).props;
268
+ // lib/field-transforms/use-field-transforms.tsx
269
+ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
270
+ const mappers = (0, import_react2.useMemo)(() => {
271
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
272
+ const fieldType = _fieldType;
273
+ return __spreadProps(__spreadValues({}, acc), {
274
+ [fieldType]: (_a) => {
275
+ var _b = _a, {
276
+ parentId
277
+ } = _b, params = __objRest(_b, [
278
+ "parentId"
279
+ ]);
280
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
281
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
282
+ const fn = transforms[fieldType];
283
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
284
+ isReadOnly,
285
+ componentId: parentId
286
+ }));
287
+ }
288
+ });
289
+ }, {});
290
+ }, [transforms, readOnly, forceReadOnly]);
291
+ const transformedProps = (0, import_react2.useMemo)(() => {
292
+ const mapped = mapFields(item, mappers, config).props;
260
293
  return mapped;
261
- }, [config, item, readOnly, forceReadOnly]);
294
+ }, [config, item, mappers]);
262
295
  const mergedProps = (0, import_react2.useMemo)(
263
- () => __spreadValues(__spreadValues({}, item.props), slotProps),
264
- [item.props, slotProps]
296
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
297
+ [item.props, transformedProps]
265
298
  );
266
299
  return mergedProps;
267
300
  }
268
301
 
302
+ // lib/field-transforms/default-transforms/slot-transform.tsx
303
+ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
304
+ slot: ({ value: content, propName, field, isReadOnly }) => {
305
+ const render = isReadOnly ? renderSlotRender : renderSlotEdit;
306
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
307
+ allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
308
+ disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
309
+ }, dzProps), {
310
+ zone: propName,
311
+ content
312
+ }));
313
+ return Slot;
314
+ }
315
+ });
316
+
317
+ // lib/use-slots.tsx
318
+ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
319
+ return useFieldTransforms(
320
+ config,
321
+ item,
322
+ getSlotTransform(renderSlotEdit, renderSlotRender),
323
+ readOnly,
324
+ forceReadOnly
325
+ );
326
+ }
327
+
269
328
  // components/SlotRender/server.tsx
270
329
  var import_react3 = require("react");
271
330
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -441,24 +500,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
441
500
  resolvedItem.readOnly = readOnly;
442
501
  }
443
502
  }
444
- let itemWithResolvedChildren = yield mapSlots(
503
+ let itemWithResolvedChildren = yield mapFields(
445
504
  resolvedItem,
446
- (content) => __async(void 0, null, function* () {
447
- return yield Promise.all(
448
- content.map(
449
- (childItem) => __async(void 0, null, function* () {
450
- return (yield resolveComponentData(
451
- childItem,
452
- config,
453
- metadata,
454
- onResolveStart,
455
- onResolveEnd,
456
- trigger
457
- )).node;
458
- })
459
- )
460
- );
461
- }),
505
+ {
506
+ slot: (_02) => __async(void 0, [_02], function* ({ value }) {
507
+ const content = value;
508
+ return yield Promise.all(
509
+ content.map(
510
+ (childItem) => __async(void 0, null, function* () {
511
+ return (yield resolveComponentData(
512
+ childItem,
513
+ config,
514
+ metadata,
515
+ onResolveStart,
516
+ onResolveEnd,
517
+ trigger
518
+ )).node;
519
+ })
520
+ )
521
+ );
522
+ })
523
+ },
462
524
  config
463
525
  );
464
526
  if (shouldRunResolver && onResolveEnd) {
@@ -506,9 +568,9 @@ function resolveAllData(_0, _1) {
506
568
  },
507
569
  "force"
508
570
  )).node;
509
- const resolvedDeep = yield mapSlots(
571
+ const resolvedDeep = yield mapFields(
510
572
  resolved,
511
- processContent,
573
+ { slot: ({ value }) => processContent(value) },
512
574
  config
513
575
  );
514
576
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
@@ -542,11 +604,14 @@ function resolveAllData(_0, _1) {
542
604
  function walkTree(data, config, callbackFn) {
543
605
  var _a, _b;
544
606
  const walkItem = (item) => {
545
- return mapSlots(
607
+ return mapFields(
546
608
  item,
547
- (content, parentId, propName) => {
548
- var _a2;
549
- return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
609
+ {
610
+ slot: ({ value, parentId, propName }) => {
611
+ var _a2;
612
+ const content = value;
613
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
614
+ }
550
615
  },
551
616
  config,
552
617
  true
@@ -629,7 +694,8 @@ var defaultAppState = {
629
694
  options: [],
630
695
  controlsVisible: true
631
696
  },
632
- field: { focus: null }
697
+ field: { focus: null },
698
+ plugin: { current: null }
633
699
  },
634
700
  indexes: {
635
701
  nodes: {},
@@ -663,7 +729,7 @@ var import_flat = __toESM(require("flat"));
663
729
 
664
730
  // lib/data/strip-slots.ts
665
731
  var stripSlots = (data, config) => {
666
- return mapSlots(data, () => null, config);
732
+ return mapFields(data, { slot: () => null }, config);
667
733
  };
668
734
 
669
735
  // lib/data/flatten-node.ts
@@ -716,18 +782,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
716
782
  const mappedItem = mapNodeOrSkip(item, path, index);
717
783
  if (!mappedItem) return item;
718
784
  const id = mappedItem.props.id;
719
- const newProps = __spreadProps(__spreadValues({}, mapSlots(
785
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
720
786
  mappedItem,
721
- (content, parentId2, slotId) => {
722
- const zoneCompound = `${parentId2}:${slotId}`;
723
- const [_2, newContent2] = processContent(
724
- path,
725
- zoneCompound,
726
- content,
727
- "slot",
728
- parentId2
729
- );
730
- return newContent2;
787
+ {
788
+ slot: ({ value, parentId: parentId2, propPath }) => {
789
+ const content = value;
790
+ const zoneCompound = `${parentId2}:${propPath}`;
791
+ const [_2, newContent2] = processContent(
792
+ path,
793
+ zoneCompound,
794
+ content,
795
+ "slot",
796
+ parentId2
797
+ );
798
+ return newContent2;
799
+ }
731
800
  },
732
801
  config
733
802
  ).props), {
package/dist/rsc.mjs CHANGED
@@ -1,10 +1,14 @@
1
1
  import {
2
2
  Render,
3
+ init_react_import,
3
4
  migrate,
4
5
  resolveAllData,
5
6
  transformProps,
6
7
  walkTree
7
- } from "./chunk-H6KSTNLT.mjs";
8
+ } from "./chunk-BNXRZWNI.mjs";
9
+
10
+ // bundle/rsc.tsx
11
+ init_react_import();
8
12
  export {
9
13
  Render,
10
14
  migrate,
@@ -17,7 +17,7 @@ type DropZoneProps = {
17
17
 
18
18
  type FieldOption = {
19
19
  label: string;
20
- value: string | number | boolean;
20
+ value: string | number | boolean | undefined | null | object;
21
21
  };
22
22
  type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
23
23
  type BaseField = {
@@ -29,6 +29,7 @@ type BaseField = {
29
29
  type TextField = BaseField & {
30
30
  type: "text";
31
31
  placeholder?: string;
32
+ contentEditable?: boolean;
32
33
  };
33
34
  type NumberField = BaseField & {
34
35
  type: "number";
@@ -40,6 +41,7 @@ type NumberField = BaseField & {
40
41
  type TextareaField = BaseField & {
41
42
  type: "textarea";
42
43
  placeholder?: string;
44
+ contentEditable?: boolean;
43
45
  };
44
46
  type SelectField = BaseField & {
45
47
  type: "select";
@@ -117,6 +119,7 @@ type CustomFieldRender<Value extends any> = (props: {
117
119
  type CustomField<Value extends any> = BaseField & {
118
120
  type: "custom";
119
121
  render: CustomFieldRender<Value>;
122
+ contentEditable?: boolean;
120
123
  };
121
124
  type SlotField = BaseField & {
122
125
  type: "slot";
@@ -209,14 +212,18 @@ type WithChildren<Props> = Props & {
209
212
  };
210
213
  type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
211
214
  type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
212
- type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
215
+ type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserPublicAppState extends AppState<UserData> = AppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
213
216
  UserConfig: UserConfig;
214
217
  UserProps: UserProps;
215
218
  UserRootProps: UserRootProps;
216
219
  UserData: UserData;
217
220
  UserAppState: UserAppState;
221
+ UserPublicAppState: UserPublicAppState;
218
222
  UserComponentData: UserComponentData;
219
223
  };
224
+ type ExtractField<T extends Field["type"]> = Extract<Field, {
225
+ type: T;
226
+ }>;
220
227
 
221
228
  type PuckContext = {
222
229
  renderDropZone: React.FC<DropZoneProps>;
@@ -277,6 +284,7 @@ type Metadata = {
277
284
  type ItemWithId = {
278
285
  _arrayId: string;
279
286
  _originalIndex: number;
287
+ _currentIndex: number;
280
288
  };
281
289
  type ArrayState = {
282
290
  items: ItemWithId[];
@@ -285,6 +293,8 @@ type ArrayState = {
285
293
  type UiState = {
286
294
  leftSideBarVisible: boolean;
287
295
  rightSideBarVisible: boolean;
296
+ leftSideBarWidth?: number | null;
297
+ rightSideBarWidth?: number | null;
288
298
  itemSelector: ItemSelector | null;
289
299
  arrayState: Record<string, ArrayState | undefined>;
290
300
  previewMode: "interactive" | "edit";
@@ -306,6 +316,9 @@ type UiState = {
306
316
  field: {
307
317
  focus?: string | null;
308
318
  };
319
+ plugin: {
320
+ current: string | null;
321
+ };
309
322
  };
310
323
  type AppState<UserData extends Data = Data> = {
311
324
  data: UserData;
@@ -340,13 +353,33 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
340
353
  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 ? {
341
354
  [K in keyof T]: WithDeepSlots<T[K], SlotType>;
342
355
  } : T;
343
-
344
356
  type RenderFunc<Props extends {
345
357
  [key: string]: any;
346
358
  } = {
347
359
  children: ReactNode;
348
360
  }> = (props: Props) => ReactElement;
349
- declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
361
+ type PluginInternal = Plugin & {
362
+ mobileOnly?: boolean;
363
+ };
364
+
365
+ type MapFnParams<ThisField = Field> = {
366
+ value: any;
367
+ parentId: string;
368
+ propName: string;
369
+ field: ThisField;
370
+ propPath: string;
371
+ };
372
+
373
+ type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
374
+ isReadOnly: boolean;
375
+ componentId: string;
376
+ };
377
+ type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
378
+ type FieldTransforms = Partial<{
379
+ [FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
380
+ }>;
381
+
382
+ declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
350
383
  type OverrideKey = (typeof overrideKeys)[number];
351
384
  type OverridesGeneric<Shape extends {
352
385
  [key in OverrideKey]: any;
@@ -384,11 +417,23 @@ type Overrides = OverridesGeneric<{
384
417
  children: ReactNode;
385
418
  name: string;
386
419
  }>;
420
+ drawer: RenderFunc;
421
+ drawerItem: RenderFunc<{
422
+ children: ReactNode;
423
+ name: string;
424
+ }>;
387
425
  iframe: RenderFunc<{
388
426
  children: ReactNode;
389
427
  document?: Document;
390
428
  }>;
391
429
  outline: RenderFunc;
430
+ componentOverlay: RenderFunc<{
431
+ children: ReactNode;
432
+ hover: boolean;
433
+ isSelected: boolean;
434
+ componentId: string;
435
+ componentType: string;
436
+ }>;
392
437
  puck: RenderFunc;
393
438
  }>;
394
439
  type FieldRenderFunctions = Omit<{
@@ -430,7 +475,12 @@ type IframeConfig = {
430
475
  };
431
476
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
432
477
  type Plugin = {
433
- overrides: Partial<Overrides>;
478
+ name?: string;
479
+ label?: string;
480
+ icon?: ReactNode;
481
+ render?: () => ReactElement;
482
+ overrides?: Partial<Overrides>;
483
+ fieldTransforms?: FieldTransforms;
434
484
  };
435
485
  type History<D = any> = {
436
486
  state: D;
@@ -548,4 +598,4 @@ type WalkTreeOptions = {
548
598
  };
549
599
  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;
550
600
 
551
- export { type ExternalFieldWithAdaptor as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type MappedItem as E, type Fields as F, type ComponentDataMap as G, type History as H, type IframeConfig as I, type Content as J, type BaseField as K, type TextareaField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type SelectField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type RadioField as X, type ArrayField as Y, type ObjectField as Z, type Adaptor as _, type Config as a, type ExternalField as a0, type CustomFieldRender as a1, type CustomField as a2, type SlotField as a3, type PuckContext as a4, type DefaultRootFieldProps as a5, type DefaultRootRenderProps as a6, type DefaultRootProps as a7, type DefaultComponentProps as a8, type WithId as a9, type WithPuckProps as aa, type AsFieldProps as ab, type WithChildren as ac, type ExtractPropsFromConfig as ad, type ExtractRootPropsFromConfig as ae, migrate as af, transformProps as ag, resolveAllData as ah, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type ItemSelector as l, type Direction as m, type DragAxis as n, type Viewport as o, overrideKeys as p, type OverrideKey as q, type FieldRenderFunctions as r, type ItemWithId as s, type ArrayState as t, type PuckComponent as u, type RootConfig as v, walkTree as w, type RootDataWithoutProps as x, type RootData as y, type ComponentDataOptionalId as z };
601
+ export { type TextField as $, type AppState as A, type ItemWithId as B, type Config as C, type DropZoneProps as D, type ArrayState as E, type Fields as F, type SlotComponent as G, type History as H, type IframeConfig as I, type PuckComponent as J, type RootConfig as K, type BaseData as L, type Metadata as M, type RootDataWithoutProps as N, type Overrides as O, type Permissions as P, type RootData as Q, type RootDataWithProps as R, type Slot as S, type ComponentDataOptionalId as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type MappedItem as X, type ComponentDataMap as Y, type Content as Z, type BaseField as _, type ComponentData as a, type NumberField as a0, type TextareaField as a1, type SelectField as a2, type RadioField as a3, type ArrayField as a4, type ObjectField as a5, type Adaptor as a6, type ExternalFieldWithAdaptor as a7, type ExternalField as a8, type CustomFieldRender as a9, type CustomField as aa, type SlotField as ab, type PuckContext as ac, type DefaultRootFieldProps as ad, type DefaultRootRenderProps as ae, type DefaultRootProps as af, type DefaultComponentProps as ag, type WithId as ah, type WithPuckProps as ai, type AsFieldProps as aj, type WithChildren as ak, type ExtractPropsFromConfig as al, type ExtractRootPropsFromConfig 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 PluginInternal as o, type Direction as p, type DragAxis as q, resolveAllData as r, type Viewport as s, transformProps as t, type FieldTransformFnParams as u, type FieldTransformFn as v, walkTree as w, overrideKeys as x, type OverrideKey as y, type FieldRenderFunctions as z };