@measured/puck 0.16.0-canary.f761e5f → 0.16.0-canary.fc564d7
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/{actions-DDAd8cys.d.mts → actions-9pHbVtMU.d.mts} +32 -7
- package/dist/{actions-DDAd8cys.d.ts → actions-9pHbVtMU.d.ts} +32 -7
- package/dist/index.css +96 -77
- package/dist/index.d.mts +48 -50
- package/dist/index.d.ts +48 -50
- package/dist/index.js +817 -676
- package/dist/index.mjs +790 -650
- package/dist/rsc.d.mts +1 -1
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps,
|
2
|
-
export {
|
1
|
+
import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, k as ComponentData, H as History, A as AppState, E as ExtractPropsFromConfig, l as ExtractRootPropsFromConfig, m as ComponentDataMap } from './actions-9pHbVtMU.mjs';
|
2
|
+
export { L as Adaptor, J as ArrayField, s as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, u as ComponentConfig, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Y as Fields, r as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, p as OverrideKey, t as PuckComponent, Z as PuckContext, G as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, n as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys } from './actions-9pHbVtMU.mjs';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
@@ -15,12 +15,18 @@ declare const ActionBar: {
|
|
15
15
|
label?: string;
|
16
16
|
onClick: (e: SyntheticEvent) => void;
|
17
17
|
}) => react_jsx_runtime.JSX.Element;
|
18
|
+
Group: ({ children }: {
|
19
|
+
children: ReactNode;
|
20
|
+
}) => react_jsx_runtime.JSX.Element;
|
18
21
|
};
|
19
22
|
declare const Action: ({ children, label, onClick, }: {
|
20
23
|
children: ReactNode;
|
21
24
|
label?: string;
|
22
25
|
onClick: (e: SyntheticEvent) => void;
|
23
26
|
}) => react_jsx_runtime.JSX.Element;
|
27
|
+
declare const Group: ({ children }: {
|
28
|
+
children: ReactNode;
|
29
|
+
}) => react_jsx_runtime.JSX.Element;
|
24
30
|
|
25
31
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
26
32
|
children?: ReactNode;
|
@@ -88,25 +94,6 @@ declare const Drawer: {
|
|
88
94
|
}) => react_jsx_runtime.JSX.Element;
|
89
95
|
};
|
90
96
|
|
91
|
-
type History<D = any> = {
|
92
|
-
id: string;
|
93
|
-
data: D;
|
94
|
-
};
|
95
|
-
type HistoryStore<D = any> = {
|
96
|
-
index: number;
|
97
|
-
hasPast: boolean;
|
98
|
-
hasFuture: boolean;
|
99
|
-
histories: History<D>[];
|
100
|
-
record: (data: D) => void;
|
101
|
-
back: VoidFunction;
|
102
|
-
forward: VoidFunction;
|
103
|
-
currentHistory: History;
|
104
|
-
nextHistory: History<D> | null;
|
105
|
-
prevHistory: History<D> | null;
|
106
|
-
setHistories: (histories: History[]) => void;
|
107
|
-
setHistoryIndex: (index: number) => void;
|
108
|
-
};
|
109
|
-
|
110
97
|
type PathData = Record<string, {
|
111
98
|
path: string[];
|
112
99
|
label: string;
|
@@ -159,24 +146,24 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
159
146
|
title: string;
|
160
147
|
}) => react_jsx_runtime.JSX.Element;
|
161
148
|
|
162
|
-
declare function Puck<UserConfig extends Config = Config,
|
149
|
+
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe: _iframe, dnd, initialHistory: _initialHistory, }: {
|
163
150
|
children?: ReactNode;
|
164
151
|
config: UserConfig;
|
165
|
-
data: Partial<UserData>;
|
152
|
+
data: Partial<G["UserData"] | Data>;
|
166
153
|
ui?: Partial<UiState>;
|
167
|
-
onChange?: (data: UserData) => void;
|
168
|
-
onPublish?: (data: UserData) => void;
|
169
|
-
onAction?: OnAction<UserData>;
|
154
|
+
onChange?: (data: G["UserData"]) => void;
|
155
|
+
onPublish?: (data: G["UserData"]) => void;
|
156
|
+
onAction?: OnAction<G["UserData"]>;
|
170
157
|
permissions?: Partial<Permissions>;
|
171
158
|
plugins?: Plugin[];
|
172
159
|
overrides?: Partial<Overrides>;
|
173
160
|
renderHeader?: (props: {
|
174
161
|
children: ReactNode;
|
175
162
|
dispatch: (action: PuckAction) => void;
|
176
|
-
state:
|
163
|
+
state: G["UserAppState"];
|
177
164
|
}) => ReactElement;
|
178
165
|
renderHeaderActions?: (props: {
|
179
|
-
state:
|
166
|
+
state: G["UserAppState"];
|
180
167
|
dispatch: (action: PuckAction) => void;
|
181
168
|
}) => ReactElement;
|
182
169
|
headerTitle?: string;
|
@@ -186,10 +173,7 @@ declare function Puck<UserConfig extends Config = Config, UserProps extends Extr
|
|
186
173
|
dnd?: {
|
187
174
|
disableAutoScroll?: boolean;
|
188
175
|
};
|
189
|
-
initialHistory?:
|
190
|
-
histories: History<any>[];
|
191
|
-
index: number;
|
192
|
-
};
|
176
|
+
initialHistory?: InitialHistory;
|
193
177
|
}): react_jsx_runtime.JSX.Element;
|
194
178
|
declare namespace Puck {
|
195
179
|
var Components: () => react_jsx_runtime.JSX.Element;
|
@@ -200,9 +184,9 @@ declare namespace Puck {
|
|
200
184
|
}) => react_jsx_runtime.JSX.Element;
|
201
185
|
}
|
202
186
|
|
203
|
-
declare function Render<UserConfig extends Config = Config,
|
187
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, }: {
|
204
188
|
config: UserConfig;
|
205
|
-
data: Partial<UserData>;
|
189
|
+
data: Partial<G["UserData"] | Data>;
|
206
190
|
}): react_jsx_runtime.JSX.Element;
|
207
191
|
|
208
192
|
declare function migrate(data: Data): Data;
|
@@ -220,21 +204,35 @@ declare function transformProps<Props extends DefaultComponentProps = DefaultCom
|
|
220
204
|
|
221
205
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
222
206
|
|
223
|
-
|
224
|
-
|
225
|
-
|
207
|
+
type HistoryStore<D = any> = {
|
208
|
+
index: number;
|
209
|
+
hasPast: boolean;
|
210
|
+
hasFuture: boolean;
|
211
|
+
histories: History<D>[];
|
212
|
+
record: (data: D) => void;
|
213
|
+
back: VoidFunction;
|
214
|
+
forward: VoidFunction;
|
215
|
+
currentHistory: History;
|
216
|
+
nextHistory: History<D> | null;
|
217
|
+
prevHistory: History<D> | null;
|
218
|
+
setHistories: (histories: History[]) => void;
|
219
|
+
setHistoryIndex: (index: number) => void;
|
220
|
+
};
|
221
|
+
|
222
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
223
|
+
item?: G["UserComponentData"];
|
224
|
+
type?: keyof G["UserProps"];
|
225
|
+
root?: boolean;
|
226
|
+
};
|
227
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Partial<Permissions>;
|
228
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
229
|
+
|
230
|
+
declare const usePuck: <UserConfig extends Config = Config>() => {
|
231
|
+
appState: AppState<Data<ExtractPropsFromConfig<UserConfig>, ExtractRootPropsFromConfig<UserConfig>>>;
|
232
|
+
config: UserConfig;
|
226
233
|
dispatch: (action: PuckAction) => void;
|
227
|
-
getPermissions:
|
228
|
-
|
229
|
-
type?: keyof DefaultComponentProps;
|
230
|
-
}) => {
|
231
|
-
[x: string]: boolean | undefined;
|
232
|
-
drag?: boolean | undefined;
|
233
|
-
duplicate?: boolean | undefined;
|
234
|
-
delete?: boolean | undefined;
|
235
|
-
edit?: boolean | undefined;
|
236
|
-
insert?: boolean | undefined;
|
237
|
-
};
|
234
|
+
getPermissions: GetPermissions<UserConfig>;
|
235
|
+
refreshPermissions: RefreshPermissions<UserConfig>;
|
238
236
|
history: {
|
239
237
|
back: VoidFunction;
|
240
238
|
forward: VoidFunction;
|
@@ -246,7 +244,7 @@ declare const usePuck: () => {
|
|
246
244
|
index: number;
|
247
245
|
historyStore: HistoryStore | undefined;
|
248
246
|
};
|
249
|
-
selectedItem:
|
247
|
+
selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
|
250
248
|
};
|
251
249
|
|
252
|
-
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal,
|
250
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps,
|
2
|
-
export {
|
1
|
+
import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, k as ComponentData, H as History, A as AppState, E as ExtractPropsFromConfig, l as ExtractRootPropsFromConfig, m as ComponentDataMap } from './actions-9pHbVtMU.js';
|
2
|
+
export { L as Adaptor, J as ArrayField, s as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, u as ComponentConfig, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Y as Fields, r as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, p as OverrideKey, t as PuckComponent, Z as PuckContext, G as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, n as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys } from './actions-9pHbVtMU.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
@@ -15,12 +15,18 @@ declare const ActionBar: {
|
|
15
15
|
label?: string;
|
16
16
|
onClick: (e: SyntheticEvent) => void;
|
17
17
|
}) => react_jsx_runtime.JSX.Element;
|
18
|
+
Group: ({ children }: {
|
19
|
+
children: ReactNode;
|
20
|
+
}) => react_jsx_runtime.JSX.Element;
|
18
21
|
};
|
19
22
|
declare const Action: ({ children, label, onClick, }: {
|
20
23
|
children: ReactNode;
|
21
24
|
label?: string;
|
22
25
|
onClick: (e: SyntheticEvent) => void;
|
23
26
|
}) => react_jsx_runtime.JSX.Element;
|
27
|
+
declare const Group: ({ children }: {
|
28
|
+
children: ReactNode;
|
29
|
+
}) => react_jsx_runtime.JSX.Element;
|
24
30
|
|
25
31
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
26
32
|
children?: ReactNode;
|
@@ -88,25 +94,6 @@ declare const Drawer: {
|
|
88
94
|
}) => react_jsx_runtime.JSX.Element;
|
89
95
|
};
|
90
96
|
|
91
|
-
type History<D = any> = {
|
92
|
-
id: string;
|
93
|
-
data: D;
|
94
|
-
};
|
95
|
-
type HistoryStore<D = any> = {
|
96
|
-
index: number;
|
97
|
-
hasPast: boolean;
|
98
|
-
hasFuture: boolean;
|
99
|
-
histories: History<D>[];
|
100
|
-
record: (data: D) => void;
|
101
|
-
back: VoidFunction;
|
102
|
-
forward: VoidFunction;
|
103
|
-
currentHistory: History;
|
104
|
-
nextHistory: History<D> | null;
|
105
|
-
prevHistory: History<D> | null;
|
106
|
-
setHistories: (histories: History[]) => void;
|
107
|
-
setHistoryIndex: (index: number) => void;
|
108
|
-
};
|
109
|
-
|
110
97
|
type PathData = Record<string, {
|
111
98
|
path: string[];
|
112
99
|
label: string;
|
@@ -159,24 +146,24 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
159
146
|
title: string;
|
160
147
|
}) => react_jsx_runtime.JSX.Element;
|
161
148
|
|
162
|
-
declare function Puck<UserConfig extends Config = Config,
|
149
|
+
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe: _iframe, dnd, initialHistory: _initialHistory, }: {
|
163
150
|
children?: ReactNode;
|
164
151
|
config: UserConfig;
|
165
|
-
data: Partial<UserData>;
|
152
|
+
data: Partial<G["UserData"] | Data>;
|
166
153
|
ui?: Partial<UiState>;
|
167
|
-
onChange?: (data: UserData) => void;
|
168
|
-
onPublish?: (data: UserData) => void;
|
169
|
-
onAction?: OnAction<UserData>;
|
154
|
+
onChange?: (data: G["UserData"]) => void;
|
155
|
+
onPublish?: (data: G["UserData"]) => void;
|
156
|
+
onAction?: OnAction<G["UserData"]>;
|
170
157
|
permissions?: Partial<Permissions>;
|
171
158
|
plugins?: Plugin[];
|
172
159
|
overrides?: Partial<Overrides>;
|
173
160
|
renderHeader?: (props: {
|
174
161
|
children: ReactNode;
|
175
162
|
dispatch: (action: PuckAction) => void;
|
176
|
-
state:
|
163
|
+
state: G["UserAppState"];
|
177
164
|
}) => ReactElement;
|
178
165
|
renderHeaderActions?: (props: {
|
179
|
-
state:
|
166
|
+
state: G["UserAppState"];
|
180
167
|
dispatch: (action: PuckAction) => void;
|
181
168
|
}) => ReactElement;
|
182
169
|
headerTitle?: string;
|
@@ -186,10 +173,7 @@ declare function Puck<UserConfig extends Config = Config, UserProps extends Extr
|
|
186
173
|
dnd?: {
|
187
174
|
disableAutoScroll?: boolean;
|
188
175
|
};
|
189
|
-
initialHistory?:
|
190
|
-
histories: History<any>[];
|
191
|
-
index: number;
|
192
|
-
};
|
176
|
+
initialHistory?: InitialHistory;
|
193
177
|
}): react_jsx_runtime.JSX.Element;
|
194
178
|
declare namespace Puck {
|
195
179
|
var Components: () => react_jsx_runtime.JSX.Element;
|
@@ -200,9 +184,9 @@ declare namespace Puck {
|
|
200
184
|
}) => react_jsx_runtime.JSX.Element;
|
201
185
|
}
|
202
186
|
|
203
|
-
declare function Render<UserConfig extends Config = Config,
|
187
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, }: {
|
204
188
|
config: UserConfig;
|
205
|
-
data: Partial<UserData>;
|
189
|
+
data: Partial<G["UserData"] | Data>;
|
206
190
|
}): react_jsx_runtime.JSX.Element;
|
207
191
|
|
208
192
|
declare function migrate(data: Data): Data;
|
@@ -220,21 +204,35 @@ declare function transformProps<Props extends DefaultComponentProps = DefaultCom
|
|
220
204
|
|
221
205
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
222
206
|
|
223
|
-
|
224
|
-
|
225
|
-
|
207
|
+
type HistoryStore<D = any> = {
|
208
|
+
index: number;
|
209
|
+
hasPast: boolean;
|
210
|
+
hasFuture: boolean;
|
211
|
+
histories: History<D>[];
|
212
|
+
record: (data: D) => void;
|
213
|
+
back: VoidFunction;
|
214
|
+
forward: VoidFunction;
|
215
|
+
currentHistory: History;
|
216
|
+
nextHistory: History<D> | null;
|
217
|
+
prevHistory: History<D> | null;
|
218
|
+
setHistories: (histories: History[]) => void;
|
219
|
+
setHistoryIndex: (index: number) => void;
|
220
|
+
};
|
221
|
+
|
222
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
223
|
+
item?: G["UserComponentData"];
|
224
|
+
type?: keyof G["UserProps"];
|
225
|
+
root?: boolean;
|
226
|
+
};
|
227
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Partial<Permissions>;
|
228
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
229
|
+
|
230
|
+
declare const usePuck: <UserConfig extends Config = Config>() => {
|
231
|
+
appState: AppState<Data<ExtractPropsFromConfig<UserConfig>, ExtractRootPropsFromConfig<UserConfig>>>;
|
232
|
+
config: UserConfig;
|
226
233
|
dispatch: (action: PuckAction) => void;
|
227
|
-
getPermissions:
|
228
|
-
|
229
|
-
type?: keyof DefaultComponentProps;
|
230
|
-
}) => {
|
231
|
-
[x: string]: boolean | undefined;
|
232
|
-
drag?: boolean | undefined;
|
233
|
-
duplicate?: boolean | undefined;
|
234
|
-
delete?: boolean | undefined;
|
235
|
-
edit?: boolean | undefined;
|
236
|
-
insert?: boolean | undefined;
|
237
|
-
};
|
234
|
+
getPermissions: GetPermissions<UserConfig>;
|
235
|
+
refreshPermissions: RefreshPermissions<UserConfig>;
|
238
236
|
history: {
|
239
237
|
back: VoidFunction;
|
240
238
|
forward: VoidFunction;
|
@@ -246,7 +244,7 @@ declare const usePuck: () => {
|
|
246
244
|
index: number;
|
247
245
|
historyStore: HistoryStore | undefined;
|
248
246
|
};
|
249
|
-
selectedItem:
|
247
|
+
selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
|
250
248
|
};
|
251
249
|
|
252
|
-
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal,
|
250
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|