@open-document/core 0.11.0 → 0.13.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 (105) hide show
  1. package/dist/{build-BHFGY8eF.js → build-CbgIk6bA.js} +1 -1
  2. package/dist/{check-UEBmDfT_.js → check-BTroj-5Z.js} +3 -3
  3. package/dist/cli/bin.js +58 -34
  4. package/dist/config-BWtOZ1jc.d.ts +45 -0
  5. package/dist/{config-B_pdNbYg.js → config-DKKNIbvO.js} +1458 -983
  6. package/dist/{context-BM9_-u9P.js → context-DXNP8v9I.js} +3 -2
  7. package/dist/deploy-gcp-BUiSuqz7.js +758 -0
  8. package/dist/{dev-DX3QMIRi.js → dev-YXumw5iX.js} +1 -1
  9. package/dist/{diagram-BK4jTZr4.js → diagram-CKf3ptOE.js} +293 -13
  10. package/dist/{diff-DayvbXfX.js → diff-CTFfU4Tz.js} +2 -2
  11. package/dist/{export-BPsXj1i6.js → export-D2QLtF84.js} +11 -4
  12. package/dist/flow-CS5apebG.d.ts +252 -0
  13. package/dist/{import-71wlAsrd.js → import-CcmrFetU.js} +3 -2
  14. package/dist/index.d.ts +155 -59
  15. package/dist/index.js +945 -104
  16. package/dist/open-doc-plugin-DnX5usgI.js +320 -0
  17. package/dist/ops/index.d.ts +112 -3
  18. package/dist/ops/index.js +3 -3
  19. package/dist/{ops-BUo67DaP.js → ops-DmEecq1k.js} +86 -164
  20. package/dist/package-version-C89gtYSk.js +36 -0
  21. package/dist/{preview-D3m1-gUL.js → preview-_mHpBhMk.js} +1 -1
  22. package/dist/templates-MMblHwmT.js +34 -0
  23. package/dist/vite/index.d.ts +1 -1
  24. package/dist/vite/index.js +2 -1
  25. package/package.json +2 -1
  26. package/skills/apply-comments/SKILL.md +3 -1
  27. package/skills/create-doc/SKILL.md +2 -0
  28. package/skills/doc-authoring/SKILL.md +17 -16
  29. package/skills/doc-authoring/references/long-form.md +43 -2
  30. package/skills/doc-authoring/references/pagination.md +14 -2
  31. package/skills/doc-authoring/references/tables-and-charts.md +21 -17
  32. package/src/app/components/browser/browser-ui.tsx +21 -0
  33. package/src/app/components/browser/new-document-dialog.tsx +208 -0
  34. package/src/app/components/callout.tsx +101 -0
  35. package/src/app/components/changes/changes-overlay.tsx +68 -0
  36. package/src/app/components/changes/changes-panel.tsx +341 -0
  37. package/src/app/components/changes/use-changes.ts +85 -0
  38. package/src/app/components/chart.tsx +191 -33
  39. package/src/app/components/code-block.tsx +249 -0
  40. package/src/app/components/comments/comments-overlay.tsx +50 -0
  41. package/src/app/components/comments/comments-panel.tsx +272 -0
  42. package/src/app/components/comments/use-comments.ts +61 -0
  43. package/src/app/components/data-table.tsx +146 -18
  44. package/src/app/components/doc-sidebar.tsx +32 -2
  45. package/src/app/components/flow-page.tsx +57 -8
  46. package/src/app/components/inspector/field-source.tsx +41 -0
  47. package/src/app/components/inspector/inspector.tsx +64 -65
  48. package/src/app/components/numbering.tsx +226 -12
  49. package/src/app/components/overlay-frame.tsx +79 -0
  50. package/src/app/components/page-frame.tsx +46 -0
  51. package/src/app/components/page-placement.ts +68 -0
  52. package/src/app/components/record-picker.tsx +79 -0
  53. package/src/app/components/themes/theme-preview.tsx +5 -4
  54. package/src/app/lib/agent-bridge.ts +29 -1
  55. package/src/app/lib/chart.test.ts +15 -0
  56. package/src/app/lib/chart.ts +134 -9
  57. package/src/app/lib/diagnostics.ts +45 -1
  58. package/src/app/lib/docx/ooxml.test.ts +24 -1
  59. package/src/app/lib/docx/ooxml.ts +27 -1
  60. package/src/app/lib/export-docx.ts +3 -1
  61. package/src/app/lib/export-dom.ts +17 -3
  62. package/src/app/lib/export-html.ts +4 -2
  63. package/src/app/lib/export-image.ts +2 -1
  64. package/src/app/lib/export-pdf.ts +9 -1
  65. package/src/app/lib/flow-measure.test.ts +30 -0
  66. package/src/app/lib/flow-measure.ts +68 -14
  67. package/src/app/lib/flow.test.ts +20 -1
  68. package/src/app/lib/flow.ts +120 -20
  69. package/src/app/lib/i18n-ja/browser.ts +10 -0
  70. package/src/app/lib/i18n-ja/doc.ts +4 -0
  71. package/src/app/lib/i18n-ja/panels.ts +40 -0
  72. package/src/app/lib/i18n-ko/browser.ts +10 -0
  73. package/src/app/lib/i18n-ko/doc.ts +4 -0
  74. package/src/app/lib/i18n-ko/panels.ts +39 -0
  75. package/src/app/lib/i18n-zh-cn/browser.ts +10 -0
  76. package/src/app/lib/i18n-zh-cn/doc.ts +4 -0
  77. package/src/app/lib/i18n-zh-cn/panels.ts +38 -0
  78. package/src/app/lib/i18n-zh-tw/browser.ts +10 -0
  79. package/src/app/lib/i18n-zh-tw/doc.ts +4 -0
  80. package/src/app/lib/i18n-zh-tw/panels.ts +38 -0
  81. package/src/app/lib/labels.ts +29 -10
  82. package/src/app/lib/records.test.ts +38 -0
  83. package/src/app/lib/records.ts +127 -0
  84. package/src/app/lib/sdk.ts +35 -0
  85. package/src/app/lib/use-doc-module.ts +7 -0
  86. package/src/app/lib/use-doc-pages.ts +38 -17
  87. package/src/app/routes/doc.tsx +275 -13
  88. package/src/app/routes/home.tsx +30 -5
  89. package/src/app/styles.css +23 -0
  90. package/templates/blank/index.tsx +63 -0
  91. package/templates/blank/template.json +6 -0
  92. package/templates/certificate/data/recipients.csv +4 -0
  93. package/templates/certificate/index.tsx +128 -0
  94. package/templates/certificate/template.json +6 -0
  95. package/templates/letter/index.tsx +106 -0
  96. package/templates/letter/template.json +5 -0
  97. package/templates/meeting-notes/index.tsx +194 -0
  98. package/templates/meeting-notes/template.json +6 -0
  99. package/templates/proposal/index.tsx +264 -0
  100. package/templates/proposal/template.json +6 -0
  101. package/templates/report/data/metrics.csv +5 -0
  102. package/templates/report/index.tsx +224 -0
  103. package/templates/report/template.json +6 -0
  104. package/dist/config-P61niZMf.d.ts +0 -24
  105. package/dist/sdk-CpDEGRIo.d.ts +0 -138
@@ -0,0 +1,252 @@
1
+ import { ComponentType, ReactNode } from "react";
2
+ //#region src/app/lib/labels.d.ts
3
+ type LabelKind = 'figure' | 'table' | 'footnote' | 'citation';
4
+ type LabelEntry = {
5
+ /** Author-supplied id for `<Ref to>`, or a generated one. */
6
+ id: string;
7
+ kind: LabelKind;
8
+ /** 1-based, counted per kind across the whole document. */
9
+ number: number;
10
+ /** Caption text, for a list of figures. */
11
+ text: string;
12
+ /** 1-based page the item sits on. */
13
+ page: number;
14
+ };
15
+ /**
16
+ * The words wrapped around a number. Numbering is structural; what it is
17
+ * *called* is a document's own business — `圖 3` and `Figure 3` are the same
18
+ * entry. Set it once in `meta.labels`.
19
+ */
20
+ type LabelVocabulary = {
21
+ figure: string;
22
+ table: string;
23
+ /** Heading above a page's footnotes. Empty string renders no heading. */
24
+ footnotes: string;
25
+ /** Heading above a bibliography section when not overridden. */
26
+ bibliography: string;
27
+ /** Page suffix for a cross-reference. `{page}` is replaced. */
28
+ onPage: string;
29
+ };
30
+ /** The document's numbered items of one kind, in order. Empty on the first render pass. */
31
+ declare function useDocLabels(kind: LabelKind): LabelEntry[];
32
+ /** One numbered item by id, once the scan has run. */
33
+ declare function useDocLabel(id: string, kind?: LabelKind): LabelEntry | null;
34
+ //#endregion
35
+ //#region src/app/lib/design.d.ts
36
+ type DesignPalette = {
37
+ bg: string;
38
+ text: string;
39
+ muted: string;
40
+ accent: string;
41
+ rule: string;
42
+ };
43
+ type DesignFonts = {
44
+ heading: string;
45
+ body: string;
46
+ mono: string;
47
+ };
48
+ type DesignTypeScale = {
49
+ title: number;
50
+ h1: number;
51
+ h2: number;
52
+ h3: number;
53
+ body: number;
54
+ caption: number;
55
+ };
56
+ type DesignSystem = {
57
+ palette: DesignPalette;
58
+ fonts: DesignFonts;
59
+ typeScale: DesignTypeScale;
60
+ /** Page margin in CSS px — the printable text block's inset from the sheet edge. */
61
+ margin: number;
62
+ /** Body line-height multiplier. Headings tighten this themselves. */
63
+ leading: number;
64
+ radius: number;
65
+ };
66
+ declare function designToCssVars(d: DesignSystem): Record<string, string>;
67
+ declare function cssVarsToString(vars: Record<string, string>): string;
68
+ declare const defaultDesign: DesignSystem;
69
+ //#endregion
70
+ //#region src/app/lib/records.d.ts
71
+ /** One row of a document's `records` — usually a line of an imported `.csv`. */
72
+ type DataRecord = Record<string, unknown>;
73
+ /**
74
+ * The row this copy of the document is printed for. A document that exports
75
+ * `records` is laid out once per row; every page reads the same one. Outside a
76
+ * document with records — a card in the document list — it is `undefined`.
77
+ */
78
+ declare function useRecord<T extends DataRecord = DataRecord>(): T | undefined;
79
+ type FieldProps = {
80
+ /** The column to print. */
81
+ name: string;
82
+ /** Printed when the row has no value for it. */
83
+ fallback?: ReactNode;
84
+ };
85
+ /**
86
+ * One value of the current row, as text. Where no row is set — a document
87
+ * card, a theme preview — it prints the column's name in guillemets, so the
88
+ * layout still shows what goes where.
89
+ */
90
+ declare function Field({ name, fallback }: FieldProps): import("react").DetailedReactHTMLElement<{
91
+ style: {
92
+ opacity: number;
93
+ };
94
+ }, HTMLElement> | import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement> | null;
95
+ //#endregion
96
+ //#region src/app/lib/sdk.d.ts
97
+ /** The only sheets a document may be laid out on. */
98
+ declare const PAGE_SIZE_NAMES: readonly ["A4", "B4", "A3"];
99
+ type PageSizeName = (typeof PAGE_SIZE_NAMES)[number];
100
+ declare const ORIENTATIONS: readonly ["portrait", "landscape"];
101
+ type Orientation = (typeof ORIENTATIONS)[number];
102
+ /**
103
+ * Portrait dimensions in CSS pixels at 96dpi — the unit authors write in —
104
+ * paired with the physical millimetres used when printing. Keeping both means a
105
+ * page laid out at 794×1123 on screen maps to a real A4 sheet with no rescaling.
106
+ */
107
+ declare const PAGE_SIZES: Record<PageSizeName, {
108
+ width: number;
109
+ height: number;
110
+ mm: readonly [number, number];
111
+ }>;
112
+ declare const DEFAULT_PAGE_SIZE: PageSizeName;
113
+ declare const DEFAULT_ORIENTATION: Orientation;
114
+ declare function isPageSizeName(value: unknown): value is PageSizeName;
115
+ declare function isOrientation(value: unknown): value is Orientation;
116
+ type PageGeometry = {
117
+ width: number;
118
+ height: number;
119
+ /** Value for the `@page { size: … }` descriptor, orientation included. */
120
+ css: string;
121
+ };
122
+ type DocPage = ComponentType;
123
+ /**
124
+ * A run of continuous content the framework paginates itself. Build one with
125
+ * `flow(...)` and put it in the page array alongside fixed pages.
126
+ */
127
+ type FlowSection = {
128
+ readonly __odFlow: true;
129
+ blocks: ReactNode[];
130
+ /** Rendered on every page the section expands into, in the top margin band. */
131
+ header?: ComponentType;
132
+ /** Rendered on every page the section expands into. */
133
+ footer?: ComponentType;
134
+ /** Page padding override in px; defaults to the design's `margin`. */
135
+ padding?: number;
136
+ /** Number of columns for body content inside each page of this flow section. */
137
+ columns?: 1 | 2 | 3;
138
+ /** Gap in px between columns when `columns > 1`; defaults to 24. */
139
+ columnGap?: number;
140
+ };
141
+ /** What a document's default export may contain: fixed pages, flow sections, or both. */
142
+ type DocEntry = DocPage | FlowSection;
143
+ /**
144
+ * Every format `open-doc export` can write. The CLI's `--format`, the MCP
145
+ * `export_document` schema and `ops/layout.ts` all read this tuple, so adding a
146
+ * format is one edit here and its branch in `exportDocument`.
147
+ */
148
+ declare const EXPORT_FORMATS: readonly ["pdf", "html", "png", "docx"];
149
+ type ExportFormat = (typeof EXPORT_FORMATS)[number];
150
+ type DocMeta = {
151
+ title?: string;
152
+ subtitle?: string;
153
+ author?: string;
154
+ pageSize?: PageSizeName;
155
+ orientation?: Orientation;
156
+ /** Id of a theme under `themes/` this document was built from. Adds a back-link. */
157
+ theme?: string;
158
+ /** ISO 8601 timestamp. Set once at scaffold time; used to sort the doc list. */
159
+ createdAt?: string;
160
+ /** What numbered items are called — `圖`/`表` instead of `Figure`/`Table`. */
161
+ labels?: Partial<LabelVocabulary>;
162
+ /**
163
+ * The language the document is written in, as a BCP 47 tag — `zh-Hant-TW`,
164
+ * `ja`, `ko`, `en-GB`. It decides glyph shapes for shared Han characters,
165
+ * which line-breaking rules apply, and the language an exported file
166
+ * declares. English when unset.
167
+ */
168
+ lang?: string;
169
+ /**
170
+ * With `records`: the file name for each row's copy — `{column}` takes the
171
+ * row's value, `{#}` its number. `<id>-{#}` when unset.
172
+ */
173
+ recordName?: string;
174
+ /** With `records`: the column that names a row in the viewer's picker. */
175
+ recordLabel?: string;
176
+ /** Diagonal watermark text stamped across every sheet (e.g. 'CONFIDENTIAL', 'DRAFT'). */
177
+ watermark?: string;
178
+ };
179
+ type DocModule = {
180
+ default: DocEntry[];
181
+ meta?: DocMeta;
182
+ design?: DesignSystem;
183
+ /**
184
+ * Rows to print the document for, one copy each — usually an imported
185
+ * `.csv`. Pages read the current row with `useRecord()` or `<Field>`.
186
+ */
187
+ records?: DataRecord[];
188
+ };
189
+ declare function resolvePageGeometry(meta?: DocMeta): PageGeometry;
190
+ //#endregion
191
+ //#region src/app/lib/flow.d.ts
192
+ /**
193
+ * Wraps continuous content so the framework paginates it, instead of the author
194
+ * hand-splitting sections into fixed pages. Each direct child is one atomic
195
+ * block — a heading, a paragraph, a table — that never straddles a page break.
196
+ */
197
+ declare function flow(children: ReactNode, opts?: {
198
+ header?: ComponentType;
199
+ footer?: ComponentType;
200
+ padding?: number;
201
+ columns?: 1 | 2 | 3;
202
+ columnGap?: number;
203
+ }): FlowSection;
204
+ declare function isFlowSection(entry: DocEntry): entry is FlowSection;
205
+ type BlockSlice = {
206
+ index: number;
207
+ rowStart?: number;
208
+ rowEnd?: number;
209
+ };
210
+ type BlockMetrics = {
211
+ height: number;
212
+ /** Height this block's footnotes add to the foot of whatever page it lands on. */
213
+ footnoteHeight?: number;
214
+ /** A heading must not be the last block on a page. */
215
+ keepWithNext?: boolean;
216
+ /** A caption must not open a page without the figure it belongs to. */
217
+ keepWithPrevious?: boolean;
218
+ /** Always start a new page before this block. */
219
+ breakBefore?: boolean;
220
+ /** When present, this block is a table that can split between rows across page breaks. */
221
+ splittable?: {
222
+ headerHeight: number;
223
+ footerHeight: number;
224
+ rowHeights: number[];
225
+ };
226
+ };
227
+ type PaginationResult = {
228
+ /** Block indices per page, in order. */
229
+ pages: number[][];
230
+ /** Detailed block slices per page, carrying row ranges when a table splits across pages. */
231
+ slices: BlockSlice[][];
232
+ /** Blocks taller than one page — they stay whole and overflow. */
233
+ overflowing: number[];
234
+ };
235
+ type PaginateOptions = {
236
+ /** Rule and padding a page's footnote area costs before its first note. */
237
+ footnoteOverhead?: number;
238
+ };
239
+ /**
240
+ * Greedy top-to-bottom packing: fill a page until the next block would cross
241
+ * the bottom edge, then push that block — plus anything glued to it — onto the
242
+ * next page. Blocks are atomic unless marked `splittable`, in which case rows
243
+ * pack into the remaining space and continue on the next sheet with the header
244
+ * repeated.
245
+ *
246
+ * Footnotes are packed from the same budget: a block that carries notes brings
247
+ * their height with it, because those notes print at the foot of whichever page
248
+ * the block lands on.
249
+ */
250
+ declare function paginateBlocks(blocks: BlockMetrics[], available: number, opts?: PaginateOptions): PaginationResult;
251
+ //#endregion
252
+ export { DesignPalette as A, useDocLabels as B, isPageSizeName as C, FieldProps as D, Field as E, designToCssVars as F, LabelEntry as I, LabelKind as L, DesignTypeScale as M, cssVarsToString as N, useRecord as O, defaultDesign as P, LabelVocabulary as R, isOrientation as S, DataRecord as T, Orientation as _, isFlowSection as a, PageGeometry as b, DEFAULT_PAGE_SIZE as c, DocModule as d, DocPage as f, ORIENTATIONS as g, FlowSection as h, flow as i, DesignSystem as j, DesignFonts as k, DocEntry as l, ExportFormat as m, BlockSlice as n, paginateBlocks as o, EXPORT_FORMATS as p, PaginationResult as r, DEFAULT_ORIENTATION as s, BlockMetrics as t, DocMeta as u, PAGE_SIZES as v, resolvePageGeometry as w, PageSizeName as x, PAGE_SIZE_NAMES as y, useDocLabel as z };
@@ -1,5 +1,5 @@
1
- import { m as importMarkdown } from "./ops-BUo67DaP.js";
2
- import { t as cliContext } from "./context-BM9_-u9P.js";
1
+ import { a as importMarkdown } from "./ops-DmEecq1k.js";
2
+ import { t as cliContext } from "./context-DXNP8v9I.js";
3
3
  import chalk from "chalk";
4
4
  import path from "node:path";
5
5
  //#region src/cli/import.ts
@@ -11,6 +11,7 @@ async function importDoc(file, opts = {}) {
11
11
  ...opts.id !== void 0 ? { docId: opts.id } : {},
12
12
  ...opts.title !== void 0 ? { title: opts.title } : {},
13
13
  ...opts.subtitle !== void 0 ? { subtitle: opts.subtitle } : {},
14
+ ...opts.lang !== void 0 ? { lang: opts.lang } : {},
14
15
  ...opts.author !== void 0 ? { author: opts.author } : {},
15
16
  ...opts.theme !== void 0 ? { theme: opts.theme } : {},
16
17
  ...opts.pageSize !== void 0 ? { pageSize: opts.pageSize } : {},
package/dist/index.d.ts CHANGED
@@ -1,6 +1,33 @@
1
- import { A as useDocLabels, C as cssVarsToString, D as LabelKind, E as LabelEntry, O as LabelVocabulary, S as DesignTypeScale, T as designToCssVars, _ as isPageSizeName, a as DocModule, b as DesignPalette, d as Orientation, f as PAGE_SIZES, g as isOrientation, h as PageSizeName, i as DocMeta, k as useDocLabel, l as FlowSection, m as PageGeometry, n as DEFAULT_PAGE_SIZE, o as DocPage, p as PAGE_SIZE_NAMES, r as DocEntry, t as DEFAULT_ORIENTATION, u as ORIENTATIONS, v as resolvePageGeometry, w as defaultDesign, x as DesignSystem, y as DesignFonts } from "./sdk-CpDEGRIo.js";
2
- import { n as OpenDocConfig, t as OpenDocBuildConfig } from "./config-P61niZMf.js";
3
- import { CSSProperties, ComponentType, ReactNode } from "react";
1
+ import { A as DesignPalette, B as useDocLabels, C as isPageSizeName, D as FieldProps, E as Field, F as designToCssVars, I as LabelEntry, L as LabelKind, M as DesignTypeScale, N as cssVarsToString, O as useRecord, P as defaultDesign, R as LabelVocabulary, S as isOrientation, T as DataRecord, _ as Orientation, a as isFlowSection, b as PageGeometry, c as DEFAULT_PAGE_SIZE, d as DocModule, f as DocPage, g as ORIENTATIONS, h as FlowSection, i as flow, j as DesignSystem, k as DesignFonts, l as DocEntry, n as BlockSlice, o as paginateBlocks, r as PaginationResult, s as DEFAULT_ORIENTATION, t as BlockMetrics, u as DocMeta, v as PAGE_SIZES, w as resolvePageGeometry, x as PageSizeName, y as PAGE_SIZE_NAMES, z as useDocLabel } from "./flow-CS5apebG.js";
2
+ import { i as OpenDocGcpDeployConfig, n as OpenDocConfig, r as OpenDocDeployConfig, t as OpenDocBuildConfig } from "./config-BWtOZ1jc.js";
3
+ import { CSSProperties, ReactNode } from "react";
4
+ //#region src/app/lib/source-loc.d.ts
5
+ /**
6
+ * In dev, `loc-tags-plugin` stamps `data-od-loc` onto the call site of a
7
+ * framework component that forwards it. The component puts it back on the
8
+ * host that prints the call site's words, so the inspector can select what it
9
+ * rendered — a table, a caption, a footnote — and find the source behind it.
10
+ * `data-od-prop` says which attribute of the call site those words come from.
11
+ */
12
+ declare const LOC_PROP = "data-od-loc";
13
+ //#endregion
14
+ //#region src/app/components/callout.d.ts
15
+ type CalloutVariant = 'info' | 'tip' | 'warning' | 'danger' | 'neutral';
16
+ type CalloutProps = {
17
+ variant?: CalloutVariant;
18
+ title?: ReactNode;
19
+ children?: ReactNode;
20
+ style?: CSSProperties;
21
+ className?: string;
22
+ [LOC_PROP]?: string;
23
+ };
24
+ /**
25
+ * A structured admonition box (`info`, `tip`, `warning`, `danger`, `neutral`)
26
+ * rendered as a `<blockquote data-od-callout>` so Word and PDF exporters keep
27
+ * its panel border and shading intact.
28
+ */
29
+ declare function Callout({ variant, title, children, style, className, [LOC_PROP]: loc }: CalloutProps): import("react").JSX.Element;
30
+ //#endregion
4
31
  //#region src/app/lib/chart.d.ts
5
32
  /**
6
33
  * Chart geometry, kept pure so it can be tested without a DOM.
@@ -11,7 +38,7 @@ import { CSSProperties, ComponentType, ReactNode } from "react";
11
38
  * after the page break was decided. Text widths come from the same estimate
12
39
  * the diagram compiler uses, for the same reason.
13
40
  */
14
- type ChartType = 'bar' | 'line' | 'pie';
41
+ type ChartType = 'bar' | 'line' | 'pie' | 'area' | 'horizontal-bar';
15
42
  type ChartFormat = 'number' | 'integer' | 'percent' | ((value: number) => string);
16
43
  //#endregion
17
44
  //#region src/app/components/chart.d.ts
@@ -50,20 +77,48 @@ type ChartProps = {
50
77
  * it prints; the Word export places it as a picture.
51
78
  */
52
79
  declare function Chart({ type, data, x, y, labels, stacked, format, values, colors, width, height, caption, captionText, kind, id, style, className }: ChartProps): import("react").JSX.Element;
80
+ type SparklineProps = {
81
+ /** Numeric values to plot in order. */
82
+ data: number[];
83
+ /** Line with subtle fill, or compact inline bars. Defaults to 'line'. */
84
+ type?: 'line' | 'bar';
85
+ width?: number;
86
+ height?: number;
87
+ color?: string;
88
+ /** Highlight the final data point with a dot on line sparklines. Defaults to true. */
89
+ showEndDot?: boolean;
90
+ style?: CSSProperties;
91
+ className?: string;
92
+ };
93
+ /**
94
+ * A compact word-sized chart that sits inline inside a paragraph or table cell.
95
+ */
96
+ declare function Sparkline({ data, type, width, height, color, showEndDot, style, className }: SparklineProps): import("react").JSX.Element | null;
53
97
  //#endregion
54
- //#region src/app/lib/source-loc.d.ts
98
+ //#region src/app/components/code-block.d.ts
99
+ type CodeBlockProps = {
100
+ code?: string;
101
+ children?: string;
102
+ lang?: string;
103
+ title?: ReactNode;
104
+ lineNumbers?: boolean;
105
+ /** 1-based line numbers to highlight. */
106
+ highlightLines?: number[];
107
+ style?: CSSProperties;
108
+ className?: string;
109
+ [LOC_PROP]?: string;
110
+ };
55
111
  /**
56
- * In dev, `loc-tags-plugin` stamps `data-od-loc` onto the call site of a
57
- * framework component that forwards it. The component puts it back on the
58
- * host that prints the call site's words, so the inspector can select what it
59
- * rendered — a table, a caption, a footnote — and find the source behind it.
60
- * `data-od-prop` says which attribute of the call site those words come from.
112
+ * Print-ready syntax-highlighted code block with optional header bar, line
113
+ * numbers, and highlighted lines. Uses `--od-*` variables so it harmonizes with
114
+ * the document's design system and exports cleanly to PDF, HTML, and Word.
61
115
  */
62
- declare const LOC_PROP = "data-od-loc";
116
+ declare function CodeBlock({ code, children, lang, title, lineNumbers, highlightLines, style, className, [LOC_PROP]: loc }: CodeBlockProps): import("react").JSX.Element;
63
117
  //#endregion
64
118
  //#region src/app/components/data-table.d.ts
65
119
  type DataAlign = 'left' | 'center' | 'right';
66
- type DataFormat = 'text' | 'number' | 'integer' | 'percent' | ((value: unknown, row: Record<string, unknown>) => ReactNode);
120
+ type DataFormat = 'text' | 'number' | 'integer' | 'percent' | 'currency' | 'delta' | ((value: unknown, row: Record<string, unknown>) => ReactNode);
121
+ type DataSummaryOp = 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values: number[]) => ReactNode);
67
122
  type DataColumn = {
68
123
  key: string;
69
124
  label?: ReactNode;
@@ -71,6 +126,10 @@ type DataColumn = {
71
126
  format?: DataFormat;
72
127
  /** Column width. A number is px; `tableLayout: fixed` means these are honoured. */
73
128
  width?: number | string;
129
+ /** Draws a proportional horizontal bar behind numeric cells in this column. */
130
+ dataBar?: boolean;
131
+ /** Aggregation for this column when `summaryRow` is enabled on the table. */
132
+ summary?: DataSummaryOp | ReactNode;
74
133
  };
75
134
  type DataTableProps = {
76
135
  /** Rows as parsed from a `.csv`/`.tsv` import, or any array of objects. */
@@ -85,6 +144,12 @@ type DataTableProps = {
85
144
  limit?: number;
86
145
  /** Tighter rows, for a dense appendix table. */
87
146
  compact?: boolean;
147
+ /** Allows `flow()` to split this table across pages and repeat the `<thead>` on each sheet. */
148
+ splittable?: boolean;
149
+ /** Appends a summary footer row. Pass `true` to use column `summary` ops, or a record of values/ops. */
150
+ summaryRow?: boolean | Record<string, DataSummaryOp | ReactNode>;
151
+ /** Label printed in the first column of the summary row when not overridden. Defaults to 'Total'. */
152
+ summaryLabel?: ReactNode;
88
153
  /** What an empty cell prints as. Defaults to an em dash. */
89
154
  emptyValue?: ReactNode;
90
155
  style?: CSSProperties;
@@ -97,7 +162,7 @@ type DataTableProps = {
97
162
  * instead of being retyped into JSX. Alignment and grouping follow the column's
98
163
  * contents, which is the part people get wrong by hand.
99
164
  */
100
- declare function DataTable({ rows, columns, caption, id, limit, compact, emptyValue, style, className, [LOC_PROP]: loc }: DataTableProps): import("react").JSX.Element;
165
+ declare function DataTable({ rows, columns, caption, id, limit, compact, splittable, summaryRow, summaryLabel, emptyValue, style, className, [LOC_PROP]: loc }: DataTableProps): import("react").JSX.Element;
101
166
  //#endregion
102
167
  //#region src/app/components/diagram.d.ts
103
168
  type DiagramSource = {
@@ -187,6 +252,8 @@ type FigureProps = {
187
252
  captionPosition?: 'above' | 'below';
188
253
  /** Plain-text caption for the list of figures, when `caption` carries markup. */
189
254
  captionText?: string;
255
+ /** When false, prints the caption without registering a new label number (e.g. continued table slices). */
256
+ numbered?: boolean;
190
257
  style?: CSSProperties;
191
258
  captionStyle?: CSSProperties;
192
259
  className?: string;
@@ -202,7 +269,7 @@ type FigureProps = {
202
269
  *
203
270
  * Caption and content are one block, so a `flow()` section never separates them.
204
271
  */
205
- declare function Figure({ id, caption, kind, captionPosition, captionText, style, captionStyle, className, children, [LOC_PROP]: loc }: FigureProps): import("react").JSX.Element;
272
+ declare function Figure({ id, caption, kind, captionPosition, captionText, numbered, style, captionStyle, className, children, [LOC_PROP]: loc }: FigureProps): import("react").JSX.Element;
206
273
  type RefProps = {
207
274
  /** The `id` of a `<Figure>` or `<Footnote>`. */
208
275
  to: string;
@@ -235,6 +302,44 @@ type ListOfProps = {
235
302
  declare function ListOf({ kind, showPageNumbers, style, className }: ListOfProps): import("react").JSX.Element;
236
303
  declare function ListOfFigures(props: Omit<ListOfProps, 'kind'>): import("react").JSX.Element;
237
304
  declare function ListOfTables(props: Omit<ListOfProps, 'kind'>): import("react").JSX.Element;
305
+ type CiteProps = {
306
+ /** Stable citation key (e.g. 'rfc9110' or 'q3-audit'). */
307
+ id: string;
308
+ /** Citation details printed in `<Bibliography />`. Needs only to be supplied on one `<Cite>` for that id, or in `<Bibliography items={...} />`. */
309
+ source?: string;
310
+ style?: CSSProperties;
311
+ className?: string;
312
+ };
313
+ /**
314
+ * An inline bibliographic citation (`[1]`), numbered in order of first
315
+ * appearance across the rendered pages. Multiple `<Cite id="x" />` calls share
316
+ * the same number.
317
+ */
318
+ declare function Cite({ id, source, style, className }: CiteProps): import("react").JSX.Element;
319
+ type BibliographyItem = {
320
+ id?: string;
321
+ title?: ReactNode;
322
+ source?: ReactNode;
323
+ author?: string;
324
+ year?: string | number;
325
+ url?: string;
326
+ note?: string;
327
+ };
328
+ type BibliographyProps = {
329
+ /** Optional catalog of reference details keyed by citation `id` (or an array with `id`). Merged with inline `<Cite source="..." />` texts. */
330
+ items?: Record<string, string | BibliographyItem> | BibliographyItem[];
331
+ /** Optional heading text above the reference list. Pass `""` to omit. */
332
+ title?: ReactNode;
333
+ /** Show page numbers where each citation first appeared. */
334
+ showPageNumbers?: boolean;
335
+ style?: CSSProperties;
336
+ className?: string;
337
+ };
338
+ /**
339
+ * Renders the numbered list of all `<Cite>` references in order of appearance,
340
+ * plus any additional uncited entries passed in `items`.
341
+ */
342
+ declare function Bibliography({ items, title, showPageNumbers, style, className }: BibliographyProps): import("react").JSX.Element;
238
343
  //#endregion
239
344
  //#region src/app/components/table-of-contents.d.ts
240
345
  type TableOfContentsProps = {
@@ -257,50 +362,6 @@ type TableOfContentsProps = {
257
362
  */
258
363
  declare function TableOfContents({ maxLevel, showPageNumbers, includeOwnPage, indent, style, className }: TableOfContentsProps): import("react").JSX.Element;
259
364
  //#endregion
260
- //#region src/app/lib/flow.d.ts
261
- /**
262
- * Wraps continuous content so the framework paginates it, instead of the author
263
- * hand-splitting sections into fixed pages. Each direct child is one atomic
264
- * block — a heading, a paragraph, a table — that never straddles a page break.
265
- */
266
- declare function flow(children: ReactNode, opts?: {
267
- header?: ComponentType;
268
- footer?: ComponentType;
269
- padding?: number;
270
- }): FlowSection;
271
- declare function isFlowSection(entry: DocEntry): entry is FlowSection;
272
- type BlockMetrics = {
273
- height: number;
274
- /** Height this block's footnotes add to the foot of whatever page it lands on. */
275
- footnoteHeight?: number;
276
- /** A heading must not be the last block on a page. */
277
- keepWithNext?: boolean;
278
- /** A caption must not open a page without the figure it belongs to. */
279
- keepWithPrevious?: boolean;
280
- /** Always start a new page before this block. */
281
- breakBefore?: boolean;
282
- };
283
- type PaginationResult = {
284
- /** Block indices per page, in order. */
285
- pages: number[][];
286
- /** Blocks taller than one page — they stay whole and overflow. */
287
- overflowing: number[];
288
- };
289
- type PaginateOptions = {
290
- /** Rule and padding a page's footnote area costs before its first note. */
291
- footnoteOverhead?: number;
292
- };
293
- /**
294
- * Greedy top-to-bottom packing: fill a page until the next block would cross
295
- * the bottom edge, then push that block — plus anything glued to it — onto the
296
- * next page. Blocks are atomic; nothing is split mid-block.
297
- *
298
- * Footnotes are packed from the same budget: a block that carries notes brings
299
- * their height with it, because those notes print at the foot of whichever page
300
- * the block lands on.
301
- */
302
- declare function paginateBlocks(blocks: BlockMetrics[], available: number, opts?: PaginateOptions): PaginationResult;
303
- //#endregion
304
365
  //#region src/app/lib/outline.d.ts
305
366
  type OutlineEntry = {
306
367
  id: string;
@@ -343,6 +404,7 @@ type DiagramNode = {
343
404
  id: string;
344
405
  label: string;
345
406
  shape: NodeShape;
407
+ subgraph?: string;
346
408
  };
347
409
  type EdgeStyle = 'solid' | 'dashed' | 'thick';
348
410
  type DiagramEdge = {
@@ -353,10 +415,30 @@ type DiagramEdge = {
353
415
  /** A `---` link draws no arrowhead. */
354
416
  arrow: boolean;
355
417
  };
418
+ type DiagramSubgraph = {
419
+ id: string;
420
+ label: string;
421
+ nodeIds: string[];
422
+ };
423
+ type SequenceParticipant = {
424
+ id: string;
425
+ label: string;
426
+ };
427
+ type SequenceMessage = {
428
+ from: string;
429
+ to: string;
430
+ label: string;
431
+ style: EdgeStyle;
432
+ arrow: boolean;
433
+ };
356
434
  type Diagram$1 = {
435
+ kind?: 'flowchart' | 'sequence';
357
436
  direction: Direction;
358
437
  nodes: DiagramNode[];
359
438
  edges: DiagramEdge[];
439
+ subgraphs?: DiagramSubgraph[];
440
+ participants?: SequenceParticipant[];
441
+ messages?: SequenceMessage[];
360
442
  };
361
443
  declare class DiagramSyntaxError extends Error {
362
444
  readonly line: number;
@@ -364,6 +446,20 @@ declare class DiagramSyntaxError extends Error {
364
446
  }
365
447
  //#endregion
366
448
  //#region src/diagram/layout.d.ts
449
+ type LaidOutSubgraph = {
450
+ id: string;
451
+ label: string;
452
+ x: number;
453
+ y: number;
454
+ width: number;
455
+ height: number;
456
+ };
457
+ type LaidOutLifeline = {
458
+ id: string;
459
+ x: number;
460
+ y1: number;
461
+ y2: number;
462
+ };
367
463
  type LayoutOptions = {
368
464
  fontSize?: number;
369
465
  /** Gap between consecutive ranks, along the flow direction. */
@@ -393,4 +489,4 @@ type CompileOptions = LayoutOptions & RenderOptions;
393
489
  /** Mermaid-flavoured text in, themed SVG out. One call, no browser. */
394
490
  declare function compileDiagram(source: string, options?: CompileOptions): CompiledDiagram;
395
491
  //#endregion
396
- export { type BlockMetrics, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Figure, type FigureProps, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocBuildConfig, type OpenDocConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber };
492
+ export { Bibliography, type BibliographyItem, type BibliographyProps, type BlockMetrics, type BlockSlice, Callout, type CalloutProps, type CalloutVariant, type CellValue, Chart, type ChartFormat, type ChartProps, type ChartType, Cite, type CiteProps, CodeBlock, type CodeBlockProps, type CompileOptions, type CompiledDiagram, DEFAULT_ORIENTATION, DEFAULT_PAGE_SIZE, type DataAlign, type DataColumn, type DataFormat, type DataRecord, type DataSummaryOp, DataTable, type DataTableProps, type DelimitedTable, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, Diagram, type DiagramProps, type DiagramSource, type DiagramSubgraph, DiagramSyntaxError, type DocEntry, type DocMeta, type DocModule, type DocPage, Field, type FieldProps, Figure, type FigureProps, type FlowSection, Footnote, type FootnoteProps, Footnotes, type FootnotesProps, ImagePlaceholder, type ImagePlaceholderProps, type LabelEntry, type LabelKind, type LabelVocabulary, type LaidOutLifeline, type LaidOutSubgraph, ListOf, ListOfFigures, type ListOfProps, ListOfTables, ORIENTATIONS, type OpenDocBuildConfig, type OpenDocConfig, type OpenDocDeployConfig, type OpenDocGcpDeployConfig, type Orientation, type OutlineEntry, PAGE_SIZES, PAGE_SIZE_NAMES, type PageGeometry, type PageSizeName, type PaginationResult, Ref, type RefProps, type SequenceMessage, type SequenceParticipant, Sparkline, type SparklineProps, TableOfContents, type TableOfContentsProps, compileDiagram, cssVarsToString, defaultDesign, designToCssVars, flow, isFlowSection, isOrientation, isPageSizeName, paginateBlocks, parseDelimited, resolvePageGeometry, useDocLabel, useDocLabels, useDocOutline, useDocPageCount, useDocPageNumber, useRecord };