From ce16609c768ad41bd129df1f6228941299ffbcc8 Mon Sep 17 00:00:00 2001 From: Void Date: Mon, 9 Nov 2026 22:25:59 +0000 Subject: [PATCH] Plate every region of bare-sky text under the scene with one rule skyPlate.css.ts joins the room and page headers, the room list, list pages, the typing and Following bars, non-bubble messages and the room intro to the sign-in card's opaque --sky-bubble plate, with the plate's ink and link tokens, at all widths. The estate title bar's own plate goes: the shared header rule covers it. skyTheme.test.ts pins the link ratios on bare sky as well (day 5.25, night 2.36). Co-Authored-By: Claude Sonnet 5.5 --- src/app/components/room-intro/RoomIntro.tsx | 6 +- src/app/features/estate/EstateNavigator.tsx | 4 +- src/app/features/scene/skyPlate.css.ts | 69 +++++++++++++++------ src/app/features/scene/skyTheme.test.ts | 16 ++--- 4 files changed, 64 insertions(+), 31 deletions(-) diff --git a/src/app/components/room-intro/RoomIntro.tsx b/src/app/components/room-intro/RoomIntro.tsx index 2e4e3ebc..0c6b10df 100644 --- a/src/app/components/room-intro/RoomIntro.tsx +++ b/src/app/components/room-intro/RoomIntro.tsx @@ -1,7 +1,9 @@ +import classNames from 'classnames'; import React, { useCallback, useState } from 'react'; import { Avatar, Box, Button, Spinner, Text, as } from 'folds'; import { Room } from 'matrix-js-sdk'; import { useAtomValue } from 'jotai'; +import { SkyPlate } from '../../features/scene/skyPlate.css'; import { IRoomCreateContent, Membership, StateEvent } from '../../../types/matrix/room'; import { getMemberDisplayName, getStateEvent } from '../../utils/room'; import { useMatrixClient } from '../../hooks/useMatrixClient'; @@ -23,7 +25,7 @@ export type RoomIntroProps = { room: Room; }; -export const RoomIntro = as<'div', RoomIntroProps>(({ room, ...props }, ref) => { +export const RoomIntro = as<'div', RoomIntroProps>(({ room, className, ...props }, ref) => { const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); const { navigateRoom } = useRoomNavigate(); @@ -50,7 +52,7 @@ export const RoomIntro = as<'div', RoomIntroProps>(({ room, ...props }, ref) => const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock'); return ( - + - + {title} diff --git a/src/app/features/scene/skyPlate.css.ts b/src/app/features/scene/skyPlate.css.ts index cb56a75b..102eefd0 100644 --- a/src/app/features/scene/skyPlate.css.ts +++ b/src/app/features/scene/skyPlate.css.ts @@ -1,32 +1,63 @@ import { globalStyle, style } from '@vanilla-extract/css'; -import { config } from 'folds'; +import { color, config } from 'folds'; import { MessageBase, BubbleContent } from '../../components/message/layout/layout.css'; +import { PageContent, PageNavContent } from '../../components/page/style.css'; +import { RoomViewFollowing } from '../room/RoomViewFollowing.css'; +import { RoomViewTyping } from '../room/RoomViewTyping.css'; import { SKY_PLATE_FALLBACK } from './skyPlate'; -// Over the scene (html[data-scene]) the signed-in shell is clear, so text outside a chat bubble -// would sit on bare sky, which a sky state can make light, dark or both (dusk): no ink clears -// 4.5:1 on all of that (skyTheme.test.ts). Such text gets a plate instead, never a halo. +// Over the scene (html[data-scene]) the signed-in shell is clear (sceneShell.css.ts), so text +// outside a chat bubble would sit on bare sky, which a sky state can make light, dark or both +// (dusk): no ink clears 4.5:1 on all of that (skyTheme.test.ts). Every such region is a plate +// instead, the sign-in card's opaque --sky-bubble fill, with its own ink and link, so what was +// checked for the card holds everywhere. One rule, below; a region joins it by class or by tag. const scene = ':root[data-scene]'; const fill = `var(--sky-bubble, ${SKY_PLATE_FALLBACK.fill})`; const text = `var(--sky-bubble-text, ${SKY_PLATE_FALLBACK.text})`; -const plate = { +/** A region with no component class of its own (the room intro) joins the plate with this. */ +export const SkyPlate = style({}); + +// A recipe's first class is its base style. +const base = (recipe: () => string) => `.${recipe().split(' ')[0]}`; + +const regions = [ + `.${SkyPlate}`, + // Title bars: the room header, the room list's header, every page header. + '#root header', + // The room list, and the pages that are lists (explore, inbox, search). + `.${PageNavContent}`, + `.${PageContent}`, + // The bars over the composer. + `.${RoomViewTyping}`, + base(RoomViewFollowing), + // A message that is not a bubble (Modern, Compact) is plain text on the scene. + `${base(MessageBase)}:not(:has(.${BubbleContent}))`, +]; + +// Only inside #root: menus and dialogs render in #portalContainer with their own themed fill. +const within = (ancestor: string) => + regions.map((r) => `${ancestor} ${r.startsWith('#root') ? '' : '#root '}${r}`).join(', '); + +globalStyle(within(scene), { backgroundColor: fill, color: text, - borderRadius: config.radii.R400, -} as const; + // Themed ink was chosen for the clear shell; inside the plate every token reads the plate's. + vars: { + [color.Background.OnContainer]: text, + [color.Surface.OnContainer]: text, + [color.SurfaceVariant.OnContainer]: text, + }, +}); +globalStyle(`${scene} #root header`, { borderRadius: config.radii.R400 }); -/** A title-bar group whose controls and title sit on the plate. */ -export const SkyPlate = style({}); -globalStyle(`${scene} ${SkyPlate}`, { ...plate, padding: `0 ${config.space.S100}` }); -// Controls in the plate take its ink; their themed ink was chosen for the clear shell. -globalStyle(`${scene} ${SkyPlate} button`, { color: 'inherit' }); - -// A message that is not a bubble (Modern, Compact) is plain text on the scene: plate the row. -globalStyle(`${scene} ${MessageBase}:not(:has(.${BubbleContent}))`, plate); - -// Links on a plate read against the plate. The Midnight and Noonday themes set their own -// --tc-link for it; the rest take the fallback, as the sign-in card does. -globalStyle(`${scene} body:not(.gamecult-theme) ${SkyPlate}, ${scene} body:not(.gamecult-theme) ${MessageBase}`, { +// Links read against the plate. The Midnight and Noonday themes set their own --tc-link for it; +// the other themes take the fallback, as the sign-in card does. +globalStyle(within(`${scene} body:not(.gamecult-theme)`), { vars: { '--tc-link': SKY_PLATE_FALLBACK.link }, }); + +globalStyle(`${scene} #root .${SkyPlate}`, { + padding: config.space.S400, + borderRadius: config.radii.R400, +}); diff --git a/src/app/features/scene/skyTheme.test.ts b/src/app/features/scene/skyTheme.test.ts index 3fad1f3f..60a3ae64 100644 --- a/src/app/features/scene/skyTheme.test.ts +++ b/src/app/features/scene/skyTheme.test.ts @@ -39,19 +39,21 @@ describe('skyThemeId', () => { }); describe('ink of the theme a state picks, on bare sky', () => { - // [state, text ratio, link ratio]; a theme's own ink is not chosen for bare sky, so only day - // and night text pass (Nibu's measurement, skyState.test.ts). Links never rest on bare sky. - const cells: [SkyState, string, string, string, string][] = [ - ['day', 'noonday-sky', '#342d25', '7.62', '#2a4f27'], - ['dusk', 'noonday-sky', '#342d25', '1.00', '#2a4f27'], - ['night', 'midnight-sky', '#aeccff', '5.05', '#609385'], + // Per state: the picked theme, its ink and link, and their ratios on bare sky. A theme's own + // ink is not chosen for bare sky, so only day and night text pass (skyState.test.ts), and no + // link does (night 2.36): links never rest on bare sky, they sit on the plate below. + const cells: [SkyState, string, string, string, string, string][] = [ + ['day', 'noonday-sky', '#342d25', '7.62', '#2a4f27', '5.25'], + ['dusk', 'noonday-sky', '#342d25', '1.00', '#2a4f27', '1.00'], + ['night', 'midnight-sky', '#aeccff', '5.05', '#609385', '2.36'], ]; - it.each(cells)('%s with %s: ink %s measures %s', (state, id, ink, want, link) => { + it.each(cells)('%s with %s: ink %s is %s, link %s is %s', (state, id, ink, want, link, wantLink) => { const sky = SKY[id as keyof typeof SKY]; expect(sky.tokens.Background.OnContainer).toBe(ink); expect(sky.link).toBe(link); expect(r2(ratio(ink, skyBackdrop(state)))).toBe(want); + expect(r2(ratio(link, skyBackdrop(state)))).toBe(wantLink); }); it('only the cells that clear AA on bare sky carry text there', () => {