@measured/puck 0.21.0-canary.ec77dd9f → 0.21.0-canary.f3ce0d72

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,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-NW2GGRCZ.mjs";
25
+ } from "./chunk-73365SXB.mjs";
22
26
  import {
23
27
  init_react_import,
24
28
  migrate,
25
29
  resolveAllData,
26
30
  transformProps,
27
31
  walkTree
28
- } from "./chunk-TC25DCTQ.mjs";
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-CkSoNBF7.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.mjs';
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-CkSoNBF7.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CkSoNBF7.js';
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
@@ -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-TC25DCTQ.mjs";
15
+ } from "./chunk-FY5AZKYD.mjs";
16
16
 
17
17
  // bundle/rsc.tsx
18
18
  init_react_import();
@@ -332,6 +332,7 @@ interface FieldMetadata extends Metadata {
332
332
  type ItemWithId = {
333
333
  _arrayId: string;
334
334
  _originalIndex: number;
335
+ _currentIndex: number;
335
336
  };
336
337
  type ArrayState = {
337
338
  items: ItemWithId[];
@@ -342,6 +343,7 @@ type UiState = {
342
343
  rightSideBarVisible: boolean;
343
344
  leftSideBarWidth?: number | null;
344
345
  rightSideBarWidth?: number | null;
346
+ mobilePanelExpanded?: boolean;
345
347
  itemSelector: ItemSelector | null;
346
348
  arrayState: Record<string, ArrayState | undefined>;
347
349
  previewMode: "interactive" | "edit";
@@ -354,7 +356,7 @@ type UiState = {
354
356
  isDragging: boolean;
355
357
  viewports: {
356
358
  current: {
357
- width: number;
359
+ width: number | "100%";
358
360
  height: number | "auto";
359
361
  };
360
362
  controlsVisible: boolean;
@@ -363,6 +365,9 @@ type UiState = {
363
365
  field: {
364
366
  focus?: string | null;
365
367
  };
368
+ plugin: {
369
+ current: string | null;
370
+ };
366
371
  };
367
372
  type AppState<UserData extends Data = Data> = {
368
373
  data: UserData;
@@ -406,6 +411,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
406
411
  type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
407
412
  never
408
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
+ };
409
422
 
410
423
  type MapFnParams<ThisField = Field> = {
411
424
  value: any;
@@ -429,11 +442,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
429
442
  [Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
430
443
  }>;
431
444
 
432
- type RenderFunc<Props extends {
433
- [key: string]: any;
434
- } = {
435
- children: ReactNode;
436
- }> = (props: Props) => ReactElement;
437
445
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
438
446
  type OverrideKey = (typeof overrideKeys)[number];
439
447
  type OverridesGeneric<Shape extends {
@@ -505,7 +513,7 @@ type DragAxis = "dynamic" | "y" | "x";
505
513
 
506
514
  type iconTypes = "Smartphone" | "Monitor" | "Tablet";
507
515
  type Viewport = {
508
- width: number;
516
+ width: number | "100%";
509
517
  height?: number | "auto";
510
518
  label?: string;
511
519
  icon?: iconTypes | ReactNode;
@@ -525,8 +533,13 @@ type IframeConfig = {
525
533
  };
526
534
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
527
535
  type Plugin<UserConfig extends Config = Config> = {
536
+ name?: string;
537
+ label?: string;
538
+ icon?: ReactNode;
539
+ render?: () => ReactElement;
528
540
  overrides?: Partial<Overrides<UserConfig>>;
529
541
  fieldTransforms?: FieldTransforms<UserConfig>;
542
+ mobilePanelHeight?: "toggle" | "min-content";
530
543
  };
531
544
  type History<D = any> = {
532
545
  state: D;
@@ -644,4 +657,4 @@ type WalkTreeOptions = {
644
657
  };
645
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;
646
659
 
647
- 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 };
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 };
@@ -332,6 +332,7 @@ interface FieldMetadata extends Metadata {
332
332
  type ItemWithId = {
333
333
  _arrayId: string;
334
334
  _originalIndex: number;
335
+ _currentIndex: number;
335
336
  };
336
337
  type ArrayState = {
337
338
  items: ItemWithId[];
@@ -342,6 +343,7 @@ type UiState = {
342
343
  rightSideBarVisible: boolean;
343
344
  leftSideBarWidth?: number | null;
344
345
  rightSideBarWidth?: number | null;
346
+ mobilePanelExpanded?: boolean;
345
347
  itemSelector: ItemSelector | null;
346
348
  arrayState: Record<string, ArrayState | undefined>;
347
349
  previewMode: "interactive" | "edit";
@@ -354,7 +356,7 @@ type UiState = {
354
356
  isDragging: boolean;
355
357
  viewports: {
356
358
  current: {
357
- width: number;
359
+ width: number | "100%";
358
360
  height: number | "auto";
359
361
  };
360
362
  controlsVisible: boolean;
@@ -363,6 +365,9 @@ type UiState = {
363
365
  field: {
364
366
  focus?: string | null;
365
367
  };
368
+ plugin: {
369
+ current: string | null;
370
+ };
366
371
  };
367
372
  type AppState<UserData extends Data = Data> = {
368
373
  data: UserData;
@@ -406,6 +411,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
406
411
  type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
407
412
  never
408
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
+ };
409
422
 
410
423
  type MapFnParams<ThisField = Field> = {
411
424
  value: any;
@@ -429,11 +442,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
429
442
  [Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
430
443
  }>;
431
444
 
432
- type RenderFunc<Props extends {
433
- [key: string]: any;
434
- } = {
435
- children: ReactNode;
436
- }> = (props: Props) => ReactElement;
437
445
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
438
446
  type OverrideKey = (typeof overrideKeys)[number];
439
447
  type OverridesGeneric<Shape extends {
@@ -505,7 +513,7 @@ type DragAxis = "dynamic" | "y" | "x";
505
513
 
506
514
  type iconTypes = "Smartphone" | "Monitor" | "Tablet";
507
515
  type Viewport = {
508
- width: number;
516
+ width: number | "100%";
509
517
  height?: number | "auto";
510
518
  label?: string;
511
519
  icon?: iconTypes | ReactNode;
@@ -525,8 +533,13 @@ type IframeConfig = {
525
533
  };
526
534
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
527
535
  type Plugin<UserConfig extends Config = Config> = {
536
+ name?: string;
537
+ label?: string;
538
+ icon?: ReactNode;
539
+ render?: () => ReactElement;
528
540
  overrides?: Partial<Overrides<UserConfig>>;
529
541
  fieldTransforms?: FieldTransforms<UserConfig>;
542
+ mobilePanelHeight?: "toggle" | "min-content";
530
543
  };
531
544
  type History<D = any> = {
532
545
  state: D;
@@ -644,4 +657,4 @@ type WalkTreeOptions = {
644
657
  };
645
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;
646
659
 
647
- 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.21.0-canary.ec77dd9f",
3
+ "version": "0.21.0-canary.f3ce0d72",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "measuredco/puck",