@measured/puck 0.14.0-canary.712fb8e → 0.14.0-canary.83be956

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.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-487c2755.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-487c2755.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-09628f3c.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-09628f3c.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,7 +83,7 @@ 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
88
  Item: ({ name, children, id, label, index, }: {
125
89
  name: string;
@@ -133,12 +97,51 @@ declare const Drawer: {
133
97
  }) => react_jsx_runtime.JSX.Element;
134
98
  };
135
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
+
136
139
  declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
137
140
  children: ReactNode;
138
141
  href?: string | undefined;
139
142
  onClick?: ((e: SyntheticEvent) => void | Promise<void>) | undefined;
140
143
  variant?: "primary" | "secondary" | undefined;
141
- type?: "reset" | "submit" | "button" | undefined;
144
+ type?: "button" | "submit" | "reset" | undefined;
142
145
  disabled?: boolean | undefined;
143
146
  tabIndex?: number | undefined;
144
147
  newTab?: boolean | undefined;
@@ -222,7 +225,11 @@ type Plugin = {
222
225
  overrides: Partial<Overrides>;
223
226
  };
224
227
 
225
- 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, }: {
226
233
  children?: ReactNode;
227
234
  config: UserConfig;
228
235
  data: Data;
@@ -242,6 +249,8 @@ declare function Puck<UserConfig extends Config<any, any, any> = Config<any, any
242
249
  }) => ReactElement;
243
250
  headerTitle?: string;
244
251
  headerPath?: string;
252
+ viewports?: Viewports;
253
+ iframe?: IframeConfig;
245
254
  }): react_jsx_runtime.JSX.Element;
246
255
  declare namespace Puck {
247
256
  var Components: () => react_jsx_runtime.JSX.Element;
@@ -252,7 +261,7 @@ declare namespace Puck {
252
261
  }) => react_jsx_runtime.JSX.Element;
253
262
  }
254
263
 
255
- 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, }: {
256
265
  config: UserConfig;
257
266
  data: Data;
258
267
  }): react_jsx_runtime.JSX.Element;
@@ -270,7 +279,7 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
270
279
  }>;
271
280
  declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
272
281
 
273
- 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<{
274
283
  root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
275
284
  content: any[];
276
285
  zones: Record<string, MappedItem[]>;
@@ -301,9 +310,12 @@ type PuckHistory = {
301
310
 
302
311
  declare const usePuck: () => {
303
312
  appState: AppState;
304
- config: Config<any, any, any>;
313
+ config: Config<Record<string, any>, DefaultRootProps, string>;
305
314
  dispatch: (action: PuckAction) => void;
306
315
  history: Partial<PuckHistory>;
316
+ selectedItem: ComponentData<DefaultComponentProps & {
317
+ id: string;
318
+ }> | null;
307
319
  };
308
320
 
309
- 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, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };