ooxml-core 0.18.0 → 0.19.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.
@@ -0,0 +1,16 @@
1
+ import type { SectionColumns, SectionProperties } from './section-model.js';
2
+ export declare const columnTextWidth: (section: SectionProperties) => number;
3
+ /** Word's Left/Right presets reserve one third of the text width for the narrow column. */
4
+ export declare function unequalColumnPreset(section: SectionProperties, preset: 'left' | 'right'): SectionColumns;
5
+ export declare function columnPreset(columns: SectionColumns): string;
6
+ export interface ColumnDraft {
7
+ widths: number[];
8
+ gaps: number[];
9
+ }
10
+ export declare function equalColumnDraft(total: number, count: number, gap: number): ColumnDraft;
11
+ export declare function readColumnDraft(section: SectionProperties): ColumnDraft;
12
+ /** Keep the overall text width fixed by taking the difference from the adjacent column. */
13
+ export declare function changeColumnWidth(draft: ColumnDraft, index: number, width: number): void;
14
+ export declare function changeColumnGap(draft: ColumnDraft, index: number, gap: number): void;
15
+ export declare function validColumnDraft(draft: ColumnDraft, total: number): boolean;
16
+ //# sourceMappingURL=column-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-settings.d.ts","sourceRoot":"","sources":["../../src/docx/column-settings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,eAAO,MAAM,eAAe,YAAa,iBAAiB,KAAG,MAIlC,CAAC;AAE5B,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,MAAM,GAAG,OAAO,GACtB,cAAc,CAchB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAQ5D;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;CACf;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAQvF;AACD,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAgBvE;AACD,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAKxF;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAIpF;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAM3E"}
@@ -9663,6 +9663,163 @@ function plainText2(model) {
9663
9663
  ).join("\n");
9664
9664
  }
9665
9665
 
