@measured/puck 0.14.0-canary.4932a6e → 0.14.0-canary.4c77ac5

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,9 +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-1b86f0dc.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-1b86f0dc.js';
1
+ import { C as Config, D as Data, I as ItemSelector, U as UiState, A as AppState, F as Field, V as Viewports, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-29dc2731.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-29dc2731.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties, ReactElement, SyntheticEvent } from 'react';
6
- import { DragStart, DragUpdate } from '@hello-pangea/dnd';
6
+ import { DragStart, DragUpdate } from '@measured/dnd';
7
7
 
8
8
  type PathData = Record<string, {
9
9
  path: string[];
@@ -33,7 +33,8 @@ type DropZoneContext<UserConfig extends Config<any, any, any> = Config<any, any,
33
33
  pathData?: PathData;
34
34
  registerPath?: (selector: ItemSelector) => void;
35
35
  mode?: "edit" | "render";
36
- disableZoom?: boolean;
36
+ zoneWillDrag?: string;
37
+ setZoneWillDrag?: (zone: string) => void;
37
38
  } | null;
38
39
  declare const dropZoneContext: react.Context<DropZoneContext<Config<any, any, any>>>;
39
40
  declare const DropZoneProvider: ({ children, value, }: {
@@ -121,12 +122,14 @@ declare const Drawer: {
121
122
  droppableId?: string | undefined;
122
123
  direction?: "horizontal" | "vertical" | undefined;
123
124
  }): react_jsx_runtime.JSX.Element;
124
- Item: ({ name, children, id, index, }: {
125
+ Item: ({ name, children, id, label, index, }: {
125
126
  name: string;
126
127
  children?: ((props: {
127
128
  children: ReactNode;
129
+ name: string;
128
130
  }) => ReactElement) | undefined;
129
131
  id?: string | undefined;
132
+ label?: string | undefined;
130
133
  index: number;
131
134
  }) => react_jsx_runtime.JSX.Element;
132
135
  };
@@ -167,7 +170,7 @@ type RenderFunc<Props extends {
167
170
  [key: string]: any;
168
171
  } = {
169
172
  children: ReactNode;
170
- }> = React.FunctionComponent<Props>;
173
+ }> = (props: Props) => ReactElement;
171
174
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
172
175
  type OverrideKey = (typeof overrideKeys)[number];
173
176
  type OverridesGeneric<Shape extends {
@@ -197,7 +200,10 @@ type Overrides = OverridesGeneric<{
197
200
  className?: string;
198
201
  }>;
199
202
  components: RenderFunc;
200
- componentItem: RenderFunc;
203
+ componentItem: RenderFunc<{
204
+ children: ReactNode;
205
+ name: string;
206
+ }>;
201
207
  outline: RenderFunc;
202
208
  puck: RenderFunc;
203
209
  }>;
@@ -217,7 +223,7 @@ type Plugin = {
217
223
  overrides: Partial<Overrides>;
218
224
  };
219
225
 
220
- 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, }: {
226
+ 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, viewports, }: {
221
227
  children?: ReactNode;
222
228
  config: UserConfig;
223
229
  data: Data;
@@ -237,6 +243,7 @@ declare function Puck<UserConfig extends Config<any, any, any> = Config<any, any
237
243
  }) => ReactElement;
238
244
  headerTitle?: string;
239
245
  headerPath?: string;
246
+ viewports?: Viewports;
240
247
  }): react_jsx_runtime.JSX.Element;
241
248
  declare namespace Puck {
242
249
  var Components: () => react_jsx_runtime.JSX.Element;
@@ -271,10 +278,34 @@ declare const resolveAllData: (data: Data, config: Config<any, any, any>, onReso
271
278
  zones: Record<string, MappedItem[]>;
272
279
  }>;
273
280
 
281
+ type History<D = any> = {
282
+ id: string;
283
+ data: D;
284
+ };
285
+ type HistoryStore<D = any> = {
286
+ index: number;
287
+ currentHistory: History;
288
+ hasPast: boolean;
289
+ hasFuture: boolean;
290
+ record: (data: D) => void;
291
+ back: VoidFunction;
292
+ forward: VoidFunction;
293
+ nextHistory: History<D> | null;
294
+ prevHistory: History<D> | null;
295
+ histories: History<D>[];
296
+ };
297
+
298
+ type PuckHistory = {
299
+ back: VoidFunction;
300
+ forward: VoidFunction;
301
+ historyStore: HistoryStore;
302
+ };
303
+
274
304
  declare const usePuck: () => {
275
305
  appState: AppState;
276
306
  config: Config<any, any, any>;
277
307
  dispatch: (action: PuckAction) => void;
308
+ history: Partial<PuckHistory>;
278
309
  };
279
310
 
280
311
  export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };