@measured/puck 0.17.4 → 0.18.0-canary.00f3e0f

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.
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { F as FieldProps, a as Field, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-zN5E6nBu.mjs';
2
- export { L as Adaptor, J as ArrayField, r as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, t as ComponentConfig, w as ComponentData, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, p as FieldRenderFunctions, Y as Fields, q as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, n as OverrideKey, s as PuckComponent, Z as PuckContext, G as RadioField, v as RootData, R as RootDataWithProps, u as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, m as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys, a4 as resolveAllData } from './resolve-all-data-zN5E6nBu.mjs';
1
+ import { F as FieldProps, a as Field, C as Config, D as Data, I as ItemSelector, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-DzJEE28m.mjs';
2
+ export { W as Adaptor, L as ArrayField, t as ArrayState, a4 as AsFieldProps, B as BaseData, G as BaseField, v as ComponentConfig, y as ComponentData, z as Content, Z as CustomField, a1 as DefaultRootProps, a0 as DefaultRootRenderProps, m as Direction, n as DragAxis, Y as ExternalField, X as ExternalFieldWithAdaptor, r as FieldRenderFunctions, _ as Fields, s as ItemWithId, M as MappedItem, N as NumberField, Q as ObjectField, q as OverrideKey, u as PuckComponent, $ as PuckContext, K as RadioField, x as RootData, R as RootDataWithProps, w as RootDataWithoutProps, S as SelectField, T as TextField, J as TextareaField, o as Viewport, a5 as WithChildren, a2 as WithId, a3 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-DzJEE28m.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
- import { DragStart, DragUpdate } from '@measured/dnd';
5
+ import { ReactNode, SyntheticEvent, ReactElement } from 'react';
6
+ import { UniqueIdentifier } from '@dnd-kit/abstract';
7
7
 
8
8
  declare const ActionBar: {
9
9
  ({ label, children, }: {
@@ -15,6 +15,9 @@ declare const ActionBar: {
15
15
  label?: string;
16
16
  onClick: (e: SyntheticEvent) => void;
17
17
  }) => react_jsx_runtime.JSX.Element;
18
+ Label: ({ label }: {
19
+ label: string;
20
+ }) => react_jsx_runtime.JSX.Element;
18
21
  Group: ({ children }: {
19
22
  children: ReactNode;
20
23
  }) => react_jsx_runtime.JSX.Element;
@@ -27,6 +30,9 @@ declare const Action: ({ children, label, onClick, }: {
27
30
  declare const Group: ({ children }: {
28
31
  children: ReactNode;
29
32
  }) => react_jsx_runtime.JSX.Element;
33
+ declare const Label: ({ label }: {
34
+ label: string;
35
+ }) => react_jsx_runtime.JSX.Element;
30
36
 
31
37
  declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
32
38
  children?: ReactNode;
@@ -55,7 +61,7 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
55
61
  }) => react_jsx_runtime.JSX.Element;
56
62
 
57
63
  declare const Drawer: {
58
- ({ children, droppableId: _droppableId, direction, }: {
64
+ ({ children, droppableId, direction, }: {
59
65
  children: ReactNode;
60
66
  droppableId?: string;
61
67
  direction?: "vertical" | "horizontal";
@@ -68,7 +74,7 @@ declare const Drawer: {
68
74
  }) => ReactElement;
69
75
  id?: string;
70
76
  label?: string;
71
- index: number;
77
+ index?: number;
72
78
  isDragDisabled?: boolean;
73
79
  }) => react_jsx_runtime.JSX.Element;
74
80
  };
@@ -83,14 +89,9 @@ type DropZoneContext<UserConfig extends Config = Config> = {
83
89
  componentState?: Record<string, any>;
84
90
  itemSelector?: ItemSelector | null;
85
91
  setItemSelector?: (newIndex: ItemSelector | null) => void;
86
- dispatch?: (action: PuckAction) => void;
87
92
  areaId?: string;
88
- draggedItem?: DragStart & Partial<DragUpdate>;
89
- placeholderStyle?: CSSProperties;
90
- hoveringArea?: string | null;
91
- setHoveringArea?: (area: string | null) => void;
92
- hoveringZone?: string | null;
93
- setHoveringZone?: (zone: string | null) => void;
93
+ zoneCompound?: string;
94
+ index?: number;
94
95
  hoveringComponent?: string | null;
95
96
  setHoveringComponent?: (id: string | null) => void;
96
97
  registerZoneArea?: (areaId: string) => void;
@@ -99,10 +100,13 @@ type DropZoneContext<UserConfig extends Config = Config> = {
99
100
  unregisterZone?: (zoneCompound: string) => void;
100
101
  activeZones?: Record<string, boolean>;
101
102
  pathData?: PathData;
102
- registerPath?: (selector: ItemSelector) => void;
103
+ registerPath?: (id: string, selector: ItemSelector, label: string) => void;
104
+ unregisterPath?: (id: string) => void;
103
105
  mode?: "edit" | "render";
104
- zoneWillDrag?: string;
105
- setZoneWillDrag?: (zone: string) => void;
106
+ depth: number;
107
+ registerLocalZone?: (zone: string, active: boolean) => void;
108
+ unregisterLocalZone?: (zone: string) => void;
109
+ path: string[];
106
110
  } | null;
107
111
  declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
108
112
  declare const DropZoneProvider: ({ children, value, }: {
@@ -110,7 +114,13 @@ declare const DropZoneProvider: ({ children, value, }: {
110
114
  value: DropZoneContext;
111
115
  }) => react_jsx_runtime.JSX.Element;
112
116
 
113
- declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
117
+ type DropZoneDndData = {
118
+ areaId?: string;
119
+ depth: number;
120
+ path: UniqueIdentifier[];
121
+ isDroppableTarget: boolean;
122
+ };
123
+ declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
114
124
 
115
125
  declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
116
126
  children: ReactNode;
@@ -226,4 +236,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
226
236
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
227
237
  };
228
238
 
229
- export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
239
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, type DropZoneDndData, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { F as FieldProps, a as Field, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-zN5E6nBu.js';
2
- export { L as Adaptor, J as ArrayField, r as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, t as ComponentConfig, w as ComponentData, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, p as FieldRenderFunctions, Y as Fields, q as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, n as OverrideKey, s as PuckComponent, Z as PuckContext, G as RadioField, v as RootData, R as RootDataWithProps, u as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, m as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys, a4 as resolveAllData } from './resolve-all-data-zN5E6nBu.js';
1
+ import { F as FieldProps, a as Field, C as Config, D as Data, I as ItemSelector, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-DzJEE28m.js';
2
+ export { W as Adaptor, L as ArrayField, t as ArrayState, a4 as AsFieldProps, B as BaseData, G as BaseField, v as ComponentConfig, y as ComponentData, z as Content, Z as CustomField, a1 as DefaultRootProps, a0 as DefaultRootRenderProps, m as Direction, n as DragAxis, Y as ExternalField, X as ExternalFieldWithAdaptor, r as FieldRenderFunctions, _ as Fields, s as ItemWithId, M as MappedItem, N as NumberField, Q as ObjectField, q as OverrideKey, u as PuckComponent, $ as PuckContext, K as RadioField, x as RootData, R as RootDataWithProps, w as RootDataWithoutProps, S as SelectField, T as TextField, J as TextareaField, o as Viewport, a5 as WithChildren, a2 as WithId, a3 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-DzJEE28m.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
- import { DragStart, DragUpdate } from '@measured/dnd';
5
+ import { ReactNode, SyntheticEvent, ReactElement } from 'react';
6
+ import { UniqueIdentifier } from '@dnd-kit/abstract';
7
7
 
8
8
  declare const ActionBar: {
9
9
  ({ label, children, }: {
@@ -15,6 +15,9 @@ declare const ActionBar: {
15
15
  label?: string;
16
16
  onClick: (e: SyntheticEvent) => void;
17
17
  }) => react_jsx_runtime.JSX.Element;
18
+ Label: ({ label }: {
19
+ label: string;
20
+ }) => react_jsx_runtime.JSX.Element;
18
21
  Group: ({ children }: {
19
22
  children: ReactNode;
20
23
  }) => react_jsx_runtime.JSX.Element;
@@ -27,6 +30,9 @@ declare const Action: ({ children, label, onClick, }: {
27
30
  declare const Group: ({ children }: {
28
31
  children: ReactNode;
29
32
  }) => react_jsx_runtime.JSX.Element;
33
+ declare const Label: ({ label }: {
34
+ label: string;
35
+ }) => react_jsx_runtime.JSX.Element;
30
36
 
31
37
  declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
32
38
  children?: ReactNode;
@@ -55,7 +61,7 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
55
61
  }) => react_jsx_runtime.JSX.Element;
56
62
 
57
63
  declare const Drawer: {
58
- ({ children, droppableId: _droppableId, direction, }: {
64
+ ({ children, droppableId, direction, }: {
59
65
  children: ReactNode;
60
66
  droppableId?: string;
61
67
  direction?: "vertical" | "horizontal";
@@ -68,7 +74,7 @@ declare const Drawer: {
68
74
  }) => ReactElement;
69
75
  id?: string;
70
76
  label?: string;
71
- index: number;
77
+ index?: number;
72
78
  isDragDisabled?: boolean;
73
79
  }) => react_jsx_runtime.JSX.Element;
74
80
  };
@@ -83,14 +89,9 @@ type DropZoneContext<UserConfig extends Config = Config> = {
83
89
  componentState?: Record<string, any>;
84
90
  itemSelector?: ItemSelector | null;
85
91
  setItemSelector?: (newIndex: ItemSelector | null) => void;
86
- dispatch?: (action: PuckAction) => void;
87
92
  areaId?: string;
88
- draggedItem?: DragStart & Partial<DragUpdate>;
89
- placeholderStyle?: CSSProperties;
90
- hoveringArea?: string | null;
91
- setHoveringArea?: (area: string | null) => void;
92
- hoveringZone?: string | null;
93
- setHoveringZone?: (zone: string | null) => void;
93
+ zoneCompound?: string;
94
+ index?: number;
94
95
  hoveringComponent?: string | null;
95
96
  setHoveringComponent?: (id: string | null) => void;
96
97
  registerZoneArea?: (areaId: string) => void;
@@ -99,10 +100,13 @@ type DropZoneContext<UserConfig extends Config = Config> = {
99
100
  unregisterZone?: (zoneCompound: string) => void;
100
101
  activeZones?: Record<string, boolean>;
101
102
  pathData?: PathData;
102
- registerPath?: (selector: ItemSelector) => void;
103
+ registerPath?: (id: string, selector: ItemSelector, label: string) => void;
104
+ unregisterPath?: (id: string) => void;
103
105
  mode?: "edit" | "render";
104
- zoneWillDrag?: string;
105
- setZoneWillDrag?: (zone: string) => void;
106
+ depth: number;
107
+ registerLocalZone?: (zone: string, active: boolean) => void;
108
+ unregisterLocalZone?: (zone: string) => void;
109
+ path: string[];
106
110
  } | null;
107
111
  declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
108
112
  declare const DropZoneProvider: ({ children, value, }: {
@@ -110,7 +114,13 @@ declare const DropZoneProvider: ({ children, value, }: {
110
114
  value: DropZoneContext;
111
115
  }) => react_jsx_runtime.JSX.Element;
112
116
 
113
- declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
117
+ type DropZoneDndData = {
118
+ areaId?: string;
119
+ depth: number;
120
+ path: UniqueIdentifier[];
121
+ isDroppableTarget: boolean;
122
+ };
123
+ declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
114
124
 
115
125
  declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
116
126
  children: ReactNode;
@@ -226,4 +236,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
226
236
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
227
237
  };
228
238
 
229
- export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
239
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, type DropZoneDndData, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };