@maily-to/core 0.3.7 → 2.0.0-beta.10
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/LICENSE +21 -0
- package/dist/blocks/index.cjs +29 -305
- package/dist/blocks/index.d.cts +1 -59
- package/dist/blocks/index.d.mts +46 -0
- package/dist/blocks/index.d.mts.map +1 -0
- package/dist/blocks/index.mjs +2 -273
- package/dist/extensions/index.cjs +354 -9100
- package/dist/extensions/index.d.cts +1 -448
- package/dist/extensions/index.d.mts +282 -0
- package/dist/extensions/index.d.mts.map +1 -0
- package/dist/extensions/index.mjs +322 -9052
- package/dist/index.cjs +10225 -12221
- package/dist/index.d.cts +1 -63
- package/dist/index.d.mts +743 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +10103 -12273
- package/dist/slash-command-BrwA1bHs.d.mts +38 -0
- package/dist/slash-command-BrwA1bHs.d.mts.map +1 -0
- package/dist/theme-D1CI7_8s.d.mts +70 -0
- package/dist/theme-D1CI7_8s.d.mts.map +1 -0
- package/dist/typography-BdOKvXfQ.mjs +911 -0
- package/dist/typography-D-VnwOSw.cjs +970 -0
- package/dist/typography-DW7VApAR.cjs +1072 -0
- package/dist/use-maily-editor-Atvy2kSO.cjs +3993 -0
- package/dist/use-maily-editor-CByaDhmT.cjs +4955 -0
- package/dist/use-maily-editor-idL0RNsG.mjs +4504 -0
- package/package.json +115 -180
- package/readme.md +356 -195
- package/src/styles/index.css +2537 -0
- package/dist/blocks/index.cjs.map +0 -1
- package/dist/blocks/index.d.ts +0 -59
- package/dist/blocks/index.mjs.map +0 -1
- package/dist/extensions/index.cjs.map +0 -1
- package/dist/extensions/index.d.ts +0 -448
- package/dist/extensions/index.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.css +0 -2487
- package/dist/index.css.map +0 -1
- package/dist/index.d.ts +0 -63
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Editor, Range } from "@tiptap/core";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/utils/slash-command.d.ts
|
|
4
|
+
type SlashCommandOptions = {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
range: Range;
|
|
7
|
+
};
|
|
8
|
+
type SlashCommandItemCommand = (options: SlashCommandOptions) => void;
|
|
9
|
+
type BaseSlashCommandItem = {
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Controls visibility in the suggestion list. Return `null` to hide the
|
|
14
|
+
* item, `true` to show it with defaults, or a ReactNode to replace the row.
|
|
15
|
+
*/
|
|
16
|
+
render?: (editor: Editor) => ReactNode | null | true;
|
|
17
|
+
preview?: string | ((editor: Editor) => ReactNode | null);
|
|
18
|
+
searchTerms: string[];
|
|
19
|
+
title: string;
|
|
20
|
+
};
|
|
21
|
+
type ExecutableSlashCommandItem = BaseSlashCommandItem & {
|
|
22
|
+
command: SlashCommandItemCommand;
|
|
23
|
+
commands?: never;
|
|
24
|
+
id?: never;
|
|
25
|
+
};
|
|
26
|
+
type NestedSlashCommandItem = BaseSlashCommandItem & {
|
|
27
|
+
command?: never;
|
|
28
|
+
commands: SlashCommandItem[];
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
type SlashCommandItem = ExecutableSlashCommandItem | NestedSlashCommandItem;
|
|
32
|
+
type SlashCommandGroupItem = {
|
|
33
|
+
commands: SlashCommandItem[];
|
|
34
|
+
title: string;
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { SlashCommandItem as n, SlashCommandGroupItem as t };
|
|
38
|
+
//# sourceMappingURL=slash-command-BrwA1bHs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash-command-BrwA1bHs.d.mts","names":[],"sources":["../src/utils/slash-command.ts"],"mappings":";;;KAMY;EACV,QAAQ;EACR,OAAO;;KAGG,2BAA2B,SAAS;KAE3C;EACH;EACA,OAAO;;;;;EAKP,UAAU,QAAQ,WAAW;EAC7B,qBAAqB,QAAQ,WAAW;EACxC;EACA;;KAGG,6BAA6B;EAChC,SAAS;EACT;EACA;;KAGG,yBAAyB;EAC5B;EACA,UAAU;EACV;;KAGU,mBACR,6BACA;KAEQ;EACV,UAAU;EACV"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Editor, Node } from "@tiptap/core";
|
|
2
|
+
import { InlineStyle, MAILY_NODE_TYPES, NodeThemeOptions, VariableAttributes } from "@maily-to/shared";
|
|
3
|
+
import { SuggestionOptions } from "@tiptap/suggestion";
|
|
4
|
+
import { DOMOutputSpec, Node as Node$1 } from "@tiptap/pm/model";
|
|
5
|
+
import { Editor as Editor$1 } from "@tiptap/react";
|
|
6
|
+
//#region ../extension-variable/dist/index.d.mts
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/variable.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* The attributes for a variable node. This is an alias for
|
|
11
|
+
* `VariableAttributes` from `@maily-to/shared`.
|
|
12
|
+
*/
|
|
13
|
+
type VariableNodeAttrs = VariableAttributes;
|
|
14
|
+
type RenderProps = {
|
|
15
|
+
node: Node$1;
|
|
16
|
+
options: VariableOptions;
|
|
17
|
+
suggestion: SuggestionOptions | null;
|
|
18
|
+
};
|
|
19
|
+
type VariableOptions = {
|
|
20
|
+
/** Whether to add a space suffix after an inserted variable. */
|
|
21
|
+
addSpaceSuffix: boolean;
|
|
22
|
+
/** Whether backspace deletes the trigger character with the node. */
|
|
23
|
+
deleteTriggerWithBackspace: boolean;
|
|
24
|
+
HTMLAttributes: Record<string, unknown>;
|
|
25
|
+
renderHTML: (props: RenderProps) => DOMOutputSpec;
|
|
26
|
+
renderText: (props: RenderProps) => string;
|
|
27
|
+
shouldScrollIntoView: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The suggestion options, when you want to support only one trigger. To
|
|
30
|
+
* support multiple triggers, use `suggestions` instead.
|
|
31
|
+
*/
|
|
32
|
+
suggestion: Omit<SuggestionOptions, 'editor'>;
|
|
33
|
+
/**
|
|
34
|
+
* The suggestion options, when you want to support multiple triggers. For
|
|
35
|
+
* example, `{{` to insert variables and `#` to insert tags.
|
|
36
|
+
*/
|
|
37
|
+
suggestions: Array<Omit<SuggestionOptions, 'editor'>>;
|
|
38
|
+
};
|
|
39
|
+
declare module '@tiptap/core' {
|
|
40
|
+
interface Commands<ReturnType> {
|
|
41
|
+
variable: {
|
|
42
|
+
insertVariable: (attrs: VariableAttributes) => ReturnType;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/utils/variable.d.ts
|
|
48
|
+
/** A variable item passed to the editor's variable suggestion list. */
|
|
49
|
+
type Variable = Omit<VariableNodeAttrs, 'variableSuggestionChar'> & {
|
|
50
|
+
/** Arbitrary metadata attached to this variable (e.g. category, type). */
|
|
51
|
+
metadata?: Record<string, unknown>;
|
|
52
|
+
};
|
|
53
|
+
type VariableFunctionOptions = {
|
|
54
|
+
editor: Editor$1;
|
|
55
|
+
query: string;
|
|
56
|
+
};
|
|
57
|
+
type VariablesFunction = (opts: VariableFunctionOptions) => Array<Variable>;
|
|
58
|
+
type Variables = Array<Variable> | VariablesFunction;
|
|
59
|
+
/**
|
|
60
|
+
* Filters the variable list by query prefix. If no exact match exists,
|
|
61
|
+
* appends a dynamic entry so users can create variables on the fly.
|
|
62
|
+
*/
|
|
63
|
+
declare function filterVariableSuggestions(variables: Variables | undefined, opts: VariableFunctionOptions): Array<Variable>;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/utils/theme.d.ts
|
|
66
|
+
type NodeThemeUpdate = { [Type in keyof NodeThemeOptions]?: Record<string, string | null | undefined> | null | undefined; };
|
|
67
|
+
type ShellType = typeof MAILY_NODE_TYPES.BODY | typeof MAILY_NODE_TYPES.CONTAINER;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Variables as a, VariableOptions as c, VariableFunctionOptions as i, ShellType as n, VariablesFunction as o, Variable as r, filterVariableSuggestions as s, NodeThemeUpdate as t };
|
|
70
|
+
//# sourceMappingURL=theme-D1CI7_8s.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-D1CI7_8s.d.mts","names":[],"sources":["../../extension-variable/dist/index.d.mts","../src/utils/variable.ts","../src/utils/theme.ts"],"mappings":";;;;;;;;;;;;KA+BK,oBAAoB;KACpB;EACH,MAAM;EACN,SAAS;EACT,YAAY;;KAET;;EAEH;;EAEA;EACA,gBAAgB;EAChB,aAAa,OAAO,gBAAgB;EACpC,aAAa,OAAO;EACpB;;;;;EAKA,YAAY,KAAK;;;;;EAKjB,aAAa,MAAM,KAAK;;;YAGd,SAAS;IACjB;MACE,iBAAiB,OAAO,uBAAuB;;;;;;;KCxDzC,WAAW,KAAK;;EAE1B,WAAW;;KAGD;EACV,QAAQ;EACR;;KAGU,qBACV,MAAM,4BACH,MAAM;KAEC,YAAY,MAAM,YAAY;;;;;iBAY1B,0BACd,WAAW,uBACX,MAAM,0BACL,MAAM;;;KCGG,qBACT,cAAc,oBACX;KA4IM,mBACD,iBAAiB,cACjB,iBAAiB"}
|