@eigenpal/docx-js-editor 0.0.3 → 0.0.5

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 (49) hide show
  1. package/README.md +69 -132
  2. package/dist/chunk-2CFVFSUH.js +57 -0
  3. package/dist/{chunk-YJJ7HRPG.js → chunk-AOL255XD.js} +1 -1
  4. package/dist/chunk-BBGDBZJY.cjs +1 -0
  5. package/dist/{chunk-CM5WP7HZ.cjs → chunk-D2GERZ7M.cjs} +2 -2
  6. package/dist/chunk-DQHQWQHL.cjs +11 -0
  7. package/dist/chunk-FXILBPZI.cjs +9 -0
  8. package/dist/chunk-H2UMX5CK.js +9 -0
  9. package/dist/chunk-HGOIKOKZ.js +1 -0
  10. package/dist/chunk-I2C6ENCR.js +11 -0
  11. package/dist/chunk-TL3YTVN2.cjs +57 -0
  12. package/dist/{colorResolver-Yakhydrt.d.ts → colorResolver-DrNkos_H.d.ts} +1 -32
  13. package/dist/{colorResolver-C-tITrbI.d.cts → colorResolver-WsUxFs5p.d.cts} +1 -32
  14. package/dist/core-plugins.cjs +1 -1
  15. package/dist/core-plugins.d.cts +3 -3
  16. package/dist/core-plugins.d.ts +3 -3
  17. package/dist/core-plugins.js +1 -1
  18. package/dist/headless.cjs +2 -2
  19. package/dist/headless.d.cts +4 -4
  20. package/dist/headless.d.ts +4 -4
  21. package/dist/headless.js +1 -1
  22. package/dist/index.cjs +43 -43
  23. package/dist/index.css +1 -1
  24. package/dist/index.d.cts +174 -363
  25. package/dist/index.d.ts +174 -363
  26. package/dist/index.js +43 -43
  27. package/dist/mcp-cli.js +21 -21
  28. package/dist/mcp.cjs +3 -3
  29. package/dist/mcp.d.cts +1 -1
  30. package/dist/mcp.d.ts +1 -1
  31. package/dist/mcp.js +1 -1
  32. package/dist/{registry-DeeU0bQB.d.cts → registry-BWDZlJx6.d.cts} +1 -1
  33. package/dist/{registry-D3zhko7n.d.ts → registry-DifIQR1O.d.ts} +1 -1
  34. package/dist/selectionRects-M7QY6HKR.cjs +1 -0
  35. package/dist/selectionRects-O6YQMMCP.js +1 -0
  36. package/dist/styles.css +1 -1
  37. package/dist/{types-BJXChtaM.d.cts → types-XVRXTi4o.d.cts} +509 -336
  38. package/dist/{types-BJXChtaM.d.ts → types-XVRXTi4o.d.ts} +509 -336
  39. package/package.json +10 -10
  40. package/dist/chunk-7KNRIGGW.cjs +0 -1
  41. package/dist/chunk-CDT2SOKB.cjs +0 -9
  42. package/dist/chunk-EU5LN2WS.js +0 -11
  43. package/dist/chunk-G4AXMTQY.cjs +0 -11
  44. package/dist/chunk-HRPNPUU4.js +0 -1
  45. package/dist/chunk-NI5OFVY2.js +0 -57
  46. package/dist/chunk-RGYAPHXT.cjs +0 -57
  47. package/dist/chunk-T3I3VSJ3.js +0 -9
  48. package/dist/selectionRects-3PJ6FGHQ.js +0 -1
  49. package/dist/selectionRects-6QL5E7CE.cjs +0 -1
@@ -1,13 +1,7 @@
1
1
  /**
2
- * Comprehensive TypeScript types for full DOCX document representation
2
+ * Color & Styling Primitives
3
3
  *
4
- * These types represent all elements that can appear in a DOCX file,
5
- * supporting full Microsoft Word fidelity including:
6
- * - Text and paragraph formatting
7
- * - Tables, images, shapes
8
- * - Hyperlinks, bookmarks, fields
9
- * - Lists, headers/footers, footnotes
10
- * - Themes, styles, page layout
4
+ * Basic types used throughout OOXML for colors, borders, and shading.
11
5
  */
12
6
  /**
13
7
  * Theme color slots from theme1.xml
@@ -56,6 +50,14 @@ interface ShadingProperties {
56
50
  /** Shading pattern type */
57
51
  pattern?: 'clear' | 'solid' | 'horzStripe' | 'vertStripe' | 'reverseDiagStripe' | 'diagStripe' | 'horzCross' | 'diagCross' | 'thinHorzStripe' | 'thinVertStripe' | 'thinReverseDiagStripe' | 'thinDiagStripe' | 'thinHorzCross' | 'thinDiagCross' | 'pct5' | 'pct10' | 'pct12' | 'pct15' | 'pct20' | 'pct25' | 'pct30' | 'pct35' | 'pct37' | 'pct40' | 'pct45' | 'pct50' | 'pct55' | 'pct60' | 'pct62' | 'pct65' | 'pct70' | 'pct75' | 'pct80' | 'pct85' | 'pct87' | 'pct90' | 'pct95' | 'nil';
58
52
  }
53
+
54
+ /**
55
+ * Text, Paragraph, and Table Formatting Types
56
+ *
57
+ * Properties that control how text, paragraphs, and table structures
58
+ * are formatted in OOXML (w:rPr, w:pPr, w:tblPr, etc.).
59
+ */
60
+
59
61
  /**
60
62
  * Underline style options
61
63
  */
@@ -252,6 +254,290 @@ interface ParagraphFormatting {
252
254
  /** Run properties to apply to all runs (w:rPr) */
253
255
  runProperties?: TextFormatting;
254
256
  }
