@json-to-office/core-docx 0.38.0 → 1.0.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 (163) hide show
  1. package/dist/components/highcharts.d.ts +16 -6
  2. package/dist/components/highcharts.d.ts.map +1 -1
  3. package/dist/components/index.d.ts +8 -14
  4. package/dist/components/index.d.ts.map +1 -1
  5. package/dist/components/visual.d.ts +60 -18
  6. package/dist/components/visual.d.ts.map +1 -1
  7. package/dist/core/collectTocHeadings.d.ts +15 -1
  8. package/dist/core/collectTocHeadings.d.ts.map +1 -1
  9. package/dist/core/componentTransform.d.ts +30 -0
  10. package/dist/core/componentTransform.d.ts.map +1 -0
  11. package/dist/core/desugarExternals.d.ts +35 -0
  12. package/dist/core/desugarExternals.d.ts.map +1 -0
  13. package/dist/core/flattenVisuals.d.ts.map +1 -1
  14. package/dist/core/generateFromIr.d.ts +78 -0
  15. package/dist/core/generateFromIr.d.ts.map +1 -0
  16. package/dist/core/generationContext.d.ts +2 -2
  17. package/dist/core/generationContext.d.ts.map +1 -1
  18. package/dist/core/generator.d.ts +48 -39
  19. package/dist/core/generator.d.ts.map +1 -1
  20. package/dist/core/imageResources.d.ts +35 -0
  21. package/dist/core/imageResources.d.ts.map +1 -0
  22. package/dist/core/index.d.ts +4 -5
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/layout.d.ts +15 -3
  25. package/dist/core/layout.d.ts.map +1 -1
  26. package/dist/core/markdownList.d.ts +21 -0
  27. package/dist/core/markdownList.d.ts.map +1 -0
  28. package/dist/core/prerasterizeVisuals.d.ts +2 -3
  29. package/dist/core/prerasterizeVisuals.d.ts.map +1 -1
  30. package/dist/core/sectionBookmarks.d.ts +15 -40
  31. package/dist/core/sectionBookmarks.d.ts.map +1 -1
  32. package/dist/core/tableModel.d.ts +188 -0
  33. package/dist/core/tableModel.d.ts.map +1 -0
  34. package/dist/core/tocField.d.ts +70 -0
  35. package/dist/core/tocField.d.ts.map +1 -0
  36. package/dist/index.d.ts +7 -6
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +8060 -7269
  39. package/dist/index.js.map +1 -1
  40. package/dist/ir/compiler.d.ts +49 -0
  41. package/dist/ir/compiler.d.ts.map +1 -0
  42. package/dist/ir/debug.d.ts +15 -0
  43. package/dist/ir/debug.d.ts.map +1 -0
  44. package/dist/ir/features.d.ts +19 -0
  45. package/dist/ir/features.d.ts.map +1 -0
  46. package/dist/ir/index.d.ts +16 -0
  47. package/dist/ir/index.d.ts.map +1 -0
  48. package/dist/ir/inline.d.ts +126 -0
  49. package/dist/ir/inline.d.ts.map +1 -0
  50. package/dist/ir/types.d.ts +774 -0
  51. package/dist/ir/types.d.ts.map +1 -0
  52. package/dist/ir/units.d.ts +57 -0
  53. package/dist/ir/units.d.ts.map +1 -0
  54. package/dist/ir/validation.d.ts +19 -0
  55. package/dist/ir/validation.d.ts.map +1 -0
  56. package/dist/plugin/createDocumentGenerator.d.ts +10 -3
  57. package/dist/plugin/createDocumentGenerator.d.ts.map +1 -1
  58. package/dist/plugin/example/index.d.ts.map +1 -1
  59. package/dist/plugin/example/index.js +8083 -7149
  60. package/dist/plugin/example/index.js.map +1 -1
  61. package/dist/plugin/index.d.ts +1 -1
  62. package/dist/plugin/index.d.ts.map +1 -1
  63. package/dist/plugin/schema.d.ts.map +1 -1
  64. package/dist/plugin/types.d.ts +13 -26
  65. package/dist/plugin/types.d.ts.map +1 -1
  66. package/dist/renderers/docxjs/emit.d.ts +41 -0
  67. package/dist/renderers/docxjs/emit.d.ts.map +1 -0
  68. package/dist/renderers/docxjs/index.d.ts +22 -0
  69. package/dist/renderers/docxjs/index.d.ts.map +1 -0
  70. package/dist/renderers/docxjs/styles.d.ts +12 -0
  71. package/dist/renderers/docxjs/styles.d.ts.map +1 -0
  72. package/dist/renderers/office-open/emit.d.ts +63 -0
  73. package/dist/renderers/office-open/emit.d.ts.map +1 -0
  74. package/dist/renderers/office-open/index.d.ts +25 -0
  75. package/dist/renderers/office-open/index.d.ts.map +1 -0
  76. package/dist/renderers/office-open/styles.d.ts +13 -0
  77. package/dist/renderers/office-open/styles.d.ts.map +1 -0
  78. package/dist/renderers/registry.d.ts +15 -0
  79. package/dist/renderers/registry.d.ts.map +1 -0
  80. package/dist/renderers/types.d.ts +35 -0
  81. package/dist/renderers/types.d.ts.map +1 -0
  82. package/dist/styles/themeToStyles.d.ts +12 -0
  83. package/dist/styles/themeToStyles.d.ts.map +1 -0
  84. package/dist/styles/utils/borderUtils.d.ts +13 -6
  85. package/dist/styles/utils/borderUtils.d.ts.map +1 -1
  86. package/dist/styles/utils/layoutUtils.d.ts +10 -14
  87. package/dist/styles/utils/layoutUtils.d.ts.map +1 -1
  88. package/dist/styles/utils/styleHelpers.d.ts +6 -2
  89. package/dist/styles/utils/styleHelpers.d.ts.map +1 -1
  90. package/dist/themes/overrides.d.ts +0 -2
  91. package/dist/themes/overrides.d.ts.map +1 -1
  92. package/dist/tsconfig.tsbuildinfo +1 -1
  93. package/dist/types/index.d.ts +18 -4
  94. package/dist/types/index.d.ts.map +1 -1
  95. package/dist/utils/bookmarkRegistry.d.ts +13 -77
  96. package/dist/utils/bookmarkRegistry.d.ts.map +1 -1
  97. package/dist/utils/commentRegistry.d.ts +5 -43
  98. package/dist/utils/commentRegistry.d.ts.map +1 -1
  99. package/dist/utils/exampleRunner.d.ts.map +1 -1
  100. package/dist/utils/imageUtils.d.ts +23 -19
  101. package/dist/utils/imageUtils.d.ts.map +1 -1
  102. package/dist/utils/numberingConfig.d.ts +7 -87
  103. package/dist/utils/numberingConfig.d.ts.map +1 -1
  104. package/dist/utils/packageDocument.d.ts +0 -3
  105. package/dist/utils/packageDocument.d.ts.map +1 -1
  106. package/dist/utils/revisionUtils.d.ts +6 -67
  107. package/dist/utils/revisionUtils.d.ts.map +1 -1
  108. package/dist/utils/warningsDocument.d.ts.map +1 -1
  109. package/package.json +12 -4
  110. package/dist/cache/index.d.ts +0 -7
  111. package/dist/cache/index.d.ts.map +0 -1
  112. package/dist/cache/key-generator.d.ts +0 -34
  113. package/dist/cache/key-generator.d.ts.map +0 -1
  114. package/dist/components/columns.d.ts +0 -12
  115. package/dist/components/columns.d.ts.map +0 -1
  116. package/dist/components/heading.d.ts +0 -12
  117. package/dist/components/heading.d.ts.map +0 -1
  118. package/dist/components/image.d.ts +0 -12
  119. package/dist/components/image.d.ts.map +0 -1
  120. package/dist/components/list.d.ts +0 -12
  121. package/dist/components/list.d.ts.map +0 -1
  122. package/dist/components/paragraph.d.ts +0 -12
  123. package/dist/components/paragraph.d.ts.map +0 -1
  124. package/dist/components/section.d.ts +0 -12
  125. package/dist/components/section.d.ts.map +0 -1
  126. package/dist/components/statistic.d.ts +0 -12
  127. package/dist/components/statistic.d.ts.map +0 -1
  128. package/dist/components/table.d.ts +0 -13
  129. package/dist/components/table.d.ts.map +0 -1
  130. package/dist/components/text-box.d.ts +0 -9
  131. package/dist/components/text-box.d.ts.map +0 -1
  132. package/dist/components/toc/index.d.ts +0 -30
  133. package/dist/components/toc/index.d.ts.map +0 -1
  134. package/dist/core/cached-render.d.ts +0 -92
  135. package/dist/core/cached-render.d.ts.map +0 -1
  136. package/dist/core/content.d.ts +0 -319
  137. package/dist/core/content.d.ts.map +0 -1
  138. package/dist/core/render.d.ts +0 -48
  139. package/dist/core/render.d.ts.map +0 -1
  140. package/dist/styles/themeToDocxAdapter.d.ts +0 -22
  141. package/dist/styles/themeToDocxAdapter.d.ts.map +0 -1
  142. package/dist/styles/utils/cellUtils.d.ts +0 -55
  143. package/dist/styles/utils/cellUtils.d.ts.map +0 -1
  144. package/dist/utils/alignmentUtils.d.ts +0 -10
  145. package/dist/utils/alignmentUtils.d.ts.map +0 -1
  146. package/dist/utils/commentAnchors.d.ts +0 -39
  147. package/dist/utils/commentAnchors.d.ts.map +0 -1
  148. package/dist/utils/componentAnnotations.d.ts +0 -23
  149. package/dist/utils/componentAnnotations.d.ts.map +0 -1
  150. package/dist/utils/docxImagePositioning.d.ts +0 -19
  151. package/dist/utils/docxImagePositioning.d.ts.map +0 -1
  152. package/dist/utils/noteRegistry.d.ts +0 -43
  153. package/dist/utils/noteRegistry.d.ts.map +0 -1
  154. package/dist/utils/noteResolver.d.ts +0 -31
  155. package/dist/utils/noteResolver.d.ts.map +0 -1
  156. package/dist/utils/numberedItemsRegistry.d.ts +0 -38
  157. package/dist/utils/numberedItemsRegistry.d.ts.map +0 -1
  158. package/dist/utils/placeholderImage.d.ts +0 -31
  159. package/dist/utils/placeholderImage.d.ts.map +0 -1
  160. package/dist/utils/placeholderProcessor.d.ts +0 -58
  161. package/dist/utils/placeholderProcessor.d.ts.map +0 -1
  162. package/dist/utils/textParser.d.ts +0 -117
  163. package/dist/utils/textParser.d.ts.map +0 -1
@@ -1,48 +0,0 @@
1
- /**
2
- * Render Functions
3
- * Transform components and layout into Word document elements
4
- */
5
- import { Document, Paragraph, Table, TableOfContents, ISectionOptions } from 'docx';
6
- import { ComponentDefinition, RenderContext } from '../types';
7
- import { ThemeConfig } from '../styles';
8
- import { ProcessedDocument } from './structure';
9
- import { LayoutPlan, SectionLayout } from './layout';
10
- import { MemoryCache } from '../cache';
11
- import type { ServicesConfig, RasterizeFontFace } from '@json-to-office/shared';
12
- import type { GenerationWarning } from '@json-to-office/shared';
13
- interface RenderDocumentOptions {
14
- cache?: MemoryCache;
15
- bypassCache?: boolean;
16
- services?: ServicesConfig;
17
- /**
18
- * Directory that relative asset paths (image `path` props) resolve
19
- * against. Defaults to `process.cwd()` when absent (#142).
20
- */
21
- baseDir?: string;
22
- /**
23
- * Font faces (base64) shipped with every `visual` rasterization so the
24
- * out-of-process LibreOffice renders the slide with the document's real
25
- * fonts instead of a system fallback. Produced by the caller from
26
- * `resolveDocumentFonts` via `toRasterizeFontFaces`.
27
- */
28
- visualFonts?: RasterizeFontFace[];
29
- /**
30
- * Collector for warnings raised while rendering, such as an inline SVG the
31
- * rasterizer could not turn into a fallback. Absent → `console.warn`.
32
- */
33
- warnings?: GenerationWarning[];
34
- }
35
- /**
36
- * Render a complete document from structure and layout
37
- */
38
- export declare function renderDocument(structure: ProcessedDocument, layout: LayoutPlan, options?: RenderDocumentOptions): Promise<Document>;
39
- /**
40
- * Render a section with layout
41
- */
42
- export declare function renderSection(section: SectionLayout, theme: ThemeConfig, themeName: string, context: RenderContext, sectionOrdinal?: number, closeBookmark?: boolean, bypassCache?: boolean): Promise<ISectionOptions>;
43
- /**
44
- * Render a single component to Word elements
45
- */
46
- export declare function renderComponent(component: ComponentDefinition, theme: ThemeConfig, themeName: string, context: RenderContext): Promise<(Paragraph | Table | TableOfContents)[]>;
47
- export {};
48
- //# sourceMappingURL=render.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/core/render.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,eAAe,EAEf,eAAe,EAKhB,MAAM,MAAM,CAAC;AAcd,OAAO,EACL,mBAAmB,EACnB,aAAa,EAed,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAEL,iBAAiB,EAElB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAgChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAOhE,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AA8DD;;GAEG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,QAAQ,CAAC,CA8BnB;AAqZD;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,EACtB,cAAc,CAAC,EAAE,MAAM,EACvB,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,UAAQ,GAClB,OAAO,CAAC,eAAe,CAAC,CAkH1B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,CAAC,SAAS,GAAG,KAAK,GAAG,eAAe,CAAC,EAAE,CAAC,CAmClD"}
@@ -1,22 +0,0 @@
1
- import { IStylesOptions, IRunStylePropertiesOptions, IParagraphStylePropertiesOptions } from 'docx';
2
- import type { ThemeConfig } from './index';
3
- export interface WordStyleDefinition {
4
- id: string;
5
- name: string;
6
- basedOn?: string;
7
- next?: string;
8
- quickFormat?: boolean;
9
- run?: IRunStylePropertiesOptions;
10
- paragraph?: IParagraphStylePropertiesOptions;
11
- }
12
- /**
13
- * Creates Word document styles from theme configuration
14
- * @param themeNameOrObject The theme to use for styling (name string or theme object)
15
- * @returns IStylesOptions for docx Document
16
- */
17
- export declare function createWordStyles(themeNameOrObject?: string | ThemeConfig, language?: string): IStylesOptions;
18
- /**
19
- * Maps section levels to Word style IDs
20
- */
21
- export declare function getStyleIdForLevel(level: number): string;
22
- //# sourceMappingURL=themeToDocxAdapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"themeToDocxAdapter.d.ts","sourceRoot":"","sources":["../../src/styles/themeToDocxAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,gCAAgC,EAGjC,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA2T3C,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,0BAA0B,CAAC;IACjC,SAAS,CAAC,EAAE,gCAAgC,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,iBAAiB,GAAE,MAAM,GAAG,WAAuB,EACnD,QAAQ,CAAC,EAAE,MAAM,GAChB,cAAc,CA2lBhB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUxD"}
@@ -1,55 +0,0 @@
1
- /**
2
- * Cell utilities for building table cell configurations
3
- */
4
- import { Paragraph, Table } from 'docx';
5
- import { ThemeConfig } from '../index';
6
- import { BordersConfig } from './borderUtils';
7
- /**
8
- * Padding configuration for all four sides
9
- */
10
- export interface PaddingConfig {
11
- top?: number;
12
- right?: number;
13
- bottom?: number;
14
- left?: number;
15
- }
16
- /**
17
- * Shading configuration
18
- */
19
- export interface ShadingConfig {
20
- fill?: string;
21
- }
22
- /**
23
- * Complete cell style configuration
24
- */
25
- export interface CellStyleConfig {
26
- padding?: PaddingConfig;
27
- border?: BordersConfig;
28
- shading?: ShadingConfig;
29
- }
30
- /**
31
- * Builds cell options object for TableCell constructor
32
- * Handles margins (padding), shading, and borders consistently
33
- * @param children - Child elements to include in the cell
34
- * @param styleCfg - Style configuration for the cell
35
- * @param theme - Theme configuration for color resolution
36
- * @returns Cell options object ready for TableCell constructor
37
- */
38
- export declare function buildCellOptions(children: (Paragraph | Table)[], styleCfg: CellStyleConfig | undefined, theme: ThemeConfig): {
39
- children: (Paragraph | Table)[];
40
- margins: {
41
- top: number;
42
- right: number;
43
- bottom: number;
44
- left: number;
45
- };
46
- shading?: {
47
- fill: string;
48
- };
49
- borders?: Record<string, {
50
- style: any;
51
- size: number;
52
- color: string;
53
- }>;
54
- };
55
- //# sourceMappingURL=cellUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cellUtils.d.ts","sourceRoot":"","sources":["../../../src/styles/utils/cellUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAkB,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC,EAAE,EAC/B,QAAQ,EAAE,eAAe,GAAG,SAAS,EACrC,KAAK,EAAE,WAAW,GACjB;IACD,QAAQ,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvE,CA6BA"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Alignment Utilities
3
- * Shared utilities for converting alignment strings to docx AlignmentType
4
- */
5
- import { AlignmentType } from 'docx';
6
- /**
7
- * Convert alignment string to docx AlignmentType
8
- */
9
- export declare function getAlignment(alignment: string): (typeof AlignmentType)[keyof typeof AlignmentType];
10
- //# sourceMappingURL=alignmentUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alignmentUtils.d.ts","sourceRoot":"","sources":["../../src/utils/alignmentUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAErC;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,GAChB,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAWpD"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Comment anchors — the `word/document.xml` half of a review comment.
3
- *
4
- * Word expects, in this order inside the commented paragraph(s):
5
- *
6
- * <w:commentRangeStart w:id="N"/> …runs… <w:commentRangeEnd w:id="N"/>
7
- * <w:r><w:commentReference w:id="N"/></w:r>
8
- *
9
- * The range may span several paragraphs, in which case the start sits in the
10
- * first and the end plus reference in the last — which is how a list-level
11
- * comment is anchored.
12
- */
13
- import type { ParagraphChild } from 'docx';
14
- import type { Comment } from '@json-to-office/shared-docx';
15
- export interface CommentAnchor {
16
- /** Every comment in the thread: the root first, then its replies. */
17
- ids: number[];
18
- /** Range-start elements to place before the commented content. */
19
- start: ParagraphChild[];
20
- }
21
- /**
22
- * Register `comment` (and its replies) and return the opening anchors, or
23
- * undefined when there is no comment. Callers must pair this with
24
- * `closeCommentRange`.
25
- *
26
- * A thread anchors every one of its comments over the same range, which is how
27
- * Word writes threads and how it groups them in the review pane.
28
- */
29
- export declare function openCommentRange(comment: Comment | undefined): CommentAnchor | undefined;
30
- /**
31
- * The closing anchors: each range end followed by its reference run.
32
- *
33
- * `w:commentReference` is run-inner content, so it has to sit inside a `w:r`.
34
- * docx's `CommentReference` is the bare element; emitted as a direct child of
35
- * `w:p` it is schema-invalid and readers drop the comment silently (verified in
36
- * LibreOffice, which showed zero annotations before this wrapping).
37
- */
38
- export declare function closeCommentRange(ids: readonly number[]): ParagraphChild[];
39
- //# sourceMappingURL=commentAnchors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commentAnchors.d.ts","sourceRoot":"","sources":["../../src/utils/commentAnchors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,kEAAkE;IAClE,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B,aAAa,GAAG,SAAS,CAI3B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,EAAE,CAK1E"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Detection of per-instance annotation props anywhere in a component subtree.
3
- *
4
- * `revision` and `comment` both render as document-scoped OOXML ids allocated
5
- * from a per-render counter. A component carrying either must never be served
6
- * from the cross-document component cache, or a cached subtree replays dead ids
7
- * into a later document.
8
- *
9
- * The walk has to reach every place a component can hide: list items, table
10
- * cells (the table model is column-major, so cells are only reachable through
11
- * `props.columns[]`), components nested in a cell's `content`, and ordinary
12
- * children.
13
- */
14
- export type MaybeComponent = {
15
- props?: unknown;
16
- children?: unknown[];
17
- };
18
- /**
19
- * True when `key` appears anywhere in the component subtree: its own props,
20
- * list items, row-parallel structural entries, table cells, or any descendant.
21
- */
22
- export declare function componentHasAnnotation(component: MaybeComponent, key: string): boolean;
23
- //# sourceMappingURL=componentAnnotations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentAnnotations.d.ts","sourceRoot":"","sources":["../../src/utils/componentAnnotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC;AAqBvE;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,cAAc,EACzB,GAAG,EAAE,MAAM,GACV,OAAO,CAyCT"}
@@ -1,19 +0,0 @@
1
- import type { ImageProps } from '../types';
2
- import type { ThemeConfig } from '../styles';
3
- export type FloatingConfig = NonNullable<ImageProps['floating']>;
4
- export declare function mapHorizontalRelative(rel?: FloatingConfig['horizontalPosition'] extends infer T ? T extends {
5
- relative?: infer R;
6
- } ? R : never : never): "page" | "margin" | "character" | "column" | undefined;
7
- export declare function mapVerticalRelative(rel?: FloatingConfig['verticalPosition'] extends infer T ? T extends {
8
- relative?: infer R;
9
- } ? R : never : never): "page" | "paragraph" | "margin" | "line" | undefined;
10
- export declare function mapHorizontalAlign(align?: 'left' | 'center' | 'right' | 'inside' | 'outside'): "left" | "right" | "center" | "inside" | "outside" | undefined;
11
- export declare function mapVerticalAlign(align?: 'top' | 'center' | 'bottom' | 'inside' | 'outside'): "top" | "bottom" | "center" | "inside" | "outside" | undefined;
12
- export declare function mapWrapType(type?: 'none' | 'square' | 'topAndBottom' | 'around' | 'through'): 0 | 1 | 2 | 3 | undefined;
13
- export declare function mapWrapSide(side?: 'bothSides' | 'left' | 'right' | 'largest'): "left" | "right" | "bothSides" | "largest" | undefined;
14
- /**
15
- * Map shared floating config to docx ImageRun floating options.
16
- * Also lifts wrap.margins (if present) to floating.margins as expected by docx.
17
- */
18
- export declare function mapFloatingOptions(floating?: FloatingConfig, theme?: ThemeConfig, themeName?: string): any | undefined;
19
- //# sourceMappingURL=docxImagePositioning.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docxImagePositioning.d.ts","sourceRoot":"","sources":["../../src/utils/docxImagePositioning.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAS7C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;AAajE,wBAAgB,qBAAqB,CACnC,GAAG,CAAC,EAAE,cAAc,CAAC,oBAAoB,CAAC,SAAS,MAAM,CAAC,GACtD,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9B,CAAC,GACD,KAAK,GACP,KAAK,0DAcV;AAED,wBAAgB,mBAAmB,CACjC,GAAG,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,SAAS,MAAM,CAAC,GACpD,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9B,CAAC,GACD,KAAK,GACP,KAAK,wDAcV;AAED,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,kEAgB3D;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,kEAgB3D;AAED,wBAAgB,WAAW,CACzB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,GAAG,SAAS,6BAgBjE;AAED,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,0DAa5E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,CAAC,EAAE,cAAc,EACzB,KAAK,CAAC,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,GAAG,SAAS,CA2IjB"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Note registry — footnote and endnote bodies collected while rendering their
3
- * markers.
4
- *
5
- * A note has two halves in the package: a reference run in
6
- * `word/document.xml` and a body in `word/footnotes.xml` or
7
- * `word/endnotes.xml`, joined by a numeric id that is document-scoped.
8
- * Async-local state gives each render its own counters, so concurrent
9
- * generations cannot interleave ids and point a reference at another
10
- * document's body.
11
- *
12
- * Footnotes and endnotes are separate id spaces — they are separate parts —
13
- * so each gets its own counter. Both start at 1: docx writes the reserved
14
- * separator (-1) and continuationSeparator (0) notes itself.
15
- */
16
- import { Paragraph } from 'docx';
17
- /** docx's shape for the `footnotes` / `endnotes` document options. */
18
- export type NoteBodies = Record<string, {
19
- children: Paragraph[];
20
- }>;
21
- declare class NoteRegistry {
22
- private fallback;
23
- private readonly scopes;
24
- private get state();
25
- /** Run work with an isolated registry that follows its async call chain. */
26
- runScoped<T>(callback: () => T): T;
27
- /**
28
- * Register a footnote body and return the id its reference must use. Ids are
29
- * unique and monotonic within a render.
30
- */
31
- registerFootnote(text: string): number;
32
- /** Register an endnote body and return the id its reference must use. */
33
- registerEndnote(text: string): number;
34
- /** Every footnote registered in this scope, keyed by id. */
35
- getFootnotes(): NoteBodies;
36
- /** Every endnote registered in this scope, keyed by id. */
37
- getEndnotes(): NoteBodies;
38
- /** Test-only: reset the current scope's counters and bodies. */
39
- clear(): void;
40
- }
41
- export declare const globalNoteRegistry: NoteRegistry;
42
- export {};
43
- //# sourceMappingURL=noteRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noteRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/noteRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAW,MAAM,MAAM,CAAC;AAI1C,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC,CAAC;AA+BnE,cAAM,YAAY;IAChB,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAE7D,OAAO,KAAK,KAAK,GAEhB;IAED,4EAA4E;IAC5E,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAIlC;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAStC,yEAAyE;IACzE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IASrC,4DAA4D;IAC5D,YAAY,IAAI,UAAU;IAI1B,2DAA2D;IAC3D,WAAW,IAAI,UAAU;IAIzB,gEAAgE;IAChE,KAAK,IAAI,IAAI;CAed;AAED,eAAO,MAAM,kBAAkB,cAAqB,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Bind a paragraph's declared note bodies to the `[^id]` markers in its text.
3
- *
4
- * Footnotes and endnotes share the marker syntax and differ only in where Word
5
- * puts the body, so one resolver serves both: an id is looked up in
6
- * `footnotes` first, then `endnotes`.
7
- *
8
- * Registration is lazy — a body reaches its part only when a marker actually
9
- * resolves to it — and memoized, so repeating `[^id]` points both references at
10
- * the same note rather than duplicating the body.
11
- */
12
- import type { Note } from '@json-to-office/shared-docx';
13
- export interface NoteResolver {
14
- /** Called by the text parser for each `[^id]` marker it finds. */
15
- resolve: (id: string) => {
16
- id: number;
17
- endnote: boolean;
18
- } | undefined;
19
- /**
20
- * Report declared bodies that never made it into the document. Call once the
21
- * paragraph's text has been fully parsed.
22
- */
23
- reportUnemitted: (text: string) => void;
24
- }
25
- /**
26
- * Build the resolver `parseTextWithDecorators` consults for each marker, or
27
- * undefined when the paragraph declares no notes (which leaves `[^…]` as
28
- * ordinary text).
29
- */
30
- export declare function createNoteResolver(footnotes: readonly Note[] | undefined, endnotes: readonly Note[] | undefined): NoteResolver | undefined;
31
- //# sourceMappingURL=noteResolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noteResolver.d.ts","sourceRoot":"","sources":["../../src/utils/noteResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;IACtE;;;OAGG;IACH,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAyCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,IAAI,EAAE,GAAG,SAAS,EACtC,QAAQ,EAAE,SAAS,IAAI,EAAE,GAAG,SAAS,GACpC,YAAY,GAAG,SAAS,CAiD1B"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Numbered Item Registry
3
- *
4
- * Cross-reference targets — numbered headings and list items — resolved by the
5
- * document-outline pre-pass and read back while rendering inline text.
6
- *
7
- * It is a registry rather than a field on `RenderContext` because the consumer
8
- * is `textParser`, which is reached through `createText`/`createHeading`/
9
- * `createList` and never sees the context.
10
- */
11
- export interface NumberedItemInfo {
12
- kind: 'heading' | 'list-item';
13
- /** Rendered text of the target, for a `:none` (text) reference. */
14
- text: string;
15
- /** Full multilevel number ("2.1.3"), absent when the target is unnumbered. */
16
- full?: string;
17
- /** The target's own level counter ("3"), absent when unnumbered. */
18
- own?: string;
19
- }
20
- export declare class NumberedItemsRegistry {
21
- private readonly fallback;
22
- private readonly scopes;
23
- private get state();
24
- /** Run work with an isolated registry that follows its async call chain. */
25
- runScoped<T>(callback: () => T): T;
26
- /** Replace the contents with the pre-pass result. */
27
- seed(items: ReadonlyMap<string, NumberedItemInfo>): void;
28
- /**
29
- * False outside a render (a unit test calling `createText` directly). An
30
- * unresolved reference is then expected rather than an authoring mistake, so
31
- * the caller stays quiet about it.
32
- */
33
- isSeeded(): boolean;
34
- get(id: string): NumberedItemInfo | undefined;
35
- clear(): void;
36
- }
37
- export declare const globalNumberedItemsRegistry: NumberedItemsRegistry;
38
- //# sourceMappingURL=numberedItemsRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"numberedItemsRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/numberedItemsRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,GAAG,WAAW,CAAC;IAC9B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAOD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGvB;IACF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;IAEtE,OAAO,KAAK,KAAK,GAEhB;IAED,4EAA4E;IAC5E,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAIlC,qDAAqD;IACrD,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,IAAI;IAMxD;;;;OAIG;IACH,QAAQ,IAAI,OAAO;IAInB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI7C,KAAK,IAAI,IAAI;CAId;AAED,eAAO,MAAM,2BAA2B,uBAA8B,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Placeholder Image Utility
3
- * Provides an embedded placeholder image for charts when generation fails or assets are missing
4
- */
5
- /// <reference types="node" />
6
- /**
7
- * Generate a placeholder image as a Buffer
8
- * Returns a PNG buffer for compatibility with docx format
9
- */
10
- export declare function getPlaceholderImageBuffer(): Buffer;
11
- /**
12
- * Generate a placeholder image and save it to a temporary file
13
- * Returns the path to the generated placeholder file (reuses existing if available)
14
- */
15
- export declare function createPlaceholderImageFile(): Promise<string>;
16
- /**
17
- * Get a PNG placeholder as base64-encoded data URL
18
- * This is a minimal 1x1 transparent PNG for fallback scenarios
19
- */
20
- export declare function getPlaceholderDataUrl(): string;
21
- /**
22
- * Get a more detailed PNG placeholder as Buffer
23
- * This creates a simple gray box with "Chart" text
24
- */
25
- export declare function getPlaceholderPngBuffer(): Buffer;
26
- /**
27
- * Clean up placeholder files and cached paths
28
- * Call this when the document generation is complete
29
- */
30
- export declare function cleanupPlaceholders(): Promise<void>;
31
- //# sourceMappingURL=placeholderImage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"placeholderImage.d.ts","sourceRoot":"","sources":["../../src/utils/placeholderImage.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AASH;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAGlD;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC,CA4ClE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAG9C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAMhD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BzD"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Placeholder Processing System
3
- * Handles dynamic content replacement in text with support for rich text formatting
4
- */
5
- import { TextRun, ExternalHyperlink, InternalHyperlink, FootnoteReferenceRun, EndnoteReferenceRun, SimpleField } from 'docx';
6
- import { TextStyle } from './textParser';
7
- export type PlaceholderChild = TextRun | ExternalHyperlink | InternalHyperlink | FootnoteReferenceRun | EndnoteReferenceRun | SimpleField;
8
- /**
9
- * Placeholder handler function type
10
- */
11
- export type PlaceholderHandler = (_context?: PlaceholderContext) => PlaceholderChild | PlaceholderChild[] | string;
12
- /**
13
- * Context passed to placeholder handlers
14
- */
15
- export interface PlaceholderContext {
16
- style?: TextStyle;
17
- date?: Date;
18
- [key: string]: unknown;
19
- }
20
- /**
21
- * Placeholder registry for managing dynamic content
22
- */
23
- export declare class PlaceholderRegistry {
24
- private static handlers;
25
- /**
26
- * Register a placeholder handler
27
- */
28
- static register(name: string, handler: PlaceholderHandler): void;
29
- /**
30
- * Get a placeholder handler
31
- */
32
- static get(name: string): PlaceholderHandler | undefined;
33
- /**
34
- * Check if a placeholder is registered
35
- */
36
- static has(name: string): boolean;
37
- /**
38
- * Get all registered placeholder names
39
- */
40
- static getRegisteredNames(): string[];
41
- /**
42
- * Clear all registered placeholders
43
- */
44
- static clear(): void;
45
- }
46
- /**
47
- * Process text containing placeholders and return array of paragraph children
48
- */
49
- export declare function processPlaceholders(text: string, baseStyle?: TextStyle, context?: PlaceholderContext): PlaceholderChild[];
50
- /**
51
- * Process text with both decorators and placeholders
52
- */
53
- export declare function processTextWithPlaceholders(text: string, baseStyle?: TextStyle, context?: PlaceholderContext, noProofWords?: string[]): PlaceholderChild[];
54
- /**
55
- * Initialize built-in placeholders
56
- */
57
- export declare function initializeBuiltinPlaceholders(): void;
58
- //# sourceMappingURL=placeholderProcessor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"placeholderProcessor.d.ts","sourceRoot":"","sources":["../../src/utils/placeholderProcessor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,OAAO,EAEP,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACZ,MAAM,MAAM,CAAC;AACd,OAAO,EAIL,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP,iBAAiB,GACjB,iBAAiB,GAEjB,oBAAoB,GACpB,mBAAmB,GAEnB,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,QAAQ,CAAC,EAAE,kBAAkB,KAC1B,gBAAgB,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAkCD;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyC;IAEhE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIhE;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIxD;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACH,MAAM,CAAC,kBAAkB,IAAI,MAAM,EAAE;IAIrC;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;CAGrB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAc,EACzB,OAAO,GAAE,kBAAuB,GAC/B,gBAAgB,EAAE,CAgDpB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAc,EACzB,OAAO,GAAE,kBAAuB,EAChC,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,gBAAgB,EAAE,CAyGpB;AAgBD;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CA4CpD"}
@@ -1,117 +0,0 @@
1
- import { TextRun } from 'docx';
2
- import { type PlaceholderChild, type PlaceholderContext } from './placeholderProcessor';
3
- export interface TextStyle {
4
- font?: string;
5
- size?: number;
6
- color?: string;
7
- bold?: boolean;
8
- italics?: boolean;
9
- underline?: {
10
- type?: 'single' | 'double' | 'thick' | 'dotted' | 'dash' | 'dotDash' | 'dotDotDash' | 'wave' | 'none' | 'words' | 'dottedHeavy' | 'dashedHeavy' | 'dashLong' | 'dashLongHeavy' | 'dashDotHeavy' | 'dashDotDotHeavy' | 'wavyHeavy' | 'wavyDouble';
11
- color?: string;
12
- };
13
- scale?: number;
14
- characterSpacing?: number;
15
- language?: {
16
- value?: string;
17
- eastAsia?: string;
18
- bidirectional?: string;
19
- };
20
- noProof?: boolean;
21
- }
22
- export interface TextDecoratorOptions {
23
- boldColor?: string;
24
- placeholderContext?: PlaceholderContext;
25
- enableHyperlinks?: boolean;
26
- /**
27
- * "Known words" allowlist: each whole-word, case-insensitive occurrence is
28
- * emitted as its own no-proof run so Word never flags it, while surrounding
29
- * text stays spell-checked.
30
- */
31
- noProofWords?: string[];
32
- /**
33
- * Resolve a `[^id]` note marker to its document-scoped id and kind, or
34
- * undefined to leave the marker as literal text.
35
- *
36
- * Passing a resolver is what turns `[^…]` into syntax at all: without one,
37
- * text that merely looks like a marker (a regex character class in a code
38
- * sample, say) is untouched.
39
- */
40
- noteRef?: (id: string) => {
41
- id: number;
42
- endnote: boolean;
43
- } | undefined;
44
- }
45
- /**
46
- * Build a matcher for the known-words allowlist, or null when there's nothing
47
- * to match. Matches each word as a whole token (no letter/number directly
48
- * adjacent on either side) so "Wiseair" doesn't match inside "Wiseairy", while
49
- * internal punctuation like "json-to-office" is matched literally.
50
- */
51
- export declare function buildNoProofWordsRegex(noProofWords?: string[]): RegExp | null;
52
- /**
53
- * Split a plain string into TextRuns, marking every known-word occurrence as a
54
- * no-proof run via `makeRun`. When there are no known words, returns a single
55
- * run for the whole text.
56
- */
57
- export declare function splitByNoProofWords(text: string, makeRun: (segment: string, noProof: boolean) => TextRun, noProofWords?: string[]): TextRun[];
58
- /**
59
- * Parses text with inline markdown-style decorators, placeholders, and newlines, returning an array of TextRun objects
60
- * Supports:
61
- * - **bold** or __bold__
62
- * - *italic* or _italic_
63
- * - ***bold italic*** or ___bold italic___
64
- * - \n for line breaks
65
- * - {PLACEHOLDER} for dynamic content
66
- * - [link text](url) for hyperlinks (when enableHyperlinks is true)
67
- *
68
- * @param text The text to parse
69
- * @param baseStyle The base style to apply to all text runs
70
- * @param options Additional options for text decoration
71
- * @returns Array of TextRun and hyperlink objects with appropriate styling
72
- */
73
- export declare function parseTextWithDecorators(text: string, baseStyle?: TextStyle, options?: TextDecoratorOptions): PlaceholderChild[];
74
- /**
75
- * Run-level properties shared by every run produced for a piece of text.
76
- * Single assembly point for both the plain-text and placeholder paths — a
77
- * prop forwarded here reaches both, so the two cannot drift (issue #137).
78
- */
79
- export declare function buildRunCommonProps(baseStyle: TextStyle, overrides?: {
80
- bold?: boolean;
81
- italics?: boolean;
82
- boldColor?: string;
83
- }): {
84
- language?: {
85
- value?: string | undefined;
86
- eastAsia?: string | undefined;
87
- bidirectional?: string | undefined;
88
- } | undefined;
89
- characterSpacing?: number | undefined;
90
- scale?: number | undefined;
91
- underline?: {
92
- type?: "single" | "double" | "dotDash" | "dotDotDash" | "dotted" | "none" | "thick" | "wave" | "dash" | "words" | "dottedHeavy" | "dashedHeavy" | "dashLong" | "dashLongHeavy" | "dashDotHeavy" | "dashDotDotHeavy" | "wavyHeavy" | "wavyDouble" | undefined;
93
- color?: string | undefined;
94
- } | undefined;
95
- italics?: boolean | undefined;
96
- bold?: boolean | undefined;
97
- color?: string | undefined;
98
- size?: number | undefined;
99
- font?: string | undefined;
100
- };
101
- /**
102
- * Turn multi-line text into TextRuns: `\n` becomes a run break, `\t` a real
103
- * tab run, no-proof words their own runs. Shared by the plain-text path
104
- * (textParser) and the placeholder path (placeholderProcessor) so run-level
105
- * properties cannot diverge between them.
106
- */
107
- export declare function buildTextRuns(text: string, commonProps: ReturnType<typeof buildRunCommonProps>, opts?: {
108
- noProof?: boolean;
109
- noProofWords?: string[];
110
- }): TextRun[];
111
- /**
112
- * True when the text carries a `[@id]` token. `createHeading` renders simple
113
- * headings through a run builder that never reaches this parser, so it needs to
114
- * know when a heading is not simple after all.
115
- */
116
- export declare function hasCrossReference(text: string): boolean;
117
- //# sourceMappingURL=textParser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textParser.d.ts","sourceRoot":"","sources":["../../src/utils/textParser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAQR,MAAM,MAAM,CAAC;AACd,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EACD,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,YAAY,GACZ,MAAM,GACN,MAAM,GACN,OAAO,GACP,aAAa,GACb,aAAa,GACb,UAAU,GACV,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,WAAW,GACX,YAAY,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IAEF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;CACxE;AAaD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAY7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,EACvD,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,OAAO,EAAE,CAoBX;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAc,EACzB,OAAO,GAAE,oBAAyB,GACjC,gBAAgB,EAAE,CAoGpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,EACpB,SAAS,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;EAoBtE;AAyDD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,EACnD,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GACxD,OAAO,EAAE,CAiBX;AAoGD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD"}