@stll/docx-core 0.33.0 → 0.34.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/dist/docx_kernel_bg.wasm +0 -0
- package/dist/projection.d.ts +8 -2
- package/dist/projection.js +57 -1
- package/package.json +1 -1
package/dist/docx_kernel_bg.wasm
CHANGED
|
Binary file
|
package/dist/projection.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type DocxProjectionParagraph = readonly [ordinal: number, text: string, packageP
|
|
|
10
10
|
type DocxProjectionFormattingUnknownReason = "document-part-only" | "styles-part-unavailable" | "unsupported-styles";
|
|
11
11
|
type DocxProjectionFormattingStatus = readonly [status: "complete"] | readonly [status: "incomplete", reason: DocxProjectionFormattingUnknownReason];
|
|
12
12
|
type DocxProjectionFactSet<T> = readonly [status: "known", items: readonly T[]] | readonly [status: "unknown", reason: DocxProjectionUnknownReason];
|
|
13
|
-
type DocxProjectionUnknownReason = "document-part-only" | "styles-part-unavailable" | "unsupported-styles" | "unsupported-numbering" | "incomplete-bookmark-ranges" | "unsupported-internal-references";
|
|
13
|
+
type DocxProjectionUnknownReason = "paragraph-fragment" | "document-part-only" | "styles-part-unavailable" | "unsupported-styles" | "unsupported-numbering" | "incomplete-bookmark-ranges" | "unsupported-internal-references";
|
|
14
14
|
type DocxProjectionIndentationFact = readonly [paragraphOrdinal: number, firstLineTwips: number | null, hangingTwips: number | null, leftTwips: number | null, rightTwips: number | null, startTwips: number | null, endTwips: number | null, firstLineCharsHundredths: number | null, hangingCharsHundredths: number | null, leftCharsHundredths: number | null, rightCharsHundredths: number | null, startCharsHundredths: number | null, endCharsHundredths: number | null];
|
|
15
15
|
type DocxProjectionNumberingFact = readonly [paragraphOrdinal: number, parentParagraphOrdinal: number | null, childParagraphOrdinals: readonly number[]];
|
|
16
16
|
type DocxProjectionOutlineLevelFact = readonly [paragraphOrdinal: number, outlineLevel: number];
|
|
@@ -21,6 +21,8 @@ type DocxProjectionStructuralFacts = readonly [indentation: DocxProjectionFactSe
|
|
|
21
21
|
type DocxProjectionRevisionUnsupportedReason = "incompatible-paragraph-merge" | "structural-table-revision" | "unsupported-revision-markup";
|
|
22
22
|
type DocxProjectionRevisionStatus = readonly [status: "complete"] | readonly [status: "incomplete", reasons: readonly DocxProjectionRevisionUnsupportedReason[]];
|
|
23
23
|
type DocxProjectionWire = readonly [schemaVersion: 5, paragraphs: readonly DocxProjectionParagraph[], structuralFacts: DocxProjectionStructuralFacts, revisionStatus: DocxProjectionRevisionStatus, formattingStatus: DocxProjectionFormattingStatus];
|
|
24
|
+
type DocxParagraphFragmentFacts<T extends readonly unknown[]> = { readonly [Key in keyof T]: readonly [status: "unknown", reason: "paragraph-fragment"]; };
|
|
25
|
+
type DocxParagraphFragmentWire = readonly [schemaVersion: DocxProjectionWire[0], paragraphs: readonly [DocxProjectionParagraph], structuralFacts: DocxParagraphFragmentFacts<DocxProjectionStructuralFacts>, revisionStatus: DocxProjectionWire[3], formattingStatus: DocxProjectionWire[4]];
|
|
24
26
|
type DocxReviewUnknownReason = "invalid-document" | "invalid-comments" | "invalid-comments-extended" | "resource-limit" | "unsupported-location";
|
|
25
27
|
type DocxReviewFactSet<T> = readonly [status: "known", items: readonly T[]] | readonly [status: "unknown", reason: DocxReviewUnknownReason];
|
|
26
28
|
type DocxRevisionKind = "insertion" | "deletion" | "moveFrom" | "moveTo" | "cellIns" | "cellDel" | "cellMerge" | "pPrChange" | "rPrChange" | "sectPrChange" | "tblPrChange" | "tblPrExChange" | "trPrChange" | "tcPrChange" | "tblGridChange" | "customXmlDelRangeStart" | "customXmlDelRangeEnd" | "customXmlInsRangeStart" | "customXmlInsRangeEnd" | "customXmlMoveFromRangeStart" | "customXmlMoveFromRangeEnd" | "customXmlMoveToRangeStart" | "customXmlMoveToRangeEnd";
|
|
@@ -66,6 +68,10 @@ type ProjectCompressedDocxWithReviewFactsOptions = {
|
|
|
66
68
|
/** Loads and caches the single-threaded WebAssembly runtime. */
|
|
67
69
|
declare const initializeDocxProjection: ({ wasm }?: InitializeDocxProjectionOptions) => Promise<void>;
|
|
68
70
|
declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
|
|
71
|
+
/** Projects raw main-document XML or a Flat OPC package through Rust. */
|
|
72
|
+
declare const projectMainDocumentXml: (bytes: Uint8Array) => Promise<DocxProjectionWire>;
|
|
73
|
+
/** Projects one Flat OPC paragraph; document structural facts remain unknown. */
|
|
74
|
+
declare const projectParagraphFragment: (bytes: Uint8Array) => Promise<DocxParagraphFragmentWire>;
|
|
69
75
|
/**
|
|
70
76
|
* Projects the document snapshot and attributed review facts through one
|
|
71
77
|
* bounded package scan. Optional review-part failures remain explicit unknown
|
|
@@ -73,4 +79,4 @@ declare const projectCompressedDocx: (bytes: Uint8Array) => Promise<DocxProjecti
|
|
|
73
79
|
*/
|
|
74
80
|
declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array, { textMaterialization }?: ProjectCompressedDocxWithReviewFactsOptions) => Promise<DocxPackageProjectionWire>;
|
|
75
81
|
//#endregion
|
|
76
|
-
export { type DocxAttributedComment, type DocxAttributedRevision, type DocxPackageProjectionWire, type DocxProjectionAlignment, type DocxProjectionAlignmentSource, type DocxProjectionAlignmentValue, type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionFormattingStatus, type DocxProjectionFormattingUnknownReason, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionOutlineLevelFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, type DocxReviewFactSet, type DocxReviewFactsWire, type DocxReviewUnknownReason, type DocxRevisionKind, InitializeDocxProjectionOptions, ProjectCompressedDocxWithReviewFactsOptions, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
|
|
82
|
+
export { type DocxAttributedComment, type DocxAttributedRevision, type DocxPackageProjectionWire, type DocxParagraphFragmentWire, type DocxProjectionAlignment, type DocxProjectionAlignmentSource, type DocxProjectionAlignmentValue, type DocxProjectionBookmarkFact, DocxProjectionError, type DocxProjectionFactSet, type DocxProjectionFormattingSpan, type DocxProjectionFormattingStatus, type DocxProjectionFormattingUnknownReason, type DocxProjectionIndentationFact, DocxProjectionInitializationError, type DocxProjectionNumberingFact, type DocxProjectionOutlineLevelFact, type DocxProjectionParagraph, type DocxProjectionReferenceFact, type DocxProjectionRevisionStatus, type DocxProjectionRevisionUnsupportedReason, type DocxProjectionStructuralFacts, type DocxProjectionStructuralSpan, type DocxProjectionStructure, type DocxProjectionUnknownReason, DocxProjectionWasmSource, type DocxProjectionWire, type DocxReviewFactSet, type DocxReviewFactsWire, type DocxReviewUnknownReason, type DocxRevisionKind, InitializeDocxProjectionOptions, ProjectCompressedDocxWithReviewFactsOptions, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts, projectMainDocumentXml, projectParagraphFragment };
|
package/dist/projection.js
CHANGED
|
@@ -79,6 +79,50 @@ function projectCompressedDocxWithReviewFacts$1(bytes) {
|
|
|
79
79
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Projects bounded main-document XML or a relationship-selected Flat OPC package.
|
|
84
|
+
*
|
|
85
|
+
* # Errors
|
|
86
|
+
* Returns a JavaScript `Error` for malformed input or a resource-limit violation.
|
|
87
|
+
* @param {Uint8Array} bytes
|
|
88
|
+
* @returns {DocxProjectionWire}
|
|
89
|
+
*/
|
|
90
|
+
function projectMainDocumentXml$1(bytes) {
|
|
91
|
+
try {
|
|
92
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
93
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
94
|
+
const len0 = WASM_VECTOR_LEN;
|
|
95
|
+
wasm.projectMainDocumentXml(retptr, ptr0, len0);
|
|
96
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
97
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
98
|
+
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
99
|
+
return takeObject(r0);
|
|
100
|
+
} finally {
|
|
101
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Projects one bounded paragraph fragment with unknown document structural facts.
|
|
106
|
+
*
|
|
107
|
+
* # Errors
|
|
108
|
+
* Returns a JavaScript `Error` for malformed input or a resource-limit violation.
|
|
109
|
+
* @param {Uint8Array} bytes
|
|
110
|
+
* @returns {DocxParagraphFragmentWire}
|
|
111
|
+
*/
|
|
112
|
+
function projectParagraphFragment$1(bytes) {
|
|
113
|
+
try {
|
|
114
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
115
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
116
|
+
const len0 = WASM_VECTOR_LEN;
|
|
117
|
+
wasm.projectParagraphFragment(retptr, ptr0, len0);
|
|
118
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
119
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
120
|
+
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
121
|
+
return takeObject(r0);
|
|
122
|
+
} finally {
|
|
123
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
82
126
|
function __wbg_get_imports() {
|
|
83
127
|
return {
|
|
84
128
|
__proto__: null,
|
|
@@ -259,6 +303,18 @@ const projectCompressedDocx = (bytes) => projectWith({
|
|
|
259
303
|
project: projectCompressedDocx$1,
|
|
260
304
|
message: DOCUMENT_PROJECTION_FAILURE_MESSAGE
|
|
261
305
|
});
|
|
306
|
+
/** Projects raw main-document XML or a Flat OPC package through Rust. */
|
|
307
|
+
const projectMainDocumentXml = (bytes) => projectWith({
|
|
308
|
+
bytes,
|
|
309
|
+
project: projectMainDocumentXml$1,
|
|
310
|
+
message: DOCUMENT_PROJECTION_FAILURE_MESSAGE
|
|
311
|
+
});
|
|
312
|
+
/** Projects one Flat OPC paragraph; document structural facts remain unknown. */
|
|
313
|
+
const projectParagraphFragment = (bytes) => projectWith({
|
|
314
|
+
bytes,
|
|
315
|
+
project: projectParagraphFragment$1,
|
|
316
|
+
message: DOCUMENT_PROJECTION_FAILURE_MESSAGE
|
|
317
|
+
});
|
|
262
318
|
/**
|
|
263
319
|
* Projects the document snapshot and attributed review facts through one
|
|
264
320
|
* bounded package scan. Optional review-part failures remain explicit unknown
|
|
@@ -270,4 +326,4 @@ const projectCompressedDocxWithReviewFacts = (bytes, { textMaterialization = "wo
|
|
|
270
326
|
message: PACKAGE_PROJECTION_FAILURE_MESSAGE
|
|
271
327
|
});
|
|
272
328
|
//#endregion
|
|
273
|
-
export { DocxProjectionError, DocxProjectionInitializationError, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts };
|
|
329
|
+
export { DocxProjectionError, DocxProjectionInitializationError, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts, projectMainDocumentXml, projectParagraphFragment };
|
package/package.json
CHANGED