pivotkit-react 0.5.0 → 0.6.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 (42) hide show
  1. package/CHANGELOG.md +118 -2
  2. package/README.md +4 -1
  3. package/dist/chunks/{chunk-2AT72SLA.js → chunk-3LDE2GPG.js} +58 -34
  4. package/dist/chunks/{chunk-RIOSIYGC.js → chunk-JOWAEZAD.js} +6 -4
  5. package/dist/chunks/{chunk-U5Q5I2D5.js → chunk-TR2HROIK.js} +10 -3
  6. package/dist/chunks/chunk-W2KIPREL.js +36 -0
  7. package/dist/chunks/{chunk-3WUGQPWV.js → chunk-XN5HNKJ2.js} +10 -95
  8. package/dist/chunks/{chunk-4RS72AAA.js → chunk-YXLANLGL.js} +8 -2
  9. package/dist/chunks/{chunk-3E4NB5RZ.js → chunk-ZK5RVCHP.js} +21 -3
  10. package/dist/import-ui.js +68 -174
  11. package/dist/index.js +75 -28
  12. package/dist/labels.js +4 -4
  13. package/dist/menu-texts-de.js +1 -1
  14. package/dist/menus.js +338 -82
  15. package/dist/styles.css +1 -1
  16. package/package.json +3 -3
  17. package/types/drill-export.d.ts +3 -2
  18. package/types/drill-panel.d.ts +4 -2
  19. package/types/export-run.d.ts +8 -3
  20. package/types/export-scope.d.ts +47 -0
  21. package/types/field-info.d.ts +3 -10
  22. package/types/import-host.d.ts +37 -8
  23. package/types/import-labels.d.ts +20 -3
  24. package/types/import-module.d.ts +1 -1
  25. package/types/import-run.d.ts +0 -8
  26. package/types/import-steps.d.ts +8 -0
  27. package/types/import-ui.d.ts +21 -4
  28. package/types/index.d.ts +59 -12
  29. package/types/labels.d.ts +2 -22
  30. package/types/menu-fields.d.ts +9 -0
  31. package/types/menu-labels.d.ts +6 -0
  32. package/types/menu-ops.d.ts +28 -3
  33. package/types/names.d.ts +22 -8
  34. package/types/share-actions.d.ts +14 -0
  35. package/types/sheet-views.d.ts +60 -0
  36. package/types/templates.d.ts +21 -1
  37. package/types/toolbar-panels.d.ts +13 -6
  38. package/types/use-export.d.ts +2 -2
  39. package/types/view-history.d.ts +15 -0
  40. package/types/view-save.d.ts +10 -6
  41. package/types/view-store.d.ts +21 -11
  42. package/types/import-source.d.ts +0 -32
@@ -121,14 +121,16 @@ export declare const RULE_TYPES: readonly string[];
121
121
  export declare const RULES_MAX = 10;
122
122
  /**
123
123
  * Replaces one rule of a field, `previous` (the view's own entry, matched by its content), with
124
- * `entry` (a filter of RULE_TYPES), removes it when `entry` is null, or adds `entry` after the field's
125
- * other filters without `previous`.
124
+ * `entry` (a filter of RULE_TYPES), removes it when `entry` is null, or adds `entry` without
125
+ * `previous`: before the rule `before` (a rule emptied and typed again keeps its place among the
126
+ * others), else after the field's other filters.
126
127
  * @param {any} view
127
128
  * @param {string} field
128
129
  * @param {object | null} previous
129
130
  * @param {object | null} entry
131
+ * @param {object | null} [before]
130
132
  */
131
- export declare const setRule: (view: any, field: string, previous: object | null, entry: object | null) => any;
133
+ export declare const setRule: (view: any, field: string, previous: object | null, entry: object | null, before?: object | null) => any;
132
134
  /** The units of a date's quick choices, finest first (hours are left to a view's own filters). */
133
135
  export declare const QUICK_UNITS: readonly string[];
134
136
  /**
@@ -405,3 +407,26 @@ export declare function rowsInRange(range: {
405
407
  from: string | null;
406
408
  to: string;
407
409
  }, dict: ArrayLike<unknown>, counts: ArrayLike<number>): number;
410
+ /**
411
+ * The years Years combined keeps, in the Filter level's summary: "2024–2025 combined" for years in a
412
+ * row (all of them, or a run), else listed; "2026 only" for one; each year as the table writes it.
413
+ * @param {number[]} on the years kept, ascending
414
+ * @param {number[]} all the years of the data
415
+ * @param {any} labels
416
+ * @param {string} locale
417
+ */
418
+ export declare function combinedYearsText(on: number[], all: number[], labels: any, locale: string): string;
419
+ /** Whether the day of `a` (an ISO day or minute) is on or before the day of `b`, by their ms. */
420
+ export declare const dayOnOrBefore: (a: any, b: any) => boolean;
421
+ /**
422
+ * An ISO day (or minute) as an `<input type="date">` holds it: the year with four or more digits and
423
+ * no sign ("10000-01-01" of "+010000-01-01"); "" for a year before 1, which the field cannot hold.
424
+ * @param {string} iso
425
+ */
426
+ export declare const dateInputValue: (iso: string) => string;
427
+ /**
428
+ * What an `<input type="date">` holds as an ISO day ("+010000-01-01" of "10000-01-01"), or null while
429
+ * it is no whole day of a year from 1 that a Date holds.
430
+ * @param {string} text
431
+ */
432
+ export declare function dateFromInput(text: string): string | null;
package/types/names.d.ts CHANGED
@@ -43,9 +43,22 @@ export declare function valueConditionText(view: any, f: {
43
43
  value: number;
44
44
  value2?: number;
45
45
  }, labels: import("./labels.js").UiLabels, locale: string): any;
46
- /** A calendar day ("2022-03-01") as the locale writes a date. */
46
+ /** Wall-clock ms of an ISO day (or of a minute's day). */
47
+ export declare const dayMs: (iso: any) => number;
48
+ /** The year of an ISO day: 2026 of "2026-03-01", -1 of "-000001-01-11". */
49
+ export declare const yearOf: (iso: any) => number;
50
+ /** A year as an ISO day writes it: "0002", "2026", "-000001", "+010000". */
51
+ export declare const isoYear: (y: any) => string;
52
+ /**
53
+ * A year as the table writes it (pivotkit-core's year grouping): "2026", before 1 AD with its era
54
+ * ("2 BC", "2 v. Chr."), always in the Gregorian calendar.
55
+ * @param {number} y astronomical: 0 is 1 BC
56
+ * @param {string} locale
57
+ */
58
+ export declare const yearText: (y: number, locale: string) => string;
59
+ /** A calendar day ("2022-03-01") as the locale writes a date, a year before 1 AD with its era (pivotkit-core's `date` format). */
47
60
  export declare const dayText: (iso: any, locale: any) => string;
48
- /** A calendar day of wall-clock ms ("2022-03-01"), as a date column holds dates. */
61
+ /** A calendar day of wall-clock ms ("2022-03-01", "-000001-01-11"), as a date column holds dates. */
49
62
  export declare const isoDay: (ms: any) => string;
50
63
  /**
51
64
  * The days a relative filter keeps, both included (pivotkit-core's relativeDateRange): counted back
@@ -95,7 +108,7 @@ export declare const plainRange: (f: {
95
108
  export declare function periodText(range: {
96
109
  from: string;
97
110
  to: string;
98
- }, unit: string, locale: string): any;
111
+ }, unit: string, locale: string): string;
99
112
  /**
100
113
  * The days a relative date range keeps, as the unit writes them: "2022–2026" for years, "Dec
101
114
  * 2025–Nov 2026" for months, dates for days; one period alone ("2026"); "" for no range.
@@ -109,7 +122,7 @@ export declare function rangeText(f: {
109
122
  unit: string;
110
123
  count: number;
111
124
  anchor?: string;
112
- }, locale: string, timeZone: string, now?: Date | number | string, latest?: number | null): any;
125
+ }, locale: string, timeZone: string, now?: Date | number | string, latest?: number | null): string;
113
126
  /**
114
127
  * The data's share of a range: which of its days have data and which have none. Null when the data
115
128
  * cover the whole range; `none` when they cover none of it; else the days with data (`data`) and
@@ -160,11 +173,12 @@ export declare function relativeText(f: {
160
173
  max: number;
161
174
  } | null, weekStart?: number): any;
162
175
  /**
163
- * The years two calendar days bound as whole years (Jan 1 to Dec 31), or null: the days a comparison
164
- * on a date grouping's source dates gets from Years combined.
165
- * @returns {[string, string] | null}
176
+ * The years two calendar days bound as whole years (Jan 1 to Dec 31; in the first and last year a
177
+ * Date holds, its first and last day), or null: the days a comparison on a date grouping's source
178
+ * dates gets from Years combined.
179
+ * @returns {[number, number] | null}
166
180
  */
