@sheetxl/query 0.8.0-beta.10 → 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 +1835 -1177
- package/node/esm/index.mjs +1912 -1242
- package/package.json +3 -3
- package/types/src/api/_aliases.d.ts +16 -0
- package/types/src/api/_offered.d.ts +13 -0
- package/types/src/api/lookupApi.d.ts +9 -1
- 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 +10 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/markdown/appendDependencies.d.ts +2 -2
- package/types/src/markdown/appendSections.d.ts +20 -6
- 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 +2 -2
- package/types/src/markdown/describeExternalCitation.d.ts +27 -0
- package/types/src/markdown/describeHistogram.d.ts +2 -2
- package/types/src/markdown/findLabels.d.ts +5 -12
- package/types/src/markdown/index.d.ts +2 -1
- package/types/src/markdown/registry.d.ts +8 -3
- package/types/src/markdown/renderFormula.d.ts +2 -2
- package/types/src/markdown/renderPageLayout.d.ts +22 -0
- package/types/src/markdown/renderProtection.d.ts +4 -4
- package/types/src/markdown/renderWorkbook.d.ts +1 -1
- package/types/src/markdown/{renderSheet.d.ts → renderWorksheet.d.ts} +5 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/query",
|
|
3
3
|
"description": "SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
4
|
+
"version": "0.8.0-beta.11",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"query"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sheetxl/primitives": "^0.8.0-beta.
|
|
46
|
-
"@sheetxl/sdk": "^0.8.0-beta.
|
|
45
|
+
"@sheetxl/primitives": "^0.8.0-beta.11",
|
|
46
|
+
"@sheetxl/sdk": "^0.8.0-beta.11"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^26.6.4"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names a script reaches for from another spreadsheet API — Excel's, Office Scripts', openpyxl's —
|
|
3
|
+
* and where SheetXL keeps that concept. Each answer names the member it relies on, and is offered
|
|
4
|
+
* only while the index still has it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const API_ALIASES: readonly {
|
|
7
|
+
readonly match: RegExp;
|
|
8
|
+
readonly relies: [string, string];
|
|
9
|
+
readonly hint: string;
|
|
10
|
+
}[];
|
|
11
|
+
/**
|
|
12
|
+
* The answer to a member called on a plain array (`wb.getSheets().getAt(0)`): `getAt`/`getItems`
|
|
13
|
+
* belong to a collection, and an array is indexed.
|
|
14
|
+
*/
|
|
15
|
+
export declare const arrayReceiverHint: (elementType: string) => string;
|
|
16
|
+
//# sourceMappingURL=_aliases.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ScriptingApi } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a declaration is offered. A `@deprecated` or `@hidden` one stays declared so a script that
|
|
4
|
+
* calls it still type-checks, and a lookup of its exact name still answers with its replacement; it
|
|
5
|
+
* is left out of listings, searches and suggestions, so nothing leads a reader to it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isOffered: (declared: {
|
|
8
|
+
readonly deprecated?: true;
|
|
9
|
+
readonly hidden?: true;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
/** The members of `entry` that are {@link isOffered | offered}. */
|
|
12
|
+
export declare const offeredMembers: (entry: ScriptingApi.Entry) => ScriptingApi.Member[];
|
|
13
|
+
//# sourceMappingURL=_offered.d.ts.map
|
|
@@ -66,7 +66,7 @@ export declare namespace ApiLookup {
|
|
|
66
66
|
*
|
|
67
67
|
* @remarks
|
|
68
68
|
* A dotted name is a claim about where something lives, and the claim is what the reader needs
|
|
69
|
-
* corrected: `ISheets.add` wants to hear that the collection is `
|
|
69
|
+
* corrected: `ISheets.add` wants to hear that the collection is `IWorksheetCollection`, and
|
|
70
70
|
* `ICellRange.setStyle` that a range's style is reached through `getStyle()`. A bare search for
|
|
71
71
|
* `add` or `setStyle` lists every type that has one and leaves the claim standing.
|
|
72
72
|
*/
|
|
@@ -144,6 +144,14 @@ export declare function apiTypeOf(index: ScriptingApi.Index, target: unknown): s
|
|
|
144
144
|
* generic or a primitive is not something the index answers for.
|
|
145
145
|
*/
|
|
146
146
|
export declare function apiPointerFor(message: string, command: string): string | null;
|
|
147
|
+
/**
|
|
148
|
+
* A compiler finding without its `Did you mean '…'?` when TypeScript means a member the index does
|
|
149
|
+
* not offer — a deprecated alias is still declared, so the compiler finds it nearest.
|
|
150
|
+
*
|
|
151
|
+
* @param message A compiler finding, e.g. `Property 'setFormat' does not exist on type 'ICellRange'.
|
|
152
|
+
* Did you mean 'getFormat'?`
|
|
153
|
+
*/
|
|
154
|
+
export declare function withoutHiddenSuggestion(index: ScriptingApi.Index, message: string): string;
|
|
147
155
|
/**
|
|
148
156
|
* The members nearest a name the script used and the API does not have — the answer an `api`
|
|
149
157
|
* lookup would be asked for next, inline.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { IRange } from '@sheetxl/primitives';
|
|
2
|
+
import { IWorkbook, IWorksheet } from '@sheetxl/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* What one commit did to a workbook, at region altitude: the structured half of the run delta.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* JSON-safe, so a host can send it as it is; {@link renderDelta} is its markdown. Every address is
|
|
8
|
+
* sheet-qualified and every list is capped, with the uncounted rest in a `more` field.
|
|
9
|
+
*/
|
|
10
|
+
export interface RunDelta {
|
|
11
|
+
/** The commit described. */
|
|
12
|
+
commitId: string;
|
|
13
|
+
/** One entry per sheet whose cells the commit changed. */
|
|
14
|
+
sheets: RunDelta.SheetChange[];
|
|
15
|
+
/** The cells downstream of the written ones, or `null` when nothing reads them. */
|
|
16
|
+
dependents: RunDelta.Dependents | null;
|
|
17
|
+
/** Errors now in the written and dependent cells, by region. */
|
|
18
|
+
errors: RunDelta.ErrorRegion[];
|
|
19
|
+
/** Error regions past {@link RunDelta.errors}. */
|
|
20
|
+
errorsMore: number;
|
|
21
|
+
/** Written cells that held an error before the commit and hold none now. */
|
|
22
|
+
errorsCleared: number;
|
|
23
|
+
/** What is not a cell, over the written or dependent cells. */
|
|
24
|
+
touches: RunDelta.Touches;
|
|
25
|
+
}
|
|
26
|
+
export declare namespace RunDelta {
|
|
27
|
+
/** What a commit did to one sheet. */
|
|
28
|
+
interface SheetChange {
|
|
29
|
+
/** The sheet, quoted as a reference would quote it. */
|
|
30
|
+
sheet: string;
|
|
31
|
+
/** The cells whose values or formulas were written, or `null` when none were. */
|
|
32
|
+
written: string | null;
|
|
33
|
+
/** Cells in {@link written}. */
|
|
34
|
+
cells: number;
|
|
35
|
+
/** Written cells that now hold a formula. */
|
|
36
|
+
formulas: number;
|
|
37
|
+
/** Written cells that now hold a value that is not a formula. */
|
|
38
|
+
values: number;
|
|
39
|
+
/** Written cells that are now empty. */
|
|
40
|
+
cleared: number;
|
|
41
|
+
/**
|
|
42
|
+
* What the write replaced, from the sheet as it was: populated cells and formulas among the
|
|
43
|
+
* written ones. `null` when it cannot be told: the commit moved cells, or the store no longer
|
|
44
|
+
* keeps the state before it.
|
|
45
|
+
*/
|
|
46
|
+
replaced: {
|
|
47
|
+
populated: number;
|
|
48
|
+
formulas: number;
|
|
49
|
+
} | null;
|
|
50
|
+
/** The inserts and deletes of cells, in the order they ran. */
|
|
51
|
+
shifts: Shift[];
|
|
52
|
+
/** Ranges whose formatting changed, or `null`. */
|
|
53
|
+
styles: string | null;
|
|
54
|
+
/** The written formulas, one per block of the same formula. */
|
|
55
|
+
blocks: FormulaBlock[];
|
|
56
|
+
/** Blocks past {@link blocks}. */
|
|
57
|
+
blocksMore: number;
|
|
58
|
+
}
|
|
59
|
+
/** One insert or delete of cells. */
|
|
60
|
+
interface Shift {
|
|
61
|
+
kind: IWorksheet.ShiftKind;
|
|
62
|
+
/** The axis the neighboring cells moved along. */
|
|
63
|
+
axis: IRange.Axis;
|
|
64
|
+
/** The cells inserted or deleted, sheet-qualified; `null` when the state before was not kept. */
|
|
65
|
+
address: string | null;
|
|
66
|
+
/** Whole rows or columns, rather than cells within them. */
|
|
67
|
+
whole: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** One written formula and the results it computed. */
|
|
70
|
+
interface FormulaBlock {
|
|
71
|
+
/** The block, sheet-qualified. */
|
|
72
|
+
address: string;
|
|
73
|
+
/** The formula as its first cell shows it, `=` included. */
|
|
74
|
+
formula: string;
|
|
75
|
+
/** Cells in the block. */
|
|
76
|
+
cells: number;
|
|
77
|
+
/** Results in reading order: all of them for a small block, else the first few and the last. */
|
|
78
|
+
values: string[];
|
|
79
|
+
/** `true` when {@link values} skips some, between its last two entries. */
|
|
80
|
+
sampled: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** The cells downstream of the write. */
|
|
83
|
+
interface Dependents {
|
|
84
|
+
/** Populated dependent cells. */
|
|
85
|
+
cells: number;
|
|
86
|
+
/** The sheets they are on, with their cells. */
|
|
87
|
+
sheets: {
|
|
88
|
+
sheet: string;
|
|
89
|
+
cells: number;
|
|
90
|
+
}[];
|
|
91
|
+
/** Their areas, sheet-qualified. */
|
|
92
|
+
areas: string[];
|
|
93
|
+
/** Areas past {@link areas}. */
|
|
94
|
+
areasMore: number;
|
|
95
|
+
}
|
|
96
|
+
/** A region of one error, with its count. */
|
|
97
|
+
interface ErrorRegion {
|
|
98
|
+
/** Sheet-qualified. */
|
|
99
|
+
address: string;
|
|
100
|
+
/** The error as a cell shows it: `#VALUE!`, `#REF!`, … */
|
|
101
|
+
error: string;
|
|
102
|
+
/** Cells in the region. */
|
|
103
|
+
cells: number;
|
|
104
|
+
}
|
|
105
|
+
/** Objects over the written or dependent cells: listed, never evaluated. */
|
|
106
|
+
interface Touches {
|
|
107
|
+
/** Defined names over the written or dependent cells, or read through by a dependent. */
|
|
108
|
+
names: string[];
|
|
109
|
+
/** Conditional formats over the written or dependent cells, by their anchors. */
|
|
110
|
+
conditionalFormats: string[];
|
|
111
|
+
/** Data validations over the written or dependent cells, by their anchors. */
|
|
112
|
+
dataValidations: string[];
|
|
113
|
+
/** Charts that read the written cells or their dependents. */
|
|
114
|
+
charts: string[];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Options for {@link describeDelta}. */
|
|
118
|
+
export interface DescribeDeltaOptions {
|
|
119
|
+
/**
|
|
120
|
+
* How many entries a list holds before the rest is counted: formula blocks, dependent areas,
|
|
121
|
+
* error regions.
|
|
122
|
+
*
|
|
123
|
+
* @defaultValue 20
|
|
124
|
+
*/
|
|
125
|
+
maxEntries?: number;
|
|
126
|
+
/**
|
|
127
|
+
* How many results a formula block lists in full; a longer block lists its first few and its
|
|
128
|
+
* last.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue 8
|
|
131
|
+
*/
|
|
132
|
+
maxBlockValues?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Describes what a commit did, read from the workbook after its calculation settled.
|
|
136
|
+
*
|
|
137
|
+
* @param workbook The workbook the commit landed on, settled.
|
|
138
|
+
* @param commitId The commit. Omit for the current one.
|
|
139
|
+
* @returns `null` when the commit changed no cells.
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* Nothing here is collected on the write path. The written ranges come from the commit
|
|
143
|
+
* ({@link IWorkbook.getChanges}), what they replaced from the sheet as it was at the commit before
|
|
144
|
+
* ({@link IWorksheet.ChangeEvent.getPreviousRanges}), and everything else is a read of the settled
|
|
145
|
+
* workbook bounded by what was written.
|
|
146
|
+
*/
|
|
147
|
+
export declare function describeDelta(workbook: IWorkbook, commitId?: string, options?: DescribeDeltaOptions): Promise<RunDelta | null>;
|
|
148
|
+
//# sourceMappingURL=describeDelta.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
import { DescribeDeltaOptions, RunDelta } from './describeDelta';
|
|
3
|
+
/** What {@link readRunDelta} hands a run report. */
|
|
4
|
+
export interface RunDeltaReport {
|
|
5
|
+
/** The delta, JSON-safe; absent when the commit changed no cells or it could not be read. */
|
|
6
|
+
delta?: RunDelta;
|
|
7
|
+
/** The report's lines: the delta rendered, or why it could not be read. */
|
|
8
|
+
markdown?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The delta of a run's commit, as a run report carries it: the structure and its lines.
|
|
12
|
+
*
|
|
13
|
+
* @param workbook The workbook the run committed to, settled.
|
|
14
|
+
* @param commitId The run's commit; nothing is read without one (a run that wrote nothing).
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Never throws. The run has already committed, and a delta that cannot be read must not turn a
|
|
18
|
+
* write that landed into a reported failure, so the reason is reported in its place.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readRunDelta(workbook: IWorkbook, commitId: string | undefined, options?: DescribeDeltaOptions): Promise<RunDeltaReport>;
|
|
21
|
+
//# sourceMappingURL=readRunDelta.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RunDelta } from './describeDelta';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a {@link RunDelta} as the lines a run report appends.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* One line per fact, labeled, so a reader scans the labels: what was written and what it
|
|
7
|
+
* replaced, the formulas with their results, what moved, what reads the write, the errors, and
|
|
8
|
+
* what sits over it that is not a cell.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* Changed: Sheet1!H7:H38 — 32 formulas, 0 populated cells replaced
|
|
13
|
+
* Sheet1!H7:H38 =B7*C7 → 12, 15, 18 … 90 (32 cells)
|
|
14
|
+
* Structure: Sheet1!5:7 rows inserted
|
|
15
|
+
* Dependents: 212 cells on 2 sheets — Sheet1!K7:K38, Summary!B4:B9
|
|
16
|
+
* Errors: Sheet1!K9:K12 #VALUE! (4)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderDelta(delta: RunDelta): string;
|
|
20
|
+
//# sourceMappingURL=renderDelta.d.ts.map
|
|
@@ -45,6 +45,16 @@ export declare namespace CellEncoding {
|
|
|
45
45
|
* format's category, and both of those are already reported.
|
|
46
46
|
*/
|
|
47
47
|
readonly Value: "value";
|
|
48
|
+
/**
|
|
49
|
+
* The formula text where the cell has a formula (`=SUM(B2:B9)`), else its stored
|
|
50
|
+
* {@link Mode.Value | value}.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Excel's Show Formulas view: for reading a block's logic as a grid. The inputs read as the
|
|
54
|
+
* scalars the formulas compute with — `0.25`, not `25%`; a date as its serial. The text carries
|
|
55
|
+
* its leading `=`, as the formula bar shows it.
|
|
56
|
+
*/
|
|
57
|
+
readonly Formula: "formula";
|
|
48
58
|
};
|
|
49
59
|
type Mode = typeof Mode[keyof typeof Mode];
|
|
50
60
|
/**
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, ICellRanges, IRange,
|
|
1
|
+
import { ICellRange, ICellRanges, IRange, IWorksheet } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
/**
|
|
4
4
|
* Options for the dependency sections.
|
|
@@ -36,7 +36,7 @@ export interface DependencyContext {
|
|
|
36
36
|
/** Print `## Dependents (0)` rather than omitting the section. */
|
|
37
37
|
zeroDependents?: boolean;
|
|
38
38
|
/** The sheet the report is about; members elsewhere are listed as crossings. */
|
|
39
|
-
home?:
|
|
39
|
+
home?: IWorksheet | null;
|
|
40
40
|
/** The cells the report is about, when it is about cells: charts that plot them are dependents too. */
|
|
41
41
|
subject?: ICellRange | null;
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, IAnchored, ICellRanges, ICellRegion, INamed,
|
|
1
|
+
import { ICellRange, IAnchored, ICellRanges, ICellRegion, INamed, IWorksheet } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
/**
|
|
4
4
|
* Options for the feature sections.
|
|
@@ -92,7 +92,7 @@ export declare const describeExtent: (range: ICellRange) => string;
|
|
|
92
92
|
*/
|
|
93
93
|
export declare const describeSheetName: (name: string | null | undefined) => string;
|
|
94
94
|
/**
|
|
95
|
-
* `wb.
|
|
95
|
+
* `wb.getWorksheet("My Sheet")` — the range's sheet as a callable expression.
|
|
96
96
|
*
|
|
97
97
|
* @remarks
|
|
98
98
|
* Not {@link describeSheetName}: that quotes for the *formula* language (`'My Sheet'!A1`), and a
|
|
@@ -126,6 +126,17 @@ export declare const describeQualifiedExtent: (range: ICellRange) => string;
|
|
|
126
126
|
* Zero kinds are elided, and blanks appear nowhere — empty is not a kind of content.
|
|
127
127
|
*/
|
|
128
128
|
export declare function appendKinds(md: MarkdownBuilder, range: ICellRange): void;
|
|
129
|
+
/**
|
|
130
|
+
* The role census: per role (`ICellRange.Feature.Role`), how many cells and the font colors they
|
|
131
|
+
* are written in — `input 36 · #0000FF 34 · #000000 2`.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* The pairing the `styleRole` check reads, laid out for the reader: the check names a link in
|
|
135
|
+
* the wrong color and says nothing about a typed cell, whose color reads like the data beside it,
|
|
136
|
+
* so the census carries the constants' colors and the reader judges them with the counts in
|
|
137
|
+
* hand. A color is the authored font color (`#RRGGBB`), the Normal style's where none is authored.
|
|
138
|
+
*/
|
|
139
|
+
export declare function appendRoles(md: MarkdownBuilder, range: ICellRange): void;
|
|
129
140
|
/**
|
|
130
141
|
* Appends one section per feature partition, headed by the feature's own name.
|
|
131
142
|
*
|
|
@@ -256,7 +267,7 @@ export declare function appendNames(md: MarkdownBuilder, names: readonly INamed[
|
|
|
256
267
|
* Counts only: the groups themselves (level, span, summary, collapsed) are `IOutline.getGroups`,
|
|
257
268
|
* which is also what a script reads, so the report routes there instead of listing them.
|
|
258
269
|
*/
|
|
259
|
-
export declare function describeOutline(sheet:
|
|
270
|
+
export declare function describeOutline(sheet: IWorksheet): string | null;
|
|
260
271
|
/**
|
|
261
272
|
* One rule listing — `## Conditional Formats (2)` over ` A1:D10 > 100 → fill #FFFF00` rows.
|
|
262
273
|
*
|
|
@@ -273,11 +284,14 @@ export declare function describeOutline(sheet: ISheet): string | null;
|
|
|
273
284
|
*/
|
|
274
285
|
export declare function appendRules<T extends IAnchored>(md: MarkdownBuilder, heading: string, items: readonly T[], describe: (item: T) => string): void;
|
|
275
286
|
/**
|
|
276
|
-
* The defined names whose target region intersects `range`,
|
|
287
|
+
* The defined names whose target region intersects `range`, by name.
|
|
277
288
|
*
|
|
278
289
|
* @remarks
|
|
279
|
-
*
|
|
280
|
-
* sheet's `A1:D4` as
|
|
290
|
+
* Asked of the sheet's collection by address rather than resolved name by name here: the
|
|
291
|
+
* collection scope-checks (a name pointing at `Sheet2!A1:D4` overlaps this sheet's `A1:D4` as
|
|
292
|
+
* coordinates and is a different region entirely), and it resolves what the names designate as
|
|
293
|
+
* ONE step. A legacy file carries thousands of names nothing reads; asked one at a time, each
|
|
294
|
+
* compiled on its own, and a cell report over such a file ran out of memory. Defined names only — a
|
|
281
295
|
* table's name has its own section.
|
|
282
296
|
*
|
|
283
297
|
* @param includeOwned Also admit this sheet's private names that designate no region
|
|
@@ -21,4 +21,8 @@
|
|
|
21
21
|
* that would have to read further to find out.
|
|
22
22
|
*/
|
|
23
23
|
export declare const pageWithLookahead: (total: number, pageSize: number) => number;
|
|
24
|
+
/** `ICellRange.getValues()`'s default `maxSize`: a range over it is too big to copy out in one read. */
|
|
25
|
+
export declare const GET_VALUES_LIMIT = 10000;
|
|
26
|
+
/** The value sample a report prints for a range over {@link GET_VALUES_LIMIT}. */
|
|
27
|
+
export declare const OVERSIZED_SAMPLE_CELLS = 200;
|
|
24
28
|
//# sourceMappingURL=caps.d.ts.map
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IWorksheet, ICellRange, ICellRanges, IChart, IMovable } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
/** The chart a movable holds, or `null` for any other content. */
|
|
4
4
|
export declare const chartOf: (movable: IMovable) => IChart | null;
|
|
@@ -49,7 +49,7 @@ export interface BrokenChartReference {
|
|
|
49
49
|
* A broken series reference is an audit finding exactly like one in a formula — the chart has
|
|
50
50
|
* stopped plotting what its author pointed it at — and no cell carries it, so no cell scan finds it.
|
|
51
51
|
*/
|
|
52
|
-
export declare function collectBrokenChartReferences(sheet:
|
|
52
|
+
export declare function collectBrokenChartReferences(sheet: IWorksheet): BrokenChartReference[];
|
|
53
53
|
/** A chart that plots the subject of a report, or something computed from it. */
|
|
54
54
|
export interface ChartReader {
|
|
55
55
|
movable: IMovable;
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, ICellRegion, IRange,
|
|
1
|
+
import { ICellRange, ICellRegion, IRange, IWorksheet, ICellStyle } from '@sheetxl/sdk';
|
|
2
2
|
/**
|
|
3
3
|
* Per-attribute histograms for the style feature sections.
|
|
4
4
|
*
|
|
@@ -127,7 +127,7 @@ export interface StyleHistogram {
|
|
|
127
127
|
* is only recognizable unclipped: the used-range view cuts `O:Q` to `O1:Q43` and it looks like a
|
|
128
128
|
* block. Cell counts are then taken inside the used range, where finite numbers live.
|
|
129
129
|
*/
|
|
130
|
-
export declare function describeStyleHistogram(sheet:
|
|
130
|
+
export declare function describeStyleHistogram(sheet: IWorksheet, feature: ICellRange.Feature, normal: ICellStyle | null, options?: HistogramLineOptions & {
|
|
131
131
|
/** The sheet's contentful rectangles, when the caller already has them (one partition serves every feature). */
|
|
132
132
|
content?: readonly IRange.Coords[];
|
|
133
133
|
}): StyleHistogram | null;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import { IRange,
|
|
1
|
+
import { IRange, IWorksheet } from '@sheetxl/sdk';
|
|
2
2
|
/** A label and where it was read from. */
|
|
3
3
|
export interface FoundLabel {
|
|
4
4
|
text: string;
|
|
5
5
|
address: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* The text that labels a cell's row (`'row'`) or column (`'column'`)
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Deterministic, and the address is always returned so a reader can judge it:
|
|
12
|
-
*
|
|
13
|
-
* 1. The first cell of the line within the cell's current region (Ctrl+Shift+*), when it is text —
|
|
14
|
-
* the row label at the left edge of the block, the header at its top.
|
|
15
|
-
* 2. Otherwise the nearest text cell before the cell on that line — leftward for a row, upward for
|
|
16
|
-
* a column. Only contentful cells are visited, so the walk costs the populated cells between,
|
|
17
|
-
* not the distance; there is no cap, because a cap is only a different arbitrary answer.
|
|
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.
|
|
18
11
|
*
|
|
19
12
|
* `null` when the cell is itself the first cell of the line or nothing before it is text.
|
|
20
13
|
*/
|
|
21
|
-
export declare function findLabel(sheet:
|
|
14
|
+
export declare function findLabel(sheet: IWorksheet, cell: IRange.CellCoords, axis: 'row' | 'column'): FoundLabel | null;
|
|
22
15
|
/** `"JUN" (G4)` — a label as the reports print it. */
|
|
23
16
|
export declare const describeLabel: (label: FoundLabel | null) => string | null;
|
|
24
17
|
/** 0-based column index to its A1 letter. */
|
|
@@ -16,12 +16,13 @@ export * from './renderFormula';
|
|
|
16
16
|
export * from './renderModules';
|
|
17
17
|
export * from './renderMovable';
|
|
18
18
|
export * from './renderNames';
|
|
19
|
+
export * from './renderPageLayout';
|
|
19
20
|
export * from './renderProtection';
|
|
20
21
|
export * from './renderRecords';
|
|
21
22
|
export * from './renderRanges';
|
|
22
23
|
export * from './renderRegions';
|
|
23
24
|
export * from './renderResult';
|
|
24
|
-
export * from './
|
|
25
|
+
export * from './renderWorksheet';
|
|
25
26
|
export * from './renderStats';
|
|
26
27
|
export * from './renderStyle';
|
|
27
28
|
export * from './renderTable';
|
|
@@ -7,7 +7,7 @@ import { RenderNamesOptions } from './renderNames';
|
|
|
7
7
|
import { RenderRecordsOptions } from './renderRecords';
|
|
8
8
|
import { RenderRangesOptions } from './renderRanges';
|
|
9
9
|
import { RenderRegionsOptions } from './renderRegions';
|
|
10
|
-
import {
|
|
10
|
+
import { RenderWorksheetOptions } from './renderWorksheet';
|
|
11
11
|
import { RenderValuesOptions } from './renderValues';
|
|
12
12
|
/**
|
|
13
13
|
* The renderer registry: one entry per renderable kind.
|
|
@@ -18,7 +18,7 @@ import { RenderValuesOptions } from './renderValues';
|
|
|
18
18
|
* Renderer.Entry.is}. Both paths land on the same entry, so a kind cannot render differently
|
|
19
19
|
* depending on how it was reached.
|
|
20
20
|
*
|
|
21
|
-
* Detection uses the SDK's `isI*` runtime brands (`isIWorkbook`, `
|
|
21
|
+
* Detection uses the SDK's `isI*` runtime brands (`isIWorkbook`, `isIWorksheet`, `isICellRange`,
|
|
22
22
|
* …) — the SDK's own convention for runtime type checking. The registry knows the SDK's
|
|
23
23
|
* interfaces, never its classes, and a brand survives any transport that preserves methods.
|
|
24
24
|
*/
|
|
@@ -32,7 +32,7 @@ export declare namespace Renderer {
|
|
|
32
32
|
* alternative is making the caller name the kind, which is the dispatch the registry exists
|
|
33
33
|
* to remove.
|
|
34
34
|
*/
|
|
35
|
-
type Options = RenderCellRangeOptions &
|
|
35
|
+
type Options = RenderCellRangeOptions & RenderWorksheetOptions & RenderRegionsOptions & RenderValuesOptions & RenderFormulaOptions & RenderRecordsOptions & RenderNamesOptions & RenderRangesOptions & RenderModulesOptions & AppendDependencyOptions;
|
|
36
36
|
/**
|
|
37
37
|
* One renderable kind.
|
|
38
38
|
*/
|
|
@@ -99,6 +99,11 @@ export declare function resolveRenderer(target: unknown): Renderer.Entry | null;
|
|
|
99
99
|
* and it is the whole async surface: the renderers themselves are synchronous, and a caller
|
|
100
100
|
* invoking one directly is responsible for settling first.
|
|
101
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
|
+
*
|
|
102
107
|
* @throws If no registered renderer accepts the object.
|
|
103
108
|
*/
|
|
104
109
|
export declare function renderMarkdown(workbook: IWorkbook | null, target: unknown, options?: Renderer.Options): Promise<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICalculation,
|
|
1
|
+
import { ICalculation, IWorksheet } from '@sheetxl/sdk';
|
|
2
2
|
/**
|
|
3
3
|
* Options for {@link renderFormula}.
|
|
4
4
|
*/
|
|
@@ -20,7 +20,7 @@ export interface RenderFormulaOptions {
|
|
|
20
20
|
* from `getReferences()`, and this option covers the case where it is not: a formula whose
|
|
21
21
|
* references are all names or constants (`=TAX_RATE * 100`) resolves nothing without it.
|
|
22
22
|
*/
|
|
23
|
-
context?:
|
|
23
|
+
context?: IWorksheet;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Renders a formula's *analysis* report: its text, calculation status, behavioral flags, the
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IPageLayout, IWorksheet } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The sheet report's `Print:` line — what differs from Excel's defaults — or `null` when nothing
|
|
4
|
+
* does.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Built from the settings a reader acts on, not from `toJSON()`: a file routinely carries print
|
|
8
|
+
* state nobody chose (the printer's resolution, its opaque settings, the automatic breaks Excel
|
|
9
|
+
* last paginated with), and a sheet whose only print state is that is a default sheet.
|
|
10
|
+
*/
|
|
11
|
+
export declare function describePageLayout(sheet: IWorksheet): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Renders a sheet's print layout — what `getPageLayout()` answers with.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* The page-shaping settings (orientation, paper, scale, margins, print area, titles, breaks) are
|
|
17
|
+
* always listed, marked when they are the default, so the report says how the sheet prints and not
|
|
18
|
+
* only how it differs. The rest is listed only when set: a line per default would bury the few that
|
|
19
|
+
* are not.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderPageLayout(layout: IPageLayout): string;
|
|
22
|
+
//# sourceMappingURL=renderPageLayout.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, ICell, IProtectedRange, IProtection,
|
|
1
|
+
import { ICellRange, ICell, IProtectedRange, IProtection, IWorksheet, IWorksheetProtection, IWorkbookProtection } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
type AnyProtection = IProtection<any, any, any>;
|
|
4
4
|
/**
|
|
@@ -21,7 +21,7 @@ export declare const describeWorkbookProtection: (protection: IWorkbookProtectio
|
|
|
21
21
|
*
|
|
22
22
|
* @returns `null` when the sheet is not protected.
|
|
23
23
|
*/
|
|
24
|
-
export declare function summarizeSheetProtection(sheet:
|
|
24
|
+
export declare function summarizeSheetProtection(sheet: IWorksheet): {
|
|
25
25
|
extent: string;
|
|
26
26
|
detail: string;
|
|
27
27
|
} | null;
|
|
@@ -38,7 +38,7 @@ export declare function summarizeSheetProtection(sheet: ISheet): {
|
|
|
38
38
|
* own: on an unprotected sheet an unlocked cell refuses nothing and says nothing, and on a
|
|
39
39
|
* protected one it is this section's body.
|
|
40
40
|
*/
|
|
41
|
-
export declare function appendSheetProtection(md: MarkdownBuilder, sheet:
|
|
41
|
+
export declare function appendSheetProtection(md: MarkdownBuilder, sheet: IWorksheet): void;
|
|
42
42
|
/**
|
|
43
43
|
* A range report's `Protection:` line — how much of the range a write reaches — or `null` when the
|
|
44
44
|
* sheet is not locked.
|
|
@@ -68,7 +68,7 @@ export declare function protectionPointerFor(error: unknown): string | null;
|
|
|
68
68
|
* `sheet.getRegions("unlock")` on their own. An unprotected object still renders — the caller asked
|
|
69
69
|
* — as the one line that says so, plus the options it keeps for its next lock.
|
|
70
70
|
*/
|
|
71
|
-
export declare function renderProtection(protection:
|
|
71
|
+
export declare function renderProtection(protection: IWorksheetProtection | IWorkbookProtection): string;
|
|
72
72
|
/**
|
|
73
73
|
* Renders one unlocked range — a member of what `sheet.getProtectedRanges()` holds.
|
|
74
74
|
*
|
|
@@ -21,7 +21,7 @@ export interface RenderWorkbookOptions extends Pick<AppendNamesOptions, 'maxName
|
|
|
21
21
|
* regions and distinct formulas say how many ideas the model has, and distinct fonts and formats
|
|
22
22
|
* say whether the styling is a convention. A layer that is empty has no line. The structure
|
|
23
23
|
* behind each line is the sheet report's, and the `content` line carries that sheet's call
|
|
24
|
-
* (`wb.
|
|
24
|
+
* (`wb.getWorksheet("Sales") lists the blocks`): a reader routes by copying an address off the roster,
|
|
25
25
|
* so the call to the fuller report sits on the line the address is read from. **Twins** — sheets
|
|
26
26
|
* whose formula partitions are identical, where the audit is the diff between them — are named on
|
|
27
27
|
* the sheet.
|