athena-ui-js 1.2.0 → 2.0.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.
- package/README.md +312 -60
- package/docs/migration-2.0.md +83 -0
- package/docs/styling.md +86 -0
- package/package.json +109 -24
- package/src/athena-ui.js +61 -81
- package/src/chart.js +6 -0
- package/src/classic.js +11 -0
- package/src/components.js +6 -0
- package/src/controls.js +8 -0
- package/src/csv.js +6 -0
- package/src/dialog.js +7 -0
- package/src/dom.js +6 -0
- package/src/feedback.js +6 -0
- package/src/format.js +6 -0
- package/src/forms.js +7 -0
- package/src/i18n.js +6 -0
- package/src/inputs.js +9 -0
- package/src/libs/config/config.js +1 -2
- package/src/libs/core/controls.js +145 -0
- package/src/libs/core/cookies.js +55 -0
- package/src/libs/core/dateRange.js +121 -0
- package/src/libs/core/dom.js +58 -8
- package/src/libs/{hephaestus/HTMLElementGenerator/src/HTMLElementGenerator.js → core/elementGenerator.js} +23 -21
- package/src/libs/{hephaestus/HTMLElementGenerator/src → core}/errors.js +7 -5
- package/src/libs/core/format.js +51 -0
- package/src/libs/core/hungarianControls.js +41 -0
- package/src/libs/core/i18n.js +104 -6
- package/src/libs/core/theme.js +131 -0
- package/src/libs/core/validation.js +2 -2
- package/src/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js +13 -7
- package/src/libs/hephaestus/LayoutGenerator/footerContentGenerator.js +2 -4
- package/src/libs/hephaestus/LayoutGenerator/headerContentGenerator.js +12 -5
- package/src/libs/hephaestus/MenuGenerator/basicMenuGenerator.js +3 -3
- package/src/libs/hephaestus/MenuGenerator/menuGenerator.js +265 -0
- package/src/libs/hephaestus/auth/authState.js +58 -0
- package/src/libs/hephaestus/auth/session.js +1 -1
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +519 -87
- package/src/libs/hephaestus/componentGenerator/componentGenerator.js +121 -4
- package/src/libs/hephaestus/componentGenerator/themePicker.js +73 -0
- package/src/libs/hephaestus/dialogGenerator/dialogGenerator.js +113 -25
- package/src/libs/hephaestus/feedbackGenerator/feedbackGenerator.js +21 -0
- package/src/libs/hephaestus/formGenerator/authForms.js +130 -0
- package/src/libs/hephaestus/formGenerator/changePasswordFormGenerator.js +4 -4
- package/src/libs/hephaestus/formGenerator/formUtils.js +10 -13
- package/src/libs/hephaestus/formGenerator/loginFormGenerator.js +10 -11
- package/src/libs/hephaestus/formGenerator/registrationFormGenerator.js +3 -3
- package/src/libs/hephaestus/hephaestus.js +0 -5
- package/src/libs/hephaestus/inputGenerator/dropZoneGenerator.js +1 -1
- package/src/libs/hephaestus/inputGenerator/inputGenerator.js +30 -1
- package/src/libs/hephaestus/modalGenerator/modalGenerator.js +25 -12
- package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +20 -24
- package/src/libs/hephaestus/router/router.js +54 -5
- package/src/libs/hephaestus/tableGenerator/tableGenerator.js +290 -16
- package/src/menu.js +6 -0
- package/src/navigation.js +6 -0
- package/src/res/themes/appearance.css +154 -0
- package/src/res/themes/default/style.css +688 -82
- package/src/res/themes/tokens.css +96 -0
- package/src/router.js +6 -0
- package/src/sanitize.js +6 -0
- package/src/session.js +8 -0
- package/src/table.js +6 -0
- package/src/testing.js +11 -1
- package/src/theme-boot.js +25 -0
- package/src/theme.js +7 -0
- package/src/validation.js +6 -0
- package/types/athena-ui.d.ts +96 -0
- package/types/chart.d.ts +1 -0
- package/types/classic.d.ts +1 -0
- package/types/components.d.ts +1 -0
- package/types/controls.d.ts +3 -0
- package/types/csv.d.ts +1 -0
- package/types/dialog.d.ts +2 -0
- package/types/dom.d.ts +1 -0
- package/types/feedback.d.ts +1 -0
- package/types/format.d.ts +1 -0
- package/types/forms.d.ts +2 -0
- package/types/i18n.d.ts +1 -0
- package/types/inputs.d.ts +4 -0
- package/types/libs/config/config.d.ts +96 -0
- package/types/libs/config/hooks.d.ts +8 -0
- package/types/libs/core/combobox.d.ts +10 -0
- package/types/libs/core/controls.d.ts +28 -0
- package/types/libs/core/cookies.d.ts +27 -0
- package/types/libs/core/csv.d.ts +12 -0
- package/types/libs/core/dateRange.d.ts +72 -0
- package/types/libs/core/dom.d.ts +65 -0
- package/types/libs/core/elementGenerator.d.ts +30 -0
- package/types/libs/core/errors.d.ts +29 -0
- package/types/libs/core/focus.d.ts +6 -0
- package/types/libs/core/format.d.ts +21 -0
- package/types/libs/core/hungarianControls.d.ts +2 -0
- package/types/libs/core/i18n.d.ts +17 -0
- package/types/libs/core/pagination.d.ts +5 -0
- package/types/libs/core/sanitize.d.ts +6 -0
- package/types/libs/core/tableMath.d.ts +26 -0
- package/types/libs/core/theme.d.ts +39 -0
- package/types/libs/core/validation.d.ts +56 -0
- package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -0
- package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -0
- package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -0
- package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -0
- package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -0
- package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -0
- package/types/libs/hephaestus/auth/authState.d.ts +26 -0
- package/types/libs/hephaestus/auth/session.d.ts +26 -0
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +91 -0
- package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +222 -0
- package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -0
- package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -0
- package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -0
- package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -0
- package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -0
- package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -0
- package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -0
- package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -0
- package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -0
- package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -0
- package/types/libs/hephaestus/hephaestus.d.ts +3 -0
- package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -0
- package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -0
- package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -0
- package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -0
- package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +150 -0
- package/types/libs/hephaestus/router/matchRoute.d.ts +12 -0
- package/types/libs/hephaestus/router/router.d.ts +67 -0
- package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -0
- package/types/menu.d.ts +1 -0
- package/types/navigation.d.ts +1 -0
- package/types/res/themes/themes.d.ts +7 -0
- package/types/router.d.ts +1 -0
- package/types/sanitize.d.ts +1 -0
- package/types/session.d.ts +3 -0
- package/types/table.d.ts +1 -0
- package/types/testing.d.ts +27 -0
- package/types/theme-boot.d.ts +0 -0
- package/types/theme.d.ts +2 -0
- package/types/validation.d.ts +1 -0
- package/src/libs/crypto-js/LICENSE +0 -24
- package/src/libs/crypto-js/crypto-js.js +0 -6657
- package/src/libs/hephaestus/HTMLControlGenerator/LICENSE +0 -21
- package/src/libs/hephaestus/HTMLControlGenerator/src/HTMLControlGenerator.min.js +0 -5
- package/src/libs/hephaestus/HTMLElementGenerator/LICENSE +0 -21
- package/src/libs/js-cookie/LICENSE +0 -21
- package/src/libs/js-cookie/src/api.mjs +0 -103
- package/src/libs/js-cookie/src/assign.mjs +0 -10
- package/src/libs/js-cookie/src/converter.mjs +0 -14
- package/src/libs/libs.js +0 -13
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* Athena UI design tokens
|
|
2
|
+
|
|
3
|
+
Every visual decision of Athena UI is one of these custom properties, so an application restyles it by setting them, never by overriding a component:
|
|
4
|
+
|
|
5
|
+
:root { --athena-accent: #8e44ad; --athena-radius: 2px; }
|
|
6
|
+
|
|
7
|
+
This file is imported into the cascade layer "athena" by default/style.css, so a :root rule of the application (not in a layer) wins.
|
|
8
|
+
|
|
9
|
+
Colours come in a light and a dark set. Without the attribute data-mode on <html> the page follows the system (prefers-color-scheme); with
|
|
10
|
+
createThemeManager (or theme-boot.js) the person can choose light, dark or "like the system", and a named theme (appearance.css) can replace the
|
|
11
|
+
colours. */
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
/* colours */
|
|
15
|
+
--athena-bg: #fff;
|
|
16
|
+
--athena-fg: #1a1a1a;
|
|
17
|
+
--athena-muted: #666;
|
|
18
|
+
--athena-border: #000;
|
|
19
|
+
--athena-line: #ccc;
|
|
20
|
+
--athena-surface: #f2f2f2;
|
|
21
|
+
--athena-surface-alt: #fafafa;
|
|
22
|
+
--athena-hover: #e8f0fe;
|
|
23
|
+
--athena-overlay: rgb(0 0 0 / 40%);
|
|
24
|
+
--athena-accent: #2f6db5;
|
|
25
|
+
--athena-accent-fg: #fff;
|
|
26
|
+
--athena-focus: #1b4f8f;
|
|
27
|
+
--athena-danger: #c0392b;
|
|
28
|
+
--athena-success: #1e8449;
|
|
29
|
+
--athena-warning: #9a6700;
|
|
30
|
+
--athena-info: #2471a3;
|
|
31
|
+
--athena-shadow: 0 4px 14px rgb(0 0 0 / 18%);
|
|
32
|
+
|
|
33
|
+
/* shape and spacing */
|
|
34
|
+
--athena-radius: 6px;
|
|
35
|
+
--athena-border-width: 1px;
|
|
36
|
+
--athena-space-1: 4px;
|
|
37
|
+
--athena-space-2: 8px;
|
|
38
|
+
--athena-space-3: 12px;
|
|
39
|
+
--athena-space-4: 16px;
|
|
40
|
+
--grid-gap: 16px;
|
|
41
|
+
|
|
42
|
+
/* focus ring: the colour is --athena-focus */
|
|
43
|
+
--athena-focus-width: 2px;
|
|
44
|
+
|
|
45
|
+
/* components */
|
|
46
|
+
--athena-dialog-small: 360px;
|
|
47
|
+
--athena-dialog-medium: 480px;
|
|
48
|
+
--athena-dialog-large: 720px;
|
|
49
|
+
--athena-row-height: 36px; /* rows of a virtual table; generateTable({ virtual: { rowHeight } }) sets --row-height on the table */
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* The dark colours: chosen with data-mode="dark" ... */
|
|
53
|
+
:root[data-mode="dark"] {
|
|
54
|
+
color-scheme: dark;
|
|
55
|
+
--athena-bg: #16181d;
|
|
56
|
+
--athena-fg: #e6e8eb;
|
|
57
|
+
--athena-muted: #9aa3ad;
|
|
58
|
+
--athena-border: #3a3f47;
|
|
59
|
+
--athena-line: #3a3f47;
|
|
60
|
+
--athena-surface: #23272e;
|
|
61
|
+
--athena-surface-alt: #1c1f25;
|
|
62
|
+
--athena-hover: #2b3340;
|
|
63
|
+
--athena-overlay: rgb(0 0 0 / 65%);
|
|
64
|
+
--athena-accent: #5b9bd5;
|
|
65
|
+
--athena-accent-fg: #0b1118;
|
|
66
|
+
--athena-focus: #8cc0ee;
|
|
67
|
+
--athena-danger: #ef6b5e;
|
|
68
|
+
--athena-success: #4cc38a;
|
|
69
|
+
--athena-warning: #e0b04a;
|
|
70
|
+
--athena-info: #5b9bd5;
|
|
71
|
+
--athena-shadow: 0 4px 14px rgb(0 0 0 / 55%);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ... or, when nothing was chosen, by the system */
|
|
75
|
+
@media (prefers-color-scheme: dark) {
|
|
76
|
+
:root:not([data-mode]) {
|
|
77
|
+
color-scheme: dark;
|
|
78
|
+
--athena-bg: #16181d;
|
|
79
|
+
--athena-fg: #e6e8eb;
|
|
80
|
+
--athena-muted: #9aa3ad;
|
|
81
|
+
--athena-border: #3a3f47;
|
|
82
|
+
--athena-line: #3a3f47;
|
|
83
|
+
--athena-surface: #23272e;
|
|
84
|
+
--athena-surface-alt: #1c1f25;
|
|
85
|
+
--athena-hover: #2b3340;
|
|
86
|
+
--athena-overlay: rgb(0 0 0 / 65%);
|
|
87
|
+
--athena-accent: #5b9bd5;
|
|
88
|
+
--athena-accent-fg: #0b1118;
|
|
89
|
+
--athena-focus: #8cc0ee;
|
|
90
|
+
--athena-danger: #ef6b5e;
|
|
91
|
+
--athena-success: #4cc38a;
|
|
92
|
+
--athena-warning: #e0b04a;
|
|
93
|
+
--athena-info: #5b9bd5;
|
|
94
|
+
--athena-shadow: 0 4px 14px rgb(0 0 0 / 55%);
|
|
95
|
+
}
|
|
96
|
+
}
|
package/src/router.js
ADDED
package/src/sanitize.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//sanitize entry of Athena UI: sanitizeHtml, htmlToText, isSafeUrl
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/sanitize"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/core/sanitize.js";
|
package/src/session.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//session entry of Athena UI: the session cookie, createAuthState, Cookies
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/session"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/auth/session.js";
|
|
7
|
+
export * from "./libs/hephaestus/auth/authState.js";
|
|
8
|
+
export * from "./libs/core/cookies.js";
|
package/src/table.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//table entry of Athena UI: generateTable (rows from memory or a data source, virtual scrolling)
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/table"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/tableGenerator/tableGenerator.js";
|
package/src/testing.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// dom.uninstall();
|
|
14
14
|
|
|
15
15
|
const GLOBALS = ["window", "document", "navigator", "Node", "Element", "HTMLElement", "Event", "CustomEvent", "KeyboardEvent",
|
|
16
|
-
"MouseEvent", "PointerEvent", "DocumentFragment", "MutationObserver", "getComputedStyle", "requestAnimationFrame",
|
|
16
|
+
"MouseEvent", "PointerEvent", "DocumentFragment", "HTMLDialogElement", "MutationObserver", "getComputedStyle", "requestAnimationFrame",
|
|
17
17
|
"cancelAnimationFrame", "localStorage", "location"];
|
|
18
18
|
|
|
19
19
|
const BOUND = new Set(["getComputedStyle", "requestAnimationFrame", "cancelAnimationFrame"]);
|
|
@@ -31,6 +31,16 @@ const BOUND = new Set(["getComputedStyle", "requestAnimationFrame", "cancelAnima
|
|
|
31
31
|
export function installDom(JSDOM, html = '<!doctype html><html><body><div id="wrapper"></div></body></html>', options = {}) {
|
|
32
32
|
const dom = new JSDOM(html, { url: "http://localhost/", pretendToBeVisual: true, ...options });
|
|
33
33
|
const { window } = dom;
|
|
34
|
+
// jsdom has the <dialog> element but not showModal() and close(): a small stand-in (no top layer, no focus trap, which a test does not need)
|
|
35
|
+
const dialogs = window.HTMLDialogElement?.prototype;
|
|
36
|
+
if (dialogs && !dialogs.showModal) {
|
|
37
|
+
dialogs.show = dialogs.showModal = function () { this.setAttribute("open", ""); };
|
|
38
|
+
dialogs.close = function () {
|
|
39
|
+
if (!this.hasAttribute("open")) return;
|
|
40
|
+
this.removeAttribute("open");
|
|
41
|
+
this.dispatchEvent(new window.Event("close"));
|
|
42
|
+
};
|
|
43
|
+
}
|
|
34
44
|
const saved = new Map();
|
|
35
45
|
for (const name of GLOBALS) {
|
|
36
46
|
saved.set(name, Object.getOwnPropertyDescriptor(globalThis, name));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Athena UI theme boot script (MIT). A classic script, not a module: load it in <head>, before the stylesheet, so the saved
|
|
2
|
+
// theme and mode are on <html> before the page is drawn and the wrong colours never flash. createThemeManager does the rest.
|
|
3
|
+
// It is a file of its own because a strict Content-Security-Policy does not allow an inline script. Configure it with
|
|
4
|
+
// data attributes on its own tag (they have to match createThemeManager):
|
|
5
|
+
//
|
|
6
|
+
// <script src="/athena-ui/theme-boot.js" data-key="myapp.appearance" data-theme="ocean"></script>
|
|
7
|
+
//
|
|
8
|
+
// data-key localStorage key (default "athena.appearance")
|
|
9
|
+
// data-theme the theme that is used when nothing is saved (default "default")
|
|
10
|
+
(function () {
|
|
11
|
+
var tag = document.currentScript;
|
|
12
|
+
var key = (tag && tag.getAttribute("data-key")) || "athena.appearance";
|
|
13
|
+
var theme = (tag && tag.getAttribute("data-theme")) || "default";
|
|
14
|
+
var mode = "system";
|
|
15
|
+
try {
|
|
16
|
+
var saved = JSON.parse(localStorage.getItem(key) || "{}");
|
|
17
|
+
if (/^[a-z0-9_-]+$/i.test(saved.theme || "")) theme = saved.theme;
|
|
18
|
+
if (saved.mode === "light" || saved.mode === "dark") mode = saved.mode;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// Private browsing, or a value that is not JSON: the defaults
|
|
21
|
+
}
|
|
22
|
+
var dark = mode === "dark" || (mode === "system" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
23
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
24
|
+
document.documentElement.setAttribute("data-mode", dark ? "dark" : "light");
|
|
25
|
+
})();
|
package/src/theme.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//theme entry of Athena UI: createThemeManager, generateThemePicker
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/theme"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/core/theme.js";
|
|
7
|
+
export * from "./libs/hephaestus/componentGenerator/themePicker.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//validation entry of Athena UI: validateValue, validateAll, validateDateRange
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/validation"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/core/validation.js";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads the theme, waits for the page and generates the layout.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} [options]
|
|
5
|
+
* @param {{id?: number, href?: string}} [options.theme] registered theme id or custom stylesheet
|
|
6
|
+
* @param {object} [options.config] settings overriding the defaults (and the global appConfig)
|
|
7
|
+
* @param {Function} [options.nav] navigation callback (falls back to the global nav)
|
|
8
|
+
* @param {Function} [options.login] login callback (falls back to the global login)
|
|
9
|
+
* @param {Function} [options.register] registration callback (falls back to the global register)
|
|
10
|
+
* @param {Function} [options.lostPassword] lost password callback (falls back to the global lostPassword)
|
|
11
|
+
* @param {Function} [options.changePassword] change password callback (falls back to the global changePassword)
|
|
12
|
+
* @param {object} [options.menuItems] { headerMenu, footerMenu } (falls back to the global menuItems)
|
|
13
|
+
* @returns {Promise<object>} the effective configuration
|
|
14
|
+
*/
|
|
15
|
+
export function init(options?: {
|
|
16
|
+
theme?: {
|
|
17
|
+
id?: number;
|
|
18
|
+
href?: string;
|
|
19
|
+
};
|
|
20
|
+
config?: object;
|
|
21
|
+
nav?: Function;
|
|
22
|
+
login?: Function;
|
|
23
|
+
register?: Function;
|
|
24
|
+
lostPassword?: Function;
|
|
25
|
+
changePassword?: Function;
|
|
26
|
+
menuItems?: object;
|
|
27
|
+
}): Promise<object>;
|
|
28
|
+
/**
|
|
29
|
+
* Starts Athena UI inside an element of your page instead of the body, so it can be one part of a larger page (or of several apps).
|
|
30
|
+
* It does what init() does (settings, language, theme, hooks), and the layout (container, header, wrapper, footer) is generated into
|
|
31
|
+
* `root`. The parts follow the settings: `config: { generateHeader: false, generateFooter: false }` leaves only the wrapper, which is where
|
|
32
|
+
* the components go by default (the element with the id "wrapper"). One app per page: the parts have fixed ids.
|
|
33
|
+
*
|
|
34
|
+
* @param {object} options the options of init(), and
|
|
35
|
+
* @param {string|Element} options.root the element to build into (an element, an id or a selector)
|
|
36
|
+
* @returns {Promise<{element: HTMLElement, container: HTMLElement, header: HTMLElement|null, wrapper: HTMLElement|null, footer: HTMLElement|null,
|
|
37
|
+
* config: object, update: Function, destroy: Function}>}
|
|
38
|
+
*/
|
|
39
|
+
export function createApp(options?: {
|
|
40
|
+
root: string | Element;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
element: HTMLElement;
|
|
43
|
+
container: HTMLElement;
|
|
44
|
+
header: HTMLElement | null;
|
|
45
|
+
wrapper: HTMLElement | null;
|
|
46
|
+
footer: HTMLElement | null;
|
|
47
|
+
config: object;
|
|
48
|
+
update: Function;
|
|
49
|
+
destroy: Function;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Switches the theme at runtime: { id } of a registered theme or { href } of a stylesheet.
|
|
53
|
+
* @returns {Promise<object>} the applied theme
|
|
54
|
+
*/
|
|
55
|
+
export function setTheme(selected: any): Promise<object>;
|
|
56
|
+
export { default as Cookies } from "./libs/core/cookies.js";
|
|
57
|
+
export * from "./libs/core/elementGenerator.js";
|
|
58
|
+
export * from "./libs/core/controls.js";
|
|
59
|
+
export * from "./libs/core/hungarianControls.js";
|
|
60
|
+
export * from "./libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js";
|
|
61
|
+
export * from "./libs/hephaestus/LayoutGenerator/headerContentGenerator.js";
|
|
62
|
+
export * from "./libs/hephaestus/LayoutGenerator/wrapperContentGenerator.js";
|
|
63
|
+
export * from "./libs/hephaestus/LayoutGenerator/footerContentGenerator.js";
|
|
64
|
+
export * from "./libs/hephaestus/MenuGenerator/basicMenuGenerator.js";
|
|
65
|
+
export * from "./libs/hephaestus/MenuGenerator/menuGenerator.js";
|
|
66
|
+
export * from "./libs/hephaestus/formGenerator/loginFormGenerator.js";
|
|
67
|
+
export * from "./libs/hephaestus/formGenerator/registrationFormGenerator.js";
|
|
68
|
+
export * from "./libs/hephaestus/formGenerator/lostPasswordFormGenerator.js";
|
|
69
|
+
export * from "./libs/hephaestus/chartGenerator/chartGenerator.js";
|
|
70
|
+
export * from "./libs/hephaestus/tableGenerator/tableGenerator.js";
|
|
71
|
+
export * from "./libs/hephaestus/formGenerator/changePasswordFormGenerator.js";
|
|
72
|
+
export * from "./libs/hephaestus/formGenerator/formBuilder.js";
|
|
73
|
+
export * from "./libs/hephaestus/formGenerator/authForms.js";
|
|
74
|
+
export * from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
|
|
75
|
+
export * from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
|
|
76
|
+
export * from "./libs/hephaestus/navigationGenerator/navigationGenerator.js";
|
|
77
|
+
export * from "./libs/hephaestus/componentGenerator/componentGenerator.js";
|
|
78
|
+
export * from "./libs/hephaestus/inputGenerator/inputGenerator.js";
|
|
79
|
+
export * from "./libs/hephaestus/inputGenerator/dropZoneGenerator.js";
|
|
80
|
+
export * from "./libs/hephaestus/inputGenerator/richTextGenerator.js";
|
|
81
|
+
export * from "./libs/core/sanitize.js";
|
|
82
|
+
export * from "./libs/hephaestus/router/router.js";
|
|
83
|
+
export * from "./libs/hephaestus/auth/session.js";
|
|
84
|
+
export * from "./libs/hephaestus/auth/authState.js";
|
|
85
|
+
export * from "./libs/core/i18n.js";
|
|
86
|
+
export * from "./libs/core/validation.js";
|
|
87
|
+
export * from "./libs/core/csv.js";
|
|
88
|
+
export * from "./libs/core/dateRange.js";
|
|
89
|
+
export * from "./libs/core/format.js";
|
|
90
|
+
export * from "./libs/hephaestus/modalGenerator/modalGenerator.js";
|
|
91
|
+
export * from "./libs/core/theme.js";
|
|
92
|
+
export * from "./libs/hephaestus/componentGenerator/themePicker.js";
|
|
93
|
+
import config from "./libs/config/config.js";
|
|
94
|
+
import { loadScript } from "./libs/hephaestus/hephaestus.js";
|
|
95
|
+
export { config, loadScript };
|
|
96
|
+
export { el, setContent, resolveElement, asHandle, createSafeBuilder } from "./libs/core/dom.js";
|
package/types/chart.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./libs/hephaestus/chartGenerator/chartGenerator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./libs/hephaestus/componentGenerator/componentGenerator.js";
|
package/types/csv.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./libs/core/csv.js";
|
package/types/dom.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { el, setContent, resolveElement, asHandle, createSafeBuilder } from "./libs/core/dom.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./libs/core/format.js";
|
package/types/forms.d.ts
ADDED
package/types/i18n.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./libs/core/i18n.js";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export function applyConfig(...sources: any[]): {
|
|
2
|
+
version: "2.0.0";
|
|
3
|
+
container_class: "container";
|
|
4
|
+
header_class: "header-container";
|
|
5
|
+
header_menu_class: "header-menu menu";
|
|
6
|
+
wrapper_class: "wrapper-container";
|
|
7
|
+
footer_class: "footer-container";
|
|
8
|
+
footer_menu_class: "footer-menu menu";
|
|
9
|
+
loginForm_class: "login-form form";
|
|
10
|
+
registrationForm_class: "registration-form form";
|
|
11
|
+
lostPasswordForm_class: "lost-password-form form";
|
|
12
|
+
changePasswordForm_class: "change-password-form form";
|
|
13
|
+
bordered: true;
|
|
14
|
+
generateHeader: true;
|
|
15
|
+
generateFooter: true;
|
|
16
|
+
generateHeadercontent: true;
|
|
17
|
+
generateFooterContent: true;
|
|
18
|
+
generateWrappercontent: true;
|
|
19
|
+
login_enabled: false;
|
|
20
|
+
registration_enabled: false;
|
|
21
|
+
lost_password_enabled: false;
|
|
22
|
+
change_password_enabled: false;
|
|
23
|
+
login_remember_me: false;
|
|
24
|
+
header_title_text: "Athena UI";
|
|
25
|
+
header_img_url: any;
|
|
26
|
+
copyright: "Here is the bottom Copyright Text for website";
|
|
27
|
+
locale: "en";
|
|
28
|
+
session_cookie: "athena_session";
|
|
29
|
+
session_days: 7;
|
|
30
|
+
customLoader: any;
|
|
31
|
+
};
|
|
32
|
+
export function withBorder(className: any): any;
|
|
33
|
+
export const BORDERED_CLASS: "default-cointainer-bordered";
|
|
34
|
+
export const defaults: Readonly<{
|
|
35
|
+
version: "2.0.0";
|
|
36
|
+
container_class: "container";
|
|
37
|
+
header_class: "header-container";
|
|
38
|
+
header_menu_class: "header-menu menu";
|
|
39
|
+
wrapper_class: "wrapper-container";
|
|
40
|
+
footer_class: "footer-container";
|
|
41
|
+
footer_menu_class: "footer-menu menu";
|
|
42
|
+
loginForm_class: "login-form form";
|
|
43
|
+
registrationForm_class: "registration-form form";
|
|
44
|
+
lostPasswordForm_class: "lost-password-form form";
|
|
45
|
+
changePasswordForm_class: "change-password-form form";
|
|
46
|
+
bordered: true;
|
|
47
|
+
generateHeader: true;
|
|
48
|
+
generateFooter: true;
|
|
49
|
+
generateHeadercontent: true;
|
|
50
|
+
generateFooterContent: true;
|
|
51
|
+
generateWrappercontent: true;
|
|
52
|
+
login_enabled: false;
|
|
53
|
+
registration_enabled: false;
|
|
54
|
+
lost_password_enabled: false;
|
|
55
|
+
change_password_enabled: false;
|
|
56
|
+
login_remember_me: false;
|
|
57
|
+
header_title_text: "Athena UI";
|
|
58
|
+
header_img_url: any;
|
|
59
|
+
copyright: "Here is the bottom Copyright Text for website";
|
|
60
|
+
locale: "en";
|
|
61
|
+
session_cookie: "athena_session";
|
|
62
|
+
session_days: 7;
|
|
63
|
+
customLoader: any;
|
|
64
|
+
}>;
|
|
65
|
+
export default config;
|
|
66
|
+
declare namespace config {
|
|
67
|
+
let version: "2.0.0";
|
|
68
|
+
let container_class: "container";
|
|
69
|
+
let header_class: "header-container";
|
|
70
|
+
let header_menu_class: "header-menu menu";
|
|
71
|
+
let wrapper_class: "wrapper-container";
|
|
72
|
+
let footer_class: "footer-container";
|
|
73
|
+
let footer_menu_class: "footer-menu menu";
|
|
74
|
+
let loginForm_class: "login-form form";
|
|
75
|
+
let registrationForm_class: "registration-form form";
|
|
76
|
+
let lostPasswordForm_class: "lost-password-form form";
|
|
77
|
+
let changePasswordForm_class: "change-password-form form";
|
|
78
|
+
let bordered: true;
|
|
79
|
+
let generateHeader: true;
|
|
80
|
+
let generateFooter: true;
|
|
81
|
+
let generateHeadercontent: true;
|
|
82
|
+
let generateFooterContent: true;
|
|
83
|
+
let generateWrappercontent: true;
|
|
84
|
+
let login_enabled: false;
|
|
85
|
+
let registration_enabled: false;
|
|
86
|
+
let lost_password_enabled: false;
|
|
87
|
+
let change_password_enabled: false;
|
|
88
|
+
let login_remember_me: false;
|
|
89
|
+
let header_title_text: "Athena UI";
|
|
90
|
+
let header_img_url: any;
|
|
91
|
+
let copyright: "Here is the bottom Copyright Text for website";
|
|
92
|
+
let locale: "en";
|
|
93
|
+
let session_cookie: "athena_session";
|
|
94
|
+
let session_days: 7;
|
|
95
|
+
let customLoader: any;
|
|
96
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function setHooks(options?: {}): void;
|
|
2
|
+
export function getAppConfig(): any;
|
|
3
|
+
export function getMenuItems(): any;
|
|
4
|
+
export function getNav(): any;
|
|
5
|
+
export function getLogin(): any;
|
|
6
|
+
export function getRegister(): any;
|
|
7
|
+
export function getLostPassword(): any;
|
|
8
|
+
export function getChangePassword(): any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: input with a suggestion list. Single mode is an autocomplete, multiple mode a tag selector.
|
|
3
|
+
* `source` is an array of options, or a function (query) => options | Promise<options>.
|
|
4
|
+
*/
|
|
5
|
+
export function createCombobox(options?: {}): {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
input: HTMLElement;
|
|
8
|
+
getValue: () => any;
|
|
9
|
+
setValue: (value: any) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Builds the control described by `options` without appending it. Returns the element, or null (an error is reported). */
|
|
2
|
+
export function buildControl(options: any): any;
|
|
3
|
+
/**
|
|
4
|
+
* Registers a new input type. `factory(options)` returns the element to append.
|
|
5
|
+
* Addons use this to plug in their controls, see registerHungarianInputControls.
|
|
6
|
+
*/
|
|
7
|
+
export function registerControl(inputType: any, factory: any): void;
|
|
8
|
+
/**
|
|
9
|
+
* Builds a control from `{ inputType, id, class, name, value, items, onclick, onchange, ... }` and appends it to the element given as
|
|
10
|
+
* `parent` (an id or an element; without one, to the body).
|
|
11
|
+
*
|
|
12
|
+
* @returns {HTMLElement|undefined} the control, or undefined when the input type is not known
|
|
13
|
+
*/
|
|
14
|
+
export function generateControl(options?: {}): HTMLElement | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The HTMLControlGenerator of the standalone project (0.4.1), so code written for it keeps working.
|
|
17
|
+
* `HTMLControlGenerator(options)` builds the control and appends it to the element with the id `options.parent`
|
|
18
|
+
* (an unknown id appends it, in a div, to the body). It is also a global once Athena UI is loaded.
|
|
19
|
+
*/
|
|
20
|
+
export function HTMLControlGenerator(options: any): void;
|
|
21
|
+
export namespace HTMLControlGenerator {
|
|
22
|
+
/**
|
|
23
|
+
* Builds the control without appending it and returns the element (the standalone project returned a jQuery object: wrap it yourself with
|
|
24
|
+
* `$(HTMLControlGenerator.create(options))` if you still need one). Undefined when the options are not valid.
|
|
25
|
+
*/
|
|
26
|
+
export function create(options: any): any;
|
|
27
|
+
export { registerControl as register };
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Cookies;
|
|
2
|
+
export namespace Cookies {
|
|
3
|
+
export { get };
|
|
4
|
+
export { set };
|
|
5
|
+
export { remove };
|
|
6
|
+
}
|
|
7
|
+
/** The value of a cookie, or undefined. Without a name: all cookies as an object. */
|
|
8
|
+
declare function get(name: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} name
|
|
11
|
+
* @param {string} value
|
|
12
|
+
* @param {object} [attributes]
|
|
13
|
+
* @param {number|Date} [attributes.expires] days from now, or a Date. Without it the cookie ends with the browser session.
|
|
14
|
+
* @param {string} [attributes.path="/"]
|
|
15
|
+
* @param {string} [attributes.domain]
|
|
16
|
+
* @param {"strict"|"lax"|"none"} [attributes.sameSite]
|
|
17
|
+
* @param {boolean} [attributes.secure]
|
|
18
|
+
*/
|
|
19
|
+
declare function set(name: string, value: string, attributes?: {
|
|
20
|
+
expires?: number | Date;
|
|
21
|
+
path?: string;
|
|
22
|
+
domain?: string;
|
|
23
|
+
sameSite?: "strict" | "lax" | "none";
|
|
24
|
+
secure?: boolean;
|
|
25
|
+
}): void;
|
|
26
|
+
/** Removes a cookie. Give the same path, domain and sameSite it was set with. */
|
|
27
|
+
declare function remove(name: any, attributes?: {}): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts rows to CSV text (RFC 4180 quoting, CRLF line ends).
|
|
3
|
+
*
|
|
4
|
+
* @param {{key: string, label?: string}[]} columns
|
|
5
|
+
* @param {object[]} rows
|
|
6
|
+
* @param {string} [separator=","]
|
|
7
|
+
*/
|
|
8
|
+
export function toCsv(columns: {
|
|
9
|
+
key: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
}[], rows: object[], separator?: string): string;
|
|
12
|
+
export function downloadFile(filename: any, text: any, type?: string): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: two native date inputs (from / to). The "to" picker starts at the chosen start date.
|
|
3
|
+
* Values are ISO dates ("2026-01-31"), an empty date is "".
|
|
4
|
+
*/
|
|
5
|
+
export function createDateRange(options?: {}): {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
inputs: HTMLElement[];
|
|
8
|
+
getValue: () => {
|
|
9
|
+
from: any;
|
|
10
|
+
to: any;
|
|
11
|
+
};
|
|
12
|
+
setValue: (value: any) => void;
|
|
13
|
+
validate: () => any;
|
|
14
|
+
};
|
|
15
|
+
/** A Date as the value of a datetime-local input, in the local time of the person: "2026-11-19T10:30". */
|
|
16
|
+
export function toLocalInput(date: any, seconds?: boolean): string;
|
|
17
|
+
/** The value of a datetime-local input as a Date (local time), or null when it is empty or not valid. */
|
|
18
|
+
export function fromLocalInput(value: any): Date;
|
|
19
|
+
/**
|
|
20
|
+
* Internal: two datetime-local inputs and a list of presets (last 15 minutes, hour, 24 hours, 7 days). Choosing a preset fills
|
|
21
|
+
* both inputs; changing an input switches the preset to "Custom". A preset is remembered as a preset: getRange() works out
|
|
22
|
+
* "now" when it is called, so a screen that refreshes asks again and gets the moving window.
|
|
23
|
+
*
|
|
24
|
+
* @param {object} options
|
|
25
|
+
* @param {string} [options.id]
|
|
26
|
+
* @param {string} [options.from] initial start (datetime-local value)
|
|
27
|
+
* @param {string} [options.to] initial end
|
|
28
|
+
* @param {string} [options.preset] id of the preset to start with
|
|
29
|
+
* @param {object[]} [options.presets] default DEFAULT_RANGE_PRESETS; { id, label | labelKey, minutes }
|
|
30
|
+
* @param {boolean} [options.seconds=false] the inputs ask for seconds too
|
|
31
|
+
* @param {string} [options.min]
|
|
32
|
+
* @param {string} [options.max]
|
|
33
|
+
* @param {boolean} [options.disabled]
|
|
34
|
+
* @param {(value: {from: string, to: string, preset: string}) => void} [options.onChange]
|
|
35
|
+
*/
|
|
36
|
+
export function createDateTimeRange(options?: {
|
|
37
|
+
id?: string;
|
|
38
|
+
from?: string;
|
|
39
|
+
to?: string;
|
|
40
|
+
preset?: string;
|
|
41
|
+
presets?: object[];
|
|
42
|
+
seconds?: boolean;
|
|
43
|
+
min?: string;
|
|
44
|
+
max?: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
onChange?: (value: {
|
|
47
|
+
from: string;
|
|
48
|
+
to: string;
|
|
49
|
+
preset: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
}): {
|
|
52
|
+
element: HTMLElement;
|
|
53
|
+
inputs: HTMLElement[];
|
|
54
|
+
getValue: () => {
|
|
55
|
+
from: any;
|
|
56
|
+
to: any;
|
|
57
|
+
preset: string;
|
|
58
|
+
};
|
|
59
|
+
setValue: (value: any) => void;
|
|
60
|
+
/** The range as Dates: a preset is measured from now (when this is called), a custom range is what the inputs hold. */
|
|
61
|
+
getRange(): {
|
|
62
|
+
from: Date;
|
|
63
|
+
to: Date;
|
|
64
|
+
};
|
|
65
|
+
validate: () => any;
|
|
66
|
+
};
|
|
67
|
+
/** The presets of generateDateTimeRange: a name, and how far back from now they reach. */
|
|
68
|
+
export const DEFAULT_RANGE_PRESETS: {
|
|
69
|
+
id: string;
|
|
70
|
+
labelKey: string;
|
|
71
|
+
minutes: number;
|
|
72
|
+
}[];
|