@measured/puck-plugin-heading-analyzer 0.21.0-canary.dfecd012 → 0.21.0-canary.e1cbf777
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 +5 -149
- package/dist/index.d.mts +223 -13
- package/dist/index.d.ts +223 -13
- package/dist/index.js +119 -256
- package/dist/index.mjs +116 -253
- package/package.json +2 -2
package/dist/index.css
CHANGED
|
@@ -1,162 +1,18 @@
|
|
|
1
1
|
/* css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css/#css-module-data */
|
|
2
|
-
.
|
|
2
|
+
._HeadingAnalyzer_yg0s7_1 {
|
|
3
3
|
display: block;
|
|
4
|
+
padding: 16px;
|
|
4
5
|
}
|
|
5
|
-
._HeadingAnalyzer-
|
|
6
|
+
._HeadingAnalyzer-cssWarning_yg0s7_6 {
|
|
6
7
|
display: none !important;
|
|
7
8
|
}
|
|
8
|
-
.
|
|
9
|
+
._HeadingAnalyzerItem_yg0s7_10 {
|
|
9
10
|
display: inline;
|
|
10
11
|
}
|
|
11
|
-
._HeadingAnalyzerItem--
|
|
12
|
+
._HeadingAnalyzerItem--missing_yg0s7_14 {
|
|
12
13
|
color: var(--puck-color-red-04);
|
|
13
14
|
}
|
|
14
15
|
|
|
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
|
-
|
|
160
16
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css/#css-module-data */
|
|
161
17
|
._OutlineList_w4lzv_1 {
|
|
162
18
|
color: var(--puck-color-grey-03);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,185 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties, ElementType,
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, ElementType, Ref, JSX } from 'react';
|
|
2
|
+
import { EditorStateSnapshot, Editor, Extensions } from '@tiptap/react';
|
|
3
|
+
import { BlockquoteOptions } from '@tiptap/extension-blockquote';
|
|
4
|
+
import { BoldOptions } from '@tiptap/extension-bold';
|
|
5
|
+
import { CodeOptions } from '@tiptap/extension-code';
|
|
6
|
+
import { CodeBlockOptions } from '@tiptap/extension-code-block';
|
|
7
|
+
import { HardBreakOptions } from '@tiptap/extension-hard-break';
|
|
8
|
+
import { HeadingOptions } from '@tiptap/extension-heading';
|
|
9
|
+
import { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule';
|
|
10
|
+
import { ItalicOptions } from '@tiptap/extension-italic';
|
|
11
|
+
import { LinkOptions } from '@tiptap/extension-link';
|
|
12
|
+
import { BulletListOptions, ListItemOptions, ListKeymapOptions, OrderedListOptions } from '@tiptap/extension-list';
|
|
13
|
+
import { ParagraphOptions } from '@tiptap/extension-paragraph';
|
|
14
|
+
import { StrikeOptions } from '@tiptap/extension-strike';
|
|
15
|
+
import { TextAlignOptions } from '@tiptap/extension-text-align';
|
|
16
|
+
import { UnderlineOptions } from '@tiptap/extension-underline';
|
|
2
17
|
|
|
3
18
|
type ItemSelector = {
|
|
4
19
|
index: number;
|
|
5
20
|
zone?: string;
|
|
6
21
|
};
|
|
7
22
|
|
|
23
|
+
declare const defaultEditorState: (ctx: EditorStateSnapshot, readOnly: boolean) => {
|
|
24
|
+
isAlignLeft?: undefined;
|
|
25
|
+
canAlignLeft?: undefined;
|
|
26
|
+
isAlignCenter?: undefined;
|
|
27
|
+
canAlignCenter?: undefined;
|
|
28
|
+
isAlignRight?: undefined;
|
|
29
|
+
canAlignRight?: undefined;
|
|
30
|
+
isAlignJustify?: undefined;
|
|
31
|
+
canAlignJustify?: undefined;
|
|
32
|
+
isBold?: undefined;
|
|
33
|
+
canBold?: undefined;
|
|
34
|
+
isItalic?: undefined;
|
|
35
|
+
canItalic?: undefined;
|
|
36
|
+
isUnderline?: undefined;
|
|
37
|
+
canUnderline?: undefined;
|
|
38
|
+
isStrike?: undefined;
|
|
39
|
+
canStrike?: undefined;
|
|
40
|
+
isInlineCode?: undefined;
|
|
41
|
+
canInlineCode?: undefined;
|
|
42
|
+
isBulletList?: undefined;
|
|
43
|
+
canBulletList?: undefined;
|
|
44
|
+
isOrderedList?: undefined;
|
|
45
|
+
canOrderedList?: undefined;
|
|
46
|
+
isCodeBlock?: undefined;
|
|
47
|
+
canCodeBlock?: undefined;
|
|
48
|
+
isBlockquote?: undefined;
|
|
49
|
+
canBlockquote?: undefined;
|
|
50
|
+
canHorizontalRule?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
isAlignLeft: boolean;
|
|
53
|
+
canAlignLeft: boolean;
|
|
54
|
+
isAlignCenter: boolean;
|
|
55
|
+
canAlignCenter: boolean;
|
|
56
|
+
isAlignRight: boolean;
|
|
57
|
+
canAlignRight: boolean;
|
|
58
|
+
isAlignJustify: boolean;
|
|
59
|
+
canAlignJustify: boolean;
|
|
60
|
+
isBold: boolean;
|
|
61
|
+
canBold: boolean;
|
|
62
|
+
isItalic: boolean;
|
|
63
|
+
canItalic: boolean;
|
|
64
|
+
isUnderline: boolean;
|
|
65
|
+
canUnderline: boolean;
|
|
66
|
+
isStrike: boolean;
|
|
67
|
+
canStrike: boolean;
|
|
68
|
+
isInlineCode: boolean;
|
|
69
|
+
canInlineCode: boolean;
|
|
70
|
+
isBulletList: boolean;
|
|
71
|
+
canBulletList: boolean;
|
|
72
|
+
isOrderedList: boolean;
|
|
73
|
+
canOrderedList: boolean;
|
|
74
|
+
isCodeBlock: boolean;
|
|
75
|
+
canCodeBlock: boolean;
|
|
76
|
+
isBlockquote: boolean;
|
|
77
|
+
canBlockquote: boolean;
|
|
78
|
+
canHorizontalRule: boolean;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
type RichTextSelector = (ctx: EditorStateSnapshot, readOnly: boolean) => Partial<Record<string, boolean>>;
|
|
82
|
+
type DefaultEditorState = ReturnType<typeof defaultEditorState>;
|
|
83
|
+
type EditorState<Selector extends RichTextSelector = RichTextSelector> = DefaultEditorState & ReturnType<Selector> & Record<string, boolean | undefined>;
|
|
84
|
+
|
|
85
|
+
interface PuckRichTextOptions {
|
|
86
|
+
/**
|
|
87
|
+
* If set to false, the blockquote extension will not be registered
|
|
88
|
+
* @example blockquote: false
|
|
89
|
+
*/
|
|
90
|
+
blockquote: Partial<BlockquoteOptions> | false;
|
|
91
|
+
/**
|
|
92
|
+
* If set to false, the bold extension will not be registered
|
|
93
|
+
* @example bold: false
|
|
94
|
+
*/
|
|
95
|
+
bold: Partial<BoldOptions> | false;
|
|
96
|
+
/**
|
|
97
|
+
* If set to false, the bulletList extension will not be registered
|
|
98
|
+
* @example bulletList: false
|
|
99
|
+
*/
|
|
100
|
+
bulletList: Partial<BulletListOptions> | false;
|
|
101
|
+
/**
|
|
102
|
+
* If set to false, the code extension will not be registered
|
|
103
|
+
* @example code: false
|
|
104
|
+
*/
|
|
105
|
+
code: Partial<CodeOptions> | false;
|
|
106
|
+
/**
|
|
107
|
+
* If set to false, the codeBlock extension will not be registered
|
|
108
|
+
* @example codeBlock: false
|
|
109
|
+
*/
|
|
110
|
+
codeBlock: Partial<CodeBlockOptions> | false;
|
|
111
|
+
/**
|
|
112
|
+
* If set to false, the document extension will not be registered
|
|
113
|
+
* @example document: false
|
|
114
|
+
*/
|
|
115
|
+
document: false;
|
|
116
|
+
/**
|
|
117
|
+
* If set to false, the hardBreak extension will not be registered
|
|
118
|
+
* @example hardBreak: false
|
|
119
|
+
*/
|
|
120
|
+
hardBreak: Partial<HardBreakOptions> | false;
|
|
121
|
+
/**
|
|
122
|
+
* If set to false, the heading extension will not be registered
|
|
123
|
+
* @example heading: false
|
|
124
|
+
*/
|
|
125
|
+
heading: Partial<HeadingOptions> | false;
|
|
126
|
+
/**
|
|
127
|
+
* If set to false, the horizontalRule extension will not be registered
|
|
128
|
+
* @example horizontalRule: false
|
|
129
|
+
*/
|
|
130
|
+
horizontalRule: Partial<HorizontalRuleOptions> | false;
|
|
131
|
+
/**
|
|
132
|
+
* If set to false, the italic extension will not be registered
|
|
133
|
+
* @example italic: false
|
|
134
|
+
*/
|
|
135
|
+
italic: Partial<ItalicOptions> | false;
|
|
136
|
+
/**
|
|
137
|
+
* If set to false, the listItem extension will not be registered
|
|
138
|
+
* @example listItem: false
|
|
139
|
+
*/
|
|
140
|
+
listItem: Partial<ListItemOptions> | false;
|
|
141
|
+
/**
|
|
142
|
+
* If set to false, the listItemKeymap extension will not be registered
|
|
143
|
+
* @example listKeymap: false
|
|
144
|
+
*/
|
|
145
|
+
listKeymap: Partial<ListKeymapOptions> | false;
|
|
146
|
+
/**
|
|
147
|
+
* If set to false, the link extension will not be registered
|
|
148
|
+
* @example link: false
|
|
149
|
+
*/
|
|
150
|
+
link: Partial<LinkOptions> | false;
|
|
151
|
+
/**
|
|
152
|
+
* If set to false, the orderedList extension will not be registered
|
|
153
|
+
* @example orderedList: false
|
|
154
|
+
*/
|
|
155
|
+
orderedList: Partial<OrderedListOptions> | false;
|
|
156
|
+
/**
|
|
157
|
+
* If set to false, the paragraph extension will not be registered
|
|
158
|
+
* @example paragraph: false
|
|
159
|
+
*/
|
|
160
|
+
paragraph: Partial<ParagraphOptions> | false;
|
|
161
|
+
/**
|
|
162
|
+
* If set to false, the strike extension will not be registered
|
|
163
|
+
* @example strike: false
|
|
164
|
+
*/
|
|
165
|
+
strike: Partial<StrikeOptions> | false;
|
|
166
|
+
/**
|
|
167
|
+
* If set to false, the text extension will not be registered
|
|
168
|
+
* @example text: false
|
|
169
|
+
*/
|
|
170
|
+
text: false;
|
|
171
|
+
/**
|
|
172
|
+
* If set to false, the textAlign extension will not be registered
|
|
173
|
+
* @example text: false
|
|
174
|
+
*/
|
|
175
|
+
textAlign: Partial<TextAlignOptions> | false;
|
|
176
|
+
/**
|
|
177
|
+
* If set to false, the underline extension will not be registered
|
|
178
|
+
* @example underline: false
|
|
179
|
+
*/
|
|
180
|
+
underline: Partial<UnderlineOptions> | false;
|
|
181
|
+
}
|
|
182
|
+
|
|
8
183
|
type FieldOption = {
|
|
9
184
|
label: string;
|
|
10
185
|
value: string | number | boolean | undefined | null | object;
|
|
@@ -41,6 +216,28 @@ interface RadioField extends BaseField {
|
|
|
41
216
|
type: "radio";
|
|
42
217
|
options: FieldOptions;
|
|
43
218
|
}
|
|
219
|
+
interface RichtextField<UserSelector extends RichTextSelector = RichTextSelector> extends BaseField {
|
|
220
|
+
type: "richtext";
|
|
221
|
+
contentEditable?: boolean;
|
|
222
|
+
initialHeight?: CSSProperties["height"];
|
|
223
|
+
options?: Partial<PuckRichTextOptions>;
|
|
224
|
+
renderMenu?: (props: {
|
|
225
|
+
children: ReactNode;
|
|
226
|
+
editor: Editor | null;
|
|
227
|
+
editorState: EditorState<UserSelector> | null;
|
|
228
|
+
readOnly: boolean;
|
|
229
|
+
}) => ReactNode;
|
|
230
|
+
renderInlineMenu?: (props: {
|
|
231
|
+
children: ReactNode;
|
|
232
|
+
editor: Editor | null;
|
|
233
|
+
editorState: EditorState<UserSelector> | null;
|
|
234
|
+
readOnly: boolean;
|
|
235
|
+
}) => ReactNode;
|
|
236
|
+
tiptap?: {
|
|
237
|
+
selector?: UserSelector;
|
|
238
|
+
extensions?: Extensions;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
44
241
|
interface ArrayField<Props extends {
|
|
45
242
|
[key: string]: any;
|
|
46
243
|
}[] = {
|
|
@@ -53,7 +250,7 @@ interface ArrayField<Props extends {
|
|
|
53
250
|
} ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
|
|
54
251
|
};
|
|
55
252
|
defaultItemProps?: Props[0] | ((index: number) => Props[0]);
|
|
56
|
-
getItemSummary?: (item: Props[0], index?: number) =>
|
|
253
|
+
getItemSummary?: (item: Props[0], index?: number) => ReactNode;
|
|
57
254
|
max?: number;
|
|
58
255
|
min?: number;
|
|
59
256
|
}
|
|
@@ -80,7 +277,7 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
|
80
277
|
placeholder?: string;
|
|
81
278
|
adaptor: Adaptor<any, any, Props>;
|
|
82
279
|
adaptorParams?: object;
|
|
83
|
-
getItemSummary: (item: NotUndefined<Props>, index?: number) =>
|
|
280
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
|
|
84
281
|
};
|
|
85
282
|
type CacheOpts = {
|
|
86
283
|
enabled?: boolean;
|
|
@@ -97,7 +294,7 @@ interface ExternalField<Props extends any = {
|
|
|
97
294
|
}) => Promise<any[] | null>;
|
|
98
295
|
mapProp?: (value: any) => Props;
|
|
99
296
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
|
100
|
-
getItemSummary?: (item: NotUndefined<Props>, index?: number) =>
|
|
297
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
|
|
101
298
|
showSearch?: boolean;
|
|
102
299
|
renderFooter?: (props: {
|
|
103
300
|
items: any[];
|
|
@@ -125,7 +322,7 @@ interface SlotField extends BaseField {
|
|
|
125
322
|
allow?: string[];
|
|
126
323
|
disallow?: string[];
|
|
127
324
|
}
|
|
128
|
-
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
325
|
+
type Field<ValueType = any, UserField extends {} = {}> = TextField | RichtextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
129
326
|
[key: string]: any;
|
|
130
327
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
131
328
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps, UserField extends {} = {}> = {
|
|
@@ -146,10 +343,11 @@ type DropZoneProps = {
|
|
|
146
343
|
allow?: string[];
|
|
147
344
|
disallow?: string[];
|
|
148
345
|
style?: CSSProperties;
|
|
149
|
-
minEmptyHeight?: number;
|
|
346
|
+
minEmptyHeight?: CSSProperties["minHeight"] | number;
|
|
150
347
|
className?: string;
|
|
151
348
|
collisionAxis?: DragAxis;
|
|
152
349
|
as?: ElementType;
|
|
350
|
+
ref?: Ref<any>;
|
|
153
351
|
};
|
|
154
352
|
|
|
155
353
|
type PuckContext = {
|
|
@@ -238,6 +436,7 @@ UserField extends BaseField = {}> = {
|
|
|
238
436
|
permissions: Partial<Permissions>;
|
|
239
437
|
appState: AppState;
|
|
240
438
|
lastData: DataShape | null;
|
|
439
|
+
parent: ComponentData | null;
|
|
241
440
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
|
242
441
|
metadata?: ComponentMetadata;
|
|
243
442
|
} & ComponentConfigExtensions;
|
|
@@ -322,6 +521,7 @@ interface FieldMetadata extends Metadata {
|
|
|
322
521
|
type ItemWithId = {
|
|
323
522
|
_arrayId: string;
|
|
324
523
|
_originalIndex: number;
|
|
524
|
+
_currentIndex: number;
|
|
325
525
|
};
|
|
326
526
|
type ArrayState = {
|
|
327
527
|
items: ItemWithId[];
|
|
@@ -332,6 +532,7 @@ type UiState = {
|
|
|
332
532
|
rightSideBarVisible: boolean;
|
|
333
533
|
leftSideBarWidth?: number | null;
|
|
334
534
|
rightSideBarWidth?: number | null;
|
|
535
|
+
mobilePanelExpanded?: boolean;
|
|
335
536
|
itemSelector: ItemSelector | null;
|
|
336
537
|
arrayState: Record<string, ArrayState | undefined>;
|
|
337
538
|
previewMode: "interactive" | "edit";
|
|
@@ -344,7 +545,7 @@ type UiState = {
|
|
|
344
545
|
isDragging: boolean;
|
|
345
546
|
viewports: {
|
|
346
547
|
current: {
|
|
347
|
-
width: number;
|
|
548
|
+
width: number | "100%";
|
|
348
549
|
height: number | "auto";
|
|
349
550
|
};
|
|
350
551
|
controlsVisible: boolean;
|
|
@@ -352,6 +553,10 @@ type UiState = {
|
|
|
352
553
|
};
|
|
353
554
|
field: {
|
|
354
555
|
focus?: string | null;
|
|
556
|
+
metadata?: Record<string, any>;
|
|
557
|
+
};
|
|
558
|
+
plugin: {
|
|
559
|
+
current: string | null;
|
|
355
560
|
};
|
|
356
561
|
};
|
|
357
562
|
type AppState<UserData extends Data = Data> = {
|
|
@@ -396,6 +601,11 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
396
601
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
397
602
|
never
|
|
398
603
|
] ? False : True;
|
|
604
|
+
type RenderFunc<Props extends {
|
|
605
|
+
[key: string]: any;
|
|
606
|
+
} = {
|
|
607
|
+
children: ReactNode;
|
|
608
|
+
}> = (props: Props) => ReactElement;
|
|
399
609
|
|
|
400
610
|
type MapFnParams<ThisField = Field> = {
|
|
401
611
|
value: any;
|
|
@@ -419,11 +629,6 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
419
629
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
420
630
|
}>;
|
|
421
631
|
|
|
422
|
-
type RenderFunc<Props extends {
|
|
423
|
-
[key: string]: any;
|
|
424
|
-
} = {
|
|
425
|
-
children: ReactNode;
|
|
426
|
-
}> = (props: Props) => ReactElement;
|
|
427
632
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
428
633
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
429
634
|
type OverridesGeneric<Shape extends {
|
|
@@ -494,7 +699,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
494
699
|
|
|
495
700
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
496
701
|
type Viewport = {
|
|
497
|
-
width: number;
|
|
702
|
+
width: number | "100%";
|
|
498
703
|
height?: number | "auto";
|
|
499
704
|
label?: string;
|
|
500
705
|
icon?: iconTypes | ReactNode;
|
|
@@ -508,8 +713,13 @@ type Permissions = {
|
|
|
508
713
|
insert: boolean;
|
|
509
714
|
} & Record<string, boolean>;
|
|
510
715
|
type Plugin<UserConfig extends Config = Config> = {
|
|
716
|
+
name?: string;
|
|
717
|
+
label?: string;
|
|
718
|
+
icon?: ReactNode;
|
|
719
|
+
render?: () => ReactElement;
|
|
511
720
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
512
721
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
722
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
513
723
|
};
|
|
514
724
|
type Slot<Props extends {
|
|
515
725
|
[key: string]: DefaultComponentProps;
|