docxodus 9.9.0 → 11.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 +182 -4
- package/dist/canonical.d.ts +7 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +56 -0
- package/dist/canonical.js.map +1 -0
- package/dist/docxodus.worker.d.ts +2 -1
- package/dist/docxodus.worker.d.ts.map +1 -1
- package/dist/docxodus.worker.js +250 -41
- package/dist/docxodus.worker.js.map +1 -1
- package/dist/editor.bundle.js +1980 -423
- package/dist/editor.d.ts +22 -2
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +94 -9
- package/dist/editor.js.map +1 -1
- package/dist/embed.bundle.js +2968 -597
- package/dist/embed.d.ts +1 -1
- package/dist/embed.iife.js +2969 -598
- package/dist/embed.js +1 -1
- package/dist/export-assets.json +277 -0
- package/dist/export-browser.bundle.js +7989 -0
- package/dist/export-browser.d.ts +266 -0
- package/dist/export-browser.d.ts.map +1 -0
- package/dist/export-browser.js +2915 -0
- package/dist/export-browser.js.map +1 -0
- package/dist/export-resource-limits-v1.json +57 -0
- package/dist/font-contract.d.ts +150 -0
- package/dist/font-contract.d.ts.map +1 -0
- package/dist/font-contract.js +59 -0
- package/dist/font-contract.js.map +1 -0
- package/dist/font-runtime.d.ts +33 -0
- package/dist/font-runtime.d.ts.map +1 -0
- package/dist/font-runtime.js +1100 -0
- package/dist/font-runtime.js.map +1 -0
- package/dist/index.d.ts +83 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +194 -149
- package/dist/index.js.map +1 -1
- package/dist/page-geometry.d.ts +8 -1
- package/dist/page-geometry.d.ts.map +1 -1
- package/dist/page-geometry.js +37 -11
- package/dist/page-geometry.js.map +1 -1
- package/dist/pagination.bundle.js +1827 -410
- package/dist/pagination.d.ts +249 -15
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +1942 -453
- package/dist/pagination.js.map +1 -1
- package/dist/react.d.ts +13 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +38 -5
- package/dist/react.js.map +1 -1
- package/dist/render-report-v2.schema.json +1581 -0
- package/dist/ribbon-chrome.d.ts +2 -2
- package/dist/ribbon-chrome.d.ts.map +1 -1
- package/dist/ribbon-chrome.js +72 -4
- package/dist/ribbon-chrome.js.map +1 -1
- package/dist/ribbon.js +119 -0
- package/dist/ribbon.js.map +1 -1
- package/dist/session.bundle.js +747 -29
- package/dist/session.d.ts +159 -19
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +593 -25
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +1287 -238
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -75
- 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 +0 -0
- package/dist/wasm/_framework/System.Collections.Immutable.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 +0 -0
- package/dist/wasm/_framework/System.ComponentModel.Primitives.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 +0 -0
- package/dist/wasm/_framework/System.IO.Pipelines.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.Private.CoreLib.wasm +0 -0
- package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
- package/dist/wasm/_framework/System.Private.Uri.wasm +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 +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 +0 -0
- package/dist/wasm/_framework/System.Security.Cryptography.wasm.br +0 -0
- package/dist/wasm/_framework/System.Text.Encodings.Web.wasm +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/dotnet.boot.js +34 -40
- package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
- package/dist/wasm/_framework/dotnet.native.js +39 -3
- 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/worker-proxy.bundle.js +198 -32
- package/dist/worker-proxy.d.ts +37 -4
- package/dist/worker-proxy.d.ts.map +1 -1
- package/dist/worker-proxy.js +187 -35
- package/dist/worker-proxy.js.map +1 -1
- package/package.json +22 -6
- package/dist/wasm/_framework/System.Diagnostics.Process.wasm +0 -0
- package/dist/wasm/_framework/System.Diagnostics.Process.wasm.br +0 -0
package/README.md
CHANGED
|
@@ -23,6 +23,13 @@ linked as one operation instead of reported as an unrelated delete and insert.*
|
|
|
23
23
|
`getRevisions()` gives you the same changes as structured data — typed, with move pairing and stable
|
|
24
24
|
`kind:scope:unid` anchors — so you can drive a review UI without parsing OOXML.
|
|
25
25
|
|
|
26
|
+
For audit and verification workflows, `docxDiffGetSemanticChanges(left, right)` returns the stable
|
|
27
|
+
`docxodus.semantic-changes` v1 object. It distinguishes content, formatting, structure, table,
|
|
28
|
+
story/review, relationship/media, and opaque-package families, with typed before/after values and
|
|
29
|
+
deterministic ids. An open session exposes the same opening-to-current comparison through
|
|
30
|
+
`session.getSemanticChanges()`; it requires the default `captureInitialProjection: true` setting.
|
|
31
|
+
See the [semantic diff contract](../docs/architecture/semantic_diff.md).
|
|
32
|
+
|
|
26
33
|
## Render a document faithfully
|
|
27
34
|
|
|
28
35
|
`convertDocxToHtml()` keeps what naive converters drop: justification, style inheritance, legal
|
|
@@ -33,6 +40,23 @@ numbering, tables, images, comments, headers and footers, and real footnotes wit
|
|
|
33
40
|
Paginated mode flows content into real page boxes with per-page numbers and page-anchored footnotes —
|
|
34
41
|
a print-accurate preview in the browser.
|
|
35
42
|
|
|
43
|
+
Supply an exact layout token to materialize portable page citations from that layout:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const result = paginateHtml(html, viewer, {
|
|
47
|
+
layoutToken: { documentVersion: session.getVersion(), rendererFingerprint: 'chromium-layout-v1' },
|
|
48
|
+
});
|
|
49
|
+
session.registerPageMap(result.pageMap!, 'chromium-layout-v1');
|
|
50
|
+
const citation = session.getPageCitation(anchorId, {
|
|
51
|
+
documentVersion: session.getVersion(),
|
|
52
|
+
rendererFingerprint: 'chromium-layout-v1',
|
|
53
|
+
});
|
|
54
|
+
navigateToPageCitation(viewer, citation);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Continuous renderers return explicit unavailability; Docxodus never estimates a citation page.
|
|
58
|
+
See the [PageMap contract](../docs/architecture/page_map.md).
|
|
59
|
+
|
|
36
60
|
## Edit it in place
|
|
37
61
|
|
|
38
62
|
`DocxEditor` is a framework-agnostic block editor over the live document. Edits go through a
|
|
@@ -66,7 +90,7 @@ runtime location auto-detected — no build step, no configuration:
|
|
|
66
90
|
```html
|
|
67
91
|
<div id="doc" style="height: 100dvh"></div>
|
|
68
92
|
<script type="module">
|
|
69
|
-
import { createRibbonEditor } from 'https://cdn.jsdelivr.net/npm/docxodus@
|
|
93
|
+
import { createRibbonEditor } from 'https://cdn.jsdelivr.net/npm/docxodus@10.0.0/dist/embed.bundle.js';
|
|
70
94
|
const ribbon = await createRibbonEditor('#doc', './contract.docx'); // or bytes / Blob / File
|
|
71
95
|
// ...later: const editedBytes = ribbon.save();
|
|
72
96
|
</script>
|
|
@@ -82,8 +106,80 @@ Bundler users get the same API from `docxodus/embed`; classic-script pages can l
|
|
|
82
106
|
`convertWmlToMarkdown()` renders the document as markdown where **every block carries a stable id**,
|
|
83
107
|
so an agent can point at a clause and edit it — and `openDocxSession()` writes back to that same id.
|
|
84
108
|
|
|
109
|
+
Multi-step plans are atomic by default. Each callback may call any synchronous
|
|
110
|
+
session mutation; success is one version/undo unit, while a failure or throw
|
|
111
|
+
restores the complete package and history checkpoint:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const result = session.executeBatch([
|
|
115
|
+
{ tool: 'docx_edit', action: 'replace_text',
|
|
116
|
+
mutation: () => session.replaceText(firstAnchor, 'Replacement text') },
|
|
117
|
+
{ tool: 'docx_create', action: 'set_header_text',
|
|
118
|
+
mutation: () => session.setHeaderText(firstAnchor, 'default', 'Confidential') },
|
|
119
|
+
]);
|
|
120
|
+
|
|
121
|
+
if (!result.success) console.error(result.failure);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Pass `'best_effort'` explicitly only when partial successes should be retained.
|
|
125
|
+
|
|
126
|
+
`previewBatch` answers "what would this do?" without touching the live session. It runs the
|
|
127
|
+
same steps against a complete isolated clone — each callback is handed the shadow session to
|
|
128
|
+
mutate — and returns the same receipt plus optional predicted HTML:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
const preview = session.previewBatch([
|
|
132
|
+
{ tool: 'docx_edit', action: 'replace_text',
|
|
133
|
+
mutation: shadow => shadow.replaceText(firstAnchor, 'Proposed replacement') },
|
|
134
|
+
], 'atomic', { html: 'full' });
|
|
135
|
+
|
|
136
|
+
console.log(preview.html, preview.revisionChanges.added, preview.warnings);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The live document's bytes, version and undo/redo history are unchanged either way. Preview
|
|
140
|
+
HTML shows tracked changes, comments, annotations, notes and headers/footers — the document
|
|
141
|
+
the batch would produce, matching what the Python and MCP clients render for the same batch.
|
|
142
|
+
`packageHash` is `null` when it could not be computed, so never assert replay equality
|
|
143
|
+
without checking for it.
|
|
144
|
+
|
|
85
145
|

|
|
86
146
|
|
|
147
|
+
Native links and bookmarks use the same stable anchors and exact character spans:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const session = openDocxSession(docxBytes, { persistAnchorIds: true });
|
|
151
|
+
const paragraph = Object.keys(session.project().anchorIndex)
|
|
152
|
+
.find(id => id.startsWith('p:body:'))!;
|
|
153
|
+
session.addBookmark('Definitions', {
|
|
154
|
+
startAnchorId: paragraph, startOffset: 0,
|
|
155
|
+
endAnchorId: paragraph, endOffset: 11,
|
|
156
|
+
});
|
|
157
|
+
session.addHyperlink(paragraph, { start: 0, length: 11 }, 'internal', 'Definitions');
|
|
158
|
+
const links = session.listHyperlinks(); // ids feed updateHyperlink/removeHyperlink
|
|
159
|
+
const bookmarks = session.listBookmarks(); // exact endpoint range + per-paragraph segments
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
External links own their relationship in the actual body/header/footer/footnote/endnote part;
|
|
163
|
+
internal links are relationship-free bookmark targets. Bookmark rename retargets inbound links
|
|
164
|
+
atomically, and unsafe removal or cross-part ranges return typed `EditResult` errors.
|
|
165
|
+
|
|
166
|
+
Native images are occurrence-addressed too, with bytes kept explicit at the API boundary:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
const capabilities = session.getImageCapabilities();
|
|
170
|
+
const inserted = session.insertImage(paragraph, 0, pngBytes, {
|
|
171
|
+
widthPoints: 144,
|
|
172
|
+
altText: 'Revenue by quarter',
|
|
173
|
+
});
|
|
174
|
+
const image = session.listImages().find(value => value.id === inserted.imageId)!;
|
|
175
|
+
session.setImageDimensions(image.id, { widthPoints: 108 });
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
PNG/JPEG/GIF/BMP/TIFF are writable. Existing WebP, external links, legacy VML, and unsupported
|
|
179
|
+
DrawingML remain enumerable with `canMutate: false`. Dimensions use points; floating offsets use
|
|
180
|
+
exact EMUs, and omitted insert dimensions use 96 DPI. The browser API accepts `Uint8Array` and
|
|
181
|
+
does not fetch image URLs or read paths.
|
|
182
|
+
|
|
87
183
|
---
|
|
88
184
|
|
|
89
185
|
## Everything else
|
|
@@ -179,6 +275,48 @@ function DocumentComparer() {
|
|
|
179
275
|
|
|
180
276
|
## API Reference
|
|
181
277
|
|
|
278
|
+
### Package verification
|
|
279
|
+
|
|
280
|
+
`generatePackageManifest(document)` inspects supplied bytes without opening an editable package;
|
|
281
|
+
`session.getPackageManifest()` describes the current logical session checkpoint, including unsaved
|
|
282
|
+
edits, without advancing its version. Both return the same schema-v1 `PackageManifest` with exact
|
|
283
|
+
package, ordered OPC-content, and normalized-semantic SHA-256 identities plus entries,
|
|
284
|
+
relationships, facts, and structured findings. Worker users can call
|
|
285
|
+
`worker.generatePackageManifest(document)` or `await workerSession.getPackageManifest()`. See
|
|
286
|
+
[`package_manifests.md`](../docs/architecture/package_manifests.md) for the normalization boundary.
|
|
287
|
+
|
|
288
|
+
### Stateful inspection and editing
|
|
289
|
+
|
|
290
|
+
`openDocxSession(bytes)` exposes the live document rather than a one-shot conversion. Inspect the
|
|
291
|
+
source before writing it: `listStyles()` returns the document's actual paragraph/character/table
|
|
292
|
+
styles, `getFormatting(anchorId)` keeps `directParagraph` separate from `effectiveParagraph`, and
|
|
293
|
+
`listInlineSpans(anchorId)` returns `anchorId` + `span` pairs accepted unchanged by `applyFormat`.
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
const session = openDocxSession(bytes);
|
|
297
|
+
try {
|
|
298
|
+
const anchorId = Object.keys(session.project().anchorIndex)[0];
|
|
299
|
+
const style = session.listStyles().find(s => s.name === "Strong Custom");
|
|
300
|
+
const run = session.listInlineSpans(anchorId).find(s => s.text === "Defined Term");
|
|
301
|
+
if (style && run) {
|
|
302
|
+
session.applyFormat(run.anchorId, run.span, { runStyle: style.id });
|
|
303
|
+
}
|
|
304
|
+
} finally {
|
|
305
|
+
session.close();
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
An omitted property in a `direct` record means "not written at this layer"; it must not be treated
|
|
310
|
+
as false or zero. The matching `effective` record resolves document defaults and the full style
|
|
311
|
+
chain. `getListMembership` and `getSectionInfo` likewise return their query `anchorId` so callers
|
|
312
|
+
do not have to translate between inspection and mutation coordinate systems.
|
|
313
|
+
|
|
314
|
+
`effective` is deliberately a shorter cascade than the renderer's: it excludes the numbering
|
|
315
|
+
level's own paragraph properties and the table style's conditional formatting, so a list item
|
|
316
|
+
indented only by its numbering definition reports `leftIndentTwips: 0` and a run bolded by a
|
|
317
|
+
`firstRow` table style reports `bold: false`. Use `getListMembership` for the real numbering
|
|
318
|
+
indentation. See `docs/architecture/docx_mutation_api.md` for the exact layer list.
|
|
319
|
+
|
|
182
320
|
### Core Functions
|
|
183
321
|
|
|
184
322
|
#### `initialize(basePath?: string): Promise<void>`
|
|
@@ -440,7 +578,7 @@ so a page can embed a full viewer or editor without hosting anything itself.
|
|
|
440
578
|
<div id="app" style="height: 100dvh"></div>
|
|
441
579
|
<script type="module">
|
|
442
580
|
import { createViewer, createEditor, createRibbonEditor }
|
|
443
|
-
from 'https://cdn.jsdelivr.net/npm/docxodus@
|
|
581
|
+
from 'https://cdn.jsdelivr.net/npm/docxodus@10.0.0/dist/embed.bundle.js';
|
|
444
582
|
|
|
445
583
|
// Choose a factory, or render several into separate containers as shown.
|
|
446
584
|
// Source may be a URL, Uint8Array, ArrayBuffer, Blob, or File.
|
|
@@ -470,7 +608,7 @@ For pages that can't use modules, `dist/embed.iife.js` exposes the same surface
|
|
|
470
608
|
|
|
471
609
|
```html
|
|
472
610
|
<div id="doc"></div>
|
|
473
|
-
<script src="https://cdn.jsdelivr.net/npm/docxodus@
|
|
611
|
+
<script src="https://cdn.jsdelivr.net/npm/docxodus@10.0.0/dist/embed.iife.js"></script>
|
|
474
612
|
<script>
|
|
475
613
|
Docxodus.createRibbonEditor('#doc').then((ribbon) => { /* ... */ });
|
|
476
614
|
</script>
|
|
@@ -486,7 +624,7 @@ first `<bundle dir>/wasm/`, then `<bundle dir>/` as a fallback. On a CDN that re
|
|
|
486
624
|
|
|
487
625
|
### CDN caveats
|
|
488
626
|
|
|
489
|
-
- **Pin an exact version in production** (`docxodus@
|
|
627
|
+
- **Pin an exact version in production** (`docxodus@10.0.0`, not `@latest`) — CDN responses are
|
|
490
628
|
cached as immutable, and the wire shapes between the JS wrappers and the WASM assemblies must
|
|
491
629
|
come from the same release.
|
|
492
630
|
- The build patches the .NET loader to fetch with `credentials: "omit"` — required because the
|
|
@@ -500,6 +638,46 @@ first `<bundle dir>/wasm/`, then `<bundle dir>/` as a fallback. On a CDN that re
|
|
|
500
638
|
- First load fetches ~18 MB uncompressed across about 49 requests; subsequent loads hit the
|
|
501
639
|
browser cache.
|
|
502
640
|
|
|
641
|
+
## Standalone paginated HTML
|
|
642
|
+
|
|
643
|
+
`docxodus/export-browser` turns a DOCX into a complete offline HTML document whose body contains
|
|
644
|
+
the finalized fixed page boxes—not the hidden measurement tree. It returns the HTML together with
|
|
645
|
+
the exact PageMap, renderer fingerprint, warnings, and a schema-v2 render report from that same
|
|
646
|
+
sanitized tree.
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
import { convertDocxToPaginatedHtml } from 'docxodus/export-browser';
|
|
650
|
+
|
|
651
|
+
const source = new Uint8Array(await file.arrayBuffer());
|
|
652
|
+
const result = await convertDocxToPaginatedHtml(source, {
|
|
653
|
+
reviewProfile: 'final',
|
|
654
|
+
commentProfile: 'endnotes',
|
|
655
|
+
documentVersion: 12,
|
|
656
|
+
expectedSourceDigest: verifiedSha256,
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
download(new Blob([result.html], { type: 'text/html' }));
|
|
660
|
+
console.log(result.pageCount, result.pageMap, result.renderReport);
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
The exporter copies caller bytes before its first asynchronous boundary, verifies them with the
|
|
664
|
+
package manifest API, performs layout in an attached script-disabled frame, embeds or removes every
|
|
665
|
+
automatic resource, and reopens the serialized result to verify page count and physical geometry.
|
|
666
|
+
External HTTPS/mail/tel links remain user-activated links and are inventoried in the report; the
|
|
667
|
+
exporter never follows them. `unsupportedContent: 'strict'` rejects visible placeholders or omitted
|
|
668
|
+
resources instead of returning a nominally complete artifact.
|
|
669
|
+
|
|
670
|
+
All three revision profiles (`final`, `original`, `markup`) are supported; `final` and `original`
|
|
671
|
+
derive their projection out-of-place and never mutate the caller's bytes. `strictFonts: true`
|
|
672
|
+
turns unresolved or unverified font families into failures; supplying a `fontResolver` (in Node,
|
|
673
|
+
`fontDirectories` on `@docxodus/export`) is what makes families verifiable. A font the browser
|
|
674
|
+
supplied on its own is labelled `browserObserved`; it is not presented as a verified host-font
|
|
675
|
+
environment.
|
|
676
|
+
|
|
677
|
+
By default the worker loads from `dist/wasm/` beside the package entry point. A deployment that
|
|
678
|
+
hosts those files elsewhere may pass `wasmBasePath`. `docxodus/export-assets.json` is the closed,
|
|
679
|
+
SHA-256-addressed runtime asset graph, and `docxodus/render-report.schema.json` is the report schema.
|
|
680
|
+
|
|
503
681
|
## Hosting WASM Files
|
|
504
682
|
|
|
505
683
|
The WASM files need to be served from your web server. After building:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Shared canonical-JSON serialization, used by both the export orchestrator and the browser
|
|
2
|
+
* font runtime wherever a value needs a stable digest or a deterministic wire form. */
|
|
3
|
+
export declare function isWellFormedUnicode(value: string): boolean;
|
|
4
|
+
export declare function assertWellFormedUnicode(value: string): void;
|
|
5
|
+
/** Serialize report/schema values with recursively sorted object keys and no insignificant space. */
|
|
6
|
+
export declare function canonicalJson(value: unknown): string;
|
|
7
|
+
//# sourceMappingURL=canonical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;uFACuF;AAEvF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAW1D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI3D;AA6BD,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Shared canonical-JSON serialization, used by both the export orchestrator and the browser
|
|
2
|
+
* font runtime wherever a value needs a stable digest or a deterministic wire form. */
|
|
3
|
+
export function isWellFormedUnicode(value) {
|
|
4
|
+
for (let index = 0; index < value.length; index++) {
|
|
5
|
+
const unit = value.charCodeAt(index);
|
|
6
|
+
if (unit >= 0xd800 && unit <= 0xdbff) {
|
|
7
|
+
const next = value.charCodeAt(++index);
|
|
8
|
+
if (!(next >= 0xdc00 && next <= 0xdfff))
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
else if (unit >= 0xdc00 && unit <= 0xdfff) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
export function assertWellFormedUnicode(value) {
|
|
18
|
+
if (!isWellFormedUnicode(value)) {
|
|
19
|
+
throw new TypeError("Canonical JSON does not support unpaired UTF-16 surrogates");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function canonicalValue(value) {
|
|
23
|
+
if (value === null || typeof value === "boolean")
|
|
24
|
+
return value;
|
|
25
|
+
if (typeof value === "string") {
|
|
26
|
+
assertWellFormedUnicode(value);
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === "number") {
|
|
30
|
+
if (!Number.isFinite(value))
|
|
31
|
+
throw new TypeError("Canonical JSON does not support non-finite numbers");
|
|
32
|
+
return Object.is(value, -0) ? 0 : value;
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(value))
|
|
35
|
+
return value.map(canonicalValue);
|
|
36
|
+
if (typeof value === "object") {
|
|
37
|
+
const prototype = Object.getPrototypeOf(value);
|
|
38
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
39
|
+
throw new TypeError("Canonical JSON supports only plain objects");
|
|
40
|
+
}
|
|
41
|
+
const result = {};
|
|
42
|
+
for (const key of Object.keys(value).sort()) {
|
|
43
|
+
assertWellFormedUnicode(key);
|
|
44
|
+
const member = value[key];
|
|
45
|
+
if (member !== undefined)
|
|
46
|
+
result[key] = canonicalValue(member);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
throw new TypeError(`Canonical JSON does not support ${typeof value}`);
|
|
51
|
+
}
|
|
52
|
+
/** Serialize report/schema values with recursively sorted object keys and no insignificant space. */
|
|
53
|
+
export function canonicalJson(value) {
|
|
54
|
+
return JSON.stringify(canonicalValue(value));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;uFACuF;AAEvF,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC;YACvC,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;gBAAE,OAAO,KAAK,CAAC;QACxD,CAAC;aAAM,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,4DAA4D,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;QACvG,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACzD,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;QACpE,CAAC;QACD,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAgC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACvE,uBAAuB,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,MAAM,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC;YACvD,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,IAAI,SAAS,CAAC,mCAAmC,OAAO,KAAK,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* thread free for UI updates and user interactions.
|
|
6
6
|
*
|
|
7
7
|
* Communication is via postMessage with structured request/response types.
|
|
8
|
-
*
|
|
8
|
+
* Caller-owned Uint8Array inputs are first cloned to preserve their exact view and avoid
|
|
9
|
+
* detachment; that private clone is then transferred to the worker.
|
|
9
10
|
*/
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=docxodus.worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docxodus.worker.d.ts","sourceRoot":"","sources":["../src/docxodus.worker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"docxodus.worker.d.ts","sourceRoot":"","sources":["../src/docxodus.worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|