@measured/puck 0.14.0-canary.55740c4 → 0.14.0-canary.5bb1708

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-1444273f.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-1444273f.js';
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';
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';
@@ -121,12 +121,14 @@ declare const Drawer: {
121
121
  droppableId?: string | undefined;
122
122
  direction?: "horizontal" | "vertical" | undefined;
123
123
  }): react_jsx_runtime.JSX.Element;
124
- Item: ({ name, children, id, index, }: {
124
+ Item: ({ name, children, id, label, index, }: {
125
125
  name: string;
126
126
  children?: ((props: {
127
127
  children: ReactNode;
128
+ name: string;
128
129
  }) => ReactElement) | undefined;
129
130
  id?: string | undefined;
131
+ label?: string | undefined;
130
132
  index: number;
131
133
  }) => react_jsx_runtime.JSX.Element;
132
134
  };
@@ -167,7 +169,7 @@ type RenderFunc<Props extends {
167
169
  [key: string]: any;
168
170
  } = {
169
171
  children: ReactNode;
170
- }> = React.FunctionComponent<Props>;
172
+ }> = (props: Props) => ReactElement;
171
173
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
172
174
  type OverrideKey = (typeof overrideKeys)[number];
173
175
  type OverridesGeneric<Shape extends {
@@ -197,7 +199,10 @@ type Overrides = OverridesGeneric<{
197
199
  className?: string;
198
200
  }>;
199
201
  components: RenderFunc;
200
- componentItem: RenderFunc;
202
+ componentItem: RenderFunc<{
203
+ children: ReactNode;
204
+ name: string;
205
+ }>;
201
206
  outline: RenderFunc;
202
207
  puck: RenderFunc;
203
208
  }>;
@@ -271,10 +276,34 @@ declare const resolveAllData: (data: Data, config: Config<any, any, any>, onReso
271
276
  zones: Record<string, MappedItem[]>;
272
277
  }>;
273
278
 
279
+ type History<D = any> = {
280
+ id: string;
281
+ data: D;
282
+ };
283
+ type HistoryStore<D = any> = {
284
+ index: number;
285
+ currentHistory: History;
286
+ hasPast: boolean;
287
+ hasFuture: boolean;
288
+ record: (data: D) => void;
289
+ back: VoidFunction;
290
+ forward: VoidFunction;
291
+ nextHistory: History<D> | null;
292
+ prevHistory: History<D> | null;
293
+ histories: History<D>[];
294
+ };
295
+
296
+ type PuckHistory = {
297
+ back: VoidFunction;
298
+ forward: VoidFunction;
299
+ historyStore: HistoryStore;
300
+ };
301
+
274
302
  declare const usePuck: () => {
275
303
  appState: AppState;
276
304
  config: Config<any, any, any>;
277
305
  dispatch: (action: PuckAction) => void;
306
+ history: Partial<PuckHistory>;
278
307
  };
279
308
 
280
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 };