@sheetxl/query 0.7.23-beta.1

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 (82) hide show
  1. package/LICENSE.md +11 -0
  2. package/README.md +69 -0
  3. package/browser/cjs/index.cjs +26 -0
  4. package/browser/esm/index.mjs +1994 -0
  5. package/licenses/dependencies.txt +1 -0
  6. package/node/esm/index.mjs +2024 -0
  7. package/package.json +52 -0
  8. package/types/index.d.ts +2 -0
  9. package/types/src/Tool.d.ts +108 -0
  10. package/types/src/Tool.d.ts.map +1 -0
  11. package/types/src/encode/encodeCell.d.ts +149 -0
  12. package/types/src/encode/encodeCell.d.ts.map +1 -0
  13. package/types/src/encode/index.d.ts +2 -0
  14. package/types/src/encode/index.d.ts.map +1 -0
  15. package/types/src/grep/GrepTypes.d.ts +308 -0
  16. package/types/src/grep/GrepTypes.d.ts.map +1 -0
  17. package/types/src/grep/grep.d.ts +15 -0
  18. package/types/src/grep/grep.d.ts.map +1 -0
  19. package/types/src/grep/grepTool.d.ts +16 -0
  20. package/types/src/grep/grepTool.d.ts.map +1 -0
  21. package/types/src/grep/index.d.ts +5 -0
  22. package/types/src/grep/index.d.ts.map +1 -0
  23. package/types/src/grep/renderGrep.d.ts +19 -0
  24. package/types/src/grep/renderGrep.d.ts.map +1 -0
  25. package/types/src/index.d.ts +20 -0
  26. package/types/src/index.d.ts.map +1 -0
  27. package/types/src/markdown/MarkdownBuilder.d.ts +84 -0
  28. package/types/src/markdown/MarkdownBuilder.d.ts.map +1 -0
  29. package/types/src/markdown/appendSections.d.ts +364 -0
  30. package/types/src/markdown/appendSections.d.ts.map +1 -0
  31. package/types/src/markdown/caps.d.ts +24 -0
  32. package/types/src/markdown/caps.d.ts.map +1 -0
  33. package/types/src/markdown/describeRegionPayload.d.ts +46 -0
  34. package/types/src/markdown/describeRegionPayload.d.ts.map +1 -0
  35. package/types/src/markdown/describeRule.d.ts +66 -0
  36. package/types/src/markdown/describeRule.d.ts.map +1 -0
  37. package/types/src/markdown/describeStyle.d.ts +64 -0
  38. package/types/src/markdown/describeStyle.d.ts.map +1 -0
  39. package/types/src/markdown/index.d.ts +27 -0
  40. package/types/src/markdown/index.d.ts.map +1 -0
  41. package/types/src/markdown/parseRenderOptions.d.ts +16 -0
  42. package/types/src/markdown/parseRenderOptions.d.ts.map +1 -0
  43. package/types/src/markdown/profileRegion.d.ts +121 -0
  44. package/types/src/markdown/profileRegion.d.ts.map +1 -0
  45. package/types/src/markdown/registry.d.ts +96 -0
  46. package/types/src/markdown/registry.d.ts.map +1 -0
  47. package/types/src/markdown/renderCell.d.ts +23 -0
  48. package/types/src/markdown/renderCell.d.ts.map +1 -0
  49. package/types/src/markdown/renderCellRange.d.ts +61 -0
  50. package/types/src/markdown/renderCellRange.d.ts.map +1 -0
  51. package/types/src/markdown/renderConditionalFormat.d.ts +15 -0
  52. package/types/src/markdown/renderConditionalFormat.d.ts.map +1 -0
  53. package/types/src/markdown/renderCounts.d.ts +11 -0
  54. package/types/src/markdown/renderCounts.d.ts.map +1 -0
  55. package/types/src/markdown/renderDataValidation.d.ts +15 -0
  56. package/types/src/markdown/renderDataValidation.d.ts.map +1 -0
  57. package/types/src/markdown/renderFormula.d.ts +63 -0
  58. package/types/src/markdown/renderFormula.d.ts.map +1 -0
  59. package/types/src/markdown/renderMovable.d.ts +35 -0
  60. package/types/src/markdown/renderMovable.d.ts.map +1 -0
  61. package/types/src/markdown/renderNames.d.ts +32 -0
  62. package/types/src/markdown/renderNames.d.ts.map +1 -0
  63. package/types/src/markdown/renderRanges.d.ts +33 -0
  64. package/types/src/markdown/renderRanges.d.ts.map +1 -0
  65. package/types/src/markdown/renderRecords.d.ts +39 -0
  66. package/types/src/markdown/renderRecords.d.ts.map +1 -0
  67. package/types/src/markdown/renderRegions.d.ts +70 -0
  68. package/types/src/markdown/renderRegions.d.ts.map +1 -0
  69. package/types/src/markdown/renderResult.d.ts +35 -0
  70. package/types/src/markdown/renderResult.d.ts.map +1 -0
  71. package/types/src/markdown/renderSheet.d.ts +29 -0
  72. package/types/src/markdown/renderSheet.d.ts.map +1 -0
  73. package/types/src/markdown/renderStats.d.ts +18 -0
  74. package/types/src/markdown/renderStats.d.ts.map +1 -0
  75. package/types/src/markdown/renderStyle.d.ts +12 -0
  76. package/types/src/markdown/renderStyle.d.ts.map +1 -0
  77. package/types/src/markdown/renderTable.d.ts +12 -0
  78. package/types/src/markdown/renderTable.d.ts.map +1 -0
  79. package/types/src/markdown/renderValues.d.ts +28 -0
  80. package/types/src/markdown/renderValues.d.ts.map +1 -0
  81. package/types/src/markdown/renderWorkbook.d.ts +50 -0
  82. package/types/src/markdown/renderWorkbook.d.ts.map +1 -0
