@maily-to/core 0.3.7 → 2.0.0-beta.1

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.
Files changed (46) hide show
  1. package/dist/blocks/index.cjs +22 -305
  2. package/dist/blocks/index.d.cts +38 -59
  3. package/dist/blocks/index.d.cts.map +1 -0
  4. package/dist/blocks/index.d.mts +38 -0
  5. package/dist/blocks/index.d.mts.map +1 -0
  6. package/dist/blocks/index.mjs +2 -273
  7. package/dist/chunk-CfYAbeIz.mjs +13 -0
  8. package/dist/extensions/index.cjs +375 -9101
  9. package/dist/extensions/index.d.cts +337 -406
  10. package/dist/extensions/index.d.cts.map +1 -0
  11. package/dist/extensions/index.d.mts +379 -0
  12. package/dist/extensions/index.d.mts.map +1 -0
  13. package/dist/extensions/index.mjs +353 -9050
  14. package/dist/extensions/index.mjs.map +1 -1
  15. package/dist/index.cjs +13117 -12141
  16. package/dist/index.css +1302 -1477
  17. package/dist/index.d.cts +103 -59
  18. package/dist/index.d.cts.map +1 -0
  19. package/dist/index.d.mts +105 -0
  20. package/dist/index.d.mts.map +1 -0
  21. package/dist/index.mjs +13098 -12191
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/slash-command-BmWRVPbv.d.mts +39 -0
  24. package/dist/slash-command-BmWRVPbv.d.mts.map +1 -0
  25. package/dist/slash-command-CK0-1FwR.d.cts +39 -0
  26. package/dist/slash-command-CK0-1FwR.d.cts.map +1 -0
  27. package/dist/spacer-DBtsr3hu.cjs +5768 -0
  28. package/dist/spacer-DzZWX-wB.mjs +5456 -0
  29. package/dist/spacer-DzZWX-wB.mjs.map +1 -0
  30. package/dist/typography-CWL13acR.cjs +400 -0
  31. package/dist/typography-DhrUe809.mjs +282 -0
  32. package/dist/typography-DhrUe809.mjs.map +1 -0
  33. package/dist/variable-C9S9ZoHv.d.cts +108 -0
  34. package/dist/variable-C9S9ZoHv.d.cts.map +1 -0
  35. package/dist/variable-DVwGrg2a.d.mts +108 -0
  36. package/dist/variable-DVwGrg2a.d.mts.map +1 -0
  37. package/package.json +95 -172
  38. package/readme.md +298 -181
  39. package/dist/blocks/index.cjs.map +0 -1
  40. package/dist/blocks/index.d.ts +0 -59
  41. package/dist/blocks/index.mjs.map +0 -1
  42. package/dist/extensions/index.cjs.map +0 -1
  43. package/dist/extensions/index.d.ts +0 -448
  44. package/dist/index.cjs.map +0 -1
  45. package/dist/index.css.map +0 -1
  46. package/dist/index.d.ts +0 -63
@@ -1,448 +1,379 @@
1
- import * as _tiptap_core from '@tiptap/core';
2
- import { Editor, Extension, Range, Node } from '@tiptap/core';
3
- import { ColorOptions } from '@tiptap/extension-color';
4
- import * as _tiptap_extension_horizontal_rule from '@tiptap/extension-horizontal-rule';
5
- import { Plugin, PluginKey } from '@tiptap/pm/state';
6
- import * as _tiptap_extension_link from '@tiptap/extension-link';
7
- import { LinkOptions } from '@tiptap/extension-link';
8
- import * as _tiptap_extension_placeholder from '@tiptap/extension-placeholder';
9
- import { SuggestionOptions } from '@tiptap/suggestion';
10
- import * as _tiptap_react from '@tiptap/react';
11
- import * as _tiptap_extension_image from '@tiptap/extension-image';
12
- import { Node as Node$1 } from '@tiptap/pm/model';
13
- import * as react from 'react';
14
- import * as _tiptap_extension_code_block_lowlight from '@tiptap/extension-code-block-lowlight';
15
-
16
- type ColorStorage = {
17
- /**
18
- * Last 5 used colors
19
- */
20
- colors: Set<string>;
21
- };
22
- declare const Color: _tiptap_core.Extension<ColorOptions, ColorStorage>;
23
-
24
- declare const HorizontalRule: _tiptap_core.Node<_tiptap_extension_horizontal_rule.HorizontalRuleOptions, any>;
25
-
26
- type ImageUploadPluginOptions = {
27
- editor: Editor;
28
- /**
29
- * Allows you to define a list of allowed mime types for dropped or pasted images.
30
- * @default ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml']
31
- */
32
- allowedMimeTypes?: string[];
33
- /**
34
- * The onImageUpload callback that is called when an image is dropped or pasted.
35
- * @param file the image file
36
- * @returns Returns the image URL as a string.
37
- */
38
- onImageUpload?: (file: Blob) => Promise<string>;
39
- };
40
- declare function ImageUploadPlugin(options: ImageUploadPluginOptions): Plugin<any>;
41
-
42
- type ImageUploadOptions = Omit<ImageUploadPluginOptions, 'editor'> & {};
43
- type ImageUploadStorage = {
44
- placeholderImages: Set<string>;
45
- };
46
- declare const ImageUploadExtension: Extension<Omit<ImageUploadPluginOptions, "editor">, any>;
47
- declare function useImageUploadOptions(editor: Editor): ImageUploadOptions;
1
+ import { t as SlashCommandGroupItem } from "../slash-command-CK0-1FwR.cjs";
2
+ import { o as VariableOptions, r as Variables } from "../variable-C9S9ZoHv.cjs";
3
+ import * as _tiptap_core0 from "@tiptap/core";
4
+ import { Editor, Extension, Node } from "@tiptap/core";
5
+ import * as _tiptap_extension_blockquote0 from "@tiptap/extension-blockquote";
6
+ import { AllowedButtonKind, AllowedFieldMode, AllowedTextAlignment, BorderStyleConfig, ColumnAttributes, ColumnsAttributes, FontFamilyItem, FontStyleAttributes, FooterAttributes, HtmlCodeBlockAttributes, LinkCardAttributes, RepeatAttributes, SectionAttributes, SpacerAttributes, TextDirection, VisibilityRule } from "@maily-to/shared";
7
+ import * as _tiptap_extension_horizontal_rule0 from "@tiptap/extension-horizontal-rule";
8
+ import * as _tiptap_extension_code_block_lowlight0 from "@tiptap/extension-code-block-lowlight";
9
+ import { ImageOptions } from "@tiptap/extension-image";
10
+ import { SuggestionOptions } from "@tiptap/suggestion";
11
+ import { PluginKey } from "@tiptap/pm/state";
48
12
 
