athena-ui-js 2.0.0 → 2.0.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 (76) hide show
  1. package/README.md +28 -4
  2. package/package.json +5 -2
  3. package/src/athena-ui.js +1 -1
  4. package/src/libs/config/config.js +1 -1
  5. package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
  6. package/types/athena-ui.d.ts +96 -96
  7. package/types/chart.d.ts +1 -1
  8. package/types/classic.d.ts +1 -1
  9. package/types/components.d.ts +1 -1
  10. package/types/controls.d.ts +3 -3
  11. package/types/csv.d.ts +1 -1
  12. package/types/dialog.d.ts +2 -2
  13. package/types/dom.d.ts +1 -1
  14. package/types/feedback.d.ts +1 -1
  15. package/types/format.d.ts +1 -1
  16. package/types/forms.d.ts +2 -2
  17. package/types/i18n.d.ts +1 -1
  18. package/types/inputs.d.ts +4 -4
  19. package/types/libs/config/config.d.ts +3 -3
  20. package/types/libs/config/hooks.d.ts +8 -8
  21. package/types/libs/core/combobox.d.ts +10 -10
  22. package/types/libs/core/controls.d.ts +28 -28
  23. package/types/libs/core/cookies.d.ts +27 -27
  24. package/types/libs/core/csv.d.ts +12 -12
  25. package/types/libs/core/dateRange.d.ts +72 -72
  26. package/types/libs/core/dom.d.ts +65 -65
  27. package/types/libs/core/elementGenerator.d.ts +30 -30
  28. package/types/libs/core/errors.d.ts +29 -29
  29. package/types/libs/core/focus.d.ts +6 -6
  30. package/types/libs/core/format.d.ts +21 -21
  31. package/types/libs/core/hungarianControls.d.ts +2 -2
  32. package/types/libs/core/i18n.d.ts +17 -17
  33. package/types/libs/core/pagination.d.ts +5 -5
  34. package/types/libs/core/sanitize.d.ts +6 -6
  35. package/types/libs/core/tableMath.d.ts +26 -26
  36. package/types/libs/core/theme.d.ts +39 -39
  37. package/types/libs/core/validation.d.ts +56 -56
  38. package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -10
  39. package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -4
  40. package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -20
  41. package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -1
  42. package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -14
  43. package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -65
  44. package/types/libs/hephaestus/auth/authState.d.ts +26 -26
  45. package/types/libs/hephaestus/auth/session.d.ts +26 -26
  46. package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +2 -0
  47. package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +222 -222
  48. package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -24
  49. package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -120
  50. package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -86
  51. package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -122
  52. package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -6
  53. package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -113
  54. package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -8
  55. package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -11
  56. package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -4
  57. package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -7
  58. package/types/libs/hephaestus/hephaestus.d.ts +3 -3
  59. package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -48
  60. package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -185
  61. package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -49
  62. package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -2
  63. package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +150 -150
  64. package/types/libs/hephaestus/router/matchRoute.d.ts +12 -12
  65. package/types/libs/hephaestus/router/router.d.ts +67 -67
  66. package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -120
  67. package/types/menu.d.ts +1 -1
  68. package/types/navigation.d.ts +1 -1
  69. package/types/res/themes/themes.d.ts +7 -7
  70. package/types/router.d.ts +1 -1
  71. package/types/sanitize.d.ts +1 -1
  72. package/types/session.d.ts +3 -3
  73. package/types/table.d.ts +1 -1
  74. package/types/testing.d.ts +27 -27
  75. package/types/theme.d.ts +2 -2
  76. package/types/validation.d.ts +1 -1
