@measured/puck 0.21.0-canary.8358d3e1 → 0.21.0-canary.89038d0c

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.
Files changed (43) hide show
  1. package/dist/{Editor-N46HUQEC.mjs → Editor-O447AVCX.mjs} +13 -10
  2. package/dist/{Render-Y567PGZ7.mjs → Render-OFE6QLI2.mjs} +6 -4
  3. package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-ONhOkrvf.d.mts} +1 -27
  4. package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-ONhOkrvf.d.ts} +1 -27
  5. package/dist/{chunk-FNWOH4R6.mjs → chunk-2Q4PACDA.mjs} +8 -6
  6. package/dist/{chunk-DNF2EMM4.mjs → chunk-62AAYNXG.mjs} +2 -2
  7. package/dist/{chunk-K3V4LVUL.mjs → chunk-BSDEIOEK.mjs} +11 -9
  8. package/dist/{chunk-WUWXFMEM.mjs → chunk-CSSRLPHM.mjs} +1 -1
  9. package/dist/{chunk-7KY6RHEY.mjs → chunk-DAQLMM2T.mjs} +15 -523
  10. package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
  11. package/dist/{chunk-DJSH5REF.mjs → chunk-NLUHDYVR.mjs} +2 -123
  12. package/dist/{chunk-GQKMOYLG.mjs → chunk-PLXSMBAA.mjs} +2 -2
  13. package/dist/{chunk-3QHWXJEI.mjs → chunk-QAWJTCV5.mjs} +2 -2
  14. package/dist/chunk-QBGM4ELA.mjs +528 -0
  15. package/dist/chunk-T3WX7XJ6.mjs +132 -0
  16. package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
  17. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  18. package/dist/{chunk-C2TVYIYC.mjs → chunk-Y656T6AQ.mjs} +10 -6
  19. package/dist/{chunk-N5XMZOMC.mjs → chunk-Z476VA6G.mjs} +279 -203
  20. package/dist/{full-NLUNPJWS.mjs → full-BEMDJKDS.mjs} +10 -7
  21. package/dist/index-BEoNHRI1.d.ts +116 -0
  22. package/dist/index-DfxZ7tZF.d.mts +116 -0
  23. package/dist/index.d.mts +6 -116
  24. package/dist/index.d.ts +6 -116
  25. package/dist/index.js +446 -376
  26. package/dist/index.mjs +14 -11
  27. package/dist/internal.d.mts +27 -0
  28. package/dist/internal.d.ts +27 -0
  29. package/dist/internal.js +908 -0
  30. package/dist/internal.mjs +13 -0
  31. package/dist/{loaded-ZXOU6S6R.mjs → loaded-JU3A7Y4L.mjs} +7 -4
  32. package/dist/{loaded-HMSPJUZM.mjs → loaded-N3FYGF2Y.mjs} +7 -4
  33. package/dist/{loaded-EV34KGYJ.mjs → loaded-OBY7OMS6.mjs} +7 -4
  34. package/dist/no-external.d.mts +3 -1
  35. package/dist/no-external.d.ts +3 -1
  36. package/dist/no-external.js +446 -376
  37. package/dist/no-external.mjs +14 -11
  38. package/dist/rsc.d.mts +2 -2
  39. package/dist/rsc.d.ts +2 -2
  40. package/dist/rsc.mjs +6 -4
  41. package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
  42. package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
  43. package/package.json +9 -4
@@ -1,15 +1,18 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-K3V4LVUL.mjs";
4
- import "./chunk-GQKMOYLG.mjs";
5
- import "./chunk-DNF2EMM4.mjs";
6
- import "./chunk-3QHWXJEI.mjs";
7
- import "./chunk-7KY6RHEY.mjs";
8
- import "./chunk-DJSH5REF.mjs";
3
+ } from "./chunk-BSDEIOEK.mjs";
4
+ import "./chunk-PLXSMBAA.mjs";
5
+ import "./chunk-62AAYNXG.mjs";
6
+ import "./chunk-QAWJTCV5.mjs";
7
+ import "./chunk-DAQLMM2T.mjs";
8
+ import "./chunk-QBGM4ELA.mjs";
9
+ import "./chunk-T3WX7XJ6.mjs";
10
+ import "./chunk-Y2EFNT5P.mjs";
11
+ import "./chunk-NLUHDYVR.mjs";
9
12
  import {
10
13
  __spreadValues,
11
14
  init_react_import
12
- } from "./chunk-DCSQEDMK.mjs";
15
+ } from "./chunk-M6W7YEVX.mjs";
13
16
 
14
17
  // components/RichTextMenu/full.tsx
15
18
  init_react_import();
@@ -0,0 +1,116 @@
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-ONhOkrvf.js';
2
+ import { Editor } from '@tiptap/react';
3
+
4
+ type HistorySlice<D = any> = {
5
+ index: number;
6
+ hasPast: () => boolean;
7
+ hasFuture: () => boolean;
8
+ histories: History<D>[];
9
+ record: (data: D) => void;
10
+ back: VoidFunction;
11
+ forward: VoidFunction;
12
+ currentHistory: () => History;
13
+ nextHistory: () => History<D> | null;
14
+ prevHistory: () => History<D> | null;
15
+ setHistories: (histories: History[]) => void;
16
+ setHistoryIndex: (index: number) => void;
17
+ initialAppState: D;
18
+ };
19
+
20
+ type NodeMethods = {
21
+ sync: () => void;
22
+ hideOverlay: () => void;
23
+ showOverlay: () => void;
24
+ };
25
+ type PuckNodeInstance = {
26
+ id: string;
27
+ methods: NodeMethods;
28
+ element: HTMLElement | null;
29
+ };
30
+ type NodesSlice = {
31
+ nodes: Record<string, PuckNodeInstance | undefined>;
32
+ registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
33
+ unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
34
+ };
35
+
36
+ type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
37
+ item?: G["UserComponentData"] | null;
38
+ type?: keyof G["UserProps"];
39
+ root?: boolean;
40
+ };
41
+ type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
42
+ type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
43
+ type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
44
+ type Cache = Record<string, {
45
+ lastPermissions: Partial<Permissions>;
46
+ lastData: ComponentData | null;
47
+ lastParentId: string | null;
48
+ }>;
49
+ type PermissionsSlice = {
50
+ cache: Cache;
51
+ globalPermissions: Permissions;
52
+ resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
53
+ getPermissions: GetPermissions<Config>;
54
+ resolvePermissions: ResolvePermissions<Config>;
55
+ refreshPermissions: RefreshPermissions<Config>;
56
+ };
57
+
58
+ type ComponentOrRootData = Omit<ComponentData<any>, "type">;
59
+ type FieldsSlice = {
60
+ fields: Fields | Partial<Fields>;
61
+ loading: boolean;
62
+ lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
64
+ };
65
+
66
+ type Status = "LOADING" | "MOUNTED" | "READY";
67
+ type ZoomConfig = {
68
+ autoZoom: number;
69
+ rootHeight: number;
70
+ zoom: number;
71
+ };
72
+ type ComponentState = Record<string, {
73
+ loadingCount: number;
74
+ }>;
75
+ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
76
+ state: G["UserAppState"];
77
+ dispatch: (action: PuckAction) => void;
78
+ config: UserConfig;
79
+ componentState: ComponentState;
80
+ setComponentState: (componentState: ComponentState) => void;
81
+ setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
82
+ unsetComponentLoading: (id: string) => void;
83
+ pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
84
+ resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
85
+ node: T;
86
+ didChange: boolean;
87
+ }>;
88
+ resolveAndCommitData: () => void;
89
+ plugins: Plugin[];
90
+ overrides: Partial<Overrides>;
91
+ viewports: Viewports;
92
+ zoomConfig: ZoomConfig;
93
+ setZoomConfig: (zoomConfig: ZoomConfig) => void;
94
+ status: Status;
95
+ setStatus: (status: Status) => void;
96
+ iframe: IframeConfig;
97
+ selectedItem?: G["UserData"]["content"][0] | null;
98
+ setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
99
+ getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
100
+ onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
101
+ metadata: Metadata;
102
+ fields: FieldsSlice;
103
+ history: HistorySlice;
104
+ nodes: NodesSlice;
105
+ permissions: PermissionsSlice;
106
+ fieldTransforms: FieldTransforms;
107
+ currentRichText?: {
108
+ inlineComponentId?: string;
109
+ inline: boolean;
110
+ field: RichtextField;
111
+ editor: Editor;
112
+ id: string;
113
+ } | null;
114
+ };
115
+
116
+ export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
@@ -0,0 +1,116 @@
1
+ import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms, o as RichtextField } from './actions-ONhOkrvf.mjs';
2
+ import { Editor } from '@tiptap/react';
3
+
4
+ type HistorySlice<D = any> = {
5
+ index: number;
6
+ hasPast: () => boolean;
7
+ hasFuture: () => boolean;
8
+ histories: History<D>[];
9
+ record: (data: D) => void;
10
+ back: VoidFunction;
11
+ forward: VoidFunction;
12
+ currentHistory: () => History;
13
+ nextHistory: () => History<D> | null;
14
+ prevHistory: () => History<D> | null;
15
+ setHistories: (histories: History[]) => void;
16
+ setHistoryIndex: (index: number) => void;
17
+ initialAppState: D;
18
+ };
19
+
20
+ type NodeMethods = {
21
+ sync: () => void;
22
+ hideOverlay: () => void;
23
+ showOverlay: () => void;
24
+ };
25
+ type PuckNodeInstance = {
26
+ id: string;
27
+ methods: NodeMethods;
28
+ element: HTMLElement | null;
29
+ };
30
+ type NodesSlice = {
31
+ nodes: Record<string, PuckNodeInstance | undefined>;
32
+ registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
33
+ unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
34
+ };
35
+
36
+ type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
37
+ item?: G["UserComponentData"] | null;
38
+ type?: keyof G["UserProps"];
39
+ root?: boolean;
40
+ };
41
+ type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
42
+ type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
43
+ type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
44
+ type Cache = Record<string, {
45
+ lastPermissions: Partial<Permissions>;
46
+ lastData: ComponentData | null;
47
+ lastParentId: string | null;
48
+ }>;
49
+ type PermissionsSlice = {
50
+ cache: Cache;
51
+ globalPermissions: Permissions;
52
+ resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
53
+ getPermissions: GetPermissions<Config>;
54
+ resolvePermissions: ResolvePermissions<Config>;
55
+ refreshPermissions: RefreshPermissions<Config>;
56
+ };
57
+
58
+ type ComponentOrRootData = Omit<ComponentData<any>, "type">;
59
+ type FieldsSlice = {
60
+ fields: Fields | Partial<Fields>;
61
+ loading: boolean;
62
+ lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
64
+ };
65
+
66
+ type Status = "LOADING" | "MOUNTED" | "READY";
67
+ type ZoomConfig = {
68
+ autoZoom: number;
69
+ rootHeight: number;
70
+ zoom: number;
71
+ };
72
+ type ComponentState = Record<string, {
73
+ loadingCount: number;
74
+ }>;
75
+ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
76
+ state: G["UserAppState"];
77
+ dispatch: (action: PuckAction) => void;
78
+ config: UserConfig;
79
+ componentState: ComponentState;
80
+ setComponentState: (componentState: ComponentState) => void;
81
+ setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
82
+ unsetComponentLoading: (id: string) => void;
83
+ pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
84
+ resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
85
+ node: T;
86
+ didChange: boolean;
87
+ }>;
88
+ resolveAndCommitData: () => void;
89
+ plugins: Plugin[];
90
+ overrides: Partial<Overrides>;
91
+ viewports: Viewports;
92
+ zoomConfig: ZoomConfig;
93
+ setZoomConfig: (zoomConfig: ZoomConfig) => void;
94
+ status: Status;
95
+ setStatus: (status: Status) => void;
96
+ iframe: IframeConfig;
97
+ selectedItem?: G["UserData"]["content"][0] | null;
98
+ setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
99
+ getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
100
+ onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
101
+ metadata: Metadata;
102
+ fields: FieldsSlice;
103
+ history: HistorySlice;
104
+ nodes: NodesSlice;
105
+ permissions: PermissionsSlice;
106
+ fieldTransforms: FieldTransforms;
107
+ currentRichText?: {
108
+ inlineComponentId?: string;
109
+ inline: boolean;
110
+ field: RichtextField;
111
+ editor: Editor;
112
+ id: string;
113
+ } | null;
114
+ };
115
+
116
+ export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,11 @@
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 RichtextField, i as Field, j as FieldProps, D as DropZoneProps, k as Data, l as OnAction, n as InitialHistory, o as ItemSelector } from './walk-tree-Ja9bNCM9.mjs';
2
- export { af as Adaptor, ad as ArrayField, G as ArrayState, at as AsFieldProps, Z as BaseData, a7 as BaseField, ah as CacheOpts, L as ComponentConfigExtensions, Y as ComponentConfigParams, a2 as ComponentDataMap, a0 as ComponentDataOptionalId, a5 as ComponentMetadata, X as ConfigParams, a3 as Content, ak as CustomField, aj as CustomFieldRender, aq as DefaultComponentProps, Q as DefaultComponents, an as DefaultRootFieldProps, ap as DefaultRootProps, ao as DefaultRootRenderProps, q as Direction, s as DragAxis, ai as ExternalField, ag as ExternalFieldWithAdaptor, T as ExtractConfigParams, av as ExtractField, a6 as FieldMetadata, B as FieldRenderFunctions, x as FieldTransformFn, v as FieldTransformFnParams, E as ItemWithId, a1 as MappedItem, a9 as NumberField, ae as ObjectField, z as OverrideKey, K as PuckComponent, am as PuckContext, a4 as PuckMetadata, ac as RadioField, p as RichText, N as RootConfig, $ as RootData, _ as RootDataWithoutProps, ab as SelectField, S as Slot, J as SlotComponent, al as SlotField, a8 as TextField, aa as TextareaField, u as Viewport, au as WithChildren, ar as WithId, as as WithPuckProps, W as WithSlotProps, m as migrate, y as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Ja9bNCM9.mjs';
1
+ import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, t as ItemSelector, c as ComponentData } from './actions-ONhOkrvf.mjs';
2
+ export { af as Adaptor, A as AppState, ad as ArrayField, L as ArrayState, aq as AsFieldProps, $ as BaseData, a7 as BaseField, ah as CacheOpts, m as ComponentConfig, T as ComponentConfigExtensions, _ as ComponentConfigParams, a3 as ComponentDataMap, a1 as ComponentDataOptionalId, a5 as ComponentMetadata, Z as ConfigParams, b as Content, ak as CustomField, aj as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, ao as DefaultRootProps, an as DefaultRootRenderProps, w as Direction, x as DragAxis, ai as ExternalField, ag as ExternalFieldWithAdaptor, Y as ExtractConfigParams, as as ExtractField, a6 as FieldMetadata, J as FieldRenderFunctions, B as FieldTransformFn, z as FieldTransformFnParams, F as Fields, H as History, K as ItemWithId, a2 as MappedItem, a9 as NumberField, ae as ObjectField, G as OverrideKey, Q as PuckComponent, am as PuckContext, a4 as PuckMetadata, ac as RadioField, i as ResolveDataTrigger, v as RichText, o as RichtextField, X as RootConfig, R as RootData, h as RootDataWithProps, a0 as RootDataWithoutProps, ab as SelectField, S as Slot, N as SlotComponent, al as SlotField, a8 as TextField, aa as TextareaField, y as Viewport, ar as WithChildren, W as WithId, ap as WithPuckProps, u as WithSlotProps, E as overrideKeys } from './actions-ONhOkrvf.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CdriEzFJ.mjs';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import * as react from 'react';
5
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
6
- import { Editor } from '@tiptap/react';
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-DfxZ7tZF.mjs';
8
+ import '@tiptap/react';
7
9
  import '@tiptap/extension-blockquote';
8
10
  import '@tiptap/extension-bold';
9
11
  import '@tiptap/extension-code';
@@ -19,118 +21,6 @@ import '@tiptap/extension-strike';
19
21
  import '@tiptap/extension-text-align';
20
22
  import '@tiptap/extension-underline';
21
23
 
22
- type HistorySlice<D = any> = {
23
- index: number;
24
- hasPast: () => boolean;
25
- hasFuture: () => boolean;
26
- histories: History<D>[];
27
- record: (data: D) => void;
28
- back: VoidFunction;
29
- forward: VoidFunction;
30
- currentHistory: () => History;
31
- nextHistory: () => History<D> | null;
32
- prevHistory: () => History<D> | null;
33
- setHistories: (histories: History[]) => void;
34
- setHistoryIndex: (index: number) => void;
35
- initialAppState: D;
36
- };
37
-
38
- type NodeMethods = {
39
- sync: () => void;
40
- hideOverlay: () => void;
41
- showOverlay: () => void;
42
- };
43
- type PuckNodeInstance = {
44
- id: string;
45
- methods: NodeMethods;
46
- element: HTMLElement | null;
47
- };
48
- type NodesSlice = {
49
- nodes: Record<string, PuckNodeInstance | undefined>;
50
- registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
51
- unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
52
- };
53
-
54
- type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
55
- item?: G["UserComponentData"] | null;
56
- type?: keyof G["UserProps"];
57
- root?: boolean;
58
- };
59
- type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
60
- type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
61
- type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
62
- type Cache = Record<string, {
63
- lastPermissions: Partial<Permissions>;
64
- lastData: ComponentData | null;
65
- lastParentId: string | null;
66
- }>;
67
- type PermissionsSlice = {
68
- cache: Cache;
69
- globalPermissions: Permissions;
70
- resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
71
- getPermissions: GetPermissions<Config>;
72
- resolvePermissions: ResolvePermissions<Config>;
73
- refreshPermissions: RefreshPermissions<Config>;
74
- };
75
-
76
- type ComponentOrRootData = Omit<ComponentData<any>, "type">;
77
- type FieldsSlice = {
78
- fields: Fields | Partial<Fields>;
79
- loading: boolean;
80
- lastResolvedData: Partial<ComponentOrRootData>;
81
- id: string | undefined;
82
- };
83
-
84
- type Status = "LOADING" | "MOUNTED" | "READY";
85
- type ZoomConfig = {
86
- autoZoom: number;
87
- rootHeight: number;
88
- zoom: number;
89
- };
90
- type ComponentState = Record<string, {
91
- loadingCount: number;
92
- }>;
93
- type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
94
- state: G["UserAppState"];
95
- dispatch: (action: PuckAction) => void;
96
- config: UserConfig;
97
- componentState: ComponentState;
98
- setComponentState: (componentState: ComponentState) => void;
99
- setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
100
- unsetComponentLoading: (id: string) => void;
101
- pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
102
- resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
103
- node: T;
104
- didChange: boolean;
105
- }>;
106
- resolveAndCommitData: () => void;
107
- plugins: Plugin[];
108
- overrides: Partial<Overrides>;
109
- viewports: Viewports;
110
- zoomConfig: ZoomConfig;
111
- setZoomConfig: (zoomConfig: ZoomConfig) => void;
112
- status: Status;
113
- setStatus: (status: Status) => void;
114
- iframe: IframeConfig;
115
- selectedItem?: G["UserData"]["content"][0] | null;
116
- setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
117
- getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
118
- onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
119
- metadata: Metadata;
120
- fields: FieldsSlice;
121
- history: HistorySlice;
122
- nodes: NodesSlice;
123
- permissions: PermissionsSlice;
124
- fieldTransforms: FieldTransforms;
125
- currentRichText?: {
126
- inlineComponentId?: string;
127
- inline: boolean;
128
- field: RichtextField;
129
- editor: Editor;
130
- id: string;
131
- } | null;
132
- };
133
-
134
24
  declare const ActionBar: {
135
25
  ({ label, children, }: {
136
26
  label?: string;
@@ -395,4 +285,4 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
395
285
  */
396
286
  declare function useGetPuck(): () => UsePuckStore<Config>;
397
287
 
398
- 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, RichTextMenu, RichtextField, RootDataWithProps, Separator, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
288
+ export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
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 RichtextField, i as Field, j as FieldProps, D as DropZoneProps, k as Data, l as OnAction, n as InitialHistory, o as ItemSelector } from './walk-tree-Ja9bNCM9.js';
2
- export { af as Adaptor, ad as ArrayField, G as ArrayState, at as AsFieldProps, Z as BaseData, a7 as BaseField, ah as CacheOpts, L as ComponentConfigExtensions, Y as ComponentConfigParams, a2 as ComponentDataMap, a0 as ComponentDataOptionalId, a5 as ComponentMetadata, X as ConfigParams, a3 as Content, ak as CustomField, aj as CustomFieldRender, aq as DefaultComponentProps, Q as DefaultComponents, an as DefaultRootFieldProps, ap as DefaultRootProps, ao as DefaultRootRenderProps, q as Direction, s as DragAxis, ai as ExternalField, ag as ExternalFieldWithAdaptor, T as ExtractConfigParams, av as ExtractField, a6 as FieldMetadata, B as FieldRenderFunctions, x as FieldTransformFn, v as FieldTransformFnParams, E as ItemWithId, a1 as MappedItem, a9 as NumberField, ae as ObjectField, z as OverrideKey, K as PuckComponent, am as PuckContext, a4 as PuckMetadata, ac as RadioField, p as RichText, N as RootConfig, $ as RootData, _ as RootDataWithoutProps, ab as SelectField, S as Slot, J as SlotComponent, al as SlotField, a8 as TextField, aa as TextareaField, u as Viewport, au as WithChildren, ar as WithId, as as WithPuckProps, W as WithSlotProps, m as migrate, y as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Ja9bNCM9.js';
1
+ import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, t as ItemSelector, c as ComponentData } from './actions-ONhOkrvf.js';
2
+ export { af as Adaptor, A as AppState, ad as ArrayField, L as ArrayState, aq as AsFieldProps, $ as BaseData, a7 as BaseField, ah as CacheOpts, m as ComponentConfig, T as ComponentConfigExtensions, _ as ComponentConfigParams, a3 as ComponentDataMap, a1 as ComponentDataOptionalId, a5 as ComponentMetadata, Z as ConfigParams, b as Content, ak as CustomField, aj as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, ao as DefaultRootProps, an as DefaultRootRenderProps, w as Direction, x as DragAxis, ai as ExternalField, ag as ExternalFieldWithAdaptor, Y as ExtractConfigParams, as as ExtractField, a6 as FieldMetadata, J as FieldRenderFunctions, B as FieldTransformFn, z as FieldTransformFnParams, F as Fields, H as History, K as ItemWithId, a2 as MappedItem, a9 as NumberField, ae as ObjectField, G as OverrideKey, Q as PuckComponent, am as PuckContext, a4 as PuckMetadata, ac as RadioField, i as ResolveDataTrigger, v as RichText, o as RichtextField, X as RootConfig, R as RootData, h as RootDataWithProps, a0 as RootDataWithoutProps, ab as SelectField, S as Slot, N as SlotComponent, al as SlotField, a8 as TextField, aa as TextareaField, y as Viewport, ar as WithChildren, W as WithId, ap as WithPuckProps, u as WithSlotProps, E as overrideKeys } from './actions-ONhOkrvf.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DHbAZ4wF.js';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import * as react from 'react';
5
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
6
- import { Editor } from '@tiptap/react';
7
+ import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-BEoNHRI1.js';
8
+ import '@tiptap/react';
7
9
  import '@tiptap/extension-blockquote';
8
10
  import '@tiptap/extension-bold';
9
11
  import '@tiptap/extension-code';
@@ -19,118 +21,6 @@ import '@tiptap/extension-strike';
19
21
  import '@tiptap/extension-text-align';
20
22
  import '@tiptap/extension-underline';
21
23
 
22
- type HistorySlice<D = any> = {
23
- index: number;
24
- hasPast: () => boolean;
25
- hasFuture: () => boolean;
26
- histories: History<D>[];
27
- record: (data: D) => void;
28
- back: VoidFunction;
29
- forward: VoidFunction;
30
- currentHistory: () => History;
31
- nextHistory: () => History<D> | null;
32
- prevHistory: () => History<D> | null;
33
- setHistories: (histories: History[]) => void;
34
- setHistoryIndex: (index: number) => void;
35
- initialAppState: D;
36
- };
37
-
38
- type NodeMethods = {
39
- sync: () => void;
40
- hideOverlay: () => void;
41
- showOverlay: () => void;
42
- };
43
- type PuckNodeInstance = {
44
- id: string;
45
- methods: NodeMethods;
46
- element: HTMLElement | null;
47
- };
48
- type NodesSlice = {
49
- nodes: Record<string, PuckNodeInstance | undefined>;
50
- registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
51
- unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
52
- };
53
-
54
- type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
55
- item?: G["UserComponentData"] | null;
56
- type?: keyof G["UserProps"];
57
- root?: boolean;
58
- };
59
- type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
60
- type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
61
- type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
62
- type Cache = Record<string, {
63
- lastPermissions: Partial<Permissions>;
64
- lastData: ComponentData | null;
65
- lastParentId: string | null;
66
- }>;
67
- type PermissionsSlice = {
68
- cache: Cache;
69
- globalPermissions: Permissions;
70
- resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
71
- getPermissions: GetPermissions<Config>;
72
- resolvePermissions: ResolvePermissions<Config>;
73
- refreshPermissions: RefreshPermissions<Config>;
74
- };
75
-
76
- type ComponentOrRootData = Omit<ComponentData<any>, "type">;
77
- type FieldsSlice = {
78
- fields: Fields | Partial<Fields>;
79
- loading: boolean;
80
- lastResolvedData: Partial<ComponentOrRootData>;
81
- id: string | undefined;
82
- };
83
-
84
- type Status = "LOADING" | "MOUNTED" | "READY";
85
- type ZoomConfig = {
86
- autoZoom: number;
87
- rootHeight: number;
88
- zoom: number;
89
- };
90
- type ComponentState = Record<string, {
91
- loadingCount: number;
92
- }>;
93
- type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
94
- state: G["UserAppState"];
95
- dispatch: (action: PuckAction) => void;
96
- config: UserConfig;
97
- componentState: ComponentState;
98
- setComponentState: (componentState: ComponentState) => void;
99
- setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
100
- unsetComponentLoading: (id: string) => void;
101
- pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
102
- resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
103
- node: T;
104
- didChange: boolean;
105
- }>;
106
- resolveAndCommitData: () => void;
107
- plugins: Plugin[];
108
- overrides: Partial<Overrides>;
109
- viewports: Viewports;
110
- zoomConfig: ZoomConfig;
111
- setZoomConfig: (zoomConfig: ZoomConfig) => void;
112
- status: Status;
113
- setStatus: (status: Status) => void;
114
- iframe: IframeConfig;
115
- selectedItem?: G["UserData"]["content"][0] | null;
116
- setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
117
- getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
118
- onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
119
- metadata: Metadata;
120
- fields: FieldsSlice;
121
- history: HistorySlice;
122
- nodes: NodesSlice;
123
- permissions: PermissionsSlice;
124
- fieldTransforms: FieldTransforms;
125
- currentRichText?: {
126
- inlineComponentId?: string;
127
- inline: boolean;
128
- field: RichtextField;
129
- editor: Editor;
130
- id: string;
131
- } | null;
132
- };
133
-
134
24
  declare const ActionBar: {
135
25
  ({ label, children, }: {
136
26
  label?: string;
@@ -395,4 +285,4 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
395
285
  */
396
286
  declare function useGetPuck(): () => UsePuckStore<Config>;
397
287
 
398
- 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, RichTextMenu, RichtextField, RootDataWithProps, Separator, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
288
+ export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };