pivotkit-react 0.0.0-stage → 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 (89) hide show
  1. package/CHANGELOG.md +442 -0
  2. package/LICENSE +21 -0
  3. package/README.md +77 -2
  4. package/dist/chunks/chunk-53ZMK4BH.js +177 -0
  5. package/dist/chunks/chunk-F6MVUAQD.js +741 -0
  6. package/dist/chunks/chunk-LQCWFJBS.js +310 -0
  7. package/dist/chunks/chunk-OYY4BKIL.js +93 -0
  8. package/dist/chunks/chunk-QBD4FOBB.js +254 -0
  9. package/dist/chunks/chunk-X7H7BAVT.js +1752 -0
  10. package/dist/chunks/unused-texts-YTNJCFFC.js +10 -0
  11. package/dist/chunks/unused-texts-de-SGOHV4N7.js +6 -0
  12. package/dist/echarts.js +347 -0
  13. package/dist/index.js +3482 -0
  14. package/dist/labels.js +21 -0
  15. package/dist/menu-texts-de.js +6 -0
  16. package/dist/menus.js +1681 -0
  17. package/dist/styles.css +2529 -0
  18. package/package.json +70 -4
  19. package/types/PivotReport.d.ts +20 -0
  20. package/types/all-labels.d.ts +5 -0
  21. package/types/chart-decorate.d.ts +16 -0
  22. package/types/chart-layout.d.ts +111 -0
  23. package/types/chart-options.d.ts +23 -0
  24. package/types/chart-summary.d.ts +12 -0
  25. package/types/chart-tooltip.d.ts +38 -0
  26. package/types/chart-types.d.ts +61 -0
  27. package/types/chart.d.ts +39 -0
  28. package/types/chip-menus.d.ts +32 -0
  29. package/types/clear-input.d.ts +20 -0
  30. package/types/dnd-moves.d.ts +45 -0
  31. package/types/dnd.d.ts +101 -0
  32. package/types/dom.d.ts +52 -0
  33. package/types/drill-export.d.ts +42 -0
  34. package/types/drill-panel.d.ts +22 -0
  35. package/types/drill-table.d.ts +71 -0
  36. package/types/drill.d.ts +26 -0
  37. package/types/echarts.d.ts +4 -0
  38. package/types/export-run.d.ts +59 -0
  39. package/types/field-info.d.ts +34 -0
  40. package/types/fields.d.ts +32 -0
  41. package/types/files.d.ts +27 -0
  42. package/types/filter.d.ts +21 -0
  43. package/types/help.d.ts +21 -0
  44. package/types/icons.d.ts +80 -0
  45. package/types/index.d.ts +536 -0
  46. package/types/info.d.ts +34 -0
  47. package/types/iso.d.ts +2 -0
  48. package/types/labels.d.ts +663 -0
  49. package/types/lazy-menus.d.ts +28 -0
  50. package/types/menu-labels-de.d.ts +2 -0
  51. package/types/menu-labels.d.ts +317 -0
  52. package/types/menu-ops.d.ts +145 -0
  53. package/types/menu-texts.d.ts +2 -0
  54. package/types/menus.d.ts +7 -0
  55. package/types/names.d.ts +80 -0
  56. package/types/numbers.d.ts +13 -0
  57. package/types/overflow.d.ts +62 -0
  58. package/types/place.d.ts +43 -0
  59. package/types/popover.d.ts +93 -0
  60. package/types/rove.d.ts +20 -0
  61. package/types/section.d.ts +25 -0
  62. package/types/sections.d.ts +2 -0
  63. package/types/share-actions.d.ts +99 -0
  64. package/types/share.d.ts +114 -0
  65. package/types/skeleton.d.ts +9 -0
  66. package/types/storage.d.ts +24 -0
  67. package/types/table.d.ts +29 -0
  68. package/types/templates.d.ts +46 -0
  69. package/types/theme.d.ts +24 -0
  70. package/types/tip-list.d.ts +20 -0
  71. package/types/tips.d.ts +300 -0
  72. package/types/toasts.d.ts +26 -0
  73. package/types/toolbar-panels.d.ts +93 -0
  74. package/types/toolbar.d.ts +5 -0
  75. package/types/unused-load.d.ts +23 -0
  76. package/types/unused-texts-de.d.ts +2 -0
  77. package/types/unused-texts.d.ts +130 -0
  78. package/types/unused.d.ts +22 -0
  79. package/types/use-big-result.d.ts +29 -0
  80. package/types/use-export.d.ts +7 -0
  81. package/types/use-theme.d.ts +11 -0
  82. package/types/use-view-history.d.ts +37 -0
  83. package/types/version.d.ts +2 -0
  84. package/types/view-history.d.ts +106 -0
  85. package/types/view-ops.d.ts +293 -0
  86. package/types/view-save.d.ts +76 -0
  87. package/types/view-store.d.ts +59 -0
  88. package/types/virtual.d.ts +44 -0
  89. package/types/zones.d.ts +42 -0
@@ -0,0 +1,93 @@
1
+ import React from "react";
2
+ /** The layer element and the size class of the report ("wide", "medium", "narrow"). */
3
+ export declare const LayerContext: React.Context<{
4
+ layer: HTMLElement | null;
5
+ size: string;
6
+ }>;
7
+ /**
8
+ * Whether a wheel turn inside a popover may scroll something there: an element on its way from the
9
+ * target up to the popover that scrolls in that direction and is not at its end. Else the popover
10
+ * keeps it (preventDefault), so the table or the page behind never scrolls.
11
+ * @param {EventTarget[]} path the event's composed path
12
+ * @param {Element} popover
13
+ * @param {number} dx
14
+ * @param {number} dy
15
+ */
16
+ export declare function wheelScrollsInside(path: EventTarget[], popover: Element, dx: number, dy: number): boolean;
17
+ /**
18
+ * @param {{ open: boolean, anchor: React.RefObject<HTMLElement>, onClose: () => void, label?: string,
19
+ * role?: "menu" | "dialog" | "tooltip", align?: "start" | "end", className?: string, id?: string,
20
+ * passive?: boolean, fill?: boolean, onPointerEnter?: (e: React.PointerEvent) => void, onPointerLeave?: (e: React.PointerEvent) => void,
21
+ * children: React.ReactNode }} props
22
+ * `fill`: a popover with a scrolling middle and a foot that stays in view (the filter, a chip menu)
23
+ * may cover its anchor when it fits on neither side (place.js)
24
+ * `passive`: shown on hover or focus of its button (a description): the focus stays where it is,
25
+ * never a bottom sheet
26
+ */
27
+ export declare function Popover({ open, anchor, onClose, label, role, align, className, id, passive, fill, onPointerEnter, onPointerLeave, children }: {
28
+ open: boolean;
29
+ anchor: React.RefObject<HTMLElement>;
30
+ onClose: () => void;
31
+ label?: string;
32
+ role?: "menu" | "dialog" | "tooltip";
33
+ align?: "start" | "end";
34
+ className?: string;
35
+ id?: string;
36
+ passive?: boolean;
37
+ fill?: boolean;
38
+ onPointerEnter?: (e: React.PointerEvent) => void;
39
+ onPointerLeave?: (e: React.PointerEvent) => void;
40
+ children: React.ReactNode;
41
+ }): React.ReactPortal | null;
42
+ /**
43
+ * A button that opens a popover. `children` is a function of `close`.
44
+ * @param {{ label: string, icon?: string, text?: React.ReactNode, showText?: boolean, className?: string,
45
+ * role?: "menu" | "dialog", align?: "start" | "end", popoverClass?: string, disabled?: boolean,
46
+ * title?: string, children: (close: () => void) => React.ReactNode, testId?: string, name?: string,
47
+ * buttonRef?: React.RefObject<HTMLButtonElement>, tabIndex?: number, slot?: string, fill?: boolean, mark?: React.ReactNode }} props
48
+ * `tabIndex`: -1 where a list moves the focus itself (the field list); `mark`: after the text (the
49
+ * dot for unsaved changes on "More")
50
+ */
51
+ export declare function MenuButton({ label, icon, text, showText, className, role, align, popoverClass, disabled, title, children, testId, buttonRef, name, tabIndex, slot, fill, mark }: {
52
+ label: string;
53
+ icon?: string;
54
+ text?: React.ReactNode;
55
+ showText?: boolean;
56
+ className?: string;
57
+ role?: "menu" | "dialog";
58
+ align?: "start" | "end";
59
+ popoverClass?: string;
60
+ disabled?: boolean;
61
+ title?: string;
62
+ children: (close: () => void) => React.ReactNode;
63
+ testId?: string;
64
+ name?: string;
65
+ buttonRef?: React.RefObject<HTMLButtonElement>;
66
+ tabIndex?: number;
67
+ slot?: string;
68
+ fill?: boolean;
69
+ mark?: React.ReactNode;
70
+ }): React.JSX.Element;
71
+ /**
72
+ * One option of a menu or of a chip's settings: one line. `hint` is a short second line that belongs
73
+ * to the option (a date unit's example); `reason` says why a disabled option does nothing and shows
74
+ * only while it is disabled (it is state, not an explanation: those go into an "i").
75
+ * @param {{ onSelect: () => void, icon?: string, checked?: boolean, children: React.ReactNode, hint?: React.ReactNode,
76
+ * reason?: React.ReactNode, inMenu?: boolean, disabled?: boolean, danger?: boolean, tone?: "accent", testId?: string, current?: boolean }} props
77
+ * `tone`: "accent" for an option that says what is set (a filter); `current`: the entry shown now
78
+ * (the view loaded), with a check and aria-current
79
+ */
80
+ export declare function Option({ onSelect, icon, checked, children, hint, reason, inMenu, disabled, danger, tone, testId, current }: {
81
+ onSelect: () => void;
82
+ icon?: string;
83
+ checked?: boolean;
84
+ children: React.ReactNode;
85
+ hint?: React.ReactNode;
86
+ reason?: React.ReactNode;
87
+ inMenu?: boolean;
88
+ disabled?: boolean;
89
+ danger?: boolean;
90
+ tone?: "accent";
91
+ testId?: string;
92
+ current?: boolean;
93
+ }): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ /** The controls of a field in the list, left to right. */
2
+ export declare const SLOTS: readonly string[];
3
+ /**
4
+ * The control a key moves the focus to from the focused one, or null for a key the list leaves alone.
5
+ * Up and down keep the column (the menu stays the menu); a row without it takes its name.
6
+ * @param {string} key KeyboardEvent.key
7
+ * @param {{ row: number, slot: string }} at the focused control
8
+ * @param {number} rows the fields shown
9
+ * @param {(row: number) => readonly string[]} slotsOf the controls a row has, in SLOTS order
10
+ * @returns {{ row: number, slot: string } | null}
11
+ */
12
+ export declare function roveTarget(key: string, at: {
13
+ row: number;
14
+ slot: string;
15
+ }, rows: number, slotsOf: (row: number) => readonly string[]): {
16
+ row: number;
17
+ slot: string;
18
+ } | null;
19
+ /** The key that opens the menu of the field in focus: Shift+F10 or the context menu key. */
20
+ export declare const opensMenu: (e: any) => any;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ /**
3
+ * The "i" next to a setting: its explanation (labels.settingInfo[id], loaded with the menus) on
4
+ * hover, focus or tap. Nothing while "Show explanations" is off or the text is missing.
5
+ * @param {{ id: string, name: string }} props `name`: the setting's name, for the button's name
6
+ */
7
+ export declare function SettingInfo({ id, name }: {
8
+ id: string;
9
+ name: string;
10
+ }): React.JSX.Element | null;
11
+ /**
12
+ * A titled group of options. With an `id` of SECTIONS (tips.js) its title is a button that folds it;
13
+ * folded, the title says what the section holds (`state`, muted at its end) and marks a setting that
14
+ * is not the default (`changed`). `info` is the id of an explanation shown as an "i" next to the
15
+ * title.
16
+ * @param {{ title: React.ReactNode, children: React.ReactNode, id?: string, info?: string, state?: string | null, changed?: boolean }} props
17
+ */
18
+ export declare function Section({ title, children, id, info, state, changed }: {
19
+ title: React.ReactNode;
20
+ children: React.ReactNode;
21
+ id?: string;
22
+ info?: string;
23
+ state?: string | null;
24
+ changed?: boolean;
25
+ }): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** The list without the sections' states: every section open or folded as at first, the tips as they are. */
2
+ export declare const withoutSections: (dismissed: any) => any;
@@ -0,0 +1,99 @@
1
+ export type ShareContext = {
2
+ /**
3
+ * the host allows links (shareLink) and the page has an address
4
+ */
5
+ canLink: boolean;
6
+ /**
7
+ * starts loading pivotkit-core/link, so a copy happens in the click
8
+ */
9
+ prepare: (() => void) | undefined;
10
+ /**
11
+ * the view shown
12
+ */
13
+ view: any;
14
+ /**
15
+ * the loaded view's name
16
+ */
17
+ viewName: string | null;
18
+ sourceId: string | undefined;
19
+ sourceName: string | undefined;
20
+ /**
21
+ * the `$schema` of the view files (the prop)
22
+ */
23
+ schemaUrl: string | null | undefined;
24
+ encoded: import("pivotkit-core").Encoded;
25
+ /**
26
+ * the prop: the base of the link
27
+ */
28
+ shareLink: boolean | string | undefined;
29
+ /**
30
+ * the link's parameter in the fragment
31
+ */
32
+ param: string;
33
+ /**
34
+ * the report's root (copies and downloads start from its document)
35
+ */
36
+ root: {
37
+ current: HTMLElement | null;
38
+ };
39
+ /**
40
+ * the host's file name of exports
41
+ */
42
+ fileName: string | undefined;
43
+ onExport: ((file: any) => unknown) | undefined;
44
+ announce: (text: string, extra?: object) => void;
45
+ limits: object | undefined;
46
+ sources: Array<{
47
+ id: string;
48
+ name?: string;
49
+ }> | undefined;
50
+ onSourceSwitch: ((choice: any) => void) | undefined;
51
+ /**
52
+ * shows a loaded view (a step Undo takes back)
53
+ */
54
+ applyLoaded: (loaded: import("./share.js").LoadedView) => void;
55
+ };
56
+ /**
57
+ * @typedef {object} ShareContext what the report passes (PivotReport.jsx)
58
+ * @property {boolean} canLink the host allows links (shareLink) and the page has an address
59
+ * @property {(() => void) | undefined} prepare starts loading pivotkit-core/link, so a copy happens in the click
60
+ * @property {any} view the view shown
61
+ * @property {string | null} viewName the loaded view's name
62
+ * @property {string | undefined} sourceId
63
+ * @property {string | undefined} sourceName
64
+ * @property {string | null | undefined} schemaUrl the `$schema` of the view files (the prop)
65
+ * @property {import("pivotkit-core").Encoded} encoded
66
+ * @property {boolean | string | undefined} shareLink the prop: the base of the link
67
+ * @property {string} param the link's parameter in the fragment
68
+ * @property {{ current: HTMLElement | null }} root the report's root (copies and downloads start from its document)
69
+ * @property {string | undefined} fileName the host's file name of exports
70
+ * @property {((file: any) => unknown) | undefined} onExport
71
+ * @property {(text: string, extra?: object) => void} announce
72
+ * @property {object | undefined} limits
73
+ * @property {Array<{ id: string, name?: string }> | undefined} sources
74
+ * @property {((choice: any) => void) | undefined} onSourceSwitch
75
+ * @property {(loaded: import("./share.js").LoadedView) => void} applyLoaded shows a loaded view (a step Undo takes back)
76
+ */
77
+ /**
78
+ * The share entries' actions.
79
+ * @param {ShareContext} ctx
80
+ * @param {any} labels with the menus' texts
81
+ */
82
+ export declare function shareActions(ctx: ShareContext, labels: any): {
83
+ copyLink: () => Promise<void>;
84
+ copyJson: () => Promise<void>;
85
+ download: () => void;
86
+ /**
87
+ * @param {string} text
88
+ * @returns {Promise<string | null | { lines: string[], load: () => void, switchTo?: { name: string, run: () => void } }>}
89
+ * why nothing was loaded, null when it was, or what to ask first (a view for other data)
90
+ */
91
+ loadText: (text: string) => Promise<string | null | {
92
+ lines: string[];
93
+ load: () => void;
94
+ switchTo?: {
95
+ name: string;
96
+ run: () => void;
97
+ };
98
+ }>;
99
+ };
@@ -0,0 +1,114 @@
1
+ /** pivotkit-core/link (fflate), loaded once, on first use. */
2
+ export declare function loadLink(): Promise<typeof import("pivotkit-core/link")>;
3
+ /** The link module when it is loaded already, else null (see loadLink). */
4
+ export declare const linkNow: () => typeof import("pivotkit-core/link") | null;
5
+ /**
6
+ * The name of a report's view in the URL fragment: "pivot", or "pivot-<storageKey>" so several reports
7
+ * on one page each have their own.
8
+ * @param {string | undefined} storageKey
9
+ */
10
+ export declare function linkParam(storageKey: string | undefined): string;
11
+ /**
12
+ * The encoded view of a fragment ("#pivot=1.abc&pivot-sales=1.def") under a name, or null. The
13
+ * fragment is read as it is, not as form data, so a hash route next to it ("#/reports/a?tab=2&pivot=...")
14
+ * does not matter.
15
+ * @param {string} hash location.hash, with or without "#"
16
+ * @param {string} param
17
+ */
18
+ export declare function readLinkParam(hash: string, param: string): any;
19
+ /**
20
+ * A URL with the encoded view under `param` in its fragment. Only that entry is added, replaced or
21
+ * removed; the rest of the fragment (another report's entry, a hash route such as "#/reports/a?tab=2",
22
+ * an anchor) stays byte for byte.
23
+ * @param {string} url
24
+ * @param {string} param
25
+ * @param {string | null} encoded null removes the entry
26
+ */
27
+ export declare function withLinkParam(url: string, param: string, encoded: string | null): string;
28
+ /**
29
+ * The address a shared link points to: the host's base URL as given, or for `true` the page's own
30
+ * address without its query (it may hold tokens or ids the host did not mean to share) and with its
31
+ * fragment (other entries, a hash route); null when links are off.
32
+ * @param {unknown} shareLink the prop: true, a URL, or anything else for off
33
+ * @param {string | undefined} here the page's address (location.href)
34
+ * @returns {string | null}
35
+ */
36
+ export declare function shareBase(shareLink: unknown, here: string | undefined): string | null;
37
+ /** The sessionStorage key of a report's view: one per storageKey. */
38
+ export declare const viewStorageName: (key: any) => string;
39
+ /**
40
+ * The stored view of a report (persistView="session") as JSON text, or null (none, no storage, blocked).
41
+ * @param {string | undefined} key
42
+ * @param {Pick<Storage, "getItem"> | null | undefined} storage
43
+ */
44
+ export declare function readStoredView(key: string | undefined, storage: Pick<Storage, "getItem"> | null | undefined): string | null;
45
+ /**
46
+ * Stores a report's view; quietly nothing when the browser refuses (private mode, quota).
47
+ * @param {string | undefined} key
48
+ * @param {Pick<Storage, "setItem"> | null | undefined} storage
49
+ * @param {object} view
50
+ */
51
+ export declare function writeStoredView(key: string | undefined, storage: Pick<Storage, "setItem"> | null | undefined, view: object): void;
52
+ /** The characters a view file or pasted JSON may have (pivotkit-core's VIEW_FILE_LIMITS.text). */
53
+ export declare const VIEW_TEXT_MAX: 1000000;
54
+ export type LoadedView = {
55
+ /**
56
+ * normalized against the data; null when nothing can be used
57
+ */
58
+ view: import("pivotkit-core").View | null;
59
+ /**
60
+ * what normalize() left out
61
+ */
62
+ issues: import("pivotkit-core").Issue[];
63
+ /**
64
+ * why nothing can be used: "empty", "tooLarge", "notJson", "notView", "newer"
65
+ */
66
+ failed: string | null;
67
+ /**
68
+ * the view file as read (name, source, compatible)
69
+ */
70
+ file: import("pivotkit-core").ViewFileRead | null;
71
+ };
72
+ /**
73
+ * A view from text someone pasted or a file they chose: a view file (pivotkit-core's fromViewFile), a
74
+ * bare view or a template { name, view }, normalized against the data.
75
+ * @param {string} text
76
+ * @param {import("pivotkit-core").Encoded} encoded
77
+ * @param {{ limits?: object, sourceId?: string }} [options]
78
+ * @returns {LoadedView}
79
+ */
80
+ export declare function viewFromText(text: string, encoded: import("pivotkit-core").Encoded, options?: {
81
+ limits?: object;
82
+ sourceId?: string;
83
+ }): LoadedView;
84
+ /**
85
+ * A view from a parsed object (a link's) or a text, read as a view file and normalized against the
86
+ * data; `file.compatible` says how it fits (the same source by `options.sourceId`, its fields there).
87
+ * @param {unknown} input
88
+ * @param {import("pivotkit-core").Encoded} encoded
89
+ * @param {{ limits?: object, sourceId?: string }} [options]
90
+ * @returns {LoadedView}
91
+ */
92
+ export declare function viewFromObject(input: unknown, encoded: import("pivotkit-core").Encoded, options?: {
93
+ limits?: object;
94
+ sourceId?: string;
95
+ }): LoadedView;
96
+ /**
97
+ * What to ask before a view for other data is applied, or null when it fits: the lines that say why
98
+ * (the source it was made for, the fields missing, the fields of another type) and, when the host
99
+ * can switch to that source (`sources`), its entry. Names from the file are plain text.
100
+ * @param {LoadedView} loaded
101
+ * @param {import("./labels.js").UiLabels} labels
102
+ * @param {Array<{ id: string, name?: string }>} [sources] the sources the host can switch to
103
+ * @returns {{ lines: string[], switchTo: { id: string, name: string } | null } | null}
104
+ */
105
+ export declare function loadCheck(loaded: LoadedView, labels: import("./labels.js").UiLabels, sources?: Array<{
106
+ id: string;
107
+ name?: string;
108
+ }>): {
109
+ lines: string[];
110
+ switchTo: {
111
+ id: string;
112
+ name: string;
113
+ } | null;
114
+ } | null;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ /**
3
+ * The whole report waiting (`full`), or only its result area (the report is there, its data reloads).
4
+ * @param {{ text: string, full?: boolean }} props
5
+ */
6
+ export declare function Skeleton({ text, full }: {
7
+ text: string;
8
+ full?: boolean;
9
+ }): React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ /** The browser's localStorage, or null where it is missing or blocked (a sandboxed frame throws). */
2
+ export declare function localStore(): Storage | null;
3
+ /**
4
+ * The stored text of an item, or null (no storage, nothing stored, blocked).
5
+ * @param {string} name
6
+ * @param {Pick<Storage, "getItem"> | null | undefined} storage
7
+ * @returns {string | null}
8
+ */
9
+ export declare function readItem(name: string, storage: Pick<Storage, "getItem"> | null | undefined): string | null;
10
+ /**
11
+ * Listens to an item: a write in this page (writeItem) or in another tab (the storage event).
12
+ * @param {string} name
13
+ * @param {() => void} callback
14
+ * @returns {() => void} stops listening
15
+ */
16
+ export declare function subscribeItem(name: string, callback: () => void): () => void;
17
+ /**
18
+ * Stores the text of an item (null removes it) and tells its listeners in this page. False when the
19
+ * browser refused (blocked, private mode, quota); nothing is thrown.
20
+ * @param {string} name
21
+ * @param {Pick<Storage, "setItem" | "removeItem"> | null | undefined} storage
22
+ * @param {string | null} text
23
+ */
24
+ export declare function writeItem(name: string, storage: Pick<Storage, "setItem" | "removeItem"> | null | undefined, text: string | null): boolean;
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ /**
3
+ * @param {{ grid: import("pivotkit-core").Grid, view: any, labels: import("./labels.js").UiLabels,
4
+ * onToggle: (axis: string, path: any[]) => void, onCell: (cell: object) => void, version: unknown, hintId?: string,
5
+ * onRowLabel?: (label: string | null) => void, infoOf?: (field: string) => { description?: string } | undefined, showInfo?: boolean,
6
+ * typeOf?: (field: string) => string | undefined, hostOrdered?: (field: string) => boolean, onSort?: (field: string, sort: object | null) => void }} props
7
+ * `onRowLabel`: the whole label of the row of a focused value or a tapped row label while the table
8
+ * is virtual (its labels are cut to one line); null when there is none to show; `infoOf`: the host's
9
+ * description of a field; `showInfo` false: no tooltip for it (the accessible description stays);
10
+ * `onSort`: a header was clicked, the field's new sort entry (setSort's argument); `typeOf` the
11
+ * column type of a field (of its source for a grouping), `hostOrdered` whether the host gives the field an order
12
+ */
13
+ export declare function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version, hintId, onRowLabel, infoOf, showInfo, typeOf, hostOrdered, onSort }: {
14
+ grid: import("pivotkit-core").Grid;
15
+ view: any;
16
+ labels: import("./labels.js").UiLabels;
17
+ onToggle: (axis: string, path: any[]) => void;
18
+ onCell: (cell: object) => void;
19
+ version: unknown;
20
+ hintId?: string;
21
+ onRowLabel?: (label: string | null) => void;
22
+ infoOf?: (field: string) => {
23
+ description?: string;
24
+ } | undefined;
25
+ showInfo?: boolean;
26
+ typeOf?: (field: string) => string | undefined;
27
+ hostOrdered?: (field: string) => boolean;
28
+ onSort?: (field: string, sort: object | null) => void;
29
+ }): React.JSX.Element;
@@ -0,0 +1,46 @@
1
+ /** The localStorage item of a report's views: one per storageKey ("pivotkit:views" without one). */
2
+ export declare const viewsName: (key: any) => string;
3
+ export type TemplateEntry = {
4
+ name: string;
5
+ /**
6
+ * not normalized: the report normalizes it when it is loaded
7
+ */
8
+ view: Record<string, unknown>;
9
+ scope: "shared" | "user";
10
+ deletable: boolean;
11
+ /**
12
+ * its place in the browser store; only for the store's own entries
13
+ */
14
+ at?: number;
15
+ /**
16
+ * the data a view of the browser store names, when it names one
17
+ */
18
+ sourceId?: string;
19
+ };
20
+ /**
21
+ * @typedef {object} TemplateEntry an entry of the Views menu
22
+ * @property {string} name
23
+ * @property {Record<string, unknown>} view not normalized: the report normalizes it when it is loaded
24
+ * @property {"shared" | "user"} scope
25
+ * @property {boolean} deletable
26
+ * @property {number} [at] its place in the browser store; only for the store's own entries
27
+ * @property {string} [sourceId] the data a view of the browser store names, when it names one
28
+ */
29
+ /**
30
+ * The entries of the Views menu: the host's templates (an entry with `file` is read as a view file;
31
+ * one without a usable view or name is left out), then the browser store's. An entry without a
32
+ * `scope` is the user's own when it is deletable, else shared (with a console warning once: a
33
+ * deletable shared view would land under "My views"). A host's entry can be deleted only when it is
34
+ * marked `deletable` and the host takes the delete (`hostDeletes`). Every name is plain text
35
+ * (plainNames), as a name from a file or the store is.
36
+ * @param {unknown} templates the host's
37
+ * @param {Array<{ name: string, view: Record<string, unknown>, at: number, sourceId?: string }>} stored
38
+ * @param {boolean} hostDeletes
39
+ * @returns {TemplateEntry[]}
40
+ */
41
+ export declare function templateEntries(templates: unknown, stored: Array<{
42
+ name: string;
43
+ view: Record<string, unknown>;
44
+ at: number;
45
+ sourceId?: string;
46
+ }>, hostDeletes: boolean): TemplateEntry[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The theme to show.
3
+ * @param {"auto" | "light" | "dark" | undefined} wanted the theme prop
4
+ * @param {string | null | undefined} htmlTheme the value of <html data-theme>
5
+ * @param {boolean} prefersDark matchMedia("(prefers-color-scheme: dark)").matches
6
+ * @returns {"light" | "dark"}
7
+ */
8
+ export declare function resolveTheme(wanted: "auto" | "light" | "dark" | undefined, htmlTheme: string | null | undefined, prefersDark: boolean): "light" | "dark";
9
+ /** Number of categorical chart colours (--pk-chart-1 ... --pk-chart-8). */
10
+ export declare const CHART_COLORS = 8;
11
+ /**
12
+ * The ECharts theme of pivotkit-core's toEChartsOption from the computed style of the report's root.
13
+ * @param {{ getPropertyValue(name: string): string }} style getComputedStyle(root)
14
+ */
15
+ export declare function chartThemeFrom(style: {
16
+ getPropertyValue(name: string): string;
17
+ }): {
18
+ colors: any[];
19
+ textColor: string | undefined;
20
+ axisColor: string | undefined;
21
+ gridColor: string | undefined;
22
+ fontFamily: string | undefined;
23
+ backgroundColor: string;
24
+ };
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ /**
3
+ * @param {{ tips: Array<{ id: string, text: string, icon: string, action: string, actionText: string, notice?: boolean }>,
4
+ * labels: import("./labels.js").UiLabels, onDismiss: (id: string) => void, onAction: (id: string, action: string) => void,
5
+ * focusFallback: () => void }} props
6
+ */
7
+ export declare function Tips({ tips, labels, onDismiss, onAction, focusFallback }: {
8
+ tips: Array<{
9
+ id: string;
10
+ text: string;
11
+ icon: string;
12
+ action: string;
13
+ actionText: string;
14
+ notice?: boolean;
15
+ }>;
16
+ labels: import("./labels.js").UiLabels;
17
+ onDismiss: (id: string) => void;
18
+ onAction: (id: string, action: string) => void;
19
+ focusFallback: () => void;
20
+ }): React.JSX.Element;