@measured/puck-plugin-heading-analyzer 0.12.1-canary.aa431b7 → 0.13.0-canary.0450f4e
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.css +17 -14
- package/dist/index.d.ts +147 -101
- package/dist/index.js +77096 -582
- package/package.json +2 -2
package/dist/index.css
CHANGED
@@ -1,56 +1,59 @@
|
|
1
1
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css/#css-module-data */
|
2
|
-
.
|
2
|
+
._SidebarSection_170gs_1 {
|
3
3
|
display: flex;
|
4
4
|
position: relative;
|
5
5
|
flex-direction: column;
|
6
6
|
color: black;
|
7
7
|
}
|
8
|
-
.
|
8
|
+
._SidebarSection_170gs_1:last-of-type {
|
9
9
|
flex-grow: 1;
|
10
10
|
}
|
11
|
-
._SidebarSection-
|
11
|
+
._SidebarSection-title_170gs_12 {
|
12
12
|
background: white;
|
13
13
|
padding: 16px;
|
14
14
|
border-bottom: 1px solid var(--puck-color-grey-8);
|
15
|
+
border-top: 1px solid var(--puck-color-grey-8);
|
15
16
|
overflow-x: auto;
|
16
17
|
}
|
17
|
-
._SidebarSection-
|
18
|
-
border-
|
18
|
+
._SidebarSection--noBorderTop_170gs_20 > ._SidebarSection-title_170gs_12 {
|
19
|
+
border-top: 0px;
|
20
|
+
}
|
21
|
+
._SidebarSection-content_170gs_24 {
|
19
22
|
padding: 16px;
|
20
23
|
}
|
21
|
-
._SidebarSection--
|
24
|
+
._SidebarSection--noPadding_170gs_28 > ._SidebarSection-content_170gs_24 {
|
22
25
|
padding: 0px;
|
23
26
|
}
|
24
|
-
._SidebarSection--
|
27
|
+
._SidebarSection--noPadding_170gs_28 > ._SidebarSection-content_170gs_24:last-child {
|
25
28
|
padding-bottom: 4px;
|
26
29
|
}
|
27
|
-
.
|
30
|
+
._SidebarSection_170gs_1:last-of-type ._SidebarSection-content_170gs_24 {
|
28
31
|
border-bottom: none;
|
29
32
|
flex-grow: 1;
|
30
33
|
}
|
31
|
-
._SidebarSection-
|
34
|
+
._SidebarSection-breadcrumbLabel_170gs_41 {
|
32
35
|
color: var(--puck-color-azure-3);
|
33
36
|
flex-shrink: 0;
|
34
37
|
}
|
35
|
-
._SidebarSection-
|
38
|
+
._SidebarSection-breadcrumbLabel_170gs_41:hover {
|
36
39
|
color: var(--puck-color-azure-4);
|
37
40
|
cursor: pointer;
|
38
41
|
text-decoration: underline;
|
39
42
|
}
|
40
|
-
._SidebarSection-
|
43
|
+
._SidebarSection-breadcrumbs_170gs_52 {
|
41
44
|
align-items: center;
|
42
45
|
display: flex;
|
43
46
|
gap: 4px;
|
44
47
|
}
|
45
|
-
._SidebarSection-
|
48
|
+
._SidebarSection-breadcrumb_170gs_41 {
|
46
49
|
align-items: center;
|
47
50
|
display: flex;
|
48
51
|
gap: 4px;
|
49
52
|
}
|
50
|
-
._SidebarSection-
|
53
|
+
._SidebarSection-heading_170gs_64 {
|
51
54
|
padding-right: 16px;
|
52
55
|
}
|
53
|
-
._SidebarSection-
|
56
|
+
._SidebarSection-loadingOverlay_170gs_68 {
|
54
57
|
background: white;
|
55
58
|
display: flex;
|
56
59
|
justify-content: center;
|
package/dist/index.d.ts
CHANGED
@@ -1,106 +1,108 @@
|
|
1
|
-
import {
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
2
2
|
|
3
3
|
type ItemSelector = {
|
4
4
|
index: number;
|
5
5
|
zone?: string;
|
6
6
|
};
|
7
7
|
|
8
|
-
type
|
9
|
-
|
10
|
-
componentType: string;
|
11
|
-
destinationIndex: number;
|
12
|
-
destinationZone: string;
|
13
|
-
};
|
14
|
-
type DuplicateAction = {
|
15
|
-
type: "duplicate";
|
16
|
-
sourceIndex: number;
|
17
|
-
sourceZone: string;
|
18
|
-
};
|
19
|
-
type ReplaceAction = {
|
20
|
-
type: "replace";
|
21
|
-
destinationIndex: number;
|
22
|
-
destinationZone: string;
|
23
|
-
data: any;
|
24
|
-
};
|
25
|
-
type ReorderAction = {
|
26
|
-
type: "reorder";
|
27
|
-
sourceIndex: number;
|
28
|
-
destinationIndex: number;
|
29
|
-
destinationZone: string;
|
30
|
-
};
|
31
|
-
type MoveAction = {
|
32
|
-
type: "move";
|
33
|
-
sourceIndex: number;
|
34
|
-
sourceZone: string;
|
35
|
-
destinationIndex: number;
|
36
|
-
destinationZone: string;
|
37
|
-
};
|
38
|
-
type RemoveAction = {
|
39
|
-
type: "remove";
|
40
|
-
index: number;
|
41
|
-
zone: string;
|
42
|
-
};
|
43
|
-
type SetUiAction = {
|
44
|
-
type: "setUi";
|
45
|
-
ui: Partial<UiState> | ((previous: UiState) => Partial<UiState>);
|
8
|
+
type BaseField = {
|
9
|
+
label?: string;
|
46
10
|
};
|
47
|
-
type
|
48
|
-
type: "
|
49
|
-
data: Partial<Data> | ((previous: Data) => Partial<Data>);
|
11
|
+
type TextField = BaseField & {
|
12
|
+
type: "text";
|
50
13
|
};
|
51
|
-
type
|
52
|
-
type: "
|
53
|
-
state: Partial<AppState> | ((previous: AppState) => Partial<AppState>);
|
14
|
+
type NumberField = BaseField & {
|
15
|
+
type: "number";
|
54
16
|
};
|
55
|
-
type
|
56
|
-
type: "
|
57
|
-
zone: string;
|
17
|
+
type TextareaField = BaseField & {
|
18
|
+
type: "textarea";
|
58
19
|
};
|
59
|
-
type
|
60
|
-
type: "
|
61
|
-
|
20
|
+
type SelectField = BaseField & {
|
21
|
+
type: "select";
|
22
|
+
options: {
|
23
|
+
label: string;
|
24
|
+
value: string | number | boolean;
|
25
|
+
}[];
|
62
26
|
};
|
63
|
-
type
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
27
|
+
type RadioField = BaseField & {
|
28
|
+
type: "radio";
|
29
|
+
options: {
|
30
|
+
label: string;
|
31
|
+
value: string | number | boolean;
|
32
|
+
}[];
|
69
33
|
};
|
70
|
-
type
|
71
|
-
title?: string;
|
34
|
+
type ArrayField<Props extends {
|
72
35
|
[key: string]: any;
|
73
|
-
}
|
74
|
-
type DefaultComponentProps = {
|
36
|
+
} = {
|
75
37
|
[key: string]: any;
|
76
|
-
|
77
|
-
|
78
|
-
|
38
|
+
}> = BaseField & {
|
39
|
+
type: "array";
|
40
|
+
arrayFields: {
|
41
|
+
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
42
|
+
};
|
43
|
+
defaultItemProps?: Props[0];
|
44
|
+
getItemSummary?: (item: Props[0], index?: number) => string;
|
45
|
+
};
|
46
|
+
type ObjectField<Props extends {
|
79
47
|
[key: string]: any;
|
80
48
|
} = {
|
81
49
|
[key: string]: any;
|
82
|
-
}> =
|
83
|
-
type
|
50
|
+
}> = BaseField & {
|
51
|
+
type: "object";
|
52
|
+
objectFields: {
|
53
|
+
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
54
|
+
};
|
55
|
+
};
|
56
|
+
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
57
|
+
name: string;
|
58
|
+
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
59
|
+
mapProp?: (value: TableShape) => PropShape;
|
60
|
+
};
|
61
|
+
type ExternalFieldWithAdaptor<Props extends {
|
84
62
|
[key: string]: any;
|
85
63
|
} = {
|
86
64
|
[key: string]: any;
|
87
|
-
}> = {
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
}
|
94
|
-
type
|
95
|
-
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
type
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
65
|
+
}> = BaseField & {
|
66
|
+
type: "external";
|
67
|
+
placeholder?: string;
|
68
|
+
adaptor: Adaptor<any, any, Props>;
|
69
|
+
adaptorParams?: object;
|
70
|
+
getItemSummary: (item: Props, index?: number) => string;
|
71
|
+
};
|
72
|
+
type ExternalField<Props extends {
|
73
|
+
[key: string]: any;
|
74
|
+
} = {
|
75
|
+
[key: string]: any;
|
76
|
+
}> = BaseField & {
|
77
|
+
type: "external";
|
78
|
+
placeholder?: string;
|
79
|
+
fetchList: (params: {
|
80
|
+
query: string;
|
81
|
+
}) => Promise<any[] | null>;
|
82
|
+
mapProp?: (value: any) => Props;
|
83
|
+
getItemSummary: (item: Props, index?: number) => string;
|
84
|
+
showSearch?: boolean;
|
85
|
+
initialQuery?: string;
|
86
|
+
};
|
87
|
+
type CustomField<Props extends {
|
88
|
+
[key: string]: any;
|
89
|
+
} = {
|
90
|
+
[key: string]: any;
|
91
|
+
}> = BaseField & {
|
92
|
+
type: "custom";
|
93
|
+
render: (props: {
|
94
|
+
field: CustomField;
|
95
|
+
name: string;
|
96
|
+
value: any;
|
97
|
+
onChange: (value: Props) => void;
|
98
|
+
readOnly?: boolean;
|
99
|
+
}) => ReactElement;
|
100
|
+
};
|
101
|
+
type Field<Props extends {
|
102
|
+
[key: string]: any;
|
103
|
+
} = {
|
104
|
+
[key: string]: any;
|
105
|
+
}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField;
|
104
106
|
type ItemWithId = {
|
105
107
|
_arrayId: string;
|
106
108
|
_originalIndex: number;
|
@@ -120,30 +122,74 @@ type UiState = {
|
|
120
122
|
visible?: boolean;
|
121
123
|
expanded?: boolean;
|
122
124
|
}>;
|
125
|
+
isDragging: boolean;
|
123
126
|
};
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
+
|
128
|
+
type InputProps<F = Field<any>> = {
|
129
|
+
name: string;
|
130
|
+
field: F;
|
131
|
+
value: any;
|
132
|
+
id: string;
|
133
|
+
label?: string;
|
134
|
+
onChange: (value: any, uiState?: Partial<UiState>) => void;
|
135
|
+
readOnly?: boolean;
|
136
|
+
readOnlyFields?: Record<string, boolean | undefined>;
|
127
137
|
};
|
128
138
|
|
129
|
-
type
|
130
|
-
|
139
|
+
type RenderFunc<Props extends {
|
140
|
+
[key: string]: any;
|
141
|
+
} = {
|
142
|
+
children: ReactNode;
|
143
|
+
}> = React.FunctionComponent<Props>;
|
144
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
145
|
+
type OverrideKey = (typeof overrideKeys)[number];
|
146
|
+
type OverridesGeneric<Shape extends {
|
147
|
+
[key in OverrideKey]: any;
|
148
|
+
}> = Shape;
|
149
|
+
type Overrides = OverridesGeneric<{
|
150
|
+
fieldTypes: Partial<FieldRenderFunctions>;
|
151
|
+
header: RenderFunc<{
|
152
|
+
actions: ReactNode;
|
153
|
+
children: ReactNode;
|
154
|
+
}>;
|
155
|
+
headerActions: RenderFunc<{
|
156
|
+
children?: ReactNode;
|
157
|
+
}>;
|
158
|
+
preview: RenderFunc;
|
159
|
+
fields: RenderFunc<{
|
131
160
|
children: ReactNode;
|
132
|
-
|
133
|
-
|
134
|
-
}
|
135
|
-
|
161
|
+
isLoading: boolean;
|
162
|
+
itemSelector?: ItemSelector | null;
|
163
|
+
}>;
|
164
|
+
fieldLabel: RenderFunc<{
|
165
|
+
children?: ReactNode;
|
166
|
+
icon?: ReactNode;
|
167
|
+
label: string;
|
168
|
+
el?: "label" | "div";
|
169
|
+
readOnly?: boolean;
|
170
|
+
className?: string;
|
171
|
+
}>;
|
172
|
+
components: RenderFunc;
|
173
|
+
componentItem: RenderFunc;
|
174
|
+
outline: RenderFunc;
|
175
|
+
puck: RenderFunc;
|
176
|
+
}>;
|
177
|
+
type FieldRenderFunctions = Omit<{
|
178
|
+
[Type in Field["type"]]: React.FunctionComponent<InputProps<Extract<Field, {
|
179
|
+
type: Type;
|
180
|
+
}>> & {
|
136
181
|
children: ReactNode;
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
renderFields?: (props: {
|
182
|
+
}>;
|
183
|
+
}, "custom"> & {
|
184
|
+
[key: string]: React.FunctionComponent<InputProps<any> & {
|
141
185
|
children: ReactNode;
|
142
|
-
|
143
|
-
|
144
|
-
|
186
|
+
}>;
|
187
|
+
};
|
188
|
+
|
189
|
+
type Plugin = {
|
190
|
+
overrides: Partial<Overrides>;
|
145
191
|
};
|
146
192
|
|
147
|
-
declare const
|
193
|
+
declare const headingAnalyzer: Plugin;
|
148
194
|
|
149
|
-
export {
|
195
|
+
export { headingAnalyzer as default };
|