9666
+ // src/docx/column-settings.ts
9667
+ var columnTextWidth = (section) => section.pageWidthTwips - section.marginLeftTwips - section.marginRightTwips - (section.gutterTwips ?? 0);
9668
+ function unequalColumnPreset(section, preset) {
9669
+ const gap = 720;
9670
+ const available = columnTextWidth(section) - gap;
9671
+ const narrow = Math.round(available / 3);
9672
+ const wide = available - narrow;
9673
+ return {
9674
+ count: 2,
9675
+ equalWidth: false,
9676
+ spacingTwips: twips(gap),
9677
+ widths: [
9678
+ { widthTwips: twips(preset === "left" ? narrow : wide), spacingTwips: twips(gap) },
9679
+ { widthTwips: twips(preset === "left" ? wide : narrow) }
9680
+ ]
9681
+ };
9682
+ }
9683
+ function columnPreset(columns) {
9684
+ if (columns.equalWidth) return String(columns.count);
9685
+ const [a, b] = columns.widths ?? [];
9686
+ if (columns.count === 2 && a && b) {
9687
+ if (Math.abs(a.widthTwips * 2 - b.widthTwips) <= 2) return "left";
9688
+ if (Math.abs(b.widthTwips * 2 - a.widthTwips) <= 2) return "right";
9689
+ }
9690
+ return "";
9691
+ }
9692
+ function equalColumnDraft(total, count, gap) {
9693
+ const width = Math.floor((total - gap * (count - 1)) / count);
9694
+ return {
9695
+ widths: Array.from(
9696
+ { length: count },
9697
+ (_, i) => i === count - 1 ? total - gap * (count - 1) - width * (count - 1) : width
9698
+ ),
9699
+ gaps: Array.from({ length: count }, (_, i) => i === count - 1 ? 0 : gap)
9700
+ };
9701
+ }
9702
+ function readColumnDraft(section) {
9703
+ const fallback = equalColumnDraft(
9704
+ columnTextWidth(section),
9705
+ section.columns.count,
9706
+ section.columns.spacingTwips ?? 720
9707
+ );
9708
+ return !section.columns.equalWidth && section.columns.widths?.length === section.columns.count ? {
9709
+ widths: section.columns.widths.map((column) => column.widthTwips),
9710
+ gaps: section.columns.widths.map(
9711
+ (column, i) => i === section.columns.count - 1 ? 0 : column.spacingTwips ?? section.columns.spacingTwips ?? 720
9712
+ )
9713
+ } : fallback;
9714
+ }
9715
+ function changeColumnWidth(draft, index, width) {
9716
+ const delta = width - draft.widths[index];
9717
+ draft.widths[index] = width;
9718
+ const neighbor = index < draft.widths.length - 1 ? index + 1 : index - 1;
9719
+ if (neighbor >= 0) draft.widths[neighbor] = draft.widths[neighbor] - delta;
9720
+ }
9721
+ function changeColumnGap(draft, index, gap) {
9722
+ const delta = gap - draft.gaps[index];
9723
+ draft.gaps[index] = gap;
9724
+ if (index + 1 < draft.widths.length) draft.widths[index + 1] = draft.widths[index + 1] - delta;
9725
+ }
9726
+ function validColumnDraft(draft, total) {
9727
+ return draft.widths.every((width) => Number.isSafeInteger(width) && width >= 720) && draft.gaps.every((gap) => Number.isSafeInteger(gap) && gap >= 0) && Math.abs(draft.widths.reduce((sum, value, i) => sum + value + draft.gaps[i], 0) - total) <= 1;
9728
+ }
9729
+
9730
+ // src/docx/line-spacing.ts
9731
+ var lineSpacingOptions = [
9732
+ ["inherit", "Line: style default"],
9733
+ ["auto:240", "1.0 lines"],
9734
+ ["auto:276", "1.15 lines"],
9735
+ ["auto:360", "1.5 lines"],
9736
+ ["auto:480", "2.0 lines"],
9737
+ ["auto:600", "2.5 lines"],
9738
+ ["auto:720", "3.0 lines"]
9739
+ ];
9740
+ function lineSpacingValue(attrs) {
9741
+ const rule = attrs.lineSpacingRule === "exact" || attrs.lineSpacingRule === "atLeast" ? attrs.lineSpacingRule : "auto";
9742
+ if (!Number.isSafeInteger(attrs.lineSpacingTwips))
9743
+ return attrs.lineSpacingRule === "exact" || attrs.lineSpacingRule === "atLeast" ? `rule-only:${attrs.lineSpacingRule}` : "inherit";
9744
+ return `${rule}:${Number(attrs.lineSpacingTwips)}`;
9745
+ }
9746
+ function lineSpacingLabel(value) {
9747
+ if (value === "inherit") return "Style default";
9748
+ const ruleOnly = /^rule-only:(exact|atLeast)$/.exec(value);
9749
+ if (ruleOnly) return `${ruleOnly[1] === "exact" ? "Exact" : "At least"} rule (no amount)`;
9750
+ const match = /^(auto|exact|atLeast):(\d+)$/.exec(value);
9751
+ if (!match) return "Mixed paragraphs";
9752
+ const [, rule, rawTwips] = match;
9753
+ const twips3 = Number(rawTwips);
9754
+ if (rule === "auto") {
9755
+ const ratios = {
9756
+ 240: "1.0",
9757
+ 276: "1.15",
9758
+ 360: "1.5",
9759
+ 480: "2.0",
9760
+ 600: "2.5",
9761
+ 720: "3.0"
9762
+ };
9763
+ return ratios[twips3] ? `${ratios[twips3]} lines` : `Automatic ${(twips3 / 240).toLocaleString(void 0, { maximumFractionDigits: 3 })} lines (${twips3}/240)`;
9764
+ }
9765
+ const points = (twips3 / 20).toLocaleString(void 0, { maximumFractionDigits: 2 });
9766
+ return `${rule === "exact" ? "Exact" : "At least"} ${points} pt`;
9767
+ }
9768
+ function parseLineSpacingValue(value) {
9769
+ const match = /^(auto|exact|atLeast):(\d+)$/.exec(value);
9770
+ if (!match) return null;
9771
+ const twips3 = Number(match[2]);
9772
+ return Number.isSafeInteger(twips3) && twips3 >= 0 ? { rule: match[1], twips: twips3 } : null;
9773
+ }
9774
+
9775
+ // src/docx/section-layout.ts
9776
+ function sectionLayoutJson(sections) {
9777
+ return JSON.stringify(
9778
+ sections.map(({ headers: _headers, footers: _footers, ...layout2 }) => layout2)
9779
+ );
9780
+ }
9781
+ function sectionsFromLayout(json, prior, blocks) {
9782
+ const layout2 = JSON.parse(json);
9783
+ const order = new Map(blocks.map((block, index) => [block.id, index]));
9784
+ const priorSections = prior ?? [];
9785
+ const endOf = (section, index, list) => index === list.length - 1 ? Number.POSITIVE_INFINITY : order.get(section.endsAtBlockId) ?? -1;
9786
+ const kept = layout2.filter(
9787
+ (section, index) => index === layout2.length - 1 || order.has(section.endsAtBlockId)
9788
+ );
9789
+ return kept.map((section, index) => {
9790
+ const end = endOf(section, index, kept);
9791
+ const source = priorSections.find((candidate) => candidate.endsAtBlockId === section.endsAtBlockId) ?? priorSections.find(
9792
+ (candidate, position) => endOf(candidate, position, priorSections) >= end
9793
+ ) ?? priorSections.at(-1);
9794
+ return {
9795
+ ...section,
9796
+ ...source?.headers ? { headers: source.headers } : {},
9797
+ ...source?.footers ? { footers: source.footers } : {}
9798
+ };
9799
+ });
9800
+ }
9801
+ function sectionsOf(model) {
9802
+ if (model.sections?.length) return model.sections;
9803
+ const { page } = model;
9804
+ return [
9805
+ {
9806
+ endsAtBlockId: model.blocks.at(-1)?.id ?? "",
9807
+ type: "nextPage",
9808
+ pageWidthTwips: twipsFromPixels(page.width),
9809
+ pageHeightTwips: twipsFromPixels(page.height),
9810
+ orientation: page.width > page.height ? "landscape" : "portrait",
9811
+ marginTopTwips: signedTwipsFromPixels(page.marginTop),
9812
+ marginRightTwips: twipsFromPixels(page.marginRight),
9813
+ marginBottomTwips: signedTwipsFromPixels(page.marginBottom),
9814
+ marginLeftTwips: twipsFromPixels(page.marginLeft),
9815
+ headerDistanceTwips: twips(720),
9816
+ footerDistanceTwips: twips(720),
9817
+ gutterTwips: twips(0),
9818
+ columns: { count: 1, spacingTwips: twips(720), equalWidth: true }
9819
+ }
9820
+ ];
9821
+ }
9822
+
9666
9823
  exports.DEFAULT_STYLES_XML = DEFAULT_STYLES_XML;
9667
9824
  exports.DEFAULT_TABLE_BORDERS = DEFAULT_TABLE_BORDERS;
9668
9825
  exports.DEFAULT_TOC_INSTRUCTION = DEFAULT_TOC_INSTRUCTION;
@@ -9787,6 +9944,10 @@ exports.applyThemeTint = applyThemeTint;
9787
9944
  exports.assertValidDocumentModel = assertValidDocumentModel;
9788
9945
  exports.buildTableOfContents = buildTableOfContents;
9789
9946
  exports.captionParagraphs = captionParagraphs;
9947
+ exports.changeColumnGap = changeColumnGap;
9948
+ exports.changeColumnWidth = changeColumnWidth;
9949
+ exports.columnPreset = columnPreset;
9950
+ exports.columnTextWidth = columnTextWidth;
9790
9951
  exports.computeListLabels = computeListLabels;
9791
9952
  exports.createDocument = createDocument;
9792
9953
  exports.createListDefinition = createListDefinition;
@@ -9805,6 +9966,7 @@ exports.emuFromPixels = emuFromPixels;
9805
9966
  exports.emuToPixels = emuToPixels;
9806
9967
  exports.ensureListDefinition = ensureListDefinition;
9807
9968
  exports.enumValue = enumValue;
9969
+ exports.equalColumnDraft = equalColumnDraft;
9808
9970
  exports.fieldName = fieldName;
9809
9971
  exports.findRevision = findRevision;
9810
9972
  exports.findTableOfContents = findTableOfContents;
@@ -9922,6 +10084,9 @@ exports.isThemeColorToken = isThemeColorToken;
9922
10084
  exports.isValidLanguageTag = isValidLanguageTag;
9923
10085
  exports.isWordHighlightToken = isWordHighlightToken;
9924
10086
  exports.isWordUnderlineStyle = isWordUnderlineStyle;
10087
+ exports.lineSpacingLabel = lineSpacingLabel;
10088
+ exports.lineSpacingOptions = lineSpacingOptions;
10089
+ exports.lineSpacingValue = lineSpacingValue;
9925
10090
  exports.linkStylesToList = linkStylesToList;
9926
10091
  exports.listRevisions = listRevisions;
9927
10092
  exports.loadDocx = loadDocx;
@@ -9934,6 +10099,7 @@ exports.parseHalfPoints = parseHalfPoints;
9934
10099
  exports.parseHexColor = parseHexColor;
9935
10100
  exports.parseInteger = parseInteger;
9936
10101
  exports.parseJustification = parseJustification;
10102
+ exports.parseLineSpacingValue = parseLineSpacingValue;
9937
10103
  exports.parseNumberingCatalog = parseNumberingCatalog;
9938
10104
  exports.parseOnOff = parseOnOff;
9939
10105
  exports.parseParagraphStyleCatalog = parseParagraphStyleCatalog;
@@ -9948,6 +10114,7 @@ exports.parseTintShade = parseTintShade;
9948
10114
  exports.parseTwips = parseTwips;
9949
10115
  exports.parseUnsignedInteger = parseUnsignedInteger;
9950
10116
  exports.plainText = plainText2;
10117
+ exports.readColumnDraft = readColumnDraft;
9951
10118
  exports.rejectAllRevisions = rejectAllRevisions;
9952
10119
  exports.rejectRevision = rejectRevision;
9953
10120
  exports.reportParseWarning = reportParseWarning;
@@ -9967,6 +10134,9 @@ exports.roundHalfPoints = roundHalfPoints;
9967
10134
  exports.roundSignedTwips = roundSignedTwips;
9968
10135
  exports.roundTwips = roundTwips;
9969
10136
  exports.saveDocx = saveDocx;
10137
+ exports.sectionLayoutJson = sectionLayoutJson;
10138
+ exports.sectionsFromLayout = sectionsFromLayout;
10139
+ exports.sectionsOf = sectionsOf;
9970
10140
  exports.signedTwips = signedTwips;
9971
10141
  exports.signedTwipsFromPixels = signedTwipsFromPixels;
9972
10142
  exports.signedTwipsFromPoints = signedTwipsFromPoints;
@@ -9983,8 +10153,10 @@ exports.twipsFromPoints = twipsFromPoints;
9983
10153
  exports.twipsToInches = twipsToInches;
9984
10154
  exports.twipsToPixels = twipsToPixels;
9985
10155
  exports.twipsToPoints = twipsToPoints;
10156
+ exports.unequalColumnPreset = unequalColumnPreset;
9986
10157
  exports.universalMeasureToTwips = universalMeasureToTwips;
9987
10158
  exports.updateTableOfContents = updateTableOfContents;
10159
+ exports.validColumnDraft = validColumnDraft;
9988
10160
  exports.validateDocumentModel = validateDocumentModel;
9989
10161
  exports.withParseWarnings = withParseWarnings;
9990
10162
  exports.withTocBookmarks = withTocBookmarks;
@@ -38,4 +38,7 @@ export { withParseWarnings, enumValue, reportParseWarning } from './parse-diagno
38
38
  export { PROPERTY_FIELDS, type DocumentProperties } from './core-properties.js';
39
39
  export { captionParagraphs, isCaptionOf, tableOfFiguresInstruction, tocCaptionLabel, } from './table-of-figures.js';
40
40
  export * from './document-stats.js';
41
+ export * from './column-settings.js';
42
+ export * from './line-spacing.js';
43
+ export * from './section-layout.js';
41
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docx/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9E,cAAc,eAAe,CAAC;AAC9B,OAAO,EACN,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACN,sBAAsB,EACtB,0BAA0B,EAC1B,cAAc,EACd,eAAe,EACf,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACN,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,QAAQ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AC;AAClC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACtF,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACN,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -9657,4 +9657,161 @@ function plainText2(model) {
9657
9657
  ).join("\n");
9658
9658
  }
9659
9659
 
9660
- export { DEFAULT_STYLES_XML, DEFAULT_TABLE_BORDERS, DEFAULT_TOC_INSTRUCTION, DIAGRAM_GRAPHIC_URI, DocxModelValidationError, EMPTY_FIGURES_TEXT, EMPTY_TOC_TEXT, EMU_PER_INCH, EMU_PER_PIXEL, EMU_PER_POINT, LIGATURE_VALUES, PIXELS_PER_INCH, PROPERTY_FIELDS, ST_AlgClass, ST_AlgType, ST_AnnotationVMerge, ST_Border, ST_BrClear, ST_BrType, ST_CalendarType, ST_CaptionPos, ST_ChapterSep, ST_CharacterSpacing, ST_CombineBrackets, ST_ConformanceClass, ST_CryptProv, ST_Direction, ST_DisplacedByCustomXml, ST_DocGrid, ST_DocPartBehavior, ST_DocPartGallery, ST_DocPartType, ST_DocProtect, ST_DropCap, ST_EdGrp, ST_EdnPos, ST_Em, ST_FFTextType, ST_FldCharType, ST_FontFamily, ST_FrameLayout, ST_FrameScrollbar, ST_FtnEdn, ST_FtnPos, ST_HAnchor, ST_HdrFtr, ST_HeightRule, ST_HexColorAuto, ST_HighlightColor, ST_Hint, ST_InfoTextType, ST_Jc, ST_JcTable, ST_LevelSuffix, ST_LineNumberRestart, ST_LineSpacingRule, ST_Lock, ST_MailMergeDest, ST_MailMergeDocType, ST_MailMergeOdsoFMDFieldType, ST_MailMergeSourceType, ST_Merge, ST_MultiLevelType, ST_NumberFormat, ST_ObjectDrawAspect, ST_ObjectUpdateMode, ST_OnOff1, ST_PTabAlignment, ST_PTabLeader, ST_PTabRelativeTo, ST_PageBorderDisplay, ST_PageBorderOffset, ST_PageBorderZOrder, ST_PageOrientation, ST_Pitch, ST_Proof, ST_ProofErr, ST_RelFromH, ST_RelFromV, ST_RestartNumber, ST_RubyAlign, ST_SchemeColorVal, ST_SdtDateMappingType, ST_SectionMark, ST_Shd, ST_StyleSort, ST_StyleType, ST_TabJc, ST_TabTlc, ST_TargetScreenSz, ST_TblLayoutType, ST_TblOverlap, ST_TblStyleOverrideType, ST_TblWidth, ST_TextAlignment, ST_TextDirection, ST_TextEffect, ST_TextboxTightWrap, ST_Theme, ST_ThemeColor, ST_TrueFalse, ST_TrueFalseBlank, ST_Underline, ST_VAnchor, ST_VerticalAlignRun, ST_VerticalJc, ST_View, ST_WmlColorSchemeIndex, ST_Wrap, ST_XAlign, ST_YAlign, ST_Zoom, TWIPS_PER_INCH, TWIPS_PER_POINT, WORD_HIGHLIGHT_TOKENS, WORD_UNDERLINE_TOKENS, acceptAllRevisions, acceptRevision, alignFromJustification, applyThemeShade, applyThemeTint, assertValidDocumentModel, buildTableOfContents, captionParagraphs, computeListLabels, createDocument, createListDefinition, dateFieldResult, datePicture, defaultStyleCatalogs, diagramColorTheme, diagramsIn, displayListLabel, documentStats, eighthPoints, eighthPointsFromPoints, eighthPointsToPoints, emu, emuFromPixels, emuToPixels, ensureListDefinition, enumValue, fieldName, findRevision, findTableOfContents, formatListNumber, formatNoteNumber, formatWordDate, halfPoints, halfPointsFromPoints, halfPointsToPoints, headingLevel, headingListLevels, isCaptionOf, isHeadingListKind, isLigatures, isStAlgClass, isStAlgType, isStAnnotationVMerge, isStBorder, isStBrClear, isStBrType, isStCalendarType, isStCaptionPos, isStChapterSep, isStCharacterSpacing, isStCombineBrackets, isStConformanceClass, isStCryptProv, isStDirection, isStDisplacedByCustomXml, isStDocGrid, isStDocPartBehavior, isStDocPartGallery, isStDocPartType, isStDocProtect, isStDropCap, isStEdGrp, isStEdnPos, isStEm, isStFFTextType, isStFldCharType, isStFontFamily, isStFrameLayout, isStFrameScrollbar, isStFtnEdn, isStFtnPos, isStHAnchor, isStHdrFtr, isStHeightRule, isStHexColorAuto, isStHighlightColor, isStHint, isStInfoTextType, isStJc, isStJcTable, isStLevelSuffix, isStLineNumberRestart, isStLineSpacingRule, isStLock, isStMailMergeDest, isStMailMergeDocType, isStMailMergeOdsoFMDFieldType, isStMailMergeSourceType, isStMerge, isStMultiLevelType, isStNumberFormat, isStObjectDrawAspect, isStObjectUpdateMode, isStOnOff1, isStPTabAlignment, isStPTabLeader, isStPTabRelativeTo, isStPageBorderDisplay, isStPageBorderOffset, isStPageBorderZOrder, isStPageOrientation, isStPitch, isStProof, isStProofErr, isStRelFromH, isStRelFromV, isStRestartNumber, isStRubyAlign, isStSchemeColorVal, isStSdtDateMappingType, isStSectionMark, isStShd, isStStyleSort, isStStyleType, isStTabJc, isStTabTlc, isStTargetScreenSz, isStTblLayoutType, isStTblOverlap, isStTblStyleOverrideType, isStTblWidth, isStTextAlignment, isStTextDirection, isStTextEffect, isStTextboxTightWrap, isStTheme, isStThemeColor, isStTrueFalse, isStTrueFalseBlank, isStUnderline, isStVAnchor, isStVerticalAlignRun, isStVerticalJc, isStView, isStWmlColorSchemeIndex, isStWrap, isStXAlign, isStYAlign, isStZoom, isThemeColorToken, isValidLanguageTag, isWordHighlightToken, isWordUnderlineStyle, linkStylesToList, listRevisions, loadDocx, numberNotesInOrder, onOffAttribute, onOffElement, parseColorSchemeMapping, parseEighthPoints, parseHalfPoints, parseHexColor, parseInteger, parseJustification, parseNumberingCatalog, parseOnOff, parseParagraphStyleCatalog, parseRgbColor, parseRunStyleCatalog, parseSignedHalfPoints, parseSignedTwips, parseTableStyleCatalog, parseTextScale, parseTheme, parseTintShade, parseTwips, parseUnsignedInteger, plainText2 as plainText, rejectAllRevisions, rejectRevision, reportParseWarning, resolveCellVisuals, resolveDiagramColor, resolveNumberingLevel, resolveParagraphFormatting, resolveParagraphNumbering, resolveRunFormatting, resolveStyleNumbering, resolveTableStyleFormatting, resolveThemeColorReference, resolveThemeColorToken, roundEighthPoints, roundEmu, roundHalfPoints, roundSignedTwips, roundTwips, saveDocx, signedTwips, signedTwipsFromPixels, signedTwipsFromPoints, tableOfFiguresInstruction, tocBookmarks, tocCaptionLabel, tocEntries, tocHyperlinks, tocLevels, twips, twipsFromInches, twipsFromPixels, twipsFromPoints, twipsToInches, twipsToPixels, twipsToPoints, universalMeasureToTwips, updateTableOfContents, validateDocumentModel, withParseWarnings, withTocBookmarks };
9660
+ // src/docx/column-settings.ts
9661
+ var columnTextWidth = (section) => section.pageWidthTwips - section.marginLeftTwips - section.marginRightTwips - (section.gutterTwips ?? 0);
9662
+ function unequalColumnPreset(section, preset) {
9663
+ const gap = 720;
9664
+ const available = columnTextWidth(section) - gap;
9665
+ const narrow = Math.round(available / 3);
9666
+ const wide = available - narrow;
9667
+ return {
9668
+ count: 2,
9669
+ equalWidth: false,
9670
+ spacingTwips: twips(gap),
9671
+ widths: [
9672
+ { widthTwips: twips(preset === "left" ? narrow : wide), spacingTwips: twips(gap) },
9673
+ { widthTwips: twips(preset === "left" ? wide : narrow) }
9674
+ ]
9675
+ };
9676
+ }
9677
+ function columnPreset(columns) {
9678
+ if (columns.equalWidth) return String(columns.count);
9679
+ const [a, b] = columns.widths ?? [];
9680
+ if (columns.count === 2 && a && b) {
9681
+ if (Math.abs(a.widthTwips * 2 - b.widthTwips) <= 2) return "left";
9682
+ if (Math.abs(b.widthTwips * 2 - a.widthTwips) <= 2) return "right";
9683
+ }
9684
+ return "";
9685
+ }
9686
+ function equalColumnDraft(total, count, gap) {
9687
+ const width = Math.floor((total - gap * (count - 1)) / count);
9688
+ return {
9689
+ widths: Array.from(
9690
+ { length: count },
9691
+ (_, i) => i === count - 1 ? total - gap * (count - 1) - width * (count - 1) : width
9692
+ ),
9693
+ gaps: Array.from({ length: count }, (_, i) => i === count - 1 ? 0 : gap)
9694
+ };
9695
+ }
9696
+ function readColumnDraft(section) {
9697
+ const fallback = equalColumnDraft(
9698
+ columnTextWidth(section),
9699
+ section.columns.count,
9700
+ section.columns.spacingTwips ?? 720
9701
+ );
9702
+ return !section.columns.equalWidth && section.columns.widths?.length === section.columns.count ? {
9703
+ widths: section.columns.widths.map((column) => column.widthTwips),
9704
+ gaps: section.columns.widths.map(
9705
+ (column, i) => i === section.columns.count - 1 ? 0 : column.spacingTwips ?? section.columns.spacingTwips ?? 720
9706
+ )
9707
+ } : fallback;
9708
+ }
9709
+ function changeColumnWidth(draft, index, width) {
9710
+ const delta = width - draft.widths[index];
9711
+ draft.widths[index] = width;
9712
+ const neighbor = index < draft.widths.length - 1 ? index + 1 : index - 1;
9713
+ if (neighbor >= 0) draft.widths[neighbor] = draft.widths[neighbor] - delta;
9714
+ }
9715
+ function changeColumnGap(draft, index, gap) {
9716
+ const delta = gap - draft.gaps[index];
9717
+ draft.gaps[index] = gap;
9718
+ if (index + 1 < draft.widths.length) draft.widths[index + 1] = draft.widths[index + 1] - delta;
9719
+ }
9720
+ function validColumnDraft(draft, total) {
9721
+ return draft.widths.every((width) => Number.isSafeInteger(width) && width >= 720) && draft.gaps.every((gap) => Number.isSafeInteger(gap) && gap >= 0) && Math.abs(draft.widths.reduce((sum, value, i) => sum + value + draft.gaps[i], 0) - total) <= 1;
9722
+ }
9723
+
9724
+ // src/docx/line-spacing.ts
9725
+ var lineSpacingOptions = [
9726
+ ["inherit", "Line: style default"],
9727
+ ["auto:240", "1.0 lines"],
9728
+ ["auto:276", "1.15 lines"],
9729
+ ["auto:360", "1.5 lines"],
9730
+ ["auto:480", "2.0 lines"],
9731
+ ["auto:600", "2.5 lines"],
9732
+ ["auto:720", "3.0 lines"]
9733
+ ];
9734
+ function lineSpacingValue(attrs) {
9735
+ const rule = attrs.lineSpacingRule === "exact" || attrs.lineSpacingRule === "atLeast" ? attrs.lineSpacingRule : "auto";
9736
+ if (!Number.isSafeInteger(attrs.lineSpacingTwips))
9737
+ return attrs.lineSpacingRule === "exact" || attrs.lineSpacingRule === "atLeast" ? `rule-only:${attrs.lineSpacingRule}` : "inherit";
9738
+ return `${rule}:${Number(attrs.lineSpacingTwips)}`;
9739
+ }
9740
+ function lineSpacingLabel(value) {
9741
+ if (value === "inherit") return "Style default";
9742
+ const ruleOnly = /^rule-only:(exact|atLeast)$/.exec(value);
9743
+ if (ruleOnly) return `${ruleOnly[1] === "exact" ? "Exact" : "At least"} rule (no amount)`;
9744
+ const match = /^(auto|exact|atLeast):(\d+)$/.exec(value);
9745
+ if (!match) return "Mixed paragraphs";
9746
+ const [, rule, rawTwips] = match;
9747
+ const twips3 = Number(rawTwips);
9748
+ if (rule === "auto") {
9749
+ const ratios = {
9750
+ 240: "1.0",
9751
+ 276: "1.15",
9752
+ 360: "1.5",
9753
+ 480: "2.0",
9754
+ 600: "2.5",
9755
+ 720: "3.0"
9756
+ };
9757
+ return ratios[twips3] ? `${ratios[twips3]} lines` : `Automatic ${(twips3 / 240).toLocaleString(void 0, { maximumFractionDigits: 3 })} lines (${twips3}/240)`;
9758
+ }
9759
+ const points = (twips3 / 20).toLocaleString(void 0, { maximumFractionDigits: 2 });
9760
+ return `${rule === "exact" ? "Exact" : "At least"} ${points} pt`;
9761
+ }
9762
+ function parseLineSpacingValue(value) {
9763
+ const match = /^(auto|exact|atLeast):(\d+)$/.exec(value);
9764
+ if (!match) return null;
9765
+ const twips3 = Number(match[2]);
9766
+ return Number.isSafeInteger(twips3) && twips3 >= 0 ? { rule: match[1], twips: twips3 } : null;
9767
+ }
9768
+
9769
+ // src/docx/section-layout.ts
9770
+ function sectionLayoutJson(sections) {
9771
+ return JSON.stringify(
9772
+ sections.map(({ headers: _headers, footers: _footers, ...layout2 }) => layout2)
9773
+ );
9774
+ }
9775
+ function sectionsFromLayout(json, prior, blocks) {
9776
+ const layout2 = JSON.parse(json);
9777
+ const order = new Map(blocks.map((block, index) => [block.id, index]));
9778
+ const priorSections = prior ?? [];
9779
+ const endOf = (section, index, list) => index === list.length - 1 ? Number.POSITIVE_INFINITY : order.get(section.endsAtBlockId) ?? -1;
9780
+ const kept = layout2.filter(
9781
+ (section, index) => index === layout2.length - 1 || order.has(section.endsAtBlockId)
9782
+ );
9783
+ return kept.map((section, index) => {
9784
+ const end = endOf(section, index, kept);
9785
+ const source = priorSections.find((candidate) => candidate.endsAtBlockId === section.endsAtBlockId) ?? priorSections.find(
9786
+ (candidate, position) => endOf(candidate, position, priorSections) >= end
9787
+ ) ?? priorSections.at(-1);
9788
+ return {
9789
+ ...section,
9790
+ ...source?.headers ? { headers: source.headers } : {},
9791
+ ...source?.footers ? { footers: source.footers } : {}
9792
+ };
9793
+ });
9794
+ }
9795
+ function sectionsOf(model) {
9796
+ if (model.sections?.length) return model.sections;
9797
+ const { page } = model;
9798
+ return [
9799
+ {
9800
+ endsAtBlockId: model.blocks.at(-1)?.id ?? "",
9801
+ type: "nextPage",
9802
+ pageWidthTwips: twipsFromPixels(page.width),
9803
+ pageHeightTwips: twipsFromPixels(page.height),
9804
+ orientation: page.width > page.height ? "landscape" : "portrait",
9805
+ marginTopTwips: signedTwipsFromPixels(page.marginTop),
9806
+ marginRightTwips: twipsFromPixels(page.marginRight),
9807
+ marginBottomTwips: signedTwipsFromPixels(page.marginBottom),
9808
+ marginLeftTwips: twipsFromPixels(page.marginLeft),
9809
+ headerDistanceTwips: twips(720),
9810
+ footerDistanceTwips: twips(720),
9811
+ gutterTwips: twips(0),
9812
+ columns: { count: 1, spacingTwips: twips(720), equalWidth: true }
9813
+ }
9814
+ ];
9815
+ }
9816
+
9817
+ export { DEFAULT_STYLES_XML, DEFAULT_TABLE_BORDERS, DEFAULT_TOC_INSTRUCTION, DIAGRAM_GRAPHIC_URI, DocxModelValidationError, EMPTY_FIGURES_TEXT, EMPTY_TOC_TEXT, EMU_PER_INCH, EMU_PER_PIXEL, EMU_PER_POINT, LIGATURE_VALUES, PIXELS_PER_INCH, PROPERTY_FIELDS, ST_AlgClass, ST_AlgType, ST_AnnotationVMerge, ST_Border, ST_BrClear, ST_BrType, ST_CalendarType, ST_CaptionPos, ST_ChapterSep, ST_CharacterSpacing, ST_CombineBrackets, ST_ConformanceClass, ST_CryptProv, ST_Direction, ST_DisplacedByCustomXml, ST_DocGrid, ST_DocPartBehavior, ST_DocPartGallery, ST_DocPartType, ST_DocProtect, ST_DropCap, ST_EdGrp, ST_EdnPos, ST_Em, ST_FFTextType, ST_FldCharType, ST_FontFamily, ST_FrameLayout, ST_FrameScrollbar, ST_FtnEdn, ST_FtnPos, ST_HAnchor, ST_HdrFtr, ST_HeightRule, ST_HexColorAuto, ST_HighlightColor, ST_Hint, ST_InfoTextType, ST_Jc, ST_JcTable, ST_LevelSuffix, ST_LineNumberRestart, ST_LineSpacingRule, ST_Lock, ST_MailMergeDest, ST_MailMergeDocType, ST_MailMergeOdsoFMDFieldType, ST_MailMergeSourceType, ST_Merge, ST_MultiLevelType, ST_NumberFormat, ST_ObjectDrawAspect, ST_ObjectUpdateMode, ST_OnOff1, ST_PTabAlignment, ST_PTabLeader, ST_PTabRelativeTo, ST_PageBorderDisplay, ST_PageBorderOffset, ST_PageBorderZOrder, ST_PageOrientation, ST_Pitch, ST_Proof, ST_ProofErr, ST_RelFromH, ST_RelFromV, ST_RestartNumber, ST_RubyAlign, ST_SchemeColorVal, ST_SdtDateMappingType, ST_SectionMark, ST_Shd, ST_StyleSort, ST_StyleType, ST_TabJc, ST_TabTlc, ST_TargetScreenSz, ST_TblLayoutType, ST_TblOverlap, ST_TblStyleOverrideType, ST_TblWidth, ST_TextAlignment, ST_TextDirection, ST_TextEffect, ST_TextboxTightWrap, ST_Theme, ST_ThemeColor, ST_TrueFalse, ST_TrueFalseBlank, ST_Underline, ST_VAnchor, ST_VerticalAlignRun, ST_VerticalJc, ST_View, ST_WmlColorSchemeIndex, ST_Wrap, ST_XAlign, ST_YAlign, ST_Zoom, TWIPS_PER_INCH, TWIPS_PER_POINT, WORD_HIGHLIGHT_TOKENS, WORD_UNDERLINE_TOKENS, acceptAllRevisions, acceptRevision, alignFromJustification, applyThemeShade, applyThemeTint, assertValidDocumentModel, buildTableOfContents, captionParagraphs, changeColumnGap, changeColumnWidth, columnPreset, columnTextWidth, computeListLabels, createDocument, createListDefinition, dateFieldResult, datePicture, defaultStyleCatalogs, diagramColorTheme, diagramsIn, displayListLabel, documentStats, eighthPoints, eighthPointsFromPoints, eighthPointsToPoints, emu, emuFromPixels, emuToPixels, ensureListDefinition, enumValue, equalColumnDraft, fieldName, findRevision, findTableOfContents, formatListNumber, formatNoteNumber, formatWordDate, halfPoints, halfPointsFromPoints, halfPointsToPoints, headingLevel, headingListLevels, isCaptionOf, isHeadingListKind, isLigatures, isStAlgClass, isStAlgType, isStAnnotationVMerge, isStBorder, isStBrClear, isStBrType, isStCalendarType, isStCaptionPos, isStChapterSep, isStCharacterSpacing, isStCombineBrackets, isStConformanceClass, isStCryptProv, isStDirection, isStDisplacedByCustomXml, isStDocGrid, isStDocPartBehavior, isStDocPartGallery, isStDocPartType, isStDocProtect, isStDropCap, isStEdGrp, isStEdnPos, isStEm, isStFFTextType, isStFldCharType, isStFontFamily, isStFrameLayout, isStFrameScrollbar, isStFtnEdn, isStFtnPos, isStHAnchor, isStHdrFtr, isStHeightRule, isStHexColorAuto, isStHighlightColor, isStHint, isStInfoTextType, isStJc, isStJcTable, isStLevelSuffix, isStLineNumberRestart, isStLineSpacingRule, isStLock, isStMailMergeDest, isStMailMergeDocType, isStMailMergeOdsoFMDFieldType, isStMailMergeSourceType, isStMerge, isStMultiLevelType, isStNumberFormat, isStObjectDrawAspect, isStObjectUpdateMode, isStOnOff1, isStPTabAlignment, isStPTabLeader, isStPTabRelativeTo, isStPageBorderDisplay, isStPageBorderOffset, isStPageBorderZOrder, isStPageOrientation, isStPitch, isStProof, isStProofErr, isStRelFromH, isStRelFromV, isStRestartNumber, isStRubyAlign, isStSchemeColorVal, isStSdtDateMappingType, isStSectionMark, isStShd, isStStyleSort, isStStyleType, isStTabJc, isStTabTlc, isStTargetScreenSz, isStTblLayoutType, isStTblOverlap, isStTblStyleOverrideType, isStTblWidth, isStTextAlignment, isStTextDirection, isStTextEffect, isStTextboxTightWrap, isStTheme, isStThemeColor, isStTrueFalse, isStTrueFalseBlank, isStUnderline, isStVAnchor, isStVerticalAlignRun, isStVerticalJc, isStView, isStWmlColorSchemeIndex, isStWrap, isStXAlign, isStYAlign, isStZoom, isThemeColorToken, isValidLanguageTag, isWordHighlightToken, isWordUnderlineStyle, lineSpacingLabel, lineSpacingOptions, lineSpacingValue, linkStylesToList, listRevisions, loadDocx, numberNotesInOrder, onOffAttribute, onOffElement, parseColorSchemeMapping, parseEighthPoints, parseHalfPoints, parseHexColor, parseInteger, parseJustification, parseLineSpacingValue, parseNumberingCatalog, parseOnOff, parseParagraphStyleCatalog, parseRgbColor, parseRunStyleCatalog, parseSignedHalfPoints, parseSignedTwips, parseTableStyleCatalog, parseTextScale, parseTheme, parseTintShade, parseTwips, parseUnsignedInteger, plainText2 as plainText, readColumnDraft, rejectAllRevisions, rejectRevision, reportParseWarning, resolveCellVisuals, resolveDiagramColor, resolveNumberingLevel, resolveParagraphFormatting, resolveParagraphNumbering, resolveRunFormatting, resolveStyleNumbering, resolveTableStyleFormatting, resolveThemeColorReference, resolveThemeColorToken, roundEighthPoints, roundEmu, roundHalfPoints, roundSignedTwips, roundTwips, saveDocx, sectionLayoutJson, sectionsFromLayout, sectionsOf, signedTwips, signedTwipsFromPixels, signedTwipsFromPoints, tableOfFiguresInstruction, tocBookmarks, tocCaptionLabel, tocEntries, tocHyperlinks, tocLevels, twips, twipsFromInches, twipsFromPixels, twipsFromPoints, twipsToInches, twipsToPixels, twipsToPoints, unequalColumnPreset, universalMeasureToTwips, updateTableOfContents, validColumnDraft, validateDocumentModel, withParseWarnings, withTocBookmarks };
@@ -0,0 +1,9 @@
1
+ export type LineSpacingRule = 'auto' | 'exact' | 'atLeast';
2
+ export declare const lineSpacingOptions: Array<[string, string]>;
3
+ export declare function lineSpacingValue(attrs: Record<string, unknown>): string;
4
+ export declare function lineSpacingLabel(value: string): string;
5
+ export declare function parseLineSpacingValue(value: string): {
6
+ rule: LineSpacingRule;
7
+ twips: number;
8
+ } | null;
9
+ //# sourceMappingURL=line-spacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-spacing.d.ts","sourceRoot":"","sources":["../../src/docx/line-spacing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAQtD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAUvE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuBtD;AAED,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOjD"}
@@ -0,0 +1,14 @@
1
+ import type { Block, DocumentModel } from './model.js';
2
+ import type { SectionProperties } from './section-model.js';
3
+ /** Section layout without header/footer content, as stored on the editor document for undo. */
4
+ export declare function sectionLayoutJson(sections: SectionProperties[]): string;
5
+ /**
6
+ * Rebuilds sections from the editor document's layout JSON, reattaching header/footer content
7
+ * from the previous model: a section keeps the content of the prior section ending at the same
8
+ * block, and a newly split section takes the content of the section it was split from. Sections
9
+ * whose ending paragraph no longer exists are dropped (deleting a break merges sections).
10
+ */
11
+ export declare function sectionsFromLayout(json: string, prior: SectionProperties[] | undefined, blocks: Block[]): SectionProperties[];
12
+ /** The document's sections, creating one from the page settings for documents without any. */
13
+ export declare function sectionsOf(model: DocumentModel): SectionProperties[];
14
+ //# sourceMappingURL=section-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-layout.d.ts","sourceRoot":"","sources":["../../src/docx/section-layout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAIvE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,iBAAiB,EAAE,GAAG,SAAS,EACtC,MAAM,EAAE,KAAK,EAAE,GACb,iBAAiB,EAAE,CAuBrB;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,iBAAiB,EAAE,CAoBpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-core",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Shared OOXML logic for the Word, PowerPoint and Excel viewers: everything except the UI",
5
5
  "keywords": [
6
6
  "charts",