@measured/puck 0.20.0-canary.6a211610 → 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.
@@ -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-FYXJ5FPS.mjs";
24
+ } from "./chunk-5X2PB4G7.mjs";
22
25
  import {
23
26
  init_react_import,
24
27
  migrate,
25
28
  resolveAllData,
26
29
  transformProps,
27
30
  walkTree
28
- } from "./chunk-HUKJ36SA.mjs";
31
+ } from "./chunk-BNXRZWNI.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-B57SgEEc.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-B57SgEEc.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 { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-B57SgEEc.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-B57SgEEc.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
@@ -694,7 +694,8 @@ var defaultAppState = {
694
694
  options: [],
695
695
  controlsVisible: true
696
696
  },
697
- field: { focus: null }
697
+ field: { focus: null },
698
+ plugin: { current: null }
698
699
  },
699
700
  indexes: {
700
701
  nodes: {},
package/dist/rsc.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  resolveAllData,
6
6
  transformProps,
7
7
  walkTree
8
- } from "./chunk-HUKJ36SA.mjs";
8
+ } from "./chunk-BNXRZWNI.mjs";
9
9
 
10
10
  // bundle/rsc.tsx
11
11
  init_react_import();
@@ -284,6 +284,7 @@ type Metadata = {
284
284
  type ItemWithId = {
285
285
  _arrayId: string;
286
286
  _originalIndex: number;
287
+ _currentIndex: number;
287
288
  };
288
289
  type ArrayState = {
289
290
  items: ItemWithId[];
@@ -315,6 +316,9 @@ type UiState = {
315
316
  field: {
316
317
  focus?: string | null;
317
318
  };
319
+ plugin: {
320
+ current: string | null;
321
+ };
318
322
  };
319
323
  type AppState<UserData extends Data = Data> = {
320
324
  data: UserData;
@@ -349,6 +353,14 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
349
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 ? {
350
354
  [K in keyof T]: WithDeepSlots<T[K], SlotType>;
351
355
  } : T;
356
+ type RenderFunc<Props extends {
357
+ [key: string]: any;
358
+ } = {
359
+ children: ReactNode;
360
+ }> = (props: Props) => ReactElement;
361
+ type PluginInternal = Plugin & {
362
+ mobileOnly?: boolean;
363
+ };
352
364
 
353
365
  type MapFnParams<ThisField = Field> = {
354
366
  value: any;
@@ -367,11 +379,6 @@ type FieldTransforms = Partial<{
367
379
  [FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
368
380
  }>;
369
381
 
370
- type RenderFunc<Props extends {
371
- [key: string]: any;
372
- } = {
373
- children: ReactNode;
374
- }> = (props: Props) => ReactElement;
375
382
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
376
383
  type OverrideKey = (typeof overrideKeys)[number];
377
384
  type OverridesGeneric<Shape extends {
@@ -468,6 +475,10 @@ type IframeConfig = {
468
475
  };
469
476
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
470
477
  type Plugin = {
478
+ name?: string;
479
+ label?: string;
480
+ icon?: ReactNode;
481
+ render?: () => ReactElement;
471
482
  overrides?: Partial<Overrides>;
472
483
  fieldTransforms?: FieldTransforms;
473
484
  };
@@ -587,4 +598,4 @@ type WalkTreeOptions = {
587
598
  };
588
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;
589
600
 
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 };
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 };
@@ -284,6 +284,7 @@ type Metadata = {
284
284
  type ItemWithId = {
285
285
  _arrayId: string;
286
286
  _originalIndex: number;
287
+ _currentIndex: number;
287
288
  };
288
289
  type ArrayState = {
289
290
  items: ItemWithId[];
@@ -315,6 +316,9 @@ type UiState = {
315
316
  field: {
316
317
  focus?: string | null;
317
318
  };
319
+ plugin: {
320
+ current: string | null;
321
+ };
318
322
  };
319
323
  type AppState<UserData extends Data = Data> = {
320
324
  data: UserData;
@@ -349,6 +353,14 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
349
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 ? {
350
354
  [K in keyof T]: WithDeepSlots<T[K], SlotType>;
351
355
  } : T;
356
+ type RenderFunc<Props extends {
357
+ [key: string]: any;
358
+ } = {
359
+ children: ReactNode;
360
+ }> = (props: Props) => ReactElement;
361
+ type PluginInternal = Plugin & {
362
+ mobileOnly?: boolean;
363
+ };
352
364
 
353
365
  type MapFnParams<ThisField = Field> = {
354
366
  value: any;
@@ -367,11 +379,6 @@ type FieldTransforms = Partial<{
367
379
  [FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
368
380
  }>;
369
381
 
370
- type RenderFunc<Props extends {
371
- [key: string]: any;
372
- } = {
373
- children: ReactNode;
374
- }> = (props: Props) => ReactElement;
375
382
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
376
383
  type OverrideKey = (typeof overrideKeys)[number];
377
384
  type OverridesGeneric<Shape extends {
@@ -468,6 +475,10 @@ type IframeConfig = {
468
475
  };
469
476
  type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
470
477
  type Plugin = {
478
+ name?: string;
479
+ label?: string;
480
+ icon?: ReactNode;
481
+ render?: () => ReactElement;
471
482
  overrides?: Partial<Overrides>;
472
483
  fieldTransforms?: FieldTransforms;
473
484
  };
@@ -587,4 +598,4 @@ type WalkTreeOptions = {
587
598
  };
588
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;
589
600
 
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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.20.0-canary.6a211610",
3
+ "version": "0.20.0-canary.6aefde61",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",