@@ -1,39 +1,39 @@
1
- /**
2
- * @param {object} options
3
- * @param {{id: string, name?: string, description?: string}[]} options.themes the first one is the default
4
- * @param {{id: string, name?: string}[]} [options.modes] default: system, light, dark. Ids "light" and "dark" are the ones that can be resolved
5
- * @param {string} [options.storageKey="athena.appearance"] localStorage key (also give it to theme-boot.js)
6
- * @param {string} [options.themeColorVariable] CSS variable whose value becomes <meta name="theme-color"> (the bar of a phone browser)
7
- * @param {HTMLElement} [options.root] element that gets the attributes (default: <html>)
8
- * @param {Storage} [options.storage] default: localStorage
9
- * @returns {{themes, modes, appearance: () => object, setTheme: (id) => boolean, setMode: (id) => boolean,
10
- * onChange: (listener) => Function, refresh: Function, destroy: Function}}
11
- */
12
- export function createThemeManager(options?: {
13
- themes: {
14
- id: string;
15
- name?: string;
16
- description?: string;
17
- }[];
18
- modes?: {
19
- id: string;
20
- name?: string;
21
- }[];
22
- storageKey?: string;
23
- themeColorVariable?: string;
24
- root?: HTMLElement;
25
- storage?: Storage;
26
- }): {
27
- themes: any;
28
- modes: any;
29
- appearance: () => object;
30
- setTheme: (id: any) => boolean;
31
- setMode: (id: any) => boolean;
32
- onChange: (listener: any) => Function;
33
- refresh: Function;
34
- destroy: Function;
35
- };
36
- export const DEFAULT_MODES: {
37
- id: string;
38
- name: string;
39
- }[];
1
+ /**
2
+ * @param {object} options
3
+ * @param {{id: string, name?: string, description?: string}[]} options.themes the first one is the default
4
+ * @param {{id: string, name?: string}[]} [options.modes] default: system, light, dark. Ids "light" and "dark" are the ones that can be resolved
5
+ * @param {string} [options.storageKey="athena.appearance"] localStorage key (also give it to theme-boot.js)
6
+ * @param {string} [options.themeColorVariable] CSS variable whose value becomes <meta name="theme-color"> (the bar of a phone browser)
7
+ * @param {HTMLElement} [options.root] element that gets the attributes (default: <html>)
8
+ * @param {Storage} [options.storage] default: localStorage
9
+ * @returns {{themes, modes, appearance: () => object, setTheme: (id) => boolean, setMode: (id) => boolean,
10
+ * onChange: (listener) => Function, refresh: Function, destroy: Function}}
11
+ */
12
+ export function createThemeManager(options?: {
13
+ themes: {
14
+ id: string;
15
+ name?: string;
16
+ description?: string;
17
+ }[];
18
+ modes?: {
19
+ id: string;
20
+ name?: string;
21
+ }[];
22
+ storageKey?: string;
23
+ themeColorVariable?: string;
24
+ root?: HTMLElement;
25
+ storage?: Storage;
26
+ }): {
27
+ themes: any;
28
+ modes: any;
29
+ appearance: () => object;
30
+ setTheme: (id: any) => boolean;
31
+ setMode: (id: any) => boolean;
32
+ onChange: (listener: any) => Function;
33
+ refresh: Function;
34
+ destroy: Function;
35
+ };
36
+ export const DEFAULT_MODES: {
37
+ id: string;
38
+ name: string;
39
+ }[];
@@ -1,56 +1,56 @@
1
- /**
2
- * Validates one value. Returns the (translated) error text, or "" when the value is valid.
3
- * Empty values only fail `required`, so optional fields can stay empty.
4
- *
5
- * @param {*} value a string, boolean (checkbox) or array (multiple choice)
6
- * @param {object} [rules]
7
- * @param {boolean} [rules.required]
8
- * @param {boolean} [rules.email]
9
- * @param {number} [rules.minLength]
10
- * @param {number} [rules.maxLength]
11
- * @param {RegExp|string} [rules.pattern]
12
- * @param {number} [rules.min] numeric minimum
13
- * @param {number} [rules.max] numeric maximum
14
- * @param {string} [rules.match] name of another field that has to hold the same value
15
- * @param {(value, values) => (string|boolean|undefined)} [rules.validate] custom rule: a string is the error
16
- * text, false is a generic error, anything else is valid
17
- * @param {object} [values] all values of the form, for `match` and `validate`
18
- */
19
- export function validateValue(value: any, rules?: {
20
- required?: boolean;
21
- email?: boolean;
22
- minLength?: number;
23
- maxLength?: number;
24
- pattern?: RegExp | string;
25
- min?: number;
26
- max?: number;
27
- match?: string;
28
- validate?: (value: any, values: any) => (string | boolean | undefined);
29
- }, values?: object): any;
30
- /**
31
- * Checks a date range given as ISO dates ("2026-01-31"; they compare correctly as text).
32
- * Returns the (translated) error text, or "" when the range is valid. Empty dates are not an error.
33
- *
34
- * @param {string} from
35
- * @param {string} to
36
- * @param {{min?: string, max?: string}} [limits]
37
- */
38
- export function validateDateRange(from: string, to: string, { min, max }?: {
39
- min?: string;
40
- max?: string;
41
- }): any;
42
- /**
43
- * Validates a whole form.
44
- *
45
- * @param {Object<string, object>} ruleSet rules by field name
46
- * @param {Object<string, *>} values
47
- * @returns {Object<string, string>} error text by field name, only for invalid fields
48
- */
49
- export function validateAll(ruleSet: {
50
- [x: string]: any;
51
- }, values: {
52
- [x: string]: any;
53
- }): {
54
- [x: string]: string;
55
- };
56
- export const EMAIL_PATTERN: RegExp;
1
+ /**
2
+ * Validates one value. Returns the (translated) error text, or "" when the value is valid.
3
+ * Empty values only fail `required`, so optional fields can stay empty.
4
+ *
5
+ * @param {*} value a string, boolean (checkbox) or array (multiple choice)
6
+ * @param {object} [rules]
7
+ * @param {boolean} [rules.required]
8
+ * @param {boolean} [rules.email]
9
+ * @param {number} [rules.minLength]
10
+ * @param {number} [rules.maxLength]
11
+ * @param {RegExp|string} [rules.pattern]
12
+ * @param {number} [rules.min] numeric minimum
13
+ * @param {number} [rules.max] numeric maximum
14
+ * @param {string} [rules.match] name of another field that has to hold the same value
15
+ * @param {(value, values) => (string|boolean|undefined)} [rules.validate] custom rule: a string is the error
16
+ * text, false is a generic error, anything else is valid
17
+ * @param {object} [values] all values of the form, for `match` and `validate`
18
+ */
19
+ export function validateValue(value: any, rules?: {
20
+ required?: boolean;
21
+ email?: boolean;
22
+ minLength?: number;
23
+ maxLength?: number;
24
+ pattern?: RegExp | string;
25
+ min?: number;
26
+ max?: number;
27
+ match?: string;
28
+ validate?: (value: any, values: any) => (string | boolean | undefined);
29
+ }, values?: object): any;
30
+ /**
31
+ * Checks a date range given as ISO dates ("2026-01-31"; they compare correctly as text).
32
+ * Returns the (translated) error text, or "" when the range is valid. Empty dates are not an error.
33
+ *
34
+ * @param {string} from
35
+ * @param {string} to
36
+ * @param {{min?: string, max?: string}} [limits]
37
+ */
38
+ export function validateDateRange(from: string, to: string, { min, max }?: {
39
+ min?: string;
40
+ max?: string;
41
+ }): any;
42
+ /**
43
+ * Validates a whole form.
44
+ *
45
+ * @param {Object<string, object>} ruleSet rules by field name
46
+ * @param {Object<string, *>} values
47
+ * @returns {Object<string, string>} error text by field name, only for invalid fields
48
+ */
49
+ export function validateAll(ruleSet: {
50
+ [x: string]: any;
51
+ }, values: {
52
+ [x: string]: any;
53
+ }): {
54
+ [x: string]: string;
55
+ };
56
+ export const EMAIL_PATTERN: RegExp;
@@ -1,10 +1,10 @@
1
- /** Chooses where generateContainer() puts the page layout: the id of an element, or "" for the body. */
2
- export function setLayoutRoot(id?: string): void;
3
- export function generateBasicLayout(): void;
4
- export function generateContainer(): void;
5
- export function generateHeader(): void;
6
- export function clearHeader(): void;
7
- export function generateWrapper(): void;
8
- export function clearWrapper(): void;
9
- export function generateFooter(): void;
10
- export function clearFooter(): void;
1
+ /** Chooses where generateContainer() puts the page layout: the id of an element, or "" for the body. */
2
+ export function setLayoutRoot(id?: string): void;
3
+ export function generateBasicLayout(): void;
4
+ export function generateContainer(): void;
5
+ export function generateHeader(): void;
6
+ export function clearHeader(): void;
7
+ export function generateWrapper(): void;
8
+ export function clearWrapper(): void;
9
+ export function generateFooter(): void;
10
+ export function clearFooter(): void;
@@ -1,4 +1,4 @@
1
- export function generateFooterContent(): void;
2
- export function generateFooterMenu(): void;
3
- export function clearFooterMenu(): void;
4
- export function generateFooterCopyrightText(): void;
1
+ export function generateFooterContent(): void;
2
+ export function generateFooterMenu(): void;
3
+ export function clearFooterMenu(): void;
4
+ export function generateFooterCopyrightText(): void;
@@ -1,20 +1,20 @@
1
- export function generateHeaderContent(): void;
2
- /**
3
- * Generates the menu of the header. Without options it is built from the global `menuItems` / nav callback, as before.
4
- * With `options.items` it is a generateMenu (no globals): `generateHeaderMenu({ items, onNavigate, active, layout, followHash })`.
5
- */
6
- export function generateHeaderMenu(options: any): {
7
- element: HTMLElement;
8
- select: (id: string | null) => void;
9
- getActive: () => string | null;
10
- setBadge: (id: string, badge: any) => void;
11
- close: Function;
12
- update: (changes?: {
13
- items?: object[];
14
- }) => object;
15
- destroy: Function;
16
- };
17
- export function clearHeaderMenu(): void;
18
- export function generateHeaderTitle(): void;
19
- export function generateHeaderLogo(): void;
20
- export function generateContaninerForElements(params: any): void;
1
+ export function generateHeaderContent(): void;
2
+ /**
3
+ * Generates the menu of the header. Without options it is built from the global `menuItems` / nav callback, as before.
4
+ * With `options.items` it is a generateMenu (no globals): `generateHeaderMenu({ items, onNavigate, active, layout, followHash })`.
5
+ */
6
+ export function generateHeaderMenu(options: any): {
7
+ element: HTMLElement;
8
+ select: (id: string | null) => void;
9
+ getActive: () => string | null;
10
+ setBadge: (id: string, badge: any) => void;
11
+ close: Function;
12
+ update: (changes?: {
13
+ items?: object[];
14
+ }) => object;
15
+ destroy: Function;
16
+ };
17
+ export function clearHeaderMenu(): void;
18
+ export function generateHeaderTitle(): void;
19
+ export function generateHeaderLogo(): void;
20
+ export function generateContaninerForElements(params: any): void;
@@ -1 +1 @@
1
- export function generateWrapperContent(): void;
1
+ export function generateWrapperContent(): void;
@@ -1,14 +1,14 @@
1
- export function defaultMenuItems(menuId: any, count?: number): {
2
- id: string;
3
- class: string;
4
- text: string;
5
- inner_text: string;
6
- }[];
7
- /**
8
- * Generates a menu. An item with `children: [{ inner_text, disabled? }]` opens a submenu on click, Enter, Space
9
- * or the Down arrow. Esc, a click outside, or choosing an entry closes it. Choosing an entry calls the
10
- * nav callback with its `inner_text`, like a top level item.
11
- */
12
- export function generateBasicMenu(options: any): void;
13
- export function generateMenuWireFrame(options: any): void;
14
- export function addMenuItemToWireFrame(options: any): void;
1
+ export function defaultMenuItems(menuId: any, count?: number): {
2
+ id: string;
3
+ class: string;
4
+ text: string;
5
+ inner_text: string;
6
+ }[];
7
+ /**
8
+ * Generates a menu. An item with `children: [{ inner_text, disabled? }]` opens a submenu on click, Enter, Space
9
+ * or the Down arrow. Esc, a click outside, or choosing an entry closes it. Choosing an entry calls the
10
+ * nav callback with its `inner_text`, like a top level item.
11
+ */
12
+ export function generateBasicMenu(options: any): void;
13
+ export function generateMenuWireFrame(options: any): void;
14
+ export function addMenuItemToWireFrame(options: any): void;
@@ -1,65 +1,65 @@
1
- /** The text of a badge: numbers above 99 become "99+", 0 / null / false / "" mean no badge. */
2
- export function badgeText(value: any): string;
3
- /**
4
- * Generates a navigation menu. Items are real links (`href`) or buttons, so the keyboard and screen readers work without help:
5
- * Tab reaches every item, Enter and Space use it, the arrow keys move inside a group, Esc closes it.
6
- *
7
- * @param {object} options
8
- * @param {string|Element} [options.parent]
9
- * @param {MenuItem[]} options.items
10
- * `icon` is shown before the label (text, or a Node such as an SVG; it is hidden from screen readers).
11
- * `badge` is a small count or word after the label (0, null and "" show nothing, numbers above 99 show "99+").
12
- * `badgeLabel` is what a screen reader hears for it ("3 unread"); without it the badge text is read after the label.
13
- * `avatar` shows the picture (or the initials) of a person: for the user menu, usually with `align: "end"` and children.
14
- * An item with `children` opens a group; a child can have children too (a group inside a group, any depth).
15
- * @param {(item: MenuItem, event: Event) => void} [options.onNavigate] called when a PERSON uses an item (click, Enter, Space).
16
- * It is never called by select() or while the menu is built.
17
- * @param {string} [options.active] id of the item that is the current page at the start
18
- * @param {boolean} [options.followHash=false] the item whose `href` equals location.hash is the active one, and follows hashchange
19
- * @param {"bar"|"bottom-tabs"|"responsive"} [options.layout="bar"] "bottom-tabs": a bar of tabs at the bottom of the screen,
20
- * groups open as sheets above it. "responsive": a bar on wide screens, bottom tabs on a tablet or phone (max 700px).
21
- * @param {string} [options.label] accessible name of the navigation
22
- * @param {string} [options.id]
23
- * @param {string} [options.class]
24
- * @returns {{element: HTMLElement, select: (id: string|null) => void, getActive: () => string|null, setBadge: (id: string, badge) => void,
25
- * close: Function, update: (changes?: {items?: object[]}) => object, destroy: Function}}
26
- */
27
- export function generateMenu(options?: {
28
- parent?: string | Element;
29
- items: MenuItem[];
30
- onNavigate?: (item: MenuItem, event: Event) => void;
31
- active?: string;
32
- followHash?: boolean;
33
- layout?: "bar" | "bottom-tabs" | "responsive";
34
- label?: string;
35
- id?: string;
36
- class?: string;
37
- }): {
38
- element: HTMLElement;
39
- select: (id: string | null) => void;
40
- getActive: () => string | null;
41
- setBadge: (id: string, badge: any) => void;
42
- close: Function;
43
- update: (changes?: {
44
- items?: object[];
45
- }) => object;
46
- destroy: Function;
47
- };
48
- export type MenuItem = {
49
- id: string;
50
- label: string;
51
- icon?: string | Node;
52
- href?: string;
53
- disabled?: boolean;
54
- align?: "end";
55
- badge?: number | string | {
56
- text: (number | string);
57
- tone?: "info" | "ok" | "warn" | "bad";
58
- };
59
- badgeLabel?: string;
60
- avatar?: {
61
- name: string;
62
- src?: string;
63
- };
64
- children?: MenuItem[];
65
- };
1
+ /** The text of a badge: numbers above 99 become "99+", 0 / null / false / "" mean no badge. */
2
+ export function badgeText(value: any): string;
3
+ /**
4
+ * Generates a navigation menu. Items are real links (`href`) or buttons, so the keyboard and screen readers work without help:
5
+ * Tab reaches every item, Enter and Space use it, the arrow keys move inside a group, Esc closes it.
6
+ *
7
+ * @param {object} options
8
+ * @param {string|Element} [options.parent]
9
+ * @param {MenuItem[]} options.items
10
+ * `icon` is shown before the label (text, or a Node such as an SVG; it is hidden from screen readers).
11
+ * `badge` is a small count or word after the label (0, null and "" show nothing, numbers above 99 show "99+").
12
+ * `badgeLabel` is what a screen reader hears for it ("3 unread"); without it the badge text is read after the label.
13
+ * `avatar` shows the picture (or the initials) of a person: for the user menu, usually with `align: "end"` and children.
14
+ * An item with `children` opens a group; a child can have children too (a group inside a group, any depth).
15
+ * @param {(item: MenuItem, event: Event) => void} [options.onNavigate] called when a PERSON uses an item (click, Enter, Space).
16
+ * It is never called by select() or while the menu is built.
17
+ * @param {string} [options.active] id of the item that is the current page at the start
18
+ * @param {boolean} [options.followHash=false] the item whose `href` equals location.hash is the active one, and follows hashchange
19
+ * @param {"bar"|"bottom-tabs"|"responsive"} [options.layout="bar"] "bottom-tabs": a bar of tabs at the bottom of the screen,
20
+ * groups open as sheets above it. "responsive": a bar on wide screens, bottom tabs on a tablet or phone (max 700px).
21
+ * @param {string} [options.label] accessible name of the navigation
22
+ * @param {string} [options.id]
23
+ * @param {string} [options.class]
24
+ * @returns {{element: HTMLElement, select: (id: string|null) => void, getActive: () => string|null, setBadge: (id: string, badge) => void,
25
+ * close: Function, update: (changes?: {items?: object[]}) => object, destroy: Function}}
26
+ */
27
+ export function generateMenu(options?: {
28
+ parent?: string | Element;
29
+ items: MenuItem[];
30
+ onNavigate?: (item: MenuItem, event: Event) => void;
31
+ active?: string;
32
+ followHash?: boolean;
33
+ layout?: "bar" | "bottom-tabs" | "responsive";
34
+ label?: string;
35
+ id?: string;
36
+ class?: string;
37
+ }): {
38
+ element: HTMLElement;
39
+ select: (id: string | null) => void;
40
+ getActive: () => string | null;
41
+ setBadge: (id: string, badge: any) => void;
42
+ close: Function;
43
+ update: (changes?: {
44
+ items?: object[];
45
+ }) => object;
46
+ destroy: Function;
47
+ };
48
+ export type MenuItem = {
49
+ id: string;
50
+ label: string;
51
+ icon?: string | Node;
52
+ href?: string;
53
+ disabled?: boolean;
54
+ align?: "end";
55
+ badge?: number | string | {
56
+ text: (number | string);
57
+ tone?: "info" | "ok" | "warn" | "bad";
58
+ };
59
+ badgeLabel?: string;
60
+ avatar?: {
61
+ name: string;
62
+ src?: string;
63
+ };
64
+ children?: MenuItem[];
65
+ };
@@ -1,26 +1,26 @@
1
- /**
2
- * Who is signed in, kept in memory only. Nothing is written to a cookie or to the storage, so a script (an injected one too) cannot read
3
- * a credential from here: the real session is a cookie that only the server can read (HttpOnly). This object is the UI's copy of the
4
- * answer to "who am I", for menus, route guards and the page. The server decides what a person may do.
5
- *
6
- * After a reload the state is empty until restore() has asked the server.
7
- *
8
- * @param {object} [options]
9
- * @param {() => Promise<(object|null)>} [options.restore] asks the server who is signed in (for example GET /api/me with the cookie):
10
- * resolves with the user object, or with null / throws when nobody is
11
- * @returns {{signIn: (user: object) => void, signOut: () => void, restore: () => Promise<object|null>, isSignedIn: () => boolean,
12
- * getUser: () => (object|null), hasRole: (role: string) => boolean, onChange: (listener: Function) => Function,
13
- * routerRules: (paths?: object) => object}}
14
- */
15
- export function createAuthState(options?: {
16
- restore?: () => Promise<(object | null)>;
17
- }): {
18
- signIn: (user: object) => void;
19
- signOut: () => void;
20
- restore: () => Promise<object | null>;
21
- isSignedIn: () => boolean;
22
- getUser: () => (object | null);
23
- hasRole: (role: string) => boolean;
24
- onChange: (listener: Function) => Function;
25
- routerRules: (paths?: object) => object;
26
- };
1
+ /**
2
+ * Who is signed in, kept in memory only. Nothing is written to a cookie or to the storage, so a script (an injected one too) cannot read
3
+ * a credential from here: the real session is a cookie that only the server can read (HttpOnly). This object is the UI's copy of the
4
+ * answer to "who am I", for menus, route guards and the page. The server decides what a person may do.
5
+ *
6
+ * After a reload the state is empty until restore() has asked the server.
7
+ *
8
+ * @param {object} [options]
9
+ * @param {() => Promise<(object|null)>} [options.restore] asks the server who is signed in (for example GET /api/me with the cookie):
10
+ * resolves with the user object, or with null / throws when nobody is
11
+ * @returns {{signIn: (user: object) => void, signOut: () => void, restore: () => Promise<object|null>, isSignedIn: () => boolean,
12
+ * getUser: () => (object|null), hasRole: (role: string) => boolean, onChange: (listener: Function) => Function,
13
+ * routerRules: (paths?: object) => object}}
14
+ */
15
+ export function createAuthState(options?: {
16
+ restore?: () => Promise<(object | null)>;
17
+ }): {
18
+ signIn: (user: object) => void;
19
+ signOut: () => void;
20
+ restore: () => Promise<object | null>;
21
+ isSignedIn: () => boolean;
22
+ getUser: () => (object | null);
23
+ hasRole: (role: string) => boolean;
24
+ onChange: (listener: Function) => Function;
25
+ routerRules: (paths?: object) => object;
26
+ };
@@ -1,26 +1,26 @@
1
- /**
2
- * Stores the session after a successful login.
3
- *
4
- * @param {object} session
5
- * @param {*} [session.user] anything JSON serializable: name, roles, ...
6
- * @param {string} [session.token]
7
- * @param {boolean} [session.remember=false] keep the session after the browser closes
8
- * @param {number} [session.days] lifetime of a remembered session (default: the `session_days` setting)
9
- */
10
- export function setSession({ user, token, remember, days }?: {
11
- user?: any;
12
- token?: string;
13
- remember?: boolean;
14
- days?: number;
15
- }): void;
16
- /** The stored session ({ user, token, at }), or null when nobody is logged in. */
17
- export function getSession(): any;
18
- export function isLoggedIn(): boolean;
19
- /** Ends the session. */
20
- export function logout(): void;
21
- /**
22
- * Calls the listener with the session (or null) whenever somebody logs in or out.
23
- *
24
- * @returns {() => void} unsubscribe function
25
- */
26
- export function onSessionChange(listener: any): () => void;
1
+ /**
2
+ * Stores the session after a successful login.
3
+ *
4
+ * @param {object} session
5
+ * @param {*} [session.user] anything JSON serializable: name, roles, ...
6
+ * @param {string} [session.token]
7
+ * @param {boolean} [session.remember=false] keep the session after the browser closes
8
+ * @param {number} [session.days] lifetime of a remembered session (default: the `session_days` setting)
9
+ */
10
+ export function setSession({ user, token, remember, days }?: {
11
+ user?: any;
12
+ token?: string;
13
+ remember?: boolean;
14
+ days?: number;
15
+ }): void;
16
+ /** The stored session ({ user, token, at }), or null when nobody is logged in. */
17
+ export function getSession(): any;
18
+ export function isLoggedIn(): boolean;
19
+ /** Ends the session. */
20
+ export function logout(): void;
21
+ /**
22
+ * Calls the listener with the session (or null) whenever somebody logs in or out.
23
+ *
24
+ * @returns {() => void} unsubscribe function
25
+ */
26
+ export function onSessionChange(listener: any): () => void;
@@ -32,6 +32,7 @@ export function decimate(indices: any, values: any, buckets: any): any;
32
32
  * `times`, otherwise the index of the point (-0.5 is the left edge of the first point)
33
33
  * @param {(range: ({from: number, to: number}|null)) => void} [options.onZoom] called when a person zooms or resets
34
34
  * @param {number} [options.maxPoints] `push` keeps at most this many points per series (the oldest are dropped)
35
+ * @param {number[]} [options.hiddenSeries] the series (or slices) that are hidden at the start; a person hides and shows them with the legend, and a redraw keeps that
35
36
  * @param {boolean} [options.interactive=true] line and area charts: false leaves out the pointer layer (tooltip that follows the pointer, zoom)
36
37
  * @returns {(SVGElement & {element: SVGElement, update: (options?: object) => SVGElement, destroy: () => void,
37
38
  * zoom: (from: number, to: number) => void, resetZoom: () => void, getZoom: () => ({from: number, to: number}|null),
@@ -69,6 +70,7 @@ export function generateChart(options?: {
69
70
  to: number;
70
71
  } | null)) => void;
71
72
  maxPoints?: number;
73
+ hiddenSeries?: number[];
72
74
  interactive?: boolean;
73
75
  }): (SVGElement & {
74
76
  element: SVGElement;