athena-ui-js 2.0.0 → 2.1.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 (83) hide show
  1. package/README.md +47 -5
  2. package/docs/migration-2.0.md +1 -1
  3. package/docs/styling.md +3 -1
  4. package/package.json +5 -2
  5. package/src/athena-ui.js +1 -1
  6. package/src/libs/config/config.js +1 -1
  7. package/src/libs/core/popover.js +96 -0
  8. package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
  9. package/src/libs/hephaestus/componentGenerator/componentGenerator.js +26 -2
  10. package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +45 -9
  11. package/src/res/themes/default/style.css +32 -0
  12. package/types/athena-ui.d.ts +96 -96
  13. package/types/chart.d.ts +1 -1
  14. package/types/classic.d.ts +1 -1
  15. package/types/components.d.ts +1 -1
  16. package/types/controls.d.ts +3 -3
  17. package/types/csv.d.ts +1 -1
  18. package/types/dialog.d.ts +2 -2
  19. package/types/dom.d.ts +1 -1
  20. package/types/feedback.d.ts +1 -1
  21. package/types/format.d.ts +1 -1
  22. package/types/forms.d.ts +2 -2
  23. package/types/i18n.d.ts +1 -1
  24. package/types/inputs.d.ts +4 -4
  25. package/types/libs/config/config.d.ts +3 -3
  26. package/types/libs/config/hooks.d.ts +8 -8
  27. package/types/libs/core/combobox.d.ts +10 -10
  28. package/types/libs/core/controls.d.ts +28 -28
  29. package/types/libs/core/cookies.d.ts +27 -27
  30. package/types/libs/core/csv.d.ts +12 -12
  31. package/types/libs/core/dateRange.d.ts +72 -72
  32. package/types/libs/core/dom.d.ts +65 -65
  33. package/types/libs/core/elementGenerator.d.ts +30 -30
  34. package/types/libs/core/errors.d.ts +29 -29
  35. package/types/libs/core/focus.d.ts +6 -6
  36. package/types/libs/core/format.d.ts +21 -21
  37. package/types/libs/core/hungarianControls.d.ts +2 -2
  38. package/types/libs/core/i18n.d.ts +17 -17
  39. package/types/libs/core/pagination.d.ts +5 -5
  40. package/types/libs/core/popover.d.ts +36 -0
  41. package/types/libs/core/sanitize.d.ts +6 -6
  42. package/types/libs/core/tableMath.d.ts +26 -26
  43. package/types/libs/core/theme.d.ts +39 -39
  44. package/types/libs/core/validation.d.ts +56 -56
  45. package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -10
  46. package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -4
  47. package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -20
  48. package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -1
  49. package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -14
  50. package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -65
  51. package/types/libs/hephaestus/auth/authState.d.ts +26 -26
  52. package/types/libs/hephaestus/auth/session.d.ts +26 -26
  53. package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +93 -91
  54. package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +3 -1
  55. package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -24
  56. package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -120
  57. package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -86
  58. package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -122
  59. package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -6
  60. package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -113
  61. package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -8
  62. package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -11
  63. package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -4
  64. package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -7
  65. package/types/libs/hephaestus/hephaestus.d.ts +3 -3
  66. package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -48
  67. package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -185
  68. package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -49
  69. package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -2
  70. package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +4 -1
  71. package/types/libs/hephaestus/router/matchRoute.d.ts +12 -12
  72. package/types/libs/hephaestus/router/router.d.ts +67 -67
  73. package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -120
  74. package/types/menu.d.ts +1 -1
  75. package/types/navigation.d.ts +1 -1
  76. package/types/res/themes/themes.d.ts +7 -7
  77. package/types/router.d.ts +1 -1
  78. package/types/sanitize.d.ts +1 -1
  79. package/types/session.d.ts +3 -3
  80. package/types/table.d.ts +1 -1
  81. package/types/testing.d.ts +27 -27
  82. package/types/theme.d.ts +2 -2
  83. package/types/validation.d.ts +1 -1
@@ -1,65 +1,65 @@
1
- /**
2
- * Creates an element. This is the safe way to write pages: text is only ever inserted as text, attributes that run code
3
- * (on*, style, srcdoc) and unsafe addresses (javascript:, data:, ...) in href / src / action are refused, listeners have to be
4
- * functions, and children can be given as nested lists.
5
- *
6
- * @param {string} tag
7
- * @param {object} [props]
8
- * @param {string} [props.class]
9
- * @param {string} [props.id]
10
- * @param {string} [props.text] set as textContent (never parsed as HTML)
11
- * @param {Object<string, string|boolean|number>} [props.attrs] attributes, false / null / undefined are skipped
12
- * @param {Object<string, Function>} [props.on] event listeners (a value that is not a function throws a TypeError)
13
- * @param {Object<string, *>} [props.prop] DOM properties (value, checked, disabled, ...), not the ones that parse HTML
14
- * @param {...(Node|string|number|Array|null|false)} children text, nodes, or lists of them
15
- */
16
- export function el(tag: string, props?: {
17
- class?: string;
18
- id?: string;
19
- text?: string;
20
- attrs?: {
21
- [x: string]: string | boolean | number;
22
- };
23
- on?: {
24
- [x: string]: Function;
25
- };
26
- prop?: {
27
- [x: string]: any;
28
- };
29
- }, ...children: (Node | string | number | any[] | null | false)[]): HTMLElement;
30
- /**
31
- * Fills a node with content. Strings are inserted as text, never as HTML.
32
- * Accepts a string / number, a Node, an array of those, or a function returning one.
33
- */
34
- export function setContent(node: any, content: any): any;
35
- /**
36
- * Finds an element from an element, an id or a CSS selector ("#list", ".panel > ul").
37
- * An id wins over a selector with the same text. Returns null when nothing matches.
38
- */
39
- export function resolveElement(target: any): Element;
40
- export function mount(parent: any, node: any): any;
41
- /**
42
- * Gives a component the same handle as every other one: { element, update(), destroy() }.
43
- * What the component already has is kept. `update` does nothing unless the component supports it
44
- * (it returns the handle), `destroy` removes the element (and `also`, e.g. a wrapper around it).
45
- */
46
- export function asHandle(handle: any, { element, also }?: {
47
- element?: any;
48
- }): any;
49
- /**
50
- * A stricter el(): only the tags and attributes on your lists are allowed, everything else is refused (a tag throws, an attribute is
51
- * skipped with a warning). For pages that are built from data you do not control, such as a plugin API. The refusals of el() still apply.
52
- *
53
- * @param {object} allow
54
- * @param {string[]} [allow.tags] allowed tag names (default: any)
55
- * @param {string[]} allow.attributes allowed attribute names, lower case: ["class", "title", "href"]
56
- * @param {boolean} [allow.dataAndAria=true] data-* and aria-* attributes are allowed too
57
- * @returns {typeof el}
58
- */
59
- export function createSafeBuilder({ tags, attributes, dataAndAria }?: {
60
- tags?: string[];
61
- attributes: string[];
62
- dataAndAria?: boolean;
63
- }): typeof el;
64
- export function uid(prefix?: string): string;
65
- export function cx(...classes: any[]): string;
1
+ /**
2
+ * Creates an element. This is the safe way to write pages: text is only ever inserted as text, attributes that run code
3
+ * (on*, style, srcdoc) and unsafe addresses (javascript:, data:, ...) in href / src / action are refused, listeners have to be
4
+ * functions, and children can be given as nested lists.
5
+ *
6
+ * @param {string} tag
7
+ * @param {object} [props]
8
+ * @param {string} [props.class]
9
+ * @param {string} [props.id]
10
+ * @param {string} [props.text] set as textContent (never parsed as HTML)
11
+ * @param {Object<string, string|boolean|number>} [props.attrs] attributes, false / null / undefined are skipped
12
+ * @param {Object<string, Function>} [props.on] event listeners (a value that is not a function throws a TypeError)
13
+ * @param {Object<string, *>} [props.prop] DOM properties (value, checked, disabled, ...), not the ones that parse HTML
14
+ * @param {...(Node|string|number|Array|null|false)} children text, nodes, or lists of them
15
+ */
16
+ export function el(tag: string, props?: {
17
+ class?: string;
18
+ id?: string;
19
+ text?: string;
20
+ attrs?: {
21
+ [x: string]: string | boolean | number;
22
+ };
23
+ on?: {
24
+ [x: string]: Function;
25
+ };
26
+ prop?: {
27
+ [x: string]: any;
28
+ };
29
+ }, ...children: (Node | string | number | any[] | null | false)[]): HTMLElement;
30
+ /**
31
+ * Fills a node with content. Strings are inserted as text, never as HTML.
32
+ * Accepts a string / number, a Node, an array of those, or a function returning one.
33
+ */
34
+ export function setContent(node: any, content: any): any;
35
+ /**
36
+ * Finds an element from an element, an id or a CSS selector ("#list", ".panel > ul").
37
+ * An id wins over a selector with the same text. Returns null when nothing matches.
38
+ */
39
+ export function resolveElement(target: any): Element;
40
+ export function mount(parent: any, node: any): any;
41
+ /**
42
+ * Gives a component the same handle as every other one: { element, update(), destroy() }.
43
+ * What the component already has is kept. `update` does nothing unless the component supports it
44
+ * (it returns the handle), `destroy` removes the element (and `also`, e.g. a wrapper around it).
45
+ */
46
+ export function asHandle(handle: any, { element, also }?: {
47
+ element?: any;
48
+ }): any;
49
+ /**
50
+ * A stricter el(): only the tags and attributes on your lists are allowed, everything else is refused (a tag throws, an attribute is
51
+ * skipped with a warning). For pages that are built from data you do not control, such as a plugin API. The refusals of el() still apply.
52
+ *
53
+ * @param {object} allow
54
+ * @param {string[]} [allow.tags] allowed tag names (default: any)
55
+ * @param {string[]} allow.attributes allowed attribute names, lower case: ["class", "title", "href"]
56
+ * @param {boolean} [allow.dataAndAria=true] data-* and aria-* attributes are allowed too
57
+ * @returns {typeof el}
58
+ */
59
+ export function createSafeBuilder({ tags, attributes, dataAndAria }?: {
60
+ tags?: string[];
61
+ attributes: string[];
62
+ dataAndAria?: boolean;
63
+ }): typeof el;
64
+ export function uid(prefix?: string): string;
65
+ export function cx(...classes: any[]): string;
@@ -1,30 +1,30 @@
1
- /**
2
- * Generates an HTML element and appends it to its parent.
3
- *
4
- * @param {object} options
5
- * @param {string} options.elementType one of `supportedElements`
6
- * @param {string} [options.parent] id of the parent element; omitted or '' appends to body
7
- * @param {string} [options.id]
8
- * @param {string} [options.class]
9
- * @param {string} [options.text]
10
- * @param {string} [options.src] img only
11
- * @param {string} [options.alt] img only
12
- * @param {*} [options.data] passed to the onclick / onchange handlers
13
- * @param {(data: *) => void} [options.onclick]
14
- * @param {(data: *) => void} [options.onchange]
15
- * @returns {HTMLElement|null} the generated element, or null when generation failed
16
- */
17
- export function HTMLElementGenerator(options: {
18
- elementType: string;
19
- parent?: string;
20
- id?: string;
21
- class?: string;
22
- text?: string;
23
- src?: string;
24
- alt?: string;
25
- data?: any;
26
- onclick?: (data: any) => void;
27
- onchange?: (data: any) => void;
28
- }): HTMLElement | null;
29
- export const supportedElements: readonly string[];
30
- export default HTMLElementGenerator;
1
+ /**
2
+ * Generates an HTML element and appends it to its parent.
3
+ *
4
+ * @param {object} options
5
+ * @param {string} options.elementType one of `supportedElements`
6
+ * @param {string} [options.parent] id of the parent element; omitted or '' appends to body
7
+ * @param {string} [options.id]
8
+ * @param {string} [options.class]
9
+ * @param {string} [options.text]
10
+ * @param {string} [options.src] img only
11
+ * @param {string} [options.alt] img only
12
+ * @param {*} [options.data] passed to the onclick / onchange handlers
13
+ * @param {(data: *) => void} [options.onclick]
14
+ * @param {(data: *) => void} [options.onchange]
15
+ * @returns {HTMLElement|null} the generated element, or null when generation failed
16
+ */
17
+ export function HTMLElementGenerator(options: {
18
+ elementType: string;
19
+ parent?: string;
20
+ id?: string;
21
+ class?: string;
22
+ text?: string;
23
+ src?: string;
24
+ alt?: string;
25
+ data?: any;
26
+ onclick?: (data: any) => void;
27
+ onchange?: (data: any) => void;
28
+ }): HTMLElement | null;
29
+ export const supportedElements: readonly string[];
30
+ export default HTMLElementGenerator;
@@ -1,29 +1,29 @@
1
- /**
2
- * Logs the error and, when the page has a body, shows a short message in it.
3
- * Always returns null so callers can `return reportError(...)`.
4
- */
5
- export function reportError(error: any): any;
6
- export const ErrorCode: Readonly<{
7
- UNDEFINED: 0;
8
- WRONG_INPUT_TYPE: 1;
9
- NO_BODY_OR_PARENT: 2;
10
- }>;
11
- export function undefinedError(variable: any, functionName: any): {
12
- errorCode: 0;
13
- errorString: string;
14
- errorVariable: any;
15
- errorFunction: any;
16
- };
17
- export function wrongInputTypeError(variable: any, functionName: any, inputOptions: any): {
18
- errorCode: 1;
19
- errorString: string;
20
- errorVariable: any;
21
- errorFunction: any;
22
- errorMiscInfo: any;
23
- };
24
- export function noBodyOrParentError(variable: any, functionName: any): {
25
- errorCode: 2;
26
- errorString: string;
27
- errorVariable: any;
28
- errorFunction: any;
29
- };
1
+ /**
2
+ * Logs the error and, when the page has a body, shows a short message in it.
3
+ * Always returns null so callers can `return reportError(...)`.
4
+ */
5
+ export function reportError(error: any): any;
6
+ export const ErrorCode: Readonly<{
7
+ UNDEFINED: 0;
8
+ WRONG_INPUT_TYPE: 1;
9
+ NO_BODY_OR_PARENT: 2;
10
+ }>;
11
+ export function undefinedError(variable: any, functionName: any): {
12
+ errorCode: 0;
13
+ errorString: string;
14
+ errorVariable: any;
15
+ errorFunction: any;
16
+ };
17
+ export function wrongInputTypeError(variable: any, functionName: any, inputOptions: any): {
18
+ errorCode: 1;
19
+ errorString: string;
20
+ errorVariable: any;
21
+ errorFunction: any;
22
+ errorMiscInfo: any;
23
+ };
24
+ export function noBodyOrParentError(variable: any, functionName: any): {
25
+ errorCode: 2;
26
+ errorString: string;
27
+ errorVariable: any;
28
+ errorFunction: any;
29
+ };
@@ -1,6 +1,6 @@
1
- export function focusableIn(container: any): any[];
2
- /**
3
- * Keeps Tab inside the container, calls onEscape on Esc and moves the focus into the container.
4
- * Returns a release function that restores the previous focus.
5
- */
6
- export function trapFocus(container: any, { onEscape }?: {}): () => void;
1
+ export function focusableIn(container: any): any[];
2
+ /**
3
+ * Keeps Tab inside the container, calls onEscape on Esc and moves the focus into the container.
4
+ * Returns a release function that restores the previous focus.
5
+ */
6
+ export function trapFocus(container: any, { onEscape }?: {}): () => void;
@@ -1,21 +1,21 @@
1
- export function formatBytes(bytes: any): string;
2
- /**
3
- * Checks a file against an `accept` list like ".png,image/*,application/pdf". An empty list accepts everything.
4
- */
5
- export function matchesAccept(file: any, accept: any): boolean;
6
- /** 1234567.891 -> "1,234,567.89" (the separators of the current language). */
7
- export function formatNumber(value: any, options?: {}): string;
8
- /**
9
- * A length of time in milliseconds as short text: 350 -> "350 ms", 45000 -> "45 sec", 7500000 -> "2 hr, 5 min".
10
- * At most `parts` units are shown (default 2). The unit names follow the current language.
11
- */
12
- export function formatDuration(ms: any, { parts }?: {
13
- parts?: number;
14
- }): string;
15
- /** "2 min ago", "in 3 days", "yesterday": the time between `date` and `now`, in the current language. */
16
- export function formatRelativeTime(date: any, now?: number): string;
17
- /** A date (and time) for people: formatDate(d) -> "Nov 19, 2026"; formatDate(d, { time: true }) adds the time. */
18
- export function formatDate(date: any, { time, style }?: {
19
- time?: boolean;
20
- style?: string;
21
- }): string;
1
+ export function formatBytes(bytes: any): string;
2
+ /**
3
+ * Checks a file against an `accept` list like ".png,image/*,application/pdf". An empty list accepts everything.
4
+ */
5
+ export function matchesAccept(file: any, accept: any): boolean;
6
+ /** 1234567.891 -> "1,234,567.89" (the separators of the current language). */
7
+ export function formatNumber(value: any, options?: {}): string;
8
+ /**
9
+ * A length of time in milliseconds as short text: 350 -> "350 ms", 45000 -> "45 sec", 7500000 -> "2 hr, 5 min".
10
+ * At most `parts` units are shown (default 2). The unit names follow the current language.
11
+ */
12
+ export function formatDuration(ms: any, { parts }?: {
13
+ parts?: number;
14
+ }): string;
15
+ /** "2 min ago", "in 3 days", "yesterday": the time between `date` and `now`, in the current language. */
16
+ export function formatRelativeTime(date: any, now?: number): string;
17
+ /** A date (and time) for people: formatDate(d) -> "Nov 19, 2026"; formatDate(d, { time: true }) adds the time. */
18
+ export function formatDate(date: any, { time, style }?: {
19
+ time?: boolean;
20
+ style?: string;
21
+ }): string;
@@ -1,2 +1,2 @@
1
- /** Adds the input types hunPIN, hunCRID and hunTID (Hungarian personal insurance, company registration and tax numbers, in segments). */
2
- export function registerHungarianInputControls(): void;
1
+ /** Adds the input types hunPIN, hunCRID and hunTID (Hungarian personal insurance, company registration and tax numbers, in segments). */
2
+ export function registerHungarianInputControls(): void;
@@ -1,17 +1,17 @@
1
- export function setLocale(newLocale: any): void;
2
- export function getLocale(): string;
3
- export function addMessages(forLocale: any, texts: any): void;
4
- /**
5
- * Looks a text up in the current locale, then in its base language ("hu-HU" -> "hu"), then in English.
6
- * Unknown keys are returned as they are.
7
- *
8
- * Placeholders: {name} is replaced from params as it is, {name:number} is formatted as a number and {name:date} as a date, in the current language (Intl).
9
- * Plural forms: a message can be an object with the forms of the language, and the form is chosen by `params.count`:
10
- *
11
- * addMessages("en", { files: { zero: "No files", one: "{count} file", other: "{count:number} files" } });
12
- * translate("files", { count: 1200 }) // "1,200 files"
13
- *
14
- * The keys are the categories of Intl.PluralRules for the language ("one", "other", and where the language has them "zero", "two", "few", "many"),
15
- * or an exact number ("0"). "other" is the fallback.
16
- */
17
- export function translate(key: any, params?: {}): any;
1
+ export function setLocale(newLocale: any): void;
2
+ export function getLocale(): string;
3
+ export function addMessages(forLocale: any, texts: any): void;
4
+ /**
5
+ * Looks a text up in the current locale, then in its base language ("hu-HU" -> "hu"), then in English.
6
+ * Unknown keys are returned as they are.
7
+ *
8
+ * Placeholders: {name} is replaced from params as it is, {name:number} is formatted as a number and {name:date} as a date, in the current language (Intl).
9
+ * Plural forms: a message can be an object with the forms of the language, and the form is chosen by `params.count`:
10
+ *
11
+ * addMessages("en", { files: { zero: "No files", one: "{count} file", other: "{count:number} files" } });
12
+ * translate("files", { count: 1200 }) // "1,200 files"
13
+ *
14
+ * The keys are the categories of Intl.PluralRules for the language ("one", "other", and where the language has them "zero", "two", "few", "many"),
15
+ * or an exact number ("0"). "other" is the fallback.
16
+ */
17
+ export function translate(key: any, params?: {}): any;
@@ -1,5 +1,5 @@
1
- /**
2
- * Page buttons to show: first and last page, the current page with its neighbours, "…" for the gaps.
3
- * pageRange(5, 10, 1) -> [1, "…", 4, 5, 6, "…", 10]
4
- */
5
- export function pageRange(page: any, pages: any, siblings?: number): any[];
1
+ /**
2
+ * Page buttons to show: first and last page, the current page with its neighbours, "…" for the gaps.
3
+ * pageRange(5, 10, 1) -> [1, "…", 4, 5, 6, "…", 10]
4
+ */
5
+ export function pageRange(page: any, pages: any, siblings?: number): any[];
@@ -0,0 +1,36 @@
1
+ /** Opens it: showPopover(), or without the API: the element is no longer hidden. Does nothing when it is open already. */
2
+ export function openPopover(element: any): void;
3
+ /** Closes it. Does nothing when it is closed already. */
4
+ export function closePopover(element: any): void;
5
+ /**
6
+ * Where a popover goes, next to the element it belongs to, before it is shown (so there is no frame at the wrong place). Only the side and the alignment
7
+ * are chosen here, from the position of the anchor in the window: the popover is moved with CSS (translate) by its own size. Once it is shown,
8
+ * `settlePopover` measures it and keeps it inside the window.
9
+ *
10
+ * @param {Element} anchor the button or the target of the tooltip
11
+ * @param {HTMLElement} popover
12
+ * @param {object} [options]
13
+ * @param {"bottom"|"top"|"auto"} [options.side="auto"] "bottom": below. "top": above, unless there is less than `room` px above. "auto": below,
14
+ * unless there is less than `room` px below and more room above
15
+ * @param {"start"|"end"|"center"} [options.align="start"] which edge of the anchor the popover lines up with
16
+ * @param {number} [options.gap=4] px between the anchor and the popover
17
+ * @param {number} [options.room=240] how much room a side needs, in px (a tooltip needs about 40)
18
+ */
19
+ export function placePopover(anchor: Element, popover: HTMLElement, { side, align, gap, room }?: {
20
+ side?: "bottom" | "top" | "auto";
21
+ align?: "start" | "end" | "center";
22
+ gap?: number;
23
+ room?: number;
24
+ }): void;
25
+ /**
26
+ * After the popover is shown: measures it and moves it back inside the window when it sticks out to the left, the right or the bottom (a popover that
27
+ * is taller than the room is left where it is: it scrolls).
28
+ */
29
+ export function settlePopover(popover: any): void;
30
+ /**
31
+ * Keeps an open popover next to its anchor while the page scrolls or the window changes size. Returns a function that stops it.
32
+ * (A popover in the top layer does not move with its anchor by itself.)
33
+ */
34
+ export function followAnchor(anchor: any, popover: any, options: any): () => void;
35
+ export function supportsPopover(): boolean;
36
+ export function isOpen(element: any): any;
@@ -1,6 +1,6 @@
1
- /** True for http(s), mailto, tel, anchors and relative paths. Rejects javascript:, data:, vbscript: and the like. */
2
- export function isSafeUrl(url: any): boolean;
3
- /** Cleans HTML from the editor, the clipboard or the application. Returns the safe HTML string. */
4
- export function sanitizeHtml(html: any): string;
5
- /** The text of an HTML string, without tags. */
6
- export function htmlToText(html: any): string;
1
+ /** True for http(s), mailto, tel, anchors and relative paths. Rejects javascript:, data:, vbscript: and the like. */
2
+ export function isSafeUrl(url: any): boolean;
3
+ /** Cleans HTML from the editor, the clipboard or the application. Returns the safe HTML string. */
4
+ export function sanitizeHtml(html: any): string;
5
+ /** The text of an HTML string, without tags. */
6
+ export function htmlToText(html: any): string;
@@ -1,26 +1,26 @@
1
- /**
2
- * Which rows of a long list have to be in the DOM for the current scroll position.
3
- * The rows before and after the window are replaced by spacers of `offsetTop` / `offsetBottom` pixels,
4
- * so the scroll bar keeps the size of the whole list.
5
- *
6
- * @param {object} options
7
- * @param {number} options.scrollTop
8
- * @param {number} options.viewportHeight
9
- * @param {number} options.rowHeight
10
- * @param {number} options.total number of rows
11
- * @param {number} [options.overscan=5] extra rows above and below, so fast scrolling does not show gaps
12
- * @returns {{start: number, end: number, offsetTop: number, offsetBottom: number}} rows start..end-1 are rendered
13
- */
14
- export function virtualWindow({ scrollTop, viewportHeight, rowHeight, total, overscan }: {
15
- scrollTop: number;
16
- viewportHeight: number;
17
- rowHeight: number;
18
- total: number;
19
- overscan?: number;
20
- }): {
21
- start: number;
22
- end: number;
23
- offsetTop: number;
24
- offsetBottom: number;
25
- };
26
- export function clampWidth(width: any, min?: number, max?: number): number;
1
+ /**
2
+ * Which rows of a long list have to be in the DOM for the current scroll position.
3
+ * The rows before and after the window are replaced by spacers of `offsetTop` / `offsetBottom` pixels,
4
+ * so the scroll bar keeps the size of the whole list.
5
+ *
6
+ * @param {object} options
7
+ * @param {number} options.scrollTop
8
+ * @param {number} options.viewportHeight
9
+ * @param {number} options.rowHeight
10
+ * @param {number} options.total number of rows
11
+ * @param {number} [options.overscan=5] extra rows above and below, so fast scrolling does not show gaps
12
+ * @returns {{start: number, end: number, offsetTop: number, offsetBottom: number}} rows start..end-1 are rendered
13
+ */
14
+ export function virtualWindow({ scrollTop, viewportHeight, rowHeight, total, overscan }: {
15
+ scrollTop: number;
16
+ viewportHeight: number;
17
+ rowHeight: number;
18
+ total: number;
19
+ overscan?: number;
20
+ }): {
21
+ start: number;
22
+ end: number;
23
+ offsetTop: number;
24
+ offsetBottom: number;
25
+ };
26
+ export function clampWidth(width: any, min?: number, max?: number): number;
@@ -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
+ }[];