docxmlater 10.1.4 → 10.1.6
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 +759 -754
- package/dist/constants/legacyCompatFlags.js +1 -1
- package/dist/constants/legacyCompatFlags.js.map +1 -1
- package/dist/constants/limits.js.map +1 -1
- package/dist/core/Document.d.ts +51 -50
- package/dist/core/Document.d.ts.map +1 -1
- package/dist/core/Document.js +486 -471
- package/dist/core/Document.js.map +1 -1
- package/dist/core/DocumentContent.d.ts +9 -9
- package/dist/core/DocumentContent.d.ts.map +1 -1
- package/dist/core/DocumentContent.js +1 -1
- package/dist/core/DocumentContent.js.map +1 -1
- package/dist/core/DocumentGenerator.d.ts +11 -11
- package/dist/core/DocumentGenerator.d.ts.map +1 -1
- package/dist/core/DocumentGenerator.js +251 -251
- package/dist/core/DocumentGenerator.js.map +1 -1
- package/dist/core/DocumentIdManager.js.map +1 -1
- package/dist/core/DocumentParser.d.ts +15 -15
- package/dist/core/DocumentParser.d.ts.map +1 -1
- package/dist/core/DocumentParser.js +2123 -2155
- package/dist/core/DocumentParser.js.map +1 -1
- package/dist/core/DocumentValidator.d.ts.map +1 -1
- package/dist/core/DocumentValidator.js +2 -5
- package/dist/core/DocumentValidator.js.map +1 -1
- package/dist/core/Relationship.js.map +1 -1
- package/dist/core/RelationshipManager.d.ts.map +1 -1
- package/dist/core/RelationshipManager.js +3 -3
- package/dist/core/RelationshipManager.js.map +1 -1
- package/dist/elements/AlternateContent.js.map +1 -1
- package/dist/elements/Bookmark.d.ts.map +1 -1
- package/dist/elements/Bookmark.js +3 -1
- package/dist/elements/Bookmark.js.map +1 -1
- package/dist/elements/BookmarkManager.d.ts.map +1 -1
- package/dist/elements/BookmarkManager.js.map +1 -1
- package/dist/elements/Comment.d.ts.map +1 -1
- package/dist/elements/Comment.js +9 -6
- package/dist/elements/Comment.js.map +1 -1
- package/dist/elements/CommentManager.d.ts.map +1 -1
- package/dist/elements/CommentManager.js +18 -17
- package/dist/elements/CommentManager.js.map +1 -1
- package/dist/elements/CommonTypes.d.ts +21 -21
- package/dist/elements/CommonTypes.d.ts.map +1 -1
- package/dist/elements/CommonTypes.js +56 -56
- package/dist/elements/CommonTypes.js.map +1 -1
- package/dist/elements/CustomXml.js.map +1 -1
- package/dist/elements/Endnote.d.ts.map +1 -1
- package/dist/elements/Endnote.js +6 -6
- package/dist/elements/Endnote.js.map +1 -1
- package/dist/elements/EndnoteManager.d.ts.map +1 -1
- package/dist/elements/EndnoteManager.js +6 -7
- package/dist/elements/EndnoteManager.js.map +1 -1
- package/dist/elements/Field.d.ts.map +1 -1
- package/dist/elements/Field.js +82 -25
- package/dist/elements/Field.js.map +1 -1
- package/dist/elements/FieldHelpers.d.ts.map +1 -1
- package/dist/elements/FieldHelpers.js.map +1 -1
- package/dist/elements/FontManager.d.ts.map +1 -1
- package/dist/elements/FontManager.js +1 -1
- package/dist/elements/FontManager.js.map +1 -1
- package/dist/elements/Footer.js +2 -2
- package/dist/elements/Footer.js.map +1 -1
- package/dist/elements/Footnote.d.ts.map +1 -1
- package/dist/elements/Footnote.js +6 -6
- package/dist/elements/Footnote.js.map +1 -1
- package/dist/elements/FootnoteManager.d.ts.map +1 -1
- package/dist/elements/FootnoteManager.js +6 -7
- package/dist/elements/FootnoteManager.js.map +1 -1
- package/dist/elements/Header.js +2 -2
- package/dist/elements/Header.js.map +1 -1
- package/dist/elements/HeaderFooterManager.js.map +1 -1
- package/dist/elements/Hyperlink.d.ts +5 -3
- package/dist/elements/Hyperlink.d.ts.map +1 -1
- package/dist/elements/Hyperlink.js +134 -76
- package/dist/elements/Hyperlink.js.map +1 -1
- package/dist/elements/Image.d.ts.map +1 -1
- package/dist/elements/Image.js +238 -106
- package/dist/elements/Image.js.map +1 -1
- package/dist/elements/ImageManager.d.ts.map +1 -1
- package/dist/elements/ImageManager.js +1 -1
- package/dist/elements/ImageManager.js.map +1 -1
- package/dist/elements/ImageRun.js +1 -1
- package/dist/elements/ImageRun.js.map +1 -1
- package/dist/elements/MathElement.js.map +1 -1
- package/dist/elements/Paragraph.d.ts +24 -24
- package/dist/elements/Paragraph.d.ts.map +1 -1
- package/dist/elements/Paragraph.js +181 -188
- package/dist/elements/Paragraph.js.map +1 -1
- package/dist/elements/PreservedElement.js.map +1 -1
- package/dist/elements/PropertyChangeTypes.d.ts.map +1 -1
- package/dist/elements/PropertyChangeTypes.js +6 -6
- package/dist/elements/PropertyChangeTypes.js.map +1 -1
- package/dist/elements/RangeMarker.d.ts.map +1 -1
- package/dist/elements/RangeMarker.js.map +1 -1
- package/dist/elements/Revision.d.ts.map +1 -1
- package/dist/elements/Revision.js +4 -5
- package/dist/elements/Revision.js.map +1 -1
- package/dist/elements/RevisionContent.js.map +1 -1
- package/dist/elements/RevisionManager.d.ts.map +1 -1
- package/dist/elements/RevisionManager.js +40 -48
- package/dist/elements/RevisionManager.js.map +1 -1
- package/dist/elements/Run.d.ts +16 -16
- package/dist/elements/Run.d.ts.map +1 -1
- package/dist/elements/Run.js +256 -238
- package/dist/elements/Run.js.map +1 -1
- package/dist/elements/Section.d.ts.map +1 -1
- package/dist/elements/Section.js +36 -11
- package/dist/elements/Section.js.map +1 -1
- package/dist/elements/Shape.d.ts.map +1 -1
- package/dist/elements/Shape.js.map +1 -1
- package/dist/elements/StructuredDocumentTag.d.ts +6 -6
- package/dist/elements/StructuredDocumentTag.d.ts.map +1 -1
- package/dist/elements/StructuredDocumentTag.js +99 -104
- package/dist/elements/StructuredDocumentTag.js.map +1 -1
- package/dist/elements/Table.d.ts +11 -11
- package/dist/elements/Table.d.ts.map +1 -1
- package/dist/elements/Table.js +102 -107
- package/dist/elements/Table.js.map +1 -1
- package/dist/elements/TableCell.d.ts +10 -10
- package/dist/elements/TableCell.d.ts.map +1 -1
- package/dist/elements/TableCell.js +105 -106
- package/dist/elements/TableCell.js.map +1 -1
- package/dist/elements/TableGridChange.d.ts.map +1 -1
- package/dist/elements/TableGridChange.js.map +1 -1
- package/dist/elements/TableOfContents.d.ts.map +1 -1
- package/dist/elements/TableOfContents.js +4 -4
- package/dist/elements/TableOfContents.js.map +1 -1
- package/dist/elements/TableOfContentsElement.js.map +1 -1
- package/dist/elements/TableRow.d.ts.map +1 -1
- package/dist/elements/TableRow.js +13 -6
- package/dist/elements/TableRow.js.map +1 -1
- package/dist/elements/TextBox.d.ts.map +1 -1
- package/dist/elements/TextBox.js +3 -5
- package/dist/elements/TextBox.js.map +1 -1
- package/dist/formatting/AbstractNumbering.d.ts +4 -4
- package/dist/formatting/AbstractNumbering.d.ts.map +1 -1
- package/dist/formatting/AbstractNumbering.js +54 -49
- package/dist/formatting/AbstractNumbering.js.map +1 -1
- package/dist/formatting/NumberingInstance.d.ts.map +1 -1
- package/dist/formatting/NumberingInstance.js +1 -3
- package/dist/formatting/NumberingInstance.js.map +1 -1
- package/dist/formatting/NumberingLevel.d.ts +5 -5
- package/dist/formatting/NumberingLevel.d.ts.map +1 -1
- package/dist/formatting/NumberingLevel.js +119 -125
- package/dist/formatting/NumberingLevel.js.map +1 -1
- package/dist/formatting/NumberingManager.d.ts +1 -0
- package/dist/formatting/NumberingManager.d.ts.map +1 -1
- package/dist/formatting/NumberingManager.js +27 -9
- package/dist/formatting/NumberingManager.js.map +1 -1
- package/dist/formatting/Style.d.ts +11 -11
- package/dist/formatting/Style.d.ts.map +1 -1
- package/dist/formatting/Style.js +219 -247
- package/dist/formatting/Style.js.map +1 -1
- package/dist/formatting/StylesManager.d.ts +2 -2
- package/dist/formatting/StylesManager.d.ts.map +1 -1
- package/dist/formatting/StylesManager.js +96 -102
- package/dist/formatting/StylesManager.js.map +1 -1
- package/dist/helpers/CleanupHelper.d.ts +1 -1
- package/dist/helpers/CleanupHelper.d.ts.map +1 -1
- package/dist/helpers/CleanupHelper.js +6 -6
- package/dist/helpers/CleanupHelper.js.map +1 -1
- package/dist/images/ImageOptimizer.js +7 -7
- package/dist/images/ImageOptimizer.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/managers/DrawingManager.js.map +1 -1
- package/dist/tracking/DocumentTrackingContext.d.ts.map +1 -1
- package/dist/tracking/DocumentTrackingContext.js +23 -7
- package/dist/tracking/DocumentTrackingContext.js.map +1 -1
- package/dist/tracking/TrackingContext.d.ts.map +1 -1
- package/dist/tracking/TrackingContext.js.map +1 -1
- package/dist/types/compatibility-types.js.map +1 -1
- package/dist/types/formatting.js.map +1 -1
- package/dist/types/list-types.d.ts +6 -6
- package/dist/types/list-types.js.map +1 -1
- package/dist/types/settings-types.js.map +1 -1
- package/dist/types/styleConfig.d.ts +2 -2
- package/dist/types/styleConfig.js.map +1 -1
- package/dist/utils/ChangelogGenerator.d.ts.map +1 -1
- package/dist/utils/ChangelogGenerator.js +97 -101
- package/dist/utils/ChangelogGenerator.js.map +1 -1
- package/dist/utils/CompatibilityUpgrader.d.ts.map +1 -1
- package/dist/utils/CompatibilityUpgrader.js +1 -1
- package/dist/utils/CompatibilityUpgrader.js.map +1 -1
- package/dist/utils/InMemoryRevisionAcceptor.d.ts.map +1 -1
- package/dist/utils/InMemoryRevisionAcceptor.js +1 -6
- package/dist/utils/InMemoryRevisionAcceptor.js.map +1 -1
- package/dist/utils/MoveOperationHelper.d.ts.map +1 -1
- package/dist/utils/MoveOperationHelper.js +1 -1
- package/dist/utils/MoveOperationHelper.js.map +1 -1
- package/dist/utils/RevisionAwareProcessor.d.ts.map +1 -1
- package/dist/utils/RevisionAwareProcessor.js +2 -4
- package/dist/utils/RevisionAwareProcessor.js.map +1 -1
- package/dist/utils/RevisionWalker.d.ts.map +1 -1
- package/dist/utils/RevisionWalker.js +4 -12
- package/dist/utils/RevisionWalker.js.map +1 -1
- package/dist/utils/SelectiveRevisionAcceptor.d.ts.map +1 -1
- package/dist/utils/SelectiveRevisionAcceptor.js +2 -6
- package/dist/utils/SelectiveRevisionAcceptor.js.map +1 -1
- package/dist/utils/ShadingResolver.d.ts.map +1 -1
- package/dist/utils/ShadingResolver.js +1 -1
- package/dist/utils/ShadingResolver.js.map +1 -1
- package/dist/utils/acceptRevisions.d.ts.map +1 -1
- package/dist/utils/acceptRevisions.js +23 -12
- package/dist/utils/acceptRevisions.js.map +1 -1
- package/dist/utils/cnfStyleDecoder.d.ts +1 -1
- package/dist/utils/cnfStyleDecoder.d.ts.map +1 -1
- package/dist/utils/cnfStyleDecoder.js +40 -40
- package/dist/utils/cnfStyleDecoder.js.map +1 -1
- package/dist/utils/corruptionDetection.d.ts.map +1 -1
- package/dist/utils/corruptionDetection.js.map +1 -1
- package/dist/utils/dateFormatting.js.map +1 -1
- package/dist/utils/deepClone.js +1 -1
- package/dist/utils/deepClone.js.map +1 -1
- package/dist/utils/diagnostics.d.ts.map +1 -1
- package/dist/utils/diagnostics.js +1 -1
- package/dist/utils/diagnostics.js.map +1 -1
- package/dist/utils/errorHandling.js.map +1 -1
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +10 -2
- package/dist/utils/formatting.js.map +1 -1
- package/dist/utils/list-detection.d.ts +2 -2
- package/dist/utils/list-detection.d.ts.map +1 -1
- package/dist/utils/list-detection.js +21 -23
- package/dist/utils/list-detection.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +12 -7
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/parsingHelpers.js.map +1 -1
- package/dist/utils/stripTrackedChanges.d.ts.map +1 -1
- package/dist/utils/stripTrackedChanges.js +3 -3
- package/dist/utils/stripTrackedChanges.js.map +1 -1
- package/dist/utils/textDiff.d.ts +1 -1
- package/dist/utils/textDiff.js +8 -8
- package/dist/utils/textDiff.js.map +1 -1
- package/dist/utils/units.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +24 -7
- package/dist/utils/validation.js.map +1 -1
- package/dist/utils/xmlSanitization.d.ts.map +1 -1
- package/dist/utils/xmlSanitization.js +3 -3
- package/dist/utils/xmlSanitization.js.map +1 -1
- package/dist/validation/RevisionAutoFixer.d.ts.map +1 -1
- package/dist/validation/RevisionAutoFixer.js +5 -5
- package/dist/validation/RevisionAutoFixer.js.map +1 -1
- package/dist/validation/RevisionValidator.d.ts.map +1 -1
- package/dist/validation/RevisionValidator.js +7 -9
- package/dist/validation/RevisionValidator.js.map +1 -1
- package/dist/validation/ValidationRules.js +3 -3
- package/dist/validation/ValidationRules.js.map +1 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/xml/XMLBuilder.d.ts +1 -1
- package/dist/xml/XMLBuilder.d.ts.map +1 -1
- package/dist/xml/XMLBuilder.js +98 -100
- package/dist/xml/XMLBuilder.js.map +1 -1
- package/dist/xml/XMLParser.d.ts.map +1 -1
- package/dist/xml/XMLParser.js +61 -66
- package/dist/xml/XMLParser.js.map +1 -1
- package/dist/zip/ZipHandler.d.ts.map +1 -1
- package/dist/zip/ZipHandler.js.map +1 -1
- package/dist/zip/ZipReader.d.ts.map +1 -1
- package/dist/zip/ZipReader.js +1 -3
- package/dist/zip/ZipReader.js.map +1 -1
- package/dist/zip/ZipWriter.d.ts +1 -1
- package/dist/zip/ZipWriter.d.ts.map +1 -1
- package/dist/zip/ZipWriter.js +28 -36
- package/dist/zip/ZipWriter.js.map +1 -1
- package/dist/zip/types.js +1 -1
- package/dist/zip/types.js.map +1 -1
- package/package.json +92 -92
- package/src/__tests__/helper-methods.test.ts +512 -512
- package/src/constants/legacyCompatFlags.ts +138 -138
- package/src/constants/limits.ts +50 -50
- package/src/core/Document.ts +1010 -1145
- package/src/core/DocumentContent.ts +461 -467
- package/src/core/DocumentGenerator.ts +1133 -1104
- package/src/core/DocumentIdManager.ts +158 -158
- package/src/core/DocumentParser.ts +2347 -2716
- package/src/core/DocumentValidator.ts +363 -372
- package/src/core/Relationship.ts +367 -367
- package/src/core/RelationshipManager.ts +429 -428
- package/src/elements/AlternateContent.ts +42 -42
- package/src/elements/Bookmark.ts +212 -210
- package/src/elements/BookmarkManager.ts +247 -250
- package/src/elements/Comment.ts +356 -359
- package/src/elements/CommentManager.ts +499 -502
- package/src/elements/CommonTypes.ts +524 -549
- package/src/elements/CustomXml.ts +36 -36
- package/src/elements/Endnote.ts +221 -217
- package/src/elements/EndnoteManager.ts +246 -249
- package/src/elements/Field.ts +1292 -1233
- package/src/elements/FieldHelpers.ts +329 -333
- package/src/elements/FontManager.ts +336 -339
- package/src/elements/Footer.ts +269 -269
- package/src/elements/Footnote.ts +221 -217
- package/src/elements/FootnoteManager.ts +246 -249
- package/src/elements/Header.ts +269 -269
- package/src/elements/HeaderFooterManager.ts +219 -219
- package/src/elements/Hyperlink.ts +1288 -1193
- package/src/elements/Image.ts +1982 -1756
- package/src/elements/ImageManager.ts +437 -432
- package/src/elements/ImageRun.ts +59 -59
- package/src/elements/MathElement.ts +65 -65
- package/src/elements/Paragraph.ts +4347 -4287
- package/src/elements/PreservedElement.ts +53 -53
- package/src/elements/PropertyChangeTypes.ts +458 -442
- package/src/elements/RangeMarker.ts +382 -400
- package/src/elements/Revision.ts +1198 -1217
- package/src/elements/RevisionContent.ts +73 -73
- package/src/elements/RevisionManager.ts +1070 -1070
- package/src/elements/Run.ts +3103 -3073
- package/src/elements/Section.ts +1521 -1421
- package/src/elements/Shape.ts +884 -873
- package/src/elements/StructuredDocumentTag.ts +1176 -1207
- package/src/elements/Table.ts +2468 -2524
- package/src/elements/TableCell.ts +1617 -1621
- package/src/elements/TableGridChange.ts +149 -151
- package/src/elements/TableOfContents.ts +701 -691
- package/src/elements/TableOfContentsElement.ts +89 -89
- package/src/elements/TableRow.ts +960 -929
- package/src/elements/TextBox.ts +766 -768
- package/src/formatting/AbstractNumbering.ts +580 -579
- package/src/formatting/NumberingInstance.ts +295 -299
- package/src/formatting/NumberingLevel.ts +981 -1040
- package/src/formatting/NumberingManager.ts +875 -827
- package/src/formatting/Style.ts +1785 -1879
- package/src/formatting/StylesManager.ts +1090 -1130
- package/src/helpers/CleanupHelper.ts +524 -524
- package/src/images/ImageOptimizer.ts +274 -274
- package/src/index.ts +559 -554
- package/src/managers/DrawingManager.ts +319 -319
- package/src/tracking/DocumentTrackingContext.ts +687 -674
- package/src/tracking/TrackingContext.ts +175 -173
- package/src/types/compatibility-types.ts +49 -49
- package/src/types/formatting.ts +210 -210
- package/src/types/list-types.ts +14 -14
- package/src/types/settings-types.ts +59 -59
- package/src/types/styleConfig.ts +189 -189
- package/src/utils/ChangelogGenerator.ts +1583 -1581
- package/src/utils/CompatibilityUpgrader.ts +235 -237
- package/src/utils/InMemoryRevisionAcceptor.ts +691 -696
- package/src/utils/MoveOperationHelper.ts +233 -238
- package/src/utils/RevisionAwareProcessor.ts +518 -526
- package/src/utils/RevisionWalker.ts +427 -457
- package/src/utils/SelectiveRevisionAcceptor.ts +662 -683
- package/src/utils/ShadingResolver.ts +105 -107
- package/src/utils/acceptRevisions.ts +723 -714
- package/src/utils/cnfStyleDecoder.ts +212 -217
- package/src/utils/corruptionDetection.ts +346 -345
- package/src/utils/dateFormatting.ts +20 -20
- package/src/utils/deepClone.ts +77 -78
- package/src/utils/diagnostics.ts +125 -129
- package/src/utils/errorHandling.ts +80 -80
- package/src/utils/formatting.ts +220 -213
- package/src/utils/list-detection.ts +32 -42
- package/src/utils/logger.ts +412 -404
- package/src/utils/parsingHelpers.ts +190 -190
- package/src/utils/stripTrackedChanges.ts +356 -353
- package/src/utils/textDiff.ts +100 -100
- package/src/utils/units.ts +421 -421
- package/src/utils/validation.ts +553 -542
- package/src/utils/xmlSanitization.ts +179 -182
- package/src/validation/RevisionAutoFixer.ts +541 -542
- package/src/validation/RevisionValidator.ts +470 -460
- package/src/validation/ValidationRules.ts +338 -338
- package/src/validation/index.ts +30 -30
- package/src/xml/XMLBuilder.ts +857 -871
- package/src/xml/XMLParser.ts +877 -919
- package/src/zip/ZipHandler.ts +629 -637
- package/src/zip/ZipReader.ts +295 -299
- package/src/zip/ZipWriter.ts +374 -390
- package/src/zip/types.ts +116 -116
|
@@ -1,549 +1,524 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CommonTypes - Consolidated type definitions for docxmlater elements
|
|
3
|
-
*
|
|
4
|
-
* This file consolidates duplicate type definitions that were scattered across multiple
|
|
5
|
-
* element files (Paragraph.ts, Run.ts, Table.ts, TableCell.ts, TableRow.ts, Image.ts, Section.ts).
|
|
6
|
-
*
|
|
7
|
-
* Benefits:
|
|
8
|
-
* - Single source of truth for shared types
|
|
9
|
-
* - Consistent type definitions across all elements
|
|
10
|
-
* - Easier maintenance and updates
|
|
11
|
-
* - Better type safety when passing values between elements
|
|
12
|
-
*
|
|
13
|
-
* @module CommonTypes
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
// ============================================================================
|
|
17
|
-
// SHADING PATTERNS
|
|
18
|
-
// ============================================================================
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Shading pattern types per ECMA-376 Part 1 Section 17.18.78 (ST_Shd)
|
|
22
|
-
*
|
|
23
|
-
* Consolidated from: Paragraph.ts, Run.ts, TableRow.ts, TableCell.ts
|
|
24
|
-
* This is the complete set of shading patterns supported by Word.
|
|
25
|
-
*/
|
|
26
|
-
export type ShadingPattern =
|
|
27
|
-
// Solid patterns
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
// Stripe patterns
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
// Cross patterns
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
// Thin stripe patterns
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
// Thin cross patterns
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
// Percentage fill patterns (5% increments with some extras)
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Basic shading patterns (without percentage fills)
|
|
74
|
-
* Use this for contexts where percentage patterns are not needed
|
|
75
|
-
*/
|
|
76
|
-
export type BasicShadingPattern =
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
// ============================================================================
|
|
93
|
-
// BORDER STYLES
|
|
94
|
-
// ============================================================================
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Basic border styles per ECMA-376 Part 1 Section 17.18.2 (ST_Border)
|
|
98
|
-
*
|
|
99
|
-
* Consolidated from: Paragraph.ts, TableCell.ts, Table.ts
|
|
100
|
-
* This covers the most commonly used border styles.
|
|
101
|
-
*/
|
|
102
|
-
export type BorderStyle =
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Extended border styles including decorative effects
|
|
112
|
-
*
|
|
113
|
-
* Consolidated from: Run.ts (TextBorderStyle)
|
|
114
|
-
* Includes 3D effects and other decorative styles.
|
|
115
|
-
*/
|
|
116
|
-
export type ExtendedBorderStyle =
|
|
117
|
-
| BorderStyle
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Full border style set per ECMA-376
|
|
125
|
-
* Includes all possible border values from the spec.
|
|
126
|
-
*/
|
|
127
|
-
export type FullBorderStyle =
|
|
128
|
-
| ExtendedBorderStyle
|
|
129
|
-
|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Generic border definition interface
|
|
148
|
-
*
|
|
149
|
-
* Consolidated from: Paragraph.ts (BorderDefinition), Run.ts (TextBorder),
|
|
150
|
-
* TableCell.ts (CellBorder), Table.ts (TableBorder)
|
|
151
|
-
*/
|
|
152
|
-
export interface BorderDefinition {
|
|
153
|
-
/** Border style */
|
|
154
|
-
style?: BorderStyle | ExtendedBorderStyle;
|
|
155
|
-
/** Border width in eighths of a point (1-96) */
|
|
156
|
-
size?: number;
|
|
157
|
-
/** Border color in hex format (without #) */
|
|
158
|
-
color?: string;
|
|
159
|
-
/** Space between border and content in points (0-31) */
|
|
160
|
-
space?: number;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Four-sided border definitions
|
|
165
|
-
*/
|
|
166
|
-
export interface FourSidedBorders {
|
|
167
|
-
top?: BorderDefinition;
|
|
168
|
-
bottom?: BorderDefinition;
|
|
169
|
-
left?: BorderDefinition;
|
|
170
|
-
right?: BorderDefinition;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Table border definitions (includes inside borders)
|
|
175
|
-
*/
|
|
176
|
-
export interface TableBorderDefinitions extends FourSidedBorders {
|
|
177
|
-
/** Inside horizontal borders (between rows) */
|
|
178
|
-
insideH?: BorderDefinition;
|
|
179
|
-
/** Inside vertical borders (between columns) */
|
|
180
|
-
insideV?: BorderDefinition;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ============================================================================
|
|
184
|
-
// ALIGNMENT TYPES
|
|
185
|
-
// ============================================================================
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Horizontal alignment for general use
|
|
189
|
-
*
|
|
190
|
-
* Consolidated from: Image.ts, Table.ts (TableHorizontalAlignment)
|
|
191
|
-
*/
|
|
192
|
-
export type HorizontalAlignment =
|
|
193
|
-
|
|
|
194
|
-
|
|
|
195
|
-
|
|
|
196
|
-
|
|
|
197
|
-
|
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Vertical alignment for general use
|
|
201
|
-
*
|
|
202
|
-
* Consolidated from: Image.ts, Table.ts (TableVerticalAlignment)
|
|
203
|
-
*/
|
|
204
|
-
export type VerticalAlignment =
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Vertical alignment for page content (Section-level)
|
|
213
|
-
*
|
|
214
|
-
* From: Section.ts - includes 'both' for justified vertical alignment
|
|
215
|
-
*/
|
|
216
|
-
export type PageVerticalAlignment =
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Vertical alignment for table cells
|
|
220
|
-
*
|
|
221
|
-
* From: TableCell.ts (CellVerticalAlignment)
|
|
222
|
-
*/
|
|
223
|
-
export type CellVerticalAlignment =
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Paragraph text alignment
|
|
227
|
-
*
|
|
228
|
-
* From: Paragraph.ts (ParagraphAlignment)
|
|
229
|
-
* Note: 'both' is an alias for 'justify' in some contexts
|
|
230
|
-
*/
|
|
231
|
-
export type ParagraphAlignment =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
*
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
*
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
//
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
*
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
*/
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
];
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
*
|
|
495
|
-
*/
|
|
496
|
-
export
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
// SHADING UTILITIES
|
|
526
|
-
// ============================================================================
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Builds XML attributes for a w:shd element from a ShadingConfig.
|
|
530
|
-
* Shared across all element types for consistent shading generation.
|
|
531
|
-
*/
|
|
532
|
-
export function buildShadingAttributes(
|
|
533
|
-
shading: ShadingConfig
|
|
534
|
-
): Record<string, string> {
|
|
535
|
-
const attrs: Record<string, string> = {};
|
|
536
|
-
// w:val is REQUIRED per ECMA-376 — default to "clear" if no pattern specified
|
|
537
|
-
attrs["w:val"] = shading.pattern || "clear";
|
|
538
|
-
if (shading.fill) attrs["w:fill"] = shading.fill;
|
|
539
|
-
if (shading.color) attrs["w:color"] = shading.color;
|
|
540
|
-
if (shading.themeFill) attrs["w:themeFill"] = shading.themeFill;
|
|
541
|
-
if (shading.themeColor) attrs["w:themeColor"] = shading.themeColor;
|
|
542
|
-
if (shading.themeFillTint)
|
|
543
|
-
attrs["w:themeFillTint"] = shading.themeFillTint;
|
|
544
|
-
if (shading.themeFillShade)
|
|
545
|
-
attrs["w:themeFillShade"] = shading.themeFillShade;
|
|
546
|
-
if (shading.themeTint) attrs["w:themeTint"] = shading.themeTint;
|
|
547
|
-
if (shading.themeShade) attrs["w:themeShade"] = shading.themeShade;
|
|
548
|
-
return attrs;
|
|
549
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* CommonTypes - Consolidated type definitions for docxmlater elements
|
|
3
|
+
*
|
|
4
|
+
* This file consolidates duplicate type definitions that were scattered across multiple
|
|
5
|
+
* element files (Paragraph.ts, Run.ts, Table.ts, TableCell.ts, TableRow.ts, Image.ts, Section.ts).
|
|
6
|
+
*
|
|
7
|
+
* Benefits:
|
|
8
|
+
* - Single source of truth for shared types
|
|
9
|
+
* - Consistent type definitions across all elements
|
|
10
|
+
* - Easier maintenance and updates
|
|
11
|
+
* - Better type safety when passing values between elements
|
|
12
|
+
*
|
|
13
|
+
* @module CommonTypes
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// SHADING PATTERNS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Shading pattern types per ECMA-376 Part 1 Section 17.18.78 (ST_Shd)
|
|
22
|
+
*
|
|
23
|
+
* Consolidated from: Paragraph.ts, Run.ts, TableRow.ts, TableCell.ts
|
|
24
|
+
* This is the complete set of shading patterns supported by Word.
|
|
25
|
+
*/
|
|
26
|
+
export type ShadingPattern =
|
|
27
|
+
// Solid patterns
|
|
28
|
+
| 'clear' // No pattern (transparent)
|
|
29
|
+
| 'solid' // Solid fill
|
|
30
|
+
// Stripe patterns
|
|
31
|
+
| 'horzStripe' // Horizontal stripes
|
|
32
|
+
| 'vertStripe' // Vertical stripes
|
|
33
|
+
| 'reverseDiagStripe' // Reverse diagonal stripes (/)
|
|
34
|
+
| 'diagStripe' // Diagonal stripes (\)
|
|
35
|
+
// Cross patterns
|
|
36
|
+
| 'horzCross' // Horizontal cross-hatch
|
|
37
|
+
| 'diagCross' // Diagonal cross-hatch
|
|
38
|
+
// Thin stripe patterns
|
|
39
|
+
| 'thinHorzStripe' // Thin horizontal stripes
|
|
40
|
+
| 'thinVertStripe' // Thin vertical stripes
|
|
41
|
+
| 'thinReverseDiagStripe' // Thin reverse diagonal stripes
|
|
42
|
+
| 'thinDiagStripe' // Thin diagonal stripes
|
|
43
|
+
// Thin cross patterns
|
|
44
|
+
| 'thinHorzCross' // Thin horizontal cross-hatch
|
|
45
|
+
| 'thinDiagCross' // Thin diagonal cross-hatch
|
|
46
|
+
// Percentage fill patterns (5% increments with some extras)
|
|
47
|
+
| 'pct5'
|
|
48
|
+
| 'pct10'
|
|
49
|
+
| 'pct12'
|
|
50
|
+
| 'pct15'
|
|
51
|
+
| 'pct20'
|
|
52
|
+
| 'pct25'
|
|
53
|
+
| 'pct30'
|
|
54
|
+
| 'pct35'
|
|
55
|
+
| 'pct37'
|
|
56
|
+
| 'pct40'
|
|
57
|
+
| 'pct45'
|
|
58
|
+
| 'pct50'
|
|
59
|
+
| 'pct55'
|
|
60
|
+
| 'pct60'
|
|
61
|
+
| 'pct62'
|
|
62
|
+
| 'pct65'
|
|
63
|
+
| 'pct70'
|
|
64
|
+
| 'pct75'
|
|
65
|
+
| 'pct80'
|
|
66
|
+
| 'pct85'
|
|
67
|
+
| 'pct87'
|
|
68
|
+
| 'pct90'
|
|
69
|
+
| 'pct95'
|
|
70
|
+
| 'nil'; // Explicitly clear inherited shading (ECMA-376 §17.18.78)
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Basic shading patterns (without percentage fills)
|
|
74
|
+
* Use this for contexts where percentage patterns are not needed
|
|
75
|
+
*/
|
|
76
|
+
export type BasicShadingPattern =
|
|
77
|
+
| 'clear'
|
|
78
|
+
| 'solid'
|
|
79
|
+
| 'horzStripe'
|
|
80
|
+
| 'vertStripe'
|
|
81
|
+
| 'reverseDiagStripe'
|
|
82
|
+
| 'diagStripe'
|
|
83
|
+
| 'horzCross'
|
|
84
|
+
| 'diagCross'
|
|
85
|
+
| 'thinHorzStripe'
|
|
86
|
+
| 'thinVertStripe'
|
|
87
|
+
| 'thinReverseDiagStripe'
|
|
88
|
+
| 'thinDiagStripe'
|
|
89
|
+
| 'thinHorzCross'
|
|
90
|
+
| 'thinDiagCross';
|
|
91
|
+
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// BORDER STYLES
|
|
94
|
+
// ============================================================================
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Basic border styles per ECMA-376 Part 1 Section 17.18.2 (ST_Border)
|
|
98
|
+
*
|
|
99
|
+
* Consolidated from: Paragraph.ts, TableCell.ts, Table.ts
|
|
100
|
+
* This covers the most commonly used border styles.
|
|
101
|
+
*/
|
|
102
|
+
export type BorderStyle =
|
|
103
|
+
| 'none' // No border
|
|
104
|
+
| 'single' // Single line
|
|
105
|
+
| 'double' // Double line
|
|
106
|
+
| 'dashed' // Dashed line
|
|
107
|
+
| 'dotted' // Dotted line
|
|
108
|
+
| 'thick'; // Thick single line
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Extended border styles including decorative effects
|
|
112
|
+
*
|
|
113
|
+
* Consolidated from: Run.ts (TextBorderStyle)
|
|
114
|
+
* Includes 3D effects and other decorative styles.
|
|
115
|
+
*/
|
|
116
|
+
export type ExtendedBorderStyle =
|
|
117
|
+
| BorderStyle
|
|
118
|
+
| 'wave' // Wavy line
|
|
119
|
+
| 'dashDotStroked' // Dash-dot stroked
|
|
120
|
+
| 'threeDEmboss' // 3D embossed effect
|
|
121
|
+
| 'threeDEngrave'; // 3D engraved effect
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Full border style set per ECMA-376
|
|
125
|
+
* Includes all possible border values from the spec.
|
|
126
|
+
*/
|
|
127
|
+
export type FullBorderStyle =
|
|
128
|
+
| ExtendedBorderStyle
|
|
129
|
+
| 'dotDash' // Dot-dash pattern
|
|
130
|
+
| 'dotDotDash' // Dot-dot-dash pattern
|
|
131
|
+
| 'triple' // Triple line
|
|
132
|
+
| 'thinThickSmallGap'
|
|
133
|
+
| 'thickThinSmallGap'
|
|
134
|
+
| 'thinThickThinSmallGap'
|
|
135
|
+
| 'thinThickMediumGap'
|
|
136
|
+
| 'thickThinMediumGap'
|
|
137
|
+
| 'thinThickThinMediumGap'
|
|
138
|
+
| 'thinThickLargeGap'
|
|
139
|
+
| 'thickThinLargeGap'
|
|
140
|
+
| 'thinThickThinLargeGap'
|
|
141
|
+
| 'dashSmallGap'
|
|
142
|
+
| 'dashDotStroked'
|
|
143
|
+
| 'outset'
|
|
144
|
+
| 'inset';
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Generic border definition interface
|
|
148
|
+
*
|
|
149
|
+
* Consolidated from: Paragraph.ts (BorderDefinition), Run.ts (TextBorder),
|
|
150
|
+
* TableCell.ts (CellBorder), Table.ts (TableBorder)
|
|
151
|
+
*/
|
|
152
|
+
export interface BorderDefinition {
|
|
153
|
+
/** Border style */
|
|
154
|
+
style?: BorderStyle | ExtendedBorderStyle;
|
|
155
|
+
/** Border width in eighths of a point (1-96) */
|
|
156
|
+
size?: number;
|
|
157
|
+
/** Border color in hex format (without #) */
|
|
158
|
+
color?: string;
|
|
159
|
+
/** Space between border and content in points (0-31) */
|
|
160
|
+
space?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Four-sided border definitions
|
|
165
|
+
*/
|
|
166
|
+
export interface FourSidedBorders {
|
|
167
|
+
top?: BorderDefinition;
|
|
168
|
+
bottom?: BorderDefinition;
|
|
169
|
+
left?: BorderDefinition;
|
|
170
|
+
right?: BorderDefinition;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Table border definitions (includes inside borders)
|
|
175
|
+
*/
|
|
176
|
+
export interface TableBorderDefinitions extends FourSidedBorders {
|
|
177
|
+
/** Inside horizontal borders (between rows) */
|
|
178
|
+
insideH?: BorderDefinition;
|
|
179
|
+
/** Inside vertical borders (between columns) */
|
|
180
|
+
insideV?: BorderDefinition;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ============================================================================
|
|
184
|
+
// ALIGNMENT TYPES
|
|
185
|
+
// ============================================================================
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Horizontal alignment for general use
|
|
189
|
+
*
|
|
190
|
+
* Consolidated from: Image.ts, Table.ts (TableHorizontalAlignment)
|
|
191
|
+
*/
|
|
192
|
+
export type HorizontalAlignment =
|
|
193
|
+
| 'left'
|
|
194
|
+
| 'center'
|
|
195
|
+
| 'right'
|
|
196
|
+
| 'inside' // Toward binding edge
|
|
197
|
+
| 'outside'; // Away from binding edge
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Vertical alignment for general use
|
|
201
|
+
*
|
|
202
|
+
* Consolidated from: Image.ts, Table.ts (TableVerticalAlignment)
|
|
203
|
+
*/
|
|
204
|
+
export type VerticalAlignment =
|
|
205
|
+
| 'top'
|
|
206
|
+
| 'center'
|
|
207
|
+
| 'bottom'
|
|
208
|
+
| 'inside' // Toward top of page in header
|
|
209
|
+
| 'outside'; // Toward bottom of page in footer
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Vertical alignment for page content (Section-level)
|
|
213
|
+
*
|
|
214
|
+
* From: Section.ts - includes 'both' for justified vertical alignment
|
|
215
|
+
*/
|
|
216
|
+
export type PageVerticalAlignment = 'top' | 'center' | 'bottom' | 'both';
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Vertical alignment for table cells
|
|
220
|
+
*
|
|
221
|
+
* From: TableCell.ts (CellVerticalAlignment)
|
|
222
|
+
*/
|
|
223
|
+
export type CellVerticalAlignment = 'top' | 'center' | 'bottom';
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Paragraph text alignment
|
|
227
|
+
*
|
|
228
|
+
* From: Paragraph.ts (ParagraphAlignment)
|
|
229
|
+
* Note: 'both' is an alias for 'justify' in some contexts
|
|
230
|
+
*/
|
|
231
|
+
export type ParagraphAlignment = 'left' | 'center' | 'right' | 'justify' | 'both';
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Table alignment (horizontal positioning)
|
|
235
|
+
*
|
|
236
|
+
* From: Table.ts (TableAlignment)
|
|
237
|
+
*/
|
|
238
|
+
export type TableAlignment = 'left' | 'center' | 'right';
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Row justification/alignment options
|
|
242
|
+
*
|
|
243
|
+
* From: TableRow.ts (RowJustification)
|
|
244
|
+
*/
|
|
245
|
+
export type RowJustification = 'left' | 'center' | 'right' | 'start' | 'end';
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Text vertical alignment within line/cell
|
|
249
|
+
*
|
|
250
|
+
* From: Paragraph.ts (TextAlignment)
|
|
251
|
+
*/
|
|
252
|
+
export type TextVerticalAlignment = 'top' | 'center' | 'baseline' | 'bottom' | 'auto';
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Tab stop alignment types
|
|
256
|
+
*
|
|
257
|
+
* From: Paragraph.ts (TabAlignment)
|
|
258
|
+
*/
|
|
259
|
+
export type TabAlignment =
|
|
260
|
+
| 'clear' // Remove tab stop
|
|
261
|
+
| 'left' // Left-aligned
|
|
262
|
+
| 'center' // Center-aligned
|
|
263
|
+
| 'right' // Right-aligned
|
|
264
|
+
| 'decimal' // Decimal-aligned (for numbers)
|
|
265
|
+
| 'bar' // Bar tab (vertical line)
|
|
266
|
+
| 'num'; // List number alignment
|
|
267
|
+
|
|
268
|
+
// ============================================================================
|
|
269
|
+
// POSITIONING & ANCHORING
|
|
270
|
+
// ============================================================================
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Position anchor type (what to position relative to)
|
|
274
|
+
*
|
|
275
|
+
* From: Image.ts (PositionAnchor)
|
|
276
|
+
*/
|
|
277
|
+
export type PositionAnchor = 'page' | 'margin' | 'column' | 'character' | 'paragraph';
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Horizontal anchor for floating elements
|
|
281
|
+
*
|
|
282
|
+
* From: Table.ts (TableHorizontalAnchor), Paragraph.ts (FrameProperties.hAnchor)
|
|
283
|
+
*/
|
|
284
|
+
export type HorizontalAnchor = 'text' | 'margin' | 'page';
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Vertical anchor for floating elements
|
|
288
|
+
*
|
|
289
|
+
* From: Table.ts (TableVerticalAnchor), Paragraph.ts (FrameProperties.vAnchor)
|
|
290
|
+
*/
|
|
291
|
+
export type VerticalAnchor = 'text' | 'margin' | 'page';
|
|
292
|
+
|
|
293
|
+
// ============================================================================
|
|
294
|
+
// TEXT DIRECTION
|
|
295
|
+
// ============================================================================
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Text direction for paragraphs and cells
|
|
299
|
+
*
|
|
300
|
+
* Consolidated from: Paragraph.ts, Section.ts
|
|
301
|
+
* Per ECMA-376 Part 1 Section 17.18.93 (ST_TextDirection)
|
|
302
|
+
*/
|
|
303
|
+
export type TextDirection =
|
|
304
|
+
| 'lrTb' // Left-to-right, top-to-bottom (Western default)
|
|
305
|
+
| 'tbRl' // Top-to-bottom, right-to-left (East Asian vertical)
|
|
306
|
+
| 'btLr' // Bottom-to-top, left-to-right
|
|
307
|
+
| 'lrTbV' // Left-to-right, top-to-bottom (vertical variant)
|
|
308
|
+
| 'tbRlV' // Top-to-bottom, right-to-left (vertical variant)
|
|
309
|
+
| 'tbLrV'; // Top-to-bottom, left-to-right (vertical variant)
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Simplified text direction for sections
|
|
313
|
+
*
|
|
314
|
+
* From: Section.ts
|
|
315
|
+
*/
|
|
316
|
+
export type SectionTextDirection = 'ltr' | 'rtl' | 'tbRl' | 'btLr';
|
|
317
|
+
|
|
318
|
+
// ============================================================================
|
|
319
|
+
// WIDTH TYPES
|
|
320
|
+
// ============================================================================
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Width type specification per ECMA-376
|
|
324
|
+
*
|
|
325
|
+
* Consolidated from: Table.ts, TableCell.ts
|
|
326
|
+
*/
|
|
327
|
+
export type WidthType =
|
|
328
|
+
| 'auto' // Automatically determined
|
|
329
|
+
| 'dxa' // Twips (twentieths of a point)
|
|
330
|
+
| 'pct'; // Percentage (in fiftieths of a percent)
|
|
331
|
+
|
|
332
|
+
// ============================================================================
|
|
333
|
+
// SHADING CONFIGURATION
|
|
334
|
+
// ============================================================================
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Generic shading configuration
|
|
338
|
+
*
|
|
339
|
+
* Consolidated from: Run.ts (CharacterShading), TableRow.ts (Shading), TableCell.ts (CellShading)
|
|
340
|
+
*/
|
|
341
|
+
export interface ShadingConfig {
|
|
342
|
+
/** Background fill color in hex format (without #), or "auto" to inherit from style/parent */
|
|
343
|
+
fill?: string;
|
|
344
|
+
/** Foreground/pattern color in hex format (without #), or "auto" to inherit from style/parent */
|
|
345
|
+
color?: string;
|
|
346
|
+
/** Shading pattern type (maps to w:val in XML) */
|
|
347
|
+
pattern?: ShadingPattern;
|
|
348
|
+
/** Theme fill color reference (e.g., "accent1") */
|
|
349
|
+
themeFill?: string;
|
|
350
|
+
/** Theme foreground color reference */
|
|
351
|
+
themeColor?: string;
|
|
352
|
+
/** Tint on theme fill (hex 00-FF) */
|
|
353
|
+
themeFillTint?: string;
|
|
354
|
+
/** Shade on theme fill (hex 00-FF) */
|
|
355
|
+
themeFillShade?: string;
|
|
356
|
+
/** Tint on theme color (hex 00-FF) */
|
|
357
|
+
themeTint?: string;
|
|
358
|
+
/** Shade on theme color (hex 00-FF) */
|
|
359
|
+
themeShade?: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// ============================================================================
|
|
363
|
+
// TAB STOPS
|
|
364
|
+
// ============================================================================
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Tab stop leader types
|
|
368
|
+
*
|
|
369
|
+
* From: Paragraph.ts (TabLeader)
|
|
370
|
+
*/
|
|
371
|
+
export type TabLeader =
|
|
372
|
+
| 'none' // No leader
|
|
373
|
+
| 'dot' // Dots ......
|
|
374
|
+
| 'hyphen' // Hyphens ------
|
|
375
|
+
| 'underscore' // Underscores ______
|
|
376
|
+
| 'heavy' // Heavy line
|
|
377
|
+
| 'middleDot'; // Middle dots
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Tab stop definition
|
|
381
|
+
*
|
|
382
|
+
* From: Paragraph.ts (TabStop)
|
|
383
|
+
*/
|
|
384
|
+
export interface TabStop {
|
|
385
|
+
/** Position in twips from left margin */
|
|
386
|
+
position: number;
|
|
387
|
+
/** Alignment type */
|
|
388
|
+
alignment?: TabAlignment;
|
|
389
|
+
/** Leader character type */
|
|
390
|
+
leader?: TabLeader;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// ============================================================================
|
|
394
|
+
// TYPE GUARDS
|
|
395
|
+
// ============================================================================
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Check if a value is a valid ShadingPattern
|
|
399
|
+
*/
|
|
400
|
+
export function isShadingPattern(value: string): value is ShadingPattern {
|
|
401
|
+
const patterns = [
|
|
402
|
+
'clear',
|
|
403
|
+
'solid',
|
|
404
|
+
'horzStripe',
|
|
405
|
+
'vertStripe',
|
|
406
|
+
'reverseDiagStripe',
|
|
407
|
+
'diagStripe',
|
|
408
|
+
'horzCross',
|
|
409
|
+
'diagCross',
|
|
410
|
+
'thinHorzStripe',
|
|
411
|
+
'thinVertStripe',
|
|
412
|
+
'thinReverseDiagStripe',
|
|
413
|
+
'thinDiagStripe',
|
|
414
|
+
'thinHorzCross',
|
|
415
|
+
'thinDiagCross',
|
|
416
|
+
'pct5',
|
|
417
|
+
'pct10',
|
|
418
|
+
'pct12',
|
|
419
|
+
'pct15',
|
|
420
|
+
'pct20',
|
|
421
|
+
'pct25',
|
|
422
|
+
'pct30',
|
|
423
|
+
'pct35',
|
|
424
|
+
'pct37',
|
|
425
|
+
'pct40',
|
|
426
|
+
'pct45',
|
|
427
|
+
'pct50',
|
|
428
|
+
'pct55',
|
|
429
|
+
'pct60',
|
|
430
|
+
'pct62',
|
|
431
|
+
'pct65',
|
|
432
|
+
'pct70',
|
|
433
|
+
'pct75',
|
|
434
|
+
'pct80',
|
|
435
|
+
'pct85',
|
|
436
|
+
'pct87',
|
|
437
|
+
'pct90',
|
|
438
|
+
'pct95',
|
|
439
|
+
'nil',
|
|
440
|
+
];
|
|
441
|
+
return patterns.includes(value);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Check if a value is a valid BorderStyle
|
|
446
|
+
*/
|
|
447
|
+
export function isBorderStyle(value: string): value is BorderStyle {
|
|
448
|
+
return ['none', 'single', 'double', 'dashed', 'dotted', 'thick'].includes(value);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Check if a value is a valid HorizontalAlignment
|
|
453
|
+
*/
|
|
454
|
+
export function isHorizontalAlignment(value: string): value is HorizontalAlignment {
|
|
455
|
+
return ['left', 'center', 'right', 'inside', 'outside'].includes(value);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Check if a value is a valid VerticalAlignment
|
|
460
|
+
*/
|
|
461
|
+
export function isVerticalAlignment(value: string): value is VerticalAlignment {
|
|
462
|
+
return ['top', 'center', 'bottom', 'inside', 'outside'].includes(value);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Check if a value is a valid ParagraphAlignment
|
|
467
|
+
*/
|
|
468
|
+
export function isParagraphAlignment(value: string): value is ParagraphAlignment {
|
|
469
|
+
return ['left', 'center', 'right', 'justify', 'both'].includes(value);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Check if a value is a valid WidthType
|
|
474
|
+
*/
|
|
475
|
+
export function isWidthType(value: string): value is WidthType {
|
|
476
|
+
return ['auto', 'dxa', 'pct'].includes(value);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// ============================================================================
|
|
480
|
+
// CONSTANTS
|
|
481
|
+
// ============================================================================
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Default border definition
|
|
485
|
+
*/
|
|
486
|
+
export const DEFAULT_BORDER: BorderDefinition = {
|
|
487
|
+
style: 'single',
|
|
488
|
+
size: 4, // 0.5pt (4 eighths)
|
|
489
|
+
color: '000000',
|
|
490
|
+
space: 0,
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* No border definition
|
|
495
|
+
*/
|
|
496
|
+
export const NO_BORDER: BorderDefinition = {
|
|
497
|
+
style: 'none',
|
|
498
|
+
size: 0,
|
|
499
|
+
color: 'auto',
|
|
500
|
+
space: 0,
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
// ============================================================================
|
|
504
|
+
// SHADING UTILITIES
|
|
505
|
+
// ============================================================================
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Builds XML attributes for a w:shd element from a ShadingConfig.
|
|
509
|
+
* Shared across all element types for consistent shading generation.
|
|
510
|
+
*/
|
|
511
|
+
export function buildShadingAttributes(shading: ShadingConfig): Record<string, string> {
|
|
512
|
+
const attrs: Record<string, string> = {};
|
|
513
|
+
// w:val is REQUIRED per ECMA-376 — default to "clear" if no pattern specified
|
|
514
|
+
attrs['w:val'] = shading.pattern || 'clear';
|
|
515
|
+
if (shading.fill) attrs['w:fill'] = shading.fill;
|
|
516
|
+
if (shading.color) attrs['w:color'] = shading.color;
|
|
517
|
+
if (shading.themeFill) attrs['w:themeFill'] = shading.themeFill;
|
|
518
|
+
if (shading.themeColor) attrs['w:themeColor'] = shading.themeColor;
|
|
519
|
+
if (shading.themeFillTint) attrs['w:themeFillTint'] = shading.themeFillTint;
|
|
520
|
+
if (shading.themeFillShade) attrs['w:themeFillShade'] = shading.themeFillShade;
|
|
521
|
+
if (shading.themeTint) attrs['w:themeTint'] = shading.themeTint;
|
|
522
|
+
if (shading.themeShade) attrs['w:themeShade'] = shading.themeShade;
|
|
523
|
+
return attrs;
|
|
524
|
+
}
|