aerolith 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -21,8 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
23
  The rendered sprite images in library/dist/ are covered by the same license.
24
- The fonts in library/dist/fonts/ are not: they are under the SIL Open Font
25
- License 1.1 (Istok Web, Selawik, and Aerolith Display, which is derived from
26
- Istok Web). Their license files are in that folder.
24
+ The fonts in library/dist/fonts/ and fonts/ are not: they are under the SIL
25
+ Open Font License 1.1 (Aerolith Text, which is derived from Selawik, and
26
+ Aerolith Display, which is derived from Istok Web). Their license files are in
27
+ those folders.
27
28
  Bryce is a trademark of its respective owner. This project is not affiliated
28
29
  with or endorsed by it, and contains no part of the Bryce software.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Aerolith
2
2
 
3
- Frutiger Aero for the web. Every button, field, pane, icon and title letter is a Bryce 2 render
3
+ Tactile UI for the web. Every button, field, pane, icon and title letter is a Bryce 2 render
4
4
  (1996), laid over plain HTML elements.
5
5
 
6
6
  **[Live showcase](https://immineal.github.io/aerolith/)** · [npm](https://www.npmjs.com/package/aerolith) · [Changelog](CHANGELOG.md)
@@ -39,7 +39,7 @@ example of every component. Self-hosting: keep `sprites/` and `fonts/` next to `
39
39
  | GitHub Packages | `npm i @immineal/aerolith --registry=https://npm.pkg.github.com` | same |
40
40
  | Composer | `composer require immineal/aerolith` | serve `vendor/immineal/aerolith/library/dist/` |
41
41
  | PyPI | `pip install aerolith` | `aerolith.static_dir()`; Django: add `"aerolith"` to `INSTALLED_APPS` |
42
- | CDN | jsDelivr, unpkg, esm.sh | or `cdn.jsdelivr.net/gh/immineal/aerolith@v1.1.0/library/dist/aerolith.css` |
42
+ | CDN | jsDelivr, unpkg, esm.sh | or `cdn.jsdelivr.net/gh/immineal/aerolith@v1.3.0/library/dist/aerolith.css` |
43
43
 
44
44
  React, Vue, Svelte, Astro: import the CSS once in your entry file and use the classes
45
45
  (`className` in JSX). Content added after load needs `window.Aerolith.init(container)`.
@@ -49,13 +49,13 @@ React, Vue, Svelte, Astro: import the CSS once in your entry file and use the cl
49
49
  | Class | On | States |
50
50
  |---|---|---|
51
51
  | `.aer-button` (+ `.aer-secondary`, `.aer-quiet`; `.aer-s`, `.aer-l`) | `<button>`, `<a>` | hover, pressed, `aria-pressed`, disabled |
52
- | `.aer-iconbtn` (+ `.aer-quiet`) | `<button>` with an `.aer-icon` | hover, pressed |
52
+ | `.aer-iconbtn` (+ `.aer-quiet`) | `<button>` with an `.aer-icon` | hover, pressed, `aria-pressed` (`data-aer-toggle` flips it on click; a heart turns to its outline when off) |
53
53
  | `.aer-icon .aer-icon-<name>` (+ `.aer-s`, `.aer-pearl`) | `<span aria-hidden="true">` | 35 glyphs, 24/16 px |
54
54
  | `.aer-toggle` (+ `.aer-theme`) | `<input type="checkbox" role="switch">` | on, disabled |
55
55
  | `.aer-check`, `.aer-radio` | checkbox, radio | checked, mixed, disabled |
56
56
  | `.aer-field` | `<input>`, `<textarea>`, `<select>` | focus, disabled |
57
57
  | `.aer-select` | wrapper around `select.aer-field` | |
58
- | `.aer-segmented` | radios in labels, or links with `aria-current` | hover, selected |
58
+ | `.aer-segmented` | radios in labels, or links with `aria-current` | hover, selected (slides with the JS) |
59
59
  | `.aer-choice` | `<label>` with a radio or checkbox | hover, checked, focus |
60
60
  | `.aer-drop` | `<label>` with `<input type="file">` | drag-over, focus |
61
61
  | `.aer-progress` | `<progress>` | value |
@@ -67,7 +67,7 @@ React, Vue, Svelte, Astro: import the CSS once in your entry file and use the cl
67
67
  | `.aer-dialog`, `.aer-close` | `<dialog>`, `<button>` | open, backdrop |
68
68
  | `.aer-popover`, `.aer-menu` | `[popover]` | item hover/focus |
69
69
  | `.aer-bar` | `<header>`, `<nav>` | |
70
- | `.aer-lens` | any block | rim refraction in Chromium |
70
+ | `.aer-lens` | any block | rim refraction; `data-aer-drag` makes it movable |
71
71
  | `.aer-compare` | two `<img>` and an `<input type="range">` | |
72
72
  | `.aer-display` (+ `.aer-aqua`, `.aer-glass`, `.aer-pearl`) | any heading | 116 characters |
73
73
 
@@ -81,10 +81,13 @@ React, Vue, Svelte, Astro: import the CSS once in your entry file and use the cl
81
81
 
82
82
  Aerolith Display is a colour font of rendered gel letters, so titles stay real, selectable text.
83
83
  Use it from 32 px up. Each material is about 0.6 MB, loaded only where used. Browsers without
84
- colour fonts show heavy Istok.
84
+ colour fonts show plain heavy letters.
85
85
 
86
- Body text is **Selawik**, an open Segoe UI stand-in. `data-aer-type="istok"` switches to
87
- **Istok Web**. Dark mode follows the system; `data-theme="dark"` or `"light"` on `<html>` forces it,
86
+ Body text is **Aerolith Text**, Selawik (an open Segoe UI stand-in) with a kern table, because Selawik
87
+ ships without kerning. Both fonts are also in [`fonts/`](fonts/) as TTF files for your computer
88
+ ([download](https://github.com/immineal/aerolith/releases/latest/download/aerolith-fonts.zip)).
89
+
90
+ Dark mode follows the system; `data-theme="dark"` or `"light"` on `<html>` forces it,
88
91
  and the sun/moon switch (`input[data-aer-theme]`) sets that for you.
89
92
 
90
93
  ## Accessibility
@@ -130,14 +133,15 @@ Setup: [harness/README.md](harness/README.md). Design rules:
130
133
 
131
134
  - **No colour picker.** Colours are baked into the renders.
132
135
  - **Three heights.** 32, 44 or 56 px; buttons stretch sideways only.
133
- - **The lens bends light only in Chromium.** Firefox and Safari show plain glass.
136
+ - **The lens bends light in Chromium, and in Firefox with `data-aer-lens-backdrop="#el"`** (the
137
+ element behind it). Safari shows plain glass.
134
138
  - **No framework components.** Put the classes on your own elements.
135
139
  - **Bitmap icons and titles.** Icons are 16 and 24 px. Titles are sharp up to about 120 px and
136
140
  cover Latin with German and French accents.
137
141
 
138
142
  ## License
139
143
 
140
- MIT for code and sprites ([LICENSE](LICENSE)). Fonts in `library/dist/fonts/` are SIL OFL 1.1:
141
- Istok Web (Andrey V. Panov) and Selawik (Microsoft) unmodified, Aerolith Display derived from
142
- Istok Web Bold. Bryce is a trademark of its owner; Aerolith is not affiliated and contains no
144
+ MIT for code and sprites ([LICENSE](LICENSE)). The fonts in `library/dist/fonts/` and `fonts/` are
145
+ SIL OFL 1.1: Aerolith Text, derived from Selawik (Microsoft) with a kern table added and renamed
146
+ because the OFL reserves "Selawik"; Aerolith Display, derived from Istok Web Bold (Andrey V. Panov). Bryce is a trademark of its owner; Aerolith is not affiliated and contains no
143
147
  Bryce code.
@@ -21,7 +21,7 @@
21
21
  --aer-target-gap: var(--aer-space-2);
22
22
 
23
23
  /* type: modular scale 1.2 */
24
- --aer-font-ui: "Selawik", "Segoe UI", "Istok Web", "Frutiger", "Myriad Pro", Tahoma, system-ui, sans-serif; /* bundled: type.css */
24
+ --aer-font-ui: "Aerolith Text", "Selawik", "Segoe UI", "Myriad Pro", Tahoma, system-ui, sans-serif; /* bundled: type.css */
25
25
  --aer-font-text: var(--aer-font-ui);
26
26
  --aer-font-mono: "Consolas", "Lucida Console", ui-monospace, monospace;
27
27
  --aer-text-xs: 0.833rem;
@@ -68,6 +68,13 @@
68
68
  /* 10-foot / distance media: scale everything so the visual angle stays comfortable at ~3 m */
69
69
  .aer-distance { font-size: 150%; --aer-control: var(--aer-control-l); }
70
70
 
71
+ /* Chromium on Linux and Windows rounds every glyph advance to whole pixels unless asked for precise
72
+ geometry: a 16 px label came out 1.6 px wider with an open gap after the f in "verfügbar".
73
+ Scoped to our own controls; a host page keeps its own text-rendering. */
74
+ :is(.aer-button, .aer-field, .aer-select, .aer-badge, .aer-segmented, .aer-menu, .aer-label, .aer-option,
75
+ .aer-choice, .aer-check, .aer-radio, .aer-toggle, .aer-panel, .aer-card, .aer-callout, .aer-dialog,
76
+ .aer-popover, .aer-toast) { text-rendering: geometricPrecision; }
77
+
71
78
  /* label text on glossy sprites: white + halo (WCAG measures text against its halo) */
72
79
  .aer-on-gloss {
73
80
  color: var(--aer-on-gloss);
@@ -89,7 +96,7 @@
89
96
  @media (forced-colors: active) {
90
97
  .aer [class*="aer-"] { border-color: ButtonText; }
91
98
  .aer-button, .aer-field, .aer-panel { border: 1px solid ButtonText !important; }
92
- .aer-button:focus-visible { outline: 2px solid Highlight; }
99
+ .aer-button:focus-visible, .aer .aer-field:focus-visible, .aer-field:focus-visible { outline: 2px solid Highlight; }
93
100
  }
94
101
 
95
102
  /* utilities */
@@ -100,28 +107,19 @@
100
107
 
101
108
  /* ---- type.css ---- */
102
109
  /* Aerolith type.
103
- Text: Selawik (default) or Istok Web (data-aer-type="istok"), both bundled, both SIL OFL 1.1.
110
+ Text: Aerolith Text, Selawik with a kern table (renamed because the OFL reserves "Selawik"), SIL OFL 1.1.
104
111
  Titles: Aerolith Display, gel letters rendered in Bryce and packed into colour fonts. Each
105
112
  material comes as OpenType-SVG (Firefox, Safari) and sbix (Chromium); tech() makes a browser
106
113
  download only the file it can draw. The fonts keep outlines, so a browser without colour-font
107
- support still shows the title, in plain heavy Istok. */
108
-
109
- @font-face { font-family: "Istok Web"; src: url(fonts/istok-web-regular.woff2) format("woff2");
110
- font-weight: 400; font-style: normal; font-display: swap; }
111
- @font-face { font-family: "Istok Web"; src: url(fonts/istok-web-italic.woff2) format("woff2");
112
- font-weight: 400; font-style: italic; font-display: swap; }
113
- @font-face { font-family: "Istok Web"; src: url(fonts/istok-web-bold.woff2) format("woff2");
114
- font-weight: 700; font-style: normal; font-display: swap; }
115
- @font-face { font-family: "Istok Web"; src: url(fonts/istok-web-bold-italic.woff2) format("woff2");
116
- font-weight: 700; font-style: italic; font-display: swap; }
114
+ support still shows the title as plain heavy letters. */
117
115
 
118
- @font-face { font-family: "Selawik"; src: url(fonts/selawik-light.woff2) format("woff2");
116
+ @font-face { font-family: "Aerolith Text"; src: url(fonts/aerolith-text-light.woff2) format("woff2");
119
117
  font-weight: 300; font-display: swap; }
120
- @font-face { font-family: "Selawik"; src: url(fonts/selawik-regular.woff2) format("woff2");
118
+ @font-face { font-family: "Aerolith Text"; src: url(fonts/aerolith-text-regular.woff2) format("woff2");
121
119
  font-weight: 400; font-display: swap; }
122
- @font-face { font-family: "Selawik"; src: url(fonts/selawik-semibold.woff2) format("woff2");
120
+ @font-face { font-family: "Aerolith Text"; src: url(fonts/aerolith-text-semibold.woff2) format("woff2");
123
121
  font-weight: 600; font-display: swap; }
124
- @font-face { font-family: "Selawik"; src: url(fonts/selawik-bold.woff2) format("woff2");
122
+ @font-face { font-family: "Aerolith Text"; src: url(fonts/aerolith-text-bold.woff2) format("woff2");
125
123
  font-weight: 700; font-display: swap; }
126
124
 
127
125
  @font-face { font-family: "Aerolith Display Aqua"; font-display: swap;
@@ -137,10 +135,6 @@
137
135
  src: url(fonts/aerolith-display-pearl.svg.woff2) format("woff2") tech(color-SVG),
138
136
  url(fonts/aerolith-display-pearl.bmp.woff2) format("woff2") tech(color-sbix); }
139
137
 
140
- [data-aer-type="istok"], .aer-type-istok {
141
- --aer-font-ui: "Istok Web", "Selawik", "Segoe UI", Tahoma, system-ui, sans-serif;
142
- }
143
-
144
138
  /* Big titles only: the letters are rendered at about 80 px per em and read best from 32 px up.
145
139
  Weight 700 picks the bold text face while the font loads; the colour face itself has one weight and is
146
140
  never synthesised. */
@@ -1454,6 +1448,8 @@
1454
1448
  .aer-field:focus {
1455
1449
  border-image: var(--aer-field-focus) var(--aer-field-focus-slice) / var(--aer-field-focus-border) / var(--aer-field-focus-outset) stretch;
1456
1450
  }
1451
+ /* the rendered aqua rim is the focus indicator: the square outline would cut across the rounded well */
1452
+ .aer .aer-field:focus-visible, .aer-field:focus-visible { outline: none; }
1457
1453
  textarea.aer-field { block-size: auto; min-block-size: calc(var(--aer-control) * 2); padding-block: var(--aer-space-3); resize: vertical; line-height: var(--aer-leading); }
1458
1454
  .aer-field:disabled, .aer-field[readonly] { color: var(--aer-ink-muted); }
1459
1455
  .aer-label { display: grid; gap: var(--aer-space-1); font: 600 var(--aer-text-s) / 1.3 var(--aer-font-ui); color: var(--aer-ink); }
@@ -1597,6 +1593,8 @@ a.aer-card:hover, button.aer-card:hover, .aer-card[data-interactive]:hover {
1597
1593
  --_n: var(--aer-iconbtn-glass-active); --_o: var(--aer-iconbtn-glass-active-outset);
1598
1594
  }
1599
1595
  .aer-iconbtn:disabled { opacity: 0.5; filter: saturate(0.2); cursor: not-allowed; }
1596
+ /* A toggle that is not pressed shows the heart as an outline. */
1597
+ [aria-pressed="false"] > .aer-icon-heart { --_i: 1; }
1600
1598
 
1601
1599
  /* ------------------------------------------------------------------ segmented control / tab bar
1602
1600
  <div class="aer-segmented" role="radiogroup" aria-label="View">
@@ -1629,6 +1627,20 @@ a.aer-card:hover, button.aer-card:hover, .aer-card[data-interactive]:hover {
1629
1627
  }
1630
1628
  .aer-segmented > :has(:focus-visible) { outline: 2px solid var(--aer-focus); outline-offset: 2px; }
1631
1629
  .aer-segmented > :has(:disabled) { opacity: 0.5; cursor: not-allowed; }
1630
+ /* with aerolith.js: one pill carries the chip and slides; the items' own chips give way */
1631
+ .aer-segmented[data-aer-slide] { position: relative; isolation: isolate; }
1632
+ .aer-seg-pill {
1633
+ position: absolute; left: 0; top: 0; z-index: -1; box-sizing: border-box; pointer-events: none;
1634
+ border-style: solid; border-color: transparent; border-width: 0;
1635
+ border-image: var(--aer-seg-chip) var(--aer-seg-chip-slice) / var(--aer-seg-chip-border) / var(--aer-seg-chip-outset) stretch;
1636
+ }
1637
+ .aer-segmented[data-aer-ready] > .aer-seg-pill {
1638
+ transition: transform 300ms cubic-bezier(.3, 1.2, .5, 1), width 300ms cubic-bezier(.3, 1.2, .5, 1);
1639
+ }
1640
+ .aer-segmented[data-aer-slide] > :is(:has(:checked), [aria-current]:not([aria-current="false"]), [aria-selected="true"], [aria-pressed="true"]) {
1641
+ border-image: none;
1642
+ }
1643
+ .aer-segmented[data-aer-ready] > :not(.aer-seg-pill) { transition: color 200ms, text-shadow 200ms; }
1632
1644
 
1633
1645
  /* ------------------------------------------------------------------ choice card: a whole tile is the radio/checkbox
1634
1646
  <label class="aer-choice"><input type="radio" class="aer-radio" name="f"> <b>PDF</b> <small>…</small></label> */
@@ -1826,14 +1838,27 @@ a.aer-card:hover, button.aer-card:hover, .aer-card[data-interactive]:hover {
1826
1838
  }
1827
1839
  .aer-bar > .aer-spacer { flex: 1; }
1828
1840
 
1829
- /* ------------------------------------------------------------------ lens: clear thick glass; in Chromium aerolith.js
1830
- adds the refraction of its rim (an SVG displacement map computed from the same bevel profile) */
1841
+ /* ------------------------------------------------------------------ lens: clear thick glass. aerolith.js adds the
1842
+ refraction of its rim (an SVG displacement map computed from the same bevel profile): in Chromium, and in
1843
+ Firefox when data-aer-lens-backdrop names the element behind it. Safari shows plain glass. */
1831
1844
  .aer-lens {
1832
1845
  position: relative; box-sizing: border-box; padding: var(--aer-space-5);
1833
1846
  border-style: solid; border-color: transparent; border-width: 0;
1834
1847
  border-image: var(--aer-lens) var(--aer-lens-slice) / var(--aer-lens-border) / var(--aer-lens-outset) stretch;
1835
1848
  color: var(--aer-ink);
1836
1849
  }
1850
+ /* with a backdrop copy: copy at the bottom, glass sprite over it, content on top */
1851
+ .aer-lens[data-aer-lens-view] { isolation: isolate; border-image: none; }
1852
+ .aer-lens[data-aer-lens-view]::before {
1853
+ content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
1854
+ border-style: solid; border-color: transparent; border-width: 0;
1855
+ border-image: var(--aer-lens) var(--aer-lens-slice) / var(--aer-lens-border) / var(--aer-lens-outset) stretch;
1856
+ }
1857
+ .aer-lens-view { position: absolute; z-index: -2; overflow: hidden; pointer-events: none; } /* placed by aerolith.js */
1858
+ /* the focus ring follows the glass, not a square box */
1859
+ .aer-lens[data-aer-drag] { border-radius: 24px; }
1860
+ .aer-lens[data-aer-drag] { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
1861
+ .aer-lens[data-aer-dragging] { cursor: grabbing; }
1837
1862
 
1838
1863
  /* ------------------------------------------------------------------ preferences */
1839
1864
  /* ------------------------------------------------------------------ state sprites, fetched up front
@@ -1865,6 +1890,7 @@ a.aer-card, button.aer-card, .aer-card[data-interactive], .aer-close {
1865
1890
  .aer-spinner::before { animation: none; }
1866
1891
  .aer-toggle::before, .aer-progress::-webkit-progress-value { transition: none; }
1867
1892
  .aer-toast, .aer-dialog[open] { animation: none; }
1893
+ .aer-segmented[data-aer-ready] > .aer-seg-pill, .aer-segmented[data-aer-ready] > :not(.aer-seg-pill) { transition: none; }
1868
1894
  }
1869
1895
  /* forced colours: sprites are dropped, native rendering and system colours take over */
1870
1896
  @media (forced-colors: active) {
@@ -1877,6 +1903,7 @@ a.aer-card, button.aer-card, .aer-card[data-interactive], .aer-close {
1877
1903
  background: Highlight; color: HighlightText; forced-color-adjust: none;
1878
1904
  }
1879
1905
  .aer-toggle, .aer-check, .aer-radio { appearance: auto; border-image: none; }
1880
- .aer-toggle::before, .aer-spinner::before, .aer-callout::before { display: none; }
1906
+ .aer-toggle::before, .aer-spinner::before, .aer-callout::before, .aer-seg-pill,
1907
+ .aer-lens::before, .aer-lens-view { display: none; }
1881
1908
  .aer-spinner { border: 3px dotted CanvasText; border-radius: 50%; }
1882
1909
  }
@@ -3,8 +3,11 @@
3
3
  // - slider / compare: keeps --aer-fill in sync with the native range value
4
4
  // - drop zone: [data-aer-over] while files are dragged over an .aer-drop
5
5
  // - theme switch: input[data-aer-theme] toggles <html data-theme> and remembers the choice
6
- // - lens: the rim refraction of .aer-lens (Chromium only: backdrop-filter with an SVG filter)
6
+ // - lens: the rim refraction of .aer-lens (Chromium; Firefox too with data-aer-lens-backdrop);
7
+ // data-aer-drag makes it movable
7
8
  // - menus: popovers drop down from their button; [data-aer-menu] opens one at the pointer
9
+ // - segmented: the selected chip slides between items
10
+ // - toggle: [data-aer-toggle] flips aria-pressed on click (a heart icon inside turns to outline)
8
11
  // - preload: sprites of closed dialogs and popovers load with the page
9
12
  (function () {
10
13
  "use strict";
@@ -36,33 +39,64 @@
36
39
  }
37
40
 
38
41
  // ---------------------------------------------------------------- lens: displacement map from the bevel profile
39
- var lensId = 0, svgRoot = null;
42
+ // Two ways to bend what is behind the rim:
43
+ // - data-aer-lens-backdrop="<selector>": the lens carries a copy of that element, lined up with the
44
+ // original, and bends the copy with filter: url(). Chromium and Firefox.
45
+ // - otherwise, Chromium only: backdrop-filter: url(). Safari shows plain glass either way.
46
+ // data-aer-drag makes the lens movable (pointer, touch, arrow keys) inside its parent.
47
+ var lensId = 0, svgRoot = null, PAD = 2;
48
+ // Lens geometry, same as the rendered sprite (catalog.py): superellipse corners (n = 4) of radius
49
+ // LENS_R, a convex edge 1-(1-t)^4 over LENS_BEVEL px. Light comes straight down, refracts at the
50
+ // curved top and the flat bottom (IOR 1.5), then travels LIFT px to the page under the glass.
51
+ var LENS_R = 32, LENS_BEVEL = 30, GLASS = 20, BASE = 4, LIFT = 24, IOR = 1.5;
52
+ var DISPERSION = [0.9, 1, 1.16]; // red, green, blue: blue bends most
40
53
  function chromium() { return !!(navigator.userAgentData && navigator.userAgentData.brands &&
41
54
  navigator.userAgentData.brands.some(function (b) { return /Chromium/.test(b.brand); })); }
42
- function lensMap(w, h, radius, bevel) {
43
- // height h(d) = smoothstep(d / bevel) of the distance d to the rounded-rect outline; the
44
- // gradient of h, scaled to 0..255 around 128, tells feDisplacementMap how far to bend light
45
- var c = document.createElement("canvas"); c.width = w; c.height = h;
46
- var g = c.getContext("2d"), img = g.createImageData(w, h), px = img.data;
47
- var hx = w / 2, hy = h / 2, r = Math.min(radius, hx, hy);
48
- function height(x, y) {
49
- var qx = Math.abs(x - hx) - (hx - r), qy = Math.abs(y - hy) - (hy - r);
50
- var out = Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - r;
51
- var t = Math.min(Math.max(-out / bevel, 0), 1);
52
- return t * t * (3 - 2 * t);
53
- }
54
- for (var y = 0; y < h; y++) for (var x = 0; x < w; x++) {
55
- var dx = height(x + 1, y + 0.5) - height(x, y + 0.5), dy = height(x + 0.5, y + 1) - height(x + 0.5, y);
56
- var k = bevel * 0.75, i = (y * w + x) * 4;
57
- px[i] = 128 + Math.max(-127, Math.min(127, dx * k * 127));
58
- px[i + 1] = 128 + Math.max(-127, Math.min(127, dy * k * 127));
59
- px[i + 2] = 128; px[i + 3] = 255;
55
+ function bend(d, bevel) { // px of sideways shift at depth d (px in from the outline)
56
+ var t = Math.min(Math.max(d / bevel, 0), 1), u = 1 - t;
57
+ var z = GLASS * (1 - u * u * u * u), slope = GLASS * 4 * u * u * u / bevel;
58
+ var ti = Math.atan(slope), dl = ti - Math.asin(Math.sin(ti) / IOR);
59
+ return (z + BASE) * Math.tan(dl) + LIFT * Math.tan(Math.asin(Math.min(1, IOR * Math.sin(dl))));
60
+ }
61
+ function lensMap(w, h, W, H, q) {
62
+ // W x H map (lens centred) at q px per CSS px. R and G hold the inward shift as a fraction of the
63
+ // largest one (128 = none); returns the map and that largest shift in px. One lookup table, then
64
+ // a few multiplications per pixel: cheap enough to redo on every resize.
65
+ var R = Math.min(LENS_R, w / 2, h / 2), bevel = Math.min(LENS_BEVEL, R);
66
+ var STEP = 16, lut = new Float32Array(Math.ceil(bevel * STEP) + 2), max = bend(0, bevel);
67
+ for (var k = 0; k < lut.length; k++) lut[k] = bend(k / STEP, bevel) / max;
68
+ var cw = Math.round(W * q), ch = Math.round(H * q);
69
+ var c = document.createElement("canvas"); c.width = cw; c.height = ch;
70
+ var g = c.getContext("2d"), img = g.createImageData(cw, ch), px = img.data;
71
+ var hx = w / 2, hy = h / 2, ex = hx - R, ey = hy - R;
72
+ for (var Y = 0; Y < ch; Y++) {
73
+ var y = (Y + 0.5) / q - H / 2, ay = Math.abs(y), qy = ay - ey;
74
+ for (var X = 0; X < cw; X++) {
75
+ var x = (X + 0.5) / q - W / 2, ax = Math.abs(x), qx = ax - ex, d, ux = 0, uy = 0;
76
+ if (qx > 0 && qy > 0) { // corner: superellipse, n = 4
77
+ var x3 = qx * qx * qx, y3 = qy * qy * qy, L = Math.sqrt(Math.sqrt(x3 * qx + y3 * qy));
78
+ d = R - L;
79
+ var gl = Math.hypot(x3, y3); ux = -x3 / gl; uy = -y3 / gl;
80
+ } else if (qx > qy) { d = R - qx; ux = -1; }
81
+ else { d = R - qy; uy = -1; }
82
+ if (x < 0) ux = -ux;
83
+ if (y < 0) uy = -uy;
84
+ var m = 0;
85
+ if (d > 0 && d < bevel) { var f = d * STEP, k0 = f | 0; m = lut[k0] + (lut[k0 + 1] - lut[k0]) * (f - k0); }
86
+ var i = (Y * cw + X) * 4;
87
+ px[i] = 128 + Math.round(127 * m * ux); px[i + 1] = 128 + Math.round(127 * m * uy);
88
+ px[i + 2] = 128; px[i + 3] = 255;
89
+ }
60
90
  }
61
91
  g.putImageData(img, 0, 0);
62
- return c.toDataURL();
92
+ return { url: c.toDataURL(), max: max };
63
93
  }
64
94
  function lens(el) {
65
- if (!chromium()) return;
95
+ if (el.hasAttribute("data-aer-drag")) drag(el);
96
+ // WebKit (Safari, every iOS browser) misplaces SVG filters on HTML: plain glass there
97
+ var sel = el.getAttribute("data-aer-lens-backdrop"), gecko = CSS.supports("-moz-appearance", "none");
98
+ var src = sel && (chromium() || gecko) ? document.querySelector(sel) : null;
99
+ if (!src && !chromium()) return;
66
100
  var NS = "http://www.w3.org/2000/svg";
67
101
  if (!svgRoot) {
68
102
  svgRoot = document.createElementNS(NS, "svg");
@@ -70,34 +104,102 @@
70
104
  svgRoot.style.cssText = "position:absolute;width:0;height:0;overflow:hidden";
71
105
  document.body.appendChild(svgRoot);
72
106
  }
73
- var id = "aer-lens-" + (++lensId), filter = null;
107
+ var id = "aer-lens-" + (++lensId), filter = null, view = null, copy = null, ox = 0, oy = 0;
108
+ if (src) {
109
+ // the copy: same element, same classes, no ids, no lens inside, lined up with the original
110
+ view = document.createElement("div");
111
+ view.className = "aer-lens-view"; view.setAttribute("aria-hidden", "true"); view.inert = true;
112
+ copy = src.cloneNode(true);
113
+ copy.removeAttribute("id");
114
+ copy.querySelectorAll("[id]").forEach(function (n) { n.removeAttribute("id"); });
115
+ copy.querySelectorAll(".aer-lens").forEach(function (n) { n.remove(); });
116
+ view.appendChild(copy);
117
+ el.insertBefore(view, el.firstChild);
118
+ el.setAttribute("data-aer-lens-view", "");
119
+ }
120
+ function sync() { // line the copy up with the original
121
+ if (!copy) return;
122
+ var cs = getComputedStyle(src), a = src.getBoundingClientRect(), b = el.getBoundingClientRect();
123
+ var st = copy.style;
124
+ st.position = "absolute"; st.margin = "0"; st.boxSizing = "border-box"; st.transform = "none"; st.translate = "none";
125
+ st.width = src.offsetWidth + "px"; st.height = src.offsetHeight + "px";
126
+ st.left = (a.left - b.left + ox) + "px"; st.top = (a.top - b.top + oy) + "px";
127
+ ["color", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing"].forEach(function (p) { st[p] = cs[p]; });
128
+ }
74
129
  function build() {
75
130
  var w = Math.round(el.offsetWidth), h = Math.round(el.offsetHeight);
76
131
  if (!w || !h) return;
77
132
  if (filter) filter.remove();
133
+ var pad = view ? PAD : 0, W = w + 2 * pad, H = h + 2 * pad;
134
+ var map = lensMap(w, h, W, H, Math.min(2, window.devicePixelRatio || 1));
135
+ if (view) {
136
+ ox = pad; oy = pad;
137
+ var vs = view.style;
138
+ vs.left = -pad + "px"; vs.top = -pad + "px"; vs.width = W + "px"; vs.height = H + "px";
139
+ }
140
+ // map -> three displacements (red, green, blue bend by different amounts) -> recombined
78
141
  filter = document.createElementNS(NS, "filter");
79
142
  filter.id = id;
80
- ["x", "y"].forEach(function (a) { filter.setAttribute(a, "0"); });
81
- filter.setAttribute("width", w); filter.setAttribute("height", h);
82
- filter.setAttribute("filterUnits", "userSpaceOnUse");
83
- filter.setAttribute("color-interpolation-filters", "sRGB");
84
- var fi = document.createElementNS(NS, "feImage");
85
- fi.setAttribute("href", lensMap(w, h, 24, Math.min(28, w / 4, h / 4)));
86
- fi.setAttribute("x", 0); fi.setAttribute("y", 0); fi.setAttribute("width", w); fi.setAttribute("height", h);
87
- fi.setAttribute("preserveAspectRatio", "none"); fi.setAttribute("result", "map");
88
- var dm = document.createElementNS(NS, "feDisplacementMap");
89
- dm.setAttribute("in", "SourceGraphic"); dm.setAttribute("in2", "map"); dm.setAttribute("scale", "36");
90
- dm.setAttribute("xChannelSelector", "R"); dm.setAttribute("yChannelSelector", "G");
91
- filter.appendChild(fi); filter.appendChild(dm);
143
+ var attrs = { x: 0, y: 0, width: W, height: H, filterUnits: "userSpaceOnUse", primitiveUnits: "userSpaceOnUse",
144
+ "color-interpolation-filters": "sRGB" };
145
+ for (var a in attrs) filter.setAttribute(a, attrs[a]);
146
+ function prim(tag, at) {
147
+ var n = document.createElementNS(NS, tag);
148
+ for (var a in at) n.setAttribute(a, at[a]);
149
+ filter.appendChild(n);
150
+ }
151
+ prim("feImage", { href: map.url, x: 0, y: 0, width: W, height: H, preserveAspectRatio: "none", result: "map" });
152
+ ["r", "g", "b"].forEach(function (ch, k) {
153
+ prim("feDisplacementMap", { in: "SourceGraphic", in2: "map", scale: (2 * map.max * DISPERSION[k]).toFixed(2),
154
+ xChannelSelector: "R", yChannelSelector: "G", result: "d" + ch });
155
+ var m = ["0 0 0 0 0", "0 0 0 0 0", "0 0 0 0 0"]; m[k] = ["1 0 0 0 0", "0 1 0 0 0", "0 0 1 0 0"][k];
156
+ prim("feColorMatrix", { in: "d" + ch, type: "matrix", values: m.join(" ") + " 0 0 0 1 0", result: ch });
157
+ });
158
+ prim("feComposite", { in: "r", in2: "g", operator: "arithmetic", k2: 1, k3: 1, result: "rg" });
159
+ prim("feComposite", { in: "rg", in2: "b", operator: "arithmetic", k2: 1, k3: 1 });
92
160
  svgRoot.appendChild(filter);
93
- el.style.backdropFilter = "url(#" + id + ")";
161
+ if (view) { sync(); view.style.filter = "url(#" + id + ")"; }
162
+ else el.style.backdropFilter = "url(#" + id + ")";
94
163
  el.setAttribute("data-aer-lens", "");
95
164
  }
165
+ el._aerLensSync = sync;
96
166
  build();
97
167
  if (window.ResizeObserver) {
98
168
  var t;
99
169
  new ResizeObserver(function () { clearTimeout(t); t = setTimeout(build, 120); }).observe(el);
170
+ if (src) new ResizeObserver(sync).observe(src);
100
171
  }
172
+ addEventListener("resize", sync);
173
+ }
174
+ function drag(el) {
175
+ var x = 0, y = 0, start = null;
176
+ if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
177
+ function moveTo(nx, ny) {
178
+ var box = el.parentElement.getBoundingClientRect(), r = el.getBoundingClientRect();
179
+ var bx = r.left - x, by = r.top - y; // where it sits without the shift
180
+ x = Math.round(clamp(nx, box.left - bx, box.right - r.width - bx));
181
+ y = Math.round(clamp(ny, box.top - by, box.bottom - r.height - by));
182
+ el.style.translate = x + "px " + y + "px";
183
+ if (el._aerLensSync) el._aerLensSync();
184
+ }
185
+ el.addEventListener("pointerdown", function (e) {
186
+ if (e.button !== 0 || e.target.closest("a, button, input, select, textarea")) return;
187
+ start = { px: e.clientX, py: e.clientY, x: x, y: y };
188
+ el.setPointerCapture(e.pointerId); el.setAttribute("data-aer-dragging", "");
189
+ e.preventDefault();
190
+ });
191
+ el.addEventListener("pointermove", function (e) {
192
+ if (start) moveTo(start.x + e.clientX - start.px, start.y + e.clientY - start.py);
193
+ });
194
+ ["pointerup", "pointercancel", "lostpointercapture"].forEach(function (t) {
195
+ el.addEventListener(t, function () { start = null; el.removeAttribute("data-aer-dragging"); });
196
+ });
197
+ el.addEventListener("keydown", function (e) {
198
+ var d = e.shiftKey ? 40 : 10, k = { ArrowLeft: [-d, 0], ArrowRight: [d, 0], ArrowUp: [0, -d], ArrowDown: [0, d] }[e.key];
199
+ if (!k) return;
200
+ e.preventDefault(); moveTo(x + k[0], y + k[1]);
201
+ });
202
+ if (window.ResizeObserver) new ResizeObserver(function () { moveTo(x, y); }).observe(el.parentElement);
101
203
  }
102
204
 
103
205
  // ---------------------------------------------------------------- menus: placed like a context menu
@@ -198,10 +300,59 @@
198
300
  document.body.appendChild(i);
199
301
  }
200
302
 
303
+ // ---------------------------------------------------------------- segmented: one pill that slides
304
+ // Without this every selected item draws its own chip. With it, one .aer-seg-pill under the items
305
+ // carries the chip and CSS moves it. It follows radio changes, aria-current / -selected / -pressed
306
+ // (MutationObserver), form resets and size changes; a size change snaps instead of sliding.
307
+ function selected(c) {
308
+ var i = c.querySelector("input");
309
+ if (i) return i.checked;
310
+ var a = c.getAttribute("aria-current");
311
+ return (a !== null && a !== "false") || c.getAttribute("aria-selected") === "true" ||
312
+ c.getAttribute("aria-pressed") === "true";
313
+ }
314
+ function slide(seg) {
315
+ var pill = document.createElement("span"), shown = false;
316
+ pill.className = "aer-seg-pill"; pill.setAttribute("aria-hidden", "true");
317
+ seg.appendChild(pill); // last, so a fieldset's legend stays first
318
+ seg.setAttribute("data-aer-slide", "");
319
+ function place(snap) {
320
+ var c = null;
321
+ for (var k = 0; k < seg.children.length; k++) {
322
+ var e = seg.children[k];
323
+ if (e !== pill && selected(e)) { c = e; break; }
324
+ }
325
+ if (!c || !c.offsetWidth) { pill.style.opacity = "0"; shown = false; return; }
326
+ if (snap || !shown) seg.removeAttribute("data-aer-ready");
327
+ pill.style.opacity = "";
328
+ pill.style.transform = "translate(" + c.offsetLeft + "px, " + c.offsetTop + "px)";
329
+ pill.style.width = c.offsetWidth + "px"; pill.style.height = c.offsetHeight + "px";
330
+ if (snap || !shown) { void pill.offsetWidth; seg.setAttribute("data-aer-ready", ""); } // reflow, then animate again
331
+ shown = true;
332
+ }
333
+ seg._aerPlace = place;
334
+ seg.addEventListener("change", function () { place(); });
335
+ if (window.MutationObserver)
336
+ new MutationObserver(function () { place(); }).observe(seg, { subtree: true, attributes: true,
337
+ attributeFilter: ["aria-current", "aria-selected", "aria-pressed"] });
338
+ var form = seg.closest && seg.closest("form");
339
+ if (form) form.addEventListener("reset", function () { setTimeout(place, 0); });
340
+ if (window.ResizeObserver) {
341
+ var ro = new ResizeObserver(function () { place(true); });
342
+ ro.observe(seg);
343
+ for (var k = 0; k < seg.children.length; k++) if (seg.children[k] !== pill) ro.observe(seg.children[k]);
344
+ }
345
+ place(true);
346
+ }
347
+
201
348
  // ---------------------------------------------------------------- init
349
+ // Calling init again re-places the segmented pills, e.g. after setting input.checked from script.
202
350
  function init(root) {
203
351
  root = root || document;
204
352
  preload(root);
353
+ root.querySelectorAll(".aer-segmented").forEach(function (s) {
354
+ if (once(s, "aerSlide")) slide(s); else if (s._aerPlace) s._aerPlace();
355
+ });
205
356
  root.querySelectorAll(".aer-popover[popover]").forEach(function (p) { if (once(p, "aerBound")) bindPopover(p); });
206
357
  root.querySelectorAll("[data-aer-menu]").forEach(function (el) { if (once(el, "aerCtxBound")) bindContext(el); });
207
358
  root.querySelectorAll(".aer-slider > input[type=range], .aer-compare > input[type=range]").forEach(function (input) {
@@ -226,6 +377,13 @@
226
377
  applyTheme(t);
227
378
  });
228
379
  });
380
+ root.querySelectorAll("[data-aer-toggle]").forEach(function (b) {
381
+ if (!once(b, "aerToggle")) return;
382
+ if (!b.hasAttribute("aria-pressed")) b.setAttribute("aria-pressed", "false");
383
+ b.addEventListener("click", function () {
384
+ b.setAttribute("aria-pressed", b.getAttribute("aria-pressed") === "true" ? "false" : "true");
385
+ });
386
+ });
229
387
  root.querySelectorAll(".aer-lens").forEach(function (el) { if (once(el, "aerBound")) lens(el); });
230
388
  }
231
389
 
@@ -1,3 +1,9 @@
1
+ Aerolith Text is derived from Selawik by Microsoft Corporation. A kern table was added and the
2
+ font was renamed; it is a Modified Version under the SIL Open Font License 1.1 below and does not
3
+ use the Reserved Font Name "Selawik".
4
+
5
+ Copyright (c) 2026, Immineal (kern table).
6
+
1
7
  Copyright 2015, Microsoft Corporation (www.microsoft.com), with Reserved Font Name Selawik. All Rights Reserved. Selawik is a trademark of Microsoft Corporation in the United States and/or other countries.
2
8
 
3
9
  This Font Software is licensed under the SIL Open Font License, Version 1.1.
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "aerolith",
3
- "version": "1.1.0",
4
- "description": "Glossy buttons and real glass for the web, in the Frutiger Aero style. Every sprite rendered in Bryce 2 (1996) and laid over plain HTML.",
3
+ "version": "1.3.0",
4
+ "description": "Tactile UI for the web, rendered in Bryce 2 and laid over plain HTML.",
5
5
  "keywords": [
6
- "frutiger-aero", "css", "ui", "ui-library", "design-system", "skeuomorphism", "glassmorphism",
7
- "retro", "y2k", "aero", "bryce", "sprites", "dark-mode", "accessibility", "vanilla-css"
6
+ "tactile", "css", "ui", "ui-library", "design-system", "skeuomorphism", "glassmorphism",
7
+ "retro", "bryce", "sprites", "dark-mode", "accessibility", "vanilla-css"
8
8
  ],
9
9
  "homepage": "https://immineal.github.io/aerolith/",
10
10
  "bugs": "https://github.com/immineal/aerolith/issues",
@@ -1,94 +0,0 @@
1
- Copyright (c) 2008-2012, 2014, Andrey V. Panov (panov@canopus.iacp.dvo.ru),
2
- with Reserved Font Name Istok.
3
-
4
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
5
- This license is copied below, and is also available with a FAQ at:
6
- http://scripts.sil.org/OFL
7
-
8
-
9
- -----------------------------------------------------------
10
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
- -----------------------------------------------------------
12
-
13
- PREAMBLE
14
- The goals of the Open Font License (OFL) are to stimulate worldwide
15
- development of collaborative font projects, to support the font creation
16
- efforts of academic and linguistic communities, and to provide a free and
17
- open framework in which fonts may be shared and improved in partnership
18
- with others.
19
-
20
- The OFL allows the licensed fonts to be used, studied, modified and
21
- redistributed freely as long as they are not sold by themselves. The
22
- fonts, including any derivative works, can be bundled, embedded,
23
- redistributed and/or sold with any software provided that any reserved
24
- names are not used by derivative works. The fonts and derivatives,
25
- however, cannot be released under any other type of license. The
26
- requirement for fonts to remain under this license does not apply
27
- to any document created using the fonts or their derivatives.
28
-
29
- DEFINITIONS
30
- "Font Software" refers to the set of files released by the Copyright
31
- Holder(s) under this license and clearly marked as such. This may
32
- include source files, build scripts and documentation.
33
-
34
- "Reserved Font Name" refers to any names specified as such after the
35
- copyright statement(s).
36
-
37
- "Original Version" refers to the collection of Font Software components as
38
- distributed by the Copyright Holder(s).
39
-
40
- "Modified Version" refers to any derivative made by adding to, deleting,
41
- or substituting -- in part or in whole -- any of the components of the
42
- Original Version, by changing formats or by porting the Font Software to a
43
- new environment.
44
-
45
- "Author" refers to any designer, engineer, programmer, technical
46
- writer or other person who contributed to the Font Software.
47
-
48
- PERMISSION & CONDITIONS
49
- Permission is hereby granted, free of charge, to any person obtaining
50
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
51
- redistribute, and sell modified and unmodified copies of the Font
52
- Software, subject to the following conditions:
53
-
54
- 1) Neither the Font Software nor any of its individual components,
55
- in Original or Modified Versions, may be sold by itself.
56
-
57
- 2) Original or Modified Versions of the Font Software may be bundled,
58
- redistributed and/or sold with any software, provided that each copy
59
- contains the above copyright notice and this license. These can be
60
- included either as stand-alone text files, human-readable headers or
61
- in the appropriate machine-readable metadata fields within text or
62
- binary files as long as those fields can be easily viewed by the user.
63
-
64
- 3) No Modified Version of the Font Software may use the Reserved Font
65
- Name(s) unless explicit written permission is granted by the corresponding
66
- Copyright Holder. This restriction only applies to the primary font name as
67
- presented to the users.
68
-
69
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
- Software shall not be used to promote, endorse or advertise any
71
- Modified Version, except to acknowledge the contribution(s) of the
72
- Copyright Holder(s) and the Author(s) or with their explicit written
73
- permission.
74
-
75
- 5) The Font Software, modified or unmodified, in part or in whole,
76
- must be distributed entirely under this license, and must not be
77
- distributed under any other license. The requirement for fonts to
78
- remain under this license does not apply to any document created
79
- using the Font Software.
80
-
81
- TERMINATION
82
- This license becomes null and void if any of the above conditions are
83
- not met.
84
-
85
- DISCLAIMER
86
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
- OTHER DEALINGS IN THE FONT SOFTWARE.