@stll/docx-core 0.30.1 → 0.32.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 +4 -0
- package/dist/{document-DdWrTPQY.js → document-3WKQA1r3.js} +20 -1
- package/dist/{document-DrtmJ_hz.d.ts → document-C73n0FqK.d.ts} +92 -15
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/{xmlEscape-T-2DeGlS.js → href-2XSCK-T8.js} +49 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +404 -72
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +2 -2
- package/dist/ops/documentOps.d.ts +739 -26
- package/dist/ops/documentOps.js +10164 -2331
- package/dist/projection.d.ts +2 -2
- package/dist/schema/sequenceChildren.d.ts +2 -1
- package/dist/schema/sequenceChildren.js +2 -2
- package/dist/{sequenceChildren-BIixCB49.js → sequenceChildren-B8ODeI3J.js} +99 -1
- package/dist/zip/writeZipPart.d.ts +12 -0
- package/dist/zip/writeZipPart.js +12 -0
- package/package.json +6 -1
package/dist/projection.d.ts
CHANGED
|
@@ -23,12 +23,12 @@ type DocxProjectionRevisionStatus = readonly [status: "complete"] | readonly [st
|
|
|
23
23
|
type DocxProjectionWire = readonly [schemaVersion: 5, paragraphs: readonly DocxProjectionParagraph[], structuralFacts: DocxProjectionStructuralFacts, revisionStatus: DocxProjectionRevisionStatus, formattingStatus: DocxProjectionFormattingStatus];
|
|
24
24
|
type DocxReviewUnknownReason = "invalid-document" | "invalid-comments" | "invalid-comments-extended" | "resource-limit" | "unsupported-location";
|
|
25
25
|
type DocxReviewFactSet<T> = readonly [status: "known", items: readonly T[]] | readonly [status: "unknown", reason: DocxReviewUnknownReason];
|
|
26
|
-
type DocxRevisionKind = "insertion" | "deletion" | "moveFrom" | "moveTo" | "cellIns" | "cellDel" | "cellMerge" | "pPrChange" | "rPrChange" | "sectPrChange" | "tblPrChange" | "trPrChange" | "tcPrChange" | "tblGridChange" | "customXmlDelRangeStart" | "customXmlDelRangeEnd" | "customXmlInsRangeStart" | "customXmlInsRangeEnd" | "customXmlMoveFromRangeStart" | "customXmlMoveFromRangeEnd" | "customXmlMoveToRangeStart" | "customXmlMoveToRangeEnd";
|
|
26
|
+
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";
|
|
27
27
|
/**
|
|
28
28
|
* Attributed revision wire tuple. Known content is flattened into the item so
|
|
29
29
|
* one review fact creates one JavaScript array at the WASM boundary.
|
|
30
30
|
*/
|
|
31
|
-
type DocxAttributedRevision = readonly [type: DocxRevisionKind, author: string, date: string | null, revisionId: string | null, contentStatus: "known", startParagraphOrdinal: number, startUtf8: number, startUtf16: number, endParagraphOrdinal: number, endUtf8: number, endUtf16: number, text: string, contentKind: "text" | "formatting-only"] | readonly [type: DocxRevisionKind, author: string, date: string | null, revisionId: string | null, contentStatus: "unknown", reason: DocxReviewUnknownReason];
|
|
31
|
+
type DocxAttributedRevision = readonly [type: DocxRevisionKind, author: string, date: string | null, revisionId: string | null, contentStatus: "known", startParagraphOrdinal: number, startUtf8: number, startUtf16: number, endParagraphOrdinal: number, endUtf8: number, endUtf16: number, text: string, contentKind: "text" | "formatting-only" | "paragraph-mark"] | readonly [type: DocxRevisionKind, author: string, date: string | null, revisionId: string | null, contentStatus: "unknown", reason: DocxReviewUnknownReason];
|
|
32
32
|
/**
|
|
33
33
|
* Attributed comment wire tuple. Known content is flattened into the item so
|
|
34
34
|
* one review fact creates one JavaScript array at the WASM boundary.
|
|
@@ -32,6 +32,7 @@ declare const SEQUENCE_CHILDREN: {
|
|
|
32
32
|
readonly "content-control-properties": readonly ["rPr", "alias", "tag", "id", "lock", "placeholder", "temporary", "showingPlcHdr", "dataBinding", "label", "tabIndex", "equation", "comboBox", "date", "docPartObj", "docPartList", "dropDownList", "picture", "richText", "text", "citation", "group", "bibliography"];
|
|
33
33
|
readonly "section-properties": readonly ["headerReference", "footerReference", "footnotePr", "endnotePr", "type", "pgSz", "pgMar", "paperSrc", "pgBorders", "lnNumType", "pgNumType", "cols", "formProt", "vAlign", "noEndnote", "titlePg", "textDirection", "bidi", "rtlGutter", "docGrid", "printerSettings", "sectPrChange"];
|
|
34
34
|
};
|
|
35
|
+
declare const SETTINGS_CHILDREN: readonly ["writeProtection", "view", "zoom", "removePersonalInformation", "removeDateAndTime", "doNotDisplayPageBoundaries", "displayBackgroundShape", "printPostScriptOverText", "printFractionalCharacterWidth", "printFormsData", "embedTrueTypeFonts", "embedSystemFonts", "saveSubsetFonts", "saveFormsData", "mirrorMargins", "alignBordersAndEdges", "bordersDoNotSurroundHeader", "bordersDoNotSurroundFooter", "gutterAtTop", "hideSpellingErrors", "hideGrammaticalErrors", "activeWritingStyle", "proofState", "formsDesign", "attachedTemplate", "linkStyles", "stylePaneFormatFilter", "stylePaneSortMethod", "documentType", "mailMerge", "revisionView", "trackRevisions", "doNotTrackMoves", "doNotTrackFormatting", "documentProtection", "autoFormatOverride", "styleLockTheme", "styleLockQFSet", "defaultTabStop", "autoHyphenation", "consecutiveHyphenLimit", "hyphenationZone", "doNotHyphenateCaps", "showEnvelope", "summaryLength", "clickAndTypeStyle", "defaultTableStyle", "evenAndOddHeaders", "bookFoldRevPrinting", "bookFoldPrinting", "bookFoldPrintingSheets", "drawingGridHorizontalSpacing", "drawingGridVerticalSpacing", "displayHorizontalDrawingGridEvery", "displayVerticalDrawingGridEvery", "doNotUseMarginsForDrawingGridOrigin", "drawingGridHorizontalOrigin", "drawingGridVerticalOrigin", "doNotShadeFormData", "noPunctuationKerning", "characterSpacingControl", "printTwoOnOne", "strictFirstAndLastChars", "noLineBreaksAfter", "noLineBreaksBefore", "savePreviewPicture", "doNotValidateAgainstSchema", "saveInvalidXml", "ignoreMixedContent", "alwaysShowPlaceholderText", "doNotDemarcateInvalidXml", "saveXmlDataOnly", "useXSLTWhenSaving", "saveThroughXslt", "showXMLTags", "alwaysMergeEmptyNamespace", "updateFields", "hdrShapeDefaults", "footnotePr", "endnotePr", "compat", "docVars", "rsids", "attachedSchema", "themeFontLang", "clrSchemeMapping", "doNotIncludeSubdocsInStats", "doNotAutoCompressPictures", "forceUpgrade", "captions", "readModeInkLockDown", "smartTagType", "shapeDefaults", "doNotEmbedSmartTags", "decimalSymbol", "listSeparator"];
|
|
35
36
|
/** A container whose declared children have an order. */
|
|
36
37
|
type SequenceContainer = keyof typeof SEQUENCE_CHILDREN;
|
|
37
38
|
/** Every child the schema declares for `Container`, in declaration order. */
|
|
@@ -70,4 +71,4 @@ declare const assertSafePreservedMarkup: (preserved: PreservedMarkup | undefined
|
|
|
70
71
|
*/
|
|
71
72
|
declare const serializeSequenceChildren: <Container extends SequenceContainer>({ container, modelled, preserved }: SerializeSequenceChildrenOptions<Container>) => string[];
|
|
72
73
|
//#endregion
|
|
73
|
-
export { SEQUENCE_CHILDREN, type SequenceChild, type SequenceContainer, assertSafePreservedMarkup, isSafePreservedChildXml, isWithinPreservedMarkupBudget, serializeSequenceChildren };
|
|
74
|
+
export { SEQUENCE_CHILDREN, SETTINGS_CHILDREN, type SequenceChild, type SequenceContainer, assertSafePreservedMarkup, isSafePreservedChildXml, isWithinPreservedMarkupBudget, serializeSequenceChildren };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SEQUENCE_CHILDREN, i as serializeSequenceChildren, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, t as assertSafePreservedMarkup } from "../sequenceChildren-
|
|
2
|
-
export { SEQUENCE_CHILDREN, assertSafePreservedMarkup, isSafePreservedChildXml, isWithinPreservedMarkupBudget, serializeSequenceChildren };
|
|
1
|
+
import { a as SEQUENCE_CHILDREN, i as serializeSequenceChildren, n as isSafePreservedChildXml, o as SETTINGS_CHILDREN, r as isWithinPreservedMarkupBudget, t as assertSafePreservedMarkup } from "../sequenceChildren-B8ODeI3J.js";
|
|
2
|
+
export { SEQUENCE_CHILDREN, SETTINGS_CHILDREN, assertSafePreservedMarkup, isSafePreservedChildXml, isWithinPreservedMarkupBudget, serializeSequenceChildren };
|
|
@@ -254,6 +254,104 @@ const SEQUENCE_CHILDREN = {
|
|
|
254
254
|
"sectPrChange"
|
|
255
255
|
]
|
|
256
256
|
};
|
|
257
|
+
const SETTINGS_CHILDREN = [
|
|
258
|
+
"writeProtection",
|
|
259
|
+
"view",
|
|
260
|
+
"zoom",
|
|
261
|
+
"removePersonalInformation",
|
|
262
|
+
"removeDateAndTime",
|
|
263
|
+
"doNotDisplayPageBoundaries",
|
|
264
|
+
"displayBackgroundShape",
|
|
265
|
+
"printPostScriptOverText",
|
|
266
|
+
"printFractionalCharacterWidth",
|
|
267
|
+
"printFormsData",
|
|
268
|
+
"embedTrueTypeFonts",
|
|
269
|
+
"embedSystemFonts",
|
|
270
|
+
"saveSubsetFonts",
|
|
271
|
+
"saveFormsData",
|
|
272
|
+
"mirrorMargins",
|
|
273
|
+
"alignBordersAndEdges",
|
|
274
|
+
"bordersDoNotSurroundHeader",
|
|
275
|
+
"bordersDoNotSurroundFooter",
|
|
276
|
+
"gutterAtTop",
|
|
277
|
+
"hideSpellingErrors",
|
|
278
|
+
"hideGrammaticalErrors",
|
|
279
|
+
"activeWritingStyle",
|
|
280
|
+
"proofState",
|
|
281
|
+
"formsDesign",
|
|
282
|
+
"attachedTemplate",
|
|
283
|
+
"linkStyles",
|
|
284
|
+
"stylePaneFormatFilter",
|
|
285
|
+
"stylePaneSortMethod",
|
|
286
|
+
"documentType",
|
|
287
|
+
"mailMerge",
|
|
288
|
+
"revisionView",
|
|
289
|
+
"trackRevisions",
|
|
290
|
+
"doNotTrackMoves",
|
|
291
|
+
"doNotTrackFormatting",
|
|
292
|
+
"documentProtection",
|
|
293
|
+
"autoFormatOverride",
|
|
294
|
+
"styleLockTheme",
|
|
295
|
+
"styleLockQFSet",
|
|
296
|
+
"defaultTabStop",
|
|
297
|
+
"autoHyphenation",
|
|
298
|
+
"consecutiveHyphenLimit",
|
|
299
|
+
"hyphenationZone",
|
|
300
|
+
"doNotHyphenateCaps",
|
|
301
|
+
"showEnvelope",
|
|
302
|
+
"summaryLength",
|
|
303
|
+
"clickAndTypeStyle",
|
|
304
|
+
"defaultTableStyle",
|
|
305
|
+
"evenAndOddHeaders",
|
|
306
|
+
"bookFoldRevPrinting",
|
|
307
|
+
"bookFoldPrinting",
|
|
308
|
+
"bookFoldPrintingSheets",
|
|
309
|
+
"drawingGridHorizontalSpacing",
|
|
310
|
+
"drawingGridVerticalSpacing",
|
|
311
|
+
"displayHorizontalDrawingGridEvery",
|
|
312
|
+
"displayVerticalDrawingGridEvery",
|
|
313
|
+
"doNotUseMarginsForDrawingGridOrigin",
|
|
314
|
+
"drawingGridHorizontalOrigin",
|
|
315
|
+
"drawingGridVerticalOrigin",
|
|
316
|
+
"doNotShadeFormData",
|
|
317
|
+
"noPunctuationKerning",
|
|
318
|
+
"characterSpacingControl",
|
|
319
|
+
"printTwoOnOne",
|
|
320
|
+
"strictFirstAndLastChars",
|
|
321
|
+
"noLineBreaksAfter",
|
|
322
|
+
"noLineBreaksBefore",
|
|
323
|
+
"savePreviewPicture",
|
|
324
|
+
"doNotValidateAgainstSchema",
|
|
325
|
+
"saveInvalidXml",
|
|
326
|
+
"ignoreMixedContent",
|
|
327
|
+
"alwaysShowPlaceholderText",
|
|
328
|
+
"doNotDemarcateInvalidXml",
|
|
329
|
+
"saveXmlDataOnly",
|
|
330
|
+
"useXSLTWhenSaving",
|
|
331
|
+
"saveThroughXslt",
|
|
332
|
+
"showXMLTags",
|
|
333
|
+
"alwaysMergeEmptyNamespace",
|
|
334
|
+
"updateFields",
|
|
335
|
+
"hdrShapeDefaults",
|
|
336
|
+
"footnotePr",
|
|
337
|
+
"endnotePr",
|
|
338
|
+
"compat",
|
|
339
|
+
"docVars",
|
|
340
|
+
"rsids",
|
|
341
|
+
"attachedSchema",
|
|
342
|
+
"themeFontLang",
|
|
343
|
+
"clrSchemeMapping",
|
|
344
|
+
"doNotIncludeSubdocsInStats",
|
|
345
|
+
"doNotAutoCompressPictures",
|
|
346
|
+
"forceUpgrade",
|
|
347
|
+
"captions",
|
|
348
|
+
"readModeInkLockDown",
|
|
349
|
+
"smartTagType",
|
|
350
|
+
"shapeDefaults",
|
|
351
|
+
"doNotEmbedSmartTags",
|
|
352
|
+
"decimalSymbol",
|
|
353
|
+
"listSeparator"
|
|
354
|
+
];
|
|
257
355
|
//#endregion
|
|
258
356
|
//#region src/schema/sequenceChildren.ts
|
|
259
357
|
const MAX_PRESERVED_CHILD_XML_CHARACTERS = 1024 * 1024;
|
|
@@ -460,4 +558,4 @@ const serializeSequenceChildren = ({ container, modelled, preserved }) => {
|
|
|
460
558
|
return placed.sort((left, right) => left.at - right.at || left.rank - right.rank).map(({ xml }) => xml);
|
|
461
559
|
};
|
|
462
560
|
//#endregion
|
|
463
|
-
export { SEQUENCE_CHILDREN as a, serializeSequenceChildren as i, isSafePreservedChildXml as n, isWithinPreservedMarkupBudget as r, assertSafePreservedMarkup as t };
|
|
561
|
+
export { SEQUENCE_CHILDREN as a, serializeSequenceChildren as i, isSafePreservedChildXml as n, SETTINGS_CHILDREN as o, isWithinPreservedMarkupBudget as r, assertSafePreservedMarkup as t };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import JSZip from "jszip";
|
|
2
|
+
//#region src/zip/writeZipPart.d.ts
|
|
3
|
+
type WriteZipPartOptions = {
|
|
4
|
+
zip: JSZip;
|
|
5
|
+
path: string;
|
|
6
|
+
data: Parameters<JSZip["loadAsync"]>[0];
|
|
7
|
+
options?: Omit<JSZip.JSZipFileOptions, "createFolders">;
|
|
8
|
+
};
|
|
9
|
+
/** Write exactly one entry, without synthesizing parent directory entries. */
|
|
10
|
+
declare const writeZipPart: ({ zip, path, data, options }: WriteZipPartOptions) => void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { writeZipPart };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/zip/writeZipPart.ts
|
|
2
|
+
const FIXED_ZIP_DATE_MS = Date.UTC(2e3, 0, 1);
|
|
3
|
+
/** Write exactly one entry, without synthesizing parent directory entries. */
|
|
4
|
+
const writeZipPart = ({ zip, path, data, options }) => {
|
|
5
|
+
zip.file(path, data, {
|
|
6
|
+
...options,
|
|
7
|
+
date: options?.date ?? new Date(FIXED_ZIP_DATE_MS),
|
|
8
|
+
createFolders: false
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { writeZipPart };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/docx-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.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",
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"./schema": {
|
|
52
52
|
"types": "./dist/schema/sequenceChildren.d.ts",
|
|
53
53
|
"import": "./dist/schema/sequenceChildren.js"
|
|
54
|
+
},
|
|
55
|
+
"./zip": {
|
|
56
|
+
"types": "./dist/zip/writeZipPart.d.ts",
|
|
57
|
+
"import": "./dist/zip/writeZipPart.js"
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
60
|
"publishConfig": {
|
|
@@ -68,6 +72,7 @@
|
|
|
68
72
|
"prepack": "bun run build"
|
|
69
73
|
},
|
|
70
74
|
"dependencies": {
|
|
75
|
+
"@nodable/entities": "^3.0.0",
|
|
71
76
|
"@stll/docx-utils": "^0.1.0",
|
|
72
77
|
"better-result": "3.0.1",
|
|
73
78
|
"fast-xml-parser": "^5.10.1",
|