@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
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Compile a processed document into DocxIR.
3
+ *
4
+ * The input is the authoring tree after schema validation, custom-component
5
+ * expansion, theme resolution and component defaults (`ProcessedDocument`),
6
+ * paired with the section and column plan (`LayoutPlan`). What remains, and
7
+ * what this module does, is the last mile: the inline mini-language becomes
8
+ * inline nodes, points become twips and half-points, theme colour tokens become
9
+ * hex, and a font weight becomes the family alias it resolves to.
10
+ *
11
+ * No renderer is imported here, and none may be. The output is plain data.
12
+ *
13
+ * Scope: this is the first vertical slice — document metadata and settings,
14
+ * sections and page setup, headers and footers, paragraphs and headings with
15
+ * their runs, bookmarks, inline images and simple tables. Anything outside it
16
+ * is reported through `unsupported`, so a caller can tell "not yet compiled"
17
+ * from "compiled to nothing", and the default pipeline stays on the pre-IR path
18
+ * until the gap closes.
19
+ */
20
+ import { type FeatureRequirement } from '@json-to-office/shared/rendering';
21
+ import type { GenerationWarning } from '@json-to-office/shared';
22
+ import type { LayoutPlan } from '../core/layout';
23
+ import type { ProcessedDocument } from '../core/structure';
24
+ import type { ImageResources } from '../core/imageResources';
25
+ import type { DocxFeature } from './features';
26
+ import { type DocxIR } from './types';
27
+ /** A component the compiler does not yet lower into IR. */
28
+ export interface UnsupportedComponent {
29
+ name: string;
30
+ path: string;
31
+ /** What about it is not handled, when the component itself is. */
32
+ detail?: string;
33
+ }
34
+ export interface DocxCompileResult {
35
+ ir: DocxIR;
36
+ /** Backend capabilities the IR needs, with the IR path that needs them. */
37
+ required: readonly FeatureRequirement<DocxFeature>[];
38
+ warnings: GenerationWarning[];
39
+ /**
40
+ * What the compiler could not lower. Empty once the migration is complete;
41
+ * until then this is what keeps the pre-IR path authoritative instead of
42
+ * silently dropping content.
43
+ */
44
+ unsupported: UnsupportedComponent[];
45
+ }
46
+ export declare function compileDocument(structure: ProcessedDocument, layout: LayoutPlan, warnings?: GenerationWarning[], images?: ImageResources, options?: {
47
+ echoWarnings?: boolean;
48
+ }): DocxCompileResult;
49
+ //# sourceMappingURL=compiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/ir/compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA8B3D,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,wBAAwB,CAAC;AAuC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAEL,KAAK,MAAM,EA8BZ,MAAM,SAAS,CAAC;AAejB,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,QAAQ,EAAE,SAAS,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;IACrD,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B;;;;OAIG;IACH,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAsFD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,UAAU,EAClB,QAAQ,GAAE,iBAAiB,EAAO,EAClC,MAAM,GAAE,cAA0B,EAClC,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACvC,iBAAiB,CAmGnB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Stable debug snapshots of DocxIR.
3
+ *
4
+ * A snapshot is the IR with every binary resource replaced by its content hash
5
+ * and byte length, and object keys in a fixed order — diffable in a test,
6
+ * readable in a bug report, and free of the megabytes of image data that a
7
+ * base64 dump would carry.
8
+ */
9
+ import type { DocxIR } from './types';
10
+ /** A JSON-safe view of the IR, suitable for `toMatchSnapshot`. */
11
+ export type DocxIrSnapshot = Record<string, unknown>;
12
+ export declare function snapshotDocxIr(ir: DocxIR): DocxIrSnapshot;
13
+ /** Render a snapshot as stable, pretty-printed JSON. */
14
+ export declare function formatDocxIr(ir: DocxIR): string;
15
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/ir/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,SAAS,CAAC;AAEtD,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAKzD;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * DOCX renderer features.
3
+ *
4
+ * A feature is a capability a *backend* must have, not an authoring concept.
5
+ * The compiler records one requirement per IR node that needs one; a renderer
6
+ * declares the set it can satisfy. Anything required but not declared fails
7
+ * before rendering, with the IR path attached.
8
+ *
9
+ * The boundaries are drawn where backends actually differ. `toc` and
10
+ * `cached-toc` are separate because writing the field is easy and baking its
11
+ * entries is not; `footnotes` and `endnotes` are separate because a backend can
12
+ * plausibly have one and not the other.
13
+ */
14
+ export declare const DOCX_FEATURES: readonly ["paragraphs", "styles", "numbering", "sections", "columns", "headers-footers", "tables", "table-merged-cells", "floating-tables", "images", "floating-images", "svg-images", "text-frames", "text-boxes", "toc", "cached-toc", "fields", "cached-fields", "hyperlinks", "bookmarks", "cross-references", "comments", "comment-threads", "footnotes", "endnotes", "revisions", "breaks", "shading", "borders", "tab-stops", "proofing-language", "custom-properties", "rtl"];
15
+ export type DocxFeature = (typeof DOCX_FEATURES)[number];
16
+ /** Every feature, for an adapter that claims the full surface. */
17
+ export declare const ALL_DOCX_FEATURES: ReadonlySet<DocxFeature>;
18
+ export declare function isDocxFeature(value: string): value is DocxFeature;
19
+ //# sourceMappingURL=features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/ir/features.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,aAAa,udA6DhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,WAAW,CAEtD,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,WAAW,CAEjE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * DocxIR — internal to `@json-to-office/core-docx` for this release.
3
+ *
4
+ * Deliberately not re-exported from `packages/core-docx/src/index.ts`: the IR
5
+ * shape is expected to move while the rest of the DOCX migration lands, and
6
+ * publishing it now would freeze it. See
7
+ * `docs/architecture/office-renderer-ir.md`.
8
+ */
9
+ export * from './types';
10
+ export * from './features';
11
+ export * from './units';
12
+ export { assertValidDocxIr, validateDocxIr } from './validation';
13
+ export type { IrViolation } from './validation';
14
+ export { formatDocxIr, snapshotDocxIr } from './debug';
15
+ export type { DocxIrSnapshot } from './debug';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ir/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * The inline text mini-language, parsed into IR nodes.
3
+ *
4
+ * Authoring writes `**bold**`, `\n`, `\t` and friends inside a single string.
5
+ * By the time DocxIR exists none of that is markup any more: it is text runs,
6
+ * line breaks and tab runs, each carrying resolved formatting.
7
+ *
8
+ * This is deliberately a separate module from `compiler.ts`. The mini-language
9
+ * is the one piece of DOCX authoring with its own grammar, and it is where the
10
+ * subtle rules live — a decorator pair may straddle a newline, a tab has to
11
+ * become a real tab run because a tab character inside `<w:t>` is dropped, and
12
+ * a no-proof word has to be its own run so the flag can sit on it alone.
13
+ *
14
+ * Scope: decorators, line breaks, tabs, no-proof words, `[text](target)` links
15
+ * and `{PLACEHOLDER}` tokens. Cross-references and note markers are recognised
16
+ * only so the compiler can refuse them explicitly rather than render them as
17
+ * the literal characters an author wrote as markup — see
18
+ * `containsUnsupportedSyntax`.
19
+ */
20
+ import type { DocxIrInline, DocxIrRunFormatting } from './types';
21
+ /**
22
+ * A matcher for the known-words allowlist, or null when there is nothing to
23
+ * match.
24
+ *
25
+ * Each word matches as a whole token — no letter or digit directly either side
26
+ * — so `Wiseair` does not match inside `Wiseairy`, while internal punctuation
27
+ * like `json-to-office` matches literally.
28
+ */
29
+ export declare function buildNoProofWordsRegex(noProofWords?: string[]): RegExp | null;
30
+ /** True when the text carries a `{PLACEHOLDER}` token. */
31
+ export declare function containsPlaceholder(text: string): boolean;
32
+ /** True when the text carries a `[@id]` cross-reference. */
33
+ export declare function containsCrossReference(text: string): boolean;
34
+ /** True when the text carries a `[text](target)` link. */
35
+ export declare function containsLink(text: string): boolean;
36
+ /**
37
+ * Name the first piece of syntax in `text` this parser cannot lower.
38
+ *
39
+ * The compiler calls this before parsing so an unsupported construct is
40
+ * reported rather than silently rendered as the literal characters an author
41
+ * wrote as markup.
42
+ */
43
+ export declare function containsUnsupportedSyntax(text: string): string | undefined;
44
+ export interface ParseInlineOptions {
45
+ /** Formatting every run starts from. */
46
+ base: DocxIrRunFormatting;
47
+ /**
48
+ * Lower `[text](target)` into hyperlink nodes.
49
+ *
50
+ * Off by default: a component that does not accept links renders the
51
+ * brackets as the literal characters the author typed, which is what the
52
+ * pipeline has always done.
53
+ */
54
+ hyperlinks?: boolean;
55
+ /**
56
+ * Colour applied to a run only because a decorator made it bold.
57
+ *
58
+ * A separate colour for emphasised text is an authoring feature, so it is
59
+ * resolved here rather than left for a renderer to infer from `bold`.
60
+ */
61
+ boldColor?: {
62
+ hex: string;
63
+ };
64
+ /** Words to mark `noProof`, each split into a run of its own. */
65
+ noProofWords?: string[];
66
+ /**
67
+ * Resolve a `{NAME}` token. Returning nothing leaves it as literal text.
68
+ *
69
+ * A placeholder's meaning is document state — the generation date, the page
70
+ * being drawn — so the compiler supplies it rather than this module knowing
71
+ * any of it.
72
+ */
73
+ resolvePlaceholder?: (name: string) => PlaceholderResolution | undefined;
74
+ /**
75
+ * Resolve a `[^id]` marker to a note. Returning nothing leaves it literal.
76
+ *
77
+ * Resolution happens at the leaf, after decorators: a marker inside
78
+ * `**bold[^n]**` keeps the surrounding emphasis, which splitting earlier
79
+ * would break by cutting the `**` pair across segments.
80
+ */
81
+ resolveNote?: (id: string) => {
82
+ id: number;
83
+ noteKind: 'footnote' | 'endnote';
84
+ } | undefined;
85
+ /**
86
+ * Resolve a `[@id]` token to a field, or to nothing to leave it literal.
87
+ *
88
+ * The target may appear later in the document, so only a pre-pass over the
89
+ * whole outline can answer this — which is why the compiler supplies it.
90
+ */
91
+ resolveCrossReference?: (id: string, format: CrossReferenceFormat, token: string) => DocxIrInline | undefined;
92
+ }
93
+ /** The `\r`-style switches a `[@id:format]` token may ask for. */
94
+ export type CrossReferenceFormat = 'relative' | 'no_context' | 'full_context' | 'none';
95
+ /**
96
+ * Parse authored text into inline IR nodes.
97
+ *
98
+ * The shape of the output mirrors what the format needs rather than what the
99
+ * grammar looked like: a decorated span becomes runs with `bold`/`italic` set,
100
+ * a `\n` becomes a `lineBreak` node, a `\t` becomes a `tab` node.
101
+ */
102
+ export declare function parseInline(text: string, options: ParseInlineOptions): DocxIrInline[];
103
+ /**
104
+ * A placeholder resolved to something concrete.
105
+ *
106
+ * `field` is a live field Word recomputes (a page number); `text` is resolved
107
+ * once, at generation time (a date). An unknown name resolves to nothing and
108
+ * the token stays as the characters the author typed.
109
+ */
110
+ export type PlaceholderResolution = {
111
+ kind: 'field';
112
+ instruction: string;
113
+ } | {
114
+ kind: 'text';
115
+ text: string;
116
+ };
117
+ /**
118
+ * Text with no mini-language at all.
119
+ *
120
+ * A heading with no decorators and no cross-reference is rendered character for
121
+ * character: brackets stay brackets, and a newline stays inside the text rather
122
+ * than breaking the line. Only no-proof words are still split out, because the
123
+ * flag has to sit on exactly those runs.
124
+ */
125
+ export declare function parseLiteral(text: string, options: ParseInlineOptions): DocxIrInline[];
126
+ //#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