Dawnline 0.15.0
- The device menu (⋯) is an iOS-style menu on frosted glass: the copy actions show the address they copy, Rename, Reconnect and Remove sit under them, and one highlight glides from row to row - The language picker shows flags; pick a language with a click, or press the pill and slide onto one. The flag and the code change in place - The page's QR code opens as a small card under its button, with Copy link and Share - All dropdowns look and behave the same: frosted glass, one open at a time, and a press outside, Escape or the button again closes them - Setting a device up: when it can't finish connecting or connects but passes no data, the sheet keeps just the status and what it means. No data now says the router drops its traffic because the address doesn't match, and the device's card says "Connected, but no data" right away instead of "Connected" - Setting a phone up from another device: Download and Copy for the connection sit on its row, next to the arrow - On iPhone and iPad the caret shows as soon as a field is focused, the page no longer zooms on a pinch or a double tap, and sheets and their animations run smoother - A press near the edge of a button or a card always counts, even as it shrinks under the pointer - Animations settle without a jump at the end - New green, orange and red - The focus ring shows only while moving around with the keyboard
No files matched your search
@@ -21,11 +21,11 @@ colors:
|
||||
accent: "#4eafff"
|
||||
accent-ink: "#ffffff"
|
||||
accent-soft: "rgba(78, 175, 255, 0.13)"
|
||||
ok: "#57d64b"
|
||||
ok-soft: "rgba(87, 214, 75, 0.14)"
|
||||
warn: "#ff8a3d"
|
||||
bad: "#ff5c5c"
|
||||
bad-soft: "rgba(255, 92, 92, 0.13)"
|
||||
ok: "#30d158"
|
||||
ok-soft: "rgba(48, 209, 88, 0.14)"
|
||||
warn: "#ff8d28"
|
||||
bad: "#ff383c"
|
||||
bad-soft: "rgba(255, 56, 60, 0.13)"
|
||||
selection-bg: "rgba(131, 209, 255, 0.25)"
|
||||
selection-fg: "#64c6ff"
|
||||
scrim: "rgba(8, 8, 8, 0.8)"
|
||||
@@ -44,11 +44,11 @@ colors:
|
||||
light-text-3: "#a6a6a4"
|
||||
light-accent: "#2b9dff"
|
||||
light-accent-soft: "rgba(43, 157, 255, 0.12)"
|
||||
light-ok: "#33a328"
|
||||
light-ok-soft: "rgba(51, 163, 40, 0.12)"
|
||||
light-warn: "#ee6a12"
|
||||
light-bad: "#e5484d"
|
||||
light-bad-soft: "rgba(229, 72, 77, 0.1)"
|
||||
light-ok: "#30d158"
|
||||
light-ok-soft: "rgba(48, 209, 88, 0.12)"
|
||||
light-warn: "#ff8d28"
|
||||
light-bad: "#ff383c"
|
||||
light-bad-soft: "rgba(255, 56, 60, 0.1)"
|
||||
light-selection-bg: "rgba(78, 175, 255, 0.22)"
|
||||
light-selection-fg: "#0a76cf"
|
||||
light-scrim: "rgba(236, 236, 235, 0.62)"
|
||||
@@ -402,7 +402,7 @@ components:
|
||||
height: 44px
|
||||
padding: 0 4px 0 14px
|
||||
update-pill:
|
||||
backgroundColor: "rgba(255, 138, 61, 0.14)"
|
||||
backgroundColor: "rgba(255, 141, 40, 0.14)"
|
||||
textColor: "{colors.warn}"
|
||||
typography: "{typography.pill-label}"
|
||||
rounded: "{rounded.full}"
|
||||
@@ -413,7 +413,7 @@ components:
|
||||
textColor: "{colors.text}"
|
||||
rounded: "{rounded.full}"
|
||||
height: 32px
|
||||
padding: 0 8px 0 12px
|
||||
padding: 0 8px
|
||||
name-chip:
|
||||
backgroundColor: "{colors.field}"
|
||||
typography: "{typography.mono-link}"
|
||||
@@ -432,28 +432,19 @@ components:
|
||||
|
||||
# DESIGN.md — the Dawnline personal portal
|
||||
|
||||
This file describes the **personal portal** (`web/src/portal`, plus the parts of `web/src/shared` it uses): its look, its components and, in its own part, its motion. The admin pages inside LuCI follow `rules/ui-design.md` and the LuCI theme and are not covered here.
|
||||
This file describes how the **personal portal** (`web/src/portal`, plus the parts of `web/src/shared` it uses) looks and moves: its tokens, its components and, in its own part, its motion. The admin pages inside LuCI follow `rules/ui-design.md` and the LuCI theme and are not covered here.
|
||||
|
||||
The front matter follows the [DESIGN.md](https://github.com/google-labs-code/design.md) draft format (alpha). The prose sections come in that format's order. **Motion Design**, **Content & Voice**, **Accessibility**, **Live audit** and **Source map** are extra sections after them.
|
||||
The front matter follows the [DESIGN.md](https://github.com/google-labs-code/design.md) draft format (alpha). The prose sections come in that format's order. **Motion Design**, **Content & Voice** and **Accessibility** are extra sections after them.
|
||||
|
||||
**How this was researched (2026-10-20, Dawnline 0.11.0).** Two passes:
|
||||
The styles live in `web/src/portal/styles` (tokens in `tokens.css`), the motion engine in `web/src/portal/motion.ts`.
|
||||
|
||||
1. **The code.** Every stylesheet in `web/src/portal/styles`, the motion engine (`motion.ts`), every UI module (`ui/`), the page (`page/`) and the flows (`flows/`).
|
||||
2. **The live demo** ([dawnline-demo.vercel.app](https://dawnline-demo.vercel.app), the real portal over an in-page router). I went through every scenario, sheet, menu, picker and button at desktop width (1138 px) and phone width (375 px), in dark and in light, in English and in Russian. A recorder hooked `Element.prototype.animate`, `transitionrun` and `animationstart`, so every duration, delay and easing in this file was seen running, not only read. Spring durations and overshoot were computed from the same function the portal uses (see *Motion → Springs*).
|
||||
|
||||
Where code, older plans and the live page disagree, the live page wins. The disagreements are listed in *Live audit*.
|
||||
**Measured live (2026-10-20, Dawnline 0.11.0)** at desktop width (1138 px) and phone width (375 px), in dark and in light, in English and in Russian. Every duration, delay and easing in this file was seen running, not only read. Spring durations and overshoot come from the same function the portal uses (see *Motion → Springs*). Where code and the live page disagree, the live page wins.
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
The portal is one person's page on a router. It opens from a personal link with no account and no cookie, and it has three jobs:
|
||||
|
||||
- show the person's **devices**;
|
||||
- show their **access** (what it reaches, how much data, until when);
|
||||
- **set up** a new device in about a minute.
|
||||
|
||||
The router serves it as a CGI process under a strict CSP, which forbids inline scripts and `style=` attributes. It is plain TypeScript, with no framework, and it does not poll.
|
||||
The portal is one person's page on a router.
|
||||
|
||||
**Lineage.** The look was approved as a mockup (Oct 2026). It borrows from four places:
|
||||
|
||||
@@ -473,7 +464,8 @@ The router serves it as a CGI process under a strict CSP, which forbids inline s
|
||||
5. **Nothing blinks.** A change happens where it is: text morphs letter by letter, cards glide to their new places, a sheet glides to its new height. A repaint never flashes.
|
||||
6. **Physical, interruptible motion.** Springs are given as stiffness and damping, and each animation starts from where the element stands right now.
|
||||
7. **The keyboard never animates.** Escape closes a sheet or a menu instantly. Reduced motion keeps fades and drops all travel.
|
||||
8. **Honest states.** Paused, out of data, outside the hours, a plain-HTTP link: each is said once, where it matters, in the state's colour.
|
||||
8. **Honest states.** Each state is said once, where it matters, in the state's colour.
|
||||
9. **Cheap to draw on a phone.** Nothing watches the page (no observers): what changes says so. Nothing blurs the page behind a sheet (the scrim only dims); on a touch screen the top fade doesn't blur either. A large block (a fold, an accordion's body, a sheet) fades without a blur, on any screen; letters, icons and small things keep theirs. The page keeps its scale, as an app: no pinch or double-tap zoom.
|
||||
|
||||
---
|
||||
|
||||
@@ -511,9 +503,9 @@ The measured luminance steps are tiny. In dark, raised vs bg is 1.07:1, field vs
|
||||
| `--accent` | `#4eafff` | `#2b9dff` | Primary action, "this device", today, links in hints, the selection ring, a field's caret and selection, a switch that is on |
|
||||
| `--accent-ink` | `#ffffff` | `#ffffff` | Text on a filled accent button, the knob of a switch that is on |
|
||||
| `--accent-soft` | `blue @ 13%` | `blue @ 12%` | Tinted "Connect", the Demo chip, a primary badge's icon tile |
|
||||
| `--ok` / `--ok-soft` | `#57d64b` / 14% | `#33a328` / 12% | Connected, included, the way filling green, the arrival ring |
|
||||
| `--warn` | `#ff8a3d` | `#ee6a12` | Not set up yet, settings changed, outside hours, Reconnect, ends soon, a link that fails (the card's line; the way's can't finish and no data) |
|
||||
| `--bad` / `--bad-soft` | `#ff5c5c` / 13% | `#e5484d` / 10% | Out of data, access ended, Remove, errors |
|
||||
| `--ok` / `--ok-soft` | `#30d158` / 14% | *same* / 12% | Connected, included, the way filling green, the arrival ring |
|
||||
| `--warn` | `#ff8d28` | *same* | Not set up yet, settings changed, outside hours, Reconnect, ends soon, a link that fails (the card's line; the way's can't finish and no data) |
|
||||
| `--bad` / `--bad-soft` | `#ff383c` / 13% | *same* / 10% | Out of data, access ended, Remove, errors |
|
||||
| `--sel-bg` / `--sel-fg` | `rgba(131,209,255,.25)` / `#64c6ff` | `rgba(78,175,255,.22)` / `#0a76cf` | `::selection` |
|
||||
| `--bar` | `text @ 13%` | `text @ 11%` | Chart bars, meter and ring tracks |
|
||||
|
||||
@@ -523,9 +515,9 @@ All tints come from `color-mix`, never from new hex values:
|
||||
|
||||
| Recipe | Where |
|
||||
|---|---|
|
||||
| `color-mix(in srgb, var(--knob), var(--text) 6%)` | hover of knob, soft button, language pill, pinned keys; at rest, the file card's icon and a nested row's soft buttons inside an inset row |
|
||||
| `color-mix(in srgb, var(--knob), var(--text) 6%)` | hover of knob, soft button, language pill; at rest, the file card's icon and a nested row's soft buttons inside an inset row |
|
||||
| `… var(--text) 10%` | pressed or open (`aria-expanded`) knob and language pill |
|
||||
| `… var(--text) 12%` | hover of a nested row's soft buttons inside an inset row (the router's "Configuration" in "Set it up again") |
|
||||
| `… var(--text) 12%` | hover of a nested row's soft buttons inside an inset row |
|
||||
| `color-mix(in srgb, var(--accent) 82%, transparent)` | hover of the filled accent button |
|
||||
| `accent 20%` / `24%` over transparent | hover / active of the tinted button |
|
||||
| `color-mix(in srgb, var(--warn|--bad) 10%, var(--raised))` + `inset 0 0 0 1px tone 22%` | warn / bad notice |
|
||||
@@ -536,11 +528,11 @@ All tints come from `color-mix`, never from new hex values:
|
||||
| `color-mix(in srgb, var(--warn) 14%, transparent)` | the way's router end when the device can't finish (accent 14% while waiting) |
|
||||
| `color-mix(in srgb, var(--accent) 32%, transparent)` inset 1px | ring of the card of "this device" |
|
||||
| `color-mix(in srgb, var(--text) 16%, transparent)` inset 1.5px | focused field |
|
||||
| `color-mix(in srgb, var(--accent) 65%, transparent)` 2px outline, offset 2px | `:focus-visible` everywhere |
|
||||
| `color-mix(in srgb, var(--accent) 65%, transparent)` 2px outline, offset 2px | `:focus-visible`, while the keyboard moves focus (`.kbd`) |
|
||||
|
||||
### Overlays and floating colours
|
||||
|
||||
- **Scrim:** dark `rgba(8,8,8,.8)`, light `rgba(236,236,235,.62)`, both with `backdrop-filter: blur(8px)`.
|
||||
- **Scrim:** dark `rgba(8,8,8,.8)`, light `rgba(236,236,235,.62)`, a dim alone (no backdrop blur).
|
||||
- **Toast and tooltip:** `#232323` on dark. On light they invert to `#0b0b0b` with `#f2f2f1` text.
|
||||
- **QR card:** `#0a0a0a` "night" (light dots) on dark, `#ffffff` "day" (dark dots) on light, with a 1px `--line` rim in light.
|
||||
|
||||
@@ -551,10 +543,10 @@ Glass icons (`ui/glass.ts`) draw a tinted back shape, the same shape blurred beh
|
||||
| Tone | Dark a → b | Light a → b | Used for |
|
||||
|---|---|---|---|
|
||||
| `t-grey` | `#cfcfcd` → `#5a5a59` | `#a9a9a7` → `#3d3d3c` | Device cards (default), access rows, Add |
|
||||
| `t-blue` | `#a6d9ff` → `#1d84e6` | `#7cc4ff` → `#0a6fd6` | This device, first device, kinds, reach tiles that are on, the LAN Bypass row when on, "Set it up again", lock |
|
||||
| `t-green` | `#a8f29c` → `#3aa32c` | `#82e070` → `#2e8a22` | "Everything works" (demo) |
|
||||
| `t-orange` | `#ffc08f` → `#ec6a12` | *same as dark* | Warn notices, Reconnect question |
|
||||
| `t-red` | `#ffadad` → `#dc3a3a` | `#ff9090` → `#c92a2a` | Bad notices, Remove question |
|
||||
| `t-blue` | `#a6d9ff` → `#1d84e6` | `#7cc4ff` → `#0a6fd6` | This device, first device, kinds, reach tiles that are on, the LAN Bypass row when on, lock |
|
||||
| `t-green` | `#a8f29c` → `#30d158` | `#82e070` → `#30d158` | "Everything works" (demo) |
|
||||
| `t-orange` | `#ffc08f` → `#ff8d28` | *same as dark* | Warn notices, Reconnect question |
|
||||
| `t-red` | `#ffadad` → `#ff383c` | `#ff9090` → `#ff383c` | Bad notices, Remove question |
|
||||
|
||||
Frosted pane: dark `--gi-a .58 / --gi-b .14` white with a `.5` rim and no edge stroke. Light uses a `.72 / .5` grey pane, a `.9` rim and an `rgba(0,0,0,.11)` edge, with dark detail strokes.
|
||||
|
||||
@@ -570,8 +562,6 @@ Frosted pane: dark `--gi-a .58 / --gi-b .14` white with a `.5` rim and no edge s
|
||||
| white on bad (Remove) | 3.0 | 3.9 | AA large only |
|
||||
| ok / warn / bad text on raised | 9.9 / 8.0 / 6.2 | **3.3 / 3.1** / 3.9 | dark AA, light below AA at 13 px |
|
||||
|
||||
These ratios feed the findings in *Live audit*.
|
||||
|
||||
---
|
||||
|
||||
## Typography
|
||||
@@ -627,9 +617,9 @@ These ratios feed the findings in *Live audit*.
|
||||
### Page frame
|
||||
|
||||
- `.page`: `max-width: 1072px`, centred. The side gutter is `max(16px, safe-area)`. The top is `40px + safe-area-top` and the bottom `112px`, so the end of the scroll clears the bottom fade.
|
||||
- No navbar. The page opens with a **breadcrumb row**: 32 px high and 32 px above the content. The Dawnline mark sits in a 32 px box (logo 24 px), then `server › person`, then on the right the language pill and the QR knob. Without a server name the place reads "Dawnline". The browser tab title is the place too.
|
||||
- No navbar. The page opens with a **breadcrumb row**: 32 px high and 32 px above the content. The Dawnline mark sits in a 32 px box (logo 24 px), then `server › person`, then on the right the language pill and the QR knob.
|
||||
- **Edge fades** sit above the page and under every overlay:
|
||||
- **top:** 80 px plus the safe area, a `bg → 75% → 0` gradient with `backdrop-filter: blur(12px)`, masked `1 → .88 @44% → 0`. It shows only once `scrollY > 2`, so the breadcrumb at rest stays crisp.
|
||||
- **top:** 80 px plus the safe area, a `bg → 75% → 0` gradient with `backdrop-filter: blur(12px)` (not on a touch screen, where it would be drawn again on every frame of a scroll), masked `1 → .88 @44% → 0`. It shows only once `scrollY > 2`, so the breadcrumb at rest stays crisp.
|
||||
- **bottom:** 96 px, a plain `bg → transparent` gradient interpolated `in oklab`.
|
||||
|
||||
### Columns and order
|
||||
@@ -652,7 +642,7 @@ Other breakpoints and container queries:
|
||||
|
||||
### Single card mode
|
||||
|
||||
When there is nothing else to show (access paused, the link stopped working, the page could not load), the page becomes **one card in the middle of the screen** with the breadcrumb above it.
|
||||
When the page has only one message to show, it becomes **one card in the middle of the screen** with the breadcrumb above it.
|
||||
|
||||
- **The card:** `.gone`, radius 36, padding `32 24 28`, a 56 px glass icon, a 22 px title and a balanced line of text.
|
||||
- **The breadcrumb:** centred on its words, with the mark hanging to their left. It is nudged right by 12 px so mark and words read as centred together.
|
||||
@@ -679,17 +669,17 @@ There is no strict 4/8 grid. The values in use are `2 3 4 5 6 8 10 12 14 16 18 2
|
||||
| Sheet root (scrim + sheet) | 50 |
|
||||
| ⋯ menu | 60 |
|
||||
| Toasts | 70 |
|
||||
| Inside the sheet: ×, pinned keys | 3; their tooltip 4 |
|
||||
| Inside the sheet: × | 3; the connection keys' tooltip 4 |
|
||||
|
||||
### Scroll
|
||||
|
||||
Only the person moves the page: on a phone nothing the page does pulls it up or down under them, and a reload finds it where they left it.
|
||||
Only the person moves the page: on a phone nothing the page does pulls it up or down under them.
|
||||
|
||||
- **No scroll anchoring** (`html { overflow-anchor: none }`). On a phone "Your access" shows above the devices but comes after them in the page, so the browser would hold "Your devices" still while an access row opens or folds, and pull a page scrolled less than the fold to the very top. A row grows and folds in place, and a repaint glides what moves.
|
||||
- **A fold near the foot takes the page down with it** (`holdFoot()` in `page/frame.ts`). Without anchoring, a fold that leaves the page shorter than where it is scrolled would drop it to its new end on the frame the fold is measured. The page body holds the height the scroll needs until the rows' new shape is known, then lets go over 476 ms on EASE_OUT, which never overshoots: the scroll follows the fold down frame by frame and stops at the new foot, not short of it while the row's spring dips.
|
||||
- **A repaint holds the page's height** (`render()` in `main.ts`). The content keeps its height on screen while it is refilled and lets go once everything in it has its styles. Safari lays the page out once with the new cards still empty (each is a size container) and would pull the scroll up to fit that shorter page; a language change empties it all. A page that really got shorter (a removed card) still shrinks after.
|
||||
- **A reload keeps its place.** A phone drops a tab while the visitor is in another app (the VPN app, the App Store) and loads it again on return; a pull to refresh does too. The browser restores the scroll as the page loads, before the router has answered, onto one empty screen, so it would stay at the top. The tab keeps the page's place itself (`sessionStorage`, as the tab is hidden or left), and the first paint of a reload or of a step back onto the page goes there. A fresh visit to the link opens at the top. Each link keeps its own place (several people's links opened in one tab share the origin), and only the page drawn in its place writes one: a tab hidden before the router answered, or showing a card in place of the page, keeps the place it had.
|
||||
- **The sheet's history entry never moves the page** (`scrollRestoration = 'manual'` on that entry only), and it is current only while its sheet is open. Left behind (a reload with a sheet open, a step forward onto it: Safari's swipe in from the right edge), it is stepped back off at once, on load or on that step, so Back from there leaves the page instead of putting it back where it stood when the sheet opened. The page's own entry stays `auto`, so Back and closing a sheet still restore it.
|
||||
- **No scroll anchoring** (`html { overflow-anchor: none }`). A row grows and folds in place, and a repaint glides what moves.
|
||||
- **A fold near the foot takes the page down with it.** The page body holds the height the scroll needs until the rows' new shape is known, then lets go over 476 ms on EASE_OUT, which never overshoots: the scroll follows the fold down frame by frame and stops at the new foot, not short of it while the row's spring dips.
|
||||
- **A repaint holds the page's height.** The content keeps its height on screen while it is refilled and lets go once everything in it has its styles, so the scroll never jumps. A page that really got shorter (a removed card) still shrinks after.
|
||||
- **A reload keeps its place.** A reload or a step back onto the page opens where it was left; a fresh visit opens at the top.
|
||||
- **A sheet never moves the page.** Opening it, closing it or stepping Back from it leaves the page where it stood.
|
||||
- `html { scrollbar-gutter: stable }` and `body.locked { overflow: hidden }` keep the page from shifting sideways when a sheet locks the scroll.
|
||||
|
||||
---
|
||||
@@ -700,7 +690,7 @@ Only the person moves the page: on a phone nothing the page does pulls it up or
|
||||
- **Floating layers get one shadow each:**
|
||||
- `--pop-shadow`: dark `0 18px 48px -14px rgba(0,0,0,.75)`, light `0 18px 44px -14px rgba(0,0,0,.2)`. Used on the ⋯ menu (plus `inset 0 0 0 1px var(--line)`), the toast and the tooltip (plus `0 0 0 1px var(--line-glass)`).
|
||||
- `--sheet-shadow`: dark `0 24px 64px -16px rgba(0,0,0,.6)`, light `… -18px rgba(0,0,0,.22)`. Used on the sheet.
|
||||
- **Scrim:** 80% (dark) or 62% (light) plus an 8 px backdrop blur. The page behind a sheet is out of focus, not just darker.
|
||||
- **Scrim:** 80% (dark) or 62% (light), a dim alone, as the system's own sheets. No backdrop blur: it would be drawn again on every frame the sheet and the dim move.
|
||||
- **Inset rings replace borders.** Every ring is `box-shadow: inset 0 0 0 Npx`:
|
||||
- focus: 1.5 px, `text` at 16%;
|
||||
- picked kind: 1.5 px accent;
|
||||
@@ -724,13 +714,12 @@ Only the person moves the page: on a phone nothing the page does pulls it up or
|
||||
| 22 | Dense QR |
|
||||
| 20 | Accordion row (open, and the shared ends of closed rows), usage block, ⋯ menu, the way |
|
||||
| 18 | Badge, QR in a row, file card |
|
||||
| 16 | Field, segmented track, reach tile, option row, "until" and "hours" blocks; the pinned keys' outer corners |
|
||||
| 16 | Field, segmented track, reach tile, option row, "until" and "hours" blocks |
|
||||
| 14 | Kind tile, link row, menu item and highlight, `.conf` block |
|
||||
| 12 | Go button, segmented pill |
|
||||
| 11 | Ends of the way |
|
||||
| 10 | Name chip, badge icon tile, link row knobs |
|
||||
| 9 | File card icon |
|
||||
| 6 | Inner corners of the joined pinned keys |
|
||||
| 2.5–4 | Chart bars (2.5 month, 3 spark, 3 calendar cells), meter and hours bar, a field's selection wash (4) |
|
||||
| 1 | A field's caret and selection handles |
|
||||
| 999 / 50% | Buttons, pills, chips, toasts, tooltips, the switch / knobs, step numbers, reach marks, the switch's knob, the handles' knobs |
|
||||
@@ -739,7 +728,6 @@ Only the person moves the page: on a phone nothing the page does pulls it up or
|
||||
|
||||
- **Nesting:** inner radius = outer radius − padding. Card 28 − 8 = usage 20. Field 16 − 4 = go button 12. Segmented track 16 − 4 = pill 12.
|
||||
- **Closed accordion rows touch and share rounded ends.** Only the first row's top and the last row's bottom are round. An open row lifts out with 10 px gaps and gets all four corners, and so do its neighbours' facing corners.
|
||||
- **Joined key pairs** (Download | Copy beside ×): `16 6 6 16` and `6 16 16 6`, with a 2 px gap.
|
||||
- **Line icons:** 24 viewBox, `stroke-width 1.8`, round caps and joins, `currentColor`. Shown at 14, 16, 18 or 20 px.
|
||||
- **Glass icons:** 24 viewBox drawn at 22 (rows), 24, 26 (kinds), 28 (reach, option row), 30 (demo rows), 32 (cards), 36 (notices, add), 44 (first), 56 (gone) and 64 (questions).
|
||||
- **QR codes:** round dots (r 0.42, 0.48 when dense), eyes drawn whole as rounded squares (2.6 / 1.8 / 1.5), and the Dawnline mark in a rounded tile at the centre (dense codes have none). Light dots on `#0a0a0a` in dark, dark dots on white in light.
|
||||
@@ -754,9 +742,31 @@ Measurements are CSS pixels, read live at 1138 px and 375 px. Source files are u
|
||||
### Breadcrumb · `page/frame.ts`
|
||||
|
||||
- **Layout:** a 32 px row with `gap 10`. The mark box is 32 × 32 (logo 24). The path is 15/22 `text-2` with `gap 6` and a 14 px chevron; the current crumb is `text` 500 with `aria-current="page"`.
|
||||
- **Language pill** (`.cr-lang`): 32 high, pill, `knob` fill, 14 px 500 language code plus a 14 px chevron that points down and turns up while its menu is open.
|
||||
- **QR knob** (`.cr-qr`): opens "Open on another device".
|
||||
- **Truncation:** the crumbs truncate independently. At 375 px with the demo chip they become "Dawnlin… › U…". See *Live audit*.
|
||||
- **Language pill** (`.cr-lang`, a pick pill: see below): 32 high, pill, `knob` fill, padding `0 8`, gap 6: the language's 16 px flag disc, its 14 px 500 code and a 14 px chevron. Its popup opens under it, 10 px away.
|
||||
- **QR knob** (`.cr-qr`): a knob with the QR icon. It opens into the page's code card where it stands (see below).
|
||||
- **Truncation:** the crumbs truncate independently, each with its own ellipsis.
|
||||
|
||||
### Dropdowns · `ui/drop.ts`, `styles/drop.css`
|
||||
|
||||
The ⋯ menu, the pick pills' popups and the page code card are one kind of thing, and share every setting; each lays out and fills its own.
|
||||
|
||||
- **Glass** (`.drop`): Apple's iOS 26 Liquid Glass, Regular (Figma kit), in `tokens.css` `--glass-*`: on dark black 40% with a white 4% film (the kit's black 60% + white 6% at 67%), on light `rgba(245,245,245,.6)`; backdrop `blur 28, saturate 1.8`; a soft, even 1 px inner edge, no gradient (white 5% / black 4%); a shadow on light only, soft (`0 8 32` black 12%): on dark the edge sets it apart. Its own colours: text `#F5F5F5` / `#1A1A1A`, subtitles `#8A8A8A` / `#727272`, destructive `#FF383C` (`--bad`), separators a touch softer than the edge (white 4% / black 3%); a solid highlight (`raised` + `text` 8% / 11%). Nothing dims around one. Over the page and a sheet alike (z 60).
|
||||
- **Placement:** its nearest point 8 px from its button, under it where it fits, else over it; centred on it, 12 px inside the screen's edge.
|
||||
- **Motion:** in, a spring out of where it grows from (`scale .5, blur 6` on POP, a little overshoot); out, back towards it from where it stands (`scale .7, blur 4`, 110 ms EASE_IN): quicker than it came.
|
||||
- **Highlight** (`ui/glide.ts`): one for all of a dropdown's items (rows, segments), under their icons and words, solid and the same for every item (no tint for Reconnect or Remove), with the corners of what it is on. It fades in (160 ms) where the pointer or the keyboard is, glides from item to item on GLIDE (`spring(640, 40)`, about 2% over: place, size, corners), presses in to 0.97 with what it is on, and fades where the pointer leaves, or goes back to the item it rests on (a pick pill's picked segment, where it starts).
|
||||
- **Shut by:** a press outside it and its button, its button again, Escape (only it: a sheet under it stays; focus goes back to its button), a choice, another dropdown opening (at once), a resize (at once). One at a time; the page holds its repaints while one is open.
|
||||
|
||||
### Pick pill · `ui/pick.ts`
|
||||
|
||||
- **What it is:** a pill showing what is picked (a lead such as a flag or a dot, its words, a 14 px `text-2` chevron) whose popup, a dropdown (see *Dropdowns*), is a row of segments in one pill frame: 3 px padding and gap, segments 34 high, radius 10 (17 at the frame's ends), 12.5 px 500, clear on the glass; the dropdowns' highlight rests on the picked one (it is what says which is picked) and glides to the one pointed at; the picked one and the one pointed at in `glass-text`, the rest `glass-sub`. Its tail (6 high, 20 wide at the base, shoulders leaving the edge level, the tip rounded) points at the pill's middle and is one shape with the frame (a clip path), so the glass runs into it; a soft even edge (`glass-edge`) traces both. The glass's shadow (light only, `--glass-shadow`) is cast by a clear pill under the frame, since the clip path would cut one off the popup; no halo.
|
||||
- **Placement:** as every dropdown's, its tail's tip 8 px from the pill, inside its sheet where it fits; above by default, under where it does not fit (or under first, as the language's). Fixed to the screen (it may open on a sheet), so a wheel, a swipe or Tab shuts it too.
|
||||
- **Picking:** a click opens it and a click picks. Or a quick pick: press the pill, slide onto a segment (it lights as on hover and presses in to 0.96) and let go there; let go anywhere else after sliding and nothing changes. Arrow keys move between segments.
|
||||
- **Motion:** in and out as every dropdown, from the tail's tip. The pill's words morph into the ones picked.
|
||||
- **Flags** (`.flag`): 16 px discs with a 1 px inner hairline; a flag not picked is at 70% until pointed at.
|
||||
|
||||
### Page code card · `flows/page-code.ts`
|
||||
|
||||
- **What it is:** a dropdown (see *Dropdowns*) from the QR knob, scrolling with the page: radius 24, padding 10, gap 8. The page's code (224 px, radius 14: concentric with the card) on top; under it Copy link (36 high, pill, `glass-text` 6% on the glass (11% on hover; Share's knob the same), in `glass-text`, 14 px 500, a 16 px link icon; it says Copied with a check for a moment) and Share (a 36 px knob) where the system has it. No ×. The knob stays where it is.
|
||||
|
||||
### Knob · `styles/controls.css`
|
||||
|
||||
@@ -783,23 +793,23 @@ Measurements are CSS pixels, read live at 1138 px and 375 px. Source files are u
|
||||
|
||||
- **Field:** 48 high, radius 16, `field` fill, padding `0 4 0 16`. The input is 16/24 500 and the placeholder `text-3`. Focus: inset 1.5 px ring at text 16%, on SMOOTH.
|
||||
- **Go button:** 48 × 40, radius 12, at the field's end. Idle: `knob` / `text-3`, `cursor: not-allowed`. Ready: accent / white, the colours changing on SMOOTH. Press `.9`.
|
||||
- Arrow for create, check for save. The field and its go button are the whole form: no label row, no separate Save. Add a device's name field is not a login: no password manager offers itself there (`data-1p-ignore`).
|
||||
- **Caret** (`ui/caret.ts`, on both name fields: Add a device and the name edited on its card): the input's own is hidden (`caret-color: transparent`) and the field draws one as macOS does: accent, 2 × 20, radius 1. It glides to where the next letter goes (see *Motion → Caret and selection*), and a click puts it where clicked at once. It blinks 0.6 s on / 0.6 s off with soft fades, stays solid while typing and blinks again 0.5 s after the last key.
|
||||
- **Selection** (`pointer: fine` only): the native selection is see-through and the text keeps its colour. Under the text sits an accent 26% wash, 22 high, radius 4, with an iOS handle at each end: a 2 × 22 line with a 9 px knob, on top at the start and under it at the end. A selection grows out of the caret and, on collapse, fades in place before its ends rejoin the caret. It never runs past the input's edges, so a long, scrolled name's wash stops before the go button. On a touch screen the system's own selection and handles show, and the caret steps aside while one does.
|
||||
- **What a name may hold** (`shared/name-guard.ts`, both name fields, the admin's too): up to 20 letters of any language (with their marks), digits, spaces and `- _ .` (ordinary words reach about as far as the card's status line), as the router takes it; punctuation, symbols and emoji don't. A character outside that, or a 21st, never gets in: it is turned away as it is typed, pasted or dropped, and the field **shakes** at once, with no request to the router, while the red line under it (`ui/bad-line.ts`, the one the router's refusals use) says why in a few words: "Only letters, digits, - _ ." or "Up to 20 characters." (short enough for a card's status line, where a name edited in place says it). It goes with the next change that gets in. Emptying the field doesn't shake; Return or the go button on an empty name does, as does a name the router or the page refuses (one already taken). Names the page makes up (the kind, the phone's model) are in the page's language, stripped of what doesn't fit and cut to the limit ("Galaxy S24+" → "Galaxy S24").
|
||||
- Arrow for create, check for save. The field and its go button are the whole form: no label row, no separate Save.
|
||||
- **Caret** (`ui/caret.ts`, on name fields, with a mouse or trackpad; a touch screen keeps the system's): the input's own is hidden (`caret-color: transparent`) and the field draws one as macOS does: accent, 2 × 20, radius 1. It glides to where the next letter goes (see *Motion → Caret and selection*), and a click puts it where clicked at once. It blinks 0.6 s on / 0.6 s off with soft fades, stays solid while typing and blinks again 0.5 s after the last key.
|
||||
- **Selection** (`pointer: fine` only): the native selection is see-through and the text keeps its colour. Under the text sits an accent 26% wash, 22 high, radius 4, with an iOS handle at each end: a 2 × 22 line with a 9 px knob, on top at the start and under it at the end. A selection grows out of the caret and, on collapse, fades in place before its ends rejoin the caret. It never runs past the input's edges, so a long, scrolled name's wash stops before the go button. On a touch screen the field draws neither: the system's caret shows (in the accent) with its own selection and handles.
|
||||
- **Refusal:** a refused entry makes the field **shake** at once, while a red line under it (`ui/bad-line.ts`) says why in a few words, short enough for one line.
|
||||
- **Shake** (`shared/shake.ts`): iOS's wrong-passcode shake, a damped swing sideways about four times in 0.52 s (14 px at most, settling by half), linear over its frames. The field's outline goes red with it (a 1.5 px inset ring in `bad`, as the focus ring is drawn), holds 0.7 s and fades back to the ring the field has (focused or not) over 0.8 s on ease-out; another refusal starts it red again. Another one starts from where the field is, never jumping back; only its own animation is touched, so the focus ring's transition goes on. With less motion asked for it doesn't move (the red line or toast still says why).
|
||||
|
||||
### Notice · `page/notices.ts`
|
||||
|
||||
- **Layout:** radius 24, padding `14 18 14 14`, gap 14, a 36 px glass icon, a 15/22 500 title and a 14/20 `text-2` line that adds to the title and never repeats it.
|
||||
- **Tones:** `warn` (orange) for paused, outside hours, server off, no server and ends soon. `bad` (red) for out of data and access ended.
|
||||
- **Placement:** one per page, above the columns, 22 px above them. Paused is not a notice: the whole page becomes the single card.
|
||||
- **Tones:** `warn` (orange) for attention (outside hours, ends soon). `bad` (red) for an end (out of data, access ended).
|
||||
- **Placement:** one per page, above the columns, 22 px above them.
|
||||
- **On a repaint** a notice that comes blurs in, one that goes fades where it stood and one that changes morphs in place, while its slot glides to the new height. The page under it moves instead of jumping.
|
||||
|
||||
### Section head
|
||||
|
||||
- 20/28 500 title with a `text-3` 14 px 500 aside at the baseline: "3 of 4" in the page's numerals, `warn` when the admin let the person go over the limit.
|
||||
- Under the grid sits a `note-s` (13/18 `text-3`) for "You have reached your limit of N devices. Remove one to add another."
|
||||
- 20/28 500 title with a `text-3` 14 px 500 aside at the baseline ("3 of 4", in the page's numerals), `warn` when over the limit.
|
||||
- Under the grid sits a `note-s` (13/18 `text-3`) for the limit note.
|
||||
|
||||
### Device card · `page/devices.ts`
|
||||
|
||||
@@ -809,71 +819,59 @@ Measurements are CSS pixels, read live at 1138 px and 375 px. Source files are u
|
||||
- Top row (padding `8 6 6 10`, gap 12): a 32 px glass icon (blue on "this device", else grey), the name (16/22 500, one line), the status (13/18, one line, full wording in `title`), and the ⋯ knob.
|
||||
- Bottom, one of three:
|
||||
- **Usage** (`field`, radius 20, padding `12 14 12 16`, min-height 66): "Last 7 days" 13/18 `text-2` over the total 17/24 500 tabular. Spark of 7 bars at the right: 6 px wide, gap 4, ≤ 34 px high, min 3, radius 3, `--bar`, today in accent. Hovering a bar puts that day's name and bytes in place of the label and total instantly, with no morph.
|
||||
- **Reconnect** (instead of the week) when the settings changed or no data gets through ("Connected, but no data"): a `tint` block button with the refresh icon. New keys, then the set-up again. Not on a device never set up, a disabled one or a locked page.
|
||||
- **Connect** when never set up: a `tint` block button with the QR icon. It disappears when the admin locked the person.
|
||||
- **Reconnect** (instead of the week): a `tint` block button with the refresh icon.
|
||||
- **Connect**: a `tint` block button with the QR icon.
|
||||
- A status is one line, and Reconnect or Connect takes the week's place. The button is lower than the week (48 against 66), so a card alone in its row is lower too; when its bottom changes, the card glides to its new height (see *Motion → Repaint choreography*).
|
||||
|
||||
**Order:** "this device" first, then online, then seen, then never set up, then disabled (`byDeviceState`). The grid keeps cards in place across repaints and glides them (FLIP).
|
||||
The grid keeps cards in place across repaints and glides them (FLIP).
|
||||
|
||||
**Status line (the full matrix):**
|
||||
**Status line:** one 13/18 line in its state's colour.
|
||||
|
||||
| Condition | Text | Colour |
|
||||
|---|---|---|
|
||||
| Page opened through this device's tunnel | This device | accent (and the card gets the accent ring, the icon turns blue) |
|
||||
| Disabled by the admin | Disabled | text-2, card at 50% opacity |
|
||||
| Settings changed and it has connected before | Settings changed | warn (+ Reconnect) |
|
||||
| Online while out of data | Connected, no data left | warn |
|
||||
| Online outside the hours | Connected, outside your hours | warn |
|
||||
| Its link fails in a named way (the router's watcher held it 3 min) | Can't finish connecting · Connected, but no data · On two devices at once · Connection keeps dropping; why in `title` ("It reaches the router, but the connection never completes. The network may be blocking it.") and, for a screen reader, in hidden text right after the status | warn (+ Reconnect for "Connected, but no data") |
|
||||
| Online | Connected | ok |
|
||||
| Never connected | Not set up yet | warn (+ Connect) |
|
||||
| Otherwise | Last connected 3 h ago (exact time in `title`) | text-2 |
|
||||
| Look | Colour |
|
||||
|---|---|
|
||||
| This device | accent; the card gets the accent ring and the icon turns blue |
|
||||
| Connected | ok |
|
||||
| Attention (settings changed, outside hours, no data left, a link that fails, not set up yet) | warn, with Reconnect or Connect in the bottom where one applies |
|
||||
| At rest ("Last connected 3 h ago", the exact time in `title`) | text-2 |
|
||||
| Disabled | text-2, the card at 50% opacity |
|
||||
|
||||
**Menu items** (⋯):
|
||||
A longer reason sits in `title` and, for a screen reader, in hidden text right after the status.
|
||||
|
||||
- **Copy IP address** and **Copy local address**, only where the home network can reach the device;
|
||||
- a separator;
|
||||
- **Rename**;
|
||||
- **Reconnect** (warn tone);
|
||||
- **Remove** (bad tone).
|
||||
**Rename on the card** (`flows/rename.ts`): the name is where it is changed.
|
||||
|
||||
A disabled device has no Rename, Reconnect or Remove. A locked page has no ⋯ at all.
|
||||
- **At rest:** an editable name is a button. Under the pointer a faint wash (`raised` + text 6%, radius 8) hugs its words.
|
||||
- **Editing:** the name gives way to its own input in the same font and place, with no frame or fill: only the field's caret and selection (the name selected). The status line morphs to a hint in `text-2`.
|
||||
- **Saving:** the words shimmer (see *Motion → Shimmer*), settle to solid, and the status morphs back from the hint, words and colour.
|
||||
- **Cancelling:** the name it had comes back; the status turns back.
|
||||
- **Refusal:** the words shake (no red ring here, the field has none) and the status line says why in `bad`, in its one line, in full on hover.
|
||||
|
||||
**Rename on the card** (`flows/rename.ts`): the name is where it is changed. A name the person may change (not a disabled device, not a locked page) is a button: under the pointer a faint wash (`raised` + text 6%, radius 8) hugs its words, a click, Return or Space edits it, as **Rename** in the ⋯ menu does. Editing, the name gives way to its own input in the same font and place, with no frame or fill: only the field's caret and selection (the name selected). The status line morphs to "Return to save, Esc to cancel" in `text-2` where there is a keyboard (a touch screen's Done key saves; there it stays as it was).
|
||||
|
||||
- **Return** saves: the words shimmer while the router answers (see *Motion → Shimmer*), settle to solid, and the card is drawn again with the new name, the status morphing back from the hint, words and colour.
|
||||
- **Esc or a click away** puts the name it had back, whatever was typed; the status turns back.
|
||||
- **What it won't take** never gets in (see *Field → What a name may hold*): the words shake (no red ring here, the field has none) and the status line says why in `bad`, short enough for its one line ("Only letters, digits, - _ ."). An empty name ("Give the device a name.") and one another device of theirs has ("That name is taken.") are said here before asking the router; a refusal of the router's own says the same way, in full on hover. Typing again brings the hint back.
|
||||
- The page isn't drawn again under a name being edited.
|
||||
- **Focus.** The input takes focus in the same turn as the click, the key or the menu's item (iOS raises its keyboard only for a focus made inside the tap), with the whole name selected at once and again a frame later if iOS dropped it. Return (the screen's Done key too) and Esc give focus back to the name, the new one after a save, without its focus ring (that shows only when Tab brings focus there); a click or tap away leaves it where it went. Focus leaving for somewhere else in the page (Tab, iPad's hide-keyboard key) lets the edit go like a click away; leaving the window (another app or tab) keeps it.
|
||||
|
||||
**Add card:** a `button.dev.add`, min-height 144, centred, grey glass plus 36 and "Add device" in `text-2` 500. Hover raised + knob 45%, press `.98`. Gone when no slot is free or the page is locked.
|
||||
**Add card:** a `button.dev.add`, min-height 144, centred, grey glass plus 36 and "Add device" in `text-2` 500. Hover raised + knob 45%, press `.98`.
|
||||
|
||||
**First card** (no devices yet):
|
||||
|
||||
- spans the grid, padding `28 24 24`;
|
||||
- blue glass plus 44, "Add your first device" 18/24 500;
|
||||
- one balanced 14/20 line (max 34ch);
|
||||
- an accent block button, max 320: "Add this phone" on mobile, "Add this device" otherwise.
|
||||
- an accent block button, max 320.
|
||||
|
||||
### Accordion · `ui/accordion.ts`
|
||||
|
||||
- **Row:** `raised`, padding `0 8`. Head 52 high, gap 10, with a 22 px glass icon, a 15/22 500 title (ellipsis), an optional chip, an optional value at the end (14 px `text-2`) and a 16 px chevron (pointing down, rotated 90°, and up when open).
|
||||
- **Body:** padding `0 8 16 40` (inset rows `0 8 16 8`), column, gap 12.
|
||||
- **One row open at a time.** A **still** row (nothing to open) has no chevron, no hover and no click.
|
||||
- **A row inside a row** (the router's "Configuration" inside "Set it up again") keeps its own state: the open look (chevron, body, `valHide`) keys on the row's own head and body only.
|
||||
- **A row inside a row** has its own open look (chevron, body, `valHide`), apart from the row around it.
|
||||
- **`valHide`:** a row whose body shows the same numbers drops its head value while open (blur, fade, slide 8 px right).
|
||||
- **Inset variant** (inside the sheet): rows on `field`, hover field + knob 50%. Inside them the app picker and badges step up to knob 65% over field, and a badge's hover goes to `knob`. The router's file step inside one steps up the same way: the file card and an inset row inside the row on knob 65% over field (that row's hover `knob`, the `.conf` it opens on `knob`), the card's icon and that row's soft buttons on knob + text 6% (hover 12%).
|
||||
- **Inset variant** (inside the sheet): rows on `field`, hover field + knob 50%. Inside them the app picker and badges step up to knob 65% over field, and a badge's hover goes to `knob`. A file step inside one steps up the same way: the file card and an inset row inside the row on knob 65% over field (that row's hover `knob`, the `.conf` it opens on `knob`), the card's icon and that row's soft buttons on knob + text 6% (hover 12%).
|
||||
|
||||
### "Your access" rows · `page/access.ts`
|
||||
|
||||
| Row | Head | Body |
|
||||
|---|---|---|
|
||||
| **What it reaches** (shield, home or globe glass) | "Home network + Internet" / "Internet" / "Home network" | Two **reach tiles** (radius 16, `field`, padding `12 12 12 14`, glass 28, title 14/20 500, sub 12/16; a 20 px round mark at the top right: ok-soft check or knob minus, the tile dimmed when off). Then a sentence with the hostname pattern in mono, and **name chips** (32 high, radius 10, mono 13, the domain part in `text-3`, a copy icon 14; a click copies). |
|
||||
| **Data this month** (chart glass; "Data used" for a total limit) | A 16 px **ring** (track `--bar`, arc accent, warn ≥ 90%, bad ≥ 100%) and "38.6 GB / 100 GB" or "· no limit"; hidden while open | The **month**: one bar per day (flex, gap 3, 64 high, radius 2.5, min 3; days to come at 45% bar; today accent), an axis 11 px `text-3` with "Today" in accent under its bar (the month's ends hide when it comes close), the total line ("38.6 GB used" / "61.4 GB left", `bad` when out), a 6 px **meter** (same tone thresholds), and a `.desc` about the reset. Hovering a bar puts "X on 13 Oct" in place of the total instantly. |
|
||||
| **Access until** (calendar glass) | "30 Nov" plus "42 days" in ok, warn when soon, or "ended" in bad | The **until block** (`field`, radius 16, padding `14 16`): the days left as a 36/40 600 number (warn when soon), "days left", "Ends Mon 30 Nov" in `text-3`, and a **calendar** of the weeks to the end. 7 columns of 10 px cells with gap 5 and radius 3: past at text 5%, left at text 16%, today in accent, the last day ringed 1.5 px accent; warn colours when soon. Under it the **hours bar** when set: 8 px track, the allowed window in ok 70%, a 2 × 16 "now" marker (`text`, warn when outside, with a 2 px field ring), and axis 00/06/12/18/24 at 10 px. Without an end date and hours, the row is still. |
|
||||
| **What it reaches** (shield, home or globe glass) | Title only | Two **reach tiles** (radius 16, `field`, padding `12 12 12 14`, glass 28, title 14/20 500, sub 12/16; a 20 px round mark at the top right: ok-soft check or knob minus, the tile dimmed when off). Then a sentence with the hostname pattern in mono, and **name chips** (32 high, radius 10, mono 13, the domain part in `text-3`, a copy icon 14). |
|
||||
| **Data this month** (chart glass) | A 16 px **ring** (track `--bar`, arc accent, warn ≥ 90%, bad ≥ 100%) and "38.6 GB / 100 GB"; hidden while open | The **month**: one bar per day (flex, gap 3, 64 high, radius 2.5, min 3; days to come at 45% bar; today accent), an axis 11 px `text-3` with "Today" in accent under its bar (the month's ends hide when it comes close), the total line (`bad` when out), a 6 px **meter** (same tone thresholds), and a `.desc`. Hovering a bar puts that day's total in place of the total instantly. |
|
||||
| **Access until** (calendar glass) | "30 Nov" plus "42 days" in ok, warn when soon, or "ended" in bad | The **until block** (`field`, radius 16, padding `14 16`): the days left as a 36/40 600 number (warn when soon), "days left", the end date in `text-3`, and a **calendar** of the weeks to the end. 7 columns of 10 px cells with gap 5 and radius 3: past at text 5%, left at text 16%, today in accent, the last day ringed 1.5 px accent; warn colours when soon. Under it the **hours bar**: 8 px track, the allowed window in ok 70%, a 2 × 16 "now" marker (`text`, warn when outside, with a 2 px field ring), and axis 00/06/12/18/24 at 10 px. With nothing to open, the row is still. |
|
||||
|
||||
The data row is open by default. A repaint keeps the rows on the page and changes what they hold in place, the same row open (see *Motion → Repaint choreography*). Only rows of another shape (an end date set or taken away) are built afresh.
|
||||
A repaint keeps the rows on the page and changes what they hold in place, the same row open (see *Motion → Repaint choreography*).
|
||||
|
||||
### Sheet · `ui/sheet.ts`
|
||||
|
||||
@@ -884,7 +882,7 @@ The data row is open by default. A repaint keeps the rows on the page and change
|
||||
| < 760 | **Drawer** floating 16 px from the left, right and bottom edges (plus safe areas), max-width 400, max-height `100% − 32 − safe areas` |
|
||||
| ≥ 760 | **Dialog** centred by flex layout (not a transform, so text stays on the pixel grid), width `100% − gutters`, max-width 400 |
|
||||
|
||||
**Width plan.** On a computer the sheet widens for a dense QR code (an AmneziaVPN key) until the code gets about **3.2 px per module** (+80 px padding), capped by the viewport. Live: 400 → 448 for a key, 400 → 410–422 for a `.conf`. It then scrolls the code fully into view.
|
||||
**Width plan.** On a computer the sheet widens for a dense QR code until the code gets about **3.2 px per module** (+80 px padding), capped by the viewport. Live: 400 → 448 for a key, 400 → 410–422 for a `.conf`. It then scrolls the code fully into view.
|
||||
|
||||
**Inside:**
|
||||
|
||||
@@ -892,20 +890,17 @@ The data row is open by default. A repaint keeps the rows on the page and change
|
||||
- **Pinned keys:** a view's own buttons, pinned at top 22 / right 58.
|
||||
- **View:** padding `0 24 24`.
|
||||
- **View head** (`.vhead`): 76 high. Title 20/28 500, centred with a Back knob inside a flow. The head is the drag handle, with `touch-action: none` and a grab cursor.
|
||||
- **Sub line:** 14/20 `text-2`, pulled up 16 px under the head. In the set-up sheet it shows only while waiting (see *Set-up sheet → Around the way*).
|
||||
- **Sub line:** 14/20 `text-2`, pulled up 16 px under the head.
|
||||
|
||||
**Behaviour:**
|
||||
**Movement:**
|
||||
|
||||
- **Views stack.** `go()` pushes and `back()` pops. The sheet glides to each view's height.
|
||||
- **Closes by:** ×, the scrim, Escape (instant), the phone's back button (the sheet is a history entry), or a pull down on its head. Focus returns to the opener.
|
||||
- **A double click** that opened it: clicks in the sheet are ignored for 320 ms, so its second half neither closes it nor answers its question.
|
||||
- **A flow that comes while it closes** (an answer after Cancel) opens once it is gone. Escape while it closes ends it at once, and nothing opens after it.
|
||||
- **Labels:** `role="dialog"` named by the view title, or `alertdialog` for questions.
|
||||
- **Views stack.** The sheet glides to each view's height.
|
||||
- **Closes by:** ×, the scrim, Escape (instant), the phone's back button, or a pull down on its head.
|
||||
- **A sheet asked for while one closes** opens once it is gone. Escape while it closes ends it at once.
|
||||
|
||||
**Pinned keys** (`.hpill`, a phone or tablet set up from elsewhere): Download and Copy for the picked app's config, each 38 × 32, joined.
|
||||
**Connection keys** (`.hpill`): Download and Copy on the connection's row, beside its chevron, while the row is open (they fade in with a blur as it opens, the title making room, and go as it shuts): quiet 32 px circles, the icon 16 px in the chevron's `text-2`, a `knob` circle behind one under the pointer, its icon up to `text`.
|
||||
|
||||
- **Tooltip:** one 26 px pill in toast colours under the keys. It appears after 420 ms of hover, then follows the pointer (or Tab) from key to key at once, gliding from where it stands, and says "Copied" after a copy. Back on a key while it still fades out, it turns back from there.
|
||||
- **On arrival:** when the device connects, × and the keys step away (`settle()`, `.arrived`). If it leaves that state (no data after all, or gone again) they come back (`settle(false)`).
|
||||
|
||||
**Question view** (`.ask`: Reconnect, Remove):
|
||||
|
||||
@@ -914,50 +909,47 @@ The data row is open by default. A repaint keeps the rows on the page and change
|
||||
- two equal buttons: **Cancel** (soft) and the action (accent for Reconnect, red for Remove);
|
||||
- no × beside them.
|
||||
|
||||
**Secure view** (plain HTTP): centred lock glass, "Open securely" (accent, a link to the HTTPS twin in the same tab), and an honest note about the router's own certificate.
|
||||
**Secure view:** centred lock glass, an accent "Open securely" button and a short note.
|
||||
|
||||
### ⋯ Menu · `ui/menu.ts`
|
||||
|
||||
**Panel:** `position: fixed`, min-width 224, padding 6, radius 20, `field` fill, `--pop-shadow` plus an inner 1 px `--line`.
|
||||
Apple's iOS 26 menu (Figma kit, "Menu – iPhone"), made compact: smaller type and tighter rows.
|
||||
|
||||
**Items:** 40 high, radius 14, padding `0 12`, gap 12, 14 px 500, a 16 px icon in `text-2`. Tones: `warn` (Reconnect) and `bad` (Remove) colour both text and icon. Separators are a 1 px line with `6 12` margin, kept only between items.
|
||||
**Surface:** a dropdown (see *Dropdowns*): at least 210 wide, radius 24, padding `6 0`.
|
||||
|
||||
**Highlight:** one `knob` pill behind the items that **glides** after the pointer and takes the item's tone (`bad-soft`, `warn 13%`).
|
||||
**Rows**, 6 px in, in groups (copy actions, then Rename, Reconnect, Remove): 8 px above and below the words (34 high, 50 with a line under the label), radius 18 (concentric); the icon 14 px in from the rounded edge, more than the 10 px from it to the words, so it doesn't crowd the curve; 12 px at the right end: a 16 px icon, a 14 px 400 label (line 18) and an 11.5 px subtitle under it where the item has one (the address it copies, tabular figures), 1 px apart. Reconnect `warn`, Remove destructive.
|
||||
|
||||
**Options:** an option list (language) shows a check on the current item and keeps an invisible check on the others so the names line up.
|
||||
**Separators** between groups: 13 px high, their 1 px line 16 px in from the edge.
|
||||
|
||||
**Placement:** under its button, right-aligned, 8 px away, or above it where the screen ends. It grows out of the button's corner.
|
||||
**Highlight:** the dropdowns' (see *Dropdowns*), radius 18 on a row. The row under it grows its icon to 1.08 on the same spring; a press takes the row to 0.97.
|
||||
|
||||
**Closes on:** a press outside, scroll, Escape (instant), its button again, or another menu opening.
|
||||
**Motion and shutting:** as every dropdown's, growing from the knob's side.
|
||||
|
||||
### Toast · `ui/feedback.ts`
|
||||
|
||||
- Bottom centre, `24px + safe-area` from the bottom, one at a time; a new one replaces the shown one.
|
||||
- 42 high pill, padding `0 18 0 13`, 14 px 500, an 18 px icon (check in ok, alert in bad).
|
||||
- 2.4 s on screen. Used for every result and every failure ("Device removed", "Address copied", an error message).
|
||||
- 2.4 s on screen. Used for every result and every failure.
|
||||
|
||||
### App picker · `ui/seg.ts`
|
||||
|
||||
- **Track:** 48 high, radius 16, `field`, padding `0 4`.
|
||||
- **Items:** icons only (20 px) at 56 px each. The picked item takes the remaining width (`flex-grow`) and shows its name.
|
||||
- **Pill:** 40 px, radius 12. It stretches like skiper21's tabs: the leading edge reaches the new item first and the trailing edge follows.
|
||||
- **Pill:** 40 px, radius 12. It stretches like skiper21's tabs: the leading edge reaches the new item first and the trailing edge follows. At rest it sits on its item by layout alone (4 px and the items before it on the left, the items after it on the right, each 56 or 44 px), so the sheet changing width carries it along with nothing watching.
|
||||
- **Item colours:** idle `text-3`, hover `text-2`, picked `text`.
|
||||
- **Apps by disguise:** AmneziaVPN and AmneziaWG, plus WireGuard only when the server's disguise is off. Routers never get AmneziaVPN. The last app picked per device is remembered in `localStorage`.
|
||||
|
||||
### Kinds picker · `flows/add.ts`
|
||||
|
||||
- **Tiles:** four in a grid (`--n` columns, gap 8): PC, Mobile (phones and tablets are one choice), Router, Other. Each is 56 high, radius 14, `field`.
|
||||
- **Tiles:** four in a grid (`--n` columns, gap 8): PC, Mobile, Router, Other. Each is 56 high, radius 14, `field`.
|
||||
- **Icons and labels:** a 26 px blue glass icon, greyscale at 55% opacity until picked. The label sits under the tile at 12/16 500.
|
||||
- **Picked:** the tile gets an inset 1.5 px accent ring **in place**, without travelling between tiles. Hover → `knob`, press `.94`.
|
||||
- **Defaults:** the kind and the name are guessed from the browser (iPhone, iPad, a Samsung model through Client Hints, Mac, Windows PC…), deduplicated with " 2", " 3".
|
||||
- **Back from "Add it from the device"** brings the view back as they left it: the kind, LAN Bypass and a name they typed.
|
||||
- **Under them:** the LAN Bypass option row, 16 px under the kinds and 12 px above the name field (see *Option row*). No note sits between them any more (the packet-size note is gone).
|
||||
- **Under them:** the option row, 16 px under the kinds and 12 px above the name field (see *Option row*).
|
||||
|
||||
### Option row and switch · `.swrow`, `.sw` (`flows/add.ts`)
|
||||
|
||||
One choice with a switch: Add a device's **LAN Bypass** ("Your local network stays reachable while connected."). Off by default. With home and internet access, switching it on unfolds a third line, "Except 192.168.1.x: those addresses lead to the home network." (the server's home networks, `server.home`; a /24 reads as "x"): height, opacity and blur on SMOOTH from where the line is, so flicking the switch never snaps, and the row, what follows and the sheet ride along. The admin's drawer says the same ("On, except 192.168.1.x (home)"), and Health warns when a home network is one of the common out-of-the-box subnets. After the device is added it stays as chosen: the admin's drawer shows it ("set when it was added"), and neither the portal nor the admin UI changes it.
|
||||
One choice with a switch (Add a device's **LAN Bypass**). A line that unfolds under the words when it is switched on runs height, opacity and blur on SMOOTH from where the line is, so flicking the switch never snaps, and the row, what follows and the sheet ride along.
|
||||
|
||||
- **Row:** the whole row is the switch (`button role="switch"`, `aria-checked`). `field` on the raised sheet, radius 16, padding `12 12 12 14`, gap 12.
|
||||
- **Row:** the whole row is the switch. `field` on the raised sheet, radius 16, padding `12 12 12 14`, gap 12.
|
||||
- **Icon:** the `lan` glass at 28 px, blue. Grey while off (`grayscale(1)` at 55% opacity), on SMOOTH.
|
||||
- **Words:** the title 15/22 500 −0.015em over a 13/18 `text-2` line, gap 1.
|
||||
- **Hover:** field + knob 50% over 200 ms. **No press shrink.**
|
||||
@@ -968,81 +960,64 @@ One choice with a switch: Add a device's **LAN Bypass** ("Your local network sta
|
||||
- 60 high, radius 18, `field`, padding `0 14 0 12`, gap 12.
|
||||
- A 36 px icon tile, radius 10, **inverted** (`text` fill, `raised` mark).
|
||||
- Two lines: top 12/16 `text-2`, main 15/20 500.
|
||||
- A 16 px trailing mark: chevron for an action, "open" for a store page in a new tab.
|
||||
- `.primary` (the one thing to tap in step 2): the icon tile is accent-soft / accent.
|
||||
- `.badges2`: two side by side (Android's Google Play beside the APK), no trailing mark.
|
||||
- Inside an inset row (the steps on the device itself folded into "Set it up again"): knob 65% over field, hover `knob`, one step above the row.
|
||||
- A 16 px trailing mark: chevron for an action, "open" for a page in a new tab.
|
||||
- `.primary` (the one thing to tap in a step): the icon tile is accent-soft / accent.
|
||||
- `.badges2`: two side by side, no trailing mark.
|
||||
- Inside an inset row: knob 65% over field, hover `knob`, one step above the row.
|
||||
|
||||
### Set-up sheet · `flows/setup-view.ts`
|
||||
|
||||
The layout follows where the page is open:
|
||||
|
||||
| Layout | When | Content |
|
||||
|---|---|---|
|
||||
| `same` | The page is on the device being set up (another device, a TV or a box, when the page came from its own set-up link) | "Not on the X right now?" inset accordion (opening it folds the steps away), then **1 Get <app>** (picker + store badge) and **2 Add the connection** (primary badge: a vpn:// link, the share sheet, a key to copy or a file to download, plus a "how to" path) |
|
||||
| `away` | A phone or tablet set up from elsewhere | Inset accordion: "Open your link on the phone" (QR of the set-up link + link row) / "Already has the app" (picker + the connection as a QR + scan line; where the key or the configuration is too long for a code, the set-up link's code and one line saying so instead, in the picked app's words), open by default; pinned Download / Copy keys |
|
||||
| `pc-away` | A computer set up from elsewhere, or another device (TV, box, NAS) added from a phone | "Open your link on the computer" / "Copy or save the connection" (picker + two small soft buttons) |
|
||||
| `router` | A router | **1 Get AmneziaWG on the router** (OpenWrt packages badge), **2 Import the configuration** (file card with Download / Share, plus a "Configuration" inset row with Show key / Copy and the `.conf`, keys masked) |
|
||||
**Structure.** The way sits on top, 18 px above what is under it. Under it come numbered steps, inset accordion rows, or both. A row holds what a step would: a QR with its link row, the app picker with a code and its scan line, small soft buttons, or a file card with a nested inset row for the `.conf`. Pinned Download / Copy keys sit in the head where the view has them.
|
||||
|
||||
**Steps:** a 24 px round number (knob, 13 px 600), a 16/24 500 title and a body with gap 10. Steps sit 20 px apart.
|
||||
|
||||
**"How to" path:** `Open AmneziaWG › + › Import Tunnel(s) from File…` in 13 px `text-2`, the app's own words in `text` 500, quoted verbatim from each app in each language.
|
||||
**"How to" path:** `Open AmneziaWG › + › Import Tunnel(s) from File…` in 13 px `text-2`, the app's own words in `text` 500.
|
||||
|
||||
**Scan line:** "In WireGuard: + › Create from QR code". Where iOS and Android name a step differently, that word alternates every 3 s, with the or Android mark beside it.
|
||||
|
||||
**The way** (waiting for the first connection), on top of every layout. Its state is read off the device in each poll's answer (`way.ts`, from the router's `setup`); it has no buttons.
|
||||
**The way:** a picture of the connection, with no buttons.
|
||||
|
||||
- **Block:** `field`, radius 20, padding `12 14`, 18 px above what is under it in every state.
|
||||
- **Ends:** two 34 px rounded squares (radius 11): the device icon in `knob`, and the server in accent tint.
|
||||
- **Track:** a dotted line between the ends (1.4 px dots every 9 px, `text-3` at 80%).
|
||||
- **Lines under it:** the line (14/20 500) and, in the states that need one, a second line (13/18 `text-2`).
|
||||
|
||||
| State | When | The way | Lines |
|
||||
|---|---|---|---|
|
||||
| **Waiting** | Nothing heard yet, or gone quiet, offline or removed again | A light runs along the track and rests a beat | "Waiting for the connection" |
|
||||
| **Can't finish** (`.trying`) | Its knocks reach the router and no handshake follows | The light turns warn, runs almost to the router and falls back (`way-knock`). A 2 × 18 warn break, tilted 18°, flashes at the router (`way-break`). The router's end turns warn 14%. | "Unable to complete the handshake" (warn) / "Your network may be blocking the connection." |
|
||||
| **Connected** (`.done`) | A handshake newer than the sheet, and data flowing | The track fills green from the device and the server end turns green last with a pop | "<device> connected" (green) |
|
||||
| **No data** (`.nodata`) | A handshake newer than the sheet, but nothing in except handshakes and keep-alives (an outdated configuration) | The track is green and both ends too (the router's 600 ms after). Two 8 px warn packets, with a soft warn glow, take turns falling through midway (`way-drop`). | "Handshake complete, but no data" (warn) / "This device is using an outdated configuration." |
|
||||
| **Given up** (`.stopped`) | 10 minutes without connecting | The light goes out | "No connection yet" / "Close this and open it again to keep checking." |
|
||||
| State | The way | Lines |
|
||||
|---|---|---|
|
||||
| **Waiting** | A light runs along the track and rests a beat | One line |
|
||||
| **Can't finish** (`.trying`) | The light turns warn, runs almost to the router and falls back (`way-knock`). A 2 × 18 warn break, tilted 18°, flashes at the router (`way-break`). The router's end turns warn 14%. | Line in warn, plus a second line |
|
||||
| **Connected** (`.done`) | The track fills green from the device and the server end turns green last with a pop | Line in green |
|
||||
| **No data** (`.nodata`) | The track is green and both ends too (the router's 600 ms after). Two 8 px warn packets, with a soft warn glow, take turns falling through midway (`way-drop`). | Line in warn, plus a second line |
|
||||
| **Given up** (`.stopped`) | The light goes out | Line, plus a second line |
|
||||
|
||||
Arrival is data flowing, not the first handshake, so no data shows instead of the sheet closing. Gone back to waiting, the way says nothing more: no second line.
|
||||
**Around the way:**
|
||||
|
||||
**Around the way** (`follow()` in `flows/wait.ts`):
|
||||
|
||||
- **The sub line** ("Two steps, about a minute") says what setting up takes, so it shows only while waiting. In every other state it folds away with its margins and the way sits right under the head, as in a sheet with no sub line. It comes back with waiting.
|
||||
- **Connected:** × and the pinned keys step away (`settle()`), the sheet scrolls back to the top, everything under the way folds shut with the way's 18 px gap, and the sheet closes onto the page after the reading time.
|
||||
- **Any other state** undoes that: × and the keys come back (`settle(false)`), and what folded unfolds straight into the new shape.
|
||||
- **On the device itself** (`same`) and **for a router**, the steps follow the way (`regroup()` in `flows/setup-view.ts`):
|
||||
- **can't finish:** one closed inset row, "Set it up again" (refresh glass, blue). On the device itself it holds both steps. A router that knocks has AmneziaWG on it already, so its row holds only the file step (no number, no title of its own);
|
||||
- **no data:** one open inset row, "Add the connection again" ("Import the configuration again" for a router), holding only the connection step (no number, no title of its own);
|
||||
- "Not on the X right now?" (the device itself only) hides in both: the device is in hand;
|
||||
- waiting: the steps as built;
|
||||
- connected: what shows stays as it is while everything under the way folds shut.
|
||||
|
||||
Inside the row what sat on field steps up one (*Accordion → Inset variant*). The layouts set up from elsewhere have rows, not steps, and keep them as built. When focus is inside what moves (a badge just used), it stays in the sheet: on that control where it still shows, else on the head of "Set it up again" or the first control of what now holds the steps.
|
||||
- **The sub line** shows with the waiting way only. Otherwise it folds away with its margins and the way sits right under the head, as in a sheet with no sub line.
|
||||
- **On arrival** × steps away, the sheet scrolls back to the top, and everything under the way folds shut with the way's 18 px gap (see *Motion → Waiting for the first connection*).
|
||||
- **Can't finish and no data** fold everything under the way shut the same way, at once, and the sheet stays: the way and its two lines are all it shows. Back to waiting, × comes back and what folded unfolds as it was.
|
||||
|
||||
### Code row, QR and link row · `ui/codes.ts`
|
||||
|
||||
- **QR:** 148 px (radius 18) beside its words (gap 14). Big: 208 (radius 24). Dense: full width, square, radius 22, words under it.
|
||||
- **Link row:** 44 high, radius 14, the URL in mono 13 without its scheme (ellipsis, `user-select: all`), then copy and, where the browser has it, share.
|
||||
- A code that changes **cross-fades in place**: the new one comes in first, so the place is never empty; a code of the other size scales the box to its own.
|
||||
- A code **too long to scan** (over about 1.6 KB, e.g. an AmneziaVPN key where the browser cannot compress it, or a LAN Bypass configuration with its long list of networks) gives its place to a stand-in: another code and words that say why (they change with the picked app). The row's own words come back with a code that fits.
|
||||
- A stand-in code (where the real one is too long to scan) takes the same place, with words beside it that say why.
|
||||
|
||||
### File card and configuration
|
||||
|
||||
- **File card:** `field`, radius 18, padding 12. A 38 × 46 "file" icon (radius 9, mono 10 600 ".conf"), the filename in mono 13, "For computers and routers" at 12 px, and an accent `sm` block button. Inside an inset row it steps up one (*Accordion → Inset variant*).
|
||||
- **File card:** `field`, radius 18, padding 12. A 38 × 46 "file" icon (radius 9, mono 10 600 ".conf"), the filename in mono 13, a 12 px line, and an accent `sm` block button. Inside an inset row it steps up one (*Accordion → Inset variant*).
|
||||
- **Configuration:** `pre` 12/18 mono, max-height 16 rem, scrolls.
|
||||
- colours: section headers in accent, keys in `text`, values in `text-2`;
|
||||
- **PrivateKey and PresharedKey are masked** (`••••` in `text-3`, letter-spaced 1 px) until "Show key". The mask and the key share one place and cross-fade; the one at rest is out of sight, so a selection of the `.conf` never takes a hidden key.
|
||||
- **keys are masked** (`••••` in `text-3`, letter-spaced 1 px) until "Show key". The mask and the key share one place and cross-fade; the one at rest is out of sight.
|
||||
|
||||
### Glass icon catalogue · `ui/glass.ts`
|
||||
|
||||
`phone, mobile, tablet, computer, router, other, plus, globe, home, shield, chart, calendar, clock, pause, server, link, key, lock, check, trash, refresh, app (AmneziaVPN mark), file, lan (three devices joined: the LAN Bypass row)`. An unknown name falls back to `other`.
|
||||
`phone, mobile, tablet, computer, router, other, plus, globe, home, shield, chart, calendar, clock, pause, server, link, key, lock, check, trash, refresh, app (AmneziaVPN mark), file, lan (three devices joined)`.
|
||||
|
||||
### Demo-only pieces · `demo/` (not in the router build)
|
||||
|
||||
- "Demo" chip after the crumbs (26 high, accent-soft, 13 px 600).
|
||||
- GitHub pill before the language pill (hidden below 480 px; a button in the drawer instead).
|
||||
- GitHub knob (its mark only, 32 px, as the QR knob) before the language pill (hidden below 480 px; a button in the drawer instead).
|
||||
- Scenario drawer: grouped rows on `field`, 2 px apart inside a radius-20 group, 60 px min, glass 30; the current row in accent with a check.
|
||||
|
||||
---
|
||||
@@ -1057,7 +1032,7 @@ Arrival is data flowing, not the first handshake, so no data shows instead of th
|
||||
- Say a state once, where it matters, in its colour. One notice per page.
|
||||
- Put numbers in `.num`, hostnames and links in mono, and one-line names with `title`.
|
||||
- Make every changing text go through `morphText`, and every appearing block through a blur-in (see *Motion*).
|
||||
- Translate in the same change and check the Russian at 375 px.
|
||||
- Check every new string in Russian at 375 px.
|
||||
- Respect the CSP: no `style=` attributes. Set styles through `el.style` and colours through classes.
|
||||
|
||||
**Don't**
|
||||
@@ -1067,7 +1042,7 @@ Arrival is data flowing, not the first handshake, so no data shows instead of th
|
||||
- Use blue text links for actions. Use buttons and pills.
|
||||
- Put an ellipsis on a button or menu item.
|
||||
- Use the accent for decoration, or a new hue for anything.
|
||||
- Animate with ad-hoc durations and curves. Use the springs and the two eases (see *Motion → Drift*).
|
||||
- Animate with ad-hoc durations and curves. Use the springs and the two eases (see *Motion → Curves and durations*).
|
||||
- Animate in response to the keyboard (Escape), or rely on motion to convey a state.
|
||||
- Use `--text-3` for text a person needs to read (see *Contrast*).
|
||||
|
||||
@@ -1099,15 +1074,17 @@ Six rules hold everywhere:
|
||||
```ts
|
||||
spring(k, c, m = 1) // closed-form damped harmonic oscillator; under-, critically and over-damped branches
|
||||
// duration = time until it stays within 0.15% of the end (sampled every 4 ms, ≤ 3 s)
|
||||
// what is left of the way then is spread over the curve (mostly near its end), so it lands on 1
|
||||
// exactly: a 500 px travel ends without a last-frame step
|
||||
// easing = CSS linear() with 65 points; at(ms) = progress for script-driven motion
|
||||
publishSprings(root) // --spring-{bouncy,smooth,soft,quick} and --spring-*-dur on <html> for CSS transitions
|
||||
play(el, frames, o) // el.animate() with the reduced-motion policy
|
||||
play(el, frames, o) // el.animate() with the reduced-motion policy; a large element (> 30 000 px²) fades without its blur
|
||||
rubber(dist, dim) // (1 − 1 / (dist·0.55/dim + 1))·dim: resistance that grows with the pull
|
||||
unrubber(d, dim) // rubber() undone: the pull that puts an edge d past it (a sheet taken while it settles back)
|
||||
dismisses(dy, v, h) // a pulled sheet goes on a flick down (v > 0.4 px/ms) or past h/3; never on a flick back up (v < −0.1)
|
||||
```
|
||||
|
||||
Animations from script go through `play()` (WAAPI). Hover and press states are CSS transitions. Loops and one-shots are CSS keyframes (`orb-converge`, `orb-breathe`, `way-run`, `way-knock`, `way-break`, `way-drop`, `way-dip`, `way-pop`, `caret-blink`, `cal-in`). The field's caret and selection run a per-frame spring of their own, not `spring()` (`ui/caret.ts`, see *Caret and selection*).
|
||||
Animations from script go through `play()` (WAAPI). Hover and press states are CSS transitions. Loops and one-shots are CSS keyframes (`orb-converge`, `orb-breathe`, `way-run`, `way-knock`, `way-break`, `way-drop`, `way-dip`, `way-pop`, `caret-blink`, `cal-in`). The field's caret and selection run a per-frame spring of their own, not `spring()` (see *Caret and selection*).
|
||||
|
||||
### Springs
|
||||
|
||||
@@ -1131,8 +1108,8 @@ Computed from `spring()` and confirmed live: the published CSS variables read 57
|
||||
| `EASE_OUT` (`--ease-out`) | `cubic-bezier(.23, 1, .32, 1)` | Entrances, hover and press transitions, folds of a finished step |
|
||||
| `EASE_IN` | `cubic-bezier(.55, 0, 1, .45)` | Exits: menu, toast, dialog close, busy content out, ghosts |
|
||||
| `DRAWER` | `cubic-bezier(.32, .72, 0, 1)` | The phone drawer, up 500 ms and down 420 ms (Vaul's curve) |
|
||||
| ad hoc | `cubic-bezier(.2, 0, 0, 1)` | Sheet view swap and pinned keys (see *Drift*) |
|
||||
| ad hoc | `cubic-bezier(.25, 1, .5, 1)` | Sheet height on a view swap, 360 ms (see *Drift*) |
|
||||
| ad hoc | `cubic-bezier(.2, 0, 0, 1)` | Sheet view swap |
|
||||
| ad hoc | `cubic-bezier(.25, 1, .5, 1)` | Sheet height on a view swap, 360 ms |
|
||||
| ad hoc | `cubic-bezier(0, 0, .58, 1)` | Accordion body fade-in, 300 ms |
|
||||
| `ease-out` / `ease` keywords | — | Drawer scrim (420 in / 320 out), tooltip hide, arrival ring, hover background colours |
|
||||
|
||||
@@ -1140,6 +1117,8 @@ The duration ladder in use is **100 · 120 · 140 · 150 · 160 · 180 · 200 ·
|
||||
|
||||
### Hover and press (CSS transitions)
|
||||
|
||||
A press shrinks a control, but it keeps the footprint it had when pressed: let go anywhere on that and it is the control's click, however far it has shrunk under the pointer (`ui/press.ts`, mouse and trackpad; a touch stays with what it pressed).
|
||||
|
||||
| Element | Press | Hover | Timing |
|
||||
|---|---|---|---|
|
||||
| `.knob` | `scale(.8)` | bg +6% text | 150 ms ease-out (transform), 150 ms (bg) |
|
||||
@@ -1148,14 +1127,14 @@ The duration ladder in use is **100 · 120 · 140 · 150 · 160 · 180 · 200 ·
|
||||
| `.kind` tile | `scale(.94)` | `knob` | 200 ms (bg, transform), ring 220, icon colour 260 |
|
||||
| `.badge`, `.dev.add` | `scale(.98)` | `knob` / raised+knob 45% | 200 ms |
|
||||
| `.namechip` | `scale(.96)` | `knob` | 150 ms |
|
||||
| `.upd-pill`, `.cr-lang`, `.hp-b`, demo chip / GitHub | `scale(.94)` | +6% / tone 22% | 150 ms |
|
||||
| `.upd-pill`, `.cr-lang`, `.hp-b`, demo chip / GitHub | `scale(.94)` | +6% (`.hp-b`: a `knob` circle) / tone 22% | 150 ms |
|
||||
| Accordion row | — | raised+knob 40% (inset: field+knob 50%; nested in an inset row: `knob`) | 150 ms |
|
||||
| `.swrow` (option row) | none | field+knob 50% | 200 ms |
|
||||
| Switch knob (`.sw`) | held: stretches 20 → 27 px toward where it goes | — | SMOOTH 524 (travel, width, colour) |
|
||||
| Picker item | — | `text-3` → `text-2` | 200 ms colour |
|
||||
| Spark / month bar | — | `--bar` → `text-2` (today: accent+text 25%) | 150 / 120 ms |
|
||||
| Field | — | focus ring inset 1.5 px | SMOOTH 524 |
|
||||
| Language chevron | — | rotates `90° → −90°` while open | 200 ms ease-out |
|
||||
| Pick pill chevron | — | turns `90° → −90°` as it opens and on round `−90° → −270°` as it shuts (then 90° again, unseen) | 260 ms ease-out |
|
||||
|
||||
### Catalogue: every animation, measured live
|
||||
|
||||
@@ -1216,8 +1195,8 @@ Every text that changes in place while visible morphs. Hover readouts over chart
|
||||
|
||||
- unchanged pieces stay still;
|
||||
- a piece with new words morphs where it stands (whole mode, up to 40 characters);
|
||||
- a keyed text (`data-t`) with new words is left to `morphChanged`, which letter-morphs it;
|
||||
- a piece that changed kind, height or drawing crosses: the old one is pinned where it stood and fades `b4` over 180 ms, from how it showed, while the new one blurs in (280 / 60); what came in whole is not morphed again (`morphChanged` skips it);
|
||||
- a keyed text (`data-t`) with new words is letter-morphed;
|
||||
- a piece that changed kind, height or drawing crosses: the old one is pinned where it stood and fades `b4` over 180 ms, from how it showed, while the new one blurs in (280 / 60); what came in whole is not morphed again;
|
||||
- pieces that only moved glide on SMOOTH.
|
||||
|
||||
**Interrupting:** a morph under way is not cut short. The next one starts from what shows: the words that were coming in leave from as far as they came (a letter both texts keep slides on from where it is), the words still leaving go on leaving, and the width carries on from its on-screen width. Asked again for what it is already turning into, the morph just goes on. A `morphInto` refilled again half-way does the same: what was fading goes on fading where it is, and what was still coming in goes on from as far as it came. No morph runs for reduced motion or for an element that is not on screen.
|
||||
@@ -1240,11 +1219,11 @@ Live examples:
|
||||
| Body of the closing row | from where it stands → `opacity 0, b2`, kept displayed (`.closing`) until the row finishes, also when another row is clicked meanwhile | 160 × what is left, EASE_IN |
|
||||
| Chevron | `rotate(90°) → rotate(−90°)` | SOFT 476 (CSS var) |
|
||||
| Head value (`valHide`) | `out, b4, translateX(8px)` | 200 (opacity, blur), 260 (transform), EASE_OUT |
|
||||
| Calendar cells when "Access until" opens | `cal-in`: `opacity 0, scale .4 → 1`; `.opened` stays until the row has shut, so a row opened again before then carries on its cascade | 360 / 7·i ms (49 cells ≈ 700 ms total), EASE_OUT |
|
||||
| Calendar cells when "Access until" opens | `cal-in`: `opacity 0, scale .4 → 1`; a row opened again before it has shut carries on its cascade | 360 / 7·i ms (49 cells ≈ 700 ms total), EASE_OUT |
|
||||
|
||||
On open the neighbours' facing corners round at the same time, so the open row lifts out of the stack rather than splitting it. Inside the sheet the accordion plans the sheet's width first, so a dense code that comes into view gets its width on the same frame. On the page a fold near the foot takes the page down with it (see *Layout → Scroll*).
|
||||
|
||||
A click mid-way (a double click) turns every row and body back from where it stands. When content changes under a height glide that is still heading for an old end (a row inside a row, a pick while its row opens, a fold inside a row), that glide is re-aimed from where it stands to the new end on its own curve (`regrow()` in `ui/accordion.ts`). The sheet needs none of this: its height follows its view (see *5. Sheet → Content glide*).
|
||||
A click mid-way (a double click) turns every row and body back from where it stands. When content changes under a height glide that is still heading for an old end (a row inside a row, a pick while its row opens, a fold inside a row), that glide is re-aimed from where it stands to the new end on its own curve. The sheet needs none of this: its height follows its view (see *5. Sheet → Content glide*).
|
||||
|
||||
#### 5. Sheet
|
||||
|
||||
@@ -1260,9 +1239,9 @@ A click mid-way (a double click) turns every row and body back from where it sta
|
||||
| | scrim | `in` | 420, ease-out |
|
||||
| Phone close | sheet | from its current transform → `translateY(100% + 40px)` | 420, DRAWER |
|
||||
| | scrim | from its current opacity → 0 | 320, ease-out |
|
||||
| Escape, or a link that stopped working | everything | gone at once | 0 |
|
||||
| Escape | everything | gone at once | 0 |
|
||||
|
||||
**View swap** (`go`, `back`, a new flow in an open sheet):
|
||||
**View swap:**
|
||||
|
||||
| Element | Motion | Timing |
|
||||
|---|---|---|
|
||||
@@ -1273,9 +1252,9 @@ A click mid-way (a double click) turns every row and body back from where it sta
|
||||
| Pinned keys | old out `s.9, b3` 180; new in `s.9 → 1, b3 → 0` | 260 / 110 |
|
||||
| Clicks on the new view | ignored for 320 ms, so a tap meant for the old button doesn't press the new one | — |
|
||||
|
||||
**Content glide** (`glide()`, a pick that changes a view):
|
||||
**Content glide** (a change inside a view):
|
||||
|
||||
- the viewport height glides on SMOOTH, as a gap (or overhang) under the view that closes, so whatever changes inside meanwhile (a row opening, a fold, a poll) carries the sheet's edge along;
|
||||
- the viewport height glides on SMOOTH, as a gap (or overhang) under the view that closes, so whatever changes inside meanwhile (a row opening, a fold) carries the sheet's edge along;
|
||||
- every element that moved inside glides from its old place (outermost only) on SMOOTH, added to a glide still under way, so a quick second pick takes it on from where it is;
|
||||
- blocks named as changed blur in (280, EASE_OUT).
|
||||
|
||||
@@ -1287,7 +1266,7 @@ A click mid-way (a double click) turns every row and body back from where it sta
|
||||
- release closes on a flick (> 0.4 px/ms) or past a third of the height. Live, a 250 px pull closed from scrim .40, and a fast 50 px flick closed from scrim .88.
|
||||
- otherwise the sheet and its dim go back on SMOOTH (a touch that never moved only lets it settle).
|
||||
|
||||
**Arrived** (`.arrived`) and question (`.asks`): × and the pinned keys go `out, b3, scale .9` over 240 ms EASE_OUT and stop taking clicks.
|
||||
**Arrived** (`.arrived`) and question (`.asks`): × goes `out, b3, scale .9` over 240 ms EASE_OUT and stop taking clicks; they come back the same way.
|
||||
|
||||
#### 6. ⋯ Menu
|
||||
|
||||
@@ -1324,7 +1303,7 @@ The orb is aicss.dev's **Orbs B4 Converge** at its 28 px stage, twice its speed,
|
||||
| Orb loop: front dot (7 px) | walks a triangle (top → bottom right → bottom left). It rests 10% at each corner, leaves ease-in (`.55,0,1,.45`), arrives ease-out (`.33,1,.68,1`), and is `scale .72, blur .8` between corners. | 1.8 s, linear keyframe timeline |
|
||||
| Orb loop: back dot | breathes in the centre: opacity .16 ↔ .32, blur 2.4 ↔ 1.6, scale 1.2 ↔ .98 | 1.8 s, ease-in-out |
|
||||
|
||||
The orb starts on the click itself (a 250 ms "only if slow" delay was tried and rejected). The button stays disabled until the answer, which also guards against double submits. `contain: strict` keeps the loop off layout.
|
||||
The orb starts on the click itself (a 250 ms "only if slow" delay was tried and rejected). `contain: strict` keeps the loop off layout.
|
||||
|
||||
#### 9. Copy feedback
|
||||
|
||||
@@ -1333,7 +1312,7 @@ The control that copied says so for 1.6 s:
|
||||
- its icon swaps to a check (POP 544, from `s.6, b3`), and back the same way;
|
||||
- its "Copy…" label morphs to "Copied" and back;
|
||||
- a toast says what was copied;
|
||||
- in the pinned keys, the tooltip glides and rewords to "Copied" (SMOOTH).
|
||||
- in the connection keys, the tooltip glides and rewords to "Copied" (SMOOTH).
|
||||
|
||||
#### 10. App picker stretch
|
||||
|
||||
@@ -1341,38 +1320,38 @@ On a pick:
|
||||
|
||||
- **Edges:** the pill's two edges are driven per frame by `spring.at(t)`. The leading edge (toward the new item) runs on LEAD (396 ms) and the trailing edge on SMOOTH (524 ms), so the pill stretches toward the target and then contracts.
|
||||
- **Width shares:** items change `flex-grow` 0 ↔ 1 on SMOOTH. Shares of the track, not pixels, so they stay right while the sheet's width changes.
|
||||
- **Labels:** the old label collapses (`max-width → 0, margin-left −8, out`, 220 ease-out) while the new one opens to its width with its item's share (SMOOTH) and blurs in (280 / 70, EASE_OUT), always inside the pill. Picked again half-way, each name goes on from where it stands, one still folding included, over what is left of its way (`labelFade`).
|
||||
- **What follows:** everything the pick changes `morphInto`s in place (step title, store badge, step 2, the code) and the sheet glides.
|
||||
- **Labels:** the old label collapses (`max-width → 0, margin-left −8, out`, 220 ease-out) while the new one opens to its width with its item's share (SMOOTH) and blurs in (280 / 70, EASE_OUT), always inside the pill. Picked again half-way, each name goes on from where it stands, one still folding included, over what is left of its way.
|
||||
- **What follows:** everything the pick changes morphs in place (`morphInto`) and the sheet glides.
|
||||
|
||||
#### 11. Kinds picker
|
||||
|
||||
The ring does not travel: the old tile's ring fades and the new tile's ring draws in place (box-shadow 220 ms). The icon desaturates or saturates (260 ms) and the label colour changes (200 ms). The name field updates without motion while untouched.
|
||||
The ring does not travel: the old tile's ring fades and the new tile's ring draws in place (box-shadow 220 ms). The icon desaturates or saturates (260 ms) and the label colour changes (200 ms). A name that follows the pick changes without motion.
|
||||
|
||||
#### 12. Codes and words
|
||||
|
||||
| What | Motion | Timing |
|
||||
|---|---|---|
|
||||
| A new QR in the same box | new `in` under them all first (200, EASE_OUT); old laid over it goes `out` (220 / 110, EASE_IN); each from where it stands. Nothing changes its place in the stack: a code turned back to fades up again where it lies (200 × what is left), what lies over it goes, and what lies under it goes once it shows whole | the box is never empty |
|
||||
| A code of the other size (dense ↔ not, e.g. the stand-in link) | the box scales from its size on screen to its own (from its top left, corners kept), the codes with it; the words glide to their new place | SMOOTH 524 |
|
||||
| The same code for another app (WireGuard ↔ AmneziaWG take one file) | only the words change | — |
|
||||
| A code of the other size (dense ↔ not, e.g. the stand-in) | the box scales from its size on screen to its own (from its top left, corners kept), the codes with it; the words glide to their new place | SMOOTH 524 |
|
||||
| The same code under other words | only the words change | — |
|
||||
| Words beside a code | new `in, b3 → 0` 220 EASE_OUT; old `out, b3` from where they stand, 200 / 90 EASE_IN | — |
|
||||
| Scan line, another app | app name and each path part morph whole; the OS mark grows or shrinks (`width 0 ↔ 1.05em`, `b3`) | SMOOTH; mark out 220 × the width it has left, from where it stands |
|
||||
| Scan line, OS alternation (every 3000 ms while on screen) | the differing word letter-morphs; the old mark `out, scale .5 rotate −40°, b3` (200, EASE_IN); the new one turns in from `scale .5 rotate 40°` | POP 544 / 80 |
|
||||
|
||||
#### 13. Waiting for the first connection · `flows/wait.ts`
|
||||
|
||||
**While waiting:** the way's light (`way-run`) is a gradient band masked to the dots. It travels from −70% to +70% in the first 72% of a 2 s loop (`cubic-bezier(.45,0,.55,1)`) and rests for the last 28% (≈ 560 ms). Behind it, polls run every 5 s six times, then every 15 s six times, then every 30 s. They skip while the tab is hidden and go on until the sheet closes, through the arrival too, so a state that changes again is still seen. They give up at 10 minutes unless the device is connected (the sheet is closing by itself then).
|
||||
**Waiting:** the way's light (`way-run`) is a gradient band masked to the dots. It travels from −70% to +70% in the first 72% of a 2 s loop (`cubic-bezier(.45,0,.55,1)`) and rests for the last 28% (≈ 560 ms).
|
||||
|
||||
**Can't finish:** the light turns warn and knocks (`way-knock`, 1.8 s, the same curve): −70% → +34% at 48%, back to +26% at 62% as if turned away, then home to −70%, fading out by 86% and resting to the end. The break at the router flashes on the same beat (`way-break`, 1.8 s): `opacity .25, scaleY .7`, up to `1, 1.15` at 50%, back by 70%. The router's end turns warn over 400 ms. Both loops (the run and the knock) and the break run from the way's first frame; each state fades its own in and the others out over 200 ms (ease-out) where they stand, so none starts over in sight.
|
||||
|
||||
**No data:** the green fills the dots as on arrival (700 / 80, EASE_OUT) and the ends turn green (400; the router's 600 later, with no pop). Two packets take turns (`way-drop`, 2.2 s, the same curve, the second 1.1 s behind): each fades in by 8%, runs to 48% of the track at 46%, then drops 16 px past the middle (to 54%), shrinking to `.5` and fading out by 66%. Leaving no data, each packet fades out where it is as it falls on (200, EASE_IN), then goes; back to no data while they fade, a fresh pair sets off.
|
||||
|
||||
**Arrival timeline**, measured live (t = 0 when the poll sees data flowing after a fresh handshake; the sub line's fold is read from the code):
|
||||
**Arrival timeline**, measured live (t = 0 at arrival):
|
||||
|
||||
| t (ms) | What |
|
||||
|---|---|
|
||||
| 0 | The line morphs to "<device> connected" (width glides on SMOOTH, letters lift and rise). Its colour turns green (300 ms). |
|
||||
| 0 | × and the pinned keys step away (`out, b3, s.9`, 240 ms). The sheet scrolls to the top. |
|
||||
| 0 | × steps away (`out, b3, s.9`, 240 ms). The sheet scrolls to the top. |
|
||||
| 0 → 380 | The sub line folds away, if it still shows (see below). |
|
||||
| 0 → 200 | The light fades out (200 ms). |
|
||||
| 80 → 780 | The green fills the dots from the device's end (`clip-path inset(0 100% 0 0) → inset(0)`, 700 / 80 ms, EASE_OUT). The device's end turns green (400 ms). |
|
||||
@@ -1382,7 +1361,7 @@ The ring does not travel: the old tile's ring fades and the new tile's ring draw
|
||||
| 2810 | The sheet closes (120 ms on a computer, 420 on a phone). |
|
||||
| ≈ 2950 | The page repaints: the card glides to its new place (SMOOTH), its status morphs to "Connected", and its **green ring fades** over 1.8 s. |
|
||||
|
||||
**Changes of state** (`follow()`), each starting from where things stand on screen, so one turned round half-way never jumps:
|
||||
**Changes of state**, each starting from where things stand on screen, so one turned round half-way never jumps:
|
||||
|
||||
| What | Motion | Timing |
|
||||
|---|---|---|
|
||||
@@ -1390,10 +1369,10 @@ The ring does not travel: the old tile's ring fades and the new tile's ring draw
|
||||
| Second line in | `in, b4 → 0`, while the block's height glides open and both lines FLIP to their new centre together | 300 / 60 EASE_OUT; height and FLIP 340 EASE_OUT (the FLIP measured on the glide's first frame) |
|
||||
| Second line replaced | whole-word morph in place (old `out, b4` 180 EASE_IN, new `in, b4 → 0` 280 / 60 EASE_OUT) as the block glides to the new height | 340 EASE_OUT |
|
||||
| Second line out | `out, b4` from its current opacity, then the block closes the same way | 180 EASE_OUT, the close from 170 ms, 340 EASE_OUT |
|
||||
| Sub line folds (every state but waiting) and comes back | `height, margin-top/bottom → 0, out, b4` | 380, EASE_OUT |
|
||||
| Steps regroup (`same` and `router`: into "Set it up again", "Add the connection again" or "Import the configuration again", and back) | `.setup` height from where it stands to the new one; `opacity .4, b2 → none` | 420, EASE_OUT; 320, EASE_OUT |
|
||||
| Sub line folds and comes back | `height, margin-top/bottom → 0, out, b4` | 380, EASE_OUT |
|
||||
| Steps regroup (into one inset row, and back) | `.setup` height from where it stands to the new one; `opacity .4, b2 → none` | 420, EASE_OUT; 320, EASE_OUT |
|
||||
| Leaving connected | × and the keys come back (240); what folded unfolds straight into the new shape, the way's 18 px gap with it | 520, EASE_OUT |
|
||||
| "No connection yet" after 10 min | the line morphs; "Close this and open it again to keep checking." comes in as the second line, or morphs from the one shown; the sub line folds away if it still shows | as above |
|
||||
| Given up | the line morphs; the second line comes in, or morphs from the one shown; the sub line folds away if it still shows | as above |
|
||||
|
||||
#### 14. Caret and selection · `ui/caret.ts`
|
||||
|
||||
@@ -1409,22 +1388,22 @@ The ring does not travel: the old tile's ring fades and the new tile's ring draw
|
||||
|
||||
| What | Motion | Timing |
|
||||
|---|---|---|
|
||||
| Add sheet, error under the field | in: `in, y−4 → 0, b4 → 0` as the sheet glides open (see 5, *Content glide*); out (they type): `out, y−4, b4` where it stands, then the sheet glides shut; a second error morphs its words; each turns back from where it stands | 220, EASE_OUT; out 180, EASE_IN, the glide from 170 ms |
|
||||
| Error under a field in a sheet | in: `in, y−4 → 0, b4 → 0` as the sheet glides open (see 5, *Content glide*); out: `out, y−4, b4` where it stands, then the sheet glides shut; a second error morphs its words; each turns back from where it stands | 220, EASE_OUT; out 180, EASE_IN, the glide from 170 ms |
|
||||
| Show key / Hide key | the mask and the key cross-fade in place, each from where it stands: in → `none, 1` (320, EASE_OUT); out → `0, b4` (200, EASE_IN), then out of sight. The icon (key ↔ ×) turns the same way, out through `s.6, b3`; the label morphs | 320 / 200 |
|
||||
| Steps fold (same-device layout, the "Not on the X" row) | `height, opacity, blur(0 ↔ 4px)` from where it stands (a double click turns it back); a row still opening around it heads for the new height | SMOOTH 524 |
|
||||
| Steps fold (an inset row above them opening) | `height, opacity, blur(0 ↔ 4px)` from where it stands (a double click turns it back); a row still opening around it heads for the new height | SMOOTH 524 |
|
||||
| Top edge fade | opacity 0 ↔ 1 at `scrollY > 2` | 200 ms |
|
||||
| Demo scenario switch | page `out, b4` 160 EASE_OUT → repaint → `in, y6, b4 → 0` 420 EASE_OUT | demo only |
|
||||
|
||||
### Shimmer · `ui/shimmer.ts`
|
||||
|
||||
Words on their way to the router (a name being saved on its card) shimmer as an assistant's "thinking" line does. A copy of the input's words is laid exactly over them (same font, clipped to the input and scrolled as it is) and the input's own go transparent. The copy is the words' colour (`text`) over a muted base (`text` 38% into `raised`), painted as a gradient clipped to the text: a band 2.2 em either side with a bell falloff (0, .5, .9, 1, .9, .5, 0) crosses it from left to right in 1.8 s, linear, then rests 0.58 s and goes again. It starts solid (the swap shows nothing), dims in 240 ms; stopping, the band holds where it is and the words fade back to their colour around it (480 ms, standard curve), and only then does the copy go. With less motion asked for there is no band: it only dims and comes back.
|
||||
Words being saved (a name on its card) shimmer as an assistant's "thinking" line does. A copy of the words is laid exactly over them (same font, clipped to the input and scrolled as it is) and the input's own go transparent. The copy is the words' colour (`text`) over a muted base (`text` 38% into `raised`), painted as a gradient clipped to the text: a band 2.2 em either side with a bell falloff (0, .5, .9, 1, .9, .5, 0) crosses it from left to right in 1.8 s, linear, then rests 0.58 s and goes again. It starts solid (the swap shows nothing), dims in 240 ms; stopping, the band holds where it is and the words fade back to their colour around it (480 ms, standard curve), and only then does the copy go. With less motion asked for there is no band: it only dims and comes back.
|
||||
|
||||
### Choreographies, end to end (live, demo latency ~0.5–0.75 s)
|
||||
|
||||
**Rename (on the card):**
|
||||
|
||||
- 0: Return; the words' copy laid over them dims to the muted base (240, standard curve), the caret steps aside;
|
||||
- +120: the first sweep sets off (1.8 s across, linear), then again after a 0.58 s rest, for as long as the router takes;
|
||||
- +120: the first sweep sets off (1.8 s across, linear), then again after a 0.58 s rest, until the answer;
|
||||
- answer: the band holds where it is and the words fade back to their colour (480, standard curve);
|
||||
- then: the input gives way to the name (identical, nothing moves), the card is drawn again and its status morphs from the hint, words and colour.
|
||||
|
||||
@@ -1432,7 +1411,7 @@ Words on their way to the router (a name being saved on its card) shimmer as an
|
||||
|
||||
- 0: busy;
|
||||
- +720: answer. Under the sheet the cards FLIP (iPhone and MacBook swap places, ±315 px) and the status morphs to "Not set up yet";
|
||||
- +795: view swap to set-up. Old out 200, new in 280 / 110, height 297 → 830 (360), width 400 → 448 (SMOOTH), pinned keys in 260 / 110, × back (240), the light starts.
|
||||
- +795: view swap to set-up. Old out 200, new in 280 / 110, height 297 → 830 (360), width 400 → 448 (SMOOTH), × back (240), the light starts.
|
||||
|
||||
**Add:**
|
||||
|
||||
@@ -1469,7 +1448,7 @@ CSS hover and press transitions (`scale(.8–.98)`, colours, the switch) are not
|
||||
### Performance notes
|
||||
|
||||
- Animated properties are `transform`, `opacity` and `filter: blur` almost everywhere. Layout properties animate only where the layout must truly change: `height`, `width`, `max-width`, margins and radii (sheet height, accordion rows, morph width, folds), `flex-grow` (picker) and `clip-path` (way fill).
|
||||
- Morphs skip elements that are not on screen. The OS alternation skips while folded. Polls pause in hidden tabs.
|
||||
- Morphs skip elements that are not on screen. The OS alternation skips while folded.
|
||||
- The caret runs one `requestAnimationFrame` loop for itself and both selection edges, writes only `transform` (and the wash's width), and stops once all three rest. Its measuring copy of the text sits out of sight with the input's font, and several events in one frame make one measure.
|
||||
- Blur radii stay at ≤ 6 px; the edge fade's 12 px backdrop blur is the only large one.
|
||||
- One animation per property per element at a time: new runs cancel old ones after starting from their computed state. The exception is a FLIP inside the sheet, which adds to one still under way (`composite: 'add'`).
|
||||
@@ -1493,94 +1472,18 @@ CSS hover and press transitions (`scale(.8–.98)`, colours, the switch) are not
|
||||
- **Buttons are verbs, with no ellipsis:** Connect, Update, Add device, Reconnect, Remove, Cancel, Open securely, Show key, Copy.
|
||||
- **Statuses are short and fit one line.** The full wording goes in the tooltip: "Settings changed, update needed".
|
||||
- **Other apps are quoted word for word, in each language:** "+ › Insert › Continue" for AmneziaVPN, "Import Tunnel(s) from File…" for WireGuard.
|
||||
- **Honest warnings sit where the choice is made:** plain HTTP, the router's own certificate, connected but no data left, a device that can't finish connecting or connects with no data (the way says what it likely is, the card says it in one line with why in `title`).
|
||||
- **Numbers, sizes and dates** follow the page's language (`num`, `bytes`, `toLocaleDateString(locale())`). Times are the router's clock, hours shown in the visitor's time when the offset is known.
|
||||
- **The language pill switches in place.** The page opens in the kept choice, else the browser's language, else English.
|
||||
- **Honest warnings sit where the choice is made**, said once: one line where space is short, the why in `title`.
|
||||
- **Numbers, sizes and dates** follow the page's language.
|
||||
- **The language pill switches in place.**
|
||||
|
||||
---
|
||||
|
||||
## Accessibility
|
||||
|
||||
- **Focus:** `:focus-visible` draws a 2 px outline in accent at 65% with a 2 px offset. Mouse focus shows nothing.
|
||||
- **Roles:**
|
||||
- the sheet is `dialog`, or `alertdialog` for questions, with `aria-modal` and `aria-label` = the view's title;
|
||||
- the menu is `menu` with `menuitem` or `menuitemradio` (`aria-checked`);
|
||||
- the picker is a `tablist` of `tab`s (`aria-selected`); the kinds are a `radiogroup` of `radio`s (`aria-checked`);
|
||||
- the LAN Bypass row is one `button` with `role="switch"` and `aria-checked`, named by its title and line;
|
||||
- accordion heads are buttons with `aria-expanded`;
|
||||
- the way is `role="status"` with `aria-live="polite"`;
|
||||
- the menu path has its own `aria-label` naming both systems' words;
|
||||
- busy buttons get `aria-busy`.
|
||||
- **Keyboard:** Escape closes the menu, then the sheet, without animation. The phone's back button closes the sheet. Focus returns to the opener. A name edited on its card selects its text as it opens; Esc there puts the name back without closing anything else, and focus returns to the name. When the set-up steps regroup under the way, focus inside them stays in the sheet (see *Set-up sheet → Around the way*).
|
||||
- **Words only on hover:** a device card's status stays one line, so why a link fails sits in `title` for a pointer and in hidden text right after the status for a screen reader (`.offscreen`). A touch screen shows neither: the trade-off for cards of one height.
|
||||
- **Hidden decoration:** icons and glass icons are `aria-hidden`. Morph overlays and ghosts are `aria-hidden` and click-through. A field's drawn caret, selection and handles are click-through, and its measuring copy is `aria-hidden`; the input underneath stays the browser's own (typing, IME, its real selection). An icon-only button has an `aria-label`.
|
||||
- **Focus:** `:focus-visible` draws a 2 px outline in accent at 65% with a 2 px offset, only while the keyboard is moving focus: `main.ts` sets `.kbd` on `<html>` at Tab or an arrow key and drops it at any press. Focus a script moves, or one left after a click or a touch, shows nothing.
|
||||
- **Keyboard:** Escape closes the menu, then the sheet, without animation.
|
||||
- **Words only on hover:** a device card's status stays one line, so a longer reason sits in `title` for a pointer and in hidden text right after the status for a screen reader (`.offscreen`). A touch screen shows neither: the trade-off for cards of one height.
|
||||
- **Hidden decoration:** icons and glass icons are `aria-hidden`. Morph overlays and ghosts are `aria-hidden` and click-through. A field's drawn caret, selection and handles are click-through, and its measuring copy is `aria-hidden`; the input underneath stays the browser's own (typing, IME, its real selection).
|
||||
- **Contrast:** see the table in *Colors*. `--text-3` and white-on-accent are below AA.
|
||||
- **Targets:** buttons and fields are 48 px, menu items 40 px. Knobs and pills are 32 px, the pinned keys 38 × 32 and calendar cells 10 px (not interactive). The 32 px controls are below the 44 px touch guideline.
|
||||
|
||||
---
|
||||
|
||||
## Live audit: findings (2026-10-20)
|
||||
|
||||
These are observations from the code read and the live run, not changes. Each is cheap to confirm in the demo.
|
||||
|
||||
### Motion
|
||||
|
||||
1. **The sheet uses two height animations.** A view swap glides height over 360 ms `cubic-bezier(.25,1,.5,1)` with `cubic-bezier(.2,0,0,1)` cross-fades and pinned keys. In-view changes use SMOOTH (524 ms). Moving the swap onto the spring tokens would make the sheet move the same way however its content changes.
|
||||
2. **The drawer scrim uses CSS keywords** (`ease-out` 420 / 320) where the dialog's scrim uses SOFT and EASE_IN. Harmless, but it sits outside the token set.
|
||||
3. **Comments drift from the code.**
|
||||
- `motion.ts` says BOUNCY is "the accordion", and `accordion.css` and `accordion.ts` call it "bouncy". The accordion runs on SOFT (476 ms, 3.9%), on purpose since 2026-10-19.
|
||||
- `docs/plan-portal-redesign.md` says "one bottom drawer at every width" and "four kinds with a sliding ring". Live, the sheet is a centred dialog from 760 px, and the ring does not travel.
|
||||
4. **The language switch is a hard cut.** The whole page is rebuilt with no fade. It is consistent with "nothing animates that the person can't follow", but it is the only visible change without a transition.
|
||||
|
||||
### Visual and accessibility
|
||||
|
||||
5. **White on accent** (every primary button) is 2.4:1 in dark and 2.9:1 in light. It is below AA even for large text. It is the measured skiper21 look, so it is a decision for the user. Options: a deeper accent fill with the same hue (e.g. `#1d84e6`, the glass tone b) or dark ink on the light fill.
|
||||
6. **`--text-3` carries meaningful text** at 2.2–2.4:1: the limit note ("You have reached your limit…"), "3 of 4", "Ends Mon 30 Nov", axis dates and the "OR" divider. The limit note and the end date carry information and could move to `--text-2`.
|
||||
7. **Light theme tone text is thin.** Status lines at 13 px in ok, warn or accent are 3.1–3.3:1 on white. Accent text links in hints are 2.9:1.
|
||||
8. **`--t-orange` has no light override.** The light block redefines the grey, blue, green and red glass tones, but not orange. Orange glass icons keep their dark-theme stops in light.
|
||||
9. **Breadcrumb at 375 px:** with the demo chip, both crumbs truncate to "Dawnlin… › U…". The router build has no chip, but a long server name will do the same. Consider letting the person's crumb win (`flex-shrink` on the place first).
|
||||
10. **Quota tone mismatch:** the "Out of data" notice is red (`bad`) while the cards say "Connected, no data left" in orange (`warn`). Intended (the tunnel is up), but the page shows two tones for one state.
|
||||
11. **"How to" paths wrap with the separator first:** a wrapped line starts with "›" ("› Pick the file and connect").
|
||||
12. **The `.conf` block has no edge inside its inset row:** both are `--field`. In light especially, the code floats without a container. (Inside "Set it up again" both step up and the block shows: `knob` on knob 65%.)
|
||||
13. **The trash glass icon reads as "pause"** at small sizes: two vertical strokes in a rounded body. The lid separates it at 64 px only.
|
||||
|
||||
---
|
||||
|
||||
## Source map
|
||||
|
||||
| Area | Files |
|
||||
|---|---|
|
||||
| Tokens, fonts, light theme | `web/src/portal/styles/tokens.css` |
|
||||
| Reset, type, focus, selection, icons | `styles/base.css` |
|
||||
| Knob, buttons, orb, field (its caret and selection), picker, kinds, option row and switch, badges, hints, link row, QR | `styles/controls.css` |
|
||||
| Field caret and selection | `ui/caret.ts` |
|
||||
| Add a device, the LAN Bypass row | `flows/add.ts` |
|
||||
| Page frame, edge fades, crumbs, columns, notices, single card | `styles/page.css`, `page/frame.ts`, `page/notices.ts` |
|
||||
| Device cards | `styles/devices.css`, `page/devices.ts` |
|
||||
| Access rows | `styles/access.css`, `page/access.ts`, `days.ts` |
|
||||
| Accordion | `styles/accordion.css`, `ui/accordion.ts` |
|
||||
| Sheet, views, questions | `styles/sheet.css`, `ui/sheet.ts`, `flows/device-actions.ts`, `flows/secure.ts` |
|
||||
| Set-up | `styles/setup.css`, `flows/setup-view.ts`, `flows/setup-parts.ts`, `flows/wait.ts`, `way.ts` (the way's state), `setup.ts` |
|
||||
| Menu, toast | `styles/menu-toast.css`, `ui/menu.ts`, `ui/feedback.ts` |
|
||||
| Motion engine | `motion.ts`; morph `ui/morph.ts` + `styles/morph.css`; busy `ui/busy.ts`; picker `ui/seg.ts` |
|
||||
| Glass icons, line icons, QR | `ui/glass.ts`, `web/src/shared/icons.ts`, `web/src/shared/qr.ts`, `ui/codes.ts` |
|
||||
| Demo | `web/src/portal/demo/*` (deployed to dawnline-demo.vercel.app) |
|
||||
| Rules | `rules/ui-design.md`, `rules/frontend.md`, `rules/i18n.md` |
|
||||
|
||||
### Measuring motion live
|
||||
|
||||
Paste this into the console of the demo (or the portal) before interacting, then read `__dump()`. Springs show by name because each has a unique duration.
|
||||
|
||||
```js
|
||||
const N = {572:'BOUNCY',524:'SMOOTH',476:'SOFT',296:'QUICK',544:'POP',396:'LEAD'}, L = (window.__log = []);
|
||||
const d = (e) => e.tagName.toLowerCase() + '.' + String(e.className?.baseVal ?? e.className).trim().replace(/\s+/g, '.');
|
||||
const ez = (e, t) => (e?.startsWith('linear(') ? N[t] ?? 'spring' : e ?? 'linear');
|
||||
const A = Element.prototype.animate;
|
||||
Element.prototype.animate = function (f, o) {
|
||||
L.push([d(this), o?.duration, o?.delay ?? 0, ez(o?.easing, o?.duration), JSON.stringify(f).slice(0, 160)].join(' | '));
|
||||
return A.call(this, f, o);
|
||||
};
|
||||
addEventListener('transitionrun', (e) => L.push(['css', d(e.target), e.propertyName].join(' | ')), true);
|
||||
addEventListener('animationstart', (e) => L.push(['kf', d(e.target), e.animationName].join(' | ')), true);
|
||||
window.__dump = () => L.splice(0).join('\n');
|
||||
```
|
||||
- **Targets:** buttons and fields are 48 px, menu items 40 px. Knobs, pills and the connection keys are 32 px, calendar cells 10 px (not interactive). The 32 px controls are below the 44 px touch guideline.
|
||||
- **Reduced motion:** see *Motion → Reduced motion*.
|
||||
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
@@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-dawnline
|
||||
PKG_VERSION:=0.14.1
|
||||
PKG_VERSION:=0.15.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=MIT
|
||||
# po/<lang>/dawnline.po becomes luci-i18n-dawnline-<lang> (luci.mk), released
|
||||
|
||||
@@ -1 +1 @@
|
||||
@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable;overflow-anchor:none}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hoveLine truncated
|
||||
@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #30d158;--ok-soft: rgba(48, 209, 88, .14);--warn: #ff8d28;--bad: #ff383c;--bad-soft: rgba(255, 56, 60, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--glass-bg: linear-gradient(rgba(255, 255, 255, .04), rgba(255, 255, 255, .04)), rgba(0, 0, 0, .4);--glass-edge: rgba(255, 255, 255, .05);--glass-sep: rgba(255, 255, 255, .04);--glass-text: #f5f5f5;--glass-sub: #8a8a8a;--glass-bad: var(--bad);--glass-hl: color-mix(in srgb, var(--raised), var(--text) 8%);--glass-hover: color-mix(in srgb, var(--raised), var(--text) 5%);--glass-shadow: 0 0 0 transparent;--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #30d158;--t-red-a: #ffadad;--t-red-b: #ff383c;--t-orange-a: #ffc08f;--t-orange-b: #ff8d28;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #30d158;--ok-soft: rgba(48, 209, 88, .12);--warn: #ff8d28;--bad: #ff383c;--bad-soft: rgba(255, 56, 60, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--glass-bg: rgba(245, 245, 245, .6);--glass-edge: rgba(0, 0, 0, .04);--glass-sep: rgba(0, 0, 0, .03);--glass-text: #1a1a1a;--glass-sub: #727272;--glass-hl: color-mix(in srgb, var(--raised), var(--text) 11%);--glass-hover: color-mix(in srgb, var(--raised), var(--text) 4%);--glass-shadow: 0 8px 32px rgba(0, 0, 0, .12);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #30d158;--t-red-a: #ff9090;--t-red-b: #ff383c}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable;overflow-anchor:none;touch-action:manipulation}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}.kbd :focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(Line truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";(()=>{var Si=Object.create;var Oo=Object.defineProperty;var Ai=Object.getOwnPropertyDescriptor;var Hi=Object.getOwnPropertyNames;var Di=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty;var Pi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Hi(t))!$i.call(e,r)&&r!==n&&Oo(e,r,{get:()=>t[r],enumerable:!(o=Ai(t,r))||o.enumerable});return e};var Ri=(e,t,n)=>(n=e!=null?Si(Di(e)):{},Oi(t||!e||!e.__esModule?Oo(n,"default",{value:e,enumerable:!0}):n,e));var Lr=Pi((kr,Cr)=>{"use strict";var Er=(function(){var e=function(y,w){var p=236,u=17,l=y,v=n[w],h=null,d=0,L=null,M=[],H={},q=function(k,T){d=l*4+17,h=(function(E){for(var D=new Array(E),$=0;$<E;$+=1){D[$]=new Array(E);for(var I=0;I<E;I+=1)D[$][I]=null}return D})(d),R(0,0),R(d-7,0),R(0,d-7),U(),N(),oe(k,T),l>=7&&Z(k),L==null&&(L=nn(l,v,M)),de(L,T)},R=function(k,T){for(var E=-1;E<=7;E+=1)if(!(k+E<=-1||d<=k+E))for(var D=-1;D<=7;D+=1)T+D<=-1||d<=T+D||(0<=E&&E<=6&&(D==0||D==6)||0<=D&&D<=6&&(E==0||E==6)||2<=E&&E<=4&&2<=D&&D<=4?h[k+E][T+D]=!0:h[k+E][T+D]=!1)},W=function(){for(var k=0,T=0,E=0;E<8;E+=1){q(!0,E);var D=r.getLostPoint(H);(E==0||k>D)&&(k=D,T=E)}return T},N=function(){for(var k=8;k<d-8;k+=1)h[k][6]==null&&(h[k][6]=k%2==0);for(var T=8;T<d-8;T+=1)h[6][T]==null&&(h[6][T]=T%2==0)},U=function(){for(var k=r.getPatternPosition(l),T=0;T<k.length;T+=1)for(var E=0;E<k.length;E+=1){var D=k[T],$=k[E];if(h[D][$]==null)for(var I=-2;I<=2;I+=1)for(var B=-2;B<=2;B+=1)I==-2||I==2||B==-2||B==2||I==0&&B==0?h[D+I][$+B]=!0:h[D+I][$+B]=!1}},Z=function(k){for(var T=r.getBCHTypeNumber(l),E=0;E<18;E+=1){var D=!k&&(T>>E&1)==1;h[Math.floor(E/3)][E%3+d-8-3]=D}for(var E=0;E<18;E+=1){var D=!k&&(T>>E&1)==1;h[E%3+d-8-3][Math.floor(E/3)]=D}},oe=function(k,T){for(var E=v<<3|T,D=r.getBCHTypeInfo(E),$=0;$<15;$+=1){var I=!k&&(D>>$&1)==1;$<6?h[$][8]=I:$<8?h[$+1][8]=I:h[d-15+$][8]=I}for(var $=0;$<15;$+=1){var I=!k&&(D>>$&1)==1;$<8?h[8][d-$-1]=I:$<9?h[8][15-$-1+1]=I:h[8][15-$-1]=I}h[d-8][8]=!k},de=function(k,T){for(var E=-1,D=d-1,$=7,I=0,B=r.getMaskFunction(T),G=d-1;G>0;G-=2)for(G==6&&(G-=1);;){for(var X=0;X<2;X+=1)if(h[D][G-X]==null){var ne=!1;I<k.length&&(ne=(k[I]>>>$&1)==1);var Y=B(D,G-X);Y&&(ne=!ne),h[D][G-X]=ne,$-=1,$==-1&&(I+=1,$=7)}if(D+=E,D<0||d<=D){D-=E,E=-E;break}}},ke=function(k,T){for(var E=0,D=0,$=0,I=new Array(T.length),B=new Array(T.length),G=0;G<T.length;G+=1){var X=T[G].dataCount,ne=T[G].totalCount-X;D=Math.max(D,X),$=Math.max($,ne),I[G]=new Array(X);for(var Y=0;Y<I[G].length;Y+=1)I[G][Y]=255&k.getBuffer()[Y+E];E+=X;var fe=r.getErrorCorrectPolynomial(ne),ce=i(I[G],fe.getLength()-1),Do=ce.mod(fe);B[G]=new Array(fe.getLength()-1);for(var Y=0;Y<B[G].length;Y+=1){var $o=Y+Do.getLength()-B[G].length;B[G][Y]=$o>=0?Do.getAt($o):0}}for(var Po=0,Y=0;Y<T.length;Y+=1)Po+=T[Y].totalCount;for(var Qn=new Array(Po),on=0,Y=0;Y<D;Y+=1)for(var G=0;G<T.length;G+=1)Y<I[G].length&&(Qn[on]=I[G][Y],on+=1);for(var Y=0;Y<$;Y+=1)for(var G=0;G<T.length;G+=1)Y<B[G].length&&(Qn[on]=B[G][Y],on+=1);return Qn},nn=function(k,T,E){for(var D=c.getRSBlocks(k,T),$=m(),I=0;I<E.length;I+=1){var B=E[I];$.put(B.getMode(),4),$.put(B.getLength(),r.getLengthInBits(B.getMode(),k)),B.write($)}for(var G=0,I=0;I<D.length;I+=1)G+=D[I].dataCount;if($.getLengthInBits()>G*8)throw"code length overflow. ("+$.getLengthInBits()+">"+G*8+")";for($.getLengthInBits()+4<=G*8&&$.put(0,4);$.getLengthInBits()%8!=0;)$.putBit(!1);for(;!($.getLengthInBits()>=G*8||($.put(p,8),$.getLengthInBits()>=G*8));)$.put(u,8);return ke($,D)};H.addData=function(k,T){T=T||"Byte";var E=null;switch(T){case"Numeric":E=f(k);break;case"Alphanumeric":E=C(k);break;case"Byte":E=g(k);break;case"Kanji":E=b(k);break;default:throw"mode:"+T}M.push(E),L=null},H.isDark=function(k,T){if(k<0||d<=k||T<0||d<=T)throw k+","+T;return h[k][T]},H.getModuleCount=function(){return d},H.make=function(){if(l<1){for(var k=1;k<40;k++){for(var T=c.getRSBlocks(k,v),E=m(),D=0;D<M.length;D++){var $=M[D];E.put($.getMode(),4),E.put($.getLength(),r.getLengthInBits($.getMode(),k)),$.write(E)}for(var I=0,D=0;D<T.length;D++)I+=T[D].dataCount;if(E.getLengthInBits()<=I*8)break}l=k}q(!1,W())},H.createTableTag=function(k,T){k=k||2,T=typeof T=="undefined"?k*4:T;var E="";E+='<table style="',E+=" border-width: 0px; border-style: none;",E+=" border-collapse: collapse;",E+=" padding: 0px; margin: "+T+"px;",E+='">',E+="<tbody>";for(var D=0;D<H.getModuleCount();D+=1){E+="<tr>";for(var $=0;$<H.getModuleCount();$+=1)E+='<td style="',E+=" border-width: 0px; border-style: none;",E+=" border-collapse: collapse;",E+=" padding: 0px; margin: 0px;",E+=" width: "+k+"px;",E+=" height: "+k+"px;",E+=" background-color: ",E+=H.isDark(D,$)?"#000000":"#ffffff",E+=";",E+='"/>';E+="</tr>"}return E+="</tbody>",E+="</table>",E},H.createSvgTag=function(k,T,E,D){var $={};typeof arguments[0]=="object"&&($=arguments[0],k=$.cellSize,T=$.margin,E=$.alt,D=$.title),k=k||2,T=typeof T=="undefined"?k*4:T,E=typeof E=="string"?{text:E}:E||{Line truncated
|
||||
`}return E%2&&k>0?ce.substring(0,ce.length-E-1)+Array(E+1).join("▀"):ce.substring(0,ce.length-1)};return H.createASCII=function(k,T){if(k=k||1,k<2)return et(T);k-=1,T=typeof T=="undefined"?k*2:T;var E=H.getModuleCount()*k+T*2,D=T,$=E-T,I,B,G,X,ne=Array(k+1).join("██"),Y=Array(k+1).join(" "),fe="",ce="";for(I=0;I<E;I+=1){for(G=Math.floor((I-D)/k),ce="",B=0;B<E;B+=1)X=1,D<=B&&B<$&&D<=I&&I<$&&H.isDark(G,Math.floor((B-D)/k))&&(X=0),ce+=X?ne:Y;for(G=0;G<k;G+=1)fe+=ce+`
|
||||
`}return fe.substring(0,fe.length-1)},H.renderTo2dContext=function(k,T){T=T||2;for(var E=H.getModuleCount(),D=0;D<E;D++)for(var $=0;$<E;$++)k.fillStyle=H.isDark(D,$)?"black":"white",k.fillRect(D*T,$*T,T,T)},H};e.stringToBytesFuncs={default:function(y){for(var w=[],p=0;p<y.length;p+=1){var u=y.charCodeAt(p);w.push(u&255)}return w}},e.stringToBytes=e.stringToBytesFuncs.default,e.createStringToBytes=function(y,w){var p=(function(){for(var l=P(y),v=function(){var N=l.read();if(N==-1)throw"eof";return N},h=0,d={};;){var L=l.read();if(L==-1)break;var M=v(),H=v(),q=v(),R=String.fromCharCode(L<<8|M),W=H<<8|q;d[R]=W,h+=1}if(h!=w)throw h+" != "+w;return d})(),u=63;return function(l){for(var v=[],h=0;h<l.length;h+=1){var d=l.charCodeAt(h);if(d<128)v.push(d);else{var L=p[l.charAt(h)];typeof L=="number"?(L&255)==L?v.push(L):(v.push(L>>>8),v.push(L&255)):v.push(u)}}return v}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var y=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],w=1335,p=7973,u=21522,l={},v=function(h){for(var d=0;h!=0;)d+=1,h>>>=1;return d};return l.getBCHTypeInfo=function(h){for(var d=h<<10;v(d)-v(w)>=0;)d^=w<<v(d)-v(w);return(h<<10|d)^u},l.getBCHTypeNumber=function(h){for(var d=h<<12;v(d)-v(p)>=0;)d^=p<<v(d)-v(p);return h<<12|d},l.getPatternPosition=function(h){return y[h-1]},l.getMaskFunction=function(h){switch(h){case o.PATTERN000:return function(d,L){return(d+L)%2==0};case o.PATTERN001:return function(d,L){return d%2==0};case o.PATTERN010:return function(d,L){return L%3==0};case o.PATTERN011:return function(d,L){return(d+L)%3==0};case o.PATTERN100:return function(d,L){return(Math.floor(d/2)+Math.floor(L/3))%2==0};case o.PATTERN101:return function(d,L){return d*L%2+d*L%3==0};case o.PATTERN110:return function(d,L){return(d*L%2+d*L%3)%2==0};case o.PATTERN111:return function(d,L){return(d*L%3+(d+L)%2)%2==0};default:throw"bad maskPattern:"+h}},l.getErrorCorrectPolynomial=function(h){for(var d=i([1],0),L=0;L<h;L+=1)d=d.multiply(i([1,s.gexp(L)],0));return d},l.getLengthInBits=function(h,d){if(1<=d&&d<10)switch(h){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw"mode:"+h}else if(d<27)switch(h){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw"mode:"+h}else if(d<41)switch(h){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw"mode:"+h}else throw"type:"+d},l.getLostPoint=function(h){for(var d=h.getModuleCount(),L=0,M=0;M<d;M+=1)for(var H=0;H<d;H+=1){for(var q=0,R=h.isDark(M,H),W=-1;W<=1;W+=1)if(!(M+W<0||d<=M+W))for(var N=-1;N<=1;N+=1)H+N<0||d<=H+N||W==0&&N==0||R==h.isDark(M+W,H+N)&&(q+=1);q>5&&(L+=3+q-5)}for(var M=0;M<d-1;M+=1)for(var H=0;H<d-1;H+=1){var U=0;h.isDark(M,H)&&(U+=1),h.isDark(M+1,H)&&(U+=1),h.isDark(M,H+1)&&(U+=1),h.isDark(M+1,H+1)&&(U+=1),(U==0||U==4)&&(L+=3)}for(var M=0;M<d;M+=1)for(var H=0;H<d-6;H+=1)h.isDark(M,H)&&!h.isDark(M,H+1)&&h.isDark(M,H+2)&&h.isDark(M,H+3)&&h.isDark(M,H+4)&&!h.isDark(M,H+5)&&h.isDark(M,H+6)&&(L+=40);for(var H=0;H<d;H+=1)for(var M=0;M<d-6;M+=1)h.isDark(M,H)&&!h.isDark(M+1,H)&&h.isDark(M+2,H)&&h.isDark(M+3,H)&&h.isDark(M+4,H)&&!h.isDark(M+5,H)&&h.isDark(M+6,H)&&(L+=40);for(var Z=0,H=0;H<d;H+=1)for(var M=0;M<d;M+=1)h.isDark(M,H)&&(Z+=1);var oe=Math.abs(100*Z/d/d-50)/5;return L+=oe*10,L},l})(),s=(function(){for(var y=new Array(256),w=new Array(256),p=0;p<8;p+=1)y[p]=1<<p;for(var p=8;p<256;p+=1)y[p]=y[p-4]^y[p-5]^y[p-6]^y[p-8];for(var p=0;p<255;p+=1)w[y[p]]=p;var u={};return u.glog=function(l){if(l<1)throw"glog("+l+")";return w[l]},u.gexp=function(l){for(;l<0;)l+=255;for(;l>=256;)l-=255;return y[l]},u})();function i(y,w){if(typeof y.length=="undefined")throw y.length+"/"+w;var p=(function(){for(var l=0;l<y.length&&y[l]==0;)l+=1;for(var v=new Array(y.length-l+w),h=0;h<y.length-l;h+=1)v[h]=y[h+l];return v})(),u={};return u.getAt=function(l){return p[l]},u.getLength=function(){return p.length},u.multiply=function(l){for(var v=new Array(u.getLength()+l.getLength()-1),h=0;h<u.getLength();h+=1)for(var d=0;d<l.getLength();d+=1)v[h+d]^=s.gexp(s.glog(u.getAt(h))+s.glog(l.getAt(d)));return i(v,0)},u.mod=function(l){if(u.ge
Line truncated
|
||||
`),hostName:s,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},c={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(n.port),protocol_version:o.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:s};return n.dns[0]&&(c.dns1=n.dns[0],c.dns2=n.dns[1]||n.dns[0]),c}function Fa(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ga(e){let t=globalThis;if(typeof t.CompressionStream=="undefined")return null;try{let n=new t.Blob([e]).stream().pipeThrough(new t.CompressionStream("deflate")),o=new Uint8Array(await new t.Response(n).arrayBuffer()),r=new Uint8Array(4+o.length);return new DataView(r.buffer).setUint32(0,e.length,!1),r.set(o,4),r}catch{return null}}async function wo(e,t,n=!0){let o=new TextEncoder().encode(JSON.stringify(Wa(e,t))),r=n?await Ga(o):null;return`vpn://${Fa(r!=null?r:o)}`}var ks=e=>e.replace(/^vpn:\/\//,"");var Cs=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],qa={opacity:0,filter:"blur(2px)"};function Ls(e,t,n){let o=e.getAnimations();O(e,t,n),o.forEach(r=>r.cancel())}var Ka=new Set(["offset","computedOffset","easing","composite"]),Va=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function Dt(...e){let t=[],n=[],o=new Set;for(let s of e)for(let i=s;i&&!o.has(i);i=i.parentElement)if(o.add(i),!(!(i instanceof HTMLElement)||i.classList.contains("closing")))for(let c of i.getAnimations()){let m=c.playState==="running"&&c.effect instanceof KeyframeEffect?c.effect.getKeyframes():[],f=m[m.length-1];if(f&&("width"in f||"maxWidth"in f)&&n.push({a:c,t:c.currentTime}),!(f!=null&&f.height)||f.height==="0px")continue;let C=getComputedStyle(i),g={},b={};for(let x of Object.keys(f))Ka.has(x)||(g[x]=C.getPropertyValue(Va(x)),b[x]=f[x]);t.push({el:i,a:c,t:c.currentTime,cur:g,to:b})}if(!t.length)return;[...t,...n].forEach(s=>s.a.cancel());let r=t.map(s=>getComputedStyle(s.el).height);for(let s of n)s.a.play(),s.a.currentTime=s.t;t.forEach((s,i)=>{s.a.play(),Math.abs(parseFloat(r[i])-parseFloat(String(s.to.height)))<.5?s.a.currentTime=s.t:s.a.effect.setKeyframes([s.cur,{...s.to,height:r[i]}])})}function ze(e,t={}){let n=a("div",{class:`acc${t.inset?" inset":""}`}),o=e.map((g,b)=>{var w;let x=g.body.filter(p=>!!p),S=!x.length,P=[g.icon,a("span",{class:"acc-title"},a("span",{class:"t"},g.title),(w=g.tag)!=null?w:null),g.val?a("span",{class:`acc-val${g.valHide?" hide-open":""}`},g.val):null],F=b===t.open&&!S,A=S?a("div",{class:"acc-head"},...P):a("button",{type:"button",class:"acc-head","aria-expanded":String(F),onclick:()=>C(y)},...P,z("chevron","i acc-chev")),y=a("div",{class:`acc-row${S?" still":""}${F?" open":""}`},A,a("div",{class:"acc-body"},...x));return n.appendChild(y),y}),r=g=>g.querySelector(".acc-body"),s=()=>o.forEach((g,b)=>{let x=g.classList.contains("open");g.classList.toggle("rt",b===0||x||o[b-1].classList.contains("open")),g.classList.toggle("rb",b===o.length-1||x||o[b+1].classList.contains("open"))}),i=g=>{let b=getComputedStyle(g),x={};for(let S of Cs)x[S]=S==="height"?`${g.getBoundingClientRect().height}px`:b[S];return x},c=()=>o.forEach(g=>{var b;return(b=g.querySelector("button.acc-head"))==null?void 0:b.setAttribute("aria-expanded",String(g.classList.contains("open")))}),m=g=>g.classList.contains("open")||g.classList.contains("closing"),f=g=>{if(!m(g))return qa;let b=getComputedStyle(r(g));return{opacity:b.opacity,filter:b.filter==="none"?"blur(0px)":b.filter}};function C(g){var w,p;let b=o.map(i),x=o.map(f),S=(w=t.hold)==null?void 0:w.call(t);o.forEach(u=>u.getAnimations().forEach(l=>l.cancel()));let P=!g.classList.contains("open"),F=o.filter(u=>m(u)&&!(u===g&&P));o.forEach(u=>{u.classList.remove("closing"),u!==g&&u.classList.remove("open")}),g.classList.toggle("open",P),P&&g.classList.add("opened"),s();let A=Lt(),y=o.map(i);if(S==null||S(),Dt(n.parentElement),o.forEach((u,l)=>{let v=()=>{u.classList.remove("closing"),u.classList.contains("open")||u.classList.remove("opened")};if(!Cs.some(h=>b[l][h]!==y[l][h]))return v();F.includes(u)&&u.classList.add("closing"),O(u,[b[l],y[l]],{duration:Le.duration,easing:Le.easing}).onfinish=v}),F.forEach(u=>{let l=x[o.indexOf(u)];Ls(r(u),[l,{opacity:0,filter:"blur(2px)"}],{duration:160*Number(l.opacity),easing:J,fill:"forwards"})}),P){let u=x[o.indexOf(g)];Ls(r(g),[u,{opacity:1,filter:"blur(0px)"}],{duration:300*(1-Number(u.opacity)),easing:"cubic-bezier(0,0,.58,1)"})}Tt(A),c(),(p=t.onToggle)==null||p.call(t,o.indexOf(g),P,!1)}return s(),{el:n,openIndex:()=>o.findIndex(g=>g.classList.contains("open")),setOpen(g){o.forEach((b,x)=>{[b,r(b)].forEach(P=>P.getAnimations().forEach(F=>F.cancel()));let S=x===g&&!b.classList.contains("still");b.classList.toggle(
Line truncated
|
||||
`).flatMap((g,b)=>b?[`
|
||||
`,Hs(g)]:[Hs(g)])),o=!!st(e.filename,e.conf),r=z("key"),s=z("x"),i=a("span",{},_("Show key")),c=a("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,te(i,t?_("Hide key"):_("Show key")),n.querySelectorAll(".secret").forEach(g=>Wn(g,t,Ss)),n.querySelectorAll(".mask").forEach(g=>Wn(g,!t,Ss)),Wn(r,!t,As),Wn(s,t,As)}},Is(r,s),i),m=a("button",{type:"button",class:"btn soft sm",onclick:g=>be(e.conf,_("Configuration copied"),g.currentTarget)},z("copy"),a("span",{class:"lbl"},_("Copy"))),f=a("div",{class:"filecard"},a("div",{class:"fc-row"},a("span",{class:"filecard-ic"},".conf"),a("span",{class:"t"},a("span",{class:"mono"},e.filename),a("span",{},_("For computers and routers")))),a("button",{type:"button",class:"btn accent sm block",onclick:()=>Gt(e.filename,e.conf)},z(o?"open":"download"),a("span",{},o?_("Share file"):_("Download")))),C=ze([{icon:ee("file"),title:_("Configuration"),body:[a("div",{class:"confbar"},c,m),n]}],{inset:!0});return a("div",{class:"step-box"},f,C.el)}function Fs(e){let t=a("span",{class:"osm-p"},he[e]),n=Ur(Rt(e,"ios"),Rt(e,"android"));return{el:a("span",{class:"scanline"},a("span",{},...ut(_("In %s:"),t)),n.el),set(o){te(t,he[o],void 0,{whole:!0}),n.set(Rt(o,"ios"),Rt(o,"android"))}}}function Gs(e){let t=a("span",{class:"tt"}),n=a("span",{class:"tt-m"}),o=a("span",{class:"hp-tip","aria-hidden":"true"},t,n),r=a("button",{type:"button",class:"hp-b",onclick:()=>Gt(e().file,e().text)},z("download")),s=a("button",{type:"button",class:"hp-b"},z("copy")),i=a("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},r,s,o),c=null,m=0,f=0,C=l=>{var v;return l===s&&s.classList.contains("done")?_("Copied"):(v=l.getAttribute("aria-label"))!=null?v:""},g=(l,v)=>{n.textContent=v;let h=n.offsetWidth+20;return Math.min(l.offsetLeft+l.offsetWidth/2,i.offsetWidth+46-h/2)},b=l=>`translateX(${l}px) translateX(-50%)`,x=()=>{let l=getComputedStyle(o);return{opacity:l.opacity,filter:l.filter==="none"?"blur(0px)":l.filter,transform:l.transform}},S=(l,v)=>{let h=o.getAnimations();O(o,l,v),h.forEach(d=>d.cancel())},P=l=>{let v=x();o.style.transform=b(l),S([v,{opacity:1,filter:"blur(0px)",transform:b(l)}],{duration:K.duration,easing:K.easing})},F=l=>te(t,l),A=l=>{if(clearTimeout(m),c===l&&o.classList.contains("on"))return;if(c=l,o.classList.contains("on")||+getComputedStyle(o).opacity>0){let h=C(l);return o.classList.add("on"),P(g(l,h)),F(h)}let v=()=>{let h=C(l);ae(t,h);let d=g(l,h);o.style.transform=b(d),o.classList.add("on"),S([{opacity:0,transform:`${b(d)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:b(d),filter:"blur(0px)"}],{duration:220,easing:Q})};performance.now()<f?v():m=window.setTimeout(v,420)},y=()=>{if(clearTimeout(m),c=null,!o.classList.contains("on"))return;f=performance.now()+500;let l=x();o.classList.remove("on"),S([l,{...l,opacity:0}],{duration:120,easing:"ease-out"})};for(let l of[r,s])l.addEventListener("pointerenter",v=>{v.pointerType==="mouse"&&A(l)}),l.addEventListener("focus",()=>{l.matches(":focus-visible")&&A(l)}),l.addEventListener("blur",v=>{i.contains(v.relatedTarget)||y()});i.addEventListener("pointerleave",y);let w=l=>{let v=z(l);s.querySelector("svg").replaceWith(v),O(v,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Te.duration,easing:Te.easing})},p=()=>{if(c!==s||!o.classList.contains("on"))return;let l=C(s);P(g(s,l)),F(l)},u=0;return s.addEventListener("click",()=>{let l=e();be(l.text,l.msg),clearTimeout(u),s.classList.contains("done")||(s.classList.add("done"),w("check"),p()),u=window.setTimeout(()=>{s.classList.remove("done"),w("copy"),p()},1600)}),{el:i,sync(){let l=e().app;r.setAttribute("aria-label",V(_("Download %s config"),l)),s.setAttribute("aria-label",V(_("Copy %s config"),l))}}}function qs(e,t){var n,o,r;return e?((n=e.setup)==null?void 0:n.state)==="trying"?"trying":e.handshake<=t?"waiting":((o=e.setup)==null?void 0:o.state)==="flowing"?"connected":((r=e.setup)==null?void 0:r.state)==="nodata"?"nodata":"waiting":"waiting"}function ja(e,t){switch(e){case"trying":return[_("Unable to complete the handshake"),_("Your network may be blocking the connection.")];case"connected":return[V(_("%s connected"),t.name),""];case"nodata":return[_("Handshake complete, but no data"),_("This device is using an outdated configuration.")];case"waiting":return[_("Waiting for the connection"),""]}}var Ks={waiting:"",trying:"trying",connected:"done",nodata:"nodata"};function Us(e){let t=a("b",{},_("Waiting for the connection")),n=a("span",{class:"ws",hidden:!0}),o=a("span",{class:"t"},t,n),r=a("div",{class:"way-text"},o),s=a("span",{class:"way-track"},a("span",{class:"way-glow"},a("span",{class:"run"},a("i")),a("span",{class:"knock"},a("i"))),a("span",{class:"way-fill"}),a("span",{class:"way-break"},a("i"))),i=a("div",{class:"way",role:"status","aria-live":"polite"},a("div",{class:"way-row"},a("span",{class:"way-end"},z(e.kind)),s,a("span",{class:"way-end home"},z("se
Line truncated
|
||||
"use strict";(()=>{var Xi=Object.create;var Xo=Object.defineProperty;var Ji=Object.getOwnPropertyDescriptor;var Zi=Object.getOwnPropertyNames;var ea=Object.getPrototypeOf,ta=Object.prototype.hasOwnProperty;var na=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var oa=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Zi(t))!ta.call(e,r)&&r!==n&&Xo(e,r,{get:()=>t[r],enumerable:!(o=Ji(t,r))||o.enumerable});return e};var ra=(e,t,n)=>(n=e!=null?Xi(ea(e)):{},oa(t||!e||!e.__esModule?Xo(n,"default",{value:e,enumerable:!0}):n,e));var qr=na((Fr,Wr)=>{"use strict";var Gr=(function(){var e=function(g,v){var d=236,u=17,l=g,b=n[v],y=null,p=0,C=null,k=[],A={},F=function(S,H){p=l*4+17,y=(function(L){for(var P=new Array(L),$=0;$<L;$+=1){P[$]=new Array(L);for(var I=0;I<L;I+=1)P[$][I]=null}return P})(p),N(0,0),N(p-7,0),N(0,p-7),Y(),q(),te(S,H),l>=7&&Z(S),C==null&&(C=Ie(l,b,k)),le(C,H)},N=function(S,H){for(var L=-1;L<=7;L+=1)if(!(S+L<=-1||p<=S+L))for(var P=-1;P<=7;P+=1)H+P<=-1||p<=H+P||(0<=L&&L<=6&&(P==0||P==6)||0<=P&&P<=6&&(L==0||L==6)||2<=L&&L<=4&&2<=P&&P<=4?y[S+L][H+P]=!0:y[S+L][H+P]=!1)},R=function(){for(var S=0,H=0,L=0;L<8;L+=1){F(!0,L);var P=r.getLostPoint(A);(L==0||S>P)&&(S=P,H=L)}return H},q=function(){for(var S=8;S<p-8;S+=1)y[S][6]==null&&(y[S][6]=S%2==0);for(var H=8;H<p-8;H+=1)y[6][H]==null&&(y[6][H]=H%2==0)},Y=function(){for(var S=r.getPatternPosition(l),H=0;H<S.length;H+=1)for(var L=0;L<S.length;L+=1){var P=S[H],$=S[L];if(y[P][$]==null)for(var I=-2;I<=2;I+=1)for(var G=-2;G<=2;G+=1)I==-2||I==2||G==-2||G==2||I==0&&G==0?y[P+I][$+G]=!0:y[P+I][$+G]=!1}},Z=function(S){for(var H=r.getBCHTypeNumber(l),L=0;L<18;L+=1){var P=!S&&(H>>L&1)==1;y[Math.floor(L/3)][L%3+p-8-3]=P}for(var L=0;L<18;L+=1){var P=!S&&(H>>L&1)==1;y[L%3+p-8-3][Math.floor(L/3)]=P}},te=function(S,H){for(var L=b<<3|H,P=r.getBCHTypeInfo(L),$=0;$<15;$+=1){var I=!S&&(P>>$&1)==1;$<6?y[$][8]=I:$<8?y[$+1][8]=I:y[p-15+$][8]=I}for(var $=0;$<15;$+=1){var I=!S&&(P>>$&1)==1;$<8?y[8][p-$-1]=I:$<9?y[8][15-$-1+1]=I:y[8][15-$-1]=I}y[p-8][8]=!S},le=function(S,H){for(var L=-1,P=p-1,$=7,I=0,G=r.getMaskFunction(H),W=p-1;W>0;W-=2)for(W==6&&(W-=1);;){for(var X=0;X<2;X+=1)if(y[P][W-X]==null){var oe=!1;I<S.length&&(oe=(S[I]>>>$&1)==1);var U=G(P,W-X);U&&(oe=!oe),y[P][W-X]=oe,$-=1,$==-1&&(I+=1,$=7)}if(P+=L,P<0||p<=P){P-=L,L=-L;break}}},me=function(S,H){for(var L=0,P=0,$=0,I=new Array(H.length),G=new Array(H.length),W=0;W<H.length;W+=1){var X=H[W].dataCount,oe=H[W].totalCount-X;P=Math.max(P,X),$=Math.max($,oe),I[W]=new Array(X);for(var U=0;U<I[W].length;U+=1)I[W][U]=255&S.getBuffer()[U+L];L+=X;var be=r.getErrorCorrectPolynomial(oe),ue=i(I[W],be.getLength()-1),Yo=ue.mod(be);G[W]=new Array(be.getLength()-1);for(var U=0;U<G[W].length;U+=1){var jo=U+Yo.getLength()-G[W].length;G[W][U]=jo>=0?Yo.getAt(jo):0}}for(var Qo=0,U=0;U<H.length;U+=1)Qo+=H[U].totalCount;for(var ao=new Array(Qo),fn=0,U=0;U<P;U+=1)for(var W=0;W<H.length;W+=1)U<I[W].length&&(ao[fn]=I[W][U],fn+=1);for(var U=0;U<$;U+=1)for(var W=0;W<H.length;W+=1)U<G[W].length&&(ao[fn]=G[W][U],fn+=1);return ao},Ie=function(S,H,L){for(var P=c.getRSBlocks(S,H),$=f(),I=0;I<L.length;I+=1){var G=L[I];$.put(G.getMode(),4),$.put(G.getLength(),r.getLengthInBits(G.getMode(),S)),G.write($)}for(var W=0,I=0;I<P.length;I+=1)W+=P[I].dataCount;if($.getLengthInBits()>W*8)throw"code length overflow. ("+$.getLengthInBits()+">"+W*8+")";for($.getLengthInBits()+4<=W*8&&$.put(0,4);$.getLengthInBits()%8!=0;)$.putBit(!1);for(;!($.getLengthInBits()>=W*8||($.put(d,8),$.getLengthInBits()>=W*8));)$.put(u,8);return me($,P)};A.addData=function(S,H){H=H||"Byte";var L=null;switch(H){case"Numeric":L=m(S);break;case"Alphanumeric":L=M(S);break;case"Byte":L=h(S);break;case"Kanji":L=x(S);break;default:throw"mode:"+H}k.push(L),C=null},A.isDark=function(S,H){if(S<0||p<=S||H<0||p<=H)throw S+","+H;return y[S][H]},A.getModuleCount=function(){return p},A.make=function(){if(l<1){for(var S=1;S<40;S++){for(var H=c.getRSBlocks(S,b),L=f(),P=0;P<k.length;P++){var $=k[P];L.put($.getMode(),4),L.put($.getLength(),r.getLengthInBits($.getMode(),S)),$.write(L)}for(var I=0,P=0;P<H.length;P++)I+=H[P].dataCount;if(L.getLengthInBits()<=I*8)break}l=S}F(!1,R())},A.createTableTag=function(S,H){S=S||2,H=typeof H=="undefined"?S*4:H;var L="";L+='<table style="',L+=" border-width: 0px; border-style: none;",L+=" border-collapse: collapse;",L+=" padding: 0px; margin: "+H+"px;",L+='">',L+="<tbody>";for(var P=0;P<A.getModuleCount();P+=1){L+="<tr>";for(var $=0;$<A.getModuleCount();$+=1)L+='<td style="',L+=" border-width: 0px; border-style: none;",L+=" border-collapse: collapse;",L+=" padding: 0px; margin: 0px;",L+=" width: "+S+"px;",L+=" height: "+S+"px;",L+=" background-color: ",L+=A.isDark(P,$)?"#000000":"#ffffff",L+=";",L+='"/>';L+="</tr>"}return L+="</tbody>",L+="</table>",L},A.createSvgTag=function(S,H,L,P){var $={};typeof arguments[0]=="object"&&($=arguments[0],S=$.cellSize,H=$.margin,L=$.alt,P=$.title),S=S||2,H=typeof H=="undefined"?S*4:H,L=typeof L=="string"?{text:L}:L||{Line truncated
|
||||
`}return L%2&&S>0?ue.substring(0,ue.length-L-1)+Array(L+1).join("▀"):ue.substring(0,ue.length-1)};return A.createASCII=function(S,H){if(S=S||1,S<2)return Ge(H);S-=1,H=typeof H=="undefined"?S*2:H;var L=A.getModuleCount()*S+H*2,P=H,$=L-H,I,G,W,X,oe=Array(S+1).join("██"),U=Array(S+1).join(" "),be="",ue="";for(I=0;I<L;I+=1){for(W=Math.floor((I-P)/S),ue="",G=0;G<L;G+=1)X=1,P<=G&&G<$&&P<=I&&I<$&&A.isDark(W,Math.floor((G-P)/S))&&(X=0),ue+=X?oe:U;for(W=0;W<S;W+=1)be+=ue+`
|
||||
`}return be.substring(0,be.length-1)},A.renderTo2dContext=function(S,H){H=H||2;for(var L=A.getModuleCount(),P=0;P<L;P++)for(var $=0;$<L;$++)S.fillStyle=A.isDark(P,$)?"black":"white",S.fillRect(P*H,$*H,H,H)},A};e.stringToBytesFuncs={default:function(g){for(var v=[],d=0;d<g.length;d+=1){var u=g.charCodeAt(d);v.push(u&255)}return v}},e.stringToBytes=e.stringToBytesFuncs.default,e.createStringToBytes=function(g,v){var d=(function(){for(var l=O(g),b=function(){var q=l.read();if(q==-1)throw"eof";return q},y=0,p={};;){var C=l.read();if(C==-1)break;var k=b(),A=b(),F=b(),N=String.fromCharCode(C<<8|k),R=A<<8|F;p[N]=R,y+=1}if(y!=v)throw y+" != "+v;return p})(),u=63;return function(l){for(var b=[],y=0;y<l.length;y+=1){var p=l.charCodeAt(y);if(p<128)b.push(p);else{var C=d[l.charAt(y)];typeof C=="number"?(C&255)==C?b.push(C):(b.push(C>>>8),b.push(C&255)):b.push(u)}}return b}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var g=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],v=1335,d=7973,u=21522,l={},b=function(y){for(var p=0;y!=0;)p+=1,y>>>=1;return p};return l.getBCHTypeInfo=function(y){for(var p=y<<10;b(p)-b(v)>=0;)p^=v<<b(p)-b(v);return(y<<10|p)^u},l.getBCHTypeNumber=function(y){for(var p=y<<12;b(p)-b(d)>=0;)p^=d<<b(p)-b(d);return y<<12|p},l.getPatternPosition=function(y){return g[y-1]},l.getMaskFunction=function(y){switch(y){case o.PATTERN000:return function(p,C){return(p+C)%2==0};case o.PATTERN001:return function(p,C){return p%2==0};case o.PATTERN010:return function(p,C){return C%3==0};case o.PATTERN011:return function(p,C){return(p+C)%3==0};case o.PATTERN100:return function(p,C){return(Math.floor(p/2)+Math.floor(C/3))%2==0};case o.PATTERN101:return function(p,C){return p*C%2+p*C%3==0};case o.PATTERN110:return function(p,C){return(p*C%2+p*C%3)%2==0};case o.PATTERN111:return function(p,C){return(p*C%3+(p+C)%2)%2==0};default:throw"bad maskPattern:"+y}},l.getErrorCorrectPolynomial=function(y){for(var p=i([1],0),C=0;C<y;C+=1)p=p.multiply(i([1,s.gexp(C)],0));return p},l.getLengthInBits=function(y,p){if(1<=p&&p<10)switch(y){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw"mode:"+y}else if(p<27)switch(y){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw"mode:"+y}else if(p<41)switch(y){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw"mode:"+y}else throw"type:"+p},l.getLostPoint=function(y){for(var p=y.getModuleCount(),C=0,k=0;k<p;k+=1)for(var A=0;A<p;A+=1){for(var F=0,N=y.isDark(k,A),R=-1;R<=1;R+=1)if(!(k+R<0||p<=k+R))for(var q=-1;q<=1;q+=1)A+q<0||p<=A+q||R==0&&q==0||N==y.isDark(k+R,A+q)&&(F+=1);F>5&&(C+=3+F-5)}for(var k=0;k<p-1;k+=1)for(var A=0;A<p-1;A+=1){var Y=0;y.isDark(k,A)&&(Y+=1),y.isDark(k+1,A)&&(Y+=1),y.isDark(k,A+1)&&(Y+=1),y.isDark(k+1,A+1)&&(Y+=1),(Y==0||Y==4)&&(C+=3)}for(var k=0;k<p;k+=1)for(var A=0;A<p-6;A+=1)y.isDark(k,A)&&!y.isDark(k,A+1)&&y.isDark(k,A+2)&&y.isDark(k,A+3)&&y.isDark(k,A+4)&&!y.isDark(k,A+5)&&y.isDark(k,A+6)&&(C+=40);for(var A=0;A<p;A+=1)for(var k=0;k<p-6;k+=1)y.isDark(k,A)&&!y.isDark(k+1,A)&&y.isDark(k+2,A)&&y.isDark(k+3,A)&&y.isDark(k+4,A)&&!y.isDark(k+5,A)&&y.isDark(k+6,A)&&(C+=40);for(var Z=0,A=0;A<p;A+=1)for(var k=0;k<p;k+=1)y.isDark(k,A)&&(Z+=1);var te=Math.abs(100*Z/p/p-50)/5;return C+=te*10,C},l})(),s=(function(){for(var g=new Array(256),v=new Array(256),d=0;d<8;d+=1)g[d]=1<<d;for(var d=8;d<256;d+=1)g[d]=g[d-4]^g[d-5]^g[d-6]^g[d-8];for(var d=0;d<255;d+=1)v[g[d]]=d;var u={};return u.glog=function(l){if(l<1)throw"glog("+l+")";return v[l]},u.gexp=function(l){for(;l<0;)l+=255;for(;l>=256;)l-=255;return g[l]},u})();function i(g,v){if(typeof g.length=="undefined")throw g.length+"/"+v;var d=(function(){for(var l=0;l<g.length&&g[l]==0;)l+=1;for(var b=new Array(g.length-l+v),y=0;y<g.length-l;y+=1)b[y]=g[y+l];return b})(),u={};return u.getAt=function(l){return d[l]},u.getLength=function(){return d.length},u.multiply=function(l){for(var b=new Array(u.getLength()+l.getLength()-1),y=0;y<u.getLength();y+=1)for(var p=0;p<l.getLength();p+=1)b[y+p]^=s.gexp(s.glog(u.getAt(y))+s.glog(l.getAt(p)));return i(b,0)},u.mod=function(l){if(u.ge
Line truncated
|
||||
`),hostName:s,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},c={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(n.port),protocol_version:o.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:s};return n.dns[0]&&(c.dns1=n.dns[0],c.dns2=n.dns[1]||n.dns[0]),c}function bc(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function xc(e){let t=globalThis;if(typeof t.CompressionStream=="undefined")return null;try{let n=new t.Blob([e]).stream().pipeThrough(new t.CompressionStream("deflate")),o=new Uint8Array(await new t.Response(n).arrayBuffer()),r=new Uint8Array(4+o.length);return new DataView(r.buffer).setUint32(0,e.length,!1),r.set(o,4),r}catch{return null}}async function Oo(e,t,n=!0){let o=new TextEncoder().encode(JSON.stringify(vc(e,t))),r=n?await xc(o):null;return`vpn://${bc(r!=null?r:o)}`}var Us=e=>e.replace(/^vpn:\/\//,"");var Ys=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],wc={opacity:0,filter:"blur(2px)"};function js(e,t,n){let o=e.getAnimations();D(e,t,n),o.forEach(r=>r.cancel())}var Mc=new Set(["offset","computedOffset","easing","composite"]),Ec=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function Gt(...e){let t=[],n=[],o=new Set;for(let s of e)for(let i=s;i&&!o.has(i);i=i.parentElement)if(o.add(i),!(!(i instanceof HTMLElement)||i.classList.contains("closing")))for(let c of i.getAnimations()){let f=c.playState==="running"&&c.effect instanceof KeyframeEffect?c.effect.getKeyframes():[],m=f[f.length-1];if(m&&("width"in m||"maxWidth"in m)&&n.push({a:c,t:c.currentTime}),!(m!=null&&m.height)||m.height==="0px")continue;let M=getComputedStyle(i),h={},x={};for(let w of Object.keys(m))Mc.has(w)||(h[w]=M.getPropertyValue(Ec(w)),x[w]=m[w]);t.push({el:i,a:c,t:c.currentTime,cur:h,to:x})}if(!t.length)return;[...t,...n].forEach(s=>s.a.cancel());let r=t.map(s=>getComputedStyle(s.el).height);for(let s of n)s.a.play(),s.a.currentTime=s.t;t.forEach((s,i)=>{s.a.play(),Math.abs(parseFloat(r[i])-parseFloat(String(s.to.height)))<.5?s.a.currentTime=s.t:s.a.effect.setKeyframes([s.cur,{...s.to,height:r[i]}])})}function ut(e,t={}){let n=a("div",{class:`acc${t.inset?" inset":""}`}),o=e.map((h,x)=>{var v;let w=h.body.filter(d=>!!d),T=!w.length,O=[h.icon,a("span",{class:"acc-title"},a("span",{class:"t"},h.title),(v=h.tag)!=null?v:null),h.val?a("span",{class:`acc-val${h.valHide?" hide-open":""}`},h.val):null],B=x===t.open&&!T,E=T?a("div",{class:"acc-head"},...O):a("button",{type:"button",class:"acc-head","aria-expanded":String(B),onclick:()=>M(g)},...O,V("chevron","i acc-chev")),g=a("div",{class:`acc-row${T?" still":""}${B?" open":""}${h.aside?" has-aside":""}`},E,h.aside?a("div",{class:"acc-aside"},h.aside):null,a("div",{class:"acc-body"},...w));return n.appendChild(g),g}),r=h=>h.querySelector(".acc-body"),s=()=>{let h=o.filter(x=>!x.hidden);h.forEach((x,w)=>{let T=x.classList.contains("open");x.classList.toggle("rt",w===0||T||h[w-1].classList.contains("open")),x.classList.toggle("rb",w===h.length-1||T||h[w+1].classList.contains("open"))}),o.forEach(x=>{x.classList.toggle("first",x===h[0]),x.classList.toggle("last",x===h[h.length-1])})},i=h=>{let x=getComputedStyle(h),w={};for(let T of Ys)w[T]=T==="height"?`${h.getBoundingClientRect().height}px`:x[T];return w},c=()=>o.forEach(h=>{var x;return(x=h.querySelector("button.acc-head"))==null?void 0:x.setAttribute("aria-expanded",String(h.classList.contains("open")))}),f=h=>h.classList.contains("open")||h.classList.contains("closing"),m=h=>{if(!f(h))return wc;let x=getComputedStyle(r(h));return{opacity:x.opacity,filter:x.filter==="none"?"blur(0px)":x.filter}};function M(h){var v,d;let x=o.map(i),w=o.map(m),T=(v=t.hold)==null?void 0:v.call(t);o.forEach(u=>u.getAnimations().forEach(l=>l.cancel()));let O=!h.classList.contains("open"),B=o.filter(u=>f(u)&&!(u===h&&O));o.forEach(u=>{u.classList.remove("closing"),u!==h&&u.classList.remove("open")}),h.classList.toggle("open",O),O&&h.classList.add("opened"),s();let E=Ot(),g=o.map(i);if(T==null||T(),Gt(n.parentElement),o.forEach((u,l)=>{let b=()=>{u.classList.remove("closing"),u.classList.contains("open")||u.classList.remove("opened")};if(!Ys.some(y=>x[l][y]!==g[l][y]))return b();B.includes(u)&&u.classList.add("closing"),D(u,[x[l],g[l]],{duration:_e.duration,easing:_e.easing}).onfinish=b}),B.forEach(u=>{let l=w[o.indexOf(u)];js(r(u),[l,{opacity:0,filter:"blur(2px)"}],{duration:160*Number(l.opacity),easing:J,fill:"forwards"})}),O){let u=w[o.indexOf(h)];js(r(h),[u,{opacity:1,filter:"blur(0px)"}],{duration:300*(1-Number(u.opacity)),easing:"cubic-bezier(0,0,.58,1)"})}Rt(E),c(),(d=t.onToggle)==null||d.call(t,o.indexOf(h),O,!1)}return s(),{el:n,openInde
Line truncated
|
||||
`).flatMap((h,x)=>x?[`
|
||||
`,ei(h)]:[ei(h)])),o=!!at(e.filename,e.conf),r=V("key"),s=V("x"),i=a("span",{},_("Show key")),c=a("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,ee(i,t?_("Hide key"):_("Show key")),n.querySelectorAll(".secret").forEach(h=>Xn(h,t,Js)),n.querySelectorAll(".mask").forEach(h=>Xn(h,!t,Js)),Xn(r,!t,Zs),Xn(s,t,Zs)}},ci(r,s),i),f=a("button",{type:"button",class:"btn soft sm",onclick:h=>ge(e.conf,_("Configuration copied"),h.currentTarget)},V("copy"),a("span",{class:"lbl"},_("Copy"))),m=a("div",{class:"filecard"},a("div",{class:"fc-row"},a("span",{class:"filecard-ic"},".conf"),a("span",{class:"t"},a("span",{class:"mono"},e.filename),a("span",{},_("For computers and routers")))),a("button",{type:"button",class:"btn accent sm block",onclick:()=>Xt(e.filename,e.conf)},V(o?"open":"download"),a("span",{},o?_("Share file"):_("Download")))),M=ut([{icon:ne("file"),title:_("Configuration"),body:[a("div",{class:"confbar"},c,f),n]}],{inset:!0});return a("div",{class:"step-box"},m,M.el)}function di(e){let t=a("span",{class:"osm-p"},we[e]),n=ds(Kt(e,"ios"),Kt(e,"android"));return{el:a("span",{class:"scanline"},a("span",{},...ht(_("In %s:"),t)),n.el),set(o){ee(t,we[o],void 0,{whole:!0}),n.set(Kt(o,"ios"),Kt(o,"android"))}}}function ui(e){let t=a("span",{class:"tt"}),n=a("span",{class:"tt-m"}),o=a("span",{class:"hp-tip","aria-hidden":"true"},t,n),r=a("button",{type:"button",class:"hp-b",onclick:()=>Xt(e().file,e().text)},V("download")),s=a("button",{type:"button",class:"hp-b"},V("copy")),i=a("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},r,s,o),c=null,f=0,m=0,M=l=>{var b;return l===s&&s.classList.contains("done")?_("Copied"):(b=l.getAttribute("aria-label"))!=null?b:""},h=(l,b)=>{n.textContent=b;let y=n.offsetWidth+20;return Math.min(l.offsetLeft+l.offsetWidth/2,i.offsetWidth+30-y/2)},x=l=>`translateX(${l}px) translateX(-50%)`,w=()=>{let l=getComputedStyle(o);return{opacity:l.opacity,filter:l.filter==="none"?"blur(0px)":l.filter,transform:l.transform}},T=(l,b)=>{let y=o.getAnimations();D(o,l,b),y.forEach(p=>p.cancel())},O=l=>{let b=w();o.style.transform=x(l),T([b,{opacity:1,filter:"blur(0px)",transform:x(l)}],{duration:K.duration,easing:K.easing})},B=l=>ee(t,l),E=l=>{if(clearTimeout(f),c===l&&o.classList.contains("on"))return;if(c=l,o.classList.contains("on")||+getComputedStyle(o).opacity>0){let y=M(l);return o.classList.add("on"),O(h(l,y)),B(y)}let b=()=>{let y=M(l);se(t,y);let p=h(l,y);o.style.transform=x(p),o.classList.add("on"),T([{opacity:0,transform:`${x(p)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:x(p),filter:"blur(0px)"}],{duration:220,easing:Q})};performance.now()<m?b():f=window.setTimeout(b,420)},g=()=>{if(clearTimeout(f),c=null,!o.classList.contains("on"))return;m=performance.now()+500;let l=w();o.classList.remove("on"),T([l,{...l,opacity:0}],{duration:120,easing:"ease-out"})};for(let l of[r,s])l.addEventListener("pointerenter",b=>{b.pointerType==="mouse"&&E(l)}),l.addEventListener("focus",()=>{l.matches(":focus-visible")&&E(l)}),l.addEventListener("blur",b=>{i.contains(b.relatedTarget)||g()});i.addEventListener("pointerleave",g);let v=l=>{let b=V(l);s.querySelector("svg").replaceWith(b),D(b,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Se.duration,easing:Se.easing})},d=()=>{if(c!==s||!o.classList.contains("on"))return;let l=M(s);O(h(s,l)),B(l)},u=0;return s.addEventListener("click",()=>{let l=e();ge(l.text,l.msg),clearTimeout(u),s.classList.contains("done")||(s.classList.add("done"),v("check"),d()),u=window.setTimeout(()=>{s.classList.remove("done"),v("copy"),d()},1600)}),{el:i,sync(){let l=e().app;r.setAttribute("aria-label",z(_("Download %s config"),l)),s.setAttribute("aria-label",z(_("Copy %s config"),l))}}}function pi(e,t){var n,o,r;return e?((n=e.setup)==null?void 0:n.state)==="trying"?"trying":e.handshake<=t?"waiting":((o=e.setup)==null?void 0:o.state)==="flowing"?"connected":((r=e.setup)==null?void 0:r.state)==="nodata"?"nodata":"waiting":"waiting"}function Tc(e,t){switch(e){case"trying":return[_("Unable to complete the handshake"),_("Your network may be blocking the connection.")];case"connected":return[z(_("%s connected"),t.name),""];case"nodata":return[_("Handshake complete, but no data"),_("The router drops its traffic: the address does not match.")];case"waiting":return[_("Waiting for the connection"),""]}}var fi={waiting:"",trying:"trying",connected:"done",nodata:"nodata"};function hi(e){let t=a("b",{},_("Waiting for the connection")),n=a("span",{class:"ws",hidden:!0}),o=a("span",{class:"t"},t,n),r=a("div",{class:"way-text"},o),s=a("span",{class:"way-track"},a("span",{class:"way-glow"},a("span",{class:"run"},a("i")),a("span",{class:"knock"},a("i"))),a("span",{class:"way-fill"}),a("span",{class:"way-break"},a("i"))),i=a("div",{class:"way",role:"status","aria-live":"polite"},a("div",{class:"way-row"},a("span",{class:"way-end"},V(e.kind)),s,a("span",{class:"way-end ho
Line truncated
|
||||
@@ -275,7 +275,7 @@ function shell(r) {
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>${html_escape(title)}</title>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs';
|
||||
import { _ } from 'dawnline.i18n';
|
||||
|
||||
export const VERSION = '0.14.1';
|
||||
export const VERSION = '0.15.0';
|
||||
/** GitHub repository with Dawnline releases (updates and the installer). */
|
||||
export const REPO = 'tickcount/luci-app-dawnline';
|
||||
export const RUN_DIR = '/var/run/dawnline';
|
||||
|
||||
@@ -133,8 +133,9 @@ const prelude = (lang, db) => `(() => {
|
||||
});
|
||||
addEventListener('DOMContentLoaded', () => {
|
||||
const s = document.createElement('style');
|
||||
// The demo's chip and GitHub pill go, and the path takes the row again, as on a router's page.
|
||||
s.textContent = '.dm-chip, .dm-gh { display: none !important; } .cr-path { flex: 1 !important; }';
|
||||
// The demo's chip, GitHub knob and set-up state switch go, and the path takes the row again, as on a router's
|
||||
// page.
|
||||
s.textContent = '.dm-chip, .dm-gh, .dm-way { display: none !important; } .cr-path { flex: 1 !important; }';
|
||||
document.head.append(s);
|
||||
});
|
||||
})()`;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "dawnline-web",
|
||||
"version": "0.14.1",
|
||||
"version": "0.15.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "dawnline-web",
|
||||
"version": "0.14.1",
|
||||
"version": "0.15.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"qrcode-generator": "1.4.4"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dawnline-web",
|
||||
"version": "0.14.1",
|
||||
"version": "0.15.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// What the demo adds to the breadcrumb: the scenario chip right after the path,
|
||||
// and a GitHub pill just before the page's language picker (none over a card
|
||||
// and a GitHub knob (its mark only) just before the page's language picker (none over a card
|
||||
// alone, which has no picker either). On a phone the pill would crowd out the names, so it
|
||||
// gives way to a button in the scenario drawer (demo.css). The portal redraws
|
||||
// the breadcrumb with the page and knows nothing of either, so both go back in
|
||||
// the breadcrumb with the page and says when (onCrumbs), so both go back in
|
||||
// place after each redraw; a language change makes both again in it.
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { onLang } from '../i18n';
|
||||
import { onCrumbs } from '../page/frame';
|
||||
import { REPO } from './data';
|
||||
import { scenarioChip } from './picker';
|
||||
import type { DemoRouter } from './router';
|
||||
@@ -15,15 +16,9 @@ export function mountCrumbs(router: DemoRouter) {
|
||||
const app = document.getElementById('app')!;
|
||||
const make = () => ({
|
||||
chip: scenarioChip(router),
|
||||
gh: h(
|
||||
'a',
|
||||
{ class: 'dm-gh', href: REPO, target: '_blank', rel: 'noopener', 'aria-label': _('Dawnline on GitHub') },
|
||||
ic('github'),
|
||||
h('span', {}, 'GitHub'),
|
||||
),
|
||||
gh: h('a', { class: 'dm-gh', href: REPO, target: '_blank', rel: 'noopener', 'aria-label': _('Dawnline on GitHub') }, ic('github')),
|
||||
});
|
||||
let { chip, gh } = make();
|
||||
// Our own insertions call this again: by then both are in place and nothing moves.
|
||||
const keep = () => {
|
||||
const crumbs = app.querySelector('.crumbs');
|
||||
const path = crumbs?.querySelector('.cr-path');
|
||||
@@ -32,7 +27,8 @@ export function mountCrumbs(router: DemoRouter) {
|
||||
const lang = crumbs.querySelector('.cr-lang');
|
||||
if (lang && lang.previousElementSibling !== gh) lang.before(gh);
|
||||
};
|
||||
new MutationObserver(keep).observe(app, { childList: true, subtree: true });
|
||||
// Each time the page draws its breadcrumb again (a repaint, the language changed).
|
||||
onCrumbs(keep);
|
||||
keep();
|
||||
// The page has redrawn its breadcrumb in the new language by now (main.ts listens first).
|
||||
onLang(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* The portal demo's stylesheet: the portal's own, then the demo's pieces in its tokens — the "Demo"
|
||||
chip after the breadcrumb's path, the GitHub pill beside the page's QR knob, the scenario
|
||||
chip after the breadcrumb's path, the GitHub knob before the page's language, the scenario
|
||||
rows in the drawer, and the set-up state switch beside the set-up sheet's ×. */
|
||||
@import '../styles/index.css';
|
||||
|
||||
@@ -40,20 +40,16 @@
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
/* GitHub: a pill of the QR knob's height and fill, just before it. On a phone it would crowd out the
|
||||
names (the server's and the person's): there it is a button in the drawer instead. */
|
||||
/* GitHub: a knob with its mark only, as the QR knob, just before the language. On a phone it would crowd out
|
||||
the names (the server's and the person's): there it is a button in the drawer instead. */
|
||||
.dm-gh {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0 12px 0 10px;
|
||||
border-radius: 999px;
|
||||
border-radius: 50%;
|
||||
background: var(--knob);
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.01em;
|
||||
text-decoration: none;
|
||||
flex: none;
|
||||
transition:
|
||||
@@ -179,18 +175,8 @@
|
||||
.dm-way[aria-expanded='true'] {
|
||||
background: color-mix(in srgb, var(--knob), var(--text) 10%);
|
||||
}
|
||||
.dm-way .i {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: var(--text-2);
|
||||
transform: rotate(90deg);
|
||||
transition: transform 240ms var(--ease-out);
|
||||
}
|
||||
.dm-way[aria-expanded='true'] .i {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.dm-way .dot,
|
||||
.dm-way-pop .dot {
|
||||
.pp-pop .dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
@@ -200,103 +186,21 @@
|
||||
opacity 150ms;
|
||||
}
|
||||
.dm-way .dot.warn,
|
||||
.dm-way-pop .dot.warn {
|
||||
.pp-pop .dot.warn {
|
||||
background: var(--warn);
|
||||
}
|
||||
.dm-way .dot.ok,
|
||||
.dm-way-pop .dot.ok {
|
||||
.pp-pop .dot.ok {
|
||||
background: var(--ok);
|
||||
}
|
||||
|
||||
/* Its popup: segments in one pill frame, a step above the sheet each (white on grey in light), a tail down
|
||||
to the pill, and a dark, softly blurred halo behind that fades out around it. */
|
||||
.dm-way-pop {
|
||||
--frame: color-mix(in srgb, var(--field), var(--knob) 55%);
|
||||
--seg: color-mix(in srgb, var(--knob), var(--text) 2%);
|
||||
--seg-hover: color-mix(in srgb, var(--knob), var(--text) 6%);
|
||||
position: fixed;
|
||||
z-index: 60;
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
padding: 3px;
|
||||
border-radius: 999px;
|
||||
background: var(--frame);
|
||||
box-shadow: var(--pop-shadow);
|
||||
}
|
||||
.dm-way-pop::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -5px;
|
||||
left: var(--tail, 50%);
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: -6px;
|
||||
border-radius: 0 0 3px 0;
|
||||
background: var(--frame);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.dm-way-pop button {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
height: 34px;
|
||||
padding: 0 10px;
|
||||
border-radius: 10px;
|
||||
background: var(--seg);
|
||||
color: color-mix(in srgb, var(--text-2), var(--text-3) 35%);
|
||||
font-size: 12.5px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
color 150ms,
|
||||
background-color 150ms,
|
||||
transform 150ms var(--ease-out);
|
||||
}
|
||||
/* The ends follow the frame: half the segment's height (a larger radius would shrink every corner). */
|
||||
.dm-way-pop button:first-of-type {
|
||||
border-radius: 17px 10px 10px 17px;
|
||||
padding-left: 13px;
|
||||
}
|
||||
.dm-way-pop button:last-of-type {
|
||||
border-radius: 10px 17px 17px 10px;
|
||||
padding-right: 13px;
|
||||
}
|
||||
.dm-way-pop button:hover {
|
||||
color: color-mix(in srgb, var(--text-2), var(--text) 45%);
|
||||
background: var(--seg-hover);
|
||||
}
|
||||
.dm-way-pop button:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
.dm-way-pop button[aria-checked='true'] {
|
||||
color: var(--text);
|
||||
}
|
||||
.dm-way-pop .dot {
|
||||
/* The set-up state's dots in the shared popup (styles/pick.css): faint, full on the one picked or pointed at. */
|
||||
.pp-pop .dot {
|
||||
background: currentColor;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.dm-way-pop button[aria-checked='true'] .dot,
|
||||
.dm-way-pop button:hover .dot {
|
||||
.pp-pop button[aria-checked='true'] .dot,
|
||||
.pp-pop button:hover .dot,
|
||||
.pp-pop button.hot .dot {
|
||||
opacity: 1;
|
||||
}
|
||||
.dm-way-halo {
|
||||
position: fixed;
|
||||
z-index: 59;
|
||||
pointer-events: none;
|
||||
background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.35) 55%, transparent);
|
||||
-webkit-backdrop-filter: blur(3px);
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent 92%);
|
||||
mask-image: radial-gradient(closest-side, #000 60%, transparent 92%);
|
||||
}
|
||||
@media (prefers-color-scheme: light) {
|
||||
.dm-way-pop {
|
||||
--frame: var(--knob);
|
||||
--seg: var(--raised);
|
||||
--seg-hover: color-mix(in srgb, var(--raised), var(--text) 4%);
|
||||
}
|
||||
.dm-way-halo {
|
||||
background: radial-gradient(closest-side, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0.07) 55%, transparent);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<meta
|
||||
name="description"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// The demo's set-up state switch: a pill beside the set-up sheet's ×, so a visitor can see each state the way
|
||||
// shows (waiting, knocks that never finish, no data, connected) without a device. Its popup is a row of segments
|
||||
// in one pill frame, above the pill with a tail pointing at it and a dark halo behind. Only on the set-up view:
|
||||
// shows (waiting, knocks that never finish, no data, connected) without a device: a pick pill (ui/pick.ts), its
|
||||
// popup above it. Only on the set-up view:
|
||||
// another view in the same sheet (a question, a device's page) fades it out. Picking holds the device in that
|
||||
// state on the demo's router and polls at once; Auto is the demo's own timing.
|
||||
// state on the demo's router and polls at once; Auto is the demo's own timing, and where each opening starts.
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { EASE_IN, EASE_OUT, POP, play } from '../motion';
|
||||
import { morphText, setText } from '../ui/morph';
|
||||
import { h } from '../dom';
|
||||
import { EASE_IN, SMOOTH, play } from '../motion';
|
||||
import { pollNow } from '../flows/wait';
|
||||
import { pickPill, type PickPill } from '../ui/pick';
|
||||
import { onSheetChange } from '../ui/sheet';
|
||||
import type { DemoWay } from './data';
|
||||
import type { DemoRouter } from './router';
|
||||
|
||||
@@ -21,11 +22,6 @@ const PICKS: [Pick, () => string, Tone][] = [
|
||||
['nodata', () => _('No data'), 'warn'],
|
||||
['connected', () => _('Online'), 'ok'],
|
||||
];
|
||||
const pick = (p: Pick) => PICKS.find((x) => x[0] === p)!;
|
||||
|
||||
/** The gap between the pill and the popup above it, and how far the halo reaches out (up, sideways, down). */
|
||||
const GAP = 18;
|
||||
const HALO = { x: 64, up: 48, down: 14 };
|
||||
|
||||
/** Gone from where it stands, so one leaving while it still comes in turns back from there. */
|
||||
function leave(el: Element, frames: Keyframe, ms: number) {
|
||||
@@ -49,102 +45,27 @@ function leave(el: Element, frames: Keyframe, ms: number) {
|
||||
export function mountWayPick(router: DemoRouter) {
|
||||
/** What each device's pill says: what was picked here, else what the router holds it in. */
|
||||
const shown = new Map<string, Pick>();
|
||||
let pop: HTMLElement | null = null;
|
||||
let halo: HTMLElement | null = null;
|
||||
let anchor: HTMLElement | null = null;
|
||||
|
||||
function closePop() {
|
||||
if (!pop) return;
|
||||
leave(pop, { transform: 'scale(.96)', filter: 'blur(3px)' }, 120);
|
||||
if (halo) leave(halo, {}, 160);
|
||||
anchor?.setAttribute('aria-expanded', 'false');
|
||||
pop = halo = anchor = null;
|
||||
}
|
||||
|
||||
function openPop(pill: HTMLElement, id: string, paint: () => void) {
|
||||
const now = shown.get(id) ?? router.wayOf(id);
|
||||
const m = h(
|
||||
'div',
|
||||
{ class: 'dm-way-pop', role: 'menu' },
|
||||
...PICKS.map(([p, label, tone]) =>
|
||||
h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
role: 'menuitemradio',
|
||||
'aria-checked': String(p === now),
|
||||
onclick: () => {
|
||||
closePop();
|
||||
shown.set(id, p);
|
||||
router.holdWay(id, p);
|
||||
paint();
|
||||
pollNow();
|
||||
},
|
||||
},
|
||||
h('span', { class: `dot ${tone}` }),
|
||||
label(),
|
||||
),
|
||||
),
|
||||
);
|
||||
document.body.append(m);
|
||||
// Centred over the pill, inside the sheet where it fits (else the screen), the tail on the pill's middle.
|
||||
const r = pill.getBoundingClientRect();
|
||||
const box = pill.closest('.sheet')?.getBoundingClientRect() ?? { left: 0, right: innerWidth };
|
||||
const w = m.offsetWidth;
|
||||
const mid = r.left + r.width / 2;
|
||||
const lo = Math.max(12, box.left + 10);
|
||||
const hi = Math.min(innerWidth - 12, box.right - 10);
|
||||
const left = Math.max(lo, Math.min(mid - w / 2, hi - w));
|
||||
const top = r.top - GAP - m.offsetHeight;
|
||||
Object.assign(m.style, { left: `${left}px`, top: `${top}px`, transformOrigin: `${mid - left}px bottom` });
|
||||
m.style.setProperty('--tail', `${mid - left}px`);
|
||||
// The halo reaches up and out but stops short of the pill, which stays sharp.
|
||||
const sc = h('div', { class: 'dm-way-halo' });
|
||||
Object.assign(sc.style, {
|
||||
left: `${left - HALO.x}px`,
|
||||
top: `${top - HALO.up}px`,
|
||||
width: `${w + HALO.x * 2}px`,
|
||||
height: `${m.offsetHeight + HALO.up + HALO.down}px`,
|
||||
});
|
||||
m.before(sc);
|
||||
play(sc, [{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: EASE_OUT });
|
||||
play(
|
||||
m,
|
||||
[
|
||||
{ opacity: 0, transform: 'scale(.9)', filter: 'blur(4px)' },
|
||||
{ opacity: 1, transform: 'none', filter: 'none' },
|
||||
],
|
||||
{ duration: POP.duration, easing: POP.easing },
|
||||
);
|
||||
pop = m;
|
||||
halo = sc;
|
||||
anchor = pill;
|
||||
pill.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
/** The pill on the sheet now. */
|
||||
let live: PickPill<Pick> | null = null;
|
||||
|
||||
function makePill(id: string): HTMLElement {
|
||||
const dot = h('span', { class: 'dot' });
|
||||
const lbl = h('span', {});
|
||||
const pill = h(
|
||||
'button',
|
||||
{ type: 'button', class: 'dm-way', 'aria-haspopup': 'menu', 'aria-expanded': 'false', 'aria-label': _('Set-up state') },
|
||||
dot,
|
||||
lbl,
|
||||
ic('chevron', 'i'),
|
||||
);
|
||||
const paint = (morph = true) => {
|
||||
const [, label, tone] = pick(shown.get(id) ?? router.wayOf(id));
|
||||
dot.className = `dot ${tone}`;
|
||||
if (morph) morphText(lbl, label());
|
||||
else setText(lbl, label());
|
||||
};
|
||||
paint(false);
|
||||
pill.addEventListener('click', () => (anchor === pill ? closePop() : (closePop(), openPop(pill, id, () => paint()))));
|
||||
return pill;
|
||||
live = pickPill<Pick>({
|
||||
cls: 'dm-way',
|
||||
label: () => _('Set-up state'),
|
||||
options: PICKS.map(([value, label, tone]) => ({ value, label, lead: () => h('span', { class: `dot ${tone}` }) })),
|
||||
value: shown.get(id) ?? router.wayOf(id),
|
||||
pick: (p) => {
|
||||
shown.set(id, p);
|
||||
router.holdWay(id, p);
|
||||
pollNow();
|
||||
// Its width glides with its words (SMOOTH): the title makes room for where it ends.
|
||||
setTimeout(place, SMOOTH.duration + 40);
|
||||
},
|
||||
});
|
||||
return live.el;
|
||||
}
|
||||
|
||||
function place() {
|
||||
if (anchor && !anchor.isConnected) closePop();
|
||||
const sheet = document.querySelector<HTMLElement>('.sheet-root.open .sheet');
|
||||
const id = router.settingUp();
|
||||
const setup = !!sheet && !!id && !!sheet.querySelector('.way') && !sheet.classList.contains('asks');
|
||||
@@ -152,12 +73,18 @@ export function mountWayPick(router: DemoRouter) {
|
||||
if (setup && el.parentElement === sheet && el.dataset.id === id) return;
|
||||
el.classList.add('gone');
|
||||
el.parentElement?.querySelectorAll<HTMLElement>('.vhead').forEach((hd) => (hd.style.paddingRight = ''));
|
||||
if (anchor === el) closePop();
|
||||
if (live?.el === el) {
|
||||
live.close();
|
||||
live = null;
|
||||
}
|
||||
leave(el, { transform: 'scale(.9)', filter: 'blur(3px)' }, 160);
|
||||
});
|
||||
if (!sheet || !setup || !id) return;
|
||||
let pill = sheet.querySelector<HTMLElement>('.dm-way:not(.gone)');
|
||||
if (!pill) {
|
||||
// A set-up opened anew starts from the default: the demo's own timing, nothing held from the last time.
|
||||
shown.delete(id);
|
||||
if (router.wayOf(id) !== 'auto') router.holdWay(id, 'auto');
|
||||
pill = makePill(id);
|
||||
pill.dataset.id = id;
|
||||
sheet.append(pill);
|
||||
@@ -179,22 +106,6 @@ export function mountWayPick(router: DemoRouter) {
|
||||
}
|
||||
}
|
||||
|
||||
new MutationObserver(place).observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });
|
||||
document.addEventListener('pointerdown', (e) => {
|
||||
const t = e.target as Element;
|
||||
if (pop && !pop.contains(t) && !anchor?.contains(t)) closePop();
|
||||
});
|
||||
// Escape takes the popup only, not the sheet under it.
|
||||
document.addEventListener(
|
||||
'keydown',
|
||||
(e) => {
|
||||
if (!pop || e.key !== 'Escape') return;
|
||||
e.stopPropagation();
|
||||
closePop();
|
||||
},
|
||||
true,
|
||||
);
|
||||
// A wheel or a swipe closes it; the sheet's own scroll as it settles does not.
|
||||
for (const ev of ['wheel', 'touchmove'])
|
||||
addEventListener(ev, (e) => pop && !pop.contains(e.target as Node) && closePop(), { passive: true, capture: true });
|
||||
// The sheet says when it changes (a view shown, the device arrived, the sheet gone): nothing to watch.
|
||||
onSheetChange(place);
|
||||
}
|
||||
@@ -1,22 +1,76 @@
|
||||
// This page on another device: from the breadcrumb, its link as a code for a
|
||||
// phone's camera, and the link itself to copy or share.
|
||||
// This page on another device: a dropdown from the breadcrumb's QR knob (ui/drop.ts: placed, coming and going and
|
||||
// shut as every dropdown is), the page's link as a code for a phone's camera, and under it Copy link (it says
|
||||
// Copied for a moment) and Share where the system has it.
|
||||
|
||||
import { h } from '../dom';
|
||||
import { pageUrl } from '../state';
|
||||
import { linkRow, qrBox } from '../ui/codes';
|
||||
import { head, openSheet, sub } from '../ui/sheet';
|
||||
import { h, ic } from '../dom';
|
||||
import { placeName, pageUrl } from '../state';
|
||||
import { qrBox } from '../ui/codes';
|
||||
import { appear, closeDrop, EDGE, GAP, opened, vanish } from '../ui/drop';
|
||||
import { copy } from '../ui/feedback';
|
||||
|
||||
export function showPageCode() {
|
||||
openSheet(() => {
|
||||
/** The card open now, to shut at once when its knob goes with the breadcrumb. */
|
||||
let open: ((now?: boolean) => void) | null = null;
|
||||
|
||||
export const closePageCode = (now = false) => open?.(now);
|
||||
|
||||
export function showPageCode(knob: HTMLElement) {
|
||||
if (knob.getAttribute('aria-expanded') === 'true') return closeDrop();
|
||||
const url = pageUrl();
|
||||
const el = h(
|
||||
const share = typeof navigator.share === 'function';
|
||||
const card = h(
|
||||
'div',
|
||||
{ class: 'view' },
|
||||
head(_('Open on another device')),
|
||||
sub(_('Point its camera at the code: this page opens there.')),
|
||||
{ class: 'pc-card drop', role: 'dialog', 'aria-label': _('Open on another device') },
|
||||
qrBox(url, true),
|
||||
linkRow(url),
|
||||
h(
|
||||
'div',
|
||||
{ class: 'pc-row' },
|
||||
h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
class: 'pc-copy',
|
||||
'aria-label': _('Copy the link'),
|
||||
onclick: (e: Event) => copy(url, _('Link copied'), e.currentTarget),
|
||||
},
|
||||
ic('link'),
|
||||
h('span', { class: 'lbl' }, _('Copy link')),
|
||||
),
|
||||
share
|
||||
? h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
class: 'knob',
|
||||
'aria-label': _('Share the link'),
|
||||
onclick: () => navigator.share({ url, title: placeName() }).catch(() => undefined),
|
||||
},
|
||||
ic('share'),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
return { el, label: _('Open on another device') };
|
||||
document.body.append(card);
|
||||
// Under the knob where it fits, else over it; centred on it inside the screen's edge, growing from its side.
|
||||
const r = knob.getBoundingClientRect();
|
||||
const w = card.offsetWidth;
|
||||
const ht = card.offsetHeight;
|
||||
const mid = r.left + r.width / 2;
|
||||
const left = Math.max(EDGE, Math.min(mid - w / 2, innerWidth - EDGE - w));
|
||||
const below = r.bottom + GAP + ht <= innerHeight - EDGE || r.top - GAP - ht < EDGE;
|
||||
const top = below ? r.bottom + GAP : r.top - GAP - ht;
|
||||
Object.assign(card.style, {
|
||||
left: `${left + scrollX}px`,
|
||||
top: `${top + scrollY}px`,
|
||||
transformOrigin: `${mid - left}px ${below ? 0 : ht}px`,
|
||||
});
|
||||
appear(card);
|
||||
const release = opened(card, knob, close);
|
||||
open = close;
|
||||
|
||||
function close(instant = false) {
|
||||
if (!release()) return;
|
||||
if (open === close) open = null;
|
||||
if (instant) card.remove();
|
||||
else vanish(card);
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ export interface ConnPill {
|
||||
}
|
||||
|
||||
/**
|
||||
* Beside ×: the connection itself, to download or copy, where the sheet offers
|
||||
* On its row, beside the chevron: the connection itself, to download or copy, where the sheet offers
|
||||
* neither (a phone or a tablet set up from elsewhere). One tooltip for both
|
||||
* keys, under them: the first waits a beat; once one is up the next comes at
|
||||
* once and the tooltip glides across (by Tab too, and back to a key while it
|
||||
@@ -354,11 +354,11 @@ export function connPill(get: () => { text: string; msg: string; file: string; a
|
||||
let tipT = 0;
|
||||
let warmUntil = 0;
|
||||
const words = (b: HTMLElement) => (b === cp && cp.classList.contains('done') ? _('Copied') : (b.getAttribute('aria-label') ?? ''));
|
||||
// Centred under its key, but never past the sheet's edge (× and its margin to the right).
|
||||
// Centred under its key, but never past its row's edge (the chevron and the row's inset to the right).
|
||||
const centre = (b: HTMLElement, t: string) => {
|
||||
tm.textContent = t;
|
||||
const w = tm.offsetWidth + 20;
|
||||
return Math.min(b.offsetLeft + b.offsetWidth / 2, el.offsetWidth + 46 - w / 2);
|
||||
return Math.min(b.offsetLeft + b.offsetWidth / 2, el.offsetWidth + 30 - w / 2);
|
||||
};
|
||||
const at = (x: number) => `translateX(${x}px) translateX(-50%)`;
|
||||
/** Where the tooltip stands now: mid-fade and mid-glide included. */
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// computer, or another device added from a phone, its link or the connection
|
||||
// to send there. Which app and where it comes from follow the
|
||||
// server's disguise and the platform (setup.ts). The wait for the first
|
||||
// connection sits on top the whole time (wait.ts); on the device itself and for
|
||||
// a router the steps regroup under it as it goes (can't finish, no data).
|
||||
// connection sits on top the whole time (wait.ts); once the device is heard
|
||||
// from (can't finish, no data, connected) what is under it folds away.
|
||||
|
||||
import type { ClientConfig, Device } from '../../shared/types';
|
||||
import { fmt } from '../../shared/i18n';
|
||||
@@ -17,7 +17,7 @@ import { h, put } from '../dom';
|
||||
import { SMOOTH, play } from '../motion';
|
||||
import { APP_NAME, appsFor, deviceNoun, inWebview, keyFileName, sameDevice, setupLink, type AppId } from '../setup';
|
||||
import { pageUrl, platform, preset, repaint } from '../state';
|
||||
import { accordion, regrow, type Accordion } from '../ui/accordion';
|
||||
import { accordion, regrow } from '../ui/accordion';
|
||||
import { codeRow, linkRow, type CodeRow } from '../ui/codes';
|
||||
import { once, toast } from '../ui/feedback';
|
||||
import { glass } from '../ui/glass';
|
||||
@@ -39,7 +39,6 @@ import {
|
||||
storeBlock,
|
||||
type SetupCtx,
|
||||
} from './setup-parts';
|
||||
import type { WayState } from '../way';
|
||||
import { follow, waitWay, watchFirstConnection } from './wait';
|
||||
|
||||
async function getConfig(d: Device): Promise<ClientConfig | null> {
|
||||
@@ -114,66 +113,6 @@ function foldBlock(el: HTMLElement, fold: boolean, instant: boolean) {
|
||||
};
|
||||
}
|
||||
|
||||
/** The first control in `el` that can take focus now (shown, not disabled). */
|
||||
const firstControl = (el: Element | null | undefined) =>
|
||||
[...(el?.querySelectorAll<HTMLElement>('button:not([disabled]), a[href], input:not([disabled])') ?? [])].find(
|
||||
(x) => x.getClientRects().length > 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* The steps on the device itself or for a router, as the way goes (way.ts); the
|
||||
* layouts set up from elsewhere have rows, no steps. Waiting: the steps as
|
||||
* built (connected is never asked: what shows folds shut as it is, wait.ts
|
||||
* follow). Can't finish: the network is the likely cause, so they fold
|
||||
* into one closed row, "Set it up again". No data: only what fixes it, open in
|
||||
* one row, "Add the connection again" ("Import the configuration again" for a
|
||||
* router): the connection step without its number and title. A router that
|
||||
* knocks has AmneziaWG on it already, so its row holds that step alone in both.
|
||||
* What sits on field inside the row steps up one (accordion.css). "Not on the X
|
||||
* right now?" (`round`, on the device itself) goes in both: the device is in
|
||||
* hand. Focus inside what moves (a badge just used) stays in the sheet: on that
|
||||
* control where it still shows, else on the first one of what holds the steps
|
||||
* now. Returns whether anything changed.
|
||||
*/
|
||||
function regroup(body: HTMLElement, steps: HTMLElement, round: Accordion | null, router: boolean): (st: WayState) => boolean {
|
||||
const [s1, s2] = [...steps.children].slice(-2) as HTMLElement[];
|
||||
const gap = steps.querySelector<HTMLElement>(':scope > .steps-gap');
|
||||
const head2 = [...s2.querySelectorAll<HTMLElement>(':scope > .step-n, :scope > .step-b > .step-t')];
|
||||
let look: 'steps' | 'again' | 'conn' = 'steps';
|
||||
let row: HTMLElement | null = null;
|
||||
return (st) => {
|
||||
const next = st === 'trying' ? 'again' : st === 'nodata' ? 'conn' : 'steps';
|
||||
if (next === look) return false;
|
||||
look = next;
|
||||
// Moving a focused control out of the page and back drops its focus (to the page under the sheet).
|
||||
const had = document.activeElement;
|
||||
const inside = had instanceof HTMLElement && (steps.contains(had) || !!round?.el.contains(had) || !!row?.contains(had));
|
||||
row?.remove();
|
||||
row = null;
|
||||
// The steps show whole wherever they go: opened, the way round folds them away.
|
||||
round?.setOpen(-1);
|
||||
if (round) round.el.hidden = next !== 'steps';
|
||||
const alone = next === 'conn' || (next === 'again' && router);
|
||||
for (const e of [gap, s1, ...head2]) if (e) e.hidden = alone;
|
||||
if (next === 'steps') body.append(steps);
|
||||
else {
|
||||
const title = next === 'again' ? _('Set it up again') : router ? _('Import the configuration again') : _('Add the connection again');
|
||||
row = accordion([{ icon: glass('refresh', 'blue'), title, body: [steps] }], { inset: true, open: next === 'conn' ? 0 : -1 }).el;
|
||||
body.append(row);
|
||||
}
|
||||
if (inside) {
|
||||
const to =
|
||||
had.isConnected && had.getClientRects().length
|
||||
? had
|
||||
: next === 'again'
|
||||
? row?.querySelector<HTMLElement>('.acc-head')
|
||||
: firstControl(alone ? s2 : steps);
|
||||
to?.focus({ preventScroll: true });
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
type Layout = 'same' | 'router' | 'away' | 'pc-away';
|
||||
|
||||
export function setupView(d: Device, cfg: ClientConfig, key: string, here = false): View {
|
||||
@@ -280,52 +219,50 @@ export function setupView(d: Device, cfg: ClientConfig, key: string, here = fals
|
||||
: h('p', { class: 'desc' }, fmt(_('Open this link on the %s to set it up there.'), thereOn)),
|
||||
linkRow(linkThere),
|
||||
];
|
||||
const step1 = () => step('1', title1, [picker(), getBox]);
|
||||
const step2 = () => step('2', router ? _('Import the configuration') : _('Add the connection'), [addBox]);
|
||||
const inSteps = layout === 'same' || layout === 'router';
|
||||
// The connection, one element: its picker (none in step 2: step 1's is there) and its layout's box.
|
||||
const pickEl = inSteps ? null : picker();
|
||||
const pick = pickEl ? h('div', { class: 'conn-pick' }, pickEl) : null;
|
||||
const box = layout === 'away' ? codeBox : layout === 'pc-away' ? sendBox : addBox;
|
||||
const conn = h('div', { class: 'conn' }, pick, box);
|
||||
|
||||
const body = h('div', { class: 'setup' });
|
||||
if (inWebview(navigator.userAgent))
|
||||
body.appendChild(
|
||||
notice('warn', 'shield', null, _('Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.')),
|
||||
);
|
||||
let shape: (st: WayState) => boolean = () => false;
|
||||
const steps = () =>
|
||||
h(
|
||||
'div',
|
||||
{ class: 'steps-wrap' },
|
||||
layout === 'same' ? h('div', { class: 'steps-gap' }) : null,
|
||||
step('1', title1, [picker(), getBox]),
|
||||
step('2', router ? _('Import the configuration') : _('Add the connection'), [conn]),
|
||||
);
|
||||
/** The link to the device and the connection beside it, as rows (`open`: the one open as it starts). */
|
||||
const rows = (icon: string, title: string, open: number, aside: Node | null = null) =>
|
||||
accordion(
|
||||
[
|
||||
{ icon: glass('link'), title: fmt(_('Open your link on the %s'), thereOn), body: linkBody() },
|
||||
{ icon: glass(icon), title, body: [conn], aside },
|
||||
],
|
||||
{ inset: true, open },
|
||||
).el;
|
||||
if (layout === 'same') {
|
||||
// Opened, the way round folds the steps away: the device is not in hand.
|
||||
const steps = h('div', { class: 'steps-wrap' }, h('div', { class: 'steps-gap' }), step1(), step2());
|
||||
const s = steps();
|
||||
const round = accordion([{ icon: glass('link'), title: fmt(_('Not on the %s right now?'), thereOn), body: linkBody() }], {
|
||||
inset: true,
|
||||
onToggle: (_i, open, instant) => foldBlock(steps, open, instant),
|
||||
onToggle: (_i, open, instant) => foldBlock(s, open, instant),
|
||||
});
|
||||
body.append(round.el, steps);
|
||||
shape = regroup(body, steps, round, false);
|
||||
} else if (layout === 'router') {
|
||||
const steps = h('div', { class: 'steps-wrap' }, step1(), step2());
|
||||
body.append(steps);
|
||||
shape = regroup(body, steps, null, true);
|
||||
}
|
||||
body.append(round.el, s);
|
||||
} else if (layout === 'router') body.append(steps());
|
||||
// A phone or a tablet set up from here: its link as a code, or the connection as a code for an app it has.
|
||||
else if (layout === 'away')
|
||||
body.appendChild(
|
||||
accordion(
|
||||
[
|
||||
{ icon: glass('link'), title: fmt(_('Open your link on the %s'), thereOn), body: linkBody() },
|
||||
{ icon: glass('app'), title: _('Already has the app'), body: [picker(), codeBox] },
|
||||
],
|
||||
{ inset: true, open: 1 },
|
||||
).el,
|
||||
);
|
||||
// The connection's download and copy sit on its own row, while it is open.
|
||||
else if (layout === 'away') body.append(rows('app', _('Add the connection'), 1, pill?.el ?? null));
|
||||
// A computer set up from somewhere else, or something else (a TV, a box, a NAS) set up from a phone: its system is
|
||||
// not known here, so the link goes there and the page there does both steps.
|
||||
else
|
||||
body.appendChild(
|
||||
accordion(
|
||||
[
|
||||
{ icon: glass('link'), title: fmt(_('Open your link on the %s'), thereOn), body: linkBody() },
|
||||
{ icon: glass('key'), title: _('Copy or save the connection'), body: [picker(), sendBox] },
|
||||
],
|
||||
{ inset: true, open: 0 },
|
||||
).el,
|
||||
);
|
||||
else body.append(rows('key', _('Copy or save the connection'), 0));
|
||||
|
||||
const subline = sub(
|
||||
layout === 'same'
|
||||
@@ -335,12 +272,12 @@ export function setupView(d: Device, cfg: ClientConfig, key: string, here = fals
|
||||
: fmt(_('The app goes on the %s.'), there),
|
||||
);
|
||||
const way = waitWay(d);
|
||||
const wait = follow(d, way, { sub: subline, rest: body, shape });
|
||||
const wait = follow(d, way, { sub: subline, rest: body });
|
||||
onLeave(watchFirstConnection(d, wait.seen, wait.gaveUp));
|
||||
// Closed before the device connected: the page shows what the polls brought.
|
||||
onClosed(() => repaint());
|
||||
|
||||
const title = fmt(_('Set up %s'), d.name);
|
||||
const el = h('div', { class: 'view' }, head(title, { acts: !!pill }), subline, way.el, body);
|
||||
return { el, label: title, acts: pill?.el ?? null };
|
||||
const el = h('div', { class: 'view' }, head(title), subline, way.el, body);
|
||||
return { el, label: title };
|
||||
}
|
||||
@@ -4,8 +4,9 @@
|
||||
// the sheet around it keeping pace. Connected, the way fills green and its line
|
||||
// morphs into "<device> connected", × and the sheet's buttons step away,
|
||||
// everything under the way folds shut and the sheet closes by itself onto the
|
||||
// page; any other state undoes that. What sits under the way in each state is
|
||||
// the view's (setup-view.ts hands it over as `Around`).
|
||||
// page. Can't finish and no data fold what is under the way the same and keep
|
||||
// the sheet; waiting again unfolds it. What sits under the way is the view's
|
||||
// (setup-view.ts hands it over as `Around`).
|
||||
|
||||
import type { Device } from '../../shared/types';
|
||||
import { fmt } from '../../shared/i18n';
|
||||
@@ -13,7 +14,7 @@ import { gone, call } from '../api';
|
||||
import { h, ic } from '../dom';
|
||||
import { EASE_IN, EASE_OUT, calm, play } from '../motion';
|
||||
import { now, repaint, setState, type State } from '../state';
|
||||
import { menuOpen } from '../ui/menu';
|
||||
import { dropOpen } from '../ui/drop';
|
||||
import { morphText, setText, textOf } from '../ui/morph';
|
||||
import { closeSheet, onClosed, scrollTop, settle, showing } from '../ui/sheet';
|
||||
import { wayState, type WayState } from '../way';
|
||||
@@ -34,7 +35,7 @@ function lines(st: WayState, d: Device): [string, string] {
|
||||
case 'connected':
|
||||
return [fmt(_('%s connected'), d.name), ''];
|
||||
case 'nodata':
|
||||
return [_('Handshake complete, but no data'), _('This device is using an outdated configuration.')];
|
||||
return [_('Handshake complete, but no data'), _('The router drops its traffic: the address does not match.')];
|
||||
case 'waiting':
|
||||
return [_('Waiting for the connection'), ''];
|
||||
}
|
||||
@@ -185,7 +186,7 @@ function catchUp(id: string, tries = 4) {
|
||||
try {
|
||||
const st = await call<State>('state');
|
||||
setState(st);
|
||||
if (!menuOpen()) repaint();
|
||||
if (!dropOpen()) repaint();
|
||||
if (!st.person.devices.find((x) => x.id === id)?.online && tries > 1) catchUp(id, tries - 1);
|
||||
} catch {
|
||||
/* a hiccup: the page keeps the last answer, as on load */
|
||||
@@ -274,8 +275,6 @@ export interface Around {
|
||||
sub: HTMLElement;
|
||||
/** Everything under the way. */
|
||||
rest: HTMLElement;
|
||||
/** Give what is under the way its shape for this state, at once (the glide is here); false: nothing changed. */
|
||||
shape(st: WayState): boolean;
|
||||
}
|
||||
|
||||
/** Blocks folded away, held at nothing until they come back. */
|
||||
@@ -337,28 +336,6 @@ function gap(way: HTMLElement, away: boolean) {
|
||||
play(way, [{ marginBottom: from }, { marginBottom: to }], { duration: 520, easing: EASE_OUT, fill: away ? 'forwards' : 'none' });
|
||||
}
|
||||
|
||||
/** What is under the way takes another shape: it glides to its new height, and what came in blurs in. */
|
||||
function reshape(a: Around, st: WayState) {
|
||||
const rest = a.rest;
|
||||
// From where it stands on screen (a glide under way included) to its new height.
|
||||
const h0 = rest.getBoundingClientRect().height;
|
||||
if (!a.shape(st)) return;
|
||||
rest.getAnimations().forEach((x) => x.cancel());
|
||||
const h1 = rest.getBoundingClientRect().height;
|
||||
rest.style.overflow = 'hidden';
|
||||
play(rest, [{ height: `${h0}px` }, { height: `${h1}px` }], { duration: 420, easing: EASE_OUT }).onfinish = () => {
|
||||
rest.style.overflow = '';
|
||||
};
|
||||
play(
|
||||
rest,
|
||||
[
|
||||
{ opacity: 0.4, filter: 'blur(2px)' },
|
||||
{ opacity: 1, filter: 'none' },
|
||||
],
|
||||
{ duration: 320, easing: EASE_OUT },
|
||||
);
|
||||
}
|
||||
|
||||
/** What the sheet does as the wait goes on (follow). */
|
||||
export interface Following {
|
||||
/** A new state of the way. */
|
||||
@@ -371,14 +348,23 @@ export interface Following {
|
||||
* The sheet keeps pace with the way. Connected: × and the buttons beside it
|
||||
* step away, the sheet goes back up to the way if it was scrolled, everything
|
||||
* under the way folds shut with the way's gap to it, and after two seconds to
|
||||
* read it the sheet closes by itself onto the page, the card ringing green. Any
|
||||
* other state undoes that (× comes back, what folded unfolds) and gives what is
|
||||
* under the way its shape. The subtitle says what setting up takes, so it shows
|
||||
* only while waiting: once the device is heard from, or the wait gives up, it
|
||||
* folds away, the way then right under the head.
|
||||
* read it the sheet closes by itself onto the page, the card ringing green.
|
||||
* Can't finish or no data: what is under the way folds shut the same, at once,
|
||||
* and the sheet stays (adding the connection again would not help: the way
|
||||
* says what would). Waiting again undoes that (× comes back, what folded
|
||||
* unfolds). The subtitle says what setting up takes, so it shows only while
|
||||
* waiting: once the device is heard from, or the wait gives up, it folds away,
|
||||
* the way then right under the head.
|
||||
*/
|
||||
export function follow(d: Device, way: Way, a: Around): Following {
|
||||
/** What is under the way is folded shut, the way's gap to it with it. */
|
||||
let shut = false;
|
||||
const shutRest = (away: boolean) => {
|
||||
if (shut === away) return;
|
||||
shut = away;
|
||||
fold(a.rest, away, 520);
|
||||
gap(way.el, away);
|
||||
};
|
||||
let timers: number[] = [];
|
||||
const later = (ms: number, f: () => void) => timers.push(window.setTimeout(f, ms));
|
||||
const seen = (st: WayState) => {
|
||||
@@ -391,9 +377,7 @@ export function follow(d: Device, way: Way, a: Around): Following {
|
||||
scrollTop();
|
||||
later(400, () => {
|
||||
if (!showing(way.el)) return;
|
||||
shut = true;
|
||||
fold(a.rest, true, 520);
|
||||
gap(way.el, true);
|
||||
shutRest(true);
|
||||
// Reading time, not motion: the same with less motion.
|
||||
later(2400, () => {
|
||||
// Only this sheet: not one the visitor went on to.
|
||||
@@ -404,12 +388,7 @@ export function follow(d: Device, way: Way, a: Around): Following {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!shut) return reshape(a, st);
|
||||
// Folded while it was connected: it unfolds straight into its new shape.
|
||||
shut = false;
|
||||
a.shape(st);
|
||||
fold(a.rest, false, 520);
|
||||
gap(way.el, false);
|
||||
shutRest(st !== 'waiting');
|
||||
};
|
||||
return {
|
||||
seen,
|
||||
|
||||
@@ -230,10 +230,6 @@ msgstr ""
|
||||
msgid "Add the connection"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Add the connection again"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Add this device"
|
||||
msgstr ""
|
||||
@@ -255,10 +251,6 @@ msgstr ""
|
||||
msgid "Address copied"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Already has the app"
|
||||
msgstr ""
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc
|
||||
msgid "AmneziaWG is not installed (%s): install it in Dawnline → Components."
|
||||
msgstr ""
|
||||
@@ -378,6 +370,10 @@ msgstr ""
|
||||
msgid "Copy IP address"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
msgid "Copy link"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Copy local address"
|
||||
msgstr ""
|
||||
@@ -399,6 +395,7 @@ msgctxt "in a sentence"
|
||||
msgid "Copy the key"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
#: web/src/portal/ui/codes.ts
|
||||
msgid "Copy the link"
|
||||
msgstr ""
|
||||
@@ -677,10 +674,6 @@ msgstr ""
|
||||
msgid "Import the configuration"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Import the configuration again"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/setup.ts
|
||||
msgctxt "WireGuard app"
|
||||
msgid "Import tunnel(s) from file…"
|
||||
@@ -790,6 +783,7 @@ msgstr ""
|
||||
msgid "Last connected %s"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
#: web/src/portal/ui/codes.ts
|
||||
msgid "Link copied"
|
||||
msgstr ""
|
||||
@@ -1037,10 +1031,6 @@ msgstr ""
|
||||
msgid "Point its camera at the code: the link opens there."
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
msgid "Point its camera at the code: this page opens there."
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/add.ts
|
||||
msgid "Point its camera at the code: your page opens there with this device ready to add."
|
||||
msgstr ""
|
||||
@@ -1149,10 +1139,6 @@ msgstr ""
|
||||
msgid "Server is turned off"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Set it up again"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Set up %s"
|
||||
@@ -1182,6 +1168,7 @@ msgstr ""
|
||||
msgid "Share the file"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
#: web/src/portal/ui/codes.ts
|
||||
msgid "Share the link"
|
||||
msgstr ""
|
||||
@@ -1274,6 +1261,11 @@ msgstr ""
|
||||
msgid "The router can’t use what it sends: reconnect it."
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/wait.ts
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "The router drops its traffic: the address does not match."
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/setup-parts.ts
|
||||
msgid "Then come back here and tap"
|
||||
msgstr ""
|
||||
@@ -1290,10 +1282,6 @@ msgstr ""
|
||||
msgid "This device"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/flows/wait.ts
|
||||
msgid "This device is using an outdated configuration."
|
||||
msgstr ""
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc
|
||||
msgid "This key is already in use."
|
||||
msgstr ""
|
||||
|
||||
@@ -235,10 +235,6 @@ msgstr "Добавить с самого устройства"
|
||||
msgid "Add the connection"
|
||||
msgstr "Добавьте подключение"
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Add the connection again"
|
||||
msgstr "Добавить заново"
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Add this device"
|
||||
msgstr "Добавить это устройство"
|
||||
@@ -260,10 +256,6 @@ msgstr "Сейчас добавить устройство нельзя: VPN-с
|
||||
msgid "Address copied"
|
||||
msgstr "Адрес скопирован"
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Already has the app"
|
||||
msgstr "Приложение уже установлено"
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc
|
||||
msgid "AmneziaWG is not installed (%s): install it in Dawnline → Components."
|
||||
msgstr "AmneziaWG не установлен (%s): установите его в Dawnline → Компоненты."
|
||||
@@ -383,6 +375,10 @@ msgstr "Скопировать конфигурацию %s"
|
||||
msgid "Copy IP address"
|
||||
msgstr "Скопировать IP-адрес"
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
msgid "Copy link"
|
||||
msgstr "Скопировать ссылку"
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Copy local address"
|
||||
msgstr "Скопировать локальный адрес"
|
||||
@@ -404,6 +400,7 @@ msgctxt "in a sentence"
|
||||
msgid "Copy the key"
|
||||
msgstr "Скопируйте ключ"
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
#: web/src/portal/ui/codes.ts
|
||||
msgid "Copy the link"
|
||||
msgstr "Скопировать ссылку"
|
||||
@@ -682,10 +679,6 @@ msgstr "Импорт из файла или архива"
|
||||
msgid "Import the configuration"
|
||||
msgstr "Импортируйте конфигурацию"
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Import the configuration again"
|
||||
msgstr "Импортировать заново"
|
||||
|
||||
#: web/src/portal/setup.ts
|
||||
msgctxt "WireGuard app"
|
||||
msgid "Import tunnel(s) from file…"
|
||||
@@ -795,6 +788,7 @@ msgstr "За 7 дней"
|
||||
msgid "Last connected %s"
|
||||
msgstr "В сети %s"
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
#: web/src/portal/ui/codes.ts
|
||||
msgid "Link copied"
|
||||
msgstr "Ссылка скопирована"
|
||||
@@ -1042,10 +1036,6 @@ msgstr "Выберите файл и подключитесь"
|
||||
msgid "Point its camera at the code: the link opens there."
|
||||
msgstr "Наведите камеру устройства на код - ссылка откроется на нём."
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
msgid "Point its camera at the code: this page opens there."
|
||||
msgstr "Наведите камеру устройства на код - там откроется эта страница."
|
||||
|
||||
#: web/src/portal/flows/add.ts
|
||||
msgid "Point its camera at the code: your page opens there with this device ready to add."
|
||||
msgstr "Наведите камеру устройства на код - там откроется ваша страница, и его можно будет сразу добавить."
|
||||
@@ -1154,10 +1144,6 @@ msgstr "Сервер выключен"
|
||||
msgid "Server is turned off"
|
||||
msgstr "Сервер выключен"
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
msgid "Set it up again"
|
||||
msgstr "Настроить заново"
|
||||
|
||||
#: web/src/portal/flows/setup-view.ts
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Set up %s"
|
||||
@@ -1187,6 +1173,7 @@ msgstr "Поделиться файлом"
|
||||
msgid "Share the file"
|
||||
msgstr "Поделиться файлом"
|
||||
|
||||
#: web/src/portal/flows/page-code.ts
|
||||
#: web/src/portal/ui/codes.ts
|
||||
msgid "Share the link"
|
||||
msgstr "Поделиться ссылкой"
|
||||
@@ -1279,6 +1266,11 @@ msgstr "У человека нет сервера."
|
||||
msgid "The router can’t use what it sends: reconnect it."
|
||||
msgstr "Роутер не принимает то, что отправляет устройство: переподключите его."
|
||||
|
||||
#: web/src/portal/flows/wait.ts
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "The router drops its traffic: the address does not match."
|
||||
msgstr "Роутер отбрасывает его трафик: адрес не совпадает."
|
||||
|
||||
#: web/src/portal/flows/setup-parts.ts
|
||||
msgid "Then come back here and tap"
|
||||
msgstr "Затем вернитесь сюда и нажмите"
|
||||
@@ -1295,10 +1287,6 @@ msgstr "Это подключение стоит на двух устройст
|
||||
msgid "This device"
|
||||
msgstr "Это устройство"
|
||||
|
||||
#: web/src/portal/flows/wait.ts
|
||||
msgid "This device is using an outdated configuration."
|
||||
msgstr "На этом устройстве устаревшая конфигурация."
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc
|
||||
msgid "This key is already in use."
|
||||
msgstr "Этот ключ уже используется."
|
||||
|
||||
@@ -18,9 +18,10 @@ import { fillNotice, stateNotice } from './page/notices';
|
||||
import { devicesNow, devicesSection, fillDevices } from './page/devices';
|
||||
import { accessSection, fillAccess } from './page/access';
|
||||
import { glass, type Tone } from './ui/glass';
|
||||
import { closeMenu, menuOpen } from './ui/menu';
|
||||
import { closeDrop, dropOpen } from './ui/drop';
|
||||
import { closeSheet, sheetOpen } from './ui/sheet';
|
||||
import { renaming } from './flows/rename';
|
||||
import { keepPressFootprint } from './ui/press';
|
||||
import { startAdd } from './flows/add';
|
||||
import { openSetup } from './flows/setup-view';
|
||||
|
||||
@@ -191,7 +192,7 @@ async function refresh() {
|
||||
try {
|
||||
setState(await call<State>('state'));
|
||||
// Not under an open sheet or menu, nor a name being edited on its card.
|
||||
if (!sheetOpen() && !menuOpen() && !renaming()) render();
|
||||
if (!sheetOpen() && !dropOpen() && !renaming()) render();
|
||||
openFromLink();
|
||||
} catch (e) {
|
||||
if (gone(e)) linkGone();
|
||||
@@ -202,15 +203,28 @@ async function refresh() {
|
||||
|
||||
// Another language: everything is drawn again in it, the sections too (their headings are text).
|
||||
onLang(() => {
|
||||
closeMenu(true);
|
||||
closeDrop(true);
|
||||
parts = null;
|
||||
redraw();
|
||||
});
|
||||
|
||||
// A press that shrinks a control under the pointer still lands on it (ui/press.ts).
|
||||
keepPressFootprint();
|
||||
|
||||
// The focus ring only while the keyboard moves focus (base.css .kbd): on from Tab or an arrow, off at a press.
|
||||
const KEYS = new Set(['Tab', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']);
|
||||
document.addEventListener('keydown', (e) => KEYS.has(e.key) && document.documentElement.classList.add('kbd'), true);
|
||||
document.addEventListener('pointerdown', () => document.documentElement.classList.remove('kbd'), true);
|
||||
|
||||
// The page keeps its scale, as an app does: Safari on iOS zooms on a pinch whatever the viewport says, its own
|
||||
// gesture events are the only way to stop it (the viewport and touch-action take care of the rest).
|
||||
for (const ev of ['gesturestart', 'gesturechange', 'gestureend'])
|
||||
document.addEventListener(ev, (e) => e.preventDefault(), { passive: false });
|
||||
|
||||
// What the keyboard does never animates.
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key !== 'Escape') return;
|
||||
if (menuOpen()) closeMenu(true);
|
||||
if (dropOpen()) closeDrop(true);
|
||||
else if (sheetOpen()) closeSheet(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,8 +8,25 @@
|
||||
// BOUNCY is the skiper103 accordion (about 11% overshoot), SMOOTH the skiper21
|
||||
// tab pill (critically damped). Reduced motion keeps fades and drops travel.
|
||||
|
||||
/** Asked once and kept (it answers as the setting changes): play() asks on every animation. */
|
||||
const REDUCE = typeof matchMedia === 'function' ? matchMedia('(prefers-reduced-motion: reduce)') : null;
|
||||
|
||||
/** The visitor asked for less motion: fades only, nothing travels. */
|
||||
export const calm = (): boolean => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
export const calm = (): boolean => !!REDUCE?.matches;
|
||||
|
||||
/** Past this many px² a blur is a large layer's, drawn anew on every frame: it fades without. */
|
||||
const BIG_BLUR = 30_000;
|
||||
|
||||
/**
|
||||
* A large element's frames without their blur (a fold, an accordion's body, a sheet): opacity, movement and size
|
||||
* go on as they were. Letters, icons and small things keep theirs.
|
||||
*/
|
||||
function lean(el: Element, frames: Keyframe[]): Keyframe[] {
|
||||
if (!frames.some((f) => 'filter' in f)) return frames;
|
||||
const r = el.getBoundingClientRect();
|
||||
if (r.width * r.height < BIG_BLUR) return frames;
|
||||
return frames.map(({ filter: _f, ...f }) => f);
|
||||
}
|
||||
|
||||
export interface Spring {
|
||||
/** Until it settles within 0.15% of the end. */
|
||||
@@ -38,11 +55,16 @@ export function spring(k: number, c: number, m = 1): Spring {
|
||||
let end = 0;
|
||||
for (let t = 0; t < 3; t += 0.004) if (Math.abs(1 - x(t)) > 0.0015) end = t;
|
||||
end += 0.004;
|
||||
// Cut where it is within 0.15% of the end, the spring still has that much to go: on a large travel (a row
|
||||
// folding 500 px) a step of a pixel in the last frame. What is left is spread over the way instead, most of
|
||||
// it near the end, so the curve arrives at 1 exactly and smoothly; overshoot and timing stay as they are.
|
||||
const rest = 1 - x(end);
|
||||
const y = (t: number) => x(t) + rest * (t / end) ** 3;
|
||||
const pts: number[] = [];
|
||||
for (let i = 0; i <= 64; i++) pts.push(+x((end * i) / 64).toFixed(4));
|
||||
for (let i = 0; i <= 64; i++) pts.push(+y((end * i) / 64).toFixed(4));
|
||||
pts[64] = 1;
|
||||
const duration = Math.round(end * 1000);
|
||||
return { duration, easing: `linear(${pts.join(', ')})`, at: (ms) => (ms >= duration ? 1 : x(ms / 1000)) };
|
||||
return { duration, easing: `linear(${pts.join(', ')})`, at: (ms) => (ms >= duration ? 1 : y(ms / 1000)) };
|
||||
}
|
||||
|
||||
/** The accordion, the toast, a card that pops in. */
|
||||
@@ -57,6 +79,8 @@ export const LEAD = spring(520, 46);
|
||||
export const SOFT = spring(380, 28);
|
||||
/** What follows the pointer (a menu's highlight): there in about 130 ms, no overshoot. */
|
||||
export const QUICK = spring(900, 60);
|
||||
/** A highlight gliding from row to row: quick, with a touch of give (about 2% over). */
|
||||
export const GLIDE = spring(640, 40);
|
||||
|
||||
export const EASE_OUT = 'cubic-bezier(0.23, 1, 0.32, 1)';
|
||||
export const EASE_IN = 'cubic-bezier(0.55, 0, 1, 0.45)';
|
||||
@@ -72,6 +96,8 @@ export function publishSprings(root: HTMLElement) {
|
||||
root.style.setProperty('--spring-soft-dur', `${SOFT.duration}ms`);
|
||||
root.style.setProperty('--spring-quick', QUICK.easing);
|
||||
root.style.setProperty('--spring-quick-dur', `${QUICK.duration}ms`);
|
||||
root.style.setProperty('--spring-glide', GLIDE.easing);
|
||||
root.style.setProperty('--spring-glide-dur', `${GLIDE.duration}ms`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +105,7 @@ export function publishSprings(root: HTMLElement) {
|
||||
* its fade (short); one that only moves or resizes jumps to its end.
|
||||
*/
|
||||
export function play(el: Element, frames: Keyframe[], o: KeyframeAnimationOptions): Animation {
|
||||
if (!calm()) return el.animate(frames, o);
|
||||
if (!calm()) return el.animate(lean(el, frames), o);
|
||||
if (frames.some((f) => 'opacity' in f))
|
||||
return el.animate(
|
||||
frames.map((f) => ('opacity' in f ? { opacity: f.opacity } : {})),
|
||||
|
||||
@@ -56,6 +56,10 @@ function statusOf(d: Device, p: Person): [string, string, string?] {
|
||||
// "connected", so say here why nothing works.
|
||||
if (d.online && p.state === 'quota') return ['warn-t', _('Connected, no data left')];
|
||||
if (d.online && p.state === 'hours') return ['warn-t', _('Connected, outside your hours')];
|
||||
// Connected, and what it sends is dropped: the set-up sheet's no data, right away (the router's watcher names it
|
||||
// only once it held 3 minutes), so a sheet closed on it doesn't leave the card saying Connected.
|
||||
if (d.online && d.setup?.state === 'nodata')
|
||||
return ['warn-t', _('Connected, but no data'), _('The router drops its traffic: the address does not match.')];
|
||||
if (d.link) return ['warn-t', ...linkWords(d.link.state)];
|
||||
if (d.online) return ['ok-t', _('Connected')];
|
||||
if (!d.handshake) return ['warn-t', _('Not set up yet')];
|
||||
@@ -93,8 +97,10 @@ function menuItems(d: Device, st: State): (MenuItem | null)[] {
|
||||
// How devices at home reach it: only where the router actually lets them through.
|
||||
...(reachableFromHome(st.person, d)
|
||||
? [
|
||||
{ label: _('Copy IP address'), icon: 'copy', run: () => copy(d.address, _('IP address copied')) },
|
||||
...(d.hostname ? [{ label: _('Copy local address'), icon: 'home', run: () => copy(d.hostname, _('Address copied')) }] : []),
|
||||
{ label: _('Copy IP address'), icon: 'copy', sub: d.address, run: () => copy(d.address, _('IP address copied')) },
|
||||
...(d.hostname
|
||||
? [{ label: _('Copy local address'), icon: 'home', sub: d.hostname, run: () => copy(d.hostname, _('Address copied')) }]
|
||||
: []),
|
||||
null,
|
||||
]
|
||||
: []),
|
||||
@@ -171,7 +177,7 @@ function card(d: Device, st: State): HTMLElement {
|
||||
},
|
||||
ic('more'),
|
||||
);
|
||||
more?.addEventListener('click', () => openMenu(more, items));
|
||||
more?.addEventListener('click', () => openMenu(more, items, d.name));
|
||||
return h(
|
||||
'article',
|
||||
{ class: `dev${here ? ' is-here' : ''}${d.disabled ? ' off' : ''}`, 'data-id': d.id },
|
||||
@@ -258,19 +264,16 @@ export function devicesSection(): HTMLElement {
|
||||
/**
|
||||
* A card whose width jumps (the grid changed its columns: a window across 560 or 960 px, a phone turned)
|
||||
* takes its new shape with the layout, at once: gliding there from the old one, its numbers would not fit
|
||||
* for a moment and wrap. A threshold crossed while the window is resized a little at a time still glides
|
||||
* (devices.css). The class goes on before the frame is painted, so the glide that began never shows.
|
||||
* for a moment and wrap. The columns change only there (devices.css, page.css), so those two crossings are what
|
||||
* it listens for; a window resized between them still glides. The class goes on before the frame is painted, so
|
||||
* the glide that began never shows.
|
||||
*/
|
||||
function snapOnJump(grid: HTMLElement) {
|
||||
let was = 0;
|
||||
new ResizeObserver(() => {
|
||||
const w = grid.querySelector('.dev')?.getBoundingClientRect().width ?? 0;
|
||||
if (Math.abs(w - was) > 16) {
|
||||
const snap = () => {
|
||||
grid.classList.add('snap');
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => grid.classList.remove('snap')));
|
||||
}
|
||||
was = w;
|
||||
}).observe(grid);
|
||||
};
|
||||
for (const q of ['(min-width: 560px)', '(min-width: 960px)']) matchMedia(q).addEventListener('change', snap);
|
||||
}
|
||||
|
||||
/** The green ring of a device that just connected (its animation's id, to find it again on a repaint). */
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
import { h, ic, markup } from '../dom';
|
||||
import { EASE_OUT, SOFT, play } from '../motion';
|
||||
import { placeName, state } from '../state';
|
||||
import { showPageCode } from '../flows/page-code';
|
||||
import { openMenu } from '../ui/menu';
|
||||
import { closePageCode, showPageCode } from '../flows/page-code';
|
||||
import { pickPill, type PickPill } from '../ui/pick';
|
||||
import { LANGS, lang, setLang } from '../i18n';
|
||||
|
||||
// The sun rises from behind the horizon once, on the visit's first paint.
|
||||
@@ -70,21 +70,50 @@ export function single(on: boolean) {
|
||||
pageEl?.classList.toggle('single', on);
|
||||
}
|
||||
|
||||
/** The language: its code and a chevron; the menu lists the languages by their own names. */
|
||||
// Each language's flag, a disc (styles/pick.css): the Union Jack for English, the tricolour for Russian.
|
||||
const FLAGS: Record<string, string> = {
|
||||
en:
|
||||
'<svg viewBox="15 0 30 30" aria-hidden="true"><path fill="#012169" d="M0 0h60v30H0z"/>' +
|
||||
'<path stroke="#fff" stroke-width="6" d="M0 0l60 30M60 0L0 30"/><path stroke="#c8102e" stroke-width="2" d="M0 0l60 30M60 0L0 30"/>' +
|
||||
'<path stroke="#fff" stroke-width="10" d="M30 0v30M0 15h60"/><path stroke="#c8102e" stroke-width="6" d="M30 0v30M0 15h60"/></svg>',
|
||||
ru:
|
||||
'<svg viewBox="0 0 30 30" aria-hidden="true"><path fill="#fff" d="M0 0h30v10H0z"/><path fill="#0039a6" d="M0 10h30v10H0z"/>' +
|
||||
'<path fill="#d52b1e" d="M0 20h30v10H0z"/></svg>',
|
||||
};
|
||||
const flag = (code: string) => h('span', { class: 'flag' }, FLAGS[code] ? markup(FLAGS[code]) : null);
|
||||
|
||||
/**
|
||||
* The language: its flag, its code and a chevron; the popup under it lists the languages by their own names. One
|
||||
* pill for the visit, put back each time the breadcrumb is drawn, so a pick morphs its code after the page redraws.
|
||||
*/
|
||||
let langPill: PickPill<string> | null = null;
|
||||
function langPicker(): HTMLElement {
|
||||
const b = h(
|
||||
langPill ??= pickPill({
|
||||
cls: 'cr-lang',
|
||||
label: () => _('Language'),
|
||||
options: LANGS.map((l) => ({ value: l.code, label: () => l.name, lead: () => flag(l.code) })),
|
||||
value: lang(),
|
||||
short: (c) => c.toUpperCase(),
|
||||
prefer: 'below',
|
||||
pick: (c) => setLang(c),
|
||||
});
|
||||
langPill.show(lang());
|
||||
return langPill.el;
|
||||
}
|
||||
|
||||
/**
|
||||
* This page's code for another device: one knob for the visit, as the language's pill, so a card open from it
|
||||
* (flows/page-code.ts) stays where it is as the page redraws.
|
||||
*/
|
||||
let qr: HTMLElement | null = null;
|
||||
function qrKnob(): HTMLElement {
|
||||
qr ??= h(
|
||||
'button',
|
||||
{ type: 'button', class: 'cr-lang', 'aria-label': _('Language'), 'aria-haspopup': 'menu', 'aria-expanded': 'false' },
|
||||
h('span', {}, lang().toUpperCase()),
|
||||
ic('chevron', 'i cr-down'),
|
||||
{ type: 'button', class: 'knob cr-qr', 'aria-haspopup': 'dialog', 'aria-expanded': 'false', onclick: () => showPageCode(qr!) },
|
||||
ic('qr'),
|
||||
);
|
||||
b.addEventListener('click', () =>
|
||||
openMenu(
|
||||
b,
|
||||
LANGS.map((l) => ({ label: l.name, checked: l.code === lang(), run: () => l.code !== lang() && setLang(l.code) })),
|
||||
),
|
||||
);
|
||||
return b;
|
||||
qr.setAttribute('aria-label', _('Open on another device'));
|
||||
return qr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +122,10 @@ function langPicker(): HTMLElement {
|
||||
* device, on the page itself only (not over a card: paused, link gone,
|
||||
* nothing loaded).
|
||||
*/
|
||||
/** Who is told the breadcrumb was drawn again (the demo adds its chip and GitHub link to it: demo/crumbs.ts). */
|
||||
const drawnCrumbs: (() => void)[] = [];
|
||||
export const onCrumbs = (fn: () => void) => void drawnCrumbs.push(fn);
|
||||
|
||||
export function crumbs(gone = false, card = false) {
|
||||
if (!crumbsEl) return;
|
||||
const p = gone ? null : state()?.person;
|
||||
@@ -106,8 +139,9 @@ export function crumbs(gone = false, card = false) {
|
||||
p ? [ic('chevron'), h('span', { class: 'cur', 'aria-current': 'page' }, p.name)] : null,
|
||||
),
|
||||
...(card ? [] : [langPicker()]),
|
||||
...(p && !card
|
||||
? [h('button', { type: 'button', class: 'knob cr-qr', 'aria-label': _('Open on another device'), onclick: showPageCode }, ic('qr'))]
|
||||
: []),
|
||||
...(p && !card ? [qrKnob()] : []),
|
||||
);
|
||||
// No knob to fold back into: the card goes with it.
|
||||
if (!qr?.isConnected) closePageCode(true);
|
||||
drawnCrumbs.forEach((f) => f());
|
||||
}
|
||||
@@ -24,10 +24,11 @@
|
||||
.acc-row.open {
|
||||
margin-block: 10px;
|
||||
}
|
||||
.acc-row.open:first-child {
|
||||
/* The first and last rows that show (ui/accordion.ts: a row stepped out leaves none of its gap). */
|
||||
.acc-row.open.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
.acc-row.open:last-child {
|
||||
.acc-row.open.last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.acc-row:not(.open):not(.still):hover {
|
||||
@@ -90,6 +91,39 @@
|
||||
transform: translateX(8px);
|
||||
pointer-events: none;
|
||||
}
|
||||
/* Actions on what an open row holds (ui/accordion.ts aside): beside the chevron, over the head's end, coming
|
||||
in as the row opens and going as it shuts; the title keeps clear of them meanwhile (--aside-w: their width
|
||||
and a gap). */
|
||||
.acc-row.has-aside {
|
||||
position: relative;
|
||||
--aside-w: 72px;
|
||||
}
|
||||
.acc-aside {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 40px;
|
||||
height: 52px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transition:
|
||||
opacity 200ms var(--ease-out),
|
||||
filter 200ms var(--ease-out),
|
||||
transform 200ms var(--ease-out);
|
||||
}
|
||||
.acc-row:not(.open) > .acc-aside {
|
||||
opacity: 0;
|
||||
filter: blur(4px);
|
||||
transform: translateX(8px);
|
||||
pointer-events: none;
|
||||
visibility: hidden;
|
||||
transition-property: opacity, filter, transform, visibility;
|
||||
}
|
||||
.acc-row.has-aside > .acc-head > .acc-title {
|
||||
transition: padding-right 200ms var(--ease-out);
|
||||
}
|
||||
.acc-row.has-aside.open > .acc-head > .acc-title {
|
||||
padding-right: var(--aside-w);
|
||||
}
|
||||
.acc-chev {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
||||
@@ -12,6 +12,9 @@ html {
|
||||
(main.ts), so the browser would hold "Your devices" still while an access row opens or folds, and pull a page
|
||||
scrolled less than the fold to the very top. A row grows and folds in place; a repaint glides what moves. */
|
||||
overflow-anchor: none;
|
||||
/* An app's page, not a document's: a double tap doesn't zoom (the viewport keeps its scale, main.ts stops
|
||||
Safari's pinch). Taps answer at once, with no wait for a second one. */
|
||||
touch-action: manipulation;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
@@ -60,7 +63,9 @@ a {
|
||||
:focus {
|
||||
outline: none;
|
||||
}
|
||||
:focus-visible {
|
||||
/* The focus ring only while the keyboard is moving focus (main.ts sets .kbd on Tab or an arrow and drops it on a
|
||||
press): focus a script moves, or one left after a click, shows nothing. */
|
||||
.kbd :focus-visible {
|
||||
outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
@@ -216,6 +216,10 @@
|
||||
color: var(--text);
|
||||
letter-spacing: -0.012em;
|
||||
}
|
||||
/* The system's caret where the field draws none (a touch screen, ui/caret.ts): the accent, as the drawn one. */
|
||||
.field input {
|
||||
caret-color: var(--accent);
|
||||
}
|
||||
.field input::placeholder {
|
||||
color: var(--text-3);
|
||||
}
|
||||
@@ -433,6 +437,16 @@
|
||||
.appseg .seg-b.on {
|
||||
flex: 1 1 56px;
|
||||
}
|
||||
/* At rest the pill stands on its item (ui/seg.ts sets --i of --n): the track's 4 px edge and the items before it
|
||||
(each --b wide) on the left, the items after it on the right; the picked item takes what is left, so does the
|
||||
pill, whatever the sheet's width. A pick moves it with its own left and right, then hands back. */
|
||||
.appseg {
|
||||
--b: 56px;
|
||||
}
|
||||
.appseg .seg-pill {
|
||||
left: calc(4px + var(--i, 0) * var(--b));
|
||||
right: calc(4px + (var(--n, 1) - 1 - var(--i, 0)) * var(--b));
|
||||
}
|
||||
.appseg .seg-b .i {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
@@ -454,6 +468,9 @@
|
||||
container-type: inline-size;
|
||||
}
|
||||
@container (max-width: 300px) {
|
||||
.appseg {
|
||||
--b: 44px;
|
||||
}
|
||||
.appseg .seg-b {
|
||||
flex-basis: 44px;
|
||||
padding: 0 12px;
|
||||
@@ -501,7 +518,7 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
.kind:hover .kind-tile,
|
||||
.kind:focus-visible .kind-tile {
|
||||
.kbd .kind:focus-visible .kind-tile {
|
||||
background: var(--knob);
|
||||
}
|
||||
.kind:active .kind-tile {
|
||||
@@ -510,7 +527,7 @@
|
||||
.kind:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
.kind:focus-visible .kind-lbl,
|
||||
.kbd .kind:focus-visible .kind-lbl,
|
||||
.kind.on {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
background: color-mix(in srgb, var(--raised), var(--text) 6%);
|
||||
}
|
||||
/* Not when an edit gave focus back to it (flows/rename.ts): only reached with Tab. */
|
||||
.dev-name.can-edit:focus-visible:not(.quiet) {
|
||||
.kbd .dev-name.can-edit:focus-visible:not(.quiet) {
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent);
|
||||
}
|
||||
.field.inline,
|
||||
@@ -187,6 +187,14 @@
|
||||
.dev.add:hover {
|
||||
background: color-mix(in srgb, var(--raised), var(--knob) 45%);
|
||||
}
|
||||
/* On light the darker step would land on the page's own grey and the card would melt into it: a touch off white,
|
||||
the words up to full colour. */
|
||||
@media (prefers-color-scheme: light) {
|
||||
.dev.add:hover {
|
||||
background: color-mix(in srgb, var(--raised), var(--text) 2.5%);
|
||||
color: var(--text);
|
||||
}
|
||||
}
|
||||
.dev.add:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/* What every dropdown is made of (ui/drop.ts: the ⋯ menu, the pick pills' popups, the page's code): Liquid Glass
|
||||
(tokens.css --glass-*), the page behind blurred and its colours lifted, a soft even edge, a soft shadow on light
|
||||
only; over the page and a sheet alike. A dropdown cut to a shape of its own (a pick popup's tail) traces its edge
|
||||
and casts its shadow itself. */
|
||||
.drop {
|
||||
z-index: 60;
|
||||
background: var(--glass-bg);
|
||||
-webkit-backdrop-filter: blur(28px) saturate(1.8);
|
||||
backdrop-filter: blur(28px) saturate(1.8);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px var(--glass-edge),
|
||||
var(--glass-shadow);
|
||||
}
|
||||
|
||||
/* Their one highlight (ui/glide.ts): under the items' icons and words (they sit over it), solid, the same for every
|
||||
item; it glides on GLIDE and presses in with what it is on. */
|
||||
.drop-hl {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: var(--glass-hl);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition:
|
||||
opacity 160ms var(--ease-out),
|
||||
scale 150ms var(--ease-out);
|
||||
}
|
||||
.drop-hl.moving {
|
||||
transition:
|
||||
opacity 160ms var(--ease-out),
|
||||
scale 150ms var(--ease-out),
|
||||
translate var(--spring-glide-dur, 400ms) var(--spring-glide, ease-out),
|
||||
width var(--spring-glide-dur, 400ms) var(--spring-glide, ease-out),
|
||||
height var(--spring-glide-dur, 400ms) var(--spring-glide, ease-out),
|
||||
border-radius var(--spring-glide-dur, 400ms) var(--spring-glide, ease-out);
|
||||
}
|
||||
.drop-hl.down {
|
||||
scale: 0.97;
|
||||
}
|
||||
@@ -12,3 +12,5 @@
|
||||
@import './sheet.css';
|
||||
@import './setup.css';
|
||||
@import './menu-toast.css';
|
||||
@import './drop.css';
|
||||
@import './pick.css';
|
||||
@@ -1,76 +1,108 @@
|
||||
/* The ⋯ menu (a highlight that glides after the pointer, tinted for Reconnect and Remove) and the
|
||||
toast slot at the bottom. */
|
||||
/* The ⋯ menu (ui/menu.ts): an iOS 26-style menu: Liquid Glass with a soft even edge, rows, thin lines
|
||||
between groups. And the toast slot at the bottom. */
|
||||
|
||||
.menu {
|
||||
position: fixed;
|
||||
z-index: 60;
|
||||
min-width: 224px;
|
||||
padding: 6px;
|
||||
border-radius: 20px;
|
||||
background: var(--field);
|
||||
box-shadow:
|
||||
var(--pop-shadow),
|
||||
inset 0 0 0 1px var(--line);
|
||||
}
|
||||
.menu-hl {
|
||||
/* On the dropdowns' glass (.drop, styles/drop.css). */
|
||||
.pop {
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
right: 6px;
|
||||
top: 6px;
|
||||
height: 40px;
|
||||
border-radius: 14px;
|
||||
background: var(--knob);
|
||||
opacity: 0;
|
||||
transition: opacity 150ms var(--ease-out);
|
||||
pointer-events: none;
|
||||
min-width: 210px;
|
||||
overflow: hidden;
|
||||
border-radius: 24px;
|
||||
}
|
||||
.menu-hl.moving {
|
||||
transition:
|
||||
opacity 150ms var(--ease-out),
|
||||
transform var(--spring-quick-dur, 300ms) var(--spring-quick, ease-out),
|
||||
background-color 150ms;
|
||||
}
|
||||
.menu-hl.bad {
|
||||
background: var(--bad-soft);
|
||||
}
|
||||
.menu-hl.warn {
|
||||
background: color-mix(in srgb, var(--warn) 13%, transparent);
|
||||
}
|
||||
.mi {
|
||||
/* The Figma's Menu made compact: 6 px top and bottom, the rows 6 px in. */
|
||||
.pop-body {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 6px 0;
|
||||
}
|
||||
.pop-grp {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 6px;
|
||||
}
|
||||
/* A separator: 21 px high, its line 8 px further in than the rows. */
|
||||
.pop-sep {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
padding: 0 12px;
|
||||
border-radius: 14px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
height: 13px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
.mi .i {
|
||||
.pop-sep > span {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: var(--glass-sep);
|
||||
}
|
||||
/* A row: 8 px above and below the words (34 high, 50 with a line under the label); the icon further in from the
|
||||
row's rounded edge (14 px) than it is from the words (10 px), so it doesn't crowd the curve. */
|
||||
.mi {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 34px;
|
||||
padding: 0 12px 0 14px;
|
||||
border-radius: 18px;
|
||||
color: var(--glass-text);
|
||||
text-align: left;
|
||||
transition: transform 150ms var(--ease-out);
|
||||
}
|
||||
/* Whole rows over the highlight (they have no fill of their own): pressed, a row scales as one layer, and its
|
||||
words must not drop under the highlight with it. */
|
||||
.mi {
|
||||
z-index: 3;
|
||||
}
|
||||
.mi:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
.kbd .mi:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.mi > .i {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
flex: none;
|
||||
color: currentColor;
|
||||
transition: scale var(--spring-glide-dur, 400ms) var(--spring-glide, ease-out);
|
||||
}
|
||||
.mi > .i {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
/* An option's check, kept in its place on the others so the names line up. */
|
||||
.mi .i.off {
|
||||
visibility: hidden;
|
||||
.mi.hot > .i {
|
||||
scale: 1.08;
|
||||
}
|
||||
.mi.warn,
|
||||
.mi.warn .i {
|
||||
.mi-b {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 1px;
|
||||
min-width: 0;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.mi-l {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 18px;
|
||||
letter-spacing: -0.2px;
|
||||
}
|
||||
.mi-s {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 11.5px;
|
||||
line-height: 15px;
|
||||
color: var(--glass-sub);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.mi.warn {
|
||||
color: var(--warn);
|
||||
}
|
||||
.mi.bad,
|
||||
.mi.bad .i {
|
||||
color: var(--bad);
|
||||
}
|
||||
.menu-sep {
|
||||
height: 1px;
|
||||
margin: 6px 12px;
|
||||
background: var(--line);
|
||||
.mi.bad {
|
||||
color: var(--glass-bad);
|
||||
}
|
||||
|
||||
/* One toast at a time; a new one comes in over the leaving one. */
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
.mt {
|
||||
position: relative;
|
||||
}
|
||||
/* While the words change (ui/morph.ts): nothing of them clipped, not even by a box that ends a long line in an
|
||||
ellipsis; that comes back once they have changed. */
|
||||
.mt-run {
|
||||
overflow: visible !important;
|
||||
text-overflow: clip !important;
|
||||
}
|
||||
.mt-ib {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
-webkit-mask-image: linear-gradient(#000 0%, rgba(0, 0, 0, 0.88) 44%, transparent 100%);
|
||||
mask-image: linear-gradient(#000 0%, rgba(0, 0, 0, 0.88) 44%, transparent 100%);
|
||||
}
|
||||
/* On a phone the blur under it is drawn again on every frame of a scroll: the fade to the page's colour alone. */
|
||||
@media (pointer: coarse) {
|
||||
.edge-fade.top {
|
||||
-webkit-backdrop-filter: none;
|
||||
backdrop-filter: none;
|
||||
}
|
||||
}
|
||||
body.scrolled .edge-fade.top {
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -81,14 +88,14 @@ body.scrolled .edge-fade.top {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
/* The language: a pill as high as the QR knob beside it, its code and a chevron that turns up while
|
||||
the menu is open. */
|
||||
/* The language (a pick pill, ui/pick.ts): as high as the QR knob beside it, its flag, its code and a chevron
|
||||
that turns up while the popup is open. */
|
||||
.cr-lang {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
gap: 6px;
|
||||
height: 32px;
|
||||
padding: 0 8px 0 12px;
|
||||
padding: 0 8px 0 8px;
|
||||
border-radius: 999px;
|
||||
background: var(--knob);
|
||||
color: var(--text);
|
||||
@@ -109,15 +116,8 @@ body.scrolled .edge-fade.top {
|
||||
.cr-lang[aria-expanded='true'] {
|
||||
background: color-mix(in srgb, var(--knob), var(--text) 10%);
|
||||
}
|
||||
.cr-down {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: var(--text-2);
|
||||
transform: rotate(90deg);
|
||||
transition: transform 200ms var(--ease-out);
|
||||
}
|
||||
.cr-lang[aria-expanded='true'] .cr-down {
|
||||
transform: rotate(-90deg);
|
||||
.cr-lang .pp-chev {
|
||||
margin-left: -2px;
|
||||
}
|
||||
|
||||
/* Phones: one column, access first. From 960px: devices left, access right and sticky. The foot
|
||||
@@ -280,3 +280,73 @@ body.scrolled .edge-fade.top {
|
||||
color: var(--text-2);
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
/* This page's code for another device (flows/page-code.ts): a card grown out of the QR knob where it stands, on
|
||||
the ⋯ menu's Liquid Glass; the code on top and under it Copy link and Share. */
|
||||
.pc-card {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
width: 244px;
|
||||
padding: 10px;
|
||||
/* The dropdowns' radius (the ⋯ menu's), on their glass (.drop). */
|
||||
border-radius: 24px;
|
||||
}
|
||||
/* Concentric with the card: its radius less the 10 px around the code. */
|
||||
.pc-card .qrbox.big {
|
||||
width: 224px;
|
||||
height: 224px;
|
||||
border-radius: 14px;
|
||||
}
|
||||
.pc-row {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.pc-row .knob {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background: color-mix(in srgb, var(--glass-text) 6%, transparent);
|
||||
color: var(--glass-text);
|
||||
}
|
||||
.pc-row .knob:hover {
|
||||
background: color-mix(in srgb, var(--glass-text) 11%, transparent);
|
||||
}
|
||||
.pc-copy {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 36px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 7px;
|
||||
padding: 0 14px;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--glass-text) 6%, transparent);
|
||||
color: var(--glass-text);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.01em;
|
||||
transition:
|
||||
transform 150ms var(--ease-out),
|
||||
background-color 150ms;
|
||||
}
|
||||
.pc-copy:hover {
|
||||
background: color-mix(in srgb, var(--glass-text) 11%, transparent);
|
||||
}
|
||||
.pc-copy:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
.pc-copy .i {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
flex: none;
|
||||
}
|
||||
.pc-copy .lbl {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pc-copy.copied {
|
||||
color: var(--ok);
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/* A pick pill (ui/pick.ts): the pill's own look is its class's (the language in the breadcrumb, the demo's
|
||||
set-up state); here what every one shares: what it leads with, its chevron, and its popup. */
|
||||
.pp {
|
||||
touch-action: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.pp-lead {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
}
|
||||
/* The one it led with before, blurring away over the new one. */
|
||||
.pp-lead > .pp-gone {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
.pp-lead[hidden] {
|
||||
display: none;
|
||||
}
|
||||
/* Turned by its own angle (ui/pick.ts), so shutting goes on round to down rather than back. */
|
||||
.pp-chev {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
flex: none;
|
||||
color: var(--text-2);
|
||||
rotate: 90deg;
|
||||
transition: rotate 260ms var(--ease-out);
|
||||
}
|
||||
|
||||
/* The popup: segments in one pill frame on Liquid Glass (tokens.css --glass-*), its tail one shape with it (a clip
|
||||
path, ui/pick.ts) with a soft even edge traced round both.
|
||||
The segments: clear on the glass as the menu's rows are; the dropdowns' highlight rests on the picked one (it is
|
||||
what says which is picked) and glides to the one pointed at; the picked one and the one pointed at in full text
|
||||
colour, the rest in the glass's subtitle colour. */
|
||||
.pp-pop {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
padding: 3px;
|
||||
}
|
||||
/* Its edge and shadow are its own (the clip path would cut the dropdowns' off): the ring and the shade. */
|
||||
.pp-pop.drop {
|
||||
box-shadow: none;
|
||||
}
|
||||
/* Room for the tail, towards the pill. */
|
||||
.pp-pop.above {
|
||||
padding-bottom: 9px;
|
||||
}
|
||||
.pp-pop.below {
|
||||
padding-top: 9px;
|
||||
}
|
||||
.pp-shade {
|
||||
position: fixed;
|
||||
z-index: 59;
|
||||
border-radius: 999px;
|
||||
pointer-events: none;
|
||||
box-shadow: var(--glass-shadow);
|
||||
}
|
||||
.pp-ring {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
fill: none;
|
||||
stroke: var(--glass-edge);
|
||||
stroke-width: 2;
|
||||
}
|
||||
.pp-pop button {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
height: 34px;
|
||||
padding: 0 10px;
|
||||
border-radius: 10px;
|
||||
color: var(--glass-sub);
|
||||
font-size: 12.5px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
color 150ms,
|
||||
background-color 150ms,
|
||||
transform 150ms var(--ease-out);
|
||||
}
|
||||
/* The ends follow the frame: half the segment's height (a larger radius would shrink every corner). */
|
||||
.pp-pop button:first-of-type {
|
||||
border-radius: 17px 10px 10px 17px;
|
||||
padding-left: 13px;
|
||||
}
|
||||
.pp-pop button:last-of-type {
|
||||
border-radius: 10px 17px 17px 10px;
|
||||
padding-right: 13px;
|
||||
}
|
||||
/* Under the pointer, or under a finger sliding over from the pill. */
|
||||
/* Under the pointer, or under a finger sliding over from the pill: the dropdowns' highlight is under it
|
||||
(ui/glide.ts); its words come up. */
|
||||
.pp-pop button.hot {
|
||||
color: var(--glass-text);
|
||||
}
|
||||
.pp-pop button:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
.pp-pop button[aria-checked='true'] {
|
||||
color: var(--glass-text);
|
||||
}
|
||||
.kbd .pp-pop button:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/* A language's flag: a 16px disc with a hairline so a white stripe keeps its edge. */
|
||||
.flag {
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
flex: none;
|
||||
}
|
||||
.flag svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.flag::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
.pp-pop button:not([aria-checked='true']):not(.hot) .flag {
|
||||
opacity: 0.7;
|
||||
}
|
||||
@@ -22,10 +22,6 @@
|
||||
.step + .step {
|
||||
margin-top: 20px;
|
||||
}
|
||||
/* No data: the connection step alone in its row (flows/setup-view.ts regroup). */
|
||||
.step[hidden] + .step {
|
||||
margin-top: 0;
|
||||
}
|
||||
.step-n {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
@@ -55,6 +51,12 @@
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
/* The connection (flows/setup-view.ts): its picker over its box, in step 2, a row or the again-row alike. */
|
||||
.conn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* The way, as on the old portal: one dotted line, three layers through the same dots (the dots, the
|
||||
light along them that runs and rests a beat, the green that fills them from the device); the
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
.sheet-root.open {
|
||||
display: block;
|
||||
}
|
||||
/* The dim alone, no blur behind it: a blur of the whole page would be drawn again on every frame the sheet and
|
||||
the dim move, and the system's own sheets dim too. */
|
||||
.scrim {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--scrim);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
.sheet {
|
||||
position: absolute;
|
||||
@@ -135,34 +135,31 @@
|
||||
top: 22px;
|
||||
right: 58px;
|
||||
}
|
||||
/* The connection's download and copy, on its row beside the chevron: quiet icons in the chevron's grey, a knob
|
||||
circle behind one under the pointer. */
|
||||
.hpill {
|
||||
position: relative;
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
}
|
||||
.hp-b {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 38px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: var(--knob);
|
||||
color: var(--text);
|
||||
border-radius: 50%;
|
||||
color: var(--text-2);
|
||||
transition:
|
||||
background-color 150ms,
|
||||
color 150ms,
|
||||
transform 150ms var(--ease-out);
|
||||
}
|
||||
.hp-b:first-of-type {
|
||||
border-radius: 16px 6px 6px 16px;
|
||||
}
|
||||
.hp-b:last-of-type {
|
||||
border-radius: 6px 16px 16px 6px;
|
||||
}
|
||||
.hp-b .i {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.hp-b:hover {
|
||||
background: color-mix(in srgb, var(--knob), var(--text) 6%);
|
||||
background: var(--knob);
|
||||
color: var(--text);
|
||||
}
|
||||
.hp-b:active {
|
||||
transform: scale(0.94);
|
||||
|
||||
@@ -39,14 +39,27 @@
|
||||
--accent: #4eafff;
|
||||
--accent-ink: #ffffff;
|
||||
--accent-soft: rgba(78, 175, 255, 0.13);
|
||||
--ok: #57d64b;
|
||||
--ok-soft: rgba(87, 214, 75, 0.14);
|
||||
--warn: #ff8a3d;
|
||||
--bad: #ff5c5c;
|
||||
--bad-soft: rgba(255, 92, 92, 0.13);
|
||||
--ok: #30d158;
|
||||
--ok-soft: rgba(48, 209, 88, 0.14);
|
||||
--warn: #ff8d28;
|
||||
--bad: #ff383c;
|
||||
--bad-soft: rgba(255, 56, 60, 0.13);
|
||||
--sel-bg: rgba(131, 209, 255, 0.25);
|
||||
--sel-fg: #64c6ff;
|
||||
--scrim: rgba(8, 8, 8, 0.8);
|
||||
/* iOS 26's Liquid Glass, Regular (Apple's Figma kit), for what pops over the page (the ⋯ menu, the pick pills'
|
||||
popups): black 60% with a white 6% film at 67%, blurred and its colours lifted; a soft even edge; its own
|
||||
text, subtitle and destructive colours; separators a touch softer than the edge; a solid highlight. */
|
||||
--glass-bg: linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04)), rgba(0, 0, 0, 0.4);
|
||||
--glass-edge: rgba(255, 255, 255, 0.05);
|
||||
--glass-sep: rgba(255, 255, 255, 0.04);
|
||||
--glass-text: #f5f5f5;
|
||||
--glass-sub: #8a8a8a;
|
||||
--glass-bad: var(--bad);
|
||||
--glass-hl: color-mix(in srgb, var(--raised), var(--text) 8%);
|
||||
--glass-hover: color-mix(in srgb, var(--raised), var(--text) 5%);
|
||||
/* No shadow on dark: the glass's edge sets it apart; on light a soft one. */
|
||||
--glass-shadow: 0 0 0 transparent;
|
||||
--line-glass: rgba(255, 255, 255, 0.07);
|
||||
--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, 0.75);
|
||||
--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.6);
|
||||
@@ -65,11 +78,11 @@
|
||||
--t-blue-a: #a6d9ff;
|
||||
--t-blue-b: #1d84e6;
|
||||
--t-green-a: #a8f29c;
|
||||
--t-green-b: #3aa32c;
|
||||
--t-green-b: #30d158;
|
||||
--t-red-a: #ffadad;
|
||||
--t-red-b: #dc3a3a;
|
||||
--t-red-b: #ff383c;
|
||||
--t-orange-a: #ffc08f;
|
||||
--t-orange-b: #ec6a12;
|
||||
--t-orange-b: #ff8d28;
|
||||
|
||||
--font: Geist, -apple-system, system-ui, 'Segoe UI', sans-serif;
|
||||
--mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
|
||||
@@ -98,14 +111,22 @@
|
||||
--text-3: #a6a6a4;
|
||||
--accent: #2b9dff;
|
||||
--accent-soft: rgba(43, 157, 255, 0.12);
|
||||
--ok: #33a328;
|
||||
--ok-soft: rgba(51, 163, 40, 0.12);
|
||||
--warn: #ee6a12;
|
||||
--bad: #e5484d;
|
||||
--bad-soft: rgba(229, 72, 77, 0.1);
|
||||
--ok: #30d158;
|
||||
--ok-soft: rgba(48, 209, 88, 0.12);
|
||||
--warn: #ff8d28;
|
||||
--bad: #ff383c;
|
||||
--bad-soft: rgba(255, 56, 60, 0.1);
|
||||
--sel-bg: rgba(78, 175, 255, 0.22);
|
||||
--sel-fg: #0a76cf;
|
||||
--scrim: rgba(236, 236, 235, 0.62);
|
||||
--glass-bg: rgba(245, 245, 245, 0.6);
|
||||
--glass-edge: rgba(0, 0, 0, 0.04);
|
||||
--glass-sep: rgba(0, 0, 0, 0.03);
|
||||
--glass-text: #1a1a1a;
|
||||
--glass-sub: #727272;
|
||||
--glass-hl: color-mix(in srgb, var(--raised), var(--text) 11%);
|
||||
--glass-hover: color-mix(in srgb, var(--raised), var(--text) 4%);
|
||||
--glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
||||
--line-glass: rgba(0, 0, 0, 0.07);
|
||||
--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.2);
|
||||
--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, 0.22);
|
||||
@@ -123,8 +144,8 @@
|
||||
--t-blue-a: #7cc4ff;
|
||||
--t-blue-b: #0a6fd6;
|
||||
--t-green-a: #82e070;
|
||||
--t-green-b: #2e8a22;
|
||||
--t-green-b: #30d158;
|
||||
--t-red-a: #ff9090;
|
||||
--t-red-b: #c92a2a;
|
||||
--t-red-b: #ff383c;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,11 @@ export interface AccItem {
|
||||
val?: Node | null;
|
||||
/** The body shows the same numbers: the head drops them while open. */
|
||||
valHide?: boolean;
|
||||
/**
|
||||
* Actions on what the row holds, beside the chevron while it is open (gone while it is shut). Beside the head,
|
||||
* not in it: the head is a button itself.
|
||||
*/
|
||||
aside?: Node | null;
|
||||
body: (Node | null | false | undefined)[];
|
||||
}
|
||||
|
||||
@@ -139,20 +144,28 @@ export function accordion(
|
||||
);
|
||||
const r = h(
|
||||
'div',
|
||||
{ class: `acc-row${still ? ' still' : ''}${open ? ' open' : ''}` },
|
||||
{ class: `acc-row${still ? ' still' : ''}${open ? ' open' : ''}${it.aside ? ' has-aside' : ''}` },
|
||||
headEl,
|
||||
it.aside ? h('div', { class: 'acc-aside' }, it.aside) : null,
|
||||
h('div', { class: 'acc-body' }, ...kids),
|
||||
);
|
||||
acc.appendChild(r);
|
||||
return r;
|
||||
});
|
||||
const bodyOf = (r: HTMLElement) => r.querySelector('.acc-body') as HTMLElement;
|
||||
const corners = () =>
|
||||
rows.forEach((r, i) => {
|
||||
/** Corners and edges over the rows that show: a row stepped out (only()) leaves no gap or corner behind. */
|
||||
const corners = () => {
|
||||
const shown = rows.filter((r) => !r.hidden);
|
||||
shown.forEach((r, i) => {
|
||||
const op = r.classList.contains('open');
|
||||
r.classList.toggle('rt', i === 0 || op || rows[i - 1].classList.contains('open'));
|
||||
r.classList.toggle('rb', i === rows.length - 1 || op || rows[i + 1].classList.contains('open'));
|
||||
r.classList.toggle('rt', i === 0 || op || shown[i - 1].classList.contains('open'));
|
||||
r.classList.toggle('rb', i === shown.length - 1 || op || shown[i + 1].classList.contains('open'));
|
||||
});
|
||||
rows.forEach((r) => {
|
||||
r.classList.toggle('first', r === shown[0]);
|
||||
r.classList.toggle('last', r === shown[shown.length - 1]);
|
||||
});
|
||||
};
|
||||
const read = (x: HTMLElement) => {
|
||||
const cs = getComputedStyle(x);
|
||||
const out: Record<string, string> = {};
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
// and blinks as macOS draws it; a selection is an accent wash with a handle at
|
||||
// each end, as iOS draws it, growing out of the caret and fading back into it.
|
||||
// The input stays the browser's own (typing, IME, its native selection, made
|
||||
// see-through): this only draws over it. On a touch screen the system draws its
|
||||
// own selection and handles, so ours stays off and the caret steps aside while
|
||||
// one shows. The look is in styles/controls.css; like the rest of the page this
|
||||
// writes styles through `el.style` only (the CSP drops style attributes).
|
||||
// see-through): this only draws over it. With a mouse or trackpad only: on a
|
||||
// touch screen the system's caret stays (in the accent), with its own selection
|
||||
// and handles. iOS doesn't tell a page reliably where its caret went (a tap in
|
||||
// the words, a press-and-drag): a drawn one would wait for the first key. The
|
||||
// look is in styles/controls.css; like the rest of the page this writes styles
|
||||
// through `el.style` only (the CSP drops style attributes).
|
||||
//
|
||||
// Places come from a hidden mirror with the input's own font: the width of the
|
||||
// text up to a position, less how far the input has scrolled. The pure parts
|
||||
@@ -87,15 +89,15 @@ export function places(f: FieldText, measure: (text: string) => number): Places
|
||||
const FONT = ['fontFamily', 'fontSize', 'fontWeight', 'letterSpacing', 'fontFeatureSettings', 'fontVariationSettings'] as const;
|
||||
|
||||
/**
|
||||
* Give the input of `field` (a `.field`) the glide caret and, with a fine pointer, the selection.
|
||||
* Give the input of `field` (a `.field`) the glide caret and the selection, with a mouse or trackpad.
|
||||
* Call it once, as the field is built (it measures only once the field is on the page).
|
||||
*/
|
||||
export function smoothCaret(field: HTMLElement) {
|
||||
const input = field.querySelector('input');
|
||||
if (!input) return;
|
||||
const fine = matchMedia('(pointer: fine)').matches;
|
||||
field.classList.add('own-caret');
|
||||
if (fine) field.classList.add('own-sel');
|
||||
// A touch screen: the system's caret (controls.css gives it the accent).
|
||||
if (!matchMedia('(pointer: fine)').matches) return;
|
||||
field.classList.add('own-caret', 'own-sel');
|
||||
const wash = h('span', { class: 'caret-sel' });
|
||||
const h0 = h('span', { class: 'caret-hd s' });
|
||||
const h1 = h('span', { class: 'caret-hd e' });
|
||||
@@ -187,7 +189,7 @@ export function smoothCaret(field: HTMLElement) {
|
||||
all.forEach((g) => jump(g, p.start));
|
||||
first = false;
|
||||
}
|
||||
if (p.range && fine) {
|
||||
if (p.range) {
|
||||
// Selecting: the wash grows out of where the caret is, and the caret steps aside. A wash still fading from
|
||||
// the last selection turns back instead and glides from its old ends to the new ones.
|
||||
if (!selecting) {
|
||||
@@ -204,10 +206,6 @@ export function smoothCaret(field: HTMLElement) {
|
||||
cur.t = p.caret;
|
||||
field.classList.add('selecting');
|
||||
caret.classList.remove('on', 'blink');
|
||||
} else if (p.range) {
|
||||
// A touch screen: the system's own selection shows.
|
||||
caret.classList.remove('on', 'blink');
|
||||
return;
|
||||
} else {
|
||||
// Collapsed: the wash fades where it stands, and its ends join the caret once it is gone.
|
||||
// A click puts the caret where it was clicked at once, as macOS does; typing and the arrows glide.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
// What every dropdown shares (the ⋯ menu, the pick pills' popups, the page's code): its look (.drop,
|
||||
// styles/drop.css: Liquid Glass, a soft even edge, a soft shadow on light only), one open at a time, the same gap to
|
||||
// its button and margin to the screen's edge, the same way in (a spring out of where it grows from) and out (back
|
||||
// towards it, from where it stands), and the same ways to shut it: a press outside it and its button, Escape (the
|
||||
// sheet under it stays; focus goes back to the button), a resize (at once). Each lays out and fills its own.
|
||||
|
||||
import { EASE_IN, POP, play } from '../motion';
|
||||
|
||||
/** From its button, and from the screen's edge. */
|
||||
export const GAP = 8;
|
||||
export const EDGE = 12;
|
||||
|
||||
let current: ((now?: boolean) => void) | null = null;
|
||||
|
||||
/** A dropdown is open (the page holds its repaints meanwhile). */
|
||||
export const dropOpen = () => !!current;
|
||||
|
||||
/** Shut the one open (`now`: at once: a sheet opening, the page drawn again in another language). */
|
||||
export function closeDrop(now = false) {
|
||||
current?.(now);
|
||||
}
|
||||
|
||||
/** Where an element stands now, mid-motion included. */
|
||||
function standing(el: Element): Keyframe {
|
||||
const s = getComputedStyle(el);
|
||||
return { opacity: s.opacity, transform: s.transform, filter: s.filter === 'none' ? 'blur(0px)' : s.filter };
|
||||
}
|
||||
|
||||
/** In: a spring out of its transform origin. */
|
||||
export function appear(el: Element) {
|
||||
play(
|
||||
el,
|
||||
[
|
||||
{ opacity: 0, transform: 'scale(.5)', filter: 'blur(6px)' },
|
||||
{ opacity: 1, transform: 'none', filter: 'blur(0px)' },
|
||||
],
|
||||
{ duration: POP.duration, easing: POP.easing },
|
||||
);
|
||||
}
|
||||
|
||||
/** Out: back towards its origin from where it stands, then gone. */
|
||||
export function vanish(el: Element) {
|
||||
const from = standing(el);
|
||||
el.getAnimations().forEach((a) => a.cancel());
|
||||
play(el, [from, { opacity: 0, transform: 'scale(.7)', filter: 'blur(4px)' }], {
|
||||
duration: 110,
|
||||
easing: EASE_IN,
|
||||
fill: 'forwards',
|
||||
}).onfinish = () => el.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open `panel` for `button`: another one open shuts at once, and the ways to shut this one are listened for.
|
||||
* `shut(now)` does the closing itself; what this returns is to be called first thing in it (it lets go of the
|
||||
* listeners, says the button is shut, and is false when the dropdown was shut already).
|
||||
*/
|
||||
export function opened(panel: Element, button: HTMLElement, shut: (now?: boolean) => void): () => boolean {
|
||||
if (current) current(true);
|
||||
const outside = (e: PointerEvent) => {
|
||||
const t = e.target as Node;
|
||||
if (!panel.contains(t) && !button.contains(t)) shut();
|
||||
};
|
||||
const esc = (e: KeyboardEvent) => {
|
||||
if (e.key !== 'Escape') return;
|
||||
e.stopPropagation();
|
||||
shut();
|
||||
button.focus({ preventScroll: true });
|
||||
};
|
||||
const resized = () => shut(true);
|
||||
document.addEventListener('pointerdown', outside, true);
|
||||
document.addEventListener('keydown', esc, true);
|
||||
addEventListener('resize', resized);
|
||||
button.setAttribute('aria-expanded', 'true');
|
||||
current = shut;
|
||||
return () => {
|
||||
if (current !== shut) return false;
|
||||
current = null;
|
||||
document.removeEventListener('pointerdown', outside, true);
|
||||
document.removeEventListener('keydown', esc, true);
|
||||
removeEventListener('resize', resized);
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// The dropdowns' highlight (ui/drop.ts: the ⋯ menu's rows, a pick pill's segments): one for all of a dropdown's
|
||||
// items, under their icons and words, the glass's solid highlight, the same for every item. It comes in on the item
|
||||
// the pointer (the keyboard, or a finger sliding over from a pick pill) reaches, glides from item to item on GLIDE
|
||||
// taking each one's place, size and corners, presses in with it, and fades where the pointer leaves (or goes back to
|
||||
// the item it rests on: a pick pill's picked segment).
|
||||
|
||||
import { h } from '../dom';
|
||||
|
||||
export interface Glide {
|
||||
/** Light this item (null: none). */
|
||||
light(item: HTMLElement | null): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* `host`: what holds the items and the highlight, positioned. `rest`: the item the highlight rests on (a pick pill's
|
||||
* picked segment): it starts there, and goes back there rather than fading when the pointer leaves.
|
||||
*/
|
||||
export function glide(host: HTMLElement, items: HTMLElement[], rest: HTMLElement | null = null): Glide {
|
||||
const hl = h('span', { class: 'drop-hl', 'aria-hidden': 'true' });
|
||||
host.prepend(hl);
|
||||
let hot: HTMLElement | null = null;
|
||||
const light = (item: HTMLElement | null) => {
|
||||
if (item === hot) return;
|
||||
hot?.classList.remove('hot');
|
||||
hot = item;
|
||||
if (!item) return void (hl.style.opacity = '0');
|
||||
item.classList.add('hot');
|
||||
// Gone altogether, it is placed at once and fades in there; still showing, it glides from where it stands.
|
||||
hl.classList.toggle('moving', +getComputedStyle(hl).opacity > 0.01);
|
||||
Object.assign(hl.style, {
|
||||
translate: `${item.offsetLeft}px ${item.offsetTop}px`,
|
||||
width: `${item.offsetWidth}px`,
|
||||
height: `${item.offsetHeight}px`,
|
||||
borderRadius: getComputedStyle(item).borderRadius,
|
||||
opacity: '1',
|
||||
});
|
||||
};
|
||||
for (const it of items) {
|
||||
it.addEventListener('pointerenter', () => light(it));
|
||||
it.addEventListener('focus', () => it.matches(':focus-visible') && light(it));
|
||||
it.addEventListener('pointerdown', () => {
|
||||
hl.classList.add('down');
|
||||
document.addEventListener('pointerup', () => hl.classList.remove('down'), { once: true, capture: true });
|
||||
});
|
||||
}
|
||||
host.addEventListener('pointerleave', () => light(rest));
|
||||
light(rest);
|
||||
return { light: (item) => light(item ?? rest) };
|
||||
}
|
||||
@@ -1,123 +1,114 @@
|
||||
// The ⋯ menu: a small panel under (or over) its button, items with an icon,
|
||||
// a highlight that glides after the pointer and takes the item's colour
|
||||
// (orange for Reconnect, red for Remove). A choice among options (the
|
||||
// language) marks the current one with a check instead of icons. One at a
|
||||
// time; it closes on a press outside, on scroll, on Escape and when its button
|
||||
// is pressed again.
|
||||
// The ⋯ menu: an iOS 26-style menu under its button (over it where the screen
|
||||
// ends): Liquid Glass (the page blurred behind), a soft even edge.
|
||||
// Laid out as iOS 26's: rows (an icon, the label and a line under it where the
|
||||
// item has one: the address it copies), a thin line between groups; Reconnect
|
||||
// orange, Remove red. The dropdowns' highlight glides from row to row. It springs out from the
|
||||
// button's side and drops back towards it. Shut by a
|
||||
// press outside, Escape, its button again or a choice. One at a time.
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { EASE_IN, POP, play } from '../motion';
|
||||
import { appear, closeDrop, EDGE, GAP, opened, vanish } from './drop';
|
||||
import { glide } from './glide';
|
||||
|
||||
export interface MenuItem {
|
||||
label: string;
|
||||
/** An action's icon; an option (`checked` set) shows a check in its place, on the current one only. */
|
||||
icon?: string;
|
||||
checked?: boolean;
|
||||
/** Its line icon. */
|
||||
icon: string;
|
||||
/** Under the label: what it acts on (the address it copies). */
|
||||
sub?: string;
|
||||
tone?: 'warn' | 'bad';
|
||||
run: () => unknown;
|
||||
}
|
||||
|
||||
let menuEl: HTMLElement | null = null;
|
||||
/** The button the open menu belongs to: pressing it again closes the menu. */
|
||||
let anchorEl: HTMLElement | null = null;
|
||||
|
||||
export const menuOpen = () => !!menuEl;
|
||||
|
||||
/** `now`: gone at once (Escape, or another menu opening). */
|
||||
export function closeMenu(now = false) {
|
||||
const m = menuEl;
|
||||
if (!m) return;
|
||||
menuEl = null;
|
||||
anchorEl?.setAttribute('aria-expanded', 'false');
|
||||
anchorEl = null;
|
||||
if (now) {
|
||||
m.remove();
|
||||
return;
|
||||
/** `all`: null between groups (kept only between items); `title`: what it acts on (the device), for a screen reader. */
|
||||
export function openMenu(anchor: HTMLElement, all: (MenuItem | null)[], title: string) {
|
||||
// Its button again: it shuts.
|
||||
if (anchor.getAttribute('aria-expanded') === 'true') return closeDrop();
|
||||
const groups: MenuItem[][] = [[]];
|
||||
for (const it of all) {
|
||||
if (it) groups[groups.length - 1].push(it);
|
||||
else if (groups[groups.length - 1].length) groups.push([]);
|
||||
}
|
||||
// From where it stands: one closed while it still pops in (a scroll, a second press) goes from there.
|
||||
const s = getComputedStyle(m);
|
||||
const a = play(
|
||||
m,
|
||||
[
|
||||
{ opacity: s.opacity, transform: s.transform, filter: s.filter },
|
||||
{ opacity: 0, transform: 'scale(.96)', filter: 'blur(3px)' },
|
||||
],
|
||||
{
|
||||
duration: 120,
|
||||
easing: EASE_IN,
|
||||
fill: 'forwards',
|
||||
},
|
||||
);
|
||||
m.getAnimations().forEach((x) => x !== a && x.cancel());
|
||||
a.onfinish = () => m.remove();
|
||||
}
|
||||
if (!groups[groups.length - 1].length) groups.pop();
|
||||
|
||||
/** `items`: null is a separator, kept only between items. */
|
||||
export function openMenu(anchor: HTMLElement, all: (MenuItem | null)[]) {
|
||||
if (anchorEl === anchor && menuEl) return closeMenu();
|
||||
closeMenu(true);
|
||||
const items = all.filter((it, i) => it || (i > 0 && all[i - 1] && all.slice(i + 1).some(Boolean)));
|
||||
const hl = h('span', { class: 'menu-hl' });
|
||||
const m = h('div', { class: 'menu', role: 'menu' }, hl);
|
||||
for (const it of items) {
|
||||
if (!it) {
|
||||
m.appendChild(h('div', { class: 'menu-sep' }));
|
||||
continue;
|
||||
}
|
||||
const rows: HTMLElement[] = [];
|
||||
const item = (it: MenuItem, cls: string, ...kids: (Node | null)[]) => {
|
||||
const b = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
role: it.checked === undefined ? 'menuitem' : 'menuitemradio',
|
||||
'aria-checked': it.checked === undefined ? null : String(it.checked),
|
||||
class: `mi ${it.tone ?? ''}`,
|
||||
role: 'menuitem',
|
||||
class: `${cls}${it.tone ? ` ${it.tone}` : ''}`,
|
||||
onclick: () => {
|
||||
closeMenu();
|
||||
close();
|
||||
it.run();
|
||||
},
|
||||
},
|
||||
it.checked === undefined ? ic(it.icon ?? '') : ic('check', it.checked ? 'i' : 'i off'),
|
||||
h('span', {}, it.label),
|
||||
...kids,
|
||||
);
|
||||
// The highlight comes in where the pointer is, then glides from item to item. Whether it shows is read off the
|
||||
// screen: one still fading out (the pointer left and came back) turns back and glides from where it stands;
|
||||
// only one gone altogether is placed at once.
|
||||
b.addEventListener('pointerenter', () => {
|
||||
const seen = +getComputedStyle(hl).opacity > 0.01;
|
||||
hl.className = `menu-hl${seen ? ' moving' : ''} ${it.tone ?? ''}`;
|
||||
hl.style.transform = `translateY(${b.offsetTop - 6}px)`;
|
||||
hl.style.opacity = '1';
|
||||
});
|
||||
m.appendChild(b);
|
||||
}
|
||||
m.addEventListener('pointerleave', () => (hl.style.opacity = '0'));
|
||||
document.body.appendChild(m);
|
||||
const r = anchor.getBoundingClientRect();
|
||||
const w = m.offsetWidth;
|
||||
const mh = m.offsetHeight;
|
||||
// Under the button, or over it where the screen ends: it grows out of the button either way.
|
||||
const below = r.bottom + 8 + mh < innerHeight - 8;
|
||||
m.style.left = `${Math.max(12, Math.min(r.right - w, innerWidth - w - 12))}px`;
|
||||
m.style.top = `${below ? r.bottom + 8 : r.top - 8 - mh}px`;
|
||||
m.style.transformOrigin = `${below ? 'top' : 'bottom'} right`;
|
||||
play(
|
||||
m,
|
||||
[
|
||||
{ opacity: 0, transform: 'scale(.9)', filter: 'blur(4px)' },
|
||||
{ opacity: 1, transform: 'none', filter: 'none' },
|
||||
],
|
||||
{
|
||||
duration: POP.duration,
|
||||
easing: POP.easing,
|
||||
},
|
||||
rows.push(b);
|
||||
return b;
|
||||
};
|
||||
const sections: HTMLElement[] = [
|
||||
...groups.map((g) =>
|
||||
h(
|
||||
'div',
|
||||
{ class: 'pop-grp' },
|
||||
...g.map((it) =>
|
||||
item(
|
||||
it,
|
||||
'mi',
|
||||
ic(it.icon),
|
||||
h('span', { class: 'mi-b' }, h('span', { class: 'mi-l' }, it.label), it.sub ? h('span', { class: 'mi-s' }, it.sub) : null),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
// A thin line between sections (iOS's, inset; the rows themselves sit in a 16 px inset).
|
||||
const body = h(
|
||||
'div',
|
||||
{ class: 'pop-body' },
|
||||
...sections.flatMap((sec, i) => (i ? [h('div', { class: 'pop-sep', 'aria-hidden': 'true' }, h('span')), sec] : [sec])),
|
||||
);
|
||||
menuEl = m;
|
||||
anchorEl = anchor;
|
||||
anchor.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
const pop = h('div', { class: 'pop drop', role: 'menu', 'aria-label': title }, body);
|
||||
document.body.append(pop);
|
||||
|
||||
document.addEventListener('pointerdown', (e) => {
|
||||
const t = e.target as Element;
|
||||
if (menuEl && !menuEl.contains(t) && !anchorEl?.contains(t)) closeMenu();
|
||||
});
|
||||
addEventListener('scroll', () => closeMenu(), { passive: true });
|
||||
// Under the button where it fits, else over it; centred on it, inside the screen's edge, growing from its side.
|
||||
const k = anchor.getBoundingClientRect();
|
||||
const w = Math.min(pop.offsetWidth, innerWidth - EDGE * 2);
|
||||
pop.style.width = `${w}px`;
|
||||
const ht = pop.offsetHeight;
|
||||
const mid = k.left + k.width / 2;
|
||||
const left = Math.max(EDGE, Math.min(mid - w / 2, innerWidth - EDGE - w));
|
||||
const below = k.bottom + GAP + ht <= innerHeight - EDGE || k.top - GAP - ht < EDGE;
|
||||
const top = below ? k.bottom + GAP : k.top - GAP - ht;
|
||||
Object.assign(pop.style, {
|
||||
left: `${left + scrollX}px`,
|
||||
top: `${top + scrollY}px`,
|
||||
transformOrigin: `${mid - left}px ${below ? 0 : ht}px`,
|
||||
});
|
||||
|
||||
appear(pop);
|
||||
const release = opened(pop, anchor, close);
|
||||
|
||||
// The dropdowns' one highlight for the rows (ui/glide.ts).
|
||||
glide(body, rows);
|
||||
|
||||
// Arrows move through the rows (the rest of the keys and presses are the dropdown's: ui/drop.ts).
|
||||
const keys = (e: KeyboardEvent) => {
|
||||
if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
|
||||
e.preventDefault();
|
||||
const i = rows.indexOf(document.activeElement as HTMLElement);
|
||||
const j = i < 0 ? (e.key === 'ArrowDown' ? 0 : rows.length - 1) : i + (e.key === 'ArrowDown' ? 1 : -1);
|
||||
rows[Math.max(0, Math.min(rows.length - 1, j))]?.focus({ preventScroll: true });
|
||||
};
|
||||
document.addEventListener('keydown', keys, true);
|
||||
|
||||
function close(instant = false) {
|
||||
if (!release()) return;
|
||||
document.removeEventListener('keydown', keys, true);
|
||||
if (instant || !anchor.isConnected) pop.remove();
|
||||
else vanish(pop);
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ function finish(el: HTMLElement) {
|
||||
clearTimeout(r.timer);
|
||||
runs.delete(el);
|
||||
el.getAnimations().forEach((a) => a.cancel());
|
||||
el.classList.remove('mt', 'mt-ib');
|
||||
el.classList.remove('mt', 'mt-ib', 'mt-run');
|
||||
el.textContent = r.text;
|
||||
}
|
||||
|
||||
@@ -162,6 +162,33 @@ export interface MorphOpts {
|
||||
color?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A letter of a morph leaving: it lifts away as it blurs out (`delay`: its place in the sweep; `from`: how it
|
||||
* shows). Also what goes with the words as one more letter (a pick pill's flag), so both move as one.
|
||||
*/
|
||||
export function letterOut(el: Element, delay = 0, from: Look = SHOWN): Animation {
|
||||
return play(
|
||||
el,
|
||||
[
|
||||
{ opacity: from.opacity, filter: from.filter, transform: 'none' },
|
||||
{ opacity: 0, filter: 'blur(4px)', transform: 'translateY(-0.45em)' },
|
||||
],
|
||||
{ duration: 220, delay, easing: EASE_IN, fill: 'forwards' },
|
||||
);
|
||||
}
|
||||
|
||||
/** A letter of a morph coming in: it rises in as it sharpens, after the old ones start to go. */
|
||||
export function letterIn(el: Element, delay = 0): Animation {
|
||||
return play(
|
||||
el,
|
||||
[
|
||||
{ opacity: 0, filter: 'blur(4px)', transform: 'translateY(0.45em)' },
|
||||
{ opacity: 1, filter: 'blur(0px)', transform: 'none' },
|
||||
],
|
||||
{ duration: 380, delay: 120 + delay, easing: EASE_OUT, fill: 'backwards' },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* `el`'s text turns into `next`, letter by letter: the letters both say stay
|
||||
* and slide to their new places, the others lift away or rise in. `from`: what
|
||||
@@ -196,6 +223,9 @@ export function morphText(el: HTMLElement, next: string, from = textOf(el), o: M
|
||||
const flow = whole && cs.display === 'inline';
|
||||
if (cs.display === 'inline' && !whole) el.classList.add('mt-ib');
|
||||
if (cs.position === 'static') el.classList.add('mt');
|
||||
// A box that clips its text (one line ending in an ellipsis) lets it show whole while it changes: the letters
|
||||
// rise from under the line and blur, and the width glides past the new ones. Clipped again once done.
|
||||
el.classList.add('mt-run');
|
||||
let r0: DOMRect | null = live ? midway : null;
|
||||
let t0 = live?.at ?? at ?? null;
|
||||
let at0: number[] = [];
|
||||
@@ -316,26 +346,8 @@ export function morphText(el: HTMLElement, next: string, from = textOf(el), o: M
|
||||
// A long text keeps the same overall sweep: the steps shorten instead.
|
||||
const so = Math.min(12, 160 / Math.max(1, out.length));
|
||||
const si = Math.min(22, 260 / Math.max(1, inn.length));
|
||||
out.forEach((c, i) =>
|
||||
play(
|
||||
c,
|
||||
[
|
||||
{ opacity: s0.opacity, filter: s0.filter, transform: 'none' },
|
||||
{ opacity: 0, filter: 'blur(4px)', transform: 'translateY(-0.45em)' },
|
||||
],
|
||||
{ duration: 220, delay: i * so, easing: EASE_IN, fill: 'forwards' },
|
||||
),
|
||||
);
|
||||
inn.forEach((c, i) =>
|
||||
play(
|
||||
c,
|
||||
[
|
||||
{ opacity: 0, filter: 'blur(4px)', transform: 'translateY(0.45em)' },
|
||||
{ opacity: 1, filter: 'blur(0px)', transform: 'none' },
|
||||
],
|
||||
{ duration: 380, delay: 120 + i * si, easing: EASE_OUT, fill: 'backwards' },
|
||||
),
|
||||
);
|
||||
out.forEach((c, i) => letterOut(c, i * so, s0));
|
||||
inn.forEach((c, i) => letterIn(c, i * si));
|
||||
const ends =
|
||||
Math.max(220 + out.length * so, inn.length ? 120 + inn.length * si + 380 : 0, glides || pairs.length ? SMOOTH.duration : 0) + 40;
|
||||
runs.set(el, { text: next, timer: window.setTimeout(() => finish(el), ends) });
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
// A pill that picks one of a few options (the language in the breadcrumb; the demo's set-up state): what is
|
||||
// picked and a chevron. Its popup, a dropdown as every other (ui/drop.ts: its glass, its gap, its way in and out,
|
||||
// what shuts it), is a row of segments in one pill frame beside it, its tail one shape with it, pointing at the pill. A click opens it and another picks; or press the pill, slide onto an option and let go
|
||||
// there (a quick pick: let go anywhere else after sliding and nothing changes). The chevron turns up as it opens
|
||||
// and on round to down as it shuts; what the pill says morphs into the one picked. Fixed to the screen (it may open
|
||||
// on a sheet), it also shuts on a wheel or a swipe, and on Tab.
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { EASE_IN, play } from '../motion';
|
||||
import { appear, EDGE, GAP, opened, vanish } from './drop';
|
||||
import { glide } from './glide';
|
||||
import { letterIn, letterOut, morphText, setText } from './morph';
|
||||
|
||||
export interface PickOption<T> {
|
||||
value: T;
|
||||
label: () => string;
|
||||
/** Before the label, in the popup and on the pill (a dot, a flag): made anew each time it shows. */
|
||||
lead?: () => Element;
|
||||
}
|
||||
|
||||
export interface PickPill<T> {
|
||||
el: HTMLButtonElement;
|
||||
/** Show this value, without motion (it changed elsewhere). */
|
||||
show(v: T): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface PickOpts<T> {
|
||||
/** The pill's own class (its look). */
|
||||
cls: string;
|
||||
label: () => string;
|
||||
options: PickOption<T>[];
|
||||
value: T;
|
||||
/** What the pill says for a value: the option's label unless given (the language's code). */
|
||||
short?: (v: T) => string;
|
||||
pick: (v: T) => void;
|
||||
/** Where the popup goes first: above the pill (default) or under it; the other side where it does not fit. */
|
||||
prefer?: 'above' | 'below';
|
||||
}
|
||||
|
||||
/** The tail: its height and half its width at the base. */
|
||||
const TAIL = 6;
|
||||
const HALF = 10;
|
||||
|
||||
/**
|
||||
* The popup's outline, `w` × `h`: a pill of radius `r` with its tail at `x` on the top edge (`up`) or the bottom
|
||||
* one, its shoulders leaving the edge level (so it flows out of the frame) and its tip rounded.
|
||||
*/
|
||||
function outline(w: number, ht: number, r: number, x: number, up: boolean): string {
|
||||
const y0 = up ? TAIL : 0;
|
||||
const y1 = up ? ht : ht - TAIL;
|
||||
const tip = up ? 0 : ht;
|
||||
const n = (v: number) => Math.round(v * 100) / 100;
|
||||
const tail = (a: number, b: number, base: number) =>
|
||||
`L ${n(a)} ${base} C ${n(a + (b - a) / 4)} ${base} ${n(x - (b - a) / 8)} ${tip} ${n(x)} ${tip} ` +
|
||||
`C ${n(x + (b - a) / 8)} ${tip} ${n(b - (b - a) / 4)} ${base} ${n(b)} ${base} `;
|
||||
return (
|
||||
`M ${r} ${y0} ${up ? tail(x - HALF, x + HALF, y0) : ''}L ${w - r} ${y0} A ${r} ${r} 0 0 1 ${w - r} ${y1} ` +
|
||||
`${up ? '' : tail(x + HALF, x - HALF, y1)}L ${r} ${y1} A ${r} ${r} 0 0 1 ${r} ${y0} Z`
|
||||
);
|
||||
}
|
||||
|
||||
interface Open {
|
||||
el: HTMLElement;
|
||||
pop: HTMLElement;
|
||||
close(): void;
|
||||
choose(b: HTMLElement): void;
|
||||
/** The dropdowns' highlight on this segment (ui/glide.ts). */
|
||||
light(b: HTMLElement | null): void;
|
||||
/** A press on the pill under way: was the popup open before it, and has it slid since. */
|
||||
press: { wasOpen: boolean; x: number; y: number; moved: boolean } | null;
|
||||
}
|
||||
let open: Open | null = null;
|
||||
|
||||
/** Gone from where it stands, so one leaving while it still comes in turns back from there. */
|
||||
function leave(el: Element, frames: Keyframe, ms: number) {
|
||||
const s = getComputedStyle(el);
|
||||
el.getAnimations().forEach((a) => a.cancel());
|
||||
play(
|
||||
el,
|
||||
[
|
||||
{ opacity: s.opacity, transform: s.transform, filter: s.filter },
|
||||
{ opacity: 0, ...frames },
|
||||
],
|
||||
{
|
||||
duration: ms,
|
||||
easing: EASE_IN,
|
||||
fill: 'forwards',
|
||||
},
|
||||
).onfinish = () => el.remove();
|
||||
}
|
||||
|
||||
const optionAt = (x: number, y: number) =>
|
||||
open ? (document.elementFromPoint(x, y)?.closest<HTMLElement>('.pp-pop button') ?? null) : null;
|
||||
|
||||
let wired = false;
|
||||
function wire() {
|
||||
if (wired) return;
|
||||
wired = true;
|
||||
document.addEventListener(
|
||||
'pointermove',
|
||||
(e) => {
|
||||
const p = open?.press;
|
||||
if (!open || !p) return;
|
||||
if (Math.hypot(e.clientX - p.x, e.clientY - p.y) > 6) p.moved = true;
|
||||
open.light(optionAt(e.clientX, e.clientY));
|
||||
},
|
||||
true,
|
||||
);
|
||||
document.addEventListener(
|
||||
'pointerup',
|
||||
(e) => {
|
||||
const o = open;
|
||||
const p = o?.press;
|
||||
if (!o || !p) return;
|
||||
o.press = null;
|
||||
const at = optionAt(e.clientX, e.clientY);
|
||||
if (at && o.pop.contains(at)) return o.choose(at);
|
||||
const onPill = o.el.contains(document.elementFromPoint(e.clientX, e.clientY));
|
||||
// A click on the pill: it opened and stays; open already, it shuts. Slid off and let go elsewhere: nothing.
|
||||
if (onPill ? p.wasOpen && !p.moved : p.moved) o.close();
|
||||
},
|
||||
true,
|
||||
);
|
||||
document.addEventListener('pointercancel', () => open && (open.press = null), true);
|
||||
document.addEventListener(
|
||||
'keydown',
|
||||
(e) => {
|
||||
if (!open) return;
|
||||
if (e.key === 'Tab') open.close();
|
||||
else if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight') && open.pop.contains(document.activeElement)) {
|
||||
e.preventDefault();
|
||||
const bs = [...open.pop.querySelectorAll<HTMLElement>('button')];
|
||||
const i = bs.indexOf(document.activeElement as HTMLElement) + (e.key === 'ArrowRight' ? 1 : -1);
|
||||
bs[Math.max(0, Math.min(bs.length - 1, i))].focus({ preventScroll: true });
|
||||
}
|
||||
},
|
||||
true,
|
||||
);
|
||||
for (const ev of ['wheel', 'touchmove'])
|
||||
addEventListener(ev, (e) => open && !open.pop.contains(e.target as Node) && !open.el.contains(e.target as Node) && open.close(), {
|
||||
passive: true,
|
||||
capture: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function pickPill<T>(o: PickOpts<T>): PickPill<T> {
|
||||
wire();
|
||||
let value = o.value;
|
||||
const opt = (v: T) => o.options.find((x) => x.value === v) ?? o.options[0];
|
||||
const words = (v: T) => (o.short ? o.short(v) : opt(v).label());
|
||||
const lead = h('span', { class: 'pp-lead' });
|
||||
const lbl = h('span', { class: 'pp-t' });
|
||||
const chev = ic('chevron', 'i pp-chev') as SVGElement;
|
||||
const el = h(
|
||||
'button',
|
||||
{ type: 'button', class: `pp ${o.cls}`, 'aria-haspopup': 'menu', 'aria-expanded': 'false' },
|
||||
lead,
|
||||
lbl,
|
||||
chev,
|
||||
) as HTMLButtonElement;
|
||||
/** What it leads with follows the value; `swap`: the old one blurs away over the new one as that pops in. */
|
||||
const paint = (swap = false) => {
|
||||
const n = opt(value).lead?.();
|
||||
const old = swap ? [...lead.children].filter((c) => !c.classList.contains('pp-gone')) : [];
|
||||
lead.replaceChildren(...old, ...(n ? [n] : []));
|
||||
lead.hidden = !n && !old.length;
|
||||
el.setAttribute('aria-label', o.label());
|
||||
if (!swap) return;
|
||||
// As the first letter of the words beside it: it goes and comes with them (ui/morph.ts).
|
||||
for (const c of old) {
|
||||
c.classList.add('pp-gone');
|
||||
letterOut(c).onfinish = () => c.remove();
|
||||
}
|
||||
if (n) letterIn(n);
|
||||
};
|
||||
setText(lbl, words(value));
|
||||
paint();
|
||||
|
||||
// The chevron turns by its own angle, so shutting goes on round (up, left, down) rather than back; once down it
|
||||
// is 90° again, unseen.
|
||||
chev.addEventListener('transitionend', () => {
|
||||
if (chev.style.rotate !== '-270deg') return;
|
||||
chev.style.transition = 'none';
|
||||
chev.style.rotate = '';
|
||||
chev.getBoundingClientRect();
|
||||
chev.style.transition = '';
|
||||
});
|
||||
|
||||
let me: Open | null = null;
|
||||
let shade: HTMLElement | null = null;
|
||||
/** Lets go of what every dropdown listens for (ui/drop.ts). */
|
||||
let release: () => boolean = () => false;
|
||||
const close = (now = false) => {
|
||||
if (!me || !release()) return;
|
||||
if (now) {
|
||||
me.pop.remove();
|
||||
shade?.remove();
|
||||
} else {
|
||||
vanish(me.pop);
|
||||
if (shade) leave(shade, {}, 110);
|
||||
}
|
||||
shade = null;
|
||||
if (open === me) open = null;
|
||||
me = null;
|
||||
chev.style.rotate = '-270deg';
|
||||
};
|
||||
const choose = (b: HTMLElement) => {
|
||||
const v = o.options[Number(b.dataset.i)].value;
|
||||
close();
|
||||
if (v === value) return;
|
||||
const was = words(value);
|
||||
value = v;
|
||||
// Picking may draw the page again (a language): the pill is the same one, put back; its words morph after.
|
||||
o.pick(v);
|
||||
paint(true);
|
||||
morphText(lbl, words(v), was);
|
||||
};
|
||||
|
||||
const show = (focus: boolean) => {
|
||||
const pop = h(
|
||||
'div',
|
||||
{ class: 'pp-pop drop', role: 'menu', 'aria-label': o.label() },
|
||||
...o.options.map((x, i) =>
|
||||
h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
role: 'menuitemradio',
|
||||
tabindex: '-1',
|
||||
'data-i': String(i),
|
||||
'aria-checked': String(x.value === value),
|
||||
onclick: (e: Event) => choose(e.currentTarget as HTMLElement),
|
||||
},
|
||||
x.lead?.() ?? null,
|
||||
h('span', {}, x.label()),
|
||||
),
|
||||
),
|
||||
);
|
||||
document.body.append(pop);
|
||||
// Centred on the pill, inside its sheet where it fits (else the screen), the tail on the pill's middle and its
|
||||
// tip the dropdowns' gap from it.
|
||||
const r = el.getBoundingClientRect();
|
||||
const box = el.closest('.sheet')?.getBoundingClientRect() ?? { left: 0, right: innerWidth };
|
||||
const w = pop.offsetWidth;
|
||||
const ht = pop.offsetHeight;
|
||||
const mid = r.left + r.width / 2;
|
||||
const lo = Math.max(EDGE, box.left + 10);
|
||||
const hi = Math.min(innerWidth - EDGE, box.right - 10);
|
||||
const left = Math.max(lo, Math.min(mid - w / 2, hi - w));
|
||||
// The tail is part of the glass (one shape with the frame, a clip path): the popup grows by it towards the pill.
|
||||
const all = ht + TAIL;
|
||||
const above = r.top - GAP - all >= EDGE;
|
||||
const under = r.bottom + GAP + all <= innerHeight - EDGE;
|
||||
const below = o.prefer === 'below' ? under || !above : !above;
|
||||
const top = below ? r.bottom + GAP : r.top - GAP - all;
|
||||
pop.classList.add(below ? 'below' : 'above');
|
||||
const x = Math.max(ht / 2 + HALF, Math.min(mid - left, w - ht / 2 - HALF));
|
||||
const shape = outline(w, all, ht / 2, x, below);
|
||||
Object.assign(pop.style, {
|
||||
left: `${left}px`,
|
||||
top: `${top}px`,
|
||||
height: `${all}px`,
|
||||
clipPath: `path('${shape}')`,
|
||||
transformOrigin: `${x}px ${below ? 0 : all}px`,
|
||||
});
|
||||
const ring = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
ring.setAttribute('class', 'pp-ring');
|
||||
ring.setAttribute('aria-hidden', 'true');
|
||||
ring.setAttribute('viewBox', `0 0 ${w} ${all}`);
|
||||
const edge = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||
edge.setAttribute('d', shape);
|
||||
ring.append(edge);
|
||||
pop.append(ring);
|
||||
// The glass's shadow (light only, tokens.css): the clip path would cut one off the popup, so a clear pill under
|
||||
// its frame casts it (an outer shadow shows only outside its box).
|
||||
shade = h('div', { class: 'pp-shade', 'aria-hidden': 'true' });
|
||||
Object.assign(shade.style, {
|
||||
left: `${left}px`,
|
||||
top: `${top + (below ? TAIL : 0)}px`,
|
||||
width: `${w}px`,
|
||||
height: `${ht}px`,
|
||||
});
|
||||
pop.before(shade);
|
||||
play(shade, [{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: 'ease-out' });
|
||||
appear(pop);
|
||||
release = opened(pop, el, close);
|
||||
// The highlight rests on the picked segment: it is what says which one is picked.
|
||||
const { light } = glide(pop, [...pop.querySelectorAll<HTMLElement>('button')], pop.querySelector<HTMLElement>('[aria-checked="true"]'));
|
||||
me = { el, pop, close, choose, light, press: null };
|
||||
open = me;
|
||||
chev.style.rotate = '-90deg';
|
||||
if (focus) pop.querySelector<HTMLElement>('[aria-checked="true"]')?.focus({ preventScroll: true });
|
||||
};
|
||||
|
||||
let pressedAt = 0;
|
||||
el.addEventListener('pointerdown', (e) => {
|
||||
if (e.button !== 0) return;
|
||||
pressedAt = performance.now();
|
||||
const wasOpen = !!me;
|
||||
if (!me) show(false);
|
||||
me!.press = { wasOpen, x: e.clientX, y: e.clientY, moved: false };
|
||||
// A touch keeps to what it pressed: let it go, so what is under the finger can be found as it slides.
|
||||
if (el.hasPointerCapture(e.pointerId)) el.releasePointerCapture(e.pointerId);
|
||||
});
|
||||
// The keyboard's click (Return, Space): a press already did what it does.
|
||||
el.addEventListener('click', () => {
|
||||
if (performance.now() - pressedAt < 800) return;
|
||||
if (me) close();
|
||||
else show(true);
|
||||
});
|
||||
|
||||
return {
|
||||
el,
|
||||
show(v) {
|
||||
if (v === value) return;
|
||||
value = v;
|
||||
setText(lbl, words(v));
|
||||
paint();
|
||||
},
|
||||
close,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// A control pressed scales down (its :active look, in the stylesheets): let go near its edge after a moment and
|
||||
// the pointer is outside it by then, so the browser gives the click to what holds both and nothing happens. Here
|
||||
// what was pressed keeps the footprint it had when pressed: let go inside that and it gets the click, the
|
||||
// browser's own (to the ancestor) dropped. A mouse or trackpad only: a touch stays with what it pressed.
|
||||
|
||||
const PRESSABLE = 'button, a[href], [role="button"], label';
|
||||
|
||||
let pressed: { el: HTMLElement; at: DOMRect } | null = null;
|
||||
/** The browser's own click of this press, to the ancestor, is to be dropped. */
|
||||
let swallow = false;
|
||||
|
||||
export function keepPressFootprint() {
|
||||
document.addEventListener(
|
||||
'pointerdown',
|
||||
(e) => {
|
||||
const el = e.pointerType === 'mouse' && e.button === 0 ? (e.target as Element).closest?.<HTMLElement>(PRESSABLE) : null;
|
||||
pressed = el ? { el, at: el.getBoundingClientRect() } : null;
|
||||
},
|
||||
true,
|
||||
);
|
||||
document.addEventListener(
|
||||
'pointerup',
|
||||
(e) => {
|
||||
const p = pressed;
|
||||
pressed = null;
|
||||
if (!p || p.el.contains(e.target as Node)) return;
|
||||
const { at } = p;
|
||||
if (e.clientX < at.left || e.clientX > at.right || e.clientY < at.top || e.clientY > at.bottom) return;
|
||||
swallow = true;
|
||||
// The click, if the browser sends one, comes right after this; anything later is another press.
|
||||
setTimeout(() => (swallow = false));
|
||||
p.el.click();
|
||||
},
|
||||
true,
|
||||
);
|
||||
document.addEventListener(
|
||||
'click',
|
||||
(e) => {
|
||||
if (!swallow || !e.isTrusted) return;
|
||||
swallow = false;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
},
|
||||
true,
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,10 @@
|
||||
// name. The pill stretches like skiper21's tabs: its leading edge reaches the
|
||||
// new item first and the trailing edge follows, so the name fading in is always
|
||||
// inside it. Items grow by flex-grow (a share of the track, not pixels), so
|
||||
// they stay right while the sheet around them changes width.
|
||||
// they stay right while the sheet around them changes width. At rest the pill
|
||||
// stands where CSS puts it (its item's place among the others: controls.css), so
|
||||
// a sheet changing width, a phone turned, carry it along with nothing to watch;
|
||||
// only a pick moves it from here.
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { EASE_OUT, LEAD, SMOOTH, calm, play } from '../motion';
|
||||
@@ -64,11 +67,20 @@ export function iconSeg<T extends string>(items: SegItem<T>[], value: T, onPick:
|
||||
const b = btns.find((x) => x.dataset.v === value);
|
||||
return b && b.offsetWidth ? [b.offsetLeft, el.clientWidth - b.offsetLeft - b.offsetWidth] : null;
|
||||
};
|
||||
/** At rest: its item's place, for CSS to keep (`--i` of `--n`), nothing inline. */
|
||||
const placePill = () => {
|
||||
const e = edges();
|
||||
if (!e) return;
|
||||
pill.style.left = `${e[0]}px`;
|
||||
pill.style.right = `${e[1]}px`;
|
||||
pill.style.setProperty(
|
||||
'--i',
|
||||
String(
|
||||
Math.max(
|
||||
0,
|
||||
btns.findIndex((b) => b.dataset.v === value),
|
||||
),
|
||||
),
|
||||
);
|
||||
pill.style.setProperty('--n', String(btns.length));
|
||||
pill.style.left = '';
|
||||
pill.style.right = '';
|
||||
};
|
||||
|
||||
let raf = 0;
|
||||
@@ -166,9 +178,7 @@ export function iconSeg<T extends string>(items: SegItem<T>[], value: T, onPick:
|
||||
}
|
||||
|
||||
mark();
|
||||
new ResizeObserver(() => {
|
||||
if (!raf) placePill();
|
||||
}).observe(el);
|
||||
placePill();
|
||||
return {
|
||||
el,
|
||||
sync(v) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { h, ic } from '../dom';
|
||||
import { BOUNCY, DRAWER, EASE_IN, EASE_OUT, SMOOTH, SOFT, dismisses, play, rubber, unrubber } from '../motion';
|
||||
import { closeMenu } from './menu';
|
||||
import { closeDrop } from './drop';
|
||||
|
||||
/** A view: its root, and what the sheet reads from it. */
|
||||
export interface View {
|
||||
@@ -134,7 +134,12 @@ function build() {
|
||||
true,
|
||||
);
|
||||
document.body.appendChild(root);
|
||||
new ResizeObserver(() => startWidth(planWidth())).observe(vp);
|
||||
// What changes the sheet's width says so itself (a view, a row opening, a code swapped: planWidth); left is the
|
||||
// window, a phone turned or a desktop window crossing the dialog's width. Once a frame at most.
|
||||
let resizing = 0;
|
||||
addEventListener('resize', () => {
|
||||
if (!resizing) resizing = requestAnimationFrame(() => ((resizing = 0), startWidth(planWidth())));
|
||||
});
|
||||
pullToClose();
|
||||
}
|
||||
|
||||
@@ -158,6 +163,12 @@ export function onLeave(fn: () => void) {
|
||||
left = fn;
|
||||
}
|
||||
|
||||
/** Who is told the sheet changed: a view shown in it, its work done (or not), the sheet gone. */
|
||||
const watchers: (() => void)[] = [];
|
||||
/** Told whenever the sheet changes (the demo's state switch: demo/way-pick.ts). */
|
||||
export const onSheetChange = (fn: () => void) => void watchers.push(fn);
|
||||
const changed = () => watchers.forEach((f) => f());
|
||||
|
||||
/** After this sheet closes (once). */
|
||||
export function onClosed(fn: () => void) {
|
||||
closed = fn;
|
||||
@@ -165,7 +176,7 @@ export function onClosed(fn: () => void) {
|
||||
|
||||
export function openSheet(factory: ViewFactory) {
|
||||
if (!root) build();
|
||||
closeMenu(true);
|
||||
closeDrop(true);
|
||||
if (root.dataset.closing) {
|
||||
// Still on its way out: the new flow opens once it is gone, as it would have a moment later.
|
||||
next = factory;
|
||||
@@ -226,6 +237,7 @@ export function openSheet(factory: ViewFactory) {
|
||||
/* no history */
|
||||
}
|
||||
}
|
||||
changed();
|
||||
}
|
||||
|
||||
/** `now`: gone at once (Escape: what the keyboard does never animates). */
|
||||
@@ -295,6 +307,7 @@ function gone() {
|
||||
const f = closed;
|
||||
closed = null;
|
||||
f?.();
|
||||
changed();
|
||||
const n = next;
|
||||
next = null;
|
||||
if (n) openSheet(n);
|
||||
@@ -419,6 +432,7 @@ function swapView(v: View) {
|
||||
fill: 'backwards',
|
||||
},
|
||||
);
|
||||
changed();
|
||||
}
|
||||
|
||||
/** Further into a flow (Add → Open on the device). */
|
||||
@@ -493,6 +507,7 @@ export function glide(change: () => void, focus: (Element | null | undefined)[]
|
||||
*/
|
||||
export function settle(done = true) {
|
||||
sheetEl?.classList.toggle('arrived', done);
|
||||
changed();
|
||||
}
|
||||
|
||||
/** The sheet scrolls back to the top (a device connected under a scrolled sheet). */
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
// agent the router counts a session that lives as data flowing): waiting,
|
||||
// can't finish (its knocks reach the router, no handshake follows), connected
|
||||
// (a handshake since the sheet opened, and data coming through), no data (a
|
||||
// handshake since then, but nothing in except handshakes and keep-alives: an
|
||||
// outdated configuration). Pure: flows/wait.ts polls for it and draws it.
|
||||
// handshake since then, but nothing in except handshakes and keep-alives: it
|
||||
// sends from an address the router does not expect, so the router drops it).
|
||||
// Pure: flows/wait.ts polls for it and draws it.
|
||||
|
||||
import type { Device } from '../shared/types';
|
||||
|
||||
|
||||