@sheetxl/query 0.7.28-beta.4 → 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.
Files changed (38) hide show
  1. package/browser/esm/index.mjs +3359 -1112
  2. package/node/esm/index.mjs +3637 -1352
  3. package/package.json +6 -7
  4. package/types/src/Tool.d.ts +38 -0
  5. package/types/src/api/apiTool.d.ts +22 -0
  6. package/types/src/api/index.d.ts +4 -0
  7. package/types/src/api/lookupApi.d.ts +163 -0
  8. package/types/src/api/renderApi.d.ts +13 -0
  9. package/types/src/encode/encodeCell.d.ts +9 -7
  10. package/types/src/grep/GrepTypes.d.ts +88 -42
  11. package/types/src/grep/grep.d.ts +4 -1
  12. package/types/src/index.d.ts +9 -0
  13. package/types/src/markdown/appendDependencies.d.ts +106 -0
  14. package/types/src/markdown/appendPivotTables.d.ts +22 -0
  15. package/types/src/markdown/appendSections.d.ts +42 -104
  16. package/types/src/markdown/describeChart.d.ts +72 -0
  17. package/types/src/markdown/describeHistogram.d.ts +186 -0
  18. package/types/src/markdown/describeRegionPayload.d.ts +4 -4
  19. package/types/src/markdown/describeRule.d.ts +5 -5
  20. package/types/src/markdown/describeShape.d.ts +41 -0
  21. package/types/src/markdown/describeStyle.d.ts +7 -7
  22. package/types/src/markdown/findLabels.d.ts +26 -0
  23. package/types/src/markdown/index.d.ts +4 -0
  24. package/types/src/markdown/profileRegion.d.ts +56 -1
  25. package/types/src/markdown/registry.d.ts +11 -2
  26. package/types/src/markdown/renderCell.d.ts +14 -11
  27. package/types/src/markdown/renderCellRange.d.ts +3 -2
  28. package/types/src/markdown/renderModules.d.ts +55 -0
  29. package/types/src/markdown/renderMovable.d.ts +83 -14
  30. package/types/src/markdown/renderNames.d.ts +2 -2
  31. package/types/src/markdown/renderProtection.d.ts +81 -0
  32. package/types/src/markdown/renderRecords.d.ts +8 -0
  33. package/types/src/markdown/renderRegions.d.ts +1 -0
  34. package/types/src/markdown/renderSheet.d.ts +6 -7
  35. package/types/src/markdown/renderStyle.d.ts +2 -2
  36. package/types/src/markdown/renderTable.d.ts +11 -3
  37. package/types/src/markdown/renderWorkbook.d.ts +33 -26
  38. package/browser/cjs/index.cjs +0 -26
@@ -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, IStyle } from '@sheetxl/sdk';
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: IStyle) => string | null;
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: IStyle) => string | null;
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: IStyle) => string[];
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: IStyle) => string | null;
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: IStyle, normal: IStyle) => string | null;
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: IStyle, normal: IStyle) => string | null;
63
+ export declare const describeFont: (style: ICellStyle, normal: ICellStyle) => string | null;
64
64
  //# sourceMappingURL=describeStyle.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { IRange, ISheet } 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'`).
9
+ *
10
+ * @remarks
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.
18
+ *
19
+ * `null` when the cell is itself the first cell of the line or nothing before it is text.
20
+ */
21
+ export declare function findLabel(sheet: ISheet, cell: IRange.CellCoords, axis: 'row' | 'column'): FoundLabel | null;
22
+ /** `"JUN" (G4)` — a label as the reports print it. */
23
+ export declare const describeLabel: (label: FoundLabel | null) => string | null;
24
+ /** 0-based column index to its A1 letter. */
25
+ export declare function columnLetter(index: number): string;
26
+ //# 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,8 +13,10 @@ 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 './renderProtection';
16
20
  export * from './renderRecords';
17
21
  export * from './renderRanges';
18
22
  export * from './renderRegions';
@@ -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 — `table · header row 1`. */
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,7 +1,8 @@
1
1
  import { IWorkbook } from '@sheetxl/sdk';
2
- import { AppendDependencyOptions } from './appendSections';
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';
@@ -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 & RenderSheetOptions & RenderRegionsOptions & RenderValuesOptions & RenderFormulaOptions & RenderRecordsOptions & RenderNamesOptions & RenderRangesOptions & AppendDependencyOptions;
35
+ type Options = RenderCellRangeOptions & RenderSheetOptions & 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
  *
