@toantranmei/editor 0.0.0-stage → 0.1.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +363 -2
  3. package/dist/css-CaicG2fA.js +580 -0
  4. package/dist/css-CaicG2fA.js.map +1 -0
  5. package/dist/index.js +6481 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/nuxt.js +78 -0
  8. package/dist/nuxt.js.map +1 -0
  9. package/dist/style.css +2 -0
  10. package/dist/types/block-items.d.ts +38 -0
  11. package/dist/types/block-names.d.ts +5 -0
  12. package/dist/types/block-ops.d.ts +66 -0
  13. package/dist/types/blocks/advanced.d.ts +7 -0
  14. package/dist/types/blocks/basic.d.ts +10 -0
  15. package/dist/types/blocks/extras.d.ts +23 -0
  16. package/dist/types/blocks/index.d.ts +13 -0
  17. package/dist/types/blocks/media.d.ts +3 -0
  18. package/dist/types/colors.d.ts +3 -0
  19. package/dist/types/components/BlockMenu.vue.d.ts +16 -0
  20. package/dist/types/components/ColorList.vue.d.ts +37 -0
  21. package/dist/types/components/DatePicker.vue.d.ts +22 -0
  22. package/dist/types/components/EmojiMenu.vue.d.ts +13 -0
  23. package/dist/types/components/FormatMenu.vue.d.ts +7 -0
  24. package/dist/types/components/ImageCropper.vue.d.ts +25 -0
  25. package/dist/types/components/ImageLightbox.vue.d.ts +16 -0
  26. package/dist/types/components/MeiEditor.vue.d.ts +72 -0
  27. package/dist/types/components/MeiOutline.vue.d.ts +14 -0
  28. package/dist/types/components/MentionMenu.vue.d.ts +13 -0
  29. package/dist/types/components/MermaidDiagram.vue.d.ts +9 -0
  30. package/dist/types/components/SlashMenu.vue.d.ts +14 -0
  31. package/dist/types/components/TableControls.vue.d.ts +13 -0
  32. package/dist/types/composables/useClickOutside.d.ts +5 -0
  33. package/dist/types/composables/useEditable.d.ts +7 -0
  34. package/dist/types/composables/useScope.d.ts +9 -0
  35. package/dist/types/config.d.ts +30 -0
  36. package/dist/types/content.d.ts +27 -0
  37. package/dist/types/date-utils.d.ts +38 -0
  38. package/dist/types/define-block.d.ts +43 -0
  39. package/dist/types/emoji-data.d.ts +9 -0
  40. package/dist/types/extensions/block-drop.d.ts +28 -0
  41. package/dist/types/extensions/block-id.d.ts +21 -0
  42. package/dist/types/extensions/block-selection.d.ts +24 -0
  43. package/dist/types/extensions/callout.d.ts +12 -0
  44. package/dist/types/extensions/code-block.d.ts +20 -0
  45. package/dist/types/extensions/color-marks.d.ts +24 -0
  46. package/dist/types/extensions/columns.d.ts +10 -0
  47. package/dist/types/extensions/embed.d.ts +13 -0
  48. package/dist/types/extensions/emoji.d.ts +5 -0
  49. package/dist/types/extensions/file-block.d.ts +17 -0
  50. package/dist/types/extensions/html-block.d.ts +39 -0
  51. package/dist/types/extensions/image-block.d.ts +1 -0
  52. package/dist/types/extensions/index.d.ts +13 -0
  53. package/dist/types/extensions/math.d.ts +13 -0
  54. package/dist/types/extensions/mention.d.ts +43 -0
  55. package/dist/types/extensions/mermaid.d.ts +4 -0
  56. package/dist/types/extensions/slash-command.d.ts +4 -0
  57. package/dist/types/extensions/suggestion-renderer.d.ts +11 -0
  58. package/dist/types/extensions/table.d.ts +1 -0
  59. package/dist/types/extensions/toc.d.ts +10 -0
  60. package/dist/types/extensions/toggle.d.ts +6 -0
  61. package/dist/types/extensions/unknown.d.ts +3 -0
  62. package/dist/types/index.d.ts +34 -0
  63. package/dist/types/keys.d.ts +3 -0
  64. package/dist/types/lazy.d.ts +12 -0
  65. package/dist/types/locale.d.ts +226 -0
  66. package/dist/types/nodeviews/CalloutView.vue.d.ts +93 -0
  67. package/dist/types/nodeviews/CodeBlockView.vue.d.ts +93 -0
  68. package/dist/types/nodeviews/EmbedView.vue.d.ts +93 -0
  69. package/dist/types/nodeviews/FileView.vue.d.ts +93 -0
  70. package/dist/types/nodeviews/HtmlView.vue.d.ts +93 -0
  71. package/dist/types/nodeviews/ImageView.vue.d.ts +93 -0
  72. package/dist/types/nodeviews/MathView.vue.d.ts +93 -0
  73. package/dist/types/nodeviews/MentionView.vue.d.ts +93 -0
  74. package/dist/types/nodeviews/TocView.vue.d.ts +93 -0
  75. package/dist/types/nodeviews/renderer.d.ts +12 -0
  76. package/dist/types/nuxt.d.ts +36 -0
  77. package/dist/types/plugin-key.d.ts +7 -0
  78. package/dist/types/plugin.d.ts +20 -0
  79. package/dist/types/recent.d.ts +24 -0
  80. package/dist/types/slash-items.d.ts +24 -0
  81. package/dist/types/table-ops.d.ts +32 -0
  82. package/dist/types/theme/css.d.ts +20 -0
  83. package/dist/types/theme/define.d.ts +18 -0
  84. package/dist/types/theme/index.d.ts +7 -0
  85. package/dist/types/theme/read.d.ts +5 -0
  86. package/dist/types/theme/tokens.d.ts +515 -0
  87. package/package.json +119 -3
