docxodus 9.0.0 → 9.1.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 +91 -7
- package/dist/embed.bundle.js +6569 -0
- package/dist/embed.d.ts +77 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.iife.js +6596 -0
- package/dist/embed.js +350 -0
- package/dist/embed.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/session.bundle.js +15 -0
- package/dist/session.d.ts +7 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +6 -0
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm +0 -0
- package/dist/wasm/_framework/DocumentFormat.OpenXml.Framework.wasm.br +0 -0
- package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm +0 -0
- package/dist/wasm/_framework/DocumentFormat.OpenXml.wasm.br +0 -0
- package/dist/wasm/_framework/Docxodus.wasm +0 -0
- package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
- package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
- package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
- package/dist/wasm/_framework/System.Collections.Concurrent.wasm +0 -0
- package/dist/wasm/_framework/System.Collections.Concurrent.wasm.br +0 -0
- package/dist/wasm/_framework/System.Collections.Immutable.wasm.br +0 -0
- package/dist/wasm/_framework/System.Collections.NonGeneric.wasm.br +0 -0
- package/dist/wasm/_framework/System.Collections.Specialized.wasm.br +0 -0
- package/dist/wasm/_framework/System.Collections.wasm +0 -0
- package/dist/wasm/_framework/System.Collections.wasm.br +0 -0
- package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm.br +0 -0
- package/dist/wasm/_framework/System.ComponentModel.TypeConverter.wasm.br +0 -0
- package/dist/wasm/_framework/System.ComponentModel.wasm.br +0 -0
- package/dist/wasm/_framework/System.Console.wasm +0 -0
- package/dist/wasm/_framework/System.Console.wasm.br +0 -0
- package/dist/wasm/_framework/System.Diagnostics.Process.wasm +0 -0
- package/dist/wasm/_framework/System.Diagnostics.Process.wasm.br +0 -0
- package/dist/wasm/_framework/System.IO.Compression.wasm +0 -0
- package/dist/wasm/_framework/System.IO.Compression.wasm.br +0 -0
- package/dist/wasm/_framework/System.IO.Packaging.wasm +0 -0
- package/dist/wasm/_framework/System.IO.Packaging.wasm.br +0 -0
- package/dist/wasm/_framework/System.IO.Pipelines.wasm.br +0 -0
- package/dist/wasm/_framework/System.Linq.Expressions.wasm.br +0 -0
- package/dist/wasm/_framework/System.Linq.wasm +0 -0
- package/dist/wasm/_framework/System.Linq.wasm.br +0 -0
- package/dist/wasm/_framework/System.Memory.wasm +0 -0
- package/dist/wasm/_framework/System.Memory.wasm.br +0 -0
- package/dist/wasm/_framework/System.Net.Http.wasm.br +0 -0
- package/dist/wasm/_framework/System.Net.Primitives.wasm.br +0 -0
- package/dist/wasm/_framework/System.ObjectModel.wasm.br +0 -0
- package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
- package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
- package/dist/wasm/_framework/System.Private.Uri.wasm.br +0 -0
- package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
- package/dist/wasm/_framework/System.Private.Xml.Linq.wasm.br +0 -0
- package/dist/wasm/_framework/System.Private.Xml.wasm +0 -0
- package/dist/wasm/_framework/System.Private.Xml.wasm.br +0 -0
- package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm.br +0 -0
- package/dist/wasm/_framework/System.Runtime.wasm +0 -0
- package/dist/wasm/_framework/System.Runtime.wasm.br +0 -0
- package/dist/wasm/_framework/System.Security.Cryptography.wasm.br +0 -0
- package/dist/wasm/_framework/System.Text.Encodings.Web.wasm.br +0 -0
- package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
- package/dist/wasm/_framework/System.Text.Json.wasm.br +0 -0
- package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
- package/dist/wasm/_framework/System.Text.RegularExpressions.wasm.br +0 -0
- package/dist/wasm/_framework/System.Xml.Linq.wasm.br +0 -0
- package/dist/wasm/_framework/System.Xml.XDocument.wasm +0 -0
- package/dist/wasm/_framework/System.Xml.XDocument.wasm.br +0 -0
- package/dist/wasm/_framework/System.wasm.br +0 -0
- package/dist/wasm/_framework/dotnet.boot.js +22 -57
- package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
- package/dist/wasm/_framework/dotnet.js.br +0 -0
- package/dist/wasm/_framework/dotnet.native.js +0 -171
- package/dist/wasm/_framework/dotnet.native.js.br +0 -0
- package/dist/wasm/_framework/dotnet.native.wasm +0 -0
- package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
- package/dist/wasm/_framework/dotnet.runtime.js.br +0 -0
- package/package.json +11 -3
- package/dist/wasm/_framework/System.Text.Encoding.Extensions.wasm +0 -0
- package/dist/wasm/_framework/System.Threading.Thread.wasm +0 -0
- package/dist/wasm/_framework/System.Threading.wasm +0 -0
- package/dist/wasm/_framework/System.Xml.ReaderWriter.wasm +0 -0
- package/dist/wasm/_framework/System.Xml.XPath.XDocument.wasm +0 -0
- package/dist/wasm/_framework/System.Xml.XPath.wasm +0 -0
- package/dist/wasm/_framework/dotnet.js.map +0 -1
- package/dist/wasm/_framework/dotnet.native.js.symbols +0 -5533
- package/dist/wasm/_framework/dotnet.runtime.js.map +0 -1
package/README.md
CHANGED
|
@@ -49,6 +49,24 @@ const editor = DocxEditor.open(container, docxBytes, exports);
|
|
|
49
49
|
See [`examples/editor.html`](https://github.com/JSv4/Docxodus/blob/main/npm/examples/editor.html) for
|
|
50
50
|
a complete ribbon implementation.
|
|
51
51
|
|
|
52
|
+
## Embed it with one script tag
|
|
53
|
+
|
|
54
|
+
The `embed` entry packages the viewer and editor behind two one-call factories, with the WASM
|
|
55
|
+
runtime location auto-detected — no build step, no configuration:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<div id="doc"></div>
|
|
59
|
+
<script type="module">
|
|
60
|
+
import { createEditor } from 'https://cdn.jsdelivr.net/npm/docxodus@9.1.0/dist/embed.bundle.js';
|
|
61
|
+
const editor = await createEditor('#doc', './contract.docx'); // or bytes / Blob / File
|
|
62
|
+
// ...later: const editedBytes = editor.save();
|
|
63
|
+
</script>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`createViewer('#doc', source, options?)` is the read-only counterpart. Bundler users get the same
|
|
67
|
+
API from `docxodus/embed`; classic-script pages can load `dist/embed.iife.js` for a global
|
|
68
|
+
`Docxodus`. See [Embedding via CDN](#embedding-via-cdn) below.
|
|
69
|
+
|
|
52
70
|
## Project it for an LLM
|
|
53
71
|
|
|
54
72
|
`convertWmlToMarkdown()` renders the document as markdown where **every block carries a stable id**,
|
|
@@ -398,6 +416,69 @@ Hook for managing custom annotations on documents.
|
|
|
398
416
|
#### `useDocumentStructure(wasmBasePath?: string)`
|
|
399
417
|
Hook for document structure analysis and element-based targeting.
|
|
400
418
|
|
|
419
|
+
## Embedding via CDN
|
|
420
|
+
|
|
421
|
+
Everything in the published package — the JS wrappers AND the WASM runtime — is served by npm CDNs
|
|
422
|
+
(jsDelivr, unpkg) with `Access-Control-Allow-Origin: *` and correct `application/wasm` MIME types,
|
|
423
|
+
so a page can embed a full viewer or editor without hosting anything itself.
|
|
424
|
+
|
|
425
|
+
### One-tag viewer / editor (recommended)
|
|
426
|
+
|
|
427
|
+
```html
|
|
428
|
+
<div id="viewer"></div>
|
|
429
|
+
<div id="editor"></div>
|
|
430
|
+
<script type="module">
|
|
431
|
+
import { createViewer, createEditor }
|
|
432
|
+
from 'https://cdn.jsdelivr.net/npm/docxodus@9.1.0/dist/embed.bundle.js';
|
|
433
|
+
|
|
434
|
+
// Choose either factory, or render both into separate containers as shown.
|
|
435
|
+
// Source may be a URL, Uint8Array, ArrayBuffer, Blob, or File.
|
|
436
|
+
const viewer = await createViewer('#viewer', './contract.docx');
|
|
437
|
+
|
|
438
|
+
// No source opens a blank "New document"; returns a DocxEditor.
|
|
439
|
+
const editor = await createEditor('#editor', './contract.docx', { paginated: false });
|
|
440
|
+
const bytes = editor.save(); // lossless DOCX bytes
|
|
441
|
+
</script>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
`dist/embed.bundle.js` is a self-contained ESM bundle re-exporting the entire main API
|
|
445
|
+
(convert, compare, diff, sessions, annotations) plus `createViewer`/`createEditor`/`DocxEditor`,
|
|
446
|
+
so it also works as a no-build way to use any other function.
|
|
447
|
+
|
|
448
|
+
For pages that can't use modules, `dist/embed.iife.js` exposes the same surface as a global:
|
|
449
|
+
|
|
450
|
+
```html
|
|
451
|
+
<div id="doc"></div>
|
|
452
|
+
<script src="https://cdn.jsdelivr.net/npm/docxodus@9.1.0/dist/embed.iife.js"></script>
|
|
453
|
+
<script>
|
|
454
|
+
Docxodus.createEditor('#doc').then((editor) => { /* ... */ });
|
|
455
|
+
</script>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### How WASM resolution works
|
|
459
|
+
|
|
460
|
+
The ~18 MB runtime request set in `dist/wasm/` loads lazily from the same directory the bundle
|
|
461
|
+
was loaded from (`import.meta.url` for module scripts, `document.currentScript` for the IIFE):
|
|
462
|
+
first `<bundle dir>/wasm/`, then `<bundle dir>/` as a fallback. On a CDN that resolves to
|
|
463
|
+
`.../dist/wasm/_framework/...` automatically. To serve the WASM assets from somewhere else, pass
|
|
464
|
+
`{ wasmBasePath: 'https://your.host/wasm/' }` to either factory (or call `initialize(path)` first).
|
|
465
|
+
|
|
466
|
+
### CDN caveats
|
|
467
|
+
|
|
468
|
+
- **Pin an exact version in production** (`docxodus@9.1.0`, not `@latest`) — CDN responses are
|
|
469
|
+
cached as immutable, and the wire shapes between the JS wrappers and the WASM assemblies must
|
|
470
|
+
come from the same release.
|
|
471
|
+
- The build patches the .NET loader to fetch with `credentials: "omit"` — required because the
|
|
472
|
+
CDN's `Access-Control-Allow-Origin: *` cannot be combined with credentialed requests.
|
|
473
|
+
- The Web Worker entry (`docxodus/worker`) is not CDN-loadable cross-origin (browsers require
|
|
474
|
+
same-origin worker scripts); embed runs the engine on the main thread. Self-host the package
|
|
475
|
+
if you need the worker.
|
|
476
|
+
- Converter CSS is scoped to a private inner mount so `body`, `span`, and document-class rules
|
|
477
|
+
cannot restyle the host page. Document-global `@import` and `@page` rules are omitted; use the
|
|
478
|
+
full-document conversion/print path rather than an embed factory if those rules are required.
|
|
479
|
+
- First load fetches ~18 MB uncompressed across about 49 requests; subsequent loads hit the
|
|
480
|
+
browser cache.
|
|
481
|
+
|
|
401
482
|
## Hosting WASM Files
|
|
402
483
|
|
|
403
484
|
The WASM files need to be served from your web server. After building:
|
|
@@ -416,15 +497,18 @@ public/
|
|
|
416
497
|
main.js
|
|
417
498
|
```
|
|
418
499
|
|
|
419
|
-
##
|
|
500
|
+
## Package and Runtime Size
|
|
420
501
|
|
|
421
|
-
| Component |
|
|
422
|
-
|
|
423
|
-
| dotnet.native.wasm |
|
|
424
|
-
| Managed
|
|
425
|
-
|
|
|
502
|
+
| Component | Approx. uncompressed size |
|
|
503
|
+
|-----------|---------------------------:|
|
|
504
|
+
| dotnet.native.wasm | 1.5 MB |
|
|
505
|
+
| Managed/runtime WASM modules | 15.5 MB |
|
|
506
|
+
| WASM payload total | 17.0 MB |
|
|
507
|
+
| Published package (all bundles, types, maps, and WASM) | 20.0 MB |
|
|
426
508
|
|
|
427
|
-
|
|
509
|
+
Only the runtime request set (~18 MB including loader JavaScript) is fetched during first
|
|
510
|
+
initialization; source maps, declarations, and unrelated entry bundles are not. Runtime files are
|
|
511
|
+
loaded on demand and cached by the browser.
|
|
428
512
|
|
|
429
513
|
## Browser Support
|
|
430
514
|
|