@measured/puck 0.21.0-canary.79a26849 → 0.21.0-canary.7ed9655b

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-UABEUL66.mjs";
24
+ } from "./chunk-QOZ6ZSWO.mjs";
22
25
  import {
23
26
  init_react_import,
24
27
  migrate,
25
28
  resolveAllData,
26
29
  transformProps,
27
30
  walkTree
28
- } from "./chunk-JA7SEUEH.mjs";
31
+ } from "./chunk-IDP5ATXM.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-CgWnYC1X.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CgWnYC1X.mjs';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CI7CLsRf.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CI7CLsRf.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-CgWnYC1X.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CgWnYC1X.js';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CI7CLsRf.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CI7CLsRf.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
@@ -672,7 +672,8 @@ function transformProps(data, propTransforms, config = { components: {} }) {
672
672
  var defaultViewports = [
673
673
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
674
674
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
675
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
675
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
676
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
676
677
  ];
677
678
 
678
679
  // store/default-app-state.ts
@@ -694,7 +695,8 @@ var defaultAppState = {
694
695
  options: [],
695
696
  controlsVisible: true
696
697
  },
697
- field: { focus: null }
698
+ field: { focus: null },
699
+ plugin: { current: null }
698
700
  },
699
701
  indexes: {
700
702
  nodes: {},
package/dist/rsc.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  transformProps,
13
13
  useSlots,
14
14
  walkTree
15
- } from "./chunk-JA7SEUEH.mjs";
15
+ } from "./chunk-IDP5ATXM.mjs";
16
16
 
17
17
  // bundle/rsc.tsx
18
18
  init_react_import();