@@ -1,23 +1,26 @@
1
1
  import { ICell } from '@sheetxl/sdk';
2
- import { AppendDependencyOptions } from './appendSections';
2
+ import { AppendDependencyOptions } from './appendDependencies';
3
3
  /**
4
- * Renders a cell's report: value, formula, spans, spill, the effective style, and its position in
5
- * the dependency graph.
4
+ * Renders a cell's report: value, formula, the block it sits in, whether it agrees with its
5
+ * siblings, its reach through the dependency graph, and the effective style.
6
6
  *
7
7
  * @remarks
8
+ * A cell is usually arrived at cold — a chat mention, a grep hit, a node in someone else's tree —
9
+ * so the report orients before it details: which block this is and what its labels say, whether
10
+ * this formula is the same as the ones beside it, and how much of the model it reads and feeds.
11
+ * Each of those is an index read, not a scan.
12
+ *
8
13
  * A cell is the one altitude where **resolved effect** belongs. A range reports style as authored
9
14
  * layers and never composes them, because composition is an expansion — a banded table is one
10
15
  * authored fact and an unbounded number of effective ranges. For a single cell the expansion is
11
16
  * one row, and "what does a human actually see here" is the question being asked, so `getStyle()`
12
- * is read rendered rather than direct.
13
- *
14
- * The dependency graph, by contrast, is NOT cell-only. It is indexed by range, so a range
15
- * answers the same four questions in one call and {@link renderCellRange} reports them too — the
16
- * cell form is that one over a 1×1.
17
+ * is read rendered rather than direct, and the line says so.
17
18
  *
18
19
  * Facets that are not present are omitted rather than reported as absent — merge spans on an
19
- * unmerged cell, a spill range on a cell that is not spilled. Value text goes through
20
- * {@link encodeCell}, so whatever this prints, grep can find.
20
+ * unmerged cell, a spill range on a cell that is not spilled. Zeros that ARE facts are printed:
21
+ * a formula nothing reads is an output, and `Dependents (0)` is how the report says it. Value text
22
+ * goes through {@link encodeCell}, so whatever this prints, grep can find: `Display` is grep's
23
+ * `display` field and `Value` — the stored scalar, what `getValue()` returns — is its `value` field.
21
24
  */
22
- export declare function renderCell(cell: ICell, options?: AppendDependencyOptions): string;
25
+ export declare function renderCell(cell: ICell, options?: AppendDependencyOptions): Promise<string>;
23
26
  //# sourceMappingURL=renderCell.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { ICellRange } from '@sheetxl/sdk';
2
2
  import { CellEncoding } from '../encode';
3
- import { AppendDependencyOptions, AppendFeatureOptions } from './appendSections';
3
+ import { AppendDependencyOptions } from './appendDependencies';
4
+ import { AppendFeatureOptions } from './appendSections';
4
5
  import { ProfileRegionOptions } from './profileRegion';
5
6
  /**
6
7
  * Options for {@link renderCellRange}.
@@ -57,5 +58,5 @@ export interface RenderCellRangeOptions extends AppendFeatureOptions, AppendDepe
57
58
  *
58
59
  * Cell text goes through {@link encodeCell}, so whatever a report prints, grep can find.
59
60
  */
60
- export declare function renderCellRange(range: ICellRange, options?: RenderCellRangeOptions): string;
61
+ export declare function renderCellRange(range: ICellRange, options?: RenderCellRangeOptions): Promise<string>;
61
62
  //# sourceMappingURL=renderCellRange.d.ts.map
@@ -0,0 +1,55 @@
1
+ import { IModule, IModuleCollection, IWorkbook } from '@sheetxl/sdk';
2
+ import { MarkdownBuilder } from './MarkdownBuilder';
3
+ /**
4
+ * Options for {@link renderModules} and {@link renderModule}.
5
+ */
6
+ export interface RenderModulesOptions {
7
+ /** Maximum modules listed before the tail is reported as a count. */
8
+ maxModules?: number;
9
+ /** Maximum source lines shown per module in the full listing. */
10
+ maxSourceLines?: number;
11
+ }
12
+ /**
13
+ * Every module in the workbook, its own and its sheets', in one list.
14
+ *
15
+ * @remarks
16
+ * Both levels, because "does this workbook contain code" is one question and a reader who has to
17
+ * ask it per sheet will not ask it at all. Unfiltered by language — the default TypeScript filter
18
+ * exists to protect callers that only want runnable scripts, and this report exists precisely to
19
+ * say what is there.
20
+ */
21
+ export declare function collectModules(workbook: IWorkbook): IModule[];
22
+ /**
23
+ * Appends the code announcement — what has code, what runs itself, and what SheetXL will not run.
24
+ *
25
+ * @remarks
26
+ * **Names the modules that have source, and only those.** Excel writes an empty `ThisWorkbook`
27
+ * and an empty document module per sheet whether or not anyone wrote a line in them, so listing
28
+ * every module reports scaffolding as content — a five-row table for one macro, in which the
29
+ * reader has to work out which row matters. The heading still counts the whole collection, so
30
+ * nothing is hidden; the rows are the part worth reading, and `getModules()` reaches the rest.
31
+ *
32
+ * Nothing is printed for a workbook with no modules at all. Absence of code is the norm and does
33
+ * not need a section saying so.
34
+ */
35
+ export declare function appendModules(md: MarkdownBuilder, modules: readonly IModule[], options?: RenderModulesOptions): void;
36
+ /**
37
+ * Renders one module — its facts, then its source.
38
+ *
39
+ * @remarks
40
+ * The report that answers "what does this code do", which is why it prints the body rather than
41
+ * measuring it.
42
+ */
43
+ export declare function renderModule(module: IModule, options?: RenderModulesOptions): string;
44
+ /**
45
+ * Renders a module collection — the roster, then each module's source.
46
+ *
47
+ * @remarks
48
+ * **What it holds is decided by where the collection came from**, the same rule
49
+ * `renderNames` follows: `wb.getScripts().getModules()` is the workbook's own modules,
50
+ * `sheet.getModules()` is that sheet's. Neither is filtered here — a caller who reached this
51
+ * report asked to see what exists, so `language` is left wide open rather than defaulting to
52
+ * TypeScript the way an ordinary `getItems()` does.
53
+ */
54
+ export declare function renderModules(modules: IModuleCollection, options?: RenderModulesOptions): string;
55
+ //# sourceMappingURL=renderModules.d.ts.map
@@ -1,35 +1,104 @@
1
- import { IMovable } from '@sheetxl/sdk';
1
+ import { IMovable, IShape } from '@sheetxl/sdk';
2
2
  import { MarkdownBuilder } from './MarkdownBuilder';
3
+ /** A shape with something written on it, the text already read. */
4
+ export interface ShapeTextEntry {
5
+ movable: IMovable;
6
+ text: string;
7
+ }
8
+ /** The anchor as a plain A1 address — `toString()` may carry the sheet, and these rows decide that themselves. */
9
+ export declare const describeAnchor: (movable: IMovable) => string;
10
+ /** A shape's text as a listing prints it: quoted, capped, the recovery named where it was cut. */
11
+ export declare const describeShapeText: ({ movable, text }: ShapeTextEntry) => string;
12
+ /** The text written on a shape — `''` for a bare one — or `null` for content that is not a shape. */
13
+ export declare const readShapeText: (movable: IMovable) => string | null;
3
14
  /**
4
- * `## Movables (3)` over ` C3:F12 chart Chart 1 — column` rows — the pictures, charts, shapes
5
- * and slicers floating over the report's range.
15
+ * The shapes among `movables` that have something written on them, in reading order.
16
+ *
17
+ * @remarks
18
+ * **Only non-empty text.** On a shape with an empty body "no text" is itself the information: a
19
+ * bare rectangle is a box drawn around the cells under it.
20
+ *
21
+ * **Reading order, not z-order**: by the anchor's top-left, row-major. Z-order is the order the
22
+ * author happened to draw them in; callouts are written to be read down the sheet.
23
+ *
24
+ * Hidden shapes are included. Hidden text is exactly what a reviewer wants surfaced, and the row
25
+ * marks it so the reader knows a human looking at the grid does not see it.
26
+ */
27
+ export declare function collectShapeText(movables: readonly IMovable[]): ShapeTextEntry[];
28
+ /**
29
+ * One movable as one line of prose: `Picture 1 — logo.png`, or for a chart
30
+ * `line · 8 series · values NOI!C4:J111 · categories NOI!B4:B111 · Chart 2`.
31
+ *
32
+ * @remarks
33
+ * Name first because it is what the object is called everywhere else — the OOXML `cNvPr/@name`,
34
+ * the UI's selection pane — and because for a slicer or a shape it is the ONLY description
35
+ * anything can offer. A chart is the exception and its name goes last: `Chart 2` says nothing, and
36
+ * what the chart plots is the one fact on the row that points back at cells.
37
+ *
38
+ * The alt text joins it when set. It is prose a human wrote about a graphic a text report cannot
39
+ * show, so here it is not decoration: for a chart or a smart-art frame it is frequently the only
40
+ * sentence in the whole file that says what the graphic shows.
41
+ */
42
+ export declare const describeMovableSummary: (movable: IMovable) => string;
43
+ /** `Charts` for `chart` — a type the table does not know still gets a section, named after itself. */
44
+ export declare const describeTypeHeading: (type: string) => string;
45
+ /**
46
+ * `movables` by content type, in section order: the known types as {@link TYPE_HEADINGS} lists
47
+ * them, then any other in the order it first appears. Z-order is kept within a type.
48
+ *
49
+ * A note's box is left out: the note is reported with the comments, and its box says nothing more.
50
+ */
51
+ export declare function groupMovables(movables: readonly IMovable[]): Map<string, IMovable[]>;
52
+ /**
53
+ * One section per content type — `## Charts (1)`, `## Shapes (11 · 4 with text)` — over the
54
+ * pictures, charts, shapes and slicers floating over the report's range.
6
55
  *
7
56
  * @remarks
8
57
  * **The one class of sheet content that appears in no other section.** Everything else these
9
58
  * reports describe lives in cells and is reachable by address; a movable floats over the grid and
10
- * is invisible to every values, region and rule listing — so without this section a report about
11
- * a dashboard sheet says the sheet is nearly empty, which is true of its cells and false of what
59
+ * is invisible to every values, region and rule listing — so without these a report about a
60
+ * dashboard sheet says the sheet is nearly empty, which is true of its cells and false of what
12
61
  * anyone looking at it sees.
13
62
  *
14
- * Rows are `anchor · type · prose`, and both leading columns are arguments rather than labels: the
15
- * address is what `getRange()` takes, and the type is exactly what `getMovables({ type })` filters
16
- * on — the filter compares this same string.
63
+ * **A section per type, the way tables have one.** A reader looks for charts, or for the notes an
64
+ * author left; nobody looks for "movables", which is the SDK's word for how these are stored. The
65
+ * heading is the type, so no row spends a column repeating it.
66
+ *
67
+ * Rows are `anchor · preset · prose · "text"`. The anchor is what `getRange()` takes and says which
68
+ * cells the object is about; the preset says what kind of shape it is — a callout points at
69
+ * something, a text box stands alone. A chart's type takes the preset's column, and what it plots
70
+ * is labeled lines beneath its row, the way a table's facts are: a chart states three ranges, and
71
+ * on one line nothing says which is which.
17
72
  *
18
- * Listed in z-order, which is the order the collection returns them in and the order they paint,
19
- * so where two movables overlap the later row is the one on top. Hidden movables are listed and
20
- * marked; they are the ones a reader cannot otherwise learn about.
73
+ * **What is written on a shape rides its row, and those rows lead** — in reading order, ahead of
74
+ * the rest in z-order. Text on a shape is almost never decoration: it is a note from the author to
75
+ * the reader — what a block means, which cell to change, what not to touch — and the heading
76
+ * counts them so a reader knows to look. Leading also makes the cap safe: what it eats is bare
77
+ * rectangles. Hidden movables are listed and marked; they are the ones a reader cannot otherwise
78
+ * learn about.
21
79
  */
22
80
  export declare function appendMovables(md: MarkdownBuilder, movables: readonly IMovable[]): void;
23
81
  /**
24
- * Renders one movable's report — what it is, where it is anchored, and whether anyone can see it.
82
+ * Renders one movable's report — what it is, where it is anchored, and whether it is hidden.
25
83
  *
26
84
  * @remarks
27
- * The listing carries the identity; this adds what does not fit on a row: the pixel bounds, the
28
- * anchor behavior that decides what an insert does to this object, and the display note in full.
85
+ * The listing carries the identity; this adds what does not fit on a row: the pixel bounds and
86
+ * the anchor behavior that decides what an insert does to this object.
29
87
  *
30
88
  * **A movable has no name-based lookup**, so unlike a table this report leads with the anchor —
31
89
  * the address is how a reader gets back to it (`range.getMovables()`), and the name is the first
32
90
  * fact rather than the title.
33
91
  */
34
92
  export declare function renderMovable(movable: IMovable): string;
