@docmentis/udoc-wasm 0.0.0-stage → 0.8.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 (42) hide show
  1. package/LICENSE +434 -0
  2. package/README.md +53 -2
  3. package/dist/error.d.ts +16 -0
  4. package/dist/error.js +36 -0
  5. package/dist/font-fulfill.d.ts +92 -0
  6. package/dist/font-fulfill.js +203 -0
  7. package/dist/fonts/Caladea-Bold.ttf +0 -0
  8. package/dist/fonts/Caladea-BoldItalic.ttf +0 -0
  9. package/dist/fonts/Caladea-Italic.ttf +0 -0
  10. package/dist/fonts/Caladea-Regular.ttf +0 -0
  11. package/dist/fonts/Carlito-Bold.ttf +0 -0
  12. package/dist/fonts/Carlito-BoldItalic.ttf +0 -0
  13. package/dist/fonts/Carlito-Italic.ttf +0 -0
  14. package/dist/fonts/Carlito-Regular.ttf +0 -0
  15. package/dist/fonts/LICENSE-Liberation.txt +102 -0
  16. package/dist/fonts/LiberationMono-Bold.ttf +0 -0
  17. package/dist/fonts/LiberationMono-BoldItalic.ttf +0 -0
  18. package/dist/fonts/LiberationMono-Italic.ttf +0 -0
  19. package/dist/fonts/LiberationMono-Regular.ttf +0 -0
  20. package/dist/fonts/LiberationSans-Bold.ttf +0 -0
  21. package/dist/fonts/LiberationSans-BoldItalic.ttf +0 -0
  22. package/dist/fonts/LiberationSans-Italic.ttf +0 -0
  23. package/dist/fonts/LiberationSans-Regular.ttf +0 -0
  24. package/dist/fonts/LiberationSerif-Bold.ttf +0 -0
  25. package/dist/fonts/LiberationSerif-BoldItalic.ttf +0 -0
  26. package/dist/fonts/LiberationSerif-Italic.ttf +0 -0
  27. package/dist/fonts/LiberationSerif-Regular.ttf +0 -0
  28. package/dist/fonts/OFL-Caladea.txt +93 -0
  29. package/dist/fonts/OFL-Carlito.txt +94 -0
  30. package/dist/google-font-catalog.d.ts +21 -0
  31. package/dist/google-font-catalog.js +1860 -0
  32. package/dist/index.d.ts +58 -0
  33. package/dist/index.js +150 -0
  34. package/dist/meta-url.d.ts +3 -0
  35. package/dist/meta-url.js +46 -0
  36. package/dist/office-compatible-fonts.d.ts +3 -0
  37. package/dist/office-compatible-fonts.js +33 -0
  38. package/dist/wasm/THIRD-PARTY-NOTICES.txt +9395 -0
  39. package/dist/wasm/udoc.d.ts +20260 -0
  40. package/dist/wasm/udoc.js +4600 -0
  41. package/dist/wasm/udoc_bg.wasm +0 -0
  42. package/package.json +41 -5
