Dawnline 0.8.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

- Fixed: the Overview's map stayed empty after leaving the page and coming
  back (the map freed on leaving was never made again); a map still loading
  when freed no longer draws into a dropped element
- A new connection's city shows within seconds: the agent looks its address
  up the moment the device connects or roams, in a child process so the
  watcher never waits, and open pages refresh once the place is known; the
  connection's entry in the activity log gets its place too. Since 0.7.0 the
  lookup waited for the minute tick and the pages for their 30-second poll
- Device window: each place has a strip of when the device was there (from
  the log's connections) and its share of the time; ▶ replays the period on
  the map: the place it leaves goes gray, a blue shimmer runs along a dotted
  arc to the next one, which lights up. A click or a drag on a strip goes to
  that moment; short visits are folded only past 24 moves. The fixed trail
  line is gone, and place names are no longer cut off at the map's edges
- Overview: the disguise tile's icon is gray when the disguise is Off
- People: "Add device" is a dashed chip with its label; "Send invite" is gone
  from the card (the invite card stays in its ⋯ menu)
This commit is contained in:
Aemeath committed 2026-10-19 00:48:09 +03:00
1 parent 466ca6c7b0
commit 7a6370aa9e
21 files changed
+1241 -193

No files matched your search

+1 -1
View File
@@ -408,7 +408,7 @@ function overviewTile(srv: Server): HTMLElement {
E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, 'Change'),
]),
E('div', { class: 'dl-disg-id' }, [
E('span', { class: 'dl-disg-ic' }, icon(m?.ic ?? 'shield')),
E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')),
E('span', { class: 'dl-stack' }, [
E('b', {}, m ? m.title : (legacyTitle(srv.preset) ?? 'Custom')),
E('span', { class: 'dl-sub' }, m ? m.short : legacyTitle(srv.preset) ? 'Switch to Balanced or Maximum' : 'Set by hand'),
+19 -32
View File
@@ -23,7 +23,8 @@ import { clearLogDialog, exportEvents, resetUsageDialog } from './logs';
import { coreFor, coreOf, type Core } from './cores';
import { plainWg } from './cores/awg';
import { onLiveChange } from './state/live';
import { ConnectionMap, devicePlaces, rangeControl, type MapData, type Range } from './map';
import { ConnectionMap, rangeControl, type Range } from './map';
import { PlacesView } from './places/render';
import { personUrl } from './urls';
/** What the page that opens a device hands over. */
@@ -135,6 +136,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
const showLog = (events: LogEvent[]) => {
logEvents = events.filter((e) => e.device === d.id);
dom.content(log, deviceEvents(events, d.id, now));
view?.update({ events });
};
/** The page's events when it has them; otherwise a fetch (`force` after clearing). */
const loadLog = async (force = false) => {
@@ -144,31 +146,11 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
if (ev) showLog(ev.events);
};
// Where this device connected from, in time order (option B): a map with its trail and the list.
// Where this device connected from: the map, a row per place with a strip of when it was
// there (from the log's connections), and a replay of the period on the map.
let range: Range = '30d';
let map: ConnectionMap | null = null;
const places = E('div', { class: 'dl-dplaces' });
const mapData = (): MapData => ({ geo: geo!, people: [p], now: now ?? Date.now() / 1000, person: p.id, device: d.id });
const paintPlaces = () => {
if (!geo?.enabled) return;
const list = devicePlaces(mapData(), range);
dom.content(
places,
list.length
? list.map((x) =>
E('div', { class: 'dl-dplace-row' }, [
E('span', { class: `dl-dplace-n${x.online ? ' live' : ''}` }, x.online ? icon(d.kind) : String(x.n)),
E('span', { class: 'dl-row-main dl-stack' }, [
E('span', {}, [x.city || x.cc || 'Unknown city', x.org ? E('span', { class: 'dl-muted' }, ` · ${x.org}`) : '']),
E('span', { class: 'dl-mono dl-faint' }, x.ip),
]),
E('span', { class: x.online ? 'dl-dplace-now' : 'dl-faint dl-nowrap' }, x.online ? 'now' : ago(x.ts, now)),
]),
)
: E('div', { class: 'dl-sub' }, 'No locations in this period.'),
);
};
let view: PlacesView | null = null;
const paint = () => {
dom.content(titleEl, [
E('span', { class: `dl-dcard-ic${d.online ? ' on' : ''}` }, icon(d.kind)),
@@ -290,8 +272,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
now = st.now;
today = todayOf(st.series);
paint();
map?.update(mapData());
paintPlaces();
view?.update({ geo: st.geo, now: st.now, person: p, device: d });
};
/** After a change made here: this drawer and the page. */
const changed = async () => {
@@ -376,6 +357,13 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
range,
220,
);
const v = (view = new PlacesView(map, range, {
geo,
now: now ?? Date.now() / 1000,
person: p,
device: d,
events: o.events?.() ?? null,
}));
locationsSec = E('section', { class: 'dl-dsec' }, [
E('div', { class: 'dl-dsec-head' }, [
E('h4', {}, 'Locations'),
@@ -383,16 +371,14 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
range,
(r) => {
range = r;
map?.setRange(r);
paintPlaces();
v.setRange(r);
},
false,
),
]),
E('div', { class: 'dl-dmap' }, map.el),
places,
E('div', { class: 'dl-dmap' }, [map.el, v.controls]),
v.el,
]);
paintPlaces();
}
// Connecting is what the drawer is for until the device is set up (or its configuration is old);
// after that it goes to the bottom.
@@ -413,10 +399,11 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
const handle = drawer(titleEl, body, foot, () => {
clearInterval(watch);
off();
view?.destroy();
map?.destroy();
});
paint();
if (map) requestAnimationFrame(() => map?.mount(mapData()));
if (map && view) requestAnimationFrame(() => view && map?.mount(view.mapData()));
}
/** ⋯ on a device card: quick actions (everything else is in the panel; click the card). */
+134 -38
View File
@@ -10,6 +10,7 @@ import { E } from './e';
import { ago, initials } from '../shared/format';
import { icon, iconSvg } from '../shared/icons';
import { onNavigate } from './ui/nav';
import { placeKey, shimmerOpacity } from './places/model';
// mapcn requires maplibre-gl ^6 (the globe projection came with 5): an ES module, its worker beside it.
const MAPLIBRE = 'https://unpkg.com/maplibre-gl@6.14.0/dist';
@@ -82,6 +83,8 @@ const CLICK_ZOOM = 10;
const CITY_KM = 30;
/** Screen distance at which two markers stand clear of each other (the server's plate and an avatar, with room). */
const PART_PX = 62;
/** The replay's dotted arc: a dot every this many screen pixels. */
const DOT_PX = 4;
/** Below these zooms plates turn compact (a continent) or mid-sized (a country). */
const LOD_FAR = 4.5;
const LOD_MID = 7;
@@ -146,7 +149,7 @@ export function visiblePoints(data: MapData, range: Range): GeoPoint[] {
if (data.device && p.device !== data.device) continue;
if (range === 'online' ? !p.online : data.now - p.ts > WINDOW[range]) continue;
// Where people are: each device once. A person's page: every city each device was in.
const key = data.device ? `${p.city}|${p.cc}` : data.person ? `${p.device}|${p.city}|${p.cc}` : p.device;
const key = data.device ? placeKey(p) : data.person ? `${p.device}|${p.city}|${p.cc}` : p.device;
const cur = best.get(key);
if (!cur || (p.online && !cur.online) || (p.online === cur.online && p.ts > cur.ts)) best.set(key, p);
}
@@ -200,6 +203,17 @@ export class ConnectionMap {
/** The folded keys the layers were last filtered for (a filter only changes when they do). */
private hiddenKey = '';
private focused: string | null = null;
/** Destroyed: a mount still waiting for the library stops there instead of drawing into a dropped element. */
private dead = false;
/** A device's places (its window) by placeKey: what the replay switches on and off. */
private places = new Map<
string,
{ el: HTMLElement; tile: HTMLElement; label: HTMLElement; when: HTMLElement | null; g: Group; n: number; kind: string }
>();
/** The replay of a device's moves: the place the light is on and the time under it; null outside it. */
private replaying: { active: string | null; when: string } | null = null;
/** The replay's arc dots, kept for a style reload (a theme switch) in the middle of a move. */
private bandDots: unknown[] = [];
private card: HTMLElement;
readonly el: HTMLElement;
private status: HTMLElement;
@@ -223,6 +237,7 @@ export class ConnectionMap {
this.status.textContent = (e as Error).message;
return;
}
if (this.dead) return;
this.map = new this.gl.Map({
container: this.el,
style: isDark() ? STYLE_DARK : STYLE_LIGHT,
@@ -285,14 +300,13 @@ export class ConnectionMap {
'circle-stroke-opacity': ['case', ['get', 'online'], 0.35, 0.15],
},
});
// A device's trail through its places in time order (its window): fine gray dots.
this.map.addSource('dl-trail', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });
// A device's move in its replay: a dotted arc, transparent but where the shimmer is (band, bandAt).
this.map.addSource('dl-band', { type: 'geojson', data: { type: 'FeatureCollection', features: this.bandDots } });
this.map.addLayer({
id: 'dl-trail',
type: 'line',
source: 'dl-trail',
layout: { 'line-join': 'round', 'line-cap': 'round' },
paint: { 'line-color': RECENT, 'line-width': 1.5, 'line-opacity': 0.85, 'line-dasharray': [0, 2.5] },
id: 'dl-band',
type: 'circle',
source: 'dl-band',
paint: { 'circle-radius': 1.4, 'circle-color': LIVE, 'circle-opacity': 0 },
});
// mapcn's MapArc paint (width 2, opacity 0.85, rounded) with the Basic Arc example's dashes;
// recent arcs under live ones.
@@ -321,6 +335,7 @@ export class ConnectionMap {
}
destroy() {
this.dead = true;
this.dropCard();
for (const p of this.piles.values()) p.marker.remove();
this.piles.clear();
@@ -334,7 +349,7 @@ export class ConnectionMap {
private groups(pts: GeoPoint[]): Group[] {
const map = new Map<string, Group>();
for (const p of pts) {
const key = `${p.person}|${p.city || `${p.lat.toFixed(1)},${p.lon.toFixed(1)}`}|${p.cc}`;
const key = `${p.person}|${placeKey(p)}`;
let g = map.get(key);
if (!g) {
g = {
@@ -416,31 +431,16 @@ export class ConnectionMap {
this.add(el, [home.lon, home.lat], true);
}
// A device's places joined oldest to newest, each step bowed like an arc.
const steps = data.device ? [...placed].sort((a, b) => Number(a.g.online) - Number(b.g.online) || a.g.ts - b.g.ts) : [];
this.map.getSource('dl-trail')?.setData({
type: 'FeatureCollection',
features:
steps.length > 1
? [
{
type: 'Feature',
properties: {},
geometry: { type: 'LineString', coordinates: steps.slice(1).flatMap((x, i) => arc(steps[i].at, x.at)) },
},
]
: [],
});
const numbers = new Map(data.device ? devicePlaces(data, this.range).map((p) => [`${p.city}|${p.cc}`, p.n]) : []);
// A device's places, numbered as the list under the map (its strips say when it was where).
const numbers = new Map(data.device ? devicePlaces(data, this.range).map((p) => [placeKey(p), p.n]) : []);
this.people = [];
this.places.clear();
for (const { g, at } of placed) {
const n = g.points.length;
const person = data.people.find((x) => x.id === g.person);
if (data.person) {
const el = data.device
? this.stepMarker(g, at, person, numbers.get(`${g.points[0].city}|${g.points[0].cc}`) ?? 0)
: this.placeMarker(g, at, person);
const el = data.device ? this.deviceMarker(g, at, person, numbers.get(placeKey(g)) ?? 0) : this.placeMarker(g, at, person);
this.add(el, at);
continue;
}
@@ -820,23 +820,111 @@ export class ConnectionMap {
}
/**
* A place in a device's window: the live one as a blue tile with the device's icon and
* "now", the earlier ones as small gray tiles numbered by recency (1 = most recent).
* A place in a device's window: on, a blue tile with the device's icon and "now" (the live
* place); off, a small gray tile numbered by recency (1 = most recent). One element whose
* state changes, so the replay can move the light from place to place (paintPlace).
*/
private stepMarker(g: Group, at: [number, number], person: Person | undefined, n: number): HTMLElement {
if (g.online) return this.placeMarker(g, at, person);
const when = ago(g.ts, this.data!.now);
const el = E('button', { type: 'button', class: 'dl-mk place step', 'aria-label': `${n}: ${g.city || 'an unknown city'}, ${when}` }, [
E('span', { class: 'dl-mk-tile sm' }, String(n)),
E('span', { class: 'dl-mk-label below' }, [g.city || g.cc || '?', ` · ${when}`]),
]);
private deviceMarker(g: Group, at: [number, number], person: Person | undefined, n: number): HTMLElement {
const kind = person?.devices.find((d) => d.id === g.points[0].device)?.kind ?? 'other';
const tile = E('span', { class: 'dl-mk-tile' });
const label = E('span', { class: 'dl-mk-label below' });
const el = E('button', { type: 'button', class: 'dl-mk place step' }, [tile, label]);
el.addEventListener('click', (ev) => {
ev.stopPropagation();
this.openPopup(g, at, el);
});
const key = placeKey(g);
this.places.set(key, { el, tile, label, when: null, g, n, kind });
this.paintPlace(key, false);
return el;
}
/** A device's place as the replay has it (or, outside it, as it is now); `animate` lets the light come in. */
private paintPlace(key: string, animate: boolean) {
const x = this.places.get(key);
if (!x) return;
const r = this.replaying;
const on = r ? r.active === key : x.g.online;
const was = x.el.classList.contains('online');
const city = x.g.city || x.g.cc || '?';
x.el.classList.toggle('online', on);
x.el.classList.toggle('faded', !!r && !on);
x.tile.classList.toggle('sm', !on);
if (on || !x.n) x.tile.innerHTML = iconSvg(x.kind, 'dl-mk-tile-ic');
else x.tile.textContent = String(x.n);
x.when = null;
if (on) {
// In the replay the time goes on the city's line (two lines would run into a place below).
x.when = E('span', { class: `dl-mk-when${r ? ' inline' : ''}` }, r ? r.when : 'now');
x.label.replaceChildren(city, r ? ' · ' : '', x.when);
} else x.label.replaceChildren(`${city} · ${x.g.online ? 'now' : ago(x.g.ts, this.data!.now)}`);
const when = on ? (r ? r.when : 'now') : x.g.online ? 'now' : ago(x.g.ts, this.data!.now);
x.el.setAttribute('aria-label', `${x.n ? `${x.n}: ` : ''}${x.g.city || 'an unknown city'}, ${when}`);
if (animate && on && !was) {
x.el.classList.remove('arrive');
void x.el.offsetWidth;
x.el.classList.add('arrive');
setTimeout(() => x.el.classList.remove('arrive'), 500);
}
}
/**
* The replay of a device's moves (its window): `active` is the place (placeKey) the light is on,
* `when` the time under it; null goes back to how things are now. A change of place animates.
*/
replay(state: { active: string | null; when: string } | null, animate = true) {
const prev = this.replaying;
this.replaying = state;
// The same place a moment later: only its time changes.
if (prev && state && prev.active === state.active) {
const x = state.active ? this.places.get(state.active) : null;
if (x?.when) x.when.textContent = state.when;
return;
}
for (const key of this.places.keys()) if (key !== state?.active) this.paintPlace(key, animate);
if (state?.active) this.paintPlace(state.active, animate);
// Tiles grow and shrink: spread the crowded ones again, now and once they have their size.
this.declutter();
setTimeout(() => this.declutter(), 320);
}
/** A device's place lit while its row under the map is hovered; null for none. */
hoverPlace(key: string | null) {
for (const [k, x] of this.places) x.el.classList.toggle('hl', k === key);
}
/**
* The dots of the arc between two places (a move in the replay), as many as fit on screen at
* DOT_PX apart, all transparent until bandAt() brings the shimmer in; no arguments clear them.
*/
band(from?: [number, number], to?: [number, number]) {
this.bandDots = [];
if (this.map && from && to) {
const pts = arc(from, to);
const px = pts.map((c) => this.map.project(c));
const len = [0];
for (let i = 1; i < px.length; i++) len.push(len[i - 1] + Math.hypot(px[i].x - px[i - 1].x, px[i].y - px[i - 1].y));
const total = len[len.length - 1];
const n = Math.max(2, Math.round(total / DOT_PX));
let j = 0;
for (let i = 0; i <= n; i++) {
const d = (total * i) / n;
while (j < len.length - 2 && len[j + 1] < d) j++;
const t = len[j + 1] > len[j] ? (d - len[j]) / (len[j + 1] - len[j]) : 0;
const at = [pts[j][0] + (pts[j + 1][0] - pts[j][0]) * t, pts[j][1] + (pts[j + 1][1] - pts[j][1]) * t];
this.bandDots.push({ type: 'Feature', properties: { pos: i / n }, geometry: { type: 'Point', coordinates: at } });
}
}
if (!this.map?.getLayer('dl-band')) return;
this.map.setPaintProperty('dl-band', 'circle-opacity', 0);
this.map.getSource('dl-band').setData({ type: 'FeatureCollection', features: this.bandDots });
}
/** The shimmer along the band's arc, its middle at `c` (a share of the arc: see places/model). */
bandAt(c: number) {
if (this.map?.getLayer('dl-band')) this.map.setPaintProperty('dl-band', 'circle-opacity', shimmerOpacity(c));
}
/**
* One person in focus (hovering any of their markers): all their places and arcs stay,
* everyone else fades, and a card lists their devices with where and when.
@@ -894,9 +982,17 @@ export class ConnectionMap {
const b = new this.gl.LngLatBounds(pts[0], pts[0]);
pts.forEach((c) => b.extend(c));
const h = this.el.clientHeight || 380;
// A person's and a device's places have their name (and "now") under the tile; a device's
// window has the replay's controls in its top corner.
const below = !!this.data?.person;
const opts = {
// Just enough room for the labels: the server's chip above its plate, a place's name above its dot.
padding: { top: Math.min(60, h / 5), bottom: Math.min(40, h / 8), left: 48, right: 48 },
padding: {
top: this.data?.device ? Math.min(56, h / 4) : Math.min(60, h / 5),
bottom: below ? Math.min(52, h / 4) : Math.min(40, h / 8),
left: 48,
right: 48,
},
// A person's page shows a little more around a single place.
maxZoom: this.data?.person ? 11 : 12,
};
+30 -11
View File
@@ -111,6 +111,8 @@ export class ServerOverview {
st!: Status;
el = E('div', { class: 'dl-srvov' });
map: ConnectionMap | null = null;
/** Whether the map card was made for locations on (a map) or off (a link to Settings); null before the first. */
mapOn: boolean | null = null;
range: Range = 'online';
parts: Record<string, HTMLElement> = {};
healthAt = 0;
@@ -124,11 +126,11 @@ export class ServerOverview {
/** Build once; later calls to update() keep the map instance. */
mount(st: Status): HTMLElement {
this.st = scoped(st, this.srvId);
for (const k of ['health', 'bento', 'side', 'activity']) this.parts[k] = E('div', {});
for (const k of ['health', 'bento', 'map', 'side', 'activity']) this.parts[k] = E('div', {});
dom.content(this.el, [
this.parts.health,
this.parts.bento,
this.mapCard(),
this.parts.map,
E('div', { class: 'dl-grid2' }, [this.parts.activity, this.parts.side]),
]);
this.paint();
@@ -140,7 +142,6 @@ export class ServerOverview {
update(st: Status, quiet = false) {
this.st = scoped(st, this.srvId);
this.paint(quiet);
this.map?.update(this.mapData());
// Health checks cost more than a status call: once a minute is plenty.
if (Date.now() - this.healthAt > 60_000) void this.loadHealth();
}
@@ -168,6 +169,21 @@ export class ServerOverview {
return { geo: this.st.geo, people: this.st.people, now: this.st.now };
}
/**
* The map keeps its instance between updates. Its card is made again only
* when locations were turned on or off, or when the map was freed: leaving
* the page frees it, and Outline brings this same overview back on return.
*/
paintMap() {
const on = this.st.geo.enabled;
if (on === this.mapOn && (!on || this.map)) {
this.map?.update(this.mapData());
return;
}
this.mapOn = on;
dom.content(this.parts.map, this.mapCard());
}
mapCard(): HTMLElement {
const st = this.st;
const head = E('div', { class: 'dl-panel-head pad' }, [
@@ -181,6 +197,8 @@ export class ServerOverview {
this.map?.setRange(r);
}),
]);
this.map?.destroy();
this.map = null;
if (!st.geo.enabled)
return E('div', { class: 'dl-panel flush' }, [
head,
@@ -190,27 +208,27 @@ export class ServerOverview {
'.',
]),
]);
this.map?.destroy();
this.map = new ConnectionMap(
const map = (this.map = new ConnectionMap(
{
openPerson: (id) => (location.href = personUrl(id)),
openDevice: (id, dev) => (location.href = personUrl(id, dev)),
},
this.range,
);
));
// A WebGL map outlives the page's DOM unless it is told: free it when
// Outline navigates away (the page object itself may be reused).
// Outline navigates away. The page object is reused on return, and its
// next update finds the map gone and makes the card again (paintMap).
const offNav = onNavigate(() => {
offNav();
this.map?.destroy();
this.map = null;
map.destroy();
if (this.map === map) this.map = null;
});
const legend = E('div', { class: 'dl-map-legend' }, [
E('span', {}, [E('i', { class: 'line live' }), 'Live tunnel']),
E('span', {}, [E('i', { class: 'line' }), 'Seen recently']),
]);
const wrap = E('div', { class: 'dl-map-wrap' }, [this.map.el, legend]);
requestAnimationFrame(() => this.map!.mount(this.mapData()));
const wrap = E('div', { class: 'dl-map-wrap' }, [map.el, legend]);
requestAnimationFrame(() => map.mount(this.mapData()));
return E('div', { class: 'dl-panel flush' }, [head, wrap]);
}
@@ -218,6 +236,7 @@ export class ServerOverview {
const st = this.st;
const srv = st.servers[0];
this.paintMap();
repaint(
this.parts.bento,
E('div', { class: 'dl-bento' }, [this.onlineTile(), this.speedTile(), coreOf(srv).overviewTile(srv), this.monthTile()]),
+4 -15
View File
@@ -438,7 +438,7 @@ export class PeoplePage {
icon(d.kind),
E('span', { class: 'dl-chip-name' }, d.name),
!d.handshake && !d.disabled ? E('span', { class: 'dl-chip-tag' }, 'not set up') : '',
// Online shows as the green dashed chip (.dl-chip.live); no dots.
// Online shows as the green chip (.dl-chip.live); no dots.
],
);
});
@@ -448,30 +448,19 @@ export class PeoplePage {
'button',
{
type: 'button',
// Just a "+": the slots above say how many there are.
class: 'dl-chip add',
'aria-label': 'Add device',
title: free > 0 ? 'Add device' : 'Add device · over the limit, admins can still add',
title: free > 0 ? 'Add device' : 'Over the limit: admins can still add',
click: (ev: Event) => {
ev.preventDefault();
addDevice(p, this.deviceOpts(p));
},
},
icon('plus'),
[icon('plus'), 'Add device'],
),
);
// Ending soon (the strip below handles an end that has passed); someone new
// without a device yet gets a nudge to send the link.
// Ending soon (the strip below handles an end that has passed).
const fixes: Node[] = [];
if (!p.devices.length && portal && !stopped(p))
fixes.push(
E(
'button',
{ type: 'button', class: 'dl-fix', click: () => inviteCard(p, this.st.servers.find((s) => s.id === p.server)?.name ?? 'Home') },
'Send invite',
),
);
if (p.expires && endsSoon(p, left) && why !== 'expired')
fixes.push(
E(
+245
View File
@@ -0,0 +1,245 @@
// Where a device went: its stretches on each client address from the activity log
// (connect, roam, disconnect), as visits to the places the map shows, folded into
// stays for the replay, and the replay's timeline and shimmer. No DOM here (see ./render).
import type { GeoPoint, LogEvent } from '../../shared/types';
/** On one client address: from a connect or a roam to the next one, a disconnect or now. */
export interface Stretch {
ip: string;
from: number;
to: number;
live: boolean;
}
/**
* A device's stretches in time order, from the activity log. A stretch the log leaves open
* goes on until now while the device is online, and ends at `seen` (its latest handshake)
* when it is not. Empty when the log has no connections (the category is off or cleared).
*/
export function stretches(events: LogEvent[], device: string, now: number, online: boolean, seen = 0): Stretch[] {
const out: Stretch[] = [];
let cur: Stretch | null = null;
const close = (t: number) => {
if (cur && t > cur.from) out.push({ ...cur, to: t });
cur = null;
};
const mine = events.filter((e) => e.device === device).sort((a, b) => a.ts - b.ts);
for (const e of mine) {
if (e.type === 'connect') {
close(e.ts);
if (e.detail) cur = { ip: e.detail, from: e.ts, to: e.ts, live: false };
} else if (e.type === 'roam') {
// "old → new"
const ip = e.detail?.split('→')[1]?.trim();
close(e.ts);
if (ip) cur = { ip, from: e.ts, to: e.ts, live: false };
} else if (e.type === 'disconnect') close(e.ts);
}
const open = cur as Stretch | null;
if (open && online) out.push({ ...open, to: Math.max(now, open.from), live: true });
else close(Math.min(now, seen));
return out;
}
/** A place as the map groups them: the city (or rounded coordinates where there is none) and the country. */
export function placeKey(p: Pick<GeoPoint, 'city' | 'lat' | 'lon' | 'cc'>): string {
return `${p.city || `${p.lat.toFixed(1)},${p.lon.toFixed(1)}`}|${p.cc}`;
}
/** A stretch at a located address: the place it was at. */
export interface Visit {
key: string;
point: GeoPoint;
from: number;
to: number;
live: boolean;
}
/**
* The stretches since `from` whose address has a location (the device's own point first, then
* anyone's at that address), clipped to `from`. Addresses without one are left out, as on the map.
*/
export function visits(list: Stretch[], points: GeoPoint[], device: string, from: number): Visit[] {
const at = new Map<string, GeoPoint>();
for (const p of points) if (p.device === device || !at.has(p.ip)) at.set(p.ip, p);
const out: Visit[] = [];
for (const s of list) {
const p = at.get(s.ip);
if (!p || s.to <= from) continue;
out.push({ key: placeKey(p), point: p, from: Math.max(s.from, from), to: s.to, live: s.live });
}
return out;
}
/** Each place's share of the time the visits cover (0–1), by place key. */
export function shares(v: Visit[]): Map<string, number> {
const time = new Map<string, number>();
let total = 0;
for (const x of v) {
time.set(x.key, (time.get(x.key) ?? 0) + (x.to - x.from));
total += x.to - x.from;
}
return new Map([...time].map(([k, t]) => [k, total ? t / total : 0]));
}
/** Visits in a row at one place, with `short` visits elsewhere folded in. */
export interface Stay {
key: string;
point: GeoPoint;
from: number;
to: number;
live: boolean;
/** Visits elsewhere shorter than the fold (a phone flipping to mobile data and back), folded into this stay. */
short: number;
}
/** Visits as stays: a place's visits in a row are one, and a visit elsewhere shorter than `fold` seconds joins the stay around it. */
export function stays(v: Visit[], fold = 45 * 60): Stay[] {
const out: Stay[] = [];
for (const x of v) {
const last = out[out.length - 1];
if (last && x.key !== last.key && !x.live && x.to - x.from < fold) {
last.short++;
last.to = x.to;
continue;
}
if (last && last.key === x.key) {
last.to = x.to;
last.live = x.live;
continue;
}
out.push({ key: x.key, point: x.point, from: x.from, to: x.to, live: x.live, short: 0 });
}
return out;
}
/**
* Stays for a replay of at most `max` moves: every move while there are few, folding the
* shortest visits (minutes on mobile data, then longer) only as far as needed.
*/
export function replayStays(v: Visit[], max = 24): Stay[] {
for (const fold of [0, 5 * 60, 15 * 60, 45 * 60, 2 * 3600, 6 * 3600]) {
const st = stays(v, fold);
if (st.length - 1 <= max) return st;
}
return stays(v, 24 * 3600);
}
/* ---------- the replay ---------- */
/** One move (ms): the place it leaves lets go, the shimmer runs along the arc, the next place lights up. */
export const MOVE_MS = 1600;
/** The shimmer sets off once the place it leaves has started to go gray (a share of the move). */
const LEAVE = 0.12;
/** The shimmer's length, a share of the arc: longer than the arc, so most of it is lit mid-move. */
export const BAND = 1.3;
/** ± this around the shimmer's middle is fully lit; it fades out to ±BAND/2. */
export const FLAT = 0.32;
/** A move into stay `k` (from stay k − 1), or stay `k` itself, `ms` long from `start`. */
export interface Step {
kind: 'move' | 'stay';
k: number;
start: number;
ms: number;
}
/** The replay's steps: each stay held in proportion to how long it lasted (within bounds), a move before each but the first. */
export function timeline(st: Stay[], move = MOVE_MS): { steps: Step[]; total: number } {
const steps: Step[] = [];
let t = 0;
st.forEach((s, k) => {
if (k) {
steps.push({ kind: 'move', k, start: t, ms: move });
t += move;
}
const ms = Math.min(1100, Math.max(350, ((s.to - s.from) / 3600) * 45));
steps.push({ kind: 'stay', k, start: t, ms });
t += ms;
});
return { steps, total: t };
}
/** Where the replay is at `ms`: the step (its index), how far into it (0–1) and the moment shown. */
export function moment(st: Stay[], steps: Step[], ms: number): { i: number; step: Step; q: number; t: number } {
let i = steps.findIndex((s) => ms >= s.start && ms < s.start + s.ms);
if (i < 0) i = steps.length - 1;
const step = steps[i];
const q = Math.min(1, Math.max(0, (ms - step.start) / step.ms));
const s = st[step.k];
return { i, step, q, t: step.kind === 'move' ? s.from : s.from + (s.to - s.from) * q };
}
/** The replay's `ms` for moment `t` (a click on a strip): inside the stay it falls in. */
export function msAt(st: Stay[], steps: Step[], t: number): number {
let k = st.findIndex((s) => t >= s.from && t < s.to);
if (k < 0) k = t < (st[0]?.from ?? 0) ? 0 : st.length - 1;
const step = steps.find((s) => s.kind === 'stay' && s.k === k)!;
const s = st[k];
return step.start + step.ms * Math.min(0.999, Math.max(0, (t - s.from) / Math.max(1, s.to - s.from)));
}
export const ease = (x: number) => (x <= 0 ? 0 : x >= 1 ? 1 : x < 0.5 ? 2 * x * x : 1 - (-2 * x + 2) ** 2 / 2);
/** The shimmer's middle (a share of the arc) `q` into a move: it enters before the place it leaves and runs out past the next. */
export function bandMiddle(q: number): number {
return -BAND / 2 + (1 + BAND) * ease((q - LEAVE) / (1 - LEAVE));
}
/** The next place lights up once the shimmer's bright part reaches it. */
export const arrived = (middle: number) => middle + FLAT >= 1;
/**
* The opacity of the arc's dots (each has its `pos` along the arc, 0–1) with the shimmer's middle
* at `c`: beui's text shimmer along a line, the arc itself transparent. A MapLibre expression.
*/
export function shimmerOpacity(c: number): unknown[] {
return ['interpolate', ['linear'], ['abs', ['-', ['get', 'pos'], c]], 0, 1, FLAT, 1, BAND / 2, 0];
}
/* ---------- labels ---------- */
/** Labels under the strips for a range ending `now`: [share of the range, label], in local time. */
export function ticks(range: '24h' | '7d' | '30d', now: number): [number, string][] {
const span = range === '24h' ? 86400 : range === '7d' ? 7 * 86400 : 30 * 86400;
const from = now - span;
const out: [number, string][] = [];
const put = (ts: number, label: string) => {
const f = (ts - from) / span;
if (f > 0.02 && f < 0.98) out.push([f, label]);
};
const d = new Date(from * 1000);
if (range === '24h') {
d.setMinutes(0, 0, 0);
while (d.getTime() / 1000 <= now) {
if (d.getHours() % 6 === 0) put(d.getTime() / 1000, `${String(d.getHours()).padStart(2, '0')}:00`);
d.setHours(d.getHours() + 1);
}
} else if (range === '7d') {
d.setHours(12, 0, 0, 0);
for (; d.getTime() / 1000 <= now; d.setDate(d.getDate() + 1))
put(d.getTime() / 1000, d.toLocaleDateString('en-GB', { weekday: 'short' }));
} else {
const end = new Date(now * 1000);
end.setHours(0, 0, 0, 0);
for (let i = 0; i < 5; i++) {
const w = new Date(end);
w.setDate(end.getDate() - 7 * i);
put(w.getTime() / 1000, w.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }));
}
out.reverse();
}
return out;
}
/** "14:05", local. */
export const clock = (ts: number) => new Date(ts * 1000).toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
/** "Today", "Yesterday" or "Wed 14 Oct" for a moment, against the router's `now`. */
export function dayName(ts: number, now: number): string {
const day = (x: number) => new Date(x * 1000).toDateString();
if (day(ts) === day(now)) return 'Today';
if (day(ts) === day(now - 86400)) return 'Yesterday';
return new Date(ts * 1000).toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' });
}
+288
View File
@@ -0,0 +1,288 @@
// Where a device went, under its map (the device window): a row per place with a strip of
// when it was there, and a replay of the period: the place it leaves goes gray, a blue
// shimmer runs along the dotted arc to the next place, which lights up. The model is
// ./model; the map draws (ConnectionMap.replay, band, bandAt).
import type { Device, Geo, LogEvent, Person } from '../../shared/types';
import { E } from '../e';
import { icon } from '../../shared/icons';
import { ago } from '../../shared/format';
import { devicePlaces, type ConnectionMap, type MapData, type Range } from '../map';
import {
MOVE_MS,
arrived,
bandMiddle,
clock,
dayName,
moment,
msAt,
placeKey,
shares,
replayStays,
stretches,
ticks,
timeline,
visits,
type Stay,
type Step,
} from './model';
export interface PlacesData {
geo: Geo;
/** The router's clock (seconds). */
now: number;
person: Person;
device: Device;
/** The person's activity log (the device's connects and roams in it); null until loaded. */
events: LogEvent[] | null;
}
const SPAN: Record<Exclude<Range, 'online'>, number> = { '24h': 86400, '7d': 7 * 86400, '30d': 30 * 86400 };
const pct = (part: number, whole: number) => `${((part / whole) * 100).toFixed(3)}%`;
export class PlacesView {
/** The rows under the map. */
readonly el = E('div', { class: 'dl-dplaces' });
/** The replay's controls, for the map's top corner. */
readonly controls = E('div', { class: 'dl-map-replay' });
private data: PlacesData;
/** What came while the replay ran: shown once it ends (the replay plays what it started with). */
private pending: PlacesData | null = null;
private rows = new Map<string, HTMLElement>();
private st: Stay[] = [];
private steps: Step[] = [];
private total = 0;
/** Where the replay is (ms into it) and the step it showed last. */
private ms = 0;
private stepI = -1;
/** In the replay (playing or paused), and playing. */
private on = false;
private playing = false;
private raf = 0;
private last = 0;
private endTimer = 0;
private play = E('button', { type: 'button', class: 'dl-map-btn' });
private chip = E('span', { class: 'dl-map-chip' });
private stop = E('button', { type: 'button', class: 'dl-map-btn', title: 'Back to now', 'aria-label': 'Back to now' }, icon('x'));
private reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
constructor(
private map: ConnectionMap,
private range: Range,
data: PlacesData,
) {
this.data = data;
this.play.addEventListener('click', () => this.toggle());
this.stop.addEventListener('click', () => this.end());
this.paint();
}
mapData(): MapData {
const d = this.data;
return { geo: d.geo, people: [d.person], now: d.now, person: d.person.id, device: d.device.id };
}
/** New status or log: shown at once, or after the replay. */
update(data: Partial<PlacesData>) {
const next = { ...(this.pending ?? this.data), ...data };
if (this.on) {
this.pending = next;
return;
}
this.data = next;
this.map.update(this.mapData());
this.paint();
}
setRange(r: Range) {
this.end();
this.range = r;
this.map.setRange(r);
this.paint();
}
destroy() {
cancelAnimationFrame(this.raf);
clearTimeout(this.endTimer);
}
private paint() {
const d = this.data;
const span = SPAN[this.range as keyof typeof SPAN];
const from = d.now - span;
const v = visits(stretches(d.events ?? [], d.device.id, d.now, d.device.online, d.device.handshake), d.geo.points, d.device.id, from);
const share = shares(v);
this.st = replayStays(v);
const list = devicePlaces(this.mapData(), this.range);
const strips = v.length > 0;
this.el.classList.toggle('strips', strips);
this.el.classList.toggle('can-replay', this.st.length > 1);
this.rows.clear();
dom.content(
this.el,
list.length
? [
...list.map((x) => {
const key = placeKey(x);
const sh = share.get(key);
const strip = strips
? E(
'div',
{ class: `dl-dplace-strip${x.online ? ' live' : ''}` },
v
.filter((y) => y.key === key)
.map((y) => E('i', { style: `left:${pct(y.from - from, span)};width:${pct(y.to - y.from, span)}` })),
)
: '';
const row = E('div', { class: 'dl-dplace-row' }, [
E('span', { class: `dl-dplace-n${x.online ? ' live' : ''}` }, x.online ? icon(d.device.kind) : String(x.n)),
E('span', { class: 'dl-row-main dl-stack' }, [
E('span', {}, [x.city || x.cc || 'Unknown city', x.org ? E('span', { class: 'dl-muted' }, ` · ${x.org}`) : '']),
E('span', { class: 'dl-faint' }, [
E('span', { class: 'dl-mono' }, x.ip),
sh != null ? ` · ${sh > 0 && sh < 0.005 ? '<1' : Math.round(sh * 100)}% of the time` : '',
]),
]),
E('span', { class: x.online ? 'dl-dplace-now' : 'dl-faint dl-nowrap' }, x.online ? 'now' : ago(x.ts, d.now)),
strip,
]);
row.addEventListener('mouseenter', () => this.map.hoverPlace(key));
row.addEventListener('mouseleave', () => this.map.hoverPlace(null));
// The strips are the replay's timeline: a click or a drag on one goes to that moment.
if (strip) {
const seek = (ev: PointerEvent) => {
const r = strip.getBoundingClientRect();
this.seek(from + span * Math.min(1, Math.max(0, (ev.clientX - r.left) / r.width)));
};
strip.addEventListener('pointerdown', (ev) => {
strip.setPointerCapture(ev.pointerId);
seek(ev);
});
strip.addEventListener('pointermove', (ev) => ev.buttons && seek(ev));
}
this.rows.set(key, row);
return row;
}),
strips
? E(
'div',
{ class: 'dl-dplace-axis' },
ticks(this.range as keyof typeof SPAN, d.now).map(([f, label]) =>
E('span', { style: `left:${(f * 100).toFixed(2)}%` }, label),
),
)
: '',
]
: E('div', { class: 'dl-sub' }, 'No locations in this period.'),
);
this.paintControls();
}
private paintControls() {
dom.content(this.play, icon(this.playing ? 'pause' : 'play'));
this.play.title = this.playing ? 'Pause' : 'Replay this period';
this.play.setAttribute('aria-label', this.play.title);
// LuCI's dom.content takes one level of children: no nested arrays.
dom.content(this.controls, this.on ? [this.play, this.chip, this.stop] : this.st.length > 1 ? [this.play] : []);
}
/* ---------- the replay ---------- */
private begin() {
this.on = true;
({ steps: this.steps, total: this.total } = timeline(this.st, this.reduced ? 400 : MOVE_MS));
this.ms = 0;
this.stepI = -1;
// The live place lets go; the first stay lights up on the first frame.
this.map.replay({ active: null, when: '' }, true);
}
private toggle() {
if (this.playing) {
this.playing = false;
cancelAnimationFrame(this.raf);
this.paintControls();
return;
}
clearTimeout(this.endTimer);
if (!this.on || this.ms >= this.total) this.begin();
this.playing = true;
this.last = performance.now();
this.paintControls();
this.raf = requestAnimationFrame((t) => this.frame(t));
}
private frame(now: number) {
if (!this.playing) return;
this.ms = Math.min(this.total, this.ms + (now - this.last));
this.last = now;
this.show(true);
if (this.ms < this.total) {
this.raf = requestAnimationFrame((t) => this.frame(t));
return;
}
// At the end: a moment on the last place, then back to now.
this.playing = false;
this.paintControls();
this.endTimer = window.setTimeout(() => this.end(), 1500);
}
/** Moment `t` (a click on a strip): its place at once, paused there. */
private seek(t: number) {
if (this.st.length < 2) return;
clearTimeout(this.endTimer);
if (!this.on) this.begin();
this.ms = msAt(this.st, this.steps, t);
this.stepI = -1;
this.show(false);
this.paintControls();
}
/** The replay at `this.ms`: the map's light and shimmer, the strips' tick, the chip. */
private show(animate: boolean) {
const m = moment(this.st, this.steps, this.ms);
const s = this.st[m.step.k];
if (m.step.kind === 'move') {
const prev = this.st[m.step.k - 1];
if (m.i !== this.stepI) {
// The place it leaves goes gray; the shimmer sets off from it.
this.map.replay({ active: null, when: '' }, animate);
this.map.band([prev.point.lon, prev.point.lat], [s.point.lon, s.point.lat]);
}
const c = bandMiddle(m.q);
if (!this.reduced) this.map.bandAt(c);
if (this.reduced ? m.q >= 0.5 : arrived(c)) this.map.replay({ active: s.key, when: clock(m.t) }, animate);
} else {
if (m.i !== this.stepI) this.map.band();
this.map.replay({ active: s.key, when: clock(m.t) }, animate);
}
this.stepI = m.i;
const d = this.data;
const from = d.now - SPAN[this.range as keyof typeof SPAN];
this.el.classList.add('replay');
this.el.style.setProperty('--at', pct(m.t - from, d.now - from));
for (const [k, r] of this.rows) r.classList.toggle('cur', k === s.key);
this.chip.textContent = `${dayName(m.t, d.now)}, ${clock(m.t)} · ${s.point.city || s.point.cc || '?'}`;
}
/** Back to now: the map as it is, and whatever came while the replay ran. */
private end() {
cancelAnimationFrame(this.raf);
clearTimeout(this.endTimer);
if (!this.on) return;
this.on = false;
this.playing = false;
this.ms = 0;
this.stepI = -1;
this.map.band();
this.map.replay(null, false);
this.el.classList.remove('replay');
for (const r of this.rows.values()) r.classList.remove('cur');
if (this.pending) {
this.data = this.pending;
this.pending = null;
this.map.update(this.mapData());
this.paint();
} else this.paintControls();
}
}
+40 -2
View File
@@ -51,6 +51,43 @@
.dl-dplace-n.live { background: #3b82f6; color: #fff; }
.dl-dplace-n .dl-icon { width: 12px; height: 12px; }
.dl-dplace-now { color: #3b82f6; }
/* With the log's connections, each place has a strip: when the device was there in the range (the
live place's blue). The highlight (hover, the replay's place) reaches past the content on both
sides, the separators stay with the content. */
.dl-dplaces.strips .dl-dplace-row { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 9px;
margin: 0 -10px; padding: 11px 10px; border-top: 0; border-radius: 10px; transition: background .15s; }
.dl-dplaces.strips .dl-dplace-row + .dl-dplace-row::before { content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--dl-line); }
.dl-dplaces.strips .dl-dplace-row:is(:hover, .cur) { background: var(--dl-soft); }
.dl-dplaces.strips .dl-dplace-row:is(:hover, .cur)::before, .dl-dplaces.strips .dl-dplace-row:is(:hover, .cur) + .dl-dplace-row::before { opacity: 0; }
.dl-dplace-strip { grid-column: 2 / 4; position: relative; height: 6px; border-radius: 3px; background: var(--dl-track); }
.dl-dplaces.can-replay .dl-dplace-strip { cursor: ew-resize; touch-action: none; }
.dl-dplace-strip i { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 2px; background: #8a8a8a; }
.dl-dplace-strip.live i { background: #3b82f6; }
/* The replay's moment: a tick on every strip. */
.dl-dplaces.replay .dl-dplace-strip::after { content: ''; position: absolute; left: var(--at); top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px;
background: var(--dl-fg); box-shadow: 0 0 0 2px var(--dialog-bg, var(--dl-elevated)); pointer-events: none; }
.dl-dplace-axis { position: relative; height: 16px; margin: 4px 0 0 30px; font-size: 11px; line-height: 16px; color: var(--dl-fg-faint); }
.dl-dplace-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
/* The replay's controls in the map's top corner, and the place it lights. */
.dl-dmap { position: relative; }
.dl-map-replay { position: absolute; left: 10px; top: 10px; z-index: 3; display: flex; align-items: center; gap: 6px; }
.dl-map-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
background: var(--dl-elevated); border: 1px solid var(--dl-line); color: var(--dl-fg); }
.dl-map-btn:hover { background: color-mix(in srgb, var(--dl-fg) 8%, var(--dl-elevated)); }
.dl-map-btn:focus-visible { outline: 2px solid var(--dl-ring); }
.dl-map-btn .dl-icon { width: 13px; height: 13px; }
.dl-map-chip { display: inline-flex; align-items: center; height: 28px; box-sizing: border-box; padding: 0 10px; border-radius: 8px; font-size: 11.5px; white-space: nowrap;
background: var(--dl-elevated); border: 1px solid var(--dl-line); color: var(--dl-fg); font-variant-numeric: tabular-nums; }
.dl-mk.step .dl-mk-tile { transition: width .3s cubic-bezier(.2, .8, .2, 1), height .3s cubic-bezier(.2, .8, .2, 1), border-radius .3s, background-color .3s, color .3s,
box-shadow .3s, transform .24s; }
.dl-mk.step .dl-mk-tile.sm .dl-mk-tile-ic { width: 11px; height: 11px; }
.dl-mk.step.faded > * { opacity: .5; }
/* The place in the light (or hovered in the list) over its neighbours, its name readable. */
.dl-mk.step:is(.online, .hl) { z-index: 2; }
.dl-mk.step.hl .dl-mk-tile { box-shadow: 0 0 0 3px color-mix(in srgb, #3b82f6 55%, transparent); }
.dl-mk.step.arrive .dl-mk-tile { animation: dl-mk-arrive .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes dl-mk-arrive { 0% { transform: scale(.8); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.dl-mk-when.inline { display: inline; }
/* Someone on top of the server: folded into a count on its plate until there is room. */
/* MapLibre writes the marker's own opacity (fading what is behind the globe): ours goes on its parts. */
.dl-mk > * { transition: opacity .15s; opacity: var(--dl-mk-fade, 1); }
@@ -116,14 +153,15 @@
.dl-lod-far .dl-mk-more { margin-left: 4px; font-size: 10px; }
/* Place names only from the country level: far out they would crowd the plates. */
.dl-mk-label { transition: opacity .2s ease; }
.dl-lod-far .dl-mk-label { opacity: 0; }
/* A device's few places keep their names at any distance. */
.dl-lod-far .dl-mk:not(.step) .dl-mk-label { opacity: 0; }
.dl-lod-mid .dl-mk-host { width: 36px; height: 36px; }
.dl-lod-mid .dl-mk-dock, .dl-lod-mid .dl-mk-pile-box { height: 36px; }
.dl-lod-mid .dl-mk-face .dl-mk-av { width: 24px; height: 24px; font-size: 9px; }
.dl-lod-mid .dl-mk-face > .dl-mk-badge { height: 12px; min-width: 12px; margin-left: -10px; bottom: -7px; }
.dl-lod-mid .dl-mk-face > .dl-mk-badge:has(> svg:only-child) { width: 12px; }
.dl-lod-mid .dl-mk-face > .dl-mk-badge .dl-mk-badge-ic { width: 8px; height: 8px; }
@media (prefers-reduced-motion: reduce) { .dl-mk-dock, .dl-mk-pile-box, .dl-mk-face, .dl-mk-av, .dl-mk-tile, .dl-mk-host, .dl-mk-face > .dl-mk-badge { transition: none; animation: none; } }
@media (prefers-reduced-motion: reduce) { .dl-mk-dock, .dl-mk-pile-box, .dl-mk-face, .dl-mk-av, .dl-mk-tile, .dl-mk.step .dl-mk-tile, .dl-mk-host, .dl-mk-face > .dl-mk-badge { transition: none; animation: none; } }
.dl-mk-hub:has(.dl-mk-host.docked) .dl-mk-host { cursor: zoom-in; }
/* A marker moved clear of a crowd: a line back to its real spot, and a dot there. */
.dl-mk-ptr { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: -1; pointer-events: none; }
+2
View File
@@ -99,6 +99,8 @@
.dl-disg-ic { width: 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--dl-accent) 14%, transparent); color: var(--dl-accent);
display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dl-disg-ic .dl-icon-wrap { display: inline-flex; } .dl-disg-ic .dl-icon { width: 18px; height: 18px; }
/* No disguise: gray, as the picker's unselected methods. */
.dl-disg-ic.off { background: var(--dl-soft); color: var(--dl-fg-muted); }
.dl-disg-meters { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--dl-fg-muted); }
.dl-segs { display: inline-flex; gap: 3px; } .dl-segs i { width: 18px; height: 5px; border-radius: 3px; background: var(--dl-track); }
.dl-segs.acc i.on { background: var(--dl-accent); } .dl-segs.ok i.on { background: var(--dl-ok); }
+3 -2
View File
@@ -34,8 +34,9 @@
.dl-chip:hover { background: var(--dl-soft-hover); }
.dl-chip:focus-visible { outline: 2px solid var(--dl-ring); outline-offset: 2px; }
.dl-chip .dl-icon { width: 14px; height: 14px; color: var(--dl-fg-muted); }
.dl-chip.add { background: transparent; box-shadow: inset 0 0 0 1px var(--dl-line); color: var(--dl-fg-muted); aspect-ratio: 1; padding: 0; justify-content: center; }
.dl-chip.add:hover { background: var(--dl-soft); color: var(--dl-fg); }
.dl-chip.add { background: transparent; border: 1px dashed color-mix(in srgb, var(--dl-fg) 28%, transparent); color: var(--dl-fg-muted); }
.dl-chip.add:hover { background: var(--dl-soft); color: var(--dl-fg); border-color: color-mix(in srgb, var(--dl-fg) 45%, transparent); }
.dl-chip.add:hover .dl-icon { color: var(--dl-fg); }
.dl-chip.disabled .dl-chip-name { text-decoration: line-through; color: var(--dl-fg-faint); }
.dl-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--dl-fg-faint); opacity: .6; }