@toantranmei/editor 0.3.1 → 0.4.0
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/README.md +82 -1
- package/dist/collaboration.js +205 -19
- package/dist/collaboration.js.map +1 -1
- package/dist/{css-el97DJfy.js → css-Cf_w91Fs.js} +26 -11
- package/dist/css-Cf_w91Fs.js.map +1 -0
- package/dist/{date-utils-DW99lT2W.js → date-utils-CevhhRfQ.js} +22 -4
- package/dist/date-utils-CevhhRfQ.js.map +1 -0
- package/dist/index.js +2058 -1621
- package/dist/index.js.map +1 -1
- package/dist/nuxt.js +2 -1
- package/dist/nuxt.js.map +1 -1
- package/dist/render.js +200 -182
- package/dist/render.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/collaboration.d.ts +9 -1
- package/dist/types/components/MeiEditor.vue.d.ts +3 -2
- package/dist/types/composables/useUploadState.d.ts +10 -0
- package/dist/types/config.d.ts +5 -2
- package/dist/types/extensions/block-drop.d.ts +23 -0
- package/dist/types/extensions/file-block.d.ts +5 -2
- package/dist/types/extensions/file-drop.d.ts +65 -0
- package/dist/types/extensions/index.d.ts +1 -1
- package/dist/types/extensions/upload-attrs.d.ts +29 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locale.d.ts +9 -0
- package/dist/types/presence.d.ts +39 -0
- package/dist/types/render/index.d.ts +18 -3
- package/dist/types/theme/css.d.ts +3 -0
- package/dist/types/theme/tokens.d.ts +4 -0
- package/package.json +1 -1
- package/dist/css-el97DJfy.js.map +0 -1
- package/dist/date-utils-DW99lT2W.js.map +0 -1
package/dist/nuxt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as e } from "./css-Cf_w91Fs.js";
|
|
2
2
|
import { n as t, t as n } from "./block-names-QblT9TgF.js";
|
|
3
3
|
import { addComponent as r, addPluginTemplate as i, addTemplate as a, defineNuxtModule as o, extendViteConfig as s } from "@nuxt/kit";
|
|
4
4
|
// src/nuxt.ts
|
|
@@ -20,6 +20,7 @@ var c = [
|
|
|
20
20
|
"@tiptap/pm/model",
|
|
21
21
|
"@tiptap/pm/state",
|
|
22
22
|
"@tiptap/pm/tables",
|
|
23
|
+
"@tiptap/pm/transform",
|
|
23
24
|
"@tiptap/pm/view",
|
|
24
25
|
"@tiptap/starter-kit",
|
|
25
26
|
"@tiptap/suggestion",
|
package/dist/nuxt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.js","names":["overridesCss","BLOCK_PEERS","BLOCK_NAMES","RUNTIME_DEPS","module","defineNuxtModule","options","nuxt","tokensCss","addTemplate","dst","addComponent","unknown","b","named","list","n","extendViteConfig","peers","p","dep"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addComponent, addPluginTemplate, addTemplate, defineNuxtModule, extendViteConfig } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport { overridesCss } from './theme/css'\nimport type { ThemeTokens } from './theme/tokens'\nimport { BLOCK_NAMES, BLOCK_PEERS, type BlockName } from './block-names'\n\n/**\n * Bare imports in dist/index.js (everything except `vue`). Keep in sync when adding\n * imports; `pnpm --filter @toantranmei/editor check:deps` verifies it after a build.\n */\nexport const RUNTIME_DEPS = [\n '@floating-ui/dom',\n '@lucide/vue',\n '@tiptap/core',\n '@tiptap/extension-blockquote',\n '@tiptap/extension-code-block-lowlight',\n '@tiptap/extension-details',\n '@tiptap/extension-drag-handle-vue-3',\n '@tiptap/extension-heading',\n '@tiptap/extension-horizontal-rule',\n '@tiptap/extension-image',\n '@tiptap/extension-list',\n '@tiptap/extension-mention',\n '@tiptap/extension-node-range',\n '@tiptap/extension-table',\n '@tiptap/pm/model',\n '@tiptap/pm/state',\n '@tiptap/pm/tables',\n '@tiptap/pm/view',\n '@tiptap/starter-kit',\n '@tiptap/suggestion',\n '@tiptap/vue-3',\n '@tiptap/vue-3/menus',\n 'lowlight',\n]\n\nexport interface ModuleOptions {\n /** Name of the auto-registered component. */\n componentName: string\n /** Add the editor stylesheet to the app automatically. */\n css: boolean\n /**\n * Pre-bundle the editor and its Tiptap/ProseMirror deps in Vite dev. Keeps a single\n * ProseMirror instance and converts highlight.js (CommonJS). Disable only when\n * consuming the editor's source directly (like the monorepo playground).\n */\n prebundle: boolean\n /** Token overrides applied to every editor in the app (typed, with autocomplete). */\n tokens?: ThemeTokens\n /**\n * Blocks loaded by every editor without a `blocks` prop, e.g. `['default', 'math', 'toc']`.\n * Only the listed blocks are imported. For blocks with options (`file`, `mention`), use\n * a Nuxt plugin with `app.use(MeiEditorPlugin, { component: false, blocks: [...] })` instead.\n */\n blocks?: BlockName[]\n}\n\n/**\n * Nuxt module: registers <MeiEditor> as a client-only component and adds its CSS.\n *\n * @example\n * export default defineNuxtConfig({ modules: ['@toantranmei/editor/nuxt'] })\n */\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: { name: '@toantranmei/editor', configKey: 'meiEditor' },\n defaults: { componentName: 'MeiEditor', css: true, prebundle: true },\n setup(options, nuxt) {\n if (options.css) nuxt.options.css.push('@toantranmei/editor/style.css')\n\n // App-wide token overrides compiled to a static stylesheet (no runtime cost).\n const tokensCss = overridesCss(options.tokens)\n if (tokensCss) {\n const { dst } = addTemplate({ filename: 'mei-editor-tokens.css', write: true, getContents: () => tokensCss })\n nuxt.options.css.push(dst)\n }\n\n addComponent({\n name: options.componentName,\n export: 'MeiEditor',\n filePath: '@toantranmei/editor',\n mode: 'client',\n })\n\n // KaTeX's stylesheet for the math block (see lazy.ts for why the library doesn't import it).\n if (options.blocks?.includes('math')) nuxt.options.css.push('katex/dist/katex.min.css')\n\n if (options.blocks?.length) {\n const unknown = options.blocks.filter(b => !BLOCK_NAMES.includes(b))\n if (unknown.length) throw new Error(`[@toantranmei/editor] Unknown block(s) in meiEditor.blocks: ${unknown.join(', ')}`)\n const named = options.blocks.filter(b => b !== 'default')\n const list = [options.blocks.includes('default') ? '...defaultBlocks' : '', ...named].filter(Boolean).join(', ')\n addPluginTemplate({\n filename: 'mei-editor-blocks.client.mjs',\n mode: 'client',\n getContents: () => [\n `import { defineNuxtPlugin } from '#imports'`,\n `import { GLOBAL_BLOCKS_KEY, defaultBlocks${named.map(n => `, ${n}`).join('')} } from '@toantranmei/editor'`,\n `export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.provide(GLOBAL_BLOCKS_KEY, [${list}]) })`,\n ].join('\\n'),\n })\n }\n\n // Nuxt marks module packages as \"transpile\", which excludes them from pre-bundling,\n // so pre-bundle the editor's runtime deps instead (resolved from this package).\n if (options.prebundle) {\n extendViteConfig((config) => {\n config.optimizeDeps ??= {}\n config.optimizeDeps.include ??= []\n const peers = (options.blocks ?? []).map(b => BLOCK_PEERS[b]).filter((p): p is string => !!p)\n config.optimizeDeps.include.push(...[...RUNTIME_DEPS, ...peers].map(dep => `@toantranmei/editor > ${dep}`))\n })\n }\n },\n})\n\nexport default module\n"],"mappings":";;;;AAUA,IAAaG,IAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GA6BMC,IAAoCC,EAAgC;CACxE,MAAM;EAAE,MAAM;EAAuB,WAAW;CAAY;CAC5D,UAAU;EAAE,eAAe;EAAa,KAAK;EAAM,WAAW;CAAK;CACnE,MAAM,GAAS,GAAM;EACnB,AAAIC,EAAQ,OAAKC,EAAK,QAAQ,IAAI,KAAK,+BAA+B;EAGtE,IAAMC,IAAYR,EAAaM,EAAQ,MAAM;EAC7C,IAAIE,GAAW;GACb,IAAM,EAAE,WAAQC,EAAY;IAAE,UAAU;IAAyB,OAAO;IAAM,mBAAmBD;GAAU,CAAC;GAC5G,EAAK,QAAQ,IAAI,KAAKE,CAAG;EAC3B;EAYA,IAVAC,EAAa;GACX,MAAML,EAAQ;GACd,QAAQ;GACR,UAAU;GACV,MAAM;EACR,CAAC,GAGGA,EAAQ,QAAQ,SAAS,MAAM,KAAGC,EAAK,QAAQ,IAAI,KAAK,0BAA0B,GAElFD,EAAQ,QAAQ,QAAQ;GAC1B,IAAMM,IAAUN,EAAQ,OAAO,QAAO,MAAK,CAACJ,EAAY,SAASW,CAAC,CAAC;GACnE,IAAID,EAAQ,QAAQ,MAAU,MAAM,+DAA+DA,EAAQ,KAAK,IAAI,GAAG;GACvH,IAAME,IAAQR,EAAQ,OAAO,QAAO,MAAKO,MAAM,SAAS,GAClDE,IAAO,CAACT,EAAQ,OAAO,SAAS,SAAS,IAAI,qBAAqB,IAAI,GAAGQ,CAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;GAC/G,EAAkB;IAChB,UAAU;IACV,MAAM;IACN,mBAAmB;KACjB;KACA,4CAA4CA,EAAM,KAAI,MAAK,KAAKE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;KAC9E,6FAA6FD,EAAK;IACpG,CAAC,CAAC,KAAK,IAAI;GACb,CAAC;EACH;EAIA,AAAIT,EAAQ,aACVW,GAAkB,MAAW;GAE3B,AADA,EAAO,iBAAiB,CAAC,GACzB,EAAO,aAAa,YAAY,CAAC;GACjC,IAAMC,KAASZ,EAAQ,UAAU,CAAC,EAAA,CAAG,KAAI,MAAKL,EAAYY,EAAE,CAAC,CAAC,QAAQ,MAAmB,CAAC,CAACM,CAAC;GAC5F,EAAO,aAAa,QAAQ,KAAK,GAAG,CAAC,GAAGhB,GAAc,GAAGe,CAAK,CAAC,CAAC,KAAI,MAAO,yBAAyBE,GAAK,CAAC;EAC5G,CAAC;CAEL;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"nuxt.js","names":["overridesCss","BLOCK_PEERS","BLOCK_NAMES","RUNTIME_DEPS","module","defineNuxtModule","options","nuxt","tokensCss","addTemplate","dst","addComponent","unknown","b","named","list","n","extendViteConfig","peers","p","dep"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addComponent, addPluginTemplate, addTemplate, defineNuxtModule, extendViteConfig } from '@nuxt/kit'\nimport type { NuxtModule } from '@nuxt/schema'\nimport { overridesCss } from './theme/css'\nimport type { ThemeTokens } from './theme/tokens'\nimport { BLOCK_NAMES, BLOCK_PEERS, type BlockName } from './block-names'\n\n/**\n * Bare imports in dist/index.js (everything except `vue`). Keep in sync when adding\n * imports; `pnpm --filter @toantranmei/editor check:deps` verifies it after a build.\n */\nexport const RUNTIME_DEPS = [\n '@floating-ui/dom',\n '@lucide/vue',\n '@tiptap/core',\n '@tiptap/extension-blockquote',\n '@tiptap/extension-code-block-lowlight',\n '@tiptap/extension-details',\n '@tiptap/extension-drag-handle-vue-3',\n '@tiptap/extension-heading',\n '@tiptap/extension-horizontal-rule',\n '@tiptap/extension-image',\n '@tiptap/extension-list',\n '@tiptap/extension-mention',\n '@tiptap/extension-node-range',\n '@tiptap/extension-table',\n '@tiptap/pm/model',\n '@tiptap/pm/state',\n '@tiptap/pm/tables',\n '@tiptap/pm/transform',\n '@tiptap/pm/view',\n '@tiptap/starter-kit',\n '@tiptap/suggestion',\n '@tiptap/vue-3',\n '@tiptap/vue-3/menus',\n 'lowlight',\n]\n\nexport interface ModuleOptions {\n /** Name of the auto-registered component. */\n componentName: string\n /** Add the editor stylesheet to the app automatically. */\n css: boolean\n /**\n * Pre-bundle the editor and its Tiptap/ProseMirror deps in Vite dev. Keeps a single\n * ProseMirror instance and converts highlight.js (CommonJS). Disable only when\n * consuming the editor's source directly (like the monorepo playground).\n */\n prebundle: boolean\n /** Token overrides applied to every editor in the app (typed, with autocomplete). */\n tokens?: ThemeTokens\n /**\n * Blocks loaded by every editor without a `blocks` prop, e.g. `['default', 'math', 'toc']`.\n * Only the listed blocks are imported. For blocks with options (`file`, `mention`), use\n * a Nuxt plugin with `app.use(MeiEditorPlugin, { component: false, blocks: [...] })` instead.\n */\n blocks?: BlockName[]\n}\n\n/**\n * Nuxt module: registers <MeiEditor> as a client-only component and adds its CSS.\n *\n * @example\n * export default defineNuxtConfig({ modules: ['@toantranmei/editor/nuxt'] })\n */\nconst module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({\n meta: { name: '@toantranmei/editor', configKey: 'meiEditor' },\n defaults: { componentName: 'MeiEditor', css: true, prebundle: true },\n setup(options, nuxt) {\n if (options.css) nuxt.options.css.push('@toantranmei/editor/style.css')\n\n // App-wide token overrides compiled to a static stylesheet (no runtime cost).\n const tokensCss = overridesCss(options.tokens)\n if (tokensCss) {\n const { dst } = addTemplate({ filename: 'mei-editor-tokens.css', write: true, getContents: () => tokensCss })\n nuxt.options.css.push(dst)\n }\n\n addComponent({\n name: options.componentName,\n export: 'MeiEditor',\n filePath: '@toantranmei/editor',\n mode: 'client',\n })\n\n // KaTeX's stylesheet for the math block (see lazy.ts for why the library doesn't import it).\n if (options.blocks?.includes('math')) nuxt.options.css.push('katex/dist/katex.min.css')\n\n if (options.blocks?.length) {\n const unknown = options.blocks.filter(b => !BLOCK_NAMES.includes(b))\n if (unknown.length) throw new Error(`[@toantranmei/editor] Unknown block(s) in meiEditor.blocks: ${unknown.join(', ')}`)\n const named = options.blocks.filter(b => b !== 'default')\n const list = [options.blocks.includes('default') ? '...defaultBlocks' : '', ...named].filter(Boolean).join(', ')\n addPluginTemplate({\n filename: 'mei-editor-blocks.client.mjs',\n mode: 'client',\n getContents: () => [\n `import { defineNuxtPlugin } from '#imports'`,\n `import { GLOBAL_BLOCKS_KEY, defaultBlocks${named.map(n => `, ${n}`).join('')} } from '@toantranmei/editor'`,\n `export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.provide(GLOBAL_BLOCKS_KEY, [${list}]) })`,\n ].join('\\n'),\n })\n }\n\n // Nuxt marks module packages as \"transpile\", which excludes them from pre-bundling,\n // so pre-bundle the editor's runtime deps instead (resolved from this package).\n if (options.prebundle) {\n extendViteConfig((config) => {\n config.optimizeDeps ??= {}\n config.optimizeDeps.include ??= []\n const peers = (options.blocks ?? []).map(b => BLOCK_PEERS[b]).filter((p): p is string => !!p)\n config.optimizeDeps.include.push(...[...RUNTIME_DEPS, ...peers].map(dep => `@toantranmei/editor > ${dep}`))\n })\n }\n },\n})\n\nexport default module\n"],"mappings":";;;;AAUA,IAAaG,IAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GA6BMC,IAAoCC,EAAgC;CACxE,MAAM;EAAE,MAAM;EAAuB,WAAW;CAAY;CAC5D,UAAU;EAAE,eAAe;EAAa,KAAK;EAAM,WAAW;CAAK;CACnE,MAAM,GAAS,GAAM;EACnB,AAAIC,EAAQ,OAAKC,EAAK,QAAQ,IAAI,KAAK,+BAA+B;EAGtE,IAAMC,IAAYR,EAAaM,EAAQ,MAAM;EAC7C,IAAIE,GAAW;GACb,IAAM,EAAE,WAAQC,EAAY;IAAE,UAAU;IAAyB,OAAO;IAAM,mBAAmBD;GAAU,CAAC;GAC5G,EAAK,QAAQ,IAAI,KAAKE,CAAG;EAC3B;EAYA,IAVAC,EAAa;GACX,MAAML,EAAQ;GACd,QAAQ;GACR,UAAU;GACV,MAAM;EACR,CAAC,GAGGA,EAAQ,QAAQ,SAAS,MAAM,KAAGC,EAAK,QAAQ,IAAI,KAAK,0BAA0B,GAElFD,EAAQ,QAAQ,QAAQ;GAC1B,IAAMM,IAAUN,EAAQ,OAAO,QAAO,MAAK,CAACJ,EAAY,SAASW,CAAC,CAAC;GACnE,IAAID,EAAQ,QAAQ,MAAU,MAAM,+DAA+DA,EAAQ,KAAK,IAAI,GAAG;GACvH,IAAME,IAAQR,EAAQ,OAAO,QAAO,MAAKO,MAAM,SAAS,GAClDE,IAAO,CAACT,EAAQ,OAAO,SAAS,SAAS,IAAI,qBAAqB,IAAI,GAAGQ,CAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;GAC/G,EAAkB;IAChB,UAAU;IACV,MAAM;IACN,mBAAmB;KACjB;KACA,4CAA4CA,EAAM,KAAI,MAAK,KAAKE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;KAC9E,6FAA6FD,EAAK;IACpG,CAAC,CAAC,KAAK,IAAI;GACb,CAAC;EACH;EAIA,AAAIT,EAAQ,aACVW,GAAkB,MAAW;GAE3B,AADA,EAAO,iBAAiB,CAAC,GACzB,EAAO,aAAa,YAAY,CAAC;GACjC,IAAMC,KAASZ,EAAQ,UAAU,CAAC,EAAA,CAAG,KAAI,MAAKL,EAAYY,EAAE,CAAC,CAAC,QAAQ,MAAmB,CAAC,CAACM,CAAC;GAC5F,EAAO,aAAa,QAAQ,KAAK,GAAG,CAAC,GAAGhB,GAAc,GAAGe,CAAK,CAAC,CAAC,KAAI,MAAO,yBAAyBE,GAAK,CAAC;EAC5G,CAAC;CAEL;AACF,CAAC"}
|