@betteroffice/docx 0.1.0 → 0.2.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.
Files changed (63) hide show
  1. package/README.md +2 -6
  2. package/dist/chunk-47Q2FMFF.mjs +1 -0
  3. package/dist/chunk-6LQJAKOC.mjs +1 -0
  4. package/dist/chunk-ACGKK7IB.mjs +1 -0
  5. package/dist/{chunk-PI2I3TO5.mjs → chunk-AFMVSI4Z.mjs} +2 -2
  6. package/dist/chunk-GD4VNJ64.mjs +1 -0
  7. package/dist/{chunk-BUZ2X5CT.mjs → chunk-JHJLG4I6.mjs} +1 -1
  8. package/dist/chunk-PGMXWI5X.mjs +1 -0
  9. package/dist/{chunk-VRGUAKOC.mjs → chunk-WTFRNX5K.mjs} +1 -1
  10. package/dist/collaboration/index.d.mts +6 -6
  11. package/dist/{content-DrqzbIr7.d.mts → content-CvEtPl0c.d.mts} +59 -6
  12. package/dist/core.d.mts +7 -7
  13. package/dist/core.mjs +1 -1
  14. package/dist/{displayListQueries-DGDR-OWc.d.mts → displayListQueries-DF8F6fMl.d.mts} +2 -2
  15. package/dist/docx/index.d.mts +3 -3
  16. package/dist/docx/index.mjs +1 -1
  17. package/dist/editor/index.d.mts +20 -11
  18. package/dist/editor/index.mjs +1 -1
  19. package/dist/{fontLoader-DnixuYST.d.mts → fontLoader-b8eicJKV.d.mts} +1 -1
  20. package/dist/{formatting-BqrFPeev.d.mts → formatting-7zKCTu5a.d.mts} +3 -2
  21. package/dist/{frameDelta-DMgR8n13.d.mts → frameDelta-pA4jrQ1G.d.mts} +3 -2
  22. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  23. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  24. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  25. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  26. package/dist/{index-ImoMd0Ju.d.mts → index-CHl2zLJ7.d.mts} +117 -15
  27. package/dist/layout/index.d.mts +4 -4
  28. package/dist/layout/index.mjs +1 -1
  29. package/dist/layout/pagination/index.d.mts +4 -4
  30. package/dist/layout/pagination/index.mjs +1 -1
  31. package/dist/layout/render/index.d.mts +10 -10
  32. package/dist/layout/render/index.mjs +1 -1
  33. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  34. package/dist/plugin-api/index.d.mts +3 -3
  35. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  36. package/dist/{rustDisplayList-B9dQoLHI.d.mts → rustDisplayList-BJqaN9tt.d.mts} +2 -2
  37. package/dist/styles/index.d.mts +5 -9
  38. package/dist/styles/index.mjs +1 -1
  39. package/dist/{styles-CMybYYHS.d.mts → styles-7e-mq3c-.d.mts} +1 -1
  40. package/dist/types/content.d.mts +2 -2
  41. package/dist/types/document.d.mts +7 -6
  42. package/dist/{types-CXLxVF1t.d.mts → types-C4A8mWjU.d.mts} +19 -3
  43. package/dist/utils/comments.d.mts +2 -2
  44. package/dist/utils/index.d.mts +4 -4
  45. package/dist/utils/index.mjs +1 -1
  46. package/dist/utils/stylePreview.d.mts +2 -2
  47. package/dist/wasm-7SOSHNGP.mjs +1 -0
  48. package/dist/{wasm-T2CRCO7S.mjs → wasm-ZQAVP7P2.mjs} +1 -1
  49. package/dist/wasm-edit.d.mts +35 -27
  50. package/dist/wasm-edit.mjs +1 -1
  51. package/dist/wasm-layout.mjs +1 -1
  52. package/dist/wasm-parse.d.mts +2 -1
  53. package/dist/wasm-parse.mjs +1 -1
  54. package/dist/yrs/index.d.mts +5 -5
  55. package/dist/yrs/index.mjs +1 -1
  56. package/dist/yrs/residentEngineWorker.mjs +1 -1
  57. package/package.json +2 -2
  58. package/dist/chunk-24DL53QL.mjs +0 -1
  59. package/dist/chunk-GHEHBYQK.mjs +0 -1
  60. package/dist/chunk-HTDNSQ44.mjs +0 -1
  61. package/dist/chunk-TMHG7OAZ.mjs +0 -1
  62. package/dist/chunk-WBH3SXI6.mjs +0 -1
  63. package/dist/wasm-CJHQHBDE.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-BqrFPeev.mjs';
1
+ import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-7zKCTu5a.mjs';
2
2
  import { WrapType } from './docx/wrapTypes.mjs';
3
3
 
4
4
  interface ShapeFillPaint {
@@ -233,6 +233,14 @@ interface NumberingInstance {
233
233
  interface ListRendering {
234
234
  /** Computed marker text (e.g., "1.", "a)", "•") */
235
235
  marker: string;
236
+ /**
237
+ * Level indents the paragraph inherits when neither direct formatting nor
238
+ * the style chain sets its own; applied at layout time so the paragraph's
239
+ * authored properties stay authored.
240
+ */
241
+ indentLeft?: number;
242
+ indentFirstLine?: number;
243
+ hangingIndent?: boolean;
236
244
  /** List level (0-8) */
237
245
  level: number;
238
246
  /** Numbering ID */
@@ -317,7 +325,7 @@ interface TableCell {
317
325
  /** Tracked structural changes (cell insert/delete/merge) */
318
326
  structuralChange?: TableStructuralChangeInfo;
319
327
  /** Cell content (paragraphs, tables, etc.) */
320
- content: (Paragraph | Table)[];
328
+ content: BlockContent[];
321
329
  }
322
330
  /**
323
331
  * Table row (`w:tr`) — an ordered list of `TableCell` plus row-level
@@ -355,6 +363,11 @@ interface Table {
355
363
  rows: TableRow[];
356
364
  }
357
365
 
366
+ interface RawXml {
367
+ type: 'rawXml';
368
+ xml: string;
369
+ }
370
+
358
371
  /**
359
372
  * Watermark — the MS Word "Design → Watermark" feature.
360
373
  *
@@ -471,6 +484,11 @@ interface HeaderFooter {
471
484
  hdrFtrType: HeaderFooterType;
472
485
  /** Content (paragraphs, tables, etc.) */
473
486
  content: BlockContent[];
487
+ /** Root bindings and attributes retained outside the standard boilerplate. */
488
+ customRootBindings?: {
489
+ name: string;
490
+ value: string;
491
+ }[];
474
492
  /**
475
493
  * Watermark stored on this header (MS Word "Design → Watermark"). Lives
476
494
  * here, not in `content`, so it stays out of the editable text flow while
@@ -540,6 +558,11 @@ interface Footnote {
540
558
  * and stays editable on round-trip.
541
559
  */
542
560
  content: BlockContent[];
561
+ /** Inherited root bindings required by foreign note content. */
562
+ customRootBindings?: {
563
+ name: string;
564
+ value: string;
565
+ }[];
543
566
  /** Verbatim note XML for unmodeled bookmarks or custom XML. */
544
567
  verbatimXml?: string;
545
568
  }
@@ -558,6 +581,11 @@ interface Endnote {
558
581
  * on `Footnote.content`.
559
582
  */
560
583
  content: BlockContent[];
584
+ /** Inherited root bindings required by foreign note content. */
585
+ customRootBindings?: {
586
+ name: string;
587
+ value: string;
588
+ }[];
561
589
  /** Verbatim note XML for unmodeled blocks. */
562
590
  verbatimXml?: string;
563
591
  }
@@ -800,7 +828,7 @@ interface SectionProperties {
800
828
  /**
801
829
  * Block-level content types
802
830
  */
803
- type BlockContent = Paragraph | Table | BlockSdt;
831
+ type BlockContent = Paragraph | Table | BlockSdt | RawXml;
804
832
  /**
805
833
  * One section of the document — a `SectionProperties` plus the block
806
834
  * content (`Paragraph`s and `Table`s) that lives under those properties.
@@ -836,6 +864,11 @@ interface DocumentBody {
836
864
  sections?: Section[];
837
865
  /** Final section properties (from body's sectPr) */
838
866
  finalSectionProperties?: SectionProperties;
867
+ /** Root bindings and attributes retained outside the standard boilerplate. */
868
+ customRootBindings?: {
869
+ name: string;
870
+ value: string;
871
+ }[];
839
872
  /** Comments from comments.xml */
840
873
  comments?: Comment[];
841
874
  /** Stable reviewer palette metadata. Undefined = derive colors by author order. */
@@ -1466,6 +1499,18 @@ interface NoteRefMarkContent {
1466
1499
  interface SeparatorContent {
1467
1500
  type: 'separator' | 'continuationSeparator';
1468
1501
  }
1502
+ interface HorizontalRuleContent {
1503
+ type: 'horizontalRule';
1504
+ rule: {
1505
+ width: number | null;
1506
+ widthPercent: number | null;
1507
+ height: number;
1508
+ alignment: string;
1509
+ noShade: boolean;
1510
+ color: string;
1511
+ xml: string;
1512
+ };
1513
+ }
1469
1514
  /** Legacy `w:ffData` projected as inert form-control state. */
1470
1515
  interface FieldFormData {
1471
1516
  name?: string;
@@ -1552,7 +1597,7 @@ interface ChartContent {
1552
1597
  /**
1553
1598
  * All possible run content types
1554
1599
  */
1555
- type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | CommentReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent | ChartContent;
1600
+ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | HorizontalRuleContent | CommentReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent | ChartContent;
1556
1601
  /**
1557
1602
  * A run (`w:r`) — a contiguous span of inline content sharing one set of
1558
1603
  * character properties (bold, italic, font, color, etc.). Runs are the
@@ -1594,7 +1639,7 @@ interface Run {
1594
1639
  * this union carries a `type` discriminator so consumers can narrow at
1595
1640
  * runtime.
1596
1641
  */
1597
- type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
1642
+ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation | RawXml;
1598
1643
  /**
1599
1644
  * Paragraph (`w:p`) — the primary block-level container in a Word document.
1600
1645
  *
@@ -1909,6 +1954,8 @@ interface Image {
1909
1954
  padding?: ImagePadding;
1910
1955
  /** Source-image crop (fractional, OOXML `a:srcRect`). */
1911
1956
  crop?: ImageCrop;
1957
+ /** Picture preset geometry; undefined means rect. */
1958
+ shapeType?: string;
1912
1959
  /** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
1913
1960
  opacity?: number;
1914
1961
  /** Whether this is a decorative image */
@@ -1975,6 +2022,7 @@ interface ChartTextProperties {
1975
2022
  bold?: boolean;
1976
2023
  italic?: boolean;
1977
2024
  color?: string;
2025
+ spacingPt?: number;
1978
2026
  }
1979
2027
  /** One `c:dLbl`: an index plus the switches it overrides. */
1980
2028
  interface ChartPointLabel {
@@ -2113,6 +2161,11 @@ interface Chart {
2113
2161
  text?: ChartTextProperties;
2114
2162
  /** `c:txPr` on `c:title`. */
2115
2163
  titleText?: ChartTextProperties;
2164
+ /**
2165
+ * The `w:drawing` that places the chart, replayed verbatim on save. Absent
2166
+ * on package-level entries, which no drawing owns.
2167
+ */
2168
+ drawingXml?: string;
2116
2169
  }
2117
2170
 
2118
- export { type FieldInlineContent as $, type AbstractNumbering as A, type BlockContent as B, type CellMarker as C, type DrawingScene as D, type EndnoteProperties as E, type FootnoteProperties as F, type CommentAnchorRange as G, type HeaderFooter as H, type CommentAuthor as I, type CommentRangeEnd as J, type CommentRangeStart as K, type CommentReferenceContent as L, type ComplexField as M, type NoteKind as N, type ContentPosition as O, type Paragraph as P, DEFAULT_WATERMARK_PRESETS as Q, type RevisionInfo as R, type SectionProperties as S, type Deletion as T, type DrawingContent as U, type DrawingSceneNode as V, type Watermark as W, type EndnotePosition as X, type Field as Y, type FieldCharContent as Z, type FieldFormData as _, type SdtControlState as a, type StructuredFieldContent as a$, type FieldType as a0, type FooterReference as a1, type FootnotePosition as a2, type HeaderFooterType as a3, type HeaderReference as a4, type Hyperlink as a5, type HyperlinkContent as a6, type Image as a7, type ImageCrop as a8, type ImageEffect as a9, type NoteSeparatorReference as aA, type NumberFormat as aB, type NumberingInstance as aC, type PageNumberingProperties as aD, type PageOrientation as aE, type ParagraphContent as aF, type ParagraphPropertyChange as aG, type PictureWatermark as aH, type PropertyChangeInfo as aI, type Run as aJ, type RunContent as aK, type RunPropertyChange as aL, type SdtCheckboxGlyph as aM, type SdtDataBinding as aN, type SdtDateState as aO, type SdtGalleryState as aP, type SdtType as aQ, type Section as aR, type SectionStart as aS, type SeparatorContent as aT, type Shape as aU, type ShapeContent as aV, type ShapeFillPaint as aW, type ShapeStrokePaint as aX, type ShapeTextBody as aY, type SimpleField as aZ, type SoftHyphenContent as a_, type ImageHyperlink as aa, type ImagePadding as ab, type ImagePosition as ac, type ImageRotationBounds as ad, type ImageSize as ae, type ImageTransform as af, type ImageWrap as ag, type ImageWrapPoint as ah, type InlineSdt as ai, type Insertion as aj, type InstrTextContent as ak, type LevelSuffix as al, type LineNumberRestart as am, type ListLevel as an, type ListRendering as ao, type MathEquation as ap, type MoveFrom as aq, type MoveFromRangeEnd as ar, type MoveFromRangeStart as as, type MoveTo as at, type MoveToRangeEnd as au, type MoveToRangeStart as av, type NoBreakHyphenContent as aw, type NoteNumberRestart as ax, type NoteRefMarkContent as ay, type NoteReferenceContent as az, type SdtProperties as b, type StructuredFieldTree as b0, type SymbolContent as b1, type TabContent as b2, type Table as b3, type TableCell as b4, type TableCellPropertyChange as b5, type TablePropertyChange as b6, type TableRow as b7, type TableRowPropertyChange as b8, type TableStructuralChangeInfo as b9, type TextBox as ba, type TextContent as bb, type TextWatermark as bc, type TrackedChangeInfo as bd, type TrackedRunChange as be, type VerticalAlign as bf, pictureWatermarkDisplayEmu as bg, type ShapeEffect as c, type ShapeTextBodyProperties as d, type Chart as e, type Comment as f, type DocumentBody as g, type NumberingDefinitions as h, type Footnote as i, type Endnote as j, type BookmarkRange as k, type BlockSdt as l, type BookmarkEnd as m, type BookmarkStart as n, type BreakContent as o, type ChartAxis as p, type ChartContent as q, type ChartDataLabels as r, type ChartGrouping as s, type ChartLegend as t, type ChartPlotGroup as u, type ChartPoint as v, type ChartPointLabel as w, type ChartSeries as x, type ChartType as y, type Column as z };
2171
+ export { type FieldInlineContent as $, type AbstractNumbering as A, type BlockContent as B, type CellMarker as C, type DrawingScene as D, type EndnoteProperties as E, type FootnoteProperties as F, type CommentAnchorRange as G, type HeaderFooter as H, type CommentAuthor as I, type CommentRangeEnd as J, type CommentRangeStart as K, type CommentReferenceContent as L, type ComplexField as M, type NoteKind as N, type ContentPosition as O, type Paragraph as P, DEFAULT_WATERMARK_PRESETS as Q, type RevisionInfo as R, type SdtControlState as S, type Deletion as T, type DrawingContent as U, type DrawingSceneNode as V, type Watermark as W, type EndnotePosition as X, type Field as Y, type FieldCharContent as Z, type FieldFormData as _, type SdtProperties as a, type SoftHyphenContent as a$, type FieldType as a0, type FooterReference as a1, type FootnotePosition as a2, type HeaderFooterType as a3, type HeaderReference as a4, type HorizontalRuleContent as a5, type Hyperlink as a6, type HyperlinkContent as a7, type Image as a8, type ImageCrop as a9, type NoteReferenceContent as aA, type NoteSeparatorReference as aB, type NumberFormat as aC, type NumberingInstance as aD, type PageNumberingProperties as aE, type PageOrientation as aF, type ParagraphContent as aG, type ParagraphPropertyChange as aH, type PictureWatermark as aI, type PropertyChangeInfo as aJ, type Run as aK, type RunContent as aL, type RunPropertyChange as aM, type SdtCheckboxGlyph as aN, type SdtDataBinding as aO, type SdtDateState as aP, type SdtGalleryState as aQ, type SdtType as aR, type Section as aS, type SectionStart as aT, type SeparatorContent as aU, type Shape as aV, type ShapeContent as aW, type ShapeFillPaint as aX, type ShapeStrokePaint as aY, type ShapeTextBody as aZ, type SimpleField as a_, type ImageEffect as aa, type ImageHyperlink as ab, type ImagePadding as ac, type ImagePosition as ad, type ImageRotationBounds as ae, type ImageSize as af, type ImageTransform as ag, type ImageWrap as ah, type ImageWrapPoint as ai, type InlineSdt as aj, type Insertion as ak, type InstrTextContent as al, type LevelSuffix as am, type LineNumberRestart as an, type ListLevel as ao, type ListRendering as ap, type MathEquation as aq, type MoveFrom as ar, type MoveFromRangeEnd as as, type MoveFromRangeStart as at, type MoveTo as au, type MoveToRangeEnd as av, type MoveToRangeStart as aw, type NoBreakHyphenContent as ax, type NoteNumberRestart as ay, type NoteRefMarkContent as az, type ShapeEffect as b, type StructuredFieldContent as b0, type StructuredFieldTree as b1, type SymbolContent as b2, type TabContent as b3, type Table as b4, type TableCell as b5, type TableCellPropertyChange as b6, type TablePropertyChange as b7, type TableRow as b8, type TableRowPropertyChange as b9, type TableStructuralChangeInfo as ba, type TextBox as bb, type TextContent as bc, type TextWatermark as bd, type TrackedChangeInfo as be, type TrackedRunChange as bf, type VerticalAlign as bg, pictureWatermarkDisplayEmu as bh, type RawXml as bi, type ShapeTextBodyProperties as c, type Chart as d, type Comment as e, type SectionProperties as f, type DocumentBody as g, type NumberingDefinitions as h, type Footnote as i, type Endnote as j, type BookmarkRange as k, type BlockSdt as l, type BookmarkEnd as m, type BookmarkStart as n, type BreakContent as o, type ChartAxis as p, type ChartContent as q, type ChartDataLabels as r, type ChartGrouping as s, type ChartLegend as t, type ChartPlotGroup as u, type ChartPoint as v, type ChartPointLabel as w, type ChartSeries as x, type ChartType as y, type Column as z };
package/dist/core.d.mts CHANGED
@@ -1,15 +1,15 @@
1
1
  export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from './selectiveSave-CRh-_Y_C.mjs';
2
2
  import { Document } from './types/document.mjs';
3
3
  export { DocxPackage } from './types/document.mjs';
4
- import { g as DocumentBody, S as SectionProperties, b3 as Table } from './content-DrqzbIr7.mjs';
5
- export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, f as Comment, J as CommentRangeEnd, K as CommentRangeStart, T as Deletion, j as Endnote, Y as Field, a1 as FooterReference, i as Footnote, H as HeaderFooter, a4 as HeaderReference, a5 as Hyperlink, a7 as Image, aj as Insertion, an as ListLevel, aq as MoveFrom, at as MoveTo, h as NumberingDefinitions, P as Paragraph, aF as ParagraphContent, aJ as Run, aK as RunContent, aU as Shape, b4 as TableCell, b7 as TableRow, ba as TextBox, bb as TextContent, bd as TrackedChangeInfo, be as TrackedRunChange } from './content-DrqzbIr7.mjs';
4
+ import { g as DocumentBody, f as SectionProperties, b4 as Table } from './content-CvEtPl0c.mjs';
5
+ export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, T as Deletion, j as Endnote, Y as Field, a1 as FooterReference, i as Footnote, H as HeaderFooter, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, ak as Insertion, ao as ListLevel, ar as MoveFrom, au as MoveTo, h as NumberingDefinitions, P as Paragraph, aG as ParagraphContent, aK as Run, aL as RunContent, aV as Shape, b5 as TableCell, b8 as TableRow, bb as TextBox, bc as TextContent, be as TrackedChangeInfo, bf as TrackedRunChange } from './content-CvEtPl0c.mjs';
6
6
  export { emuToPixels, emuToTwips, formatPx, halfPointsToPixels, pixelsToEmu, pixelsToTwips, pointsToPixels, twipsToEmu, twipsToPixels } from './utils/units.mjs';
7
- export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-DnixuYST.mjs';
7
+ export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-b8eicJKV.mjs';
8
8
  export { D as DocxInput, t as toArrayBuffer } from './docxInput-DTbCa48g.mjs';
9
9
  export { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext } from './plugin-api/index.mjs';
10
- export { B as BlockExtent, F as FootnoteContent, a as Layout, L as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-CXLxVF1t.mjs';
11
- export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-BqrFPeev.mjs';
12
- export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-CMybYYHS.mjs';
10
+ export { B as BlockExtent, F as FootnoteContent, L as Layout, b as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-C4A8mWjU.mjs';
11
+ export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-7zKCTu5a.mjs';
12
+ export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-7e-mq3c-.mjs';
13
13
  import './docx/wrapTypes.mjs';
14
14
 
15
15
  /**
@@ -253,6 +253,6 @@ declare class ErrorManager extends Subscribable<ErrorManagerSnapshot> {
253
253
  * @packageDocumentation
254
254
  * @public
255
255
  */
256
- declare const VERSION = "0.0.2";
256
+ declare const VERSION: string;
257
257
 
258
258
  export { type CellCoordinates, Document, DocumentBody, ErrorManager, type ErrorManagerSnapshot, type ErrorNotification, type ErrorSeverity, type PrintOptions, SectionProperties, Subscribable, TABLE_DATA_ATTRIBUTES, Table, TableSelectionManager, type TableSelectionSnapshot, VERSION, deleteTableFromDocument, findTableFromClick, formatPageRange, getDefaultPrintOptions, getTableFromDocument, isPrintSupported, openPrintWindow, parsePageRange, serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties, triggerPrint, updateTableInDocument };
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-PI2I3TO5.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-BUZ2X5CT.mjs';import'./chunk-TMHG7OAZ.mjs';import'./chunk-HLDJMU3R.mjs';import'./chunk-GHEHBYQK.mjs';import'./chunk-5F6DLQZP.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var ce={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function me(){return {...ce}}function de(){typeof window<"u"&&window.print();}var fe="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function ge(t="Document",r){if(typeof window>"u")return null;let e=window.open("","_blank");if(!e)return null;e.opener=null;let n=e.document;n.title=t;let o=n.createElement("style");o.textContent=fe,n.head.appendChild(o);let i=new DOMParser().parseFromString(r,"text/html");for(let l of Array.from(i.body.childNodes))n.body.appendChild(n.importNode(l,true));return e}function he(t,r){if(!t||!t.trim())return null;let e=t.trim();if(/^\d+$/.test(e)){let o=parseInt(e,10);return o>=1&&o<=r?{start:o,end:o}:null}let n=e.match(/^(\d+)-(\d+)$/);if(n){let o=parseInt(n[1],10),i=parseInt(n[2],10);if(o>=1&&i<=r&&o<=i)return {start:o,end:i}}return null}function Te(t,r){return t?t.start===t.end?`Page ${t.start}`:`Pages ${t.start}-${t.end}`:`All (${r} pages)`}function be(){return typeof window<"u"&&typeof window.print=="function"}var s=class{constructor(r){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=r;}setSnapshot(r){this.snapshot=r,this.notify();}notify(){for(let r of this.listeners)r();}};var c={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function g(t,r){if(!(t instanceof Element))return null;let e=t;for(;e&&e!==r;){if(e.tagName==="TD"||e.tagName==="TH"){let n=e.getAttribute(c.ROW_INDEX),o=e.getAttribute(c.COLUMN_INDEX);if(n!==null&&o!==null){let i=e;for(;i&&i!==r;){if(i.tagName==="TABLE"){let l=i.getAttribute(c.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(n,10),columnIndex:parseInt(o,10)};break}i=i.parentElement;}}break}e=e.parentElement;}return null}function h(t,r){if(!t.package?.document?.content)return null;let e=0;for(let n of t.package.document.content)if(n.type==="table"){if(e===r)return n;e++;}return null}function T(t,r,e){if(!t.package?.document?.content)return t;let n=0,o=t.package.document.content.map(i=>{if(i.type==="table"){if(n===r)return n++,e;n++;}return i});return {...t,package:{...t.package,document:{...t.package.document,content:o}}}}function b(t,r){if(!t.package?.document?.content)return t;let e=0,n=t.package.document.content.filter(o=>{if(o.type==="table"){let i=e===r;return e++,!i}return true});return {...t,package:{...t.package,document:{...t.package.document,content:n}}}}var m=class extends s{constructor(){super({selectedCell:null});}selectCell(r){this.setSnapshot({selectedCell:r});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(r,e,n){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===r&&o.rowIndex===e&&o.columnIndex===n:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var d=class extends s{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(e,n){return this.addNotification(e,"error",n)}showWarning(e,n){return this.addNotification(e,"warning",n)}showInfo(e,n){return this.addNotification(e,"info",n)}dismiss(e){this.notifications=this.notifications.map(o=>o.id===e?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==e),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,n,o){let i=`error-${++this.idCounter}-${Date.now()}`,l={id:i,message:e,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),n!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(i);},5e3);this.timers.add(f);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Me="0.0.2";export{d as ErrorManager,s as Subscribable,c as TABLE_DATA_ATTRIBUTES,m as TableSelectionManager,Me as VERSION,b as deleteTableFromDocument,g as findTableFromClick,Te as formatPageRange,me as getDefaultPrintOptions,h as getTableFromDocument,be as isPrintSupported,ge as openPrintWindow,he as parsePageRange,de as triggerPrint,T as updateTableInDocument};
1
+ export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,g as updateMultipleFiles}from'./chunk-AFMVSI4Z.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-JHJLG4I6.mjs';import'./chunk-6LQJAKOC.mjs';import'./chunk-HLDJMU3R.mjs';import'./chunk-ACGKK7IB.mjs';import'./chunk-5F6DLQZP.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var g="0.2.0";var ct={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function ft(){return {...ct}}function gt(){typeof window<"u"&&window.print();}var yt="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function xt(e="Document",s){if(typeof window>"u")return null;let t=window.open("","_blank");if(!t)return null;t.opener=null;let i=t.document;i.title=e;let o=i.createElement("style");o.textContent=yt,i.head.appendChild(o);let n=new DOMParser().parseFromString(s,"text/html");for(let l of Array.from(n.body.childNodes))i.body.appendChild(i.importNode(l,true));return t}function ht(e,s){if(!e||!e.trim())return null;let t=e.trim();if(/^\d+$/.test(t)){let o=parseInt(t,10);return o>=1&&o<=s?{start:o,end:o}:null}let i=t.match(/^(\d+)-(\d+)$/);if(i){let o=parseInt(i[1],10),n=parseInt(i[2],10);if(o>=1&&n<=s&&o<=n)return {start:o,end:n}}return null}function bt(e,s){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${s} pages)`}function Tt(){return typeof window<"u"&&typeof window.print=="function"}var a=class{constructor(s){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",s=>(this.listeners.add(s),()=>{this.listeners.delete(s);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=s;}setSnapshot(s){this.snapshot=s,this.notify();}notify(){for(let s of this.listeners)s();}};var m={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function y(e,s){if(!(e instanceof Element))return null;let t=e;for(;t&&t!==s;){if(t.tagName==="TD"||t.tagName==="TH"){let i=t.getAttribute(m.ROW_INDEX),o=t.getAttribute(m.COLUMN_INDEX);if(i!==null&&o!==null){let n=t;for(;n&&n!==s;){if(n.tagName==="TABLE"){let l=n.getAttribute(m.TABLE_INDEX);if(l!==null)return {tableIndex:parseInt(l,10),rowIndex:parseInt(i,10),columnIndex:parseInt(o,10)};break}n=n.parentElement;}}break}t=t.parentElement;}return null}function x(e,s){if(!e.package?.document?.content)return null;let t=0;for(let i of e.package.document.content)if(i.type==="table"){if(t===s)return i;t++;}return null}function h(e,s,t){if(!e.package?.document?.content)return e;let i=0,o=e.package.document.content.map(n=>{if(n.type==="table"){if(i===s)return i++,t;i++;}return n});return {...e,package:{...e.package,document:{...e.package.document,content:o}}}}function b(e,s){if(!e.package?.document?.content)return e;let t=0,i=e.package.document.content.filter(o=>{if(o.type==="table"){let n=t===s;return t++,!n}return true});return {...e,package:{...e.package,document:{...e.package.document,content:i}}}}var u=class extends a{constructor(){super({selectedCell:null});}selectCell(s){this.setSnapshot({selectedCell:s});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(s,t,i){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===s&&o.rowIndex===t&&o.columnIndex===i:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var c=class extends a{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(t,i){return this.addNotification(t,"error",i)}showWarning(t,i){return this.addNotification(t,"warning",i)}showInfo(t,i){return this.addNotification(t,"info",i)}dismiss(t){this.notifications=this.notifications.map(o=>o.id===t?{...o,dismissed:true}:o),this.emitSnapshot();let i=setTimeout(()=>{this.timers.delete(i),this.notifications=this.notifications.filter(o=>o.id!==t),this.emitSnapshot();},300);this.timers.add(i);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,i,o){let n=`error-${++this.idCounter}-${Date.now()}`,l={id:n,message:t,severity:i,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,l],this.emitSnapshot(),i!=="error"){let f=setTimeout(()=>{this.timers.delete(f),this.dismiss(n);},5e3);this.timers.add(f);}return n}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Wt=g;export{c as ErrorManager,a as Subscribable,m as TABLE_DATA_ATTRIBUTES,u as TableSelectionManager,Wt as VERSION,b as deleteTableFromDocument,y as findTableFromClick,bt as formatPageRange,ft as getDefaultPrintOptions,x as getTableFromDocument,Tt as isPrintSupported,xt as openPrintWindow,ht as parsePageRange,gt as triggerPrint,h as updateTableInDocument};
@@ -1,5 +1,5 @@
1
- import { I as ImagePrimitive, D as DisplayList } from './frameDelta-DMgR8n13.mjs';
2
- import { R as RustDisplayListQueryEngine } from './rustDisplayList-B9dQoLHI.mjs';
1
+ import { I as ImagePrimitive, D as DisplayList } from './frameDelta-pA4jrQ1G.mjs';
2
+ import { R as RustDisplayListQueryEngine } from './rustDisplayList-BJqaN9tt.mjs';
3
3
 
4
4
  /**
5
5
  * Locate an image primitive in a built DisplayList by its document position.
@@ -1,10 +1,10 @@
1
1
  export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from '../selectiveSave-CRh-_Y_C.mjs';
2
2
  import { WrapType } from './wrapTypes.mjs';
3
- import { B as BlockContent, f as Comment, W as Watermark } from '../content-DrqzbIr7.mjs';
3
+ import { B as BlockContent, e as Comment, W as Watermark } from '../content-CvEtPl0c.mjs';
4
4
  import { Document } from '../types/document.mjs';
5
5
  import '../docxInput-DTbCa48g.mjs';
6
- import '../formatting-BqrFPeev.mjs';
7
- import '../styles-CMybYYHS.mjs';
6
+ import '../formatting-7zKCTu5a.mjs';
7
+ import '../styles-7e-mq3c-.mjs';
8
8
 
9
9
  type AnchorWrapType = Exclude<WrapType, 'inline'>;
10
10
  type ImageLayoutTarget = AnchorWrapType | 'squareLeft' | 'squareRight' | 'inline';
@@ -1,2 +1,2 @@
1
- import {e}from'../chunk-PI2I3TO5.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-PI2I3TO5.mjs';import'../chunk-BUZ2X5CT.mjs';import'../chunk-TMHG7OAZ.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-GHEHBYQK.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
1
+ import {e}from'../chunk-AFMVSI4Z.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-AFMVSI4Z.mjs';import'../chunk-JHJLG4I6.mjs';import'../chunk-6LQJAKOC.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-ACGKK7IB.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
2
2
  export{_ as IMAGE_LAYOUT_OPTIONS,E as calculateResizedImageDimensions,W as deriveLayoutChoice,$ as getDocumentWatermark,K as injectReplyRangeMarkers,X as injectTCReplyRangeMarkers,B as isImageLayoutOptionEnabled,q as resolveImageLayoutAttrs,Y as setDocumentWatermark,z as toolbarValueToLayoutTarget};
@@ -1,13 +1,13 @@
1
1
  import { R as ResidentMeasurementConfig } from '../rustMeasureSource-C0EZB055.mjs';
2
- import { L as LayoutBlock, B as BlockExtent, a as Layout, b as LayoutOptions } from '../types-CXLxVF1t.mjs';
2
+ import { L as Layout, a as LayoutOptions } from '../types-C4A8mWjU.mjs';
3
3
  import { MeasuredBlock } from '../layout/pagination/index.mjs';
4
- import { D as DisplayListHeadersFooters } from '../rustDisplayList-B9dQoLHI.mjs';
4
+ import { D as DisplayListHeadersFooters } from '../rustDisplayList-BJqaN9tt.mjs';
5
5
  import { Document } from '../types/document.mjs';
6
- import { Y as YrsSession, a as YrsRenderEnv } from '../index-ImoMd0Ju.mjs';
7
- import { S as SectionProperties, N as NoteKind } from '../content-DrqzbIr7.mjs';
8
- import '../formatting-BqrFPeev.mjs';
9
- import '../frameDelta-DMgR8n13.mjs';
10
- import '../styles-CMybYYHS.mjs';
6
+ import { Y as YrsSession, a as YrsRenderEnv } from '../index-CHl2zLJ7.mjs';
7
+ import { f as SectionProperties, N as NoteKind, g as DocumentBody } from '../content-CvEtPl0c.mjs';
8
+ import '../formatting-7zKCTu5a.mjs';
9
+ import '../frameDelta-pA4jrQ1G.mjs';
10
+ import '../styles-7e-mq3c-.mjs';
11
11
  import '../docx/wrapTypes.mjs';
12
12
 
13
13
  interface ResidentRegionLayoutRequest {
@@ -34,13 +34,11 @@ interface ResidentRegionLayoutRequest {
34
34
  interface ComputeLayoutInputs {
35
35
  document: Document | null;
36
36
  pageGap: number;
37
- session: Pick<YrsSession, 'layoutDocumentWithRegionsJson'>;
37
+ session: Pick<YrsSession, 'layoutDocumentWithRegionsRetainedJson' | 'residentWorkerProbe' | 'retainedKernelInputsJson'>;
38
38
  renderEnv: YrsRenderEnv;
39
39
  measurement: ResidentMeasurementConfig;
40
40
  }
41
41
  interface LayoutComputation {
42
- blocks: LayoutBlock[];
43
- measures: BlockExtent[];
44
42
  layout: Layout;
45
43
  notesConverged: boolean;
46
44
  }
@@ -52,4 +50,15 @@ declare function getLayoutKernelInputs(layout: Layout): {
52
50
  } | undefined;
53
51
  declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
54
52
 
55
- export { type ComputeLayoutInputs, type LayoutComputation, buildResidentRegionLayoutRequest, computeLayout, getLayoutKernelInputs };
53
+ /**
54
+ * The last section with inherited references; `finalSectionProperties`
55
+ * is the body sectPr as authored.
56
+ */
57
+ declare function resolvedFinalSectionProperties(body: DocumentBody | null | undefined): SectionProperties | undefined;
58
+ /**
59
+ * Applies an edit to the last section on both views: the resolved entry the
60
+ * engine lays out and the authored sectPr the serializer saves.
61
+ */
62
+ declare function updateFinalSectionProperties(body: DocumentBody, update: (properties: SectionProperties) => SectionProperties): DocumentBody;
63
+
64
+ export { type ComputeLayoutInputs, type LayoutComputation, buildResidentRegionLayoutRequest, computeLayout, getLayoutKernelInputs, resolvedFinalSectionProperties, updateFinalSectionProperties };
@@ -1 +1 @@
1
- import'../chunk-TTRUPDAB.mjs';var r=new WeakMap;function p(e){let n=e?.package.document;if(!n)return [{properties:{}}];let t=(n.sections??[]).map(o=>({sectionId:o.id??o.properties.sectionId,properties:o.properties}));return t.push({sectionId:n.finalSectionProperties?.sectionId,properties:n.finalSectionProperties??{}}),t}function a(e,n,t){let o=[];for(let s of e?.package.footnotes??[])s.noteType&&s.noteType!=="normal"||o.push({id:s.id,noteKind:"footnote",height:0});for(let s of e?.package.endnotes??[])s.noteType&&s.noteType!=="normal"||o.push({id:s.id,noteKind:"endnote",height:0});return {bodyStory:"body",options:{contractVersion:e?.package.contractVersion,pageGap:n},regions:{sections:p(e),settings:e?.package.settings,watermark:e?.package.document.finalSectionProperties?.watermark},notes:{contents:o},renderEnv:t}}function d(e){return r.get(e)}function c(e){let n=a(e.document,e.pageGap,e.renderEnv);n.measurement=e.measurement;let t=JSON.parse(e.session.layoutDocumentWithRegionsJson(JSON.stringify(n)));return r.set(t.layout,{measured:t.measured,options:t.options,...t.headersFooters?{headersFooters:t.headersFooters}:{}}),{blocks:t.measured.map(o=>o.block),measures:t.measured.map(o=>o.measure),layout:t.layout,notesConverged:t.notesConverged}}export{a as buildResidentRegionLayoutRequest,c as computeLayout,d as getLayoutKernelInputs};
1
+ import'../chunk-TTRUPDAB.mjs';function i(e){return e?.sections?.at(-1)?.properties??e?.finalSectionProperties}function l(e,r){let n=e.sections?.map((t,o,s)=>o===s.length-1?{...t,properties:r(t.properties)}:t);return {...e,...n?{sections:n}:{},finalSectionProperties:r(e.finalSectionProperties??{})}}var d=new WeakMap;function y(e){let r=e?.package.document;if(!r)return [{properties:{}}];let n=(r.sections??[]).map(t=>({sectionId:t.id??t.properties.sectionId,properties:t.properties}));return n.push({sectionId:n.at(-1)?.sectionId??r.finalSectionProperties?.sectionId,properties:i(r)??{}}),n}function c(e,r,n){let t=[];for(let o of e?.package.footnotes??[])o.noteType&&o.noteType!=="normal"||t.push({id:o.id,noteKind:"footnote",height:0});for(let o of e?.package.endnotes??[])o.noteType&&o.noteType!=="normal"||t.push({id:o.id,noteKind:"endnote",height:0});return {bodyStory:"body",options:{contractVersion:e?.package.contractVersion,pageGap:r},regions:{sections:y(e),settings:e?.package.settings,watermark:i(e?.package.document)?.watermark},notes:{contents:t},renderEnv:{...n,...m(e,n),tocStyleIds:[...new Set([...n.tocStyleIds??[],...(e?.package.styles?.styles??[]).filter(o=>o.type==="paragraph"&&typeof o.styleId=="string"&&o.styleId&&[o.styleId,o.name].some(s=>/^TOC\s*\d+$/i.test(s??""))).map(o=>o.styleId)])]}}}function m(e,r){if(r.defaultParagraphStyleId)return {};let n=e?.package.styles?.styles??[],t=n.find(s=>s.type==="paragraph"&&s.default&&s.styleId)?.styleId;return t?{defaultParagraphStyleId:t}:n.some(s=>s.type==="paragraph"&&s.styleId==="Normal")?{defaultParagraphStyleId:"Normal"}:{}}function g(e){return d.get(e)}function f(e){let r=c(e.document,e.pageGap,e.renderEnv);r.measurement=e.measurement;let n=e.session,t=JSON.parse(n.layoutDocumentWithRegionsRetainedJson(JSON.stringify(r))),o=n.residentWorkerProbe().layoutRevision,s=null,a=()=>s??(s=JSON.parse(n.retainedKernelInputsJson(o)));return d.set(t.layout,{get measured(){return a().measured},get options(){return a().options},...t.headersFooters?{headersFooters:t.headersFooters}:{}}),{layout:t.layout,notesConverged:t.notesConverged}}export{c as buildResidentRegionLayoutRequest,f as computeLayout,g as getLayoutKernelInputs,i as resolvedFinalSectionProperties,l as updateFinalSectionProperties};
@@ -1,4 +1,4 @@
1
- import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-BqrFPeev.mjs';
1
+ import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-7zKCTu5a.mjs';
2
2
 
3
3
  /**
4
4
  * Color primitives and math shared across OOXML formats.
@@ -389,6 +389,8 @@ interface ParagraphFormatting {
389
389
  spaceBefore?: number;
390
390
  /** Spacing after in twips (w:spacing/@w:after) */
391
391
  spaceAfter?: number;
392
+ spaceBeforeLines?: number;
393
+ spaceAfterLines?: number;
392
394
  /** Line spacing value (w:spacing/@w:line) */
393
395
  lineSpacing?: number;
394
396
  /** Line spacing rule (w:spacing/@w:lineRule) */
@@ -399,8 +401,7 @@ interface ParagraphFormatting {
399
401
  afterAutospacing?: boolean;
400
402
  /**
401
403
  * Per-side flags marking which `<w:spacing>` attrs came from this
402
- * paragraph's own pPr (vs inherited). Word collapses style-inherited
403
- * spacing on empty paragraphs but honors the explicit values.
404
+ * paragraph's own pPr (vs inherited).
404
405
  */
405
406
  spacingExplicit?: SpacingExplicit;
406
407
  /** Left indent in twips (w:ind/@w:left) */
@@ -1,5 +1,5 @@
1
- import { T as TextModernEffects } from './formatting-BqrFPeev.mjs';
2
- import { D as DrawingScene, d as ShapeTextBodyProperties } from './content-DrqzbIr7.mjs';
1
+ import { T as TextModernEffects } from './formatting-7zKCTu5a.mjs';
2
+ import { D as DrawingScene, c as ShapeTextBodyProperties } from './content-CvEtPl0c.mjs';
3
3
 
4
4
  interface DisplayList {
5
5
  /** Contract version. Undefined reads as legacy version 0. */
@@ -435,6 +435,7 @@ interface PageBorderPrimitive {
435
435
  }
436
436
  interface ImagePrimitive extends DocAttrs {
437
437
  kind: 'image';
438
+ shapeType?: string;
438
439
  relId: string;
439
440
  x: number;
440
441
  y: number;