085 calm Match deck: no header hourglass, centred bare empty state, the release card as a deck card (Cancel, Skip, Release), fixed card height. 086 motion: vanish() fade everywhere with a lint test, view transitions, a lub-dub heartbeat for working objects, confetti that lands and fades. 087 time readout under the pivot of every analog clock. 088 prune dialog grouped by prefix with tri-state boxes, search, stepper and sticky footer. 089 one-row task toolbar with Filter and Actions menus and a filter chip. 090 card border by state colour with a soft glow and owner avatars. 091 draggable limit lines with staged changes and one Save, a Limits menu with the matrix, View toggles, the GPU cause in its tooltip. 093 request chips Open, Expired, Stale, Failed, All and a signed Delete. 094 closed cards leave the deck within 5 s; open in Claude stamps. 095 compact agent message box with Post/Call, attach, mic and Send in the field. 096 Reject on an expired card drops it silently as Drop (expired). 097 Show filter in Match's right-click menu. 098 docked speech bubbles carry the speaker's avatar and a skip button. 099 Match card headlines cut to 120 characters with the full title in the tooltip; the code box keeps the whole command. tests/test_hub_path_links.py: a unicode fixture without German. Full make test green through the queue (2605 tests, ruff, shellcheck, markdownlint). Gate missed on the operator's word: break 7 %, the E2E specs (13 new, 15 updated) run next. 🎯 Fix: 92 % 💥 Break: 7 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 86 🚦 Gate: ⛔ break 7 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
121 lines
5.5 KiB
JavaScript
121 lines
5.5 KiB
JavaScript
const DIAL_MAX = 60;
|
|
const DIAL_PAGE = 5;
|
|
const DIAL_SWEEP = 200;
|
|
|
|
/**
|
|
* @param {Object} options value: the whole value the dial starts at; label: the slider's accessible name; name: the
|
|
* root's own class; min, max: the ends, max a full turn; page: the Page Up and Down step and the long-tick spacing;
|
|
* readout: (value) => the text inside the face below the pivot; spoken: (value) => the aria-valuetext; readonly: true
|
|
* for a dial only the caller moves; live: null, or the source of a running clock, (epoch milliseconds) => {at, value,
|
|
* text} such as Dial.counting() or Dial.walled(), which then turns the hand and sets value and readout every frame.
|
|
* @returns {root, value, set}: an analog clock face with Dial.TICKS ticks, one hand and the readout, an ARIA slider:
|
|
* dragging the hand or clicking a tick sets it, the arrows step 1, Page Up and Down page, Home and End the ends;
|
|
* set(value) moves it. The hand sweeps to each new value over DIAL_SWEEP ms and a live hand never stops; the frames end
|
|
* on the first one that finds the root out of the page, so the caller attaches the root in the same task.
|
|
*/
|
|
function dial(options) {
|
|
let current = null;
|
|
let shown = 0;
|
|
let sweep = {from: 0, to: 0, start: 0};
|
|
let frame = 0;
|
|
const centre = Dial.SIZE / 2;
|
|
const ticks = Dial.ticks(options.page).map(({at, long}) => {
|
|
const [x1, y1] = Dial.point(at, Dial.TICKS, Dial.RADIUS - (long ? 10 : 5));
|
|
const [x2, y2] = Dial.point(at, Dial.TICKS, Dial.RADIUS);
|
|
return s("line", {class: `dial-tick${long ? " long" : ""}`, x1: fixed(x1), y1: fixed(y1), x2: fixed(x2), y2: fixed(y2)});
|
|
});
|
|
const hand = s("line", {class: "dial-hand", x1: centre, y1: centre, x2: centre, y2: fixed(centre - Dial.RADIUS + 14)});
|
|
const readout = s("text", {class: "dial-readout", x: centre, y: centre + Dial.READOUT});
|
|
const face = s("svg", {class: "dial-face", viewBox: `0 0 ${Dial.SIZE} ${Dial.SIZE}`, "aria-hidden": "true", focusable: "false"},
|
|
s("circle", {class: "dial-rim", cx: centre, cy: centre, r: Dial.RADIUS + 4}), ticks, readout, hand, s("circle", {class: "dial-pin", cx: centre, cy: centre, r: 4}));
|
|
const root = h("div", {class: `dial ${options.name}`, role: "slider", tabindex: "0", "aria-label": options.label, "aria-valuemin": String(options.min), "aria-valuemax": String(options.max),
|
|
"aria-readonly": options.readonly || options.live ? "true" : null}, face);
|
|
const turn = (degrees) => {
|
|
shown = degrees;
|
|
hand.setAttribute("transform", `rotate(${degrees.toFixed(3)} ${centre} ${centre})`);
|
|
};
|
|
const show = (value, words) => {
|
|
if (value === current && readout.textContent === words) {
|
|
return;
|
|
}
|
|
current = value;
|
|
readout.textContent = words;
|
|
root.setAttribute("aria-valuenow", String(value));
|
|
root.setAttribute("aria-valuetext", options.spoken(value));
|
|
};
|
|
const running = () => {
|
|
const at = options.live(Date.now());
|
|
turn(Dial.angle(Math.min(at.at, options.max), options.max));
|
|
show(Dial.clamp(at.value, options), at.text);
|
|
};
|
|
const step = (now) => {
|
|
frame = 0;
|
|
if (!root.isConnected) {
|
|
return;
|
|
}
|
|
if (options.live) {
|
|
running();
|
|
} else {
|
|
const progress = Math.max(0, Math.min(1, (now - sweep.start) / DIAL_SWEEP));
|
|
turn(sweep.from + (sweep.to - sweep.from) * Dial.eased(progress));
|
|
if (progress === 1) {
|
|
return;
|
|
}
|
|
}
|
|
frame = window.requestAnimationFrame(step);
|
|
};
|
|
const set = (next) => {
|
|
const value = Dial.clamp(next, options);
|
|
show(value, options.readout(value));
|
|
sweep = {from: shown, to: Dial.angle(value, options.max), start: performance.now()};
|
|
if (!frame) {
|
|
frame = window.requestAnimationFrame(step);
|
|
}
|
|
};
|
|
if (options.live) {
|
|
running();
|
|
frame = window.requestAnimationFrame(step);
|
|
} else {
|
|
const value = Dial.clamp(options.value, options);
|
|
show(value, options.readout(value));
|
|
turn(Dial.angle(value, options.max));
|
|
}
|
|
if (options.readonly || options.live) {
|
|
return {root, value: () => current, set};
|
|
}
|
|
const pointed = (event) => {
|
|
const box = face.getBoundingClientRect();
|
|
set(Dial.fromAngle((Math.atan2(event.clientX - box.left - box.width / 2, box.top + box.height / 2 - event.clientY) * 180) / Math.PI, options.max));
|
|
};
|
|
root.addEventListener("keydown", (event) => {
|
|
const next = Dial.stepped(event.key, current, options);
|
|
if (next === null) {
|
|
return;
|
|
}
|
|
set(next);
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
});
|
|
face.addEventListener("pointerdown", (event) => {
|
|
face.setPointerCapture(event.pointerId);
|
|
pointed(event);
|
|
root.focus({preventScroll: true});
|
|
});
|
|
face.addEventListener("pointermove", (event) => {
|
|
if (face.hasPointerCapture(event.pointerId)) {
|
|
pointed(event);
|
|
}
|
|
});
|
|
return {root, value: () => current, set};
|
|
}
|
|
|
|
/**
|
|
* @param {number} value the undo window in whole seconds the dial starts at.
|
|
* @param {string} label the slider's accessible name.
|
|
* @returns {root, value, set}: dial() over 0 to DIAL_MAX seconds, Page Up and Down 5 s.
|
|
*/
|
|
function undoDial(value, label) {
|
|
const spoken = (seconds) => (seconds ? `${seconds} seconds to undo` : "0 seconds: takes effect at once");
|
|
return dial({value, label, name: "undo-dial", min: 0, max: DIAL_MAX, page: DIAL_PAGE, readout: Dial.countdown, spoken, readonly: false, live: null});
|
|
}
|