athena-ui-js 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +28 -4
  2. package/package.json +5 -2
  3. package/src/athena-ui.js +1 -1
  4. package/src/libs/config/config.js +1 -1
  5. package/src/libs/hephaestus/chartGenerator/chartGenerator.js +26 -2
  6. package/types/athena-ui.d.ts +96 -96
  7. package/types/chart.d.ts +1 -1
  8. package/types/classic.d.ts +1 -1
  9. package/types/components.d.ts +1 -1
  10. package/types/controls.d.ts +3 -3
  11. package/types/csv.d.ts +1 -1
  12. package/types/dialog.d.ts +2 -2
  13. package/types/dom.d.ts +1 -1
  14. package/types/feedback.d.ts +1 -1
  15. package/types/format.d.ts +1 -1
  16. package/types/forms.d.ts +2 -2
  17. package/types/i18n.d.ts +1 -1
  18. package/types/inputs.d.ts +4 -4
  19. package/types/libs/config/config.d.ts +3 -3
  20. package/types/libs/config/hooks.d.ts +8 -8
  21. package/types/libs/core/combobox.d.ts +10 -10
  22. package/types/libs/core/controls.d.ts +28 -28
  23. package/types/libs/core/cookies.d.ts +27 -27
  24. package/types/libs/core/csv.d.ts +12 -12
  25. package/types/libs/core/dateRange.d.ts +72 -72
  26. package/types/libs/core/dom.d.ts +65 -65
  27. package/types/libs/core/elementGenerator.d.ts +30 -30
  28. package/types/libs/core/errors.d.ts +29 -29
  29. package/types/libs/core/focus.d.ts +6 -6
  30. package/types/libs/core/format.d.ts +21 -21
  31. package/types/libs/core/hungarianControls.d.ts +2 -2
  32. package/types/libs/core/i18n.d.ts +17 -17
  33. package/types/libs/core/pagination.d.ts +5 -5
  34. package/types/libs/core/sanitize.d.ts +6 -6
  35. package/types/libs/core/tableMath.d.ts +26 -26
  36. package/types/libs/core/theme.d.ts +39 -39
  37. package/types/libs/core/validation.d.ts +56 -56
  38. package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -10
  39. package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -4
  40. package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -20
  41. package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -1
  42. package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -14
  43. package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -65
  44. package/types/libs/hephaestus/auth/authState.d.ts +26 -26
  45. package/types/libs/hephaestus/auth/session.d.ts +26 -26
  46. package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +2 -0
  47. package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +222 -222
  48. package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -24
  49. package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -120
  50. package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -86
  51. package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -122
  52. package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -6
  53. package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -113
  54. package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -8
  55. package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -11
  56. package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -4
  57. package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -7
  58. package/types/libs/hephaestus/hephaestus.d.ts +3 -3
  59. package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -48
  60. package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -185
  61. package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -49
  62. package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -2
  63. package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +150 -150
  64. package/types/libs/hephaestus/router/matchRoute.d.ts +12 -12
  65. package/types/libs/hephaestus/router/router.d.ts +67 -67
  66. package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -120
  67. package/types/menu.d.ts +1 -1
  68. package/types/navigation.d.ts +1 -1
  69. package/types/res/themes/themes.d.ts +7 -7
  70. package/types/router.d.ts +1 -1
  71. package/types/sanitize.d.ts +1 -1
  72. package/types/session.d.ts +3 -3
  73. package/types/table.d.ts +1 -1
  74. package/types/testing.d.ts +27 -27
  75. package/types/theme.d.ts +2 -2
  76. package/types/validation.d.ts +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ layout (header, menu, content wrapper, footer) from a single `init()` call, load
5
5
  and theme, and ships the building blocks of a multipurpose application: forms, tables, charts,
6
6
  feedback, navigation, a router and more.
7
7
 
8
- Current version: **2.0.0**
8
+ Current version: **2.0.1**
9
9
 
