@measured/puck 0.20.0-canary.f768aab9 → 0.20.1-canary.d7404af9

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.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-BOSl1o0G.mjs';
2
- export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-BOSl1o0G.mjs';
1
+ import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-CiAkCQEp.mjs';
2
+ export { a7 as Adaptor, a5 as ArrayField, B as ArrayState, ak as AsFieldProps, N as BaseData, $ as BaseField, Z as ComponentDataMap, X as ComponentDataOptionalId, _ as Content, ab as CustomField, aa as CustomFieldRender, ah as DefaultComponentProps, K as DefaultComponents, ae as DefaultRootFieldProps, ag as DefaultRootProps, af as DefaultRootRenderProps, o as Direction, p as DragAxis, a9 as ExternalField, a8 as ExternalFieldWithAdaptor, L as ExtractConfigParams, am as ExtractField, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, Y as MappedItem, a1 as NumberField, a6 as ObjectField, x as OverrideKey, G as PuckComponent, ad as PuckContext, a4 as RadioField, J as RootConfig, T as RootData, Q as RootDataWithoutProps, a3 as SelectField, S as Slot, E as SlotComponent, ac as SlotField, a0 as TextField, a2 as TextareaField, q as Viewport, al as WithChildren, ai as WithId, aj as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CiAkCQEp.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
@@ -105,6 +105,7 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
105
105
  history: HistorySlice;
106
106
  nodes: NodesSlice;
107
107
  permissions: PermissionsSlice;
108
+ fieldTransforms: FieldTransforms;
108
109
  };
109
110
 
110
111
  declare const ActionBar: {
@@ -205,8 +206,9 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
205
206
  onPublish?: (data: G["UserData"]) => void;
206
207
  onAction?: OnAction<G["UserData"]>;
207
208
  permissions?: Partial<Permissions>;
208
- plugins?: Plugin[];
209
- overrides?: Partial<Overrides>;
209
+ plugins?: Plugin<UserConfig>[];
210
+ overrides?: Partial<Overrides<UserConfig>>;
211
+ fieldTransforms?: FieldTransforms<UserConfig>;
210
212
  renderHeader?: (props: {
211
213
  children: ReactNode;
212
214
  dispatch: (action: PuckAction) => void;
@@ -249,18 +251,25 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
249
251
  metadata?: Metadata;
250
252
  }): react_jsx_runtime.JSX.Element;
251
253
 
252
- type WithGet<T> = T & {
253
- get: () => T;
254
- };
254
+ declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
255
+ disableDrag?: boolean;
256
+ disableDragOnFocus?: boolean;
257
+ }) => (() => void) | undefined;
258
+
259
+ /**
260
+ * Helper function to set a value based on a dot-notated path
261
+ */
262
+ declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
263
+
255
264
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
256
- appState: AppState;
265
+ appState: G["UserPublicAppState"];
257
266
  config: UserConfig;
258
267
  dispatch: AppStore["dispatch"];
259
268
  getPermissions: GetPermissions<UserConfig>;
260
269
  refreshPermissions: RefreshPermissions<UserConfig>;
261
270
  selectedItem: G["UserComponentData"] | null;
262
- getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
263
- getItemById: (id: string) => ComponentData | undefined;
271
+ getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
272
+ getItemById: (id: string) => G["UserComponentData"] | undefined;
264
273
  getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
265
274
  history: {
266
275
  back: HistorySlice["back"];
@@ -274,7 +283,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
274
283
  };
275
284
  };
276
285
  type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
277
- type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
286
+ type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
278
287
  /**
279
288
  * createUsePuck
280
289
  *
@@ -293,4 +302,4 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
293
302
  */
294
303
  declare function useGetPuck(): () => UsePuckStore<Config>;
295
304
 