13
+ //#region src/extensions/blockquote/blockquote.d.ts
14
+ declare const BlockquoteExtension: _tiptap_core0.Node<_tiptap_extension_blockquote0.BlockquoteOptions, any>;
15
+ //#endregion
16
+ //#region src/extensions/button/button.d.ts
17
+ type ButtonAttributes = {
18
+ dir: TextDirection | null;
19
+ url: string;
20
+ kind: AllowedButtonKind;
21
+ alignment: AllowedTextAlignment | null;
22
+ backgroundColor: string | null;
23
+ color: string | null;
24
+ paddingMode: AllowedFieldMode;
25
+ paddingTop: number;
26
+ paddingRight: number;
27
+ paddingBottom: number;
28
+ paddingLeft: number;
29
+ } & BorderStyleConfig & FontStyleAttributes;
49
30
  declare module '@tiptap/core' {
50
- interface Commands<ReturnType> {
51
- linkCard: {
52
- setLinkCard: () => ReturnType;
53
- };
54
- }
31
+ interface Commands<ReturnType> {
32
+ button: {
33
+ setButton: (attrs?: Partial<ButtonAttributes>) => ReturnType;
34
+ updateButtonAttributes: (attrs: Partial<ButtonAttributes>) => ReturnType;
35
+ };
36
+ }
55
37
  }