@@ -0,0 +1,9 @@
1
+ import type { EditorMessages } from '../locale';
2
+ type __VLS_Props = {
3
+ code: string;
4
+ messages: EditorMessages;
5
+ dark: boolean;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ import type { SlashItem } from '../slash-items';
3
+ type __VLS_Props = {
4
+ editor: Editor;
5
+ items: SlashItem[];
6
+ query: string;
7
+ command: (item: SlashItem) => void;
8
+ };
9
+ declare function onKeyDown(event: KeyboardEvent): boolean;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
11
+ onKeyDown: typeof onKeyDown;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Notion-style table controls, drawn over the editor:
3
+ * - grip handles on the hovered row (left) and column (top) → row/column menu
4
+ * - "+" bars below and to the right of the table to add a row / column
5
+ * - a small toolbar for multi-cell selections (merge, split, color, clear)
6
+ */
7
+ import type { Editor } from '@tiptap/vue-3';
8
+ type __VLS_Props = {
9
+ editor: Editor;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { type Ref } from 'vue';
2
+ /** Calls `handler` on a pointerdown outside `target` while `active` is true. */
3
+ export declare function useClickOutside(target: Ref<HTMLElement | null | undefined>, active: {
4
+ readonly value: boolean;
5
+ }, handler: () => void): void;
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ /**
3
+ * `editor.isEditable` as a Vue ref. The editor's flag isn't reactive, so node views
4
+ * would keep showing edit controls after switching to read-only (setEditable emits
5
+ * an update, which is what we listen to).
6
+ */
7
+ export declare function useEditable(editor: Editor): Readonly<import("vue").Ref<boolean, boolean>>;
@@ -0,0 +1,9 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ /**
3
+ * Theme scope attributes (mode class + overrides id) for elements rendered outside
4
+ * the editor root, e.g. popovers teleported to <body>. Use with `v-bind`.
5
+ */
6
+ export declare function useScope(editor: () => Editor | undefined): import("vue").ComputedRef<{
7
+ class: string[];
8
+ 'data-me-id': string;
9
+ }>;
@@ -0,0 +1,30 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import type { BlockType } from './block-items';
3
+ import { type EditorMessages, type LocaleName } from './locale';
4
+ /** Uploads an image file and resolves to its public URL. */
5
+ export type ImageUploader = (file: File) => Promise<string>;
6
+ export interface MeiConfigStorage {
7
+ messages: EditorMessages;
8
+ locale: LocaleName;
9
+ /** Menu entries of the loaded blocks (slash menu, "Turn into"). */
10
+ items: BlockType[];
11
+ /** Custom uploader. Without it, images are inlined as base64 data URLs. */
12
+ uploadImage: ImageUploader | null;
13
+ /** Max image size in MB. */
14
+ maxImageSize: number;
15
+ /**
16
+ * Attributes for every element that carries theme tokens: the editor root and
17
+ * popovers teleported to <body> (so they get the same mode and overrides).
18
+ */
19
+ scope: {
20
+ class: string[];
21
+ 'data-me-id': string;
22
+ };
23
+ }
24
+ declare module '@tiptap/core' {
25
+ interface Storage {
26
+ meiConfig: MeiConfigStorage;
27
+ }
28
+ }
29
+ /** Holds editor-wide settings that menus and node views read at runtime. */
30
+ export declare const MeiConfig: Extension<Partial<MeiConfigStorage>, MeiConfigStorage>;
@@ -0,0 +1,27 @@
1
+ import type { Schema } from '@tiptap/pm/model';
2
+ import type { JSONContent } from '@tiptap/vue-3';
3
+ /** What happened while loading a document (see the `content-error` event). */
4
+ export interface ContentIssue {
5
+ kind: 'unknown' | 'repaired' | 'invalid';
6
+ /** Node type of the affected block. */
7
+ type: string;
8
+ message?: string;
9
+ }
10
+ export declare class ContentError extends Error {
11
+ content: unknown;
12
+ constructor(message: string, content: unknown);
13
+ }
14
+ /**
15
+ * Wraps nodes the schema doesn't know into `unknownBlock` / `unknownInline` so the
16
+ * editor can load documents written with other blocks enabled. Unknown marks are dropped.
17
+ */
18
+ export declare function wrapUnknown(doc: JSONContent | null | undefined, schema: Schema, issues?: ContentIssue[]): JSONContent | null;
19
+ /**
20
+ * Validates a document block by block so one broken block never blanks the editor
21
+ * (Tiptap shows an empty doc on invalid content, and the next save would overwrite it).
22
+ * Fixable blocks are repaired; others are kept verbatim inside `unknownBlock`.
23
+ * Throws {@link ContentError} only when the input isn't a document at all.
24
+ */
25
+ export declare function sanitizeContent(doc: unknown, schema: Schema, issues?: ContentIssue[]): JSONContent | null;
26
+ /** Reverses {@link wrapUnknown}: puts the original JSON back. */
27
+ export declare function unwrapUnknown(doc: JSONContent): JSONContent;
@@ -0,0 +1,38 @@
1
+ export type DateFormat = 'full' | 'short' | 'mdy' | 'dmy' | 'ymd' | 'relative';
2
+ export type TimeFormat = '12' | '24';
3
+ export declare const DATE_FORMATS: DateFormat[];
4
+ /** Everything a date mention stores (besides its id = start date). */
5
+ export interface DateValue {
6
+ start: string;
7
+ end?: string | null;
8
+ time?: string | null;
9
+ endTime?: string | null;
10
+ format?: DateFormat | null;
11
+ timeFormat?: TimeFormat | null;
12
+ remind?: string | null;
13
+ }
14
+ export declare const isoDate: (d: Date) => string;
15
+ /** `YYYY-MM-DD` → local Date (no timezone shift). */
16
+ export declare function parseIsoDate(id: string | null | undefined): Date | null;
17
+ export interface RelativeLabels {
18
+ today: string;
19
+ tomorrow: string;
20
+ yesterday: string;
21
+ }
22
+ /** One date in the chosen format. */
23
+ export declare function formatDate(id: string, locale: string, format?: DateFormat, relative?: RelativeLabels): string;
24
+ /** `HH:mm` → "2:30 PM" or "14:30". */
25
+ export declare function formatTime(time: string, locale: string, format?: TimeFormat): string;
26
+ /** The chip label: date (+ time), with "→ end" for ranges. */
27
+ export declare function formatDateValue(v: DateValue, locale: string, relative?: RelativeLabels): string;
28
+ /** Back-compat: short date only. */
29
+ export declare function formatMentionDate(id: string, locale: string): string;
30
+ /** Parses what users type in the date box: 24/10/2026, 2026-10-24, 10/24/2026 (en), "Oct 24, 2026". */
31
+ export declare function parseDateInput(text: string, locale: string): string | null;
32
+ /** Parses "14:30", "9", "2:30 pm", "9am" → `HH:mm`. */
33
+ export declare function parseTimeInput(text: string): string | null;
34
+ /** Reminder presets (like Notion's). Date-only ones fire at 09:00. */
35
+ export declare const REMINDERS_DATE: readonly ["none", "day", "1d", "2d", "1w"];
36
+ export declare const REMINDERS_TIME: readonly ["none", "at", "5m", "10m", "15m", "30m", "1h", "2h", "1d", "2d"];
37
+ /** When the reminder should fire, or null without one. */
38
+ export declare function reminderTime(v: DateValue): Date | null;
@@ -0,0 +1,43 @@
1
+ import type { AnyExtension } from '@tiptap/core';
2
+ import type { BlockType } from './block-items';
3
+ import type { LocaleName, PartialMessages } from './locale';
4
+ export interface BlockSpec<O extends object = Record<string, never>> {
5
+ /** Unique name, e.g. `'heading'`, `'math'`. */
6
+ name: string;
7
+ /** Default options, overridable with `.configure()`. */
8
+ defaults?: O;
9
+ /** Tiptap extensions the block needs. Extensions shared by blocks are de-duplicated by name. */
10
+ extensions?: (options: O) => AnyExtension[];
11
+ /** Slash menu / "Turn into" entries. */
12
+ items?: (options: O) => BlockType[];
13
+ /** ProseMirror node types this block creates (they get stable ids). */
14
+ nodes?: string[];
15
+ /** UI strings per locale, merged into the editor messages (for custom blocks). */
16
+ messages?: Partial<Record<LocaleName, PartialMessages>>;
17
+ }
18
+ /** A block ready to pass to `<MeiEditor :blocks>`. */
19
+ export interface BlockDefinition<O extends object = any> {
20
+ name: string;
21
+ options: O;
22
+ extensions: AnyExtension[];
23
+ items: BlockType[];
24
+ nodes: string[];
25
+ messages?: Partial<Record<LocaleName, PartialMessages>>;
26
+ /** Returns a copy with different options: `file.configure({ upload })`. */
27
+ configure: (options: Partial<O>) => BlockDefinition<O>;
28
+ }
29
+ /**
30
+ * Declares a block: its Tiptap extensions, menu entries and strings, in one place.
31
+ *
32
+ * @example
33
+ * export const invoice = defineBlock({
34
+ * name: 'invoice',
35
+ * nodes: ['invoice'],
36
+ * extensions: () => [InvoiceNode],
37
+ * items: () => [{ id: 'invoice', icon: Receipt, group: 'advanced', keywords: ['bill'], insert: c => c.insertInvoice() }],
38
+ * messages: { vi: { blocks: { invoice: { title: 'Hoá đơn', description: 'Chèn hoá đơn' } } } },
39
+ * })
40
+ */
41
+ export declare function defineBlock<O extends object = Record<string, never>>(spec: BlockSpec<O>): BlockDefinition<O>;
42
+ /** Flattens block definitions into one extension list (first extension per name wins). */
43
+ export declare function collectExtensions(blocks: BlockDefinition[]): AnyExtension[];
@@ -0,0 +1,9 @@
1
+ /** Emoji search data, loaded on first use (≈600KB per locale, split into its own chunk). */
2
+ export interface EmojiEntry {
3
+ unicode: string;
4
+ label: string;
5
+ terms: string[];
6
+ }
7
+ /** English labels + GitHub shortcodes always; plus labels/tags in `locale` when available. */
8
+ export declare function loadEmojis(locale: string): Promise<EmojiEntry[]>;
9
+ export declare function searchEmojis(list: EmojiEntry[], query: string, limit?: number): EmojiEntry[];
@@ -0,0 +1,28 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { PluginKey } from '@tiptap/pm/state';
3
+ export interface BlockDropOptions {
4
+ /** Node types whose direct children are "blocks" you can drop between. */
5
+ containers: string[];
6
+ /** Class of the drop indicator line. */
7
+ indicatorClass: string;
8
+ /** Max columns when dropping beside a block. */
9
+ maxColumns: number;
10
+ }
11
+ export interface BlockDropStorage {
12
+ /** True while a block is being dragged from the drag handle. */
13
+ active: boolean;
14
+ }
15
+ declare module '@tiptap/core' {
16
+ interface Storage {
17
+ blockDrop: BlockDropStorage;
18
+ }
19
+ }
20
+ export declare const blockDropKey: PluginKey<any>;
21
+ /**
22
+ * Notion-style drop for blocks dragged from the drag handle:
23
+ * - between blocks (top level or in a column), never inside a list item by accident;
24
+ * - beside a block (left/right edge) to create or extend columns;
25
+ * - with an indent below a list/toggle/callout to nest inside it;
26
+ * - auto-scrolls near the viewport edges.
27
+ */
28
+ export declare const BlockDrop: Extension<BlockDropOptions, BlockDropStorage>;
@@ -0,0 +1,21 @@
1
+ import { Extension, type JSONContent } from '@tiptap/core';
2
+ export interface BlockIdOptions {
3
+ /** Node types that get an id. */
4
+ types: string[];
5
+ /** Attribute name (rendered as `data-<name>`). */
6
+ attributeName: string;
7
+ generate: () => string;
8
+ }
9
+ export declare const uuid: () => `${string}-${string}-${string}-${string}-${string}`;
10
+ /**
11
+ * Gives every block in a JSON document a unique id before it's loaded — one O(n) pass,
12
+ * so opening large documents doesn't need thousands of id-setting steps.
13
+ */
14
+ export declare function assignIds(doc: JSONContent | null, types: string[], generate?: () => string, attr?: string): JSONContent | null;
15
+ /**
16
+ * Stable block ids, linear-time. Replaces Tiptap's UniqueID, which is O(n²) on large
17
+ * documents (indexOf-based duplicate search over every id, and position-shifting
18
+ * setNodeMarkup steps). Here: only nodes inserted by the transaction are checked,
19
+ * duplicates use a Set, and ids are written with setNodeAttribute (no position shifts).
20
+ */
21
+ export declare const BlockId: Extension<BlockIdOptions, any>;
@@ -0,0 +1,24 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { PluginKey } from '@tiptap/pm/state';
3
+ import { type BlockRange } from '../block-ops';
4
+ export interface BlockSelectionStorage {
5
+ /** Set by the editor UI: opens the ⋮⋮ menu for a range (⌘/). */
6
+ openMenu: ((range: BlockRange) => void) | null;
7
+ }
8
+ declare module '@tiptap/core' {
9
+ interface Storage {
10
+ blockSelection: BlockSelectionStorage;
11
+ }
12
+ }
13
+ /** ⌘⌥0–8 → block type, like Notion. */
14
+ export declare const TURN_INTO_SHORTCUTS: Record<string, string>;
15
+ export declare const blockSelectionKey: PluginKey<any>;
16
+ /**
17
+ * Notion-style block selection and block shortcuts:
18
+ * - Esc selects the current block; Esc again clears.
19
+ * - Shift+click or dragging a text selection across blocks selects whole blocks.
20
+ * - With blocks selected: ↑/↓ move the selection, Shift+↑/↓ extend it, Enter edits,
21
+ * Backspace/Delete removes them, typing is ignored; ⌘C/⌘X copy/cut blocks.
22
+ * - Anywhere: ⌘⇧↑/↓ move, ⌘D duplicate, ⌘⌥0–8 turn into, ⌘/ open the block menu.
23
+ */
24
+ export declare const BlockSelection: Extension<object, BlockSelectionStorage>;
@@ -0,0 +1,12 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ callout: {
5
+ setCallout: (attrs?: {
6
+ icon?: string;
7
+ color?: string;
8
+ }) => ReturnType;
9
+ };
10
+ }
11
+ }
12
+ export declare const Callout: Node<any, any>;
@@ -0,0 +1,20 @@
1
+ /** Starts empty: each language's grammar is loaded the first time a code block uses it. */
2
+ export declare const lowlight: {
3
+ highlight: (language: string, value: string, options?: Readonly<import("lowlight").Options> | null | undefined) => import("hast").Root;
4
+ highlightAuto: (value: string, options?: Readonly<import("lowlight").AutoOptions> | null | undefined) => import("hast").Root;
5
+ listLanguages: () => Array<string>;
6
+ register: {
7
+ (grammars: Readonly<Record<string, import("highlight.js").LanguageFn>>): undefined;
8
+ (name: string, grammar: import("highlight.js").LanguageFn): undefined;
9
+ };
10
+ registerAlias: {
11
+ (aliases: Readonly<Record<string, ReadonlyArray<string> | string>>): undefined;
12
+ (language: string, alias: ReadonlyArray<string> | string): undefined;
13
+ };
14
+ registered: (aliasOrName: string) => boolean;
15
+ };
16
+ /** Languages offered in the code block's language picker. */
17
+ export declare const CODE_LANGUAGES: string[];
18
+ /** Loads and registers a grammar. Resolves true when newly registered. */
19
+ export declare function loadLanguage(language: string): Promise<boolean>;
20
+ export declare const CodeBlock: import("@tiptap/core").Node<import("@tiptap/extension-code-block-lowlight").CodeBlockLowlightOptions, any>;
@@ -0,0 +1,24 @@
1
+ import { Extension, Mark } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ textColor: {
5
+ /** Sets a palette color by name (`'red'`, `'blue'`…); `null`/`'default'` removes it. */
6
+ setTextColor: (color: string | null) => ReturnType;
7
+ };
8
+ bgColor: {
9
+ setBgColor: (color: string | null) => ReturnType;
10
+ };
11
+ }
12
+ }
13
+ /** Text color stored by palette name, so themes and dark mode can restyle it. */
14
+ export declare const TextColor: Mark<any, any>;
15
+ /** Background (highlight) color stored by palette name. */
16
+ export declare const BgColor: Mark<any, any>;
17
+ /** Blocks that take a whole-block color (Notion's block menu / "/red" colors). */
18
+ export declare const COLORABLE_BLOCKS: string[];
19
+ /**
20
+ * Whole-block text/background color, stored by palette name as `blockColor` / `blockBg`.
21
+ * Renders the same `data-text-color` / `data-bg-color` attributes as the marks, so one
22
+ * set of palette rules styles both. New blocks split off with Enter start uncolored.
23
+ */
24
+ export declare const BlockColor: Extension<any, any>;
@@ -0,0 +1,10 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ columns: {
5
+ setColumns: (count: number) => ReturnType;
6
+ };
7
+ }
8
+ }
9
+ export declare const Column: Node<any, any>;
10
+ export declare const Columns: Node<any, any>;
@@ -0,0 +1,13 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ embed: {
5
+ setEmbed: (attrs?: {
6
+ src?: string | null;
7
+ }) => ReturnType;
8
+ };
9
+ }
10
+ }
11
+ /** Turns a YouTube / Vimeo / Loom watch link into an embeddable URL. */
12
+ export declare function toEmbedUrl(raw: string): string | null;
13
+ export declare const Embed: Node<any, any>;
@@ -0,0 +1,5 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { PluginKey } from '@tiptap/pm/state';
3
+ export declare const emojiPluginKey: PluginKey<any>;
4
+ /** Type `:` + a word (e.g. `:smile`, `:cười`) to insert an emoji as text. */
5
+ export declare const EmojiSuggestion: Extension<any, any>;
@@ -0,0 +1,17 @@
1
+ import { Node } from '@tiptap/core';
2
+ export type FileKind = 'file' | 'audio' | 'video';
3
+ export interface FileBlockOptions {
4
+ /** Uploads a file and resolves to its URL. Without it files are inlined as base64. */
5
+ upload: ((file: File, kind: FileKind) => Promise<string>) | null;
6
+ /** Max size in MB. */
7
+ maxSize: number;
8
+ }
9
+ declare module '@tiptap/core' {
10
+ interface Commands<ReturnType> {
11
+ fileBlock: {
12
+ insertFileBlock: (kind?: FileKind) => ReturnType;
13
+ };
14
+ }
15
+ }
16
+ /** Attachment, audio player or video player, uploaded or linked. */
17
+ export declare const FileBlock: Node<FileBlockOptions, any>;
@@ -0,0 +1,39 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ htmlBlock: {
5
+ insertHtmlBlock: (attrs?: {
6
+ code?: string;
7
+ fileName?: string | null;
8
+ }) => ReturnType;
9
+ };
10
+ }
11
+ }
12
+ export interface HtmlBlockOptions {
13
+ /**
14
+ * What the block's code may load from the network. `false` (default, like Notion):
15
+ * nothing. Images, fonts and scripts must be inlined. `true`: anything. A list of
16
+ * origins (`['https://cdn.jsdelivr.net']`): only those.
17
+ */
18
+ network: boolean | string[];
19
+ /** Largest `.html` file that can be uploaded, in KB. */
20
+ maxSize: number;
21
+ /** Height of a new block, in px. */
22
+ defaultHeight: number;
23
+ }
24
+ /** Block heights users can drag between, in px. */
25
+ export declare const HTML_MIN_HEIGHT = 120;
26
+ export declare const HTML_MAX_HEIGHT = 2000;
27
+ /**
28
+ * Content-Security-Policy for the sandboxed page. The iframe has no `allow-same-origin`,
29
+ * so the code can't touch the editor, its page, cookies or storage either way; the
30
+ * policy additionally blocks network requests unless `network` allows them.
31
+ */
32
+ export declare function htmlBlockCsp(network: HtmlBlockOptions['network']): string | null;
33
+ /**
34
+ * The iframe document: a strict CSP first (later policies can only tighten it), then
35
+ * the user's HTML.
36
+ */
37
+ export declare function htmlBlockDocument(code: string, network: HtmlBlockOptions['network']): string;
38
+ /** Notion-style HTML block: your own HTML/CSS/JS, running in a sandboxed frame. */
39
+ export declare const HtmlBlock: Node<HtmlBlockOptions, any>;
@@ -0,0 +1 @@
1
+ export declare const ImageBlock: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
@@ -0,0 +1,13 @@
1
+ import type { AnyExtension } from '@tiptap/core';
2
+ import { type MeiConfigStorage } from '../config';
3
+ import { type BlockDefinition } from '../define-block';
4
+ export interface MeiExtensionsOptions extends Partial<MeiConfigStorage> {
5
+ /** Block definitions to load (their extensions and menu items). */
6
+ blocks: BlockDefinition[];
7
+ }
8
+ /**
9
+ * Editor core (always loaded) + the extensions of the given blocks.
10
+ * Core: paragraphs, text marks, links, history, colors, slash menu, drag & drop,
11
+ * block selection, block ids and the unknown-block fallback.
12
+ */
13
+ export declare function createExtensions({ blocks, ...config }: MeiExtensionsOptions): AnyExtension[];
@@ -0,0 +1,13 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ math: {
5
+ insertMathBlock: (latex?: string) => ReturnType;
6
+ insertMathInline: (latex?: string) => ReturnType;
7
+ };
8
+ }
9
+ }
10
+ /** Display equation (KaTeX, loaded on first render). Type `$$ ` on an empty line. */
11
+ export declare const MathBlock: Node<any, any>;
12
+ /** Inline equation. Type `$$x^2$$` (single `$` would catch prices like $5). */
13
+ export declare const MathInline: Node<any, any>;
@@ -0,0 +1,43 @@
1
+ import { type JSONContent } from '@tiptap/core';
2
+ import { PluginKey } from '@tiptap/pm/state';
3
+ import { type DateValue } from '../date-utils';
4
+ export { formatDateValue, formatMentionDate, isoDate, parseIsoDate, reminderTime, type DateFormat, type DateValue, type TimeFormat } from '../date-utils';
5
+ export type MentionKind = 'user' | 'page' | 'date';
6
+ export interface MentionItem {
7
+ id: string;
8
+ label: string;
9
+ kind: MentionKind;
10
+ /** Avatar image URL (users) — optional. */
11
+ avatar?: string;
12
+ /** Link for pages — opened on ⌘/Ctrl+click when no `onClick` is given. */
13
+ href?: string;
14
+ /** Secondary text in the menu (email, path…). */
15
+ description?: string;
16
+ }
17
+ export interface MentionReminder {
18
+ /** Start date of the mention (`YYYY-MM-DD`). */
19
+ date: string;
20
+ time: string | null;
21
+ /** Preset, e.g. `'1d'`, `'30m'`. */
22
+ remind: string;
23
+ /** When to notify. */
24
+ fireAt: Date;
25
+ }
26
+ export interface MentionOptions {
27
+ /** Finds people/pages for `@query`. Dates (today, tomorrow…) are built in. */
28
+ search: ((query: string) => MentionItem[] | Promise<MentionItem[]>) | null;
29
+ /** Called when a mention is clicked (read-only editors). */
30
+ onClick: ((item: MentionItem) => void) | null;
31
+ /**
32
+ * Called when a date mention's reminder is set or cleared. The editor can't send
33
+ * notifications itself — schedule them on your backend (see `getMentionReminders`).
34
+ */
35
+ onRemind: ((reminder: MentionReminder | null, value: DateValue) => void) | null;
36
+ /** "Learn about reminders" link in the date picker (hidden when not set). */
37
+ reminderHelpUrl: string | null;
38
+ }
39
+ /** All reminders in a document, for scheduling notifications server-side. */
40
+ export declare function getMentionReminders(doc: JSONContent): MentionReminder[];
41
+ export declare const mentionPluginKey: PluginKey<any>;
42
+ /** `@` mentions of people, pages and dates. */
43
+ export declare const MentionNode: import("@tiptap/core").Node<MentionOptions & Record<string, any>, any>;
@@ -0,0 +1,4 @@
1
+ import { Extension } from '@tiptap/core';
2
+ /** Marker: when loaded, code blocks in the `mermaid` language show a live diagram. */
3
+ export declare const MermaidPreview: Extension<any, any>;
4
+ export declare const SAMPLE_MERMAID = "flowchart LR\n A[\u00DD t\u01B0\u1EDFng] --> B{Duy\u1EC7t?}\n B -- C\u00F3 --> C[L\u00E0m]\n B -- Kh\u00F4ng --> A";
@@ -0,0 +1,4 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { PluginKey } from '@tiptap/pm/state';
3
+ export declare const slashPluginKey: PluginKey<any>;
4
+ export declare const SlashCommand: Extension<any, any>;
@@ -0,0 +1,11 @@
1
+ import type { PluginKey } from '@tiptap/pm/state';
2
+ import { type SuggestionOptions, type SuggestionProps } from '@tiptap/suggestion';
3
+ import type { Component } from 'vue';
4
+ /**
5
+ * Renders a suggestion popup (slash menu, emoji, mentions) with a Vue component that
6
+ * exposes `onKeyDown(event): boolean`, positioned under the caret with floating-ui.
7
+ */
8
+ export declare function suggestionRenderer<I>(component: Component, pluginKey: PluginKey, hooks?: {
9
+ onUpdate?: (props: SuggestionProps<I>) => boolean | void;
10
+ onStart?: () => void;
11
+ }): SuggestionOptions<I>['render'];
@@ -0,0 +1 @@
1
+ export declare const tableExtensions: (import("@tiptap/core").Node<import("@tiptap/extension-table").TableCellOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any>)[];
@@ -0,0 +1,10 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ tableOfContents: {
5
+ insertTableOfContents: () => ReturnType;
6
+ };
7
+ }
8
+ }
9
+ /** Table of contents built live from the document's headings and toggle headings. */
10
+ export declare const TableOfContents: Node<any, any>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Toggle (collapsible) block. `level` turns the summary into a heading, which is how
3
+ * Notion's toggle headings work: the heading's content folds under it.
4
+ */
5
+ export declare const ToggleDetails: import("@tiptap/core").Node<import("@tiptap/extension-details").DetailsOptions, any>;
6
+ export declare const toggleExtensions: (import("@tiptap/core").Node<import("@tiptap/extension-details").DetailsOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-details").DetailsSummaryOptions, any>)[];
@@ -0,0 +1,3 @@
1
+ import { Node } from '@tiptap/core';
2
+ export declare const UnknownBlock: Node<any, any>;
3
+ export declare const UnknownInline: Node<any, any>;
@@ -0,0 +1,34 @@
1
+ import './styles/index.css';
2
+ export { default as MeiEditor } from './components/MeiEditor.vue';
3
+ export { MeiEditorPlugin, type MeiEditorPluginOptions } from './plugin';
4
+ export { createExtensions, type MeiExtensionsOptions } from './extensions';
5
+ export { MeiConfig, type ImageUploader, type MeiConfigStorage } from './config';
6
+ export { BlockDrop } from './extensions/block-drop';
7
+ export { Callout } from './extensions/callout';
8
+ export { Column, Columns } from './extensions/columns';
9
+ export { ImageBlock } from './extensions/image-block';
10
+ export { Embed, toEmbedUrl } from './extensions/embed';
11
+ export { CodeBlock, lowlight } from './extensions/code-block';
12
+ export { SlashCommand } from './extensions/slash-command';
13
+ export { filterBlocks, isNode, type BlockType } from './block-items';
14
+ export { collectExtensions, defineBlock, type BlockDefinition, type BlockSpec } from './define-block';
15
+ export * from './blocks';
16
+ export { ContentError, sanitizeContent, unwrapUnknown, wrapUnknown, type ContentIssue } from './content';
17
+ export { GLOBAL_BLOCKS_KEY, GLOBAL_TOKENS_KEY } from './plugin-key';
18
+ export { TableOfContents } from './extensions/toc';
19
+ export { MathBlock, MathInline } from './extensions/math';
20
+ export { FileBlock, type FileBlockOptions, type FileKind } from './extensions/file-block';
21
+ export { MentionNode, type MentionItem, type MentionKind, type MentionOptions } from './extensions/mention';
22
+ export { EmojiSuggestion } from './extensions/emoji';
23
+ export { MermaidPreview } from './extensions/mermaid';
24
+ export { HtmlBlock, htmlBlockCsp, type HtmlBlockOptions } from './extensions/html-block';
25
+ export { ToggleDetails } from './extensions/toggle';
26
+ export { UnknownBlock, UnknownInline } from './extensions/unknown';
27
+ export { CODE_LANGUAGES, loadLanguage } from './extensions/code-block';
28
+ export { blockAt, colorBlocks, currentRange, deleteBlocks, duplicateBlocks, moveBlocks, selectBlocks, turnBlocksInto, type BlockRange, } from './block-ops';
29
+ export { BlockSelection, TURN_INTO_SHORTCUTS } from './extensions/block-selection';
30
+ export { COLORS, type ColorName } from './colors';
31
+ export { BgColor, BlockColor, COLORABLE_BLOCKS, TextColor } from './extensions/color-marks';
32
+ export { baseTokensCss, component as componentTokens, defineTokens, overridesCss, PALETTE_NAMES, primitive as primitiveTokens, semanticDark as semanticDarkTokens, semanticLight as semanticLightTokens, type PaletteName, type ThemeMode, type ThemeTokens, } from './theme';
33
+ export { en, locales, resolveMessages, vi, type BlockGroup, type EditorMessages, type LocaleName, type PartialMessages } from './locale';
34
+ export type { Editor, JSONContent } from '@tiptap/vue-3';
@@ -0,0 +1,3 @@
1
+ export declare function kbd(shortcut: string): string;
2
+ /** True for ⌘ on Mac / Ctrl elsewhere. */
3
+ export declare const isMod: (e: KeyboardEvent | MouseEvent) => boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * KaTeX's stylesheet is NOT imported here: Vite's dev optimizer can't stub a CSS subpath
3
+ * of a missing optional peer, which would break apps that don't use math. The Nuxt module
4
+ * adds it when `math` is enabled; Vue apps import 'katex/dist/katex.min.css' themselves.
5
+ */
6
+ export declare function loadKatex(): Promise<{
7
+ version: string;
8
+ render: typeof import("katex").render;
9
+ renderToString: typeof import("katex").renderToString;
10
+ ParseError: typeof import("katex").ParseError;
11
+ }>;
12
+ export declare function loadMermaid(): Promise<import("mermaid").Mermaid>;