@eigenpal/nuxt-docx-editor 0.0.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 ADDED
@@ -0,0 +1,113 @@
1
+ <p align="center">
2
+ <a href="https://www.docx-editor.dev/">
3
+ <img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/assets/header.png" alt="DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side." width="500" />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@eigenpal/nuxt-docx-editor"><img src="https://img.shields.io/npm/v/@eigenpal/nuxt-docx-editor.svg?style=flat-square&color=3B5BDB" alt="npm version" /></a>
9
+ <a href="https://www.npmjs.com/package/@eigenpal/nuxt-docx-editor"><img src="https://img.shields.io/npm/dm/@eigenpal/nuxt-docx-editor.svg?style=flat-square&color=3B5BDB" alt="npm downloads" /></a>
10
+ <a href="https://github.com/eigenpal/docx-editor/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache_2.0-blue.svg?style=flat-square&color=3B5BDB" alt="license" /></a>
11
+ <a href="https://docx-editor.dev/editor"><img src="https://img.shields.io/badge/Live_Demo-3B5BDB?style=flat-square&logo=vercel&logoColor=white" alt="Demo" /></a>
12
+ <a href="https://www.docx-editor.dev/docs"><img src="https://img.shields.io/badge/Docs-3B5BDB?style=flat-square&logo=readthedocs&logoColor=white" alt="Documentation" /></a>
13
+ </p>
14
+
15
+ # @eigenpal/nuxt-docx-editor
16
+
17
+ Nuxt 3 & 4 module for the [docx-editor](https://docx-editor.dev). Wraps [`@eigenpal/docx-editor-vue`](https://www.npmjs.com/package/@eigenpal/docx-editor-vue) and auto-imports an SSR-safe `<DocxEditor>` component — no manual import, no `<ClientOnly>` boilerplate.
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ npm install @eigenpal/nuxt-docx-editor
23
+ ```
24
+
25
+ ```ts
26
+ // nuxt.config.ts
27
+ export default defineNuxtConfig({
28
+ modules: ['@eigenpal/nuxt-docx-editor'],
29
+ });
30
+ ```
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import { ref } from 'vue';
35
+
36
+ const buffer = ref<ArrayBuffer | null>(null);
37
+
38
+ async function loadFile(e: Event) {
39
+ const file = (e.target as HTMLInputElement).files?.[0];
40
+ buffer.value = file ? await file.arrayBuffer() : null;
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <input type="file" accept=".docx" @change="loadFile" />
46
+ <DocxEditor v-if="buffer" :document-buffer="buffer" mode="editing" />
47
+ </template>
48
+ ```
49
+
50
+ That's the whole integration. The module registers `<DocxEditor>` as **client-only** — the editor drives a hidden ProseMirror instance and browser DOM APIs, so it never runs during SSR. Nuxt renders a placeholder on the server and hydrates the editor in the browser. The module also pushes the editor stylesheet into Nuxt's CSS pipeline, so the toolbar is styled without a manual `import`.
51
+
52
+ ## Options
53
+
54
+ ```ts
55
+ export default defineNuxtConfig({
56
+ modules: ['@eigenpal/nuxt-docx-editor'],
57
+ docxEditor: {
58
+ prefix: 'Ep', // <EpDocxEditor> instead of <DocxEditor>
59
+ injectStyles: true, // push @eigenpal/docx-editor-vue/styles.css into nuxt.options.css
60
+ },
61
+ });
62
+ ```
63
+
64
+ | Option | Type | Default | Description |
65
+ | -------------- | --------- | ------- | -------------------------------------------------------------------------------- |
66
+ | `prefix` | `string` | `''` | Component name prefix. `'Ep'` registers `<EpDocxEditor>`. |
67
+ | `injectStyles` | `boolean` | `true` | Set `false` to import `@eigenpal/docx-editor-vue/styles.css` yourself. |
68
+
69
+ ## Packages
70
+
71
+ | Package | Description |
72
+ | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
73
+ | [`@eigenpal/docx-editor-react`](https://www.npmjs.com/package/@eigenpal/docx-editor-react) | <img src="https://cdn.simpleicons.org/react/61DAFB" width="20" align="middle" /> &nbsp; React adapter. Toolbar, paged editor, plugins. |
74
+ | [`@eigenpal/docx-editor-vue`](https://www.npmjs.com/package/@eigenpal/docx-editor-vue) | <img src="https://cdn.simpleicons.org/vuedotjs/4FC08D" width="20" align="middle" /> &nbsp; Vue 3 adapter. Toolbar, paged editor, plugins. |
75
+ | [`@eigenpal/nuxt-docx-editor`](https://www.npmjs.com/package/@eigenpal/nuxt-docx-editor) | <img src="https://cdn.simpleicons.org/nuxtdotjs/00DC82" width="20" align="middle" /> &nbsp; Nuxt 3 & 4 module wrapping the Vue adapter. |
76
+ | [`@eigenpal/docx-editor-core`](https://www.npmjs.com/package/@eigenpal/docx-editor-core) | Framework-agnostic core: OOXML parser, serializer, layout engine, ProseMirror schema. Depend on this if you fork the React or Vue adapter. |
77
+ | [`@eigenpal/docx-editor-i18n`](https://www.npmjs.com/package/@eigenpal/docx-editor-i18n) | Shared locale strings and types consumed by both adapters. |
78
+ | [`@eigenpal/docx-editor-agents`](https://www.npmjs.com/package/@eigenpal/docx-editor-agents) | Agent SDK and chat UI: framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI. |
79
+
80
+ ## Component API
81
+
82
+ `<DocxEditor>` is the Vue adapter's component, registered unchanged — the same props, emits, and `DocxEditorRef` methods. Full reference: **[docx-editor.dev/docs/props](https://www.docx-editor.dev/docs/props)**.
83
+
84
+ ## Composables
85
+
86
+ The Vue composables (`useDocxEditor`, `useZoom`, `useFindReplace`, `useAutoSave`, ...) are auto-imported — use them in any component or page without an `import`:
87
+
88
+ ```vue
89
+ <script setup lang="ts">
90
+ const { save } = useAutoSave(/* ... */);
91
+ </script>
92
+ ```
93
+
94
+ ## Beyond the component
95
+
96
+ Other `@eigenpal/docx-editor-vue` surfaces — `renderAsync`, `createEmptyDocument`, the `DocxEditorProps`/`DocxEditorRef` types, and the `/ui`, `/dialogs`, `/plugin-api` subpaths — are not re-exported by this module. Import them from the adapter directly, and add it to your own `dependencies` so the import is explicit:
97
+
98
+ ```bash
99
+ npm install @eigenpal/docx-editor-vue
100
+ ```
101
+
102
+ ```ts
103
+ import { renderAsync, createEmptyDocument } from '@eigenpal/docx-editor-vue';
104
+ ```
105
+
106
+ ## Contributing
107
+
108
+ Contributions welcome. See [CONTRIBUTING.md](https://github.com/eigenpal/docx-editor/blob/main/CONTRIBUTING.md) for setup, tests, and the one-time CLA signature.
109
+
110
+ ## Commercial Support
111
+
112
+ > [!TIP]
113
+ > Questions or custom features? Email **[docx-editor@eigenpal.com](mailto:docx-editor@eigenpal.com)**.
@@ -0,0 +1,25 @@
1
+ import { NuxtModule } from '@nuxt/schema';
2
+
3
+ /**
4
+ * Configuration for the DOCX editor Nuxt module, read from the
5
+ * `docxEditor` key of `nuxt.config`.
6
+ *
7
+ * @public
8
+ */
9
+ interface ModuleOptions {
10
+ /**
11
+ * Component name prefix. With `prefix: 'Ep'` the component is auto-imported
12
+ * as `<EpDocxEditor>` instead of `<DocxEditor>`. Defaults to `''`.
13
+ */
14
+ prefix?: string;
15
+ /**
16
+ * Whether the module pushes the editor stylesheet into `nuxt.options.css`.
17
+ * Set to `false` to import `@eigenpal/docx-editor-vue/styles.css` yourself.
18
+ * Defaults to `true`.
19
+ */
20
+ injectStyles?: boolean;
21
+ }
22
+ declare const module$1: NuxtModule<ModuleOptions>;
23
+
24
+ export { module$1 as default };
25
+ export type { ModuleOptions };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@eigenpal/nuxt-docx-editor",
3
+ "configKey": "docxEditor",
4
+ "compatibility": {
5
+ "nuxt": ">=3.0.0"
6
+ },
7
+ "version": "0.0.0",
8
+ "builder": {
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "unknown"
11
+ }
12
+ }
@@ -0,0 +1,54 @@
1
+ import { defineNuxtModule, createResolver, addComponent, addImports } from '@nuxt/kit';
2
+
3
+ const COMPOSABLES_SUBPATH = "@eigenpal/docx-editor-vue/composables";
4
+ const STYLES_SUBPATH = "@eigenpal/docx-editor-vue/styles.css";
5
+ const VUE_COMPOSABLES = [
6
+ "useAutoSave",
7
+ "useClipboard",
8
+ "useCommentSidebarItems",
9
+ "useDocxEditor",
10
+ "useDragAutoScroll",
11
+ "useFindReplace",
12
+ "useFixedDropdown",
13
+ "useHistory",
14
+ "useSelectionHighlight",
15
+ "useTableResize",
16
+ "useTableSelection",
17
+ "useTrackedChanges",
18
+ "useVisualLineNavigation",
19
+ "useWheelZoom",
20
+ "useZoom"
21
+ ];
22
+ const module$1 = defineNuxtModule({
23
+ meta: {
24
+ name: "@eigenpal/nuxt-docx-editor",
25
+ configKey: "docxEditor",
26
+ compatibility: {
27
+ nuxt: ">=3.0.0"
28
+ }
29
+ },
30
+ defaults: {
31
+ prefix: "",
32
+ injectStyles: true
33
+ },
34
+ setup(options, nuxt) {
35
+ const resolver = createResolver(import.meta.url);
36
+ if (options.injectStyles) {
37
+ nuxt.options.css.push(STYLES_SUBPATH);
38
+ }
39
+ const optimizeDeps = nuxt.options.vite.optimizeDeps ??= {};
40
+ optimizeDeps.include = [
41
+ ...optimizeDeps.include ?? [],
42
+ "@eigenpal/docx-editor-core",
43
+ "@eigenpal/docx-editor-vue"
44
+ ];
45
+ addComponent({
46
+ name: `${options.prefix}DocxEditor`,
47
+ filePath: resolver.resolve("./runtime/components/DocxEditor"),
48
+ mode: "client"
49
+ });
50
+ addImports(VUE_COMPOSABLES.map((name) => ({ name, from: COMPOSABLES_SUBPATH })));
51
+ }
52
+ });
53
+
54
+ export { module$1 as default };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Runtime entry for the auto-imported `<DocxEditor>` component.
3
+ *
4
+ * Re-exports the Vue adapter's editor component unchanged so all of its props,
5
+ * events, and the `DocxEditorRef` typing flow through to Nuxt consumers. The
6
+ * client-only behaviour is applied by `module.ts` via `addComponent`, not here.
7
+ */
8
+ export { DocxEditor as default } from '@eigenpal/docx-editor-vue';
9
+ //# sourceMappingURL=DocxEditor.d.ts.map
@@ -0,0 +1 @@
1
+ export { DocxEditor as default } from "@eigenpal/docx-editor-vue";
@@ -0,0 +1,3 @@
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@eigenpal/nuxt-docx-editor",
3
+ "version": "0.0.0",
4
+ "description": "Nuxt 3 & 4 module for the @eigenpal/docx-editor WYSIWYG DOCX editor — auto-imports an SSR-safe <DocxEditor> component.",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/types.d.mts",
9
+ "import": "./dist/module.mjs"
10
+ }
11
+ },
12
+ "main": "./dist/module.mjs",
13
+ "types": "./dist/types.d.mts",
14
+ "typesVersions": {
15
+ "*": {
16
+ ".": [
17
+ "./dist/types.d.mts"
18
+ ]
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "nuxt-module-build build",
26
+ "prepack": "nuxt-module-build build",
27
+ "typecheck": "tsc --noEmit"
28
+ },
29
+ "dependencies": {
30
+ "@nuxt/kit": "^3.14.0 || ^4.0.0",
31
+ "@eigenpal/docx-editor-vue": "^1.0.1",
32
+ "prosemirror-commands": "^1.5.2",
33
+ "prosemirror-dropcursor": "^1.8.2",
34
+ "prosemirror-history": "^1.4.0",
35
+ "prosemirror-keymap": "^1.2.2",
36
+ "prosemirror-model": "^1.19.4",
37
+ "prosemirror-state": "^1.4.3",
38
+ "prosemirror-tables": "^1.8.5",
39
+ "prosemirror-transform": "^1.12.0",
40
+ "prosemirror-view": "^1.41.6"
41
+ },
42
+ "peerDependencies": {
43
+ "vue": "^3.3.0"
44
+ },
45
+ "devDependencies": {
46
+ "@nuxt/module-builder": "^1.0.0",
47
+ "@nuxt/schema": "^3.14.0",
48
+ "nuxt": "^3.14.0",
49
+ "vue": "^3.5.0"
50
+ },
51
+ "keywords": [
52
+ "nuxt",
53
+ "nuxt-module",
54
+ "docx",
55
+ "editor",
56
+ "word",
57
+ "document",
58
+ "ssr"
59
+ ],
60
+ "author": {
61
+ "name": "Jedr Blaszyk",
62
+ "email": "jedr@eigenpal.com",
63
+ "url": "https://github.com/jedrazb"
64
+ },
65
+ "license": "Apache-2.0",
66
+ "homepage": "https://docx-editor.dev/",
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "https://github.com/eigenpal/docx-editor.git",
70
+ "directory": "packages/nuxt"
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ }
75
+ }