167
- export declare function wholeYears(from: any, to: any): [string, string] | null;
181
+ export declare function wholeYears(from: any, to: any): [number, number] | null;
168
182
  /**
169
183
  * A comparison of the item itself in short: "from 2022", "2022 to 2024" for a date or a date
170
184
  * grouping, "≥ 10" for a number. `labelOf` gives an item's label (a grouping's "Mar 2025").
@@ -17,6 +17,17 @@ export type ShareContext = {
17
17
  viewName: string | null;
18
18
  sourceId: string | undefined;
19
19
  sourceName: string | undefined;
20
+ /**
21
+ * the source's params the files and links carry (a loaded workbook's sheet)
22
+ */
23
+ sourceParams: Record<string, string> | undefined;
24
+ /**
25
+ * a view file made on another sheet of the workbook shown: reads that sheet, then loads `file` on it ("switch" when that started)
26
+ */
27
+ viaSheet: ((made: {
28
+ id?: string | null;
29
+ sheet?: string | null;
30
+ }, name: string, file: object) => "switch" | "missing" | "none") | undefined;
20
31
  /**
21
32
  * the `$schema` of the view files (the prop)
22
33
  */
@@ -61,6 +72,9 @@ export type ShareContext = {
61
72
  * @property {string | null} viewName the loaded view's name
62
73
  * @property {string | undefined} sourceId
63
74
  * @property {string | undefined} sourceName
75
+ * @property {Record<string, string> | undefined} sourceParams the source's params the files and links carry (a loaded workbook's sheet)
76
+ * @property {((made: { id?: string | null, sheet?: string | null }, name: string, file: object) => "switch" | "missing" | "none") | undefined} viaSheet
77
+ * a view file made on another sheet of the workbook shown: reads that sheet, then loads `file` on it ("switch" when that started)
64
78
  * @property {string | null | undefined} schemaUrl the `$schema` of the view files (the prop)
65
79
  * @property {import("pivotkit-core").Encoded} encoded
66
80
  * @property {boolean | string | undefined} shareLink the prop: the base of the link
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The file name part of a loaded file's source id, or null for another id (a host's data).
3
+ * @param {string | null | undefined} id
4
+ */
5
+ export declare function fileOfId(id: string | null | undefined): string | null;
6
+ /**
7
+ * The sheet a view's source names, or null.
8
+ * @param {unknown} source a view file's source ({ id, params })
9
+ * @returns {string | null}
10
+ */
11
+ export declare function sheetOfSource(source: unknown): string | null;
12
+ export type ShownSheet = {
13
+ /**
14
+ * its source id
15
+ */
16
+ id: string | undefined;
17
+ /**
18
+ * the sheet of a workbook shown, else null
19
+ */
20
+ sheet: string | null;
21
+ /**
22
+ * the sheets of that workbook (names)
23
+ */
24
+ sheets: readonly string[];
25
+ };
26
+ /**
27
+ * @typedef {object} ShownSheet the data shown, for these rules
28
+ * @property {string | undefined} id its source id
29
+ * @property {string | null} sheet the sheet of a workbook shown, else null
30
+ * @property {readonly string[]} sheets the sheets of that workbook (names)
31
+ */
32
+ /**
33
+ * Whether a view of the browser store is listed for the data shown: made for this data (its id), for
34
+ * no named data, while no data is named, or for a sheet of a file of the same name while a workbook's
35
+ * sheet is shown (the same workbook's other sheets have other columns, so another id; opening it
36
+ * reads that sheet, sheetPlan).
37
+ * @param {{ sourceId?: string, sheet?: string | null }} entry
38
+ * @param {ShownSheet} shown
39
+ */
40
+ export declare function listedFor(entry: {
41
+ sourceId?: string;
42
+ sheet?: string | null;
43
+ }, shown: ShownSheet): boolean;
44
+ /**
45
+ * What opening a view that names a sheet does with the data shown: nothing ("none": it names no
46
+ * sheet, the sheet shown, or other data than this file), read that sheet of the file again first
47
+ * ("switch"), or say that the workbook has no such sheet ("missing": the view loads on the data shown).
48
+ * @param {{ id?: string | null, sheet?: string | null }} view the source the view names
49
+ * @param {ShownSheet} shown
50
+ * @returns {{ kind: "none" } | { kind: "switch" | "missing", sheet: string }}
51
+ */
52
+ export declare function sheetPlan(view: {
53
+ id?: string | null;
54
+ sheet?: string | null;
55
+ }, shown: ShownSheet): {
56
+ kind: "none";
57
+ } | {
58
+ kind: "switch" | "missing";
59
+ sheet: string;
60
+ };
@@ -16,6 +16,20 @@ export type TemplateEntry = {
16
16
  * the data a view of the browser store names, when it names one
17
17
  */
18
18
  sourceId?: string;
19
+ /**
20
+ * the sheet of a workbook the view was made on (its source.params.sheet)
21
+ */
22
+ sheet?: string;
23
+ /**
24
+ * the source id of that workbook's sheet (a host's view file; the
25
+ * browser store's entries have it as `sourceId`)
26
+ */
27
+ sheetOf?: string;
28
+ /**
29
+ * the source id a host's view file names (with or without a sheet): the data it
30
+ * was made for, which Publish hands on
31
+ */
32
+ fileSource?: string;
19
33
  };
20
34
  /**
21
35
  * @typedef {object} TemplateEntry an entry of the Views menu
@@ -25,6 +39,11 @@ export type TemplateEntry = {
25
39
  * @property {boolean} deletable
26
40
  * @property {number} [at] its place in the browser store; only for the store's own entries
27
41
  * @property {string} [sourceId] the data a view of the browser store names, when it names one
42
+ * @property {string} [sheet] the sheet of a workbook the view was made on (its source.params.sheet)
43
+ * @property {string} [sheetOf] the source id of that workbook's sheet (a host's view file; the
44
+ * browser store's entries have it as `sourceId`)
45
+ * @property {string} [fileSource] the source id a host's view file names (with or without a sheet): the data it
46
+ * was made for, which Publish hands on
28
47
  */
29
48
  /**
30
49
  * The entries of the Views menu: the host's templates (an entry with `file` is read as a view file;
@@ -34,7 +53,7 @@ export type TemplateEntry = {
34
53
  * marked `deletable` and the host takes the delete (`hostDeletes`). Every name is plain text
35
54
  * (plainNames), as a name from a file or the store is.
36
55
  * @param {unknown} templates the host's
37
- * @param {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string }>} stored
56
+ * @param {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string, sheet?: string }>} stored
38
57
  * @param {boolean} hostDeletes
39
58
  * @returns {TemplateEntry[]}
40
59
  */
@@ -43,4 +62,5 @@ export declare function templateEntries(templates: unknown, stored: Array<{
43
62
  view: Record<string, unknown>;
44
63
  at: number;
45
64
  sourceId?: string;
65
+ sheet?: string;
46
66
  }>, hostDeletes: boolean): TemplateEntry[];
@@ -85,18 +85,25 @@ export declare function ExportOption({ icon, text, info, onSelect, testId, disab
85
85
  }): React.JSX.Element;
