@measured/puck 0.20.0-canary.6760121f → 0.20.0-canary.6a211610

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.
@@ -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";
@@ -218,6 +221,9 @@ type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractP
218
221
  UserPublicAppState: UserPublicAppState;
219
222
  UserComponentData: UserComponentData;
220
223
  };
224
+ type ExtractField<T extends Field["type"]> = Extract<Field, {
225
+ type: T;
226
+ }>;
221
227
 
222
228
  type PuckContext = {
223
229
  renderDropZone: React.FC<DropZoneProps>;
@@ -286,6 +292,8 @@ type ArrayState = {
286
292
  type UiState = {
287
293
  leftSideBarVisible: boolean;
288
294
  rightSideBarVisible: boolean;
295
+ leftSideBarWidth?: number | null;
296
+ rightSideBarWidth?: number | null;
289
297
  itemSelector: ItemSelector | null;
290
298
  arrayState: Record<string, ArrayState | undefined>;
291
299
  previewMode: "interactive" | "edit";
@@ -342,12 +350,29 @@ type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (inf
342
350
  [K in keyof T]: WithDeepSlots<T[K], SlotType>;
343
351
  } : T;
344
352
 
353
+ type MapFnParams<ThisField = Field> = {
354
+ value: any;
355
+ parentId: string;
356
+ propName: string;
357
+ field: ThisField;
358
+ propPath: string;
359
+ };
360
+
361
+ type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
362
+ isReadOnly: boolean;
363
+ componentId: string;
364
+ };
365
+ type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
366
+ type FieldTransforms = Partial<{
367
+ [FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
368
+ }>;
369
+
345
370
  type RenderFunc<Props extends {
346
371
  [key: string]: any;
347
372
  } = {
348
373
  children: ReactNode;
349
374
  }> = (props: Props) => ReactElement;
350
- declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
375
+ declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
351
376
  type OverrideKey = (typeof overrideKeys)[number];
352
377
  type OverridesGeneric<Shape extends {
353
378
  [key in OverrideKey]: any;
@@ -385,11 +410,23 @@ type Overrides = OverridesGeneric<{
385
410
  children: ReactNode;
386
411
  name: string;
387
412
  }>;
413
+ drawer: RenderFunc;
414
+ drawerItem: RenderFunc<{
415
+ children: ReactNode;
416
+ name: string;
417
+ }>;
388
418
  iframe: RenderFunc<{
389
419
  children: ReactNode;
390
420
  document?: Document;
391
421
  }>;
392
422
  outline: RenderFunc;
423
+ componentOverlay: RenderFunc<{
424
+ children: ReactNode;
425
+ hover: boolean;
426
+ isSelected: boolean;
427
+ componentId: string;
428
+ componentType: string;
429
+ }>;
393
430
  puck: RenderFunc;
394
431
  }>;
395
432
  type FieldRenderFunctions = Omit<{
@@ -431,7 +468,8 @@ type IframeConfig = {
431
468
  };
432
469
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
433
470
  type Plugin = {
434
- overrides: Partial<Overrides>;
471
+ overrides?: Partial<Overrides>;
472
+ fieldTransforms?: FieldTransforms;
435
473
  };
436
474
  type History<D = any> = {
437
475
  state: D;
@@ -549,4 +587,4 @@ type WalkTreeOptions = {
549
587
  };
550
588
  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;
551
589
 
552
- export { type Adaptor as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataOptionalId as E, type Fields as F, type MappedItem as G, type History as H, type IframeConfig as I, type ComponentDataMap as J, type Content as K, type BaseField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type TextareaField 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 SelectField as X, type RadioField as Y, type ArrayField as Z, type ObjectField as _, type Config as a, type ExternalFieldWithAdaptor as a0, type ExternalField as a1, type CustomFieldRender as a2, type CustomField as a3, type SlotField as a4, type PuckContext as a5, type DefaultRootFieldProps as a6, type DefaultRootRenderProps as a7, type DefaultRootProps as a8, type DefaultComponentProps as a9, type WithId as aa, type WithPuckProps as ab, type AsFieldProps as ac, type WithChildren as ad, type ExtractPropsFromConfig as ae, type ExtractRootPropsFromConfig as af, migrate as ag, transformProps as ah, resolveAllData as ai, 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 SlotComponent as u, type PuckComponent as v, walkTree as w, type RootConfig as x, type RootDataWithoutProps as y, type RootData as z };
590
+ export { type NumberField 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 BaseData as K, type RootDataWithoutProps as L, type Metadata as M, type RootData as N, type Overrides as O, type Permissions as P, type ComponentDataOptionalId as Q, type RootDataWithProps as R, type Slot as S, type MappedItem as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataMap as X, type Content as Y, type BaseField as Z, type TextField as _, type ComponentData as a, type TextareaField as a0, type SelectField as a1, type RadioField as a2, type ArrayField as a3, type ObjectField as a4, type Adaptor as a5, type ExternalFieldWithAdaptor as a6, type ExternalField as a7, type CustomFieldRender as a8, type CustomField as a9, type SlotField as aa, type PuckContext as ab, type DefaultRootFieldProps as ac, type DefaultRootRenderProps as ad, type DefaultRootProps as ae, type DefaultComponentProps as af, type WithId as ag, type WithPuckProps as ah, type AsFieldProps as ai, type WithChildren as aj, type ExtractPropsFromConfig as ak, type ExtractRootPropsFromConfig as al, type ExtractField as am, 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.20.0-canary.6760121f",
3
+ "version": "0.20.0-canary.6a211610",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -27,6 +27,7 @@
27
27
  "require": "./dist/rsc.js"
28
28
  },
29
29
  "./puck.css": "./dist/index.css",
30
+ "./no-external.css": "./dist/no-external.css",
30
31
  "./dist/index.css": "./dist/index.css",
31
32
  "./package.json": "./package.json"
32
33
  },
@@ -40,7 +41,7 @@
40
41
  "license": "MIT",
41
42
  "scripts": {
42
43
  "lint": "eslint \"**/*.ts*\"",
43
- "build": "rm -rf dist && tsup index.ts rsc.tsx",
44
+ "build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts",
44
45
  "test": "jest",
45
46
  "prepare": "cp ../../README.md . && yarn build",
46
47
  "postpublish": "rm README.md"