@measured/puck 0.1.2 → 0.1.4
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/package.json +2 -2
- package/dist/index.css +0 -611
- package/dist/index.d.ts +0 -117
- package/dist/index.js +0 -1188
package/dist/index.d.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
type Adaptor<AdaptorParams = {}> = {
|
|
5
|
-
name: string;
|
|
6
|
-
fetchList: (adaptorParams?: AdaptorParams) => Promise<Record<string, any>[] | null>;
|
|
7
|
-
};
|
|
8
|
-
type Field<Props extends {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
} = {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}> = {
|
|
13
|
-
type: "text" | "textarea" | "number" | "select" | "group" | "external" | "radio";
|
|
14
|
-
label?: string;
|
|
15
|
-
adaptor?: Adaptor;
|
|
16
|
-
adaptorParams?: object;
|
|
17
|
-
groupFields?: {
|
|
18
|
-
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
|
19
|
-
};
|
|
20
|
-
getItemSummary?: (item: Props, index: number) => string;
|
|
21
|
-
defaultItemProps?: Props;
|
|
22
|
-
options?: {
|
|
23
|
-
label: string;
|
|
24
|
-
value: string | number;
|
|
25
|
-
}[];
|
|
26
|
-
};
|
|
27
|
-
type DefaultPageProps = {
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
title: string;
|
|
30
|
-
editMode: boolean;
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
};
|
|
33
|
-
type DefaultComponentProps = {
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
editMode?: boolean;
|
|
36
|
-
};
|
|
37
|
-
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
|
|
38
|
-
[PropName in keyof Omit<Required<ComponentProps>, "children" | "editMode">]: Field<ComponentProps[PropName][0]>;
|
|
39
|
-
};
|
|
40
|
-
type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
|
|
41
|
-
render: (props: ComponentProps) => ReactElement;
|
|
42
|
-
defaultProps?: ComponentProps;
|
|
43
|
-
fields?: Fields<ComponentProps>;
|
|
44
|
-
};
|
|
45
|
-
type Config<Props extends {
|
|
46
|
-
[key: string]: any;
|
|
47
|
-
} = {
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
}, PageProps extends DefaultPageProps = DefaultPageProps> = {
|
|
50
|
-
components: {
|
|
51
|
-
[ComponentName in keyof Props]: ComponentConfig<Props[ComponentName]>;
|
|
52
|
-
};
|
|
53
|
-
page?: ComponentConfig<PageProps & {
|
|
54
|
-
children: ReactNode;
|
|
55
|
-
}>;
|
|
56
|
-
};
|
|
57
|
-
type MappedItem<Props extends {
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
} = {
|
|
60
|
-
[key: string]: any;
|
|
61
|
-
}> = {
|
|
62
|
-
type: keyof Props;
|
|
63
|
-
props: {
|
|
64
|
-
[key: string]: any;
|
|
65
|
-
} & {
|
|
66
|
-
id: string;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
type Data<Props extends {
|
|
70
|
-
[key: string]: any;
|
|
71
|
-
} = {
|
|
72
|
-
[key: string]: any;
|
|
73
|
-
}, PageProps extends {
|
|
74
|
-
title: string;
|
|
75
|
-
[key: string]: any;
|
|
76
|
-
} = {
|
|
77
|
-
title: string;
|
|
78
|
-
[key: string]: any;
|
|
79
|
-
}> = {
|
|
80
|
-
page: PageProps;
|
|
81
|
-
content: MappedItem<Props>[];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
type Plugin = {
|
|
85
|
-
renderPageFields?: (props: {
|
|
86
|
-
children: ReactNode;
|
|
87
|
-
data: Data;
|
|
88
|
-
}) => ReactElement<any>;
|
|
89
|
-
renderPage?: (props: {
|
|
90
|
-
children: ReactNode;
|
|
91
|
-
data: Data;
|
|
92
|
-
}) => ReactElement<any>;
|
|
93
|
-
renderFields?: (props: {
|
|
94
|
-
children: ReactNode;
|
|
95
|
-
data: Data;
|
|
96
|
-
}) => ReactElement<any>;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
declare function Puck({ config, data: initialData, onChange, onPublish, plugins, renderHeader, }: {
|
|
100
|
-
config: Config;
|
|
101
|
-
data: Data;
|
|
102
|
-
onChange?: (data: Data) => void;
|
|
103
|
-
onPublish: (data: Data) => void;
|
|
104
|
-
plugins?: Plugin[];
|
|
105
|
-
renderHeader?: (props: {
|
|
106
|
-
children: ReactNode;
|
|
107
|
-
data: Data;
|
|
108
|
-
setData: (data: Data) => void;
|
|
109
|
-
}) => ReactElement;
|
|
110
|
-
}): react_jsx_runtime.JSX.Element;
|
|
111
|
-
|
|
112
|
-
declare function Render({ config, data }: {
|
|
113
|
-
config: Config;
|
|
114
|
-
data: Data;
|
|
115
|
-
}): react_jsx_runtime.JSX.Element;
|
|
116
|
-
|
|
117
|
-
export { Adaptor, ComponentConfig, Config, Data, DefaultComponentProps, DefaultPageProps, Field, Fields, Puck, Render };
|