doc-codec 2.4.3 → 2.5.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 +47 -16
- package/dist/chp-B6AOh85P.d.ts +18 -0
- package/dist/chp-BpCqpb7V.d.cts +18 -0
- package/dist/detect.cjs +3 -0
- package/dist/detect.d.cts +3 -1
- package/dist/detect.d.ts +3 -1
- package/dist/detect.js +3 -1
- package/dist/fib/fib.cjs +14 -0
- package/dist/fib/fib.d.cts +1 -1
- package/dist/fib/fib.d.ts +1 -1
- package/dist/fib/fib.js +14 -0
- package/dist/fib/offsets.cjs +14 -0
- package/dist/fib/offsets.d.cts +14 -0
- package/dist/fib/offsets.d.ts +14 -0
- package/dist/fib/offsets.js +14 -0
- package/dist/{fib-DWFta19r.d.cts → fib-6BFIx153.d.cts} +14 -0
- package/dist/{fib-DWFta19r.d.ts → fib-6BFIx153.d.ts} +14 -0
- package/dist/fkp-I-laf-8y.d.cts +33 -0
- package/dist/fkp-I-laf-8y.d.ts +33 -0
- package/dist/headers-footers.cjs +34 -0
- package/dist/headers-footers.d.cts +16 -0
- package/dist/headers-footers.d.ts +16 -0
- package/dist/headers-footers.js +33 -0
- package/dist/index.cjs +20 -9
- package/dist/index.d.cts +16 -12
- package/dist/index.d.ts +16 -12
- package/dist/index.js +15 -11
- package/dist/list/numbering-write.d.cts +1 -1
- package/dist/list/numbering-write.d.ts +1 -1
- package/dist/list/numbering.d.cts +23 -1
- package/dist/list/numbering.d.ts +23 -1
- package/dist/notes.cjs +26 -0
- package/dist/notes.d.cts +20 -0
- package/dist/notes.d.ts +20 -0
- package/dist/notes.js +25 -0
- package/dist/{pap-BT1p0uzu.d.cts → pap-BQ2E17K9.d.cts} +5 -3
- package/dist/{pap-DOFLMWcG.d.ts → pap-iWFIpCdo.d.ts} +5 -3
- package/dist/paragraphs-DQUp8_HB.d.cts +31 -0
- package/dist/paragraphs-s2lJ6w2I.d.ts +31 -0
- package/dist/pictures.cjs +93 -0
- package/dist/pictures.d.cts +6 -0
- package/dist/pictures.d.ts +6 -0
- package/dist/pictures.js +92 -0
- package/dist/piece-table-CA18mhjv.d.cts +28 -0
- package/dist/piece-table-CA18mhjv.d.ts +28 -0
- package/dist/prop/chp.d.cts +1 -17
- package/dist/prop/chp.d.ts +1 -17
- package/dist/prop/fkp.d.cts +1 -32
- package/dist/prop/fkp.d.ts +1 -32
- package/dist/prop/pap.cjs +4 -2
- package/dist/prop/pap.d.cts +1 -1
- package/dist/prop/pap.d.ts +1 -1
- package/dist/prop/pap.js +4 -2
- package/dist/prop/sep.cjs +20 -10
- package/dist/prop/sep.d.cts +8 -4
- package/dist/prop/sep.d.ts +8 -4
- package/dist/prop/sep.js +20 -10
- package/dist/read.cjs +47 -151
- package/dist/read.d.cts +13 -15
- package/dist/read.d.ts +13 -15
- package/dist/read.js +49 -153
- package/dist/stsh-Bj0YSEOp.d.ts +40 -0
- package/dist/stsh-CK59x6XG.d.cts +40 -0
- package/dist/style/stsh.d.cts +1 -39
- package/dist/style/stsh.d.ts +1 -39
- package/dist/subdocument.cjs +20 -0
- package/dist/subdocument.d.cts +8 -0
- package/dist/subdocument.d.ts +8 -0
- package/dist/subdocument.js +18 -0
- package/dist/table/read.cjs +31 -17
- package/dist/table/read.d.cts +1 -1
- package/dist/table/read.d.ts +1 -1
- package/dist/table/read.js +32 -18
- package/dist/text/characters.d.cts +1 -1
- package/dist/text/characters.d.ts +1 -1
- package/dist/text/paragraphs.cjs +189 -0
- package/dist/text/paragraphs.d.cts +2 -0
- package/dist/text/paragraphs.d.ts +2 -0
- package/dist/text/paragraphs.js +187 -0
- package/dist/text/piece-table.d.cts +1 -27
- package/dist/text/piece-table.d.ts +1 -27
- package/dist/write.cjs +3 -3
- package/dist/write.js +3 -3
- package/package.json +1 -1
- package/dist/numbering-DSpm9w6y.d.cts +0 -24
- package/dist/numbering-DayjnHXY.d.ts +0 -24
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_subdocument = require("./subdocument.cjs");
|
|
3
|
+
const require_table_read = require("./table/read.cjs");
|
|
4
|
+
//#region src/headers-footers.ts
|
|
5
|
+
/** The six per-section slots' own order within each of Plcfhdd's per-section groups, [MS-DOC]'s own Headers page: "The stories within each group MUST appear in the following order." */
|
|
6
|
+
const SLOT_ORDER = [
|
|
7
|
+
"evenHeader",
|
|
8
|
+
"oddHeader",
|
|
9
|
+
"evenFooter",
|
|
10
|
+
"oddFooter",
|
|
11
|
+
"firstHeader",
|
|
12
|
+
"firstFooter"
|
|
13
|
+
];
|
|
14
|
+
/** The six fixed footnote/endnote-separator stories preceding every section's own six -- footnote separator, footnote continuation separator, footnote continuation notice, endnote separator, endnote continuation separator, endnote continuation notice -- carried by Plcfhdd but not read here, since neither this package's own schema nor ooxml.js's DocxDocument has anywhere to put a separator story. */
|
|
15
|
+
const FIXED_SEPARATOR_STORY_COUNT = 6;
|
|
16
|
+
function readHeaderFooterStories(wordDocument, table, pieceTable, context, fib, sectionCount) {
|
|
17
|
+
const headerStartCp = fib.ccpText + fib.ccpFtn;
|
|
18
|
+
const perSectionStories = require_subdocument.readSubdocumentStories(wordDocument, table, pieceTable, context, headerStartCp, fib.ccpHdd, fib.fcPlcfHdd, fib.lcbPlcfHdd, "Plcfhdd").slice(FIXED_SEPARATOR_STORY_COUNT);
|
|
19
|
+
const stories = [];
|
|
20
|
+
for (let section = 0; section < sectionCount; section += 1) for (let slotIndex = 0; slotIndex < SLOT_ORDER.length; slotIndex += 1) {
|
|
21
|
+
const entries = perSectionStories[section * SLOT_ORDER.length + slotIndex];
|
|
22
|
+
if (entries === void 0 || entries.length === 0) continue;
|
|
23
|
+
const slot = SLOT_ORDER[slotIndex];
|
|
24
|
+
if (slot === void 0) continue;
|
|
25
|
+
stories.push({
|
|
26
|
+
section,
|
|
27
|
+
slot,
|
|
28
|
+
blocks: require_table_read.assembleBlocks(entries)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return stories;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.readHeaderFooterStories = readHeaderFooterStories;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as Fib } from "./fib-6BFIx153.cjs";
|
|
2
|
+
import { n as ReadContext } from "./paragraphs-DQUp8_HB.cjs";
|
|
3
|
+
import { n as PieceTable } from "./piece-table-CA18mhjv.cjs";
|
|
4
|
+
import { ContentBlock } from "document-schema.js";
|
|
5
|
+
//#region src/headers-footers.d.ts
|
|
6
|
+
type HeaderFooterSlot = "evenHeader" | "oddHeader" | "evenFooter" | "oddFooter" | "firstHeader" | "firstFooter";
|
|
7
|
+
interface HeaderFooterStory {
|
|
8
|
+
/** The 0-based index into DocContent.sections this story belongs to. */
|
|
9
|
+
readonly section: number;
|
|
10
|
+
readonly slot: HeaderFooterSlot;
|
|
11
|
+
readonly blocks: readonly ContentBlock[];
|
|
12
|
+
}
|
|
13
|
+
type HeaderFooterStories = readonly HeaderFooterStory[];
|
|
14
|
+
declare function readHeaderFooterStories(wordDocument: Uint8Array, table: Uint8Array, pieceTable: PieceTable, context: ReadContext, fib: Fib, sectionCount: number): HeaderFooterStories;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { HeaderFooterSlot, HeaderFooterStories, HeaderFooterStory, readHeaderFooterStories };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as Fib } from "./fib-6BFIx153.js";
|
|
2
|
+
import { n as ReadContext } from "./paragraphs-s2lJ6w2I.js";
|
|
3
|
+
import { n as PieceTable } from "./piece-table-CA18mhjv.js";
|
|
4
|
+
import { ContentBlock } from "document-schema.js";
|
|
5
|
+
//#region src/headers-footers.d.ts
|
|
6
|
+
type HeaderFooterSlot = "evenHeader" | "oddHeader" | "evenFooter" | "oddFooter" | "firstHeader" | "firstFooter";
|
|
7
|
+
interface HeaderFooterStory {
|
|
8
|
+
/** The 0-based index into DocContent.sections this story belongs to. */
|
|
9
|
+
readonly section: number;
|
|
10
|
+
readonly slot: HeaderFooterSlot;
|
|
11
|
+
readonly blocks: readonly ContentBlock[];
|
|
12
|
+
}
|
|
13
|
+
type HeaderFooterStories = readonly HeaderFooterStory[];
|
|
14
|
+
declare function readHeaderFooterStories(wordDocument: Uint8Array, table: Uint8Array, pieceTable: PieceTable, context: ReadContext, fib: Fib, sectionCount: number): HeaderFooterStories;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { HeaderFooterSlot, HeaderFooterStories, HeaderFooterStory, readHeaderFooterStories };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { readSubdocumentStories } from "./subdocument.js";
|
|
2
|
+
import { assembleBlocks } from "./table/read.js";
|
|
3
|
+
//#region src/headers-footers.ts
|
|
4
|
+
/** The six per-section slots' own order within each of Plcfhdd's per-section groups, [MS-DOC]'s own Headers page: "The stories within each group MUST appear in the following order." */
|
|
5
|
+
const SLOT_ORDER = [
|
|
6
|
+
"evenHeader",
|
|
7
|
+
"oddHeader",
|
|
8
|
+
"evenFooter",
|
|
9
|
+
"oddFooter",
|
|
10
|
+
"firstHeader",
|
|
11
|
+
"firstFooter"
|
|
12
|
+
];
|
|
13
|
+
/** The six fixed footnote/endnote-separator stories preceding every section's own six -- footnote separator, footnote continuation separator, footnote continuation notice, endnote separator, endnote continuation separator, endnote continuation notice -- carried by Plcfhdd but not read here, since neither this package's own schema nor ooxml.js's DocxDocument has anywhere to put a separator story. */
|
|
14
|
+
const FIXED_SEPARATOR_STORY_COUNT = 6;
|
|
15
|
+
function readHeaderFooterStories(wordDocument, table, pieceTable, context, fib, sectionCount) {
|
|
16
|
+
const headerStartCp = fib.ccpText + fib.ccpFtn;
|
|
17
|
+
const perSectionStories = readSubdocumentStories(wordDocument, table, pieceTable, context, headerStartCp, fib.ccpHdd, fib.fcPlcfHdd, fib.lcbPlcfHdd, "Plcfhdd").slice(FIXED_SEPARATOR_STORY_COUNT);
|
|
18
|
+
const stories = [];
|
|
19
|
+
for (let section = 0; section < sectionCount; section += 1) for (let slotIndex = 0; slotIndex < SLOT_ORDER.length; slotIndex += 1) {
|
|
20
|
+
const entries = perSectionStories[section * SLOT_ORDER.length + slotIndex];
|
|
21
|
+
if (entries === void 0 || entries.length === 0) continue;
|
|
22
|
+
const slot = SLOT_ORDER[slotIndex];
|
|
23
|
+
if (slot === void 0) continue;
|
|
24
|
+
stories.push({
|
|
25
|
+
section,
|
|
26
|
+
slot,
|
|
27
|
+
blocks: assembleBlocks(entries)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return stories;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { readHeaderFooterStories };
|
package/dist/index.cjs
CHANGED
|
@@ -4,30 +4,35 @@ const require_bytes = require("./bytes.cjs");
|
|
|
4
4
|
const require_fib_offsets = require("./fib/offsets.cjs");
|
|
5
5
|
const require_detect = require("./detect.cjs");
|
|
6
6
|
const require_plc = require("./plc.cjs");
|
|
7
|
+
const require_prop_fkp = require("./prop/fkp.cjs");
|
|
8
|
+
const require_prop_sprm = require("./prop/sprm.cjs");
|
|
9
|
+
const require_prop_chp = require("./prop/chp.cjs");
|
|
10
|
+
const require_prop_pap = require("./prop/pap.cjs");
|
|
11
|
+
const require_style_stsh = require("./style/stsh.cjs");
|
|
12
|
+
const require_text_special = require("./text/special.cjs");
|
|
13
|
+
const require_text_paragraphs = require("./text/paragraphs.cjs");
|
|
14
|
+
const require_text_piece_table = require("./text/piece-table.cjs");
|
|
15
|
+
const require_text_characters = require("./text/characters.cjs");
|
|
16
|
+
const require_subdocument = require("./subdocument.cjs");
|
|
17
|
+
const require_headers_footers = require("./headers-footers.cjs");
|
|
7
18
|
const require_fib_fib = require("./fib/fib.cjs");
|
|
8
19
|
const require_fib_write = require("./fib/write.cjs");
|
|
9
20
|
const require_metadata = require("./metadata.cjs");
|
|
10
|
-
const require_text_piece_table = require("./text/piece-table.cjs");
|
|
11
21
|
const require_text_piece_table_write = require("./text/piece-table-write.cjs");
|
|
12
|
-
const require_text_characters = require("./text/characters.cjs");
|
|
13
|
-
const require_text_special = require("./text/special.cjs");
|
|
14
|
-
const require_prop_sprm = require("./prop/sprm.cjs");
|
|
15
|
-
const require_prop_fkp = require("./prop/fkp.cjs");
|
|
16
22
|
const require_prop_fkp_write = require("./prop/fkp-write.cjs");
|
|
17
|
-
const require_prop_chp = require("./prop/chp.cjs");
|
|
18
23
|
const require_prop_chp_write = require("./prop/chp-write.cjs");
|
|
19
|
-
const require_prop_pap = require("./prop/pap.cjs");
|
|
20
24
|
const require_prop_pap_write = require("./prop/pap-write.cjs");
|
|
21
25
|
const require_prop_sep = require("./prop/sep.cjs");
|
|
22
26
|
const require_prop_sep_write = require("./prop/sep-write.cjs");
|
|
23
|
-
const require_style_stsh = require("./style/stsh.cjs");
|
|
24
27
|
const require_style_fonts = require("./style/fonts.cjs");
|
|
25
28
|
const require_list_numbering = require("./list/numbering.cjs");
|
|
29
|
+
const require_notes = require("./notes.cjs");
|
|
26
30
|
const require_read = require("./read.cjs");
|
|
27
31
|
const require_write = require("./write.cjs");
|
|
28
32
|
exports.ANNOTATION_REFERENCE = require_text_special.ANNOTATION_REFERENCE;
|
|
29
33
|
exports.CELL_MARK = require_text_special.CELL_MARK;
|
|
30
34
|
exports.COMPRESSED_CHARACTER_MAP = require_text_characters.COMPRESSED_CHARACTER_MAP;
|
|
35
|
+
exports.DATA_STREAM = require_detect.DATA_STREAM;
|
|
31
36
|
exports.DRAWN_OBJECT = require_text_special.DRAWN_OBJECT;
|
|
32
37
|
exports.DocFormatError = require_errors.DocFormatError;
|
|
33
38
|
exports.DocUnsupportedError = require_errors.DocUnsupportedError;
|
|
@@ -99,18 +104,24 @@ exports.parsePapxFkp = require_prop_fkp.parsePapxFkp;
|
|
|
99
104
|
exports.parsePlc = require_plc.parsePlc;
|
|
100
105
|
exports.parseStsh = require_style_stsh.parseStsh;
|
|
101
106
|
exports.peekFibBaseFlags = require_fib_fib.peekFibBaseFlags;
|
|
107
|
+
exports.readAllSectionProperties = require_prop_sep.readAllSectionProperties;
|
|
102
108
|
exports.readDocContent = require_read.readDocContent;
|
|
103
109
|
exports.readDocStreams = require_read.readDocStreams;
|
|
104
110
|
exports.readGrpprl = require_prop_sprm.readGrpprl;
|
|
111
|
+
exports.readHeaderFooterStories = require_headers_footers.readHeaderFooterStories;
|
|
105
112
|
exports.readInt16LE = require_bytes.readInt16LE;
|
|
106
113
|
exports.readInt32LE = require_bytes.readInt32LE;
|
|
114
|
+
exports.readNoteBodies = require_notes.readNoteBodies;
|
|
107
115
|
exports.readNumberingDefinitions = require_list_numbering.readNumberingDefinitions;
|
|
108
|
-
exports.
|
|
116
|
+
exports.readParagraphs = require_text_paragraphs.readParagraphs;
|
|
117
|
+
exports.readSubdocumentStories = require_subdocument.readSubdocumentStories;
|
|
109
118
|
exports.readTextRange = require_text_characters.readTextRange;
|
|
110
119
|
exports.readUint16LE = require_bytes.readUint16LE;
|
|
111
120
|
exports.readUint32LE = require_bytes.readUint32LE;
|
|
112
121
|
exports.readUint8 = require_bytes.readUint8;
|
|
113
122
|
exports.resolveStyleFormatting = require_style_stsh.resolveStyleFormatting;
|
|
114
123
|
exports.slice = require_bytes.slice;
|
|
124
|
+
exports.splitEntriesByBoundaries = require_text_paragraphs.splitEntriesByBoundaries;
|
|
125
|
+
exports.storyText = require_subdocument.storyText;
|
|
115
126
|
exports.tableStreamName = require_fib_fib.tableStreamName;
|
|
116
127
|
exports.writeDocContent = require_write.writeDocContent;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { readInt16LE, readInt32LE, readUint16LE, readUint32LE, readUint8, slice } from "./bytes.cjs";
|
|
2
|
-
import { SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM, isDocBytes } from "./detect.cjs";
|
|
2
|
+
import { DATA_STREAM, SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM, isDocBytes } from "./detect.cjs";
|
|
3
3
|
import { DocFormatError, DocUnsupportedError } from "./errors.cjs";
|
|
4
|
-
import { i as tableStreamName, n as parseFib, r as peekFibBaseFlags, t as Fib } from "./fib-
|
|
4
|
+
import { i as tableStreamName, n as parseFib, r as peekFibBaseFlags, t as Fib } from "./fib-6BFIx153.cjs";
|
|
5
5
|
import { FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, LW_OFFSET } from "./fib/offsets.cjs";
|
|
6
6
|
import { FibWriteSpec, buildFib } from "./fib/write.cjs";
|
|
7
|
+
import { a as PapxRecord, c as parsePapxFkp, i as PapxLookup, n as FKP_PAGE_SIZE, o as PropertyBinTable, r as PapxFkp, s as parseChpxFkp, t as ChpxFkp } from "./fkp-I-laf-8y.cjs";
|
|
8
|
+
import { a as operandSize, i as decodeSprm, n as SGC, o as readGrpprl, r as Sprm, t as Prl } from "./sprm-DEyvdOo0.cjs";
|
|
9
|
+
import { n as applyCharacterSprms, r as characterIstdFromGrpprl, t as CharacterProperties } from "./chp-BpCqpb7V.cjs";
|
|
10
|
+
import { n as applyParagraphSprms, t as ParagraphProperties } from "./pap-BQ2E17K9.cjs";
|
|
11
|
+
import { a as StyleSheet, c as parseStsh, i as Style, l as resolveStyleFormatting, n as STI_USER_DEFINED, o as buildStshForStyles, r as STK, s as headingLevelFromIstd, t as ResolvedStyleFormatting } from "./stsh-CK59x6XG.cjs";
|
|
12
|
+
import { i as splitEntriesByBoundaries, n as ReadContext, r as readParagraphs, t as ParagraphEntry } from "./paragraphs-DQUp8_HB.cjs";
|
|
13
|
+
import { a as parseClx, i as characterSize, n as PieceTable, r as characterOffset, t as Piece } from "./piece-table-CA18mhjv.cjs";
|
|
14
|
+
import { HeaderFooterSlot, HeaderFooterStories, HeaderFooterStory, readHeaderFooterStories } from "./headers-footers.cjs";
|
|
7
15
|
import { Plc, findLargestAtMost, parsePlc } from "./plc.cjs";
|
|
8
16
|
import { layoutMetadataToSummaryInformation } from "./metadata.cjs";
|
|
9
|
-
import { Piece, PieceTable, characterOffset, characterSize, parseClx } from "./text/piece-table.cjs";
|
|
10
17
|
import { buildTextClx } from "./text/piece-table-write.cjs";
|
|
11
18
|
import { COMPRESSED_CHARACTER_MAP, TextRange, readTextRange } from "./text/characters.cjs";
|
|
12
19
|
import { ANNOTATION_REFERENCE, CELL_MARK, DRAWN_OBJECT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FOOTNOTE_REFERENCE, INLINE_PICTURE, LINE_BREAK, PARAGRAPH_MARK, SECTION_MARK, SYMBOL_ANCHOR, endsParagraph, isAnchorOnly } from "./text/special.cjs";
|
|
13
|
-
import { a as operandSize, i as decodeSprm, n as SGC, o as readGrpprl, r as Sprm, t as Prl } from "./sprm-DEyvdOo0.cjs";
|
|
14
|
-
import { ChpxFkp, FKP_PAGE_SIZE, PapxFkp, PapxLookup, PapxRecord, PropertyBinTable, parseChpxFkp, parsePapxFkp } from "./prop/fkp.cjs";
|
|
15
20
|
import { ChpxRunToWrite, PapxParagraphToWrite, buildChpxPages, buildPapxPages, buildPropertyBinTable, firstFcOfPage, fitsAloneOnPapxPage } from "./prop/fkp-write.cjs";
|
|
16
|
-
import { CharacterProperties, applyCharacterSprms, characterIstdFromGrpprl } from "./prop/chp.cjs";
|
|
17
21
|
import { encodeCharacterGrpprl } from "./prop/chp-write.cjs";
|
|
18
|
-
import { n as applyParagraphSprms, t as ParagraphProperties } from "./pap-BT1p0uzu.cjs";
|
|
19
22
|
import { encodeParagraphGrpprl } from "./prop/pap-write.cjs";
|
|
20
|
-
import { SectionProperties, applySectionSprms,
|
|
23
|
+
import { DocSectionProperties, SectionProperties, applySectionSprms, readAllSectionProperties } from "./prop/sep.cjs";
|
|
21
24
|
import { buildPlcfSed, buildSepx, encodeSectionGrpprl } from "./prop/sep-write.cjs";
|
|
22
|
-
import { ResolvedStyleFormatting, STI_USER_DEFINED, STK, Style, StyleSheet, buildStshForStyles, headingLevelFromIstd, parseStsh, resolveStyleFormatting } from "./style/stsh.cjs";
|
|
23
25
|
import { buildFontTable, parseFontTable } from "./style/fonts.cjs";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
+
import { NUMBER_FORMAT_BY_NFC, NumberingDefinition, NumberingDefinitions, NumberingLevel, readNumberingDefinitions } from "./list/numbering.cjs";
|
|
27
|
+
import { readSubdocumentStories, storyText } from "./subdocument.cjs";
|
|
28
|
+
import { Comment, Footnote, NoteBodies, readNoteBodies } from "./notes.cjs";
|
|
29
|
+
import { DocContent, DocStreams, readDocContent, readDocStreams } from "./read.cjs";
|
|
26
30
|
import { WriteDocContentOptions, writeDocContent } from "./write.cjs";
|
|
27
|
-
export { ANNOTATION_REFERENCE, CELL_MARK, COMPRESSED_CHARACTER_MAP, CharacterProperties, ChpxFkp, ChpxRunToWrite, DRAWN_OBJECT, DocContent, DocFormatError, DocStreams, DocUnsupportedError, FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FKP_PAGE_SIZE, FOOTNOTE_REFERENCE, Fib, FibWriteSpec, INLINE_PICTURE, LINE_BREAK, LW_OFFSET, NUMBER_FORMAT_BY_NFC, NumberingDefinition, NumberingDefinitions, NumberingLevel, PARAGRAPH_MARK, PapxFkp, PapxLookup, PapxParagraphToWrite, PapxRecord, ParagraphEntry, ParagraphProperties, Piece, PieceTable, Plc, Prl, PropertyBinTable, ResolvedStyleFormatting, SECTION_MARK, SGC, STI_USER_DEFINED, STK, SUMMARY_INFORMATION_STREAM, SYMBOL_ANCHOR, SectionProperties, Sprm, Style, StyleSheet, TextRange, WORD_DOCUMENT_STREAM, WriteDocContentOptions, applyCharacterSprms, applyParagraphSprms, applySectionSprms, buildChpxPages, buildFib, buildFontTable, buildPapxPages, buildPlcfSed, buildPropertyBinTable, buildSepx, buildStshForStyles, buildTextClx, characterIstdFromGrpprl, characterOffset, characterSize, decodeSprm, encodeCharacterGrpprl, encodeParagraphGrpprl, encodeSectionGrpprl, endsParagraph, findLargestAtMost, firstFcOfPage, fitsAloneOnPapxPage, headingLevelFromIstd, isAnchorOnly, isDocBytes, layoutMetadataToSummaryInformation, operandSize, parseChpxFkp, parseClx, parseFib, parseFontTable, parsePapxFkp, parsePlc, parseStsh, peekFibBaseFlags, readDocContent, readDocStreams, readGrpprl, readInt16LE, readInt32LE, readNumberingDefinitions,
|
|
31
|
+
export { ANNOTATION_REFERENCE, CELL_MARK, COMPRESSED_CHARACTER_MAP, CharacterProperties, ChpxFkp, ChpxRunToWrite, Comment, DATA_STREAM, DRAWN_OBJECT, DocContent, DocFormatError, DocSectionProperties, DocStreams, DocUnsupportedError, FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FKP_PAGE_SIZE, FOOTNOTE_REFERENCE, Fib, FibWriteSpec, Footnote, HeaderFooterSlot, HeaderFooterStories, HeaderFooterStory, INLINE_PICTURE, LINE_BREAK, LW_OFFSET, NUMBER_FORMAT_BY_NFC, NoteBodies, NumberingDefinition, NumberingDefinitions, NumberingLevel, PARAGRAPH_MARK, PapxFkp, PapxLookup, PapxParagraphToWrite, PapxRecord, ParagraphEntry, ParagraphProperties, Piece, PieceTable, Plc, Prl, PropertyBinTable, ReadContext, ResolvedStyleFormatting, SECTION_MARK, SGC, STI_USER_DEFINED, STK, SUMMARY_INFORMATION_STREAM, SYMBOL_ANCHOR, SectionProperties, Sprm, Style, StyleSheet, TextRange, WORD_DOCUMENT_STREAM, WriteDocContentOptions, applyCharacterSprms, applyParagraphSprms, applySectionSprms, buildChpxPages, buildFib, buildFontTable, buildPapxPages, buildPlcfSed, buildPropertyBinTable, buildSepx, buildStshForStyles, buildTextClx, characterIstdFromGrpprl, characterOffset, characterSize, decodeSprm, encodeCharacterGrpprl, encodeParagraphGrpprl, encodeSectionGrpprl, endsParagraph, findLargestAtMost, firstFcOfPage, fitsAloneOnPapxPage, headingLevelFromIstd, isAnchorOnly, isDocBytes, layoutMetadataToSummaryInformation, operandSize, parseChpxFkp, parseClx, parseFib, parseFontTable, parsePapxFkp, parsePlc, parseStsh, peekFibBaseFlags, readAllSectionProperties, readDocContent, readDocStreams, readGrpprl, readHeaderFooterStories, readInt16LE, readInt32LE, readNoteBodies, readNumberingDefinitions, readParagraphs, readSubdocumentStories, readTextRange, readUint16LE, readUint32LE, readUint8, resolveStyleFormatting, slice, splitEntriesByBoundaries, storyText, tableStreamName, writeDocContent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { readInt16LE, readInt32LE, readUint16LE, readUint32LE, readUint8, slice } from "./bytes.js";
|
|
2
|
-
import { SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM, isDocBytes } from "./detect.js";
|
|
2
|
+
import { DATA_STREAM, SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM, isDocBytes } from "./detect.js";
|
|
3
3
|
import { DocFormatError, DocUnsupportedError } from "./errors.js";
|
|
4
|
-
import { i as tableStreamName, n as parseFib, r as peekFibBaseFlags, t as Fib } from "./fib-
|
|
4
|
+
import { i as tableStreamName, n as parseFib, r as peekFibBaseFlags, t as Fib } from "./fib-6BFIx153.js";
|
|
5
5
|
import { FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, LW_OFFSET } from "./fib/offsets.js";
|
|
6
6
|
import { FibWriteSpec, buildFib } from "./fib/write.js";
|
|
7
|
+
import { a as PapxRecord, c as parsePapxFkp, i as PapxLookup, n as FKP_PAGE_SIZE, o as PropertyBinTable, r as PapxFkp, s as parseChpxFkp, t as ChpxFkp } from "./fkp-I-laf-8y.js";
|
|
8
|
+
import { a as operandSize, i as decodeSprm, n as SGC, o as readGrpprl, r as Sprm, t as Prl } from "./sprm-DEyvdOo0.js";
|
|
9
|
+
import { n as applyCharacterSprms, r as characterIstdFromGrpprl, t as CharacterProperties } from "./chp-B6AOh85P.js";
|
|
10
|
+
import { n as applyParagraphSprms, t as ParagraphProperties } from "./pap-iWFIpCdo.js";
|
|
11
|
+
import { a as StyleSheet, c as parseStsh, i as Style, l as resolveStyleFormatting, n as STI_USER_DEFINED, o as buildStshForStyles, r as STK, s as headingLevelFromIstd, t as ResolvedStyleFormatting } from "./stsh-Bj0YSEOp.js";
|
|
12
|
+
import { i as splitEntriesByBoundaries, n as ReadContext, r as readParagraphs, t as ParagraphEntry } from "./paragraphs-s2lJ6w2I.js";
|
|
13
|
+
import { a as parseClx, i as characterSize, n as PieceTable, r as characterOffset, t as Piece } from "./piece-table-CA18mhjv.js";
|
|
14
|
+
import { HeaderFooterSlot, HeaderFooterStories, HeaderFooterStory, readHeaderFooterStories } from "./headers-footers.js";
|
|
7
15
|
import { Plc, findLargestAtMost, parsePlc } from "./plc.js";
|
|
8
16
|
import { layoutMetadataToSummaryInformation } from "./metadata.js";
|
|
9
|
-
import { Piece, PieceTable, characterOffset, characterSize, parseClx } from "./text/piece-table.js";
|
|
10
17
|
import { buildTextClx } from "./text/piece-table-write.js";
|
|
11
18
|
import { COMPRESSED_CHARACTER_MAP, TextRange, readTextRange } from "./text/characters.js";
|
|
12
19
|
import { ANNOTATION_REFERENCE, CELL_MARK, DRAWN_OBJECT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FOOTNOTE_REFERENCE, INLINE_PICTURE, LINE_BREAK, PARAGRAPH_MARK, SECTION_MARK, SYMBOL_ANCHOR, endsParagraph, isAnchorOnly } from "./text/special.js";
|
|
13
|
-
import { a as operandSize, i as decodeSprm, n as SGC, o as readGrpprl, r as Sprm, t as Prl } from "./sprm-DEyvdOo0.js";
|
|
14
|
-
import { ChpxFkp, FKP_PAGE_SIZE, PapxFkp, PapxLookup, PapxRecord, PropertyBinTable, parseChpxFkp, parsePapxFkp } from "./prop/fkp.js";
|
|
15
20
|
import { ChpxRunToWrite, PapxParagraphToWrite, buildChpxPages, buildPapxPages, buildPropertyBinTable, firstFcOfPage, fitsAloneOnPapxPage } from "./prop/fkp-write.js";
|
|
16
|
-
import { CharacterProperties, applyCharacterSprms, characterIstdFromGrpprl } from "./prop/chp.js";
|
|
17
21
|
import { encodeCharacterGrpprl } from "./prop/chp-write.js";
|
|
18
|
-
import { n as applyParagraphSprms, t as ParagraphProperties } from "./pap-DOFLMWcG.js";
|
|
19
22
|
import { encodeParagraphGrpprl } from "./prop/pap-write.js";
|
|
20
|
-
import { SectionProperties, applySectionSprms,
|
|
23
|
+
import { DocSectionProperties, SectionProperties, applySectionSprms, readAllSectionProperties } from "./prop/sep.js";
|
|
21
24
|
import { buildPlcfSed, buildSepx, encodeSectionGrpprl } from "./prop/sep-write.js";
|
|
22
|
-
import { ResolvedStyleFormatting, STI_USER_DEFINED, STK, Style, StyleSheet, buildStshForStyles, headingLevelFromIstd, parseStsh, resolveStyleFormatting } from "./style/stsh.js";
|
|
23
25
|
import { buildFontTable, parseFontTable } from "./style/fonts.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
+
import { NUMBER_FORMAT_BY_NFC, NumberingDefinition, NumberingDefinitions, NumberingLevel, readNumberingDefinitions } from "./list/numbering.js";
|
|
27
|
+
import { readSubdocumentStories, storyText } from "./subdocument.js";
|
|
28
|
+
import { Comment, Footnote, NoteBodies, readNoteBodies } from "./notes.js";
|
|
29
|
+
import { DocContent, DocStreams, readDocContent, readDocStreams } from "./read.js";
|
|
26
30
|
import { WriteDocContentOptions, writeDocContent } from "./write.js";
|
|
27
|
-
export { ANNOTATION_REFERENCE, CELL_MARK, COMPRESSED_CHARACTER_MAP, CharacterProperties, ChpxFkp, ChpxRunToWrite, DRAWN_OBJECT, DocContent, DocFormatError, DocStreams, DocUnsupportedError, FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FKP_PAGE_SIZE, FOOTNOTE_REFERENCE, Fib, FibWriteSpec, INLINE_PICTURE, LINE_BREAK, LW_OFFSET, NUMBER_FORMAT_BY_NFC, NumberingDefinition, NumberingDefinitions, NumberingLevel, PARAGRAPH_MARK, PapxFkp, PapxLookup, PapxParagraphToWrite, PapxRecord, ParagraphEntry, ParagraphProperties, Piece, PieceTable, Plc, Prl, PropertyBinTable, ResolvedStyleFormatting, SECTION_MARK, SGC, STI_USER_DEFINED, STK, SUMMARY_INFORMATION_STREAM, SYMBOL_ANCHOR, SectionProperties, Sprm, Style, StyleSheet, TextRange, WORD_DOCUMENT_STREAM, WriteDocContentOptions, applyCharacterSprms, applyParagraphSprms, applySectionSprms, buildChpxPages, buildFib, buildFontTable, buildPapxPages, buildPlcfSed, buildPropertyBinTable, buildSepx, buildStshForStyles, buildTextClx, characterIstdFromGrpprl, characterOffset, characterSize, decodeSprm, encodeCharacterGrpprl, encodeParagraphGrpprl, encodeSectionGrpprl, endsParagraph, findLargestAtMost, firstFcOfPage, fitsAloneOnPapxPage, headingLevelFromIstd, isAnchorOnly, isDocBytes, layoutMetadataToSummaryInformation, operandSize, parseChpxFkp, parseClx, parseFib, parseFontTable, parsePapxFkp, parsePlc, parseStsh, peekFibBaseFlags, readDocContent, readDocStreams, readGrpprl, readInt16LE, readInt32LE, readNumberingDefinitions,
|
|
31
|
+
export { ANNOTATION_REFERENCE, CELL_MARK, COMPRESSED_CHARACTER_MAP, CharacterProperties, ChpxFkp, ChpxRunToWrite, Comment, DATA_STREAM, DRAWN_OBJECT, DocContent, DocFormatError, DocSectionProperties, DocStreams, DocUnsupportedError, FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FKP_PAGE_SIZE, FOOTNOTE_REFERENCE, Fib, FibWriteSpec, Footnote, HeaderFooterSlot, HeaderFooterStories, HeaderFooterStory, INLINE_PICTURE, LINE_BREAK, LW_OFFSET, NUMBER_FORMAT_BY_NFC, NoteBodies, NumberingDefinition, NumberingDefinitions, NumberingLevel, PARAGRAPH_MARK, PapxFkp, PapxLookup, PapxParagraphToWrite, PapxRecord, ParagraphEntry, ParagraphProperties, Piece, PieceTable, Plc, Prl, PropertyBinTable, ReadContext, ResolvedStyleFormatting, SECTION_MARK, SGC, STI_USER_DEFINED, STK, SUMMARY_INFORMATION_STREAM, SYMBOL_ANCHOR, SectionProperties, Sprm, Style, StyleSheet, TextRange, WORD_DOCUMENT_STREAM, WriteDocContentOptions, applyCharacterSprms, applyParagraphSprms, applySectionSprms, buildChpxPages, buildFib, buildFontTable, buildPapxPages, buildPlcfSed, buildPropertyBinTable, buildSepx, buildStshForStyles, buildTextClx, characterIstdFromGrpprl, characterOffset, characterSize, decodeSprm, encodeCharacterGrpprl, encodeParagraphGrpprl, encodeSectionGrpprl, endsParagraph, findLargestAtMost, firstFcOfPage, fitsAloneOnPapxPage, headingLevelFromIstd, isAnchorOnly, isDocBytes, layoutMetadataToSummaryInformation, operandSize, parseChpxFkp, parseClx, parseFib, parseFontTable, parsePapxFkp, parsePlc, parseStsh, peekFibBaseFlags, readAllSectionProperties, readDocContent, readDocStreams, readGrpprl, readHeaderFooterStories, readInt16LE, readInt32LE, readNoteBodies, readNumberingDefinitions, readParagraphs, readSubdocumentStories, readTextRange, readUint16LE, readUint32LE, readUint8, resolveStyleFormatting, slice, splitEntriesByBoundaries, storyText, tableStreamName, writeDocContent };
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { DocFormatError, DocUnsupportedError } from "./errors.js";
|
|
2
2
|
import { readInt16LE, readInt32LE, readUint16LE, readUint32LE, readUint8, slice } from "./bytes.js";
|
|
3
3
|
import { FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, LW_OFFSET } from "./fib/offsets.js";
|
|
4
|
-
import { SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM, isDocBytes } from "./detect.js";
|
|
4
|
+
import { DATA_STREAM, SUMMARY_INFORMATION_STREAM, WORD_DOCUMENT_STREAM, isDocBytes } from "./detect.js";
|
|
5
5
|
import { findLargestAtMost, parsePlc } from "./plc.js";
|
|
6
|
+
import { FKP_PAGE_SIZE, PropertyBinTable, parseChpxFkp, parsePapxFkp } from "./prop/fkp.js";
|
|
7
|
+
import { SGC, decodeSprm, operandSize, readGrpprl } from "./prop/sprm.js";
|
|
8
|
+
import { applyCharacterSprms, characterIstdFromGrpprl } from "./prop/chp.js";
|
|
9
|
+
import { applyParagraphSprms } from "./prop/pap.js";
|
|
10
|
+
import { STI_USER_DEFINED, STK, buildStshForStyles, headingLevelFromIstd, parseStsh, resolveStyleFormatting } from "./style/stsh.js";
|
|
11
|
+
import { ANNOTATION_REFERENCE, CELL_MARK, DRAWN_OBJECT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FOOTNOTE_REFERENCE, INLINE_PICTURE, LINE_BREAK, PARAGRAPH_MARK, SECTION_MARK, SYMBOL_ANCHOR, endsParagraph, isAnchorOnly } from "./text/special.js";
|
|
12
|
+
import { readParagraphs, splitEntriesByBoundaries } from "./text/paragraphs.js";
|
|
13
|
+
import { characterOffset, characterSize, parseClx } from "./text/piece-table.js";
|
|
14
|
+
import { COMPRESSED_CHARACTER_MAP, readTextRange } from "./text/characters.js";
|
|
15
|
+
import { readSubdocumentStories, storyText } from "./subdocument.js";
|
|
16
|
+
import { readHeaderFooterStories } from "./headers-footers.js";
|
|
6
17
|
import { parseFib, peekFibBaseFlags, tableStreamName } from "./fib/fib.js";
|
|
7
18
|
import { buildFib } from "./fib/write.js";
|
|
8
19
|
import { layoutMetadataToSummaryInformation } from "./metadata.js";
|
|
9
|
-
import { characterOffset, characterSize, parseClx } from "./text/piece-table.js";
|
|
10
20
|
import { buildTextClx } from "./text/piece-table-write.js";
|
|
11
|
-
import { COMPRESSED_CHARACTER_MAP, readTextRange } from "./text/characters.js";
|
|
12
|
-
import { ANNOTATION_REFERENCE, CELL_MARK, DRAWN_OBJECT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FOOTNOTE_REFERENCE, INLINE_PICTURE, LINE_BREAK, PARAGRAPH_MARK, SECTION_MARK, SYMBOL_ANCHOR, endsParagraph, isAnchorOnly } from "./text/special.js";
|
|
13
|
-
import { SGC, decodeSprm, operandSize, readGrpprl } from "./prop/sprm.js";
|
|
14
|
-
import { FKP_PAGE_SIZE, PropertyBinTable, parseChpxFkp, parsePapxFkp } from "./prop/fkp.js";
|
|
15
21
|
import { buildChpxPages, buildPapxPages, buildPropertyBinTable, firstFcOfPage, fitsAloneOnPapxPage } from "./prop/fkp-write.js";
|
|
16
|
-
import { applyCharacterSprms, characterIstdFromGrpprl } from "./prop/chp.js";
|
|
17
22
|
import { encodeCharacterGrpprl } from "./prop/chp-write.js";
|
|
18
|
-
import { applyParagraphSprms } from "./prop/pap.js";
|
|
19
23
|
import { encodeParagraphGrpprl } from "./prop/pap-write.js";
|
|
20
|
-
import { applySectionSprms,
|
|
24
|
+
import { applySectionSprms, readAllSectionProperties } from "./prop/sep.js";
|
|
21
25
|
import { buildPlcfSed, buildSepx, encodeSectionGrpprl } from "./prop/sep-write.js";
|
|
22
|
-
import { STI_USER_DEFINED, STK, buildStshForStyles, headingLevelFromIstd, parseStsh, resolveStyleFormatting } from "./style/stsh.js";
|
|
23
26
|
import { buildFontTable, parseFontTable } from "./style/fonts.js";
|
|
24
27
|
import { NUMBER_FORMAT_BY_NFC, readNumberingDefinitions } from "./list/numbering.js";
|
|
28
|
+
import { readNoteBodies } from "./notes.js";
|
|
25
29
|
import { readDocContent, readDocStreams } from "./read.js";
|
|
26
30
|
import { writeDocContent } from "./write.js";
|
|
27
|
-
export { ANNOTATION_REFERENCE, CELL_MARK, COMPRESSED_CHARACTER_MAP, DRAWN_OBJECT, DocFormatError, DocUnsupportedError, FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FKP_PAGE_SIZE, FOOTNOTE_REFERENCE, INLINE_PICTURE, LINE_BREAK, LW_OFFSET, NUMBER_FORMAT_BY_NFC, PARAGRAPH_MARK, PropertyBinTable, SECTION_MARK, SGC, STI_USER_DEFINED, STK, SUMMARY_INFORMATION_STREAM, SYMBOL_ANCHOR, WORD_DOCUMENT_STREAM, applyCharacterSprms, applyParagraphSprms, applySectionSprms, buildChpxPages, buildFib, buildFontTable, buildPapxPages, buildPlcfSed, buildPropertyBinTable, buildSepx, buildStshForStyles, buildTextClx, characterIstdFromGrpprl, characterOffset, characterSize, decodeSprm, encodeCharacterGrpprl, encodeParagraphGrpprl, encodeSectionGrpprl, endsParagraph, findLargestAtMost, firstFcOfPage, fitsAloneOnPapxPage, headingLevelFromIstd, isAnchorOnly, isDocBytes, layoutMetadataToSummaryInformation, operandSize, parseChpxFkp, parseClx, parseFib, parseFontTable, parsePapxFkp, parsePlc, parseStsh, peekFibBaseFlags, readDocContent, readDocStreams, readGrpprl, readInt16LE, readInt32LE, readNumberingDefinitions,
|
|
31
|
+
export { ANNOTATION_REFERENCE, CELL_MARK, COMPRESSED_CHARACTER_MAP, DATA_STREAM, DRAWN_OBJECT, DocFormatError, DocUnsupportedError, FC_LCB_VALUE_INDEX, FIB_BASE_FLAG, FIB_BASE_SIZE, FIB_CB_RG_FC_LCB_OFFSET, FIB_CSLW_OFFSET, FIB_CSLW_REQUIRED, FIB_CSW_REQUIRED, FIB_FC_LCB_BLOB_OFFSET, FIB_LKEY_OFFSET, FIB_RG_LW_OFFSET, FIB_RG_LW_SIZE, FIB_RG_W_OFFSET, FIB_RG_W_SIZE, FIB_W_IDENT, FIELD_BEGIN, FIELD_END, FIELD_SEPARATOR, FKP_PAGE_SIZE, FOOTNOTE_REFERENCE, INLINE_PICTURE, LINE_BREAK, LW_OFFSET, NUMBER_FORMAT_BY_NFC, PARAGRAPH_MARK, PropertyBinTable, SECTION_MARK, SGC, STI_USER_DEFINED, STK, SUMMARY_INFORMATION_STREAM, SYMBOL_ANCHOR, WORD_DOCUMENT_STREAM, applyCharacterSprms, applyParagraphSprms, applySectionSprms, buildChpxPages, buildFib, buildFontTable, buildPapxPages, buildPlcfSed, buildPropertyBinTable, buildSepx, buildStshForStyles, buildTextClx, characterIstdFromGrpprl, characterOffset, characterSize, decodeSprm, encodeCharacterGrpprl, encodeParagraphGrpprl, encodeSectionGrpprl, endsParagraph, findLargestAtMost, firstFcOfPage, fitsAloneOnPapxPage, headingLevelFromIstd, isAnchorOnly, isDocBytes, layoutMetadataToSummaryInformation, operandSize, parseChpxFkp, parseClx, parseFib, parseFontTable, parsePapxFkp, parsePlc, parseStsh, peekFibBaseFlags, readAllSectionProperties, readDocContent, readDocStreams, readGrpprl, readHeaderFooterStories, readInt16LE, readInt32LE, readNoteBodies, readNumberingDefinitions, readParagraphs, readSubdocumentStories, readTextRange, readUint16LE, readUint32LE, readUint8, resolveStyleFormatting, slice, splitEntriesByBoundaries, storyText, tableStreamName, writeDocContent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NumberingDefinitions } from "./numbering.cjs";
|
|
2
2
|
import { ContentListMembership } from "document-schema.js";
|
|
3
3
|
//#region src/list/numbering-write.d.ts
|
|
4
4
|
/** One document's own numbering, gathered from every paragraph's list membership (the caller passes the already-flattened sequence, table cells included, so a list used only inside a table cell is still resolved). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NumberingDefinitions } from "./numbering.js";
|
|
2
2
|
import { ContentListMembership } from "document-schema.js";
|
|
3
3
|
//#region src/list/numbering-write.d.ts
|
|
4
4
|
/** One document's own numbering, gathered from every paragraph's list membership (the caller passes the already-flattened sequence, table cells included, so a list used only inside a table cell is still resolved). */
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as Fib } from "../fib-6BFIx153.cjs";
|
|
2
|
+
//#region src/list/numbering.d.ts
|
|
3
|
+
/** MSONFC ([MS-OSHARED] 2.2.1.3), mapped to its own documented ST_NumberFormat equivalent -- the identical vocabulary ooxml.js's NumberingLevel.format carries verbatim from word/numbering.xml's own w:numFmt/@w:val. Every member through msonfcUCRus (0x3B) is a real numbered/lettered/ideograph format; 0x17 (msonfcBullet) is handled separately below since PlfLfo also treats it as the "no number sequence, but has bullets" case LVLF's own field text calls out by name. */
|
|
4
|
+
declare const NUMBER_FORMAT_BY_NFC: Readonly<Record<number, string>>;
|
|
5
|
+
interface NumberingLevel {
|
|
6
|
+
/** The ST_NumberFormat-equivalent string MSONFC's own value maps to ("decimal", "upperRoman", "bullet", ...), or "none" for a level with no number sequence at all ([MS-DOC] 2.9.150's own nfc field text: "If this is equal to 0xFF..., this level does not have a number sequence"). */
|
|
7
|
+
readonly format: string;
|
|
8
|
+
/** The level's own text template: a placeholder pattern like '%1.' or '%2)' for a numbered format (the digit names which zero-based level's own counter substitutes at that position, one-based in the placeholder itself) -- the identical convention ooxml.js's own NumberingLevel.text carries verbatim from w:lvlText/@w:val -- or a literal bullet glyph string for format 'bullet'. Decoded from the level's own Xst (a raw UTF-16 string) plus its rgbxchNums array, which names which character POSITIONS in that string are placeholders rather than literal text -- see readLevelText below. */
|
|
9
|
+
readonly text: string;
|
|
10
|
+
/** iStartAt: the value this level's counter begins from. Meaningless (and not read as anything but 1) for a level with no number sequence. */
|
|
11
|
+
readonly startAt: number;
|
|
12
|
+
/** ilvlRestartLim ([MS-DOC] 2.9.150), only when fNoRestart is set: the first (most-significant) zero-based level after which this level's own number sequence does NOT restart. Absent (undefined) is the spec's own default behaviour -- "restarts when a more significant level is encountered" -- not "never restarts". */
|
|
13
|
+
readonly restart?: number;
|
|
14
|
+
}
|
|
15
|
+
interface NumberingDefinition {
|
|
16
|
+
/** Keyed by the level's own zero-based ilvl, stringified -- the identical zero-based numbering ContentListMembership.level already uses, so `definitions[membership.numId]?.levels[String(membership.level)]` is the direct lookup path from a paragraph's own membership to its rendering definition. A record rather than a fixed-length array/tuple: a simple (fSimpleList) LSTF states only level 0. */
|
|
17
|
+
readonly levels: Readonly<Record<string, NumberingLevel>>;
|
|
18
|
+
}
|
|
19
|
+
/** Keyed by a paragraph's own listId (ContentListMembership.numId, stringified) -- prop/pap.ts's own sprmPIlfo, a one-based index into PlfLfo.rgLfo. */
|
|
20
|
+
type NumberingDefinitions = Readonly<Record<string, NumberingDefinition>>;
|
|
21
|
+
/** Resolves PlfLst and PlfLfo into NumberingDefinitions, keyed by the one-based ilfo every listId already is (prop/pap.ts's own Math.abs(ilfo)) -- absent entirely when the file carries neither (fcPlfLst/fcPlfLfo both 0, a document with no lists at all, the common case this reader must not fail on). */
|
|
22
|
+
declare function readNumberingDefinitions(table: Uint8Array, fib: Fib): NumberingDefinitions;
|
|
23
|
+
//#endregion
|
|
2
24
|
export { NUMBER_FORMAT_BY_NFC, NumberingDefinition, NumberingDefinitions, NumberingLevel, readNumberingDefinitions };
|
package/dist/list/numbering.d.ts
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as Fib } from "../fib-6BFIx153.js";
|
|
2
|
+
//#region src/list/numbering.d.ts
|
|
3
|
+
/** MSONFC ([MS-OSHARED] 2.2.1.3), mapped to its own documented ST_NumberFormat equivalent -- the identical vocabulary ooxml.js's NumberingLevel.format carries verbatim from word/numbering.xml's own w:numFmt/@w:val. Every member through msonfcUCRus (0x3B) is a real numbered/lettered/ideograph format; 0x17 (msonfcBullet) is handled separately below since PlfLfo also treats it as the "no number sequence, but has bullets" case LVLF's own field text calls out by name. */
|
|
4
|
+
declare const NUMBER_FORMAT_BY_NFC: Readonly<Record<number, string>>;
|
|
5
|
+
interface NumberingLevel {
|
|
6
|
+
/** The ST_NumberFormat-equivalent string MSONFC's own value maps to ("decimal", "upperRoman", "bullet", ...), or "none" for a level with no number sequence at all ([MS-DOC] 2.9.150's own nfc field text: "If this is equal to 0xFF..., this level does not have a number sequence"). */
|
|
7
|
+
readonly format: string;
|
|
8
|
+
/** The level's own text template: a placeholder pattern like '%1.' or '%2)' for a numbered format (the digit names which zero-based level's own counter substitutes at that position, one-based in the placeholder itself) -- the identical convention ooxml.js's own NumberingLevel.text carries verbatim from w:lvlText/@w:val -- or a literal bullet glyph string for format 'bullet'. Decoded from the level's own Xst (a raw UTF-16 string) plus its rgbxchNums array, which names which character POSITIONS in that string are placeholders rather than literal text -- see readLevelText below. */
|
|
9
|
+
readonly text: string;
|
|
10
|
+
/** iStartAt: the value this level's counter begins from. Meaningless (and not read as anything but 1) for a level with no number sequence. */
|
|
11
|
+
readonly startAt: number;
|
|
12
|
+
/** ilvlRestartLim ([MS-DOC] 2.9.150), only when fNoRestart is set: the first (most-significant) zero-based level after which this level's own number sequence does NOT restart. Absent (undefined) is the spec's own default behaviour -- "restarts when a more significant level is encountered" -- not "never restarts". */
|
|
13
|
+
readonly restart?: number;
|
|
14
|
+
}
|
|
15
|
+
interface NumberingDefinition {
|
|
16
|
+
/** Keyed by the level's own zero-based ilvl, stringified -- the identical zero-based numbering ContentListMembership.level already uses, so `definitions[membership.numId]?.levels[String(membership.level)]` is the direct lookup path from a paragraph's own membership to its rendering definition. A record rather than a fixed-length array/tuple: a simple (fSimpleList) LSTF states only level 0. */
|
|
17
|
+
readonly levels: Readonly<Record<string, NumberingLevel>>;
|
|
18
|
+
}
|
|
19
|
+
/** Keyed by a paragraph's own listId (ContentListMembership.numId, stringified) -- prop/pap.ts's own sprmPIlfo, a one-based index into PlfLfo.rgLfo. */
|
|
20
|
+
type NumberingDefinitions = Readonly<Record<string, NumberingDefinition>>;
|
|
21
|
+
/** Resolves PlfLst and PlfLfo into NumberingDefinitions, keyed by the one-based ilfo every listId already is (prop/pap.ts's own Math.abs(ilfo)) -- absent entirely when the file carries neither (fcPlfLst/fcPlfLfo both 0, a document with no lists at all, the common case this reader must not fail on). */
|
|
22
|
+
declare function readNumberingDefinitions(table: Uint8Array, fib: Fib): NumberingDefinitions;
|
|
23
|
+
//#endregion
|
|
2
24
|
export { NUMBER_FORMAT_BY_NFC, NumberingDefinition, NumberingDefinitions, NumberingLevel, readNumberingDefinitions };
|
package/dist/notes.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_subdocument = require("./subdocument.cjs");
|
|
3
|
+
//#region src/notes.ts
|
|
4
|
+
function readNoteBodies(wordDocument, table, pieceTable, context, fib) {
|
|
5
|
+
const footnoteStartCp = fib.ccpText;
|
|
6
|
+
const commentStartCp = footnoteStartCp + fib.ccpFtn + fib.ccpHdd;
|
|
7
|
+
const endnoteStartCp = commentStartCp + fib.ccpAtn;
|
|
8
|
+
const footnotes = require_subdocument.readSubdocumentStories(wordDocument, table, pieceTable, context, footnoteStartCp, fib.ccpFtn, fib.fcPlcffndTxt, fib.lcbPlcffndTxt, "PlcffndTxt").map((entries, index) => ({
|
|
9
|
+
id: String(index + 1),
|
|
10
|
+
text: require_subdocument.storyText(entries)
|
|
11
|
+
}));
|
|
12
|
+
const comments = require_subdocument.readSubdocumentStories(wordDocument, table, pieceTable, context, commentStartCp, fib.ccpAtn, fib.fcPlcfandTxt, fib.lcbPlcfandTxt, "PlcfandTxt").map((entries, index) => ({
|
|
13
|
+
id: String(index + 1),
|
|
14
|
+
text: require_subdocument.storyText(entries)
|
|
15
|
+
}));
|
|
16
|
+
return {
|
|
17
|
+
footnotes,
|
|
18
|
+
endnotes: require_subdocument.readSubdocumentStories(wordDocument, table, pieceTable, context, endnoteStartCp, fib.ccpEdn, fib.fcPlcfendTxt, fib.lcbPlcfendTxt, "PlcfendTxt").map((entries, index) => ({
|
|
19
|
+
id: String(index + 1),
|
|
20
|
+
text: require_subdocument.storyText(entries)
|
|
21
|
+
})),
|
|
22
|
+
comments
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.readNoteBodies = readNoteBodies;
|
package/dist/notes.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as Fib } from "./fib-6BFIx153.cjs";
|
|
2
|
+
import { n as ReadContext } from "./paragraphs-DQUp8_HB.cjs";
|
|
3
|
+
import { n as PieceTable } from "./piece-table-CA18mhjv.cjs";
|
|
4
|
+
//#region src/notes.d.ts
|
|
5
|
+
interface Footnote {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly text: string;
|
|
8
|
+
}
|
|
9
|
+
interface Comment {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
}
|
|
13
|
+
interface NoteBodies {
|
|
14
|
+
readonly footnotes: readonly Footnote[];
|
|
15
|
+
readonly endnotes: readonly Footnote[];
|
|
16
|
+
readonly comments: readonly Comment[];
|
|
17
|
+
}
|
|
18
|
+
declare function readNoteBodies(wordDocument: Uint8Array, table: Uint8Array, pieceTable: PieceTable, context: ReadContext, fib: Fib): NoteBodies;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Comment, Footnote, NoteBodies, readNoteBodies };
|
package/dist/notes.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as Fib } from "./fib-6BFIx153.js";
|
|
2
|
+
import { n as ReadContext } from "./paragraphs-s2lJ6w2I.js";
|
|
3
|
+
import { n as PieceTable } from "./piece-table-CA18mhjv.js";
|
|
4
|
+
//#region src/notes.d.ts
|
|
5
|
+
interface Footnote {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly text: string;
|
|
8
|
+
}
|
|
9
|
+
interface Comment {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
}
|
|
13
|
+
interface NoteBodies {
|
|
14
|
+
readonly footnotes: readonly Footnote[];
|
|
15
|
+
readonly endnotes: readonly Footnote[];
|
|
16
|
+
readonly comments: readonly Comment[];
|
|
17
|
+
}
|
|
18
|
+
declare function readNoteBodies(wordDocument: Uint8Array, table: Uint8Array, pieceTable: PieceTable, context: ReadContext, fib: Fib): NoteBodies;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Comment, Footnote, NoteBodies, readNoteBodies };
|
package/dist/notes.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readSubdocumentStories, storyText } from "./subdocument.js";
|
|
2
|
+
//#region src/notes.ts
|
|
3
|
+
function readNoteBodies(wordDocument, table, pieceTable, context, fib) {
|
|
4
|
+
const footnoteStartCp = fib.ccpText;
|
|
5
|
+
const commentStartCp = footnoteStartCp + fib.ccpFtn + fib.ccpHdd;
|
|
6
|
+
const endnoteStartCp = commentStartCp + fib.ccpAtn;
|
|
7
|
+
const footnotes = readSubdocumentStories(wordDocument, table, pieceTable, context, footnoteStartCp, fib.ccpFtn, fib.fcPlcffndTxt, fib.lcbPlcffndTxt, "PlcffndTxt").map((entries, index) => ({
|
|
8
|
+
id: String(index + 1),
|
|
9
|
+
text: storyText(entries)
|
|
10
|
+
}));
|
|
11
|
+
const comments = readSubdocumentStories(wordDocument, table, pieceTable, context, commentStartCp, fib.ccpAtn, fib.fcPlcfandTxt, fib.lcbPlcfandTxt, "PlcfandTxt").map((entries, index) => ({
|
|
12
|
+
id: String(index + 1),
|
|
13
|
+
text: storyText(entries)
|
|
14
|
+
}));
|
|
15
|
+
return {
|
|
16
|
+
footnotes,
|
|
17
|
+
endnotes: readSubdocumentStories(wordDocument, table, pieceTable, context, endnoteStartCp, fib.ccpEdn, fib.fcPlcfendTxt, fib.lcbPlcfendTxt, "PlcfendTxt").map((entries, index) => ({
|
|
18
|
+
id: String(index + 1),
|
|
19
|
+
text: storyText(entries)
|
|
20
|
+
})),
|
|
21
|
+
comments
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { readNoteBodies };
|
|
@@ -19,10 +19,12 @@ interface ParagraphProperties {
|
|
|
19
19
|
listLevel?: number;
|
|
20
20
|
/** The list identifier (sprmPIlfo), present only when the paragraph is in a list at all. */
|
|
21
21
|
listId?: number;
|
|
22
|
-
/** sprmPItap's own table depth, present only when the sprm is; a value greater than 1 marks a table nested inside a table cell. */
|
|
22
|
+
/** sprmPItap's own table depth, present only when the sprm is; a value greater than 1 marks a paragraph belonging to a table nested inside a table cell. */
|
|
23
23
|
tableDepth?: number;
|
|
24
|
-
/** True
|
|
25
|
-
|
|
24
|
+
/** True on a nested table's (depth greater than 1) own cell-ending paragraph mark -- the sprmPFInnerTableCell analogue of sprmPFInTable's own cell-mark boundary at depth 1. */
|
|
25
|
+
innerTableCellMark?: boolean;
|
|
26
|
+
/** True on a nested table's (depth greater than 1) own row-ending paragraph mark -- the sprmPFInnerTtp analogue of sprmPFTtp's own row-mark boundary at depth 1. */
|
|
27
|
+
innerTtpMark?: boolean;
|
|
26
28
|
}
|
|
27
29
|
declare function applyParagraphSprms(prls: readonly Prl[], into: ParagraphProperties): ParagraphProperties;
|
|
28
30
|
//#endregion
|
|
@@ -19,10 +19,12 @@ interface ParagraphProperties {
|
|
|
19
19
|
listLevel?: number;
|
|
20
20
|
/** The list identifier (sprmPIlfo), present only when the paragraph is in a list at all. */
|
|
21
21
|
listId?: number;
|
|
22
|
-
/** sprmPItap's own table depth, present only when the sprm is; a value greater than 1 marks a table nested inside a table cell. */
|
|
22
|
+
/** sprmPItap's own table depth, present only when the sprm is; a value greater than 1 marks a paragraph belonging to a table nested inside a table cell. */
|
|
23
23
|
tableDepth?: number;
|
|
24
|
-
/** True
|
|
25
|
-
|
|
24
|
+
/** True on a nested table's (depth greater than 1) own cell-ending paragraph mark -- the sprmPFInnerTableCell analogue of sprmPFInTable's own cell-mark boundary at depth 1. */
|
|
25
|
+
innerTableCellMark?: boolean;
|
|
26
|
+
/** True on a nested table's (depth greater than 1) own row-ending paragraph mark -- the sprmPFInnerTtp analogue of sprmPFTtp's own row-mark boundary at depth 1. */
|
|
27
|
+
innerTtpMark?: boolean;
|
|
26
28
|
}
|
|
27
29
|
declare function applyParagraphSprms(prls: readonly Prl[], into: ParagraphProperties): ParagraphProperties;
|
|
28
30
|
//#endregion
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { o as PropertyBinTable } from "./fkp-I-laf-8y.cjs";
|
|
2
|
+
import { t as Prl } from "./sprm-DEyvdOo0.cjs";
|
|
3
|
+
import { t as CharacterProperties } from "./chp-BpCqpb7V.cjs";
|
|
4
|
+
import { t as ParagraphProperties } from "./pap-BQ2E17K9.cjs";
|
|
5
|
+
import { a as StyleSheet } from "./stsh-CK59x6XG.cjs";
|
|
6
|
+
import { ContentBlock } from "document-schema.js";
|
|
7
|
+
//#region src/text/paragraphs.d.ts
|
|
8
|
+
interface ReadContext {
|
|
9
|
+
readonly chpxTable: PropertyBinTable;
|
|
10
|
+
readonly papxTable: PropertyBinTable;
|
|
11
|
+
readonly styles: StyleSheet | undefined;
|
|
12
|
+
/** The font names sprmCRgFtc0's operand indexes into, or undefined when the document carries no SttbfFfn at all. */
|
|
13
|
+
readonly fonts: readonly string[] | undefined;
|
|
14
|
+
readonly characterProperties: Map<string, CharacterProperties>;
|
|
15
|
+
/** The "Data" stream's own bytes, or undefined when the container carries none -- a valid Word Binary File with no pictures need not have one at all. sprmCPicLocation's operand is an offset into this stream (pictures.ts's readInlinePicture). */
|
|
16
|
+
readonly dataStream: Uint8Array | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** One paragraph/cell/row-ending mark, still flat -- table/read.ts's assembleBlocks is what folds a run of these into a real ContentTable. `properties` and `grpprl` are carried alongside the already-built `blocks` because table grouping needs sprmPFInTable/sprmPFTtp/sprmPItap (properties) and, on a row's own mark, its table-defining sgc-5 sprms (grpprl) -- neither of which survives onto a plain ContentParagraph. `blocks` is more than one paragraph exactly when an inline picture anchor split this paragraph's own text around it (buildParagraphBlocks) -- ordinarily a single-element array holding the one ContentParagraph this mark closes. */
|
|
19
|
+
interface ParagraphEntry {
|
|
20
|
+
readonly blocks: readonly ContentBlock[];
|
|
21
|
+
readonly properties: ParagraphProperties;
|
|
22
|
+
readonly grpprl: readonly Prl[];
|
|
23
|
+
/** The character that terminated this paragraph in the text stream: PARAGRAPH_MARK, CELL_MARK, or SECTION_MARK. */
|
|
24
|
+
readonly terminator: number;
|
|
25
|
+
/** The character position immediately after this paragraph's own terminator (or, for the trailing no-mark case, the text's own length) -- comparable directly to a boundary plex's own CPs (PlcfSed.aCp, PlcffndTxt.aCp, Plcfhdd's aCp, ...) as long as `text` was itself read starting from that plex's own CP 0. read.ts's splitIntoSections and notes.ts/headers-footers.ts's own splitting use it to locate a story's real boundary. */
|
|
26
|
+
readonly endCp: number;
|
|
27
|
+
}
|
|
28
|
+
declare function readParagraphs(text: string, fcs: readonly number[], context: ReadContext): ParagraphEntry[];
|
|
29
|
+
declare function splitEntriesByBoundaries(entries: readonly ParagraphEntry[], boundaries: readonly number[]): ParagraphEntry[][];
|
|
30
|
+
//#endregion
|
|
31
|
+
export { splitEntriesByBoundaries as i, ReadContext as n, readParagraphs as r, ParagraphEntry as t };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { o as PropertyBinTable } from "./fkp-I-laf-8y.js";
|
|
2
|
+
import { t as Prl } from "./sprm-DEyvdOo0.js";
|
|
3
|
+
import { t as CharacterProperties } from "./chp-B6AOh85P.js";
|
|
4
|
+
import { t as ParagraphProperties } from "./pap-iWFIpCdo.js";
|
|
5
|
+
import { a as StyleSheet } from "./stsh-Bj0YSEOp.js";
|
|
6
|
+
import { ContentBlock } from "document-schema.js";
|
|
7
|
+
//#region src/text/paragraphs.d.ts
|
|
8
|
+
interface ReadContext {
|
|
9
|
+
readonly chpxTable: PropertyBinTable;
|
|
10
|
+
readonly papxTable: PropertyBinTable;
|
|
11
|
+
readonly styles: StyleSheet | undefined;
|
|
12
|
+
/** The font names sprmCRgFtc0's operand indexes into, or undefined when the document carries no SttbfFfn at all. */
|
|
13
|
+
readonly fonts: readonly string[] | undefined;
|
|
14
|
+
readonly characterProperties: Map<string, CharacterProperties>;
|
|
15
|
+
/** The "Data" stream's own bytes, or undefined when the container carries none -- a valid Word Binary File with no pictures need not have one at all. sprmCPicLocation's operand is an offset into this stream (pictures.ts's readInlinePicture). */
|
|
16
|
+
readonly dataStream: Uint8Array | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** One paragraph/cell/row-ending mark, still flat -- table/read.ts's assembleBlocks is what folds a run of these into a real ContentTable. `properties` and `grpprl` are carried alongside the already-built `blocks` because table grouping needs sprmPFInTable/sprmPFTtp/sprmPItap (properties) and, on a row's own mark, its table-defining sgc-5 sprms (grpprl) -- neither of which survives onto a plain ContentParagraph. `blocks` is more than one paragraph exactly when an inline picture anchor split this paragraph's own text around it (buildParagraphBlocks) -- ordinarily a single-element array holding the one ContentParagraph this mark closes. */
|
|
19
|
+
interface ParagraphEntry {
|
|
20
|
+
readonly blocks: readonly ContentBlock[];
|
|
21
|
+
readonly properties: ParagraphProperties;
|
|
22
|
+
readonly grpprl: readonly Prl[];
|
|
23
|
+
/** The character that terminated this paragraph in the text stream: PARAGRAPH_MARK, CELL_MARK, or SECTION_MARK. */
|
|
24
|
+
readonly terminator: number;
|
|
25
|
+
/** The character position immediately after this paragraph's own terminator (or, for the trailing no-mark case, the text's own length) -- comparable directly to a boundary plex's own CPs (PlcfSed.aCp, PlcffndTxt.aCp, Plcfhdd's aCp, ...) as long as `text` was itself read starting from that plex's own CP 0. read.ts's splitIntoSections and notes.ts/headers-footers.ts's own splitting use it to locate a story's real boundary. */
|
|
26
|
+
readonly endCp: number;
|
|
27
|
+
}
|
|
28
|
+
declare function readParagraphs(text: string, fcs: readonly number[], context: ReadContext): ParagraphEntry[];
|
|
29
|
+
declare function splitEntriesByBoundaries(entries: readonly ParagraphEntry[], boundaries: readonly number[]): ParagraphEntry[][];
|
|
30
|
+
//#endregion
|
|
31
|
+
export { splitEntriesByBoundaries as i, ReadContext as n, readParagraphs as r, ParagraphEntry as t };
|