@@ -334,6 +334,7 @@ interface FieldMetadata extends Metadata {
334
334
  type ItemWithId = {
335
335
  _arrayId: string;
336
336
  _originalIndex: number;
337
+ _currentIndex: number;
337
338
  };
338
339
  type ArrayState = {
339
340
  items: ItemWithId[];
@@ -344,6 +345,7 @@ type UiState = {
344
345
  rightSideBarVisible: boolean;
345
346
  leftSideBarWidth?: number | null;
346
347
  rightSideBarWidth?: number | null;
348
+ mobilePanelExpanded?: boolean;
347
349
  itemSelector: ItemSelector | null;
348
350
  arrayState: Record<string, ArrayState | undefined>;
349
351
  previewMode: "interactive" | "edit";
@@ -356,7 +358,7 @@ type UiState = {
356
358
  isDragging: boolean;
357
359
  viewports: {
358
360
  current: {
359
- width: number;
361
+ width: number | "100%";
360
362
  height: number | "auto";
361
363
  };
362
364
  controlsVisible: boolean;
@@ -365,6 +367,9 @@ type UiState = {
365
367
  field: {
366
368
  focus?: string | null;
367
369
  };
370
+ plugin: {
371
+ current: string | null;
372
+ };
368
373
  };
369
374
  type AppState<UserData extends Data = Data> = {
370
375
  data: UserData;
@@ -408,6 +413,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
408
413
  type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
409
414
  never
410
415
  ] ? False : True;
416
+ type RenderFunc<Props extends {
417
+ [key: string]: any;
418
+ } = {
419
+ children: ReactNode;
420
+ }> = (props: Props) => ReactElement;
421
+ type PluginInternal = Plugin & {
422
+ mobileOnly?: boolean;
423
+ };
411
424
 
412
425
  type MapFnParams<ThisField = Field> = {
413
426
  value: any;
@@ -431,11 +444,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
431
444
  [Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
432
445
  }>;
433
446
 
434
- type RenderFunc<Props extends {
435
- [key: string]: any;
436
- } = {
437
- children: ReactNode;
438
- }> = (props: Props) => ReactElement;
439
447
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
440
448
  type OverrideKey = (typeof overrideKeys)[number];
441
449
  type OverridesGeneric<Shape extends {
@@ -507,7 +515,7 @@ type DragAxis = "dynamic" | "y" | "x";
507
515
 
508
516
  type iconTypes = "Smartphone" | "Monitor" | "Tablet";
509
517
  type Viewport = {
510
- width: number;
518
+ width: number | "100%";
511
519
  height?: number | "auto";
512
520
  label?: string;
513
521
  icon?: iconTypes | ReactNode;
@@ -527,8 +535,13 @@ type IframeConfig = {
527
535
  };
528
536
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
529
537
  type Plugin<UserConfig extends Config = Config> = {
538
+ name?: string;
539
+ label?: string;
540
+ icon?: ReactNode;
541
+ render?: () => ReactElement;
530
542
  overrides?: Partial<Overrides<UserConfig>>;
531
543
  fieldTransforms?: FieldTransforms<UserConfig>;
544
+ mobilePanelHeight?: "toggle" | "min-content";
532
545
  };
533
546
  type History<D = any> = {
534
547
  state: D;
@@ -646,4 +659,4 @@ type WalkTreeOptions = {
646
659
  };
647
660
  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;
648
661
 
649
- export { type MappedItem 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 ComponentConfigExtensions 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 ConfigParams as Q, type RootDataWithProps as R, type Slot as S, type ComponentConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type BaseData as X, type RootDataWithoutProps as Y, type RootData as Z, type ComponentDataOptionalId as _, type ComponentData as a, type ComponentDataMap as a0, type Content as a1, type PuckMetadata as a2, type ComponentMetadata as a3, type FieldMetadata as a4, type BaseField as a5, type TextField as a6, type NumberField as a7, type TextareaField as a8, type SelectField as a9, type RadioField as aa, type ArrayField as ab, type ObjectField as ac, type Adaptor as ad, type ExternalFieldWithAdaptor as ae, type CacheOpts as af, type ExternalField as ag, type CustomFieldRender as ah, type CustomField as ai, type SlotField as aj, type PuckContext as ak, type DefaultRootFieldProps as al, type DefaultRootRenderProps as am, type DefaultRootProps as an, type DefaultComponentProps as ao, type WithId as ap, type WithPuckProps as aq, type AsFieldProps as ar, type WithChildren as as, type ExtractField as at, 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 };
662
+ export { type ComponentDataOptionalId 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 ComponentConfigExtensions as K, type RootConfig as L, type Metadata as M, type DefaultComponents as N, type Overrides as O, type Permissions as P, type ExtractConfigParams as Q, type RootDataWithProps as R, type Slot as S, type ConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentConfigParams as X, type BaseData as Y, type RootDataWithoutProps as Z, type RootData as _, type ComponentData as a, type MappedItem as a0, type ComponentDataMap as a1, type Content as a2, type PuckMetadata as a3, type ComponentMetadata as a4, type FieldMetadata as a5, type BaseField as a6, type TextField as a7, type NumberField as a8, type TextareaField as a9, type SelectField as aa, type RadioField as ab, type ArrayField as ac, type ObjectField as ad, type Adaptor as ae, type ExternalFieldWithAdaptor as af, type CacheOpts as ag, type ExternalField as ah, type CustomFieldRender as ai, type CustomField as aj, type SlotField as ak, type PuckContext as al, type DefaultRootFieldProps as am, type DefaultRootRenderProps as an, type DefaultRootProps as ao, type DefaultComponentProps as ap, type WithId as aq, type WithPuckProps as ar, type AsFieldProps as as, type WithChildren as at, type ExtractField as au, 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 };
@@ -334,6 +334,7 @@ interface FieldMetadata extends Metadata {
334
334
  type ItemWithId = {
335
335
  _arrayId: string;
336
336
  _originalIndex: number;
337
+ _currentIndex: number;
337
338
  };
338
339
  type ArrayState = {
339
340
  items: ItemWithId[];
@@ -344,6 +345,7 @@ type UiState = {
344
345
  rightSideBarVisible: boolean;
345
346
  leftSideBarWidth?: number | null;
346
347
  rightSideBarWidth?: number | null;
348
+ mobilePanelExpanded?: boolean;
347
349
  itemSelector: ItemSelector | null;
348
350
  arrayState: Record<string, ArrayState | undefined>;
349
351
  previewMode: "interactive" | "edit";
@@ -356,7 +358,7 @@ type UiState = {
356
358
  isDragging: boolean;
357
359
  viewports: {
358
360
  current: {
359
- width: number;
361
+ width: number | "100%";
360
362
  height: number | "auto";
361
363
  };
362
364
  controlsVisible: boolean;
@@ -365,6 +367,9 @@ type UiState = {
365
367
  field: {
366
368
  focus?: string | null;
367
369
  };
370
+ plugin: {
371
+ current: string | null;
372
+ };
368
373
  };
369
374
  type AppState<UserData extends Data = Data> = {
370
375
  data: UserData;
@@ -408,6 +413,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
408
413
  type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
409
414
  never
410
415
  ] ? False : True;
416
+ type RenderFunc<Props extends {
417
+ [key: string]: any;
418
+ } = {
419
+ children: ReactNode;
420
+ }> = (props: Props) => ReactElement;
421
+ type PluginInternal = Plugin & {
422
+ mobileOnly?: boolean;
423
+ };
411
424
 
412
425
  type MapFnParams<ThisField = Field> = {
413
426
  value: any;
@@ -431,11 +444,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
431
444
  [Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
432
445
  }>;
433
446
 
434
- type RenderFunc<Props extends {
435
- [key: string]: any;
436
- } = {
437
- children: ReactNode;
438
- }> = (props: Props) => ReactElement;
439
447
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
440
448
  type OverrideKey = (typeof overrideKeys)[number];
441
449
  type OverridesGeneric<Shape extends {
@@ -507,7 +515,7 @@ type DragAxis = "dynamic" | "y" | "x";
507
515
 
508
516
  type iconTypes = "Smartphone" | "Monitor" | "Tablet";
509
517
  type Viewport = {
510
- width: number;
518
+ width: number | "100%";
511
519
  height?: number | "auto";
512
520
  label?: string;
513
521
  icon?: iconTypes | ReactNode;
@@ -527,8 +535,13 @@ type IframeConfig = {
527
535
  };
528
536
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
529
537
  type Plugin<UserConfig extends Config = Config> = {
538
+ name?: string;
539
+ label?: string;
540
+ icon?: ReactNode;
541
+ render?: () => ReactElement;
530
542
  overrides?: Partial<Overrides<UserConfig>>;
531
543
  fieldTransforms?: FieldTransforms<UserConfig>;
544
+ mobilePanelHeight?: "toggle" | "min-content";
532
545
  };
533
546
  type History<D = any> = {
534
547
  state: D;
@@ -646,4 +659,4 @@ type WalkTreeOptions = {
646
659
  };
647
660
  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;
648
661
 
649
- export { type MappedItem 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 ComponentConfigExtensions 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 ConfigParams as Q, type RootDataWithProps as R, type Slot as S, type ComponentConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type BaseData as X, type RootDataWithoutProps as Y, type RootData as Z, type ComponentDataOptionalId as _, type ComponentData as a, type ComponentDataMap as a0, type Content as a1, type PuckMetadata as a2, type ComponentMetadata as a3, type FieldMetadata as a4, type BaseField as a5, type TextField as a6, type NumberField as a7, type TextareaField as a8, type SelectField as a9, type RadioField as aa, type ArrayField as ab, type ObjectField as ac, type Adaptor as ad, type ExternalFieldWithAdaptor as ae, type CacheOpts as af, type ExternalField as ag, type CustomFieldRender as ah, type CustomField as ai, type SlotField as aj, type PuckContext as ak, type DefaultRootFieldProps as al, type DefaultRootRenderProps as am, type DefaultRootProps as an, type DefaultComponentProps as ao, type WithId as ap, type WithPuckProps as aq, type AsFieldProps as ar, type WithChildren as as, type ExtractField as at, 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 };
662
+ export { type ComponentDataOptionalId 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 ComponentConfigExtensions as K, type RootConfig as L, type Metadata as M, type DefaultComponents as N, type Overrides as O, type Permissions as P, type ExtractConfigParams as Q, type RootDataWithProps as R, type Slot as S, type ConfigParams as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentConfigParams as X, type BaseData as Y, type RootDataWithoutProps as Z, type RootData as _, type ComponentData as a, type MappedItem as a0, type ComponentDataMap as a1, type Content as a2, type PuckMetadata as a3, type ComponentMetadata as a4, type FieldMetadata as a5, type BaseField as a6, type TextField as a7, type NumberField as a8, type TextareaField as a9, type SelectField as aa, type RadioField as ab, type ArrayField as ac, type ObjectField as ad, type Adaptor as ae, type ExternalFieldWithAdaptor as af, type CacheOpts as ag, type ExternalField as ah, type CustomFieldRender as ai, type CustomField as aj, type SlotField as ak, type PuckContext as al, type DefaultRootFieldProps as am, type DefaultRootRenderProps as an, type DefaultRootProps as ao, type DefaultComponentProps as ap, type WithId as aq, type WithPuckProps as ar, type AsFieldProps as as, type WithChildren as at, type ExtractField as au, 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.21.0-canary.79a26849",
3
+ "version": "0.21.0-canary.7ed9655b",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "measuredco/puck",