athena-ui-js 1.3.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.
Files changed (124) hide show
  1. package/README.md +100 -54
  2. package/docs/migration-2.0.md +83 -0
  3. package/docs/styling.md +86 -0
  4. package/package.json +108 -25
  5. package/src/athena-ui.js +54 -97
  6. package/src/chart.js +6 -0
  7. package/src/classic.js +11 -0
  8. package/src/components.js +6 -0
  9. package/src/controls.js +8 -0
  10. package/src/csv.js +6 -0
  11. package/src/dialog.js +7 -0
  12. package/src/dom.js +6 -0
  13. package/src/feedback.js +6 -0
  14. package/src/format.js +6 -0
  15. package/src/forms.js +7 -0
  16. package/src/i18n.js +6 -0
  17. package/src/inputs.js +9 -0
  18. package/src/libs/config/config.js +1 -9
  19. package/src/libs/core/controls.js +6 -14
  20. package/src/libs/core/cookies.js +55 -0
  21. package/src/libs/core/i18n.js +40 -6
  22. package/src/libs/core/validation.js +2 -2
  23. package/src/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.js +9 -1
  24. package/src/libs/hephaestus/MenuGenerator/menuGenerator.js +16 -4
  25. package/src/libs/hephaestus/auth/session.js +1 -1
  26. package/src/libs/hephaestus/dialogGenerator/dialogGenerator.js +25 -17
  27. package/src/libs/hephaestus/formGenerator/changePasswordFormGenerator.js +4 -4
  28. package/src/libs/hephaestus/formGenerator/formUtils.js +0 -4
  29. package/src/libs/hephaestus/formGenerator/loginFormGenerator.js +2 -3
  30. package/src/libs/hephaestus/formGenerator/registrationFormGenerator.js +3 -3
  31. package/src/libs/hephaestus/hephaestus.js +0 -10
  32. package/src/libs/hephaestus/inputGenerator/dropZoneGenerator.js +1 -1
  33. package/src/libs/hephaestus/modalGenerator/modalGenerator.js +13 -6
  34. package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +20 -24
  35. package/src/menu.js +6 -0
  36. package/src/navigation.js +6 -0
  37. package/src/res/themes/default/style.css +97 -100
  38. package/src/res/themes/tokens.css +96 -0
  39. package/src/router.js +6 -0
  40. package/src/sanitize.js +6 -0
  41. package/src/session.js +8 -0
  42. package/src/table.js +6 -0
  43. package/src/testing.js +11 -1
  44. package/src/theme.js +7 -0
  45. package/src/validation.js +6 -0
  46. package/types/athena-ui.d.ts +96 -0
  47. package/types/chart.d.ts +1 -0
  48. package/types/classic.d.ts +1 -0
  49. package/types/components.d.ts +1 -0
  50. package/types/controls.d.ts +3 -0
  51. package/types/csv.d.ts +1 -0
  52. package/types/dialog.d.ts +2 -0
  53. package/types/dom.d.ts +1 -0
  54. package/types/feedback.d.ts +1 -0
  55. package/types/format.d.ts +1 -0
  56. package/types/forms.d.ts +2 -0
  57. package/types/i18n.d.ts +1 -0
  58. package/types/inputs.d.ts +4 -0
  59. package/types/libs/config/config.d.ts +96 -0
  60. package/types/libs/config/hooks.d.ts +8 -0
  61. package/types/libs/core/combobox.d.ts +10 -0
  62. package/types/libs/core/controls.d.ts +28 -0
  63. package/types/libs/core/cookies.d.ts +27 -0
  64. package/types/libs/core/csv.d.ts +12 -0
  65. package/types/libs/core/dateRange.d.ts +72 -0
  66. package/types/libs/core/dom.d.ts +65 -0
  67. package/types/libs/core/elementGenerator.d.ts +30 -0
  68. package/types/libs/core/errors.d.ts +29 -0
  69. package/types/libs/core/focus.d.ts +6 -0
  70. package/types/libs/core/format.d.ts +21 -0
  71. package/types/libs/core/hungarianControls.d.ts +2 -0
  72. package/types/libs/core/i18n.d.ts +17 -0
  73. package/types/libs/core/pagination.d.ts +5 -0
  74. package/types/libs/core/sanitize.d.ts +6 -0
  75. package/types/libs/core/tableMath.d.ts +26 -0
  76. package/types/libs/core/theme.d.ts +39 -0
  77. package/types/libs/core/validation.d.ts +56 -0
  78. package/types/libs/hephaestus/LayoutGenerator/basicLayoutGenerator.d.ts +10 -0
  79. package/types/libs/hephaestus/LayoutGenerator/footerContentGenerator.d.ts +4 -0
  80. package/types/libs/hephaestus/LayoutGenerator/headerContentGenerator.d.ts +20 -0
  81. package/types/libs/hephaestus/LayoutGenerator/wrapperContentGenerator.d.ts +1 -0
  82. package/types/libs/hephaestus/MenuGenerator/basicMenuGenerator.d.ts +14 -0
  83. package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +65 -0
  84. package/types/libs/hephaestus/auth/authState.d.ts +26 -0
  85. package/types/libs/hephaestus/auth/session.d.ts +26 -0
  86. package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +91 -0
  87. package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +222 -0
  88. package/types/libs/hephaestus/componentGenerator/themePicker.d.ts +24 -0
  89. package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +120 -0
  90. package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +86 -0
  91. package/types/libs/hephaestus/formGenerator/authForms.d.ts +122 -0
  92. package/types/libs/hephaestus/formGenerator/changePasswordFormGenerator.d.ts +6 -0
  93. package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +113 -0
  94. package/types/libs/hephaestus/formGenerator/formUtils.d.ts +8 -0
  95. package/types/libs/hephaestus/formGenerator/loginFormGenerator.d.ts +11 -0
  96. package/types/libs/hephaestus/formGenerator/lostPasswordFormGenerator.d.ts +4 -0
  97. package/types/libs/hephaestus/formGenerator/registrationFormGenerator.d.ts +7 -0
  98. package/types/libs/hephaestus/hephaestus.d.ts +3 -0
  99. package/types/libs/hephaestus/inputGenerator/dropZoneGenerator.d.ts +48 -0
  100. package/types/libs/hephaestus/inputGenerator/inputGenerator.d.ts +185 -0
  101. package/types/libs/hephaestus/inputGenerator/richTextGenerator.d.ts +49 -0
  102. package/types/libs/hephaestus/modalGenerator/modalGenerator.d.ts +2 -0
  103. package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +150 -0
  104. package/types/libs/hephaestus/router/matchRoute.d.ts +12 -0
  105. package/types/libs/hephaestus/router/router.d.ts +67 -0
  106. package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +120 -0
  107. package/types/menu.d.ts +1 -0
  108. package/types/navigation.d.ts +1 -0
  109. package/types/res/themes/themes.d.ts +7 -0
  110. package/types/router.d.ts +1 -0
  111. package/types/sanitize.d.ts +1 -0
  112. package/types/session.d.ts +3 -0
  113. package/types/table.d.ts +1 -0
  114. package/types/testing.d.ts +27 -0
  115. package/types/theme-boot.d.ts +0 -0
  116. package/types/theme.d.ts +2 -0
  117. package/types/validation.d.ts +1 -0
  118. package/src/libs/crypto-js/LICENSE +0 -24
  119. package/src/libs/crypto-js/crypto-js.js +0 -6657
  120. package/src/libs/js-cookie/LICENSE +0 -21
  121. package/src/libs/js-cookie/src/api.mjs +0 -103
  122. package/src/libs/js-cookie/src/assign.mjs +0 -10
  123. package/src/libs/js-cookie/src/converter.mjs +0 -14
  124. package/src/libs/libs.js +0 -13
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));
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";
@@ -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";
@@ -0,0 +1,3 @@
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 ADDED
@@ -0,0 +1 @@
1
+ export * from "./libs/core/csv.js";
@@ -0,0 +1,2 @@
1
+ export * from "./libs/hephaestus/dialogGenerator/dialogGenerator.js";
2
+ export * from "./libs/hephaestus/modalGenerator/modalGenerator.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";
@@ -0,0 +1,2 @@
1
+ export * from "./libs/hephaestus/formGenerator/formBuilder.js";
2
+ export * from "./libs/hephaestus/formGenerator/authForms.js";
@@ -0,0 +1 @@
1
+ export * from "./libs/core/i18n.js";
@@ -0,0 +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";
@@ -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
+ }[];
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Creates an element. This is the safe way to write pages: text is only ever inserted as text, attributes that run code
3
+ * (on*, style, srcdoc) and unsafe addresses (javascript:, data:, ...) in href / src / action are refused, listeners have to be
4
+ * functions, and children can be given as nested lists.
5
+ *
6
+ * @param {string} tag
7
+ * @param {object} [props]
8
+ * @param {string} [props.class]
9
+ * @param {string} [props.id]
10
+ * @param {string} [props.text] set as textContent (never parsed as HTML)
11
+ * @param {Object<string, string|boolean|number>} [props.attrs] attributes, false / null / undefined are skipped
12
+ * @param {Object<string, Function>} [props.on] event listeners (a value that is not a function throws a TypeError)
13
+ * @param {Object<string, *>} [props.prop] DOM properties (value, checked, disabled, ...), not the ones that parse HTML
14
+ * @param {...(Node|string|number|Array|null|false)} children text, nodes, or lists of them
15
+ */
16
+ export function el(tag: string, props?: {
17
+ class?: string;
18
+ id?: string;
19
+ text?: string;
20
+ attrs?: {
21
+ [x: string]: string | boolean | number;
22
+ };
23
+ on?: {
24
+ [x: string]: Function;
25
+ };
26
+ prop?: {
27
+ [x: string]: any;
28
+ };
29
+ }, ...children: (Node | string | number | any[] | null | false)[]): HTMLElement;
30
+ /**
31
+ * Fills a node with content. Strings are inserted as text, never as HTML.
32
+ * Accepts a string / number, a Node, an array of those, or a function returning one.
33
+ */
34
+ export function setContent(node: any, content: any): any;
35
+ /**
36
+ * Finds an element from an element, an id or a CSS selector ("#list", ".panel > ul").
37
+ * An id wins over a selector with the same text. Returns null when nothing matches.
38
+ */
39
+ export function resolveElement(target: any): Element;
40
+ export function mount(parent: any, node: any): any;
41
+ /**
42
+ * Gives a component the same handle as every other one: { element, update(), destroy() }.
43
+ * What the component already has is kept. `update` does nothing unless the component supports it
44
+ * (it returns the handle), `destroy` removes the element (and `also`, e.g. a wrapper around it).
45
+ */
46
+ export function asHandle(handle: any, { element, also }?: {
47
+ element?: any;
48
+ }): any;
49
+ /**
50
+ * A stricter el(): only the tags and attributes on your lists are allowed, everything else is refused (a tag throws, an attribute is
51
+ * skipped with a warning). For pages that are built from data you do not control, such as a plugin API. The refusals of el() still apply.
52
+ *
53
+ * @param {object} allow
54
+ * @param {string[]} [allow.tags] allowed tag names (default: any)
55
+ * @param {string[]} allow.attributes allowed attribute names, lower case: ["class", "title", "href"]
56
+ * @param {boolean} [allow.dataAndAria=true] data-* and aria-* attributes are allowed too
57
+ * @returns {typeof el}
58
+ */
59
+ export function createSafeBuilder({ tags, attributes, dataAndAria }?: {
60
+ tags?: string[];
61
+ attributes: string[];
62
+ dataAndAria?: boolean;
63
+ }): typeof el;
64
+ export function uid(prefix?: string): string;
65
+ export function cx(...classes: any[]): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Generates an HTML element and appends it to its parent.
3
+ *
4
+ * @param {object} options
5
+ * @param {string} options.elementType one of `supportedElements`
6
+ * @param {string} [options.parent] id of the parent element; omitted or '' appends to body
7
+ * @param {string} [options.id]
8
+ * @param {string} [options.class]
9
+ * @param {string} [options.text]
10
+ * @param {string} [options.src] img only
11
+ * @param {string} [options.alt] img only
12
+ * @param {*} [options.data] passed to the onclick / onchange handlers
13
+ * @param {(data: *) => void} [options.onclick]
14
+ * @param {(data: *) => void} [options.onchange]
15
+ * @returns {HTMLElement|null} the generated element, or null when generation failed
16
+ */
17
+ export function HTMLElementGenerator(options: {
18
+ elementType: string;
19
+ parent?: string;
20
+ id?: string;
21
+ class?: string;
22
+ text?: string;
23
+ src?: string;
24
+ alt?: string;
25
+ data?: any;
26
+ onclick?: (data: any) => void;
27
+ onchange?: (data: any) => void;
28
+ }): HTMLElement | null;
29
+ export const supportedElements: readonly string[];
30
+ export default HTMLElementGenerator;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Logs the error and, when the page has a body, shows a short message in it.
3
+ * Always returns null so callers can `return reportError(...)`.
4
+ */
5
+ export function reportError(error: any): any;
6
+ export const ErrorCode: Readonly<{
7
+ UNDEFINED: 0;
8
+ WRONG_INPUT_TYPE: 1;
9
+ NO_BODY_OR_PARENT: 2;
10
+ }>;
11
+ export function undefinedError(variable: any, functionName: any): {
12
+ errorCode: 0;
13
+ errorString: string;
14
+ errorVariable: any;
15
+ errorFunction: any;
16
+ };
17
+ export function wrongInputTypeError(variable: any, functionName: any, inputOptions: any): {
18
+ errorCode: 1;
19
+ errorString: string;
20
+ errorVariable: any;
21
+ errorFunction: any;
22
+ errorMiscInfo: any;
23
+ };
24
+ export function noBodyOrParentError(variable: any, functionName: any): {
25
+ errorCode: 2;
26
+ errorString: string;
27
+ errorVariable: any;
28
+ errorFunction: any;
29
+ };
@@ -0,0 +1,6 @@
1
+ export function focusableIn(container: any): any[];
2
+ /**
3
+ * Keeps Tab inside the container, calls onEscape on Esc and moves the focus into the container.
4
+ * Returns a release function that restores the previous focus.
5
+ */
6
+ export function trapFocus(container: any, { onEscape }?: {}): () => void;
@@ -0,0 +1,21 @@
1
+ export function formatBytes(bytes: any): string;
2
+ /**
3
+ * Checks a file against an `accept` list like ".png,image/*,application/pdf". An empty list accepts everything.
4
+ */
5
+ export function matchesAccept(file: any, accept: any): boolean;
6
+ /** 1234567.891 -> "1,234,567.89" (the separators of the current language). */
7
+ export function formatNumber(value: any, options?: {}): string;
8
+ /**
9
+ * A length of time in milliseconds as short text: 350 -> "350 ms", 45000 -> "45 sec", 7500000 -> "2 hr, 5 min".
10
+ * At most `parts` units are shown (default 2). The unit names follow the current language.
11
+ */
12
+ export function formatDuration(ms: any, { parts }?: {
13
+ parts?: number;
14
+ }): string;
15
+ /** "2 min ago", "in 3 days", "yesterday": the time between `date` and `now`, in the current language. */
16
+ export function formatRelativeTime(date: any, now?: number): string;
17
+ /** A date (and time) for people: formatDate(d) -> "Nov 19, 2026"; formatDate(d, { time: true }) adds the time. */
18
+ export function formatDate(date: any, { time, style }?: {
19
+ time?: boolean;
20
+ style?: string;
21
+ }): string;
@@ -0,0 +1,2 @@
1
+ /** Adds the input types hunPIN, hunCRID and hunTID (Hungarian personal insurance, company registration and tax numbers, in segments). */
2
+ export function registerHungarianInputControls(): void;
@@ -0,0 +1,17 @@
1
+ export function setLocale(newLocale: any): void;
2
+ export function getLocale(): string;
3
+ export function addMessages(forLocale: any, texts: any): void;
4
+ /**
5
+ * Looks a text up in the current locale, then in its base language ("hu-HU" -> "hu"), then in English.
6
+ * Unknown keys are returned as they are.
7
+ *
8
+ * Placeholders: {name} is replaced from params as it is, {name:number} is formatted as a number and {name:date} as a date, in the current language (Intl).
9
+ * Plural forms: a message can be an object with the forms of the language, and the form is chosen by `params.count`:
10
+ *
11
+ * addMessages("en", { files: { zero: "No files", one: "{count} file", other: "{count:number} files" } });
12
+ * translate("files", { count: 1200 }) // "1,200 files"
13
+ *
14
+ * The keys are the categories of Intl.PluralRules for the language ("one", "other", and where the language has them "zero", "two", "few", "many"),
15
+ * or an exact number ("0"). "other" is the fallback.
16
+ */
17
+ export function translate(key: any, params?: {}): any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Page buttons to show: first and last page, the current page with its neighbours, "…" for the gaps.
3
+ * pageRange(5, 10, 1) -> [1, "…", 4, 5, 6, "…", 10]
4
+ */
5
+ export function pageRange(page: any, pages: any, siblings?: number): any[];
@@ -0,0 +1,6 @@
1
+ /** True for http(s), mailto, tel, anchors and relative paths. Rejects javascript:, data:, vbscript: and the like. */
2
+ export function isSafeUrl(url: any): boolean;
3
+ /** Cleans HTML from the editor, the clipboard or the application. Returns the safe HTML string. */
4
+ export function sanitizeHtml(html: any): string;
5
+ /** The text of an HTML string, without tags. */
6
+ export function htmlToText(html: any): string;