93
+ /**
94
+ * Renders one shape's report: its placement, as {@link renderMovable} reports it, and everything
95
+ * the shape model states — geometry and adjust values, text and its layout, fill and line, line
96
+ * ends, links, locks, what a connector is glued to, and a group's members.
97
+ *
98
+ * @remarks
99
+ * The same report the shape's movable gives, titled for the object that was asked about: a shape
100
+ * is reached as `movable.getContent()`, and the reader should not have to step back to its movable
101
+ * to learn where it is.
102
+ */
103
+ export declare function renderShape(shape: IShape): string;
35
104
  //# sourceMappingURL=renderMovable.d.ts.map
@@ -24,9 +24,9 @@ export interface RenderNamesOptions extends AppendNamesOptions {
24
24
  * the workbook roster), and this is the report that has to be complete: a hidden broken name with
25
25
  * dependents is precisely the row a debugging agent must see, and the triage sort surfaces it.
26
26
  *
27
- * Synchronous, like every renderer: the dependents column is read off COMPILED formulas, so the
27
+ * The dependents column is the engine's answer, and it is read off COMPILED formulas, so the
28
28
  * caller settles the engine first — `renderMarkdown` settles its workbook argument before
29
29
  * dispatching here.
30
30
  */
31
- export declare function renderNames(names: INamedCollection, options?: RenderNamesOptions): string;
31
+ export declare function renderNames(names: INamedCollection, options?: RenderNamesOptions): Promise<string>;
32
32
  //# sourceMappingURL=renderNames.d.ts.map
@@ -0,0 +1,81 @@
1
+ import { ICellRange, ICell, IProtectedRange, IProtection, ISheet, ISheetProtection, IWorkbookProtection } from '@sheetxl/sdk';
2
+ import { MarkdownBuilder } from './MarkdownBuilder';
3
+ type AnyProtection = IProtection<any, any, any>;
4
+ /**
5
+ * `locked · password` / `paused` — or `null` when the object is not protected.
6
+ *
7
+ * @remarks
8
+ * `null` is what every embedding report tests: an unprotected sheet says nothing about protection,
9
+ * at any altitude. Paused is reported because the document is still a protected one — it saves
10
+ * protected and `resume()` restores it — even though nothing is refused meanwhile. The password is
11
+ * only ever a word here; its hash and salt are never printed.
12
+ */
13
+ export declare const describeLock: (protection: AnyProtection) => string | null;
14
+ /**
15
+ * `structure locked · password` — the workbook report's `Protection:` line, or `null` when the
16
+ * workbook is not protected.
17
+ */
18
+ export declare const describeWorkbookProtection: (protection: IWorkbookProtection) => string | null;
19
+ /**
20
+ * A protected sheet's line on the workbook report — where it can still be written, and how much.
21
+ *
22
+ * @returns `null` when the sheet is not protected.
23
+ */
24
+ export declare function summarizeSheetProtection(sheet: ISheet): {
25
+ extent: string;
26
+ detail: string;
27
+ } | null;
28
+ /**
29
+ * Appends a sheet report's `Protection` section — nothing at all when the sheet is not protected.
30
+ *
31
+ * @remarks
32
+ * Protection is a **precondition on writing**, the same reason a data validation is reported: a
33
+ * cell that will refuse the next write looks exactly like one that will accept it. So the section
34
+ * answers the writer's three questions in order — is it enforced, which operations survive, and
35
+ * where a value can still go.
36
+ *
37
+ * The editable regions are the `unlock` partition, which is why that feature has no section of its
38
+ * own: on an unprotected sheet an unlocked cell refuses nothing and says nothing, and on a
39
+ * protected one it is this section's body.
40
+ */
41
+ export declare function appendSheetProtection(md: MarkdownBuilder, sheet: ISheet): void;
42
+ /**
43
+ * A range report's `Protection:` line — how much of the range a write reaches — or `null` when the
44
+ * sheet is not locked.
45
+ *
46
+ * @remarks
47
+ * Locked only, not paused: this line is read immediately before a write, and a paused sheet
48
+ * refuses none.
49
+ */
50
+ export declare function describeRangeProtection(range: ICellRange): string | null;
51
+ /** A cell report's `Editable:` fact, or `null` when the sheet is not locked. */
52
+ export declare function describeCellProtection(cell: ICell): string | null;
53
+ /**
54
+ * The lookup that answers a write refused by protection, or `null` for any other failure.
55
+ *
56
+ * @remarks
57
+ * The refusal itself is written for a person at a dialog ("unprotect the sheet"); a script needs
58
+ * to know what is still allowed and where. Tested by `name`, since the error routinely crosses a
59
+ * bundle boundary on its way to the host that reports it.
60
+ */
61
+ export declare function protectionPointerFor(error: unknown): string | null;
62
+ /**
63
+ * Renders a sheet's or a workbook's protection — what `getProtection()` answers with.
64
+ *
65
+ * @remarks
66
+ * The object knows its options and not its owner, so this report carries no name and no cells: the
67
+ * editable regions are the sheet report's `Protection` section, and
68
+ * `sheet.getRegions("unlock")` on their own. An unprotected object still renders — the caller asked
69
+ * — as the one line that says so, plus the options it keeps for its next lock.
70
+ */
71
+ export declare function renderProtection(protection: ISheetProtection | IWorkbookProtection): string;
72
+ /**
73
+ * Renders one unlocked range — a member of what `sheet.getProtectedRanges()` holds.
74
+ *
75
+ * @remarks
76
+ * Named for what it does rather than for its type: an `IProtectedRange` RELAXES protection, and a
77
+ * report titled "Protected Range" would tell a writer the opposite of the truth.
78
+ */
79
+ export declare function renderProtectedRange(item: IProtectedRange): string;
80
+ export {};
81
+ //# sourceMappingURL=renderProtection.d.ts.map
@@ -8,6 +8,14 @@ export interface RenderRecordsOptions {
8
8
  * @defaultValue 1000
9
9
  */
10
10
  maxCells?: number;
11
+ /**
12
+ * The one-line form of a field that is a renderable SDK object, or `null` when it is not one.
13
+ *
14
+ * @remarks
15
+ * Supplied by the registry, which knows what renders; this renderer only knows that a class
16
+ * instance has no business being JSON-dumped. Without it such a field prints its string tag.
17
+ */
18
+ nested?: (value: unknown) => string | null;
11
19
  }
12
20
  /**
13
21
  * Whether a value is a *plain* object — an object literal or a `JSON.parse` result, nothing else.
@@ -49,6 +49,7 @@ export interface RenderRegionsOptions extends ProfileRegionOptions {
49
49
  export declare function appendRegionList(md: MarkdownBuilder, regions: readonly ICellRegion[], options?: RenderRegionsOptions & {
50
50
  payload?: RegionPayload;
51
51
  profile?: boolean;
52
+ series?: boolean;
52
53
  }): void;
53
54
  /**
54
55
  * Renders a partition — the unit `getRegions` returns, so an agent addresses structure instead
@@ -6,18 +6,17 @@ import { AppendFeatureOptions } from './appendSections';
6
6
  export interface RenderSheetOptions extends AppendFeatureOptions {
7
7
  }
8
8
  /**
9
- * Renders a markdown report of a sheet: counts, one section per feature partition, and the
10
- * sheet-level objects (named ranges, hidden headers, tables).
9
+ * Renders a markdown report of a sheet: counts, one section per feature partition, the sheet-level
10
+ * objects (named ranges, hidden headers, tables, pivot tables) and the floating layer by type.
11
11
  *
12
12
  * @remarks
13
13
  * **No `Values` section** — that one belongs to {@link renderCellRange}, where the caller named
14
14
  * bounds, and it is the only output in these reports that scales with the number of cells.
15
15
  *
16
16
  * Everything here is bounded by the sheet's structure instead: one section per feature
17
- * partition, and a profile per contentful block that reports computed shape (types, bounds,
18
- * aggregates, distinct counts) plus the text that names a block — a 1×1 prints its value, a
19
- * table its header labels. Blocks × series, both capped, so this report cannot grow with the
20
- * data. Altitude governs content: this one says where things are and what each block is; the
17
+ * partition, and one line per contentful block — its shape, its header, and the text that names
18
+ * it (a 1×1 prints its value). Per-column profiles summarize values, so they are the range
19
+ * report's. Altitude governs content: this one says where things are and what each block is; the
21
20
  * range report reads one.
22
21
  *
23
22
  * This is the whole-sheet form of the same stats a cell range reports — which is exactly why
@@ -25,5 +24,5 @@ export interface RenderSheetOptions extends AppendFeatureOptions {
25
24
  * then asked for, so the two calls compose into the whole read: this one to find the blocks,
26
25
  * that one to read one.
27
26
  */
28
- export declare function renderSheet(sheet: ISheet, options?: RenderSheetOptions): string;
27
+ export declare function renderSheet(sheet: ISheet, options?: RenderSheetOptions): Promise<string>;
29
28
  //# sourceMappingURL=renderSheet.d.ts.map