@maily-to/core 2.0.0-beta.7 → 2.0.0-beta.9

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 (48) hide show
  1. package/dist/blocks/index.cjs +8 -1
  2. package/dist/blocks/index.d.cts +1 -38
  3. package/dist/blocks/index.d.mts +14 -6
  4. package/dist/blocks/index.d.mts.map +1 -1
  5. package/dist/blocks/index.mjs +2 -2
  6. package/dist/extensions/index.cjs +266 -286
  7. package/dist/extensions/index.d.cts +1 -379
  8. package/dist/extensions/index.d.mts +127 -224
  9. package/dist/extensions/index.d.mts.map +1 -1
  10. package/dist/extensions/index.mjs +238 -271
  11. package/dist/index.cjs +8826 -11828
  12. package/dist/index.d.cts +1 -165
  13. package/dist/index.d.mts +701 -121
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +8460 -11567
  16. package/dist/{slash-command-BmWRVPbv.d.mts → slash-command-BrwA1bHs.d.mts} +10 -11
  17. package/dist/slash-command-BrwA1bHs.d.mts.map +1 -0
  18. package/dist/theme-D1CI7_8s.d.mts +70 -0
  19. package/dist/theme-D1CI7_8s.d.mts.map +1 -0
  20. package/dist/typography-BdOKvXfQ.mjs +911 -0
  21. package/dist/typography-D-VnwOSw.cjs +970 -0
  22. package/dist/typography-DW7VApAR.cjs +1072 -0
  23. package/dist/use-maily-editor-Atvy2kSO.cjs +3993 -0
  24. package/dist/use-maily-editor-CByaDhmT.cjs +4955 -0
  25. package/dist/use-maily-editor-idL0RNsG.mjs +4504 -0
  26. package/package.json +82 -74
  27. package/readme.md +169 -128
  28. package/src/styles/index.css +2537 -0
  29. package/dist/blocks/index.d.cts.map +0 -1
  30. package/dist/chunk-CfYAbeIz.mjs +0 -13
  31. package/dist/extensions/index.d.cts.map +0 -1
  32. package/dist/extensions/index.mjs.map +0 -1
  33. package/dist/index.css +0 -2312
  34. package/dist/index.d.cts.map +0 -1
  35. package/dist/index.mjs.map +0 -1
  36. package/dist/slash-command-BmWRVPbv.d.mts.map +0 -1
  37. package/dist/slash-command-CK0-1FwR.d.cts +0 -39
  38. package/dist/slash-command-CK0-1FwR.d.cts.map +0 -1
  39. package/dist/spacer-DBtsr3hu.cjs +0 -5768
  40. package/dist/spacer-DzZWX-wB.mjs +0 -5456
  41. package/dist/spacer-DzZWX-wB.mjs.map +0 -1
  42. package/dist/typography-CWL13acR.cjs +0 -400
  43. package/dist/typography-DhrUe809.mjs +0 -282
  44. package/dist/typography-DhrUe809.mjs.map +0 -1
  45. package/dist/variable-C9S9ZoHv.d.cts +0 -108
  46. package/dist/variable-C9S9ZoHv.d.cts.map +0 -1
  47. package/dist/variable-DVwGrg2a.d.mts +0 -108
  48. package/dist/variable-DVwGrg2a.d.mts.map +0 -1
@@ -1,6 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import { Editor, Range } from "@tiptap/core";
3
-
2
+ import { ReactNode } from "react";
4
3
  //#region src/utils/slash-command.d.ts
5
4
  type SlashCommandOptions = {
6
5
  editor: Editor;
@@ -8,32 +7,32 @@ type SlashCommandOptions = {
8
7
  };
9
8
  type SlashCommandItemCommand = (options: SlashCommandOptions) => void;
10
9
  type BaseSlashCommandItem = {
11
- title: string;
12
10
  description?: string;
13
- searchTerms: string[];
14
11
  icon?: ReactNode;
15
12
  /**
16
- * Controls visibility in the suggestion list. Return `null` to hide,
17
- * `true` to show with defaults, or a ReactNode for custom rendering.
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.
18
15
  */
19
16
  render?: (editor: Editor) => ReactNode | null | true;
20
17
  preview?: string | ((editor: Editor) => ReactNode | null);
18
+ searchTerms: string[];
19
+ title: string;
21
20
  };
22
21
  type ExecutableSlashCommandItem = BaseSlashCommandItem & {
23
22
  command: SlashCommandItemCommand;
24
- id?: never;
25
23
  commands?: never;
24
+ id?: never;
26
25
  };
27
26
  type NestedSlashCommandItem = BaseSlashCommandItem & {
28
- id: string;
29
27
  command?: never;
30
28
  commands: SlashCommandItem[];
29
+ id: string;
31
30
  };
32
31
  type SlashCommandItem = ExecutableSlashCommandItem | NestedSlashCommandItem;
33
32
  type SlashCommandGroupItem = {
34
- title: string;
35
33
  commands: SlashCommandItem[];
34
+ title: string;
36
35
  };
37
36
  //#endregion
38
- export { SlashCommandOptions as i, SlashCommandItem as n, SlashCommandItemCommand as r, SlashCommandGroupItem as t };
39
- //# sourceMappingURL=slash-command-BmWRVPbv.d.mts.map
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"}