mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 08:39:02 +03:00
fix(site): tidy the phone nav, docs menus and icons (#62707)
This commit is contained in:
committed by
GitHub
Unverified
parent
10bc5cbebb
commit
da8c0211f7
@@ -468,7 +468,7 @@ export function addProductToggles() {
|
||||
chevron.setAttribute("aria-haspopup", "menu")
|
||||
chevron.setAttribute("aria-expanded", "false")
|
||||
chevron.setAttribute("aria-label", "OpenCode products")
|
||||
chevron.innerHTML = `<svg width="10" height="10" viewBox="0 0 12 12" fill="none" aria-hidden="true"><path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5"/></svg>`
|
||||
chevron.innerHTML = `<svg width="10" height="10" viewBox="0 0 12 12" fill="none" aria-hidden="true"><path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" vector-effect="non-scaling-stroke"/></svg>`
|
||||
name.after(chevron)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -212,16 +212,6 @@
|
||||
width: 2px;
|
||||
background: var(--bar);
|
||||
}
|
||||
|
||||
[role="menuitem"][aria-current="page"]:is(:focus-visible, :active)::before {
|
||||
background: var(--link);
|
||||
}
|
||||
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
[role="menuitem"][aria-current="page"]:hover::before {
|
||||
background: var(--link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[data-slot="meta"] {
|
||||
@@ -328,6 +318,21 @@
|
||||
--nav-chevron-ink: light-dark(hsl(0 0% 8%), hsl(0 0% 95%));
|
||||
--nav-chevron-hover: var(--nav-name-hover);
|
||||
--nav-chevron-press: light-dark(#d2d2d2, #4b4b4b);
|
||||
/* The product name after the mark (and the docs' DOCS): its size, and the padding under it that puts OpenTUI Mono's
|
||||
caps (0.69 of the size) where they belong in the 25px row. */
|
||||
--nav-name-size: 15px;
|
||||
--nav-name-pad: 0.65px;
|
||||
|
||||
/* Phones: the docs sticky rows' 16px chevron, in an 18px box close to the name, its target reaching 26px past it so
|
||||
it stays 44px wide. The name grows to 20px, its caps centred in the 25px row (5.5px above and below), within half
|
||||
a pixel of the mark's inner rectangle. */
|
||||
@media (max-width: 60rem) {
|
||||
--nav-chevron-width: 18px;
|
||||
--nav-chevron-glyph: 16px;
|
||||
--nav-chevron-reach: 26px;
|
||||
--nav-name-size: 20px;
|
||||
--nav-name-pad: 1px;
|
||||
}
|
||||
--nav-logo-box-w: calc(15px * 1.492);
|
||||
--nav-logo-box-h: 25px;
|
||||
|
||||
@@ -392,11 +397,10 @@
|
||||
height: 25px;
|
||||
margin: var(--nav-lockup-inset) 0 0;
|
||||
margin-inline-start: 6px;
|
||||
/* OpenTUI Mono's caps sit 0.325px below its line box's centre; this puts them on the mark's centre. */
|
||||
padding: 0 6px 0.65px;
|
||||
padding: 0 6px var(--nav-name-pad);
|
||||
background: none;
|
||||
color: var(--nav-lockup-ink);
|
||||
font: 700 15px/1 var(--nav-menu-mono, "OpenTUI Mono", ui-monospace, monospace);
|
||||
font: 700 var(--nav-name-size) / 1 var(--nav-menu-mono, "OpenTUI Mono", ui-monospace, monospace);
|
||||
letter-spacing: 0;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
|
||||
@@ -42,6 +42,9 @@ const en = {
|
||||
"header.githubAria": "Star OpenCode on GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Try OpenCode",
|
||||
// The header button's label on phones: the same where it fits beside the 20px product name at 375px, else a short
|
||||
// "Try now".
|
||||
"header.tryOpenCodeShort": "Try OpenCode",
|
||||
"header.openNav": "Open navigation",
|
||||
"header.closeNav": "Close navigation",
|
||||
"theme.groupLabel": "Theme",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "ضع نجمة لـ OpenCode على GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "جرّب OpenCode",
|
||||
"header.tryOpenCodeShort": "جرّب OpenCode",
|
||||
"header.openNav": "فتح التنقل",
|
||||
"header.closeNav": "إغلاق التنقل",
|
||||
"theme.groupLabel": "السمة",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Dar estrela ao OpenCode no GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Experimente o OpenCode",
|
||||
"header.tryOpenCodeShort": "Experimente",
|
||||
"header.openNav": "Abrir navegação",
|
||||
"header.closeNav": "Fechar navegação",
|
||||
"theme.groupLabel": "Tema",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Giv OpenCode en stjerne på GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Prøv OpenCode",
|
||||
"header.tryOpenCodeShort": "Prøv nu",
|
||||
"header.openNav": "Åbn navigation",
|
||||
"header.closeNav": "Luk navigation",
|
||||
"theme.groupLabel": "Tema",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "OpenCode auf GitHub mit Stern markieren",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "OpenCode ausprobieren",
|
||||
"header.tryOpenCodeShort": "Jetzt testen",
|
||||
"header.openNav": "Navigation öffnen",
|
||||
"header.closeNav": "Navigation schließen",
|
||||
"theme.groupLabel": "Design",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Dale una estrella a OpenCode en GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Probar OpenCode",
|
||||
"header.tryOpenCodeShort": "Probar ahora",
|
||||
"header.openNav": "Abrir navegación",
|
||||
"header.closeNav": "Cerrar navegación",
|
||||
"theme.groupLabel": "Tema",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Ajouter une étoile à OpenCode sur GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Essayer OpenCode",
|
||||
"header.tryOpenCodeShort": "Essayer",
|
||||
"header.openNav": "Ouvrir la navigation",
|
||||
"header.closeNav": "Fermer la navigation",
|
||||
"theme.groupLabel": "Thème",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Aggiungi una stella a OpenCode su GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Prova OpenCode",
|
||||
"header.tryOpenCodeShort": "Prova ora",
|
||||
"header.openNav": "Apri navigazione",
|
||||
"header.closeNav": "Chiudi navigazione",
|
||||
"theme.groupLabel": "Tema",
|
||||
|
||||
@@ -25,6 +25,7 @@ export const dict = {
|
||||
"header.githubAria": "GitHubでOpenCodeにスターを付ける",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "OpenCodeを試す",
|
||||
"header.tryOpenCodeShort": "今すぐ試す",
|
||||
"header.openNav": "ナビゲーションを開く",
|
||||
"header.closeNav": "ナビゲーションを閉じる",
|
||||
"theme.groupLabel": "テーマ",
|
||||
|
||||
@@ -25,6 +25,7 @@ export const dict = {
|
||||
"header.githubAria": "GitHub에서 OpenCode에 스타 주기",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "OpenCode 사용해 보기",
|
||||
"header.tryOpenCodeShort": "지금 써보기",
|
||||
"header.openNav": "내비게이션 열기",
|
||||
"header.closeNav": "내비게이션 닫기",
|
||||
"theme.groupLabel": "테마",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Gi OpenCode en stjerne på GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Prøv OpenCode",
|
||||
"header.tryOpenCodeShort": "Prøv nå",
|
||||
"header.openNav": "Åpne navigasjon",
|
||||
"header.closeNav": "Lukk navigasjon",
|
||||
"theme.groupLabel": "Tema",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Dodaj gwiazdkę OpenCode na GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Wypróbuj OpenCode",
|
||||
"header.tryOpenCodeShort": "Wypróbuj",
|
||||
"header.openNav": "Otwórz nawigację",
|
||||
"header.closeNav": "Zamknij nawigację",
|
||||
"theme.groupLabel": "Motyw",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Поставить звезду OpenCode на GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Попробовать OpenCode",
|
||||
"header.tryOpenCodeShort": "Попробовать",
|
||||
"header.openNav": "Открыть навигацию",
|
||||
"header.closeNav": "Закрыть навигацию",
|
||||
"theme.groupLabel": "Тема",
|
||||
|
||||
@@ -25,6 +25,7 @@ export const dict = {
|
||||
"header.githubAria": "กดดาว OpenCode บน GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "ลองใช้ OpenCode",
|
||||
"header.tryOpenCodeShort": "ลองเลย",
|
||||
"header.openNav": "เปิดการนำทาง",
|
||||
"header.closeNav": "ปิดการนำทาง",
|
||||
"theme.groupLabel": "ธีม",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "GitHub'da OpenCode'a yıldız ver",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "OpenCode'u dene",
|
||||
"header.tryOpenCodeShort": "Hemen dene",
|
||||
"header.openNav": "Gezinmeyi aç",
|
||||
"header.closeNav": "Gezinmeyi kapat",
|
||||
"theme.groupLabel": "Tema",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const dict = {
|
||||
"header.githubAria": "Поставити зірку OpenCode на GitHub",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "Спробувати OpenCode",
|
||||
"header.tryOpenCodeShort": "Спробувати",
|
||||
"header.openNav": "Відкрити навігацію",
|
||||
"header.closeNav": "Закрити навігацію",
|
||||
"theme.groupLabel": "Тема",
|
||||
|
||||
@@ -25,6 +25,7 @@ export const dict = {
|
||||
"header.githubAria": "在 GitHub 上为 OpenCode 加星",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "试用 OpenCode",
|
||||
"header.tryOpenCodeShort": "立即试用",
|
||||
"header.openNav": "打开导航",
|
||||
"header.closeNav": "关闭导航",
|
||||
"theme.groupLabel": "主题",
|
||||
|
||||
@@ -25,6 +25,7 @@ export const dict = {
|
||||
"header.githubAria": "在 GitHub 上為 OpenCode 加星",
|
||||
"header.github": "GitHub",
|
||||
"header.tryOpenCode": "試用 OpenCode",
|
||||
"header.tryOpenCodeShort": "立即試用",
|
||||
"header.openNav": "開啟導覽",
|
||||
"header.closeNav": "關閉導覽",
|
||||
"theme.groupLabel": "主題",
|
||||
|
||||
@@ -247,7 +247,7 @@ body {
|
||||
gap: 16px;
|
||||
box-sizing: border-box;
|
||||
height: var(--nav-bar-height);
|
||||
padding: 0 var(--nav-end) 0 var(--nav-edge);
|
||||
padding-inline: var(--nav-edge) var(--nav-end);
|
||||
border-bottom: 1px solid var(--nav-rule);
|
||||
}
|
||||
|
||||
@@ -261,17 +261,16 @@ body {
|
||||
--github-focus: var(--stats-accent);
|
||||
}
|
||||
|
||||
/* Phones: the rule is drawn inside the 56px bar, as opencode.ai's top bar does, and the menu button's centre is where
|
||||
the site's is (its 32px box 6px further in than the site's 44px one). */
|
||||
/* Phones: the rule is drawn inside the 56px bar, as opencode.ai's top bar does. The menu button and the GitHub mark
|
||||
before it sit where the Console's and opencode.ai's do: the button's centre where the site's 44px button has it
|
||||
(its 32px box 6px further in), the mark's 16px before it. */
|
||||
@media (max-width: 60rem) {
|
||||
/* 12px at least between the lockup's chevron and TRY OPENCODE, so the 20px name still fits at 375px. */
|
||||
[data-page="stats"] [data-slot="header-bar"] {
|
||||
gap: 12px;
|
||||
border-bottom: 0;
|
||||
box-shadow: inset 0 -1px 0 var(--nav-rule);
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="menu-button"] {
|
||||
margin-inline-end: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-component="top"] a {
|
||||
@@ -313,16 +312,53 @@ body {
|
||||
color: var(--stats-text);
|
||||
}
|
||||
|
||||
/* Try OpenCode, the GitHub mark and the menu button sit 24px apart, ink to ink: the button's edge to the mark, and the
|
||||
mark to the menu's lines. That is as close as their 44px targets go without overlapping. */
|
||||
[data-page="stats"] [data-slot="header-actions"] {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="header-button"],
|
||||
[data-page="stats"] [data-slot="menu-button"] {
|
||||
[data-page="stats"] [data-slot="header-actions"] [data-slot="header-button"] {
|
||||
margin-inline-end: 14px;
|
||||
}
|
||||
|
||||
/* In capitals, as the nav's other labels (DATA, the product menu), at their 0 tracking. */
|
||||
[data-page="stats"] [data-slot="header-actions"] [data-slot="header-button"] strong {
|
||||
letter-spacing: 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Phones show the short label (header.tryOpenCodeShort: "Try now" where "Try OpenCode" doesn't fit beside the 20px
|
||||
product name), on a button 4px shorter, 28px, with a 44px tall target. The link's aria-label keeps the full name. */
|
||||
[data-page="stats"] [data-slot="header-actions"] [data-slot="header-button"] [data-slot="label-short"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 60rem) {
|
||||
[data-page="stats"] [data-slot="header-actions"] [data-slot="header-button"] {
|
||||
height: 28px;
|
||||
overflow: visible;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -8px 0;
|
||||
}
|
||||
|
||||
[data-slot="label"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[data-slot="label-short"] {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="header-button"] {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
@@ -340,8 +376,7 @@ body {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="header-button"]::before,
|
||||
[data-page="stats"] [data-slot="menu-button"]::before {
|
||||
[data-page="stats"] [data-slot="header-button"]::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
@@ -357,8 +392,7 @@ body {
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="header-button"] strong,
|
||||
[data-page="stats"] [data-slot="header-button"] span,
|
||||
[data-page="stats"] [data-slot="menu-button"] svg {
|
||||
[data-page="stats"] [data-slot="header-button"] span {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
@@ -380,16 +414,99 @@ body {
|
||||
inset 0 1px 2px 0 #ffffff24;
|
||||
}
|
||||
|
||||
/* The menu button, as the Console's (packages/site in anomalyco/opencode-console, landing.css): no box, two lines that
|
||||
meet in the middle and turn into a cross while the menu is open, and back. 32 × 28, with a 44px target. */
|
||||
[data-page="stats"] [data-slot="menu-button"] {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 28px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #3a3a3a;
|
||||
background: #ffffff;
|
||||
box-shadow:
|
||||
0 0 0 0 #00000024,
|
||||
0 0 0 0.5px #00000024,
|
||||
0 1px 1.5px 0 #0000001a;
|
||||
border: 0;
|
||||
appearance: none;
|
||||
background: none;
|
||||
color: var(--stats-text);
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
|
||||
margin-inline-start: 6px;
|
||||
|
||||
/* A 44px target, reaching 4px towards the GitHub mark's (they meet) and 8px past the lines' end. */
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset-block: -8px;
|
||||
inset-inline: -4px -8px;
|
||||
}
|
||||
|
||||
@media (max-width: 60rem) {
|
||||
margin-inline-end: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="menu-lines"] {
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 8.5px;
|
||||
/* Centred, the 8.5px box would start on a quarter pixel; this puts both lines on half pixels, so each is exactly 3
|
||||
device pixels at 2×. */
|
||||
margin-top: -0.5px;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 1.5px;
|
||||
background: currentColor;
|
||||
transform-origin: 50% 50%;
|
||||
/* Closing: the cross unrotates, then the lines part; the two overlap so it reads as one motion. */
|
||||
transition:
|
||||
rotate 0.22s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
translate 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) 0.12s;
|
||||
}
|
||||
|
||||
&::before {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&::after {
|
||||
top: calc(100% - 1.5px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Opening: the lines meet in the middle, then turn into a cross about their centre, overlapping slightly. */
|
||||
[data-page="stats"] [data-slot="menu-button"][aria-expanded="true"] [data-slot="menu-lines"] {
|
||||
&::before,
|
||||
&::after {
|
||||
transition:
|
||||
translate 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
rotate 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) 0.12s;
|
||||
}
|
||||
|
||||
&::before {
|
||||
translate: 0 3.5px;
|
||||
rotate: 45deg;
|
||||
}
|
||||
|
||||
&::after {
|
||||
translate: 0 -3.5px;
|
||||
rotate: -45deg;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
[data-page="stats"] [data-slot="menu-lines"] {
|
||||
&::before,
|
||||
&::after {
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-slot="header-button"]:focus-visible,
|
||||
@@ -7407,16 +7524,6 @@ body {
|
||||
background: #ffffff0d;
|
||||
}
|
||||
|
||||
[data-page="stats"][data-theme="dark"] [data-slot="menu-button"],
|
||||
:root[data-stats-theme="dark"] [data-page="stats"]:not([data-theme="light"]) [data-slot="menu-button"] {
|
||||
color: #fafafa;
|
||||
background: #ffffff0f;
|
||||
box-shadow:
|
||||
0 -0.5px 0 0 #ffffff33,
|
||||
0 0 0 0.5px #ffffff33,
|
||||
0 1px 2px 0 #00000066;
|
||||
}
|
||||
|
||||
[data-page="stats"][data-theme="dark"] [data-slot="header-button"][data-variant="contrast"],
|
||||
:root[data-stats-theme="dark"]
|
||||
[data-page="stats"]:not([data-theme="light"])
|
||||
@@ -7544,15 +7651,6 @@ body {
|
||||
opacity: 0.78;
|
||||
}
|
||||
|
||||
:root:not([data-stats-theme="light"]) [data-page="stats"]:not([data-theme="light"]) [data-slot="menu-button"] {
|
||||
color: #fafafa;
|
||||
background: #ffffff0f;
|
||||
box-shadow:
|
||||
0 -0.5px 0 0 #ffffff33,
|
||||
0 0 0 0.5px #ffffff33,
|
||||
0 1px 2px 0 #00000066;
|
||||
}
|
||||
|
||||
:root:not([data-stats-theme="light"])
|
||||
[data-page="stats"]:not([data-theme="light"])
|
||||
[data-slot="header-button"][data-variant="contrast"] {
|
||||
|
||||
@@ -122,6 +122,15 @@ export function Header(props: { githubStars: string; links?: readonly HeaderLink
|
||||
</ul>
|
||||
</nav>
|
||||
<div data-slot="header-actions">
|
||||
<a
|
||||
data-slot="header-button"
|
||||
data-variant="contrast"
|
||||
href="https://opencode.ai/"
|
||||
aria-label={i18n.t("header.tryOpenCode")}
|
||||
>
|
||||
<strong data-slot="label">{i18n.t("header.tryOpenCode")}</strong>
|
||||
<strong data-slot="label-short">{i18n.t("header.tryOpenCodeShort")}</strong>
|
||||
</a>
|
||||
<a
|
||||
data-slot="github-mark"
|
||||
href={githubLink.href}
|
||||
@@ -134,9 +143,6 @@ export function Header(props: { githubStars: string; links?: readonly HeaderLink
|
||||
<path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a data-slot="header-button" data-variant="contrast" href="https://opencode.ai/">
|
||||
<strong>{i18n.t("header.tryOpenCode")}</strong>
|
||||
</a>
|
||||
<button
|
||||
data-slot="menu-button"
|
||||
type="button"
|
||||
@@ -145,11 +151,7 @@ export function Header(props: { githubStars: string; links?: readonly HeaderLink
|
||||
aria-label={menuOpen() ? i18n.t("header.closeNav") : i18n.t("header.openNav")}
|
||||
onClick={() => setMenuOpen((value) => !value)}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<Show when={menuOpen()} fallback={<path d="M2 4.72H14M2 8.5H14M2 12.28H14" stroke="currentColor" />}>
|
||||
<path d="M4.44 4.44L11.56 11.56M11.56 4.44L4.44 11.56" stroke="currentColor" />
|
||||
</Show>
|
||||
</svg>
|
||||
<span data-slot="menu-lines" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -185,7 +185,10 @@
|
||||
}
|
||||
|
||||
/* Phones: the word sits in the 56px top bar after its 24 × 30 logo, with a 44px tap target, and the
|
||||
menu becomes a sheet under the bar. */
|
||||
menu becomes an edge-to-edge sheet under the bar on the code blocks' surface, with a line above
|
||||
(on the sticky row's top line, so the join is one line) and below, and none at the sides. Its
|
||||
labels start at the logo mark (--menu-label) and the "›" centres on the menu button
|
||||
(--menu-chevron, from the inline end), both measured when it opens (src/docs/client.ts). */
|
||||
@media (max-width: 60rem) {
|
||||
/* --lockup-text is the trigger's text x: 12px after the bar's logo. */
|
||||
[data-site] [data-component="docs-lockup"] {
|
||||
@@ -221,41 +224,44 @@
|
||||
[data-component="docs-lockup"] {
|
||||
[data-slot="menu"] {
|
||||
position: fixed;
|
||||
top: calc(var(--banner-offset, 0px) + env(safe-area-inset-top, 0px) + var(--topbar-height) + 2px);
|
||||
inset-inline-start: 12px;
|
||||
inset-inline-end: 12px;
|
||||
top: calc(var(--banner-offset, 0px) + env(safe-area-inset-top, 0px) + var(--topbar-height) + 1px);
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
background: var(--code-body, var(--popover-bg));
|
||||
/* Its rows press to the docs' shared full-width row tint (site.css), not the menus' darker fill. */
|
||||
--menu-press: var(--row-press);
|
||||
box-shadow:
|
||||
0 -1px 0 var(--border),
|
||||
0 1px 0 var(--border),
|
||||
0 6px 12px -4px light-dark(rgb(0 0 0 / 0.08), rgb(0 0 0 / 0.45));
|
||||
}
|
||||
}
|
||||
|
||||
/* 44px rows for touch, with the labels indented to the trigger's text (--menu-text, measured when
|
||||
the menu opens; the sheet's 12px inset comes first). Specific enough to beat the
|
||||
shared menu row padding in site.css. */
|
||||
/* 44px rows for touch, the labels on the logo mark's edge. Specific enough to beat the shared menu
|
||||
row padding in site.css. */
|
||||
[data-site] [data-component="docs-lockup"] [data-slot="menu"] [role="menuitem"] {
|
||||
padding-block: 13px;
|
||||
padding-inline-start: calc(var(--menu-text) - 12px);
|
||||
padding-inline-start: var(--menu-label, 26px);
|
||||
}
|
||||
|
||||
/* A 44px tap target of its own, set off from the "Docs" label by a short rule. */
|
||||
/* The active and hover bars sit on the screen's edge (site.css hangs them 1px over a menu's ring). */
|
||||
[data-site] [data-component="docs-lockup"] [data-slot="menu"] [role="menuitem"]::before {
|
||||
inset-inline-start: 0 !important;
|
||||
}
|
||||
|
||||
/* A 44px tap target of its own, centred on the menu button's column, with the sticky rows' 16px
|
||||
chevron (site.css section-toggle). */
|
||||
[data-site] [data-component="docs-lockup"] [data-slot="expand"] {
|
||||
--lockup-row: 44px;
|
||||
inset-inline-end: calc(var(--menu-chevron, 34px) - 22px);
|
||||
width: 44px;
|
||||
color: var(--text-strong);
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
bottom: 12px;
|
||||
inset-inline-start: 0;
|
||||
width: 1px;
|
||||
background: var(--border);
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,10 +334,10 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* OpenTUI Mono's caps sit 0.325px below its line box's centre; this puts them on the logo's centre. */
|
||||
/* The product name's size and padding (packages/nav-menus): 15px, 20px on phones. */
|
||||
[data-slot="word"] {
|
||||
padding: 0 6px 0.65px;
|
||||
font: 700 15px/1 var(--font-mono);
|
||||
padding: 0 6px var(--nav-name-pad, 0.65px);
|
||||
font: 700 var(--nav-name-size, 15px) / 1 var(--font-mono);
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
color: var(--text-strong);
|
||||
|
||||
@@ -170,14 +170,13 @@ function Dropdown(props: {
|
||||
}) {
|
||||
const [open, setOpen] = createSignal(false)
|
||||
const [subOpen, setSubOpen] = createSignal(false)
|
||||
// On phones the menu is a full-width sheet; its labels are indented to the trigger's text.
|
||||
const [textX, setTextX] = createSignal(0)
|
||||
// On phones the labels start at the bar's logo mark and the "›" centres on its menu button (docs-lockup.css).
|
||||
const [edges, setEdges] = createSignal<{ "--menu-label"?: string; "--menu-chevron"?: string }>({})
|
||||
const items: HTMLAnchorElement[] = []
|
||||
const subItems: HTMLAnchorElement[] = []
|
||||
let root: HTMLDivElement | undefined
|
||||
let menu: HTMLDivElement | undefined
|
||||
let combined: HTMLButtonElement | undefined
|
||||
let word: HTMLAnchorElement | undefined
|
||||
let toggleButton: HTMLButtonElement | undefined
|
||||
// Both forms render; Settings › Docs nav shows one (docs-lockup.css), so use whichever is shown.
|
||||
const splitShown = () => !!toggleButton && toggleButton.offsetParent !== null
|
||||
@@ -189,11 +188,21 @@ function Dropdown(props: {
|
||||
)
|
||||
|
||||
const show = (focus?: number) => {
|
||||
// The trigger's text start from the window's inline-start edge: its left, or right to left the
|
||||
// distance from its right edge to the window's.
|
||||
const trigger = splitShown() ? word : combined
|
||||
const box = trigger?.getBoundingClientRect()
|
||||
setTextX((box && trigger ? (isRtl(trigger) ? document.documentElement.clientWidth - box.right : box.left) : 0) + 6)
|
||||
const logo = document
|
||||
.querySelector("[data-component=topbar] [data-slot=logo] [data-slot=icon]")
|
||||
?.getBoundingClientRect()
|
||||
const button = document.querySelector("[data-component=menu-toggle]")?.getBoundingClientRect()
|
||||
const width = document.documentElement.clientWidth
|
||||
const rtl = !!menu && isRtl(menu)
|
||||
const centre = button ? button.left + button.width / 2 : 0
|
||||
setEdges(
|
||||
logo?.width && button?.width
|
||||
? {
|
||||
"--menu-label": `${rtl ? width - logo.right : logo.left}px`,
|
||||
"--menu-chevron": `${rtl ? centre : width - centre}px`,
|
||||
}
|
||||
: {},
|
||||
)
|
||||
setNested(
|
||||
siteSettings.docsSubmenu === "nested" ||
|
||||
window.matchMedia("(max-width: 60rem), (hover: none), (pointer: coarse)").matches,
|
||||
@@ -290,7 +299,6 @@ function Dropdown(props: {
|
||||
{(split) => (
|
||||
<>
|
||||
<a
|
||||
ref={word}
|
||||
data-slot="word"
|
||||
data-design="docsNav sectionMenuStyle menuActive menuColor menuAlign docsSubmenu"
|
||||
href={props.items[currentIndex()].href}
|
||||
@@ -332,7 +340,7 @@ function Dropdown(props: {
|
||||
role="menu"
|
||||
aria-label={props.menuLabel}
|
||||
data-submenu={nested() ? "nested" : "flyout"}
|
||||
style={{ "--menu-text": `${textX()}px` }}
|
||||
style={edges()}
|
||||
onKeyDown={(event) => {
|
||||
// Nested versions are rows of this menu, so the arrows walk through them in place.
|
||||
const rows = nested()
|
||||
@@ -408,7 +416,13 @@ function Dropdown(props: {
|
||||
onClick={() => (subOpen() && nested() ? setSubOpen(false) : openSub(sub(), false))}
|
||||
>
|
||||
<svg width="10" height="10" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
||||
<path d="M4.5 3L7.5 6L4.5 9" stroke="currentColor" stroke-width="1.25" stroke-linecap="square" />
|
||||
<path
|
||||
d="M4.5 3L7.5 6L4.5 9"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="square"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<div
|
||||
|
||||
@@ -72,9 +72,11 @@
|
||||
z-index: 8;
|
||||
}
|
||||
|
||||
/* Its centre 54px in from the page edge, at any link size, so the 24px mark ends 24px before the menu button's lines
|
||||
(phone-menu.css), and the search glyph before it (docs.css) ends 24px before the mark. */
|
||||
[data-component="topbar"] [data-component="github-link"] {
|
||||
margin-inline-start: auto;
|
||||
margin-inline-end: 0.5rem;
|
||||
margin-inline-end: calc(1.375rem - var(--github-size) / 2);
|
||||
}
|
||||
|
||||
@media (max-width: 60rem) {
|
||||
|
||||
@@ -104,7 +104,13 @@ export function NewTab() {
|
||||
export function Chevron() {
|
||||
return (
|
||||
<svg data-slot="chevron" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
||||
<path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="square" />
|
||||
<path
|
||||
d="M3 4.5L6 7.5L9 4.5"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="square"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -121,12 +127,28 @@ export function ChevronRight() {
|
||||
)
|
||||
}
|
||||
|
||||
/** A magnifying glass for search buttons, a 1.5px stroke in a 16px box. */
|
||||
/**
|
||||
* A magnifying glass for search buttons, a 1.5px stroke at any size: a lens and a short handle in a 16px ink box,
|
||||
* the width of the menu lines, so it sits with them and the chevrons. search-palette.tsx draws the same.
|
||||
*/
|
||||
export function SearchIcon() {
|
||||
return (
|
||||
<svg data-slot="search-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<circle cx="7" cy="7" r="4.75" stroke="currentColor" stroke-width="1.5" />
|
||||
<path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" />
|
||||
<circle
|
||||
cx="7.43"
|
||||
cy="7.43"
|
||||
r="5.06"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
<path
|
||||
d="M11 11L13.33 13.33"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="square"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* The phone dropdowns under the sticky bars (the Contents bar, and the docs section row): while one
|
||||
* is open, the page holds still (data-menu-hold, on-this-page.css) and the open list is its own scroll
|
||||
* area, from under its row to the bottom of the visual viewport, so the row stays put and only the
|
||||
* list scrolls. Call it whenever one opens or closes; it reads which is open from the page. A list
|
||||
* that drops in the page's flow (not absolutely positioned) is left alone.
|
||||
*/
|
||||
export function holdOpenMenu() {
|
||||
const list = document.querySelector<HTMLElement>(
|
||||
'[data-component="contents-menu"][open] > ul, [data-component="section-nav"][data-open] [data-slot="section-body"]',
|
||||
)
|
||||
const held = !!list && getComputedStyle(list).position === "absolute"
|
||||
document.documentElement.toggleAttribute("data-menu-hold", held)
|
||||
document
|
||||
.querySelectorAll<HTMLElement>('[data-component="contents-menu"] > ul, [data-slot="section-body"]')
|
||||
.forEach((other) => other !== list && other.style.removeProperty("max-height"))
|
||||
if (!list || !held) return
|
||||
const view = window.visualViewport
|
||||
const bottom = view ? view.offsetTop + view.height : window.innerHeight
|
||||
// From where the list rests (its offset, so an opening animation's shift doesn't count).
|
||||
const top = (list.offsetParent?.getBoundingClientRect().top ?? 0) + list.offsetTop
|
||||
list.style.maxHeight = `${Math.max(0, bottom - top)}px`
|
||||
}
|
||||
@@ -153,6 +153,14 @@
|
||||
--contents-top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + var(--notice-height, 3rem));
|
||||
}
|
||||
|
||||
/* While a phone dropdown under a sticky bar is open (menu-hold.ts), only its list scrolls: the page,
|
||||
and with it the bars, hold still. Closing it leaves the page where it was. */
|
||||
@media (max-width: 60rem) {
|
||||
html[data-menu-hold] {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
[data-site] [data-component="contents-menu"] {
|
||||
display: none;
|
||||
margin-block: 1.5rem 2.5rem;
|
||||
@@ -214,6 +222,8 @@
|
||||
inset-inline-end: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* Phones: menu-hold.ts sets the height from under the bar to the bottom of the visual viewport
|
||||
when the list opens; this is the fallback. */
|
||||
max-height: calc(100dvh - var(--contents-top) - var(--contents-height) - 1rem);
|
||||
padding-bottom: 0.75rem;
|
||||
overflow-y: auto;
|
||||
@@ -284,8 +294,8 @@
|
||||
}
|
||||
|
||||
/* The label and the items start at the page content's edge, at body size; the items are 44px+
|
||||
rows (17px Inter at 1.4 plus 11px above and below). The current item's pipe sits in the page's
|
||||
left margin, 12px before the text; the open list spans the margins for that. */
|
||||
rows (17px Inter at 1.4 plus 11px above and below). The current item's pipe sits on the screen's
|
||||
edge; the open list spans the margins for that. */
|
||||
summary {
|
||||
font-size: var(--body-size);
|
||||
}
|
||||
@@ -306,8 +316,11 @@
|
||||
padding-inline-start: 0;
|
||||
font-size: var(--body-size);
|
||||
|
||||
/* The current row's bar is on the screen's edge and as tall as the whole row. */
|
||||
&::before {
|
||||
inset-inline-start: -12px;
|
||||
inset-inline-start: calc(-1 * var(--edge));
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useI18n } from "~/context/i18n"
|
||||
import "./on-this-page.css"
|
||||
import { createEffect, createSignal, For, onCleanup, onMount, Show, type JSX } from "solid-js"
|
||||
import { Chevron } from "./icons"
|
||||
import { holdOpenMenu } from "./menu-hold"
|
||||
|
||||
type ContentsItem = {
|
||||
id: string
|
||||
@@ -143,11 +144,12 @@ export function ContentsMenu(props: { items: ContentsItem[] }) {
|
||||
document.removeEventListener("keydown", escape)
|
||||
window.removeEventListener("scroll", stuck)
|
||||
window.removeEventListener("resize", stuck)
|
||||
document.documentElement.removeAttribute("data-menu-hold")
|
||||
})
|
||||
})
|
||||
|
||||
return (
|
||||
<details ref={menu} data-component="contents-menu">
|
||||
<details ref={menu} data-component="contents-menu" on:toggle={holdOpenMenu}>
|
||||
<summary>
|
||||
<span data-slot="label">{i18n.t("site.contents")}</span>
|
||||
<Chevron />
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
}
|
||||
|
||||
@media (max-width: 60rem) {
|
||||
/* Two lines that turn into an X. The lines end on the page edge; the button extends past it
|
||||
so the tap target is 44px square. */
|
||||
/* Two 1.5px lines, 16px long (the search glyph's width) and 7px apart, that turn into an X, centred on the
|
||||
menu column (34px in from the screen's edge). The lines sit on half pixels so each is exactly 3 device pixels
|
||||
at 2×. The tap target is 44px square. */
|
||||
[data-component="menu-toggle"] {
|
||||
position: relative;
|
||||
width: 2.75rem;
|
||||
@@ -16,19 +17,18 @@
|
||||
|
||||
[data-slot="line"] {
|
||||
position: absolute;
|
||||
inset-inline-start: 0.75rem;
|
||||
inset-inline-end: 0.75rem;
|
||||
inset-inline: 14px;
|
||||
top: calc(50% - 0.5px);
|
||||
height: 1px;
|
||||
height: 1.5px;
|
||||
background: var(--text-strong);
|
||||
transition: transform 200ms var(--ease-out);
|
||||
|
||||
&:first-child {
|
||||
transform: translateY(-4.5px);
|
||||
transform: translateY(-3.5px);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
transform: translateY(4.5px);
|
||||
transform: translateY(3.5px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -436,8 +436,21 @@ export function SearchPalette(props: SiteSearchProps & { openOnMount?: SearchVia
|
||||
>
|
||||
<div data-slot="field">
|
||||
<svg data-slot="icon" width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<circle cx="7" cy="7" r="4.5" stroke="currentColor" stroke-width="1.25" />
|
||||
<path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.25" />
|
||||
<circle
|
||||
cx="7.43"
|
||||
cy="7.43"
|
||||
r="5.06"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
<path
|
||||
d="M11 11L13.33 13.33"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="square"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
</svg>
|
||||
<input
|
||||
ref={input}
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
}
|
||||
|
||||
[data-site]:not([data-bare]) > [data-component="announcement-banner"] [data-slot="dismiss"] {
|
||||
--dismiss-centre: calc(var(--edge) + env(safe-area-inset-right, 0px) + 3.75rem);
|
||||
--dismiss-centre: calc(var(--edge) + env(safe-area-inset-right, 0px) + 3.375rem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ html:has([data-site][data-theme="dark"]) {
|
||||
/* Light follows Settings › Light background (pure white unless set). */
|
||||
--bg: light-dark(#fff, #0c0c0c);
|
||||
--bg-weak: light-dark(hsl(0, 0%, 96%), hsl(0, 0%, 10%));
|
||||
/* A pressed full-width row on phones (the docs' sticky rows, the Contents list, the DOCS menu): a
|
||||
subtle surface tint, lighter than the chevrons' and menus' press fills. */
|
||||
--row-press: var(--bg-weak);
|
||||
/* The product cards' media backdrop (products.css), which their covers and reels are graded to in
|
||||
both themes. */
|
||||
--card-media-bg: #161616;
|
||||
|
||||
@@ -37,12 +37,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Header. The GitHub mark's link grows from 40 to 44px, centred on the mark (still 20px), and
|
||||
keeps 8px to the menu button's target, so the mark sits 2px further left (62px in from the
|
||||
page edge instead of 60). The chevrons and the banner's × follow its centre line. */
|
||||
/* Header. The GitHub mark's link grows from 40 to 44px, centred on the mark, which stays 54px in
|
||||
from the page edge (github-link.css), so its target meets the menu button's. The banner's ×
|
||||
follows its centre line. */
|
||||
[data-component="topbar"] [data-component="github-link"] {
|
||||
--github-size: 2.75rem;
|
||||
margin-inline-end: 0.5rem;
|
||||
}
|
||||
|
||||
/* The fixed corner mark beside the sidebar (touch tablets) and on bare pages: 44px too. Set on
|
||||
@@ -55,7 +54,7 @@
|
||||
|
||||
@media (max-width: 60rem) {
|
||||
&:not([data-bare]) > [data-component="announcement-banner"] button[data-slot="dismiss"] {
|
||||
--dismiss-centre: calc(var(--edge) + env(safe-area-inset-right, 0px) + 3.875rem);
|
||||
--dismiss-centre: calc(var(--edge) + env(safe-area-inset-right, 0px) + 3.375rem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,12 +155,12 @@
|
||||
inset: 0 -10px;
|
||||
}
|
||||
|
||||
:is([data-slot="section-toggle"], [data-component="contents-menu"] summary) {
|
||||
transition: background-color 100ms ease;
|
||||
|
||||
&:active {
|
||||
background: var(--bg-weak);
|
||||
}
|
||||
/* The press fill of the sticky menu rows and the open Contents list's rows reaches both screen
|
||||
edges; the label and chevron stay on the content edge and the menu column. The border image's outset paints past the box
|
||||
without making the page wider. */
|
||||
:is([data-slot="section-toggle"], [data-component="contents-menu"] :is(summary, a)):active {
|
||||
background: var(--row-press);
|
||||
border-image: linear-gradient(var(--row-press), var(--row-press)) fill 0 / 0 / 0 100vmax;
|
||||
}
|
||||
|
||||
/* The asset buttons on /brand and /press: asset-buttons.css. */
|
||||
|
||||
@@ -7,6 +7,7 @@ import { downloadOf, surfaceOf, targetOf } from "../lib/funnel-config"
|
||||
import { base } from "./config"
|
||||
import { closeNavMenus, installNavMenus } from "@opencode/nav-menus"
|
||||
import { fanMotion } from "../component/site/fan-motion"
|
||||
import { holdOpenMenu } from "../component/site/menu-hold"
|
||||
|
||||
// The page reports to the Console's funnel like the site's (lib/funnel.ts). The docs are English, at the host's root
|
||||
// like the site; their config is built in, as a chunk would bring Vite's preload helper with it.
|
||||
@@ -148,8 +149,16 @@ function toggleSection(open?: boolean) {
|
||||
const contents = $<HTMLDetailsElement>("[data-component=contents-menu][open]")
|
||||
if (next && contents) contents.open = false
|
||||
$("[data-slot=section-toggle]", nav)!.setAttribute("aria-expanded", String(next))
|
||||
holdOpenMenu()
|
||||
}
|
||||
|
||||
// The Contents bar's list holds the page still while it's open (component/site/menu-hold.ts).
|
||||
document.addEventListener(
|
||||
"toggle",
|
||||
(event) => (event.target as Element).matches("[data-component=contents-menu]") && holdOpenMenu(),
|
||||
true,
|
||||
)
|
||||
|
||||
function toggleMenu(open: boolean) {
|
||||
const toggle = $('[data-component="menu-toggle"]')!
|
||||
$("[data-component=site-menu-sheet]")!.toggleAttribute("data-open", open)
|
||||
@@ -199,9 +208,16 @@ function openLockup(root: HTMLElement, focus?: "first" | "last" | "current") {
|
||||
closeNavMenus()
|
||||
lockup = root
|
||||
const menu = menuOf(root)
|
||||
const word = $("[data-slot=word]", root)!
|
||||
const box = word.getBoundingClientRect()
|
||||
menu.style.setProperty("--menu-text", `${(html.dir === "rtl" ? html.clientWidth - box.right : box.left) + 6}px`)
|
||||
// Phones: the labels start at the bar's logo mark and the "›" centres on its menu button, from the inline
|
||||
// start and end edges (docs-lockup.css).
|
||||
const logo = $("[data-component=topbar] [data-slot=logo] [data-slot=icon]")?.getBoundingClientRect()
|
||||
const button = $("[data-component=menu-toggle]")?.getBoundingClientRect()
|
||||
if (logo?.width && button?.width) {
|
||||
const rtl = html.dir === "rtl"
|
||||
const centre = button.left + button.width / 2
|
||||
menu.style.setProperty("--menu-label", `${rtl ? html.clientWidth - logo.right : logo.left}px`)
|
||||
menu.style.setProperty("--menu-chevron", `${rtl ? centre : html.clientWidth - centre}px`)
|
||||
}
|
||||
menu.dataset.submenu = matchMedia("(max-width: 60rem), (hover: none), (pointer: coarse)").matches
|
||||
? "nested"
|
||||
: "flyout"
|
||||
|
||||
@@ -215,18 +215,10 @@
|
||||
min-width: 0;
|
||||
-webkit-text-stroke: var(--title-stroke);
|
||||
|
||||
/* Just the page's title, on the content edge like the Contents bar's label below it; the
|
||||
open list keeps the nav's "[-]" markers. */
|
||||
[data-slot="box"] {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
-webkit-text-stroke: 0;
|
||||
}
|
||||
|
||||
/* Its width comes from the nav's marker rule, so the row's "[-]" is the list's. */
|
||||
[data-slot="fill"] {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
height: 1lh;
|
||||
display: none;
|
||||
}
|
||||
|
||||
[data-slot="label"] {
|
||||
@@ -275,6 +267,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* The line above Previous / Next is a divider like the docs' others (tables, code frames, the bars),
|
||||
not ink (Pagination 4 in docs-variants.css draws it in --text-strong; doubled to outrank it). */
|
||||
[data-site][data-page="docs"] [data-component="docs-article"] [data-component="pagination"][data-component] {
|
||||
border-top-color: var(--border);
|
||||
}
|
||||
|
||||
/* ───────────── Right rail: search over Contents ───────────── */
|
||||
[data-site] [data-component="docs-aside"] {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user