@sheetxl/query 0.8.0-beta.1 → 0.8.0-beta.10
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 +3359 -1112
- package/node/esm/index.mjs +3637 -1352
- package/package.json +6 -7
- package/types/src/Tool.d.ts +38 -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 +163 -0
- package/types/src/api/renderApi.d.ts +13 -0
- package/types/src/encode/encodeCell.d.ts +9 -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 +9 -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 +42 -104
- package/types/src/markdown/describeChart.d.ts +72 -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 +26 -0
- package/types/src/markdown/index.d.ts +4 -0
- package/types/src/markdown/profileRegion.d.ts +56 -1
- package/types/src/markdown/registry.d.ts +11 -2
- package/types/src/markdown/renderCell.d.ts +14 -11
- package/types/src/markdown/renderCellRange.d.ts +3 -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/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/renderSheet.d.ts +6 -7
- 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/browser/cjs/index.cjs +0 -26
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ICellRange, ICellRanges, IRange, ISheet } from '@sheetxl/sdk';
|
|
2
|
+
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the dependency sections.
|
|
5
|
+
*/
|
|
6
|
+
export interface AppendDependencyOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Rows each tree prints before the rest of the graph is left to the flat call.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* A line budget, not a depth cut: the tree is filled level by level, so a budget that runs out
|
|
12
|
+
* drops the deepest nodes first, and every node with unshown children says how many.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue 12
|
|
15
|
+
*/
|
|
16
|
+
maxTreeRows?: number;
|
|
17
|
+
}
|
|
18
|
+
/** The calculation-graph surface shared by {@link ICell}, {@link ICellRange} and a defined name. */
|
|
19
|
+
export interface DependencySource {
|
|
20
|
+
getDirectPrecedents(): Promise<ICellRanges | null>;
|
|
21
|
+
getPrecedents(): Promise<ICellRanges | null>;
|
|
22
|
+
getDirectDependents(): Promise<ICellRanges | null>;
|
|
23
|
+
getDependents(): Promise<ICellRanges | null>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* How the caller wants empty sections and sheet crossings reported.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Not a render option — these are facts about the SUBJECT that only the calling report knows. A
|
|
30
|
+
* formula cell with no dependents is an output and `Dependents (0)` says so; a text label with no
|
|
31
|
+
* dependents is just a label, and the same heading would be noise on every one of them.
|
|
32
|
+
*/
|
|
33
|
+
export interface DependencyContext {
|
|
34
|
+
/** Print `## Precedents (0)` rather than omitting the section. */
|
|
35
|
+
zeroPrecedents?: boolean;
|
|
36
|
+
/** Print `## Dependents (0)` rather than omitting the section. */
|
|
37
|
+
zeroDependents?: boolean;
|
|
38
|
+
/** The sheet the report is about; members elsewhere are listed as crossings. */
|
|
39
|
+
home?: ISheet | null;
|
|
40
|
+
/** The cells the report is about, when it is about cells: charts that plot them are dependents too. */
|
|
41
|
+
subject?: ICellRange | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Appends the `Precedents` and `Dependents` sections for anything that exposes the calculation
|
|
45
|
+
* graph — a cell, a range or a name, which answer the same questions with the same shape.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* **The heading carries the reach; the tree beneath shows the path.** The flat reach
|
|
49
|
+
* (`getPrecedents()` / `getDependents()`) is what the engine already holds for recalculation, so
|
|
50
|
+
* its size costs one call: `(239 cells · 216 inputs · depth 6 · 9 areas)`. That is the answer to
|
|
51
|
+
* the common question — how much does this read, how much reads it — without any code. The tree
|
|
52
|
+
* is the explanation, and it is budgeted by rows (see {@link AppendDependencyOptions.maxTreeRows}).
|
|
53
|
+
*
|
|
54
|
+
* `inputs` are the typed (non-formula) cells in the precedent reach — the values a change to the
|
|
55
|
+
* model is actually made in. `outputs` are the dependents nothing else reads — the reported
|
|
56
|
+
* figures a change here ends up in, which is why they are listed by address and row label.
|
|
57
|
+
*
|
|
58
|
+
* `depth` is the longest chain of hops, which is the number of levels the full tree would have.
|
|
59
|
+
* It is the one measure the engine does not hold, so it is a walk, bounded, and stated as a lower
|
|
60
|
+
* bound (`depth ≥ n`) when the bound fires.
|
|
61
|
+
*/
|
|
62
|
+
export declare function appendDependencies(md: MarkdownBuilder, target: DependencySource, options?: AppendDependencyOptions, context?: DependencyContext): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* `row "Net Earnings" col "JUN"` — the labels of a single-cell node that is not itself text.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* `G33 21.7 =+G30-G32` does not say what G33 is; its labels do. Read with {@link findLabel}, so the
|
|
68
|
+
* rule is the cell report's. `origin` is the subject the tree hangs from: a label the node shares
|
|
69
|
+
* with it — the same row, the same column — is left off, since the reader already has it.
|
|
70
|
+
*/
|
|
71
|
+
export declare function describeNodeLabels(range: ICellRange, origin?: Readonly<IRange.Coords> | null): string;
|
|
72
|
+
/**
|
|
73
|
+
* How a graph member LABELS itself: its address, the sheet it lives on, and whether it is a name.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* Shared by the tree and the flat {@link ICellRanges} listing, so the two cannot label the same
|
|
77
|
+
* member differently — the flat list is the tree's rows without the hop structure, and a reader
|
|
78
|
+
* comparing them is comparing the same text.
|
|
79
|
+
*
|
|
80
|
+
* A name member leads with its NAME: its address is only an anchor, and two names authored from
|
|
81
|
+
* the same cell would otherwise print as identical, anonymous cells.
|
|
82
|
+
*
|
|
83
|
+
* The address comes back **unqualified**. A listing standing on one sheet says so once, in its
|
|
84
|
+
* heading; a qualifier goes back on every row only when the collection spans sheets, which is the
|
|
85
|
+
* caller's decision because only the caller has seen every member. A trailing `!` is `#REF!`, not
|
|
86
|
+
* a qualifier, so it is left whole.
|
|
87
|
+
*/
|
|
88
|
+
export declare function describeNodeLabel(range: ICellRange): {
|
|
89
|
+
address: string;
|
|
90
|
+
sheet: string;
|
|
91
|
+
isName: boolean;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* A node's payload: the value for a single cell, the size for a range.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* The whole point of walking as a tree rather than listing addresses — `1,204,880` beside
|
|
98
|
+
* `Model!O30` is what makes the chain readable as a model rather than as a set of coordinates.
|
|
99
|
+
* A formula node shows its expression too, because at that point the node explains itself.
|
|
100
|
+
*
|
|
101
|
+
* Shared with the flat {@link ICellRanges} listing (`renderRanges`) for the same reason
|
|
102
|
+
* {@link describeNodeLabel} is: the flat list is these rows without the hop structure, so the two
|
|
103
|
+
* shapes cannot be allowed to drift into describing one member two ways.
|
|
104
|
+
*/
|
|
105
|
+
export declare function describeNode(range: ICellRange): string;
|
|
106
|
+
//# sourceMappingURL=appendDependencies.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPivotTable } from '@sheetxl/sdk';
|
|
2
|
+
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
|
+
/**
|
|
4
|
+
* Where a pivot table is laid out, as the address its markup declares — or `''`.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Read from {@link IPivotTable.getXML} because the table has no model yet and that markup is the
|
|
8
|
+
* documented way to what it does not expose. The address is as the file wrote it: it does not
|
|
9
|
+
* follow rows and columns inserted since, which is the table's own stated limit and not this
|
|
10
|
+
* report's.
|
|
11
|
+
*/
|
|
12
|
+
export declare const describePivotLocation: (pivot: IPivotTable) => string;
|
|
13
|
+
/**
|
|
14
|
+
* `## Pivot Tables (2)` over ` A3:D20 PivotTable1` rows.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* A pivot table's output is ordinary cells, so `Contentful` already lists the block — as numbers
|
|
18
|
+
* and labels, with nothing to say they are a summary of data held elsewhere and will be
|
|
19
|
+
* overwritten by the next refresh in Excel. This section is what says so.
|
|
20
|
+
*/
|
|
21
|
+
export declare function appendPivotTables(md: MarkdownBuilder, pivots: readonly IPivotTable[]): void;
|
|
22
|
+
//# sourceMappingURL=appendPivotTables.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, IAnchored, ICellRanges, INamed } from '@sheetxl/sdk';
|
|
1
|
+
import { ICellRange, IAnchored, ICellRanges, ICellRegion, INamed, ISheet } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
/**
|
|
4
4
|
* Options for the feature sections.
|
|
@@ -13,7 +13,7 @@ export interface AppendFeatureOptions {
|
|
|
13
13
|
* A **reporting** filter, not a query one. Partitioning by feature is what
|
|
14
14
|
* {@link ICellRange.getRegions} is for and this does not duplicate it — it decides which of
|
|
15
15
|
* those partitions a report bothers to print, which is why it lives on the renderer and not on
|
|
16
|
-
* the range. `--features fill,
|
|
16
|
+
* the range. `--features fill,borders` on a sheet with forty formatted regions is the
|
|
17
17
|
* difference between an answer and a haystack.
|
|
18
18
|
*
|
|
19
19
|
* The scalar kinds are accepted and reach `Counts`; they have no partition to list, so they
|
|
@@ -69,7 +69,7 @@ export interface AppendFeatureOptions {
|
|
|
69
69
|
*/
|
|
70
70
|
export declare const REPORTED_FEATURES: readonly ICellRange.Feature[];
|
|
71
71
|
/**
|
|
72
|
-
* Parses a comma-separated feature list — the `--features fill,
|
|
72
|
+
* Parses a comma-separated feature list — the `--features fill,borders` flag's value.
|
|
73
73
|
*
|
|
74
74
|
* @remarks
|
|
75
75
|
* Matching is case-insensitive against the enum's values, so `Fill`, `fill` and `numberFormat`
|
|
@@ -118,26 +118,12 @@ export declare const describeQualifiedExtent: (range: ICellRange) => string;
|
|
|
118
118
|
* Appends the `Kind` section — what the contentful cells ARE, kind by kind.
|
|
119
119
|
*
|
|
120
120
|
* @remarks
|
|
121
|
-
* The heading carries the contentful count; the
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* numbers".
|
|
121
|
+
* The heading carries the contentful count; the lines are the census, largest first, and they
|
|
122
|
+
* sum to it — see {@link countKinds}, which the workbook's `content` row reads too, so a sheet is
|
|
123
|
+
* described in the same words and the same numbers at both altitudes. Features are not here: each
|
|
124
|
+
* has a partition to list, and carries its cell count on its own section heading.
|
|
126
125
|
*
|
|
127
|
-
*
|
|
128
|
-
* `profileKinds` already read — rather than `getCounts()`: `getCounts([Feature.Number, ...])` is a
|
|
129
|
-
* SECOND, independent value-scan inside the engine (`Sheet._featureCounts`'s own comment says so
|
|
130
|
-
* — "the scalar kinds ... count from values in one pass"), answering the identical question. One
|
|
131
|
-
* scan, one source of truth, and `RichData` is no longer a silent zero — it falls out of the same
|
|
132
|
-
* typed counts for free, where the old `Feature`-keyed list had nowhere to carry it (`Feature` has
|
|
133
|
-
* no `RichData` member).
|
|
134
|
-
*
|
|
135
|
-
* `Date` is the one line still read through a dedicated pass — `countDates`, a value scan via
|
|
136
|
-
* `getInteropType()`. It is not a `ScalarType` at all — it is numeric value ∩ date-category
|
|
137
|
-
* format — and `Feature.DateFormat` alone would overcount (a blank or text cell carrying that
|
|
138
|
-
* format is not a date). A date cell counts as both `Number` and `Date`, so the lines need not
|
|
139
|
-
* sum to the heading. Zero kinds are elided, and blanks appear nowhere — empty is not a kind of
|
|
140
|
-
* content.
|
|
126
|
+
* Zero kinds are elided, and blanks appear nowhere — empty is not a kind of content.
|
|
141
127
|
*/
|
|
142
128
|
export declare function appendKinds(md: MarkdownBuilder, range: ICellRange): void;
|
|
143
129
|
/**
|
|
@@ -161,6 +147,21 @@ export declare function appendKinds(md: MarkdownBuilder, range: ICellRange): voi
|
|
|
161
147
|
* sees which before paying for a drill.
|
|
162
148
|
*/
|
|
163
149
|
export declare function appendRegions(md: MarkdownBuilder, range: ICellRange, options?: AppendFeatureOptions): void;
|
|
150
|
+
/**
|
|
151
|
+
* The blocks of content in `range` — occupancy, cut where an authored table begins and ends.
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* Occupancy alone yields maximal SOLID rectangles, and a table is not one: a title sitting over
|
|
155
|
+
* its first column makes that column run one cell longer than the rest, so the table came back as
|
|
156
|
+
* `C3:J111` plus a `B2:B111` list — two blocks, neither of them the table, at a size the `Tables`
|
|
157
|
+
* section contradicts. A table's edge is a boundary its author drew, so the partition honors it:
|
|
158
|
+
* the table is one block, at its own extent, and the title is a 1×1 above it.
|
|
159
|
+
*
|
|
160
|
+
* Refinement only ever cuts at a table's edge, so a sheet with no tables partitions exactly as
|
|
161
|
+
* occupancy does. A refined partition yields every region carrying EITHER feature, so a blank cell
|
|
162
|
+
* inside a table comes back too; a region is uniform, which makes its anchor the test.
|
|
163
|
+
*/
|
|
164
|
+
export declare const contentfulBlocks: (range: ICellRange) => ICellRegion[];
|
|
164
165
|
/**
|
|
165
166
|
* Options for {@link appendNames}.
|
|
166
167
|
*/
|
|
@@ -246,91 +247,16 @@ export declare const describeQualifiedName: (named: INamed) => string;
|
|
|
246
247
|
* `Hidden` and `Comment` appear only when some row has one — per block. `false` on every visible
|
|
247
248
|
* row is token noise, and blank-means-normal is how these reports already speak.
|
|
248
249
|
*/
|
|
249
|
-
export declare function appendNames(md: MarkdownBuilder, names: readonly INamed[], options?: AppendNamesOptions): void
|
|
250
|
-
/**
|
|
251
|
-
* Options for the dependency trees.
|
|
252
|
-
*/
|
|
253
|
-
export interface AppendDependencyOptions {
|
|
254
|
-
/**
|
|
255
|
-
* How many hops from the subject to walk.
|
|
256
|
-
*
|
|
257
|
-
* @defaultValue 3
|
|
258
|
-
*/
|
|
259
|
-
maxDepth?: number;
|
|
260
|
-
/**
|
|
261
|
-
* Cap on nodes per tree; the tree notes truncation when exceeded.
|
|
262
|
-
*
|
|
263
|
-
* @defaultValue 50
|
|
264
|
-
*/
|
|
265
|
-
maxNodes?: number;
|
|
266
|
-
}
|
|
267
|
-
/** The calculation-graph surface shared by {@link ICell} and {@link ICellRange}. */
|
|
268
|
-
export interface DependencySource {
|
|
269
|
-
getDirectPrecedents(): ICellRanges | null;
|
|
270
|
-
getPrecedents(): ICellRanges | null;
|
|
271
|
-
getDirectDependents(): ICellRanges | null;
|
|
272
|
-
getDependents(): ICellRanges | null;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Appends the `Precedents` and `Dependents` trees for anything that exposes the calculation
|
|
276
|
-
* graph — a cell or a range, which answer the same questions with the same shape.
|
|
277
|
-
*
|
|
278
|
-
* @remarks
|
|
279
|
-
* **A tree, walked one hop at a time, rather than a `direct`/`all` pair.** The flat form gives
|
|
280
|
-
* the two ends of the chain and throws away everything between them: `D6` reading `B2:D4`
|
|
281
|
-
* "eventually" does not say whether that is one indirection or nine, and the shape is the thing a
|
|
282
|
-
* reader is actually trying to see. Repeated `getDirect*` calls cost the same as one `getAll*`
|
|
283
|
-
* — the graph is indexed either way — so the tree is strictly more answer for the same work.
|
|
284
|
-
*
|
|
285
|
-
* Each node carries its **payload at the right altitude**: a single cell shows its value, a
|
|
286
|
-
* multi-cell range shows its size. A range node is not expanded into cells; that is the same
|
|
287
|
-
* expansion the region rules exist to prevent.
|
|
288
|
-
*
|
|
289
|
-
* Bounded three ways, each stated in the output rather than applied silently — depth, node count,
|
|
290
|
-
* and revisits.
|
|
291
|
-
*
|
|
292
|
-
* **The two kinds of revisit get different marks, and that distinction is the point.** A node
|
|
293
|
-
* reached twice by different branches is a re-convergence: completely normal in any model, and
|
|
294
|
-
* marked `↑ shown above`. A node reached again while it is still on the current path is a
|
|
295
|
-
* genuine cycle — a defect, or a deliberate iterative calculation — and is marked `↺ circular`.
|
|
296
|
-
* One glyph for both would bury the second inside a busy tree, and it is the one finding here
|
|
297
|
-
* that cannot afford to be missed.
|
|
298
|
-
*/
|
|
299
|
-
export declare function appendDependencies(md: MarkdownBuilder, target: DependencySource, options?: AppendDependencyOptions): void;
|
|
250
|
+
export declare function appendNames(md: MarkdownBuilder, names: readonly INamed[], options?: AppendNamesOptions): Promise<void>;
|
|
300
251
|
/**
|
|
301
|
-
*
|
|
252
|
+
* The outline in a line — `rows 2 levels, 3 groups (1 collapsed) · columns 1 level, 1 group` —
|
|
253
|
+
* or `null` when nothing is grouped.
|
|
302
254
|
*
|
|
303
255
|
* @remarks
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* comparing them is comparing the same text.
|
|
307
|
-
*
|
|
308
|
-
* A name member leads with its NAME: its address is only an anchor, and two names authored from
|
|
309
|
-
* the same cell would otherwise print as identical, anonymous cells.
|
|
310
|
-
*
|
|
311
|
-
* The address comes back **unqualified**. A listing standing on one sheet says so once, in its
|
|
312
|
-
* heading; a qualifier goes back on every row only when the collection spans sheets, which is the
|
|
313
|
-
* caller's decision because only the caller has seen every member. A trailing `!` is `#REF!`, not
|
|
314
|
-
* a qualifier, so it is left whole.
|
|
256
|
+
* Counts only: the groups themselves (level, span, summary, collapsed) are `IOutline.getGroups`,
|
|
257
|
+
* which is also what a script reads, so the report routes there instead of listing them.
|
|
315
258
|
*/
|
|
316
|
-
export declare function
|
|
317
|
-
address: string;
|
|
318
|
-
sheet: string;
|
|
319
|
-
isName: boolean;
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* A node's payload: the value for a single cell, the size for a range.
|
|
323
|
-
*
|
|
324
|
-
* @remarks
|
|
325
|
-
* The whole point of walking as a tree rather than listing addresses — `1,204,880` beside
|
|
326
|
-
* `Model!O30` is what makes the chain readable as a model rather than as a set of coordinates.
|
|
327
|
-
* A formula node shows its expression too, because at that point the node explains itself.
|
|
328
|
-
*
|
|
329
|
-
* Shared with the flat {@link ICellRanges} listing (`renderRanges`) for the same reason
|
|
330
|
-
* {@link describeNodeLabel} is: the flat list is these rows without the hop structure, so the two
|
|
331
|
-
* shapes cannot be allowed to drift into describing one member two ways.
|
|
332
|
-
*/
|
|
333
|
-
export declare function describeNode(range: ICellRange): string;
|
|
259
|
+
export declare function describeOutline(sheet: ISheet): string | null;
|
|
334
260
|
/**
|
|
335
261
|
* One rule listing — `## Conditional Formats (2)` over ` A1:D10 > 100 → fill #FFFF00` rows.
|
|
336
262
|
*
|
|
@@ -346,6 +272,18 @@ export declare function describeNode(range: ICellRange): string;
|
|
|
346
272
|
* listing would hide the very relationship `stop if true` is read against.
|
|
347
273
|
*/
|
|
348
274
|
export declare function appendRules<T extends IAnchored>(md: MarkdownBuilder, heading: string, items: readonly T[], describe: (item: T) => string): void;
|
|
275
|
+
/**
|
|
276
|
+
* The defined names whose target region intersects `range`, in collection order.
|
|
277
|
+
*
|
|
278
|
+
* @remarks
|
|
279
|
+
* Scope-checked, not merely rectangle-checked: a name pointing at `Sheet2!A1:D4` overlaps this
|
|
280
|
+
* sheet's `A1:D4` as coordinates and is a different region entirely. Defined names only — a
|
|
281
|
+
* table's name has its own section.
|
|
282
|
+
*
|
|
283
|
+
* @param includeOwned Also admit this sheet's private names that designate no region
|
|
284
|
+
* (`TaxRate = 0.21`), which have nothing to intersect and belong to the sheet by ownership.
|
|
285
|
+
*/
|
|
286
|
+
export declare function findNames(range: ICellRange, includeOwned?: boolean): INamed[];
|
|
349
287
|
/**
|
|
350
288
|
* Appends the sheet-level objects that intersect `range`: named ranges, hidden headers, tables,
|
|
351
289
|
* conditional formats and data validations.
|
|
@@ -360,5 +298,5 @@ export declare function appendRules<T extends IAnchored>(md: MarkdownBuilder, he
|
|
|
360
298
|
* token cost on the common path, and it buries the sections that do carry something. Absence is
|
|
361
299
|
* already how these reports say "not here".
|
|
362
300
|
*/
|
|
363
|
-
export declare function appendSheetObjects(md: MarkdownBuilder, range: ICellRange): void
|
|
301
|
+
export declare function appendSheetObjects(md: MarkdownBuilder, range: ICellRange): Promise<void>;
|
|
364
302
|
//# sourceMappingURL=appendSections.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ISheet, 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: ISheet): 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,186 @@
|
|
|
1
|
+
import { ICellRange, ICellRegion, IRange, ISheet, 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: ISheet, 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.
|