Dawnline 0.15.1
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions

- Dropdowns (the ⋯ menu, the language picker, the page's QR card) open
  on a softer spring: they grow in without the wobble at the end
- Renaming a device on its card: the hint under the name and a refusal
  take the status's place as whole words, and after a save the status
  comes back the same way
- Cancelling a rename started while the status was still changing puts
  back what it said, not a mix of its old and new letters
This commit is contained in:
Aemeath committed 2026-10-22 18:01:01 +03:00
1 parent 3fadee87d3
commit 750564ab7e
10 files changed
+53 -44

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "dawnline-web",
"version": "0.15.0",
"version": "0.15.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "dawnline-web",
"version": "0.15.0",
"version": "0.15.1",
"license": "MIT",
"dependencies": {
"qrcode-generator": "1.4.4"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dawnline-web",
"version": "0.15.0",
"version": "0.15.1",
"private": true,
"license": "MIT",
"type": "module",
+19 -12
View File
@@ -1,9 +1,9 @@
// Renaming a device where its name stands on the card: a click on the name (or Rename in its ⋯ menu) turns it
// into its own input, in the name's font and place, with nothing around it but the field's caret and selection
// (ui/caret.ts), the name selected. The status line under it says how to finish. Return saves: the words shimmer
// while the router answers (ui/shimmer.ts), settle, and the card is drawn again with the new name, its status
// morphing back from the hint. Esc or a click away puts the name it had back, whatever was typed. What the router
// won't take never gets in (shared/name-guard.ts): the words shake and the status line says why in red; the
// (ui/caret.ts), the name selected. The status line under it blurs across to how to finish. Return saves: the words
// shimmer while the router answers (ui/shimmer.ts), settle, and the card is drawn again with the new name, its
// status blurring back from the hint. Esc or a click away puts the name it had back, whatever was typed. What the
// router won't take never gets in (shared/name-guard.ts): the words shake and the status line says why in red; the
// router's own refusals (a name taken) say so the same way.
import type { Device } from '../../shared/types';
@@ -13,22 +13,25 @@ import { call } from '../api';
import { h } from '../dom';
import { repaint, setState, state, type State } from '../state';
import { smoothCaret } from '../ui/caret';
import { morphText } from '../ui/morph';
import { morphText, textOf } from '../ui/morph';
import { shimmer } from '../ui/shimmer';
/** The status line's colours (page/devices.ts), and the red of a refusal. */
const TONES = ['ok-t', 'warn-t', 'here-t', 'bad-t'];
/**
* The status line says something else in another tone: its words morph and the colour turns from the one it
* had, as a repaint's status does. Only the tone classes change hands: a morph under way keeps its own.
* The status line says something else in another tone: the hint or a refusal stands in for the status, so the
* words blur across whole (not letter by letter) and the colour turns from the one it had. Marked `data-whole`
* meanwhile: the repaint after a save brings the status back the same way. Only the tone classes change hands: a
* morph under way keeps its own.
*/
function say(stat: HTMLElement, text: string, tone: string, title = text) {
const color = getComputedStyle(stat).color;
for (const t of TONES) stat.classList.toggle(t, t === tone);
// The line is one line: a long reason (the router's own) reads in full on hover.
stat.title = title;
morphText(stat, text, undefined, { color });
stat.dataset.whole = '';
morphText(stat, text, undefined, { color, whole: true });
}
/**
@@ -54,7 +57,8 @@ export function renameOnCard(d: Device, card: HTMLElement) {
const name = card.querySelector<HTMLElement>('.dev-name');
const stat = card.querySelector<HTMLElement>('.dev-stat');
if (!name || !stat) return;
const was = { text: stat.textContent ?? '', tone: TONES.find((t) => stat.classList.contains(t)) ?? '', title: stat.title };
// What it says, not what shows: still morphing (a rename just let go), it holds both its old and new letters.
const was = { text: textOf(stat), tone: TONES.find((t) => stat.classList.contains(t)) ?? '', title: stat.title };
// How to finish, where a keyboard says it; on a touch screen its Done key saves.
const hint = matchMedia('(pointer: fine)').matches ? _('Return to save, Esc to cancel') : '';
@@ -100,9 +104,12 @@ export function renameOnCard(d: Device, card: HTMLElement) {
if (saved) name.textContent = saved;
name.hidden = false;
form.remove();
// Saved: the hint stays for the repaint, which morphs it into the status (words and colour) as it does any
// status that changed. Let go: it turns back here.
if (!saved) say(stat, was.text, was.tone, was.title);
// Saved: the hint stays for the repaint, which blurs it into the status (words and colour). Let go: it turns
// back here, and is the status again (a repaint morphs it letter by letter).
if (!saved) {
say(stat, was.text, was.tone, was.title);
delete stat.dataset.whole;
}
if (!back) return;
// After a save the card is drawn again: the name is found anew then.
if (saved)
+2 -2
View File
@@ -71,11 +71,11 @@ export function spring(k: number, c: number, m = 1): Spring {
export const BOUNCY = spring(300, 20);
/** Pills, widths and heights: no overshoot. */
export const SMOOTH = spring(300, 35);
/** Small things that pop: a check, a menu. */
/** Small things that pop: a check, a mark turning in. */
export const POP = spring(520, 24);
/** The leading edge of a stretching pill: faster than SMOOTH, no overshoot. */
export const LEAD = spring(520, 46);
/** A dialog on a computer and the accordions: the menu's pop made softer (about 4% over, 90% there at ~140 ms). */
/** The dropdowns, a dialog on a computer and the accordions: POP made softer (about 4% over, 90% there at ~140 ms). */
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);
+3 -3
View File
@@ -4,7 +4,7 @@
// 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';
import { EASE_IN, SOFT, play } from '../motion';
/** From its button, and from the screen's edge. */
export const GAP = 8;
@@ -26,7 +26,7 @@ function standing(el: Element): Keyframe {
return { opacity: s.opacity, transform: s.transform, filter: s.filter === 'none' ? 'blur(0px)' : s.filter };
}
/** In: a spring out of its transform origin. */
/** In: a soft spring out of its transform origin (a little over, no wobble). */
export function appear(el: Element) {
play(
el,
@@ -34,7 +34,7 @@ export function appear(el: Element) {
{ opacity: 0, transform: 'scale(.5)', filter: 'blur(6px)' },
{ opacity: 1, transform: 'none', filter: 'blur(0px)' },
],
{ duration: POP.duration, easing: POP.easing },
{ duration: SOFT.duration, easing: SOFT.easing },
);
}
+4 -2
View File
@@ -357,6 +357,8 @@ export function morphText(el: HTMLElement, next: string, from = textOf(el), o: M
export interface Said {
text: string;
color: string;
/** Its words change as a whole (`data-whole`: a hint standing in for a card's status): they blur across. */
whole: boolean;
}
/** The keyed texts under `root` (`data-t`), before a repaint rebuilds them. */
@@ -364,7 +366,7 @@ export function textsOf(root: ParentNode): Map<string, Said> {
return new Map(
[...root.querySelectorAll<HTMLElement>('[data-t]')].map((el) => [
el.dataset.t!,
{ text: textOf(el), color: getComputedStyle(el).color },
{ text: textOf(el), color: getComputedStyle(el).color, whole: el.hasAttribute('data-whole') },
]),
);
}
@@ -378,7 +380,7 @@ export function morphChanged(root: ParentNode, was: Map<string, Said>, fresh: El
const before = was.get(el.dataset.t!);
const now = textOf(el);
if (!before || before.text === now || runs.has(el) || fresh.some((f) => f.contains(el))) return;
morphText(el, now, before.text, { color: before.color });
morphText(el, now, before.text, { color: before.color, whole: before.whole });
});
}