@measured/puck-plugin-heading-analyzer 0.20.0-canary.755737e8 → 0.20.0-canary.7d869af1
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/index.css +145 -0
- package/dist/index.d.mts +53 -32
- package/dist/index.d.ts +53 -32
- package/dist/index.js +2172 -200
- package/dist/index.mjs +2040 -68
- package/package.json +2 -2
package/dist/index.css
CHANGED
@@ -12,6 +12,151 @@
|
|
12
12
|
color: var(--puck-color-red-04);
|
13
13
|
}
|
14
14
|
|
15
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css/#css-module-data */
|
16
|
+
._SidebarSection_8boj8_1 {
|
17
|
+
display: flex;
|
18
|
+
position: relative;
|
19
|
+
flex-direction: column;
|
20
|
+
color: var(--puck-color-black);
|
21
|
+
}
|
22
|
+
._SidebarSection_8boj8_1:last-of-type {
|
23
|
+
flex-grow: 1;
|
24
|
+
}
|
25
|
+
._SidebarSection-title_8boj8_12 {
|
26
|
+
background: var(--puck-color-white);
|
27
|
+
padding: 16px;
|
28
|
+
border-bottom: 1px solid var(--puck-color-grey-09);
|
29
|
+
border-top: 1px solid var(--puck-color-grey-09);
|
30
|
+
overflow-x: auto;
|
31
|
+
}
|
32
|
+
._SidebarSection--noBorderTop_8boj8_20 > ._SidebarSection-title_8boj8_12 {
|
33
|
+
border-top: 0px;
|
34
|
+
}
|
35
|
+
._SidebarSection-content_8boj8_24 {
|
36
|
+
padding: 16px;
|
37
|
+
}
|
38
|
+
._SidebarSection--noPadding_8boj8_28 > ._SidebarSection-content_8boj8_24 {
|
39
|
+
padding: 0px;
|
40
|
+
}
|
41
|
+
._SidebarSection--noPadding_8boj8_28 > ._SidebarSection-content_8boj8_24:last-child {
|
42
|
+
padding-bottom: 4px;
|
43
|
+
}
|
44
|
+
._SidebarSection_8boj8_1:last-of-type ._SidebarSection-content_8boj8_24 {
|
45
|
+
border-bottom: none;
|
46
|
+
flex-grow: 1;
|
47
|
+
}
|
48
|
+
._SidebarSection-breadcrumbLabel_8boj8_41 {
|
49
|
+
background: none;
|
50
|
+
border: 0;
|
51
|
+
border-radius: 2px;
|
52
|
+
color: var(--puck-color-azure-04);
|
53
|
+
cursor: pointer;
|
54
|
+
font: inherit;
|
55
|
+
flex-shrink: 0;
|
56
|
+
padding: 0;
|
57
|
+
transition: color 50ms ease-in;
|
58
|
+
}
|
59
|
+
._SidebarSection-breadcrumbLabel_8boj8_41:focus-visible {
|
60
|
+
outline: 2px solid var(--puck-color-azure-05);
|
61
|
+
outline-offset: 2px;
|
62
|
+
}
|
63
|
+
@media (hover: hover) and (pointer: fine) {
|
64
|
+
._SidebarSection-breadcrumbLabel_8boj8_41:hover {
|
65
|
+
color: var(--puck-color-azure-03);
|
66
|
+
transition: none;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
._SidebarSection-breadcrumbLabel_8boj8_41:active {
|
70
|
+
color: var(--puck-color-azure-02);
|
71
|
+
transition: none;
|
72
|
+
}
|
73
|
+
._SidebarSection-breadcrumbs_8boj8_70 {
|
74
|
+
align-items: center;
|
75
|
+
display: flex;
|
76
|
+
gap: 4px;
|
77
|
+
}
|
78
|
+
._SidebarSection-breadcrumb_8boj8_41 {
|
79
|
+
align-items: center;
|
80
|
+
display: flex;
|
81
|
+
gap: 4px;
|
82
|
+
}
|
83
|
+
._SidebarSection-heading_8boj8_82 {
|
84
|
+
padding-inline-end: 16px;
|
85
|
+
}
|
86
|
+
._SidebarSection-loadingOverlay_8boj8_86 {
|
87
|
+
background: var(--puck-color-white);
|
88
|
+
display: flex;
|
89
|
+
justify-content: center;
|
90
|
+
align-items: center;
|
91
|
+
height: 100%;
|
92
|
+
width: 100%;
|
93
|
+
top: 0;
|
94
|
+
position: absolute;
|
95
|
+
z-index: 1;
|
96
|
+
pointer-events: all;
|
97
|
+
box-sizing: border-box;
|
98
|
+
opacity: 0.8;
|
99
|
+
}
|
100
|
+
|
101
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css/#css-module-data */
|
102
|
+
._Heading_qxrry_1 {
|
103
|
+
display: block;
|
104
|
+
color: var(--puck-color-black);
|
105
|
+
font-weight: 700;
|
106
|
+
margin: 0;
|
107
|
+
}
|
108
|
+
._Heading_qxrry_1 b {
|
109
|
+
font-weight: 700;
|
110
|
+
}
|
111
|
+
._Heading--xxxxl_qxrry_12 {
|
112
|
+
font-size: var(--puck-font-size-xxxxl);
|
113
|
+
letter-spacing: 0.08ch;
|
114
|
+
font-weight: 800;
|
115
|
+
}
|
116
|
+
._Heading--xxxl_qxrry_18 {
|
117
|
+
font-size: var(--puck-font-size-xxxl);
|
118
|
+
}
|
119
|
+
._Heading--xxl_qxrry_22 {
|
120
|
+
font-size: var(--puck-font-size-xxl);
|
121
|
+
}
|
122
|
+
._Heading--xl_qxrry_26 {
|
123
|
+
font-size: var(--puck-font-size-xl);
|
124
|
+
}
|
125
|
+
._Heading--l_qxrry_30 {
|
126
|
+
font-size: var(--puck-font-size-l);
|
127
|
+
}
|
128
|
+
._Heading--m_qxrry_34 {
|
129
|
+
font-size: var(--puck-font-size-m);
|
130
|
+
}
|
131
|
+
._Heading--s_qxrry_38 {
|
132
|
+
font-size: var(--puck-font-size-s);
|
133
|
+
}
|
134
|
+
._Heading--xs_qxrry_42 {
|
135
|
+
font-size: var(--puck-font-size-xs);
|
136
|
+
}
|
137
|
+
|
138
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css/#css-module-data */
|
139
|
+
@keyframes _loader-animation_nacdm_1 {
|
140
|
+
0% {
|
141
|
+
transform: rotate(0deg) scale(1);
|
142
|
+
}
|
143
|
+
50% {
|
144
|
+
transform: rotate(180deg) scale(0.8);
|
145
|
+
}
|
146
|
+
100% {
|
147
|
+
transform: rotate(360deg) scale(1);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
._Loader_nacdm_13 {
|
151
|
+
background: transparent;
|
152
|
+
border-radius: 100%;
|
153
|
+
border: 2px solid currentColor;
|
154
|
+
border-bottom-color: transparent;
|
155
|
+
display: inline-block;
|
156
|
+
animation: _loader-animation_nacdm_1 1s 0s infinite linear;
|
157
|
+
animation-fill-mode: both;
|
158
|
+
}
|
159
|
+
|
15
160
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css/#css-module-data */
|
16
161
|
._OutlineList_w4lzv_1 {
|
17
162
|
color: var(--puck-color-grey-03);
|
package/dist/index.d.mts
CHANGED
@@ -7,7 +7,7 @@ type ItemSelector = {
|
|
7
7
|
|
8
8
|
type FieldOption = {
|
9
9
|
label: string;
|
10
|
-
value: string | number | boolean;
|
10
|
+
value: string | number | boolean | undefined | null | object;
|
11
11
|
};
|
12
12
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
13
13
|
type BaseField = {
|
@@ -19,6 +19,7 @@ type BaseField = {
|
|
19
19
|
type TextField = BaseField & {
|
20
20
|
type: "text";
|
21
21
|
placeholder?: string;
|
22
|
+
contentEditable?: boolean;
|
22
23
|
};
|
23
24
|
type NumberField = BaseField & {
|
24
25
|
type: "number";
|
@@ -30,6 +31,7 @@ type NumberField = BaseField & {
|
|
30
31
|
type TextareaField = BaseField & {
|
31
32
|
type: "textarea";
|
32
33
|
placeholder?: string;
|
34
|
+
contentEditable?: boolean;
|
33
35
|
};
|
34
36
|
type SelectField = BaseField & {
|
35
37
|
type: "select";
|
@@ -39,11 +41,11 @@ type RadioField = BaseField & {
|
|
39
41
|
type: "radio";
|
40
42
|
options: FieldOptions;
|
41
43
|
};
|
42
|
-
type ArrayField<Props extends {
|
44
|
+
type ArrayField<Props extends any = {
|
43
45
|
[key: string]: any;
|
44
|
-
} = {
|
46
|
+
}> = Props extends {
|
45
47
|
[key: string]: any;
|
46
|
-
}
|
48
|
+
} ? BaseField & {
|
47
49
|
type: "array";
|
48
50
|
arrayFields: {
|
49
51
|
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
@@ -52,14 +54,12 @@ type ArrayField<Props extends {
|
|
52
54
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
53
55
|
max?: number;
|
54
56
|
min?: number;
|
55
|
-
};
|
56
|
-
type ObjectField<Props extends {
|
57
|
-
[key: string]: any;
|
58
|
-
} = {
|
57
|
+
} : never;
|
58
|
+
type ObjectField<Props extends any = {
|
59
59
|
[key: string]: any;
|
60
60
|
}> = BaseField & {
|
61
61
|
type: "object";
|
62
|
-
objectFields:
|
62
|
+
objectFields: {
|
63
63
|
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
64
64
|
};
|
65
65
|
};
|
@@ -68,20 +68,17 @@ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, Pr
|
|
68
68
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
69
69
|
mapProp?: (value: TableShape) => PropShape;
|
70
70
|
};
|
71
|
-
type
|
72
|
-
|
73
|
-
} = {
|
71
|
+
type NotUndefined<T> = T extends undefined ? Record<string, any> : T;
|
72
|
+
type ExternalFieldWithAdaptor<Props extends any = {
|
74
73
|
[key: string]: any;
|
75
74
|
}> = BaseField & {
|
76
75
|
type: "external";
|
77
76
|
placeholder?: string;
|
78
77
|
adaptor: Adaptor<any, any, Props>;
|
79
78
|
adaptorParams?: object;
|
80
|
-
getItemSummary: (item: Props
|
79
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
81
80
|
};
|
82
|
-
type ExternalField<Props extends {
|
83
|
-
[key: string]: any;
|
84
|
-
} = {
|
81
|
+
type ExternalField<Props extends any = {
|
85
82
|
[key: string]: any;
|
86
83
|
}> = BaseField & {
|
87
84
|
type: "external";
|
@@ -92,7 +89,7 @@ type ExternalField<Props extends {
|
|
92
89
|
}) => Promise<any[] | null>;
|
93
90
|
mapProp?: (value: any) => Props;
|
94
91
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
95
|
-
getItemSummary?: (item: Props
|
92
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
|
96
93
|
showSearch?: boolean;
|
97
94
|
renderFooter?: (props: {
|
98
95
|
items: any[];
|
@@ -112,21 +109,14 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
112
109
|
type CustomField<Value extends any> = BaseField & {
|
113
110
|
type: "custom";
|
114
111
|
render: CustomFieldRender<Value>;
|
112
|
+
contentEditable?: boolean;
|
115
113
|
};
|
116
114
|
type SlotField = BaseField & {
|
117
115
|
type: "slot";
|
118
116
|
allow?: string[];
|
119
117
|
disallow?: string[];
|
120
118
|
};
|
121
|
-
type Field<
|
122
|
-
[key: string]: any;
|
123
|
-
} ? Props : any> | ObjectField<Props extends {
|
124
|
-
[key: string]: any;
|
125
|
-
} ? Props : any> | ExternalField<Props extends {
|
126
|
-
[key: string]: any;
|
127
|
-
} ? Props : any> | ExternalFieldWithAdaptor<Props extends {
|
128
|
-
[key: string]: any;
|
129
|
-
} ? Props : any> | CustomField<Props> | SlotField;
|
119
|
+
type Field<ValueType = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType> | ObjectField<ValueType> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
130
120
|
type FieldProps<F = Field<any>, ValueType = any> = {
|
131
121
|
field: F;
|
132
122
|
value: ValueType;
|
@@ -135,6 +125,10 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
135
125
|
readOnly?: boolean;
|
136
126
|
};
|
137
127
|
|
128
|
+
type ExtractField<T extends Field["type"]> = Extract<Field, {
|
129
|
+
type: T;
|
130
|
+
}>;
|
131
|
+
|
138
132
|
type Metadata = {
|
139
133
|
[key: string]: any;
|
140
134
|
};
|
@@ -150,6 +144,8 @@ type ArrayState = {
|
|
150
144
|
type UiState = {
|
151
145
|
leftSideBarVisible: boolean;
|
152
146
|
rightSideBarVisible: boolean;
|
147
|
+
leftSideBarWidth?: number | null;
|
148
|
+
rightSideBarWidth?: number | null;
|
153
149
|
itemSelector: ItemSelector | null;
|
154
150
|
arrayState: Record<string, ArrayState | undefined>;
|
155
151
|
previewMode: "interactive" | "edit";
|
@@ -173,13 +169,29 @@ type UiState = {
|
|
173
169
|
};
|
174
170
|
};
|
175
171
|
|
172
|
+
type MapFnParams<ThisField = Field> = {
|
173
|
+
value: any;
|
174
|
+
parentId: string;
|
175
|
+
propName: string;
|
176
|
+
field: ThisField;
|
177
|
+
propPath: string;
|
178
|
+
};
|
179
|
+
|
180
|
+
type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
|
181
|
+
isReadOnly: boolean;
|
182
|
+
componentId: string;
|
183
|
+
};
|
184
|
+
type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
|
185
|
+
type FieldTransforms = Partial<{
|
186
|
+
[FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
|
187
|
+
}>;
|
188
|
+
|
176
189
|
type RenderFunc<Props extends {
|
177
190
|
[key: string]: any;
|
178
191
|
} = {
|
179
192
|
children: ReactNode;
|
180
193
|
}> = (props: Props) => ReactElement;
|
181
|
-
|
182
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
194
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
183
195
|
type OverrideKey = (typeof overrideKeys)[number];
|
184
196
|
type OverridesGeneric<Shape extends {
|
185
197
|
[key in OverrideKey]: any;
|
@@ -217,11 +229,23 @@ type Overrides = OverridesGeneric<{
|
|
217
229
|
children: ReactNode;
|
218
230
|
name: string;
|
219
231
|
}>;
|
232
|
+
drawer: RenderFunc;
|
233
|
+
drawerItem: RenderFunc<{
|
234
|
+
children: ReactNode;
|
235
|
+
name: string;
|
236
|
+
}>;
|
220
237
|
iframe: RenderFunc<{
|
221
238
|
children: ReactNode;
|
222
239
|
document?: Document;
|
223
240
|
}>;
|
224
241
|
outline: RenderFunc;
|
242
|
+
componentOverlay: RenderFunc<{
|
243
|
+
children: ReactNode;
|
244
|
+
hover: boolean;
|
245
|
+
isSelected: boolean;
|
246
|
+
componentId: string;
|
247
|
+
componentType: string;
|
248
|
+
}>;
|
225
249
|
puck: RenderFunc;
|
226
250
|
}>;
|
227
251
|
type FieldRenderFunctions = Omit<{
|
@@ -247,11 +271,8 @@ type Viewport = {
|
|
247
271
|
};
|
248
272
|
|
249
273
|
type Plugin = {
|
250
|
-
name?: string;
|
251
|
-
label?: string;
|
252
|
-
icon?: ReactNode;
|
253
|
-
render?: () => ReactElement;
|
254
274
|
overrides?: Partial<Overrides>;
|
275
|
+
fieldTransforms?: FieldTransforms;
|
255
276
|
};
|
256
277
|
|
257
278
|
declare const headingAnalyzer: Plugin;
|
package/dist/index.d.ts
CHANGED
@@ -7,7 +7,7 @@ type ItemSelector = {
|
|
7
7
|
|
8
8
|
type FieldOption = {
|
9
9
|
label: string;
|
10
|
-
value: string | number | boolean;
|
10
|
+
value: string | number | boolean | undefined | null | object;
|
11
11
|
};
|
12
12
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
13
13
|
type BaseField = {
|
@@ -19,6 +19,7 @@ type BaseField = {
|
|
19
19
|
type TextField = BaseField & {
|
20
20
|
type: "text";
|
21
21
|
placeholder?: string;
|
22
|
+
contentEditable?: boolean;
|
22
23
|
};
|
23
24
|
type NumberField = BaseField & {
|
24
25
|
type: "number";
|
@@ -30,6 +31,7 @@ type NumberField = BaseField & {
|
|
30
31
|
type TextareaField = BaseField & {
|
31
32
|
type: "textarea";
|
32
33
|
placeholder?: string;
|
34
|
+
contentEditable?: boolean;
|
33
35
|
};
|
34
36
|
type SelectField = BaseField & {
|
35
37
|
type: "select";
|
@@ -39,11 +41,11 @@ type RadioField = BaseField & {
|
|
39
41
|
type: "radio";
|
40
42
|
options: FieldOptions;
|
41
43
|
};
|
42
|
-
type ArrayField<Props extends {
|
44
|
+
type ArrayField<Props extends any = {
|
43
45
|
[key: string]: any;
|
44
|
-
} = {
|
46
|
+
}> = Props extends {
|
45
47
|
[key: string]: any;
|
46
|
-
}
|
48
|
+
} ? BaseField & {
|
47
49
|
type: "array";
|
48
50
|
arrayFields: {
|
49
51
|
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
@@ -52,14 +54,12 @@ type ArrayField<Props extends {
|
|
52
54
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
53
55
|
max?: number;
|
54
56
|
min?: number;
|
55
|
-
};
|
56
|
-
type ObjectField<Props extends {
|
57
|
-
[key: string]: any;
|
58
|
-
} = {
|
57
|
+
} : never;
|
58
|
+
type ObjectField<Props extends any = {
|
59
59
|
[key: string]: any;
|
60
60
|
}> = BaseField & {
|
61
61
|
type: "object";
|
62
|
-
objectFields:
|
62
|
+
objectFields: {
|
63
63
|
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
64
64
|
};
|
65
65
|
};
|
@@ -68,20 +68,17 @@ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, Pr
|
|
68
68
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
69
69
|
mapProp?: (value: TableShape) => PropShape;
|
70
70
|
};
|
71
|
-
type
|
72
|
-
|
73
|
-
} = {
|
71
|
+
type NotUndefined<T> = T extends undefined ? Record<string, any> : T;
|
72
|
+
type ExternalFieldWithAdaptor<Props extends any = {
|
74
73
|
[key: string]: any;
|
75
74
|
}> = BaseField & {
|
76
75
|
type: "external";
|
77
76
|
placeholder?: string;
|
78
77
|
adaptor: Adaptor<any, any, Props>;
|
79
78
|
adaptorParams?: object;
|
80
|
-
getItemSummary: (item: Props
|
79
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
81
80
|
};
|
82
|
-
type ExternalField<Props extends {
|
83
|
-
[key: string]: any;
|
84
|
-
} = {
|
81
|
+
type ExternalField<Props extends any = {
|
85
82
|
[key: string]: any;
|
86
83
|
}> = BaseField & {
|
87
84
|
type: "external";
|
@@ -92,7 +89,7 @@ type ExternalField<Props extends {
|
|
92
89
|
}) => Promise<any[] | null>;
|
93
90
|
mapProp?: (value: any) => Props;
|
94
91
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
95
|
-
getItemSummary?: (item: Props
|
92
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
|
96
93
|
showSearch?: boolean;
|
97
94
|
renderFooter?: (props: {
|
98
95
|
items: any[];
|
@@ -112,21 +109,14 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
112
109
|
type CustomField<Value extends any> = BaseField & {
|
113
110
|
type: "custom";
|
114
111
|
render: CustomFieldRender<Value>;
|
112
|
+
contentEditable?: boolean;
|
115
113
|
};
|
116
114
|
type SlotField = BaseField & {
|
117
115
|
type: "slot";
|
118
116
|
allow?: string[];
|
119
117
|
disallow?: string[];
|
120
118
|
};
|
121
|
-
type Field<
|
122
|
-
[key: string]: any;
|
123
|
-
} ? Props : any> | ObjectField<Props extends {
|
124
|
-
[key: string]: any;
|
125
|
-
} ? Props : any> | ExternalField<Props extends {
|
126
|
-
[key: string]: any;
|
127
|
-
} ? Props : any> | ExternalFieldWithAdaptor<Props extends {
|
128
|
-
[key: string]: any;
|
129
|
-
} ? Props : any> | CustomField<Props> | SlotField;
|
119
|
+
type Field<ValueType = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType> | ObjectField<ValueType> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
130
120
|
type FieldProps<F = Field<any>, ValueType = any> = {
|
131
121
|
field: F;
|
132
122
|
value: ValueType;
|
@@ -135,6 +125,10 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
135
125
|
readOnly?: boolean;
|
136
126
|
};
|
137
127
|
|
128
|
+
type ExtractField<T extends Field["type"]> = Extract<Field, {
|
129
|
+
type: T;
|
130
|
+
}>;
|
131
|
+
|
138
132
|
type Metadata = {
|
139
133
|
[key: string]: any;
|
140
134
|
};
|
@@ -150,6 +144,8 @@ type ArrayState = {
|
|
150
144
|
type UiState = {
|
151
145
|
leftSideBarVisible: boolean;
|
152
146
|
rightSideBarVisible: boolean;
|
147
|
+
leftSideBarWidth?: number | null;
|
148
|
+
rightSideBarWidth?: number | null;
|
153
149
|
itemSelector: ItemSelector | null;
|
154
150
|
arrayState: Record<string, ArrayState | undefined>;
|
155
151
|
previewMode: "interactive" | "edit";
|
@@ -173,13 +169,29 @@ type UiState = {
|
|
173
169
|
};
|
174
170
|
};
|
175
171
|
|
172
|
+
type MapFnParams<ThisField = Field> = {
|
173
|
+
value: any;
|
174
|
+
parentId: string;
|
175
|
+
propName: string;
|
176
|
+
field: ThisField;
|
177
|
+
propPath: string;
|
178
|
+
};
|
179
|
+
|
180
|
+
type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
|
181
|
+
isReadOnly: boolean;
|
182
|
+
componentId: string;
|
183
|
+
};
|
184
|
+
type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
|
185
|
+
type FieldTransforms = Partial<{
|
186
|
+
[FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
|
187
|
+
}>;
|
188
|
+
|
176
189
|
type RenderFunc<Props extends {
|
177
190
|
[key: string]: any;
|
178
191
|
} = {
|
179
192
|
children: ReactNode;
|
180
193
|
}> = (props: Props) => ReactElement;
|
181
|
-
|
182
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
194
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
183
195
|
type OverrideKey = (typeof overrideKeys)[number];
|
184
196
|
type OverridesGeneric<Shape extends {
|
185
197
|
[key in OverrideKey]: any;
|
@@ -217,11 +229,23 @@ type Overrides = OverridesGeneric<{
|
|
217
229
|
children: ReactNode;
|
218
230
|
name: string;
|
219
231
|
}>;
|
232
|
+
drawer: RenderFunc;
|
233
|
+
drawerItem: RenderFunc<{
|
234
|
+
children: ReactNode;
|
235
|
+
name: string;
|
236
|
+
}>;
|
220
237
|
iframe: RenderFunc<{
|
221
238
|
children: ReactNode;
|
222
239
|
document?: Document;
|
223
240
|
}>;
|
224
241
|
outline: RenderFunc;
|
242
|
+
componentOverlay: RenderFunc<{
|
243
|
+
children: ReactNode;
|
244
|
+
hover: boolean;
|
245
|
+
isSelected: boolean;
|
246
|
+
componentId: string;
|
247
|
+
componentType: string;
|
248
|
+
}>;
|
225
249
|
puck: RenderFunc;
|
226
250
|
}>;
|
227
251
|
type FieldRenderFunctions = Omit<{
|
@@ -247,11 +271,8 @@ type Viewport = {
|
|
247
271
|
};
|
248
272
|
|
249
273
|
type Plugin = {
|
250
|
-
name?: string;
|
251
|
-
label?: string;
|
252
|
-
icon?: ReactNode;
|
253
|
-
render?: () => ReactElement;
|
254
274
|
overrides?: Partial<Overrides>;
|
275
|
+
fieldTransforms?: FieldTransforms;
|
255
276
|
};
|
256
277
|
|
257
278
|
declare const headingAnalyzer: Plugin;
|