@reportwright/engine 0.0.0-stage → 0.12.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 (79) hide show
  1. package/CHANGELOG.md +233 -0
  2. package/LICENSE +23 -0
  3. package/README.md +105 -2
  4. package/dist/index.js +22548 -0
  5. package/dist/pdfstreamworker.js +38 -0
  6. package/dist/types/packages/engine/entry.d.ts +125 -0
  7. package/dist/types/src/designer/tableGen.d.ts +119 -0
  8. package/dist/types/src/engine/data/guard.d.ts +50 -0
  9. package/dist/types/src/engine/data/index.d.ts +120 -0
  10. package/dist/types/src/engine/data/odata.d.ts +35 -0
  11. package/dist/types/src/engine/data/stream.d.ts +48 -0
  12. package/dist/types/src/engine/data/xml.d.ts +108 -0
  13. package/dist/types/src/engine/expr/evaluate.d.ts +183 -0
  14. package/dist/types/src/engine/expr/format.d.ts +122 -0
  15. package/dist/types/src/engine/expr/javafmt.d.ts +26 -0
  16. package/dist/types/src/engine/expr/parser.d.ts +29 -0
  17. package/dist/types/src/engine/image.d.ts +107 -0
  18. package/dist/types/src/engine/index.d.ts +239 -0
  19. package/dist/types/src/engine/items/barcode.d.ts +121 -0
  20. package/dist/types/src/engine/items/cells.d.ts +11 -0
  21. package/dist/types/src/engine/items/chart-kit.d.ts +75 -0
  22. package/dist/types/src/engine/items/chart-more.d.ts +52 -0
  23. package/dist/types/src/engine/items/chart-round.d.ts +28 -0
  24. package/dist/types/src/engine/items/chart.d.ts +42 -0
  25. package/dist/types/src/engine/items/hpage.d.ts +33 -0
  26. package/dist/types/src/engine/items/index.d.ts +117 -0
  27. package/dist/types/src/engine/items/map.d.ts +11 -0
  28. package/dist/types/src/engine/items/paint.d.ts +138 -0
  29. package/dist/types/src/engine/items/pivot.d.ts +45 -0
  30. package/dist/types/src/engine/items/rich.d.ts +105 -0
  31. package/dist/types/src/engine/items/toc.d.ts +10 -0
  32. package/dist/types/src/engine/items/visuals.d.ts +5 -0
  33. package/dist/types/src/engine/layout.d.ts +24 -0
  34. package/dist/types/src/engine/paged.d.ts +19 -0
  35. package/dist/types/src/engine/paginate/index.d.ts +17 -0
  36. package/dist/types/src/engine/reuse.d.ts +120 -0
  37. package/dist/types/src/engine/schema/report.schema.d.ts +2421 -0
  38. package/dist/types/src/engine/schema/template.d.ts +212 -0
  39. package/dist/types/src/engine/schema/validate.d.ts +21 -0
  40. package/dist/types/src/engine/stream.d.ts +54 -0
  41. package/dist/types/src/engine/style.d.ts +70 -0
  42. package/dist/types/src/engine/text/fonts.d.ts +96 -0
  43. package/dist/types/src/engine/text/measure.d.ts +145 -0
  44. package/dist/types/src/engine/text/rich.d.ts +48 -0
  45. package/dist/types/src/engine/text/shaper.d.ts +20 -0
  46. package/dist/types/src/engine/units.d.ts +53 -0
  47. package/dist/types/src/engine/url.d.ts +23 -0
  48. package/dist/types/src/exporters/color.d.ts +9 -0
  49. package/dist/types/src/exporters/csv.d.ts +44 -0
  50. package/dist/types/src/exporters/deadline.d.ts +6 -0
  51. package/dist/types/src/exporters/docx.d.ts +19 -0
  52. package/dist/types/src/exporters/encrypt.d.ts +39 -0
  53. package/dist/types/src/exporters/figures.d.ts +112 -0
  54. package/dist/types/src/exporters/html.d.ts +24 -0
  55. package/dist/types/src/exporters/htmldata.d.ts +32 -0
  56. package/dist/types/src/exporters/pdf.d.ts +45 -0
  57. package/dist/types/src/exporters/pdfa.d.ts +42 -0
  58. package/dist/types/src/exporters/pdfpaint.d.ts +107 -0
  59. package/dist/types/src/exporters/pdfstream.d.ts +198 -0
  60. package/dist/types/src/exporters/pdfstreamtags.d.ts +38 -0
  61. package/dist/types/src/exporters/pdfua.d.ts +17 -0
  62. package/dist/types/src/exporters/png.d.ts +10 -0
  63. package/dist/types/src/exporters/pptx.d.ts +14 -0
  64. package/dist/types/src/exporters/regions.d.ts +30 -0
  65. package/dist/types/src/exporters/subset.d.ts +5 -0
  66. package/dist/types/src/exporters/svg.d.ts +26 -0
  67. package/dist/types/src/exporters/svgimage.d.ts +33 -0
  68. package/dist/types/src/exporters/xlsx.d.ts +61 -0
  69. package/dist/types/src/exporters/xlsxchart.d.ts +26 -0
  70. package/dist/types/src/exporters/xlsxwriter.d.ts +83 -0
  71. package/dist/types/src/importers/xml.d.ts +34 -0
  72. package/examples/stream-1m.mjs +87 -0
  73. package/index.d.ts +3 -0
  74. package/package.json +79 -4
  75. package/pool/index.d.ts +23 -0
  76. package/pool/index.js +85 -0
  77. package/pool/worker.js +27 -0
  78. package/report.d.ts +638 -0
  79. package/schema.json +2517 -0
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Render a report definition to a page model (pages, regions), the input of every exporter. Throws ReportError for a
3
+ * definition that cannot render at all; everything else is a warning in the model.
4
+ * @param {any} def0 the report definition (pagewright/report@1), or a saved report's JSON
5
+ * @param {RenderOptions} [opts]
6
+ * @returns {Promise<any>} the page model
7
+ */
8
+ export function render(def0: any, opts?: RenderOptions): Promise<any>;
9
+ export function baseContext(def: any, { params, now, timeZone, fnCount, clock }: {
10
+ params: any;
11
+ now: any;
12
+ timeZone: any;
13
+ fnCount: any;
14
+ clock: any;
15
+ }): {
16
+ params: any;
17
+ globals: {
18
+ ExecutionTime: any;
19
+ ReportName: any;
20
+ PageNumber: number;
21
+ TotalPages: number;
22
+ };
23
+ dataSets: {};
24
+ fields: any;
25
+ locale: any;
26
+ currency: any;
27
+ nonFinite: any;
28
+ grouping: any;
29
+ nullPropagation: boolean;
30
+ doubles: boolean;
31
+ bandRows: any;
32
+ timeZone: any;
33
+ caseSensitive: boolean;
34
+ nullOrder: any;
35
+ collation: any;
36
+ naturalSort: boolean;
37
+ functions: {
38
+ byName: Map<string, any>;
39
+ count: {
40
+ n: number;
41
+ };
42
+ };
43
+ clock: any;
44
+ aggCache: WeakMap<object, any>;
45
+ fmtMemo: Map<any, any>;
46
+ };
47
+ /**
48
+ * Options for parameters that list values from a data set (cascading parameters:
49
+ * the data set may filter on other parameters).
50
+ * @returns {Promise<Record<string, {value: any, label: string}[]>>}
51
+ */
52
+ export function parameterOptions(def: any, given?: {}, opts?: {}): Promise<Record<string, {
53
+ value: any;
54
+ label: string;
55
+ }[]>>;
56
+ /**
57
+ * Defaults, types and required checks for report parameters.
58
+ * @param {any} def @param {Record<string, any>} given the values the caller passed, by name
59
+ * @param {{ lenient?: boolean, now?: Date, timeZone?: string, locale?: string }} [o] lenient: a missing required value is not an error (the option lists); now, timeZone, locale: for defaults such as =Today()
60
+ * @returns {Record<string, any>}
61
+ */
62
+ export function resolveParameters(def: any, given: Record<string, any>, o?: {
63
+ lenient?: boolean;
64
+ now?: Date;
65
+ timeZone?: string;
66
+ locale?: string;
67
+ }): Record<string, any>;
68
+ export class ReportError extends Error {
69
+ /** @param {string} msg @param {object} [extra] */
70
+ constructor(msg: string, extra?: object);
71
+ }
72
+ export const BAND_ITEMS: 250000;
73
+ /** The start of the warning for CJK text without the optional CJK fonts (the viewer opens its warnings for it). */
74
+ export const NO_CJK_FONTS: "Text in Japanese/Chinese/Korean needs the optional CJK fonts: npm run fonts:cjk";
75
+ /**
76
+ * Options for render(). All optional.
77
+ */
78
+ export type RenderOptions = {
79
+ /**
80
+ * filled in: how many times the report was laid out (tests, the bench)
81
+ */
82
+ stats?: {
83
+ layoutPasses?: number;
84
+ };
85
+ /**
86
+ * values of the report's parameters, by name (invariant form: 1234.5, 2026-03-05)
87
+ */
88
+ parameters?: Record<string, any>;
89
+ /**
90
+ * the fonts; share one across renders (a new one loads them again)
91
+ */
92
+ fontStore?: import("./text/fonts.js").FontStore;
93
+ /**
94
+ * loads a font the store does not have
95
+ */
96
+ loadFont?: (key: string) => Promise<ArrayBuffer | Uint8Array>;
97
+ /**
98
+ * fetch for data sources (default: the SSRF-guarded fetch, see unsafeFetch)
99
+ */
100
+ fetch?: typeof fetch;
101
+ /**
102
+ * the origin relative data URLs resolve against
103
+ */
104
+ baseUrl?: string;
105
+ /**
106
+ * data sources already loaded, by name (skips loading them)
107
+ */
108
+ sources?: Record<string, any>;
109
+ /**
110
+ * the render's clock: ExecutionTime and =Today() defaults (default: the current time)
111
+ */
112
+ now?: Date;
113
+ /**
114
+ * the saved report being rendered; the server runs its SQL sources for a browser render
115
+ */
116
+ reportId?: string;
117
+ /**
118
+ * runs SQL sources directly (server renders)
119
+ */
120
+ sql?: (src: any, params: Record<string, any>) => Promise<object[]>;
121
+ /**
122
+ * loads a saved report by id: subreports, masters, part libraries, stylesheets, themes
123
+ */
124
+ loadReport?: (id: string) => Promise<any>;
125
+ /**
126
+ * stop with a ReportError (status 504) when the render runs longer; subreports share it
127
+ */
128
+ timeoutMs?: number;
129
+ /**
130
+ * the same limit as an absolute time (ms since the epoch)
131
+ */
132
+ deadline?: number;
133
+ /**
134
+ * receives the loaded sources (the worker's first pages hand them to the full render)
135
+ */
136
+ onSources?: (sources: Record<string, any>) => void;
137
+ /**
138
+ * keep the table data (model.regions) and cell tags that Excel, CSV, Word, interactive HTML and accessible PDF rebuild tables from
139
+ */
140
+ exportData?: boolean;
141
+ /**
142
+ * the table data only (model.regions; pages is empty): no layout, for the data CSV
143
+ */
144
+ dataOnly?: boolean;
145
+ /**
146
+ * turn off the SSRF guard (data/guard.js): public http(s) hosts only by default
147
+ */
148
+ unsafeFetch?: boolean;
149
+ /**
150
+ * private hosts the guard may reach
151
+ */
152
+ allowHosts?: string[];
153
+ /**
154
+ * time limit per data fetch (default 30 s)
155
+ */
156
+ fetchTimeoutMs?: number;
157
+ /**
158
+ * size limit per data fetch, decoded (default 64 MB)
159
+ */
160
+ maxFetchBytes?: number;
161
+ /**
162
+ * lay out only enough rows for this many pages: a fast first look, not the final render
163
+ */
164
+ firstPages?: number;
165
+ /**
166
+ * which layers draw (default export)
167
+ */
168
+ target?: "screen" | "print" | "export";
169
+ /**
170
+ * the viewer's interactive state: sorts, toggles, selections
171
+ */
172
+ state?: Record<string, any>;
173
+ /**
174
+ * the zone dates show in, when the report sets none
175
+ */
176
+ timeZone?: string;
177
+ /**
178
+ * internal (subreports): the width the child body is laid out to
179
+ */
180
+ bodyWidth?: any;
181
+ /**
182
+ * internal (subreports): nesting level, at most 3
183
+ */
184
+ depth?: number;
185
+ /**
186
+ * internal (subreports): subreports rendered so far, all levels together
187
+ */
188
+ budget?: {
189
+ used: number;
190
+ };
191
+ /**
192
+ * internal (subreports): the reports this render sits inside, so one that reaches itself is skipped
193
+ */
194
+ chain?: string[];
195
+ /**
196
+ * internal (subreports): the body alone, no pages
197
+ */
198
+ bodyOnly?: boolean;
199
+ /**
200
+ * internal: reports loaded for this render and its subreports
201
+ */
202
+ reportCache?: Map<string, any>;
203
+ /**
204
+ * internal: items drawn through report parts so far
205
+ */
206
+ reuseBudget?: {
207
+ items: number;
208
+ };
209
+ /**
210
+ * internal: report function calls so far
211
+ */
212
+ fnCount?: {
213
+ n: number;
214
+ };
215
+ /**
216
+ * internal: the images drawn so far, shared with subreports
217
+ */
218
+ imageBudget?: any;
219
+ /**
220
+ * internal (paged.js): these pages are a window of a longer report: numbered from offset + 1 of total ('…' when not known
221
+ * yet); final: the window holds the report's last page; first: the report's first row; rowOffset: the rows before this
222
+ * window; cont: per group level, the group the window's first row continues (its first row), or null
223
+ */
224
+ pageWindow?: {
225
+ offset: number;
226
+ total?: number | null;
227
+ final: boolean;
228
+ first?: any;
229
+ rowOffset?: number;
230
+ cont?: ({
231
+ first: any;
232
+ } | null)[];
233
+ };
234
+ };
235
+ import { FontStore } from './text/fonts.js';
236
+ import { TextMeasurer } from './text/measure.js';
237
+ import { ITEMS } from './items/index.js';
238
+ import { finishText } from './text/measure.js';
239
+ export { FontStore, TextMeasurer, ITEMS, finishText };
@@ -0,0 +1,121 @@
1
+ export function loadBarcodes(): Promise<void>;
2
+ /**
3
+ * bwip-js options from an item's flat keys, for its symbology only.
4
+ * @param {Record<string, any>} item
5
+ */
6
+ export function bwipOptions(item: Record<string, any>): Record<string, any>;
7
+ /**
8
+ * Why a symbology cannot draw, with the id that was probably meant ("qr" → "qrcode"); null when it is known.
9
+ * @param {any} sym
10
+ */
11
+ export function symbologyError(sym: any): string;
12
+ /** Scale and move every coordinate of an SVG path (absolute and relative commands). */
13
+ export function transformPath(d: any, sx: any, sy: any, tx: any, ty: any): string;
14
+ /**
15
+ * @param {{ type?: string, text: any, x: number, y: number, w: number, h: number, color?: string, showText?: boolean,
16
+ * textHeight?: number, captionAbove?: boolean, options?: Record<string, any> }} a
17
+ * @returns {{ items: any[], error?: string, twoD?: boolean }} paths in item-local coordinates
18
+ */
19
+ export function paintBarcode({ type, text, x, y, w, h, color, showText, textHeight, captionAbove, options }: {
20
+ type?: string;
21
+ text: any;
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ color?: string;
27
+ showText?: boolean;
28
+ textHeight?: number;
29
+ captionAbove?: boolean;
30
+ options?: Record<string, any>;
31
+ }): {
32
+ items: any[];
33
+ error?: string;
34
+ twoD?: boolean;
35
+ };
36
+ export const SYMBOLOGIES: {
37
+ id: any;
38
+ name: any;
39
+ sample: any;
40
+ max: number;
41
+ twoD: boolean;
42
+ }[];
43
+ /** Kept for older callers: the ids in the designer's list. */
44
+ export const BARCODE_TYPES: any[];
45
+ /**
46
+ * Per-symbology options, as flat item keys. Each is checked against a list or a range: nothing a report
47
+ * author types reaches bwip-js unchecked.
48
+ */
49
+ export const BARCODE_OPTIONS: ({
50
+ key: string;
51
+ label: string;
52
+ for: string[];
53
+ opt: string;
54
+ enum: string[];
55
+ int?: undefined;
56
+ str?: undefined;
57
+ size?: undefined;
58
+ bool?: undefined;
59
+ num?: undefined;
60
+ } | {
61
+ key: string;
62
+ label: string;
63
+ for: string[];
64
+ opt: string;
65
+ int: number[];
66
+ str: boolean;
67
+ enum?: undefined;
68
+ size?: undefined;
69
+ bool?: undefined;
70
+ num?: undefined;
71
+ } | {
72
+ key: string;
73
+ label: string;
74
+ for: string[];
75
+ opt: string;
76
+ int: number[];
77
+ enum?: undefined;
78
+ str?: undefined;
79
+ size?: undefined;
80
+ bool?: undefined;
81
+ num?: undefined;
82
+ } | {
83
+ key: string;
84
+ label: string;
85
+ for: string[];
86
+ opt: string;
87
+ size: boolean;
88
+ enum?: undefined;
89
+ int?: undefined;
90
+ str?: undefined;
91
+ bool?: undefined;
92
+ num?: undefined;
93
+ } | {
94
+ key: string;
95
+ label: string;
96
+ for: string[];
97
+ opt: string;
98
+ bool: boolean;
99
+ enum?: undefined;
100
+ int?: undefined;
101
+ str?: undefined;
102
+ size?: undefined;
103
+ num?: undefined;
104
+ } | {
105
+ key: string;
106
+ label: string;
107
+ for: string[];
108
+ opt: string;
109
+ num: number[];
110
+ enum?: undefined;
111
+ int?: undefined;
112
+ str?: undefined;
113
+ size?: undefined;
114
+ bool?: undefined;
115
+ })[];
116
+ /**
117
+ * Every symbology bwip-js draws (its symbolList bcids, kept here so a check needs no 1 MB import; a test compares).
118
+ * A report may use any of them; the designer offers SYMBOLOGIES.
119
+ */
120
+ export const BWIP_IDS: Set<string>;
121
+ export function isTwoD(id: string): boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A table row's cells by column (null where nothing starts). Two forms, both accepted:
3
+ * - one entry per column, null under a colSpan (ReportWright's own form);
4
+ * - RDL / HTML style: the row has fewer cells than columns and spans, the spanned cells are omitted.
5
+ * covered: [k, j] pairs, cell k (0-based, own form) sits under the colSpan of cell j; it is not drawn.
6
+ * @param {any} cells @param {number} ncols @returns {{ at: any[], covered: [number, number][] }}
7
+ */
8
+ export function rowCells(cells: any, ncols: number): {
9
+ at: any[];
10
+ covered: [number, number][];
11
+ };
@@ -0,0 +1,75 @@
1
+ /** A palette by name, or a custom list of #hex colours. */
2
+ export function paletteOf(p: any): any;
3
+ /** WCAG contrast ratio of two #hex colours (1 when either is not a colour). */
4
+ export function contrast(a: any, b: any): number;
5
+ /** White or near-black, whichever reads better on the fill. */
6
+ export function inkOn(fill: any): "#111827" | "#ffffff";
7
+ /** "Nice" axis bounds and step (Heckbert). */
8
+ export function niceScale(min: any, max: any, ticks?: number): {
9
+ lo: number;
10
+ hi: number;
11
+ step: number;
12
+ };
13
+ /** Ticks from lo to hi by step, rounded so 0.1 + 0.2 reads 0.3. At most 200 (a bad min/max cannot loop for ever). */
14
+ export function linearTicks(lo: any, hi: any, step: any): any[];
15
+ /** Powers of ten covering [min, max] (both > 0); at least two. */
16
+ export function logTicks(min: any, max: any): number[];
17
+ /**
18
+ * An SVG path through points (in drawing order along the category axis).
19
+ * `along: 'y'` when the categories run down the page (a bar chart): the curve is then monotone in y.
20
+ * @param {{x:number,y:number}[]} pts
21
+ * @param {'straight'|'smooth'|'step'} mode
22
+ * @param {{along?: 'x'|'y', move?: boolean}} [o] move: false continues an existing path (L to the first point)
23
+ */
24
+ export function curvePath(pts: {
25
+ x: number;
26
+ y: number;
27
+ }[], mode?: "straight" | "smooth" | "step", { along, move }?: {
28
+ along?: "x" | "y";
29
+ move?: boolean;
30
+ }): string;
31
+ /**
32
+ * Least-squares trend through [x, y] pairs.
33
+ * @param {[number, number][]} pts
34
+ * @param {'linear'|'exp'|'poly'} kind
35
+ * @returns {{at: (x:number) => number, order: number} | null}
36
+ */
37
+ export function fitTrend(pts: [number, number][], kind?: "linear" | "exp" | "poly", order?: number): {
38
+ at: (x: number) => number;
39
+ order: number;
40
+ } | null;
41
+ /** Trailing moving average: null until `period` values are in; a missing value starts the count again. */
42
+ export function movingAverage(values: any, period: any): any[];
43
+ export namespace CAPS {
44
+ let categories: number;
45
+ let series: number;
46
+ let points: number;
47
+ let overlays: number;
48
+ let period: number;
49
+ }
50
+ export namespace PALETTES {
51
+ let _default: string[];
52
+ export { _default as default };
53
+ export let office: string[];
54
+ export let colorblind: string[];
55
+ export let vivid: string[];
56
+ export let pastel: string[];
57
+ export let ocean: string[];
58
+ export let sunset: string[];
59
+ export let forest: string[];
60
+ export let berry: string[];
61
+ export let earth: string[];
62
+ export let grayscale: string[];
63
+ export let highContrast: string[];
64
+ }
65
+ export const DARK_INK: "#111827";
66
+ /** Accepts label boxes that stay inside the plot and overlap no box placed before. Grid buckets keep it near linear. */
67
+ export class LabelPlacer {
68
+ constructor(bounds: any, cell?: number);
69
+ b: any;
70
+ cell: number;
71
+ grid: Map<any, any>;
72
+ fits(r: any): boolean;
73
+ place(r: any): boolean;
74
+ keys(r: any): Generator<string, void, unknown>;
75
+ }
@@ -0,0 +1,52 @@
1
+ /** Legend entries for these types (the series legend does not fit them). */
2
+ export function moreLegend(type: any, item: any, data: any, pal: any): {
3
+ name: any;
4
+ color: any;
5
+ }[];
6
+ export function paintMore(type: any, g: any): any;
7
+ /**
8
+ * Squarified treemap (Bruls, Huizing, van Wijk): values sorted largest first, laid out in rows along the shorter side,
9
+ * a row closed when adding the next value would make its worst aspect ratio worse. Linear after the sort.
10
+ * @returns {{x:number,y:number,w:number,h:number,i:number}[]}
11
+ */
12
+ export function squarify(items: any, x: any, y: any, w: any, h: any): {
13
+ x: number;
14
+ y: number;
15
+ w: number;
16
+ h: number;
17
+ i: number;
18
+ }[];
19
+ /** Bins over [lo, hi]: a count (default: Sturges) or a width. At most MORE_CAPS.bins; linear in the values. */
20
+ export function binValues(vals: any, { binCount, binWidth }?: {}): {
21
+ lo: number;
22
+ hi: number;
23
+ width: number;
24
+ counts: any[];
25
+ capped: boolean;
26
+ };
27
+ /** Quartiles (linear interpolation, as Excel QUARTILE.INC), whiskers at the furthest values within 1.5 IQR, outliers beyond. */
28
+ export function boxStats(sorted: any): {
29
+ min: any;
30
+ max: any;
31
+ q1: any;
32
+ med: any;
33
+ q3: any;
34
+ lo: any;
35
+ hi: any;
36
+ outliers: any[];
37
+ mean: number;
38
+ n: any;
39
+ };
40
+ /** Date ticks: the first step of day, week, month, quarter, year that gives at most `max` ticks. */
41
+ export function dateTicks(lo: any, hi: any, max?: number): {
42
+ ticks: number[];
43
+ unit: string | number;
44
+ } | {
45
+ ticks: any[];
46
+ unit: string;
47
+ };
48
+ export const MORE_TYPES: Set<string>;
49
+ export namespace MORE_CAPS {
50
+ let bins: number;
51
+ let outliers: number;
52
+ }
@@ -0,0 +1,28 @@
1
+ export function arc(cx: any, cy: any, r: any, ri: any, a0: any, a1: any): string;
2
+ export function paintRound(type: any, g: any): void;
3
+ /**
4
+ * Outside pie labels: one column each side; on a side the labels keep their slice order and are pushed apart (down, then
5
+ * back up from the bottom) so none overlap. When a side has more labels than fit, the smallest slices lose theirs.
6
+ * Each label is joined to its slice: from the rim, out to an elbow, then across to the label.
7
+ */
8
+ export function placeOutside(sides: any, { cx, cy, r, lw, lh, lo, hi, out, text, texts, fs, ink }: {
9
+ cx: any;
10
+ cy: any;
11
+ r: any;
12
+ lw: any;
13
+ lh: any;
14
+ lo: any;
15
+ hi: any;
16
+ out: any;
17
+ text: any;
18
+ texts: any;
19
+ fs: any;
20
+ ink: any;
21
+ }): void;
22
+ export const ROUND_TYPES: Set<string>;
23
+ export namespace GAUGE_SHAPES {
24
+ let half: number[];
25
+ let threeQuarter: number[];
26
+ let full: number[];
27
+ }
28
+ export const GAUGE_INDICATORS: string[];
@@ -0,0 +1,42 @@
1
+ /** Categories × series values from the data. */
2
+ export function chartData(item: any, ctx: any, lc: any, pal?: any): {
3
+ categories: any[];
4
+ buckets: any[];
5
+ series: any[];
6
+ rows: any;
7
+ };
8
+ /**
9
+ * Paint the chart into item-local coordinates (x from item.x, y from 0).
10
+ * meta.alt receives the chart's generated alt text (its type, title, series and categories).
11
+ * @param {{ alt?: string }} [meta]
12
+ * @returns {any[]} page-model items
13
+ */
14
+ export function paintChart(item: any, ctx: any, lc: any, base: any, meta?: {
15
+ alt?: string;
16
+ }): any[];
17
+ /** Overlays the legend lists (each unless legend: false), with the key each draws: a line (dashed for trends) or a band. */
18
+ export function legendOverlays(item: any, type: any, data: any): ({
19
+ name: string;
20
+ color: any;
21
+ mark: string;
22
+ dash: boolean;
23
+ } | {
24
+ name: string;
25
+ color: any;
26
+ mark: string;
27
+ dash?: undefined;
28
+ })[];
29
+ /**
30
+ * The robust window of a set of values: its 1st and 99th percentiles (nearest rank). extreme: the full spread is more
31
+ * than five times that window, so a few outliers would flatten the rest of the data.
32
+ * @param {number[]} vals
33
+ */
34
+ export function robustWindow(vals: number[]): {
35
+ p1: number;
36
+ p99: number;
37
+ extreme: boolean;
38
+ };
39
+ export { niceScale };
40
+ export const PALETTE: string[];
41
+ export const CHART_TYPES: string[];
42
+ import { niceScale } from './chart-kit.js';
@@ -0,0 +1,33 @@
1
+ /** The left edge of a page-model item. */
2
+ export function itemLeft(it: any): any;
3
+ /**
4
+ * @param {{ units: any[], height: number, headerCount: number, headerHeight: number, repeatHeader: boolean,
5
+ * colX: number[], widths: number[], x: number, repeat: number, room: number, order: 'down' | 'across', pageH: number,
6
+ * name: string, nextId: () => number, warn: (m: string, clip?: boolean) => void, shiftLocal: (items: any[], dy: number) => any[],
7
+ * block?: number }} o block: columns that move together (a pivot's value columns per measure), default 1
8
+ * @returns {{ height: number, units: any[], tables: any[], width: number } | null} null when the columns fit
9
+ */
10
+ export function sliceColumns(o: {
11
+ units: any[];
12
+ height: number;
13
+ headerCount: number;
14
+ headerHeight: number;
15
+ repeatHeader: boolean;
16
+ colX: number[];
17
+ widths: number[];
18
+ x: number;
19
+ repeat: number;
20
+ room: number;
21
+ order: "down" | "across";
22
+ pageH: number;
23
+ name: string;
24
+ nextId: () => number;
25
+ warn: (m: string, clip?: boolean) => void;
26
+ shiftLocal: (items: any[], dy: number) => any[];
27
+ block?: number;
28
+ }): {
29
+ height: number;
30
+ units: any[];
31
+ tables: any[];
32
+ width: number;
33
+ } | null;