257
+ /**
258
+ * Table width type
259
+ */
260
+ type TableWidthType = 'auto' | 'dxa' | 'nil' | 'pct';
261
+ /**
262
+ * Table measurement (width or height)
263
+ */
264
+ interface TableMeasurement {
265
+ /** Value in twips (for dxa) or fifths of a percent (for pct) */
266
+ value: number;
267
+ /** Measurement type */
268
+ type: TableWidthType;
269
+ }
270
+ /**
271
+ * Table borders
272
+ */
273
+ interface TableBorders {
274
+ top?: BorderSpec;
275
+ bottom?: BorderSpec;
276
+ left?: BorderSpec;
277
+ right?: BorderSpec;
278
+ insideH?: BorderSpec;
279
+ insideV?: BorderSpec;
280
+ }
281
+ /**
282
+ * Cell margins
283
+ */
284
+ interface CellMargins {
285
+ top?: TableMeasurement;
286
+ bottom?: TableMeasurement;
287
+ left?: TableMeasurement;
288
+ right?: TableMeasurement;
289
+ }
290
+ /**
291
+ * Table look flags (for table styles)
292
+ */
293
+ interface TableLook {
294
+ firstColumn?: boolean;
295
+ firstRow?: boolean;
296
+ lastColumn?: boolean;
297
+ lastRow?: boolean;
298
+ noHBand?: boolean;
299
+ noVBand?: boolean;
300
+ }
301
+ /**
302
+ * Floating table properties
303
+ */
304
+ interface FloatingTableProperties {
305
+ /** Horizontal anchor */
306
+ horzAnchor?: 'margin' | 'page' | 'text';
307
+ /** Vertical anchor */
308
+ vertAnchor?: 'margin' | 'page' | 'text';
309
+ /** Horizontal position */
310
+ tblpX?: number;
311
+ tblpXSpec?: 'left' | 'center' | 'right' | 'inside' | 'outside';
312
+ /** Vertical position */
313
+ tblpY?: number;
314
+ tblpYSpec?: 'top' | 'center' | 'bottom' | 'inside' | 'outside' | 'inline';
315
+ /** Distance from surrounding text */
316
+ topFromText?: number;
317
+ bottomFromText?: number;
318
+ leftFromText?: number;
319
+ rightFromText?: number;
320
+ }
321
+ /**
322
+ * Table formatting properties (w:tblPr)
323
+ */
324
+ interface TableFormatting {
325
+ /** Table width */
326
+ width?: TableMeasurement;
327
+ /** Table justification */
328
+ justification?: 'left' | 'center' | 'right';
329
+ /** Cell spacing */
330
+ cellSpacing?: TableMeasurement;
331
+ /** Table indent from left margin */
332
+ indent?: TableMeasurement;
333
+ /** Table borders */
334
+ borders?: TableBorders;
335
+ /** Default cell margins */
336
+ cellMargins?: CellMargins;
337
+ /** Table layout */
338
+ layout?: 'fixed' | 'autofit';
339
+ /** Table style ID */
340
+ styleId?: string;
341
+ /** Table look (conditional formatting flags) */
342
+ look?: TableLook;
343
+ /** Shading/background */
344
+ shading?: ShadingProperties;
345
+ /** Overlap for floating tables */
346
+ overlap?: 'never' | 'overlap';
347
+ /** Floating table properties */
348
+ floating?: FloatingTableProperties;
349
+ /** Right to left table */
350
+ bidi?: boolean;
351
+ }
352
+ /**
353
+ * Table row formatting properties (w:trPr)
354
+ */
355
+ interface TableRowFormatting {
356
+ /** Row height */
357
+ height?: TableMeasurement;
358
+ /** Height rule */
359
+ heightRule?: 'auto' | 'atLeast' | 'exact';
360
+ /** Header row (repeats on each page) */
361
+ header?: boolean;
362
+ /** Allow row to break across pages */
363
+ cantSplit?: boolean;
364
+ /** Row justification */
365
+ justification?: 'left' | 'center' | 'right';
366
+ /** Hidden row */
367
+ hidden?: boolean;
368
+ }
369
+ /**
370
+ * Conditional format style
371
+ */
372
+ interface ConditionalFormatStyle {
373
+ /** First row */
374
+ firstRow?: boolean;
375
+ /** Last row */
376
+ lastRow?: boolean;
377
+ /** First column */
378
+ firstColumn?: boolean;
379
+ /** Last column */
380
+ lastColumn?: boolean;
381
+ /** Odd horizontal band */
382
+ oddHBand?: boolean;
383
+ /** Even horizontal band */
384
+ evenHBand?: boolean;
385
+ /** Odd vertical band */
386
+ oddVBand?: boolean;
387
+ /** Even vertical band */
388
+ evenVBand?: boolean;
389
+ /** Northwest corner */
390
+ nwCell?: boolean;
391
+ /** Northeast corner */
392
+ neCell?: boolean;
393
+ /** Southwest corner */
394
+ swCell?: boolean;
395
+ /** Southeast corner */
396
+ seCell?: boolean;
397
+ }
398
+ /**
399
+ * Table cell formatting properties (w:tcPr)
400
+ */
401
+ interface TableCellFormatting {
402
+ /** Cell width */
403
+ width?: TableMeasurement;
404
+ /** Cell borders */
405
+ borders?: TableBorders;
406
+ /** Cell margins (override table default) */
407
+ margins?: CellMargins;
408
+ /** Cell shading/background */
409
+ shading?: ShadingProperties;
410
+ /** Vertical alignment */
411
+ verticalAlign?: 'top' | 'center' | 'bottom';
412
+ /** Text direction */
413
+ textDirection?: 'lr' | 'lrV' | 'rl' | 'rlV' | 'tb' | 'tbV' | 'tbRl' | 'tbRlV' | 'btLr';
414
+ /** Grid span (horizontal merge) */
415
+ gridSpan?: number;
416
+ /** Vertical merge */
417
+ vMerge?: 'restart' | 'continue';
418
+ /** Fit text to cell width */
419
+ fitText?: boolean;
420
+ /** Wrap text */
421
+ noWrap?: boolean;
422
+ /** Hide cell marker */
423
+ hideMark?: boolean;
424
+ /** Conditional format style */
425
+ conditionalFormat?: ConditionalFormatStyle;
426
+ }
427
+
428
+ /**
429
+ * Lists & Numbering Types
430
+ *
431
+ * Types for bullet lists, numbered lists, and numbering definitions.
432
+ */
433
+
434
+ /**
435
+ * Number format type
436
+ */
437
+ type NumberFormat = 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter' | 'ordinal' | 'cardinalText' | 'ordinalText' | 'hex' | 'chicago' | 'ideographDigital' | 'japaneseCounting' | 'aiueo' | 'iroha' | 'decimalFullWidth' | 'decimalHalfWidth' | 'japaneseLegal' | 'japaneseDigitalTenThousand' | 'decimalEnclosedCircle' | 'decimalFullWidth2' | 'aiueoFullWidth' | 'irohaFullWidth' | 'decimalZero' | 'bullet' | 'ganada' | 'chosung' | 'decimalEnclosedFullstop' | 'decimalEnclosedParen' | 'decimalEnclosedCircleChinese' | 'ideographEnclosedCircle' | 'ideographTraditional' | 'ideographZodiac' | 'ideographZodiacTraditional' | 'taiwaneseCounting' | 'ideographLegalTraditional' | 'taiwaneseCountingThousand' | 'taiwaneseDigital' | 'chineseCounting' | 'chineseLegalSimplified' | 'chineseCountingThousand' | 'koreanDigital' | 'koreanCounting' | 'koreanLegal' | 'koreanDigital2' | 'vietnameseCounting' | 'russianLower' | 'russianUpper' | 'none' | 'numberInDash' | 'hebrew1' | 'hebrew2' | 'arabicAlpha' | 'arabicAbjad' | 'hindiVowels' | 'hindiConsonants' | 'hindiNumbers' | 'hindiCounting' | 'thaiLetters' | 'thaiNumbers' | 'thaiCounting';
438
+ /**
439
+ * Multi-level suffix (what follows the number)
440
+ */
441
+ type LevelSuffix = 'tab' | 'space' | 'nothing';
442
+ /**
443
+ * List level definition
444
+ */
445
+ interface ListLevel {
446
+ /** Level index (0-8) */
447
+ ilvl: number;
448
+ /** Starting number */
449
+ start?: number;
450
+ /** Number format */
451
+ numFmt: NumberFormat;
452
+ /** Level text (e.g., "%1." or "•") */
453
+ lvlText: string;
454
+ /** Justification */
455
+ lvlJc?: 'left' | 'center' | 'right';
456
+ /** Suffix after number */
457
+ suffix?: LevelSuffix;
458
+ /** Paragraph properties for this level */
459
+ pPr?: ParagraphFormatting;
460
+ /** Run properties for the number/bullet */
461
+ rPr?: TextFormatting;
462
+ /** Restart numbering from higher level */
463
+ lvlRestart?: number;
464
+ /** Is legal numbering style */
465
+ isLgl?: boolean;
466
+ /** Legacy settings */
467
+ legacy?: {
468
+ legacy?: boolean;
469
+ legacySpace?: number;
470
+ legacyIndent?: number;
471
+ };
472
+ }
473
+ /**
474
+ * Abstract numbering definition (w:abstractNum)
475
+ */
476
+ interface AbstractNumbering {
477
+ /** Abstract numbering ID */
478
+ abstractNumId: number;
479
+ /** Multi-level type */
480
+ multiLevelType?: 'hybridMultilevel' | 'multilevel' | 'singleLevel';
481
+ /** Numbering style link */
482
+ numStyleLink?: string;
483
+ /** Style link */
484
+ styleLink?: string;
485
+ /** Level definitions */
486
+ levels: ListLevel[];
487
+ /** Name */
488
+ name?: string;
489
+ }
490
+ /**
491
+ * Numbering instance (w:num)
492
+ */
493
+ interface NumberingInstance {
494
+ /** Numbering ID (referenced by paragraphs) */
495
+ numId: number;
496
+ /** Reference to abstract numbering */
497
+ abstractNumId: number;
498
+ /** Level overrides */
499
+ levelOverrides?: Array<{
500
+ ilvl: number;
501
+ startOverride?: number;
502
+ lvl?: ListLevel;
503
+ }>;
504
+ }
505
+ /**
506
+ * Computed list rendering info
507
+ */
508
+ interface ListRendering {
509
+ /** Computed marker text (e.g., "1.", "a)", "•") */
510
+ marker: string;
511
+ /** List level (0-8) */
512
+ level: number;
513
+ /** Numbering ID */
514
+ numId: number;
515
+ /** Whether this is a bullet or numbered list */
516
+ isBullet: boolean;
517
+ /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
518
+ numFmt?: NumberFormat;
519
+ }
520
+ /**
521
+ * Complete numbering definitions
522
+ */
523
+ interface NumberingDefinitions {
524
+ /** Abstract numbering definitions */
525
+ abstractNums: AbstractNumbering[];
526
+ /** Numbering instances */
527
+ nums: NumberingInstance[];
528
+ }
529
+
530
+ /**
531
+ * Document Content Model
532
+ *
533
+ * All content-bearing types: runs, hyperlinks, bookmarks, fields,
534
+ * images, shapes, tables, lists, paragraphs, headers/footers,
535
+ * footnotes/endnotes, and sections.
536
+ *
537
+ * These types form a deeply interrelated tree (Paragraph ↔ Table ↔ ShapeTextBody)
538
+ * and are kept together to avoid circular import issues.
539
+ */
540
+
255
541
  /**
256
542
  * Plain text content
257
543
  */
@@ -532,6 +818,8 @@ interface Image {
532
818
  padding?: ImagePadding;
533
819
  /** Whether this is a decorative image */
534
820
  decorative?: boolean;
821
+ /** Image outline/border */
822
+ outline?: ShapeOutline;
535
823
  /** Image effects */
536
824
  effects?: {
537
825
  brightness?: number;
@@ -601,240 +889,70 @@ interface ShapeTextBody {
601
889
  anchorCenter?: boolean;
602
890
  /** Auto fit */
603
891
  autoFit?: 'none' | 'normal' | 'shape';
604
- /** Text margins */
605
- margins?: {
606
- top?: number;
607
- bottom?: number;
608
- left?: number;
609
- right?: number;
610
- };
611
- /** Paragraphs inside the shape */
612
- content: Paragraph[];
613
- }
614
- /**
615
- * Shape/drawing object (wps:wsp)
616
- */
617
- interface Shape {
618
- type: 'shape';
619
- /** Shape type preset */
620
- shapeType: ShapeType;
621
- /** Unique ID */
622
- id?: string;
623
- /** Name */
624
- name?: string;
625
- /** Size in EMUs */
626
- size: ImageSize;
627
- /** Position for floating shapes */
628
- position?: ImagePosition;
629
- /** Wrap settings */
630
- wrap?: ImageWrap;
631
- /** Fill */
632
- fill?: ShapeFill;
633
- /** Outline/stroke */
634
- outline?: ShapeOutline;
635
- /** Transform */
636
- transform?: ImageTransform;
637
- /** Text content inside the shape */
638
- textBody?: ShapeTextBody;
639
- /** Custom geometry points */
640
- customGeometry?: string;
641
- }
642
- /**
643
- * Text box (floating text container)
644
- */
645
- interface TextBox {
646
- type: 'textBox';
647
- /** Unique ID */
648
- id?: string;
649
- /** Size */
650
- size: ImageSize;
651
- /** Position */
652
- position?: ImagePosition;
653
- /** Wrap settings */
654
- wrap?: ImageWrap;
655
- /** Fill */
656
- fill?: ShapeFill;
657
- /** Outline */
658
- outline?: ShapeOutline;
659
- /** Text content */
660
- content: Paragraph[];
661
- /** Internal margins */
662
- margins?: {
663
- top?: number;
664
- bottom?: number;
665
- left?: number;
666
- right?: number;
667
- };
668
- }
669
- /**
670
- * Table width type
671
- */
672
- type TableWidthType = 'auto' | 'dxa' | 'nil' | 'pct';
673
- /**
674
- * Table measurement (width or height)
675
- */
676
- interface TableMeasurement {
677
- /** Value in twips (for dxa) or fifths of a percent (for pct) */
678
- value: number;
679
- /** Measurement type */
680
- type: TableWidthType;
681
- }
682
- /**
683
- * Table borders
684
- */
685
- interface TableBorders {
686
- top?: BorderSpec;
687
- bottom?: BorderSpec;
688
- left?: BorderSpec;
689
- right?: BorderSpec;
690
- insideH?: BorderSpec;
691
- insideV?: BorderSpec;
692
- }
693
- /**
694
- * Cell margins
695
- */
696
- interface CellMargins {
697
- top?: TableMeasurement;
698
- bottom?: TableMeasurement;
699
- left?: TableMeasurement;
700
- right?: TableMeasurement;
701
- }
702
- /**
703
- * Table look flags (for table styles)
704
- */
705
- interface TableLook {
706
- firstColumn?: boolean;
707
- firstRow?: boolean;
708
- lastColumn?: boolean;
709
- lastRow?: boolean;
710
- noHBand?: boolean;
711
- noVBand?: boolean;
712
- }
713
- /**
714
- * Floating table properties
715
- */
716
- interface FloatingTableProperties {
717
- /** Horizontal anchor */
718
- horzAnchor?: 'margin' | 'page' | 'text';
719
- /** Vertical anchor */
720
- vertAnchor?: 'margin' | 'page' | 'text';
721
- /** Horizontal position */
722
- tblpX?: number;
723
- tblpXSpec?: 'left' | 'center' | 'right' | 'inside' | 'outside';
724
- /** Vertical position */
725
- tblpY?: number;
726
- tblpYSpec?: 'top' | 'center' | 'bottom' | 'inside' | 'outside' | 'inline';
727
- /** Distance from surrounding text */
728
- topFromText?: number;
729
- bottomFromText?: number;
730
- leftFromText?: number;
731
- rightFromText?: number;
732
- }
733
- /**
734
- * Table formatting properties (w:tblPr)
735
- */
736
- interface TableFormatting {
737
- /** Table width */
738
- width?: TableMeasurement;
739
- /** Table justification */
740
- justification?: 'left' | 'center' | 'right';
741
- /** Cell spacing */
742
- cellSpacing?: TableMeasurement;
743
- /** Table indent from left margin */
744
- indent?: TableMeasurement;
745
- /** Table borders */
746
- borders?: TableBorders;
747
- /** Default cell margins */
748
- cellMargins?: CellMargins;
749
- /** Table layout */
750
- layout?: 'fixed' | 'autofit';
751
- /** Table style ID */
752
- styleId?: string;
753
- /** Table look (conditional formatting flags) */
754
- look?: TableLook;
755
- /** Shading/background */
756
- shading?: ShadingProperties;
757
- /** Overlap for floating tables */
758
- overlap?: 'never' | 'overlap';
759
- /** Floating table properties */
760
- floating?: FloatingTableProperties;
761
- /** Right to left table */
762
- bidi?: boolean;
763
- }
764
- /**
765
- * Table row formatting properties (w:trPr)
766
- */
767
- interface TableRowFormatting {
768
- /** Row height */
769
- height?: TableMeasurement;
770
- /** Height rule */
771
- heightRule?: 'auto' | 'atLeast' | 'exact';
772
- /** Header row (repeats on each page) */
773
- header?: boolean;
774
- /** Allow row to break across pages */
775
- cantSplit?: boolean;
776
- /** Row justification */
777
- justification?: 'left' | 'center' | 'right';
778
- /** Hidden row */
779
- hidden?: boolean;
892
+ /** Text margins */
893
+ margins?: {
894
+ top?: number;
895
+ bottom?: number;
896
+ left?: number;
897
+ right?: number;
898
+ };
899
+ /** Paragraphs inside the shape */
900
+ content: Paragraph[];
780
901
  }
781
902
  /**
782
- * Conditional format style
903
+ * Shape/drawing object (wps:wsp)
783
904
  */
784
- interface ConditionalFormatStyle {
785
- /** First row */
786
- firstRow?: boolean;
787
- /** Last row */
788
- lastRow?: boolean;
789
- /** First column */
790
- firstColumn?: boolean;
791
- /** Last column */
792
- lastColumn?: boolean;
793
- /** Odd horizontal band */
794
- oddHBand?: boolean;
795
- /** Even horizontal band */
796
- evenHBand?: boolean;
797
- /** Odd vertical band */
798
- oddVBand?: boolean;
799
- /** Even vertical band */
800
- evenVBand?: boolean;
801
- /** Northwest corner */
802
- nwCell?: boolean;
803
- /** Northeast corner */
804
- neCell?: boolean;
805
- /** Southwest corner */
806
- swCell?: boolean;
807
- /** Southeast corner */
808
- seCell?: boolean;
905
+ interface Shape {
906
+ type: 'shape';
907
+ /** Shape type preset */
908
+ shapeType: ShapeType;
909
+ /** Unique ID */
910
+ id?: string;
911
+ /** Name */
912
+ name?: string;
913
+ /** Size in EMUs */
914
+ size: ImageSize;
915
+ /** Position for floating shapes */
916
+ position?: ImagePosition;
917
+ /** Wrap settings */
918
+ wrap?: ImageWrap;
919
+ /** Fill */
920
+ fill?: ShapeFill;
921
+ /** Outline/stroke */
922
+ outline?: ShapeOutline;
923
+ /** Transform */
924
+ transform?: ImageTransform;
925
+ /** Text content inside the shape */
926
+ textBody?: ShapeTextBody;
927
+ /** Custom geometry points */
928
+ customGeometry?: string;
809
929
  }
810
930
  /**
811
- * Table cell formatting properties (w:tcPr)
931
+ * Text box (floating text container)
812
932
  */
813
- interface TableCellFormatting {
814
- /** Cell width */
815
- width?: TableMeasurement;
816
- /** Cell borders */
817
- borders?: TableBorders;
818
- /** Cell margins (override table default) */
819
- margins?: CellMargins;
820
- /** Cell shading/background */
821
- shading?: ShadingProperties;
822
- /** Vertical alignment */
823
- verticalAlign?: 'top' | 'center' | 'bottom';
824
- /** Text direction */
825
- textDirection?: 'lr' | 'lrV' | 'rl' | 'rlV' | 'tb' | 'tbV' | 'tbRl' | 'tbRlV' | 'btLr';
826
- /** Grid span (horizontal merge) */
827
- gridSpan?: number;
828
- /** Vertical merge */
829
- vMerge?: 'restart' | 'continue';
830
- /** Fit text to cell width */
831
- fitText?: boolean;
832
- /** Wrap text */
833
- noWrap?: boolean;
834
- /** Hide cell marker */
835
- hideMark?: boolean;
836
- /** Conditional format style */
837
- conditionalFormat?: ConditionalFormatStyle;
933
+ interface TextBox {
934
+ type: 'textBox';
935
+ /** Unique ID */
936
+ id?: string;
937
+ /** Size */
938
+ size: ImageSize;
939
+ /** Position */
940
+ position?: ImagePosition;
941
+ /** Wrap settings */
942
+ wrap?: ImageWrap;
943
+ /** Fill */
944
+ fill?: ShapeFill;
945
+ /** Outline */
946
+ outline?: ShapeOutline;
947
+ /** Text content */
948
+ content: Paragraph[];
949
+ /** Internal margins */
950
+ margins?: {
951
+ top?: number;
952
+ bottom?: number;
953
+ left?: number;
954
+ right?: number;
955
+ };
838
956
  }
839
957
  /**
840
958
  * Table cell
@@ -869,99 +987,152 @@ interface Table {
869
987
  rows: TableRow[];
870
988
  }
871
989
  /**
872
- * Number format type
990
+ * A comment (w:comment) from comments.xml
873
991
  */
874
- type NumberFormat = 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter' | 'ordinal' | 'cardinalText' | 'ordinalText' | 'hex' | 'chicago' | 'ideographDigital' | 'japaneseCounting' | 'aiueo' | 'iroha' | 'decimalFullWidth' | 'decimalHalfWidth' | 'japaneseLegal' | 'japaneseDigitalTenThousand' | 'decimalEnclosedCircle' | 'decimalFullWidth2' | 'aiueoFullWidth' | 'irohaFullWidth' | 'decimalZero' | 'bullet' | 'ganada' | 'chosung' | 'decimalEnclosedFullstop' | 'decimalEnclosedParen' | 'decimalEnclosedCircleChinese' | 'ideographEnclosedCircle' | 'ideographTraditional' | 'ideographZodiac' | 'ideographZodiacTraditional' | 'taiwaneseCounting' | 'ideographLegalTraditional' | 'taiwaneseCountingThousand' | 'taiwaneseDigital' | 'chineseCounting' | 'chineseLegalSimplified' | 'chineseCountingThousand' | 'koreanDigital' | 'koreanCounting' | 'koreanLegal' | 'koreanDigital2' | 'vietnameseCounting' | 'russianLower' | 'russianUpper' | 'none' | 'numberInDash' | 'hebrew1' | 'hebrew2' | 'arabicAlpha' | 'arabicAbjad' | 'hindiVowels' | 'hindiConsonants' | 'hindiNumbers' | 'hindiCounting' | 'thaiLetters' | 'thaiNumbers' | 'thaiCounting';
992
+ interface Comment {
993
+ /** Comment ID (matches commentRangeStart/End) */
994
+ id: number;
995
+ /** Author name */
996
+ author: string;
997
+ /** Author initials */
998
+ initials?: string;
999
+ /** Date */
1000
+ date?: string;
1001
+ /** Comment content (paragraphs) */
1002
+ content: Paragraph[];
1003
+ /** Parent comment ID (for replies) */
1004
+ parentId?: number;
1005
+ /** Whether the comment is resolved/done */
1006
+ done?: boolean;
1007
+ }
875
1008
  /**
876
- * Multi-level suffix (what follows the number)
1009
+ * Comment range start marker in paragraph content
877
1010
  */
878
- type LevelSuffix = 'tab' | 'space' | 'nothing';
1011
+ interface CommentRangeStart {
1012
+ type: 'commentRangeStart';
1013
+ id: number;
1014
+ }
879
1015
  /**
880
- * List level definition
1016
+ * Comment range end marker in paragraph content
881
1017
  */
882
- interface ListLevel {
883
- /** Level index (0-8) */
884
- ilvl: number;
885
- /** Starting number */
886
- start?: number;
887
- /** Number format */
888
- numFmt: NumberFormat;
889
- /** Level text (e.g., "%1." or "•") */
890
- lvlText: string;
891
- /** Justification */
892
- lvlJc?: 'left' | 'center' | 'right';
893
- /** Suffix after number */
894
- suffix?: LevelSuffix;
895
- /** Paragraph properties for this level */
896
- pPr?: ParagraphFormatting;
897
- /** Run properties for the number/bullet */
898
- rPr?: TextFormatting;
899
- /** Restart numbering from higher level */
900
- lvlRestart?: number;
901
- /** Is legal numbering style */
902
- isLgl?: boolean;
903
- /** Legacy settings */
904
- legacy?: {
905
- legacy?: boolean;
906
- legacySpace?: number;
907
- legacyIndent?: number;
908
- };
1018
+ interface CommentRangeEnd {
1019
+ type: 'commentRangeEnd';
1020
+ id: number;
909
1021
  }
910
1022
  /**
911
- * Abstract numbering definition (w:abstractNum)
1023
+ * Math equation content (m:oMath or m:oMathPara)
912
1024
  */
913
- interface AbstractNumbering {
914
- /** Abstract numbering ID */
915
- abstractNumId: number;
916
- /** Multi-level type */
917
- multiLevelType?: 'hybridMultilevel' | 'multilevel' | 'singleLevel';
918
- /** Numbering style link */
919
- numStyleLink?: string;
920
- /** Style link */
921
- styleLink?: string;
922
- /** Level definitions */
923
- levels: ListLevel[];
924
- /** Name */
925
- name?: string;
1025
+ interface MathEquation {
1026
+ type: 'mathEquation';
1027
+ /** Whether this is a block (oMathPara) or inline (oMath) equation */
1028
+ display: 'inline' | 'block';
1029
+ /** Raw OMML XML for round-trip preservation */
1030
+ ommlXml: string;
1031
+ /** Plain text representation for accessibility/fallback */
1032
+ plainText?: string;
926
1033
  }
927
1034
  /**
928
- * Numbering instance (w:num)
1035
+ * Tracked change metadata (w:ins, w:del attributes)
929
1036
  */
930
- interface NumberingInstance {
931
- /** Numbering ID (referenced by paragraphs) */
932
- numId: number;
933
- /** Reference to abstract numbering */
934
- abstractNumId: number;
935
- /** Level overrides */
936
- levelOverrides?: Array<{
937
- ilvl: number;
938
- startOverride?: number;
939
- lvl?: ListLevel;
940
- }>;
1037
+ interface TrackedChangeInfo {
1038
+ /** Revision ID */
1039
+ id: number;
1040
+ /** Author who made the change */
1041
+ author: string;
1042
+ /** Date of the change */
1043
+ date?: string;
941
1044
  }
942
1045
  /**
943
- * Computed list rendering info
1046
+ * Insertion wrapper (w:ins) — runs inserted by tracked changes
944
1047
  */
945
- interface ListRendering {
946
- /** Computed marker text (e.g., "1.", "a)", "•") */
947
- marker: string;
948
- /** List level (0-8) */
949
- level: number;
950
- /** Numbering ID */
951
- numId: number;
952
- /** Whether this is a bullet or numbered list */
953
- isBullet: boolean;
954
- /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
955
- numFmt?: NumberFormat;
1048
+ interface Insertion {
1049
+ type: 'insertion';
1050
+ /** Tracked change metadata */
1051
+ info: TrackedChangeInfo;
1052
+ /** Inserted content */
1053
+ content: (Run | Hyperlink)[];
956
1054
  }
957
1055
  /**
958
- * Complete numbering definitions
1056
+ * Deletion wrapper (w:del) — runs deleted by tracked changes
959
1057
  */
960
- interface NumberingDefinitions {
961
- /** Abstract numbering definitions */
962
- abstractNums: AbstractNumbering[];
963
- /** Numbering instances */
964
- nums: NumberingInstance[];
1058
+ interface Deletion {
1059
+ type: 'deletion';
1060
+ /** Tracked change metadata */
1061
+ info: TrackedChangeInfo;
1062
+ /** Deleted content */
1063
+ content: (Run | Hyperlink)[];
1064
+ }
1065
+ /**
1066
+ * SDT type (content control type)
1067
+ */
1068
+ type SdtType = 'richText' | 'plainText' | 'date' | 'dropdown' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'unknown';
1069
+ /**
1070
+ * SDT properties (w:sdtPr)
1071
+ */
1072
+ interface SdtProperties {
1073
+ /** SDT type */
1074
+ sdtType: SdtType;
1075
+ /** Alias (friendly name) */
1076
+ alias?: string;
1077
+ /** Tag (developer identifier) */
1078
+ tag?: string;
1079
+ /** Lock content editing */
1080
+ lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
1081
+ /** Placeholder text */
1082
+ placeholder?: string;
1083
+ /** Whether showing placeholder */
1084
+ showingPlaceholder?: boolean;
1085
+ /** Date format for date controls */
1086
+ dateFormat?: string;
1087
+ /** Dropdown/combobox list items */
1088
+ listItems?: {
1089
+ displayText: string;
1090
+ value: string;
1091
+ }[];
1092
+ /** Checkbox checked state */
1093
+ checked?: boolean;
1094
+ }
1095
+ /**
1096
+ * Inline SDT (content control within a paragraph)
1097
+ */
1098
+ interface InlineSdt {
1099
+ type: 'inlineSdt';
1100
+ /** SDT properties */
1101
+ properties: SdtProperties;
1102
+ /** Content runs inside the control */
1103
+ content: (Run | Hyperlink)[];
1104
+ }
1105
+ /**
1106
+ * Block-level SDT (content control wrapping paragraphs/tables)
1107
+ */
1108
+ interface BlockSdt {
1109
+ type: 'blockSdt';
1110
+ /** SDT properties */
1111
+ properties: SdtProperties;
1112
+ /** Block content inside the control */
1113
+ content: (Paragraph | Table)[];
1114
+ }
1115
+ /**
1116
+ * Paragraph content types
1117
+ */
1118
+ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MathEquation;
1119
+ /**
1120
+ * Paragraph (w:p)
1121
+ */
1122
+ interface Paragraph {
1123
+ type: 'paragraph';
1124
+ /** Unique paragraph ID */
1125
+ paraId?: string;
1126
+ /** Text ID */
1127
+ textId?: string;
1128
+ /** Paragraph formatting */
1129
+ formatting?: ParagraphFormatting;
1130
+ /** Paragraph content */
1131
+ content: ParagraphContent[];
1132
+ /** Computed list rendering (if this is a list item) */
1133
+ listRendering?: ListRendering;
1134
+ /** Section properties (if this paragraph ends a section) */
1135
+ sectionProperties?: SectionProperties;
965
1136
  }
966
1137
  /**
967
1138
  * Header/footer type
@@ -1042,28 +1213,6 @@ interface Endnote {
1042
1213
  /** Content */
1043
1214
  content: Paragraph[];
1044
1215
  }
1045
- /**
1046
- * Paragraph content types
1047
- */
1048
- type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField;
1049
- /**
1050
- * Paragraph (w:p)
1051
- */
1052
- interface Paragraph {
1053
- type: 'paragraph';
1054
- /** Unique paragraph ID */
1055
- paraId?: string;
1056
- /** Text ID */
1057
- textId?: string;
1058
- /** Paragraph formatting */
1059
- formatting?: ParagraphFormatting;
1060
- /** Paragraph content */
1061
- content: ParagraphContent[];
1062
- /** Computed list rendering (if this is a list item) */
1063
- listRendering?: ListRendering;
1064
- /** Section properties (if this paragraph ends a section) */
1065
- sectionProperties?: SectionProperties;
1066
- }
1067
1216
  /**
1068
1217
  * Page orientation
1069
1218
  */
@@ -1182,7 +1331,7 @@ interface SectionProperties {
1182
1331
  /**
1183
1332
  * Block-level content types
1184
1333
  */
1185
- type BlockContent = Paragraph | Table;
1334
+ type BlockContent = Paragraph | Table | BlockSdt;
1186
1335
  /**
1187
1336
  * Section (implicit or explicit based on sectPr)
1188
1337
  */
@@ -1206,7 +1355,16 @@ interface DocumentBody {
1206
1355
  sections?: Section[];
1207
1356
  /** Final section properties (from body's sectPr) */
1208
1357
  finalSectionProperties?: SectionProperties;
1358
+ /** Comments from comments.xml */
1359
+ comments?: Comment[];
1209
1360
  }
1361
+
1362
+ /**
1363
+ * Styles, Theme, Font Table, Relationships & Media Types
1364
+ *
1365
+ * Types for document-level definitions that don't form the content tree.
1366
+ */
1367
+
1210
1368
  /**
1211
1369
  * Style type
1212
1370
  */
@@ -1424,6 +1582,21 @@ interface MediaFile {
1424
1582
  /** Data URL for direct use in src attributes */
1425
1583
  dataUrl?: string;
1426
1584
  }
1585
+
1586
+ /**
1587
+ * Comprehensive TypeScript types for full DOCX document representation
1588
+ *
1589
+ * This barrel file re-exports all types from the split modules.
1590
+ * Existing imports from './types/document' continue to work unchanged.
1591
+ *
1592
+ * Module structure:
1593
+ * - colors.ts — Color primitives, borders, shading
1594
+ * - formatting.ts — Text, paragraph, and table formatting properties
1595
+ * - lists.ts — Numbering and list definitions
1596
+ * - content.ts — Content model (runs, images, shapes, tables, paragraphs, sections)
1597
+ * - styles.ts — Styles, theme, fonts, relationships, media
1598
+ */
1599
+
1427
1600
  /**
1428
1601
  * Complete DOCX package structure
1429
1602
  */
@@ -2213,4 +2386,4 @@ interface PluginRegistrationResult {
2213
2386
  warnings?: string[];
2214
2387
  }
2215
2388
 
2216
- export { type RunContent as $, type AIAction as A, type BlockContent as B, type CorePlugin as C, type DocumentBody as D, type Endnote as E, type Footnote as F, type McpToolContent as G, type Hyperlink as H, type Image as I, type JsonSchema as J, type McpToolContext as K, type ListLevel as L, type McpToolDefinition as M, type McpToolHandler as N, type McpToolResult as O, type PluginOptions as P, type NumberingDefinitions as Q, type Run as R, type ParagraphContext as S, type TextFormatting as T, type ParagraphFormatting as U, type ParagraphOutline as V, type PluginCommand as W, type PluginEvent as X, type Range as Y, type Relationship as Z, type ReplaceTextCommand as _, type PluginRegistrationResult as a, type SectionInfo as a0, type SectionProperties as a1, type SelectionContext as a2, type SetVariableCommand as a3, type Style as a4, type StyleDefinitions as a5, type StyleInfo as a6, type SuggestedAction as a7, type TableCell as a8, type TableRow as a9, type ThemeColorScheme as aA, type ThemeFont as aB, type ThemeFontScheme as aC, type ExtractCommand as aD, type McpToolExample as aE, type TypedCommandHandler as aF, type TextContent as aa, type Theme as ab, type ZodSchemaLike as ac, comparePositions as ad, createCollapsedRange as ae, createCommand as af, createRange as ag, getActionDescription as ah, getActionLabel as ai, isPositionInRange as aj, isZodSchema as ak, type ColorValue as al, type ThemeColorSlot as am, type HeaderFooter as an, type ParagraphAlignment as ao, type StyleType as ap, type BorderSpec as aq, type ShadingProperties as ar, type BreakContent as as, type BookmarkEnd as at, type BookmarkStart as au, type Field as av, type FooterReference as aw, type HeaderReference as ax, type Shape as ay, type TextBox as az, type CommandHandler as b, type PluginEventListener as c, type McpSession as d, type Paragraph as e, type Table as f, type Position as g, type Document as h, type AIActionRequest as i, type AgentCommand as j, type AgentContext as k, type AgentResponse as l, type ApplyStyleCommand as m, type ApplyVariablesCommand as n, type CommandResult as o, DEFAULT_AI_ACTIONS as p, type DeleteTextCommand as q, type DocxPackage as r, type FormatParagraphCommand as s, type FormatTextCommand as t, type InsertHyperlinkCommand as u, type InsertImageCommand as v, type InsertTableCommand as w, type InsertTextCommand as x, type LoadedDocument as y, type McpToolAnnotations as z };
2389
+ export { type RunContent as $, type AIAction as A, type BlockContent as B, type CorePlugin as C, type DocumentBody as D, type Endnote as E, type Footnote as F, type McpToolContent as G, type Hyperlink as H, type Image as I, type JsonSchema as J, type McpToolContext as K, type ListLevel as L, type McpToolDefinition as M, type McpToolHandler as N, type McpToolResult as O, type PluginOptions as P, type NumberingDefinitions as Q, type Run as R, type ParagraphContext as S, type TextFormatting as T, type ParagraphFormatting as U, type ParagraphOutline as V, type PluginCommand as W, type PluginEvent as X, type Range as Y, type Relationship as Z, type ReplaceTextCommand as _, type PluginRegistrationResult as a, type SectionInfo as a0, type SectionProperties as a1, type SelectionContext as a2, type SetVariableCommand as a3, type Style as a4, type StyleDefinitions as a5, type StyleInfo as a6, type SuggestedAction as a7, type TableCell as a8, type TableRow as a9, type Shape as aA, type TextBox as aB, type ThemeColorScheme as aC, type ThemeFont as aD, type ThemeFontScheme as aE, type ExtractCommand as aF, type McpToolExample as aG, type TypedCommandHandler as aH, type TextContent as aa, type Theme as ab, type ZodSchemaLike as ac, comparePositions as ad, createCollapsedRange as ae, createCommand as af, createRange as ag, getActionDescription as ah, getActionLabel as ai, isPositionInRange as aj, isZodSchema as ak, type ColorValue as al, type ThemeColorSlot as am, type ParagraphAlignment as an, type StyleType as ao, type TabStop as ap, type TabStopAlignment as aq, type BorderSpec as ar, type ShadingProperties as as, type BreakContent as at, type BookmarkEnd as au, type BookmarkStart as av, type Field as aw, type FooterReference as ax, type HeaderFooter as ay, type HeaderReference as az, type CommandHandler as b, type PluginEventListener as c, type McpSession as d, type Paragraph as e, type Table as f, type Position as g, type Document as h, type AIActionRequest as i, type AgentCommand as j, type AgentContext as k, type AgentResponse as l, type ApplyStyleCommand as m, type ApplyVariablesCommand as n, type CommandResult as o, DEFAULT_AI_ACTIONS as p, type DeleteTextCommand as q, type DocxPackage as r, type FormatParagraphCommand as s, type FormatTextCommand as t, type InsertHyperlinkCommand as u, type InsertImageCommand as v, type InsertTableCommand as w, type InsertTextCommand as x, type LoadedDocument as y, type McpToolAnnotations as z };