@measured/puck 0.20.0 → 0.21.0-canary.d32e582b

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.
@@ -11,21 +11,24 @@ import {
11
11
  Label,
12
12
  Puck,
13
13
  Render,
14
+ blocksPlugin,
14
15
  createUsePuck,
16
+ fieldsPlugin,
17
+ outlinePlugin,
15
18
  overrideKeys,
16
19
  registerOverlayPortal,
17
20
  renderContext,
18
21
  setDeep,
19
22
  useGetPuck,
20
23
  usePuck
21
- } from "./chunk-DCZ7BU3G.mjs";
24
+ } from "./chunk-VVS2EUKT.mjs";
22
25
  import {
23
26
  init_react_import,
24
27
  migrate,
25
28
  resolveAllData,
26
29
  transformProps,
27
30
  walkTree
28
- } from "./chunk-NFK5JVZW.mjs";
31
+ } from "./chunk-XYKLHT4R.mjs";
29
32
 
30
33
  // bundle/no-external.ts
31
34
  init_react_import();
@@ -42,8 +45,11 @@ export {
42
45
  Label,
43
46
  Puck,
44
47
  Render,
48
+ blocksPlugin,
45
49
  createUsePuck,
50
+ fieldsPlugin,
46
51
  migrate,
52
+ outlinePlugin,
47
53
  overrideKeys,
48
54
  registerOverlayPortal,
49
55
  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-CiAkCQEp.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CiAkCQEp.mjs';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-DiatHoF-.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DiatHoF-.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-CiAkCQEp.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CiAkCQEp.js';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-DiatHoF-.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DiatHoF-.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
@@ -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
@@ -12,7 +12,7 @@ import {
12
12
  transformProps,
13
13
  useSlots,
14
14
  walkTree
15
- } from "./chunk-NFK5JVZW.mjs";
15
+ } from "./chunk-XYKLHT4R.mjs";
16
16
 
17
17
  // bundle/rsc.tsx
18
18
  init_react_import();
