Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(glass): no fade under Reduce Motion, guards close five evasions, probe leaves no state; QA round 5 fixes (code review 7, N5-M1, N5-M2, N5-L1-L3)
iceclatterWT78d8b45feb9b
diff --git a/scripts/glass-trap-probe.mjs b/scripts/glass-trap-probe.mjsindex dad41420e..1b47f7331 100644--- a/scripts/glass-trap-probe.mjs+++ b/scripts/glass-trap-probe.mjs@@ -19,17 +19,25 @@** Two passes, both by default:* - at rest: what is on screen now;- * - mid-animation: every finite CSS animation on the page is restarted, every animation is paused- * at half its duration, the page is scanned, then each is finished or resumed as it was. The+ * - mid-animation: every finite CSS animation on the page is restarted and every finite RUNNING+ * animation is set to half its duration, the page is scanned, and everything is put back. The* open animations of overlays are 120–160 ms long; a probe that only looks at rest never sees* them (QA round 4: both probes reported 0 with the palette scrim at opacity 0.17).+ * It never calls pause()/play() (code review 7 #6: on a CSS animation they install a play-state+ * override, and an infinite animation then stops obeying the idle gate, `--nt-anim-state`). The+ * whole pass is one synchronous task, so the timeline cannot advance while it scans: seeking+ * `currentTime` is enough to freeze a frame, and seeking back restores it exactly. Restarted+ * elements get their `animation-name` re-set once more afterwards (a fresh animation, no API+ * call on it ever) and lose the `style` attribute if they had none. The pass checks its own+ * restoration — style attributes, and each untouched animation's play state and time — and+ * the script exits 2 if anything was left behind.** Usage (a dev build with remote debugging, e.g. `--remote-debugging-port=9333`):* node scripts/glass-trap-probe.mjs [--port 9333 | --ws ws://…] [--rest | --mid-anim] [--json]* Open the overlay under test first; the probe checks what is on screen. Exits 1 on any trap, 2- * when it could not check anything (no page, Liquid Glass off, nothing scanned) — never a silent 0.- * It only reads computed styles and replays animations the page already declares; it never clicks,- * types or changes app state.+ * when it could not check anything (no page, no answer within 20 s, Liquid Glass off, nothing+ * scanned) or failed its own restoration check — never a silent 0. It only reads computed styles+ * and replays animations the page already declares; it never clicks, types or changes app state.*/import { realpathSync } from 'node:fs'@@ -107,26 +115,35 @@ export function glassTrapProbe(SCRIMS, midAnim) {return true}- // Mid-animation: replay every finite animation the page declares, freeze everything at half way.+ // Mid-animation: replay every finite animation the page declares, seek every finite running+ // animation to half way (no pause()/play() — see the header).+ const styleAttrs = () => new Map([...document.querySelectorAll('[style]')].map((e) => [e, e.getAttribute('style')]))+ const stylesBefore = midAnim ? styleAttrs() : null+ const untouched = midAnim ? document.getAnimations().map((a) => ({ a, state: a.playState, time: a.currentTime })) : []const replayed = []const frozen = []+ // The element's own CSS animations are replaced when its animation-name is re-set.+ const wasRestarted = (a) =>+ a instanceof CSSAnimation && !a.effect?.pseudoElement && replayed.some((r) => r.el === a.effect?.target)+ const restart = (el, prev) => {+ el.style.animationName = 'none'+ void getComputedStyle(el).animationName+ el.style.animationName = prev+ }if (midAnim) {for (const el of document.body.querySelectorAll('*')) {const cs = getComputedStyle(el)- if (none(cs.animationName) || /infinite/.test(cs.animationIterationCount) || cs.display === 'none') continue+ if (none(cs.animationName) || /infinite/.test(cs.animationIterationCount) || /paused/.test(cs.animationPlayState) || cs.display === 'none') continueconst prev = el.style.animationName- el.style.animationName = 'none'- void getComputedStyle(el).animationName- el.style.animationName = prev- replayed.push(el)+ restart(el, prev)+ replayed.push({ el, prev, hadStyle: stylesBefore.has(el) })}void document.body.offsetWidthfor (const a of document.getAnimations()) {const t = a.effect?.getTiming?.()- if (!t) continue+ if (!t || t.iterations === Infinity || a.playState !== 'running') continueconst d = typeof t.duration === 'number' ? t.duration : a.effect.getComputedTiming().duration- frozen.push({ a, wasRunning: a.playState === 'running', finite: t.iterations !== Infinity })- a.pause()+ frozen.push({ a, time: a.currentTime })a.currentTime = (t.delay || 0) + (d || 0) / 2}}@@ -202,9 +219,24 @@ export function glassTrapProbe(SCRIMS, midAnim) {check(el, '::after')}} finally {- for (const { a, wasRunning, finite } of frozen) {- if (finite && replayed.includes(a.effect?.target)) a.finish()- else if (wasRunning) a.play()+ // Restarted elements: a fresh animation replaces the seeked one (it plays its entrance once+ // more, as when the overlay opened). Everything else: seek back to where it was.+ for (const { a, time } of frozen) if (!wasRestarted(a)) a.currentTime = time+ for (const { el, prev, hadStyle } of replayed) {+ restart(el, prev)+ if (!hadStyle) el.removeAttribute('style')+ }+ }+ // Self-check: nothing left behind.+ const leftovers = []+ if (midAnim) {+ const after = styleAttrs()+ for (const [e, v] of after) if (stylesBefore.get(e) !== v) leftovers.push(`style changed on ${name(e)}`)+ for (const [e] of stylesBefore) if (!after.has(e)) leftovers.push(`style removed from ${name(e)}`)+ const same = (x, y) => x === y || (x != null && y != null && Math.abs(x - y) < 0.01)+ for (const { a, state, time } of untouched) {+ if (wasRestarted(a)) continue+ if (a.playState !== state || !same(a.currentTime, time)) leftovers.push(`animation ${a.animationName || a.id || '?'} on ${a.effect?.target ? name(a.effect.target) : '?'} not restored`)}}return {@@ -213,12 +245,19 @@ export function glassTrapProbe(SCRIMS, midAnim) {checked,animations: frozen.length,traps,+ leftovers,}}-async function evaluate(ws, expression) {+async function evaluate(ws, expression, ms = 20000) {const sock = new WebSocket(ws)return new Promise((resolve, reject) => {+ // A page that never answers (paused in a debugger, hung renderer) is "could not check": exit 2.+ const timer = setTimeout(() => {+ reject(new Error(`no answer from ${ws} within ${ms / 1000}s`))+ sock.close()+ }, ms)+ sock.onclose = () => clearTimeout(timer)sock.onerror = () => reject(new Error(`cannot connect to ${ws}`))sock.onopen = () => sock.send(JSON.stringify({ id: 1, method: 'Runtime.evaluate', params: { expression, returnByValue: true } }))sock.onmessage = (m) => {@@ -237,7 +276,7 @@ async function main() {let ws = opt('--ws')if (!ws) {const port = opt('--port') ?? '9333'- const pages = await (await fetch(`http://localhost:${port}/json`)).json()+ const pages = await (await fetch(`http://localhost:${port}/json`, { signal: AbortSignal.timeout(5000) })).json()ws = pages.find((p) => p.type === 'page' && !p.url.includes('hud'))?.webSocketDebuggerUrlif (!ws) throw new Error(`no app page on port ${port}`)}@@ -250,10 +289,11 @@ async function main() {let blind = falsefor (const r of results) {traps += r.traps.length- if (!r.glass || r.checked === 0) blind = true+ if (!r.glass || r.checked === 0 || r.leftovers.length) blind = true+ for (const l of r.leftovers) console.error(`probe left state behind: ${l}`)if (args.includes('--json')) continueif (!r.glass) console.log('Liquid Glass is not on (data-nt-glass) — nothing glass to check')- console.log(`${r.pass}: ${r.traps.length} trap(s) in ${r.checked} translucent surface(s)${r.pass === 'mid-animation' ? `, ${r.animations} animation(s) frozen at 50%` : ''}`)+ console.log(`${r.pass}: ${r.traps.length} trap(s) in ${r.checked} translucent surface(s)${r.pass === 'mid-animation' ? `, ${r.animations} animation(s) seeked to 50%, restored` : ''}`)for (const t of r.traps) console.log(` ${t.el} ${t.bg} ${t.why} [${t.box.join(',')}]`)}process.exit(traps ? 1 : blind ? 2 : 0)diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 5a7a2211b..5efdbe6b3 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -13675,7 +13675,8 @@ body.focus-mode .dock:hover {.remote-dialog,.pubdlg,.consent-card,- .github-issue-modal+ .github-issue-modal,+ .mlaunch) {background: var(--glass-chrome-bg) !important;-webkit-backdrop-filter: var(--glass-text-blur);@@ -13867,6 +13868,11 @@ body.focus-mode .dock:hover {:root[data-nt-glass='on'] :is(.confirm, .shortcuts, .palette, .kanban-modal) {animation-name: nt-glass-pop;}+ /* Remote access has no entrance of its own in the default look; on glass it pops like its+ sibling dialogs (visual QA round 5, N5-L1). */+ :root[data-nt-glass='on'] .remote-dialog {+ animation: nt-glass-pop 0.16s cubic-bezier(0.22, 1, 0.36, 1);+ }:root[data-nt-glass='on'] :is(.ctx-menu, .tab-menu) {animation-name: nt-glass-menu-in;}@@ -13877,6 +13883,14 @@ body.focus-mode .dock:hover {transition: transform 0.16s ease-out;}}+/* Under Reduce Motion the default-look reduce rule above switches off most entrances, but not the+ kanban card modal's and its scrim's (also the GitHub issue modal's scrim): their opacity fades+ (`kanban-fade`, `kanban-pop`) ran on glass (code review 7 #1). */+@media (prefers-reduced-motion: reduce) {+ :root[data-nt-glass='on'] :is(.kanban-modal-scrim, .kanban-modal) {+ animation: none;+ }+}:root[data-nt-glass='on'] .tooltip {animation-name: none;}@@ -13930,9 +13944,47 @@ body.focus-mode .dock:hover {/* One rim for every glass menu and sheet (visual QA round 4, N4-L1): the `::before`-hosted menus drewthe 20% glass hairline and the element-hosted ones (tab menu, palette, sessions, dialogs) their own10% border, so a right-click menu and the project menu read as two materials. */-:root[data-nt-glass='on'] :is(.tab-menu, .palette, .confirm, .shortcuts, .usage-popover, .sessmem-panel, .sessions-sidebar, .drawer, .phone-pair, .nt-settings, .remote-dialog, .pubdlg, .consent-card, .github-issue-modal, .tooltip, .dictation, .resume-card, .logpanel, .update-card, .announce-banner) {+:root[data-nt-glass='on'] :is(.tab-menu, .palette, .confirm, .shortcuts, .usage-popover, .sessmem-panel, .sessions-sidebar, .drawer, .phone-pair, .nt-settings, .remote-dialog, .pubdlg, .consent-card, .github-issue-modal, .mlaunch, .tooltip, .dictation, .resume-card, .logpanel, .update-card, .announce-banner) {border-color: var(--glass-edge);}++/* Destructive menu items on glass (visual QA round 5, N5-M1): the red label measured 2.7–2.8:1 on+ dark glass. Labels on glass are monochrome (HIG color.md › Liquid Glass color; macOS draws+ destructive menu items in the standard label colour), so the label is ink and only the icon+ keeps the red. Hover is the ordinary glass row highlight — a red wash is not in the fill+ solver's highlight list. */+:root[data-nt-glass='on'] :is(.ctx-item, .tab-menu button).danger:not(:disabled) {+ color: var(--text);+}+:root[data-nt-glass='on'] .ctx-item.danger .ctx-icon {+ color: var(--danger);+}+:root[data-nt-glass='on'] :is(.ctx-item, .tab-menu button).danger:hover:not(:disabled) {+ background: var(--glass-lift);+ color: var(--text-strong);+}++/* Secondary text on glass dialogs sits ABOVE the placeholder (visual QA round 5, N5-M2): macOS ranks+ the placeholder as tertiary, and on glass it cannot drop below 0.77 without losing 4.5:1 over the+ sampled worst backdrop (dark; 0.78 is pinned by glassContrast.test.ts), so the dialogs' secondary lines rise to+ 0.82 (4.9:1 worst case) instead of the hard-coded 0.55 (3.2:1). Light has no room: the+ placeholder's 4.5:1 floor is --text's own alpha, so there typed text is --text-strong (below). */+:root[data-nt-glass='on']:not([data-theme='light']) :is(.confirm, .shortcuts, .remote-dialog, .pubdlg, .consent-card, .github-issue-modal, .mlaunch) {+ --muted: rgba(var(--tint-rgb), 0.82);+}+:root[data-nt-glass='on'] :is(.remote-dialog__desc, .remote-dialog__hint) {+ color: var(--muted);+}+/* One title weight across the glass dialogs (N5-L3): Report a bug and Set icon title with the+ dialog's message line, which is regular, beside Remote access's semibold heading. */+:root[data-nt-glass='on'] :is(.bug-report, .node-icon-dialog) > .confirm__msg:first-child {+ font-weight: 600;+}+/* RAM panel secondary text (N5-L2): hard-coded 0.45–0.6 ink measured 3.95–4.22:1 on glass; it takes+ the glass secondary label. */+:root[data-nt-glass='on'] :is(.sessmem-panel__scope, .sessmem-panel__note, .sessmem-row__project, .sessmem-row__orphan, .sessmem-row__cmd, .sessmem-row__kids, .sessmem-panel__attrib, .sessmem-panel__foot) {+ color: var(--muted);+}/* The Members picker's hover was a solid accent row with white text (3.65:1) while every other liston glass washes its row (N4-L2). */:root[data-nt-glass='on'] .kanban-meta__picker > button:hover {diff --git a/src/renderer/styles.glass-traps.test.ts b/src/renderer/styles.glass-traps.test.tsindex abefabe09..46fd6f806 100644--- a/src/renderer/styles.glass-traps.test.ts+++ b/src/renderer/styles.glass-traps.test.ts@@ -19,9 +19,15 @@ import { describe, expect, it } from 'vitest'* fill's selector matches — same ancestors, and its subject compound (pseudo-classes and `:not()`* included) a subset of the fill's; a `::before` blur covers its host. A token assignment on* `:root` targets no surface in particular, so it always fails.- * 2. no glass surface (anything painting a fill, or the host of a `::before` fill) and no scrim- * (`SCRIMS` in the probe) animates or transitions `opacity` — unless a rule under the glass gate- * overrides that animation/transition for the same element with one that does not.+ * A later unconditional rule that sets the same element's backdrop-filter to something without a+ * blur cancels it (the cascade, not one rule, decides).+ * 2. no glass surface (anything painting a fill or carrying a blur, a blurred `::before` layer, the+ * host of a `::before` layer) and no scrim (`SCRIMS` in the probe) animates or transitions+ * `opacity` — unless, in BOTH motion preferences (reduce and no-preference), a rule overrides that+ * animation/transition for the same element with one that does not: a rule under the glass gate,+ * or a later default-look rule on the same selector. An override inside a media query counts+ * only for the preference that query names (code review 7 #1/#2: the kanban modal kept its fade+ * under Reduce Motion because its only override sat in a no-preference query).* The live half — backdrop roots, which CSS alone cannot see, at rest and mid-animation — is* `scripts/glass-trap-probe.mjs` (see CLAUDE.md, Liquid Glass chrome).*/@@ -38,52 +44,66 @@ const IN_FLOW: Record<string, string> = {interface Rule {selectors: string[]body: string+ /** The enclosing `@media` conditions ('' when unconditional). */+ media: string+ /** Source order. */+ index: number+}++/** Every `@<name> … {` block's extent and prelude. */+function blocks(src: string, name: RegExp): { from: number; to: number; prelude: string }[] {+ const out: { from: number; to: number; prelude: string }[] = []+ for (const m of src.matchAll(new RegExp(`@${name.source}([^{]*)\\{`, 'g'))) {+ let depth = 1+ let i = m.index! + m[0].length+ while (depth && i < src.length) depth += src[i] === '{' ? 1 : src[i] === '}' ? -1 : 0, i+++ out.push({ from: m.index!, to: i, prelude: m[1].trim() })+ }+ return out}function parse(css: string): Rule[] {const out: Rule[] = []const re = /([^{}]+)\{([^{}]*)\}/gconst src = css.replace(/\r\n/g, '\n').replace(/\/\*[\s\S]*?\*\//g, '')+ const media = blocks(src, /media/)let m: RegExpExecArray | nullwhile ((m = re.exec(src))) {const head = m[1].replace(/\s+/g, ' ').trim()// Keyframe steps (`from`, `50%`) are not selectors.if (/^(from|to|[\d.]+%)(\s*,\s*(from|to|[\d.]+%))*$/.test(head)) continue- out.push({ selectors: splitTop(head), body: m[2] })+ const at = m.index+ const cond = media.filter((b) => b.from < at && at < b.to).map((b) => b.prelude)+ out.push({ selectors: splitTop(head), body: m[2], media: cond.join(' and '), index: out.length })}return out}-/** `@keyframes` names whose steps set opacity. */+/** `@keyframes` (and `@-webkit-keyframes`) names whose steps set opacity. */function opacityKeyframes(css: string): Set<string> {const src = css.replace(/\/\*[\s\S]*?\*\//g, '')- const names = new Set<string>()- const re = /@keyframes\s+([\w-]+)\s*\{/g- let m: RegExpExecArray | null- while ((m = re.exec(src))) {- let depth = 1- let i = re.lastIndex- while (depth && i < src.length) depth += src[i] === '{' ? 1 : src[i] === '}' ? -1 : 0, i++- if (/(?:^|[;{\s])opacity\s*:/.test(src.slice(re.lastIndex, i))) names.add(m[1])- }- return names+ return new Set(+ blocks(src, /(?:-webkit-)?keyframes/)+ .filter((b) => /(?:^|[;{\s])opacity\s*:/.test(src.slice(b.from, b.to)))+ .map((b) => b.prelude)+ )}-/** Split on commas outside parentheses. */-function splitTop(list: string): string[] {+/** Split on commas (or, with `space`, on whitespace) outside parentheses. */+function splitTop(list: string, space = false): string[] {const parts: string[] = []let depth = 0let cur = ''for (const ch of list) {if (ch === '(') depth++if (ch === ')') depth--- if (ch === ',' && depth === 0) {+ if ((space ? /\s/.test(ch) : ch === ',') && depth === 0) {parts.push(cur.trim())cur = ''} else cur += ch}if (cur.trim()) parts.push(cur.trim())- return parts+ return space ? parts.filter(Boolean) : parts}/** One concrete selector: its ancestor part (verbatim, gate stripped), the subject compound's@@ -132,6 +152,11 @@ function compoundAlts(compound: string): { tokens: Set<string>; pseudo: string }const covers = (b: Alt, s: Alt): boolean =>(b.anc === '' || b.anc === s.anc) && b.tokens.size > 0 && [...b.tokens].every((t) => s.tokens.has(t))+/** Can `a` and `b` match the same element? Either covers the other, or they share a subject class+ * (`.sheet.is-open` and `.sheet`, `.modal .sheet` and `.sheet`). */+const overlap = (a: Alt, b: Alt): boolean =>+ covers(a, b) || covers(b, a) || [...a.tokens].some((t) => t.startsWith('.') && b.tokens.has(t))+/** The last (-webkit-)backdrop-filter declaration decides; Chromium treats the two as one property. */function blurs(body: string): boolean {const decls = [...body.matchAll(/(?:^|;)\s*(?:-webkit-)?backdrop-filter\s*:([^;]*)/g)]@@ -140,16 +165,37 @@ function blurs(body: string): boolean {}const paintsFill = (r: Rule): boolean => [...r.body.matchAll(PAINT)].some((d) => FILL.test(d[2]))+const setsBackdrop = (body: string): boolean => /(?:^|;)\s*(?:-webkit-)?backdrop-filter\s*:/.test(body)++/** Every blurred selector alternative whose blur no later unconditional rule cancels. A cancelling+ * rule must cover the element and not lose on the gate's specificity. */+function blurredAlts(rules: Rule[]): Alt[] {+ const out: Alt[] = []+ for (const r of rules.filter((r) => blurs(r.body)))+ for (const sel of r.selectors)+ for (const a of alternatives(sel)) {+ const cancelled = rules.some(+ (k) =>+ k.index > r.index &&+ k.media === '' &&+ setsBackdrop(k.body) &&+ !blurs(k.body) &&+ k.selectors.some((ks) => (GATE.test(ks) || !GATE.test(sel)) && alternatives(ks).some((ka) => ka.pseudo === a.pseudo && covers(ka, a)))+ )+ if (!cancelled) out.push(a)+ }+ return out+}/** Every selector that paints a glass fill without a blur of its own or a covering blur rule. */function glassFillsWithoutBlur(css: string): string[] {const rules = parse(css)- const blurred = rules.filter((r) => blurs(r.body)).flatMap((r) => r.selectors.flatMap(alternatives))+ const blurred = blurredAlts(rules)const covered = (s: Alt): boolean =>blurred.some((b) => (b.pseudo === s.pseudo || b.pseudo === 'before') && covers(b, s))const bad: string[] = []for (const r of rules) {- if (!paintsFill(r) || blurs(r.body)) continue+ if (!paintsFill(r)) continuefor (const sel of r.selectors) {if (Object.keys(IN_FLOW).some((k) => sel.endsWith(k))) continueif (!alternatives(sel).every(covered)) bad.push(sel)@@ -158,20 +204,40 @@ function glassFillsWithoutBlur(css: string): string[] {return bad}+/** A `transition` shorthand item with no property name transitions `all`. */+const TIMING = /^(?:[\d.]+m?s|ease(?:-in|-out|-in-out)?|linear|step-start|step-end|allow-discrete|normal|(?:steps|cubic-bezier|linear)\(.*\))$/+const transitionProps = (prop: string, v: string): string[] =>+ prop === 'transition-property'+ ? splitTop(v)+ : splitTop(v).map((item) => splitTop(item, true).find((w) => !TIMING.test(w)) ?? 'all')++const MOTION_PREFS = ['reduce', 'no-preference'] as const+type MotionPref = (typeof MOTION_PREFS)[number]+const PREF_QUERY = /^\(prefers-reduced-motion:\s*(reduce|no-preference)\)$/+/** The motion preferences a rule may apply in: any other condition may hold in either. */+const mayApplyIn = (media: string): readonly MotionPref[] => {+ const p = PREF_QUERY.exec(media)?.[1] as MotionPref | undefined+ return p ? [p] : MOTION_PREFS+}+/** Does a rule surely apply in preference `p`? Only unconditional, or under exactly that query. */+const surelyAppliesIn = (media: string, p: MotionPref): boolean => media === '' || PREF_QUERY.exec(media)?.[1] === p+/** Every glass surface or scrim selector that animates or transitions opacity (see rule 2). */function glassOpacityMotion(css: string, scrims: string[]): string[] {const rules = parse(css)const fades = opacityKeyframes(css)const targets: Alt[] = [- ...rules.filter(paintsFill).flatMap((r) => r.selectors.flatMap(alternatives)).map((a) => ({ ...a, pseudo: '' })),+ ...rules.filter((r) => paintsFill(r) || blurs(r.body)).flatMap((r) => r.selectors.flatMap(alternatives)),...scrims.flatMap(alternatives),]+ // A layer's own motion fades that layer; its host's motion fades the host and every layer on it.+ const hits = (t: Alt, a: Alt): boolean => (a.pseudo === '' || a.pseudo === t.pseudo) && overlap(t, a)const kindsOf = (body: string): { animation?: boolean; transition?: boolean } => {const out: { animation?: boolean; transition?: boolean } = {}for (const d of body.matchAll(/(?:^|;)\s*(animation(?:-name)?|transition(?:-property)?)\s*:([^;]*)/g)) {const v = d[2]if (d[1].startsWith('animation')) out.animation = v.split(/[\s,]+/).some((w) => fades.has(w))- else out.transition = /\b(opacity|all)\b/.test(v) || (d[1] === 'transition' && /^\s*[\d.]+m?s\b/.test(v))+ else out.transition = transitionProps(d[1], v).some((p) => p === 'opacity' || p === 'all')}return out}@@ -183,17 +249,27 @@ function glassOpacityMotion(css: string, scrims: string[]): string[] {for (const sel of r.selectors) {const gated = GATE.test(sel)for (const a of alternatives(sel)) {- if (a.pseudo || !targets.some((t) => covers(t, a))) continue- // An ungated (default-look) rule is fine when a gated rule re-declares that motion for- // the same element without opacity.- const overridden =- !gated &&+ if (!targets.some((t) => hits(t, a))) continue+ // An ungated (default-look) rule is fine when, in every motion preference it may apply+ // in, a rule re-declares that motion for the same element without opacity: a gated rule+ // (it outranks the default look) or a later default-look rule on the same selector.+ const overriddenIn = (p: MotionPref): boolean =>rules.some((g) =>+ g !== r &&+ surelyAppliesIn(g.media, p) &&kindsOf(g.body)[kind] === false &&- g.selectors.some((gs) => GATE.test(gs) && alternatives(gs).some((ga) => !ga.pseudo && covers(ga, a)))+ g.selectors.some((gs) =>+ alternatives(gs).some(+ (ga) =>+ ga.pseudo === a.pseudo &&+ (GATE.test(gs)+ ? covers(ga, a)+ : g.index > r.index && ga.anc === a.anc && covers(ga, a) && ga.tokens.size === a.tokens.size)+ )+ ))- if (!overridden) bad.push(`${sel} (${kind})`)+ if (gated || !mayApplyIn(r.media).every(overriddenIn)) bad.push(`${sel} (${kind})`)}}}@@ -241,6 +317,18 @@ describe('Liquid Glass: no translucent fill without a blur', () => {expect(glassFillsWithoutBlur(css)).toEqual([`${g} .a`, `${g} .b`, `${g} .c`, `${g} .m.m--scroll`, `${g} .sidebar .menu`])})+ it('code review 7 #5: a later rule cancelling the blur on the same element', () => {+ const g = ":root[data-nt-glass='on']"+ const css = `+ ${g} .a { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); }+ ${g} .a { backdrop-filter: none; }+ ${g} .b { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); }+ .b { backdrop-filter: none; }+ ${g} .c { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); }+ @media (prefers-reduced-transparency: reduce) { ${g} .c { backdrop-filter: none; } }`+ expect(glassFillsWithoutBlur(css)).toEqual([`${g} .a`])+ })+it('the shared surface tokens are never redefined under the glass gate', () => {const redefined = parse(CSS).filter((r) => r.selectors.some((s) => s.startsWith(":root[data-nt-glass='on']")))@@ -283,4 +371,39 @@ describe('Liquid Glass: glass never fades (visual QA round 4, N4-H1)', () => {`${g} .menu:hover (transition)`,])})++ it('code review 7 #2: an override inside a motion query counts only for that preference', () => {+ const g = ":root[data-nt-glass='on']"+ const css = `+ @keyframes fade { from { opacity: 0; } }+ @keyframes pop { from { transform: scale(0.97); } }+ ${g} :is(.modal, .sheet, .card, .tip) { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); }+ .modal { animation: fade 0.16s; }+ @media (prefers-reduced-motion: no-preference) { ${g} .modal { animation-name: pop; } }+ .sheet { animation: fade 0.16s; }+ @media (prefers-reduced-motion: no-preference) { ${g} .sheet { animation-name: pop; } }+ @media (prefers-reduced-motion: reduce) { ${g} .sheet { animation: none; } }+ .card { animation: fade 0.16s; }+ @media (prefers-reduced-motion: no-preference) { ${g} .card { animation-name: pop; } }+ @media (prefers-reduced-motion: reduce) { .card { animation: none; } }+ .tip { animation: fade 0.16s; }+ @media (max-width: 600px) { ${g} .tip { animation: none; } }`+ expect(glassOpacityMotion(css, [])).toEqual(['.modal (animation)', '.tip (animation)'])+ })++ it('code review 7 #3-#5: overlap either way, faded ::before layers, bare-timing transitions, -webkit- keyframes', () => {+ const g = ":root[data-nt-glass='on']"+ const css = `+ @-webkit-keyframes wfade { from { opacity: 0; } }+ ${g} .sheet.is-open { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); }+ .sheet { animation: wfade 0.12s; }+ ${g} .modal .pane { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); }+ .pane { transition: ease-out 0.2s; }+ ${g} .menu::before { content: ''; backdrop-filter: blur(20px); }+ .menu::before { transition: opacity 0.1s; }+ .menu::after { transition: opacity 0.1s; }+ .row { transition: opacity 0.1s; }+ ${g} .chip { background: var(--glass-chrome-bg); backdrop-filter: blur(20px); transition: background-color 0.1s ease-out, transform 0.1s; }`+ expect(glassOpacityMotion(css, [])).toEqual(['.sheet (animation)', '.pane (transition)', '.menu::before (transition)'])+ })})