pivotkit-react 0.8.2 → 0.9.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 (56) hide show
  1. package/CHANGELOG.md +93 -1
  2. package/dist/chunks/chunk-24T2VRMU.js +1010 -0
  3. package/dist/chunks/chunk-6R7TJHS3.js +212 -0
  4. package/dist/chunks/{chunk-GUSQWPTH.js → chunk-EPGRJSPP.js} +20 -5
  5. package/dist/chunks/{chunk-JAOOFDNR.js → chunk-FAAQZSR4.js} +4 -1
  6. package/dist/chunks/{chunk-2N2UGSIG.js → chunk-FI22Z6CC.js} +5 -2
  7. package/dist/chunks/{chunk-ZM45YU3W.js → chunk-G3R5C3J7.js} +28 -6
  8. package/dist/chunks/{chunk-MU5BTKSY.js → chunk-QCBVEI23.js} +6 -2
  9. package/dist/chunks/{chunk-6OWC6X5W.js → chunk-QVE7JM4G.js} +1 -1
  10. package/dist/chunks/{chunk-3WWWKPB4.js → chunk-V233JHVY.js} +75 -336
  11. package/dist/chunks/chunk-W6BG3GGS.js +679 -0
  12. package/dist/chunks/chunk-YAT2TFMK.js +138 -0
  13. package/dist/chunks/chunk-ZQ2M3U74.js +341 -0
  14. package/dist/chunks/{unused-texts-de-GB3IWWEM.js → labels-de-ZC3CSQZR.js} +1 -1
  15. package/dist/chunks/tips-SYGQPI3Q.js +22 -0
  16. package/dist/chunks/{unused-texts-LRYVWFFN.js → unused-texts-ERQ6ACNX.js} +1 -1
  17. package/dist/chunks/unused-texts-de-AC5GS3FS.js +6 -0
  18. package/dist/deferred-late.js +13 -0
  19. package/dist/deferred.js +18 -0
  20. package/dist/echarts.js +30 -6
  21. package/dist/import-ui.js +3 -3
  22. package/dist/index.js +427 -202
  23. package/dist/labels.js +15 -12
  24. package/dist/menu-texts-de.js +1 -1
  25. package/dist/menus.js +518 -381
  26. package/dist/styles.css +128 -9
  27. package/package.json +5 -4
  28. package/types/PivotReport.d.ts +3 -1
  29. package/types/chart-tooltip.d.ts +18 -1
  30. package/types/chart-types.d.ts +7 -2
  31. package/types/chart.d.ts +10 -2
  32. package/types/chip-menus.d.ts +1 -1
  33. package/types/deferred-late.d.ts +2 -0
  34. package/types/deferred.d.ts +28 -0
  35. package/types/field-info.d.ts +6 -3
  36. package/types/fields.d.ts +3 -2
  37. package/types/icons.d.ts +2 -0
  38. package/types/index.d.ts +20 -10
  39. package/types/labels-de.d.ts +2 -0
  40. package/types/labels.d.ts +55 -459
  41. package/types/lazy-menus.d.ts +2 -2
  42. package/types/menu-labels.d.ts +20 -0
  43. package/types/menu-ops.d.ts +33 -0
  44. package/types/menu-topics.d.ts +6 -3
  45. package/types/menus.d.ts +1 -0
  46. package/types/names.d.ts +20 -2
  47. package/types/notices.d.ts +212 -0
  48. package/types/point-menu.d.ts +21 -0
  49. package/types/quick-choices.d.ts +28 -0
  50. package/types/side-by-side.d.ts +19 -0
  51. package/types/tip-state.d.ts +97 -0
  52. package/types/tips.d.ts +13 -250
  53. package/types/unused-texts.d.ts +3 -0
  54. package/types/view-ops.d.ts +27 -14
  55. package/types/view-tabs.d.ts +4 -3
  56. package/dist/chunks/chunk-W2SVDHGN.js +0 -1898
@@ -35,6 +35,7 @@ export type Choice = {
35
35
  }>;
36
36
  className?: string;
37
37
  note?: string;
38
+ scale?: string[];
38
39
  };
