@stll/docx-core 0.8.0 → 0.9.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.
Binary file
@@ -51,6 +51,11 @@ type InitializeDocxProjectionOptions = {
51
51
  */
52
52
  wasm?: DocxProjectionWasmSource;
53
53
  };
54
+ /** Controls text materialization for fused document and review-fact projection. */
55
+ type ProjectCompressedDocxWithReviewFactsOptions = {
56
+ /** Selects host-coordinate controls or normalized readable text. */
57
+ textMaterialization?: "word-host" | "readable-plain-text";
58
+ };
54
59
  /** Loads and caches the single-threaded WebAssembly runtime. */
55
60
  declare const initializeDocxProjection: ({ wasm }?: InitializeDocxProjectionOptions) => Promise<void>;
56
61
  declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
@@ -59,6 +64,6 @@ declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjecti
59
64
  * bounded package scan. Optional review-part failures remain explicit unknown
60
65
  * fact families rather than invalidating the document snapshot.
61
66
  */
62
- declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array) => Promise<DocxPackageProjectionWire>;
67
+ declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array, { textMaterialization }?: ProjectCompressedDocxWithReviewFactsOptions) => Promise<DocxPackageProjectionWire>;
63
68
  //#endregion
64
- export { type DocxAttributedComment, type DocxAttributedRevision, type DocxCommentContent, type DocxPackageProjectionWire, type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, type DocxReviewDetail, type DocxReviewFactSet, type DocxReviewFactsWire, type DocxReviewPoint, type DocxReviewSpan, type DocxReviewUnknownReason, type DocxRevisionContent, InitializeDocxProjectionOptions, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
69
+ export { type DocxAttributedComment, type DocxAttributedRevision, type DocxCommentContent, type DocxPackageProjectionWire, type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, type DocxReviewDetail, type DocxReviewFactSet, type DocxReviewFactsWire, type DocxReviewPoint, type DocxReviewSpan, type DocxReviewUnknownReason, type DocxRevisionContent, InitializeDocxProjectionOptions, ProjectCompressedDocxWithReviewFactsOptions, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
@@ -31,6 +31,30 @@ function projectCompressedDocx$1(bytes) {
31
31
  }
32
32
  }
33
33
  /**
34
+ * Projects the same fused snapshot with controls normalized for readable text.
35
+ *
36
+ * # Errors
37
+ *
38
+ * Returns a JavaScript `Error` under the same conditions as
39
+ * [`project_compressed_docx_with_review_facts`].
40
+ * @param {Uint8Array} bytes
41
+ * @returns {DocxPackageProjectionWire}
42
+ */
43
+ function projectCompressedDocxWithReadableReviewFacts(bytes) {
44
+ try {
45
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
46
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
47
+ const len0 = WASM_VECTOR_LEN;
48
+ wasm.projectCompressedDocxWithReadableReviewFacts(retptr, ptr0, len0);
49
+ var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
50
+ var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
51
+ if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
52
+ return takeObject(r0);
53
+ } finally {
54
+ wasm.__wbindgen_add_to_stack_pointer(16);
55
+ }
56
+ }
57
+ /**
34
58
  * Projects the document snapshot and attributed review facts from one bounded
35
59
  * package-directory scan.
36
60
  *
@@ -240,9 +264,9 @@ const projectCompressedDocx = (bytes) => projectWith({
240
264
  * bounded package scan. Optional review-part failures remain explicit unknown
241
265
  * fact families rather than invalidating the document snapshot.
242
266
  */
243
- const projectCompressedDocxWithReviewFacts = (bytes) => projectWith({
267
+ const projectCompressedDocxWithReviewFacts = (bytes, { textMaterialization = "word-host" } = {}) => projectWith({
244
268
  bytes,
245
- project: projectCompressedDocxWithReviewFacts$1,
269
+ project: textMaterialization === "word-host" ? projectCompressedDocxWithReviewFacts$1 : projectCompressedDocxWithReadableReviewFacts,
246
270
  message: PACKAGE_PROJECTION_FAILURE_MESSAGE
247
271
  });
248
272
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/docx-core",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Typed OOXML/DOCX model, validation, serialization, legal-source compilation, and browser-native package projection.",
5
5
  "keywords": [
6
6
  "document-model",