10
10
  [Quick start](#usage) · [API](#api) · [Components](#charts) · [Themes](#themes) · [Tests](#tests) · [Release notes](#releases)
11
11
 
@@ -72,6 +72,18 @@ The package has `"sideEffects"` for `classic.js`, `theme-boot.js` and CSS only,
72
72
 
73
73
  Without npm, serve the `src` folder with any static web server and open `index.html` to see the example.
74
74
 
75
+ ### The demo application
76
+
77
+ `demo/` is a demo and test application: tables with 100,000 rows from a server, a streaming chart, every field type, native dialogs, a menu with groups inside groups, themes
78
+ and modes, and a real sign in, served by a small Node server (no dependencies) under a strict Content-Security-Policy.
79
+
80
+ ```sh
81
+ npm run demo # http://localhost:3000
82
+ npm run test:demo # the server, the API and every page in a real browser
83
+ ```
84
+
85
+ GitHub Actions tests it and deploys it to an Azure App Service: [demo/README.md](demo/README.md) has the one-time set up.
86
+
75
87
  ## Usage
76
88
 
77
89
  ```html
@@ -135,7 +147,7 @@ It takes the options of `init()`. The header and footer follow the settings `gen
135
147
  | `header_title_text` | `"Athena UI"` | Title in the header |
136
148
  | `header_img_url` | | Header logo URL |
137
149
  | `copyright` | placeholder text | Footer text, the version is appended |
138
- | `version` | `"2.0.0"` | Version shown in the footer |
150
+ | `version` | `"2.0.1"` | Version shown in the footer |
139
151
  | `bordered` | `true` | Draw a border around the layout blocks |
140
152
  | `generateHeader`, `generateFooter` | `true` | Generate the header / footer block |
141
153
  | `generateHeadercontent`, `generateFooterContent`, `generateWrappercontent` | `true` | Generate the content of the block |
@@ -689,8 +701,8 @@ component: forms, dialogs, navigation, submenus, inputs, rich text (sanitizing,
689
701
  session, themes. Set `CHROME_PATH` if the browser is not found. `DEBUG=1` prints the browser log when the page does not report results.
690
702
 
691
703
  - **The page runs under a strict Content-Security-Policy** (`default-src 'none'; script-src 'self'; style-src 'self'`, set by `run.mjs`), and a `securitypolicyviolation` fails the test
692
- that caused it. That is the guarantee that Athena UI needs no `'unsafe-inline'`. (Three tests that hand the sanitizer hostile markup are let through for the one report Chrome
693
- makes while it parses an inline handler in an inert document.)
704
+ that caused it. That is the guarantee that Athena UI needs no `'unsafe-inline'`. (Three tests that hand the sanitizer hostile markup are let through for the reports Chrome
705
+ makes while it parses an inline handler, a style attribute or a `<style>` element in an inert document.)
694
706
  - One test feeds markup to about 40 components and checks that text from data stays text.
695
707
  - `WITH_JQUERY=1 npm run test:browser` loads jQuery from its CDN, to check that an application that still has it works too (`JQUERY_URL` for another address).
696
708
  - The unit tests also check that `docs/styling.md` is up to date, and that a TypeScript file using the library compiles against `types/` (needs `npm install` for TypeScript).
@@ -714,6 +726,8 @@ src/
714
726
  res/themes/ tokens.css, default and dark theme, appearance.css (themes and modes)
715
727
  types/ TypeScript definitions (npm run types)
716
728
  docs/ styling.md (generated), migration-2.0.md
729
+ demo/ the demo and test application (server, API, pages, end to end tests), deployed to Azure by GitHub Actions
730
+ .github/workflows/ ci.yml (tests) and demo-deploy.yml
717
731
  tests/ unit tests (Node) and browser tests (headless Chrome, strict CSP)
718
732
  ```
719
733
 
@@ -727,6 +741,16 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
727
741
 
728
742
  ## Releases
729
743
 
744
+ ### 2.0.1
745
+ #### Added:
746
+ 1. `demo/`: a demo and test application of Athena UI (tables with 100,000 rows from a server, streaming charts, forms, dialogs, menus, themes, sign in) with a dependency free Node server, and end to end tests that drive a real browser (DevTools protocol) under a strict Content-Security-Policy
747
+ 2. GitHub Actions: `ci.yml` (unit, browser and demo tests on every push and pull request) and `demo-deploy.yml` (tests, builds `demo/dist`, deploys to an Azure App Service, checks the site)
748
+ #### Fixed (found by the end to end tests of the demo):
749
+ 1. A chart that redraws (streaming `push`, zoom) no longer loses the keyboard focus: it moves to the same place in the new SVG
750
+ 2. The series a person hid with the legend stay hidden when the chart redraws (`hiddenSeries` option)
751
+ #### Changed:
752
+ 1. `package-lock.json` is part of the repository (CI uses `npm ci`)
753
+
730
754
  ### 2.0.0
731
755
  #### Breaking (see [docs/migration-2.0.md](docs/migration-2.0.md)):
732
756
  1. No default export, and nothing on `window` unless you import `athena-ui-js/classic`; `athena-ui.js` has no side effects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "athena-ui-js",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
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",
@@ -8,7 +8,10 @@
8
8
  "test": "node --test tests/*.test.js",
9
9
  "test:browser": "node tests/browser/run.mjs",
10
10
  "docs": "node scripts/styling-docs.mjs",
11
- "types": "tsc -p tsconfig.types.json"
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"
12
15
  },
13
16
  "exports": {
14
17
  ".": {
package/src/athena-ui.js CHANGED
@@ -2,7 +2,7 @@
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: 2.0.0
5
+ //Version: 2.0.1
6
6
 
7
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
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
@@ -6,7 +6,7 @@
6
6
  export const BORDERED_CLASS = "default-cointainer-bordered";
7
7
 
8
8
  export const defaults = Object.freeze({
9
- version: "2.0.0",
9
+ version: "2.0.1",
10
10
  container_class: "container",
11
11
  header_class: "header-container",
12
12
  header_menu_class: "header-menu menu",
@@ -94,7 +94,7 @@ function addLegend(svg, entries, width, height, ctx) {
94
94
  let x = MARGIN.left;
95
95
  const y = height - 12;
96
96
  entries.forEach(({ name, props, series }) => {
97
- const group = svgEl("g", { class: "chart-legend-item", tabindex: 0, role: "button", "aria-pressed": "true", "aria-label": name });
97
+ const group = svgEl("g", { class: "chart-legend-item", tabindex: 0, role: "button", "aria-pressed": "true", "aria-label": name, "data-legend": series ?? "" });
98
98
  group.append(svgEl("rect", { x, y: y - 9, width: 10, height: 10, class: `chart-swatch ${props.class ?? ""}`.trim(), ...(props.color ? { color: props.color } : {}) }));
99
99
  group.append(svgEl("text", { x: x + 14, y, class: "chart-legend" }, name));
100
100
  if (series != null) {
@@ -103,6 +103,7 @@ function addLegend(svg, entries, width, height, ctx) {
103
103
  group.setAttribute("aria-pressed", hidden ? "false" : "true");
104
104
  group.classList.toggle("is-off", hidden);
105
105
  for (const node of svg.querySelectorAll(`[data-series="${series}"]`)) node.classList.toggle("chart-hidden", hidden);
106
+ ctx.hooks?.legend?.(series, hidden);
106
107
  ctx.tooltip.hide();
107
108
  };
108
109
  group.addEventListener("click", toggle);
@@ -522,6 +523,7 @@ function buildDataTable({ labels, series, times, title, type }) {
522
523
  * `times`, otherwise the index of the point (-0.5 is the left edge of the first point)
523
524
  * @param {(range: ({from: number, to: number}|null)) => void} [options.onZoom] called when a person zooms or resets
524
525
  * @param {number} [options.maxPoints] `push` keeps at most this many points per series (the oldest are dropped)
526
+ * @param {number[]} [options.hiddenSeries] the series (or slices) that are hidden at the start; a person hides and shows them with the legend, and a redraw keeps that
525
527
  * @param {boolean} [options.interactive=true] line and area charts: false leaves out the pointer layer (tooltip that follows the pointer, zoom)
526
528
  * @returns {(SVGElement & {element: SVGElement, update: (options?: object) => SVGElement, destroy: () => void,
527
529
  * zoom: (from: number, to: number) => void, resetZoom: () => void, getZoom: () => ({from: number, to: number}|null),
@@ -536,7 +538,13 @@ export function generateChart(options = {}) {
536
538
  const state = { used: { ...options, series: (options.series ?? []).map(s => ({ ...s, data: [...(s.data ?? [])] })) }, current: null, queued: false };
537
539
  if (options.labels) state.used.labels = [...options.labels];
538
540
  if (options.times) state.used.times = [...options.times];
541
+ const hidden = new Set(options.hiddenSeries ?? []);
539
542
  const hooks = {
543
+ legend: (series, off) => {
544
+ if (off) hidden.add(series);
545
+ else hidden.delete(series);
546
+ state.used.hiddenSeries = [...hidden];
547
+ },
540
548
  zoom: range => {
541
549
  state.used = { ...state.used, zoomRange: range ?? null };
542
550
  handle.redraw();
@@ -548,12 +556,22 @@ export function generateChart(options = {}) {
548
556
  redraw() {
549
557
  const next = buildChart(state.used, hooks);
550
558
  if (!next) return state.current?.svg;
559
+ // A redraw replaces the whole SVG (every second while streaming, and when someone zooms). The keyboard focus would be lost
560
+ // with it, so it goes to the same place in the new one: the same legend entry, the same point, or the plot.
561
+ const old = state.current?.svg;
562
+ const active = old && old.contains(document.activeElement) ? document.activeElement : null;
563
+ const focusables = active ? [...old.querySelectorAll("[tabindex]")] : [];
564
+ const position = active ? focusables.indexOf(active) : -1;
551
565
  if (state.current) {
552
- state.current.svg.replaceWith(next.svg);
566
+ old.replaceWith(next.svg);
553
567
  state.current.table?.remove();
554
568
  if (next.table) next.svg.after(next.table);
555
569
  }
556
570
  state.current = next;
571
+ if (active) {
572
+ const now = [...next.svg.querySelectorAll("[tabindex]")];
573
+ (active.classList.contains("chart-hit") || active.classList.contains("chart-reset") ? next.svg.querySelector(".chart-hit") : now[position] ?? next.svg.querySelector(".chart-hit"))?.focus({ preventScroll: true });
574
+ }
557
575
  return attach(next.svg);
558
576
  },
559
577
  update(changes = {}) {
@@ -648,5 +666,11 @@ function buildChart(options = {}, hooks) {
648
666
  addLegend(svg, pieLegend ?? series.map((s, i) => ({ name: s.name ?? `${translate("series")} ${i + 1}`, props: seriesProps(s, i), series: i })), width, height, ctx);
649
667
  }
650
668
  svg.append(tooltip.group);
669
+ for (const index of options.hiddenSeries ?? []) {
670
+ for (const node of svg.querySelectorAll(`[data-series="${index}"]`)) node.classList.add("chart-hidden");
671
+ const entry = svg.querySelector(`.chart-legend-item[data-legend="${index}"]`);
672
+ entry?.setAttribute("aria-pressed", "false");
673
+ entry?.classList.add("is-off");
674
+ }
651
675
  return { svg, table: options.table ? buildDataTable({ labels, series, times, title, type }) : null };
652
676
  }
@@ -1,96 +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";
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 CHANGED
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/chartGenerator/chartGenerator.js";
1
+ export * from "./libs/hephaestus/chartGenerator/chartGenerator.js";
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/componentGenerator/componentGenerator.js";
1
+ export * from "./libs/hephaestus/componentGenerator/componentGenerator.js";
@@ -1,3 +1,3 @@
1
- export * from "./libs/core/elementGenerator.js";
2
- export * from "./libs/core/controls.js";
3
- export * from "./libs/core/hungarianControls.js";
1
+ export * from "./libs/core/elementGenerator.js";
2
+ export * from "./libs/core/controls.js";
3
+ export * from "./libs/core/hungarianControls.js";
package/types/csv.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./libs/core/csv.js";
1
+ export * from "./libs/core/csv.js";
package/types/dialog.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
2
- export * from "./libs/hephaestus/modalGenerator/modalGenerator.js";
1
+ export * from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
2
+ export * from "./libs/hephaestus/modalGenerator/modalGenerator.js";
package/types/dom.d.ts CHANGED
@@ -1 +1 @@
1
- export { el, setContent, resolveElement, asHandle, createSafeBuilder } from "./libs/core/dom.js";
1
+ export { el, setContent, resolveElement, asHandle, createSafeBuilder } from "./libs/core/dom.js";
@@ -1 +1 @@
1
- export * from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
1
+ export * from "./libs/hephaestus/feedbackGenerator/feedbackGenerator.js";
package/types/format.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./libs/core/format.js";
1
+ export * from "./libs/core/format.js";
package/types/forms.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./libs/hephaestus/formGenerator/formBuilder.js";
2
- export * from "./libs/hephaestus/formGenerator/authForms.js";
1
+ export * from "./libs/hephaestus/formGenerator/formBuilder.js";
2
+ export * from "./libs/hephaestus/formGenerator/authForms.js";
package/types/i18n.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./libs/core/i18n.js";
1
+ export * from "./libs/core/i18n.js";
package/types/inputs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./libs/hephaestus/inputGenerator/inputGenerator.js";
2
- export * from "./libs/hephaestus/inputGenerator/dropZoneGenerator.js";
3
- export * from "./libs/hephaestus/inputGenerator/richTextGenerator.js";
4
- export * from "./libs/core/dateRange.js";
1
+ export * from "./libs/hephaestus/inputGenerator/inputGenerator.js";
2
+ export * from "./libs/hephaestus/inputGenerator/dropZoneGenerator.js";
3
+ export * from "./libs/hephaestus/inputGenerator/richTextGenerator.js";
4
+ export * from "./libs/core/dateRange.js";
@@ -1,5 +1,5 @@
1
1
  export function applyConfig(...sources: any[]): {
2
- version: "2.0.0";
2
+ version: "2.0.1";
3
3
  container_class: "container";
4
4
  header_class: "header-container";
5
5
  header_menu_class: "header-menu menu";
@@ -32,7 +32,7 @@ export function applyConfig(...sources: any[]): {
32
32
  export function withBorder(className: any): any;
33
33
  export const BORDERED_CLASS: "default-cointainer-bordered";
34
34
  export const defaults: Readonly<{
35
- version: "2.0.0";
35
+ version: "2.0.1";
36
36
  container_class: "container";
37
37
  header_class: "header-container";
38
38
  header_menu_class: "header-menu menu";
@@ -64,7 +64,7 @@ export const defaults: Readonly<{
64
64
  }>;
65
65
  export default config;
66
66
  declare namespace config {
67
- let version: "2.0.0";
67
+ let version: "2.0.1";
68
68
  let container_class: "container";
69
69
  let header_class: "header-container";
70
70
  let header_menu_class: "header-menu menu";
@@ -1,8 +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;
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;
@@ -1,10 +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
- };
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
+ };
@@ -1,28 +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
- }
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
+ }
@@ -1,27 +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;
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;