@@ -0,0 +1,66 @@
1
+ import { ICondition, IConditionalFormat, IDataValidation, IStyle } from '@sheetxl/sdk';
2
+ /**
3
+ * The differential style a rule applies — the OOXML `dxf`, as the facets it actually names.
4
+ *
5
+ * @remarks
6
+ * Not a diff against `Normal` like a style region's payload: a dxf **is** already a diff, so every
7
+ * property present in it is by construction something the rule author set. Absent facets are not
8
+ * reported — a rule that only fills says `fill #FFFF00` and nothing about the font it leaves alone.
9
+ */
10
+ export declare const describeRuleStyle: (style: IStyle.Properties | null | undefined) => string | null;
11
+ /**
12
+ * A value→visual mapping — `colorScale · min #FFFFFF → max #FF0000`.
13
+ *
14
+ * @remarks
15
+ * The three band rules are not predicates, so there is no condition to print for them. What
16
+ * describes one is the mapping itself: the kind, and the thresholds it maps between, in the order
17
+ * they were authored.
18
+ */
19
+ export declare const describeScale: (scale: IConditionalFormat.Scale) => string;
20
+ /**
21
+ * A conditional format as one line — the predicate, then what it paints.
22
+ *
23
+ * @remarks
24
+ * `> 100 → fill #FFFF00` is the whole fact: a rule is a test plus an effect, and either half alone
25
+ * leaves the reader with the other to guess. A band rule (color scale, data bar, icon set) has no
26
+ * predicate and renders itself, so it prints as its mapping and nothing follows the arrow.
27
+ *
28
+ * `stop if true` is appended where set, because it changes what the rules BELOW this one do — a
29
+ * later rule that appears to apply may never be reached.
30
+ */
31
+ export declare const describeConditionalFormat: (format: IConditionalFormat) => string;
32
+ /**
33
+ * A data validation as one line — the predicate, then the marks that change what it permits.
34
+ *
35
+ * @remarks
36
+ * The alert style is stated on every row rather than elided as a default, the one place these
37
+ * reports do that: it is the difference between a rule that REFUSES the next write (`stop`) and one
38
+ * that merely comments on it, an omission cannot carry that, and there is no default a reader could
39
+ * assume — Excel writes `stop` while a rule built here starts at `information`. `blanks allowed` is
40
+ * Excel's *Ignore blank*, which decides whether an empty cell is a violation.
41
+ */
42
+ export declare const describeDataValidation: (validation: IDataValidation) => string;
43
+ /**
44
+ * The values a list validation admits, spelled out — or the formula the list is read from.
45
+ *
46
+ * @remarks
47
+ * **A list validation IS a vocabulary**, and frequently the only place a sheet states one: what
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 it as a count (`In 3
50
+ * Items`) because a filter dropdown cannot show a hundred values, so a report that only carried the
51
+ * rule left the vocabulary unreadable.
52
+ *
53
+ * A list sourced from cells carries its formula instead of its values — that IS the answer, and it
54
+ * is the address to read next.
55
+ */
56
+ export declare const describeAllowedValues: (condition: ICondition | null | undefined) => string | null;
57
+ /**
58
+ * The rules covering one region, joined for a single listing row.
59
+ *
60
+ * @remarks
61
+ * Separated by ` | ` rather than the ` · ` a single rule uses for its own marks — overlapping rules
62
+ * are common (that is why a cell can carry several), and one separator for both levels made a
63
+ * two-rule row unreadable as either.
64
+ */
65
+ export declare const describeRules: <T>(items: readonly T[], describe: (item: T) => string) => string | null;
66
+ //# sourceMappingURL=describeRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describeRule.d.ts","sourceRoot":"","sources":["../../../../src/markdown/describeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAAE,kBAAkB,EACjB,KAAK,eAAe,EAAE,KAAK,MAAM,EAC/C,MAAM,cAAc,CAAC;AAqFtB;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IAmCxF,CAAC;AAWF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,CAAC,KAAK,KAAG,MAW/D,CAAC;AAKF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,kBAAkB,KAAG,MAYtE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAAI,YAAY,eAAe,KAAG,MAOpE,CAAC;AAKF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,UAAU,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IAUzF,CAAC;AAKF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,OAAO,SAAS,CAAC,EAAE,EACnB,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,KAC5B,MAAM,GAAG,IAKX,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { IColor, IStyle } from '@sheetxl/sdk';
2
+ /**
3
+ * One-line descriptions of a style's authored facets.
4
+ *
5
+ * @remarks
6
+ * These are the *payloads* of the style feature regions (`Fill`, `Border`, `NumberFormat`,
7
+ * `Alignment`, `Font`): a region is uniform by construction, so the anchor cell's read
8
+ * describes every cell in it.
9
+ *
10
+ * Each facet is described **against the workbook's `Normal` style** rather than dumped whole.
11
+ * A resolved style has ~40 properties and a region carries one or two authored ones; printing
12
+ * the resolution buries the fact. The diff is what the author actually did — the authored
13
+ * layer, per the read surface's style rule.
14
+ */
15
+ /**
16
+ * Formats a color as RGB, carrying its symbolic origin when it has one — `#000000 (dk1)`.
17
+ *
18
+ * @remarks
19
+ * A theme slot, an indexed color or a tint is not a color: an audit cannot compare `dk1` to
20
+ * `#000000` without resolving it. The origin is kept alongside because a themed color and a
21
+ * literal one that happen to match are different authoring decisions.
22
+ */
23
+ export declare const describeColor: (color: IColor | null | undefined) => string | null;
24
+ /**
25
+ * Describes a fill — `solid #FFFF00`, `darkGray pattern #FF0000 on #FFFFFF`, `gradient`.
26
+ *
27
+ * @remarks
28
+ * **The visible color of a pattern fill is the FOREGROUND.** A plainly-filled yellow cell is a
29
+ * pattern fill with patternType `solid` and a yellow foreground; the background is the color
30
+ * BEHIND the pattern marks (`auto` on a plain fill) — it is exactly what the CSS renderer
31
+ * paints for `solid` too. The fill's generic `getColor()` returns the *background*, which is
32
+ * how a yellow cell once reported `pattern #000000 (auto)`.
33
+ */
34
+ export declare const describeFill: (style: IStyle) => string | null;
35
+ /**
36
+ * Describes borders — the edges that carry a style, each as `edge style color`.
37
+ *
38
+ * @remarks
39
+ * **Includes the inner rules when the style knows its extent.** A bordered block is very often a
40
+ * box *with a grid inside it*, and the four outer edges cannot say so — a payload that stops at
41
+ * the outline reports "thin box" for a table and for a boxed blank cell alike. `horizontal` and
42
+ * `vertical` are `null` on a cell-scoped style, which is why the region payload reads through
43
+ * `getRange()`.
44
+ */
45
+ export declare const describeBorder: (style: IStyle) => string | null;
46
+ /**
47
+ * The border as a list of parts, identical edges grouped.
48
+ *
49
+ * @remarks
50
+ * The overwhelmingly common authored border is the SAME stroke on several edges — a boxed range
51
+ * is four identical edges, and listing `top thick X · left thick X · bottom thick X · right
52
+ * thick X` says one fact four times. Edges sharing a stroke collapse into one part: all four
53
+ * outer edges become **`outline`**, any other run lists its edges (`top+bottom thin`). Only
54
+ * genuinely distinct strokes produce distinct parts — which is what makes the multi-line form
55
+ * (one part per line) worth printing.
56
+ */
57
+ export declare const describeBorderParts: (style: IStyle) => string[];
58
+ /** Describes a number format — the format string itself is the payload. */
59
+ export declare const describeNumberFormat: (style: IStyle) => string | null;
60
+ /** Describes alignment — only the parts that differ from `normal`. */
61
+ export declare const describeAlignment: (style: IStyle, normal: IStyle) => string | null;
62
+ /** Describes a font — only the parts that differ from `normal`. */
63
+ export declare const describeFont: (style: IStyle, normal: IStyle) => string | null;
64
+ //# sourceMappingURL=describeStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describeStyle.d.ts","sourceRoot":"","sources":["../../../../src/markdown/describeStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE/D;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IAgBzE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,IAkBrD,CAAC;AAKF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,IAGvD,CAAC;AAKF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,MAAM,EA6BzD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,IAG7D,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAAM,GAAG,IAU1E,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAAM,GAAG,IAcrE,CAAC"}
@@ -0,0 +1,27 @@
1
+ export * from './appendSections';
2
+ export * from './describeRegionPayload';
3
+ export * from './describeRule';
4
+ export * from './describeStyle';
5
+ export * from './MarkdownBuilder';
6
+ export * from './parseRenderOptions';
7
+ export * from './profileRegion';
8
+ export * from './renderCell';
9
+ export * from './renderCellRange';
10
+ export * from './renderConditionalFormat';
11
+ export * from './renderCounts';
12
+ export * from './renderDataValidation';
13
+ export * from './renderFormula';
14
+ export * from './renderMovable';
15
+ export * from './renderNames';
16
+ export * from './renderRecords';
17
+ export * from './renderRanges';
18
+ export * from './renderRegions';
19
+ export * from './renderResult';
20
+ export * from './renderSheet';
21
+ export * from './renderStats';
22
+ export * from './renderStyle';
23
+ export * from './renderTable';
24
+ export * from './renderValues';
25
+ export * from './renderWorkbook';
26
+ export * from './registry';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Renderer } from './registry';
2
+ /** The legal keys, in declaration order — what an error message lists. */
3
+ export declare const RENDER_OPTION_KEYS: readonly string[];
4
+ /**
5
+ * Parses a host's string-valued render options into a {@link Renderer.Options}.
6
+ *
7
+ * @remarks
8
+ * An unknown key **throws with the whole vocabulary**, for the reason `parseFeatures` does: a
9
+ * silently dropped option reads as "the report ignored what I asked for", which sends the reader
10
+ * looking for the bug in the renderer rather than in what they typed.
11
+ *
12
+ * Values arrive as strings because that is what a command line and a JSON string map carry; a
13
+ * caller already holding typed options should build {@link Renderer.Options} directly.
14
+ */
15
+ export declare function parseRenderOptions(raw: Readonly<Record<string, string>>): Renderer.Options;
16
+ //# sourceMappingURL=parseRenderOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseRenderOptions.d.ts","sourceRoot":"","sources":["../../../../src/markdown/parseRenderOptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AA8B3C,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAyB,CAAC;AAY1E;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAU1F"}
@@ -0,0 +1,121 @@
1
+ import { ICellRange, ICellRegion } from '@sheetxl/sdk';
2
+ /**
3
+ * What {@link profileRegion} needs to read — the anchor cell and the extent, nothing a partition
4
+ * knows that a plain range does not.
5
+ *
6
+ * @remarks
7
+ * `ICellRegion` satisfies this structurally, so every existing caller (a `Contentful` partition's
8
+ * members) needs no change. It also lets a bare {@link ICellRange} profile itself — `renderCellRange`
9
+ * adapts one with a four-line object, `getRange` returning the range itself — without a region ever
10
+ * having been asked for.
11
+ */
12
+ export type ProfileSource = Pick<ICellRegion, 'getRowCount' | 'getColumnCount' | 'getCell' | 'getRange'>;
13
+ /**
14
+ * Options for {@link profileRegion}.
15
+ */
16
+ export interface ProfileRegionOptions {
17
+ /**
18
+ * Series (columns, or rows on a wide block) described before the profile elides the rest.
19
+ *
20
+ * @defaultValue 24
21
+ */
22
+ maxSeries?: number;
23
+ /**
24
+ * Cells scanned per region. Above this the profile is taken from a leading slice and **says
25
+ * so** — the alternative is a report whose cost is unbounded in the size of the sheet.
26
+ *
27
+ * @remarks
28
+ * A scan budget, not a listing cap: it bounds what profiling *reads*, where every other `max*`
29
+ * bounds what a report *prints*. The distinction is the reason for the name — spelled
30
+ * `maxCells` it merged with `RenderCellRangeOptions.maxCells` on `Renderer.Options`, where one
31
+ * value silently shrank the values table *and* put every profile on a leading slice.
32
+ *
33
+ * @defaultValue 20000
34
+ */
35
+ maxProfileCells?: number;
36
+ /**
37
+ * Distinct values listed for a categorical series before `…`.
38
+ *
39
+ * @defaultValue 3
40
+ */
41
+ maxCategories?: number;
42
+ }
43
+ /**
44
+ * What a contentful region turned out to be.
45
+ *
46
+ * @remarks
47
+ * The three shapes are structural, not tunable: a 1×1 has no series to describe, a 1-D run has
48
+ * exactly one, and a block has one per column (or row). This is the same discipline that keeps a
49
+ * range from rendering cell facets — bounded by construction rather than by a limit that has to
50
+ * fire.
51
+ */
52
+ export type RegionShape = 'cell' | 'list' | 'table' | 'block';
53
+ /**
54
+ * A contentful region's profile: what the block IS, and one line per series inside it.
55
+ *
56
+ * @remarks
57
+ * `summary` rides the region's address line; `series` are the indented lines beneath it.
58
+ */
59
+ export interface RegionProfile {
60
+ shape: RegionShape;
61
+ /** The one-line description that sits beside the address — `table · header row 1`. */
62
+ summary: string;
63
+ /** One line per column (or row); empty for `cell` and `list`, whose profile is in `summary`. */
64
+ series: string[];
65
+ }
66
+ /**
67
+ * Profiles a **contentful** region — the answer to "what is actually in this block?".
68
+ *
69
+ * @remarks
70
+ * `Contentful` is the one feature whose regions carry no payload: every other feature partitions
71
+ * on payload identity (a `Fill` region is one color, a `Formula` region one authored R1C1), so its
72
+ * anchor read describes the block. Occupancy has no such identity — a contentful region is pure
73
+ * geometry, which is why the listing could only ever print an address and a size, and why an agent
74
+ * had to spend one round trip per block to learn anything at all. Twelve blocks, twelve calls.
75
+ *
76
+ * So the payload is **computed** rather than read: per-series counts, types and aggregates, which
77
+ * is `df.info()` + `df.describe()` — the shape every reader already knows, and the one openpyxl
78
+ * cannot produce. Nothing here is new engine work; it is `getStats` and `getCounts` per series,
79
+ * arranged.
80
+ *
81
+ * Three rules keep it honest:
82
+ *
83
+ * - **A header is detected, never assumed**, and the result is stated either way. A silently
84
+ * assumed header shifts every label by one column and the reader cannot tell.
85
+ * - **The longer axis is the series axis**, and the profile says which. Profiling a 3×40 block by
86
+ * column would print forty lines describing nothing.
87
+ * - **Above {@link ProfileRegionOptions.maxProfileCells} the scan is a leading slice and says so** —
88
+ * elision is explicit, per the same rule that governs every truncated listing here.
89
+ */
90
+ export declare function profileRegion(region: ProfileSource, options?: ProfileRegionOptions): RegionProfile;
91
+ /**
92
+ * Per-kind stats, pooled across the WHOLE range regardless of column — "what's actually in here,
93
+ * broken down by type" in one shot, as opposed to {@link profileSeries}'s per-column breakdown.
94
+ *
95
+ * @remarks
96
+ * `Number` and the categorical kinds are naturally kind-isolated by the stats machinery already,
97
+ * with no partition and no new index required: `getAggregates` is computed over the numeric
98
+ * population regardless of what else shares the range, and `getFrequencies({ filterFn })`
99
+ * restricts distinctness to one kind. Each line leads with the count, exactly like the bare
100
+ * `Number: N` a `Types` section already prints — this is that line, with the stats appended.
101
+ *
102
+ * `Date` is left out here, on cost rather than ability: computing it correctly means a value scan
103
+ * (see {@link countDates}) rather than a `getCounts`/`getStats` read, and this payload is the
104
+ * CHEAP alternative to full per-column profiling — a Contentful region listing that pays for a
105
+ * date scan on every unprofiled row has lost the reason it exists. `appendKinds`, called once per
106
+ * report rather than once per listed region, affords it.
107
+ */
108
+ export declare function profileKinds(range: ICellRange, maxCategories?: number): string[];
109
+ /**
110
+ * How many cells in `range` are genuinely dates — numeric value AND date-category format, read
111
+ * directly off each value the same way `getInteropType()` already classifies it for display.
112
+ *
113
+ * @remarks
114
+ * Not `range.getCounts([Feature.DateFormat])`: that counts the FORMAT alone — a blank cell or a
115
+ * text cell carrying a date-category format counts there too, which is the wrong, looser
116
+ * condition for "how many of these are dates". `DateFormat` is deliberately just a formatting
117
+ * predicate now (see `ICellRange.Feature`'s own remarks); this is the value-level question a
118
+ * report asks instead, composed from public API rather than any single feature.
119
+ */
120
+ export declare function countDates(range: ICellRange): number;
121
+ //# sourceMappingURL=profileRegion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profileRegion.d.ts","sourceRoot":"","sources":["../../../../src/markdown/profileRegion.ts"],"names":[],"mappings":"AAAA,OAAO,EAC0B,UAAU,EAAE,KAAK,WAAW,EAC5D,MAAM,cAAc,CAAC;AAMtB;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,gBAAgB,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AAEzG;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,sFAAsF;IACtF,OAAO,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAiFlG;AAuLD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,GAAE,MAAU,GAAG,MAAM,EAAE,CAqBnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMpD"}
@@ -0,0 +1,96 @@
1
+ import { IWorkbook } from '@sheetxl/sdk';
2
+ import { AppendDependencyOptions } from './appendSections';
3
+ import { RenderCellRangeOptions } from './renderCellRange';
4
+ import { RenderFormulaOptions } from './renderFormula';
5
+ import { RenderNamesOptions } from './renderNames';
6
+ import { RenderRecordsOptions } from './renderRecords';
7
+ import { RenderRangesOptions } from './renderRanges';
8
+ import { RenderRegionsOptions } from './renderRegions';
9
+ import { RenderSheetOptions } from './renderSheet';
10
+ import { RenderValuesOptions } from './renderValues';
11
+ /**
12
+ * The renderer registry: one entry per renderable kind.
13
+ *
14
+ * @remarks
15
+ * Two consumers, one list. `describe` resolves an explicit kind (`'sheet'`) by name; dynamic
16
+ * surfaces (the REPL's `.md`, a macro result) resolve an arbitrary SDK object via {@link
17
+ * Renderer.Entry.is}. Both paths land on the same entry, so a kind cannot render differently
18
+ * depending on how it was reached.
19
+ *
20
+ * Detection uses the SDK's `isI*` runtime brands (`isIWorkbook`, `isISheet`, `isICellRange`,
21
+ * …) — the SDK's own convention for runtime type checking. The registry knows the SDK's
22
+ * interfaces, never its classes, and a brand survives any transport that preserves methods.
23
+ */
24
+ export declare namespace Renderer {
25
+ /**
26
+ * Everything any registered renderer accepts.
27
+ *
28
+ * @remarks
29
+ * The registry dispatches on the object, not the caller, so one options bag has to reach
30
+ * whichever entry matched. Each renderer reads the keys it knows and ignores the rest — the
31
+ * alternative is making the caller name the kind, which is the dispatch the registry exists
32
+ * to remove.
33
+ */
34
+ type Options = RenderCellRangeOptions & RenderSheetOptions & RenderRegionsOptions & RenderValuesOptions & RenderFormulaOptions & RenderRecordsOptions & RenderNamesOptions & RenderRangesOptions & AppendDependencyOptions;
35
+ /**
36
+ * One renderable kind.
37
+ */
38
+ interface Entry<T = any> {
39
+ /** Registry key — the kind name an explicit lookup (`describe('sheet', …)`) uses. */
40
+ readonly kind: string;
41
+ /** Detects whether this entry accepts the object — the dynamic-dispatch path. */
42
+ is(target: unknown): target is T;
43
+ /** Renders the object as its markdown report. */
44
+ render(target: T, options?: Options): string | Promise<string>;
45
+ }
46
+ }
47
+ /**
48
+ * All renderable kinds, most specific first — dynamic dispatch takes the first match.
49
+ *
50
+ * @remarks
51
+ * The structural entries (`values`, `records`, `record`, `items`) come last because their detection
52
+ * is shape-based rather than branded, so every kind that *does* carry a brand gets first refusal.
53
+ * `record` and `items` are last of all: they are the widest shapes here, and an array of records
54
+ * must be read as a table rather than as its first element or as N reports.
55
+ */
56
+ export declare const RENDERERS: readonly Renderer.Entry[];
57
+ /**
58
+ * Thrown by {@link renderMarkdown} when nothing in the registry accepts the value.
59
+ *
60
+ * @remarks
61
+ * A distinct type because "nothing renders this" is a ROUTING answer, and callers fall back on
62
+ * it — {@link renderResult} summarizes the value in one line instead. A renderer that throws
63
+ * while rendering is a different event entirely: it means the report is broken, and reporting it
64
+ * as "no renderer" sends the reader off to `--json` for a value that has a perfectly good
65
+ * renderer. Without a type to test, the two are indistinguishable and the real error is lost.
66
+ */
67
+ export declare class NoRendererError extends Error {
68
+ constructor(message: string);
69
+ }
70
+ /**
71
+ * Resolves the registry entry for an arbitrary object, or `null` if nothing renders it.
72
+ */
73
+ export declare function resolveRenderer(target: unknown): Renderer.Entry | null;
74
+ /**
75
+ * Renders any renderable SDK object as its markdown report.
76
+ *
77
+ * @param workbook The workbook whose calculation settles before the render — the book the target
78
+ * came from. `null` only for a value with no book behind it (a plain array, a record).
79
+ *
80
+ * @remarks
81
+ * Unbranded iterables (a generator a macro returned, `find()`'s iterator) are materialized —
82
+ * capped — before dispatch, so a bare iterator still renders as whatever its members are.
83
+ * Branded kinds never take this path: `getRegions` returns a branded collection that happens to
84
+ * be iterable, and flattening it would lose the features it carries.
85
+ *
86
+ * **Calculation settles here, not in the renderers.** A report read before the engine drains is
87
+ * wrong in quiet ways — formula results absent, used ranges short, every name reported unused —
88
+ * which is why the workbook is the FIRST parameter rather than an option a caller can forget.
89
+ * One settle covers every kind (all of a book's sheets, names and formulas share its engine),
90
+ * and it is the whole async surface: the renderers themselves are synchronous, and a caller
91
+ * invoking one directly is responsible for settling first.
92
+ *
93
+ * @throws If no registered renderer accepts the object.
94
+ */
95
+ export declare function renderMarkdown(workbook: IWorkbook | null, target: unknown, options?: Renderer.Options): Promise<string>;
96
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/markdown/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAE+D,SAAS,EACnF,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAIjF,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAgC,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIrE,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGxE;;;;;;;;;;;;GAYG;AACH,yBAAiB,QAAQ,CAAC;IACxB;;;;;;;;OAQG;IACH,KAAY,OAAO,GACjB,sBAAsB,GAAG,kBAAkB,GAAG,oBAAoB,GAAG,mBAAmB,GACxF,oBAAoB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,mBAAmB,GACtF,uBAAuB,CAAC;IAE1B;;OAEG;IACH,UAAiB,KAAK,CAAC,CAAC,GAAG,GAAG;QAC5B,qFAAqF;QACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,iFAAiF;QACjF,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,CAAC,CAAC;QACjC,iDAAiD;QACjD,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;KAChE;CACF;AAyPD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,QAAQ,CAAC,KAAK,EAqB9C,CAAC;AAKF;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC,KAAK,GAAG,IAAI,CAKtE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,SAAS,GAAG,IAAI,EAC1B,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,GACzB,OAAO,CAAC,MAAM,CAAC,CAwBjB"}
@@ -0,0 +1,23 @@
1
+ import { ICell } from '@sheetxl/sdk';
2
+ import { AppendDependencyOptions } from './appendSections';
3
+ /**
4
+ * Renders a cell's report: value, formula, spans, spill, the effective style, and its position in
5
+ * the dependency graph.
6
+ *
7
+ * @remarks
8
+ * A cell is the one altitude where **resolved effect** belongs. A range reports style as authored
9
+ * layers and never composes them, because composition is an expansion — a banded table is one
10
+ * authored fact and an unbounded number of effective ranges. For a single cell the expansion is
11
+ * 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
+ *
18
+ * 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.
21
+ */
22
+ export declare function renderCell(cell: ICell, options?: AppendDependencyOptions): string;
23
+ //# sourceMappingURL=renderCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCell.d.ts","sourceRoot":"","sources":["../../../../src/markdown/renderCell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAyC,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAMvG;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,KAAK,EACX,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,CAqBR"}
@@ -0,0 +1,61 @@
1
+ import { ICellRange } from '@sheetxl/sdk';
2
+ import { CellEncoding } from '../encode';
3
+ import { AppendDependencyOptions, AppendFeatureOptions } from './appendSections';
4
+ import { ProfileRegionOptions } from './profileRegion';
5
+ /**
6
+ * Options for {@link renderCellRange}.
7
+ */
8
+ export interface RenderCellRangeOptions extends AppendFeatureOptions, AppendDependencyOptions, ProfileRegionOptions {
9
+ /**
10
+ * How much formatting cell text carries.
11
+ *
12
+ * @defaultValue {@link CellEncoding.Mode.Display}
13
+ */
14
+ mode?: CellEncoding.Mode;
15
+ /**
16
+ * Cap on rendered data cells; the report notes truncation when exceeded.
17
+ *
18
+ * @defaultValue 1000
19
+ */
20
+ maxCells?: number;
21
+ /**
22
+ * Compute and print the `Profile` section — per-series counts, types and aggregates.
23
+ *
24
+ * @defaultValue true
25
+ *
26
+ * @remarks
27
+ * On by default here, unlike `AppendFeatureOptions.profile` (off by default for a sheet report's
28
+ * `Contentful` section): a sheet report is scanning every block on the caller's behalf, while
29
+ * this range was named directly, so the same budget reasoning argues the other way. Set `false`
30
+ * to skip the scan — e.g. a caller only after the raw values, or one already holding a `getStats()`
31
+ * result of its own.
32
+ */
33
+ profile?: boolean;
34
+ }
35
+ /**
36
+ * Renders a markdown report of a cell range: its values as a table, plus the profile, counts,
37
+ * formulas, spills, intersecting sheet objects and the rules over it — all confined to the range.
38
+ *
39
+ * @remarks
40
+ * **This is where the values live.** A sheet report says *where* the blocks are; this reads one.
41
+ * Values belong at this altitude and not the one above precisely because the caller named the
42
+ * bounds — a sheet has no bound but its size.
43
+ *
44
+ * **It is also where the stats live, by default.** The same per-series counts, types and
45
+ * aggregates a `Contentful` region's profile computes are computed here directly over the named
46
+ * range — see {@link appendProfile} — so reading a range and understanding its shape is one call,
47
+ * not a values read followed by a separate `getStats()`.
48
+ *
49
+ * **It does not repeat the feature partitions.** A sheet report is already that map over the
50
+ * whole used range, so listing them again inside a rectangle carved out of it says the same
51
+ * thing twice at a narrower scope. The one who wants a partition of this range asks for it —
52
+ * `getRegions` on the range is the call, and it is one expression.
53
+ *
54
+ * `ICellRange` is the *live handle*: it knows its sheet, so its report carries A1 addresses,
55
+ * hidden headers and intersecting tables. {@link renderValues} covers `IRange` and `Scalar[][]`,
56
+ * which know none of that.
57
+ *
58
+ * Cell text goes through {@link encodeCell}, so whatever a report prints, grep can find.
59
+ */
60
+ export declare function renderCellRange(range: ICellRange, options?: RenderCellRangeOptions): string;
61
+ //# sourceMappingURL=renderCellRange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCellRange.d.ts","sourceRoot":"","sources":["../../../../src/markdown/renderCellRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAc,MAAM,WAAW,CAAC;AACrD,OAAO,EAEoB,KAAK,uBAAuB,EAAE,KAAK,oBAAoB,EACjF,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAiB,KAAK,oBAAoB,EAAsB,MAAM,iBAAiB,CAAC;AAG/F;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB,EAAE,uBAAuB,EAAE,oBAAoB;IACjH;;;;OAIG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAyCR"}
@@ -0,0 +1,15 @@
1
+ import { IConditionalFormat } from '@sheetxl/sdk';
2
+ /**
3
+ * Renders one conditional format's report — where it applies, what it tests, and what it paints.
4
+ *
5
+ * @remarks
6
+ * The rule as AUTHORED. What a rule does to a particular cell is a cell report's question and is
7
+ * already answered there (`ICell.getStyle()` is the rendered style, conditional formatting folded
8
+ * in); what a cell can never show is the predicate, which is this report's whole subject.
9
+ *
10
+ * The listings — a region row, the `Conditional Formats` section — carry the same rule on one line
11
+ * through the same describers. This adds only what does not fit there: the anchor in full and the
12
+ * evaluation order.
13
+ */
14
+ export declare function renderConditionalFormat(format: IConditionalFormat): string;
15
+ //# sourceMappingURL=renderConditionalFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderConditionalFormat.d.ts","sourceRoot":"","sources":["../../../../src/markdown/renderConditionalFormat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMvD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CA2B1E"}
@@ -0,0 +1,11 @@
1
+ import { ICellRange } from '@sheetxl/sdk';
2
+ /**
3
+ * Renders a counts report — per-feature cell occupancy.
4
+ *
5
+ * @remarks
6
+ * `getCounts` answers "how much of each feature is here"; stats answers "what are the values
7
+ * like". Zero features are elided — the record's stable full-key shape is an API property, not
8
+ * a reporting one; a report of twenty zeros buries the four numbers that matter.
9
+ */
10
+ export declare function renderCounts(counts: ICellRange.Counts): string;
11
+ //# sourceMappingURL=renderCounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCounts.d.ts","sourceRoot":"","sources":["../../../../src/markdown/renderCounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAc9D"}
@@ -0,0 +1,15 @@
1
+ import { IDataValidation } from '@sheetxl/sdk';
2
+ /**
3
+ * Renders one data validation's report — where it applies, what it permits, and what a reader is
4
+ * told when it does not.
5
+ *
6
+ * @remarks
7
+ * A validation is a **precondition on writing**, which is why an agent reads one: it is the
8
+ * difference between a value that will be accepted and one that will be refused, and the list of
9
+ * allowed values is very often the only place a sheet states its own vocabulary.
10
+ *
11
+ * The prompt and alert text are on this report and not in any listing, because they are prose —
12
+ * and because the alert text is frequently where the author explained the rule in words.
13
+ */
14
+ export declare function renderDataValidation(validation: IDataValidation): string;
15
+ //# sourceMappingURL=renderDataValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDataValidation.d.ts","sourceRoot":"","sources":["../../../../src/markdown/renderDataValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM/C;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,CAsCxE"}
@@ -0,0 +1,63 @@
1
+ import { ICalculation, ISheet } from '@sheetxl/sdk';
2
+ /**
3
+ * Options for {@link renderFormula}.
4
+ */
5
+ export interface RenderFormulaOptions {
6
+ /**
7
+ * Cap on listed tokens; the report notes truncation when exceeded.
8
+ *
9
+ * @defaultValue 200
10
+ */
11
+ maxTokens?: number;
12
+ /**
13
+ * The sheet an identifier is resolved against.
14
+ *
15
+ * @defaultValue the sheet owning the formula's first reference
16
+ *
17
+ * @remarks
18
+ * Names, tables and functions are all scoped, so resolving one requires knowing *where the
19
+ * formula lives* — which `ICalculation.IFormula` does not carry. It is normally recoverable
20
+ * from `getReferences()`, and this option covers the case where it is not: a formula whose
21
+ * references are all names or constants (`=TAX_RATE * 100`) resolves nothing without it.
22
+ */
23
+ context?: ISheet;
24
+ }
25
+ /**
26
+ * Renders a formula's *analysis* report: its text, calculation status, behavioral flags, the
27
+ * identifiers it names, the ranges it references, and its token stream.
28
+ *
29
+ * @remarks
30
+ * **Analysis, not state.** A cell report answers "what is here" — value, format, memberships.
31
+ * This answers "what does this expression do", which is a different question with a different
32
+ * shape, and is why `formula` is its own kind rather than a section of `cell`.
33
+ *
34
+ * **It computes.** `evaluate()` is asynchronous by contract, which is why this report went without
35
+ * a value for as long as it did — but "what does `=SUM(H14:H25)` come to" is the most common
36
+ * question anyone brings to a formula, and answering it with a token stream sent the reader off to
37
+ * make a second call for the number they already asked for. One `await` buys the whole difference,
38
+ * and calculation has already settled by the time a renderer runs (see `renderMarkdown`).
39
+ *
40
+ * The flags are printed only when true. `isValid` is the exception, printed only when *false*:
41
+ * a formula that failed to parse is the finding, and a parse failure is not the same as an
42
+ * error result — `=1/0` parses fine and evaluates to `#DIV/0!`.
43
+ *
44
+ * **Symbols resolve themselves.** An agent reading `=SUM(Revenue)` cannot act until it knows
45
+ * whether `Revenue` is a defined name, a table column or a header string — three different
46
+ * objects with three different next calls, and the text alone does not say which. The section
47
+ * names each one and what it points at, which also makes the two silent failures loud: a name
48
+ * that no longer resolves, and a function that does not exist (the `#NAME?` an agent would
49
+ * otherwise diagnose from the value). `Symbols`, not `Identifiers`: the skills teach the names
50
+ * roster as "the symbol table", so this is the per-formula slice of a concept the reader already
51
+ * has, under the word they have for it.
52
+ *
53
+ * Cell references stay in `References` rather than joining it — an address is self-describing,
54
+ * and that listing is *indexed* because the index is the argument to `setReferenceAt`.
55
+ *
56
+ * **A DEFINED NAME renders through here too**, because a name IS a formula plus an identity — the
57
+ * SDK models it that way (`INamedFormula extends IFormula, INamed`) and so does this report. It
58
+ * gains an identity header and a `Dependents` section; everything else is the same analysis,
59
+ * because the questions are the same ones. A separate renderer would have had to answer them
60
+ * twice.
61
+ */
62
+ export declare function renderFormula(formula: ICalculation.IFormula, options?: RenderFormulaOptions): Promise<string>;
63
+ //# sourceMappingURL=renderFormula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderFormula.d.ts","sourceRoot":"","sources":["../../../../src/markdown/renderFormula.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,EAAU,MAAM,cAAc,CAAC;AAMrF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA6PD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,YAAY,CAAC,QAAQ,EAC9B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,CA8GjB"}