296
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, renderContext, useGetPuck, usePuck };
305
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-BOSl1o0G.js';
2
- export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-BOSl1o0G.js';
1
+ import { H as History, P as Permissions, a as ComponentData, C as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector } from './walk-tree-CiAkCQEp.js';
2
+ export { a7 as Adaptor, a5 as ArrayField, B as ArrayState, ak as AsFieldProps, N as BaseData, $ as BaseField, Z as ComponentDataMap, X as ComponentDataOptionalId, _ as Content, ab as CustomField, aa as CustomFieldRender, ah as DefaultComponentProps, K as DefaultComponents, ae as DefaultRootFieldProps, ag as DefaultRootProps, af as DefaultRootRenderProps, o as Direction, p as DragAxis, a9 as ExternalField, a8 as ExternalFieldWithAdaptor, L as ExtractConfigParams, am as ExtractField, y as FieldRenderFunctions, u as FieldTransformFn, s as FieldTransformFnParams, z as ItemWithId, Y as MappedItem, a1 as NumberField, a6 as ObjectField, x as OverrideKey, G as PuckComponent, ad as PuckContext, a4 as RadioField, J as RootConfig, T as RootData, Q as RootDataWithoutProps, a3 as SelectField, S as Slot, E as SlotComponent, ac as SlotField, a0 as TextField, a2 as TextareaField, q as Viewport, al as WithChildren, ai as WithId, aj as WithPuckProps, W as WithSlotProps, m as migrate, v as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CiAkCQEp.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
@@ -105,6 +105,7 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
105
105
  history: HistorySlice;
106
106
  nodes: NodesSlice;
107
107
  permissions: PermissionsSlice;
108
+ fieldTransforms: FieldTransforms;
108
109
  };
109
110
 
110
111
  declare const ActionBar: {
@@ -205,8 +206,9 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
205
206
  onPublish?: (data: G["UserData"]) => void;
206
207
  onAction?: OnAction<G["UserData"]>;
207
208
  permissions?: Partial<Permissions>;
208
- plugins?: Plugin[];
209
- overrides?: Partial<Overrides>;
209
+ plugins?: Plugin<UserConfig>[];
210
+ overrides?: Partial<Overrides<UserConfig>>;
211
+ fieldTransforms?: FieldTransforms<UserConfig>;
210
212
  renderHeader?: (props: {
211
213
  children: ReactNode;
212
214
  dispatch: (action: PuckAction) => void;
@@ -249,18 +251,25 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
249
251
  metadata?: Metadata;
250
252
  }): react_jsx_runtime.JSX.Element;
251
253
 
252
- type WithGet<T> = T & {
253
- get: () => T;
254
- };
254
+ declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
255
+ disableDrag?: boolean;
256
+ disableDragOnFocus?: boolean;
257
+ }) => (() => void) | undefined;
258
+
259
+ /**
260
+ * Helper function to set a value based on a dot-notated path
261
+ */
262
+ declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
263
+
255
264
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
256
- appState: AppState;
265
+ appState: G["UserPublicAppState"];
257
266
  config: UserConfig;
258
267
  dispatch: AppStore["dispatch"];
259
268
  getPermissions: GetPermissions<UserConfig>;
260
269
  refreshPermissions: RefreshPermissions<UserConfig>;
261
270
  selectedItem: G["UserComponentData"] | null;
262
- getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
263
- getItemById: (id: string) => ComponentData | undefined;
271
+ getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
272
+ getItemById: (id: string) => G["UserComponentData"] | undefined;
264
273
  getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
265
274
  history: {
266
275
  back: HistorySlice["back"];
@@ -274,7 +283,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
274
283
  };
275
284
  };
276
285
  type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
277
- type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
286
+ type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
278
287
  /**
279
288
  * createUsePuck
280
289
  *
@@ -293,4 +302,4 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
293
302
  */
294
303
  declare function useGetPuck(): () => UsePuckStore<Config>;
295
304
 
296
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, renderContext, useGetPuck, usePuck };
305
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };