@eigenpal/docx-editor-core 1.1.0 → 1.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 (209) hide show
  1. package/dist/agent/index.d.mts +42 -6
  2. package/dist/agent/index.d.ts +42 -6
  3. package/dist/agent/index.js +1 -1
  4. package/dist/agent/index.mjs +1 -1
  5. package/dist/chunk-2EQGBVPV.js +2 -0
  6. package/dist/chunk-2XP6GLA4.mjs +1 -0
  7. package/dist/{chunk-CTHHUJAB.mjs → chunk-44JKHPGF.mjs} +1 -1
  8. package/dist/{chunk-J4J2Y6EU.js → chunk-4QEETB7U.js} +2 -2
  9. package/dist/{chunk-GFDIPDJ6.mjs → chunk-5BLQHXWK.mjs} +1 -1
  10. package/dist/{chunk-UOQT6A7P.js → chunk-5M7TI6TV.js} +1 -1
  11. package/dist/chunk-6JKM7TWJ.mjs +1 -0
  12. package/dist/{chunk-7Z2AGPNQ.mjs → chunk-7BVHKWEW.mjs} +1 -1
  13. package/dist/chunk-7OW3VCZE.mjs +1 -0
  14. package/dist/chunk-7ZN4WI5N.mjs +4 -0
  15. package/dist/{chunk-GY5BWVM7.js → chunk-AMB6Y77B.js} +1 -1
  16. package/dist/{chunk-H42RXHT4.js → chunk-BXWOLARZ.js} +1 -1
  17. package/dist/chunk-C45EFOVP.js +1 -0
  18. package/dist/chunk-CCPBNE2F.mjs +2 -0
  19. package/dist/{chunk-5CDBSK2R.mjs → chunk-D62KS7QG.mjs} +1 -1
  20. package/dist/chunk-DI6CRWSW.mjs +1 -0
  21. package/dist/chunk-EQAORQC3.mjs +1 -0
  22. package/dist/chunk-FO6IX2DB.js +6 -0
  23. package/dist/chunk-FW23IMBF.mjs +1 -0
  24. package/dist/{chunk-BGE57OES.js → chunk-FYKRDDKG.js} +1 -1
  25. package/dist/chunk-GSKMHXHG.js +1 -0
  26. package/dist/{chunk-MZ2XCZAN.mjs → chunk-GUQFNJHE.mjs} +1 -1
  27. package/dist/chunk-ICE6NC3S.mjs +1 -0
  28. package/dist/chunk-IFUED5ZS.mjs +1 -0
  29. package/dist/chunk-ISKTBM4L.js +1 -0
  30. package/dist/{chunk-73AZQWIE.js → chunk-IYKBX24M.js} +1 -1
  31. package/dist/chunk-KOEWROYV.mjs +6 -0
  32. package/dist/{chunk-IF4C25FN.mjs → chunk-KRN6YSR2.mjs} +1 -1
  33. package/dist/chunk-KZXZWGFX.mjs +1 -0
  34. package/dist/chunk-L24C5TEX.mjs +1 -0
  35. package/dist/chunk-L72YAV5N.js +3 -0
  36. package/dist/chunk-LK6I3HMH.mjs +0 -0
  37. package/dist/chunk-LWH66Q7Q.js +1 -0
  38. package/dist/{chunk-ONRBRDIC.mjs → chunk-MERJFGEP.mjs} +1 -1
  39. package/dist/chunk-PVAVS3IU.js +1 -0
  40. package/dist/{chunk-OUEKNYX5.mjs → chunk-QKLY4F2J.mjs} +1 -1
  41. package/dist/{chunk-LCICADWM.js → chunk-QYF7BRG3.js} +1 -1
  42. package/dist/chunk-ROG4MNOR.js +4 -0
  43. package/dist/{chunk-LOCW6MR2.js → chunk-RORPREG3.js} +1 -1
  44. package/dist/{chunk-HV6HE6YR.js → chunk-SZIOF5SG.js} +3 -3
  45. package/dist/{chunk-W7GLQ6DV.js → chunk-THLJYXFB.js} +1 -1
  46. package/dist/{chunk-25KY5HLN.js → chunk-U4WUDHDK.js} +1 -1
  47. package/dist/{chunk-KGDXHUYC.js → chunk-U4XMGWF7.js} +1 -1
  48. package/dist/chunk-U67MWOPZ.mjs +1 -0
  49. package/dist/chunk-VMRUBLPI.js +1 -0
  50. package/dist/chunk-WLDI6N3B.mjs +3 -0
  51. package/dist/chunk-WVERBZZU.js +1 -0
  52. package/dist/chunk-XCKTBNKN.js +1 -0
  53. package/dist/chunk-Z5MJYQSD.mjs +1 -0
  54. package/dist/chunk-ZBFNOJGY.js +1 -0
  55. package/dist/{content-5Mrz6w_b.d.mts → content-CE-ZdMwG.d.mts} +167 -109
  56. package/dist/{content-CmqAwdFL.d.ts → content-CYXJ2tfQ.d.ts} +167 -109
  57. package/dist/contentControlValues-DAwTWfgR.d.mts +187 -0
  58. package/dist/contentControlValues-gyVPsi6m.d.ts +187 -0
  59. package/dist/core-plugins.d.mts +1 -1
  60. package/dist/core-plugins.d.ts +1 -1
  61. package/dist/core-plugins.js +1 -1
  62. package/dist/core-plugins.mjs +1 -1
  63. package/dist/core.d.mts +6 -6
  64. package/dist/core.d.ts +6 -6
  65. package/dist/core.js +1 -1
  66. package/dist/core.mjs +1 -1
  67. package/dist/{documentSerializer-DgO3A9av.d.mts → documentSerializer-Bghq9rFI.d.mts} +1 -1
  68. package/dist/{documentSerializer-BRaaXIHm.d.ts → documentSerializer-C4lFC60P.d.ts} +1 -1
  69. package/dist/documentStyles-D87dxl18.d.mts +34 -0
  70. package/dist/documentStyles-DToJv9co.d.ts +34 -0
  71. package/dist/docx/index.d.mts +1 -1
  72. package/dist/docx/index.d.ts +1 -1
  73. package/dist/docx/index.js +1 -1
  74. package/dist/docx/index.mjs +1 -1
  75. package/dist/docx/parser.d.mts +1 -1
  76. package/dist/docx/parser.d.ts +1 -1
  77. package/dist/docx/parser.js +1 -1
  78. package/dist/docx/parser.mjs +1 -1
  79. package/dist/docx/rezip.d.mts +1 -1
  80. package/dist/docx/rezip.d.ts +1 -1
  81. package/dist/docx/rezip.js +1 -1
  82. package/dist/docx/rezip.mjs +1 -1
  83. package/dist/docx/serializer/index.d.mts +2 -2
  84. package/dist/docx/serializer/index.d.ts +2 -2
  85. package/dist/docx/serializer/index.js +1 -1
  86. package/dist/docx/serializer/index.mjs +1 -1
  87. package/dist/{fontLoader-CK2QLq68.d.ts → fontLoader-Cm02v7PO.d.ts} +1 -1
  88. package/dist/{fontLoader-8b4X-AIh.d.mts → fontLoader-Z7pqeNvZ.d.mts} +1 -1
  89. package/dist/{headerFooterLayout-Ca4ESDHF.d.ts → headerFooterLayout-Bd58Tum3.d.ts} +1 -1
  90. package/dist/{headerFooterLayout-72Vz7yp3.d.mts → headerFooterLayout-CuIJiIzi.d.mts} +1 -1
  91. package/dist/headless.d.mts +5 -4
  92. package/dist/headless.d.ts +5 -4
  93. package/dist/headless.js +1 -1
  94. package/dist/headless.mjs +1 -1
  95. package/dist/layout-bridge/index.d.mts +2 -2
  96. package/dist/layout-bridge/index.d.ts +2 -2
  97. package/dist/layout-bridge/index.js +1 -1
  98. package/dist/layout-bridge/index.mjs +1 -1
  99. package/dist/layout-bridge/measuring/index.d.mts +1 -1
  100. package/dist/layout-bridge/measuring/index.d.ts +1 -1
  101. package/dist/layout-bridge/tableInsertHover.js +1 -1
  102. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  103. package/dist/layout-bridge/toFlowBlocks.d.mts +1 -1
  104. package/dist/layout-bridge/toFlowBlocks.d.ts +1 -1
  105. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  106. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  107. package/dist/layout-engine/index.d.mts +2 -2
  108. package/dist/layout-engine/index.d.ts +2 -2
  109. package/dist/layout-engine/types.d.mts +31 -2
  110. package/dist/layout-engine/types.d.ts +31 -2
  111. package/dist/layout-painter/index.d.mts +4 -3
  112. package/dist/layout-painter/index.d.ts +4 -3
  113. package/dist/layout-painter/index.js +1 -1
  114. package/dist/layout-painter/index.mjs +1 -1
  115. package/dist/layout-painter/renderPage.d.mts +27 -3
  116. package/dist/layout-painter/renderPage.d.ts +27 -3
  117. package/dist/layout-painter/renderPage.js +1 -1
  118. package/dist/layout-painter/renderPage.mjs +1 -1
  119. package/dist/managers/AutoSaveManager.d.mts +1 -1
  120. package/dist/managers/AutoSaveManager.d.ts +1 -1
  121. package/dist/managers/TableSelectionManager.d.mts +1 -1
  122. package/dist/managers/TableSelectionManager.d.ts +1 -1
  123. package/dist/managers/types.d.mts +1 -1
  124. package/dist/managers/types.d.ts +1 -1
  125. package/dist/mcp-cli.mjs +23 -23
  126. package/dist/mcp.d.mts +1 -1
  127. package/dist/mcp.d.ts +1 -1
  128. package/dist/mcp.js +3 -3
  129. package/dist/mcp.mjs +1 -1
  130. package/dist/{nodes-CC_nwkT_.d.ts → nodes-BNkRKBBX.d.ts} +1 -1
  131. package/dist/{nodes-7753Bgi_.d.mts → nodes-Bz-UHhLE.d.mts} +1 -1
  132. package/dist/prosemirror/commands/formatting.js +1 -1
  133. package/dist/prosemirror/commands/formatting.mjs +1 -1
  134. package/dist/prosemirror/commands/index.js +1 -1
  135. package/dist/prosemirror/commands/index.mjs +1 -1
  136. package/dist/prosemirror/commands/paragraph.js +1 -1
  137. package/dist/prosemirror/commands/paragraph.mjs +1 -1
  138. package/dist/prosemirror/conversion/fromProseDoc.d.mts +2 -2
  139. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -2
  140. package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
  141. package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
  142. package/dist/prosemirror/conversion/index.d.mts +3 -3
  143. package/dist/prosemirror/conversion/index.d.ts +3 -3
  144. package/dist/prosemirror/conversion/index.js +1 -1
  145. package/dist/prosemirror/conversion/index.mjs +1 -1
  146. package/dist/prosemirror/editor.css +147 -0
  147. package/dist/prosemirror/extensions/index.js +1 -1
  148. package/dist/prosemirror/extensions/index.mjs +1 -1
  149. package/dist/prosemirror/index.d.mts +94 -6
  150. package/dist/prosemirror/index.d.ts +94 -6
  151. package/dist/prosemirror/index.js +3 -1
  152. package/dist/prosemirror/index.mjs +3 -1
  153. package/dist/prosemirror/plugins/index.d.mts +4 -1
  154. package/dist/prosemirror/plugins/index.d.ts +4 -1
  155. package/dist/prosemirror/plugins/index.js +1 -1
  156. package/dist/prosemirror/plugins/index.mjs +1 -1
  157. package/dist/prosemirror/schema/index.d.mts +2 -2
  158. package/dist/prosemirror/schema/index.d.ts +2 -2
  159. package/dist/prosemirror/schema/index.js +1 -1
  160. package/dist/prosemirror/schema/index.mjs +1 -1
  161. package/dist/prosemirror/styles/index.d.mts +9 -0
  162. package/dist/prosemirror/styles/index.d.ts +9 -0
  163. package/dist/prosemirror/styles/index.js +1 -1
  164. package/dist/prosemirror/styles/index.mjs +1 -1
  165. package/dist/prosemirror/utils/extractTrackedChanges.d.mts +1 -1
  166. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +1 -1
  167. package/dist/types/content.d.mts +1 -1
  168. package/dist/types/content.d.ts +1 -1
  169. package/dist/types/document.d.mts +2 -2
  170. package/dist/types/document.d.ts +2 -2
  171. package/dist/utils/comments.d.mts +1 -1
  172. package/dist/utils/comments.d.ts +1 -1
  173. package/dist/utils/index.d.mts +2 -2
  174. package/dist/utils/index.d.ts +2 -2
  175. package/dist/{variableDetector-DF3-nxUC.d.mts → variableDetector-C7BLz9sJ.d.mts} +1 -1
  176. package/dist/{variableDetector-sBkgVh3f.d.ts → variableDetector-HPZbJ_gw.d.ts} +1 -1
  177. package/package.json +1 -1
  178. package/dist/chunk-CA2EYL6T.mjs +0 -1
  179. package/dist/chunk-D4RPOJC7.js +0 -1
  180. package/dist/chunk-DLCDDB66.mjs +0 -3
  181. package/dist/chunk-F44ZLDZS.js +0 -4
  182. package/dist/chunk-FEWCI2E5.mjs +0 -1
  183. package/dist/chunk-FWTP7BN7.mjs +0 -4
  184. package/dist/chunk-GM4USWKO.js +0 -2
  185. package/dist/chunk-GWBVJZVT.js +0 -3
  186. package/dist/chunk-HMBVSDCH.mjs +0 -1
  187. package/dist/chunk-ILJUDEZ5.mjs +0 -1
  188. package/dist/chunk-IP2VXNWG.js +0 -1
  189. package/dist/chunk-IQG3KLWY.mjs +0 -2
  190. package/dist/chunk-KHF4JU7D.mjs +0 -1
  191. package/dist/chunk-LBKMYD3M.mjs +0 -1
  192. package/dist/chunk-MZOVDLYL.js +0 -1
  193. package/dist/chunk-NBLJPT54.mjs +0 -1
  194. package/dist/chunk-OAWTQ3IY.js +0 -1
  195. package/dist/chunk-OCAX2KJQ.js +0 -4
  196. package/dist/chunk-ONWOHAFW.mjs +0 -1
  197. package/dist/chunk-OX75Q5ZG.mjs +0 -1
  198. package/dist/chunk-Q4CKLXWA.js +0 -1
  199. package/dist/chunk-RFC2SXZ6.mjs +0 -4
  200. package/dist/chunk-RFVFX5WK.mjs +0 -1
  201. package/dist/chunk-V5VDCQDN.mjs +0 -1
  202. package/dist/chunk-VHUVPHPI.mjs +0 -1
  203. package/dist/chunk-VQWZHPWI.mjs +0 -1
  204. package/dist/chunk-X6HFDXKB.js +0 -1
  205. package/dist/chunk-Y3ZQQI4D.js +0 -1
  206. package/dist/chunk-YTDWMXNS.js +0 -1
  207. package/dist/chunk-ZUGNF5KU.js +0 -1
  208. /package/dist/{chunk-U74VPTIU.js → chunk-53VKL6CG.js} +0 -0
  209. /package/dist/{chunk-FDEDN2RC.mjs → chunk-DTTWBKGN.mjs} +0 -0
@@ -516,111 +516,6 @@ interface Table {
516
516
  rows: TableRow[];
517
517
  }
518
518
 
519
- /**
520
- * Structured Document Tags / content controls (`w:sdt`) — inline and
521
- * block variants, plus properties (alias, tag, lock, list items,
522
- * checkbox state) for the supported SDT types.
523
- */
524
-
525
- /**
526
- * SDT type (content control type)
527
- */
528
- type SdtType = 'richText' | 'plainText' | 'date' | 'dropdown' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'unknown';
529
- /**
530
- * SDT properties (w:sdtPr)
531
- */
532
- interface SdtProperties {
533
- /** SDT type */
534
- sdtType: SdtType;
535
- /** Alias (friendly name) */
536
- alias?: string;
537
- /** Tag (developer identifier) */
538
- tag?: string;
539
- /** Lock content editing */
540
- lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
541
- /** Placeholder text */
542
- placeholder?: string;
543
- /** Whether showing placeholder */
544
- showingPlaceholder?: boolean;
545
- /** Date format for date controls */
546
- dateFormat?: string;
547
- /** Dropdown/combobox list items */
548
- listItems?: {
549
- displayText: string;
550
- value: string;
551
- }[];
552
- /** Checkbox checked state */
553
- checked?: boolean;
554
- }
555
- /**
556
- * Inline SDT (content control within a paragraph)
557
- */
558
- interface InlineSdt {
559
- type: 'inlineSdt';
560
- /** SDT properties */
561
- properties: SdtProperties;
562
- /**
563
- * Inline content held inside the control. OOXML allows runs,
564
- * hyperlinks, simple/complex fields, nested SDTs, and math at this
565
- * level; the renderer must descend into all of them so docProps-bound
566
- * fields and similar template content survive paged rendering.
567
- */
568
- content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | MathEquation)[];
569
- }
570
- /**
571
- * Block-level SDT (content control wrapping paragraphs/tables)
572
- */
573
- interface BlockSdt {
574
- type: 'blockSdt';
575
- /** SDT properties */
576
- properties: SdtProperties;
577
- /** Block content inside the control */
578
- content: (Paragraph | Table)[];
579
- }
580
-
581
- /**
582
- * Comments (`w:comment` in `comments.xml`) and the inline range markers
583
- * (`w:commentRangeStart`/`End`) that anchor them inside paragraphs.
584
- */
585
-
586
- /**
587
- * A comment from `comments.xml` — the top-level entity for review
588
- * comments and replies. `id` matches the inline `CommentRangeStart` /
589
- * `CommentRangeEnd` markers that anchor it inside a paragraph; `parentId`
590
- * threads replies under their parent; `done` reflects Word's "Resolve"
591
- * state (`w15:done`).
592
- */
593
- interface Comment {
594
- /** Comment ID (matches commentRangeStart/End) */
595
- id: number;
596
- /** Author name */
597
- author: string;
598
- /** Author initials */
599
- initials?: string;
600
- /** Date */
601
- date?: string;
602
- /** Comment content (paragraphs) */
603
- content: Paragraph[];
604
- /** Parent comment ID (for replies) */
605
- parentId?: number;
606
- /** Whether the comment is resolved/done */
607
- done?: boolean;
608
- }
609
- /**
610
- * Comment range start marker in paragraph content
611
- */
612
- interface CommentRangeStart {
613
- type: 'commentRangeStart';
614
- id: number;
615
- }
616
- /**
617
- * Comment range end marker in paragraph content
618
- */
619
- interface CommentRangeEnd {
620
- type: 'commentRangeEnd';
621
- id: number;
622
- }
623
-
624
519
  /**
625
520
  * Page furniture — headers (`w:hdr`), footers (`w:ftr`), footnotes
626
521
  * (`w:footnote`), and endnotes (`w:endnote`), plus the section-level
@@ -650,7 +545,7 @@ interface HeaderFooter {
650
545
  /** Header/footer type */
651
546
  hdrFtrType: HeaderFooterType;
652
547
  /** Content (paragraphs, tables, etc.) */
653
- content: (Paragraph | Table)[];
548
+ content: BlockContent[];
654
549
  }
655
550
  /**
656
551
  * Footnote position
@@ -698,7 +593,7 @@ interface Footnote {
698
593
  * widened to match HeaderFooter / TableCell shape so the body pipeline
699
594
  * (toProseDoc → toFlowBlocks) can render them uniformly.
700
595
  */
701
- content: (Paragraph | Table)[];
596
+ content: BlockContent[];
702
597
  }
703
598
  /**
704
599
  * Endnote (w:endnote)
@@ -713,7 +608,50 @@ interface Endnote {
713
608
  * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
714
609
  * the body — paragraphs and tables. See note on `Footnote.content`.
715
610
  */
716
- content: (Paragraph | Table)[];
611
+ content: BlockContent[];
612
+ }
613
+
614
+ /**
615
+ * Comments (`w:comment` in `comments.xml`) and the inline range markers
616
+ * (`w:commentRangeStart`/`End`) that anchor them inside paragraphs.
617
+ */
618
+
619
+ /**
620
+ * A comment from `comments.xml` — the top-level entity for review
621
+ * comments and replies. `id` matches the inline `CommentRangeStart` /
622
+ * `CommentRangeEnd` markers that anchor it inside a paragraph; `parentId`
623
+ * threads replies under their parent; `done` reflects Word's "Resolve"
624
+ * state (`w15:done`).
625
+ */
626
+ interface Comment {
627
+ /** Comment ID (matches commentRangeStart/End) */
628
+ id: number;
629
+ /** Author name */
630
+ author: string;
631
+ /** Author initials */
632
+ initials?: string;
633
+ /** Date */
634
+ date?: string;
635
+ /** Comment content (paragraphs) */
636
+ content: Paragraph[];
637
+ /** Parent comment ID (for replies) */
638
+ parentId?: number;
639
+ /** Whether the comment is resolved/done */
640
+ done?: boolean;
641
+ }
642
+ /**
643
+ * Comment range start marker in paragraph content
644
+ */
645
+ interface CommentRangeStart {
646
+ type: 'commentRangeStart';
647
+ id: number;
648
+ }
649
+ /**
650
+ * Comment range end marker in paragraph content
651
+ */
652
+ interface CommentRangeEnd {
653
+ type: 'commentRangeEnd';
654
+ id: number;
717
655
  }
718
656
 
719
657
  /**
@@ -888,6 +826,126 @@ interface DocumentBody {
888
826
  comments?: Comment[];
889
827
  }
890
828
 
829
+ /**
830
+ * Structured Document Tags / content controls (`w:sdt`) — inline and
831
+ * block variants, plus properties (alias, tag, lock, list items,
832
+ * checkbox state) for the supported SDT types.
833
+ */
834
+
835
+ /**
836
+ * SDT type (content control type).
837
+ *
838
+ * Values mirror the `w:sdtPr` type-marker element names from ECMA-376
839
+ * §17.5.2 (`CT_SdtPr`), with two deliberate exceptions:
840
+ * - `checkbox` is the `w14:checkbox` (Office 2010) extension, not a base
841
+ * OOXML type marker.
842
+ * - `buildingBlockGallery` covers both `w:docPartObj` and `w:docPartList`.
843
+ *
844
+ * A `w:sdtPr` with no type marker means `richText` (the spec default). A
845
+ * type marker the parser does not model maps to `unknown` — it is never
846
+ * coerced to `richText`, so the projection stays honest. Round-trip
847
+ * fidelity does not depend on this enum: the raw `w:sdtPr` is replayed
848
+ * verbatim (see `rawPropertiesXml`).
849
+ */
850
+ type SdtType = 'richText' | 'plainText' | 'date' | 'dropDownList' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'equation' | 'citation' | 'bibliography' | 'unknown';
851
+ /**
852
+ * XML data binding (`w:dataBinding`) — links a content control to a node in a
853
+ * Custom XML data store. Modeled read-only; the binding round-trips verbatim
854
+ * via `rawPropertiesXml` (this projection is for inspection, e.g. "which
855
+ * controls are bound, and to what XPath"). The editor does not resolve or
856
+ * sync bound values.
857
+ */
858
+ interface SdtDataBinding {
859
+ /** XPath into the bound Custom XML part (`w:xpath`). */
860
+ xpath?: string;
861
+ /** Target Custom XML store id (`w:storeItemID`). */
862
+ storeItemID?: string;
863
+ /** Namespace prefix mappings used by the XPath (`w:prefixMappings`). */
864
+ prefixMappings?: string;
865
+ }
866
+ /**
867
+ * SDT properties (`w:sdtPr`).
868
+ *
869
+ * The modeled fields are a **read-only projection** for downstream tooling
870
+ * (tag/alias addressing, template extraction). They are NOT the
871
+ * serialization source: the original `w:sdtPr` is captured verbatim in
872
+ * `rawPropertiesXml` and replayed on save, which preserves element order
873
+ * (`CT_SdtPr` is an `xsd:sequence`), avoids double-emission, and keeps
874
+ * unmodeled features (data binding, `w15:*`, `@lastValue`) lossless.
875
+ */
876
+ interface SdtProperties {
877
+ /** SDT type (projection; see {@link SdtType}). */
878
+ sdtType: SdtType;
879
+ /** Unique numeric id (`w:id`, signed). */
880
+ id?: number;
881
+ /** Alias (friendly name, `w:alias`). */
882
+ alias?: string;
883
+ /** Tag (developer identifier, `w:tag`). */
884
+ tag?: string;
885
+ /** Lock setting (`w:lock`). */
886
+ lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
887
+ /**
888
+ * Placeholder building-block name (`w:placeholder/w:docPart@w:val`).
889
+ * This is a reference to a glossary docPart that supplies the placeholder
890
+ * content — NOT the literal placeholder text.
891
+ */
892
+ placeholder?: string;
893
+ /** Whether the control is currently showing its placeholder (`w:showingPlcHdr`). */
894
+ showingPlaceholder?: boolean;
895
+ /** Date format for date controls (`w:date@w:fullDate`). */
896
+ dateFormat?: string;
897
+ /** Dropdown/combobox list items. */
898
+ listItems?: {
899
+ displayText: string;
900
+ value: string;
901
+ }[];
902
+ /** Checkbox checked state (`w14:checkbox`). */
903
+ checked?: boolean;
904
+ /** XML data binding (`w:dataBinding`), if the control is bound. */
905
+ dataBinding?: SdtDataBinding;
906
+ /**
907
+ * The original `<w:sdtPr>` serialized verbatim as an XML string, captured
908
+ * at parse time. Replayed unchanged on save so the properties block
909
+ * round-trips losslessly. Stored as a string (not an `XmlElement`) so the
910
+ * types layer stays free of the parser/`xml-js` dependency. Absent for
911
+ * SDTs created programmatically — the serializer then synthesizes a
912
+ * minimal, sequence-valid `w:sdtPr` from the modeled fields.
913
+ */
914
+ rawPropertiesXml?: string;
915
+ /** The original `<w:sdtEndPr>` serialized verbatim, if present. */
916
+ rawEndPropertiesXml?: string;
917
+ }
918
+ /**
919
+ * Inline SDT (content control within a paragraph)
920
+ */
921
+ interface InlineSdt {
922
+ type: 'inlineSdt';
923
+ /** SDT properties */
924
+ properties: SdtProperties;
925
+ /**
926
+ * Inline content held inside the control. OOXML allows runs,
927
+ * hyperlinks, simple/complex fields, nested SDTs, and math at this
928
+ * level; the renderer must descend into all of them so docProps-bound
929
+ * fields and similar template content survive paged rendering.
930
+ */
931
+ content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | MathEquation)[];
932
+ }
933
+ /**
934
+ * Block-level SDT (content control wrapping block content).
935
+ *
936
+ * `content` is `BlockContent[]` (not just paragraphs/tables) so a nested
937
+ * block SDT survives the round trip. `CT_SdtContentBlock` also permits
938
+ * run-level content (bookmarks, etc.); that is carried through the same
939
+ * block-content parsing as elsewhere in the document.
940
+ */
941
+ interface BlockSdt {
942
+ type: 'blockSdt';
943
+ /** SDT properties */
944
+ properties: SdtProperties;
945
+ /** Block content inside the control */
946
+ content: BlockContent[];
947
+ }
948
+
891
949
  /**
892
950
  * Paragraph (`w:p`) — the union of inline content that can sit inside a
893
951
  * paragraph (runs, hyperlinks, bookmarks, fields, SDT, comment ranges,
@@ -1357,4 +1415,4 @@ interface Run {
1357
1415
  content: RunContent[];
1358
1416
  }
1359
1417
 
1360
- export type { ImagePadding as $, AbstractNumbering as A, BlockContent as B, Comment as C, Deletion as D, Endnote as E, Footnote as F, DrawingContent as G, Hyperlink as H, Image as I, EndnotePosition as J, EndnoteProperties as K, ListLevel as L, MoveFrom as M, NumberingDefinitions as N, Field as O, Paragraph as P, FieldCharContent as Q, Run as R, SectionProperties as S, Table as T, FieldType as U, FooterReference as V, FootnotePosition as W, FootnoteProperties as X, HeaderFooterType as Y, HeaderReference as Z, ImageCrop as _, CommentRangeEnd as a, ImagePosition as a0, ImageSize as a1, ImageTransform as a2, ImageWrap as a3, InlineSdt as a4, InstrTextContent as a5, LevelSuffix as a6, LineNumberRestart as a7, ListRendering as a8, MathEquation as a9, TextBox as aA, VerticalAlign as aB, MoveFromRangeEnd as aa, MoveFromRangeStart as ab, MoveToRangeEnd as ac, MoveToRangeStart as ad, NoBreakHyphenContent as ae, NoteNumberRestart as af, NoteReferenceContent as ag, NumberingInstance as ah, PageOrientation as ai, PropertyChangeInfo as aj, RunPropertyChange as ak, SdtProperties as al, SdtType as am, Section as an, SectionStart as ao, Shape as ap, ShapeContent as aq, ShapeFill as ar, ShapeOutline as as, ShapeTextBody as at, ShapeType as au, SimpleField as av, SoftHyphenContent as aw, SymbolContent as ax, TabContent as ay, TableStructuralChangeInfo as az, CommentRangeStart as b, DocumentBody as c, Insertion as d, MoveTo as e, ParagraphContent as f, RunContent as g, TableCell as h, TableRow as i, TextContent as j, TrackedChangeInfo as k, TrackedRunChange as l, RevisionInfo as m, CellMarker as n, NumberFormat as o, ParagraphPropertyChange as p, TablePropertyChange as q, TableCellPropertyChange as r, TableRowPropertyChange as s, BreakContent as t, HeaderFooter as u, BlockSdt as v, BookmarkEnd as w, BookmarkStart as x, Column as y, ComplexField as z };
1418
+ export type { HeaderFooterType as $, AbstractNumbering as A, BlockContent as B, Comment as C, Deletion as D, Endnote as E, Footnote as F, BookmarkStart as G, Hyperlink as H, Image as I, Column as J, ComplexField as K, ListLevel as L, MoveFrom as M, NumberingDefinitions as N, DrawingContent as O, Paragraph as P, EndnotePosition as Q, Run as R, SectionProperties as S, Table as T, EndnoteProperties as U, Field as V, FieldCharContent as W, FieldType as X, FooterReference as Y, FootnotePosition as Z, FootnoteProperties as _, CommentRangeEnd as a, HeaderReference as a0, ImageCrop as a1, ImagePadding as a2, ImagePosition as a3, ImageSize as a4, ImageTransform as a5, ImageWrap as a6, InlineSdt as a7, InstrTextContent as a8, LevelSuffix as a9, TableStructuralChangeInfo as aA, TextBox as aB, VerticalAlign as aC, LineNumberRestart as aa, ListRendering as ab, MathEquation as ac, MoveFromRangeEnd as ad, MoveFromRangeStart as ae, MoveToRangeEnd as af, MoveToRangeStart as ag, NoBreakHyphenContent as ah, NoteNumberRestart as ai, NoteReferenceContent as aj, NumberingInstance as ak, PageOrientation as al, PropertyChangeInfo as am, RunPropertyChange as an, Section as ao, SectionStart as ap, Shape as aq, ShapeContent as ar, ShapeFill as as, ShapeOutline as at, ShapeTextBody as au, ShapeType as av, SimpleField as aw, SoftHyphenContent as ax, SymbolContent as ay, TabContent as az, CommentRangeStart as b, DocumentBody as c, Insertion as d, MoveTo as e, ParagraphContent as f, RunContent as g, TableCell as h, TableRow as i, TextContent as j, TrackedChangeInfo as k, TrackedRunChange as l, RevisionInfo as m, CellMarker as n, NumberFormat as o, ParagraphPropertyChange as p, TablePropertyChange as q, TableCellPropertyChange as r, TableRowPropertyChange as s, SdtType as t, SdtProperties as u, SdtDataBinding as v, BlockSdt as w, BreakContent as x, HeaderFooter as y, BookmarkEnd as z };
@@ -0,0 +1,187 @@
1
+ import { Document } from './types/document.mjs';
2
+ import { t as SdtType, u as SdtProperties, v as SdtDataBinding, c as DocumentBody, w as BlockSdt, B as BlockContent } from './content-CE-ZdMwG.mjs';
3
+
4
+ /**
5
+ * Content-control (SDT) addressing for the document model.
6
+ *
7
+ * Block-level content controls (`w:sdt`) are the natural anchor for template
8
+ * logic and agent edits: they survive the round trip (see the parser +
9
+ * serializer) and carry a stable `tag`/`alias`/`id`. This module is the
10
+ * read side of that contract — discover controls and read their content
11
+ * without a DOM or an editor instance, so server-side pipelines and AI
12
+ * agents can find an anchor by tag and act on it.
13
+ *
14
+ * Walks the body recursively, descending into nested controls so a control
15
+ * inside another control is still found. (The model places block content
16
+ * controls at body level or nested in other controls, not inside table
17
+ * cells.) The returned `path` (block indices from the body root) addresses
18
+ * the control unambiguously for a follow-up edit.
19
+ */
20
+
21
+ /** Filter for {@link findContentControls}. All provided fields must match (AND). */
22
+ interface ContentControlFilter {
23
+ /** Developer identifier (`w:tag`), exact match. */
24
+ tag?: string;
25
+ /** Friendly name (`w:alias`), exact match. */
26
+ alias?: string;
27
+ /** Numeric id (`w:id`), exact match. */
28
+ id?: number;
29
+ /** Control type projection (`richText`, `dropDownList`, …). */
30
+ type?: SdtType;
31
+ }
32
+ /** A discovered content control plus enough context to address and edit it. */
33
+ interface ContentControlInfo {
34
+ /** Developer identifier (`w:tag`). */
35
+ tag?: string;
36
+ /** Friendly name (`w:alias`). */
37
+ alias?: string;
38
+ /** Numeric id (`w:id`). */
39
+ id?: number;
40
+ /** Control type projection. */
41
+ sdtType: SdtType;
42
+ /** Lock setting, if any. A locked control should refuse content edits. */
43
+ lock?: SdtProperties['lock'];
44
+ /** Dropdown/combobox list items, if modeled. */
45
+ listItems?: {
46
+ displayText: string;
47
+ value: string;
48
+ }[];
49
+ /** Placeholder docPart reference, if any. */
50
+ placeholder?: string;
51
+ /** Whether the control is currently showing placeholder text (`w:showingPlcHdr`). */
52
+ showingPlaceholder?: boolean;
53
+ /** Checkbox state, for checkbox controls. */
54
+ checked?: boolean;
55
+ /** Date format string, for date controls. */
56
+ dateFormat?: string;
57
+ /** XML data binding (`w:dataBinding`), if the control is bound. */
58
+ dataBinding?: SdtDataBinding;
59
+ /** Plain text of the control's content (paragraphs/tables/nested controls flattened). */
60
+ text: string;
61
+ /**
62
+ * Block-index path from the document body to this control. Top-level
63
+ * controls are `[i]`; a control nested inside the i-th body block's content
64
+ * is `[i, j]`, and so on. Stable address for a follow-up edit.
65
+ */
66
+ path: number[];
67
+ /** Nesting depth (0 = direct child of the body). */
68
+ depth: number;
69
+ }
70
+ /** Plain text of a control's content, descending into tables and nested SDTs. */
71
+ declare function getContentControlText(control: BlockSdt): string;
72
+ /**
73
+ * Find every block-level content control in the document, optionally filtered
74
+ * by tag/alias/id/type. Results are in document order; nested controls follow
75
+ * their parent. Searches the body and controls nested inside controls. Table
76
+ * cells are not searched (the current model/parser does not surface cell-level
77
+ * controls), and headers/footers live in a separate content tree.
78
+ */
79
+ declare function findContentControls(input: Document | DocumentBody, filter?: ContentControlFilter): ContentControlInfo[];
80
+ /** Convenience: the first control matching `filter`, or `undefined`. */
81
+ declare function findContentControl(input: Document | DocumentBody, filter: ContentControlFilter): ContentControlInfo | undefined;
82
+ /** No control matched the filter. */
83
+ declare class ContentControlNotFoundError extends Error {
84
+ constructor(filter: ContentControlFilter);
85
+ }
86
+ /** The matched control's lock forbids the attempted edit (pass `force` to override). */
87
+ declare class ContentControlLockedError extends Error {
88
+ constructor(lock: SdtProperties['lock'], op: 'edit' | 'remove');
89
+ }
90
+ /**
91
+ * The control's type doesn't support free text/block replacement (e.g. a
92
+ * dropdown, date, checkbox, or picture control), so writing arbitrary content
93
+ * would desync the type marker from its value. Use a type-specific setter, or
94
+ * pass `{ force: true }` to override.
95
+ */
96
+ declare class ContentControlTypeError extends Error {
97
+ constructor(sdtType: SdtType);
98
+ }
99
+ /**
100
+ * The control is bound to a Custom XML data store (`w:dataBinding`). Writing its
101
+ * content won't stick — Word re-renders the control from the bound XML node — so
102
+ * the write is refused. Update the data store instead, or pass `{ force: true }`.
103
+ */
104
+ declare class ContentControlBoundError extends Error {
105
+ constructor();
106
+ }
107
+ /**
108
+ * Replace the content of the first control matching `filter`. `replacement`
109
+ * may be a string (split into paragraphs on newlines) or block content. The
110
+ * control's properties, tag/alias, and lossless raw `w:sdtPr` are preserved —
111
+ * only the contained blocks change, so the result still round-trips.
112
+ *
113
+ * When the control was showing its placeholder (`w:showingPlcHdr`), that flag
114
+ * is cleared so Word doesn't render the new content as placeholder text.
115
+ *
116
+ * Throws {@link ContentControlNotFoundError} if nothing matches,
117
+ * {@link ContentControlLockedError} if the control's lock forbids editing, and
118
+ * {@link ContentControlTypeError} if the control is a typed (dropdown/date/…)
119
+ * control whose value shouldn't be set as free text. Pass `{ force: true }` to
120
+ * override the lock/type guards.
121
+ */
122
+ declare function setContentControlContent(doc: Document, filter: ContentControlFilter, replacement: string | BlockContent[], options?: {
123
+ force?: boolean;
124
+ }): Document;
125
+ /**
126
+ * Remove the first control matching `filter` from the document. With
127
+ * `keepContent: true` the control's blocks are unwrapped in place (the box
128
+ * goes away, the content stays) — useful for "resolve this conditional
129
+ * section into plain content". Otherwise the whole region is deleted.
130
+ *
131
+ * Unwrapping a repeating-section (item) is refused unless `force`, since
132
+ * lifting its blocks out would orphan the (w15) repeating structure.
133
+ *
134
+ * Throws {@link ContentControlNotFoundError} / {@link ContentControlLockedError}
135
+ * as {@link setContentControlContent} does.
136
+ */
137
+ declare function removeContentControl(doc: Document, filter: ContentControlFilter, options?: {
138
+ force?: boolean;
139
+ keepContent?: boolean;
140
+ }): Document;
141
+
142
+ /**
143
+ * Typed value setters for block-level content controls — set a dropdown
144
+ * selection, toggle a checkbox, or set a date. These produce both the visible
145
+ * content (the run text Word shows) and the structured state inside the
146
+ * captured raw `w:sdtPr` (dropdown `w:lastValue`, `w14:checked`, `w:date`'s
147
+ * `w:fullDate`), patched in place so the rest of the control round-trips
148
+ * verbatim. Use these instead of {@link setContentControlContent} for typed
149
+ * controls, which that function refuses by design.
150
+ *
151
+ * Raw `w:sdtPr` is patched with targeted string edits (not a full re-serialize)
152
+ * to preserve the `CT_SdtPr` element order and any unmodeled properties — the
153
+ * same capture-and-replay contract used everywhere else for SDTs.
154
+ */
155
+
156
+ /** A typed value to apply to a content control. */
157
+ type ContentControlValue = {
158
+ kind: 'dropdown';
159
+ value: string;
160
+ } | {
161
+ kind: 'checkbox';
162
+ checked: boolean;
163
+ } | {
164
+ kind: 'date';
165
+ date: string;
166
+ };
167
+ /** The control doesn't support the requested value kind, or the value is invalid. */
168
+ declare class ContentControlValueError extends Error {
169
+ constructor(message: string);
170
+ }
171
+ /** Format an ISO date (yyyy-mm-dd) with a subset of OOXML date tokens. */
172
+ declare function formatSdtDate(iso: string, pattern?: string): string;
173
+ /**
174
+ * Set a typed value (dropdown selection / checkbox / date) on the first control
175
+ * matching `filter`, returning a new {@link Document}. Updates both the visible
176
+ * content and the structured raw state, so the result round-trips and Word
177
+ * shows the new value. Throws {@link ContentControlNotFoundError} if nothing
178
+ * matches, {@link ContentControlLockedError} if content-locked,
179
+ * {@link ContentControlBoundError} if data-bound (the store would override the
180
+ * write), and {@link ContentControlValueError} if the value doesn't fit the
181
+ * control type. The lock/bound guards are overridable with `{ force: true }`.
182
+ */
183
+ declare function setContentControlValue(doc: Document, filter: ContentControlFilter, value: ContentControlValue, options?: {
184
+ force?: boolean;
185
+ }): Document;
186
+
187
+ export { ContentControlBoundError as C, type ContentControlFilter as a, type ContentControlInfo as b, ContentControlLockedError as c, ContentControlNotFoundError as d, ContentControlTypeError as e, type ContentControlValue as f, ContentControlValueError as g, findContentControl as h, findContentControls as i, formatSdtDate as j, getContentControlText as k, setContentControlValue as l, removeContentControl as r, setContentControlContent as s };