@measured/puck-plugin-emotion-cache 0.21.0-canary.c0db75c1 → 0.21.0-canary.c78dc826
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.d.mts +207 -19
- package/dist/index.d.ts +207 -19
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,185 @@
|
|
|
1
|
-
import { ReactElement,
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, ElementType, 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
|
}[] = {
|
|
@@ -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 {} = {}> = {
|
|
@@ -323,7 +520,6 @@ interface FieldMetadata extends Metadata {
|
|
|
323
520
|
type ItemWithId = {
|
|
324
521
|
_arrayId: string;
|
|
325
522
|
_originalIndex: number;
|
|
326
|
-
_currentIndex: number;
|
|
327
523
|
};
|
|
328
524
|
type ArrayState = {
|
|
329
525
|
items: ItemWithId[];
|
|
@@ -334,7 +530,6 @@ type UiState = {
|
|
|
334
530
|
rightSideBarVisible: boolean;
|
|
335
531
|
leftSideBarWidth?: number | null;
|
|
336
532
|
rightSideBarWidth?: number | null;
|
|
337
|
-
mobilePanelExpanded?: boolean;
|
|
338
533
|
itemSelector: ItemSelector | null;
|
|
339
534
|
arrayState: Record<string, ArrayState | undefined>;
|
|
340
535
|
previewMode: "interactive" | "edit";
|
|
@@ -347,7 +542,7 @@ type UiState = {
|
|
|
347
542
|
isDragging: boolean;
|
|
348
543
|
viewports: {
|
|
349
544
|
current: {
|
|
350
|
-
width: number
|
|
545
|
+
width: number;
|
|
351
546
|
height: number | "auto";
|
|
352
547
|
};
|
|
353
548
|
controlsVisible: boolean;
|
|
@@ -355,9 +550,7 @@ type UiState = {
|
|
|
355
550
|
};
|
|
356
551
|
field: {
|
|
357
552
|
focus?: string | null;
|
|
358
|
-
|
|
359
|
-
plugin: {
|
|
360
|
-
current: string | null;
|
|
553
|
+
metadata?: Record<string, any>;
|
|
361
554
|
};
|
|
362
555
|
};
|
|
363
556
|
type AppState<UserData extends Data = Data> = {
|
|
@@ -402,11 +595,6 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
402
595
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
403
596
|
never
|
|
404
597
|
] ? False : True;
|
|
405
|
-
type RenderFunc<Props extends {
|
|
406
|
-
[key: string]: any;
|
|
407
|
-
} = {
|
|
408
|
-
children: ReactNode;
|
|
409
|
-
}> = (props: Props) => ReactElement;
|
|
410
598
|
|
|
411
599
|
type MapFnParams<ThisField = Field> = {
|
|
412
600
|
value: any;
|
|
@@ -430,6 +618,11 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
430
618
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
431
619
|
}>;
|
|
432
620
|
|
|
621
|
+
type RenderFunc<Props extends {
|
|
622
|
+
[key: string]: any;
|
|
623
|
+
} = {
|
|
624
|
+
children: ReactNode;
|
|
625
|
+
}> = (props: Props) => ReactElement;
|
|
433
626
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
434
627
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
435
628
|
type OverridesGeneric<Shape extends {
|
|
@@ -500,7 +693,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
500
693
|
|
|
501
694
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
502
695
|
type Viewport = {
|
|
503
|
-
width: number
|
|
696
|
+
width: number;
|
|
504
697
|
height?: number | "auto";
|
|
505
698
|
label?: string;
|
|
506
699
|
icon?: iconTypes | ReactNode;
|
|
@@ -514,13 +707,8 @@ type Permissions = {
|
|
|
514
707
|
insert: boolean;
|
|
515
708
|
} & Record<string, boolean>;
|
|
516
709
|
type Plugin<UserConfig extends Config = Config> = {
|
|
517
|
-
name?: string;
|
|
518
|
-
label?: string;
|
|
519
|
-
icon?: ReactNode;
|
|
520
|
-
render?: () => ReactElement;
|
|
521
710
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
522
711
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
523
|
-
mobilePanelHeight?: "toggle" | "min-content";
|
|
524
712
|
};
|
|
525
713
|
type Slot<Props extends {
|
|
526
714
|
[key: string]: DefaultComponentProps;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,185 @@
|
|
|
1
|
-
import { ReactElement,
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, ElementType, 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
|
}[] = {
|
|
@@ -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 {} = {}> = {
|
|
@@ -323,7 +520,6 @@ interface FieldMetadata extends Metadata {
|
|
|
323
520
|
type ItemWithId = {
|
|
324
521
|
_arrayId: string;
|
|
325
522
|
_originalIndex: number;
|
|
326
|
-
_currentIndex: number;
|
|
327
523
|
};
|
|
328
524
|
type ArrayState = {
|
|
329
525
|
items: ItemWithId[];
|
|
@@ -334,7 +530,6 @@ type UiState = {
|
|
|
334
530
|
rightSideBarVisible: boolean;
|
|
335
531
|
leftSideBarWidth?: number | null;
|
|
336
532
|
rightSideBarWidth?: number | null;
|
|
337
|
-
mobilePanelExpanded?: boolean;
|
|
338
533
|
itemSelector: ItemSelector | null;
|
|
339
534
|
arrayState: Record<string, ArrayState | undefined>;
|
|
340
535
|
previewMode: "interactive" | "edit";
|
|
@@ -347,7 +542,7 @@ type UiState = {
|
|
|
347
542
|
isDragging: boolean;
|
|
348
543
|
viewports: {
|
|
349
544
|
current: {
|
|
350
|
-
width: number
|
|
545
|
+
width: number;
|
|
351
546
|
height: number | "auto";
|
|
352
547
|
};
|
|
353
548
|
controlsVisible: boolean;
|
|
@@ -355,9 +550,7 @@ type UiState = {
|
|
|
355
550
|
};
|
|
356
551
|
field: {
|
|
357
552
|
focus?: string | null;
|
|
358
|
-
|
|
359
|
-
plugin: {
|
|
360
|
-
current: string | null;
|
|
553
|
+
metadata?: Record<string, any>;
|
|
361
554
|
};
|
|
362
555
|
};
|
|
363
556
|
type AppState<UserData extends Data = Data> = {
|
|
@@ -402,11 +595,6 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
402
595
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
403
596
|
never
|
|
404
597
|
] ? False : True;
|
|
405
|
-
type RenderFunc<Props extends {
|
|
406
|
-
[key: string]: any;
|
|
407
|
-
} = {
|
|
408
|
-
children: ReactNode;
|
|
409
|
-
}> = (props: Props) => ReactElement;
|
|
410
598
|
|
|
411
599
|
type MapFnParams<ThisField = Field> = {
|
|
412
600
|
value: any;
|
|
@@ -430,6 +618,11 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
430
618
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
431
619
|
}>;
|
|
432
620
|
|
|
621
|
+
type RenderFunc<Props extends {
|
|
622
|
+
[key: string]: any;
|
|
623
|
+
} = {
|
|
624
|
+
children: ReactNode;
|
|
625
|
+
}> = (props: Props) => ReactElement;
|
|
433
626
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
434
627
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
435
628
|
type OverridesGeneric<Shape extends {
|
|
@@ -500,7 +693,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
500
693
|
|
|
501
694
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
502
695
|
type Viewport = {
|
|
503
|
-
width: number
|
|
696
|
+
width: number;
|
|
504
697
|
height?: number | "auto";
|
|
505
698
|
label?: string;
|
|
506
699
|
icon?: iconTypes | ReactNode;
|
|
@@ -514,13 +707,8 @@ type Permissions = {
|
|
|
514
707
|
insert: boolean;
|
|
515
708
|
} & Record<string, boolean>;
|
|
516
709
|
type Plugin<UserConfig extends Config = Config> = {
|
|
517
|
-
name?: string;
|
|
518
|
-
label?: string;
|
|
519
|
-
icon?: ReactNode;
|
|
520
|
-
render?: () => ReactElement;
|
|
521
710
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
522
711
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
523
|
-
mobilePanelHeight?: "toggle" | "min-content";
|
|
524
712
|
};
|
|
525
713
|
type Slot<Props extends {
|
|
526
714
|
[key: string]: DefaultComponentProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@measured/puck-plugin-emotion-cache",
|
|
3
|
-
"version": "0.21.0-canary.
|
|
3
|
+
"version": "0.21.0-canary.c78dc826",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": "measuredco/puck",
|
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@emotion/react": "^11.13.3",
|
|
27
|
-
"@measured/puck": "^0.21.0-canary.
|
|
27
|
+
"@measured/puck": "^0.21.0-canary.c78dc826",
|
|
28
28
|
"@types/minimatch": "3.0.5",
|
|
29
29
|
"@types/react": "^19.0.1",
|
|
30
30
|
"@types/react-dom": "^19.0.2",
|