@measured/puck 0.14.0-canary.92750a2 → 0.14.0-canary.9b794d9

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,45 +1,9 @@
1
- import { C as Config, D as Data, I as ItemSelector, U as UiState, A as AppState, F as Field, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-ab049d49.js';
2
- export { g as Adaptor, f as ArrayField, r as ArrayState, n as BaseData, B as BaseField, m as ComponentConfig, o as ComponentData, k as Content, i as CustomField, s as DropZone, h as ExternalField, E as ExternalFieldWithAdaptor, j as Fields, q as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, l as PuckContext, e as RadioField, p as RootDataWithoutProps, S as SelectField, T as TextField, d as TextareaField } from './Config-ab049d49.js';
1
+ import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-shqT_YTp.js';
2
+ export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-shqT_YTp.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import { ReactNode, CSSProperties, ReactElement, SyntheticEvent } from 'react';
6
- import { DragStart, DragUpdate } from '@hello-pangea/dnd';
7
-
8
- type PathData = Record<string, {
9
- path: string[];
10
- label: string;
11
- }>;
12
- type DropZoneContext<UserConfig extends Config<any, any, any> = Config<any, any, any>> = {
13
- data: Data;
14
- config: UserConfig;
15
- componentState?: Record<string, any>;
16
- itemSelector?: ItemSelector | null;
17
- setItemSelector?: (newIndex: ItemSelector | null) => void;
18
- dispatch?: (action: PuckAction) => void;
19
- areaId?: string;
20
- draggedItem?: DragStart & Partial<DragUpdate>;
21
- placeholderStyle?: CSSProperties;
22
- hoveringArea?: string | null;
23
- setHoveringArea?: (area: string | null) => void;
24
- hoveringZone?: string | null;
25
- setHoveringZone?: (zone: string | null) => void;
26
- hoveringComponent?: string | null;
27
- setHoveringComponent?: (id: string | null) => void;
28
- registerZoneArea?: (areaId: string) => void;
29
- areasWithZones?: Record<string, boolean>;
30
- registerZone?: (zoneCompound: string) => void;
31
- unregisterZone?: (zoneCompound: string) => void;
32
- activeZones?: Record<string, boolean>;
33
- pathData?: PathData;
34
- registerPath?: (selector: ItemSelector) => void;
35
- mode?: "edit" | "render";
36
- disableZoom?: boolean;
37
- } | null;
38
- declare const dropZoneContext: react.Context<DropZoneContext<Config<any, any, any>>>;
39
- declare const DropZoneProvider: ({ children, value, }: {
40
- children: ReactNode;
41
- value: DropZoneContext;
42
- }) => react_jsx_runtime.JSX.Element;
5
+ import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
6
+ import { DragStart, DragUpdate } from '@measured/dnd';
43
7
 
44
8
  type InsertAction = {
45
9
  type: "insert";
@@ -105,7 +69,7 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
105
69
  href?: string | undefined;
106
70
  onClick?: ((e: any) => void | Promise<void>) | undefined;
107
71
  variant?: "primary" | "secondary" | undefined;
108
- type?: "reset" | "submit" | "button" | undefined;
72
+ type?: "button" | "submit" | "reset" | undefined;
109
73
  disabled?: boolean | undefined;
110
74
  tabIndex?: number | undefined;
111
75
  newTab?: boolean | undefined;
@@ -119,25 +83,65 @@ declare const Drawer: {
119
83
  ({ children, droppableId, direction, }: {
120
84
  children: ReactNode;
121
85
  droppableId?: string | undefined;
122
- direction?: "horizontal" | "vertical" | undefined;
86
+ direction?: "vertical" | "horizontal" | undefined;
123
87
  }): react_jsx_runtime.JSX.Element;
124
- Item: ({ name, children, id, index, }: {
88
+ Item: ({ name, children, id, label, index, }: {
125
89
  name: string;
126
90
  children?: ((props: {
127
91
  children: ReactNode;
128
92
  name: string;
129
93
  }) => ReactElement) | undefined;
130
94
  id?: string | undefined;
95
+ label?: string | undefined;
131
96
  index: number;
132
97
  }) => react_jsx_runtime.JSX.Element;
133
98
  };
134
99
 
100
+ type PathData = Record<string, {
101
+ path: string[];
102
+ label: string;
103
+ }>;
104
+ type DropZoneContext<UserConfig extends Config = Config> = {
105
+ data: Data;
106
+ config: UserConfig;
107
+ componentState?: Record<string, any>;
108
+ itemSelector?: ItemSelector | null;
109
+ setItemSelector?: (newIndex: ItemSelector | null) => void;
110
+ dispatch?: (action: PuckAction) => void;
111
+ areaId?: string;
112
+ draggedItem?: DragStart & Partial<DragUpdate>;
113
+ placeholderStyle?: CSSProperties;
114
+ hoveringArea?: string | null;
115
+ setHoveringArea?: (area: string | null) => void;
116
+ hoveringZone?: string | null;
117
+ setHoveringZone?: (zone: string | null) => void;
118
+ hoveringComponent?: string | null;
119
+ setHoveringComponent?: (id: string | null) => void;
120
+ registerZoneArea?: (areaId: string) => void;
121
+ areasWithZones?: Record<string, boolean>;
122
+ registerZone?: (zoneCompound: string) => void;
123
+ unregisterZone?: (zoneCompound: string) => void;
124
+ activeZones?: Record<string, boolean>;
125
+ pathData?: PathData;
126
+ registerPath?: (selector: ItemSelector) => void;
127
+ mode?: "edit" | "render";
128
+ zoneWillDrag?: string;
129
+ setZoneWillDrag?: (zone: string) => void;
130
+ } | null;
131
+ declare const dropZoneContext: react.Context<DropZoneContext<Config<Record<string, any>, DefaultRootProps, string>>>;
132
+ declare const DropZoneProvider: ({ children, value, }: {
133
+ children: ReactNode;
134
+ value: DropZoneContext;
135
+ }) => react_jsx_runtime.JSX.Element;
136
+
137
+ declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
138
+
135
139
  declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
136
140
  children: ReactNode;
137
141
  href?: string | undefined;
138
142
  onClick?: ((e: SyntheticEvent) => void | Promise<void>) | undefined;
139
143
  variant?: "primary" | "secondary" | undefined;
140
- type?: "reset" | "submit" | "button" | undefined;
144
+ type?: "button" | "submit" | "reset" | undefined;
141
145
  disabled?: boolean | undefined;
142
146
  tabIndex?: number | undefined;
143
147
  newTab?: boolean | undefined;
@@ -221,7 +225,11 @@ type Plugin = {
221
225
  overrides: Partial<Overrides>;
222
226
  };
223
227
 
224
- declare function Puck<UserConfig extends Config<any, any, any> = Config<any, any, any>>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, }: {
228
+ type IframeConfig = {
229
+ enabled?: boolean;
230
+ };
231
+
232
+ declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, }: {
225
233
  children?: ReactNode;
226
234
  config: UserConfig;
227
235
  data: Data;
@@ -241,6 +249,8 @@ declare function Puck<UserConfig extends Config<any, any, any> = Config<any, any
241
249
  }) => ReactElement;
242
250
  headerTitle?: string;
243
251
  headerPath?: string;
252
+ viewports?: Viewports;
253
+ iframe?: IframeConfig;
244
254
  }): react_jsx_runtime.JSX.Element;
