@xlcalc/vue 0.0.0-stage → 0.21.2

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 (125) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/LICENSE +21 -0
  3. package/README.md +75 -2
  4. package/dist/abort.d.ts +6 -0
  5. package/dist/components/CellDraft.vue.d.ts +7 -0
  6. package/dist/components/CellEditor.vue.d.ts +3 -0
  7. package/dist/components/ColourSwatches.vue.d.ts +13 -0
  8. package/dist/components/DialogShell.vue.d.ts +37 -0
  9. package/dist/components/ExplainPanel.vue.d.ts +3 -0
  10. package/dist/components/FilterPopover.vue.d.ts +3 -0
  11. package/dist/components/FindBar.vue.d.ts +3 -0
  12. package/dist/components/FormatBorders.vue.d.ts +14 -0
  13. package/dist/components/FormatColour.vue.d.ts +19 -0
  14. package/dist/components/FormatDialog.vue.d.ts +24 -0
  15. package/dist/components/FormulaBar.vue.d.ts +3 -0
  16. package/dist/components/FunctionList.vue.d.ts +28 -0
  17. package/dist/components/FunctionTip.vue.d.ts +14 -0
  18. package/dist/components/InsertFunction.vue.d.ts +9 -0
  19. package/dist/components/OutlineCell.vue.d.ts +8 -0
  20. package/dist/components/OutlineLevels.vue.d.ts +7 -0
  21. package/dist/components/SheetGrid.vue.d.ts +3 -0
  22. package/dist/components/SheetMarks.vue.d.ts +3 -0
  23. package/dist/components/SheetMenu.vue.d.ts +3 -0
  24. package/dist/components/SheetRow.vue.d.ts +18 -0
  25. package/dist/components/SheetTabs.vue.d.ts +3 -0
  26. package/dist/components/SheetToolbar.vue.d.ts +43 -0
  27. package/dist/components/SheetView.vue.d.ts +56 -0
  28. package/dist/components/ValidationAlert.vue.d.ts +16 -0
  29. package/dist/components/ValidationDropdown.vue.d.ts +33 -0
  30. package/dist/components/ValidationPrompt.vue.d.ts +16 -0
  31. package/dist/components/cf-icons.d.ts +6 -0
  32. package/dist/components/context.d.ts +4 -0
  33. package/dist/components/dom.d.ts +7 -0
  34. package/dist/components/icons.d.ts +33 -0
  35. package/dist/components/popup.d.ts +29 -0
  36. package/dist/components/toolbar-icons.d.ts +24 -0
  37. package/dist/contract/memory.d.ts +108 -0
  38. package/dist/contract/messages.d.ts +260 -0
  39. package/dist/contract/source.d.ts +433 -0
  40. package/dist/contract/view.d.ts +108 -0
  41. package/dist/contract.d.ts +9 -0
  42. package/dist/core/ask.d.ts +2 -0
  43. package/dist/core/autocomplete.d.ts +28 -0
  44. package/dist/core/cell-style.d.ts +33 -0
  45. package/dist/core/cell-view.d.ts +104 -0
  46. package/dist/core/clip.d.ts +43 -0
  47. package/dist/core/commands.d.ts +47 -0
  48. package/dist/core/conditional.d.ts +16 -0
  49. package/dist/core/editing.d.ts +85 -0
  50. package/dist/core/explain.d.ts +36 -0
  51. package/dist/core/fill.d.ts +42 -0
  52. package/dist/core/filter.d.ts +72 -0
  53. package/dist/core/find.d.ts +53 -0
  54. package/dist/core/formula.d.ts +41 -0
  55. package/dist/core/function-tip.d.ts +34 -0
  56. package/dist/core/geometry.d.ts +55 -0
  57. package/dist/core/keys.d.ts +8 -0
  58. package/dist/core/list-keys.d.ts +4 -0
  59. package/dist/core/list.d.ts +17 -0
  60. package/dist/core/menu.d.ts +155 -0
  61. package/dist/core/merge.d.ts +19 -0
  62. package/dist/core/navigation.d.ts +72 -0
  63. package/dist/core/outline.d.ts +34 -0
  64. package/dist/core/point.d.ts +34 -0
  65. package/dist/core/ref-paint.d.ts +21 -0
  66. package/dist/core/selection.d.ts +45 -0
  67. package/dist/core/sheet.d.ts +774 -0
  68. package/dist/core/state.d.ts +107 -0
  69. package/dist/core/storage.d.ts +6 -0
  70. package/dist/core/totals.d.ts +16 -0
  71. package/dist/core/validation.d.ts +95 -0
  72. package/dist/core/viewport.d.ts +83 -0
  73. package/dist/core/windows.d.ts +102 -0
  74. package/dist/entry.d.ts +3 -0
  75. package/dist/failure.d.ts +5 -0
  76. package/dist/filter-key.d.ts +3 -0
  77. package/dist/find-match.d.ts +24 -0
  78. package/dist/format-cells.d.ts +85 -0
  79. package/dist/frame.d.ts +5 -0
  80. package/dist/grid-ref.d.ts +3 -0
  81. package/dist/index.d.ts +6 -0
  82. package/dist/index.js +12767 -0
  83. package/dist/lines.d.ts +16 -0
  84. package/dist/local/find.d.ts +15 -0
  85. package/dist/local/index.d.ts +3 -0
  86. package/dist/local/locale.d.ts +5 -0
  87. package/dist/local/outcome.d.ts +21 -0
  88. package/dist/local/query.d.ts +23 -0
  89. package/dist/local/source.d.ts +4 -0
  90. package/dist/local/types.d.ts +37 -0
  91. package/dist/local/validation.d.ts +8 -0
  92. package/dist/local/window.d.ts +16 -0
  93. package/dist/local/xlsx.d.ts +23 -0
  94. package/dist/local.js +1025 -0
  95. package/dist/locale-ref.d.ts +7 -0
  96. package/dist/locales.d.ts +3 -0
  97. package/dist/memory-outline.d.ts +31 -0
  98. package/dist/memory-query.d.ts +26 -0
  99. package/dist/memory-source.d.ts +3 -0
  100. package/dist/memory-validation.d.ts +17 -0
  101. package/dist/messages.d.ts +6 -0
  102. package/dist/number-formats.d.ts +13 -0
  103. package/dist/rect.d.ts +9 -0
  104. package/dist/ru-RU-BVeg6JGM.js +931 -0
  105. package/dist/sheet-query.d.ts +22 -0
  106. package/dist/stats.d.ts +8 -0
  107. package/dist/style.css +2 -0
  108. package/dist/toolbar.d.ts +39 -0
  109. package/dist/typed-entry-2l9Ay-hV.js +4559 -0
  110. package/dist/window-size.d.ts +4 -0
  111. package/docs/api.md +520 -0
  112. package/docs/autocomplete.md +60 -0
  113. package/docs/checks.md +40 -0
  114. package/docs/clipboard.md +48 -0
  115. package/docs/editing.md +97 -0
  116. package/docs/example-app.md +26 -0
  117. package/docs/find-replace.md +26 -0
  118. package/docs/list-mode.md +86 -0
  119. package/docs/local.md +94 -0
  120. package/docs/quick-start.md +221 -0
  121. package/docs/sheets.md +61 -0
  122. package/docs/toolbar.md +72 -0
  123. package/docs/validation.md +41 -0
  124. package/docs/view.md +50 -0
  125. package/package.json +92 -4
@@ -0,0 +1,107 @@
1
+ import type { CellPosition } from 'xlcalc/contract';
2
+ import type { SheetMessages } from '../contract/messages.js';
3
+ import type { SheetFilter, SheetInfo, SheetSource } from '../contract/source.js';
4
+ import type { SheetFailure, SheetViewProps } from '../contract/view.js';
5
+ /** The source's methods by name, optional ones too. */
6
+ export type SourceMethod = {
7
+ [K in keyof SheetSource]-?: NonNullable<SheetSource[K]> extends (...args: never[]) => unknown ? K : never;
8
+ }[keyof SheetSource];
9
+ export declare function createState(props: SheetViewProps): {
10
+ props: SheetViewProps;
11
+ source: () => SheetSource;
12
+ sourceMethod: <K extends SourceMethod>(name: K) => NonNullable<SheetSource[K]> | null;
13
+ outdated: () => () => boolean;
14
+ endWorkbook: () => undefined;
15
+ messages: import("vue").ComputedRef<SheetMessages>;
16
+ locale: import("vue").ComputedRef<string>;
17
+ memory: import("./storage.js").Memory;
18
+ editable: import("vue").ComputedRef<boolean>;
19
+ sheets: import("vue").ShallowRef<SheetInfo[], SheetInfo[]>;
20
+ active: import("vue").Ref<number, number>;
21
+ sheet: import("vue").ComputedRef<SheetInfo | null>;
22
+ sheetName: import("vue").ComputedRef<string>;
23
+ grown: import("vue").Ref<{
24
+ rows: number;
25
+ cols: number;
26
+ }, {
27
+ rows: number;
28
+ cols: number;
29
+ } | {
30
+ rows: number;
31
+ cols: number;
32
+ }>;
33
+ reach: import("vue").Ref<{
34
+ rows: number;
35
+ cols: number;
36
+ }, {
37
+ rows: number;
38
+ cols: number;
39
+ } | {
40
+ rows: number;
41
+ cols: number;
42
+ }>;
43
+ dataRows: import("vue").ComputedRef<number>;
44
+ dataCols: import("vue").ComputedRef<number>;
45
+ visible: import("vue").ShallowRef<{
46
+ key: string;
47
+ spec: SheetFilter;
48
+ rows: Int32Array;
49
+ index: Int32Array;
50
+ } | null, {
51
+ key: string;
52
+ spec: SheetFilter;
53
+ rows: Int32Array;
54
+ index: Int32Array;
55
+ } | null>;
56
+ filterWait: import("vue").Ref<boolean, boolean>;
57
+ rowOf: (d: number) => number;
58
+ indexOf: (r: number) => number | undefined;
59
+ dataShown: import("vue").ComputedRef<number>;
60
+ rowCount: import("vue").ComputedRef<number>;
61
+ lastRow: import("vue").ComputedRef<number>;
62
+ colCount: import("vue").ComputedRef<number>;
63
+ failure: import("vue").ShallowRef<SheetFailure | null, SheetFailure | null>;
64
+ failureOf: (error: unknown) => SheetFailure;
65
+ loading: import("vue").Ref<boolean, boolean>;
66
+ scroller: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
67
+ scrollTop: import("vue").Ref<number, number>;
68
+ scrollLeft: import("vue").Ref<number, number>;
69
+ viewH: import("vue").Ref<number, number>;
70
+ viewW: import("vue").Ref<number, number>;
71
+ bookWidths: import("vue").ShallowRef<Map<number, number | null>, Map<number, number | null>>;
72
+ userWidths: import("vue").ShallowRef<Record<number, number>, Record<number, number>>;
73
+ heights: import("vue").ShallowRef<Map<number, number>, Map<number, number>>;
74
+ defaultRowPx: import("vue").Ref<number, number>;
75
+ selected: import("vue").Ref<{
76
+ row: number;
77
+ col: number;
78
+ } | null, CellPosition | {
79
+ row: number;
80
+ col: number;
81
+ } | null>;
82
+ extent: import("vue").Ref<{
83
+ row: number;
84
+ col: number;
85
+ } | null, CellPosition | {
86
+ row: number;
87
+ col: number;
88
+ } | null>;
89
+ anchor: import("vue").Ref<{
90
+ row: number;
91
+ col: number;
92
+ } | null, CellPosition | {
93
+ row: number;
94
+ col: number;
95
+ } | null>;
96
+ hooks: {
97
+ unfilter: (_row: number) => void;
98
+ changing: () => void;
99
+ };
100
+ focusGrid: () => void;
101
+ scrollGridTo: (top: number, left: number) => void;
102
+ grow: (row: number, col: number) => void;
103
+ stretch: (row: number, col: number) => void;
104
+ };
105
+ export type SheetState = ReturnType<typeof createState>;
106
+ /** Signals for reads of the displayed sheet (a series of windows): each new one aborts the previous, and so do another sheet and unmounting the sheet. */
107
+ export declare function useSheetReads(s: SheetState): () => AbortSignal;
@@ -0,0 +1,6 @@
1
+ export interface Memory {
2
+ recall<T>(name: string): T | null;
3
+ remember(name: string, value: unknown): void;
4
+ }
5
+ /** Storage over `localStorage` under `storageKey()`, or an in-memory map when the host provides no key. */
6
+ export declare function createMemory(storageKey: () => string | undefined): Memory;
@@ -0,0 +1,16 @@
1
+ import type { Selection } from './selection.js';
2
+ import type { SheetState } from './state.js';
3
+ import type { Windows } from './windows.js';
4
+ /** A selection's display rows: a run of them without a filter (an entire column is a million), otherwise the filter's list. */
5
+ export type ShownRows = {
6
+ from: number;
7
+ to: number;
8
+ } | number[];
9
+ /** The rows as a list, for what needs each one (a copy's text). */
10
+ export declare const listOf: (ds: ShownRows) => number[];
11
+ export declare function useTotals(s: SheetState, w: Windows, sel: Selection): {
12
+ statsText: import("vue").ComputedRef<string>;
13
+ shownRows: (r1: number, r2: number) => ShownRows;
14
+ inWindows: (ds: ShownRows, c1: number, c2: number) => boolean;
15
+ };
16
+ export type Totals = ReturnType<typeof useTotals>;
@@ -0,0 +1,95 @@
1
+ import type { SheetSource, SheetValidation, SheetValidationAlert } from '../contract/source.js';
2
+ /** How long the active cell stays before its rule is requested: holding an arrow key down a column requests once, at the end. */
3
+ export declare const VALIDATION_DELAY_MS = 60;
4
+ /** Items the list displays at once, as in Excel; Page Up and Page Down move by them. */
5
+ export declare const LIST_ROWS = 8;
6
+ export interface ValidationPlace {
7
+ sheet: string;
8
+ cell: string;
9
+ }
10
+ export interface ValidationDeps {
11
+ source: () => SheetSource;
12
+ sheet: () => string;
13
+ /** The active cell; null for none. */
14
+ active: () => {
15
+ row: number;
16
+ col: number;
17
+ } | null;
18
+ /** The active cell's displayed text: the list opens at the item equal to it. */
19
+ text?: () => string;
20
+ /** An item chosen from the list (a click, Enter), by its text and position in the list: the sheet enters it into the cell. */
21
+ pick: (text: string, place: ValidationPlace, item: number) => void;
22
+ }
23
+ /** The active cell's rule as Excel displays it: requested from the source once the cell stays, an older response discarded, and the list's state. */
24
+ export declare function useValidation(deps: ValidationDeps): {
25
+ current: import("vue").ShallowRef<SheetValidation | null, SheetValidation | null>;
26
+ place: import("vue").ShallowRef<ValidationPlace | null, ValidationPlace | null>;
27
+ list: import("vue").ComputedRef<string[] | null>;
28
+ prompt: import("vue").ComputedRef<{
29
+ title?: string;
30
+ text: string;
31
+ } | null>;
32
+ open: import("vue").Ref<boolean, boolean>;
33
+ index: import("vue").Ref<number, number>;
34
+ refresh: (wait?: number) => void;
35
+ openList: () => boolean;
36
+ close: () => void;
37
+ toggle: () => boolean | void;
38
+ choose: (i?: number) => boolean;
39
+ onKey: (e: KeyboardEvent) => boolean;
40
+ };
41
+ export type Validation = ReturnType<typeof useValidation>;
42
+ /** The sheet's own prompt for a formula that cannot be parsed: Fix reopens the editor, Restore leaves the cell unchanged, so Enter or a click elsewhere is a way out. */
43
+ export interface FormulaAlert {
44
+ severity: 'formula';
45
+ title?: undefined;
46
+ /** The source's reason. */
47
+ message: string;
48
+ sheet: string;
49
+ cell: string;
50
+ }
51
+ /** Excel's warning before cells containing more than one value are merged: OK merges, Cancel leaves them. */
52
+ export interface MergeAlert {
53
+ severity: 'merge';
54
+ title?: undefined;
55
+ /** The warning's text. */
56
+ message: string;
57
+ sheet: string;
58
+ cell: string;
59
+ }
60
+ /** Excel's dialog for an unclosed formula that it offers to correct: Yes enters the correction, No (or Esc) says what is missing. */
61
+ export interface TypoAlert {
62
+ severity: 'typo';
63
+ title?: undefined;
64
+ /** The question with the correction. */
65
+ message: string;
66
+ sheet: string;
67
+ cell: string;
68
+ }
69
+ /** Excel's message after No to a correction, with OK only: the editor reopens with the typed text. */
70
+ export interface ParenthesisAlert {
71
+ severity: 'parenthesis';
72
+ title?: undefined;
73
+ message: string;
74
+ sheet: string;
75
+ cell: string;
76
+ }
77
+ /** What the alert displays: a rule's rejection, the prompt for a formula, Excel's correction of one and what is missing, or the warning before a merge. */
78
+ export type SheetAlert = SheetValidationAlert | FormulaAlert | TypoAlert | ParenthesisAlert | MergeAlert;
79
+ /** What the user's answer to an alert does with the rejected edit: send it again with `accept`, reopen the editor with the text, or leave the cell unchanged. */
80
+ export type AlertAnswer = 'accept' | 'retry' | 'cancel';
81
+ export type AlertButton = 'retry' | 'cancel' | 'yes' | 'no' | 'ok' | 'fix' | 'revert';
82
+ /** Excel's alert buttons by style, in Excel's order, and the answer each gives (Help is omitted); the formula prompt's buttons after them. */
83
+ export declare const ALERT_BUTTONS: Record<SheetAlert['severity'], {
84
+ button: AlertButton;
85
+ answer: AlertAnswer;
86
+ }[]>;
87
+ /** The button an alert opens with, which Enter presses: Retry, No (a warning keeps a value only on a click on Yes), OK; Yes for Excel's correction. */
88
+ export declare const ALERT_DEFAULT: Record<SheetAlert['severity'], AlertButton>;
89
+ /** The alert for a rejected value: shown until the user answers; one at a time, and a new one answers the old one with Cancel. */
90
+ export declare function useValidationAlert(): {
91
+ alert: import("vue").ShallowRef<SheetAlert | null, SheetAlert | null>;
92
+ ask: (next: SheetAlert) => Promise<AlertAnswer>;
93
+ answer: (a: AlertAnswer) => void;
94
+ };
95
+ export type ValidationAlertState = ReturnType<typeof useValidationAlert>;
@@ -0,0 +1,83 @@
1
+ import { type ComputedRef, type Ref } from 'vue';
2
+ import type { SheetInfo } from '../contract/source.js';
3
+ import type { Geometry } from './geometry.js';
4
+ import type { Memory } from './storage.js';
5
+ /** The height of the column letters row (fixed in CSS); frozen rows stick below it. */
6
+ export declare const HEAD_H = 24;
7
+ interface ViewportInput {
8
+ sheet: ComputedRef<SheetInfo | null>;
9
+ /** The display filter in effect: its rows are not the sheet's rows in order, so the row outline bar is not drawn. */
10
+ visible: Readonly<Ref<object | null>>;
11
+ rowCount: ComputedRef<number>;
12
+ colCount: ComputedRef<number>;
13
+ scrollTop: Ref<number>;
14
+ scrollLeft: Ref<number>;
15
+ viewH: Ref<number>;
16
+ viewW: Ref<number>;
17
+ memory: Memory;
18
+ }
19
+ export declare function useViewport(i: ViewportInput, geo: Geometry): {
20
+ showNums: ComputedRef<boolean>;
21
+ narrow: ComputedRef<boolean>;
22
+ touch: ComputedRef<boolean>;
23
+ numW: ComputedRef<number>;
24
+ outlineSlots: ComputedRef<{
25
+ rows: number;
26
+ cols: number;
27
+ }>;
28
+ slotPx: ComputedRef<16 | 22>;
29
+ barW: ComputedRef<number>;
30
+ barH: ComputedRef<number>;
31
+ headH: ComputedRef<number>;
32
+ footH: ComputedRef<0 | 24>;
33
+ leadW: ComputedRef<number>;
34
+ bookFreeze: ComputedRef<boolean>;
35
+ freezeOn: ComputedRef<boolean>;
36
+ readFreeze: () => boolean | null;
37
+ toggleFreeze: () => void;
38
+ showFreeze: (sheet: string, on: boolean) => void;
39
+ middlePanes: () => {
40
+ rows: number;
41
+ cols: number;
42
+ };
43
+ frozenRows: ComputedRef<number>;
44
+ frozenCols: ComputedRef<number>;
45
+ frozenH: ComputedRef<number>;
46
+ frozenW: ComputedRef<number>;
47
+ frozenRowList: ComputedRef<number[]>;
48
+ frozenColList: ComputedRef<number[]>;
49
+ stickyTop: (d: number) => string;
50
+ stickyLeft: (c: number) => string;
51
+ firstRow: ComputedRef<number>;
52
+ lastRow: ComputedRef<number>;
53
+ firstCol: ComputedRef<number>;
54
+ lastCol: ComputedRef<number>;
55
+ shownRows: ComputedRef<number[]>;
56
+ shownCols: ComputedRef<number[]>;
57
+ topPad: ComputedRef<number>;
58
+ bottomPad: ComputedRef<number>;
59
+ leftPad: ComputedRef<number>;
60
+ rightPad: ComputedRef<number>;
61
+ tableWidth: ComputedRef<number>;
62
+ boxOf: (d1: number, c1: number, d2: number, c2: number) => {
63
+ top: number;
64
+ left: number;
65
+ width: number;
66
+ height: number;
67
+ frozen: boolean;
68
+ };
69
+ viewBox: ComputedRef<{
70
+ top: number;
71
+ left: number;
72
+ width: number;
73
+ height: number;
74
+ }>;
75
+ cellAt: (px: number, py: number) => {
76
+ d: number;
77
+ col: number;
78
+ x: number;
79
+ y: number;
80
+ };
81
+ };
82
+ export type Viewport = ReturnType<typeof useViewport>;
83
+ export {};
@@ -0,0 +1,102 @@
1
+ import { type ShallowRef } from 'vue';
2
+ import type { CellRect, CellStyle, CellValue, ConditionalAppearance } from 'xlcalc/contract';
3
+ import type { CellUpdate, SheetWindow } from '../contract/source.js';
4
+ import { type Geometry } from './geometry.js';
5
+ import type { SheetState } from './state.js';
6
+ import type { Viewport } from './viewport.js';
7
+ export type SlotKind = 'body' | 'top' | 'left';
8
+ /** A window's range by display rows. */
9
+ interface Area {
10
+ row: number;
11
+ rows: number;
12
+ col: number;
13
+ cols: number;
14
+ }
15
+ /** The pending request: its view and range (a repaint may overlap it), whether it re-reads a drawn window in place, and the changes that arrived meanwhile. */
16
+ interface Asked extends Area {
17
+ view: string;
18
+ /** An on-screen window re-read for a repaint: it stays drawn meanwhile, so there is no loading indicator. */
19
+ quiet: boolean;
20
+ /** Cell updates that arrived while the request was pending: the response may have been read before them, so they are applied over it. */
21
+ missed: CellUpdate[];
22
+ }
23
+ /** One window: what is loaded, the pending request and the one already answered (so neither repeats). */
24
+ export interface Slot {
25
+ /** The sheet and filter the window was requested under: another filter means other rows. */
26
+ view: string;
27
+ win: SheetWindow | null;
28
+ rows: number;
29
+ cols: number;
30
+ /** The window's merged ranges and the sheet's tables, read once when it arrives. */
31
+ merges: CellRect[];
32
+ tables: SheetTable[];
33
+ pendingKey: string;
34
+ servedKey: string;
35
+ ctrl: AbortController | null;
36
+ asked: Asked | null;
37
+ /** A repaint overlapped the window: it is re-read, drawn as is until the response arrives. */
38
+ stale: boolean;
39
+ }
40
+ /** A table of the sheet with its range parsed. */
41
+ export type SheetTable = NonNullable<SheetWindow['tables']>[number] & {
42
+ rect: CellRect;
43
+ };
44
+ /** Everything a cell has in its window, for drawing it. */
45
+ export interface CellData {
46
+ text: string;
47
+ value: CellValue | undefined;
48
+ style: CellStyle | undefined;
49
+ formula: string | undefined;
50
+ color: string | undefined;
51
+ link: NonNullable<SheetWindow['links']>[string] | undefined;
52
+ note: NonNullable<SheetWindow['notes']>[string] | undefined;
53
+ /** The cell's conditional formatting. */
54
+ look: ConditionalAppearance | undefined;
55
+ /** A list mode drill-down: marked in its window's `drill` and not empty. */
56
+ drill: boolean;
57
+ loaded: boolean;
58
+ }
59
+ export declare function useWindows(s: SheetState, v: Viewport, geo: Geometry): {
60
+ slots: Record<SlotKind, ShallowRef<Slot>>;
61
+ viewKey: () => string;
62
+ revision: ShallowRef<number, number>;
63
+ slotAt: (d: number, col: number) => Slot | null;
64
+ textAt: (d: number, col: number) => string;
65
+ styleAt: (d: number, col: number, addr: string) => CellStyle | undefined;
66
+ cellData: (d: number, col: number, addr: string) => CellData;
67
+ emptyAt: (d: number, col: number) => boolean;
68
+ textOfRow: (r: number, col: number) => string;
69
+ drillOfRow: (r: number, col: number) => boolean;
70
+ valueOfRow: (r: number, col: number) => CellValue | undefined;
71
+ formulaOfRow: (r: number, col: number) => string | undefined;
72
+ emptyAtRow: (r: number, col: number) => boolean;
73
+ editTextOfRow: (r: number, col: number) => string | undefined;
74
+ lookOfRow: (r: number, col: number) => {
75
+ style?: CellStyle;
76
+ numberFormat?: string;
77
+ } | null;
78
+ merges: import("vue").ComputedRef<CellRect[]>;
79
+ tables: import("vue").ComputedRef<SheetTable[]>;
80
+ notice: import("vue").ComputedRef<string>;
81
+ wait: import("vue").Ref<{
82
+ since: number;
83
+ elapsedMs: number;
84
+ } | null, {
85
+ since: number;
86
+ elapsedMs: number;
87
+ } | {
88
+ since: number;
89
+ elapsedMs: number;
90
+ } | null>;
91
+ waitSeconds: import("vue").Ref<number, number>;
92
+ ensure: () => void;
93
+ reset: () => void;
94
+ resetSizes: () => void;
95
+ applyChanges: (changes: CellUpdate[]) => void;
96
+ repaint: (ranges: {
97
+ sheet: string;
98
+ range: string;
99
+ }[]) => void;
100
+ };
101
+ export type Windows = ReturnType<typeof useWindows>;
102
+ export {};
@@ -0,0 +1,3 @@
1
+ export type Entry = typeof import('xlcalc/entry');
2
+ /** The module, imported once; a failed import is retried on the next call. */
3
+ export declare function loadEntry(): Promise<Entry>;
@@ -0,0 +1,5 @@
1
+ import type { EditOutcome } from './contract/source.js';
2
+ /** An error's message; '' for anything else, where the caller describes the failure in its own words. */
3
+ export declare const errorText: (e: unknown) => string;
4
+ /** The outcome of a call that threw: failed, with the error's message. */
5
+ export declare const failedOutcome: (e: unknown) => EditOutcome;
@@ -0,0 +1,3 @@
1
+ import type { SheetFilter } from './contract/source.js';
2
+ /** A filter's stable key, for caching its row list. */
3
+ export declare const filterKey: (f: SheetFilter) => string;
@@ -0,0 +1,24 @@
1
+ import type { FindRequest, FindResult } from './contract/source.js';
2
+ /** Visits every cell a search reads with its text (what it opens with, or its displayed text), in any order. */
3
+ export type EachCell = (visit: (row: number, col: number, text: string) => void) => void;
4
+ /** A cell and its text: a match, or a cell Replace All writes. */
5
+ export interface CellText {
6
+ row: number;
7
+ col: number;
8
+ text: string;
9
+ }
10
+ /** Excel's cell order for Find: row by row, or column by column. */
11
+ export declare const cellOrder: (byColumns: boolean | undefined) => (a: {
12
+ row: number;
13
+ col: number;
14
+ }, b: {
15
+ row: number;
16
+ col: number;
17
+ }) => number;
18
+ /** The cells whose text matches, in Excel's order from the first after `req.after`, wrapping around at the end, at most `max` of them; `total` counts them all. */
19
+ export declare function findCells(each: EachCell, req: FindRequest, visible: Set<number> | null, max: number): FindResult;
20
+ /**
21
+ * Replace All's new texts: each cell the request finds with its new text, in Excel's order. Cells whose text would not
22
+ * change are omitted: written again, an in-memory cell would lose the displayed text it was given.
23
+ */
24
+ export declare function replaceCells(each: EachCell, req: FindRequest, by: string, visible: Set<number> | null): CellText[];
@@ -0,0 +1,85 @@
1
+ import type { AlignmentStyle, BorderLine, FontStyle, FormatChoice, NumberFormat } from 'xlcalc/contract';
2
+ import type { SheetFormatPatch, SheetViewState } from './contract/view.js';
3
+ import { type BorderEdge, type EdgeLines } from './toolbar.js';
4
+ export type FormatTab = 'number' | 'alignment' | 'font' | 'border' | 'fill';
5
+ export declare const FORMAT_TABS: readonly FormatTab[];
6
+ type Horizontal = NonNullable<AlignmentStyle['horizontal']>;
7
+ type Vertical = NonNullable<AlignmentStyle['vertical']>;
8
+ export declare const HORIZONTALS: readonly Horizontal[];
9
+ export declare const VERTICALS: readonly Vertical[];
10
+ /** Excel's indent applies with the left, right and distributed alignments. */
11
+ export declare const INDENTED: ReadonlySet<string>;
12
+ /** The line styles Excel's Border tab offers, in the order of its list. */
13
+ export declare const LINE_STYLES: readonly BorderLine['style'][];
14
+ type FontStyleKind = 'regular' | 'italic' | 'bold' | 'boldItalic';
15
+ type Underline = 'none' | NonNullable<FontStyle['underline']>;
16
+ /** The font styles and underlines in the order of Excel's lists. */
17
+ export declare const FONT_STYLES: readonly FontStyleKind[];
18
+ export declare const UNDERLINES: readonly Underline[];
19
+ /** Excel's font sizes in its list; any size from 1 to 409 may be typed. */
20
+ export declare const FONT_SIZES: readonly number[];
21
+ /** Fonts offered in the font input's list; any name may be typed. */
22
+ export declare const FONT_NAMES: readonly string[];
23
+ /** The dialog's inputs; text inputs hold what is typed until OK parses them. */
24
+ export interface FormatDraft {
25
+ /** The code the cells are displayed with: an item's from Excel's list, or a typed one (the box names its category). */
26
+ numberCode: string;
27
+ /** What OK sets: an item's format (a built-in one by number), or the typed code; null leaves the format unchanged. */
28
+ numberFormat: NumberFormat | null;
29
+ horizontal: Horizontal;
30
+ vertical: Vertical;
31
+ wrap: boolean;
32
+ indent: string;
33
+ fontName: string;
34
+ fontSize: string;
35
+ fontStyle: FontStyleKind;
36
+ underline: Underline;
37
+ strike: boolean;
38
+ /** null: Automatic. */
39
+ fontColour: string | null;
40
+ /** null: No Color. */
41
+ fill: string | null;
42
+ /** The line the Border tab's buttons draw with. */
43
+ line: BorderLine;
44
+ /** Edges as the Border tab set them; an edge not listed stays unchanged. */
45
+ edges: EdgeLines;
46
+ }
47
+ /** The dialog as it opened: the inputs, the range it formats and what its edges were (known for one cell, unknown for a range). */
48
+ export interface FormatStart {
49
+ draft: FormatDraft;
50
+ ref: string;
51
+ /** One cell: the inside edges are off, and the outline is the cell's own sides. */
52
+ single: boolean;
53
+ edges: EdgeLines;
54
+ }
55
+ /** The inputs as the active cell's formatting fills them: its style, its number format's code, and Excel's thin black line to draw with. */
56
+ export declare function startOf(state: SheetViewState): FormatStart;
57
+ /** The edges the selection has: a single cell has no inside lines. */
58
+ export declare const edgesIn: (start: FormatStart) => BorderEdge[];
59
+ /** What an edge shows now: as set in the dialog, otherwise as it was; undefined where that is not known. */
60
+ export declare const shownEdge: (start: FormatStart, draft: FormatDraft, e: BorderEdge) => BorderLine | null | undefined;
61
+ /** An edge's button, as in Excel: puts the line on it, or turns it off when it already has that line. */
62
+ export declare function pressEdge(start: FormatStart, draft: FormatDraft, e: BorderEdge): void;
63
+ /** Excel's presets: None removes every line, Outline and Inside draw the line around the selection or inside it. */
64
+ export declare function pressPreset(start: FormatStart, draft: FormatDraft, preset: 'none' | 'outline' | 'inside'): void;
65
+ /** An input OK cannot parse, by its name: the code, the indent, the size. */
66
+ interface DraftErrors {
67
+ numberCode?: true;
68
+ indent?: true;
69
+ fontSize?: true;
70
+ }
71
+ /** Excel's limits: a font of 1 to 409 points, an indent of 0 to 250, and a non-empty code of the cell's own. */
72
+ export declare function draftErrors(draft: FormatDraft): DraftErrors;
73
+ /** An item from Excel's list: its format, and its code in the input to edit from there, as Excel's Custom starts. */
74
+ export declare function pickNumber(draft: FormatDraft, item: FormatChoice): void;
75
+ /** A code typed into the input: OK sets it as written. */
76
+ export declare function typeNumber(draft: FormatDraft, code: string): void;
77
+ /** An alignment chosen in the list; one without an indent resets it to 0, as Excel grays out the input. */
78
+ export declare function setHorizontal(draft: FormatDraft, h: string): void;
79
+ /**
80
+ * OK's patches: one over the selection with the changes to the font, the alignment, the fill and the number format, and
81
+ * the Border tab's edges on their ranges, all for one call and so a single undo step; none when nothing changed. An input
82
+ * reset to its default removes the cell's own setting (null), as Excel stores no defaults.
83
+ */
84
+ export declare function patchesOf(start: FormatStart, draft: FormatDraft): SheetFormatPatch[];
85
+ export {};
@@ -0,0 +1,5 @@
1
+ import { type Ref } from 'vue';
2
+ /** Below this width a viewport counts as a phone's: narrower row numbers, the toolbar's buttons in a menu. */
3
+ export declare const NARROW_PX = 600;
4
+ /** Whether the pointer is touch (`pointer: coarse`), following the media query until the scope ends. */
5
+ export declare function useCoarsePointer(): Ref<boolean>;
@@ -0,0 +1,3 @@
1
+ import type { FormulaReference, GridReference } from 'xlcalc/contract';
2
+ /** Whether a reference found by `scanReferences` is one the grid displays: not a table reference, not across several sheets. */
3
+ export declare const isGridRef: (r: FormulaReference) => r is GridReference;
@@ -0,0 +1,6 @@
1
+ export { default as SheetView } from './components/SheetView.vue.js';
2
+ export { default as SheetToolbar } from './components/SheetToolbar.vue.js';
3
+ export { default as FormatDialog } from './components/FormatDialog.vue.js';
4
+ export type * from './contract.js';
5
+ export { enMessages, ruMessages } from './messages.js';
6
+ export { memorySource } from './memory-source.js';