mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 21:15:57 +03:00
fix(site): fix production colours and bring in the latest site fixes (#62285)
This commit is contained in:
committed by
GitHub
Unverified
parent
e803323c13
commit
8923a8d708
@@ -38,6 +38,7 @@ await Bun.$`vite build`.cwd(root).env(env)
|
||||
await Bun.$`bun ./src/docs/script/build.ts --mode ${mode}`.cwd(root).env(env)
|
||||
await Bun.$`bun ./script/check-server-bundle.ts`.cwd(root).env(env)
|
||||
await Bun.$`bun ./script/check-client-bundle.ts`.cwd(root).env(env)
|
||||
await Bun.$`bun ./script/check-css-output.ts`.cwd(root).env(env)
|
||||
|
||||
// @cloudflare/config's file loader refuses Bun; it resolves an imported config the same way.
|
||||
const parsed = await resolveAndParseConfig((await import("../cloudflare.config")).default, { isPreview: false, mode })
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// Fails the build when the production CSS lowers light-dark(). The site's colour tokens are
|
||||
// light-dark() pairs defined once on the site root, and a card or band that forces the dark scheme
|
||||
// (color-scheme: dark) relies on them resolving there. The minifier's fallback for older browsers
|
||||
// (--lightningcss-light/--lightningcss-dark variables) freezes every token at the root's theme, so
|
||||
// the production page silently differs from the development server. vite.config.ts's cssTarget
|
||||
// keeps light-dark() native; this guards against that target being lowered again.
|
||||
// Run after `vite build`, optionally with the output directory: `bun script/check-css-output.ts .output`.
|
||||
import path from "node:path"
|
||||
import { Glob } from "bun"
|
||||
|
||||
const root = path.resolve(process.argv[2] ?? path.join(import.meta.dir, "..", ".output"), "public")
|
||||
const lowered: string[] = []
|
||||
for await (const file of new Glob("**/*.css").scan(root)) {
|
||||
if ((await Bun.file(path.join(root, file)).text()).includes("--lightningcss-")) lowered.push(file)
|
||||
}
|
||||
if (lowered.length > 0) {
|
||||
console.error(`light-dark() was lowered (--lightningcss-* variables) in:\n${lowered.join("\n")}`)
|
||||
process.exit(1)
|
||||
}
|
||||
console.log("Production CSS keeps light-dark() native.")
|
||||
@@ -687,7 +687,7 @@ function LegalHistory(props: { document: LegalDocumentContent; onBack?: () => vo
|
||||
</For>
|
||||
</ol>
|
||||
<p>
|
||||
Follow changes to every legal document in a feed reader: <a href={feed}>RSS feed</a>.
|
||||
Follow changes to every legal document with the <a href={feed}>RSS feed</a>.
|
||||
</p>
|
||||
</section>
|
||||
)
|
||||
|
||||
@@ -180,13 +180,27 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 16px, like the icons on the menu button's column. It points to the inline end while closed
|
||||
(right, or left in right-to-left pages) and turns to point down when open. */
|
||||
[data-slot="chevron"] {
|
||||
transition: scale 200ms var(--ease-out);
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
rotate: -90deg;
|
||||
transition: rotate 180ms var(--ease-out);
|
||||
|
||||
html[dir="rtl"] & {
|
||||
rotate: 90deg;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[open] summary [data-slot="chevron"] {
|
||||
scale: 1 -1;
|
||||
&[open] summary [data-slot="chevron"],
|
||||
html[dir="rtl"] &[open] summary [data-slot="chevron"] {
|
||||
rotate: 0deg;
|
||||
}
|
||||
|
||||
summary [data-slot="label"] {
|
||||
@@ -221,9 +235,11 @@
|
||||
display: block;
|
||||
background: var(--bg);
|
||||
|
||||
/* One line above the bar and one below, each across the whole screen. The top line sits on the
|
||||
row above the bar: stuck, that row is the top bar's own bottom hairline, which paints over it,
|
||||
so there's only ever one line there and nothing moves when the bar sticks. */
|
||||
/* At rest the bar has no lines. Pinned (data-stuck, from ContentsMenu), a line fades in above
|
||||
and below it, each across the whole screen. The top line sits on the row above the bar, where
|
||||
the bar above (the top bar's hairline, or the legal tabs' divider) already draws its own and
|
||||
paints over it, so there's only ever one line there. Nothing moves when they show; the bar's
|
||||
background stays a hard cut. */
|
||||
summary::before,
|
||||
summary::after {
|
||||
content: "";
|
||||
@@ -232,6 +248,17 @@
|
||||
height: 1px;
|
||||
background: var(--border);
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: opacity 150ms ease;
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-stuck] summary::before,
|
||||
&[data-stuck] summary::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
summary::before {
|
||||
@@ -252,7 +279,7 @@
|
||||
edge), like the accordions' plus. */
|
||||
@media (max-width: 40rem) {
|
||||
summary [data-slot="chevron"] {
|
||||
margin-inline-end: calc(34px - var(--edge) - 6px);
|
||||
margin-inline-end: calc(34px - var(--edge) - 8px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,11 +120,29 @@ export function ContentsMenu(props: { items: ContentsItem[] }) {
|
||||
menu.open = false
|
||||
menu.querySelector("summary")?.focus()
|
||||
}
|
||||
// Pinned (its top at its sticky offset, once the page has scrolled), the bar shows its lines
|
||||
// (data-stuck, on-this-page.css). Measured on scroll, so it works where CSS scroll-state queries
|
||||
// don't (WebKit).
|
||||
let frame = 0
|
||||
const stuck = () => {
|
||||
cancelAnimationFrame(frame)
|
||||
frame = requestAnimationFrame(() => {
|
||||
if (!menu) return
|
||||
const top = parseFloat(getComputedStyle(menu).top)
|
||||
menu.toggleAttribute("data-stuck", window.scrollY > 0 && menu.getBoundingClientRect().top <= top + 0.5)
|
||||
})
|
||||
}
|
||||
document.addEventListener("pointerdown", outside)
|
||||
document.addEventListener("keydown", escape)
|
||||
window.addEventListener("scroll", stuck, { passive: true })
|
||||
window.addEventListener("resize", stuck)
|
||||
stuck()
|
||||
onCleanup(() => {
|
||||
cancelAnimationFrame(frame)
|
||||
document.removeEventListener("pointerdown", outside)
|
||||
document.removeEventListener("keydown", escape)
|
||||
window.removeEventListener("scroll", stuck)
|
||||
window.removeEventListener("resize", stuck)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@
|
||||
|
||||
/* Divided like /press's boilerplate accordion (press/index.css): a 1px line between rows and
|
||||
one under the last, each title evenly spaced between its lines. */
|
||||
> li + li {
|
||||
> li + li,
|
||||
> li:first-child {
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
@@ -84,6 +85,13 @@
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* With a line above the first row too, it is padded like the others. */
|
||||
&& > li:first-child [data-slot="faq-question"] {
|
||||
--padding-top: 1rem;
|
||||
min-height: var(--row-height);
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&& [data-slot="faq-question"] {
|
||||
--padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
|
||||
@@ -71,12 +71,22 @@
|
||||
max-height: 100%;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
/* The "[n]" column centres on the top bar's logo mark above it: the mark's box starts at
|
||||
--edge and is --phone-logo-height × 4/5 wide, and "[n]" is three mono characters (3ch)
|
||||
wide, so the list starts half of each before the mark's centre. The labels keep their
|
||||
gap after the numbers, so they share one column too. Mirrored right to left. */
|
||||
--menu-start: calc(var(--edge) + var(--phone-logo-height, 30px) * 2 / 5 - 1.5ch);
|
||||
padding: 0.5rem calc(var(--edge) + env(safe-area-inset-right, 0px))
|
||||
calc(1.5rem + env(safe-area-inset-bottom, 0px)) calc(var(--edge) + env(safe-area-inset-left, 0px));
|
||||
calc(1.5rem + env(safe-area-inset-bottom, 0px)) calc(var(--menu-start) + env(safe-area-inset-left, 0px));
|
||||
font-family: var(--font-mono);
|
||||
/* The sheet's one job is this list: a step above the body copy, like a native menu. */
|
||||
font-size: var(--fs-large);
|
||||
line-height: 24px;
|
||||
|
||||
&:dir(rtl) {
|
||||
padding-left: calc(var(--edge) + env(safe-area-inset-left, 0px));
|
||||
padding-right: calc(var(--menu-start) + env(safe-area-inset-right, 0px));
|
||||
}
|
||||
}
|
||||
|
||||
[data-slot="panel"] > ul > li {
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
between them. */
|
||||
--feature-row-gap: 2rem;
|
||||
--feature-step: 1.75rem;
|
||||
/* On phones, the room the previous and next chevrons take at the breadcrumb row's end: two 2.75rem
|
||||
targets, less the 0.75rem pulled into the page edge, and a 0.5rem gap before them. */
|
||||
--cycle-room: calc(2 * 2.75rem - 0.75rem + 0.5rem);
|
||||
|
||||
/* Sits in the logo row so the hero video starts at the top of the content column. */
|
||||
[data-component="breadcrumb"] {
|
||||
@@ -19,18 +22,32 @@
|
||||
line-height: 1.2;
|
||||
|
||||
/* Small screens: the header holds the logo and menu, so the breadcrumb is the first row of
|
||||
the page. The chevrons get 44px targets; the last one still ends on the page edge. */
|
||||
the page. Its end leaves room for the previous and next chevrons (below), and a long name
|
||||
shortens with an ellipsis rather than run under them. */
|
||||
@media (max-width: 60rem) {
|
||||
position: static;
|
||||
height: 2.75rem;
|
||||
/* 0.5rem under the top bar, wherever the content line sits. */
|
||||
margin: calc(var(--topbar-height) + 0.5rem - var(--content-top)) 0 0.5rem;
|
||||
padding-inline-end: var(--cycle-room);
|
||||
|
||||
> a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
> * {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
[aria-current="page"] {
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,25 +89,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Small screens: in the top bar, left of its GitHub mark. The bar's right padding, the menu
|
||||
button (2.75rem, pulled 0.75rem into the padding) and the mark's 0.5rem gap and 2.5rem width
|
||||
put the mark's left edge 5rem in from the padding; the targets grow to 36px for touch. */
|
||||
/* Small screens: at the end of the breadcrumb row, not in the top bar, which holds just the
|
||||
logo, the GitHub mark and the menu as on other pages. In the flow right after the breadcrumb,
|
||||
pulled up over its row (its 2.75rem and 0.5rem gap) and taking the gap back below, so the page
|
||||
below doesn't move. Two 44px targets; the next chevron is pulled 0.75rem into the page edge,
|
||||
like the menu button, so its centre is on the menu button's centre. They scroll with the row. */
|
||||
@media (max-width: 60rem) {
|
||||
top: calc(var(--banner-offset, 0px) + env(safe-area-inset-top, 0px) + var(--topbar-height) / 2 - 1.125rem);
|
||||
inset-inline-end: calc(var(--edge) + env(safe-area-inset-right, 0px) + 5.5rem);
|
||||
z-index: 11;
|
||||
position: static;
|
||||
width: fit-content;
|
||||
margin-block: calc(-2.75rem - 0.5rem) 0.5rem;
|
||||
margin-inline: auto -0.75rem;
|
||||
|
||||
a {
|
||||
position: relative;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
|
||||
/* An invisible band above and below makes each target 44px tall. */
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -0.25rem 0;
|
||||
}
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,16 +57,17 @@
|
||||
grid-auto-columns: calc((100% + var(--edge) - var(--gaps) * var(--gutter)) / var(--visible));
|
||||
}
|
||||
|
||||
/* The carousel's cards stop short of the small viewport's bottom (100svh, with the browser's
|
||||
toolbars showing) at first load: below the home hero (24 to 28rem down, longer in German) with room under the
|
||||
button. The media keeps its full width (a set width, so the cap shortens it rather than
|
||||
narrowing it) and crops a little more of its height, never under 18rem,
|
||||
so short phones see the whole card once it scrolls into place. */
|
||||
/* The carousel's cards are 4:5, or shorter where that would run past the small viewport
|
||||
(100svh, the browser's toolbars showing): then they end 16px above its bottom at first load,
|
||||
measured from where the cards start (--card-top, set before first paint by the home page;
|
||||
28rem until then). The media keeps its full width (a set width, so the cap shortens it
|
||||
rather than narrowing it) and crops a little more of its height, never under 18rem, so short
|
||||
phones see the whole card once it scrolls into place. */
|
||||
:is([data-component="products"]:not([data-layout="grid"]), [data-component="products-skeleton"])
|
||||
[data-component="product-card"]
|
||||
[data-slot="media"] {
|
||||
width: 100%;
|
||||
max-height: max(18rem, calc(100svh - 28rem));
|
||||
max-height: max(18rem, calc(100svh - var(--card-top, 28rem) - 1rem));
|
||||
}
|
||||
|
||||
/* The carousel card's buttons sit over its dark media in both themes, so they are the light
|
||||
|
||||
@@ -2375,9 +2375,9 @@ html:has([data-site][data-theme="dark"]) {
|
||||
}
|
||||
}
|
||||
|
||||
/* The docs section menu: like the Contents row, no lines (it doesn't pin), and a 16px chevron on
|
||||
the menu button's column that points to the inline end closed and down open. */
|
||||
[data-component="section-nav"] {
|
||||
border-block: 1px solid var(--border);
|
||||
|
||||
[data-slot="section-toggle"] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -2389,11 +2389,24 @@ html:has([data-site][data-theme="dark"]) {
|
||||
color: var(--text-strong);
|
||||
|
||||
[data-slot="chevron"] {
|
||||
/* The chevron flips instantly when the menu opens. */
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-inline-end: calc(34px - var(--edge) - 8px);
|
||||
rotate: -90deg;
|
||||
transition: rotate 180ms var(--ease-out);
|
||||
|
||||
html[dir="rtl"] & {
|
||||
rotate: 90deg;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
&[aria-expanded="true"] [data-slot="chevron"] {
|
||||
scale: 1 -1;
|
||||
&[aria-expanded="true"] [data-slot="chevron"],
|
||||
html[dir="rtl"] &[aria-expanded="true"] [data-slot="chevron"] {
|
||||
rotate: 0deg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3304,6 +3317,23 @@ html:has([data-site][data-theme="dark"]) {
|
||||
which grows open and pushes the page up while the wordmark's letters are out of order. */
|
||||
[data-site] {
|
||||
--letters-bar-height: 3.25rem;
|
||||
/* The blue bars' shared look (site-banner.css): the link blue, the same as the blue buttons and
|
||||
the announcement banner (dark mode keeps the deeper light-mode blue, so white keeps 4.5:1). */
|
||||
--bar-blue: light-dark(var(--link), #3b5cf6);
|
||||
}
|
||||
|
||||
/* While the open bar fills the bottom of the screen, a fixed strip of its blue covers the home
|
||||
indicator's area under it, touching the screen's bottom edge, which iOS Safari tints its bottom
|
||||
toolbar from (the page behind the site takes the blue too: site.tsx). It is as tall as the inset,
|
||||
and a pixel, over the bar's own blue, so it never covers anything else. */
|
||||
[data-site][data-letters-end]::after {
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: auto 0 0;
|
||||
z-index: 1;
|
||||
height: calc(env(safe-area-inset-bottom, 0px) + 1px);
|
||||
background: var(--bar-blue);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (max-width: 40rem) {
|
||||
@@ -3345,10 +3375,7 @@ html:has([data-site][data-theme="dark"]) {
|
||||
gap: 0.25rem;
|
||||
height: calc(var(--letters-bar-height) + env(safe-area-inset-bottom, 0px));
|
||||
padding-bottom: env(safe-area-inset-bottom, 0px);
|
||||
/* The blue bars' shared look (site-banner.css): the link blue, the same as the blue buttons and
|
||||
the announcement banner (dark mode keeps the deeper light-mode blue, so white keeps 4.5:1), a
|
||||
highlight and a 92% body. */
|
||||
--bar-blue: light-dark(var(--link), #3b5cf6);
|
||||
/* The blue bars' shared look (--bar-blue above, site-banner.css): a highlight and a 92% body. */
|
||||
background: var(--bar-blue);
|
||||
font-family: var(--font-sans);
|
||||
font-size: var(--fs-ui);
|
||||
|
||||
@@ -230,10 +230,12 @@ export function Site(props: {
|
||||
const [theme, setTheme] = createSignal<(typeof themes)[number]>(
|
||||
isServer ? "system" : (themes.find((item) => item === localStorage.getItem("opencode-theme")) ?? "system"),
|
||||
)
|
||||
// The colour at the top of the screen: the open banner's blue while it covers it, else the page's
|
||||
// background in the scheme the tag's media query stands for (or the chosen theme's).
|
||||
// The browser bar colour: the open banner's blue while it covers the top of the screen, the letters
|
||||
// bar's while it fills the bottom, else the page's background in the scheme the tag's media query
|
||||
// stands for (or the chosen theme's).
|
||||
const themeColor = (scheme: "light" | "dark") =>
|
||||
bannerTopColor() ??
|
||||
lettersBlue() ??
|
||||
((theme() === "system" ? scheme : theme()) === "dark" ? "#0c0c0c" : siteSettings.lightBackground)
|
||||
const colorScheme = () => (theme() === "system" ? "light dark" : theme())
|
||||
const [dark, setDark] = createSignal(false)
|
||||
@@ -274,11 +276,38 @@ export function Site(props: {
|
||||
const highlight = i18n.t("footer.wordmark.font")
|
||||
return label.startsWith(highlight) ? label.slice(highlight.length).trim() : label
|
||||
}
|
||||
// Whether the whole open bar is on screen (the page is scrolled to its end), so it fills the bottom
|
||||
// of the screen.
|
||||
const [lettersBarAtEnd, setLettersBarAtEnd] = createSignal(false)
|
||||
const watchLettersBar = (element: HTMLDivElement) => {
|
||||
const observer = new IntersectionObserver(([entry]) => setLettersBarInView(entry.isIntersecting))
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
setLettersBarInView(entry.isIntersecting)
|
||||
setLettersBarAtEnd(entry.intersectionRatio >= 0.98)
|
||||
},
|
||||
{ threshold: [0, 0.98] },
|
||||
)
|
||||
observer.observe(element)
|
||||
onCleanup(() => observer.disconnect())
|
||||
}
|
||||
// While the open bar fills the bottom of the screen, its blue runs on to the screen's bottom edge:
|
||||
// the page behind the site (what shows past the end, and what iOS Safari tints its bottom toolbar
|
||||
// area from) and the browser bar colour take the bar's blue as painted, and a fixed strip under the
|
||||
// home indicator (site.css) gives Safari a blue element touching the bottom edge.
|
||||
const lettersBottom = () => lettersBarShown() && lettersBarAtEnd()
|
||||
const [lettersBlue, setLettersBlue] = createSignal<string>()
|
||||
createEffect(
|
||||
on(lettersBottom, (bottom) => {
|
||||
const link = document.querySelector<HTMLElement>('[data-component="letters-bar"] a')
|
||||
const blue = bottom && link ? getComputedStyle(link).backgroundColor : undefined
|
||||
setLettersBlue(blue)
|
||||
if (blue) document.documentElement.style.backgroundColor = blue
|
||||
else document.documentElement.style.removeProperty("background-color")
|
||||
}),
|
||||
)
|
||||
onCleanup(() => {
|
||||
if (!isServer) document.documentElement.style.removeProperty("background-color")
|
||||
})
|
||||
// The bar grows at the very end of the page. Someone at the bottom stays at the bottom while it
|
||||
// grows, so the page visibly moves up with it.
|
||||
createEffect(
|
||||
@@ -1094,6 +1123,7 @@ export function Site(props: {
|
||||
data-theme={theme()}
|
||||
data-popover={popoverTheme()}
|
||||
data-letters-bar={lettersBarShown() && lettersBarInView() ? "" : undefined}
|
||||
data-letters-end={lettersBottom() ? "" : undefined}
|
||||
data-spacer={props.page === "home" || props.page === "product" ? siteSettings.spacer : undefined}
|
||||
data-logo={logoVariant()}
|
||||
data-hero-install={props.page === "home" ? siteSettings.heroInstall : undefined}
|
||||
|
||||
@@ -54,17 +54,6 @@
|
||||
}
|
||||
|
||||
@media (max-width: 60rem) {
|
||||
/* The product pages' previous and next chevrons: 44px wide (their band above and below
|
||||
already makes them 44px tall), 8px clear of the GitHub mark's target. [data-page] and a[href]
|
||||
outrank product-page.css, which loads later. */
|
||||
&[data-page] nav[data-component="product-cycle"] {
|
||||
inset-inline-end: calc(var(--edge) + env(safe-area-inset-right, 0px) + 5.75rem);
|
||||
}
|
||||
|
||||
[data-component="product-cycle"] a[href] {
|
||||
width: 2.75rem;
|
||||
}
|
||||
|
||||
&:not([data-bare]) > [data-component="announcement-banner"] button[data-slot="dismiss"] {
|
||||
--dismiss-centre: calc(var(--edge) + env(safe-area-inset-right, 0px) + 3.875rem);
|
||||
}
|
||||
|
||||
@@ -773,9 +773,16 @@
|
||||
padding: 0.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
|
||||
font-size: var(--fs-body);
|
||||
|
||||
/* The square's top on the title's cap height, not its line box: Inter's cap top sits 0.2646 of
|
||||
the 19px title below the line's top at this line height (measured), Arabic's ink top 0.2778. */
|
||||
[data-slot="hex-tile"] {
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
margin-top: calc(1.1875rem * 0.2646);
|
||||
|
||||
&:lang(ar) {
|
||||
margin-top: calc(1.1875rem * 0.2778);
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 1.5rem;
|
||||
|
||||
@@ -41,6 +41,8 @@ await build({
|
||||
outDir: path.join(cache, "client"),
|
||||
assetsDir: "_build",
|
||||
manifest: true,
|
||||
// The site's target (vite.config.ts): keeps light-dark() native; script/check-css-output.ts fails otherwise.
|
||||
cssTarget: ["chrome123", "edge123", "firefox120", "safari17.5"],
|
||||
rolldownOptions: { input: ["src/docs/client.ts", "src/docs/styles/global.css"] },
|
||||
},
|
||||
})
|
||||
|
||||
@@ -66,15 +66,24 @@
|
||||
/* Each tile keeps the background its files are made for, whatever the page's theme: fixed
|
||||
colours, and "only" so a browser's automatic dark mode (Chrome's forced dark, which some device
|
||||
previews turn on) can't darken the light tile or invert its artwork. */
|
||||
/* Inline artwork (the partner lockups) takes the tile's own logo colours as plain values, not
|
||||
the page's light-dark() tokens, which some browsers (older iOS Safari) resolve against the page
|
||||
theme instead of the tile's. */
|
||||
&[data-tone="light"] {
|
||||
color-scheme: only light;
|
||||
background: #f5f5f5;
|
||||
--logo-code: #1f1f1f;
|
||||
--logo-open: #626262;
|
||||
--logo-inner: #d2d2d2;
|
||||
}
|
||||
|
||||
&[data-tone="dark"] {
|
||||
color-scheme: only dark;
|
||||
background: #0a0a0a;
|
||||
box-shadow: inset 0 0 0 1px var(--border);
|
||||
--logo-code: #eeeeee;
|
||||
--logo-open: #aeaeae;
|
||||
--logo-inner: #4b4b4b;
|
||||
}
|
||||
|
||||
img {
|
||||
@@ -533,6 +542,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Phones: the copy icon 4px larger (18px) and each value row a 44px tall target. */
|
||||
@media (max-width: 40rem) {
|
||||
[data-slot="format"] {
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
[data-slot="value"] svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Where a column would be narrower than about 240px: one colour per row. In the three columns the
|
||||
big swatch stays on top, as a swatch beside the values would leave them too little room. */
|
||||
@container (max-width: 46rem) {
|
||||
|
||||
@@ -267,6 +267,9 @@ export default function Home() {
|
||||
|
||||
{/* The carousel's frame until the carousel itself has streamed in (products.tsx). */}
|
||||
<ProductCarouselSkeleton />
|
||||
{/* Before first paint: where the carousel's cards start on the page, so on phones a card runs
|
||||
down to the bottom of the small viewport (products.css) and never past it. Again on resize. */}
|
||||
<script innerHTML={cardTopScript} />
|
||||
|
||||
<Show when={siteSettings.logoWall !== "off"}>
|
||||
<Show when={siteSettings.logoLayout === "section"} fallback={logoWall()}>
|
||||
@@ -1453,3 +1456,7 @@ function balanceLogo(metrics: { aspect: number; density: number; centerY: number
|
||||
function copyColumnsAttribute(copy: "2 columns" | "3 columns", body: "2 columns" | "3 columns") {
|
||||
return copy === body ? undefined : copy.charAt(0)
|
||||
}
|
||||
|
||||
// The top of the first visible carousel card (the skeleton's until the carousel streams in), in
|
||||
// page coordinates, as --card-top on the root.
|
||||
const cardTopScript = `(()=>{const r=document.documentElement,f=()=>{const m=[...document.querySelectorAll('[data-component="products-skeleton"] [data-slot="media"],[data-component="products"] [data-slot="media"]')].find(e=>e.getClientRects().length&&e.getBoundingClientRect().height);if(m)r.style.setProperty("--card-top",Math.round(m.getBoundingClientRect().top+scrollY)+"px")};f();addEventListener("resize",f)})()`
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
|
||||
z-index: 9;
|
||||
height: 2.75rem;
|
||||
margin: calc(var(--topbar-height) + 0.5rem - var(--content-top)) calc(-1 * var(--edge)) 0.5rem;
|
||||
/* 1.75rem below: the title's text starts about 27px under the band's line, as the first
|
||||
heading under a bar does elsewhere. */
|
||||
margin: calc(var(--topbar-height) + 0.5rem - var(--content-top)) calc(-1 * var(--edge)) 1.75rem;
|
||||
padding: 0 var(--edge);
|
||||
|
||||
/* "Legal" fills the band's height: a 44px target, as on the product pages. */
|
||||
@@ -506,7 +508,8 @@
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
/* Entries group by spacing alone, no dividers: wide gaps between versions, tight ones inside. */
|
||||
gap: 2rem;
|
||||
|
||||
li {
|
||||
display: grid;
|
||||
@@ -539,10 +542,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Phones: one column, so each version is a stack (date, summary, commit, links) 4 to 6px apart,
|
||||
text to text, with 40px between versions. */
|
||||
@media (max-width: 40rem) {
|
||||
[data-slot="versions"] li {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 0.375rem;
|
||||
[data-slot="versions"] {
|
||||
gap: 2.5rem;
|
||||
|
||||
li {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
[data-slot="detail"] {
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,11 +246,23 @@
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
/* A divider between rows. Each row gets a little more room around its divider. */
|
||||
> li + li {
|
||||
/* A divider between rows, and one above the first, so lines enclose the list. Each row gets a
|
||||
little more room around its divider. */
|
||||
> li + li,
|
||||
> li:first-child {
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* The first row is padded like the others now that a line sits above it; the list moves up
|
||||
8px so the title-to-line gap (16px) matches the line-to-text gap. */
|
||||
margin-top: -0.5rem;
|
||||
|
||||
&& > li:first-child [data-slot="faq-question"] {
|
||||
--padding-top: 1rem;
|
||||
min-height: var(--row-height);
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* A line under the last row too; the next section drops its own divider (below), so the two
|
||||
never stack. */
|
||||
> li:last-child {
|
||||
@@ -396,6 +408,26 @@
|
||||
color: var(--text-strong);
|
||||
}
|
||||
}
|
||||
|
||||
/* Phones: a 20px icon (16px on desktop) 10px after the label, and a 44px tall target from an
|
||||
invisible band under it that leaves the layout as it is. It reaches into the 12px gap above
|
||||
the text, not above the label, where the accordion clips it and the row's question sits. */
|
||||
@media (max-width: 40rem) {
|
||||
position: relative;
|
||||
gap: 0.625rem;
|
||||
|
||||
[data-slot="download-icon"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset-block: 0 calc(100% - 44px);
|
||||
inset-inline: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[data-copied] [data-slot="copy-label"] [data-slot="download-icon"] {
|
||||
|
||||
@@ -164,6 +164,12 @@ export default defineConfig({
|
||||
minify: false,
|
||||
// The stylesheets the pages load are minified even though the Worker's code is not.
|
||||
cssMinify: true,
|
||||
// Browsers with native light-dark() (and CSS nesting). For older targets the minifier lowers
|
||||
// light-dark() to --lightningcss-light/--lightningcss-dark variables set only where a rule
|
||||
// declares color-scheme, so the site's tokens freeze at the theme of the element that defines
|
||||
// them: a forced-dark card or band (color-scheme: dark) kept the page's light tokens in
|
||||
// production, though the dev server (no lowering) showed it right.
|
||||
cssTarget: ["chrome123", "edge123", "firefox120", "safari17.5"],
|
||||
},
|
||||
environments: {
|
||||
// The browser bundles are minified; the Worker keeps readable code for its stack traces.
|
||||
|
||||
Reference in New Issue
Block a user