@measured/puck 0.21.0-canary.15fe8d60 → 0.21.0-canary.1d823fd9
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/{chunk-TC25DCTQ.mjs → chunk-MHKBV5D3.mjs} +568 -50
- package/dist/{chunk-JB4ZAK5S.mjs → chunk-SWIW6GHU.mjs} +2623 -2575
- package/dist/index.css +649 -270
- package/dist/index.d.mts +16 -109
- package/dist/index.d.ts +16 -109
- package/dist/index.js +2381 -1835
- package/dist/index.mjs +10 -2
- package/dist/no-external.css +649 -270
- package/dist/no-external.d.mts +2 -2
- package/dist/no-external.d.ts +2 -2
- package/dist/no-external.js +2381 -1835
- package/dist/no-external.mjs +10 -2
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +479 -2
- package/dist/rsc.mjs +3 -1
- package/dist/{walk-tree-BMbIeiqs.d.mts → walk-tree-CegGHme5.d.mts} +135 -9
- package/dist/{walk-tree-BMbIeiqs.d.ts → walk-tree-CegGHme5.d.ts} +135 -9
- package/package.json +1 -1
|
@@ -1,4 +1,65 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, JSX, Reducer } from 'react';
|
|
2
|
+
|
|
3
|
+
type HistorySlice<D = any> = {
|
|
4
|
+
index: number;
|
|
5
|
+
hasPast: () => boolean;
|
|
6
|
+
hasFuture: () => boolean;
|
|
7
|
+
histories: History<D>[];
|
|
8
|
+
record: (data: D) => void;
|
|
9
|
+
back: VoidFunction;
|
|
10
|
+
forward: VoidFunction;
|
|
11
|
+
currentHistory: () => History;
|
|
12
|
+
nextHistory: () => History<D> | null;
|
|
13
|
+
prevHistory: () => History<D> | null;
|
|
14
|
+
setHistories: (histories: History[]) => void;
|
|
15
|
+
setHistoryIndex: (index: number) => void;
|
|
16
|
+
initialAppState: D;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type NodeMethods = {
|
|
20
|
+
sync: () => void;
|
|
21
|
+
hideOverlay: () => void;
|
|
22
|
+
showOverlay: () => void;
|
|
23
|
+
};
|
|
24
|
+
type PuckNodeInstance = {
|
|
25
|
+
id: string;
|
|
26
|
+
methods: NodeMethods;
|
|
27
|
+
element: HTMLElement | null;
|
|
28
|
+
};
|
|
29
|
+
type NodesSlice = {
|
|
30
|
+
nodes: Record<string, PuckNodeInstance | undefined>;
|
|
31
|
+
registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
|
|
32
|
+
unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
36
|
+
item?: G["UserComponentData"] | null;
|
|
37
|
+
type?: keyof G["UserProps"];
|
|
38
|
+
root?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
41
|
+
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
42
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
43
|
+
type Cache = Record<string, {
|
|
44
|
+
lastPermissions: Partial<Permissions>;
|
|
45
|
+
lastData: ComponentData | null;
|
|
46
|
+
}>;
|
|
47
|
+
type PermissionsSlice = {
|
|
48
|
+
cache: Cache;
|
|
49
|
+
globalPermissions: Permissions;
|
|
50
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
51
|
+
getPermissions: GetPermissions<Config>;
|
|
52
|
+
resolvePermissions: ResolvePermissions<Config>;
|
|
53
|
+
refreshPermissions: RefreshPermissions<Config>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
57
|
+
type FieldsSlice = {
|
|
58
|
+
fields: Fields | Partial<Fields>;
|
|
59
|
+
loading: boolean;
|
|
60
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
|
61
|
+
id: string | undefined;
|
|
62
|
+
};
|
|
2
63
|
|
|
3
64
|
type ItemSelector = {
|
|
4
65
|
index: number;
|
|
@@ -118,6 +179,7 @@ interface CustomField<Value extends any> extends BaseField {
|
|
|
118
179
|
type: "custom";
|
|
119
180
|
render: CustomFieldRender<Value>;
|
|
120
181
|
contentEditable?: boolean;
|
|
182
|
+
key?: string;
|
|
121
183
|
}
|
|
122
184
|
interface SlotField extends BaseField {
|
|
123
185
|
type: "slot";
|
|
@@ -331,6 +393,7 @@ interface FieldMetadata extends Metadata {
|
|
|
331
393
|
type ItemWithId = {
|
|
332
394
|
_arrayId: string;
|
|
333
395
|
_originalIndex: number;
|
|
396
|
+
_currentIndex: number;
|
|
334
397
|
};
|
|
335
398
|
type ArrayState = {
|
|
336
399
|
items: ItemWithId[];
|
|
@@ -341,6 +404,7 @@ type UiState = {
|
|
|
341
404
|
rightSideBarVisible: boolean;
|
|
342
405
|
leftSideBarWidth?: number | null;
|
|
343
406
|
rightSideBarWidth?: number | null;
|
|
407
|
+
mobilePanelExpanded?: boolean;
|
|
344
408
|
itemSelector: ItemSelector | null;
|
|
345
409
|
arrayState: Record<string, ArrayState | undefined>;
|
|
346
410
|
previewMode: "interactive" | "edit";
|
|
@@ -353,7 +417,7 @@ type UiState = {
|
|
|
353
417
|
isDragging: boolean;
|
|
354
418
|
viewports: {
|
|
355
419
|
current: {
|
|
356
|
-
width: number;
|
|
420
|
+
width: number | "100%";
|
|
357
421
|
height: number | "auto";
|
|
358
422
|
};
|
|
359
423
|
controlsVisible: boolean;
|
|
@@ -362,6 +426,9 @@ type UiState = {
|
|
|
362
426
|
field: {
|
|
363
427
|
focus?: string | null;
|
|
364
428
|
};
|
|
429
|
+
plugin: {
|
|
430
|
+
current: string | null;
|
|
431
|
+
};
|
|
365
432
|
};
|
|
366
433
|
type AppState<UserData extends Data = Data> = {
|
|
367
434
|
data: UserData;
|
|
@@ -405,6 +472,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
405
472
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
406
473
|
never
|
|
407
474
|
] ? False : True;
|
|
475
|
+
type RenderFunc<Props extends {
|
|
476
|
+
[key: string]: any;
|
|
477
|
+
} = {
|
|
478
|
+
children: ReactNode;
|
|
479
|
+
}> = (props: Props) => ReactElement;
|
|
480
|
+
type PluginInternal = Plugin & {
|
|
481
|
+
mobileOnly?: boolean;
|
|
482
|
+
};
|
|
408
483
|
|
|
409
484
|
type MapFnParams<ThisField = Field> = {
|
|
410
485
|
value: any;
|
|
@@ -428,11 +503,57 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
428
503
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
429
504
|
}>;
|
|
430
505
|
|
|
431
|
-
type
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
506
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
507
|
+
type ZoomConfig = {
|
|
508
|
+
autoZoom: number;
|
|
509
|
+
rootHeight: number;
|
|
510
|
+
zoom: number;
|
|
511
|
+
};
|
|
512
|
+
type ComponentState = Record<string, {
|
|
513
|
+
loadingCount: number;
|
|
514
|
+
}>;
|
|
515
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
516
|
+
instanceId: string;
|
|
517
|
+
state: G["UserAppState"];
|
|
518
|
+
dispatch: (action: PuckAction) => void;
|
|
519
|
+
config: UserConfig;
|
|
520
|
+
componentState: ComponentState;
|
|
521
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
522
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
523
|
+
unsetComponentLoading: (id: string) => void;
|
|
524
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
525
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
526
|
+
node: T;
|
|
527
|
+
didChange: boolean;
|
|
528
|
+
}>;
|
|
529
|
+
resolveAndCommitData: () => void;
|
|
530
|
+
plugins: Plugin[];
|
|
531
|
+
overrides: Partial<Overrides>;
|
|
532
|
+
viewports: Viewports;
|
|
533
|
+
zoomConfig: ZoomConfig;
|
|
534
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
535
|
+
status: Status;
|
|
536
|
+
setStatus: (status: Status) => void;
|
|
537
|
+
iframe: IframeConfig;
|
|
538
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
539
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
540
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
541
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
542
|
+
metadata: Metadata;
|
|
543
|
+
fields: FieldsSlice;
|
|
544
|
+
history: HistorySlice;
|
|
545
|
+
nodes: NodesSlice;
|
|
546
|
+
permissions: PermissionsSlice;
|
|
547
|
+
fieldTransforms: FieldTransforms;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
type StateReducer<UserData extends Data = Data> = Reducer<PrivateAppState<UserData>, PuckAction>;
|
|
551
|
+
declare function createReducer<UserData extends Data>({ record, onAction, appStore, }: {
|
|
552
|
+
record?: (appState: AppState<UserData>) => void;
|
|
553
|
+
onAction?: OnAction<UserData>;
|
|
554
|
+
appStore: AppStore;
|
|
555
|
+
}): StateReducer<UserData>;
|
|
556
|
+
|
|
436
557
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
437
558
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
438
559
|
type OverridesGeneric<Shape extends {
|
|
@@ -504,7 +625,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
504
625
|
|
|
505
626
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
506
627
|
type Viewport = {
|
|
507
|
-
width: number;
|
|
628
|
+
width: number | "100%";
|
|
508
629
|
height?: number | "auto";
|
|
509
630
|
label?: string;
|
|
510
631
|
icon?: iconTypes | ReactNode;
|
|
@@ -524,8 +645,13 @@ type IframeConfig = {
|
|
|
524
645
|
};
|
|
525
646
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
526
647
|
type Plugin<UserConfig extends Config = Config> = {
|
|
648
|
+
name?: string;
|
|
649
|
+
label?: string;
|
|
650
|
+
icon?: ReactNode;
|
|
651
|
+
render?: () => ReactElement;
|
|
527
652
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
528
653
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
654
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
529
655
|
};
|
|
530
656
|
type History<D = any> = {
|
|
531
657
|
state: D;
|
|
@@ -643,4 +769,4 @@ type WalkTreeOptions = {
|
|
|
643
769
|
};
|
|
644
770
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
645
771
|
|
|
646
|
-
export { type
|
|
772
|
+
export { type RootDataWithProps as $, type AppStore as A, type AppState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Field as F, type GetPermissions as G, type HistorySlice as H, type IframeConfig as I, type PuckComponent as J, type ResolveDataTrigger as K, type ComponentConfigExtensions as L, type Metadata as M, type ComponentConfig as N, type OnAction as O, type Permissions as P, type RootConfig as Q, type RefreshPermissions as R, type Slot as S, type DefaultComponents as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ExtractConfigParams as X, type ConfigParams as Y, type ComponentConfigParams as Z, type BaseData as _, type FieldProps as a, type RootDataWithoutProps as a0, type RootData as a1, type ComponentData as a2, type ComponentDataOptionalId as a3, type MappedItem as a4, type ComponentDataMap as a5, type Content as a6, type PuckMetadata as a7, type ComponentMetadata as a8, type FieldMetadata as a9, type BaseField as aa, type TextField as ab, type NumberField as ac, type TextareaField as ad, type SelectField as ae, type RadioField as af, type ArrayField as ag, type ObjectField as ah, type Adaptor as ai, type ExternalFieldWithAdaptor as aj, type CacheOpts as ak, type ExternalField as al, type CustomFieldRender as am, type CustomField as an, type SlotField as ao, type Fields as ap, type PuckContext as aq, type DefaultRootFieldProps as ar, type DefaultRootRenderProps as as, type DefaultRootProps as at, type DefaultComponentProps as au, type WithId as av, type WithPuckProps as aw, type AsFieldProps as ax, type WithChildren as ay, type ExtractField as az, type Data as b, createReducer as c, type UiState as d, type Plugin as e, type Overrides as f, type FieldTransforms as g, type PuckAction as h, type InitialHistory as i, type ItemSelector as j, type PluginInternal as k, type History as l, migrate as m, type Direction as n, type DragAxis as o, type Viewport as p, type FieldTransformFnParams as q, resolveAllData as r, type FieldTransformFn as s, transformProps as t, overrideKeys as u, type OverrideKey as v, walkTree as w, type FieldRenderFunctions as x, type ItemWithId as y, type ArrayState as z };
|
|
@@ -1,4 +1,65 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, JSX, Reducer } from 'react';
|
|
2
|
+
|
|
3
|
+
type HistorySlice<D = any> = {
|
|
4
|
+
index: number;
|
|
5
|
+
hasPast: () => boolean;
|
|
6
|
+
hasFuture: () => boolean;
|
|
7
|
+
histories: History<D>[];
|
|
8
|
+
record: (data: D) => void;
|
|
9
|
+
back: VoidFunction;
|
|
10
|
+
forward: VoidFunction;
|
|
11
|
+
currentHistory: () => History;
|
|
12
|
+
nextHistory: () => History<D> | null;
|
|
13
|
+
prevHistory: () => History<D> | null;
|
|
14
|
+
setHistories: (histories: History[]) => void;
|
|
15
|
+
setHistoryIndex: (index: number) => void;
|
|
16
|
+
initialAppState: D;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type NodeMethods = {
|
|
20
|
+
sync: () => void;
|
|
21
|
+
hideOverlay: () => void;
|
|
22
|
+
showOverlay: () => void;
|
|
23
|
+
};
|
|
24
|
+
type PuckNodeInstance = {
|
|
25
|
+
id: string;
|
|
26
|
+
methods: NodeMethods;
|
|
27
|
+
element: HTMLElement | null;
|
|
28
|
+
};
|
|
29
|
+
type NodesSlice = {
|
|
30
|
+
nodes: Record<string, PuckNodeInstance | undefined>;
|
|
31
|
+
registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
|
|
32
|
+
unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
36
|
+
item?: G["UserComponentData"] | null;
|
|
37
|
+
type?: keyof G["UserProps"];
|
|
38
|
+
root?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
41
|
+
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
42
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
43
|
+
type Cache = Record<string, {
|
|
44
|
+
lastPermissions: Partial<Permissions>;
|
|
45
|
+
lastData: ComponentData | null;
|
|
46
|
+
}>;
|
|
47
|
+
type PermissionsSlice = {
|
|
48
|
+
cache: Cache;
|
|
49
|
+
globalPermissions: Permissions;
|
|
50
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
51
|
+
getPermissions: GetPermissions<Config>;
|
|
52
|
+
resolvePermissions: ResolvePermissions<Config>;
|
|
53
|
+
refreshPermissions: RefreshPermissions<Config>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
57
|
+
type FieldsSlice = {
|
|
58
|
+
fields: Fields | Partial<Fields>;
|
|
59
|
+
loading: boolean;
|
|
60
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
|
61
|
+
id: string | undefined;
|
|
62
|
+
};
|
|
2
63
|
|
|
3
64
|
type ItemSelector = {
|
|
4
65
|
index: number;
|
|
@@ -118,6 +179,7 @@ interface CustomField<Value extends any> extends BaseField {
|
|
|
118
179
|
type: "custom";
|
|
119
180
|
render: CustomFieldRender<Value>;
|
|
120
181
|
contentEditable?: boolean;
|
|
182
|
+
key?: string;
|
|
121
183
|
}
|
|
122
184
|
interface SlotField extends BaseField {
|
|
123
185
|
type: "slot";
|
|
@@ -331,6 +393,7 @@ interface FieldMetadata extends Metadata {
|
|
|
331
393
|
type ItemWithId = {
|
|
332
394
|
_arrayId: string;
|
|
333
395
|
_originalIndex: number;
|
|
396
|
+
_currentIndex: number;
|
|
334
397
|
};
|
|
335
398
|
type ArrayState = {
|
|
336
399
|
items: ItemWithId[];
|
|
@@ -341,6 +404,7 @@ type UiState = {
|
|
|
341
404
|
rightSideBarVisible: boolean;
|
|
342
405
|
leftSideBarWidth?: number | null;
|
|
343
406
|
rightSideBarWidth?: number | null;
|
|
407
|
+
mobilePanelExpanded?: boolean;
|
|
344
408
|
itemSelector: ItemSelector | null;
|
|
345
409
|
arrayState: Record<string, ArrayState | undefined>;
|
|
346
410
|
previewMode: "interactive" | "edit";
|
|
@@ -353,7 +417,7 @@ type UiState = {
|
|
|
353
417
|
isDragging: boolean;
|
|
354
418
|
viewports: {
|
|
355
419
|
current: {
|
|
356
|
-
width: number;
|
|
420
|
+
width: number | "100%";
|
|
357
421
|
height: number | "auto";
|
|
358
422
|
};
|
|
359
423
|
controlsVisible: boolean;
|
|
@@ -362,6 +426,9 @@ type UiState = {
|
|
|
362
426
|
field: {
|
|
363
427
|
focus?: string | null;
|
|
364
428
|
};
|
|
429
|
+
plugin: {
|
|
430
|
+
current: string | null;
|
|
431
|
+
};
|
|
365
432
|
};
|
|
366
433
|
type AppState<UserData extends Data = Data> = {
|
|
367
434
|
data: UserData;
|
|
@@ -405,6 +472,14 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
405
472
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
406
473
|
never
|
|
407
474
|
] ? False : True;
|
|
475
|
+
type RenderFunc<Props extends {
|
|
476
|
+
[key: string]: any;
|
|
477
|
+
} = {
|
|
478
|
+
children: ReactNode;
|
|
479
|
+
}> = (props: Props) => ReactElement;
|
|
480
|
+
type PluginInternal = Plugin & {
|
|
481
|
+
mobileOnly?: boolean;
|
|
482
|
+
};
|
|
408
483
|
|
|
409
484
|
type MapFnParams<ThisField = Field> = {
|
|
410
485
|
value: any;
|
|
@@ -428,11 +503,57 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
428
503
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
429
504
|
}>;
|
|
430
505
|
|
|
431
|
-
type
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
506
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
507
|
+
type ZoomConfig = {
|
|
508
|
+
autoZoom: number;
|
|
509
|
+
rootHeight: number;
|
|
510
|
+
zoom: number;
|
|
511
|
+
};
|
|
512
|
+
type ComponentState = Record<string, {
|
|
513
|
+
loadingCount: number;
|
|
514
|
+
}>;
|
|
515
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
516
|
+
instanceId: string;
|
|
517
|
+
state: G["UserAppState"];
|
|
518
|
+
dispatch: (action: PuckAction) => void;
|
|
519
|
+
config: UserConfig;
|
|
520
|
+
componentState: ComponentState;
|
|
521
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
522
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
523
|
+
unsetComponentLoading: (id: string) => void;
|
|
524
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
525
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
526
|
+
node: T;
|
|
527
|
+
didChange: boolean;
|
|
528
|
+
}>;
|
|
529
|
+
resolveAndCommitData: () => void;
|
|
530
|
+
plugins: Plugin[];
|
|
531
|
+
overrides: Partial<Overrides>;
|
|
532
|
+
viewports: Viewports;
|
|
533
|
+
zoomConfig: ZoomConfig;
|
|
534
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
535
|
+
status: Status;
|
|
536
|
+
setStatus: (status: Status) => void;
|
|
537
|
+
iframe: IframeConfig;
|
|
538
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
539
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
540
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
541
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
542
|
+
metadata: Metadata;
|
|
543
|
+
fields: FieldsSlice;
|
|
544
|
+
history: HistorySlice;
|
|
545
|
+
nodes: NodesSlice;
|
|
546
|
+
permissions: PermissionsSlice;
|
|
547
|
+
fieldTransforms: FieldTransforms;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
type StateReducer<UserData extends Data = Data> = Reducer<PrivateAppState<UserData>, PuckAction>;
|
|
551
|
+
declare function createReducer<UserData extends Data>({ record, onAction, appStore, }: {
|
|
552
|
+
record?: (appState: AppState<UserData>) => void;
|
|
553
|
+
onAction?: OnAction<UserData>;
|
|
554
|
+
appStore: AppStore;
|
|
555
|
+
}): StateReducer<UserData>;
|
|
556
|
+
|
|
436
557
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
437
558
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
438
559
|
type OverridesGeneric<Shape extends {
|
|
@@ -504,7 +625,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
504
625
|
|
|
505
626
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
506
627
|
type Viewport = {
|
|
507
|
-
width: number;
|
|
628
|
+
width: number | "100%";
|
|
508
629
|
height?: number | "auto";
|
|
509
630
|
label?: string;
|
|
510
631
|
icon?: iconTypes | ReactNode;
|
|
@@ -524,8 +645,13 @@ type IframeConfig = {
|
|
|
524
645
|
};
|
|
525
646
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
526
647
|
type Plugin<UserConfig extends Config = Config> = {
|
|
648
|
+
name?: string;
|
|
649
|
+
label?: string;
|
|
650
|
+
icon?: ReactNode;
|
|
651
|
+
render?: () => ReactElement;
|
|
527
652
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
528
653
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
654
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
529
655
|
};
|
|
530
656
|
type History<D = any> = {
|
|
531
657
|
state: D;
|
|
@@ -643,4 +769,4 @@ type WalkTreeOptions = {
|
|
|
643
769
|
};
|
|
644
770
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
645
771
|
|
|
646
|
-
export { type
|
|
772
|
+
export { type RootDataWithProps as $, type AppStore as A, type AppState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Field as F, type GetPermissions as G, type HistorySlice as H, type IframeConfig as I, type PuckComponent as J, type ResolveDataTrigger as K, type ComponentConfigExtensions as L, type Metadata as M, type ComponentConfig as N, type OnAction as O, type Permissions as P, type RootConfig as Q, type RefreshPermissions as R, type Slot as S, type DefaultComponents as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ExtractConfigParams as X, type ConfigParams as Y, type ComponentConfigParams as Z, type BaseData as _, type FieldProps as a, type RootDataWithoutProps as a0, type RootData as a1, type ComponentData as a2, type ComponentDataOptionalId as a3, type MappedItem as a4, type ComponentDataMap as a5, type Content as a6, type PuckMetadata as a7, type ComponentMetadata as a8, type FieldMetadata as a9, type BaseField as aa, type TextField as ab, type NumberField as ac, type TextareaField as ad, type SelectField as ae, type RadioField as af, type ArrayField as ag, type ObjectField as ah, type Adaptor as ai, type ExternalFieldWithAdaptor as aj, type CacheOpts as ak, type ExternalField as al, type CustomFieldRender as am, type CustomField as an, type SlotField as ao, type Fields as ap, type PuckContext as aq, type DefaultRootFieldProps as ar, type DefaultRootRenderProps as as, type DefaultRootProps as at, type DefaultComponentProps as au, type WithId as av, type WithPuckProps as aw, type AsFieldProps as ax, type WithChildren as ay, type ExtractField as az, type Data as b, createReducer as c, type UiState as d, type Plugin as e, type Overrides as f, type FieldTransforms as g, type PuckAction as h, type InitialHistory as i, type ItemSelector as j, type PluginInternal as k, type History as l, migrate as m, type Direction as n, type DragAxis as o, type Viewport as p, type FieldTransformFnParams as q, resolveAllData as r, type FieldTransformFn as s, transformProps as t, overrideKeys as u, type OverrideKey as v, walkTree as w, type FieldRenderFunctions as x, type ItemWithId as y, type ArrayState as z };
|
package/package.json
CHANGED