// X-shaped fixture pages for the visual-bug audit (scripts/visual-bugs.mjs). Unlike the theme // matrix fixtures (color/contrast approximations), these reproduce the LAYOUT mechanics of x.com's // markup, because the bugs they guard against are layout bugs: react-native-web's atomic classes // with their real rules (`css-175oi2r` boxes never shrink unless `r-1wbh5a2` says so, the time box // `r-1q142lx` never shrinks, names/handles ellipsize, headers are space-between rows with the // Grok / ··· buttons on the right), X's testids and landmarks (User-Name, caret, role=group action // bars, the focal post's "time · date · N Views" line, sidebar modules inside bordered cards, // `chat-drawer-root` bottom right, the inline reply box) and X's width breakpoints (nav 275/88, // right column only from 1000px, 290px below 1078, mobile bars below 500px). // Passing here is not a live X test. export const PALETTES = { light: { bg: '#ffffff', text: 'rgb(15, 20, 25)', muted: 'rgb(83, 100, 113)', border: 'rgb(239, 243, 244)', accent: 'rgb(29, 155, 240)', hover: 'rgba(15, 20, 25, 0.1)', scheme: 'light' }, dark: { bg: '#000000', text: 'rgb(231, 233, 234)', muted: 'rgb(113, 118, 123)', border: 'rgb(47, 51, 54)', accent: 'rgb(29, 155, 240)', hover: 'rgba(231, 233, 234, 0.1)', scheme: 'dark' }, }; const X_CSS = ` html { font-size: 15px; -webkit-text-size-adjust: 100%; } html, body { margin: 0; min-height: 100%; } body { font-family: TwitterChirp, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow-y: scroll; } a { color: inherit; } /* react-native-web base boxes (verbatim rules) */ .css-175oi2r { align-items: stretch; background-color: rgba(0,0,0,0); border: 0 solid black; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; list-style: none; margin: 0; min-height: 0; min-width: 0; padding: 0; position: relative; text-decoration: none; z-index: 0; } .css-146c3p1 { background-color: rgba(0,0,0,0); border: 0 solid black; box-sizing: border-box; color: rgb(0,0,0); display: inline; font: 14px -apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; list-style: none; margin: 0; padding: 0; position: relative; text-align: inherit; text-decoration: none; white-space: pre-wrap; overflow-wrap: break-word; } .css-1jxf684 { background-color: rgba(0,0,0,0); border: 0 solid black; box-sizing: border-box; color: inherit; display: inline; font: inherit; list-style: none; margin: 0; padding: 0; position: relative; text-align: inherit; text-decoration: none; white-space: inherit; overflow-wrap: break-word; } button.css-175oi2r { cursor: pointer; font: inherit; color: inherit; } /* atomic classes used below (rule per class, as X ships them) */ .r-18u37iz { flex-direction: row; } .r-1wbh5a2 { flex-shrink: 1; } .r-1q142lx { flex-shrink: 0; } .r-dnmrzs { max-width: 100%; } .r-1wtj0ep { justify-content: space-between; } .r-16y2uox { flex-grow: 1; } .r-1udh08x { overflow: hidden; } .r-bcqeeo { min-width: 0; } .r-3s2u2q { white-space: nowrap; } .r-1udbk01 { text-overflow: ellipsis; } .r-qvutc0 { overflow-wrap: break-word; } .r-poiln3 { font-family: inherit; } .r-37j5jr { font-family: TwitterChirp, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } .r-a023e6 { font-size: 15px; } .r-rjixqe { line-height: 20px; } .r-1inkyih { font-size: 17px; } .r-16dba41 { font-weight: 400; } .r-b88u0q { font-weight: 700; } .r-adyw6z { font-size: 20px; } .r-135wba7 { line-height: 24px; } .r-1awozwy { align-items: center; } .r-1d09ksm { align-items: baseline; } .r-k4xj1c { align-items: flex-start; } .r-xoduu5 { display: inline-flex; } .r-6koalj { display: flex; } .r-s1qlax { padding-left: 4px; padding-right: 4px; } .r-13hce6t { margin-left: 4px; } .r-1kkk96v { margin-left: 8px; } .r-1h0z5md { justify-content: flex-start; } .r-1777fci { justify-content: center; } .r-13awgt0 { flex: 1 1 0; } .r-sdzlij { border-radius: 9999px; } .r-1loqt21 { cursor: pointer; } .r-zl2h9q { margin-bottom: 2px; } .r-1s2bzr4 { margin-top: 12px; } .r-18kxxzh { flex-basis: 40px; } .r-1wron08 { margin-right: 8px; } .r-1iusvr4 { flex-basis: 0; } .r-kzbkwu { padding-bottom: 12px; } .r-ttdzmv { padding-top: 12px; } .r-1ny4l3l { outline-style: none; } .r-o7ynqc { transition-duration: .2s; } .r-clp7b1 { margin: -4px; } .r-1d2f490 { left: 0; } .r-u8s1d { position: absolute; } .r-1ifxtd0 { margin-bottom: 16px; } .r-1phboty { border-style: solid; } .r-rs99b7 { border-width: 1px; } .r-1867qdf { border-radius: 16px; } .r-gtdqiz { position: sticky; } .r-1hycxz { width: 350px; } .r-aqfbo4 { background-color: transparent; } .r-1xcajam { position: fixed; } .r-1ye8kvj { max-width: 600px; } .r-kemksi { background-color: var(--x-bg); } .r-1kqtdi0 { border-color: var(--x-border); } .r-qklmqi { border-bottom-width: 1px; } .r-1igl3o0 { border-bottom-style: solid; } .r-12kyg2d { margin-top: 16px; margin-bottom: 16px; } .r-1a11zyx { position: relative; } .r-1b43r93 { font-size: 14px; } .r-1cwl3u0 { line-height: 16px; } .r-n6v787 { font-size: 13px; } .r-1h3ijdo { height: 53px; } .r-ymttw5 { padding-left: 16px; padding-right: 16px; } .r-1w6e6rj { flex-wrap: wrap; } svg.r-icon { width: 18.75px; height: 18.75px; fill: currentColor; flex-shrink: 0; } /* page scaffolding (X's layout rules at each breakpoint) */ #react-root { display: flex; flex-direction: row; justify-content: center; min-height: 100vh; } header[role="banner"] { display: flex; flex-grow: 1; align-items: flex-end; z-index: 3; } header[role="banner"] > .nav { position: sticky; top: 0; height: 100vh; width: 275px; box-sizing: border-box; padding: 0 12px; gap: 4px; } main[role="main"] { display: flex; flex-grow: 1; flex-shrink: 1; min-width: 0; align-items: flex-start; } header[role="banner"] { flex-shrink: 0; } main[role="main"] > div { width: 990px; } [data-testid="primaryColumn"] { width: 100%; max-width: 600px; min-height: 100vh; border-left: 1px solid var(--x-border); border-right: 1px solid var(--x-border); flex-shrink: 1; } [data-testid="sidebarColumn"] { width: 350px; margin-right: 10px; } [data-testid="sidebarColumn"] .search-wrap { position: sticky; top: 0; padding: 4px 0 12px; background: var(--x-bg); z-index: 2; } .fx-avatar { width: 40px; height: 40px; border-radius: 9999px; background: linear-gradient(135deg, #7856ff, #1d9bf0); flex-shrink: 0; } .fx-media { margin-top: 12px; height: 180px; border-radius: 16px; border: 1px solid var(--x-border); background: linear-gradient(135deg, rgba(29,155,240,.35), rgba(120,86,255,.25)); } .fx-banner { height: 150px; background: linear-gradient(135deg, #22303c, #1d9bf0); } [data-testid="BottomBar"], [data-testid="TopNavBar"] { display: none; } [data-testid="chat-drawer-root"] { position: fixed; right: 20px; bottom: 20px; z-index: 5; } [data-testid="chat-drawer-root"] button { width: 56px; height: 56px; border-radius: 16px; border: 1px solid var(--x-border); background: var(--x-bg); box-shadow: 0 0 12px rgba(101,119,134,.25); align-items: center; justify-content: center; } @media (max-width: 1264px) { header[role="banner"] > .nav { width: 88px; } .nav .fx-label { display: none; } } /* X renders other width classes below 1078px (layout is JS-driven): 290px wide right column. */ .r-sb290 { width: 290px; } @media (max-width: 1077px) { main[role="main"] > div { width: min(920px, calc(100vw - 105px)); } [data-testid="sidebarColumn"] { width: 290px; } } @media (max-width: 999px) { main[role="main"] > div { width: 600px; } [data-testid="sidebarColumn"] { display: none; } } @media (max-width: 699px) { main[role="main"] > div { width: 100%; } main[role="main"] { flex-grow: 1; } } @media (max-width: 499px) { header[role="banner"] { display: none; } [data-testid="primaryColumn"] { border: 0; max-width: none; } [data-testid="BottomBar"] { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 53px; border-top: 1px solid var(--x-border); background: var(--x-bg); z-index: 4; flex-direction: row; justify-content: space-around; align-items: center; } [data-testid="chat-drawer-root"] { bottom: 73px; } } `; const ICON = { reply: 'M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01z', retweet: 'M4.5 3.88l4.432 4.14-1.364 1.46L5.5 7.55V16c0 1.1.896 2 2 2H13v2H7.5c-2.209 0-4-1.79-4-4V7.55L1.432 9.48.068 8.02 4.5 3.88zM16.5 6H11V4h5.5c2.209 0 4 1.79 4 4v8.45l2.068-1.93 1.364 1.46-4.432 4.14-4.432-4.14 1.364-1.46 2.068 1.93V8c0-1.1-.896-2-2-2z', like: 'M16.697 5.5c-1.222-.06-2.679.51-3.89 2.16l-.805 1.09-.806-1.09C9.984 6.01 8.526 5.44 7.304 5.5c-1.243.07-2.349.78-2.91 1.91-.552 1.12-.633 2.78.479 4.82 1.074 1.97 3.257 4.27 7.129 6.61 3.87-2.34 6.052-4.64 7.126-6.61 1.111-2.04 1.03-3.7.477-4.82-.561-1.13-1.666-1.84-2.908-1.91z', views: 'M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z', bookmark: 'M4 4.5C4 3.12 5.119 2 6.5 2h11C18.881 2 20 3.12 20 4.5v18.44l-8-5.71-8 5.71V4.5z', share: 'M12 2.59l5.7 5.7-1.41 1.42L13 6.41V16h-2V6.41l-3.3 3.3-1.41-1.42L12 2.59zM21 15l-.02 3.51c0 1.38-1.12 2.49-2.5 2.49H5.5C4.11 21 3 19.88 3 18.5V15h2v3.5c0 .28.22.5.5.5h12.98c.28 0 .5-.22.5-.5L19 15h2z', caret: 'M3 12c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2zm9 2c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm7 0c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z', grok: 'M2.205 7.423L11.745 21h4.241L6.446 7.423H2.204zm4.237 7.541L2.2 21h4.243l2.12-3.017-2.121-3.02zM16.957 0L9.624 10.435l2.122 3.02L21.2 0h-4.243zm.767 6.456V21H21.2V1.51l-3.476 4.946z', chat: 'M1.998 5.5c0-1.381 1.119-2.5 2.5-2.5h15c1.381 0 2.5 1.119 2.5 2.5v13c0 1.381-1.119 2.5-2.5 2.5h-15c-1.381 0-2.5-1.119-2.5-2.5v-13z', verified: 'M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816z', }; const svg = (d, extra = '') => ``; const text = (content, color, cls = 'r-a023e6 r-rjixqe r-16dba41') => `