86
86
  /**
87
87
  * The Export menu: the table as a file (Excel, CSV), the chart as an image (PNG, SVG), an HTML report,
88
- * printing (or saving as PDF from the print dialog), and the table on the clipboard (as shown, or its
89
- * data as JSON). The export module loads when the menu opens, so a copy happens right in the click.
90
- * An empty report (no field placed) has nothing to export: every entry is off, and says so; the chart's
91
- * images are off while the table is shown.
92
- * @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean, prepare: () => void, close: () => void }} props
88
+ * printing (or saving as PDF from the print dialog), the table on the clipboard (as shown, or its data
89
+ * as JSON), and last, when the host turns it on (exportData), the source data: every row as it is,
90
+ * CSV or JSON, apart from the table's exports so the two are not taken for each other. The export module loads when the menu opens, so a copy happens right in
91
+ * the click. An empty report (no field placed) has no table to export: those entries are off, and say
92
+ * so; the source data is there all the same. The chart's images are off while the table is shown.
93
+ * `dataExport`: the host's exportData with the data shown, read by export-scope.js (#259).
94
+ * @param {{ labels: import("./labels.js").UiLabels, onExport: (kind: string) => void, chartReady: boolean, display: string, empty?: boolean,
95
+ * dataExport?: { exportData: unknown, encoded: import("pivotkit-core").Encoded | null }, prepare: () => void, close: () => void }} props
93
96
  */
94
- export declare function ExportPanel({ labels, onExport, chartReady, display, empty, prepare, close }: {
97
+ export declare function ExportPanel({ labels, onExport, chartReady, display, empty, dataExport, prepare, close }: {
95
98
  labels: import("./labels.js").UiLabels;
96
99
  onExport: (kind: string) => void;
97
100
  chartReady: boolean;
98
101
  display: string;
99
102
  empty?: boolean;
103
+ dataExport?: {
104
+ exportData: unknown;
105
+ encoded: import("pivotkit-core").Encoded | null;
106
+ };
100
107
  prepare: () => void;
101
108
  close: () => void;
102
109
  }): React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @param {import("./export-run.js").ExportContext} context
3
- * @returns {(kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json") => Promise<void>}
3
+ * @returns {(kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json" | "data-csv" | "data-json") => Promise<void>}
4
4
  */
5
- export declare function useExport(context: import("./export-run.js").ExportContext): (kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json") => Promise<void>;
5
+ export declare function useExport(context: import("./export-run.js").ExportContext): (kind: "xlsx" | "csv" | "png" | "html" | "svg" | "print" | "copy-table" | "copy-json" | "data-csv" | "data-json") => Promise<void>;
6
6
  /** Starts loading the export module when a menu that copies opens: a copy right in the click is allowed everywhere. */
7
7
  export declare const prepareExporters: () => undefined;
@@ -7,6 +7,21 @@
7
7
  export declare const tagFor: (tag: any, sourceId: string | undefined) => any;
8
8
  /** Steps kept for undo. */
9
9
  export declare const HISTORY_LIMIT = 100;
10
+ /**
11
+ * The views told to a controlled host (onViewChange) that it has not passed back yet, with `view`
12
+ * added: at most HISTORY_LIMIT, the newest kept, so a host that never passes them back does not make
13
+ * the list grow with every change (#204).
14
+ * @param {string[]} pending
15
+ * @param {string} view
16
+ */
17
+ export declare const told: (pending: string[], view: string) => string[];
18
+ /**
19
+ * What still waits once the host passes `view`: the views told after it (a host that answers late,
20
+ * #141), or none when it was not told (a change of the host's own).
21
+ * @param {string[]} pending
22
+ * @param {string} view
23
+ */
24
+ export declare function answered(pending: string[], view: string): string[];
10
25
  export type HistoryState = {
11
26
  /**
12
27
  * the schema the views were normalized against
@@ -3,17 +3,20 @@ export type LoadedView = {
3
3
  scope: "user" | "shared" | null;
4
4
  store: boolean;
5
5
  storeSource?: string | null;
6
+ storeSheet?: string | null;
6
7
  };
7
8
  export type SaveRights = {
8
9
  host: boolean;
9
10
  store: boolean;
10
11
  publish: boolean;
11
12
  sourceId?: string;
13
+ sheet?: string | null;
12
14
  };
13
15
  export type SaveWrite = {
14
16
  kind: "store";
15
17
  at?: number;
16
18
  storeSource: string | null;
19
+ storeSheet?: string | null;
17
20
  } | {
18
21
  kind: "host";
19
22
  } | {
@@ -28,19 +31,20 @@ export type Entry = {
28
31
  scope: string;
29
32
  at?: number;
30
33
  sourceId?: string;
34
+ sheet?: string;
31
35
  };
32
36
  /**
33
- * @typedef {{ name: string, scope: "user" | "shared" | null, store: boolean, storeSource?: string | null }} LoadedView
37
+ * @typedef {{ name: string, scope: "user" | "shared" | null, store: boolean, storeSource?: string | null, storeSheet?: string | null }} LoadedView
34
38
  * the view loaded: its name, its group (null: a file or a link), whether the browser store keeps it
35
- * and, there, the data it names
36
- * @typedef {{ host: boolean, store: boolean, publish: boolean, sourceId?: string }} SaveRights
39
+ * and, there, the data and the sheet it names
40
+ * @typedef {{ host: boolean, store: boolean, publish: boolean, sourceId?: string, sheet?: string | null }} SaveRights
37
41
  * onSaveTemplate is set, the browser store is on, the user may publish (canPublish with
38
- * onPublishTemplate); the data shown
39
- * @typedef {{ kind: "store", at?: number, storeSource: string | null } | { kind: "host" } | { kind: "publish" }} SaveWrite
42
+ * onPublishTemplate); the data shown and its sheet of a workbook
43
+ * @typedef {{ kind: "store", at?: number, storeSource: string | null, storeSheet?: string | null } | { kind: "host" } | { kind: "publish" }} SaveWrite
40
44
  * where a save goes; `at`: the browser store's view it writes over (none: a view added)
41
45
  * @typedef {SaveWrite | { kind: null, why: "saveSharedLocked" | "saveNotInViews" | "exportNeedsField" }} SaveTarget
42
46
  * `why`: the label that says why Save is off
43
- * @typedef {{ name: string, scope: string, at?: number, sourceId?: string }} Entry an entry of the Views menu
47
+ * @typedef {{ name: string, scope: string, at?: number, sourceId?: string, sheet?: string }} Entry an entry of the Views menu
44
48
  */
45
49
  /** Whether Save as can write anywhere. @param {SaveRights} can */
46
50
  export declare const canSaveAs: (can: SaveRights) => boolean;
@@ -4,30 +4,38 @@ export declare const VIEW_STORE_LIMITS: Readonly<{
4
4
  text: 500000;
5
5
  }>;
6
6
  /**
7
- * The browser store's views from its text, those for the data shown: made for `sourceId` or for no
8
- * named data.
7
+ * The browser store's views from its text, those for the data shown: made for `sourceId`, for no
8
+ * named data, or for another sheet of the workbook shown (sheet-views.js: listedFor).
9
9
  * @param {string | null} raw
10
10
  * @param {string | undefined} sourceId
11
- * `sourceId` of an entry: the data it names (none for a view saved without), which tells two views
12
- * of the same name apart (one for no named data, one for this data).
13
- * @returns {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string }>}
11
+ * @param {{ sheet: string | null, sheets: readonly string[] }} [shown] the workbook's sheet shown
12
+ * `sourceId` and `sheet` of an entry: the data it names (none for a view saved without) and the sheet
13
+ * of a workbook it was made on, which tell two views of the same name apart (one for no named data,
14
+ * one per data and sheet).
15
+ * @returns {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string, sheet?: string }>}
14
16
  */
15
- export declare function storedViews(raw: string | null, sourceId: string | undefined): Array<{
17
+ export declare function storedViews(raw: string | null, sourceId: string | undefined, shown?: {
18
+ sheet: string | null;
19
+ sheets: readonly string[];
20
+ }): Array<{
16
21
  name: string;
17
22
  view: Record<string, unknown>;
18
23
  at: number;
19
24
  sourceId?: string;
25
+ sheet?: string;
20
26
  }>;
21
27
  /**
22
- * The browser store's text after a change: `name` saved for `sourceId` (replacing a view of the same
23
- * name for the same data), the view at `replace` written over in its place (Save, and Save as onto a
24
- * name that exists: its data and its place in the list stay), or the view at `remove` taken out. A
28
+ * The browser store's text after a change: `name` saved for `sourceId` and `sheet` (replacing a view of
29
+ * the same name for the same data and sheet), the view at `replace` written over in its place (Save,
30
+ * and Save as onto a name that exists: its place in the list stays, and its data, which takes the sheet
31
+ * shown when it is the data shown: a view saved before views named their sheet gets it), or the view
32
+ * at `remove` taken out. A
25
33
  * delete and a replace check that the view there is still the one named `removeName` or `name`
26
34
  * (another tab may have changed the store since the menu was drawn) and throw "changed" when it is
27
35
  * not, so the wrong view is never deleted or overwritten. The caps apply to a save
28
36
  * only: a store over them (older caps, changed by hand) can always shrink.
29
37
  * @param {string | null} raw
30
- * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string, replace?: number }} change
38
+ * @param {{ name?: string, view?: object, sourceId?: string, sheet?: string | null, remove?: number, removeName?: string, replace?: number }} change
31
39
  * @param {(kind: "count" | "text" | "changed", max: number) => string} message the Error's message
32
40
  * @returns {string | null} null when nothing is left
33
41
  */
@@ -35,6 +43,7 @@ export declare function changedViews(raw: string | null, change: {
35
43
  name?: string;
36
44
  view?: object;
37
45
  sourceId?: string;
46
+ sheet?: string | null;
38
47
  remove?: number;
39
48
  removeName?: string;
40
49
  replace?: number;
@@ -44,7 +53,7 @@ export declare function changedViews(raw: string | null, change: {
44
53
  * the labels' words when the store would hold too much, changed since the menu was drawn, or the
45
54
  * browser refused to keep it.
46
55
  * @param {string | null} raw the store's text now
47
- * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string, replace?: number }} change
56
+ * @param {{ name?: string, view?: object, sourceId?: string, sheet?: string | null, remove?: number, removeName?: string, replace?: number }} change
48
57
  * @param {any} labels with the menus' texts
49
58
  * @param {string} locale for the numbers
50
59
  * @param {(text: string | null) => boolean} keep writes the text (storage.js: writeItem), false when the browser refused
@@ -53,6 +62,7 @@ export declare function storeViews(raw: string | null, change: {
53
62
  name?: string;
54
63
  view?: object;
55
64
  sourceId?: string;
65
+ sheet?: string | null;
56
66
  remove?: number;
57
67
  removeName?: string;
58
68
  replace?: number;
@@ -1,32 +0,0 @@
1
- /** Characters of a file name in the source id and the report's source line. */
2
- export declare const SHOWN_MAX = 120;
3
- /**
4
- * The name as the report shows it: at most SHOWN_MAX characters, cut with "...".
5
- * @param {string} name
6
- */
7
- export declare function shownName(name: string): string;
8
- /**
9
- * SHA-256 of bytes, in JavaScript (where crypto.subtle is missing).
10
- * @param {Uint8Array} bytes
11
- * @returns {Uint8Array}
12
- */
13
- export declare function sha256Bytes(bytes: Uint8Array): Uint8Array;
14
- /**
15
- * SHA-256 of a text (UTF-8) as lower-case hex: the browser's crypto.subtle where there is one.
16
- * @param {string} text
17
- * @param {{ subtle?: SubtleCrypto | null }} [options] `subtle: null` uses the own implementation (tests)
18
- * @returns {Promise<string>}
19
- */
20
- export declare function sha256Hex(text: string, options?: {
21
- subtle?: SubtleCrypto | null;
22
- }): Promise<string>;
23
- /**
24
- * The source id of a loaded file: its shown name, "#" and 16 hex digits of the SHA-256 of its whole
25
- * name and its column names in their order, joined with U+0000.
26
- * @param {string} name
27
- * @param {readonly string[]} columns
28
- * @param {{ subtle?: SubtleCrypto | null }} [options]
29
- */
30
- export declare function sourceIdOf(name: string, columns: readonly string[], options?: {
31
- subtle?: SubtleCrypto | null;
32
- }): Promise<string>;