@@ -308,6 +308,7 @@ type Metadata = {
308
308
  type ItemWithId = {
309
309
  _arrayId: string;
310
310
  _originalIndex: number;
311
+ _currentIndex: number;
311
312
  };
312
313
  type ArrayState = {
313
314
  items: ItemWithId[];
@@ -318,6 +319,7 @@ type UiState = {
318
319
  rightSideBarVisible: boolean;
319
320
  leftSideBarWidth?: number | null;
320
321
  rightSideBarWidth?: number | null;
322
+ mobilePanelExpanded?: boolean;
321
323
  itemSelector: ItemSelector | null;
322
324
  arrayState: Record<string, ArrayState | undefined>;
323
325
  previewMode: "interactive" | "edit";
@@ -330,7 +332,7 @@ type UiState = {
330
332
  isDragging: boolean;
331
333
  viewports: {
332
334
  current: {
333
- width: number;
335
+ width: number | "100%";
334
336
  height: number | "auto";
335
337
  };
336
338
  controlsVisible: boolean;
@@ -339,6 +341,9 @@ type UiState = {
339
341
  field: {
340
342
  focus?: string | null;
341
343
  };
344
+ plugin: {
345
+ current: string | null;
346
+ };
342
347
  };
343
348
  type AppState<UserData extends Data = Data> = {
344
349
  data: UserData;
@@ -392,6 +397,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
392
397
  type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
393
398
  never
394
399
  ] ? False : True;
400
+ type RenderFunc<Props extends {
401
+ [key: string]: any;
402
+ } = {
403
+ children: ReactNode;
404
+ }> = (props: Props) => ReactElement;
405
+ type PluginInternal = Plugin & {
406
+ mobileOnly?: boolean;
407
+ };
395
408
 
396
409
  type MapFnParams<ThisField = Field> = {
397
410
  value: any;
@@ -415,11 +428,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
415
428
  [Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
416
429
  }>;
417
430
 
418
- type RenderFunc<Props extends {
419
- [key: string]: any;
420
- } = {
421
- children: ReactNode;
422
- }> = (props: Props) => ReactElement;
423
431
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
424
432
  type OverrideKey = (typeof overrideKeys)[number];
425
433
  type OverridesGeneric<Shape extends {
@@ -491,7 +499,7 @@ type DragAxis = "dynamic" | "y" | "x";
491
499
 
492
500
  type iconTypes = "Smartphone" | "Monitor" | "Tablet";
493
501
  type Viewport = {
494
- width: number;
502
+ width: number | "100%";
495
503
  height?: number | "auto";
496
504
  label?: string;
497
505
  icon?: iconTypes | ReactNode;
@@ -511,8 +519,13 @@ type IframeConfig = {
511
519
  };
512
520
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
513
521
  type Plugin<UserConfig extends Config = Config> = {
522
+ name?: string;
523
+ label?: string;
524
+ icon?: ReactNode;
525
+ render?: () => ReactElement;
514
526
  overrides?: Partial<Overrides<UserConfig>>;
515
527
  fieldTransforms?: FieldTransforms<UserConfig>;
528
+ mobilePanelHeight?: "toggle" | "min-content";
516
529
  };
517
530
  type History<D = any> = {
518
531
  state: D;
@@ -630,4 +643,4 @@ type WalkTreeOptions = {
630
643
  };
631
644
  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;
632
645
 
633
- 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 ExternalField as a9, type CustomFieldRender as aa, type CustomField as ab, type SlotField as ac, type PuckContext as ad, type DefaultRootFieldProps as ae, type DefaultRootRenderProps as af, type DefaultRootProps as ag, type DefaultComponentProps as ah, type WithId as ai, type WithPuckProps as aj, type AsFieldProps as ak, type WithChildren 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 };
646
+ export { type Content 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 DefaultComponents as L, type Metadata as M, type ExtractConfigParams as N, type Overrides as O, type Permissions as P, type BaseData as Q, type RootDataWithProps as R, type Slot as S, type RootDataWithoutProps as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type RootData as X, type ComponentDataOptionalId as Y, type MappedItem as Z, type ComponentDataMap as _, type ComponentData as a, type BaseField as a0, type TextField as a1, type NumberField as a2, type TextareaField as a3, type SelectField as a4, type RadioField as a5, type ArrayField as a6, type ObjectField as a7, type Adaptor as a8, type ExternalFieldWithAdaptor 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 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 };
@@ -308,6 +308,7 @@ type Metadata = {
308
308
  type ItemWithId = {
309
309
  _arrayId: string;
310
310
  _originalIndex: number;
311
+ _currentIndex: number;
311
312
  };
312
313
  type ArrayState = {
313
314
  items: ItemWithId[];
@@ -318,6 +319,7 @@ type UiState = {
318
319
  rightSideBarVisible: boolean;
319
320
  leftSideBarWidth?: number | null;
320
321
  rightSideBarWidth?: number | null;
322
+ mobilePanelExpanded?: boolean;
321
323
  itemSelector: ItemSelector | null;
322
324
  arrayState: Record<string, ArrayState | undefined>;
323
325
  previewMode: "interactive" | "edit";
@@ -330,7 +332,7 @@ type UiState = {
330
332
  isDragging: boolean;
331
333
  viewports: {
332
334
  current: {
333
- width: number;
335
+ width: number | "100%";
334
336
  height: number | "auto";
335
337
  };
336
338
  controlsVisible: boolean;
@@ -339,6 +341,9 @@ type UiState = {
339
341
  field: {
340
342
  focus?: string | null;
341
343
  };
344
+ plugin: {
345
+ current: string | null;
346
+ };
342
347
  };
343
348
  type AppState<UserData extends Data = Data> = {
344
349
  data: UserData;
@@ -392,6 +397,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
392
397
  type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
393
398
  never
394
399
  ] ? False : True;
400
+ type RenderFunc<Props extends {
401
+ [key: string]: any;
402
+ } = {
403
+ children: ReactNode;
404
+ }> = (props: Props) => ReactElement;
405
+ type PluginInternal = Plugin & {
406
+ mobileOnly?: boolean;
407
+ };
395
408
 
396
409
  type MapFnParams<ThisField = Field> = {
397
410
  value: any;
@@ -415,11 +428,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
415
428
  [Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
416
429
  }>;
417
430
 
418
- type RenderFunc<Props extends {
419
- [key: string]: any;
420
- } = {
421
- children: ReactNode;
422
- }> = (props: Props) => ReactElement;
423
431
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
424
432
  type OverrideKey = (typeof overrideKeys)[number];
425
433
  type OverridesGeneric<Shape extends {
@@ -491,7 +499,7 @@ type DragAxis = "dynamic" | "y" | "x";
491
499
 
492
500
  type iconTypes = "Smartphone" | "Monitor" | "Tablet";
493
501
  type Viewport = {
494
- width: number;
502
+ width: number | "100%";
495
503
  height?: number | "auto";
496
504
  label?: string;
497
505
  icon?: iconTypes | ReactNode;
@@ -511,8 +519,13 @@ type IframeConfig = {
511
519
  };
512
520
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
513
521
  type Plugin<UserConfig extends Config = Config> = {
522
+ name?: string;
523
+ label?: string;
524
+ icon?: ReactNode;
525
+ render?: () => ReactElement;
514
526
  overrides?: Partial<Overrides<UserConfig>>;
515
527
  fieldTransforms?: FieldTransforms<UserConfig>;
528
+ mobilePanelHeight?: "toggle" | "min-content";
516
529
  };
517
530
  type History<D = any> = {
518
531
  state: D;
@@ -630,4 +643,4 @@ type WalkTreeOptions = {
630
643
  };
631
644
  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;
632
645
 
633
- 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 ExternalField as a9, type CustomFieldRender as aa, type CustomField as ab, type SlotField as ac, type PuckContext as ad, type DefaultRootFieldProps as ae, type DefaultRootRenderProps as af, type DefaultRootProps as ag, type DefaultComponentProps as ah, type WithId as ai, type WithPuckProps as aj, type AsFieldProps as ak, type WithChildren 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 };
646
+ export { type Content 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 DefaultComponents as L, type Metadata as M, type ExtractConfigParams as N, type Overrides as O, type Permissions as P, type BaseData as Q, type RootDataWithProps as R, type Slot as S, type RootDataWithoutProps as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type RootData as X, type ComponentDataOptionalId as Y, type MappedItem as Z, type ComponentDataMap as _, type ComponentData as a, type BaseField as a0, type TextField as a1, type NumberField as a2, type TextareaField as a3, type SelectField as a4, type RadioField as a5, type ArrayField as a6, type ObjectField as a7, type Adaptor as a8, type ExternalFieldWithAdaptor 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 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.20.0",
3
+ "version": "0.21.0-canary.d32e582b",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",