245
255
  declare namespace Puck {
246
256
  var Components: () => react_jsx_runtime.JSX.Element;
@@ -251,7 +261,7 @@ declare namespace Puck {
251
261
  }) => react_jsx_runtime.JSX.Element;
252
262
  }
253
263
 
254
- declare function Render<UserConfig extends Config<any, any, any> = Config<any, any, any>>({ config, data }: {
264
+ declare function Render<UserConfig extends Config = Config>({ config, data, }: {
255
265
  config: UserConfig;
256
266
  data: Data;
257
267
  }): react_jsx_runtime.JSX.Element;
@@ -269,7 +279,7 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
269
279
  }>;
270
280
  declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
271
281
 
272
- declare const resolveAllData: (data: Data, config: Config<any, any, any>, onResolveStart?: ((item: MappedItem) => void) | undefined, onResolveEnd?: ((item: MappedItem) => void) | undefined) => Promise<{
282
+ declare function resolveAllData(data: Data, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
273
283
  root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
274
284
  content: any[];
275
285
  zones: Record<string, MappedItem[]>;
@@ -300,9 +310,12 @@ type PuckHistory = {
300
310
 
301
311
  declare const usePuck: () => {
302
312
  appState: AppState;
303
- config: Config<any, any, any>;
313
+ config: Config<Record<string, any>, DefaultRootProps, string>;
304
314
  dispatch: (action: PuckAction) => void;
305
315
  history: Partial<PuckHistory>;
316
+ selectedItem: ComponentData<DefaultComponentProps & {
317
+ id: string;
318
+ }> | null;
306
319
  };
307
320
 
308
- export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
321
+ export { AppState, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };