@sheetxl/query 0.8.0-beta.1 → 0.8.0-beta.11
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.
- package/browser/esm/index.mjs +4008 -1103
- package/node/esm/index.mjs +4301 -1346
- package/package.json +6 -7
- package/types/src/Tool.d.ts +38 -0
- package/types/src/api/_aliases.d.ts +16 -0
- package/types/src/api/_offered.d.ts +13 -0
- package/types/src/api/apiTool.d.ts +22 -0
- package/types/src/api/index.d.ts +4 -0
- package/types/src/api/lookupApi.d.ts +171 -0
- package/types/src/api/renderApi.d.ts +13 -0
- package/types/src/delta/describeDelta.d.ts +148 -0
- package/types/src/delta/index.d.ts +4 -0
- package/types/src/delta/readRunDelta.d.ts +21 -0
- package/types/src/delta/renderDelta.d.ts +20 -0
- package/types/src/encode/encodeCell.d.ts +19 -7
- package/types/src/grep/GrepTypes.d.ts +88 -42
- package/types/src/grep/grep.d.ts +4 -1
- package/types/src/index.d.ts +10 -0
- package/types/src/markdown/appendDependencies.d.ts +106 -0
- package/types/src/markdown/appendPivotTables.d.ts +22 -0
- package/types/src/markdown/appendSections.d.ts +57 -105
- package/types/src/markdown/caps.d.ts +4 -0
- package/types/src/markdown/describeAnomaly.d.ts +22 -0
- package/types/src/markdown/describeChart.d.ts +72 -0
- package/types/src/markdown/describeExternalCitation.d.ts +27 -0
- package/types/src/markdown/describeHistogram.d.ts +186 -0
- package/types/src/markdown/describeRegionPayload.d.ts +4 -4
- package/types/src/markdown/describeRule.d.ts +5 -5
- package/types/src/markdown/describeShape.d.ts +41 -0
- package/types/src/markdown/describeStyle.d.ts +7 -7
- package/types/src/markdown/findLabels.d.ts +19 -0
- package/types/src/markdown/index.d.ts +6 -1
- package/types/src/markdown/profileRegion.d.ts +56 -1
- package/types/src/markdown/registry.d.ts +18 -4
- package/types/src/markdown/renderCell.d.ts +14 -11
- package/types/src/markdown/renderCellRange.d.ts +3 -2
- package/types/src/markdown/renderFormula.d.ts +2 -2
- package/types/src/markdown/renderModules.d.ts +55 -0
- package/types/src/markdown/renderMovable.d.ts +83 -14
- package/types/src/markdown/renderNames.d.ts +2 -2
- package/types/src/markdown/renderPageLayout.d.ts +22 -0
- package/types/src/markdown/renderProtection.d.ts +81 -0
- package/types/src/markdown/renderRecords.d.ts +8 -0
- package/types/src/markdown/renderRegions.d.ts +1 -0
- package/types/src/markdown/renderStyle.d.ts +2 -2
- package/types/src/markdown/renderTable.d.ts +11 -3
- package/types/src/markdown/renderWorkbook.d.ts +33 -26
- package/types/src/markdown/{renderSheet.d.ts → renderWorksheet.d.ts} +10 -11
- package/browser/cjs/index.cjs +0 -26
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ICell, IRange } from '@sheetxl/sdk';
|
|
2
|
+
/** The reader's name for each check, in the order a report lists them. */
|
|
3
|
+
export declare const ANOMALY_LABELS: ReadonlyMap<string, string>;
|
|
4
|
+
/** `inconsistent formula` — the label, or the check's own name for one without a label. */
|
|
5
|
+
export declare const anomalyLabel: (check: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* One finding as a reader's line, its positions read at `cell`: `inconsistent formula · the cells
|
|
8
|
+
* above and below have =B2*2`.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The evidence holds positions relative to the cell (R1C1), which is what lets a filled row share
|
|
12
|
+
* one finding. Read at the region's anchor they become the addresses a next call takes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function describeAnomaly(anomaly: ICell.Anomaly, cell: ICell): string;
|
|
15
|
+
/** Every finding at `cell`, `;`-joined; `null` when none fires. */
|
|
16
|
+
export declare function describeAnomalies(cell: ICell): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* R1C1 references in `text` as A1, read from `at`: `=R[-1]C*2` at `B3` is `=B2*2`. Absolute
|
|
19
|
+
* parts take a `$`, as Excel writes them.
|
|
20
|
+
*/
|
|
21
|
+
export declare function r1c1ToA1(text: string, at: IRange.CellCoords): string;
|
|
22
|
+
//# sourceMappingURL=describeAnomaly.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { IWorksheet, ICellRange, ICellRanges, IChart, IMovable } from '@sheetxl/sdk';
|
|
2
|
+
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
|
+
/** The chart a movable holds, or `null` for any other content. */
|
|
4
|
+
export declare const chartOf: (movable: IMovable) => IChart | null;
|
|
5
|
+
/**
|
|
6
|
+
* `line · 8 series · values NOI!C4:J111 · categories NOI!B4:B111` — a chart as one listing row's
|
|
7
|
+
* prose, or `null` when nothing about it is known.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* What the chart PLOTS leads, because it is the fact that ties the floating layer to the cells: it
|
|
11
|
+
* says which ranges the author treats as the output, and it is what breaks when the sheet under
|
|
12
|
+
* it is restructured. Series that do not collapse to one block are counted here and listed on the
|
|
13
|
+
* chart's own report.
|
|
14
|
+
*
|
|
15
|
+
* Each range is labeled with its role. `A by B` read as a formula to anyone who did not already
|
|
16
|
+
* know the convention, and `by` is the word the series line uses for orientation (`by column`).
|
|
17
|
+
*/
|
|
18
|
+
export declare function describeChartRow(chart: IChart): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* A chart's facts as `label`/`value` pairs — the lines a `Charts` section indents under its row,
|
|
21
|
+
* the way a `Tables` section does.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* The type is not here: it is the row's own column. Series that do not tile are counted, and
|
|
25
|
+
* listed one by one on the chart's own report.
|
|
26
|
+
*/
|
|
27
|
+
export declare function describeChartDetails(chart: IChart): [label: string, value: string][];
|
|
28
|
+
/** `line`, for the type column of a `Charts` row; `''` where the model has no answer. */
|
|
29
|
+
export declare const describeChartType: (chart: IChart) => string;
|
|
30
|
+
/**
|
|
31
|
+
* The `Type` / `Title` / `Series` / `Axes` facts of a chart's own report.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* `Title: (none)` is printed rather than omitted: that a chart is untitled is information, and a
|
|
35
|
+
* reader asked to tidy a model wants it. An axis with no title says so for the same reason — axis
|
|
36
|
+
* titles are where a chart states its units, often the only place anything does.
|
|
37
|
+
*/
|
|
38
|
+
export declare function appendChartFacts(md: MarkdownBuilder, chart: IChart): void;
|
|
39
|
+
/** A series reference that no longer names cells. */
|
|
40
|
+
export interface BrokenChartReference {
|
|
41
|
+
movable: IMovable;
|
|
42
|
+
/** `series "South" values Data!#REF!` */
|
|
43
|
+
detail: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every series on `sheet` whose name, values or categories reference is `#REF!`.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* A broken series reference is an audit finding exactly like one in a formula — the chart has
|
|
50
|
+
* stopped plotting what its author pointed it at — and no cell carries it, so no cell scan finds it.
|
|
51
|
+
*/
|
|
52
|
+
export declare function collectBrokenChartReferences(sheet: IWorksheet): BrokenChartReference[];
|
|
53
|
+
/** A chart that plots the subject of a report, or something computed from it. */
|
|
54
|
+
export interface ChartReader {
|
|
55
|
+
movable: IMovable;
|
|
56
|
+
/** `true` when a series names the subject's own cells; `false` when it names cells that depend on them. */
|
|
57
|
+
direct: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The charts that read `subject`, or that read what depends on it.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* A chart is a dependent the calculation graph does not hold: it reads cells and is changed by
|
|
64
|
+
* them, and nothing recalculates it. For "what else moves if I write here" it belongs in the same
|
|
65
|
+
* answer, so this is the graph's dependents carried one step further — into the floating layer.
|
|
66
|
+
*
|
|
67
|
+
* @param dependents The subject's full downstream reach, as the graph answers it.
|
|
68
|
+
*/
|
|
69
|
+
export declare function findChartReaders(subject: ICellRange, dependents: ICellRanges | null): ChartReader[];
|
|
70
|
+
/** `Charts!B2:H15 "Chart 1"`, marked when the chart reads the subject only through its dependents. */
|
|
71
|
+
export declare const describeChartReader: (reader: ChartReader) => string;
|
|
72
|
+
//# sourceMappingURL=describeChart.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ICalculation, IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
/** One external citation that resolves to nothing, and why. */
|
|
3
|
+
export interface BrokenExternalCitation {
|
|
4
|
+
/** The scope as the formula spells it: `'[1]ex 1 - ibo'`. */
|
|
5
|
+
scope: string;
|
|
6
|
+
/** `no external link [1] — this workbook has none`. */
|
|
7
|
+
reason: string;
|
|
8
|
+
/** How many references in the formula carry this scope. */
|
|
9
|
+
uses: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The external citations in a formula that resolve to nothing: a `[n]` past the workbook's links,
|
|
13
|
+
* or a sheet its link does not list. Each evaluates to `#REF!`.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Excel stores a reference to a sheet that does not exist as a reference to another workbook, so
|
|
17
|
+
* `'[1]ex 1 - ibo'!F27` is often a misspelled local sheet whose link was later lost (LibreOffice
|
|
18
|
+
* drops every link on save and keeps the `[1]`). The scope's text is the only record of what was
|
|
19
|
+
* meant, so it is quoted back rather than summarized.
|
|
20
|
+
*
|
|
21
|
+
* A citation that binds is never reported. A DDE or OLE slot holds its position without a book, so
|
|
22
|
+
* a `[n]` naming one is not broken either.
|
|
23
|
+
*/
|
|
24
|
+
export declare function findBrokenExternalCitations(tokens: readonly ICalculation.FormulaToken[], workbook: IWorkbook | null | undefined): BrokenExternalCitation[];
|
|
25
|
+
/** `cites '[1]ex 1 - ibo': no external link [1] — this workbook has none`, `; `-joined; `''` when none. */
|
|
26
|
+
export declare function describeBrokenExternalCitations(citations: readonly BrokenExternalCitation[]): string;
|
|
27
|
+
//# sourceMappingURL=describeExternalCitation.d.ts.map
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { ICellRange, ICellRegion, IRange, IWorksheet, ICellStyle } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Per-attribute histograms for the style feature sections.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* A style partition lists blocks; a reader wants **conventions**: which colors mean input, how
|
|
7
|
+
* many fonts there are, whether one cell is formatted differently from its row. A histogram per
|
|
8
|
+
* *attribute* answers that on one line each — `color blue ×216 · white ×18 · #0070C0 ×1 R13` — and
|
|
9
|
+
* degrades to a count when there is no convention to find.
|
|
10
|
+
*
|
|
11
|
+
* Pipeline, per feature: **project** each region's authored style onto one attribute → **coalesce**
|
|
12
|
+
* adjacent rectangles with the same projected value (a region is uniform in the whole feature,
|
|
13
|
+
* so `bold 10pt` and `10pt` are two regions with one family) → **promote** whole-column and
|
|
14
|
+
* whole-row rectangles to their own tiers, the way the file format does, so a column style is
|
|
15
|
+
* named once instead of counted as a million cells → **histogram** the cell tier.
|
|
16
|
+
*
|
|
17
|
+
* Every count is cells, never blocks. Content cells lead — the intersection with the
|
|
18
|
+
* `Contentful` partition — and the styled cells that hold nothing follow in parentheses, so a
|
|
19
|
+
* format over empty cells (`Currency 0dp ×0 (+1 blank) K2`) is stated rather than hidden. A value that lives
|
|
20
|
+
* in one block prints its address whatever its size; a scattered one prints its largest block
|
|
21
|
+
* and how many more.
|
|
22
|
+
*
|
|
23
|
+
* **Only authored differences are histogrammed.** An attribute equal to the workbook's `Normal`
|
|
24
|
+
* style is not a choice anyone made — every cell has *some* family — so it does not appear; the
|
|
25
|
+
* base itself is stated once, on the `normal` line, which is where "Calibri is the base" comes
|
|
26
|
+
* from without any clustering.
|
|
27
|
+
*/
|
|
28
|
+
/** A rectangle in sheet coordinates, closed on both ends. */
|
|
29
|
+
type Rect = Readonly<IRange.Coords>;
|
|
30
|
+
/**
|
|
31
|
+
* Merges adjacent rectangles that share a key into maximal rectangles.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Greedy: a column pass joins horizontal neighbors with equal row extents, a row pass joins
|
|
35
|
+
* vertical neighbors with equal column extents, repeated until nothing merges. Not guaranteed
|
|
36
|
+
* minimal, but the input is already a partition (no overlaps), the count is blocks not cells, and
|
|
37
|
+
* the store's own seams are exactly the horizontal-then-vertical cuts this undoes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function coalesceRects<T extends Rect & {
|
|
40
|
+
key: string;
|
|
41
|
+
}>(rects: readonly T[]): T[];
|
|
42
|
+
/** One value of one attribute: where it is and how much of it there is. */
|
|
43
|
+
export interface HistogramEntry {
|
|
44
|
+
/** Display form of the value. */
|
|
45
|
+
label: string;
|
|
46
|
+
/** Cells carrying the value that also hold content. */
|
|
47
|
+
content: number;
|
|
48
|
+
/** All cells carrying the value (cell tier only — never a whole column). */
|
|
49
|
+
styled: number;
|
|
50
|
+
/** The value's blocks, largest first. */
|
|
51
|
+
blocks: readonly Rect[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Options for {@link describeHistogramLine}.
|
|
55
|
+
*/
|
|
56
|
+
export interface HistogramLineOptions {
|
|
57
|
+
/** Values printed in full before the line degrades to a count. @defaultValue 8 */
|
|
58
|
+
maxValues?: number;
|
|
59
|
+
/** Above this many distinct values the line leads with the count, not the values. @defaultValue 20 */
|
|
60
|
+
manyDistinct?: number;
|
|
61
|
+
/** How to get the rest — appended after `+n more`. */
|
|
62
|
+
recovery?: string;
|
|
63
|
+
/**
|
|
64
|
+
* A label to leave off the line — the attribute's own name, for a boolean attribute whose
|
|
65
|
+
* value IS its name (`bold 87` rather than `bold bold 87`).
|
|
66
|
+
*/
|
|
67
|
+
hideLabel?: string;
|
|
68
|
+
/**
|
|
69
|
+
* How a count reads: `cells` (`blue ×216 (+105 blank)` — content cells, then the styled cells
|
|
70
|
+
* holding nothing) for a style attribute, `times` (`2.5 ×4`) for a value, whose count is
|
|
71
|
+
* occurrences and has no second figure.
|
|
72
|
+
*
|
|
73
|
+
* @defaultValue `'cells'`
|
|
74
|
+
*/
|
|
75
|
+
countStyle?: 'cells' | 'times';
|
|
76
|
+
}
|
|
77
|
+
/** Width of the attribute-name column; every line of a histogram section aligns on it. */
|
|
78
|
+
export declare const HISTOGRAM_LABEL_WIDTH = 10;
|
|
79
|
+
/**
|
|
80
|
+
* One histogram line — the values of one attribute, most common first, degrading to a count.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* The flood rule, stated once for every histogram (style attributes, formulas, values):
|
|
84
|
+
*
|
|
85
|
+
* 1. Up to `maxValues` distinct values print in full, sorted by content cells (then styled).
|
|
86
|
+
* 2. Beyond that, the top half of the budget prints, then the **rarest values that hold
|
|
87
|
+
* content** — a one-off format on a data cell is the finding, and a sort by count alone
|
|
88
|
+
* would bury it — then `+n more` with the call that lists everything.
|
|
89
|
+
* 3. Beyond `manyDistinct`, the line leads with the count and says **no convention** when the
|
|
90
|
+
* most common value does not even cover half the content: a random-color sheet is described
|
|
91
|
+
* by its count, not by a sample of its colors, and it costs one line however many there are.
|
|
92
|
+
*/
|
|
93
|
+
export declare function describeHistogramLine(entries: readonly HistogramEntry[], options?: HistogramLineOptions): string;
|
|
94
|
+
/**
|
|
95
|
+
* `Accounting 1dp` — the dialog category plus its decimals, so ten spellings of one intent read
|
|
96
|
+
* as one value. `General` is the absence of a format and contributes nothing.
|
|
97
|
+
*/
|
|
98
|
+
export declare function describeNumberFormatCategory(code: string | null | undefined): string | null;
|
|
99
|
+
/** Whether a feature gets a histogram. */
|
|
100
|
+
export declare const hasStyleHistogram: (feature: ICellRange.Feature) => boolean;
|
|
101
|
+
/**
|
|
102
|
+
* One feature's histogram: the tier lines and one line per attribute, ready to append.
|
|
103
|
+
*/
|
|
104
|
+
export interface StyleHistogram {
|
|
105
|
+
/** Distinct authored payloads across every region of the feature. */
|
|
106
|
+
distinct: number;
|
|
107
|
+
/**
|
|
108
|
+
* Styled cells in the cell tier, inside the used range — the finite number a heading can
|
|
109
|
+
* carry. The column and row tiers are named on their own lines, never counted.
|
|
110
|
+
*/
|
|
111
|
+
cells: number;
|
|
112
|
+
/** `normal Arial Narrow · 11pt · #000000` — what `Normal` says about this feature; see {@link describeNormal}. */
|
|
113
|
+
normal: string | null;
|
|
114
|
+
/** `sheet` / `columns` / `rows` tier lines, each `label runs payload`. */
|
|
115
|
+
tiers: string[];
|
|
116
|
+
/**
|
|
117
|
+
* `family Open Sans ×355 (+230 blank) B14:M25, +38 blocks · …`, one per attribute with a value —
|
|
118
|
+
* or, for number formats, one row per category (see `describeNumberFormatRows`).
|
|
119
|
+
*/
|
|
120
|
+
attributes: string[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Builds the histogram for a style feature over a whole sheet.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* Reads the sheet's **entire** partition rather than the used range's, because a column style
|
|
127
|
+
* is only recognizable unclipped: the used-range view cuts `O:Q` to `O1:Q43` and it looks like a
|
|
128
|
+
* block. Cell counts are then taken inside the used range, where finite numbers live.
|
|
129
|
+
*/
|
|
130
|
+
export declare function describeStyleHistogram(sheet: IWorksheet, feature: ICellRange.Feature, normal: ICellStyle | null, options?: HistogramLineOptions & {
|
|
131
|
+
/** The sheet's contentful rectangles, when the caller already has them (one partition serves every feature). */
|
|
132
|
+
content?: readonly IRange.Coords[];
|
|
133
|
+
}): StyleHistogram | null;
|
|
134
|
+
/** The formula section's histogram lines. */
|
|
135
|
+
export interface FormulaHistogram {
|
|
136
|
+
/** Distinct formulas by R1C1 text — `=SUM(B5:B7)` and `=SUM(C5:C7)` are one. */
|
|
137
|
+
distinct: number;
|
|
138
|
+
/** `distinct =R[-3]C-R[-1]C ×26 B11:N11, +1 block · …` and `functions SUM ×44 · no function ×52`. */
|
|
139
|
+
lines: string[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Builds the formula section's histograms from its partition.
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* The partition already groups by R1C1 — a region IS one formula filled across cells — so the
|
|
146
|
+
* `distinct` line is the partition re-keyed: the same R1C1 in several regions (a total column
|
|
147
|
+
* split by blank rows) is one value with several blocks. A one-off R1C1 in a row of thirteen is
|
|
148
|
+
* the H26 finding, printed with its address. `functions` counts cells, not regions, so `SUM ×44`
|
|
149
|
+
* is how many cells sum; `no function` is arithmetic-only cells — on a P&L that is most of them.
|
|
150
|
+
*
|
|
151
|
+
* `most complex` is deliberately absent: by function count every formula on a typical model ties
|
|
152
|
+
* at one, and a tie printed as a superlative is a lie. It arrives with the precedents depth.
|
|
153
|
+
*/
|
|
154
|
+
export declare function describeFormulaHistogram(regions: readonly ICellRegion[], options?: HistogramLineOptions): FormulaHistogram | null;
|
|
155
|
+
/**
|
|
156
|
+
* The kind census of `range` — `number 864 · date 108 · text 10` — largest first.
|
|
157
|
+
*
|
|
158
|
+
* @remarks
|
|
159
|
+
* **Disjoint, so the counts sum to the contentful cells.** Every cell is counted under exactly
|
|
160
|
+
* one kind, which is what lets a reader check the census against the heading above it; a census
|
|
161
|
+
* whose lines overlap cannot be told from one that is wrong.
|
|
162
|
+
*
|
|
163
|
+
* A formula cell's value is a number or a string too, so the typed counts alone say `number 313`
|
|
164
|
+
* where 96 of those are computed; the reader wants how much was TYPED (the inputs) against how
|
|
165
|
+
* much is formula (the model). Formula cells are counted once, under `formula`, and their values
|
|
166
|
+
* are subtracted from the typed kinds — read off the formula partition's own stats.
|
|
167
|
+
*
|
|
168
|
+
* `date` is carved out of `number` the same way: a date IS a number, under a date-category format,
|
|
169
|
+
* and a column of them is a time axis — the one fact about a block of numbers that changes how
|
|
170
|
+
* every other column in it is read.
|
|
171
|
+
*/
|
|
172
|
+
export declare function countKinds(range: ICellRange, formulaRegions: readonly ICellRegion[]): [label: string, count: number][];
|
|
173
|
+
/** The census as one row's prose: `number ×217 · formula ×96 · text ×45`, or `null` when empty. */
|
|
174
|
+
export declare function describeKinds(range: ICellRange, formulaRegions: readonly ICellRegion[]): string | null;
|
|
175
|
+
/**
|
|
176
|
+
* What the workbook's `Normal` style says about `feature`, or `null` when it says nothing.
|
|
177
|
+
*
|
|
178
|
+
* @remarks
|
|
179
|
+
* **The style of every cell no section lists.** A font always has one — and the font lines are
|
|
180
|
+
* differences from it, so it is always stated. For the rest `Normal` is nearly always empty, and
|
|
181
|
+
* then there is no line; but a `Normal` that carries a fill or a number format paints every
|
|
182
|
+
* untouched cell in the book, and no region reports it, because nobody authored it on a cell.
|
|
183
|
+
*/
|
|
184
|
+
export declare function describeNormal(feature: ICellRange.Feature, normal: ICellStyle): string | null;
|
|
185
|
+
export {};
|
|
186
|
+
//# sourceMappingURL=describeHistogram.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, ICellRegion,
|
|
1
|
+
import { ICellRange, ICellRegion, ICellStyle } from '@sheetxl/sdk';
|
|
2
2
|
/**
|
|
3
3
|
* Describes one region's payload — the anchor cell's read for the feature that produced it.
|
|
4
4
|
*
|
|
@@ -27,7 +27,7 @@ export interface RegionPayload {
|
|
|
27
27
|
* lie of omission rather than a fact — see the TODOs below. The goal is that every partition
|
|
28
28
|
* says something useful about what it found.
|
|
29
29
|
*/
|
|
30
|
-
export declare function regionPayload(feature: ICellRange.Feature, normal:
|
|
30
|
+
export declare function regionPayload(feature: ICellRange.Feature, normal: ICellStyle | null): RegionPayload | undefined;
|
|
31
31
|
/**
|
|
32
32
|
* One payload describer covering **every** feature a partition was built from.
|
|
33
33
|
*
|
|
@@ -38,9 +38,9 @@ export declare function regionPayload(feature: ICellRange.Feature, normal: IStyl
|
|
|
38
38
|
* payload and they join in the order the caller named them, so the row reads as the tuple the
|
|
39
39
|
* partition actually splits on.
|
|
40
40
|
*
|
|
41
|
-
* Features with nothing to say per region (`AutoTable
|
|
41
|
+
* Features with nothing to say per region (`AutoTable`) contribute nothing rather than
|
|
42
42
|
* an empty column, and a partition where none of them do returns `undefined` so the listing stays
|
|
43
43
|
* addresses-only.
|
|
44
44
|
*/
|
|
45
|
-
export declare function regionPayloads(features: readonly ICellRange.Feature[], normal:
|
|
45
|
+
export declare function regionPayloads(features: readonly ICellRange.Feature[], normal: ICellStyle | null): RegionPayload | undefined;
|
|
46
46
|
//# sourceMappingURL=describeRegionPayload.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICondition, IConditionalFormat, IDataValidation,
|
|
1
|
+
import { ICondition, IConditionalFormat, IDataValidation, ICellStyle } from '@sheetxl/sdk';
|
|
2
2
|
/**
|
|
3
3
|
* The differential style a rule applies — the OOXML `dxf`, as the facets it actually names.
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import { ICondition, IConditionalFormat, IDataValidation, IStyle } from '@sheetx
|
|
|
7
7
|
* property present in it is by construction something the rule author set. Absent facets are not
|
|
8
8
|
* reported — a rule that only fills says `fill #FFFF00` and nothing about the font it leaves alone.
|
|
9
9
|
*/
|
|
10
|
-
export declare const describeRuleStyle: (style:
|
|
10
|
+
export declare const describeRuleStyle: (style: ICellStyle.Properties | null | undefined) => string | null;
|
|
11
11
|
/**
|
|
12
12
|
* A value→visual mapping — `colorScale · min #FFFFFF → max #FF0000`.
|
|
13
13
|
*
|
|
@@ -46,9 +46,9 @@ export declare const describeDataValidation: (validation: IDataValidation) => st
|
|
|
46
46
|
* @remarks
|
|
47
47
|
* **A list validation IS a vocabulary**, and frequently the only place a sheet states one: what
|
|
48
48
|
* `Region` is allowed to contain is exactly what a writer needs before writing, and what a reader
|
|
49
|
-
* needs to recognize `ZZ` as wrong rather than as new. The rule text reports
|
|
50
|
-
* Items`) because a filter dropdown cannot show a hundred values, so a report
|
|
51
|
-
* rule left the vocabulary unreadable.
|
|
49
|
+
* needs to recognize `ZZ` as wrong rather than as new. The rule text reports a picked set as a
|
|
50
|
+
* count (`List 3 Items`) because a filter dropdown cannot show a hundred values, so a report
|
|
51
|
+
* that only carried the rule left the vocabulary unreadable.
|
|
52
52
|
*
|
|
53
53
|
* A list sourced from cells carries its formula instead of its values — that IS the answer, and it
|
|
54
54
|
* is the address to read next.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IShape, IGroup, IMovable, IMovableCollection } from '@sheetxl/sdk';
|
|
2
|
+
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
|
+
/**
|
|
4
|
+
* A shape's text as one quoted row cell.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Quoted, and never paraphrased, so it reads as what it is: content of the workbook, written by
|
|
8
|
+
* whoever could edit the file, not a statement of the report's. Newlines become a visible mark
|
|
9
|
+
* rather than a space because authors break lines on purpose — a callout listing three steps is
|
|
10
|
+
* three lines.
|
|
11
|
+
*
|
|
12
|
+
* @param max The cap, or `null` to print all of it.
|
|
13
|
+
* @param recovery The call that prints the rest; only read when the text is cut.
|
|
14
|
+
*/
|
|
15
|
+
export declare const quoteShapeText: (text: string, max: number | null, recovery: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* The facts of a shape a report states beyond its placement: what it is, what it says, how it is
|
|
18
|
+
* drawn, what it links to and what it is glued to. Each fact only where the shape states it or it
|
|
19
|
+
* is not the default, so a plain rectangle stays a few lines.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Read from the shape's JSON, which is the model: the accessors cover only its type, text and
|
|
23
|
+
* adjust values. A fill or line the shape does not state is named by where it comes from (its
|
|
24
|
+
* theme style) rather than resolved to a color — the theme is the workbook's, and the report says
|
|
25
|
+
* which reference to follow.
|
|
26
|
+
*/
|
|
27
|
+
export declare function appendShapeFacts(md: MarkdownBuilder, shape: IShape): void;
|
|
28
|
+
/** `getContent()` as a group, when it is one. */
|
|
29
|
+
export declare const groupOf: (movable: IMovable) => IGroup | null;
|
|
30
|
+
/**
|
|
31
|
+
* A group's members, in z-order, one line each and indented by depth; a nested group's members
|
|
32
|
+
* beneath it. A picture is named by its file, a shape by its preset, and what is written on a
|
|
33
|
+
* member rides its line.
|
|
34
|
+
*/
|
|
35
|
+
export declare const appendGroupMembers: (md: MarkdownBuilder, members: IMovableCollection, depth: number) => void;
|
|
36
|
+
/**
|
|
37
|
+
* The facts of a group a report states beyond its placement: what it holds, in z-order, and the
|
|
38
|
+
* fill it gives members that take the group's.
|
|
39
|
+
*/
|
|
40
|
+
export declare function appendGroupFacts(md: MarkdownBuilder, group: IGroup): void;
|
|
41
|
+
//# sourceMappingURL=describeShape.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IColor,
|
|
1
|
+
import { IColor, ICellStyle } from '@sheetxl/sdk';
|
|
2
2
|
/**
|
|
3
3
|
* One-line descriptions of a style's authored facets.
|
|
4
4
|
*
|
|
@@ -31,7 +31,7 @@ export declare const describeColor: (color: IColor | null | undefined) => string
|
|
|
31
31
|
* paints for `solid` too. The fill's generic `getColor()` returns the *background*, which is
|
|
32
32
|
* how a yellow cell once reported `pattern #000000 (auto)`.
|
|
33
33
|
*/
|
|
34
|
-
export declare const describeFill: (style:
|
|
34
|
+
export declare const describeFill: (style: ICellStyle) => string | null;
|
|
35
35
|
/**
|
|
36
36
|
* Describes borders — the edges that carry a style, each as `edge style color`.
|
|
37
37
|
*
|
|
@@ -42,7 +42,7 @@ export declare const describeFill: (style: IStyle) => string | null;
|
|
|
42
42
|
* `vertical` are `null` on a cell-scoped style, which is why the region payload reads through
|
|
43
43
|
* `getRange()`.
|
|
44
44
|
*/
|
|
45
|
-
export declare const describeBorder: (style:
|
|
45
|
+
export declare const describeBorder: (style: ICellStyle) => string | null;
|
|
46
46
|
/**
|
|
47
47
|
* The border as a list of parts, identical edges grouped.
|
|
48
48
|
*
|
|
@@ -54,11 +54,11 @@ export declare const describeBorder: (style: IStyle) => string | null;
|
|
|
54
54
|
* genuinely distinct strokes produce distinct parts — which is what makes the multi-line form
|
|
55
55
|
* (one part per line) worth printing.
|
|
56
56
|
*/
|
|
57
|
-
export declare const describeBorderParts: (style:
|
|
57
|
+
export declare const describeBorderParts: (style: ICellStyle) => string[];
|
|
58
58
|
/** Describes a number format — the format string itself is the payload. */
|
|
59
|
-
export declare const describeNumberFormat: (style:
|
|
59
|
+
export declare const describeNumberFormat: (style: ICellStyle) => string | null;
|
|
60
60
|
/** Describes alignment — only the parts that differ from `normal`. */
|
|
61
|
-
export declare const describeAlignment: (style:
|
|
61
|
+
export declare const describeAlignment: (style: ICellStyle, normal: ICellStyle) => string | null;
|
|
62
62
|
/** Describes a font — only the parts that differ from `normal`. */
|
|
63
|
-
export declare const describeFont: (style:
|
|
63
|
+
export declare const describeFont: (style: ICellStyle, normal: ICellStyle) => string | null;
|
|
64
64
|
//# sourceMappingURL=describeStyle.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IRange, IWorksheet } from '@sheetxl/sdk';
|
|
2
|
+
/** A label and where it was read from. */
|
|
3
|
+
export interface FoundLabel {
|
|
4
|
+
text: string;
|
|
5
|
+
address: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The text that labels a cell's row (`'row'`) or column (`'column'`): the first text cell at the
|
|
9
|
+
* line's edge of the cell's current region, else the nearest text before it on that line. The
|
|
10
|
+
* SDK's label model, which the anomaly checks read too.
|
|
11
|
+
*
|
|
12
|
+
* `null` when the cell is itself the first cell of the line or nothing before it is text.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findLabel(sheet: IWorksheet, cell: IRange.CellCoords, axis: 'row' | 'column'): FoundLabel | null;
|
|
15
|
+
/** `"JUN" (G4)` — a label as the reports print it. */
|
|
16
|
+
export declare const describeLabel: (label: FoundLabel | null) => string | null;
|
|
17
|
+
/** 0-based column index to its A1 letter. */
|
|
18
|
+
export declare function columnLetter(index: number): string;
|
|
19
|
+
//# sourceMappingURL=findLabels.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export * from './appendDependencies';
|
|
1
2
|
export * from './appendSections';
|
|
2
3
|
export * from './describeRegionPayload';
|
|
3
4
|
export * from './describeRule';
|
|
5
|
+
export * from './describeShape';
|
|
4
6
|
export * from './describeStyle';
|
|
5
7
|
export * from './MarkdownBuilder';
|
|
6
8
|
export * from './parseRenderOptions';
|
|
@@ -11,13 +13,16 @@ export * from './renderConditionalFormat';
|
|
|
11
13
|
export * from './renderCounts';
|
|
12
14
|
export * from './renderDataValidation';
|
|
13
15
|
export * from './renderFormula';
|
|
16
|
+
export * from './renderModules';
|
|
14
17
|
export * from './renderMovable';
|
|
15
18
|
export * from './renderNames';
|
|
19
|
+
export * from './renderPageLayout';
|
|
20
|
+
export * from './renderProtection';
|
|
16
21
|
export * from './renderRecords';
|
|
17
22
|
export * from './renderRanges';
|
|
18
23
|
export * from './renderRegions';
|
|
19
24
|
export * from './renderResult';
|
|
20
|
-
export * from './
|
|
25
|
+
export * from './renderWorksheet';
|
|
21
26
|
export * from './renderStats';
|
|
22
27
|
export * from './renderStyle';
|
|
23
28
|
export * from './renderTable';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ICellRange, ICellRegion } from '@sheetxl/sdk';
|
|
2
|
+
import { FoundLabel } from './findLabels';
|
|
2
3
|
/**
|
|
3
4
|
* What {@link profileRegion} needs to read — the anchor cell and the extent, nothing a partition
|
|
4
5
|
* knows that a plain range does not.
|
|
@@ -48,6 +49,10 @@ export interface ProfileRegionOptions {
|
|
|
48
49
|
* exactly one, and a block has one per column (or row). This is the same discipline that keeps a
|
|
49
50
|
* range from rendering cell facets — bounded by construction rather than by a limit that has to
|
|
50
51
|
* fire.
|
|
52
|
+
*
|
|
53
|
+
* Data for a caller, never printed: a listing row already carries the size (`1×1`, `110×1`) and
|
|
54
|
+
* the header note, so a shape word beside them is a second vocabulary for the same fact — and
|
|
55
|
+
* `table` has to stay free to mean an authored {@link ITable}.
|
|
51
56
|
*/
|
|
52
57
|
export type RegionShape = 'cell' | 'list' | 'table' | 'block';
|
|
53
58
|
/**
|
|
@@ -58,7 +63,7 @@ export type RegionShape = 'cell' | 'list' | 'table' | 'block';
|
|
|
58
63
|
*/
|
|
59
64
|
export interface RegionProfile {
|
|
60
65
|
shape: RegionShape;
|
|
61
|
-
/** The one-line description that sits beside the address — `
|
|
66
|
+
/** The one-line description that sits beside the address — `header row 1`, or a 1×1's value. */
|
|
62
67
|
summary: string;
|
|
63
68
|
/** One line per column (or row); empty for `cell` and `list`, whose profile is in `summary`. */
|
|
64
69
|
series: string[];
|
|
@@ -88,6 +93,56 @@ export interface RegionProfile {
|
|
|
88
93
|
* elision is explicit, per the same rule that governs every truncated listing here.
|
|
89
94
|
*/
|
|
90
95
|
export declare function profileRegion(region: ProfileSource, options?: ProfileRegionOptions): RegionProfile;
|
|
96
|
+
/** A line the stats leave out, and why. */
|
|
97
|
+
export interface TotalsLine {
|
|
98
|
+
/** Absolute row (or column, on a block profiled by row). */
|
|
99
|
+
index: number;
|
|
100
|
+
label: FoundLabel | null;
|
|
101
|
+
/** Set on the first line only when it was found by value: how it compares with the Σ above it. */
|
|
102
|
+
sums?: TotalsSums;
|
|
103
|
+
}
|
|
104
|
+
/** How a totals line's values compare with the sums of the body above them. */
|
|
105
|
+
export interface TotalsSums {
|
|
106
|
+
matches: number;
|
|
107
|
+
candidates: number;
|
|
108
|
+
/** The line holds no formulas. */
|
|
109
|
+
typed: boolean;
|
|
110
|
+
/** The sums run down columns (the line is a row) rather than across rows. */
|
|
111
|
+
byColumn: boolean;
|
|
112
|
+
/** The cells that do not equal their Σ — `H26 text`, `C26 400 ≠ Σ 411`. */
|
|
113
|
+
misses: string[];
|
|
114
|
+
}
|
|
115
|
+
/** Where a block's body stops. */
|
|
116
|
+
export interface Totals {
|
|
117
|
+
/** The block runs down its rows (`true`) or across its columns. */
|
|
118
|
+
byColumn: boolean;
|
|
119
|
+
/** Absolute index of the first line left out of the body. */
|
|
120
|
+
start: number;
|
|
121
|
+
/** Every line from {@link start} to the block's end. */
|
|
122
|
+
lines: TotalsLine[];
|
|
123
|
+
/** The profile summary's fragment — `rows 26:27 not profiled: …`. */
|
|
124
|
+
note: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Where a block's body stops: the first line whose values equal the Σ of the body above them.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* One deterministic test, the same for a `=SUM` row and a pasted one — a total equals the sum it
|
|
131
|
+
* totals by value, however it was entered. It needs two matches and a majority of the numeric
|
|
132
|
+
* series, so a coincidence in one column does not end a block. A table's totals row is taken as
|
|
133
|
+
* authored.
|
|
134
|
+
*
|
|
135
|
+
* Every line from there to the end of the block is left out of the stats, and each is named with
|
|
136
|
+
* its label so a reader can see what was set aside: the total, and whatever runs on below it
|
|
137
|
+
* (`Earnings Before Interest & Taxes` under `Total Expenses`). Labels are reported, never
|
|
138
|
+
* interpreted — deciding by its wording that a line is "a total" is the call a reader makes better.
|
|
139
|
+
*
|
|
140
|
+
* The first line's comparison is part of the fact: `typed` when it holds no formulas, and the cells
|
|
141
|
+
* that do not match, which on a pasted total are the finding.
|
|
142
|
+
*/
|
|
143
|
+
export declare function detectTotals(range: ICellRange, maxProfileCells?: number): Totals | null;
|
|
144
|
+
/** `= Σ above (13 of 13)` / `typed, = Σ above (12 of 13; H26 text)` / `= Σ to the left (2 of 2)`. */
|
|
145
|
+
export declare function describeSums(sums: TotalsSums): string;
|
|
91
146
|
/**
|
|
92
147
|
* Per-kind stats, pooled across the WHOLE range regardless of column — "what's actually in here,
|
|
93
148
|
* broken down by type" in one shot, as opposed to {@link profileSeries}'s per-column breakdown.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
-
import { AppendDependencyOptions } from './
|
|
2
|
+
import { AppendDependencyOptions } from './appendDependencies';
|
|
3
3
|
import { RenderCellRangeOptions } from './renderCellRange';
|
|
4
4
|
import { RenderFormulaOptions } from './renderFormula';
|
|
5
|
+
import { RenderModulesOptions } from './renderModules';
|
|
5
6
|
import { RenderNamesOptions } from './renderNames';
|
|
6
7
|
import { RenderRecordsOptions } from './renderRecords';
|
|
7
8
|
import { RenderRangesOptions } from './renderRanges';
|
|
8
9
|
import { RenderRegionsOptions } from './renderRegions';
|
|
9
|
-
import {
|
|
10
|
+
import { RenderWorksheetOptions } from './renderWorksheet';
|
|
10
11
|
import { RenderValuesOptions } from './renderValues';
|
|
11
12
|
/**
|
|
12
13
|
* The renderer registry: one entry per renderable kind.
|
|
@@ -17,7 +18,7 @@ import { RenderValuesOptions } from './renderValues';
|
|
|
17
18
|
* Renderer.Entry.is}. Both paths land on the same entry, so a kind cannot render differently
|
|
18
19
|
* depending on how it was reached.
|
|
19
20
|
*
|
|
20
|
-
* Detection uses the SDK's `isI*` runtime brands (`isIWorkbook`, `
|
|
21
|
+
* Detection uses the SDK's `isI*` runtime brands (`isIWorkbook`, `isIWorksheet`, `isICellRange`,
|
|
21
22
|
* …) — the SDK's own convention for runtime type checking. The registry knows the SDK's
|
|
22
23
|
* interfaces, never its classes, and a brand survives any transport that preserves methods.
|
|
23
24
|
*/
|
|
@@ -31,7 +32,7 @@ export declare namespace Renderer {
|
|
|
31
32
|
* alternative is making the caller name the kind, which is the dispatch the registry exists
|
|
32
33
|
* to remove.
|
|
33
34
|
*/
|
|
34
|
-
type Options = RenderCellRangeOptions &
|
|
35
|
+
type Options = RenderCellRangeOptions & RenderWorksheetOptions & RenderRegionsOptions & RenderValuesOptions & RenderFormulaOptions & RenderRecordsOptions & RenderNamesOptions & RenderRangesOptions & RenderModulesOptions & AppendDependencyOptions;
|
|
35
36
|
/**
|
|
36
37
|
* One renderable kind.
|
|
37
38
|
*/
|
|
@@ -54,6 +55,14 @@ export declare namespace Renderer {
|
|
|
54
55
|
* must be read as a table rather than as its first element or as N reports.
|
|
55
56
|
*/
|
|
56
57
|
export declare const RENDERERS: readonly Renderer.Entry[];
|
|
58
|
+
/**
|
|
59
|
+
* The name of every renderable kind, in dispatch order.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* What a host's help text lists. Derived, because a hand-written copy of this list is a second
|
|
63
|
+
* registry that nothing keeps in step with the first.
|
|
64
|
+
*/
|
|
65
|
+
export declare const RENDERABLE_KINDS: readonly string[];
|
|
57
66
|
/**
|
|
58
67
|
* Thrown by {@link renderMarkdown} when nothing in the registry accepts the value.
|
|
59
68
|
*
|
|
@@ -90,6 +99,11 @@ export declare function resolveRenderer(target: unknown): Renderer.Entry | null;
|
|
|
90
99
|
* and it is the whole async surface: the renderers themselves are synchronous, and a caller
|
|
91
100
|
* invoking one directly is responsible for settling first.
|
|
92
101
|
*
|
|
102
|
+
* A render can itself start calculation: a cell's effective style reads a conditional format
|
|
103
|
+
* whose whole-column answer is evaluated only where it is read, and the read asks for it. When a
|
|
104
|
+
* render leaves the engine calculating, it settles again and renders again, so the report carries
|
|
105
|
+
* what the first read asked for.
|
|
106
|
+
*
|
|
93
107
|
* @throws If no registered renderer accepts the object.
|
|
94
108
|
*/
|
|
95
109
|
export declare function renderMarkdown(workbook: IWorkbook | null, target: unknown, options?: Renderer.Options): Promise<string>;
|