@measured/puck 0.20.0-canary.93d525c5 → 0.20.0-canary.aee5fc96

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,8 +1,8 @@
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, o as PluginInternal } from './walk-tree-CU8Fq-KC.mjs';
2
+ export { a6 as Adaptor, a4 as ArrayField, E as ArrayState, aj as AsFieldProps, L as BaseData, _ as BaseField, Y as ComponentDataMap, T as ComponentDataOptionalId, Z as Content, aa as CustomField, a9 as CustomFieldRender, ag as DefaultComponentProps, ad as DefaultRootFieldProps, af as DefaultRootProps, ae as DefaultRootRenderProps, p as Direction, q as DragAxis, a8 as ExternalField, a7 as ExternalFieldWithAdaptor, an as ExtractField, al as ExtractPropsFromConfig, am as ExtractRootPropsFromConfig, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, X as MappedItem, a0 as NumberField, a5 as ObjectField, y as OverrideKey, J as PuckComponent, ac as PuckContext, a3 as RadioField, K as RootConfig, Q as RootData, N as RootDataWithoutProps, a2 as SelectField, S as Slot, G as SlotComponent, ab as SlotField, $ as TextField, a1 as TextareaField, s as Viewport, ak as WithChildren, ah as WithId, ai as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CU8Fq-KC.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
5
+ import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
6
 
7
7
  type HistorySlice<D = any> = {
8
8
  index: number;
@@ -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: {
@@ -207,6 +208,7 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
207
208
  permissions?: Partial<Permissions>;
208
209
  plugins?: Plugin[];
209
210
  overrides?: Partial<Overrides>;
211
+ fieldTransforms?: FieldTransforms;
210
212
  renderHeader?: (props: {
211
213
  children: ReactNode;
212
214
  dispatch: (action: PuckAction) => void;
@@ -225,6 +227,7 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
225
227
  };
226
228
  initialHistory?: InitialHistory;
227
229
  metadata?: Metadata;
230
+ height?: CSSProperties["height"];
228
231
  };
229
232
  declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
230
233
  declare namespace Puck {
@@ -249,18 +252,25 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
249
252
  metadata?: Metadata;
250
253
  }): react_jsx_runtime.JSX.Element;
251
254
 
252
- type WithGet<T> = T & {
253
- get: () => T;
254
- };
255
+ declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
256
+ disableDrag?: boolean;
257
+ disableDragOnFocus?: boolean;
258
+ }) => (() => void) | undefined;
259
+
260
+ /**
261
+ * Helper function to set a value based on a dot-notated path
262
+ */
263
+ declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
264
+
255
265
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
256
- appState: AppState;
266
+ appState: G["UserPublicAppState"];
257
267
  config: UserConfig;
258
268
  dispatch: AppStore["dispatch"];
259
269
  getPermissions: GetPermissions<UserConfig>;
260
270
  refreshPermissions: RefreshPermissions<UserConfig>;
261
271
  selectedItem: G["UserComponentData"] | null;
262
- getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
263
- getItemById: (id: string) => ComponentData | undefined;
272
+ getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
273
+ getItemById: (id: string) => G["UserComponentData"] | undefined;
264
274
  getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
265
275
  history: {
266
276
  back: HistorySlice["back"];
@@ -274,7 +284,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
274
284
  };
275
285
  };
276
286
  type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
277
- type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
287
+ type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
278
288
  /**
279
289
  * createUsePuck
280
290
  *
@@ -293,4 +303,12 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
293
303
  */
294
304
  declare function useGetPuck(): () => UsePuckStore<Config>;
295
305
 
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 };
306
+ declare const blocksPlugin: () => Plugin;
307
+
308
+ declare const fieldsPlugin: (params?: {
309
+ mobileOnly?: boolean;
310
+ }) => PluginInternal;
311
+
312
+ declare const outlinePlugin: () => Plugin;
313
+
314
+ 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, blocksPlugin, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
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, o as PluginInternal } from './walk-tree-CU8Fq-KC.js';
2
+ export { a6 as Adaptor, a4 as ArrayField, E as ArrayState, aj as AsFieldProps, L as BaseData, _ as BaseField, Y as ComponentDataMap, T as ComponentDataOptionalId, Z as Content, aa as CustomField, a9 as CustomFieldRender, ag as DefaultComponentProps, ad as DefaultRootFieldProps, af as DefaultRootProps, ae as DefaultRootRenderProps, p as Direction, q as DragAxis, a8 as ExternalField, a7 as ExternalFieldWithAdaptor, an as ExtractField, al as ExtractPropsFromConfig, am as ExtractRootPropsFromConfig, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, X as MappedItem, a0 as NumberField, a5 as ObjectField, y as OverrideKey, J as PuckComponent, ac as PuckContext, a3 as RadioField, K as RootConfig, Q as RootData, N as RootDataWithoutProps, a2 as SelectField, S as Slot, G as SlotComponent, ab as SlotField, $ as TextField, a1 as TextareaField, s as Viewport, ak as WithChildren, ah as WithId, ai as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CU8Fq-KC.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
- import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
5
+ import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
6
 
7
7
  type HistorySlice<D = any> = {
8
8
  index: number;
@@ -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: {
@@ -207,6 +208,7 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
207
208
  permissions?: Partial<Permissions>;
208
209
  plugins?: Plugin[];
209
210
  overrides?: Partial<Overrides>;
211
+ fieldTransforms?: FieldTransforms;
210
212
  renderHeader?: (props: {
211
213
  children: ReactNode;
212
214
  dispatch: (action: PuckAction) => void;
@@ -225,6 +227,7 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
225
227
  };
226
228
  initialHistory?: InitialHistory;
227
229
  metadata?: Metadata;
230
+ height?: CSSProperties["height"];
228
231
  };
229
232
  declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
230
233
  declare namespace Puck {
@@ -249,18 +252,25 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
249
252
  metadata?: Metadata;
250
253
  }): react_jsx_runtime.JSX.Element;
251
254
 
252
- type WithGet<T> = T & {
253
- get: () => T;
254
- };
255
+ declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
256
+ disableDrag?: boolean;
257
+ disableDragOnFocus?: boolean;
258
+ }) => (() => void) | undefined;
259
+
260
+ /**
261
+ * Helper function to set a value based on a dot-notated path
262
+ */
263
+ declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
264
+
255
265
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
256
- appState: AppState;
266
+ appState: G["UserPublicAppState"];
257
267
  config: UserConfig;
258
268
  dispatch: AppStore["dispatch"];
259
269
  getPermissions: GetPermissions<UserConfig>;
260
270
  refreshPermissions: RefreshPermissions<UserConfig>;
261
271
  selectedItem: G["UserComponentData"] | null;
262
- getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
263
- getItemById: (id: string) => ComponentData | undefined;
272
+ getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
273
+ getItemById: (id: string) => G["UserComponentData"] | undefined;
264
274
  getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
265
275
  history: {
266
276
  back: HistorySlice["back"];
@@ -274,7 +284,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
274
284
  };
275
285
  };
276
286
  type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
277
- type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
287
+ type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
278
288
  /**
279
289
  * createUsePuck
280
290
  *
@@ -293,4 +303,12 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
293
303
  */
294
304
  declare function useGetPuck(): () => UsePuckStore<Config>;
295
305
 
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 };
306
+ declare const blocksPlugin: () => Plugin;
307
+
308
+ declare const fieldsPlugin: (params?: {
309
+ mobileOnly?: boolean;
310
+ }) => PluginInternal;
311
+
312
+ declare const outlinePlugin: () => Plugin;
313
+
314
+ 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, blocksPlugin, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };