@measured/puck 0.21.0-canary.f3ce0d72 → 0.21.0-canary.fee2ba98
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/Editor-EHVB6NFF.mjs +204 -0
- package/dist/Editor-F2LSS6SE.css +403 -0
- package/dist/Render-OFE6QLI2.mjs +55 -0
- package/dist/Render-QEMDIDQC.css +101 -0
- package/dist/{walk-tree-CL-j099F.d.mts → actions-DwdqNb63.d.mts} +216 -52
- package/dist/{walk-tree-CL-j099F.d.ts → actions-DwdqNb63.d.ts} +216 -52
- package/dist/chunk-2334PLLL.mjs +111 -0
- package/dist/chunk-4N3WJM5Y.mjs +33 -0
- package/dist/{chunk-73365SXB.mjs → chunk-6AGLD64M.mjs} +5492 -7477
- package/dist/chunk-CSSRLPHM.mjs +11 -0
- package/dist/chunk-D6RJOV2Z.mjs +1727 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-NLUHDYVR.mjs +416 -0
- package/dist/chunk-NQEE2254.mjs +706 -0
- package/dist/chunk-PXYVL42X.mjs +53 -0
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/chunk-QLQZDFXM.mjs +63 -0
- package/dist/chunk-T3WX7XJ6.mjs +132 -0
- package/dist/chunk-V5I7CVLT.mjs +103 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/chunk-Y656T6AQ.mjs +419 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-TVZATY2K.mjs +93 -0
- package/dist/index-AfAtzigt.d.ts +117 -0
- package/dist/index-jxA1wrW4.d.mts +117 -0
- package/dist/index.css +636 -759
- package/dist/index.d.mts +100 -133
- package/dist/index.d.ts +100 -133
- package/dist/index.js +8328 -5321
- package/dist/index.mjs +26 -20
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +908 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-ICVILKS6.mjs +60 -0
- package/dist/loaded-IHAGHNLA.mjs +57 -0
- package/dist/loaded-ONU7LATV.mjs +57 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.css +736 -855
- package/dist/no-external.d.mts +19 -2
- package/dist/no-external.d.ts +19 -2
- package/dist/no-external.js +8331 -5321
- package/dist/no-external.mjs +28 -17
- package/dist/rsc.css +101 -0
- package/dist/rsc.d.mts +17 -2
- package/dist/rsc.d.ts +17 -2
- package/dist/rsc.js +411 -26
- package/dist/rsc.mjs +18 -9
- package/dist/walk-tree-DRy9ca1P.d.ts +29 -0
- package/dist/walk-tree-Dppc3XGY.d.mts +29 -0
- package/package.json +31 -4
- package/dist/chunk-FY5AZKYD.mjs +0 -967
package/dist/index.d.mts
CHANGED
|
@@ -1,130 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { af as Adaptor, ad as ArrayField,
|
|
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-DwdqNb63.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-DwdqNb63.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Dppc3XGY.mjs';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import * as react from 'react';
|
|
5
|
-
import react__default, {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type NodeMethods = {
|
|
24
|
-
sync: () => void;
|
|
25
|
-
hideOverlay: () => void;
|
|
26
|
-
showOverlay: () => void;
|
|
27
|
-
};
|
|
28
|
-
type PuckNodeInstance = {
|
|
29
|
-
id: string;
|
|
30
|
-
methods: NodeMethods;
|
|
31
|
-
element: HTMLElement | null;
|
|
32
|
-
};
|
|
33
|
-
type NodesSlice = {
|
|
34
|
-
nodes: Record<string, PuckNodeInstance | undefined>;
|
|
35
|
-
registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
|
|
36
|
-
unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
40
|
-
item?: G["UserComponentData"] | null;
|
|
41
|
-
type?: keyof G["UserProps"];
|
|
42
|
-
root?: boolean;
|
|
43
|
-
};
|
|
44
|
-
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
45
|
-
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
46
|
-
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
47
|
-
type Cache = Record<string, {
|
|
48
|
-
lastPermissions: Partial<Permissions>;
|
|
49
|
-
lastData: ComponentData | null;
|
|
50
|
-
}>;
|
|
51
|
-
type PermissionsSlice = {
|
|
52
|
-
cache: Cache;
|
|
53
|
-
globalPermissions: Permissions;
|
|
54
|
-
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
55
|
-
getPermissions: GetPermissions<Config>;
|
|
56
|
-
resolvePermissions: ResolvePermissions<Config>;
|
|
57
|
-
refreshPermissions: RefreshPermissions<Config>;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
61
|
-
type FieldsSlice = {
|
|
62
|
-
fields: Fields | Partial<Fields>;
|
|
63
|
-
loading: boolean;
|
|
64
|
-
lastResolvedData: Partial<ComponentOrRootData>;
|
|
65
|
-
id: string | undefined;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
69
|
-
type ZoomConfig = {
|
|
70
|
-
autoZoom: number;
|
|
71
|
-
rootHeight: number;
|
|
72
|
-
zoom: number;
|
|
73
|
-
};
|
|
74
|
-
type ComponentState = Record<string, {
|
|
75
|
-
loadingCount: number;
|
|
76
|
-
}>;
|
|
77
|
-
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
78
|
-
instanceId: string;
|
|
79
|
-
state: G["UserAppState"];
|
|
80
|
-
dispatch: (action: PuckAction) => void;
|
|
81
|
-
config: UserConfig;
|
|
82
|
-
componentState: ComponentState;
|
|
83
|
-
setComponentState: (componentState: ComponentState) => void;
|
|
84
|
-
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
85
|
-
unsetComponentLoading: (id: string) => void;
|
|
86
|
-
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
87
|
-
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
88
|
-
node: T;
|
|
89
|
-
didChange: boolean;
|
|
90
|
-
}>;
|
|
91
|
-
resolveAndCommitData: () => void;
|
|
92
|
-
plugins: Plugin[];
|
|
93
|
-
overrides: Partial<Overrides>;
|
|
94
|
-
viewports: Viewports;
|
|
95
|
-
zoomConfig: ZoomConfig;
|
|
96
|
-
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
97
|
-
status: Status;
|
|
98
|
-
setStatus: (status: Status) => void;
|
|
99
|
-
iframe: IframeConfig;
|
|
100
|
-
selectedItem?: G["UserData"]["content"][0] | null;
|
|
101
|
-
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
102
|
-
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
103
|
-
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
104
|
-
metadata: Metadata;
|
|
105
|
-
fields: FieldsSlice;
|
|
106
|
-
history: HistorySlice;
|
|
107
|
-
nodes: NodesSlice;
|
|
108
|
-
permissions: PermissionsSlice;
|
|
109
|
-
fieldTransforms: FieldTransforms;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
type StateReducer<UserData extends Data = Data> = Reducer<PrivateAppState<UserData>, PuckAction>;
|
|
113
|
-
declare function createReducer<UserData extends Data>({ record, onAction, appStore, }: {
|
|
114
|
-
record?: (appState: AppState<UserData>) => void;
|
|
115
|
-
onAction?: OnAction<UserData>;
|
|
116
|
-
appStore: AppStore;
|
|
117
|
-
}): StateReducer<UserData>;
|
|
6
|
+
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
|
7
|
+
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-jxA1wrW4.mjs';
|
|
8
|
+
import '@tiptap/react';
|
|
9
|
+
import '@tiptap/extension-blockquote';
|
|
10
|
+
import '@tiptap/extension-bold';
|
|
11
|
+
import '@tiptap/extension-code';
|
|
12
|
+
import '@tiptap/extension-code-block';
|
|
13
|
+
import '@tiptap/extension-hard-break';
|
|
14
|
+
import '@tiptap/extension-heading';
|
|
15
|
+
import '@tiptap/extension-horizontal-rule';
|
|
16
|
+
import '@tiptap/extension-italic';
|
|
17
|
+
import '@tiptap/extension-link';
|
|
18
|
+
import '@tiptap/extension-list';
|
|
19
|
+
import '@tiptap/extension-paragraph';
|
|
20
|
+
import '@tiptap/extension-strike';
|
|
21
|
+
import '@tiptap/extension-text-align';
|
|
22
|
+
import '@tiptap/extension-underline';
|
|
118
23
|
|
|
119
24
|
declare const ActionBar: {
|
|
120
25
|
({ label, children, }: {
|
|
121
26
|
label?: string;
|
|
122
27
|
children?: ReactNode;
|
|
123
28
|
}): react_jsx_runtime.JSX.Element;
|
|
124
|
-
Action: ({ children, label, onClick, }: {
|
|
29
|
+
Action: ({ children, label, onClick, active, disabled, }: {
|
|
125
30
|
children: ReactNode;
|
|
126
31
|
label?: string;
|
|
127
32
|
onClick: (e: SyntheticEvent) => void;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
128
35
|
}) => react_jsx_runtime.JSX.Element;
|
|
129
36
|
Label: ({ label }: {
|
|
130
37
|
label: string;
|
|
@@ -132,11 +39,14 @@ declare const ActionBar: {
|
|
|
132
39
|
Group: ({ children }: {
|
|
133
40
|
children: ReactNode;
|
|
134
41
|
}) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
Separator: () => react_jsx_runtime.JSX.Element;
|
|
135
43
|
};
|
|
136
|
-
declare const Action: ({ children, label, onClick, }: {
|
|
44
|
+
declare const Action: ({ children, label, onClick, active, disabled, }: {
|
|
137
45
|
children: ReactNode;
|
|
138
46
|
label?: string;
|
|
139
47
|
onClick: (e: SyntheticEvent) => void;
|
|
48
|
+
active?: boolean;
|
|
49
|
+
disabled?: boolean;
|
|
140
50
|
}) => react_jsx_runtime.JSX.Element;
|
|
141
51
|
declare const Group: ({ children }: {
|
|
142
52
|
children: ReactNode;
|
|
@@ -144,6 +54,7 @@ declare const Group: ({ children }: {
|
|
|
144
54
|
declare const Label: ({ label }: {
|
|
145
55
|
label: string;
|
|
146
56
|
}) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare const Separator: () => react_jsx_runtime.JSX.Element;
|
|
147
58
|
|
|
148
59
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
|
149
60
|
children?: ReactNode;
|
|
@@ -153,8 +64,11 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
|
153
64
|
readOnly?: boolean;
|
|
154
65
|
className?: string;
|
|
155
66
|
}) => react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
156
68
|
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
|
157
|
-
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType>
|
|
69
|
+
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType> & {
|
|
70
|
+
value: any;
|
|
71
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
158
72
|
|
|
159
73
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
160
74
|
children: ReactNode;
|
|
@@ -190,20 +104,19 @@ declare const Drawer: {
|
|
|
190
104
|
}) => react_jsx_runtime.JSX.Element;
|
|
191
105
|
};
|
|
192
106
|
|
|
193
|
-
declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
194
108
|
|
|
195
|
-
declare const IconButton: ({ children, href, onClick,
|
|
109
|
+
declare const IconButton: ({ active, children, href, onClick, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
|
110
|
+
active?: boolean;
|
|
196
111
|
children: ReactNode;
|
|
197
112
|
href?: string;
|
|
198
113
|
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
|
199
|
-
variant?: "primary" | "secondary";
|
|
200
114
|
type?: "button" | "submit" | "reset";
|
|
201
115
|
disabled?: boolean;
|
|
202
116
|
tabIndex?: number;
|
|
203
117
|
newTab?: boolean;
|
|
204
118
|
fullWidth?: boolean;
|
|
205
119
|
title: string;
|
|
206
|
-
suppressHydrationWarning?: boolean;
|
|
207
120
|
}) => react_jsx_runtime.JSX.Element;
|
|
208
121
|
|
|
209
122
|
type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
@@ -236,8 +149,6 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
|
|
|
236
149
|
};
|
|
237
150
|
initialHistory?: InitialHistory;
|
|
238
151
|
metadata?: Metadata;
|
|
239
|
-
height?: CSSProperties["height"];
|
|
240
|
-
_experimentalFullScreenCanvas?: boolean;
|
|
241
152
|
};
|
|
242
153
|
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
|
243
154
|
declare namespace Puck {
|
|
@@ -262,6 +173,69 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
|
262
173
|
metadata?: Metadata;
|
|
263
174
|
}): react_jsx_runtime.JSX.Element;
|
|
264
175
|
|
|
176
|
+
declare function AlignLeft(): react_jsx_runtime.JSX.Element;
|
|
177
|
+
|
|
178
|
+
declare function AlignCenter(): react_jsx_runtime.JSX.Element;
|
|
179
|
+
|
|
180
|
+
declare function AlignRight(): react_jsx_runtime.JSX.Element;
|
|
181
|
+
|
|
182
|
+
declare function AlignJustify(): react_jsx_runtime.JSX.Element;
|
|
183
|
+
|
|
184
|
+
declare function Bold(): react_jsx_runtime.JSX.Element;
|
|
185
|
+
|
|
186
|
+
declare function Italic(): react_jsx_runtime.JSX.Element;
|
|
187
|
+
|
|
188
|
+
declare function Underline(): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
declare function Strikethrough(): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
declare function InlineCode(): react_jsx_runtime.JSX.Element;
|
|
193
|
+
|
|
194
|
+
declare function BulletList(): react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
declare function OrderedList(): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
declare function CodeBlock(): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
declare function Blockquote(): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
declare function HorizontalRule(): react_jsx_runtime.JSX.Element;
|
|
203
|
+
|
|
204
|
+
declare function Control({ icon, disabled, active, onClick, title, }: {
|
|
205
|
+
icon: ReactNode;
|
|
206
|
+
disabled?: boolean;
|
|
207
|
+
active?: boolean;
|
|
208
|
+
onClick: (e: SyntheticEvent) => any;
|
|
209
|
+
title: string;
|
|
210
|
+
}): react_jsx_runtime.JSX.Element;
|
|
211
|
+
|
|
212
|
+
declare const RichTextMenu: {
|
|
213
|
+
({ children }: {
|
|
214
|
+
children: ReactNode;
|
|
215
|
+
}): react_jsx_runtime.JSX.Element;
|
|
216
|
+
Group: ({ children }: {
|
|
217
|
+
children: ReactNode;
|
|
218
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
219
|
+
Control: typeof Control;
|
|
220
|
+
AlignCenter: typeof AlignCenter;
|
|
221
|
+
AlignJustify: typeof AlignJustify;
|
|
222
|
+
AlignLeft: typeof AlignLeft;
|
|
223
|
+
AlignRight: typeof AlignRight;
|
|
224
|
+
AlignSelect: () => react_jsx_runtime.JSX.Element;
|
|
225
|
+
Blockquote: typeof Blockquote;
|
|
226
|
+
Bold: typeof Bold;
|
|
227
|
+
BulletList: typeof BulletList;
|
|
228
|
+
CodeBlock: typeof CodeBlock;
|
|
229
|
+
HeadingSelect: () => react_jsx_runtime.JSX.Element;
|
|
230
|
+
HorizontalRule: typeof HorizontalRule;
|
|
231
|
+
InlineCode: typeof InlineCode;
|
|
232
|
+
Italic: typeof Italic;
|
|
233
|
+
ListSelect: () => react_jsx_runtime.JSX.Element;
|
|
234
|
+
OrderedList: typeof OrderedList;
|
|
235
|
+
Strikethrough: typeof Strikethrough;
|
|
236
|
+
Underline: typeof Underline;
|
|
237
|
+
};
|
|
238
|
+
|
|
265
239
|
declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
|
|
266
240
|
disableDrag?: boolean;
|
|
267
241
|
disableDragOnFocus?: boolean;
|
|
@@ -282,6 +256,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
282
256
|
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
283
257
|
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
284
258
|
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
259
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
285
260
|
history: {
|
|
286
261
|
back: HistorySlice["back"];
|
|
287
262
|
forward: HistorySlice["forward"];
|
|
@@ -313,12 +288,4 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
|
|
|
313
288
|
*/
|
|
314
289
|
declare function useGetPuck(): () => UsePuckStore<Config>;
|
|
315
290
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
declare const fieldsPlugin: (params?: {
|
|
319
|
-
mobileOnly?: boolean;
|
|
320
|
-
}) => PluginInternal;
|
|
321
|
-
|
|
322
|
-
declare const outlinePlugin: () => Plugin;
|
|
323
|
-
|
|
324
|
-
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, createReducer, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
|
|
291
|
+
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,130 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { af as Adaptor, ad as ArrayField,
|
|
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-DwdqNb63.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-DwdqNb63.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DRy9ca1P.js';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import * as react from 'react';
|
|
5
|
-
import react__default, {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type NodeMethods = {
|
|
24
|
-
sync: () => void;
|
|
25
|
-
hideOverlay: () => void;
|
|
26
|
-
showOverlay: () => void;
|
|
27
|
-
};
|
|
28
|
-
type PuckNodeInstance = {
|
|
29
|
-
id: string;
|
|
30
|
-
methods: NodeMethods;
|
|
31
|
-
element: HTMLElement | null;
|
|
32
|
-
};
|
|
33
|
-
type NodesSlice = {
|
|
34
|
-
nodes: Record<string, PuckNodeInstance | undefined>;
|
|
35
|
-
registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
|
|
36
|
-
unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
40
|
-
item?: G["UserComponentData"] | null;
|
|
41
|
-
type?: keyof G["UserProps"];
|
|
42
|
-
root?: boolean;
|
|
43
|
-
};
|
|
44
|
-
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
45
|
-
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
46
|
-
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
47
|
-
type Cache = Record<string, {
|
|
48
|
-
lastPermissions: Partial<Permissions>;
|
|
49
|
-
lastData: ComponentData | null;
|
|
50
|
-
}>;
|
|
51
|
-
type PermissionsSlice = {
|
|
52
|
-
cache: Cache;
|
|
53
|
-
globalPermissions: Permissions;
|
|
54
|
-
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
55
|
-
getPermissions: GetPermissions<Config>;
|
|
56
|
-
resolvePermissions: ResolvePermissions<Config>;
|
|
57
|
-
refreshPermissions: RefreshPermissions<Config>;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
61
|
-
type FieldsSlice = {
|
|
62
|
-
fields: Fields | Partial<Fields>;
|
|
63
|
-
loading: boolean;
|
|
64
|
-
lastResolvedData: Partial<ComponentOrRootData>;
|
|
65
|
-
id: string | undefined;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
69
|
-
type ZoomConfig = {
|
|
70
|
-
autoZoom: number;
|
|
71
|
-
rootHeight: number;
|
|
72
|
-
zoom: number;
|
|
73
|
-
};
|
|
74
|
-
type ComponentState = Record<string, {
|
|
75
|
-
loadingCount: number;
|
|
76
|
-
}>;
|
|
77
|
-
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
78
|
-
instanceId: string;
|
|
79
|
-
state: G["UserAppState"];
|
|
80
|
-
dispatch: (action: PuckAction) => void;
|
|
81
|
-
config: UserConfig;
|
|
82
|
-
componentState: ComponentState;
|
|
83
|
-
setComponentState: (componentState: ComponentState) => void;
|
|
84
|
-
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
85
|
-
unsetComponentLoading: (id: string) => void;
|
|
86
|
-
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
87
|
-
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
88
|
-
node: T;
|
|
89
|
-
didChange: boolean;
|
|
90
|
-
}>;
|
|
91
|
-
resolveAndCommitData: () => void;
|
|
92
|
-
plugins: Plugin[];
|
|
93
|
-
overrides: Partial<Overrides>;
|
|
94
|
-
viewports: Viewports;
|
|
95
|
-
zoomConfig: ZoomConfig;
|
|
96
|
-
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
97
|
-
status: Status;
|
|
98
|
-
setStatus: (status: Status) => void;
|
|
99
|
-
iframe: IframeConfig;
|
|
100
|
-
selectedItem?: G["UserData"]["content"][0] | null;
|
|
101
|
-
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
102
|
-
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
103
|
-
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
104
|
-
metadata: Metadata;
|
|
105
|
-
fields: FieldsSlice;
|
|
106
|
-
history: HistorySlice;
|
|
107
|
-
nodes: NodesSlice;
|
|
108
|
-
permissions: PermissionsSlice;
|
|
109
|
-
fieldTransforms: FieldTransforms;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
type StateReducer<UserData extends Data = Data> = Reducer<PrivateAppState<UserData>, PuckAction>;
|
|
113
|
-
declare function createReducer<UserData extends Data>({ record, onAction, appStore, }: {
|
|
114
|
-
record?: (appState: AppState<UserData>) => void;
|
|
115
|
-
onAction?: OnAction<UserData>;
|
|
116
|
-
appStore: AppStore;
|
|
117
|
-
}): StateReducer<UserData>;
|
|
6
|
+
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
|
7
|
+
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-AfAtzigt.js';
|
|
8
|
+
import '@tiptap/react';
|
|
9
|
+
import '@tiptap/extension-blockquote';
|
|
10
|
+
import '@tiptap/extension-bold';
|
|
11
|
+
import '@tiptap/extension-code';
|
|
12
|
+
import '@tiptap/extension-code-block';
|
|
13
|
+
import '@tiptap/extension-hard-break';
|
|
14
|
+
import '@tiptap/extension-heading';
|
|
15
|
+
import '@tiptap/extension-horizontal-rule';
|
|
16
|
+
import '@tiptap/extension-italic';
|
|
17
|
+
import '@tiptap/extension-link';
|
|
18
|
+
import '@tiptap/extension-list';
|
|
19
|
+
import '@tiptap/extension-paragraph';
|
|
20
|
+
import '@tiptap/extension-strike';
|
|
21
|
+
import '@tiptap/extension-text-align';
|
|
22
|
+
import '@tiptap/extension-underline';
|
|
118
23
|
|
|
119
24
|
declare const ActionBar: {
|
|
120
25
|
({ label, children, }: {
|
|
121
26
|
label?: string;
|
|
122
27
|
children?: ReactNode;
|
|
123
28
|
}): react_jsx_runtime.JSX.Element;
|
|
124
|
-
Action: ({ children, label, onClick, }: {
|
|
29
|
+
Action: ({ children, label, onClick, active, disabled, }: {
|
|
125
30
|
children: ReactNode;
|
|
126
31
|
label?: string;
|
|
127
32
|
onClick: (e: SyntheticEvent) => void;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
128
35
|
}) => react_jsx_runtime.JSX.Element;
|
|
129
36
|
Label: ({ label }: {
|
|
130
37
|
label: string;
|
|
@@ -132,11 +39,14 @@ declare const ActionBar: {
|
|
|
132
39
|
Group: ({ children }: {
|
|
133
40
|
children: ReactNode;
|
|
134
41
|
}) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
Separator: () => react_jsx_runtime.JSX.Element;
|
|
135
43
|
};
|
|
136
|
-
declare const Action: ({ children, label, onClick, }: {
|
|
44
|
+
declare const Action: ({ children, label, onClick, active, disabled, }: {
|
|
137
45
|
children: ReactNode;
|
|
138
46
|
label?: string;
|
|
139
47
|
onClick: (e: SyntheticEvent) => void;
|
|
48
|
+
active?: boolean;
|
|
49
|
+
disabled?: boolean;
|
|
140
50
|
}) => react_jsx_runtime.JSX.Element;
|
|
141
51
|
declare const Group: ({ children }: {
|
|
142
52
|
children: ReactNode;
|
|
@@ -144,6 +54,7 @@ declare const Group: ({ children }: {
|
|
|
144
54
|
declare const Label: ({ label }: {
|
|
145
55
|
label: string;
|
|
146
56
|
}) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare const Separator: () => react_jsx_runtime.JSX.Element;
|
|
147
58
|
|
|
148
59
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
|
149
60
|
children?: ReactNode;
|
|
@@ -153,8 +64,11 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
|
153
64
|
readOnly?: boolean;
|
|
154
65
|
className?: string;
|
|
155
66
|
}) => react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
156
68
|
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
|
157
|
-
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType>
|
|
69
|
+
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType> & {
|
|
70
|
+
value: any;
|
|
71
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
158
72
|
|
|
159
73
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
160
74
|
children: ReactNode;
|
|
@@ -190,20 +104,19 @@ declare const Drawer: {
|
|
|
190
104
|
}) => react_jsx_runtime.JSX.Element;
|
|
191
105
|
};
|
|
192
106
|
|
|
193
|
-
declare const DropZone: react.ForwardRefExoticComponent<DropZoneProps & react.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
194
108
|
|
|
195
|
-
declare const IconButton: ({ children, href, onClick,
|
|
109
|
+
declare const IconButton: ({ active, children, href, onClick, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
|
110
|
+
active?: boolean;
|
|
196
111
|
children: ReactNode;
|
|
197
112
|
href?: string;
|
|
198
113
|
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
|
199
|
-
variant?: "primary" | "secondary";
|
|
200
114
|
type?: "button" | "submit" | "reset";
|
|
201
115
|
disabled?: boolean;
|
|
202
116
|
tabIndex?: number;
|
|
203
117
|
newTab?: boolean;
|
|
204
118
|
fullWidth?: boolean;
|
|
205
119
|
title: string;
|
|
206
|
-
suppressHydrationWarning?: boolean;
|
|
207
120
|
}) => react_jsx_runtime.JSX.Element;
|
|
208
121
|
|
|
209
122
|
type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
@@ -236,8 +149,6 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
|
|
|
236
149
|
};
|
|
237
150
|
initialHistory?: InitialHistory;
|
|
238
151
|
metadata?: Metadata;
|
|
239
|
-
height?: CSSProperties["height"];
|
|
240
|
-
_experimentalFullScreenCanvas?: boolean;
|
|
241
152
|
};
|
|
242
153
|
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
|
243
154
|
declare namespace Puck {
|
|
@@ -262,6 +173,69 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
|
262
173
|
metadata?: Metadata;
|
|
263
174
|
}): react_jsx_runtime.JSX.Element;
|
|
264
175
|
|
|
176
|
+
declare function AlignLeft(): react_jsx_runtime.JSX.Element;
|
|
177
|
+
|
|
178
|
+
declare function AlignCenter(): react_jsx_runtime.JSX.Element;
|
|
179
|
+
|
|
180
|
+
declare function AlignRight(): react_jsx_runtime.JSX.Element;
|
|
181
|
+
|
|
182
|
+
declare function AlignJustify(): react_jsx_runtime.JSX.Element;
|
|
183
|
+
|
|
184
|
+
declare function Bold(): react_jsx_runtime.JSX.Element;
|
|
185
|
+
|
|
186
|
+
declare function Italic(): react_jsx_runtime.JSX.Element;
|
|
187
|
+
|
|
188
|
+
declare function Underline(): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
declare function Strikethrough(): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
declare function InlineCode(): react_jsx_runtime.JSX.Element;
|
|
193
|
+
|
|
194
|
+
declare function BulletList(): react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
declare function OrderedList(): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
declare function CodeBlock(): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
declare function Blockquote(): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
declare function HorizontalRule(): react_jsx_runtime.JSX.Element;
|
|
203
|
+
|
|
204
|
+
declare function Control({ icon, disabled, active, onClick, title, }: {
|
|
205
|
+
icon: ReactNode;
|
|
206
|
+
disabled?: boolean;
|
|
207
|
+
active?: boolean;
|
|
208
|
+
onClick: (e: SyntheticEvent) => any;
|
|
209
|
+
title: string;
|
|
210
|
+
}): react_jsx_runtime.JSX.Element;
|
|
211
|
+
|
|
212
|
+
declare const RichTextMenu: {
|
|
213
|
+
({ children }: {
|
|
214
|
+
children: ReactNode;
|
|
215
|
+
}): react_jsx_runtime.JSX.Element;
|
|
216
|
+
Group: ({ children }: {
|
|
217
|
+
children: ReactNode;
|
|
218
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
219
|
+
Control: typeof Control;
|
|
220
|
+
AlignCenter: typeof AlignCenter;
|
|
221
|
+
AlignJustify: typeof AlignJustify;
|
|
222
|
+
AlignLeft: typeof AlignLeft;
|
|
223
|
+
AlignRight: typeof AlignRight;
|
|
224
|
+
AlignSelect: () => react_jsx_runtime.JSX.Element;
|
|
225
|
+
Blockquote: typeof Blockquote;
|
|
226
|
+
Bold: typeof Bold;
|
|
227
|
+
BulletList: typeof BulletList;
|
|
228
|
+
CodeBlock: typeof CodeBlock;
|
|
229
|
+
HeadingSelect: () => react_jsx_runtime.JSX.Element;
|
|
230
|
+
HorizontalRule: typeof HorizontalRule;
|
|
231
|
+
InlineCode: typeof InlineCode;
|
|
232
|
+
Italic: typeof Italic;
|
|
233
|
+
ListSelect: () => react_jsx_runtime.JSX.Element;
|
|
234
|
+
OrderedList: typeof OrderedList;
|
|
235
|
+
Strikethrough: typeof Strikethrough;
|
|
236
|
+
Underline: typeof Underline;
|
|
237
|
+
};
|
|
238
|
+
|
|
265
239
|
declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
|
|
266
240
|
disableDrag?: boolean;
|
|
267
241
|
disableDragOnFocus?: boolean;
|
|
@@ -282,6 +256,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
282
256
|
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
283
257
|
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
284
258
|
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
259
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
285
260
|
history: {
|
|
286
261
|
back: HistorySlice["back"];
|
|
287
262
|
forward: HistorySlice["forward"];
|
|
@@ -313,12 +288,4 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
|
|
|
313
288
|
*/
|
|
314
289
|
declare function useGetPuck(): () => UsePuckStore<Config>;
|
|
315
290
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
declare const fieldsPlugin: (params?: {
|
|
319
|
-
mobileOnly?: boolean;
|
|
320
|
-
}) => PluginInternal;
|
|
321
|
-
|
|
322
|
-
declare const outlinePlugin: () => Plugin;
|
|
323
|
-
|
|
324
|
-
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, createReducer, createUsePuck, fieldsPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
|
|
291
|
+
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 };
|