pivotkit-react 0.1.0 → 0.2.0

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 (53) hide show
  1. package/CHANGELOG.md +143 -1
  2. package/README.md +48 -298
  3. package/dist/chunks/chunk-53ZMK4BH.js +177 -0
  4. package/dist/chunks/{chunk-ILHFIV2P.js → chunk-F6MVUAQD.js} +35 -78
  5. package/dist/chunks/chunk-LQCWFJBS.js +310 -0
  6. package/dist/chunks/chunk-OYY4BKIL.js +93 -0
  7. package/dist/chunks/chunk-QBD4FOBB.js +254 -0
  8. package/dist/chunks/{chunk-KKJO36W5.js → chunk-X7H7BAVT.js} +243 -324
  9. package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
  10. package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
  11. package/dist/echarts.js +96 -11
  12. package/dist/index.js +619 -527
  13. package/dist/labels.js +13 -4
  14. package/dist/menu-texts-de.js +6 -0
  15. package/dist/menus.js +787 -191
  16. package/dist/styles.css +113 -31
  17. package/package.json +2 -2
  18. package/types/chart-layout.d.ts +111 -0
  19. package/types/chart-types.d.ts +0 -91
  20. package/types/drill-panel.d.ts +5 -22
  21. package/types/drill-table.d.ts +71 -0
  22. package/types/drill.d.ts +0 -36
  23. package/types/help.d.ts +21 -0
  24. package/types/icons.d.ts +4 -0
  25. package/types/labels.d.ts +43 -101
  26. package/types/lazy-menus.d.ts +16 -4
  27. package/types/menu-labels-de.d.ts +2 -0
  28. package/types/menu-labels.d.ts +71 -9
  29. package/types/menu-ops.d.ts +145 -0
  30. package/types/menu-texts.d.ts +2 -0
  31. package/types/menus.d.ts +1 -1
  32. package/types/names.d.ts +19 -19
  33. package/types/overflow.d.ts +4 -1
  34. package/types/popover.d.ts +10 -6
  35. package/types/section.d.ts +7 -24
  36. package/types/sections.d.ts +2 -0
  37. package/types/share-actions.d.ts +99 -0
  38. package/types/share.d.ts +0 -9
  39. package/types/table.d.ts +9 -3
  40. package/types/templates.d.ts +7 -1
  41. package/types/tips.d.ts +9 -7
  42. package/types/toolbar-panels.d.ts +8 -5
  43. package/types/unused-load.d.ts +23 -0
  44. package/types/unused-texts-de.d.ts +2 -0
  45. package/types/unused-texts.d.ts +130 -0
  46. package/types/unused.d.ts +22 -0
  47. package/types/use-view-history.d.ts +7 -4
  48. package/types/view-history.d.ts +23 -6
  49. package/types/view-ops.d.ts +72 -123
  50. package/types/view-save.d.ts +76 -0
  51. package/types/view-store.d.ts +13 -6
  52. package/dist/chunks/chunk-C32TYSHG.js +0 -441
  53. package/dist/chunks/chunk-XYP47DJ3.js +0 -123
@@ -1,3 +1,10 @@
1
+ /**
2
+ * The saved view a step's tag names, for the data shown now: none when it was loaded for another
3
+ * source (one with the same columns keeps the history, not the name).
4
+ * @param {any} tag
5
+ * @param {string | undefined} sourceId
6
+ */
7
+ export declare const tagFor: (tag: any, sourceId: string | undefined) => any;
1
8
  /** Steps kept for undo. */
2
9
  export declare const HISTORY_LIMIT = 100;
3
10
  export type HistoryState = {
@@ -19,6 +26,7 @@ export type HistoryState = {
19
26
  past: Array<{
20
27
  view: string;
21
28
  note: string;
29
+ tag: any;
22
30
  }>;
23
31
  /**
24
32
  * views undone, newest undo last
@@ -26,23 +34,30 @@ export type HistoryState = {
26
34
  future: Array<{
27
35
  view: string;
28
36
  note: string;
37
+ tag: any;
29
38
  }>;
39
+ /**
40
+ * the saved view `present` is (an object), or null
41
+ */
42
+ tag: any;
30
43
  };
31
44
  /**
32
45
  * @typedef {object} HistoryState
33
46
  * @property {string} schema the schema the views were normalized against
34
47
  * @property {string} start the start view, the target of reset
35
48
  * @property {string} present the view the history is at
36
- * @property {Array<{ view: string, note: string }>} past older views, each with the note of the step that left it
37
- * @property {Array<{ view: string, note: string }>} future views undone, newest undo last
49
+ * @property {Array<{ view: string, note: string, tag: any }>} past older views, each with the note of the step that left it
50
+ * @property {Array<{ view: string, note: string, tag: any }>} future views undone, newest undo last
51
+ * @property {any} tag the saved view `present` is (an object), or null
38
52
  */
39
53
  /**
40
54
  * @param {string} schema
41
55
  * @param {string} start JSON of the start view
42
56
  * @param {string} [current] JSON of the view shown now, default the start
57
+ * @param {any} [tag] the saved view it is
43
58
  * @returns {HistoryState}
44
59
  */
45
- export declare function createState(schema: string, start: string, current?: string): HistoryState;
60
+ export declare function createState(schema: string, start: string, current?: string, tag?: any): HistoryState;
46
61
  /**
47
62
  * The state a step works on: a new history when the schema changed, and the view the report shows
48
63
  * recorded first when it differs from the history (a controlled host passed another view).
@@ -56,13 +71,15 @@ export declare function settle(state: HistoryState, at: {
56
71
  outside: string;
57
72
  }): HistoryState;
58
73
  /**
59
- * A new step; an unchanged view is none. Clears the steps that were undone.
74
+ * A new step; an unchanged view is none (only its tag changes, when another is given). Clears the
75
+ * steps that were undone.
60
76
  * @param {HistoryState} state
61
77
  * @param {string} view JSON
62
78
  * @param {string} note
79
+ * @param {any} [tag] the saved view the step shows; default the tag of the view before
63
80
  * @returns {HistoryState}
64
81
  */
65
- export declare function record(state: HistoryState, view: string, note: string): HistoryState;
82
+ export declare function record(state: HistoryState, view: string, note: string, tag?: any): HistoryState;
66
83
  /**
67
84
  * One step back; `note` says what was undone (null when there was nothing to undo).
68
85
  * @param {HistoryState} state
@@ -82,7 +99,7 @@ export declare function redo(state: HistoryState): {
82
99
  note: string | null;
83
100
  };
84
101
  /**
85
- * Back to the start view, as one step that can be undone.
102
+ * Back to the start view, as one step that can be undone; the start is no saved view (tag null).
86
103
  * @param {HistoryState} state
87
104
  * @param {string} note
88
105
  */
@@ -1,6 +1,8 @@
1
1
  export type Zone = "rows" | "cols" | "values" | "filters";
2
2
  /** @typedef {"rows" | "cols" | "values" | "filters"} Zone */
3
3
  export declare const ZONES: readonly Zone[];
4
+ export declare const clone: (view: any) => any;
5
+ export declare const same: (a: any, b: any) => boolean;
4
6
  /** The fields shown in the Filters zone: filtered fields that are on no axis, once each. */
5
7
  export declare function filterZoneFields(view: any): any[];
6
8
  /** The axis a field is on, or null. */
@@ -95,30 +97,6 @@ export declare function fieldAt(view: any, zone: any, index: any): any;
95
97
  export declare function moveField(view: any, from: Zone, fromIndex: number, to: Zone, toIndex: number | undefined, options?: AddOptions): any;
96
98
  /** Moves an entry within a zone. */
97
99
  export declare function reorder(view: any, zone: any, from: any, to: any): any;
98
- /**
99
- * Changes properties of the value at `index` (agg, format, label, showAs, conditional). A new
100
- * aggregator drops the "show values as" calculation (a running total does not fit an average) and
101
- * picks the format: one the patch names; else the user's own format (one that is not the host's
102
- * default) while the result keeps its unit (average to median: still years); else the host's format
103
- * for the field (fieldDefaults) when its aggregator has that unit; else none, the automatic one.
104
- * @param {any} view
105
- * @param {number} index
106
- * @param {{ agg?: string, format?: string | null, label?: string | null, showAs?: object | null, conditional?: object | null }} patch
107
- * @param {{ defaults?: { agg?: string, format?: string } }} [options] `defaults`: the host's
108
- * settings for the value's field
109
- */
110
- export declare function updateValue(view: any, index: number, patch: {
111
- agg?: string;
112
- format?: string | null;
113
- label?: string | null;
114
- showAs?: object | null;
115
- conditional?: object | null;
116
- }, options?: {
117
- defaults?: {
118
- agg?: string;
119
- format?: string;
120
- };
121
- }): any;
122
100
  /**
123
101
  * The smallest and the largest number of a number column, for the range form; null without numbers.
124
102
  * @param {import("pivotkit-core").Encoded} encoded
@@ -129,19 +107,6 @@ export declare function numberRange(encoded: import("pivotkit-core").Encoded, fi
129
107
  min: number;
130
108
  max: number;
131
109
  } | null;
132
- /**
133
- * Why ranges of `size` from `start` cannot hold the numbers of `range`, or null when they can. A start
134
- * so far from the values that a range's bounds can no longer be told apart in a double (1e17 for
135
- * magnitudes of 2 to 9 in ranges of 0.5) would put every row into "(blank)": "far".
136
- * @param {number} size
137
- * @param {number} start
138
- * @param {{ min: number, max: number } | null} range
139
- * @returns {"far" | null}
140
- */
141
- export declare function binProblem(size: number, start: number, range: {
142
- min: number;
143
- max: number;
144
- } | null): "far" | null;
145
110
  /**
146
111
  * The derived field a grouping makes of a field on an axis: replaces it in place. `unit` null removes
147
112
  * the grouping (back to the source field). Returns the view and the new field's name.
@@ -179,46 +144,87 @@ export declare function setSort(view: any, field: any, sort: any): any;
179
144
  export declare function withHostOrders(view: any, orderOf: (field: string) => unknown[] | undefined): any;
180
145
  /** The sort entry of a field, or null. */
181
146
  export declare function sortOf(view: any, field: any): any;
182
- /** Filters of one type of a field. */
183
- export declare function filtersOf(view: any, field: any, types: any): any;
184
147
  /**
185
- * The item filter of a field from the selected values: everything selected removes it; otherwise the
186
- * values not selected are excluded, so values that appear in newer data are shown, as in Excel.
148
+ * The entry setSort writes for a sort the user chose: A to Z is the default without an entry, except
149
+ * for a field with the host's order, which keeps it as an entry, or the host's order would come back
150
+ * (withHostOrders).
151
+ * @param {{ by: string, order: string }} spec
152
+ * @param {boolean} [hostOrdered] the field has the host's order (fieldDefaults.order)
153
+ */
154
+ export declare function sortEntry(spec: {
155
+ by: string;
156
+ order: string;
157
+ }, hostOrdered?: boolean): {
158
+ by: string;
159
+ order: string;
160
+ } | null;
161
+ /**
162
+ * What a click on a header of the table sorts: a row field's name sorts that field by label; a value's
163
+ * name sorts the innermost row field by that value. Only a value's header that stands for the whole
164
+ * row does (its column path is empty: the one value header over all columns, the values without
165
+ * column fields, the grand total column), and only a value that gives a number (numericResult). Null
166
+ * for every other header.
187
167
  * @param {any} view
188
- * @param {string} field
189
- * @param {Array<unknown>} selected values (null is blank)
190
- * @param {Array<unknown>} all every value of the field
168
+ * @param {{ kind: string, field?: string, valueIndex?: number, colPath?: any[] }} cell a header cell of the grid
169
+ * @param {(field: string) => string | undefined} typeOf the column type of a field
170
+ * @returns {{ field: string, ref?: { field: string | null, agg: string } } | null}
191
171
  */
192
- export declare function setItemFilter(view: any, field: string, selected: Array<unknown>, all: Array<unknown>): any;
193
- /** The values an item filter lets through, from the field's values; all of them without a filter. */
194
- export declare function selectedItems(view: any, field: any, all: any): any;
195
- /** The label condition of a field ({ op, value }) or null to remove it. */
196
- export declare function setLabelFilter(view: any, field: any, condition: any): any;
172
+ export declare function headerSortTarget(view: any, cell: {
173
+ kind: string;
174
+ field?: string;
175
+ valueIndex?: number;
176
+ colPath?: any[];
177
+ }, typeOf: (field: string) => string | undefined): {
178
+ field: string;
179
+ ref?: {
180
+ field: string | null;
181
+ agg: string;
182
+ };
183
+ } | null;
197
184
  /**
198
- * Top or bottom N items of a field by a value ({ count, bottom, by }), or null to remove it. `previous`
199
- * is the top filter being edited (the view's own entry); without it the field's top filters are
200
- * replaced. Another top filter of the field (a view may hold two) stays.
185
+ * The sort a header shows (aria-sort): "ascending", "descending", "other" (a custom order), or null
186
+ * when the rows are not in its order; `chosen` when a sort entry of the view puts them in it (the
187
+ * default A to Z of a field without an entry is not chosen).
188
+ * @param {any} view
189
+ * @param {{ field: string, ref?: { field: string | null, agg: string } }} target headerSortTarget's
190
+ * @returns {{ order: "ascending" | "descending" | "other" | null, chosen: boolean }}
201
191
  */
202
- export declare function setTopFilter(view: any, field: any, top: any, previous: any): any;
192
+ export declare function headerSortState(view: any, target: {
193
+ field: string;
194
+ ref?: {
195
+ field: string | null;
196
+ agg: string;
197
+ };
198
+ }): {
199
+ order: "ascending" | "descending" | "other" | null;
200
+ chosen: boolean;
201
+ };
203
202
  /**
204
- * A value condition on a field ({ by, op, value, value2 }, pivotkit-core's `value` filter: "Sum of
205
- * Revenue greater than 1000"), or null to remove it. `previous` is the condition being edited (the
206
- * view's own entry): only that one is replaced or removed; without it every value condition of the
207
- * field is. The field keeps its other filters.
203
+ * The field's sort entry after a click on a header (setSort's argument): a value's header goes from
204
+ * largest first to smallest first to no sort by it (the field's default order); a row field's name
205
+ * from A to Z to Z to A and back, and to A to Z from a sort by a value or a custom order.
208
206
  * @param {any} view
209
- * @param {string} field
210
- * @param {{ by: { field: string | null, agg: string }, op: string, value: number, value2?: number } | null} condition
211
- * @param {object} [previous]
207
+ * @param {{ field: string, ref?: { field: string | null, agg: string } }} target headerSortTarget's
208
+ * @param {boolean} [hostOrdered] the field has the host's order (fieldDefaults.order)
212
209
  */
213
- export declare function setValueFilter(view: any, field: string, condition: {
214
- by: {
210
+ export declare function nextHeaderSort(view: any, target: {
211
+ field: string;
212
+ ref?: {
215
213
  field: string | null;
216
214
  agg: string;
217
215
  };
218
- op: string;
219
- value: number;
220
- value2?: number;
221
- } | null, previous?: object): any;
216
+ }, hostOrdered?: boolean): {
217
+ by: string;
218
+ order: string;
219
+ } | {
220
+ by: string;
221
+ order: string;
222
+ value: any;
223
+ } | null;
224
+ /** Filters of one type of a field. */
225
+ export declare function filtersOf(view: any, field: any, types: any): any;
226
+ /** The values an item filter lets through, from the field's values; all of them without a filter. */
227
+ export declare function selectedItems(view: any, field: any, all: any): any;
222
228
  /**
223
229
  * True when a value gives a number for each cell, so it can be shown as a share, formatted, highlighted,
224
230
  * sorted by and filtered by: not a list of distinct values, not the first or last entry of a text,
@@ -229,44 +235,8 @@ export declare function setValueFilter(view: any, field: string, condition: {
229
235
  export declare function numericResult(spec: {
230
236
  agg: string;
231
237
  }, type: string): boolean;
232
- /**
233
- * The measures to choose from with `ref` among them: a sort, a top N or a condition may go by a
234
- * measure the view no longer shows (its value was removed); it stays a choice, so applying the form
235
- * again keeps it.
236
- * @param {Array<{ field: string | null, agg: string }>} choices
237
- * @param {{ field: string | null, agg: string } | null | undefined} ref
238
- */
239
- export declare function withMeasure(choices: Array<{
240
- field: string | null;
241
- agg: string;
242
- }>, ref: {
243
- field: string | null;
244
- agg: string;
245
- } | null | undefined): {
246
- field: string | null;
247
- agg: string;
248
- }[];
249
238
  /** True when two value references ({ field, agg }) name the same measure. */
250
239
  export declare function sameRef(a: any, b: any): boolean;
251
- /**
252
- * The measures a field on an axis can be sorted, ranked and filtered by: each value of the view that
253
- * gives a number, once per field and aggregator, in the view's order; the row count without one. The
254
- * first one is the default, as pivotkit-core's.
255
- * @param {any} view
256
- * @param {(field: string) => string | undefined} typeOf the column type of a field
257
- * @returns {Array<{ field: string | null, agg: string }>}
258
- */
259
- export declare function measureChoices(view: any, typeOf: (field: string) => string | undefined): Array<{
260
- field: string | null;
261
- agg: string;
262
- }>;
263
- /**
264
- * Removes what the filter of a field keeps out: its item list, its text condition and a value
265
- * condition; Top N has its own control and stays. A field in the Filters zone stays there, unfiltered.
266
- */
267
- export declare function removeFilters(view: any, field: any): any;
268
- /** True when a field has an item, text or value filter that removes something (Top N is not counted). */
269
- export declare function hasFilter(view: any, field: any): any;
270
240
  /** True when a field has a filter that removes something. */
271
241
  export declare function isFiltered(view: any, field: any): any;
272
242
  /** Collapses or expands one group of an axis. */
@@ -296,17 +266,6 @@ export declare function rowFolding(view: any, outer: Array<Array<unknown>>): {
296
266
  * @param {Array<Array<unknown>> | null} paths the paths to collapse; null expands everything
297
267
  */
298
268
  export declare function setCollapsed(view: any, axis: "rows" | "cols", paths: Array<Array<unknown>> | null): any;
299
- /** The four totals of Options, in their order. */
300
- export declare const TOTALS: readonly string[];
301
- /**
302
- * Why a total of Options would change nothing in this view, or null when it changes something: a
303
- * grand total row needs a field in Rows (without one the only row is the total), a grand total column
304
- * one in Columns, subtotals two or more fields on their axis. The key names the text (labels).
305
- * @param {any} view
306
- * @param {string} key one of TOTALS
307
- * @returns {string | null}
308
- */
309
- export declare function totalNoEffect(view: any, key: string): string | null;
310
269
  /** Turns one of the totals on or off. */
311
270
  export declare function setTotal(view: any, key: any, on: any): any;
312
271
  /** Table or chart. */
@@ -332,13 +291,3 @@ export declare function setChartDisplay(view: any, patch: {
332
291
  export declare function swapAxes(view: any): any;
333
292
  /** True when nothing is placed: the UI shows its first steps. */
334
293
  export declare function isEmptyView(view: any): boolean;
335
- /**
336
- * The condition on a field's labels its type offers: "text" for text, "number" for a number (on the
337
- * label as shown), none for a date (or a grouping of one) and a yes/no field, whose items the list
338
- * above chooses.
339
- * @param {import("pivotkit-core").Encoded} encoded
340
- * @param {any} view
341
- * @param {string} field
342
- * @returns {"text" | "number" | null}
343
- */
344
- export declare function conditionKind(encoded: import("pivotkit-core").Encoded, view: any, field: string): "text" | "number" | null;
@@ -0,0 +1,76 @@
1
+ export type LoadedView = {
2
+ name: string;
3
+ scope: "user" | "shared" | null;
4
+ store: boolean;
5
+ storeSource?: string | null;
6
+ };
7
+ export type SaveRights = {
8
+ host: boolean;
9
+ store: boolean;
10
+ publish: boolean;
11
+ sourceId?: string;
12
+ };
13
+ export type SaveWrite = {
14
+ kind: "store";
15
+ at?: number;
16
+ storeSource: string | null;
17
+ } | {
18
+ kind: "host";
19
+ } | {
20
+ kind: "publish";
21
+ };
22
+ export type SaveTarget = SaveWrite | {
23
+ kind: null;
24
+ why: "saveSharedLocked" | "saveNotInViews" | "exportNeedsField";
25
+ };
26
+ export type Entry = {
27
+ name: string;
28
+ scope: string;
29
+ at?: number;
30
+ sourceId?: string;
31
+ };
32
+ /**
33
+ * @typedef {{ name: string, scope: "user" | "shared" | null, store: boolean, storeSource?: string | null }} LoadedView
34
+ * 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
37
+ * 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
40
+ * where a save goes; `at`: the browser store's view it writes over (none: a view added)
41
+ * @typedef {SaveWrite | { kind: null, why: "saveSharedLocked" | "saveNotInViews" | "exportNeedsField" }} SaveTarget
42
+ * `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
44
+ */
45
+ /** Whether Save as can write anywhere. @param {SaveRights} can */
46
+ export declare const canSaveAs: (can: SaveRights) => boolean;
47
+ /**
48
+ * Whether an entry of the Views menu is the view loaded: its name, its group, and for the browser
49
+ * store the data it names.
50
+ * @param {Entry} t
51
+ * @param {LoadedView | null | undefined} loaded
52
+ */
53
+ export declare const isLoadedEntry: (t: Entry, loaded: LoadedView | null | undefined) => boolean;
54
+ /**
55
+ * Where Save writes the loaded view, or why it is off; null when there is no Save to offer (nothing
56
+ * loaded, or no way to save at all).
57
+ * @param {LoadedView | null} loaded
58
+ * @param {ReadonlyArray<Entry>} entries the Views menu's entries
59
+ * @param {SaveRights} can
60
+ * @param {boolean} [empty] the report has no field placed
61
+ * @returns {SaveTarget | null}
62
+ */
63
+ export declare function saveTarget(loaded: LoadedView | null, entries: ReadonlyArray<Entry>, can: SaveRights, empty?: boolean): SaveTarget | null;
64
+ /**
65
+ * Where Save as writes a view named `name`, and the user's view it would replace (null: none, so
66
+ * nothing to ask): the host's own view of that name when the host takes the saves, else the browser
67
+ * store's for this data (or saved without named data).
68
+ * @template {Entry} T
69
+ * @param {string} name
70
+ * @param {ReadonlyArray<T>} entries
71
+ * @param {SaveRights} can
72
+ * @returns {SaveWrite & { replaces: T | null }}
73
+ */
74
+ export declare function saveAsTarget<T extends Entry>(name: string, entries: ReadonlyArray<T>, can: SaveRights): SaveWrite & {
75
+ replaces: T | null;
76
+ };
@@ -8,21 +8,26 @@ export declare const VIEW_STORE_LIMITS: Readonly<{
8
8
  * named data.
9
9
  * @param {string | null} raw
10
10
  * @param {string | undefined} sourceId
11
- * @returns {Array<{ name: string, view: Record<string, unknown>, at: number }>}
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 }>}
12
14
  */
13
15
  export declare function storedViews(raw: string | null, sourceId: string | undefined): Array<{
14
16
  name: string;
15
17
  view: Record<string, unknown>;
16
18
  at: number;
19
+ sourceId?: string;
17
20
  }>;
18
21
  /**
19
22
  * The browser store's text after a change: `name` saved for `sourceId` (replacing a view of the same
20
- * name for the same data), or the view at `remove` taken out. A delete checks that the view there is
21
- * still the one named `removeName` (another tab may have changed the store since the menu was drawn)
22
- * and throws "changed" when it is not, so the wrong view is never deleted. The caps apply to a save
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
25
+ * delete and a replace check that the view there is still the one named `removeName` or `name`
26
+ * (another tab may have changed the store since the menu was drawn) and throw "changed" when it is
27
+ * not, so the wrong view is never deleted or overwritten. The caps apply to a save
23
28
  * only: a store over them (older caps, changed by hand) can always shrink.
24
29
  * @param {string | null} raw
25
- * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string }} change
30
+ * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string, replace?: number }} change
26
31
  * @param {(kind: "count" | "text" | "changed", max: number) => string} message the Error's message
27
32
  * @returns {string | null} null when nothing is left
28
33
  */
@@ -32,13 +37,14 @@ export declare function changedViews(raw: string | null, change: {
32
37
  sourceId?: string;
33
38
  remove?: number;
34
39
  removeName?: string;
40
+ replace?: number;
35
41
  }, message: (kind: "count" | "text" | "changed", max: number) => string): string | null;
36
42
  /**
37
43
  * Saves or deletes a view in the browser store (see changedViews). Throws an Error with the reason in
38
44
  * the labels' words when the store would hold too much, changed since the menu was drawn, or the
39
45
  * browser refused to keep it.
40
46
  * @param {string | null} raw the store's text now
41
- * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string }} change
47
+ * @param {{ name?: string, view?: object, sourceId?: string, remove?: number, removeName?: string, replace?: number }} change
42
48
  * @param {any} labels with the menus' texts
43
49
  * @param {string} locale for the numbers
44
50
  * @param {(text: string | null) => boolean} keep writes the text (storage.js: writeItem), false when the browser refused
@@ -49,4 +55,5 @@ export declare function storeViews(raw: string | null, change: {
49
55
  sourceId?: string;
50
56
  remove?: number;
51
57
  removeName?: string;
58
+ replace?: number;
52
59
  }, labels: any, locale: string, keep: (text: string | null) => boolean): void;