39
40
  export type Topic = {
40
41
  id: string;
@@ -84,8 +85,9 @@ export type Topic = {
84
85
  * hint?: string, icon?: string, closes?: boolean, checkbox?: boolean, disabled?: boolean, reason?: string, info?: string,
85
86
  * keywords?: string, open?: string, backTo?: string, actions?: Array<Choice & { label: string }>, current?: boolean, testId?: string, label?: string,
86
87
  * color?: { id: string, value: string, label: string, pick: (color: string) => void },
87
- * tags?: Array<{ icon: string, text: string }>, className?: string, note?: string }} Choice
88
+ * tags?: Array<{ icon: string, text: string }>, className?: string, note?: string, scale?: string[] }} Choice
88
89
  * `tags`: small marks after the text (the zones a field is in), hidden from assistive technology;
90
+ * `scale`: the colours of a colour scale, low to high, drawn as a strip after the text;
89
91
  * `note`: a line under the text that says what choosing it does, read with it; `className`: the
90
92
  * item's own class (a field's type).
91
93
  */
@@ -148,7 +150,7 @@ export declare function filterTopic({ view, field, labels, locale, state, encode
148
150
  encoded?: any;
149
151
  }): Topic;
150
152
  /**
151
- * The topics of a field's menu in Filters (the whole report): Filter, Move to.
153
+ * The topics of a field's menu in Filters (the whole report): Filter, Group for a date, Move to.
152
154
  * @param {{ view: any, index: number, field: string, types: Map<string, string>, labels: any, locale: string, state?: any, encoded?: any }} input
153
155
  * @returns {Topic[]}
154
156
  */
@@ -267,7 +269,7 @@ export declare function moreTopics({ labels, tips, explanations, act }: {
267
269
  * (pivotkit-core's chart settings); the type stays. Reference lines come after Tooltip: a level with
268
270
  * a form (toolbar-panels.jsx), its row saying which lines are on.
269
271
  * @param {{ view: any, drawn: string, labels: any, names: string[], act: { display: (patch: object) => void, expand?: () => void, collapse?: () => void }, drawnColors?: Map<string, string>,
270
- * lines?: { rules: { average: boolean, trend: boolean, target: boolean, notes?: string[] }, targetText: string },
272
+ * lines?: { rules: { average: boolean, trend: boolean, target: boolean, extremes: boolean, notes?: string[] }, targetText: string },
271
273
  * folding?: { canExpand: boolean, canCollapse: boolean, collapsed: number, why: any } }} input
272
274
  * `drawn`: the picker entry drawn (chart-types.js); `names`: the legend's entries (series, a pie's slices);
273
275
  * `lines`: which reference lines the chart can draw (pivotkit-core's referenceLineChecks, or its
@@ -293,6 +295,7 @@ export declare function chartTopics({ view, drawn, labels, names, act, lines, dr
293
295
  average: boolean;
294
296
  trend: boolean;
295
297
  target: boolean;
298
+ extremes: boolean;
296
299
  notes?: string[];
297
300
  };
298
301
  targetText: string;
package/types/menus.d.ts CHANGED
@@ -3,6 +3,7 @@ export { AddMenu } from "./add-menu.jsx";
3
3
  export { ChartSettingsPanel, ExportPanel, LoadCheck, MorePanel, TableSettingsPanel, ViewsPanel } from "./toolbar-panels.jsx";
4
4
  export { FilterPopover } from "./filter.jsx";
5
5
  export { DrillPanel } from "./drill-panel.jsx";
6
+ export { PointMenu } from "./point-menu.jsx";
6
7
  export { DataMenu } from "./data-menu.jsx";
7
8
  export { addMenuTexts, hasMenuTexts, menuLabels } from "./menu-labels.js";
8
9
  export { storedViews } from "./view-store.js";
package/types/names.d.ts CHANGED
@@ -3,6 +3,13 @@
3
3
  * exports name it ("Sum of Revenue (2)", pivotkit-core's numberRepeats).
4
4
  */
5
5
  export declare const valueLabels: (values: any, labels: any) => string[];
6
+ /**
7
+ * The name a field has without the report's own (#158): the host's display name, else the field's.
8
+ * The placeholder of its Name level, and the field list's second line under a renamed field.
9
+ * @param {string} field
10
+ * @param {any} labels the report's labels (PivotReport: hostNames when the view renames a field)
11
+ */
12
+ export declare function sourceFieldName(field: string, labels: any): string;
6
13
  /** "Sum of Revenue", "% of grand total of Revenue", or the value's own name. */
7
14
  export declare function valueLabel(spec: any, labels: any): any;
8
15
  /**
@@ -18,11 +25,21 @@ export declare function refLabel(view: any, ref: {
18
25
  field: string | null;
19
26
  agg: string;
20
27
  } | null | undefined, labels: import("./labels.js").UiLabels): any;
28
+ /**
29
+ * The column a sort by one column goes by, as the table names its items ("2025 › Jul"): each item by
30
+ * pivotkit-core's fieldItems of its column field.
31
+ * @param {any} view
32
+ * @param {any[]} column
33
+ * @param {import("pivotkit-core").Encoded} encoded
34
+ */
35
+ export declare function columnText(view: any, column: any[], encoded: import("pivotkit-core").Encoded, labels: any, locale: any): string;
21
36
  /**
22
37
  * A sort in words: "Z to A", "Largest Sum of Revenue first", "Custom order".
23
38
  * @param {any} view
24
- * @param {{ by: string, order: string, value?: { field: string | null, agg: string } }} sort
39
+ * @param {{ by: string, order: string, value?: { field: string | null, agg: string }, column?: any[] }} sort
25
40
  * @param {import("./labels.js").UiLabels} labels
41
+ * @param {string} [columnText] the column of a sort by one column, as the table names it ("Jul",
42
+ * "2025 › Jul"); default its items as text
26
43
  */
27
44
  export declare function sortText(view: any, sort: {
28
45
  by: string;
@@ -31,7 +48,8 @@ export declare function sortText(view: any, sort: {
31
48
  field: string | null;
32
49
  agg: string;
33
50
  };
34
- }, labels: import("./labels.js").UiLabels): string;
51
+ column?: any[];
52
+ }, labels: import("./labels.js").UiLabels, columnText?: string): string;
35
53
  /**
36
54
  * A value condition in short: "Sum of Revenue > 1,000", "Sum of Revenue between 5 and 8".
37
55
  * @param {any} view
@@ -0,0 +1,212 @@
1
+ /** Tips shown at a time: one, the most important; the next waits until it is followed or dismissed. */
2
+ export declare const TIP_LIMIT = 1;
3
+ export type TipContext = {
4
+ /**
5
+ * the normalized view
6
+ */
7
+ view: any;
8
+ /**
9
+ * what the result shows: "table", "chart" or, on a wide report, "both" (#51)
10
+ */
11
+ display: string;
12
+ /**
13
+ * nothing placed
14
+ */
15
+ empty: boolean;
16
+ /**
17
+ * the result cannot be shown (an error is shown instead)
18
+ */
19
+ failed: boolean;
20
+ /**
21
+ * the type of a field's source column
22
+ */
23
+ typeOf: (field: string) => string;
24
+ encoded: import("pivotkit-core").Encoded;
25
+ /**
26
+ * display names (labels.core.fields)
27
+ */
28
+ fields?: Record<string, string>;
29
+ /**
30
+ * rows of the innermost row field (1 without row fields)
31
+ */
32
+ rowLeaves: number;
33
+ /**
34
+ * columns of the innermost column field (1 without column fields)
35
+ */
36
+ colLeaves: number;
37
+ /**
38
+ * a column group with more than one child is expanded, so a
39
+ * column subtotal shows when column subtotals are on (core's layout.js draws none for one child)
40
+ */
41
+ colSubtotalShown: boolean;
42
+ /**
43
+ * source rows left after the filters
44
+ */
45
+ matched: number;
46
+ /**
47
+ * source rows of the data
48
+ */
49
+ dataRows: number;
50
+ /**
51
+ * the chart's series, when the chart shows
52
+ */
53
+ series: {
54
+ series: any[];
55
+ categories: any[];
56
+ categoryCount: number;
57
+ } | null;
58
+ /**
59
+ * the table (with cells) is on screen
60
+ */
61
+ tableShown: boolean;
62
+ /**
63
+ * a value was opened once
64
+ */
65
+ drilled: boolean;
66
+ /**
67
+ * changes of the view in this session
68
+ */
69
+ changes: number;
70
+ /**
71
+ * `changes` when the first drag ended, null before
72
+ */
73
+ dragAt: number | null;
74
+ /**
75
+ * the host lets the user save templates
76
+ */
77
+ canSave: boolean;
78
+ /**
79
+ * `changes` when the view was last saved (0: not saved in this session)
80
+ */
81
+ savedAt: number;
82
+ /**
83
+ * what the chart draws (chart-types.js chartPlan): the type, whether the data chose it, rows and
84
+ * columns swapped for it, the settings it draws with
85
+ */
86
+ chartPlan: {
87
+ name: string;
88
+ auto: boolean;
89
+ swap: boolean;
90
+ chart?: {
91
+ type: string;
92
+ stacked: boolean;
93
+ horizontal: boolean;
94
+ };
95
+ };
96
+ };
97
+ export type TipEntry = {
98
+ id: string;
99
+ /**
100
+ * null: not now; else the
101
+ * placeholders of its text (and `action` data)
102
+ */
103
+ when: (ctx: TipContext) => Record<string, any> | null;
104
+ /**
105
+ * the action of its button: a key of labels.tipActions and of PivotReport's actions
106
+ */
107
+ action?: string;
108
+ /**
109
+ * a notice: always shown, not dismissible, outside the tips' limit
110
+ */
111
+ kind?: "notice";
112
+ icon?: string;
113
+ };
114
+ /**
115
+ * @typedef {object} TipContext what the conditions read; built by tipContext()
116
+ * @property {any} view the normalized view
117
+ * @property {string} display what the result shows: "table", "chart" or, on a wide report, "both" (#51)
118
+ * @property {boolean} empty nothing placed
119
+ * @property {boolean} failed the result cannot be shown (an error is shown instead)
120
+ * @property {(field: string) => string} typeOf the type of a field's source column
121
+ * @property {import("pivotkit-core").Encoded} encoded
122
+ * @property {Record<string, string>} [fields] display names (labels.core.fields)
123
+ * @property {number} rowLeaves rows of the innermost row field (1 without row fields)
124
+ * @property {number} colLeaves columns of the innermost column field (1 without column fields)
125
+ * @property {boolean} colSubtotalShown a column group with more than one child is expanded, so a
126
+ * column subtotal shows when column subtotals are on (core's layout.js draws none for one child)
127
+ * @property {number} matched source rows left after the filters
128
+ * @property {number} dataRows source rows of the data
129
+ * @property {{ series: any[], categories: any[], categoryCount: number } | null} series the chart's series, when the chart shows
130
+ * @property {boolean} tableShown the table (with cells) is on screen
131
+ * @property {boolean} drilled a value was opened once
132
+ * @property {number} changes changes of the view in this session
133
+ * @property {number | null} dragAt `changes` when the first drag ended, null before
134
+ * @property {boolean} canSave the host lets the user save templates
135
+ * @property {number} savedAt `changes` when the view was last saved (0: not saved in this session)
136
+ * @property {{ name: string, auto: boolean, swap: boolean, chart?: { type: string, stacked: boolean, horizontal: boolean } }} chartPlan
137
+ * what the chart draws (chart-types.js chartPlan): the type, whether the data chose it, rows and
138
+ * columns swapped for it, the settings it draws with
139
+ */
140
+ /**
141
+ * @typedef {object} TipEntry
142
+ * @property {string} id
143
+ * @property {(ctx: TipContext) => Record<string, any> | null} when null: not now; else the
144
+ * placeholders of its text (and `action` data)
145
+ * @property {string} [action] the action of its button: a key of labels.tipActions and of PivotReport's actions
146
+ * @property {"notice"} [kind] a notice: always shown, not dismissible, outside the tips' limit
147
+ * @property {string} [icon]
148
+ */
149
+ export declare const name: (ctx: any, field: any) => string;
150
+ export declare const chart: (ctx: any) => boolean;
151
+ /** The chart's series where chart(ctx) holds. */
152
+ export declare const seriesOf: (ctx: any) => NonNullable<TipContext["series"]>;
153
+ /** @type {readonly TipEntry[]} the notices, most important first: that is the order they show in */
154
+ export declare const NOTICES: readonly TipEntry[];
155
+ /**
156
+ * What the conditions read, from the report's state. Pure.
157
+ * @param {{ view: any, result: import("pivotkit-core").PivotResult | null, encoded: import("pivotkit-core").Encoded,
158
+ * failed: boolean, empty: boolean, typeOf: (field: string) => string, fields?: Record<string, string>,
159
+ * display?: string, series?: TipContext["series"], tableShown?: boolean, drilled?: boolean, changes?: number, dragAt?: number | null, canSave?: boolean,
160
+ * savedAt?: number, chartPlan?: TipContext["chartPlan"] }} state
161
+ * @returns {TipContext}
162
+ */
163
+ export declare function tipContext({ view, display, result, encoded, failed, empty, typeOf, fields, series, tableShown, drilled, changes, dragAt, canSave, savedAt, chartPlan }: {
164
+ view: any;
165
+ result: import("pivotkit-core").PivotResult | null;
166
+ encoded: import("pivotkit-core").Encoded;
167
+ failed: boolean;
168
+ empty: boolean;
169
+ typeOf: (field: string) => string;
170
+ fields?: Record<string, string>;
171
+ display?: string;
172
+ series?: TipContext["series"];
173
+ tableShown?: boolean;
174
+ drilled?: boolean;
175
+ changes?: number;
176
+ dragAt?: number | null;
177
+ canSave?: boolean;
178
+ savedAt?: number;
179
+ chartPlan?: TipContext["chartPlan"];
180
+ }): TipContext;
181
+ /**
182
+ * What to show now, the most important first: every notice whose condition holds, then the tips
183
+ * whose condition holds, allowed by the host and not dismissed, at most `limit` of them.
184
+ * @param {readonly TipEntry[]} table NOTICES, or every row (tips.js TIPS)
185
+ * @param {TipContext} ctx
186
+ * @param {{ allowed: "on" | "off" | readonly string[], dismissed: ReadonlySet<string> | readonly string[], limit?: number }} options
187
+ * @returns {Array<{ id: string, params: Record<string, any>, entry: TipEntry }>}
188
+ */
189
+ export declare function activeEntries(table: readonly TipEntry[], ctx: TipContext, { allowed, dismissed, limit }: {
190
+ allowed: "on" | "off" | readonly string[];
191
+ dismissed: ReadonlySet<string> | readonly string[];
192
+ limit?: number;
193
+ }): Array<{
194
+ id: string;
195
+ params: Record<string, any>;
196
+ entry: TipEntry;
197
+ }>;
198
+ /**
199
+ * The text of a tip in the labels' language; numbers in the locale.
200
+ * @param {string} id
201
+ * @param {Record<string, any>} params
202
+ * @param {import("./labels.js").UiLabels} labels
203
+ * @param {string} locale
204
+ */
205
+ export declare function tipText(id: string, params: Record<string, any>, labels: import("./labels.js").UiLabels, locale: string): any;
206
+ /**
207
+ * The text of a tip's button.
208
+ * @param {TipEntry} entry
209
+ * @param {Record<string, any>} params
210
+ * @param {import("./labels.js").UiLabels} labels
211
+ */
212
+ export declare function tipActionText(entry: TipEntry, params: Record<string, any>, labels: import("./labels.js").UiLabels): string;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ /**
3
+ * @param {{ target: { anchor: HTMLElement, home?: HTMLElement | null, point: any } | null, onClose: () => void, onRows: (point: any) => void, view: any,
4
+ * encoded: import("pivotkit-core").Encoded, locale: string, labels: any, commit: (view: any, note?: any) => void, showRows?: boolean }} props
5
+ * `showRows`: whether "Show the rows" goes anywhere (the drill-down panel or the host's onCellClick)
6
+ */
7
+ export declare function PointMenu({ target, onClose, onRows, view, encoded, locale, labels, commit, showRows }: {
8
+ target: {
9
+ anchor: HTMLElement;
10
+ home?: HTMLElement | null;
11
+ point: any;
12
+ } | null;
13
+ onClose: () => void;
14
+ onRows: (point: any) => void;
15
+ view: any;
16
+ encoded: import("pivotkit-core").Encoded;
17
+ locale: string;
18
+ labels: any;
19
+ commit: (view: any, note?: any) => void;
20
+ showRows?: boolean;
21
+ }): React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ /** Whether a quick choice sits under More choices (next, before, rolling periods): More opens with it. */
3
+ export declare const inMore: (quick: any) => boolean;
4
+ /**
5
+ * The quick choices of a date along the time line, each with the days it keeps, the data's share of
6
+ * them and its rows: All; This [unit] (only the units whose current period has data; none: named in a
7
+ * line); Last [N] [unit], with "Include the current <unit>" under it while it is set. More choices,
8
+ * folded: Next [N] [unit], Before the last [N] [unit], rolling instead of whole calendar periods.
9
+ * The units are none finer than the grouping (ruleKind's `units`). A choice applies at once, a count
10
+ * typed a moment after the typing stops (and picks its choice), a unit chosen at once (Last keeps its
11
+ * count while it reaches the data, else takes the smallest that does); each unit select is named
12
+ * after its choice. When Last's current period has no data and it counts from today, a button under
13
+ * it counts back from the latest record. "Counted back from": today, the latest or the first record,
14
+ * or a date (one being typed keeps the last whole date for the ranges and says so); shown below the
15
+ * choices when the data end before the current period or the reference is not today, else among
16
+ * More choices. The line of the choices not offered stands right under them.
17
+ */
18
+ export declare function QuickChoices({ ctx, quick, anchor, setAnchorLocal, span, column, counts, moreOpen, setMoreOpen }: {
19
+ anchor: any;
20
+ column: any;
21
+ counts: any;
22
+ ctx: any;
23
+ moreOpen: any;
24
+ quick: any;
25
+ setAnchorLocal: any;
26
+ setMoreOpen: any;
27
+ span: any;
28
+ }): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ /** The table's share of the width, in percent: at the start, the least and the most, a key's step. */
3
+ export declare const SPLIT: Readonly<{
4
+ start: 50;
5
+ min: 25;
6
+ max: 75;
7
+ step: 5;
8
+ }>;
9
+ /**
10
+ * @param {{ labels: any, split: number, onSplit: (split: number) => void, table: React.ReactNode, chart: React.ReactNode }} props
11
+ * `split`: the table's share in percent
12
+ */
13
+ export declare function SideBySide({ labels, split, onSplit: setSplit, table, chart }: {
14
+ labels: any;
15
+ split: number;
16
+ onSplit: (split: number) => void;
17
+ table: React.ReactNode;
18
+ chart: React.ReactNode;
19
+ }): React.JSX.Element;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Every tip id, for a host's `tips` list and for stored dismissals: the ids of the table in tips.js,
3
+ * in its order (test/tips.test.js checks it). A list of its own, so the stored dismissals keep every id
4
+ * while the table itself is still loading (pivotkit-element).
5
+ */
6
+ export declare const TIP_IDS: readonly string[];
7
+ /** The notices of the table in tips.js: shown whenever they hold, whatever the tips settings are. */
8
+ export declare const NOTICE_IDS: readonly string[];
9
+ /** The dismissal that switches every tip off ("Show tips" in Options). */
10
+ export declare const ALL_TIPS = "*";
11
+ /**
12
+ * The other switch of Options → Help, "Show explanations", kept in the same list (and storage) as the
13
+ * tips: off, it hides every "i" - of the settings, of the zones and of the field descriptions -
14
+ * except those a host forces on (the props settingInfo, zoneInfo and fieldInfo).
15
+ */
16
+ export declare const NO_EXPLANATIONS = "-explanations";
17
+ /** The field list collapsed to a rail by the user (a wide or medium report), kept in the same list. */
18
+ export declare const FIELDS_COLLAPSED = "-fields";
19
+ /** Entries of the list that are switches, not dismissed tips: "Show dismissed tips again" keeps them. */
20
+ export declare const SWITCHES: readonly string[];
21
+ /**
22
+ * Whether the field list is collapsed: the user's choice in this session, else the host's
23
+ * `fieldList` ("open" or "collapsed"), else what the user chose before (the list).
24
+ * @param {boolean | null} session
25
+ * @param {unknown} forced
26
+ * @param {readonly string[]} dismissed
27
+ */
28
+ export declare function fieldsCollapsed(session: boolean | null, forced: unknown, dismissed: readonly string[]): boolean;
29
+ /** Entries "Show dismissed tips again" keeps: the switches. */
30
+ export declare const keptOnReset: (id: any) => boolean;
31
+ /**
32
+ * Whether one kind of "i" shows: the host's "on" or "off" forces it (and the user's switch leaves it
33
+ * alone), else the user's "Show explanations" in the list, on by default.
34
+ * @param {unknown} forced the host's prop (settingInfo, zoneInfo or fieldInfo)
35
+ * @param {readonly string[]} dismissed
36
+ * @param {string} [off] the switch's entry, NO_EXPLANATIONS
37
+ * @returns {{ on: boolean, user: boolean }} `user`: the user's switch decides
38
+ */
39
+ export declare function helpSwitch(forced: unknown, dismissed: readonly string[], off?: string): {
40
+ on: boolean;
41
+ user: boolean;
42
+ };
43
+ /**
44
+ * The keyboard shortcuts of the help section in Options: the keys (with "Mod" for Ctrl or ⌘) and
45
+ * the key of their text in labels.shortcuts.
46
+ */
47
+ export declare const SHORTCUTS: readonly {
48
+ keys: string[];
49
+ text: string;
50
+ }[];
51
+ /**
52
+ * A host's `tips` prop or attribute: "on" (default), "off", or the ids it allows (an array, or a
53
+ * comma-separated text); unknown ids are left out.
54
+ * @param {unknown} value
55
+ * @returns {"on" | "off" | string[]}
56
+ */
57
+ export declare function allowedTips(value: unknown): "on" | "off" | string[];
58
+ /** Dismissed ids from anywhere (storage, a host): known ids and the switches only, once each. */
59
+ export declare function cleanDismissed(value: any): any[];
60
+ /** The localStorage key of a report's tips: one per `storageKey`, so two reports never share one. */
61
+ export declare const storageName: (key: any) => string;
62
+ /**
63
+ * The stored text of a report's dismissed tips, or null (no key, no storage, blocked). A text, so a
64
+ * React store snapshot of it compares by value.
65
+ * @param {string | undefined} key
66
+ * @param {Pick<Storage, "getItem"> | null | undefined} storage
67
+ * @returns {string | null}
68
+ */
69
+ export declare function readStored(key: string | undefined, storage: Pick<Storage, "getItem"> | null | undefined): string | null;
70
+ /** The dismissed ids of a stored text: [] for nothing or broken JSON. @param {string | null} raw */
71
+ export declare function parseStored(raw: string | null): any[];
72
+ /**
73
+ * The dismissed tips stored for a report, or [] (no key, no storage, blocked, broken JSON).
74
+ * @param {string | undefined} key
75
+ * @param {Pick<Storage, "getItem"> | null | undefined} storage
76
+ */
77
+ export declare function readDismissed(key: string | undefined, storage: Pick<Storage, "getItem"> | null | undefined): any[];
78
+ /**
79
+ * Listens to the stored tips of a key: a write in this page (writeDismissed) or in another tab of
80
+ * the same site. For useSyncExternalStore, so the report reads the storage only after hydration (its
81
+ * server snapshot is "nothing stored").
82
+ * @param {string | undefined} key
83
+ * @param {() => void} callback
84
+ * @returns {() => void} stops listening
85
+ */
86
+ export declare function subscribeStored(key: string | undefined, callback: () => void): () => void;
87
+ /**
88
+ * Stores the dismissed tips of a report and tells the reports of the page that use the key; nothing
89
+ * without a key or storage, and quietly when the browser refuses (private mode, quota): the tips stay
90
+ * dismissed until the page is loaded again.
91
+ * @param {string | undefined} key
92
+ * @param {Pick<Storage, "setItem" | "removeItem"> | null | undefined} storage
93
+ * @param {readonly string[]} dismissed
94
+ */
95
+ export declare function writeDismissed(key: string | undefined, storage: Pick<Storage, "setItem" | "removeItem"> | null | undefined, dismissed: readonly string[]): void;
96
+ /** The Filters zone fields, kept with empty filters, and every other filter gone: "Remove filter". */
97
+ export declare function withoutFilters(view: any): any;