athena-ui-js 2.5.1 → 2.6.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 +36 -2
- package/docs/migration-2.0.md +99 -83
- package/docs/styling.md +124 -123
- package/package.json +5 -1
- package/src/app.js +85 -0
- package/src/athena-ui.js +4 -79
- package/src/libs/config/config.js +1 -1
- package/src/libs/core/i18n.js +354 -352
- package/src/libs/hephaestus/MenuGenerator/menuGenerator.js +278 -265
- package/src/libs/hephaestus/chartGenerator/chartGenerator.js +772 -722
- package/src/libs/hephaestus/feedbackGenerator/feedbackGenerator.js +171 -161
- package/src/libs/hephaestus/formGenerator/formBuilder.js +473 -460
- package/src/libs/hephaestus/tableGenerator/tableGenerator.js +837 -825
- package/src/res/themes/default/style.css +3128 -3037
- package/types/app.d.ts +58 -0
- package/types/athena-ui.d.ts +1 -55
- package/types/libs/config/config.d.ts +96 -96
- package/types/libs/hephaestus/MenuGenerator/menuGenerator.d.ts +5 -0
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +123 -117
- package/types/libs/hephaestus/dialogGenerator/dialogGenerator.d.ts +122 -122
- package/types/libs/hephaestus/feedbackGenerator/feedbackGenerator.d.ts +3 -0
- package/types/libs/hephaestus/formGenerator/authForms.d.ts +130 -130
- package/types/libs/hephaestus/formGenerator/formBuilder.d.ts +128 -128
- package/types/libs/hephaestus/tableGenerator/tableGenerator.d.ts +133 -129
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.
|
|
8
|
+
Current version: **2.6.1**
|
|
9
9
|
|
|
10
10
|
[Quick start](#usage) · [API](#api) · [Components](#charts) · [Themes](#themes) · [Tests](#tests) · [Release notes](#releases)
|
|
11
11
|
|
|
@@ -129,6 +129,9 @@ app.destroy();
|
|
|
129
129
|
|
|
130
130
|
It takes the options of `init()`. The header and footer follow the settings `generateHeader` and `generateFooter`. The parts have fixed ids, so use one app per page.
|
|
131
131
|
|
|
132
|
+
`init`, `createApp`, `setTheme`, `config` and `loadScript` are also in a small entry of their own: `import { init } from "athena-ui-js/app"` loads the layout and the theme and none of the components
|
|
133
|
+
(the root file `athena-ui-js` loads every module), so a page that picks its components from the other entry points downloads only those.
|
|
134
|
+
|
|
132
135
|
### init options
|
|
133
136
|
|
|
134
137
|
| Option | Description |
|
|
@@ -149,7 +152,7 @@ It takes the options of `init()`. The header and footer follow the settings `gen
|
|
|
149
152
|
| `header_title_text` | `"Athena UI"` | Title in the header |
|
|
150
153
|
| `header_img_url` | | Header logo URL |
|
|
151
154
|
| `copyright` | placeholder text | Footer text, the version is appended |
|
|
152
|
-
| `version` | `"2.
|
|
155
|
+
| `version` | `"2.6.0"` | Version shown in the footer |
|
|
153
156
|
| `bordered` | `true` | Draw a border around the layout blocks |
|
|
154
157
|
| `generateHeader`, `generateFooter` | `true` | Generate the header / footer block |
|
|
155
158
|
| `generateHeadercontent`, `generateFooterContent`, `generateWrappercontent` | `true` | Generate the content of the block |
|
|
@@ -239,6 +242,12 @@ Other options: `id`, `width` (600), `height` (360), `legend`, `zero: false` (a l
|
|
|
239
242
|
- **Tooltips** show on hover and on keyboard focus (every point and bar is focusable and named). In a long line chart the tooltip follows the pointer.
|
|
240
243
|
- **Legend**: click (or Enter / Space) on an entry hides and shows that series.
|
|
241
244
|
- **Time axis**: `times: [Date | ms | "2026-11-19T10:00"]` (line and area). Ticks fall on round times, points sit at their real distance.
|
|
245
|
+
`timeFormat` writes the time in the tooltips and in the table of values: a function of the time in ms, or the options of `Intl.DateTimeFormat`
|
|
246
|
+
(`{ hour: "2-digit", minute: "2-digit" }`; the default is the long form, "Nov 19, 2026, 6:15:09 PM", which wraps in a narrow table).
|
|
247
|
+
- **Dots**: `points: false` never draws the dots, however few the points are (a half-filled window of 12 minutes then looks like a full one of 15); the tooltip still follows the pointer
|
|
248
|
+
and the keyboard. A point on its own after a gap (`gaps: true`) has a tooltip of its own.
|
|
249
|
+
- **Reading with the keyboard**: focus the plot (Tab); Left and Right move the tooltip from point to point, Home and End go to the first and the last point, Esc hides it.
|
|
250
|
+
With `zoom: true` the arrows pan, so Alt + arrow reads.
|
|
242
251
|
- **Zoom** (`zoom: true`, line and area): drag over the plot, double click or the reset button zoom out. On the plot, + and - zoom, the arrow keys pan,
|
|
243
252
|
0 resets. `chart.zoom(from, to)`, `chart.resetZoom()`, `chart.getZoom()`, `onZoom(range)` and `zoomRange` (ms with `times`, otherwise the point index).
|
|
244
253
|
- **Long series** are thinned to the width of the plot (the lowest and the highest value of every slice stay, so peaks are not lost), and dots are only drawn up to 80 points in view.
|
|
@@ -269,6 +278,8 @@ Click a header to sort (disable with `sortable: false`, or per column). Other op
|
|
|
269
278
|
- `virtual: { height: 400, rowHeight: 36, overscan: 5 }` (or `virtual: true`) renders only the rows in view and keeps the scroll bar the size of the whole list, so 10 000+ rows stay fast. Rows have a fixed height (the theme enforces it, one line per cell), the table scrolls inside `height` and its header stays visible. It replaces pagination; filtering, sorting, selection, editing and CSV export work as usual.
|
|
270
279
|
- Hooks and looks: `cellClass(row, column)` and `rowClass(row)` return a class name (or a list) for a cell or a row. `focusableRows: true` makes rows reachable with Tab (`rowLabel(row)` is their aria-label); together with `onRowClick` they open with Enter and Space. `density: "compact"`, and `wrap: true | false` (long text wraps, or stays on one line with an ellipsis). The pager is hidden when there is only one page.
|
|
271
280
|
- Column extras: `render(row, value)` returns text or a Node (built by you, so it is safe by construction), `align: "left" | "center" | "right"`. Text longer than 24 characters gets its full text as a tooltip (`title: false` switches it off).
|
|
281
|
+
- **Narrow screens**: `stack: true` (or a number: the width in px) shows every row as a block, with the label of the column (`data-label`) next to each value, while the table is narrower
|
|
282
|
+
than 600 px. It follows the width of the table, not of the screen (a table in a narrow sidebar stacks on a wide screen), and the table gets the class `is-stacked`. Not for virtual tables.
|
|
272
283
|
- A virtual table that starts empty draws a full window as soon as it gets rows, and measures again when the scroll area changes size.
|
|
273
284
|
- **Rows from a server**: `dataSource: async ({ page, pageSize, cursor, sort, filter }) => ({ rows, total })`. Sorting, the (debounced) filter box and the pager ask it again,
|
|
274
285
|
a slow request shows a loading state, a failed one an error with a Retry button, and an answer that comes too late is ignored. Answer with `total` for numbered pages
|
|
@@ -307,6 +318,9 @@ Rules (`required`, `email`, `minLength`, `maxLength`, `pattern`, `min`, `max`, `
|
|
|
307
318
|
given on the field or in `rules`. A field is validated when it loses focus, then on every change. A rejected
|
|
308
319
|
`onSubmit` promise is shown as form message and the submit button shows a spinner while it runs.
|
|
309
320
|
|
|
321
|
+
A field can have `label: values => text` (the caption follows the other fields, and exists even when the function answers nothing at first). With `nested: true` a field called `soa.host` is
|
|
322
|
+
`values.soa.host`, and `setValues({ soa: { host: "ns1" } })` fills it (so does `setValues({ "soa.host": "ns1" })`).
|
|
323
|
+
|
|
310
324
|
The returned form has `getValues()`, `setValues()`, `setErrors({ name: "Taken" })` (server side errors),
|
|
311
325
|
`validate()`, `reset()`, `setMessage(text)`, `fields` and `submitButton`. `generateField(options)` builds a single field.
|
|
312
326
|
|
|
@@ -317,6 +331,7 @@ The returned form has `getValues()`, `setValues()`, `setErrors({ name: "Taken" }
|
|
|
317
331
|
|
|
318
332
|
```js
|
|
319
333
|
showToast({ title: "Saved", message: "All good", type: "success", duration: 4000 }); // info | success | warning | error
|
|
334
|
+
showToast({ message: "Zone added", position: "bottom-right", offset: { y: 24 } }); // top-right (default), top-left, top-center, bottom-right, bottom-left, bottom-center
|
|
320
335
|
generateAlert({ parent: "wrapper", type: "error", message: "Failed", dismissible: true });
|
|
321
336
|
generateSpinner({ parent: "wrapper", size: "large" });
|
|
322
337
|
const progress = generateProgress({ parent: "wrapper", label: "Upload", value: 20 }); // no value: indeterminate
|
|
@@ -424,6 +439,9 @@ menu.setBadge("inbox", { text: 12, tone: "bad" }); // a count, text, or { text
|
|
|
424
439
|
Groups nest to any depth: ArrowDown / ArrowUp open the first level, ArrowRight opens a deeper group and ArrowLeft closes it, Esc closes the innermost group
|
|
425
440
|
first, Home / End jump, a click outside closes everything. A badge above 99 shows "99+". `generateHeaderMenu({ items, onNavigate })` puts the same menu into the header.
|
|
426
441
|
|
|
442
|
+
On a coloured header set `--athena-menu-bg`, `--athena-menu-fg`, `--athena-menu-hover` and `--athena-menu-active` (the line under the active item) on the menu or a parent; without them the bar is
|
|
443
|
+
transparent as before. `layout: "responsive"` switches to tabs at the bottom up to `breakpoint` px (default 700), and gives the menu the class `is-tabs` while they show.
|
|
444
|
+
|
|
427
445
|
### Router
|
|
428
446
|
|
|
429
447
|
```js
|
|
@@ -834,6 +852,7 @@ session, themes. Set `CHROME_PATH` if the browser is not found. `DEBUG=1` prints
|
|
|
834
852
|
```
|
|
835
853
|
src/
|
|
836
854
|
athena-ui.js the whole API as ES module exports (no side effects)
|
|
855
|
+
app.js init, createApp, setTheme: the start of a page without the components
|
|
837
856
|
classic.js opt-in: the whole API on window, for classic scripts
|
|
838
857
|
table.js, dialog.js, ... one entry point per component (athena-ui-js/table, athena-ui-js/dialog, ...)
|
|
839
858
|
theme-boot.js classic script that sets the saved theme and mode before the page is drawn
|
|
@@ -863,6 +882,21 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
863
882
|
|
|
864
883
|
## Releases
|
|
865
884
|
|
|
885
|
+
### 2.6.1
|
|
886
|
+
#### Fixed:
|
|
887
|
+
1. **A form reported one keystroke in an autocomplete twice**: the combobox announces every change of its value itself (as a `change` event), and the form listened to `input` as well, so `onChange` of the field and of the form ran twice for each typed character. They run once now, and typing in a multiselect (a search, not a change of the value) reports nothing; choosing and removing a chip still report once. The page of an application that asked a server on every change asked it twice (found by the metrics page of Heimdall)
|
|
888
|
+
|
|
889
|
+
### 2.6.0
|
|
890
|
+
(what moving Odin NS Manager onto Athena UI 2.x showed was missing)
|
|
891
|
+
#### Added:
|
|
892
|
+
1. Forms: a field whose `label` is a function always gets its caption (it was missing when the function answered nothing for the empty form); `setValues()` takes the nested shape (`{ soa: { host } }`) with `nested`, and arranges the fields that follow the values
|
|
893
|
+
2. Charts: `timeFormat` (a function or the options of `Intl.DateTimeFormat`) for the time in tooltips and in the table of values; `points: false`; a tooltip for a point on its own after a gap; the arrow keys, Home, End and Esc read a line chart point by point (Alt + arrow with `zoom`)
|
|
894
|
+
3. Tables: `stack` shows a narrow table as blocks with the label of the column next to every value
|
|
895
|
+
4. Menu: the tokens `--athena-menu-bg`, `-fg`, `-hover` and `-active` for a menu on a coloured header, and the `breakpoint` option of the responsive layout (the layout is switched by the class `is-tabs` now, not by a media query of the stylesheet)
|
|
896
|
+
5. Toasts: `position` (six places) and `offset`; the stack of toasts lets clicks through to the page under it
|
|
897
|
+
6. `athena-ui-js/app`: `init`, `createApp`, `setTheme`, `config` and `loadScript` without the components (23 files are loaded instead of 59)
|
|
898
|
+
7. `docs/migration-2.0.md` has the lessons of Odin (section 8)
|
|
899
|
+
|
|
866
900
|
### 2.5.1
|
|
867
901
|
#### Changed:
|
|
868
902
|
1. The `files` list of package.json is `src` (with `example.js` and `index.html` left out) instead of a list of folders: a new folder under `src` can no longer be forgotten, which is what broke 2.3.0 and 2.4.0. The package holds exactly the same files as 2.5.0
|
package/docs/migration-2.0.md
CHANGED
|
@@ -1,83 +1,99 @@
|
|
|
1
|
-
# Moving from Athena UI 1.x to 2.0
|
|
2
|
-
|
|
3
|
-
2.0 is lighter and has no side effects: no jQuery, no globals, no libraries loaded at run time, and everything is in a cascade layer. Most of what you call
|
|
4
|
-
(`generateTable`, `showDialog`, `createRouter`, ...) is the same. This is the list of what is not, in the order you will probably meet it.
|
|
5
|
-
|
|
6
|
-
## 1. Imports: no default export, no globals
|
|
7
|
-
|
|
8
|
-
`athena-ui.js` is plain ES module exports now. Importing it does not touch the page, and nothing is put on `window`.
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
// 1.x
|
|
12
|
-
import AthenaUI, { init } from "athena-ui-js"; // the default export is gone
|
|
13
|
-
window.generateTable(...) // the globals are gone
|
|
14
|
-
|
|
15
|
-
// 2.0
|
|
16
|
-
import { init, generateTable } from "athena-ui-js";
|
|
17
|
-
import { generateTable } from "athena-ui-js/table"; // or only what you use, so the rest is never downloaded
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Entry points: `table`, `chart`, `dialog`, `menu`, `navigation`, `forms`, `feedback`, `components`, `inputs`, `router`, `session`, `theme`, `i18n`, `format`,
|
|
21
|
-
`validation`, `sanitize`, `csv`, `dom`, `controls`. Deep imports of files under `src/libs` are not part of the package interface (the `exports` map closes them).
|
|
22
|
-
|
|
23
|
-
**A page that needs the globals** (inline handlers, classic scripts, the `customLoader`) opts in with one line:
|
|
24
|
-
|
|
25
|
-
```html
|
|
26
|
-
<script type="module" src="node_modules/athena-ui-js/src/classic.js"></script> <!-- window.generateTable, window.AthenaUI, ... -->
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## 2. jQuery is gone
|
|
30
|
-
|
|
31
|
-
Athena UI has no jQuery code, and `jquery` is not a peer dependency any more. The one place where a jQuery object came back to you,
|
|
32
|
-
`HTMLControlGenerator.create(options)`, returns the element now: use `$(HTMLControlGenerator.create(options))` if you still want a jQuery object.
|
|
33
|
-
`HTMLControlGenerator.register(type, factory)`: the factory returns an element.
|
|
34
|
-
|
|
35
|
-
## 3. crypto-js and js-cookie are gone
|
|
36
|
-
|
|
37
|
-
- **`enable_encrypt_password` is removed.** The login, registration and change password forms return the password as it was typed. Send it over HTTPS and hash
|
|
38
|
-
it on the server (argon2, scrypt, bcrypt). Hashing it in the browser only turns the hash into the password. If your server expects a SHA-256 hash, change
|
|
39
|
-
the server, or hash in your own `login` callback with `crypto.subtle.digest("SHA-256", ...)`.
|
|
40
|
-
- **`Cookies`** is a small helper of our own with `get`, `set` and `remove` (days or a `Date` for `expires`, `path`, `domain`, `sameSite`, `secure`).
|
|
41
|
-
What js-cookie had beyond that (`getJSON`, `withAttributes`, converters) is not there.
|
|
42
|
-
- No script is loaded at run time any more (`libs.js` and `loadLibs` are removed). `customLoader` (your own classic script) still works.
|
|
43
|
-
|
|
44
|
-
## 4. HTMLElementGenerator and HTMLControlGenerator
|
|
45
|
-
|
|
46
|
-
They are part of Athena UI (`athena-ui-js/controls`) and no longer git submodules. The calls are the same; with the classic build they are globals again.
|
|
47
|
-
|
|
48
|
-
## 5. Dialogs and the accordion use native elements
|
|
49
|
-
|
|
50
|
-
- `showDialog` (and `confirmDialog`, `promptDialog`, `showConfirm`, `showFormDialog`) opens a real `<dialog>` with `showModal()`. The browser traps the focus, closes
|
|
51
|
-
it with Esc, draws the backdrop and puts it in the top layer. In your CSS, `.dialog-backdrop` and `.modal-content` are gone from these dialogs: style
|
|
52
|
-
`dialog.dialog`, `dialog.dialog::backdrop` and `.dialog-inner`. `handle.backdrop` is the dialog element too. In a test (jsdom) use `installDom` from
|
|
53
|
-
`athena-ui-js/testing`, which gives jsdom `showModal()`; a synthetic Esc key does not close a native dialog, send the `cancel` event instead.
|
|
54
|
-
- `generateAccordion` is `<details>` and `<summary>`: `.accordion-header` is a `<summary>`, there is no `aria-expanded` on a button, `.accordion-open` is the
|
|
55
|
-
`[open]` attribute and `.accordion-title` is gone. `accordion.toggle(index, open)` works as before.
|
|
56
|
-
- The dropdown and the tooltip became native popovers in 2.1 (see the release notes): the menu is `<div class="dropdown-menu" popover>` (no `hidden` attribute any more: use `:popover-open`), and the tooltip text is a `popover="manual"` element.
|
|
57
|
-
|
|
58
|
-
## 6. CSS: a layer, tokens and dark mode
|
|
59
|
-
|
|
60
|
-
- All rules of the default theme are in the cascade layer `athena`, so a plain rule of your application wins without a more specific selector. If you used
|
|
61
|
-
`!important` or a longer selector to beat Athena, you can take it out. If you put Athena's CSS into **your own layer order**, declare `athena` where you want it.
|
|
62
|
-
- The tokens are in `src/res/themes/tokens.css` (radius, spacing, border, focus ring, dialog widths, row height and the colours), see `docs/styling.md` for every
|
|
63
|
-
class and variable. The new tokens are `--athena-focus`, `--athena-focus-width`, `--athena-border-width`, `--athena-space-1` ... `--athena-space-4`,
|
|
64
|
-
`--athena-dialog-small|medium|large` and `--athena-row-height`.
|
|
65
|
-
- **The default theme follows the system now**: on a device that prefers dark colours it is dark unless `data-mode="light"` is on `<html>`. To keep it light
|
|
66
|
-
always, put `data-mode="light"` on `<html>` (or use `createThemeManager`, which does it).
|
|
67
|
-
- `src/res/themes/dark/style.css` (theme `{ id: 1 }`) still works.
|
|
68
|
-
|
|
69
|
-
## 7. Small things
|
|
70
|
-
|
|
71
|
-
- Messages with plural forms: `validation.minLength`, `validation.maxLength` and `validation.maxFiles` are `{ one, other }` objects in the built-in English texts. A message you
|
|
72
|
-
override with `addMessages` can stay a plain string. `translate` knows `{name:number}` and `{name:date}`, and chooses a plural form by `params.count`.
|
|
73
|
-
- `package.json`: `"sideEffects"` lists only `classic.js`, `theme-boot.js` and CSS, so bundlers can drop what you do not use. TypeScript definitions are in `types/`.
|
|
74
|
-
- The browser tests run under a strict Content-Security-Policy (no inline script, no inline style) and fail on any violation: the library does not need `'unsafe-inline'`.
|
|
75
|
-
- `init()` and `createApp({ root })`: `createApp` builds the layout into an element of your page instead of the body.
|
|
76
|
-
|
|
77
|
-
##
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
# Moving from Athena UI 1.x to 2.0
|
|
2
|
+
|
|
3
|
+
2.0 is lighter and has no side effects: no jQuery, no globals, no libraries loaded at run time, and everything is in a cascade layer. Most of what you call
|
|
4
|
+
(`generateTable`, `showDialog`, `createRouter`, ...) is the same. This is the list of what is not, in the order you will probably meet it.
|
|
5
|
+
|
|
6
|
+
## 1. Imports: no default export, no globals
|
|
7
|
+
|
|
8
|
+
`athena-ui.js` is plain ES module exports now. Importing it does not touch the page, and nothing is put on `window`.
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
// 1.x
|
|
12
|
+
import AthenaUI, { init } from "athena-ui-js"; // the default export is gone
|
|
13
|
+
window.generateTable(...) // the globals are gone
|
|
14
|
+
|
|
15
|
+
// 2.0
|
|
16
|
+
import { init, generateTable } from "athena-ui-js";
|
|
17
|
+
import { generateTable } from "athena-ui-js/table"; // or only what you use, so the rest is never downloaded
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Entry points: `table`, `chart`, `dialog`, `menu`, `navigation`, `forms`, `feedback`, `components`, `inputs`, `router`, `session`, `theme`, `i18n`, `format`,
|
|
21
|
+
`validation`, `sanitize`, `csv`, `dom`, `controls`. Deep imports of files under `src/libs` are not part of the package interface (the `exports` map closes them).
|
|
22
|
+
|
|
23
|
+
**A page that needs the globals** (inline handlers, classic scripts, the `customLoader`) opts in with one line:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<script type="module" src="node_modules/athena-ui-js/src/classic.js"></script> <!-- window.generateTable, window.AthenaUI, ... -->
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 2. jQuery is gone
|
|
30
|
+
|
|
31
|
+
Athena UI has no jQuery code, and `jquery` is not a peer dependency any more. The one place where a jQuery object came back to you,
|
|
32
|
+
`HTMLControlGenerator.create(options)`, returns the element now: use `$(HTMLControlGenerator.create(options))` if you still want a jQuery object.
|
|
33
|
+
`HTMLControlGenerator.register(type, factory)`: the factory returns an element.
|
|
34
|
+
|
|
35
|
+
## 3. crypto-js and js-cookie are gone
|
|
36
|
+
|
|
37
|
+
- **`enable_encrypt_password` is removed.** The login, registration and change password forms return the password as it was typed. Send it over HTTPS and hash
|
|
38
|
+
it on the server (argon2, scrypt, bcrypt). Hashing it in the browser only turns the hash into the password. If your server expects a SHA-256 hash, change
|
|
39
|
+
the server, or hash in your own `login` callback with `crypto.subtle.digest("SHA-256", ...)`.
|
|
40
|
+
- **`Cookies`** is a small helper of our own with `get`, `set` and `remove` (days or a `Date` for `expires`, `path`, `domain`, `sameSite`, `secure`).
|
|
41
|
+
What js-cookie had beyond that (`getJSON`, `withAttributes`, converters) is not there.
|
|
42
|
+
- No script is loaded at run time any more (`libs.js` and `loadLibs` are removed). `customLoader` (your own classic script) still works.
|
|
43
|
+
|
|
44
|
+
## 4. HTMLElementGenerator and HTMLControlGenerator
|
|
45
|
+
|
|
46
|
+
They are part of Athena UI (`athena-ui-js/controls`) and no longer git submodules. The calls are the same; with the classic build they are globals again.
|
|
47
|
+
|
|
48
|
+
## 5. Dialogs and the accordion use native elements
|
|
49
|
+
|
|
50
|
+
- `showDialog` (and `confirmDialog`, `promptDialog`, `showConfirm`, `showFormDialog`) opens a real `<dialog>` with `showModal()`. The browser traps the focus, closes
|
|
51
|
+
it with Esc, draws the backdrop and puts it in the top layer. In your CSS, `.dialog-backdrop` and `.modal-content` are gone from these dialogs: style
|
|
52
|
+
`dialog.dialog`, `dialog.dialog::backdrop` and `.dialog-inner`. `handle.backdrop` is the dialog element too. In a test (jsdom) use `installDom` from
|
|
53
|
+
`athena-ui-js/testing`, which gives jsdom `showModal()`; a synthetic Esc key does not close a native dialog, send the `cancel` event instead.
|
|
54
|
+
- `generateAccordion` is `<details>` and `<summary>`: `.accordion-header` is a `<summary>`, there is no `aria-expanded` on a button, `.accordion-open` is the
|
|
55
|
+
`[open]` attribute and `.accordion-title` is gone. `accordion.toggle(index, open)` works as before.
|
|
56
|
+
- The dropdown and the tooltip became native popovers in 2.1 (see the release notes): the menu is `<div class="dropdown-menu" popover>` (no `hidden` attribute any more: use `:popover-open`), and the tooltip text is a `popover="manual"` element.
|
|
57
|
+
|
|
58
|
+
## 6. CSS: a layer, tokens and dark mode
|
|
59
|
+
|
|
60
|
+
- All rules of the default theme are in the cascade layer `athena`, so a plain rule of your application wins without a more specific selector. If you used
|
|
61
|
+
`!important` or a longer selector to beat Athena, you can take it out. If you put Athena's CSS into **your own layer order**, declare `athena` where you want it.
|
|
62
|
+
- The tokens are in `src/res/themes/tokens.css` (radius, spacing, border, focus ring, dialog widths, row height and the colours), see `docs/styling.md` for every
|
|
63
|
+
class and variable. The new tokens are `--athena-focus`, `--athena-focus-width`, `--athena-border-width`, `--athena-space-1` ... `--athena-space-4`,
|
|
64
|
+
`--athena-dialog-small|medium|large` and `--athena-row-height`.
|
|
65
|
+
- **The default theme follows the system now**: on a device that prefers dark colours it is dark unless `data-mode="light"` is on `<html>`. To keep it light
|
|
66
|
+
always, put `data-mode="light"` on `<html>` (or use `createThemeManager`, which does it).
|
|
67
|
+
- `src/res/themes/dark/style.css` (theme `{ id: 1 }`) still works.
|
|
68
|
+
|
|
69
|
+
## 7. Small things
|
|
70
|
+
|
|
71
|
+
- Messages with plural forms: `validation.minLength`, `validation.maxLength` and `validation.maxFiles` are `{ one, other }` objects in the built-in English texts. A message you
|
|
72
|
+
override with `addMessages` can stay a plain string. `translate` knows `{name:number}` and `{name:date}`, and chooses a plural form by `params.count`.
|
|
73
|
+
- `package.json`: `"sideEffects"` lists only `classic.js`, `theme-boot.js` and CSS, so bundlers can drop what you do not use. TypeScript definitions are in `types/`.
|
|
74
|
+
- The browser tests run under a strict Content-Security-Policy (no inline script, no inline style) and fail on any violation: the library does not need `'unsafe-inline'`.
|
|
75
|
+
- `init()` and `createApp({ root })`: `createApp` builds the layout into an element of your page instead of the body.
|
|
76
|
+
|
|
77
|
+
## 8. What Odin NS Manager needed when it moved (a real application, 2.x)
|
|
78
|
+
|
|
79
|
+
Odin moved with little work, and then replaced its own copies of the theme manager, the header menu, forms, tables and charts. What it found:
|
|
80
|
+
|
|
81
|
+
- **`HTMLControlGenerator` and `HTMLElementGenerator` are in Athena** (`athena-ui-js/controls`, `src/libs/core/elementGenerator.js`); you do not need the old packages. They are plain functions now, without jQuery: if your code
|
|
82
|
+
wrapped their result in jQuery, wrap it where you use it (`$(HTMLControlGenerator.create(...))`).
|
|
83
|
+
- **Dialogs are native `<dialog>` elements.** A selector such as `.dialog-backdrop .dialog` or `.modal-content` finds nothing; use `showDialog(...).element` or the `class` option. The close button has the class `dialog-close`.
|
|
84
|
+
- **Form parts** have classes of their own: `.form-message` (the line under the fields, `.form-message-error` / `-success`) and `.form-actions` (the buttons). Rules that styled your own copies of these can go.
|
|
85
|
+
- **Delete from your stylesheet**: rules that beat Athena's specificity (it is in the layer `athena` now, a plain rule wins), your copy of the theme variables (use `createThemeManager` and the tokens), the menu repair
|
|
86
|
+
(icons, active item, keyboard are in `generateMenu`), and the table CSS for a narrow screen (`stack: true`).
|
|
87
|
+
- **Order that worked**: the theme manager first (a drop-in), then the menu, then the pieces where Athena lacked something (forms, tables, charts): define what is missing in the application, build it in the library with
|
|
88
|
+
tests, install the packed tarball into the application with `npm install --no-save <file>.tgz`, and only when the library is published change the dependency.
|
|
89
|
+
- **Check with the real application**: run it with a throwaway database, take screenshots of every page before and after, and drive the flows with real input. Not everything has to move: Odin keeps its own
|
|
90
|
+
`el()` wrapper, its API client and its list loader.
|
|
91
|
+
- **Smaller downloads**: import from the entry points (`athena-ui-js/table`, ...) and start with `athena-ui-js/app` instead of the root file, which loads every module.
|
|
92
|
+
|
|
93
|
+
## Upgrade in five steps
|
|
94
|
+
|
|
95
|
+
1. Replace `import AthenaUI from ...` and `window.` calls by named imports, or add the `classic.js` line.
|
|
96
|
+
2. Remove the jQuery script tag if nothing else of yours needs it.
|
|
97
|
+
3. Remove `enable_encrypt_password` and make the server hash the password.
|
|
98
|
+
4. Search your CSS for `.dialog-backdrop`, `.modal-content` (in dialogs) and `.accordion-open`, and for rules that only exist to beat Athena's specificity.
|
|
99
|
+
5. Run your tests, with a Content-Security-Policy on the page if you can: it tells you what still writes inline styles or scripts.
|
package/docs/styling.md
CHANGED
|
@@ -1,123 +1,124 @@
|
|
|
1
|
-
# Styling reference
|
|
2
|
-
|
|
3
|
-
Generated by `npm run docs` from `src/res/themes/default/style.css` and `tokens.css`. Do not edit by hand.
|
|
4
|
-
|
|
5
|
-
All Athena UI rules are in the cascade layer `athena`: a plain rule of your application (not in a layer) always wins, whatever its specificity.
|
|
6
|
-
Start with the tokens, they cover most of what people want to change.
|
|
7
|
-
|
|
8
|
-
## Tokens
|
|
9
|
-
|
|
10
|
-
| Variable | Default (light) |
|
|
11
|
-
| --- | --- |
|
|
12
|
-
| `--athena-accent` | `#8e44ad` |
|
|
13
|
-
| `--athena-radius` | `2px` |
|
|
14
|
-
| `--athena-bg` | `#fff` |
|
|
15
|
-
| `--athena-fg` | `#1a1a1a` |
|
|
16
|
-
| `--athena-muted` | `#666` |
|
|
17
|
-
| `--athena-border` | `#000` |
|
|
18
|
-
| `--athena-line` | `#ccc` |
|
|
19
|
-
| `--athena-surface` | `#f2f2f2` |
|
|
20
|
-
| `--athena-surface-alt` | `#fafafa` |
|
|
21
|
-
| `--athena-hover` | `#e8f0fe` |
|
|
22
|
-
| `--athena-overlay` | `rgb(0 0 0 / 40%)` |
|
|
23
|
-
| `--athena-accent` | `#2f6db5` |
|
|
24
|
-
| `--athena-accent-fg` | `#fff` |
|
|
25
|
-
| `--athena-focus` | `#1b4f8f` |
|
|
26
|
-
| `--athena-danger` | `#c0392b` |
|
|
27
|
-
| `--athena-success` | `#1e8449` |
|
|
28
|
-
| `--athena-warning` | `#9a6700` |
|
|
29
|
-
| `--athena-info` | `#2471a3` |
|
|
30
|
-
| `--athena-shadow` | `0 4px 14px rgb(0 0 0 / 18%)` |
|
|
31
|
-
| `--athena-tok-comment` | `#5a6270` |
|
|
32
|
-
| `--athena-tok-string` | `#0b6e3a` |
|
|
33
|
-
| `--athena-tok-number` | `#a24b00` |
|
|
34
|
-
| `--athena-tok-keyword` | `#7a2a9e` |
|
|
35
|
-
| `--athena-tok-literal` | `#0b5fa5` |
|
|
36
|
-
| `--athena-tok-function` | `#1f55b0` |
|
|
37
|
-
| `--athena-tok-type` | `#0f6b6b` |
|
|
38
|
-
| `--athena-tok-property` | `#9b2c5b` |
|
|
39
|
-
| `--athena-tok-tag` | `#a3201f` |
|
|
40
|
-
| `--athena-tok-attribute` | `#8a5300` |
|
|
41
|
-
| `--athena-tok-variable` | `#0a6a8a` |
|
|
42
|
-
| `--athena-tok-selector` | `#7a2a9e` |
|
|
43
|
-
| `--athena-tok-meta` | `#6b4eae` |
|
|
44
|
-
| `--athena-tok-entity` | `#0a6a8a` |
|
|
45
|
-
| `--athena-tok-builtin` | `#0b5fa5` |
|
|
46
|
-
| `--athena-tok-operator` | `#3b4048` |
|
|
47
|
-
| `--athena-tok-punctuation` | `#5a6270` |
|
|
48
|
-
| `--athena-radius` | `6px` |
|
|
49
|
-
| `--athena-border-width` | `1px` |
|
|
50
|
-
| `--athena-space-1` | `4px` |
|
|
51
|
-
| `--athena-space-2` | `8px` |
|
|
52
|
-
| `--athena-space-3` | `12px` |
|
|
53
|
-
| `--athena-space-4` | `16px` |
|
|
54
|
-
| `--grid-gap` | `16px` |
|
|
55
|
-
| `--athena-focus-width` | `2px` |
|
|
56
|
-
| `--athena-dialog-small` | `360px` |
|
|
57
|
-
| `--athena-dialog-medium` | `480px` |
|
|
58
|
-
| `--athena-dialog-large` | `720px` |
|
|
59
|
-
| `--athena-row-height` | `36px` |
|
|
60
|
-
| `--athena-duration-fast` | `120ms` |
|
|
61
|
-
| `--athena-duration-base` | `200ms` |
|
|
62
|
-
| `--athena-duration-slow` | `360ms` |
|
|
63
|
-
| `--athena-ease-standard` | `cubic-bezier(0.2, 0, 0, 1)` |
|
|
64
|
-
| `--athena-ease-in` | `cubic-bezier(0.4, 0, 1, 1)` |
|
|
65
|
-
| `--athena-ease-out` | `cubic-bezier(0, 0, 0.2, 1)` |
|
|
66
|
-
| `--athena-ease-spring` | `linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.077 22.8%, 1.121 26.7%, 1.149 31.2%, 1.159 36.2%, 1.138 49.9%, 1.115 56.3%, 1.043 69.7%, 1.009 81.2%, 0.998 92.1%, 1)` |
|
|
67
|
-
|
|
68
|
-
Dark colours: set `data-mode="dark"` on `<html>` (or let `createThemeManager` do it); without the attribute the system decides. Themes: see `appearance.css`.
|
|
69
|
-
|
|
70
|
-
## Components
|
|
71
|
-
|
|
72
|
-
| Group of rules | Classes | Variables it reads |
|
|
73
|
-
| --- | --- | --- |
|
|
74
|
-
| General | - | `--athena-accent` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-line` |
|
|
75
|
-
| Header, Wrapper, Footer | `.footer-container` `.header-container` `.wrapper-container` | - |
|
|
76
|
-
| Elements | `.container` `.default-cointainer-bordered` `.menu` | `--athena-border` |
|
|
77
|
-
| Modal (background) | `.modal` `.modal-content` | `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-line` `--athena-overlay` |
|
|
78
|
-
| Modal close button | `.close` | `--athena-fg` `--athena-muted` |
|
|
79
|
-
| Buttons | `.athena-button` `.button-danger` `.button-large` `.button-link` `.button-secondary` `.button-small` | `--athena-accent` `--athena-accent-fg` `--athena-danger` `--athena-fg` `--athena-line` `--athena-radius` `--athena-surface` |
|
|
80
|
-
| Forms | `.athena-form` `.choice` `.choices` `.field` `.field-error` `.field-group` `.field-help` `.field-invalid` `.field-label` `.field-required` `.form-actions` `.form-message` `.form-message-error` `.form-message-success` | `--athena-border-width` `--athena-danger` `--athena-line` `--athena-muted` `--athena-radius` `--athena-space-1` `--athena-space-2` `--athena-space-3` `--athena-success` |
|
|
81
|
-
| Switch: a checkbox drawn as a toggle | `.switch` `.switch-track` | `--athena-accent` `--athena-duration-fast` `--athena-ease-standard` `--athena-line` |
|
|
82
|
-
| Spinner, alerts, toasts, progress | `.alert` `.alert-body` `.alert-close` `.alert-error` `.alert-info` `.alert-success` `.alert-warning` `.button-loading` `.progress-bar` `.progress-error` `.progress-fill` `.progress-indeterminate` `.progress-label` `.progress-success` `.progress-warning` `.spinner` `.spinner-large` `.spinner-small` `.toast` `.toast-container` | `--alert-color` `--athena-accent` `--athena-border-width` `--athena-danger` `--athena-duration-base` `--athena-ease-standard` `--athena-fg` `--athena-info` `--athena-line` `--athena-muted` `--athena-radius` `--athena-shadow` `--athena-space-2` `--athena-space-3` `--athena-success` `--athena-surface` `--athena-surface-alt` `--athena-warning` `--progress-color` |
|
|
83
|
-
| Dialog: the native <dialog> element, opened with showModal() | `.dialog` | `--athena-bg` `--athena-border-width` `--athena-dialog-medium` `--athena-fg` `--athena-line` `--athena-overlay` `--athena-radius` `--athena-shadow` `--dialog-width` |
|
|
84
|
-
| The content fills the dialog up to its edge, so a click on the backdrop is a click on the dialog element itself | `.dialog-body` `.dialog-close` `.dialog-footer` `.dialog-full` `.dialog-inner` `.dialog-large` `.dialog-medium` `.dialog-small` `.dialog-title` | `--athena-dialog-large` `--athena-dialog-medium` `--athena-dialog-small` `--athena-muted` `--athena-space-2` |
|
|
85
|
-
| Tabs | `.tab` `.tab-active` `.tab-list` `.tab-panel` | `--athena-accent` `--athena-border-width` `--athena-fg` `--athena-line` |
|
|
86
|
-
| Breadcrumbs, pagination | `.breadcrumb-item` `.breadcrumb-list` `.page-button` `.page-current` `.pagination` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-line` `--athena-muted` `--athena-space-1` |
|
|
87
|
-
| Accordion: <details> and <summary> | `.accordion-header` `.accordion-icon` `.accordion-item` `.accordion-panel` `.sidebar-parent` | `--athena-accent` `--athena-border-width` `--athena-duration-fast` `--athena-ease-standard` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-line` `--athena-surface` |
|
|
88
|
-
| Dropdown | `.dropdown` `.dropdown-menu` `.dropdown-right` | `--athena-bg` `--athena-border-width` `--athena-line` `--athena-radius` `--athena-shadow` |
|
|
89
|
-
| A popover (the dropdown menu, the tooltip) is in the top layer, placed next to its anchor by script through two variables | `.athena-popover` `.athena-popover-above` `.athena-popover-center` `.athena-popover-end` `.dropdown-divider` `.dropdown-item` `.dropdown-menu` | `--athena-fg` `--athena-hover` `--athena-line` `--athena-popover-left` `--athena-popover-top` |
|
|
90
|
-
| Sidebar | `.accordion-icon` `.sidebar` `.sidebar-link` `.sidebar-list` `.sidebar-parent` `.sidebar-sublist` `.sidebar-toggle` | `--athena-accent` `--athena-accent-fg` `--athena-fg` `--athena-hover` `--athena-space-2` |
|
|
91
|
-
| Cards, sections, grid | `.athena-grid` `.card` `.card-body` `.card-footer` `.card-image` `.card-title` | `--athena-bg` `--athena-border-width` `--athena-line` `--athena-radius` `--athena-surface-alt` `--grid-columns` `--grid-gap` |
|
|
92
|
-
| Badge, avatar, stat | `.avatar` `.avatar-large` `.avatar-small` `.badge` `.badge-error` `.badge-info` `.badge-pill` `.badge-success` `.badge-warning` `.stat` `.stat-bad` `.stat-good` `.stat-label` `.stat-neutral` `.stat-value` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-danger` `--athena-fg` `--athena-info` `--athena-line` `--athena-muted` `--athena-radius` `--athena-success` `--athena-surface` `--athena-warning` |
|
|
93
|
-
| Tooltip | `.has-tooltip` `.tooltip-text` `.tooltip-wrap` | `--athena-duration-fast` `--athena-ease-standard` |
|
|
94
|
-
| As a popover it is only drawn while it is open, so it is always visible; the position comes from placePopover() | `.tooltip-text` | - |
|
|
95
|
-
| Combobox (autocomplete, multi select) and chips | `.chip` `.chip-remove` `.combobox` `.combobox-active` `.combobox-chips` `.combobox-empty` `.combobox-input` `.combobox-list` `.combobox-multiple` `.combobox-option` `.combobox-selected` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` `--athena-shadow` `--athena-space-1` |
|
|
96
|
-
| File upload | `.dropzone` `.dropzone-disabled` `.dropzone-input` `.dropzone-over` `.file-item` `.file-list` `.file-status` | `--athena-accent` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` |
|
|
97
|
-
| Stepper | `.form-actions` `.stepper` `.stepper-current` `.stepper-done` `.stepper-number` `.stepper-step` `.stepper-steps` | `--athena-accent` `--athena-accent-fg` `--athena-fg` `--athena-line` `--athena-muted` `--athena-space-2` `--athena-success` |
|
|
98
|
-
| Tables | `.athena-table` `.athena-table-edit` `.athena-table-filter` `.athena-table-pager` `.athena-table-select` `.athena-table-wrapper` `.clickable` `.editable` `.selected` `.sortable` | `--athena-accent` `--athena-border-width` `--athena-hover` `--athena-line` `--athena-surface` `--athena-surface-alt` |
|
|
99
|
-
| Table options: density, wrapping, alignment | `.athena-align-center` `.athena-align-right` `.athena-table` `.athena-table-compact` `.athena-table-nowrap` `.athena-table-wrap` | `--athena-focus` `--athena-focus-width` |
|
|
100
|
-
| Charts | `.athena-chart` `.chart-axis` `.chart-bar` `.chart-grid` `.chart-legend` `.chart-slice` `.chart-tick` `.chart-title` | `--athena-bg` `--athena-fg` `--athena-line` `--athena-muted` |
|
|
101
|
-
| Responsive | `.athena-form` `.athena-grid` `.file-item` `.file-progress` `.modal` `.modal-content` `.sidebar` `.sidebar-list` `.sidebar-open` `.sidebar-toggle` `.stepper-title` | - |
|
|
102
|
-
| Reduced motion: a spinner and an indeterminate bar still have to say "busy", but slowly. The transitions read the duration tokens (0). | `.progress-fill` `.progress-indeterminate` `.spinner` | - |
|
|
103
|
-
| Menu submenus | `.has-submenu` `.menu-parent` `.submenu` `.submenu-item` | `--athena-bg` `--athena-border-width` `--athena-hover` `--athena-line` `--athena-radius` `--athena-shadow` |
|
|
104
|
-
| Table: resizable columns, virtual scrolling | `.athena-col-resizer` `.athena-table` `.athena-table-resizable` `.athena-table-scroll` `.athena-table-spacer` `.athena-table-virtual` `.resizing` | `--athena-accent` `--athena-border-width` `--athena-line` `--athena-row-height` `--row-height` |
|
|
105
|
-
| Date range | `.daterange` `.daterange-part` | - |
|
|
106
|
-
| Rich text editor | `.richtext` `.rt-bold` `.rt-button` `.rt-disabled` `.rt-editor` `.rt-empty` `.rt-italic` `.rt-separator` `.rt-source-view` `.rt-strike` `.rt-toolbar` `.rt-underline` `.submenu` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` `--athena-surface` |
|
|
107
|
-
| Theme picker (generateThemePicker). The preview is drawn with the colours of the theme it shows. | `.theme-picker` `.theme-picker-description` `.theme-picker-group` `.theme-picker-option` `.theme-picker-options` `.theme-preview` `.theme-preview-bar` `.theme-preview-body` `.theme-preview-button` `.theme-preview-line` | `--athena-accent` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-line` `--athena-muted` `--athena-radius` `--athena-space-1` `--athena-space-3` `--athena-space-4` |
|
|
108
|
-
| Tables with a data source and row actions | `.athena-button` `.athena-
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
| The
|
|
117
|
-
|
|
|
118
|
-
| A
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
| The
|
|
1
|
+
# Styling reference
|
|
2
|
+
|
|
3
|
+
Generated by `npm run docs` from `src/res/themes/default/style.css` and `tokens.css`. Do not edit by hand.
|
|
4
|
+
|
|
5
|
+
All Athena UI rules are in the cascade layer `athena`: a plain rule of your application (not in a layer) always wins, whatever its specificity.
|
|
6
|
+
Start with the tokens, they cover most of what people want to change.
|
|
7
|
+
|
|
8
|
+
## Tokens
|
|
9
|
+
|
|
10
|
+
| Variable | Default (light) |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `--athena-accent` | `#8e44ad` |
|
|
13
|
+
| `--athena-radius` | `2px` |
|
|
14
|
+
| `--athena-bg` | `#fff` |
|
|
15
|
+
| `--athena-fg` | `#1a1a1a` |
|
|
16
|
+
| `--athena-muted` | `#666` |
|
|
17
|
+
| `--athena-border` | `#000` |
|
|
18
|
+
| `--athena-line` | `#ccc` |
|
|
19
|
+
| `--athena-surface` | `#f2f2f2` |
|
|
20
|
+
| `--athena-surface-alt` | `#fafafa` |
|
|
21
|
+
| `--athena-hover` | `#e8f0fe` |
|
|
22
|
+
| `--athena-overlay` | `rgb(0 0 0 / 40%)` |
|
|
23
|
+
| `--athena-accent` | `#2f6db5` |
|
|
24
|
+
| `--athena-accent-fg` | `#fff` |
|
|
25
|
+
| `--athena-focus` | `#1b4f8f` |
|
|
26
|
+
| `--athena-danger` | `#c0392b` |
|
|
27
|
+
| `--athena-success` | `#1e8449` |
|
|
28
|
+
| `--athena-warning` | `#9a6700` |
|
|
29
|
+
| `--athena-info` | `#2471a3` |
|
|
30
|
+
| `--athena-shadow` | `0 4px 14px rgb(0 0 0 / 18%)` |
|
|
31
|
+
| `--athena-tok-comment` | `#5a6270` |
|
|
32
|
+
| `--athena-tok-string` | `#0b6e3a` |
|
|
33
|
+
| `--athena-tok-number` | `#a24b00` |
|
|
34
|
+
| `--athena-tok-keyword` | `#7a2a9e` |
|
|
35
|
+
| `--athena-tok-literal` | `#0b5fa5` |
|
|
36
|
+
| `--athena-tok-function` | `#1f55b0` |
|
|
37
|
+
| `--athena-tok-type` | `#0f6b6b` |
|
|
38
|
+
| `--athena-tok-property` | `#9b2c5b` |
|
|
39
|
+
| `--athena-tok-tag` | `#a3201f` |
|
|
40
|
+
| `--athena-tok-attribute` | `#8a5300` |
|
|
41
|
+
| `--athena-tok-variable` | `#0a6a8a` |
|
|
42
|
+
| `--athena-tok-selector` | `#7a2a9e` |
|
|
43
|
+
| `--athena-tok-meta` | `#6b4eae` |
|
|
44
|
+
| `--athena-tok-entity` | `#0a6a8a` |
|
|
45
|
+
| `--athena-tok-builtin` | `#0b5fa5` |
|
|
46
|
+
| `--athena-tok-operator` | `#3b4048` |
|
|
47
|
+
| `--athena-tok-punctuation` | `#5a6270` |
|
|
48
|
+
| `--athena-radius` | `6px` |
|
|
49
|
+
| `--athena-border-width` | `1px` |
|
|
50
|
+
| `--athena-space-1` | `4px` |
|
|
51
|
+
| `--athena-space-2` | `8px` |
|
|
52
|
+
| `--athena-space-3` | `12px` |
|
|
53
|
+
| `--athena-space-4` | `16px` |
|
|
54
|
+
| `--grid-gap` | `16px` |
|
|
55
|
+
| `--athena-focus-width` | `2px` |
|
|
56
|
+
| `--athena-dialog-small` | `360px` |
|
|
57
|
+
| `--athena-dialog-medium` | `480px` |
|
|
58
|
+
| `--athena-dialog-large` | `720px` |
|
|
59
|
+
| `--athena-row-height` | `36px` |
|
|
60
|
+
| `--athena-duration-fast` | `120ms` |
|
|
61
|
+
| `--athena-duration-base` | `200ms` |
|
|
62
|
+
| `--athena-duration-slow` | `360ms` |
|
|
63
|
+
| `--athena-ease-standard` | `cubic-bezier(0.2, 0, 0, 1)` |
|
|
64
|
+
| `--athena-ease-in` | `cubic-bezier(0.4, 0, 1, 1)` |
|
|
65
|
+
| `--athena-ease-out` | `cubic-bezier(0, 0, 0.2, 1)` |
|
|
66
|
+
| `--athena-ease-spring` | `linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.077 22.8%, 1.121 26.7%, 1.149 31.2%, 1.159 36.2%, 1.138 49.9%, 1.115 56.3%, 1.043 69.7%, 1.009 81.2%, 0.998 92.1%, 1)` |
|
|
67
|
+
|
|
68
|
+
Dark colours: set `data-mode="dark"` on `<html>` (or let `createThemeManager` do it); without the attribute the system decides. Themes: see `appearance.css`.
|
|
69
|
+
|
|
70
|
+
## Components
|
|
71
|
+
|
|
72
|
+
| Group of rules | Classes | Variables it reads |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| General | - | `--athena-accent` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-line` |
|
|
75
|
+
| Header, Wrapper, Footer | `.footer-container` `.header-container` `.wrapper-container` | - |
|
|
76
|
+
| Elements | `.container` `.default-cointainer-bordered` `.menu` | `--athena-border` |
|
|
77
|
+
| Modal (background) | `.modal` `.modal-content` | `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-line` `--athena-overlay` |
|
|
78
|
+
| Modal close button | `.close` | `--athena-fg` `--athena-muted` |
|
|
79
|
+
| Buttons | `.athena-button` `.button-danger` `.button-large` `.button-link` `.button-secondary` `.button-small` | `--athena-accent` `--athena-accent-fg` `--athena-danger` `--athena-fg` `--athena-line` `--athena-radius` `--athena-surface` |
|
|
80
|
+
| Forms | `.athena-form` `.choice` `.choices` `.field` `.field-error` `.field-group` `.field-help` `.field-invalid` `.field-label` `.field-required` `.form-actions` `.form-message` `.form-message-error` `.form-message-success` | `--athena-border-width` `--athena-danger` `--athena-line` `--athena-muted` `--athena-radius` `--athena-space-1` `--athena-space-2` `--athena-space-3` `--athena-success` |
|
|
81
|
+
| Switch: a checkbox drawn as a toggle | `.switch` `.switch-track` | `--athena-accent` `--athena-duration-fast` `--athena-ease-standard` `--athena-line` |
|
|
82
|
+
| Spinner, alerts, toasts, progress | `.alert` `.alert-body` `.alert-close` `.alert-error` `.alert-info` `.alert-success` `.alert-warning` `.button-loading` `.progress-bar` `.progress-error` `.progress-fill` `.progress-indeterminate` `.progress-label` `.progress-success` `.progress-warning` `.spinner` `.spinner-large` `.spinner-small` `.toast` `.toast-container` `.toast-container-bottom-center` `.toast-container-bottom-left` `.toast-container-bottom-right` `.toast-container-top-center` `.toast-container-top-left` | `--alert-color` `--athena-accent` `--athena-border-width` `--athena-danger` `--athena-duration-base` `--athena-ease-standard` `--athena-fg` `--athena-info` `--athena-line` `--athena-muted` `--athena-radius` `--athena-shadow` `--athena-space-2` `--athena-space-3` `--athena-success` `--athena-surface` `--athena-surface-alt` `--athena-toast-x` `--athena-toast-y` `--athena-warning` `--progress-color` |
|
|
83
|
+
| Dialog: the native <dialog> element, opened with showModal() | `.dialog` | `--athena-bg` `--athena-border-width` `--athena-dialog-medium` `--athena-fg` `--athena-line` `--athena-overlay` `--athena-radius` `--athena-shadow` `--dialog-width` |
|
|
84
|
+
| The content fills the dialog up to its edge, so a click on the backdrop is a click on the dialog element itself | `.dialog-body` `.dialog-close` `.dialog-footer` `.dialog-full` `.dialog-inner` `.dialog-large` `.dialog-medium` `.dialog-small` `.dialog-title` | `--athena-dialog-large` `--athena-dialog-medium` `--athena-dialog-small` `--athena-muted` `--athena-space-2` |
|
|
85
|
+
| Tabs | `.tab` `.tab-active` `.tab-list` `.tab-panel` | `--athena-accent` `--athena-border-width` `--athena-fg` `--athena-line` |
|
|
86
|
+
| Breadcrumbs, pagination | `.breadcrumb-item` `.breadcrumb-list` `.page-button` `.page-current` `.pagination` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-line` `--athena-muted` `--athena-space-1` |
|
|
87
|
+
| Accordion: <details> and <summary> | `.accordion-header` `.accordion-icon` `.accordion-item` `.accordion-panel` `.sidebar-parent` | `--athena-accent` `--athena-border-width` `--athena-duration-fast` `--athena-ease-standard` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-line` `--athena-surface` |
|
|
88
|
+
| Dropdown | `.dropdown` `.dropdown-menu` `.dropdown-right` | `--athena-bg` `--athena-border-width` `--athena-line` `--athena-radius` `--athena-shadow` |
|
|
89
|
+
| A popover (the dropdown menu, the tooltip) is in the top layer, placed next to its anchor by script through two variables | `.athena-popover` `.athena-popover-above` `.athena-popover-center` `.athena-popover-end` `.dropdown-divider` `.dropdown-item` `.dropdown-menu` | `--athena-fg` `--athena-hover` `--athena-line` `--athena-popover-left` `--athena-popover-top` |
|
|
90
|
+
| Sidebar | `.accordion-icon` `.sidebar` `.sidebar-link` `.sidebar-list` `.sidebar-parent` `.sidebar-sublist` `.sidebar-toggle` | `--athena-accent` `--athena-accent-fg` `--athena-fg` `--athena-hover` `--athena-space-2` |
|
|
91
|
+
| Cards, sections, grid | `.athena-grid` `.card` `.card-body` `.card-footer` `.card-image` `.card-title` | `--athena-bg` `--athena-border-width` `--athena-line` `--athena-radius` `--athena-surface-alt` `--grid-columns` `--grid-gap` |
|
|
92
|
+
| Badge, avatar, stat | `.avatar` `.avatar-large` `.avatar-small` `.badge` `.badge-error` `.badge-info` `.badge-pill` `.badge-success` `.badge-warning` `.stat` `.stat-bad` `.stat-good` `.stat-label` `.stat-neutral` `.stat-value` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-danger` `--athena-fg` `--athena-info` `--athena-line` `--athena-muted` `--athena-radius` `--athena-success` `--athena-surface` `--athena-warning` |
|
|
93
|
+
| Tooltip | `.has-tooltip` `.tooltip-text` `.tooltip-wrap` | `--athena-duration-fast` `--athena-ease-standard` |
|
|
94
|
+
| As a popover it is only drawn while it is open, so it is always visible; the position comes from placePopover() | `.tooltip-text` | - |
|
|
95
|
+
| Combobox (autocomplete, multi select) and chips | `.chip` `.chip-remove` `.combobox` `.combobox-active` `.combobox-chips` `.combobox-empty` `.combobox-input` `.combobox-list` `.combobox-multiple` `.combobox-option` `.combobox-selected` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` `--athena-shadow` `--athena-space-1` |
|
|
96
|
+
| File upload | `.dropzone` `.dropzone-disabled` `.dropzone-input` `.dropzone-over` `.file-item` `.file-list` `.file-status` | `--athena-accent` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` |
|
|
97
|
+
| Stepper | `.form-actions` `.stepper` `.stepper-current` `.stepper-done` `.stepper-number` `.stepper-step` `.stepper-steps` | `--athena-accent` `--athena-accent-fg` `--athena-fg` `--athena-line` `--athena-muted` `--athena-space-2` `--athena-success` |
|
|
98
|
+
| Tables | `.athena-table` `.athena-table-edit` `.athena-table-filter` `.athena-table-pager` `.athena-table-select` `.athena-table-wrapper` `.clickable` `.editable` `.selected` `.sortable` | `--athena-accent` `--athena-border-width` `--athena-hover` `--athena-line` `--athena-surface` `--athena-surface-alt` |
|
|
99
|
+
| Table options: density, wrapping, alignment | `.athena-align-center` `.athena-align-right` `.athena-table` `.athena-table-compact` `.athena-table-nowrap` `.athena-table-wrap` | `--athena-focus` `--athena-focus-width` |
|
|
100
|
+
| Charts | `.athena-chart` `.chart-axis` `.chart-bar` `.chart-grid` `.chart-legend` `.chart-slice` `.chart-tick` `.chart-title` | `--athena-bg` `--athena-fg` `--athena-line` `--athena-muted` |
|
|
101
|
+
| Responsive | `.athena-form` `.athena-grid` `.file-item` `.file-progress` `.modal` `.modal-content` `.sidebar` `.sidebar-list` `.sidebar-open` `.sidebar-toggle` `.stepper-title` | - |
|
|
102
|
+
| Reduced motion: a spinner and an indeterminate bar still have to say "busy", but slowly. The transitions read the duration tokens (0). | `.progress-fill` `.progress-indeterminate` `.spinner` | - |
|
|
103
|
+
| Menu submenus | `.has-submenu` `.menu-parent` `.submenu` `.submenu-item` | `--athena-bg` `--athena-border-width` `--athena-hover` `--athena-line` `--athena-radius` `--athena-shadow` |
|
|
104
|
+
| Table: resizable columns, virtual scrolling | `.athena-col-resizer` `.athena-table` `.athena-table-resizable` `.athena-table-scroll` `.athena-table-spacer` `.athena-table-virtual` `.resizing` | `--athena-accent` `--athena-border-width` `--athena-line` `--athena-row-height` `--row-height` |
|
|
105
|
+
| Date range | `.daterange` `.daterange-part` | - |
|
|
106
|
+
| Rich text editor | `.richtext` `.rt-bold` `.rt-button` `.rt-disabled` `.rt-editor` `.rt-empty` `.rt-italic` `.rt-separator` `.rt-source-view` `.rt-strike` `.rt-toolbar` `.rt-underline` `.submenu` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` `--athena-surface` |
|
|
107
|
+
| Theme picker (generateThemePicker). The preview is drawn with the colours of the theme it shows. | `.theme-picker` `.theme-picker-description` `.theme-picker-group` `.theme-picker-option` `.theme-picker-options` `.theme-preview` `.theme-preview-bar` `.theme-preview-body` `.theme-preview-button` `.theme-preview-line` | `--athena-accent` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-line` `--athena-muted` `--athena-radius` `--athena-space-1` `--athena-space-3` `--athena-space-4` |
|
|
108
|
+
| Tables with a data source and row actions | `.athena-button` `.athena-table` `.athena-table-actions` `.athena-table-error` `.athena-table-is-loading` `.athena-table-loading` `.athena-visually-hidden` | `--athena-danger` `--athena-muted` |
|
|
109
|
+
| Tables: the stacked layout of the option `stack`: while the table is narrow every row is a block and the label of the column stands next to each value | `.athena-chart` `.athena-chart-sparkline` `.athena-table` `.athena-table-actions` `.athena-table-stackable` `.chart-area` `.chart-bar` `.chart-data` `.chart-hidden` `.chart-legend-item` `.chart-line` `.chart-point` `.chart-ring` `.chart-slice` `.chart-swatch` `.chart-tooltip` `.chart-tooltip-box` `.chart-tooltip-text` `.is-off` `.is-stacked` `.is-visible` `.s1` `.s2` `.s3` `.s4` `.s5` `.s6` `.s7` `.s8` | `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-line` `--athena-muted` `--series-1` `--series-2` `--series-3` `--series-4` `--series-5` `--series-6` `--series-7` `--series-8` |
|
|
110
|
+
| Menu (generateMenu): a bar, or tabs at the bottom of the screen with sheets for the groups | `.athena-menu` `.athena-menu-list` `.has-active` `.is-active` `.menu-avatar` `.menu-control` `.menu-icon` `.menu-item` `.menu-item-end` `.menu-sheet` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-hover` `--athena-line` `--athena-menu-active` `--athena-menu-bg` `--athena-menu-fg` `--athena-menu-hover` `--athena-radius` `--athena-shadow` |
|
|
111
|
+
| Tabs at the bottom (layout "responsive" switches to it under 700px, or under the `breakpoint` option: the menu then has the class is-tabs) | `.athena-menu-bottom-tabs` `.athena-menu-list` `.athena-menu-responsive` `.is-tabs` `.menu-control` `.menu-item` `.menu-item-end` `.menu-sheet` | `--athena-bg` `--athena-border-width` `--athena-line` `--athena-menu-bg` `--athena-radius` |
|
|
112
|
+
| Menu: groups inside groups, and badges | `.athena-menu` `.athena-menu-bottom-tabs` `.athena-menu-responsive` `.athena-table-placeholder` `.athena-table-status` `.menu-badge` `.menu-badge-bad` `.menu-badge-info` `.menu-badge-ok` `.menu-badge-warn` `.menu-caret` `.menu-sheet` `.menu-sheet-nested` | `--athena-accent` `--athena-accent-fg` `--athena-danger` `--athena-info` `--athena-muted` `--athena-success` `--athena-warning` |
|
|
113
|
+
| Charts: pointer layer, zoom | `.athena-chart` `.chart-hit` `.chart-marker` `.chart-reset` `.chart-selection` | `--athena-accent` `--athena-focus` `--athena-focus-width` `--athena-muted` |
|
|
114
|
+
| Page header, facts, empty state, loading, stat tone and note | `.athena-popover` `.athena-popover-above` `.dialog` `.empty-icon` `.empty-message` `.empty-state` `.empty-title` `.fact` `.facts` `.facts-inline` `.is-bad` `.is-ok` `.is-warn` `.loading-state` `.page-actions` `.page-description` `.page-header` `.page-header-row` `.page-title` `.stat` `.stat-note` `.stat-value` | `--athena-danger` `--athena-duration-base` `--athena-duration-fast` `--athena-ease-out` `--athena-fg` `--athena-muted` `--athena-space-2` `--athena-space-3` `--athena-success` `--athena-warning` |
|
|
115
|
+
| Toasts slide in from the side, and out again when they are closed | `.is-leaving` `.toast` | `--athena-duration-base` `--athena-ease-out` |
|
|
116
|
+
| The panel of an accordion opens and closes smoothly (a browser without ::details-content opens it at once) | `.accordion-item` | `--athena-duration-base` `--athena-ease-standard` |
|
|
117
|
+
| The mark of the active item, and hover, move gently | `.athena-menu` `.menu-control` | `--athena-duration-fast` `--athena-ease-standard` |
|
|
118
|
+
| A place holder for what is loading: a skeleton with a shimmer (generateSkeleton) | `.athena-skeleton` `.athena-skeleton-line` | `--athena-hover` `--athena-radius` `--athena-space-2` `--athena-surface` |
|
|
119
|
+
| A theme or mode change cross-fades instead of flashing (the theme manager sets the class for a moment) | `.athena-switching` | `--athena-duration-slow` `--athena-ease-standard` |
|
|
120
|
+
| Page transitions of the router (router({ transition: true })) | - | `--athena-duration-base` `--athena-ease-standard` |
|
|
121
|
+
| Charts draw themselves when they appear: bars grow, lines are drawn, slices pop in (only the first time, not when a chart streams or is zoomed) | `.athena-chart-animated` `.athena-code` `.athena-widget-grid` `.chart-area` `.chart-bar` `.chart-line` `.chart-point` `.chart-slice` `.code-digits-1` `.code-digits-2` `.code-digits-3` `.code-digits-4` `.code-digits-5` `.code-digits-6` `.code-digits-7` `.code-editor` `.code-editor-input` `.code-line` `.code-tab-1` `.code-tab-10` `.code-tab-11` `.code-tab-12` `.code-tab-13` `.code-tab-14` `.code-tab-15` `.code-tab-16` `.code-tab-2` `.code-tab-3` `.code-tab-4` `.code-tab-5` `.code-tab-6` `.code-tab-7` `.code-tab-8` `.code-tab-9` `.code-wrap` `.field` `.has-line-numbers` `.is-dragging` `.is-editable` `.is-failed` `.is-highlighted` `.is-locked` `.is-unknown` `.tok-attribute` `.tok-builtin` `.tok-comment` `.tok-entity` `.tok-function` `.tok-keyword` `.tok-literal` `.tok-meta` `.tok-number` `.tok-operator` `.tok-property` `.tok-punctuation` `.tok-selector` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable` `.widget` `.widget-action` `.widget-actions` `.widget-body` `.widget-handle` `.widget-header` `.widget-note` `.widget-resize` `.widget-resize-e` `.widget-resize-n` `.widget-resize-ne` `.widget-resize-nw` `.widget-resize-s` `.widget-resize-se` `.widget-resize-sw` `.widget-resize-w` `.widget-title` | `--athena-accent` `--athena-accent-fg` `--athena-border` `--athena-border-width` `--athena-duration-fast` `--athena-duration-slow` `--athena-ease-out` `--athena-ease-standard` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` `--athena-shadow` `--athena-surface` `--athena-surface-alt` `--athena-tok-attribute` `--athena-tok-builtin` `--athena-tok-comment` `--athena-tok-entity` `--athena-tok-function` `--athena-tok-keyword` `--athena-tok-literal` `--athena-tok-meta` `--athena-tok-number` `--athena-tok-operator` `--athena-tok-property` `--athena-tok-punctuation` `--athena-tok-selector` `--athena-tok-string` `--athena-tok-tag` `--athena-tok-type` `--athena-tok-variable` `--code-gutter` |
|
|
122
|
+
| A block: the language, a copy button, the code | `.athena-code` `.code-block` `.code-block-copy` `.code-block-header` `.code-find-button` `.code-find-input` | `--athena-bg` `--athena-border-width` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-hover` `--athena-line` `--athena-muted` `--athena-radius` `--athena-surface` |
|
|
123
|
+
| The editor | `.code-completion` `.code-completion-detail` `.code-completions` `.code-editor` `.code-editor-highlight` `.code-editor-input` `.code-editor-scroll` `.code-editor-status` `.code-find` `.code-find-button` `.code-find-count` `.code-find-input` `.code-find-row` `.code-line` `.code-wrap` `.has-line-numbers` `.has-marker` `.is-active` `.is-current` `.is-locked-line` `.is-plain` `.is-readonly` `.marker-error` `.marker-info` `.marker-warning` | `--athena-accent` `--athena-accent-fg` `--athena-bg` `--athena-border` `--athena-border-width` `--athena-danger` `--athena-fg` `--athena-focus` `--athena-focus-width` `--athena-info` `--athena-line` `--athena-muted` `--athena-radius` `--athena-shadow` `--athena-surface` `--athena-surface-alt` `--athena-warning` `--code-completion-left` `--code-completion-top` `--code-editor-max-height` `--code-editor-min-height` `--code-gutter` |
|
|
124
|
+
| The diff view | `.code-diff` `.code-diff-body` `.code-diff-cell` `.code-diff-code` `.code-diff-empty` `.code-diff-header` `.code-diff-mark` `.code-diff-number` `.code-diff-row` `.code-diff-skip` `.code-diff-stat` `.code-line` `.is-added` `.is-empty` `.is-removed` `.is-skip` `.is-split` | `--athena-accent` `--athena-border-width` `--athena-danger` `--athena-line` `--athena-muted` `--athena-radius` `--athena-success` `--athena-surface` |
|