56
- type LinkCardOptions = {};
57
-
58
- type MailyKitOptions = {
59
- linkCard?: Partial<LinkCardOptions> | false;
60
- repeat?: Partial<{}> | false;
61
- section?: Partial<{}> | false;
62
- columns?: Partial<{}> | false;
63
- column?: Partial<{}> | false;
64
- button?: Partial<{}> | false;
65
- spacer?: Partial<{}> | false;
66
- logo?: Partial<{}> | false;
67
- image?: Partial<{}> | false;
68
- link?: Partial<LinkOptions> | false;
69
- };
70
- declare const MailyKit: Extension<MailyKitOptions, any>;
71
-
72
- declare const PlaceholderExtension: _tiptap_core.Extension<_tiptap_extension_placeholder.PlaceholderOptions, any>;
73
-
74
- type SlashCommandOptions = {
75
- suggestion: Omit<SuggestionOptions, 'editor'>;
38
+ declare const ButtonExtension: Node<any, any>;
39
+ //#endregion
40
+ //#region src/extensions/columns/column.d.ts
41
+ type ColumnOptions = {
42
+ HTMLAttributes: Record<string, any>;
76
43
  };
77
- declare const SlashCommandExtension: Extension<SlashCommandOptions, any>;
78
-
79
- interface CommandProps {
80
- editor: Editor;
81
- range: Range;
44
+ declare module '@tiptap/core' {
45
+ interface Commands<ReturnType> {
46
+ column: {
47
+ updateColumn: (attrs: Partial<ColumnAttributes>) => ReturnType;
48
+ };
49
+ }
82
50
  }
83
- type BlockItem = {
84
- title: string;
85
- description?: string;
86
- searchTerms: string[];
87
- icon?: JSX.Element;
88
- render?: (editor: Editor) => JSX.Element | null | true;
89
- preview?: string | ((editor: Editor) => JSX.Element | null);
90
- } & ({
91
- command: (options: CommandProps) => void;
92
- id?: never;
93
- commands?: never;
94
- } | {
95
- /**
96
- * id to be used for the slash command query
97
- * `headers.` will go inside the header subcommand
98
- */
99
- id: string;
100
- command?: never;
101
- commands: BlockItem[];
102
- });
103
- type BlockGroupItem = {
104
- title: string;
105
- commands: BlockItem[];
51
+ declare const ColumnExtension: Node<ColumnOptions, any>;
52
+ //#endregion
53
+ //#region src/extensions/columns/columns.d.ts
54
+ type ColumnsOptions = {
55
+ HTMLAttributes: Record<string, any>;
106
56
  };
107
-
108
- declare function getSlashCommandSuggestions(groups?: BlockGroupItem[]): Omit<SuggestionOptions, 'editor'>;
109
-
110
- declare const allowedLogoSize: readonly ["sm", "md", "lg"];
111
- type AllowedLogoSize = (typeof allowedLogoSize)[number];
112
- declare const allowedLogoAlignment: readonly ["left", "center", "right"];
113
- type AllowedLogoAlignment = (typeof allowedLogoAlignment)[number];
114
- interface LogoOptions {
115
- src: string;
116
- alt?: string;
117
- title?: string;
118
- size?: AllowedLogoSize;
119
- alignment?: AllowedLogoAlignment;
120
- }
121
- interface LogoAttributes {
122
- src?: string;
123
- size?: AllowedLogoSize;
124
- alignment?: AllowedLogoAlignment;
125
- showIfKey: string;
126
- isSrcVariable?: boolean;
127
- }
128
57
  declare module '@tiptap/core' {
129
- interface Commands<ReturnType> {
130
- logo: {
131
- setLogoImage: (options: LogoOptions) => ReturnType;
132
- setLogoAttributes: (attributes: Partial<LogoAttributes>) => ReturnType;
133
- };
134
- }
58
+ interface Commands<ReturnType> {
59
+ columns: {
60
+ setColumns: (columnCount?: number) => ReturnType;
61
+ updateColumns: (attrs: Partial<ColumnsAttributes>) => ReturnType;
62
+ addColumn: () => ReturnType;
63
+ removeColumn: () => ReturnType;
64
+ };
65
+ }
135
66
  }
136
- declare const DEFAULT_LOGO_SIZE: AllowedLogoSize;
137
- declare const logoSizes: Record<AllowedLogoSize, string>;
138
- declare const LogoExtension: _tiptap_react.Node<_tiptap_extension_image.ImageOptions, any>;
139
-
140
- declare const DEFAULT_BUTTON_ALIGNMENT: AllowedLogoAlignment;
141
- declare const DEFAULT_BUTTON_VARIANT: AllowedButtonVariant;
142
- declare const DEFAULT_BUTTON_BORDER_RADIUS: AllowedButtonBorderRadius;
143
- declare const DEFAULT_BUTTON_BACKGROUND_COLOR: null;
144
- declare const DEFAULT_BUTTON_TEXT_COLOR: null;
145
- declare const DEFAULT_BUTTON_PADDING_TOP: null;
146
- declare const DEFAULT_BUTTON_PADDING_RIGHT: null;
147
- declare const DEFAULT_BUTTON_PADDING_BOTTOM: null;
148
- declare const DEFAULT_BUTTON_PADDING_LEFT: null;
149
- declare const allowedButtonVariant: readonly ["filled", "outline"];
150
- type AllowedButtonVariant = (typeof allowedButtonVariant)[number];
151
- declare const allowedButtonBorderRadius: readonly ["sharp", "smooth", "round"];
152
- type AllowedButtonBorderRadius = (typeof allowedButtonBorderRadius)[number];
153
- type ButtonAttributes = {
154
- text: string;
155
- isTextVariable: boolean;
156
- url: string;
157
- isUrlVariable: boolean;
158
- alignment: AllowedLogoAlignment;
159
- variant: AllowedButtonVariant;
160
- borderRadius: AllowedButtonBorderRadius;
161
- buttonColor: string;
162
- textColor: string;
163
- showIfKey: string;
164
- paddingTop: number;
165
- paddingRight: number;
166
- paddingBottom: number;
167
- paddingLeft: number;
67
+ declare const ColumnsExtension: Node<ColumnsOptions, any>;
68
+ //#endregion
69
+ //#region src/extensions/font-style/font-style.d.ts
70
+ type FontStyleOptions = {
71
+ types: string[];
72
+ fontFamilies: FontFamilyItem[];
168
73
  };
169
74
  declare module '@tiptap/core' {
170
- interface Commands<ReturnType> {
171
- button: {
172
- setButton: () => ReturnType;
173
- updateButton: (attrs: Partial<ButtonAttributes>) => ReturnType;
174
- };
175
- }
75
+ interface Commands<ReturnType> {
76
+ fontStyle: {
77
+ setFontStyle: (attrs: Partial<FontStyleAttributes>) => ReturnType;
78
+ unsetFontStyle: () => ReturnType;
79
+ };
80
+ }
176
81
  }
177
- declare const ButtonExtension: Node<any, any>;
178
-
179
- declare const DEFAULT_COLUMN_WIDTH = "auto";
180
- type AllowedColumnVerticalAlign = 'top' | 'middle' | 'bottom';
181
- declare const DEFAULT_COLUMN_VERTICAL_ALIGN: AllowedColumnVerticalAlign;
182
- interface ColumnAttributes {
183
- verticalAlign: AllowedColumnVerticalAlign;
184
- backgroundColor: string;
185
- borderRadius: number;
186
- align: string;
187
- borderWidth: number;
188
- borderColor: string;
189
- paddingTop: number;
190
- paddingRight: number;
191
- paddingBottom: number;
192
- paddingLeft: number;
193
- showIfKey: string;
82
+ declare const FontStyleExtension: Extension<FontStyleOptions, any>;
83
+ //#endregion
84
+ //#region src/extensions/footer/footer.d.ts
85
+ type FooterOptions = {
86
+ HTMLAttributes: Record<string, any>;
87
+ };
88
+ declare module '@tiptap/core' {
89
+ interface Commands<ReturnType> {
90
+ footer: {
91
+ setFooter: () => ReturnType;
92
+ updateFooterAttributes: (attrs: Partial<FooterAttributes>) => ReturnType;
93
+ };
94
+ }
194
95
  }
96
+ declare const FooterExtension: Node<FooterOptions, any>;
97
+ //#endregion
98
+ //#region src/extensions/horizontal-rule/horizontal-rule.d.ts
99
+ declare const HorizontalRuleExtension: _tiptap_core0.Node<_tiptap_extension_horizontal_rule0.HorizontalRuleOptions, any>;
100
+ //#endregion
101
+ //#region src/extensions/html-code-block/html-code-block.d.ts
195
102
  declare module '@tiptap/core' {
196
- interface Commands<ReturnType> {
197
- column: {
198
- updateColumn: (attrs: Partial<ColumnAttributes>) => ReturnType;
199
- };
200
- }
103
+ interface Commands<ReturnType> {
104
+ htmlCodeBlock: {
105
+ setHtmlCodeBlock: (attributes?: {
106
+ language: string;
107
+ }) => ReturnType;
108
+ updateHtmlCodeBlock: (attrs: Partial<HtmlCodeBlockAttributes>) => ReturnType;
109
+ };
110
+ }
201
111
  }
202
- declare const ColumnExtension: Node<any, any>;
203
-
204
- declare const DEFAULT_COLUMNS_GAP = 8;
205
- interface ColumnsAttributes {
206
- showIfKey: string;
207
- gap: number;
112
+ declare const HtmlCodeBlockExtension: _tiptap_core0.Node<_tiptap_extension_code_block_lowlight0.CodeBlockLowlightOptions, any>;
113
+ //#endregion
114
+ //#region src/extensions/image-upload/image-upload.d.ts
115
+ declare const IMAGE_UPLOAD_STATUSES: {
116
+ readonly IDLE: 'idle';
117
+ readonly LOADING: 'loading';
118
+ readonly ERROR: 'error';
119
+ readonly LOADED: 'loaded';
120
+ };
121
+ type ImageUploadStatus = (typeof IMAGE_UPLOAD_STATUSES)[keyof typeof IMAGE_UPLOAD_STATUSES];
122
+ type ImageUploadStorage = {
123
+ uploads: Map<string, ImageUploadStatus>;
124
+ };
125
+ declare module '@tiptap/core' {
126
+ interface Storage {
127
+ imageUpload: ImageUploadStorage;
128
+ }
208
129
  }
130
+ type ImageUploadContext = {
131
+ position: number;
132
+ removeImage: () => void;
133
+ };
134
+ type ImageUploadOptions = {
135
+ onImageUpload?: (file: File, context: ImageUploadContext) => Promise<string>;
136
+ onImageUploadError?: (error: unknown, file: File, context: ImageUploadContext) => void;
137
+ };
138
+ declare const ImageUploadExtension: Extension<ImageUploadOptions, ImageUploadStorage>;
139
+ //#endregion
140
+ //#region src/extensions/inline-image/inline-image.d.ts
141
+ type InlineImageAttributes = {
142
+ src: string;
143
+ alt: string | null;
144
+ title: string | null;
145
+ width: number;
146
+ height: number;
147
+ externalLink: string | null;
148
+ };
149
+ type InlineImageOptions = {
150
+ HTMLAttributes: Record<string, any>;
151
+ };
209
152
  declare module '@tiptap/core' {
210
- interface Commands<ReturnType> {
211
- columns: {
212
- setColumns: () => ReturnType;
213
- updateColumns: (attrs: Partial<ColumnsAttributes>) => ReturnType;
214
- };
215
- }
153
+ interface Commands<ReturnType> {
154
+ inlineImage: {
155
+ setInlineImage: (attrs: Partial<InlineImageAttributes>) => ReturnType;
156
+ updateInlineImageAttributes: (attrs: Partial<InlineImageAttributes>) => ReturnType;
157
+ };
158
+ }
216
159
  }
217
- declare const ColumnsExtension: Node<any, any>;
218
-
219
- declare const allowedTextDirection: readonly ["ltr", "rtl"];
220
- type AllowedTextDirection = (typeof allowedTextDirection)[number];
160
+ declare const InlineImageExtension: Node<InlineImageOptions, any>;
161
+ //#endregion
162
+ //#region src/extensions/link-card/link-card.d.ts
163
+ type LinkCardOptions = {
164
+ HTMLAttributes: Record<string, any>;
165
+ };
221
166
  declare module '@tiptap/core' {
222
- interface Commands<ReturnType> {
223
- textDirection: {
224
- setTextDirection: (direction: AllowedTextDirection) => ReturnType;
225
- };
226
- }
167
+ interface Commands<ReturnType> {
168
+ linkCard: {
169
+ setLinkCard: (attrs?: Partial<LinkCardAttributes>) => ReturnType;
170
+ updateLinkCardAttributes: (attrs: Partial<LinkCardAttributes>) => ReturnType;
171
+ };
172
+ }
227
173
  }
228
-
229
- interface FooterOptions {
230
- HTMLAttributes: Record<string, any>;
174
+ declare const LinkCardExtension: Node<LinkCardOptions, any>;
175
+ //#endregion
176
+ //#region src/extensions/repeat/repeat.d.ts
177
+ type RepeatOptions = {
178
+ HTMLAttributes: Record<string, any>;
179
+ };
180
+ declare module '@tiptap/core' {
181
+ interface Commands<ReturnType> {
182
+ repeat: {
183
+ setRepeat: (attrs?: Partial<RepeatAttributes>) => ReturnType;
184
+ updateRepeat: (attrs: Partial<RepeatAttributes>) => ReturnType;
185
+ };
186
+ }
231
187
  }
188
+ declare const RepeatExtension: Node<RepeatOptions, any>;
189
+ //#endregion
190
+ //#region src/extensions/resizable-image/resizable-image.d.ts
191
+ declare const ResizableImageExtension: _tiptap_core0.Node<ImageOptions, any>;
192
+ //#endregion
193
+ //#region src/extensions/section/section.d.ts
194
+ type SectionOptions = {
195
+ HTMLAttributes: Record<string, any>;
196
+ };
232
197
  declare module '@tiptap/core' {
233
- interface Commands<ReturnType> {
234
- footer: {
235
- setFooter: () => ReturnType;
236
- setFooterTextDirection: (direction: AllowedTextDirection) => ReturnType;
237
- };
238
- }
198
+ interface Commands<ReturnType> {
199
+ section: {
200
+ setSection: () => ReturnType;
201
+ updateSection: (attrs: Partial<SectionAttributes>) => ReturnType;
202
+ };
203
+ }
239
204
  }
240
- declare const Footer: Node<FooterOptions, any>;
241
-
242
- declare const ImageExtension: _tiptap_react.Node<_tiptap_extension_image.ImageOptions, any>;
243
-
205
+ declare const SectionExtension: Node<SectionOptions, any>;
206
+ //#endregion
207
+ //#region src/extensions/slash-command/slash-command.d.ts
244
208
  declare module '@tiptap/core' {
245
- interface Commands<ReturnType> {
246
- customLink: {
247
- setIsUrlVariable: (isUrlVariable: boolean) => ReturnType;
248
- };
249
- }
209
+ interface Storage {
210
+ slashCommand: SlashCommandStorage;
211
+ }
250
212
  }
251
- declare const LinkExtension: _tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any>;
252
-
253
- type RepeatAttributes = {
254
- each: string;
255
- isUpdatingKey: boolean;
256
- showIfKey: string;
213
+ type SlashCommandStorage = {
214
+ commands: SlashCommandGroupItem[];
215
+ };
216
+ type SlashCommandOptions = {
217
+ suggestion: Omit<SuggestionOptions, 'editor'>;
218
+ commands: SlashCommandGroupItem[];
219
+ };
220
+ declare const SlashCommandExtension: Extension<SlashCommandOptions, SlashCommandStorage>;
221
+ //#endregion
222
+ //#region src/extensions/spacer/spacer.d.ts
223
+ type SpacerOptions = {
224
+ HTMLAttributes: Record<string, any>;
257
225
  };
258
226
  declare module '@tiptap/core' {
259
- interface Commands<ReturnType> {
260
- repeat: {
261
- setRepeat: () => ReturnType;
262
- updateRepeat: (attrs: Partial<RepeatAttributes>) => ReturnType;
263
- };
264
- }
227
+ interface Commands<ReturnType> {
228
+ spacer: {
229
+ setSpacer: (attrs?: Partial<SpacerAttributes>) => ReturnType;
230
+ updateSpacerAttributes: (attrs: Partial<SpacerAttributes>) => ReturnType;
231
+ unsetSpacer: () => ReturnType;
232
+ };
233
+ }
265
234
  }
266
- declare const RepeatExtension: Node<any, any>;
267
-
268
- declare const DEFAULT_SECTION_BACKGROUND_COLOR = "#f7f7f7";
269
- declare const DEFAULT_SECTION_ALIGN = "left";
270
- declare const DEFAULT_SECTION_BORDER_WIDTH = 2;
271
- declare const DEFAULT_SECTION_BORDER_COLOR = "#e2e2e2";
272
- declare const DEFAULT_SECTION_BORDER_RADIUS = 0;
273
- declare const DEFAULT_SECTION_MARGIN_TOP = 0;
274
- declare const DEFAULT_SECTION_MARGIN_RIGHT = 0;
275
- declare const DEFAULT_SECTION_MARGIN_BOTTOM = 0;
276
- declare const DEFAULT_SECTION_MARGIN_LEFT = 0;
277
- declare const DEFAULT_SECTION_PADDING_TOP = 0;
278
- declare const DEFAULT_SECTION_PADDING_RIGHT = 0;
279
- declare const DEFAULT_SECTION_PADDING_BOTTOM = 0;
280
- declare const DEFAULT_SECTION_PADDING_LEFT = 0;
281
- declare const DEFAULT_SECTION_SHOW_IF_KEY: null;
282
- type SectionAttributes = {
283
- borderRadius: number;
284
- backgroundColor: string;
285
- align: string;
286
- borderWidth: number;
287
- borderColor: string;
288
- marginTop: number;
289
- marginRight: number;
290
- marginBottom: number;
291
- marginLeft: number;
292
- paddingTop: number;
293
- paddingRight: number;
294
- paddingBottom: number;
295
- paddingLeft: number;
296
- showIfKey: string | null;
235
+ declare const SpacerExtension: Node<SpacerOptions, any>;
236
+ //#endregion
237
+ //#region src/extensions/variable/variable.d.ts
238
+ type CoreVariableOptions = VariableOptions & {
239
+ variables?: Variables;
240
+ };
241
+ type CoreVariableStorage = {
242
+ variables?: Variables;
297
243
  };
298
244
  declare module '@tiptap/core' {
299
- interface Commands<ReturnType> {
300
- section: {
301
- setSection: () => ReturnType;
302
- updateSection: (attrs: Partial<SectionAttributes>) => ReturnType;
303
- };
304
- }
245
+ interface Storage {
246
+ variable: CoreVariableStorage;
247
+ }
305
248
  }
306
- declare const SectionExtension: Node<any, any>;
307
-
308
- interface SpacerOptions {
309
- height: number;
310
- showIfKey: string;
311
- HTMLAttributes: Record<string, any>;
249
+ declare const VariableExtension: _tiptap_core0.Node<CoreVariableOptions, CoreVariableStorage>;
250
+ //#endregion
251
+ //#region src/extensions/visibility/visibility.d.ts
252
+ type VisibilityAttributes = {
253
+ visibilityRule: VisibilityRule | null;
254
+ };
255
+ type VisibilityOptions = {
256
+ types: string[];
257
+ };
258
+ declare module '@tiptap/core' {
259
+ interface Commands<ReturnType> {
260
+ visibility: {
261
+ setVisibility: (attrs: Partial<VisibilityAttributes>) => ReturnType;
262
+ unsetVisibility: () => ReturnType;
263
+ };
264
+ }
312
265
  }
266
+ declare const VisibilityExtension: Extension<VisibilityOptions, any>;
267
+ //#endregion
268
+ //#region ../extension-ai-actions/dist/index.d.mts
313
269
  declare module '@tiptap/core' {
314
- interface Commands<ReturnType> {
315
- spacer: {
316
- setSpacer: (options: {
317
- height: number;
318
- }) => ReturnType;
319
- setSpacerSize: (height: number) => ReturnType;
320
- setSpacerShowIfKey: (showIfKey: string) => ReturnType;
321
- unsetSpacer: () => ReturnType;
322
- };
323
- }
270
+ interface Commands<ReturnType> {
271
+ aiActions: {
272
+ /**
273
+ * Run a named AI action on the current text selection.
274
+ * The action string is forwarded to the user-provided `transform`
275
+ * callback so it can decide which prompt / model to use.
276
+ */
277
+ runAIAction: (action: string) => ReturnType; /** Abort any in-flight AI action and reset loading state. */
278
+ cancelAIAction: () => ReturnType;
279
+ };
280
+ }
324
281
  }
325
- declare const DEFAULT_SPACER_HEIGHT = 8;
326
- declare const Spacer: Node<SpacerOptions, any>;
327
-
328
- type VariableSuggestionsPopoverProps = {
329
- items: Variable[];
330
- onSelectItem: (item: Variable) => void;
331
- };
332
- type VariableSuggestionsPopoverRef = {
333
- moveUp: () => void;
334
- moveDown: () => void;
335
- select: () => void;
282
+ type AIActionsTransformParams = {
283
+ /** The plain-text content of the current selection. */text: string; /** The action identifier passed to `runAIAction`. */
284
+ action: string;
336
285
  };
337
- type VariableSuggestionsPopoverType = React.ForwardRefExoticComponent<VariableSuggestionsPopoverProps & React.RefAttributes<VariableSuggestionsPopoverRef>>;
338
-
339
- type Variable = {
340
- name: string;
341
- required?: boolean;
342
- valid?: boolean;
343
- hideDefaultValue?: boolean;
344
- label?: string;
286
+ type AIActionsTransformContext = {
287
+ /** Abort signal — cancelled when `cancelAIAction` is called. */signal: AbortSignal; /** The Tiptap editor instance. */
288
+ editor: Editor;
289
+ /**
290
+ * Streaming callback — call with the **full accumulated text so far**
291
+ * to progressively replace the original selection. Each call replaces
292
+ * the entire range, so always pass the complete text, not a delta.
293
+ */
294
+ write: (text: string) => void;
345
295
  };
346
- type VariableFunctionOptions = {
347
- query: string;
348
- from: 'content-variable' | 'bubble-variable' | 'repeat-variable';
349
- editor: Editor;
296
+ type AIActionsOptions = {
297
+ /**
298
+ * Transform the selected text using an AI action.
299
+ *
300
+ * @param params - the selected text and action name
301
+ * @param ctx - context with editor instance, abort signal, and
302
+ * streaming `write` callback
303
+ *
304
+ * **Return value:**
305
+ * - Return a `string` to replace the selection in one shot.
306
+ * - Return `void` / `undefined` if you used `write()` for streaming
307
+ * (the last `write()` value is used as the final text).
308
+ */
309
+ transform: (params: AIActionsTransformParams, ctx: AIActionsTransformContext) => Promise<string | void>;
350
310
  };
351
- type VariablesFunction = (opts: VariableFunctionOptions) => Array<Variable>;
352
- type Variables = Array<Variable> | VariablesFunction;
353
- declare const DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
354
- declare const DEFAULT_VARIABLES: Variables;
355
- declare const DEFAULT_RENDER_VARIABLE_FUNCTION: RenderVariableFunction;
356
- declare const DEFAULT_VARIABLE_SUGGESTION_POPOVER: VariableSuggestionsPopoverType;
357
- type RenderVariableOptions = {
358
- variable: Variable;
359
- fallback?: string;
360
- editor: Editor;
361
- from: 'content-variable' | 'bubble-variable' | 'button-variable';
311
+ type AIActionsStorage = {
312
+ /** `true` while an AI action is in flight. */isLoading: boolean; /** The name of the currently running action, or `null`. */
313
+ activeAction: string | null;
362
314
  };
363
- type RenderVariableFunction = (opts: RenderVariableOptions) => JSX.Element | null;
364
- type VariableOptions = {
365
- renderLabel: (props: {
366
- options: VariableOptions;
367
- node: Node$1;
368
- }) => string;
369
- suggestion: Omit<SuggestionOptions, 'editor'>;
370
- /**
371
- * Variables is the array of variables that will be used to render the variable pill.
372
- */
373
- variables: Variables;
374
- /**
375
- * Render variable is the function that will be used to render the variable pill.
376
- * @default DefaultRenderVariable
377
- */
378
- renderVariable: RenderVariableFunction;
379
- /**
380
- * Variable suggestion popover is the component that will be used to render
381
- * the variable suggestions for the content, bubble menu variables
382
- * @default VariableSuggestionPopover
383
- */
384
- variableSuggestionsPopover: VariableSuggestionsPopoverType;
385
- /**
386
- * Disable input is the boolean that will be used to disable the input of the variable
387
- * when the variable is selected.
388
- * @default false
389
- */
390
- disableInput: boolean;
315
+ declare module '@tiptap/core' {
316
+ interface ExtensionStorage {
317
+ aiActions: AIActionsStorage;
318
+ }
319
+ }
320
+ declare const AIActions: Extension<AIActionsOptions, AIActionsStorage>; //#endregion
321
+ //#endregion
322
+ //#region ../extension-inline-suggestion/dist/index.d.mts
323
+ //#region src/inline-suggestion.d.ts
324
+ declare module '@tiptap/core' {
325
+ interface Commands<ReturnType> {
326
+ inlineSuggestion: {
327
+ /** Debounce-fetch a suggestion for the current node's text. */fetchSuggestion: () => ReturnType; /** Accept and insert the current suggestion into the document. */
328
+ insertSuggestion: () => ReturnType; /** Dismiss the current suggestion without inserting it. */
329
+ dismissSuggestion: () => ReturnType;
330
+ };
331
+ }
332
+ }
333
+ declare const inlineSuggestionPluginKey: PluginKey;
334
+ type SuggestContext = {
335
+ /** The Tiptap editor instance. */editor: Editor; /** Abort signal — cancelled when a newer request supersedes this one. */
336
+ signal: AbortSignal;
391
337
  };
392
- type VariableStorage = {
393
- popover: boolean;
338
+ type InlineSuggestionOptions = {
339
+ /**
340
+ * Fetch inline suggestions.
341
+ *
342
+ * @param text - existing text in the current node
343
+ * @param ctx - context with editor instance and abort signal
344
+ * @returns the suggestion string to show
345
+ */
346
+ suggest: (text: string, ctx: SuggestContext) => Promise<string>;
347
+ /**
348
+ * Debounce time for fetching suggestions in milliseconds.
349
+ * @default 250
350
+ */
351
+ debounceTime?: number;
352
+ /**
353
+ * Key that triggers fetching a suggestion.
354
+ * Set to null to disable key-based triggering (use fetchSuggestion command manually).
355
+ * @default " " (space)
356
+ */
357
+ triggerKey?: string | null;
358
+ /**
359
+ * Key that accepts/inserts the current suggestion.
360
+ * @default "Tab"
361
+ */
362
+ acceptKey?: string;
394
363
  };
395
- declare const VariablePluginKey: PluginKey<any>;
396
- declare const VariableExtension: Node<VariableOptions, VariableStorage>;
397
-
398
- type VariableListProps = {
399
- command: (params: {
400
- id: string;
401
- required: boolean;
402
- hideDefaultValue: boolean;
403
- label?: string;
404
- }) => void;
405
- items: Variable[];
406
- } & SuggestionOptions;
407
- declare const VariableList: react.ForwardRefExoticComponent<{
408
- command: (params: {
409
- id: string;
410
- required: boolean;
411
- hideDefaultValue: boolean;
412
- label?: string;
413
- }) => void;
414
- items: Variable[];
415
- } & SuggestionOptions<any, any> & react.RefAttributes<unknown>>;
416
- declare function getVariableSuggestions(char?: string): Omit<SuggestionOptions, 'editor'>;
417
-
418
- type HtmlCodeBlockAttributes = {
419
- activeTab: string;
420
- showIfKey: string;
421
- language: string;
364
+ type InlineSuggestionStorage = {
365
+ /** The suggestion text currently shown as a ghost decoration. */currentSuggestion?: string; /** Node range (`from`/`to`) where the decoration is rendered. */
366
+ nodeDetails?: {
367
+ from: number;
368
+ to: number;
369
+ };
422
370
  };
423
371
  declare module '@tiptap/core' {
424
- interface Commands<ReturnType> {
425
- htmlCodeBlock: {
426
- /**
427
- * Set a code block
428
- * @param attributes Code block attributes
429
- * @example editor.commands.setCodeBlock({ language: 'javascript' })
430
- */
431
- setHtmlCodeBlock: (attributes?: {
432
- language: string;
433
- }) => ReturnType;
434
- /**
435
- * Toggle a code block
436
- * @param attributes Code block attributes
437
- * @example editor.commands.toggleCodeBlock({ language: 'javascript' })
438
- */
439
- toggleHtmlCodeBlock: (attributes?: {
440
- language: string;
441
- }) => ReturnType;
442
- updateHtmlCodeBlock: (attrs: Partial<HtmlCodeBlockAttributes>) => ReturnType;
443
- };
444
- }
372
+ interface ExtensionStorage {
373
+ inlineSuggestion: InlineSuggestionStorage;
374
+ }
445
375
  }
446
- declare const HTMLCodeBlockExtension: _tiptap_react.Node<_tiptap_extension_code_block_lowlight.CodeBlockLowlightOptions, any>;
447
-
448
- export { type AllowedButtonBorderRadius, type AllowedButtonVariant, type AllowedColumnVerticalAlign, type AllowedLogoAlignment, type AllowedLogoSize, type ButtonAttributes, ButtonExtension, Color, ColumnExtension, ColumnsExtension, DEFAULT_BUTTON_ALIGNMENT, DEFAULT_BUTTON_BACKGROUND_COLOR, DEFAULT_BUTTON_BORDER_RADIUS, DEFAULT_BUTTON_PADDING_BOTTOM, DEFAULT_BUTTON_PADDING_LEFT, DEFAULT_BUTTON_PADDING_RIGHT, DEFAULT_BUTTON_PADDING_TOP, DEFAULT_BUTTON_TEXT_COLOR, DEFAULT_BUTTON_VARIANT, DEFAULT_COLUMNS_GAP, DEFAULT_COLUMN_VERTICAL_ALIGN, DEFAULT_COLUMN_WIDTH, DEFAULT_LOGO_SIZE, DEFAULT_RENDER_VARIABLE_FUNCTION, DEFAULT_SECTION_ALIGN, DEFAULT_SECTION_BACKGROUND_COLOR, DEFAULT_SECTION_BORDER_COLOR, DEFAULT_SECTION_BORDER_RADIUS, DEFAULT_SECTION_BORDER_WIDTH, DEFAULT_SECTION_MARGIN_BOTTOM, DEFAULT_SECTION_MARGIN_LEFT, DEFAULT_SECTION_MARGIN_RIGHT, DEFAULT_SECTION_MARGIN_TOP, DEFAULT_SECTION_PADDING_BOTTOM, DEFAULT_SECTION_PADDING_LEFT, DEFAULT_SECTION_PADDING_RIGHT, DEFAULT_SECTION_PADDING_TOP, DEFAULT_SECTION_SHOW_IF_KEY, DEFAULT_SPACER_HEIGHT, DEFAULT_VARIABLES, DEFAULT_VARIABLE_SUGGESTION_POPOVER, DEFAULT_VARIABLE_TRIGGER_CHAR, Footer, type FooterOptions, HTMLCodeBlockExtension, HorizontalRule, type HtmlCodeBlockAttributes, ImageExtension, ImageUploadExtension, type ImageUploadOptions, ImageUploadPlugin, type ImageUploadPluginOptions, type ImageUploadStorage, LinkExtension, type LogoAttributes, LogoExtension, MailyKit, type MailyKitOptions, PlaceholderExtension, type RenderVariableFunction, type RenderVariableOptions, RepeatExtension, SectionExtension, SlashCommandExtension, type SlashCommandOptions, Spacer, type SpacerOptions, type Variable, VariableExtension, type VariableFunctionOptions, VariableList, type VariableListProps, type VariableOptions, VariablePluginKey, type VariableStorage, type Variables, type VariablesFunction, allowedButtonBorderRadius, allowedButtonVariant, allowedLogoAlignment, allowedLogoSize, getSlashCommandSuggestions, getVariableSuggestions, logoSizes, useImageUploadOptions };
376
+ declare const InlineSuggestion: Extension<InlineSuggestionOptions, InlineSuggestionStorage>; //#endregion
377
+ //#endregion
378
+ export { AIActions, type AIActionsOptions, type AIActionsStorage, type AIActionsTransformContext, type AIActionsTransformParams, BlockquoteExtension, ButtonExtension, ColumnExtension, ColumnsExtension, FontStyleExtension, FooterExtension, HorizontalRuleExtension, HtmlCodeBlockExtension, type ImageUploadContext, ImageUploadExtension, type ImageUploadOptions, InlineImageExtension, InlineSuggestion, type InlineSuggestionOptions, type InlineSuggestionStorage, LinkCardExtension, RepeatExtension, ResizableImageExtension, SectionExtension, SlashCommandExtension, SpacerExtension, VariableExtension, VisibilityExtension, inlineSuggestionPluginKey };
379
+ //# sourceMappingURL=index.d.cts.map