package/LICENSE ADDED
@@ -0,0 +1,434 @@
1
+ docMentis WASM Runtime License
2
+ Version 2.0 - October 22, 2026
3
+ Copyright (c) 2026 docMentis LLC. All rights reserved.
4
+
5
+ THIS IS A PROPRIETARY SOFTWARE LICENSE, NOT AN OPEN-SOURCE LICENSE.
6
+
7
+ This License governs the proprietary WebAssembly runtime (the "Runtime")
8
+ distributed in the @docmentis/udoc-wasm npm package (the "Package"). The
9
+ Package also contains third-party materials that are governed by their own
10
+ licenses, as stated below.
11
+
12
+ By installing, accessing, using, or redistributing the Runtime after being
13
+ provided these terms, You accept this License. If You act for an organization,
14
+ You represent that You have authority to bind it. If You do not agree, do not
15
+ use or redistribute the Runtime.
16
+
17
+ 1. Definitions
18
+
19
+ "docMentis" means docMentis LLC.
20
+
21
+ "Runtime" means the proprietary WebAssembly executable (currently
22
+ udoc_bg.wasm) and related proprietary runtime components supplied by
23
+ docMentis under this License. The compiled WebAssembly includes a third-party
24
+ CMYK ICC profile made available under Creative Commons CC0 1.0, URW++ font
25
+ data licensed under the SIL Open Font License 1.1, Adobe Glyph List data
26
+ licensed under a BSD 3-Clause license, and open-source Rust crates under their
27
+ own licenses. Third-party materials are not proprietary intellectual property
28
+ of docMentis.
29
+
30
+ "Package" means the distributed @docmentis/udoc-wasm npm package, which
31
+ includes the Runtime and may include additional files. In the currently
32
+ described layout, Liberation, Carlito, and Caladea font files are provided
33
+ separately under dist/fonts/, together with their respective OFL 1.1 license
34
+ files. Those separate font files are not embedded in udoc_bg.wasm.
35
+
36
+ "Application" means any product, application, library, website, service,
37
+ API, development tool, command-line tool, or other integration that uses the
38
+ Runtime, whether running in a browser, desktop, mobile, server, or automated
39
+ workflow. Applications may be created by docMentis or third parties.
40
+
41
+ "Permit" means an authorization issued by docMentis's online permit service
42
+ allowing specified free use of the Runtime for a limited duration or scope.
43
+
44
+ "Commercial License" means a separate agreement or license entitlement
45
+ issued by docMentis that expressly grants additional rights to use the Runtime.
46
+
47
+ "You" means the individual or legal entity that obtains, uses, or
48
+ redistributes the Runtime.
49
+
50
+ 2. Permission to Use and Integrate
51
+
52
+ Subject to this License, and to valid authorization under Section 3 or 4
53
+ whenever the Runtime is executed, docMentis grants You a limited, worldwide,
54
+ non-exclusive, non-transferable right to:
55
+
56
+ (a) download, install, and execute the Runtime in an Application;
57
+ (b) develop and distribute Your own Applications using its documented APIs,
58
+ including viewers, editors, document processors, server-side services,
59
+ command-line tools, and agent or automation integrations; and
60
+ (c) make and distribute unmodified copies of the proprietary Runtime as an
61
+ embedded component of, or genuine dependency for, Your Application,
62
+ subject to Section 5 and independently applicable third-party licenses.
63
+
64
+ Both commercial and non-commercial Applications are allowed. You may charge
65
+ for Your own Application or service. You do not receive the Runtime source
66
+ code, ownership rights in the Runtime, or permission to sublicense the
67
+ proprietary Runtime independently of this License. The third-party materials
68
+ remain subject to their own terms and public-domain dedications.
69
+
70
+ 3. Free Use and Online Permits
71
+
72
+ The Runtime may be used without a commercial license fee only when its required
73
+ valid online Permit has been obtained and verified in accordance with the
74
+ Runtime's authorization mechanism. A Permit may be required for each document,
75
+ operation, session, or other unit of use, as determined by the Runtime and
76
+ permit service. Free use does not confer a right to offline operation.
77
+
78
+ There is no fixed daily usage cap promised or imposed by this text. docMentis
79
+ may introduce or change prospective free-use limits, permit eligibility,
80
+ permit duration, verification requirements, or issuance policies. Such changes
81
+ apply to subsequent Permit requests or issuances and do not, by themselves,
82
+ retroactively invalidate an already issued Permit before its stated expiry.
83
+ No continuous availability of the permit service or issuance of future free
84
+ Permits is guaranteed.
85
+
86
+ A valid Permit authorizes use only within its issued scope and lifetime. You
87
+ must not bypass, forge, tamper with, or circumvent Permit checks or usage
88
+ controls.
89
+
90
+ 4. Commercial Licenses
91
+
92
+ A Commercial License may authorize offline use, operation without online
93
+ Permits, removal of docMentis attribution, disabling of docMentis telemetry,
94
+ or other specifically granted entitlements. Each entitlement is limited to the
95
+ projects, products, domains, environments, dates, uses, and other scope stated
96
+ in the applicable Commercial License. Expiration of a Commercial License may
97
+ prevent continued Runtime operation unless another valid authorization exists.
98
+
99
+ If an express provision of a Commercial License conflicts with this License,
100
+ that provision governs the uses it specifically covers. This License does
101
+ not automatically extend prior udoc-viewer licenses to additional products,
102
+ projects, or capabilities merely because a newer Runtime can provide them.
103
+
104
+ 5. Redistribution
105
+
106
+ You may deliver or host unmodified proprietary Runtime binaries as a genuine
107
+ dependency or embedded component of Your Application, including client-side
108
+ WebAssembly delivered to browsers, server deployments, and other installations.
109
+ You may also identify the official npm Package as a dependency. Ordinary
110
+ compression and relocation that preserve the binary contents are permitted.
111
+ The Package's JavaScript files and TypeScript declarations are part of the
112
+ Runtime, and You may bundle, minify, transpile, or otherwise transform them
113
+ with build tools as part of Your Application; Section 6(a) does not restrict
114
+ such transformation.
115
+
116
+ These permissions relate to docMentis's proprietary rights only. The
117
+ included CC0 color profile, OFL font data, Adobe Glyph List data and
118
+ open-source crates retain their independent third-party status and the
119
+ applicable rights described in Section 12.
120
+
121
+ When distributing the Runtime, You must:
122
+
123
+ (a) provide recipients with this License, the third-party notices and terms
124
+ reproduced in it, and dist/wasm/THIRD-PARTY-NOTICES.txt, or make those
125
+ terms reasonably accessible to recipients alongside the distributed
126
+ Runtime;
127
+ (b) preserve proprietary notices and the copyright and license notices
128
+ required by applicable third-party licenses;
129
+ (c) when separately distributing font files included in dist/fonts/, retain
130
+ the respective font license files alongside those files and comply with
131
+ their applicable license terms; and
132
+ (d) make applicable terms reasonably accessible to browser recipients when
133
+ distributing the Runtime through a web Application.
134
+
135
+ You may not rebrand, sell, publish, or license the proprietary Runtime as an
136
+ independent competing runtime product. This does not prohibit selling Your
137
+ Application or offering a hosted service that uses the Runtime. Recipients'
138
+ rights to use the proprietary Runtime arise from this License or a valid
139
+ Commercial License, not from a sublicense granted by You.
140
+
141
+ 6. Restrictions
142
+
143
+ Except as expressly permitted by this License, an applicable Commercial
144
+ License, independent third-party licenses, or applicable law, You must not:
145
+
146
+ (a) alter, patch, or create a derivative version of the proprietary Runtime;
147
+ (b) reverse engineer, decompile, disassemble, or attempt to obtain its
148
+ proprietary source code, except to the extent permitted by law;
149
+ (c) circumvent or misrepresent license keys, online Permits, attribution
150
+ requirements, telemetry restrictions, or other authorization controls;
151
+ (d) remove or falsify proprietary or third-party legal notices; or
152
+ (e) use docMentis trademarks to suggest endorsement without permission.
153
+
154
+ These restrictions apply to docMentis's proprietary code and do not limit
155
+ independent rights granted under third-party licenses, including the SIL
156
+ Open Font License for URW++ data embedded in the Runtime and for separately
157
+ distributed fonts in dist/fonts/. Separately distributed open-source wrappers
158
+ remain under their respective open-source licenses; their licenses do not
159
+ change the proprietary Runtime's license.
160
+
161
+ 7. Attribution, Telemetry, and Privacy
162
+
163
+ Where the Runtime or applicable documentation requires docMentis attribution
164
+ or telemetry as a condition of free use, You must comply unless a Commercial
165
+ License expressly provides otherwise. Waiver of docMentis attribution or
166
+ telemetry does not waive any third-party copyright notice or license duty.
167
+
168
+ Permit checks and telemetry may involve communications with docMentis services.
169
+ Applicable privacy notices, rather than this License, describe associated
170
+ data handling. This License does not authorize access to or collection of
171
+ user document contents.
172
+
173
+ 8. Ownership
174
+
175
+ The Runtime is licensed, not sold. docMentis retains title and all rights in
176
+ its proprietary software. Third-party owners retain their rights in their
177
+ respective materials. All rights not expressly granted are reserved.
178
+
179
+ 9. Term and Termination
180
+
181
+ This License continues until terminated. If You materially breach it, and the
182
+ breach is capable of cure, docMentis may terminate Your rights if You fail to
183
+ cure within 15 days after written notice. Intentional circumvention of
184
+ license controls or unauthorized distribution that cannot reasonably be cured
185
+ may result in immediate termination. On termination, stop using and
186
+ redistributing the proprietary Runtime under this License. Rights under
187
+ independent open-source third-party licenses are not terminated by this
188
+ provision. Commercial Licenses are governed by their own term and termination
189
+ clauses.
190
+
191
+ 10. Disclaimer of Warranty
192
+
193
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, DOCMENTIS PROVIDES THE RUNTIME AND
194
+ PERMIT SERVICE "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTIES OF ANY KIND,
195
+ EXPRESS, IMPLIED, OR STATUTORY, INCLUDING MERCHANTABILITY, FITNESS FOR A
196
+ PARTICULAR PURPOSE, AND NON-INFRINGEMENT. DOCMENTIS DOES NOT WARRANT THAT
197
+ THE RUNTIME OR THE PERMIT SERVICE WILL BE ERROR-FREE, UNINTERRUPTED, OR
198
+ CONTINUOUSLY AVAILABLE.
199
+
200
+ 11. Limitation of Liability; Governing Law
201
+
202
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, DOCMENTIS IS NOT LIABLE UNDER THIS
203
+ LICENSE FOR INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR
204
+ PUNITIVE DAMAGES, OR LOST PROFITS, REVENUE, DATA, OR BUSINESS OPPORTUNITIES.
205
+ FOR FREE USE UNDER THIS LICENSE, DOCMENTIS'S TOTAL AGGREGATE LIABILITY IS
206
+ LIMITED TO US$100. LIABILITY UNDER A SEPARATE COMMERCIAL LICENSE IS SUBJECT
207
+ TO THAT AGREEMENT. NOTHING EXCLUDES LIABILITY THAT CANNOT LAWFULLY BE
208
+ EXCLUDED.
209
+
210
+ This License is governed by the laws of the State of California, USA,
211
+ without regard to conflict-of-law principles. If any provision is held
212
+ unenforceable, the remainder remains in effect to the extent permitted by law.
213
+ A revised license may govern later Runtime versions, but does not
214
+ automatically replace this License for previously distributed versions.
215
+
216
+ 12. Third-Party Materials
217
+
218
+ This License does not change or replace the separate licenses for materials
219
+ owned by third parties. The compiled Runtime and the separately distributed
220
+ fonts are distinguished below.
221
+
222
+ 12.1 CC0 CMYK ICC color profile (embedded in udoc_bg.wasm)
223
+
224
+ The Runtime incorporates a CMYK ICC profile from the Compact ICC Profiles
225
+ collection by Clinton Ingram (saucecontrol), currently
226
+ CGATS001Compat-v2-micro.icc. The collection's author has made this profile
227
+ available under the Creative Commons CC0 1.0 Universal public-domain
228
+ dedication, to the extent permitted by applicable law.
229
+
230
+ Source: https://github.com/saucecontrol/Compact-ICC-Profiles
231
+ CC0 text: https://creativecommons.org/publicdomain/zero/1.0/legalcode
232
+
233
+ The CC0 profile may be copied, modified, embedded, used, and redistributed,
234
+ including commercially, without a copyright attribution requirement or any
235
+ separate end-user license acceptance required by CC0. This notice identifies
236
+ the provenance of the profile; it is not a restriction or condition on use.
237
+ The CC0 dedication applies to the profile, not to the proprietary Runtime or
238
+ the separately licensed fonts. No endorsement by the profile's creator or by
239
+ Creative Commons is implied.
240
+
241
+ 12.2 URW++ font software (embedded in udoc_bg.wasm)
242
+
243
+ The compiled Runtime incorporates URW++ font data licensed under the SIL Open
244
+ Font License, Version 1.1 (OFL 1.1). The URW++ copyright notice is reproduced
245
+ in Appendix A and the full OFL 1.1 text is reproduced in Appendix B. These
246
+ fonts remain under the OFL, even when incorporated into proprietary binaries.
247
+ The OFL rights in the font software are independent of this License, including
248
+ rights to use, extract, modify, and redistribute font data subject to the OFL.
249
+ Where modified font data is distributed, the OFL's Reserved Font Name and other
250
+ conditions continue to apply.
251
+
252
+ 12.3 Adobe Glyph List data (embedded in udoc_bg.wasm)
253
+
254
+ The Runtime incorporates glyph-name-to-Unicode mapping data derived from the
255
+ Adobe Glyph List, the Adobe Glyph List For New Fonts, and the ITC Zapf
256
+ Dingbats Glyph List, published by Adobe under a BSD 3-Clause license. Adobe's
257
+ copyright notice, the license conditions, and the disclaimer are reproduced in
258
+ Appendix C. Those terms govern the glyph list data, not the proprietary
259
+ Runtime.
260
+
261
+ Source: https://github.com/adobe-type-tools/agl-aglfn
262
+
263
+ 12.4 Open-source Rust crates (compiled into udoc_bg.wasm)
264
+
265
+ The Runtime is built from Rust source that uses third-party open-source
266
+ crates, each under its own license. Each crate, the license it is used under,
267
+ that license's text with the crate's copyright notices, and where to obtain
268
+ the crate's source code are listed in dist/wasm/THIRD-PARTY-NOTICES.txt, which
269
+ ships beside udoc_bg.wasm. Those licenses govern the respective crates, not
270
+ the proprietary Runtime, and the rights they grant in those crates are
271
+ independent of this License.
272
+
273
+ 12.5 Separately distributed font files (dist/fonts/)
274
+
275
+ The Package also distributes Liberation, Carlito, and Caladea font files
276
+ separately in dist/fonts/, not embedded in udoc_bg.wasm. These files are
277
+ licensed under OFL 1.1. Their respective complete license files, including
278
+ copyright and Reserved Font Name notices, ship in the same directory:
279
+ LICENSE-Liberation.txt, OFL-Carlito.txt, and OFL-Caladea.txt.
280
+ Those adjacent license files govern the corresponding separate font assets.
281
+ The Appendix A URW++ notice does not purport to cover those separate fonts.
282
+
283
+ If a later Package version incorporates additional third-party font data or
284
+ other materials, their applicable notices and terms must be provided with that
285
+ version as required by their respective licenses.
286
+
287
+ 13. Contact
288
+
289
+ For commercial licensing or questions about this License:
290
+ licensing@docmentis.com
291
+
292
+ ==========================================================================
293
+ APPENDIX A - EMBEDDED URW++ FONT COPYRIGHT NOTICE
294
+ ==========================================================================
295
+
296
+ Copyright (c) 2014,2015 by (URW)++ Design & Development
297
+
298
+ The URW++ font data incorporated in udoc_bg.wasm remains governed by the
299
+ SIL Open Font License, Version 1.1, reproduced in Appendix B.
300
+
301
+ ==========================================================================
302
+ APPENDIX B - SIL OPEN FONT LICENSE VERSION 1.1 (URW++ SOURCE LICENSE)
303
+ ==========================================================================
304
+
305
+ Copyright (c) 2014,2015 by (URW)++ Design & Development
306
+
307
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
308
+ This license is copied below, and is also available with a FAQ at:
309
+ http://scripts.sil.org/OFL
310
+
311
+
312
+ -----------------------------------------------------------
313
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
314
+ -----------------------------------------------------------
315
+
316
+ PREAMBLE
317
+ The goals of the Open Font License (OFL) are to stimulate worldwide
318
+ development of collaborative font projects, to support the font creation
319
+ efforts of academic and linguistic communities, and to provide a free and
320
+ open framework in which fonts may be shared and improved in partnership
321
+ with others.
322
+
323
+ The OFL allows the licensed fonts to be used, studied, modified and
324
+ redistributed freely as long as they are not sold by themselves. The
325
+ fonts, including any derivative works, can be bundled, embedded,
326
+ redistributed and/or sold with any software provided that any reserved
327
+ names are not used by derivative works. The fonts and derivatives,
328
+ however, cannot be released under any other type of license. The
329
+ requirement for fonts to remain under this license does not apply
330
+ to any document created using the fonts or their derivatives.
331
+
332
+ DEFINITIONS
333
+ "Font Software" refers to the set of files released by the Copyright
334
+ Holder(s) under this license and clearly marked as such. This may
335
+ include source files, build scripts and documentation.
336
+
337
+ "Reserved Font Name" refers to any names specified as such after the
338
+ copyright statement(s).
339
+
340
+ "Original Version" refers to the collection of Font Software components as
341
+ distributed by the Copyright Holder(s).
342
+
343
+ "Modified Version" refers to any derivative made by adding to, deleting,
344
+ or substituting -- in part or in whole -- any of the components of the
345
+ Original Version, by changing formats or by porting the Font Software to a
346
+ new environment.
347
+
348
+ "Author" refers to any designer, engineer, programmer, technical
349
+ writer or other person who contributed to the Font Software.
350
+
351
+ PERMISSION & CONDITIONS
352
+ Permission is hereby granted, free of charge, to any person obtaining
353
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
354
+ redistribute, and sell modified and unmodified copies of the Font
355
+ Software, subject to the following conditions:
356
+
357
+ 1) Neither the Font Software nor any of its individual components,
358
+ in Original or Modified Versions, may be sold by itself.
359
+
360
+ 2) Original or Modified Versions of the Font Software may be bundled,
361
+ redistributed and/or sold with any software, provided that each copy
362
+ contains the above copyright notice and this license. These can be
363
+ included either as stand-alone text files, human-readable headers or
364
+ in the appropriate machine-readable metadata fields within text or
365
+ binary files as long as those fields can be easily viewed by the user.
366
+
367
+ 3) No Modified Version of the Font Software may use the Reserved Font
368
+ Name(s) unless explicit written permission is granted by the corresponding
369
+ Copyright Holder. This restriction only applies to the primary font name as
370
+ presented to the users.
371
+
372
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
373
+ Software shall not be used to promote, endorse or advertise any
374
+ Modified Version, except to acknowledge the contribution(s) of the
375
+ Copyright Holder(s) and the Author(s) or with their explicit written
376
+ permission.
377
+
378
+ 5) The Font Software, modified or unmodified, in part or in whole,
379
+ must be distributed entirely under this license, and must not be
380
+ distributed under any other license. The requirement for fonts to
381
+ remain under this license does not apply to any document created
382
+ using the Font Software.
383
+
384
+ TERMINATION
385
+ This license becomes null and void if any of the above conditions are
386
+ not met.
387
+
388
+ DISCLAIMER
389
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
390
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
391
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
392
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
393
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
394
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
395
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
396
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
397
+ OTHER DEALINGS IN THE FONT SOFTWARE.
398
+
399
+ ==========================================================================
400
+ APPENDIX C - ADOBE GLYPH LIST COPYRIGHT NOTICE AND LICENSE
401
+ ==========================================================================
402
+
403
+ Copyright 2002-2019 Adobe (http://www.adobe.com/).
404
+
405
+ Redistribution and use in source and binary forms, with or
406
+ without modification, are permitted provided that the
407
+ following conditions are met:
408
+
409
+ Redistributions of source code must retain the above
410
+ copyright notice, this list of conditions and the following
411
+ disclaimer.
412
+
413
+ Redistributions in binary form must reproduce the above
414
+ copyright notice, this list of conditions and the following
415
+ disclaimer in the documentation and/or other materials
416
+ provided with the distribution.
417
+
418
+ Neither the name of Adobe nor the names of its contributors
419
+ may be used to endorse or promote products derived from this
420
+ software without specific prior written permission.
421
+
422
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
423
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
424
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
425
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
426
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
427
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
428
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
429
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
430
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
431
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
432
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
433
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
434
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,54 @@
1
- # Temporary Holding Version
1
+ # @docmentis/udoc-wasm
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **The document engine behind docMentis.**
4
+
5
+ `@docmentis/udoc-wasm` is a WebAssembly runtime that provides core document processing and rendering capabilities for applications built with docMentis. It is designed for use in document viewers, editors, and automated document workflows.
6
+
7
+ The runtime is **proprietary software**, distributed under the [docMentis WASM Runtime License](https://cdn.jsdelivr.net/npm/@docmentis/udoc-wasm/LICENSE). It is not an open-source package.
8
+
9
+ ## Capabilities
10
+
11
+ The runtime supports a range of document formats, including:
12
+
13
+ - **PDF**
14
+ - **Office documents:** DOCX, PPTX, and XLSX
15
+ - **SVG and common image formats**
16
+ - **Delimited text:** CSV, TSV, and PSV
17
+
18
+ It provides the underlying document capabilities used by higher-level applications and SDKs. **This package is an engine, not a ready-made viewer or editor.**
19
+
20
+ ## Getting started
21
+
22
+ For most applications, use a docMentis SDK that provides the user interface or workflow you need. If you are integrating the runtime directly, install it with:
23
+
24
+ ```bash
25
+ npm install @docmentis/udoc-wasm
26
+ ```
27
+
28
+ Visit [docMentis](https://www.docmentis.com/) for product information and integration resources.
29
+
30
+ ## Free use
31
+
32
+ The runtime can be used **free of charge, including in commercial applications**, with a valid online permit issued by docMentis. An internet connection to the docMentis permit service is required for permit-based use.
33
+
34
+ Permit requests authorize runtime use; they are **not document uploads or document-conversion requests**. See the [docMentis website](https://www.docmentis.com/) for information about privacy and telemetry.
35
+
36
+ Free use is subject to the [Runtime License](https://cdn.jsdelivr.net/npm/@docmentis/udoc-wasm/LICENSE).
37
+
38
+ ## Commercial licensing
39
+
40
+ Commercial licenses are available for deployments that require additional rights, such as offline operation or the removal of supported attribution and telemetry requirements.
41
+
42
+ Commercial entitlements and their scope are defined by the applicable agreement. For licensing inquiries, contact [licensing@docmentis.com](mailto:licensing@docmentis.com).
43
+
44
+ ## Redistribution and third-party materials
45
+
46
+ The runtime may be included in applications and redistributed in unmodified form, subject to the [Runtime License](https://cdn.jsdelivr.net/npm/@docmentis/udoc-wasm/LICENSE).
47
+
48
+ The package contains third-party materials, including open-source dependencies, fonts, and a CC0-licensed ICC color profile. These materials remain subject to their respective licenses. Applicable notices and license information accompany the package and must be preserved as required when redistributing it.
49
+
50
+ ## License
51
+
52
+ Copyright © 2026 docMentis LLC. All rights reserved.
53
+
54
+ `@docmentis/udoc-wasm` is licensed under the [docMentis WASM Runtime License](https://cdn.jsdelivr.net/npm/@docmentis/udoc-wasm/LICENSE).
@@ -0,0 +1,16 @@
1
+ import type { CallError, ErrorKind, StartError } from "./wasm/udoc.js";
2
+ /**
3
+ * What a failure is, for code to branch on: core's kinds, the refusals the
4
+ * engine adds at its seam, and `crashed` — a trap that took the engine, and the
5
+ * session with it.
6
+ */
7
+ export type UDocErrorCode = ErrorKind | StartError["code"] | CallError["code"] | "crashed";
8
+ /** What a refusal carries beside its message: the specifics of its code. */
9
+ export type UDocErrorDetail = StartError["detail"] | CallError["detail"];
10
+ export declare class UDocError extends Error {
11
+ readonly code: UDocErrorCode;
12
+ readonly detail?: UDocErrorDetail;
13
+ constructor(code: UDocErrorCode, message: string, detail?: UDocErrorDetail, options?: ErrorOptions);
14
+ /** The one classifier: what the engine threw, a trap, or anything else. */
15
+ static from(thrown: unknown): UDocError;
16
+ }
package/dist/error.js ADDED
@@ -0,0 +1,36 @@
1
+ // The one error every udoc package reports. What the engine throws carries its
2
+ // `code` already; `UDocError.from` classifies everything else once — a trap is
3
+ // `crashed`, anything not the engine's own is `internal` — and a worker sends a
4
+ // failure across its thread boundary as `{ code, message, detail }`, which the
5
+ // other side rebuilds into a `UDocError`.
6
+ //
7
+ // Its own module, imported by relative path from the package root and exported
8
+ // on its own as `@docmentis/udoc-wasm/error`: a host's main thread needs the
9
+ // class without the glue, which only the worker running the engine loads.
10
+ export class UDocError extends Error {
11
+ code;
12
+ detail;
13
+ constructor(code, message, detail, options) {
14
+ super(message, options);
15
+ this.name = "UDocError";
16
+ this.code = code;
17
+ if (detail !== undefined)
18
+ this.detail = detail;
19
+ }
20
+ /** The one classifier: what the engine threw, a trap, or anything else. */
21
+ static from(thrown) {
22
+ if (thrown instanceof UDocError)
23
+ return thrown;
24
+ if (thrown instanceof WebAssembly.RuntimeError) {
25
+ return new UDocError("crashed", thrown.message, undefined, { cause: thrown });
26
+ }
27
+ if (isEngineError(thrown))
28
+ return new UDocError(thrown.code, thrown.message, thrown.detail, { cause: thrown });
29
+ const message = thrown instanceof Error ? thrown.message : String(thrown);
30
+ return new UDocError("internal", message, undefined, { cause: thrown });
31
+ }
32
+ }
33
+ /** What the engine throws: an `Error` named `UDocError`, its code on it. */
34
+ function isEngineError(thrown) {
35
+ return thrown instanceof Error && thrown.name === "UDocError" && typeof Reflect.get(thrown, "code") === "string";
36
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Filling the engine's font orders — the half of the font system that lives out
3
+ * here, because fetching does.
4
+ *
5
+ * The engine never speaks HTTP. It hands out orders ("this family, these
6
+ * characters") and installs whatever comes back; choosing *how* to get the bytes
7
+ * is entirely this file's business. That is what makes the fetches real: they
8
+ * run concurrently, off the engine, on the host's own network stack — where the
9
+ * previous design had a synchronous XHR blocking the worker one font at a time.
10
+ *
11
+ * For a Google order that means the css2 API: ask for the family at a weight and
12
+ * style, read the `unicode-range` off each `@font-face` block, and download only
13
+ * the blocks whose ranges hold the characters actually asked for. The engine
14
+ * needs to know none of it — which is why the subset list it holds is a
15
+ * prefilter and not a download plan.
16
+ *
17
+ * Every host fills its orders here; only *when* differs. udoc-ui's worker
18
+ * installs fonts as they land and re-shapes what is on screen; udoc-node's
19
+ * fills every order before it answers, since a page it exports is final. Its own
20
+ * module, imported by relative path from the package root and exported on its
21
+ * own as `@docmentis/udoc-wasm/font-fulfill`: a host's main thread reads
22
+ * {@link CSS2_ENDPOINT} without the glue, which only the worker running the
23
+ * engine loads.
24
+ */
25
+ import type { FontRequest } from "./wasm/udoc.js";
26
+ /** Where css2 lives, unless the host's `googleFontEndpoint` names a mirror. */
27
+ export declare const CSS2_ENDPOINT = "https://fonts.googleapis.com/css2";
28
+ /** One `@font-face` block from a css2 response: where its file is, and what it covers. */
29
+ interface FontFaceBlock {
30
+ url: string;
31
+ /** Inclusive codepoint ranges, from `unicode-range`. Empty means "unstated" → always download. */
32
+ ranges: Array<[number, number]>;
33
+ }
34
+ /**
35
+ * Parse the `@font-face` blocks out of a css2 response.
36
+ *
37
+ * Google's CSS is machine-generated and regular — one block per subset, each with
38
+ * a single `src: url(...)` and a `unicode-range` — so a scan beats pulling in a
39
+ * CSS parser. A block without a `unicode-range` keeps an empty range list, which
40
+ * {@link blockCovers} reads as "covers everything": unstated coverage must never
41
+ * exclude a block, or a character silently loses its font.
42
+ */
43
+ export declare function parseFontFaces(css: string): FontFaceBlock[];
44
+ /** The css2 URL for one order — the one place a boolean becomes a weight. */
45
+ export declare function css2Url(request: FontRequest, endpoint?: string): string;
46
+ /** How the fulfiller reaches the network. Injectable so tests stay offline. */
47
+ export type Fetcher = (url: string, init?: RequestInit) => Promise<Response>;
48
+ /**
49
+ * What a fulfiller carries between orders, and why it has to.
50
+ *
51
+ * The engine asks per **character**; Google serves per **file**. Those don't
52
+ * line up, and the gap costs a download every time: a block's `unicode-range` is
53
+ * what Google *declares*, not what its cmap holds. Roboto's `symbols` block
54
+ * claims `U+25A0-27BF` and carries 78 glyphs — no `★`, no `✦` — so a deck using
55
+ * both stars orders `★`, gets the symbols file, finds nothing, and then orders
56
+ * `✦`, whose range picks the very same file again. The engine can't prevent it:
57
+ * `unavailable` is per character on purpose (a vendor missing `✔` very likely has
58
+ * `é`), and nothing over there knows what a block or a file is.
59
+ *
60
+ * So the memory lives here, where URLs exist:
61
+ *
62
+ * - `blocks` — parsed css2 responses by URL, so one face is asked for once.
63
+ * - `delivered` — the woff2 URLs already handed to the engine, per entry. A file
64
+ * the engine already installed cannot answer a character it didn't cover, so
65
+ * re-fetching it is pure waste. Dropping it is also a *complete* answer: when
66
+ * every block covering an order is already installed, `[]` is the truth —
67
+ * this vendor has nothing more — and the engine retires those characters and
68
+ * walks on to the next vendor without a single request.
69
+ *
70
+ * Per entry rather than per URL because that is what "already installed" is
71
+ * scoped to. Entry ids are minted from a process-global counter and never
72
+ * reused, so a memory outliving its session can only ever miss.
73
+ */
74
+ export interface FontFetchMemory {
75
+ /** Parsed css2 responses, by request URL. */
76
+ blocks: Map<string, Promise<FontFaceBlock[]>>;
77
+ /** woff2 URLs already handed to the engine, by the entry they were fetched for. */
78
+ delivered: Map<number, Set<string>>;
79
+ }
80
+ /** A memory with nothing in it — one per worker that fills orders. */
81
+ export declare function createFontFetchMemory(): FontFetchMemory;
82
+ /**
83
+ * Fetch the binaries for one order.
84
+ *
85
+ * Returns `[]` for "nothing to install" — a family css2 doesn't have, a network
86
+ * failure, a response with no covering block. That is a **complete answer**, not
87
+ * an error: the engine records those characters as unavailable from this vendor
88
+ * and moves to the next one down its chain. Throwing instead would leave the
89
+ * order open forever.
90
+ */
91
+ export declare function fetchFontBinaries(request: FontRequest, fetcher?: Fetcher, memory?: FontFetchMemory, endpoint?: string): Promise<Uint8Array[]>;
92
+ export {};