@measured/puck 0.14.0-canary.cc7d391 → 0.14.0-canary.d944288

Sign up to get free protection for your applications and to get access to all the features.
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-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 { 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-Bgx_Bij_.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-Bgx_Bij_.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,13 +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;
128
129
  name: string;
129
130
  }) => ReactElement) | undefined;
130
131
  id?: string | undefined;
132
+ label?: string | undefined;
131
133
  index: number;
132
134
  }) => react_jsx_runtime.JSX.Element;
133
135
  };
@@ -221,7 +223,11 @@ type Plugin = {
221
223
  overrides: Partial<Overrides>;
222
224
  };
223
225
 
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, }: {
226
+ type IframeConfig = {
227
+ enabled?: boolean;
228
+ };
229
+
230
+ 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, iframe, }: {
225
231
  children?: ReactNode;
226
232
  config: UserConfig;
227
233
  data: Data;
@@ -241,6 +247,8 @@ declare function Puck<UserConfig extends Config<any, any, any> = Config<any, any
241
247
  }) => ReactElement;
242
248
  headerTitle?: string;
243
249
  headerPath?: string;
250
+ viewports?: Viewports;
251
+ iframe?: IframeConfig;
244
252
  }): react_jsx_runtime.JSX.Element;
245
253
  declare namespace Puck {
246
254
  var Components: () => react_jsx_runtime.JSX.Element;
@@ -275,10 +283,34 @@ declare const resolveAllData: (data: Data, config: Config<any, any, any>, onReso
275
283
  zones: Record<string, MappedItem[]>;
276
284
  }>;
277
285
 
286
+ type History<D = any> = {
287
+ id: string;
288
+ data: D;
289
+ };
290
+ type HistoryStore<D = any> = {
291
+ index: number;
292
+ currentHistory: History;
293
+ hasPast: boolean;
294
+ hasFuture: boolean;
295
+ record: (data: D) => void;
296
+ back: VoidFunction;
297
+ forward: VoidFunction;
298
+ nextHistory: History<D> | null;
299
+ prevHistory: History<D> | null;
300
+ histories: History<D>[];
301
+ };
302
+
303
+ type PuckHistory = {
304
+ back: VoidFunction;
305
+ forward: VoidFunction;
306
+ historyStore: HistoryStore;
307
+ };
308
+
278
309
  declare const usePuck: () => {
279
310
  appState: AppState;
280
311
  config: Config<any, any, any>;
281
312
  dispatch: (action: PuckAction) => void;
313
+ history: Partial<PuckHistory>;
282
314
  };
283
315
 
284
- export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
316
+ export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };