athena-ui-js 1.3.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.
- package/README.md +122 -52
- package/docs/migration-2.0.md +83 -0
- package/docs/styling.md +86 -0
- package/package.json +111 -25
- package/src/athena-ui.js +54 -97
- 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 -9
- package/src/libs/core/controls.js +6 -14
- package/src/libs/core/cookies.js +55 -0
- package/src/libs/core/i18n.js +40 -6
- package/src/libs/core/validation.js +2 -2
- package/src/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js +9 -1
- package/src/libs/hephaestus/MenuGenerator/menuGenerator.js +16 -4
- package/src/libs/hephaestus/auth/session.js +1 -1
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
- package/src/libs/hephaestus/dialogGenerator/dialogGenerator.js +25 -17
- package/src/libs/hephaestus/formGenerator/changePasswordFormGenerator.js +4 -4
- package/src/libs/hephaestus/formGenerator/formUtils.js +0 -4
- package/src/libs/hephaestus/formGenerator/loginFormGenerator.js +2 -3
- package/src/libs/hephaestus/formGenerator/registrationFormGenerator.js +3 -3
- package/src/libs/hephaestus/hephaestus.js +0 -10
- package/src/libs/hephaestus/inputGenerator/dropZoneGenerator.js +1 -1
- package/src/libs/hephaestus/modalGenerator/modalGenerator.js +13 -6
- package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +20 -24
- package/src/menu.js +6 -0
- package/src/navigation.js +6 -0
- package/src/res/themes/default/style.css +97 -100
- 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.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 +93 -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/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
package/package.json
CHANGED
|
@@ -1,25 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "athena-ui-js",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A small UI framework
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "A small, dependency-free UI framework: forms, tables, charts, menus, dialogs, themes and a router, written as ES modules.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/athena-ui.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "node --test tests/*.test.js",
|
|
9
|
-
"test:browser": "node tests/browser/run.mjs"
|
|
9
|
+
"test:browser": "node tests/browser/run.mjs",
|
|
10
|
+
"docs": "node scripts/styling-docs.mjs",
|
|
11
|
+
"types": "tsc -p tsconfig.types.json",
|
|
12
|
+
"test:demo": "node --test --test-timeout=600000 demo/tests/demo.test.mjs demo/tests/browser.test.mjs",
|
|
13
|
+
"demo": "node demo/server.mjs",
|
|
14
|
+
"demo:build": "node demo/scripts/build-package.mjs"
|
|
10
15
|
},
|
|
11
16
|
"exports": {
|
|
12
|
-
".":
|
|
13
|
-
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./types/athena-ui.d.ts",
|
|
19
|
+
"default": "./src/athena-ui.js"
|
|
20
|
+
},
|
|
21
|
+
"./classic": {
|
|
22
|
+
"types": "./types/classic.d.ts",
|
|
23
|
+
"default": "./src/classic.js"
|
|
24
|
+
},
|
|
25
|
+
"./testing": {
|
|
26
|
+
"types": "./types/testing.d.ts",
|
|
27
|
+
"default": "./src/testing.js"
|
|
28
|
+
},
|
|
14
29
|
"./theme-boot.js": "./src/theme-boot.js",
|
|
30
|
+
"./table": {
|
|
31
|
+
"types": "./types/table.d.ts",
|
|
32
|
+
"default": "./src/table.js"
|
|
33
|
+
},
|
|
34
|
+
"./chart": {
|
|
35
|
+
"types": "./types/chart.d.ts",
|
|
36
|
+
"default": "./src/chart.js"
|
|
37
|
+
},
|
|
38
|
+
"./dialog": {
|
|
39
|
+
"types": "./types/dialog.d.ts",
|
|
40
|
+
"default": "./src/dialog.js"
|
|
41
|
+
},
|
|
42
|
+
"./menu": {
|
|
43
|
+
"types": "./types/menu.d.ts",
|
|
44
|
+
"default": "./src/menu.js"
|
|
45
|
+
},
|
|
46
|
+
"./navigation": {
|
|
47
|
+
"types": "./types/navigation.d.ts",
|
|
48
|
+
"default": "./src/navigation.js"
|
|
49
|
+
},
|
|
50
|
+
"./forms": {
|
|
51
|
+
"types": "./types/forms.d.ts",
|
|
52
|
+
"default": "./src/forms.js"
|
|
53
|
+
},
|
|
54
|
+
"./feedback": {
|
|
55
|
+
"types": "./types/feedback.d.ts",
|
|
56
|
+
"default": "./src/feedback.js"
|
|
57
|
+
},
|
|
58
|
+
"./components": {
|
|
59
|
+
"types": "./types/components.d.ts",
|
|
60
|
+
"default": "./src/components.js"
|
|
61
|
+
},
|
|
62
|
+
"./inputs": {
|
|
63
|
+
"types": "./types/inputs.d.ts",
|
|
64
|
+
"default": "./src/inputs.js"
|
|
65
|
+
},
|
|
66
|
+
"./router": {
|
|
67
|
+
"types": "./types/router.d.ts",
|
|
68
|
+
"default": "./src/router.js"
|
|
69
|
+
},
|
|
70
|
+
"./session": {
|
|
71
|
+
"types": "./types/session.d.ts",
|
|
72
|
+
"default": "./src/session.js"
|
|
73
|
+
},
|
|
74
|
+
"./theme": {
|
|
75
|
+
"types": "./types/theme.d.ts",
|
|
76
|
+
"default": "./src/theme.js"
|
|
77
|
+
},
|
|
78
|
+
"./i18n": {
|
|
79
|
+
"types": "./types/i18n.d.ts",
|
|
80
|
+
"default": "./src/i18n.js"
|
|
81
|
+
},
|
|
82
|
+
"./format": {
|
|
83
|
+
"types": "./types/format.d.ts",
|
|
84
|
+
"default": "./src/format.js"
|
|
85
|
+
},
|
|
86
|
+
"./validation": {
|
|
87
|
+
"types": "./types/validation.d.ts",
|
|
88
|
+
"default": "./src/validation.js"
|
|
89
|
+
},
|
|
90
|
+
"./sanitize": {
|
|
91
|
+
"types": "./types/sanitize.d.ts",
|
|
92
|
+
"default": "./src/sanitize.js"
|
|
93
|
+
},
|
|
94
|
+
"./csv": {
|
|
95
|
+
"types": "./types/csv.d.ts",
|
|
96
|
+
"default": "./src/csv.js"
|
|
97
|
+
},
|
|
98
|
+
"./dom": {
|
|
99
|
+
"types": "./types/dom.d.ts",
|
|
100
|
+
"default": "./src/dom.js"
|
|
101
|
+
},
|
|
102
|
+
"./controls": {
|
|
103
|
+
"types": "./types/controls.d.ts",
|
|
104
|
+
"default": "./src/controls.js"
|
|
105
|
+
},
|
|
15
106
|
"./themes/*": "./src/res/themes/*",
|
|
16
107
|
"./package.json": "./package.json"
|
|
17
108
|
},
|
|
18
109
|
"files": [
|
|
19
|
-
"src/athena-ui.js",
|
|
20
|
-
"src/testing.js",
|
|
21
|
-
"src/theme-boot.js",
|
|
22
|
-
"src/libs/libs.js",
|
|
23
110
|
"src/libs/config",
|
|
24
111
|
"src/libs/hephaestus/hephaestus.js",
|
|
25
112
|
"src/libs/hephaestus/LayoutGenerator",
|
|
@@ -36,17 +123,20 @@
|
|
|
36
123
|
"src/libs/hephaestus/chartGenerator",
|
|
37
124
|
"src/libs/hephaestus/tableGenerator",
|
|
38
125
|
"src/libs/hephaestus/modalGenerator",
|
|
39
|
-
"src/
|
|
40
|
-
"src
|
|
41
|
-
"src/
|
|
42
|
-
"
|
|
43
|
-
"
|
|
126
|
+
"src/res",
|
|
127
|
+
"src/*.js",
|
|
128
|
+
"!src/example.js",
|
|
129
|
+
"types",
|
|
130
|
+
"docs"
|
|
131
|
+
],
|
|
132
|
+
"sideEffects": [
|
|
133
|
+
"./src/classic.js",
|
|
134
|
+
"./src/theme-boot.js",
|
|
135
|
+
"*.css"
|
|
44
136
|
],
|
|
45
|
-
"sideEffects": true,
|
|
46
137
|
"keywords": [
|
|
47
138
|
"ui",
|
|
48
139
|
"framework",
|
|
49
|
-
"jquery",
|
|
50
140
|
"layout",
|
|
51
141
|
"menu",
|
|
52
142
|
"login-form",
|
|
@@ -64,14 +154,6 @@
|
|
|
64
154
|
"themes",
|
|
65
155
|
"es-modules"
|
|
66
156
|
],
|
|
67
|
-
"peerDependencies": {
|
|
68
|
-
"jquery": "^4.0.0"
|
|
69
|
-
},
|
|
70
|
-
"peerDependenciesMeta": {
|
|
71
|
-
"jquery": {
|
|
72
|
-
"optional": true
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
157
|
"publishConfig": {
|
|
76
158
|
"access": "public"
|
|
77
159
|
},
|
|
@@ -84,5 +166,9 @@
|
|
|
84
166
|
"url": "https://github.com/csabatibortoth/athena-ui/issues"
|
|
85
167
|
},
|
|
86
168
|
"author": "Csaba Tóth (https://github.com/csabatibortoth)",
|
|
87
|
-
"license": "MIT"
|
|
169
|
+
"license": "MIT",
|
|
170
|
+
"devDependencies": {
|
|
171
|
+
"typescript": "^5.9.3"
|
|
172
|
+
},
|
|
173
|
+
"types": "./types/athena-ui.d.ts"
|
|
88
174
|
}
|
package/src/athena-ui.js
CHANGED
|
@@ -2,52 +2,21 @@
|
|
|
2
2
|
//Author: Csaba Tóth https://github.com/csabatibortoth/
|
|
3
3
|
//LICENCE: MIT
|
|
4
4
|
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
-
//Version:
|
|
5
|
+
//Version: 2.0.1
|
|
6
|
+
|
|
7
|
+
// The whole API as ES module exports. There are no side effects: importing this file does not touch the page, does not load a script and does not
|
|
8
|
+
// put anything on globalThis. For pages that need globals use `athena-ui-js/classic`, and to download only what you use import from the entry points
|
|
9
|
+
// (`athena-ui-js/table`, `athena-ui-js/dialog`, ...).
|
|
6
10
|
|
|
7
11
|
import config, { applyConfig } from "./libs/config/config.js";
|
|
8
12
|
import { getAppConfig, setHooks } from "./libs/config/hooks.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import * as footer from "./libs/hephaestus/LayoutGenerator/footerContentGenerator.js";
|
|
14
|
-
import * as menu from "./libs/hephaestus/MenuGenerator/basicMenuGenerator.js";
|
|
15
|
-
import * as menuGenerator from "./libs/hephaestus/MenuGenerator/menuGenerator.js";
|
|
16
|
-
import * as loginForm from "./libs/hephaestus/formGenerator/loginFormGenerator.js";
|
|
17
|
-
import * as registrationForm from "./libs/hephaestus/formGenerator/registrationFormGenerator.js";
|
|
18
|
-
import * as lostPasswordForm from "./libs/hephaestus/formGenerator/lostPasswordFormGenerator.js";
|
|
19
|
-
import * as chart from "./libs/hephaestus/chartGenerator/chartGenerator.js";
|
|
20
|
-
import * as table from "./libs/hephaestus/tableGenerator/tableGenerator.js";
|
|
21
|
-
import * as changePasswordForm from "./libs/hephaestus/formGenerator/changePasswordFormGenerator.js";
|
|
22
|
-
import * as formBuilder from "./libs/hephaestus/formGenerator/formBuilder.js";
|
|
23
|
-
import * as feedback from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
|
|
24
|
-
import * as dialog from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
|
|
25
|
-
import * as navigation from "./libs/hephaestus/navigationGenerator/navigationGenerator.js";
|
|
26
|
-
import * as components from "./libs/hephaestus/componentGenerator/componentGenerator.js";
|
|
27
|
-
import * as inputs from "./libs/hephaestus/inputGenerator/inputGenerator.js";
|
|
28
|
-
import * as dropZone from "./libs/hephaestus/inputGenerator/dropZoneGenerator.js";
|
|
29
|
-
import * as richText from "./libs/hephaestus/inputGenerator/richTextGenerator.js";
|
|
30
|
-
import * as sanitize from "./libs/core/sanitize.js";
|
|
31
|
-
import * as router from "./libs/hephaestus/router/router.js";
|
|
32
|
-
import * as session from "./libs/hephaestus/auth/session.js";
|
|
33
|
-
import * as authState from "./libs/hephaestus/auth/authState.js";
|
|
34
|
-
import * as authForms from "./libs/hephaestus/formGenerator/authForms.js";
|
|
35
|
-
import * as i18n from "./libs/core/i18n.js";
|
|
36
|
-
import * as validation from "./libs/core/validation.js";
|
|
37
|
-
import * as format from "./libs/core/format.js";
|
|
38
|
-
import * as dateRange from "./libs/core/dateRange.js";
|
|
39
|
-
import * as csv from "./libs/core/csv.js";
|
|
40
|
-
import * as theme from "./libs/core/theme.js";
|
|
41
|
-
import * as themePicker from "./libs/hephaestus/componentGenerator/themePicker.js";
|
|
42
|
-
import * as modal from "./libs/hephaestus/modalGenerator/modalGenerator.js";
|
|
43
|
-
import Cookies from "./libs/js-cookie/src/api.mjs";
|
|
44
|
-
import { HTMLElementGenerator } from "./libs/core/elementGenerator.js";
|
|
45
|
-
import { HTMLControlGenerator, registerControl, generateControl } from "./libs/core/controls.js";
|
|
46
|
-
import { registerHungarianInputControls } from "./libs/core/hungarianControls.js";
|
|
47
|
-
|
|
13
|
+
import { loadScript, loadTheme } from "./libs/hephaestus/hephaestus.js";
|
|
14
|
+
import { generateBasicLayout, setLayoutRoot } from "./libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js";
|
|
15
|
+
import { asHandle, resolveElement, uid } from "./libs/core/dom.js";
|
|
16
|
+
import { setLocale } from "./libs/core/i18n.js";
|
|
48
17
|
|
|
49
18
|
/**
|
|
50
|
-
* Loads the
|
|
19
|
+
* Loads the theme, waits for the page and generates the layout.
|
|
51
20
|
*
|
|
52
21
|
* @param {object} [options]
|
|
53
22
|
* @param {{id?: number, href?: string}} [options.theme] registered theme id or custom stylesheet
|
|
@@ -62,19 +31,54 @@ import { registerHungarianInputControls } from "./libs/core/hungarianControls.js
|
|
|
62
31
|
*/
|
|
63
32
|
export async function init(options = {}) {
|
|
64
33
|
applyConfig(getAppConfig(), options.config);
|
|
65
|
-
|
|
34
|
+
setLocale(config.locale);
|
|
66
35
|
setHooks(options);
|
|
67
36
|
|
|
68
37
|
await Promise.all([
|
|
69
|
-
|
|
38
|
+
config.customLoader ? loadScript(config.customLoader) : undefined,
|
|
70
39
|
loadTheme(options.theme ?? options.themes),
|
|
71
40
|
new Promise(resolve => (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", resolve, { once: true }) : resolve()))
|
|
72
41
|
]);
|
|
73
42
|
|
|
74
|
-
|
|
43
|
+
generateBasicLayout();
|
|
75
44
|
return config;
|
|
76
45
|
}
|
|
77
46
|
|
|
47
|
+
/**
|
|
48
|
+
* 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).
|
|
49
|
+
* It does what init() does (settings, language, theme, hooks), and the layout (container, header, wrapper, footer) is generated into
|
|
50
|
+
* `root`. The parts follow the settings: `config: { generateHeader: false, generateFooter: false }` leaves only the wrapper, which is where
|
|
51
|
+
* the components go by default (the element with the id "wrapper"). One app per page: the parts have fixed ids.
|
|
52
|
+
*
|
|
53
|
+
* @param {object} options the options of init(), and
|
|
54
|
+
* @param {string|Element} options.root the element to build into (an element, an id or a selector)
|
|
55
|
+
* @returns {Promise<{element: HTMLElement, container: HTMLElement, header: HTMLElement|null, wrapper: HTMLElement|null, footer: HTMLElement|null,
|
|
56
|
+
* config: object, update: Function, destroy: Function}>}
|
|
57
|
+
*/
|
|
58
|
+
export async function createApp(options = {}) {
|
|
59
|
+
const root = resolveElement(options.root);
|
|
60
|
+
if (!root) throw new Error("Athena UI: createApp needs a root element (an element, an id or a selector)");
|
|
61
|
+
if (!root.id) root.id = uid("athena-app");
|
|
62
|
+
setLayoutRoot(root.id);
|
|
63
|
+
let effective;
|
|
64
|
+
try {
|
|
65
|
+
effective = await init(options);
|
|
66
|
+
} finally {
|
|
67
|
+
setLayoutRoot("");
|
|
68
|
+
}
|
|
69
|
+
return asHandle({
|
|
70
|
+
element: root,
|
|
71
|
+
container: document.getElementById("container"),
|
|
72
|
+
header: document.getElementById("header"),
|
|
73
|
+
wrapper: document.getElementById("wrapper"),
|
|
74
|
+
footer: document.getElementById("footer"),
|
|
75
|
+
config: effective,
|
|
76
|
+
destroy() {
|
|
77
|
+
document.getElementById("container")?.remove();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
78
82
|
/**
|
|
79
83
|
* Switches the theme at runtime: { id } of a registered theme or { href } of a stylesheet.
|
|
80
84
|
* @returns {Promise<object>} the applied theme
|
|
@@ -83,57 +87,11 @@ export function setTheme(selected) {
|
|
|
83
87
|
return loadTheme(selected);
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
HTMLElementGenerator,
|
|
92
|
-
HTMLControlGenerator,
|
|
93
|
-
registerControl,
|
|
94
|
-
generateControl,
|
|
95
|
-
registerHungarianInputControls,
|
|
96
|
-
...layout,
|
|
97
|
-
...header,
|
|
98
|
-
...wrapper,
|
|
99
|
-
...footer,
|
|
100
|
-
...menu,
|
|
101
|
-
...menuGenerator,
|
|
102
|
-
...loginForm,
|
|
103
|
-
...registrationForm,
|
|
104
|
-
...lostPasswordForm,
|
|
105
|
-
...changePasswordForm,
|
|
106
|
-
...formBuilder,
|
|
107
|
-
...feedback,
|
|
108
|
-
...dialog,
|
|
109
|
-
...navigation,
|
|
110
|
-
...components,
|
|
111
|
-
...inputs,
|
|
112
|
-
...dropZone,
|
|
113
|
-
...richText,
|
|
114
|
-
...sanitize,
|
|
115
|
-
...router,
|
|
116
|
-
...session,
|
|
117
|
-
...authState,
|
|
118
|
-
...authForms,
|
|
119
|
-
...i18n,
|
|
120
|
-
...validation,
|
|
121
|
-
...csv,
|
|
122
|
-
...dateRange,
|
|
123
|
-
...format,
|
|
124
|
-
setTheme,
|
|
125
|
-
...chart,
|
|
126
|
-
...table,
|
|
127
|
-
...theme,
|
|
128
|
-
...themePicker,
|
|
129
|
-
...modal
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// Classic scripts (the customLoader, inline handlers) keep working: the whole API
|
|
133
|
-
// stays reachable as globals, like in the pre-module versions.
|
|
134
|
-
Object.assign(globalThis, AthenaUI, { AthenaUI });
|
|
135
|
-
|
|
136
|
-
export { config, loadScript, Cookies, HTMLElementGenerator, HTMLControlGenerator, registerControl, generateControl, registerHungarianInputControls };
|
|
90
|
+
export { config, loadScript };
|
|
91
|
+
export { default as Cookies } from "./libs/core/cookies.js";
|
|
92
|
+
export * from "./libs/core/elementGenerator.js";
|
|
93
|
+
export * from "./libs/core/controls.js";
|
|
94
|
+
export * from "./libs/core/hungarianControls.js";
|
|
137
95
|
export * from "./libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js";
|
|
138
96
|
export * from "./libs/hephaestus/LayoutGenerator/headerContentGenerator.js";
|
|
139
97
|
export * from "./libs/hephaestus/LayoutGenerator/wrapperContentGenerator.js";
|
|
@@ -147,6 +105,7 @@ export * from "./libs/hephaestus/chartGenerator/chartGenerator.js";
|
|
|
147
105
|
export * from "./libs/hephaestus/tableGenerator/tableGenerator.js";
|
|
148
106
|
export * from "./libs/hephaestus/formGenerator/changePasswordFormGenerator.js";
|
|
149
107
|
export * from "./libs/hephaestus/formGenerator/formBuilder.js";
|
|
108
|
+
export * from "./libs/hephaestus/formGenerator/authForms.js";
|
|
150
109
|
export * from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
|
|
151
110
|
export * from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
|
|
152
111
|
export * from "./libs/hephaestus/navigationGenerator/navigationGenerator.js";
|
|
@@ -159,7 +118,6 @@ export * from "./libs/core/sanitize.js";
|
|
|
159
118
|
export * from "./libs/hephaestus/router/router.js";
|
|
160
119
|
export * from "./libs/hephaestus/auth/session.js";
|
|
161
120
|
export * from "./libs/hephaestus/auth/authState.js";
|
|
162
|
-
export * from "./libs/hephaestus/formGenerator/authForms.js";
|
|
163
121
|
export * from "./libs/core/i18n.js";
|
|
164
122
|
export * from "./libs/core/validation.js";
|
|
165
123
|
export * from "./libs/core/csv.js";
|
|
@@ -168,4 +126,3 @@ export * from "./libs/core/format.js";
|
|
|
168
126
|
export * from "./libs/hephaestus/modalGenerator/modalGenerator.js";
|
|
169
127
|
export * from "./libs/core/theme.js";
|
|
170
128
|
export * from "./libs/hephaestus/componentGenerator/themePicker.js";
|
|
171
|
-
export default AthenaUI;
|
package/src/chart.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//chart entry of Athena UI: generateChart
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/chart"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/chartGenerator/chartGenerator.js";
|
package/src/classic.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//classic build of Athena UI: puts the whole API on globalThis (as window.generateTable, window.AthenaUI, ...)
|
|
2
|
+
//LICENCE: MIT
|
|
3
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
4
|
+
//
|
|
5
|
+
// The ES module entry points have no side effects. This file is the opt-in for pages that use inline handlers or classic scripts:
|
|
6
|
+
//
|
|
7
|
+
// <script type="module" src="athena-ui/src/classic.js"></script>
|
|
8
|
+
|
|
9
|
+
import * as AthenaUI from "./athena-ui.js";
|
|
10
|
+
|
|
11
|
+
Object.assign(globalThis, AthenaUI, { AthenaUI });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//components entry of Athena UI: card, section, grid, badge, avatar, stat, link, tooltip, page header, facts, empty state, loading
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/components"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/componentGenerator/componentGenerator.js";
|
package/src/controls.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//controls entry of Athena UI: HTMLElementGenerator, HTMLControlGenerator, generateControl, registerHungarianInputControls
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/controls"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/core/elementGenerator.js";
|
|
7
|
+
export * from "./libs/core/controls.js";
|
|
8
|
+
export * from "./libs/core/hungarianControls.js";
|
package/src/csv.js
ADDED
package/src/dialog.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//dialog entry of Athena UI: showDialog, showConfirm, showFormDialog, alert / confirm / prompt, openModal, closeModal
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/dialog"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
|
|
7
|
+
export * from "./libs/hephaestus/modalGenerator/modalGenerator.js";
|
package/src/dom.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//dom entry of Athena UI: el, setContent, resolveElement, asHandle, createSafeBuilder
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/dom"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export { el, setContent, resolveElement, asHandle, createSafeBuilder } from "./libs/core/dom.js";
|
package/src/feedback.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//feedback entry of Athena UI: toasts, alerts, spinner, progress, copyToClipboard
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/feedback"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
|
package/src/format.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//format entry of Athena UI: formatBytes, formatNumber, formatDuration, formatRelativeTime, formatDate
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/format"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/core/format.js";
|
package/src/forms.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//forms entry of Athena UI: generateForm, generateField, generateButton, the sign in / sign up / password forms
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/forms"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/formGenerator/formBuilder.js";
|
|
7
|
+
export * from "./libs/hephaestus/formGenerator/authForms.js";
|
package/src/i18n.js
ADDED
package/src/inputs.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//inputs entry of Athena UI: autocomplete, multi select, file upload, drop zone, stepper, date and time ranges, rich text, WYSIWYG
|
|
2
|
+
//Import only what you use: `import { generateTable } from "athena-ui-js/inputs"`.
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
export * from "./libs/hephaestus/inputGenerator/inputGenerator.js";
|
|
7
|
+
export * from "./libs/hephaestus/inputGenerator/dropZoneGenerator.js";
|
|
8
|
+
export * from "./libs/hephaestus/inputGenerator/richTextGenerator.js";
|
|
9
|
+
export * from "./libs/core/dateRange.js";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export const BORDERED_CLASS = "default-cointainer-bordered";
|
|
7
7
|
|
|
8
8
|
export const defaults = Object.freeze({
|
|
9
|
-
version: "
|
|
9
|
+
version: "2.0.1",
|
|
10
10
|
container_class: "container",
|
|
11
11
|
header_class: "header-container",
|
|
12
12
|
header_menu_class: "header-menu menu",
|
|
@@ -29,7 +29,6 @@ export const defaults = Object.freeze({
|
|
|
29
29
|
lost_password_enabled: false,
|
|
30
30
|
change_password_enabled: false,
|
|
31
31
|
login_remember_me: false,
|
|
32
|
-
enable_encrypt_password: false,
|
|
33
32
|
|
|
34
33
|
header_title_text: "Athena UI",
|
|
35
34
|
header_img_url: undefined,
|
|
@@ -50,8 +49,6 @@ const config = { ...defaults };
|
|
|
50
49
|
|
|
51
50
|
export default config;
|
|
52
51
|
|
|
53
|
-
let warnedEncrypt = false;
|
|
54
|
-
|
|
55
52
|
// Copies every known setting that is defined in the given sources onto the live config.
|
|
56
53
|
export function applyConfig(...sources) {
|
|
57
54
|
for (const source of sources) {
|
|
@@ -60,11 +57,6 @@ export function applyConfig(...sources) {
|
|
|
60
57
|
if (source[key] !== undefined) config[key] = source[key];
|
|
61
58
|
}
|
|
62
59
|
}
|
|
63
|
-
if (config.enable_encrypt_password && !warnedEncrypt) {
|
|
64
|
-
warnedEncrypt = true;
|
|
65
|
-
console.warn("Athena UI: enable_encrypt_password is deprecated and will be removed in 2.0. Hashing a password in the browser only turns the hash "
|
|
66
|
-
+ "into the password. Send it over HTTPS and hash it on the server. generateSignInForm / generateSignUpForm do not hash.");
|
|
67
|
-
}
|
|
68
60
|
return config;
|
|
69
61
|
}
|
|
70
62
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//LICENCE: MIT
|
|
4
4
|
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
5
|
//Moved here from HTMLControlGenerator 0.4.1 (https://github.com/csabatibortoth/HTMLControlGenerator), which is no longer developed.
|
|
6
|
-
//The calls are the same;
|
|
6
|
+
//The calls are the same; there is no jQuery in it any more (since 2.0 `create` returns the element, not a jQuery object).
|
|
7
7
|
|
|
8
8
|
import { el, resolveElement } from "./dom.js";
|
|
9
9
|
import { noBodyOrParentError, reportError, undefinedError, wrongInputTypeError } from "./errors.js";
|
|
@@ -83,19 +83,16 @@ function list(options) {
|
|
|
83
83
|
|
|
84
84
|
const factories = new Map([...INPUT_TYPES.map(type => [type, input]), ["select", select], ["ul", list], ["ol", list]]);
|
|
85
85
|
|
|
86
|
-
// A factory registered by an addon may return an element or a jQuery object.
|
|
87
|
-
const unwrap = made => (made && made.jquery ? made[0] : made);
|
|
88
|
-
|
|
89
86
|
/** Builds the control described by `options` without appending it. Returns the element, or null (an error is reported). */
|
|
90
87
|
export function buildControl(options) {
|
|
91
88
|
if (options === undefined) return reportError(undefinedError("options", "HTMLControlGenerator"));
|
|
92
89
|
const factory = factories.get(options.inputType);
|
|
93
90
|
if (!factory) return reportError(wrongInputTypeError("options", "HTMLControlGenerator", options));
|
|
94
|
-
return
|
|
91
|
+
return factory(options);
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
/**
|
|
98
|
-
* Registers a new input type. `factory(options)` returns the element to append
|
|
95
|
+
* Registers a new input type. `factory(options)` returns the element to append.
|
|
99
96
|
* Addons use this to plug in their controls, see registerHungarianInputControls.
|
|
100
97
|
*/
|
|
101
98
|
export function registerControl(inputType, factory) {
|
|
@@ -140,14 +137,9 @@ export function HTMLControlGenerator(options) {
|
|
|
140
137
|
}
|
|
141
138
|
|
|
142
139
|
/**
|
|
143
|
-
* Builds the control without appending it
|
|
144
|
-
* (
|
|
140
|
+
* Builds the control without appending it and returns the element (the standalone project returned a jQuery object: wrap it yourself with
|
|
141
|
+
* `$(HTMLControlGenerator.create(options))` if you still need one). Undefined when the options are not valid.
|
|
145
142
|
*/
|
|
146
|
-
HTMLControlGenerator.create = options =>
|
|
147
|
-
const control = buildControl(options);
|
|
148
|
-
if (!control) return undefined;
|
|
149
|
-
const jquery = globalThis.jQuery;
|
|
150
|
-
return typeof jquery === "function" ? jquery(control) : control;
|
|
151
|
-
};
|
|
143
|
+
HTMLControlGenerator.create = options => buildControl(options) ?? undefined;
|
|
152
144
|
|
|
153
145
|
HTMLControlGenerator.register = registerControl;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//cookies for Athena UI
|
|
2
|
+
//Author: Csaba Tóth https://github.com/csabatibortoth/
|
|
3
|
+
//LICENCE: MIT
|
|
4
|
+
//Repository: https://github.com/csabatibortoth/athena-ui
|
|
5
|
+
|
|
6
|
+
// A small cookie helper (it replaces js-cookie, which Athena UI used to bundle). Same calls for what Athena needs:
|
|
7
|
+
// Cookies.get(name), Cookies.set(name, value, attributes), Cookies.remove(name, attributes).
|
|
8
|
+
|
|
9
|
+
const encode = value => encodeURIComponent(String(value)).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
10
|
+
const decode = value => value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} name
|
|
14
|
+
* @param {string} value
|
|
15
|
+
* @param {object} [attributes]
|
|
16
|
+
* @param {number|Date} [attributes.expires] days from now, or a Date. Without it the cookie ends with the browser session.
|
|
17
|
+
* @param {string} [attributes.path="/"]
|
|
18
|
+
* @param {string} [attributes.domain]
|
|
19
|
+
* @param {"strict"|"lax"|"none"} [attributes.sameSite]
|
|
20
|
+
* @param {boolean} [attributes.secure]
|
|
21
|
+
*/
|
|
22
|
+
function set(name, value, attributes = {}) {
|
|
23
|
+
const { expires, path = "/", domain, sameSite, secure } = attributes;
|
|
24
|
+
let text = `${encode(name)}=${encode(value)}`;
|
|
25
|
+
if (expires != null) {
|
|
26
|
+
const date = expires instanceof Date ? expires : new Date(Date.now() + expires * 864e5);
|
|
27
|
+
text += `; expires=${date.toUTCString()}`;
|
|
28
|
+
}
|
|
29
|
+
if (path) text += `; path=${path}`;
|
|
30
|
+
if (domain) text += `; domain=${domain}`;
|
|
31
|
+
if (sameSite) text += `; samesite=${sameSite}`;
|
|
32
|
+
if (secure) text += "; secure";
|
|
33
|
+
document.cookie = text;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The value of a cookie, or undefined. Without a name: all cookies as an object. */
|
|
37
|
+
function get(name) {
|
|
38
|
+
const all = {};
|
|
39
|
+
for (const part of document.cookie ? document.cookie.split("; ") : []) {
|
|
40
|
+
const at = part.indexOf("=");
|
|
41
|
+
const key = decode(part.slice(0, at));
|
|
42
|
+
if (name === undefined || key === name) all[key] = decode(part.slice(at + 1));
|
|
43
|
+
if (key === name) break;
|
|
44
|
+
}
|
|
45
|
+
return name === undefined ? all : all[name];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Removes a cookie. Give the same path, domain and sameSite it was set with. */
|
|
49
|
+
function remove(name, attributes = {}) {
|
|
50
|
+
set(name, "", { ...attributes, expires: -1 });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const Cookies = { get, set, remove };
|
|
54
|
+
export default Cookies;
|
|
55
|
+
export { Cookies };
|