README: a hero that shows the app
This commit is contained in:
parent
467aea2e28
commit
89c9bfc75f
32 changed files with 933 additions and 71 deletions
|
|
@ -7,6 +7,7 @@
|
|||
// Packs are standalone documents (framework themeIcons.ts); `packDocument(id)` is the JSON a pack
|
||||
// is exported and published as.
|
||||
|
||||
import { RETRO_PACKS } from './retro.ts';
|
||||
import { sanitizeIconPack, type IconGlyph, type IconName, type IconPack } from '../../../../../waybetter/packages/runtime/src/themeIcons.ts';
|
||||
|
||||
const line = (d: string): IconGlyph => ({ d, stroke: true });
|
||||
|
|
@ -165,12 +166,12 @@ const documents = [
|
|||
{ id: 'wb-pixel', name: 'Pixel 98', description: 'Sixteen-pixel icons in the manner of a 1998 desktop. Our own drawings.', ...OWN, style: { stroke: 1.75, cap: 'square', join: 'miter', scale: 1 }, glyphs: PIXEL },
|
||||
];
|
||||
|
||||
/** The built-in packs, validated like any imported pack. */
|
||||
/** The built-in packs, validated like any imported pack; retro-98 is bundled too, as the Windows 98 theme's own pack (it stays in the Store). */
|
||||
export const BUILTIN_PACKS: IconPack[] = documents.map(doc => {
|
||||
const pack = sanitizeIconPack(doc);
|
||||
if (!pack) throw new Error(`built-in icon pack ${doc.id} is not valid`);
|
||||
return pack;
|
||||
});
|
||||
}).concat(RETRO_PACKS.filter(pack => pack.id === 'retro-98'));
|
||||
|
||||
/** A built-in pack as the JSON document it is published as (`<id>.icons.json`). */
|
||||
export const packDocument = (id: string) => {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
// copyright, and the plan bans them). The look is the idea of the era, drawn from scratch.
|
||||
// retro-98 16 by 16 pixel art on the 98 desktop palette: black outline, silver, navy, teal.
|
||||
// retro-xp vector glyphs in the manner of 2001: gel fills, a dark edge, a lit top.
|
||||
// Both draw every name X's left rail uses (home .. compose, and the .active forms) and the action bar.
|
||||
// Both draw every name X's left rail uses (home .. compose, and the .active forms) and the action bar;
|
||||
// retro-98 also History, Creator Studio and Articles, and ships bundled as the Windows 98 theme's pack.
|
||||
// Generated into store/x/icons/<id>/ by scripts/build-store-icons.mjs.
|
||||
|
||||
import { sanitizeIconPack, type IconGlyph, type IconName, type IconPack } from '../../../../../waybetter/packages/runtime/src/themeIcons.ts';
|
||||
|
|
@ -152,6 +153,18 @@ const ART98: Record<string, readonly string[]> = {
|
|||
'................', '.....kkkkkk.....', '...kkyyyyyykk...', '..kyyyyyyyyyyk..', '..kyykkyykkyyk..', '.kyyykkyykkyyyk.', '.kyyyyyyyyyyyyk.', '.kykyyyyyyyykyk.',
|
||||
'.kyykyyyyyykyyk.', '..kyykkkkkkyyk..', '..kyyyyyyyyyyk..', '...kkyyyyyykk...', '.....kkkkkk.....', '................', '................', '................',
|
||||
],
|
||||
hourglass: [
|
||||
'................', '...kkkkkkkkkk...', '...kssssssssk...', '....kwwwwwwk....', '....kwyyyyyk....', '.....kwyyyk.....', '......kyyk......', '.......kk.......',
|
||||
'......kwyk......', '.....kwwyyk.....', '....kwwyyyyk....', '....kyyyyyyk....', '...kssssssssk...', '...kkkkkkkkkk...', '................', '................',
|
||||
],
|
||||
clapper: [
|
||||
'................', '.kkkkkkkkkkkkkk.', '.kwkkwwkkwwkkwk.', '.kkkkkkkkkkkkkk.', '.kggggggggggggk.', '.kgwwwwwwwwwwgk.', '.kgwnnrnnnnnwgk.', '.kgwnnrrnnnnwgk.',
|
||||
'.kgwnnrrrnnnwgk.', '.kgwnnrrnnnnwgk.', '.kgwnnrnnnnnwgk.', '.kgwwwwwwwwwwgk.', '.kggggggggggggk.', '.kkkkkkkkkkkkkk.', '................', '................',
|
||||
],
|
||||
page: [
|
||||
'................', '..kkkkkkkkk.....', '..kwwwwwwwkk....', '..kwnnnnwwkgk...', '..kwwwwwwwkkkk..', '..kwnnnnnnwwwk..', '..kwwwwwwwwwwk..', '..kwnnnnnnnnwk..',
|
||||
'..kwwwwwwwwwwk..', '..kwnnnnnnnnwk..', '..kwwwwwwwwwwk..', '..kwnnnnnwwwwk..', '..kwwwwwwwwwwk..', '..kkkkkkkkkkkk..', '................', '................',
|
||||
],
|
||||
clock: [
|
||||
'................', '.....kkkkkk.....', '...kkwwwwwwkk...', '..kwwwwkwwwwwk..', '..kwwwwkwwwwwk..', '.kwwwwwkwwwwwwk.', '.kwwwwwkwwwwwwk.', '.kwwwwwkkkkwwwk.',
|
||||
'.kwwwwwwwwwwwwk.', '.kwwwwwwwwwwwwk.', '..kwwwwwwwwwwk..', '..kwwwwwwwwwwk..', '...kkwwwwwwkk...', '.....kkkkkk.....', '................', '................',
|
||||
|
|
@ -362,6 +375,7 @@ const G98: Names = {
|
|||
reply: px('balloon'), repost: px('arrows'), 'repost.on': px('arrowsOn'), like: px('heart'), 'like.on': px('heartOn'), views: px('bars'),
|
||||
bookmark: px('bookmark'), 'bookmark.on': px('bookmarkOn'), share: px('share'), verified: px('check'), back: px('back'), close: px('close'), search: px('search'), settings: px('gear'),
|
||||
media: px('picture'), gif: px('gif'), poll: px('poll'), emoji: px('smile'), schedule: px('clock'), location: px('pin'), lock: px('lock'),
|
||||
history: px('hourglass'), studio: px('clapper'), articles: px('page'),
|
||||
};
|
||||
const GXP: Names = {
|
||||
home: XP.home!, 'home.active': XP.home!, explore: XP.explore!, 'explore.active': XP.explore!, notifications: XP.bell!, 'notifications.active': XP.bell!,
|
||||
|
|
@ -370,6 +384,7 @@ const GXP: Names = {
|
|||
reply: XP.reply!, repost: XP.repost!, 'repost.on': XP.repostOn!, like: XP.heart!, 'like.on': XP.heartOn!, views: XP.views!,
|
||||
bookmark: XP.bookmark!, 'bookmark.on': XP.bookmarkOn!, share: XP.share!, verified: XP.verified!, back: XP.back!, close: XP.close!, search: XP.explore!, settings: XP.gear!,
|
||||
media: XP.media!, gif: XP.gif!, poll: XP.poll!, emoji: XP.smile!, schedule: XP.clock!, location: XP.pin!, lock: XP.lock!,
|
||||
history: XP.clock!, studio: XP.media!, articles: XP.lists!,
|
||||
};
|
||||
|
||||
const OWN = { author: 'wayBetter for X', license: 'own', source: 'drawn for wayBetter for X; no asset is taken from Windows or from any icon archive', credits: 'wayBetter for X contributors' };
|
||||
|
|
|
|||
|
|
@ -17,10 +17,14 @@ import {
|
|||
} from './themeSpec.ts';
|
||||
import { axisPosition, buildColorModel, projectColor, type ColorModel, type Usage } from './themeTokens.ts';
|
||||
import { X_PRIMITIVE_VARS, accentLabel, chatSurfaceCss, fadedAlpha, hexToHslTriple, xTokenOverrides } from './themeChat.ts';
|
||||
import { buildStructureCss as buildThemeStructureCss, installIconGate, normalizeIconChoice, type StructureEnv } from './themeStructure.ts';
|
||||
import { buildStructureCss as buildThemeStructureCss, installIconGate, normalizeIconChoice, X_FRAMED, X_LAYER_TARGETS, type StructureEnv } from './themeStructure.ts';
|
||||
import type { IconChoice } from '../../../../waybetter/packages/runtime/src/themeIcons.ts';
|
||||
import { contrastRatio, hexToRgb, mix, normalizeResolved, readableOn, relativeLuminance, type ResolvedFonts, type ResolvedTheme } from '../../../../waybetter/packages/runtime/src/themeApi.ts';
|
||||
import { createThemeCatalog, type ThemeChoice } from '../../../../waybetter/packages/runtime/src/themeChoice.ts';
|
||||
import { deriveSurfaces, surfacesInputFromV2, type Surface, type SurfaceSet } from '../../../../waybetter/packages/runtime/src/themeDerive.ts';
|
||||
import { hexToOklch } from '../../../../waybetter/packages/runtime/src/themeInk.ts';
|
||||
import { installFrameMarker, installLayerGuard } from '../../../../waybetter/packages/runtime/src/themeGuards.ts';
|
||||
import { installBarMeasurer } from '../../../../waybetter/packages/runtime/src/themeBar.ts';
|
||||
import { installThemeRuntime, resolvedFonts, type ThemeHandle as RuntimeHandle, type ThemeRuntimeOptions } from '../../../../waybetter/packages/runtime/src/themeRuntime.ts';
|
||||
|
||||
export type { Palette, Role, ButtonRole, RuleLike } from './themeSpec.ts';
|
||||
|
|
@ -356,6 +360,82 @@ function fullPalette(palette: Partial<Palette>): Palette | null {
|
|||
return bg && surface && elevated && border && text && muted && accent ? { ...palette, bg, surface, elevated, border, text, muted, accent } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Colours X uses for a meaning, kept in hue under every theme (theme engine v3 3.6): like pink, repost
|
||||
* green, destructive red, and the swatches of X's own accent picker (purple, yellow, orange), which
|
||||
* show the colour they choose. Not fill classes: a fill in one of these stays X's.
|
||||
*/
|
||||
export const X_MEANING_KEYS = ['249,24,128', '0,186,124', '244,33,46', '120,86,255', '255,212,0', '255,122,0'];
|
||||
|
||||
/**
|
||||
* Opaque fills X paints inline that are no palette colour, read live (a class scan cannot see inline
|
||||
* values): Creator Studio's indigo "New" pill (Tailwind indigo-950, /i/monetization, 2026-10-02).
|
||||
*/
|
||||
export const X_FOREIGN_INLINE_FILLS = ['30,27,75'];
|
||||
|
||||
/** Every X colour key the remap knows (invariant I2 counts a computed colour equal to one of these as a leak). */
|
||||
export const X_COLOUR_KEYS: string[] = [...new Set([X_PALETTES.light, X_PALETTES.dim, X_PALETTES.dark, JETFUEL.light, JETFUEL.dark]
|
||||
.flatMap(source => Object.values(source).flat()))];
|
||||
|
||||
/** The surface set a full palette derives (theme engine v3, step 5). */
|
||||
export function paletteSurfaces(palette: Partial<Palette> & { page?: string }): SurfaceSet | null {
|
||||
const full = fullPalette(palette);
|
||||
return full ? deriveSurfaces(surfacesInputFromV2({ ...full, page: palette.page ?? null })) : null;
|
||||
}
|
||||
|
||||
/** OKLab distance between an `r,g,b` key and a hex colour. */
|
||||
function oklabDistance(key: string, hex: string): number {
|
||||
const asHex = `#${key.split(',').map(v => Number(v).toString(16).padStart(2, '0')).join('')}`;
|
||||
const a = hexToOklch(asHex), b = hexToOklch(hex);
|
||||
return Math.hypot(a.l - b.l, a.c * Math.cos(a.h) - b.c * Math.cos(b.h), a.c * Math.sin(a.h) - b.c * Math.sin(b.h));
|
||||
}
|
||||
|
||||
/**
|
||||
* R1 (theme engine v3 3.4): the surface an opaque X fill that is no palette colour behaves like
|
||||
* (Creator Studio's indigo "New" pill, promotional fills): the theme surface nearest to it, by where
|
||||
* X's colour sits between X's own page and text, so a dark X badge stays a strong fill in a light theme.
|
||||
*/
|
||||
export function foreignFillSurface(key: string, source: Source, surfaces: SurfaceSet): Surface {
|
||||
const toHex = (k: string) => `#${k.split(',').map(v => Number(v).toString(16).padStart(2, '0')).join('')}`;
|
||||
const xBg = toHex(source.bg[0] ?? '255,255,255'), xText = toHex(source.text[0] ?? '15,20,25');
|
||||
// Closer to X's text than to X's page: an emphasised fill (strong or the accent fill); else a quiet surface.
|
||||
const emphasised = oklabDistance(key, xText) < oklabDistance(key, xBg);
|
||||
const candidates: Surface[] = emphasised ? [surfaces.strong, surfaces.accentFill] : [surfaces.card, surfaces.raised, surfaces.chrome];
|
||||
const hue = hexToOklch(toHex(key));
|
||||
// Chromatic X fills keep to the accent fill when it is the nearer hue; neutral ones to the strong fill.
|
||||
if (emphasised && hue.c > 0.04) {
|
||||
const accent = hexToOklch(surfaces.accentFill.fill), strong = hexToOklch(surfaces.strong.fill);
|
||||
const dh = (a: number, b: number) => Math.abs(Math.atan2(Math.sin(a - b), Math.cos(a - b)));
|
||||
return dh(hue.h, accent.h) <= dh(hue.h, strong.h) || strong.c < 0.02 ? surfaces.accentFill : surfaces.strong;
|
||||
}
|
||||
return candidates.reduce((best, s) => oklabDistance(key, s.fill) < oklabDistance(key, best.fill) ? s : best);
|
||||
}
|
||||
|
||||
/** X's accent at alpha under 0.2 as a state: up to 0.1 a hover, above it a selection (content surface). */
|
||||
export function accentWash(value: string, source: Source, surfaces: SurfaceSet): string | null {
|
||||
const parsed = parseColor(value);
|
||||
if (!parsed || typeof parsed.alpha !== 'number' || parsed.alpha <= 0 || parsed.alpha >= 0.2 || !source.accent.includes(parsed.key)) return null;
|
||||
return parsed.alpha <= 0.1 ? surfaces.content.hover : surfaces.content.selected;
|
||||
}
|
||||
|
||||
/** R2: everything inside a fill reads in that fill's ink, through X's text tokens too. */
|
||||
export function inkUnderFill(selectors: string[], s: Surface): string {
|
||||
if (!selectors.length) return '';
|
||||
const fills = `:is(${selectors.join(',')})`;
|
||||
return `${fills}{background-color:${s.fill} !important;background-image:none !important;--jf-text-color:${s.ink} !important;--x-fg-on-color:${s.ink} !important;color:${s.ink} !important}
|
||||
`
|
||||
+ `${fills} :not(svg *):not(img){color:${s.ink} !important;--jf-text-color:${s.ink} !important}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* X's tooltip (`HoverLabel`): the tooltip surface, its label in the tooltip ink. X paints the label and
|
||||
* its fill through separate classes, which a property-by-property remap paired at 2.7:1 (live 1.0.2).
|
||||
*/
|
||||
export function tooltipCss(s: Surface): string {
|
||||
return `[data-testid="HoverLabel"]{background-color:${s.fill} !important;border-color:${s.line} !important}
|
||||
[data-testid="HoverLabel"],[data-testid="HoverLabel"] *{color:${s.ink} !important}`;
|
||||
}
|
||||
|
||||
/** Page states the theme's CSS keys on (`html[data-wb-app]`, `html[data-wb-chat]`), kept by the engine. */
|
||||
export const THEME_FLAGS = {
|
||||
/** X's app shell (signed in). */
|
||||
|
|
@ -402,6 +482,10 @@ export function buildThemeCss(rules: Iterable<RuleLike>, source: Source, palette
|
|||
const whiteLabels: string[] = [];
|
||||
// Translucent white labels (XChat's time stamp inside a sent bubble: `var(--x-white-60)`).
|
||||
const fadedLabels: string[] = [];
|
||||
// R1: opaque class fills in no palette colour, grouped by the surface they behave like.
|
||||
const surfaces = paletteSurfaces(palette);
|
||||
const knownKeys = new Set([...Object.values(source).flat(), ...X_MEANING_KEYS]);
|
||||
const foreign = new Map<Surface, string[]>();
|
||||
const opaque = (value: string, keys: string[]) => { const parsed = value ? parseColor(value) : null; return !!parsed && parsed.alpha === null && keys.includes(parsed.key); };
|
||||
const faded = (value: string) => { const parsed = value ? parseColor(value) : null; return !!parsed && parsed.key === '255,255,255' && typeof parsed.alpha === 'number' && parsed.alpha > 0; };
|
||||
for (const rule of rules) {
|
||||
|
|
@ -416,6 +500,17 @@ export function buildThemeCss(rules: Iterable<RuleLike>, source: Source, palette
|
|||
if (opaque(color, ['255,255,255'])) whiteLabels.push(selector);
|
||||
else if (faded(color)) fadedLabels.push(selector);
|
||||
}
|
||||
// R1: an opaque fill in no palette colour, under any selector (live: Creator Studio's "New" pill is
|
||||
// `[data-theme="dark"] .jetfuel-style-root .j-j6ij7u11{background-color:rgba(30, 27, 75, var(--jbgo))}`;
|
||||
// a variable alpha is jetfuel's opacity switch, 1 when painted).
|
||||
if (surfaces && !selector.includes('::') && selector.length < 600) {
|
||||
const background = resolve(rule.style.getPropertyValue('background-color'));
|
||||
const parsed = background ? parseColor(background) : null;
|
||||
if (parsed && (parsed.alpha === null || typeof parsed.alpha === 'string') && !knownKeys.has(parsed.key) && parsed.key !== '0,0,0' && parsed.key !== '255,255,255') {
|
||||
const surface = foreignFillSurface(parsed.key, source, surfaces);
|
||||
foreign.set(surface, [...(foreign.get(surface) ?? []), selector]);
|
||||
}
|
||||
}
|
||||
// react-native-web's base classes (`.css-146c3p1{color:rgb(0,0,0)}` on every Text) declare a
|
||||
// framework default, not a palette color. Re-declared with !important it beats every inline
|
||||
// Text color: the liked heart and its count (inline `color: rgb(249, 24, 128)`) turned the page
|
||||
|
|
@ -427,7 +522,10 @@ export function buildThemeCss(rules: Iterable<RuleLike>, source: Source, palette
|
|||
const value = rule.style.getPropertyValue(property);
|
||||
if (!value) continue;
|
||||
const resolved = resolve(value);
|
||||
const mapped = mapColor(property, resolved, source, palette);
|
||||
// X's blue at a low alpha is a hover or selected wash (theme engine v3 R1): the surface's derived
|
||||
// states, never the accent family at that alpha (Windows 98's lavender rows, 1.0.2).
|
||||
const wash = surfaces && property === 'background-color' ? accentWash(resolved, source, surfaces) : null;
|
||||
const mapped = wash ?? mapColor(property, resolved, source, palette);
|
||||
if (!mapped) continue;
|
||||
declarations.push(`${property}:${mapped} !important`);
|
||||
if ((property === 'color' || property === 'fill') && mapColor(property, resolved, source, palette, ['accent'])) keep.push(`${property}:${resolved} !important`);
|
||||
|
|
@ -444,7 +542,7 @@ export function buildThemeCss(rules: Iterable<RuleLike>, source: Source, palette
|
|||
// White labels on accent fills follow the accent: white, or the theme's background when the
|
||||
// accent is light (High Contrast yellow, Terminal green). After the inline rules, so it wins.
|
||||
if (palette.accent) {
|
||||
const label = accentLabel(palette.accent, palette.bg);
|
||||
const label = surfaces?.accentFill.ink ?? accentLabel(palette.accent, palette.bg);
|
||||
// Class or inline fill, class or inline label (the "See new posts" pill is a class fill with an inline label).
|
||||
const fills = [...accentFills, ...source.accent.map(key => inlineSelector('background-color', key))].join(',');
|
||||
const labels = [...whiteLabels, inlineSelector('color', '255,255,255')].join(',');
|
||||
|
|
@ -457,6 +555,15 @@ export function buildThemeCss(rules: Iterable<RuleLike>, source: Source, palette
|
|||
}
|
||||
}
|
||||
if (full) out.push(chatSurfaceCss(full));
|
||||
// R2 after the general remap and the inline rules, so a fill's own ink wins inside it.
|
||||
if (surfaces) {
|
||||
for (const key of X_FOREIGN_INLINE_FILLS) {
|
||||
const surface = foreignFillSurface(key, source, surfaces);
|
||||
foreign.set(surface, [...(foreign.get(surface) ?? []), inlineSelector('background-color', key)]);
|
||||
}
|
||||
for (const [surface, selectors] of foreign) out.push(inkUnderFill(selectors, surface));
|
||||
out.push(tooltipCss(surfaces.tooltip));
|
||||
}
|
||||
out.push(...badges);
|
||||
// Signed-out pages only: their rules carry :has() (X's sign-in buttons), and any :has() over the page
|
||||
// costs every insertion a full restyle, so a signed-in page (engine flag `app`) never gets them.
|
||||
|
|
@ -547,6 +654,10 @@ export function installTheme(win: Window, options: ThemeRuntimeOptions = {}): Th
|
|||
staticCss: (choice, mode) => buildThemeStructureCss(resolveTheme(choice), resolvedTheme(choice, mode), { ...env, icons: choice.icons ?? env.icons, packs: choice.packs }),
|
||||
}, options);
|
||||
try { installIconGate(win); } catch (error) { console.error('[wayBetter for X] icon gate failed', error); }
|
||||
try { installFrameMarker(win, X_FRAMED); } catch (error) { console.error('[wayBetter for X] frame marker failed', error); }
|
||||
try { installLayerGuard(win, { root: '#layers', targets: X_LAYER_TARGETS }); } catch (error) { console.error('[wayBetter for X] layer guard failed', error); }
|
||||
// The bar's label mode (theme engine v3 4.1): measured on X's nav while a bar layout is on.
|
||||
try { installBarMeasurer(win, { nav: 'header[role="banner"] nav[role="navigation"]', item: ':is(a,button)', icon: ':scope > div > div:first-child', label: ':scope > div > div:last-child:not(:first-child)' }); } catch (error) { console.error('[wayBetter for X] bar measurer failed', error); }
|
||||
return {
|
||||
...handle,
|
||||
palette: () => paletteFor(handle.current()),
|
||||
|
|
|
|||
|
|
@ -9,16 +9,22 @@ import type { IconTable } from '../../../../waybetter/packages/runtime/src/theme
|
|||
const NAV = 'header[role="banner"] nav[role="navigation"]';
|
||||
const ACT = 'article[data-testid="tweet"] [role="group"]';
|
||||
const TOOLS = '[data-testid="toolBar"] nav';
|
||||
// X's More menu repeats rail destinations that do not fit the rail (Lists, Communities, Creator Studio).
|
||||
const MENU = '#layers [role="menu"]';
|
||||
|
||||
export const X_ICONS: IconTable = {
|
||||
home: { ctx: `${NAV} [data-testid="AppTabBar_Home_Link"] svg`, group: 'nav', core: true },
|
||||
explore: { ctx: `${NAV} [data-testid="AppTabBar_Explore_Link"] svg`, group: 'nav', core: true },
|
||||
notifications: { ctx: `${NAV} [data-testid="AppTabBar_Notifications_Link"] svg`, group: 'nav', core: true },
|
||||
messages: { ctx: `${NAV} [data-testid="AppTabBar_DirectMessage_Link"] svg`, group: 'nav' },
|
||||
grok: { ctx: `${NAV} a[href="/i/grok"] svg`, group: 'nav' },
|
||||
// The floating Chat and Grok buttons at the bottom right are the same destinations (read live 2026-10-02).
|
||||
messages: { ctx: `${NAV} [data-testid="AppTabBar_DirectMessage_Link"] svg,[data-testid="chat-drawer-main"] svg`, group: 'nav' },
|
||||
grok: { ctx: `${NAV} a[href="/i/grok"] svg,[data-testid="GrokDrawerHeader"] svg`, group: 'nav' },
|
||||
history: { ctx: `${NAV} a[href="/i/history"] svg`, group: 'nav' },
|
||||
studio: { ctx: `${NAV} a[href*="/creators/studio"] svg,${MENU} a[href*="/creators/studio"] svg`, group: 'nav' },
|
||||
articles: { ctx: `${NAV} a[href$="/articles"] svg`, group: 'nav' },
|
||||
bookmarks: { ctx: `${NAV} a[href="/i/bookmarks"] svg`, group: 'nav' },
|
||||
lists: { ctx: `${NAV} a[href$="/lists"] svg`, group: 'nav' },
|
||||
communities: { ctx: `${NAV} a[href$="/communities"] svg`, group: 'nav' },
|
||||
lists: { ctx: `${NAV} a[href$="/lists"] svg,${MENU} a[href$="/lists"] svg`, group: 'nav' },
|
||||
communities: { ctx: `${NAV} a[href$="/communities"] svg,${MENU} a[href$="/communities"] svg`, group: 'nav' },
|
||||
premium: { ctx: `${NAV} a[href^="/i/premium"] svg,${NAV} a[href^="/i/verified"] svg`, group: 'nav' },
|
||||
profile: { ctx: `${NAV} [data-testid="AppTabBar_Profile_Link"] svg`, group: 'nav', core: true },
|
||||
more: { ctx: `${NAV} [data-testid="AppTabBar_More_Menu"] svg`, group: 'nav', core: true },
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ const POST = 'article[data-testid="tweet"]';
|
|||
const COLUMN = '[data-testid="primaryColumn"]';
|
||||
/** The main column on every route but chat (a drawn bar above X's chat app would push its composer out of the window). */
|
||||
// Keyed on the engine's page flag (THEME_FLAGS in theme.ts), never `:has()` over the page: see SIGNED_OUT_ROOT.
|
||||
/** Where an active 98 title bar's gradient ends (98.css `--dialog-blue-light`). */
|
||||
const TITLE_END = '#1084d0';
|
||||
const FRAMED = 'html:not([data-wb-chat]) [data-testid="primaryColumn"]';
|
||||
const RAIL = 'header[role="banner"]';
|
||||
const NAV = `${RAIL} nav[role="navigation"]`;
|
||||
|
|
@ -44,7 +46,10 @@ export const X_PARTS: PartMap = {
|
|||
composerTool: { sel: '[data-testid="toolBar"] nav [role="button"]', text: '[data-testid="toolBar"] nav [role="button"] svg' },
|
||||
// Live 2026-10-01: the painted, bordered card is the grandparent of X's aside/section (a plain div sits
|
||||
// between), or the parent of a `*_sidebar` module (news, scores).
|
||||
sidebarCard: { sel: '[data-testid="sidebarColumn"] div:has(> div > :is(aside[role="complementary"],section[role="region"])),[data-testid="sidebarColumn"] div:has(> [data-testid$="_sidebar"])' },
|
||||
// One module per card: the column holding all the modules has a section's wrapper as a direct child
|
||||
// too, so `div:has(> div > section)` framed the whole column (live 1.0.2). Asides sit two deep,
|
||||
// sections (trends) one deep, the news/scores cards beside a `*_sidebar` tracker.
|
||||
sidebarCard: { sel: '[data-testid="sidebarColumn"] div:not(:has(> :nth-child(3))):has(> div > aside[role="complementary"]),[data-testid="sidebarColumn"] div:has(> section[role="region"]),[data-testid="sidebarColumn"] div:has(> [data-testid$="_sidebar"])' },
|
||||
menu: { sel: '#layers [role="menu"]' },
|
||||
hoverCard: { sel: '#layers [data-testid="HoverCard"]' },
|
||||
// The compose dialog's painted sheet (the child of the modal that has a composer toolbar). Never every modal: the photo
|
||||
|
|
@ -61,10 +66,10 @@ export function xDecorTargets(): DecorTargets<XSkinContext> {
|
|||
moving: `${POST},${NAV} > :is(a,button) > div,[role="tab"],[data-testid$="-follow"],[data-testid="tweetButtonInline"]`,
|
||||
pressable: `${NAV} > :is(a,button),[data-testid="tweetButtonInline"],[data-testid="tweetButton"],[data-testid$="-follow"],${POST} [role="group"] [role="button"]`,
|
||||
chrome: {
|
||||
// A window title bar on the main column, and on each sidebar card with X's own label for it.
|
||||
// A window title bar on the main column (98.css: navy fading to #1084d0, not a flat accent), and on each sidebar card with X's own label for it.
|
||||
titlebar: (title, { colors }) => [
|
||||
`${FRAMED}::before{content:${cssString(title || 'Home')};display:block;order:-1;box-sizing:border-box;height:24px;padding:4px 8px;font:700 12px/16px "Pixelated MS Sans Serif","MS Sans Serif","Tahoma",sans-serif;letter-spacing:.2px;color:#ffffff;background:linear-gradient(90deg, ${colors.inverse}, ${colors.accent});white-space:nowrap;overflow:hidden}`,
|
||||
`[data-testid="sidebarColumn"] :is(aside[role="complementary"],section[role="region"])[aria-label]::before{content:attr(aria-label);display:block;margin:-12px -16px 10px;padding:3px 8px;font:700 12px/16px "Pixelated MS Sans Serif","MS Sans Serif","Tahoma",sans-serif;color:#ffffff;background:linear-gradient(90deg, ${colors.inverse}, ${colors.accent})}`,
|
||||
`${FRAMED}::before{content:${cssString(title || 'Home')};display:block;order:-1;box-sizing:border-box;height:24px;padding:4px 8px;font:700 12px/16px "Pixelated MS Sans Serif","MS Sans Serif","Tahoma",sans-serif;letter-spacing:.2px;color:#ffffff;background:linear-gradient(90deg, ${colors.inverse}, ${TITLE_END});white-space:nowrap;overflow:hidden}`,
|
||||
`[data-testid="sidebarColumn"] :is(aside[role="complementary"],section[role="region"])[aria-label]::before{content:attr(aria-label);display:block;margin:-12px -16px 10px;padding:3px 8px;font:700 12px/16px "Pixelated MS Sans Serif","MS Sans Serif","Tahoma",sans-serif;color:#ffffff;background:linear-gradient(90deg, ${colors.inverse}, ${TITLE_END})}`,
|
||||
].join('\n'),
|
||||
// A newspaper masthead: the theme's title between two rules at the top of the column.
|
||||
masthead: (title, { colors, fonts }) => `${FRAMED}::before{content:${cssString(title || 'The Timeline')};display:block;order:-1;padding:18px 16px 12px;text-align:center;font:700 34px/1.1 ${fonts.heading};letter-spacing:-.01em;color:${colors.text};border-bottom:4px double ${colors.text};margin:0 16px}`,
|
||||
|
|
@ -152,28 +157,37 @@ ${NOT_CHAT} ${inner} > div > div:first-child{flex:1 1 auto !important}
|
|||
${NOT_CHAT} ${inner} > div > div:last-child{flex:0 0 auto !important}
|
||||
/* The same for the groups inside the row (the nav and the Post button sit in full-width wrappers). */
|
||||
${NOT_CHAT} ${inner} > div > div > div{width:auto !important;flex:0 1 auto !important;min-width:0 !important}
|
||||
${NOT_CHAT} ${NAV}{flex-direction:row !important;align-items:center !important;flex-wrap:nowrap !important;gap:2px}
|
||||
${NOT_CHAT} ${NAV}{min-width:0 !important;overflow:hidden}
|
||||
/* Items share the bar like taskbar buttons: each up to 160px, all shrinking alike, the label ending in an
|
||||
ellipsis and then only the icon (live 2026-10-02: X shows up to 12 items, more than a row of whole labels). */
|
||||
${NOT_CHAT} ${NAV} > :is(a,button){width:auto !important;flex:0 1 176px !important;min-width:36px !important;overflow:hidden}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div{padding:8px 8px !important;gap:0 !important;min-width:0 !important;max-width:100% !important;box-sizing:border-box;justify-content:flex-start !important}
|
||||
/* The nav's wrapper takes what is left of the row, so the items spread over the whole bar and no dead
|
||||
space sits between the last item and the account (owner, 1.0.2 at 2000px). */
|
||||
${NOT_CHAT} ${inner} > div > div:first-child > div:has(> nav[role="navigation"]){flex:1 1 0 !important}
|
||||
${edge === 'bottom' ? `/* A taskbar: Start (the logo), the quick launch (Post), then the task buttons. */
|
||||
${NOT_CHAT} ${inner} > div > div:first-child > div:has([data-testid="SideNav_NewTweet_Button"]){order:1}
|
||||
${NOT_CHAT} ${inner} > div > div:first-child > div:has(> nav[role="navigation"]){order:2}
|
||||
` : ''}${NOT_CHAT} ${NAV}{flex-direction:row !important;align-items:center !important;flex-wrap:nowrap !important;gap:2px}
|
||||
${NOT_CHAT} ${NAV}{min-width:0 !important;width:100% !important}
|
||||
/* Items are taskbar buttons. Whether they carry their labels is measured (themeBar.ts, html[data-wb-bar]):
|
||||
with labels, equal widths up to 168px and never narrower than the whole label; without, icon buttons with
|
||||
the label as a tooltip. A label is whole or absent: no ellipsis anywhere in the bar (1.0.2 "H...", "E..."). */
|
||||
${NOT_CHAT} ${NAV} > :is(a,button){position:relative;width:auto !important;flex:1 1 0 !important;max-width:168px !important;min-width:max-content !important}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div{padding:8px 8px !important;gap:0 !important;max-width:100% !important;box-sizing:border-box;justify-content:flex-start !important}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:first-child{flex:none !important}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child){display:block !important;flex:0 1 auto !important;margin-left:8px !important;margin-right:0 !important;padding-right:0 !important;min-width:0 !important;overflow:hidden !important;text-overflow:ellipsis !important;white-space:nowrap !important}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child){display:block !important;flex:none !important;margin-left:8px !important;margin-right:0 !important;padding-right:0 !important;white-space:nowrap !important}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child) span{display:inline !important;white-space:nowrap !important}
|
||||
/* Icons mode (also before the first measurement, so a label is never seen cut). */
|
||||
html:not([data-wb-chat]):not([data-wb-bar="labels"]) ${NAV}{justify-content:${edge === 'bottom' ? 'flex-start' : 'center'} !important}
|
||||
html:not([data-wb-chat]):not([data-wb-bar="labels"]) ${NAV} > :is(a,button){flex:0 0 48px !important;min-width:0 !important}
|
||||
html:not([data-wb-chat]):not([data-wb-bar="labels"]) ${NAV} > :is(a,button) > div{justify-content:center !important}
|
||||
html:not([data-wb-chat]):not([data-wb-bar="labels"]) ${NAV} > :is(a,button) > div > div:last-child:not(:first-child){display:none !important}
|
||||
html:not([data-wb-chat]):not([data-wb-bar="labels"]) ${NAV} > :is(a,button):is(:hover,:focus-visible)::after{content:attr(aria-label);position:absolute;${edge === 'bottom' ? 'bottom' : 'top'}:calc(100% + 6px);left:50%;transform:translateX(-50%);z-index:40;padding:4px 8px;white-space:nowrap;max-width:calc(100vw - 16px);font:12px/16px var(--wb-font-interface, inherit);background-color:${colors.text};color:${colors.bg};pointer-events:none}
|
||||
|
||||
${NOT_CHAT} ${RAIL} [data-testid="SideNav_NewTweet_Button"]{margin:0 0 0 8px !important;width:auto !important;min-height:40px !important;padding:0 16px !important}
|
||||
${NOT_CHAT} ${RAIL} [data-testid="SideNav_NewTweet_Button"]{margin:0 ${edge === 'bottom' ? '0 0 0' : '0 0 8px'} !important;width:auto !important;min-height:40px !important;padding:0 16px !important}
|
||||
${NOT_CHAT} ${RAIL} [data-testid="SideNav_AccountSwitcher_Button"]{margin:0 !important}
|
||||
${NOT_CHAT} main[role="main"]{padding-${edge}:56px !important;align-items:center !important}
|
||||
/* X's floating Grok and Chat buttons (bottom right) ride above a bottom bar instead of over its last items. */
|
||||
${edge === 'bottom' ? `${NOT_CHAT} :is([data-testid="chat-drawer-root"],[data-testid="GrokDrawer"]){transform:translateY(-56px)}` : ''}
|
||||
/* Popovers clear the bar: the layer guard (themeGuards.ts) keeps them inside the viewport minus this inset. */
|
||||
:root{--wb-bar-inset-${edge}:56px}
|
||||
${NOT_CHAT} ${COLUMN} > div > div:first-child{${edge === 'top' ? 'top:56px !important' : ''}}
|
||||
}
|
||||
/* Too narrow for words: the items are icon buttons (a label cut to one letter reads as noise). */
|
||||
@media (min-width:700px) and (max-width:1199px){
|
||||
${NOT_CHAT} ${NAV} > :is(a,button){flex:0 1 48px !important}
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div{justify-content:center !important}
|
||||
/* Only a label is hidden: below 1265px X itself renders the items with their icon alone (live 2026-10-02). */
|
||||
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child){display:none !important}
|
||||
}`;
|
||||
`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
type Density, type FontChoice, type FontRole, type ThemeColors, type ThemeSpec,
|
||||
} from '../../../../waybetter/packages/runtime/src/themeSpec.ts';
|
||||
import type { RuleLike } from '../../../../waybetter/packages/runtime/src/themeRuntime.ts';
|
||||
import { deriveSurfaces, surfacesInputFromV2 } from '../../../../waybetter/packages/runtime/src/themeDerive.ts';
|
||||
|
||||
export type { RuleLike } from '../../../../waybetter/packages/runtime/src/themeRuntime.ts';
|
||||
export * from '../../../../waybetter/packages/runtime/src/themeSpec.ts';
|
||||
|
|
@ -304,6 +305,15 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
|
|||
// and the compose dialog's app bar and sticky toolbar let the silver window show (X paints them its layer color).
|
||||
'[data-testid="sidebarColumn"] div:has(> div > div > div > form[role="search"]){background-color:#c0c0c0 !important;box-shadow:inset -1px -1px #0a0a0a,inset 1px 1px #ffffff,inset -2px -2px #808080,inset 2px 2px #dfdfdf !important}',
|
||||
'#layers [role="dialog"][aria-modal="true"]:has([data-testid="toolBar"]) div:has(:is([data-testid="app-bar-close"],[data-testid="toolBar"])){background-color:transparent !important}',
|
||||
// The taskbar of 98: an etched groove between the quick launch (Post) and the task buttons, and the
|
||||
// account in a sunken tray at the right end, where the clock sits (98.css status-bar field).
|
||||
'@media (min-width:700px){html:not([data-wb-chat]) header[role="banner"] div:has(> nav[role="navigation"]){padding:0 0 0 6px !important;margin:0 0 0 2px !important;box-shadow:inset 1px 0 #808080,inset 2px 0 #ffffff !important}',
|
||||
'html:not([data-wb-chat]) header[role="banner"] > div > div > div > div:last-child{height:40px !important;align-self:center !important;padding:0 4px !important;background-color:#c0c0c0 !important;box-shadow:inset -1px -1px #ffffff,inset 1px 1px #808080 !important}',
|
||||
'html:not([data-wb-chat]) header[role="banner"] [data-testid="SideNav_AccountSwitcher_Button"]{border-radius:0 !important;padding:4px !important}}',
|
||||
// Row hover: X tints a hovered post or notification with its blue at a low alpha, which became a lavender
|
||||
// wash of the navy accent (owner, 1.0.2). 98 has no hover tint; a list row it is not focused on is
|
||||
// button-face silver, the inactive selection of a 98 list view.
|
||||
'main[role="main"] [data-testid="cellInnerDiv"] :is(article,[role="link"]):hover,main[role="main"] [data-testid="cellInnerDiv"] :is(article,[role="link"]):hover > div{background-color:#c0c0c0 !important}',
|
||||
].join('\n'),
|
||||
variants: { nav: 'bottom' },
|
||||
components: {
|
||||
|
|
@ -326,7 +336,7 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
|
|||
dividers: { style: 'solid', color: 'border', width: 1 }, chrome: { kind: 'titlebar', title: 'Timeline - wayBetter' },
|
||||
focusRing: { width: 2, style: 'dotted', color: 'text', offset: 1 }, scrollbar: { style: 'classic', track: 'elevated' },
|
||||
},
|
||||
icons: { pack: 'wb-pixel' },
|
||||
icons: { pack: 'retro-98' },
|
||||
},
|
||||
paper: {
|
||||
layout: { column: 640, sidebar: 330, density: 'comfortable', cards: false, frame: false },
|
||||
|
|
@ -639,10 +649,12 @@ export function buildStructureCss(rules: Iterable<RuleLike>, theme: ThemeSpec, c
|
|||
out.push(`@media (prefers-reduced-motion:no-preference){${TWEET},${CELL},[role="button"],a[role="link"],a[role="tab"],[data-testid="UserCell"]{transition:background-color ${t},box-shadow ${t},transform ${t},border-color ${t},color ${t}}}`);
|
||||
}
|
||||
if (effects.hover === 'lift' && layout.cards) out.push(`@media (prefers-reduced-motion:no-preference){${MAIN} ${CELL} ${TWEET}:hover{transform:translateY(-1px);box-shadow:0 6px 22px ${rgba('#000000', 0.1)}}}`);
|
||||
if (effects.hover === 'tint') out.push(`${TWEET}:hover{background-color:${rgba(colors.accent, 0.035)} !important}`);
|
||||
if (effects.hover === 'glow') {
|
||||
out.push(`[data-testid="tweetText"],[data-testid="User-Name"] span{text-shadow:0 0 6px ${rgba(colors.text, 0.35)}}`);
|
||||
out.push(`${TWEET}:hover{background-color:${rgba(colors.accent, 0.05)} !important;box-shadow:inset 2px 0 0 ${colors.accent}}`);
|
||||
// Row hover is the content surface's derived hover (theme engine v3 3.2): a neutral step that keeps
|
||||
// every ink readable, never an accent wash. `glow` keeps its text glow and its accent edge mark.
|
||||
if (effects.hover === 'tint' || effects.hover === 'glow') {
|
||||
const hover = deriveSurfaces(surfacesInputFromV2(colors)).content.hover;
|
||||
if (effects.hover === 'glow') out.push(`[data-testid="tweetText"],[data-testid="User-Name"] span{text-shadow:0 0 6px ${rgba(colors.text, 0.35)}}`);
|
||||
out.push(`${TWEET}:hover{background-color:${hover} !important${effects.hover === 'glow' ? `;box-shadow:inset 2px 0 0 ${colors.accent}` : ''}}`);
|
||||
}
|
||||
if (effects.crt) {
|
||||
out.push(`body::after{content:"";position:fixed;inset:0;z-index:2147483000;pointer-events:none;background:repeating-linear-gradient(0deg,${rgba('#000000', 0.14)} 0 1px,transparent 1px 3px),radial-gradient(ellipse at center,transparent 62%,${rgba('#000000', 0.38)})}`);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
// X's mode and the owner's icon choice, so X inserting rules never rebuilds it.
|
||||
|
||||
import { compileComponents, type RoleColors } from '../../../../waybetter/packages/runtime/src/themeComponents.ts';
|
||||
import { inkOnEvery, TARGET } from '../../../../waybetter/packages/runtime/src/themeInk.ts';
|
||||
import { CLAMPED_ATTR, frameMarkerCss, layerGuardCss } from '../../../../waybetter/packages/runtime/src/themeGuards.ts';
|
||||
import { compileDecor } from '../../../../waybetter/packages/runtime/src/themeDecor.ts';
|
||||
import { ICON_GROUPS, compileIcons, createIconCatalog, iconGroupsPresent, normalizeIconChoice, type IconChoice, type IconGroup, type IconPack } from '../../../../waybetter/packages/runtime/src/themeIcons.ts';
|
||||
import { compileVariants, resolveVariants } from '../../../../waybetter/packages/runtime/src/themeVariants.ts';
|
||||
|
|
@ -39,6 +41,7 @@ export function buildStructureCss(theme: ThemeSpec, resolved: ResolvedTheme, env
|
|||
const f = resolved.fonts!;
|
||||
const fonts = { interface: f.interface.stack, post: f.post.stack, heading: f.heading.stack, numbers: f.numbers.stack, mono: f.mono.stack, chrome: f.chrome.stack, dialog: f.dialog.stack };
|
||||
const out: string[] = [];
|
||||
out.push(X_LAYER_CSS, frameMarkerCss());
|
||||
if (theme.components) {
|
||||
const { values, rules } = compileComponents(theme.components, X_PARTS, { colors, fonts });
|
||||
if (values.length) out.push(`:where(:root){${values.join(';')}}`);
|
||||
|
|
@ -49,12 +52,23 @@ export function buildStructureCss(theme: ThemeSpec, resolved: ResolvedTheme, env
|
|||
const skin: XSkinContext = { colors, fonts, labels, brackets: theme.variants?.actions === 'labels' && /\bmono\b|Mono/.test(fonts.interface) };
|
||||
out.push(...compileVariants(resolveVariants(theme.variants, { allowed: env.layout !== false }), X_SKINS, skin));
|
||||
if (theme.decor) out.push(...compileDecor(theme.decor, xDecorTargets(), skin));
|
||||
// Action colors: the set state of like, repost and bookmark, and the reply hover.
|
||||
const actions = theme.colors?.actions;
|
||||
if (actions) {
|
||||
const act = (ids: string, color: string | undefined) => color ? `article[data-testid="tweet"] [role="group"] :is(${ids}) :is(div,span,svg){color:${color} !important}` : '';
|
||||
out.push(act('[data-testid="unlike"]', actions.like), act('[data-testid="unretweet"]', actions.repost), act('[data-testid="removeBookmark"]', actions.bookmark),
|
||||
actions.reply ? `article[data-testid="tweet"] [role="group"] [data-testid="reply"]:hover :is(div,span,svg){color:${actions.reply} !important}` : '');
|
||||
// Action colors: the set state of like, repost and bookmark, and the reply hover. Meaning colours
|
||||
// (theme engine v3 3.6, R4): X's like pink and repost green, or the theme's own, keep their hue and
|
||||
// move in lightness only, to 3:1 as icons and 4.5:1 as counts on the post's ground (the like count
|
||||
// was 3.84:1 on white).
|
||||
if (theme.colors) {
|
||||
const actions = theme.colors.actions ?? {};
|
||||
const grounds = [colors.bg, colors.surface];
|
||||
const act = (ids: string, color: string | undefined) => {
|
||||
if (!color) return '';
|
||||
const icon = inkOnEvery(grounds, color, TARGET.nonText, { keepHue: true }).ink;
|
||||
const count = inkOnEvery(grounds, color, TARGET.text, { keepHue: true }).ink;
|
||||
const base = `article[data-testid="tweet"] [role="group"] :is(${ids})`;
|
||||
return `${base} :is(div,svg){color:${icon} !important}
|
||||
${base} span{color:${count} !important}`;
|
||||
};
|
||||
out.push(act('[data-testid="unlike"]', actions.like ?? '#f91880'), act('[data-testid="unretweet"]', actions.repost ?? '#00ba7c'), act('[data-testid="removeBookmark"]', actions.bookmark),
|
||||
actions.reply ? `article[data-testid="tweet"] [role="group"] [data-testid="reply"]:hover :is(div,span,svg){color:${inkOnEvery(grounds, actions.reply, TARGET.nonText, { keepHue: true }).ink} !important}` : '');
|
||||
}
|
||||
const pack = catalog.resolve(env.icons, theme.icons);
|
||||
out.push(compileIcons(pack, env.icons === 'site' ? null : theme.icons, X_ICONS, { colors, gate: ICON_GATE, allowed: env.iconsAllowed !== false }));
|
||||
|
|
@ -84,6 +98,18 @@ export function installIconGate(win: Window): () => void {
|
|||
return () => { win.clearInterval(timer); seen = new Set(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* X's popovers for the layer guard (theme engine v3 4.2): the positioned box of a hover card or account
|
||||
* menu, menus, dropdowns and tooltips, inside `#layers`.
|
||||
*/
|
||||
export const X_LAYER_TARGETS = ['[data-testid="hoverCardParent"]', '[role="menu"]', '[role="listbox"]', '[data-testid="Dropdown"]', '[data-testid="HoverLabel"]'];
|
||||
/** The guard's static rules, and X's caret (it points at the anchor the shift moved away from). */
|
||||
export const X_LAYER_CSS = `${layerGuardCss()}
|
||||
[${CLAMPED_ATTR}] [data-testid="HoverCard"] > svg:first-child{visibility:hidden !important}`;
|
||||
|
||||
/** X's framed parts for the frame marker (theme engine v3 4.3): sidebar cards and panels in the sidebar. */
|
||||
export const X_FRAMED = { scopes: ['[data-testid="sidebarColumn"]'], parts: [X_PARTS.sidebarCard?.sel, X_PARTS.panel?.sel].filter(Boolean).join(',') };
|
||||
|
||||
export { normalizeIconChoice };
|
||||
/** The choice passed to `buildStructureCss` when nothing was picked. */
|
||||
export const defaultStructureEnv = (): StructureEnv => ({ icons: 'theme' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue