Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/blume.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default defineConfig({
},
},
lastModified: "frontmatter",
export: { pdf: true },
agents: {
llmsTxt: {
details:
Expand Down
6 changes: 5 additions & 1 deletion docs/components.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { defineComponents } from "blume";
import Breadcrumbs from "./components/DocsBreadcrumb.astro";
import Footer from "./components/DocsFooter.astro";
import DocsLandingSearch from "./components/DocsLandingSearch.astro";
import Logo from "./components/DocsLogo.astro";
import Pagination from "./components/DocsPagination.astro";
import Search from "./components/DocsSearch.astro";
import TableOfContents from "./components/DocsOutline.astro";

export default defineComponents({ layout: { Breadcrumbs, Footer, Logo, Pagination, Search, TableOfContents } });
export default defineComponents({
layout: { Breadcrumbs, Footer, Logo, Pagination, Search, TableOfContents },
mdx: { DocsLandingSearch },
});
80 changes: 58 additions & 22 deletions docs/components/DocsBreadcrumb.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withMountedBase } from "blume/components/islands/base-path.ts";
import { Icon } from "@clickhouse/click-ui/Icon";
import { Link } from "@clickhouse/click-ui/Link";
import { Text } from "@clickhouse/click-ui/Text";
import { documentationOverview } from "./documentation-link";
import { documentationOverview, isDocumentationIndex } from "./documentation-link";
import { frameCopy } from "./site-frame-copy";
import { siteLocales, type SiteLocale } from "./site-locales";

Expand All @@ -24,6 +24,16 @@ const { crumbs, strings, centered = false, wide = false } = Astro.props;
const language = Astro.currentLocale ?? "en";
const locale = Object.hasOwn(siteLocales, language) ? (language as SiteLocale) : "en";
const current = crumbs.at(-1);
const pathname = Astro.url.pathname.replace(/\/$/, "");
const markdownLabels: Record<SiteLocale, string> = {
en: "View as Markdown",
es: "Ver en Markdown",
ja: "Markdown で表示",
ko: "Markdown으로 보기",
"pt-BR": "Ver em Markdown",
"zh-CN": "查看 Markdown",
};
const markdownLabel = markdownLabels[locale];
const navigation = data.navigationByLocale[locale] ?? data.navigation;
const section = navigation.tabs.find(({ path }) => current?.route === path || current?.route?.startsWith(`${path}/`));
const home = documentationOverview(locale);
Expand All @@ -32,7 +42,7 @@ const parents = [
...(section ? [{ label: section.label, href: withMountedBase(section.href ?? section.path) }] : []),
...crumbs.slice(0, -1).map(({ label, route }) => ({ label, href: route && withMountedBase(route) })),
];
const linked = new Set([Astro.url.pathname.replace(/\/$/, "")]);
const linked = new Set([pathname]);
const trail = parents.filter(({ href }) => {
if (!href) return true;
if (linked.has(href)) return false;
Expand All @@ -41,30 +51,42 @@ const trail = parents.filter(({ href }) => {
});
---

{current && trail.length > 0 && (
<nav
aria-label={strings?.breadcrumb ?? "Breadcrumb"}
class:list={["docs-breadcrumb", !wide && ["mx-auto", centered ? "max-w-[54rem]" : "max-w-content"]]}
data-loom-docs-breadcrumb
>
<ol role="list">
{trail.map(({ label, href }, index) => (
<li>
{index > 0 && <Icon aria-hidden="true" className="rtl:-scale-x-100" name="chevron-right" size="xs" />}
{href ? <Link href={href} size="sm">{label}</Link> : <Text component="span" color="muted" size="sm">{label}</Text>}
</li>
))}
<li>
<Icon aria-hidden="true" className="rtl:-scale-x-100" name="chevron-right" size="xs" />
<Text aria-current="page" component="span" size="sm">{current.label}</Text>
</li>
</ol>
</nav>
{!isDocumentationIndex(pathname, locale) && (
<div class:list={["docs-page-path", !wide && ["mx-auto", centered ? "max-w-[54rem]" : "max-w-content"]]}>
{current && trail.length > 0 && (
<nav aria-label={strings?.breadcrumb ?? "Breadcrumb"} class="docs-breadcrumb" data-loom-docs-breadcrumb>
<ol role="list">
{trail.map(({ label, href }, index) => (
<li>
{index > 0 && <Icon aria-hidden="true" className="rtl:-scale-x-100" name="chevron-right" size="xs" />}
{href ? <Link href={href} size="sm">{label}</Link> : <Text component="span" color="muted" size="sm">{label}</Text>}
</li>
))}
<li>
<Icon aria-hidden="true" className="rtl:-scale-x-100" name="chevron-right" size="xs" />
<Text aria-current="page" component="span" size="sm">{current.label}</Text>
</li>
</ol>
</nav>
)}
<Link className="docs-markdown-link" href={`${pathname}.md`} size="sm" aria-label={markdownLabel}>
<span class="docs-markdown-full">{markdownLabel}</span>
<span class="docs-markdown-compact" aria-hidden="true">Markdown</span>
</Link>
</div>
)}

<style>
.docs-breadcrumb {
.docs-page-path {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.25rem 1rem;
margin-block-end: 1.125rem;
}

.docs-breadcrumb {
min-inline-size: 0;
color: var(--blume-muted-foreground);
font-size: 0.8125rem;
line-height: 1.5;
Expand Down Expand Up @@ -92,4 +114,18 @@ const trail = parents.filter(({ href }) => {
}

.docs-breadcrumb :global(svg) { flex: none; }
.docs-page-path :global(.docs-markdown-link) {
display: inline-flex;
align-items: center;
min-block-size: 2rem;
margin-inline-start: auto;
white-space: nowrap;
}

.docs-markdown-compact { display: none; }

@media (max-width: 47.99rem) {
.docs-markdown-full { display: none; }
.docs-markdown-compact { display: inline; }
}
</style>
18 changes: 18 additions & 0 deletions docs/components/DocsLandingSearch.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
import { Button } from "@clickhouse/click-ui/Button";
import { Icon } from "@clickhouse/click-ui/Icon";
import data from "blume:data";

const ui = data.uiByLocale[Astro.currentLocale ?? "en"] ?? data.ui;
---

<Button
className="docs-landing-search"
aria-haspopup="dialog"
data-loom-docs-landing-search=""
htmlType="button"
type="secondary"
>
<Icon name="search" size="sm" aria-hidden="true" />
{ui.search.placeholder}
</Button>
79 changes: 40 additions & 39 deletions docs/components/DocsLogo.astro
Original file line number Diff line number Diff line change
@@ -1,65 +1,66 @@
---
import { Link } from "@clickhouse/click-ui/Link";
import { Separator } from "@clickhouse/click-ui/Separator";
import loomLogo from "../public/loom.svg?raw";
import { documentationOverview } from "./documentation-link";
import { frameCopy } from "./site-frame-copy";
import { documentationOverview, isDocumentationIndex } from "./documentation-link";
import { siteLocales, type SiteLocale } from "./site-locales";
import "./click-ui-dark.css";

interface Props {
locale?: SiteLocale;
locale?: string;
}

const language = Astro.props.locale ?? Astro.currentLocale ?? "en";
const locale = Object.hasOwn(siteLocales, language) ? (language as SiteLocale) : "en";
const { href } = siteLocales[locale];
const overview = documentationOverview(locale);
const current = Astro.url.pathname.replace(/\/$/, "") === overview.href;
const pathname = Astro.url.pathname.replace(/\/$/, "");
---

<div class="docs-brand">
<Link className="brand-home" href={href} aria-label="ClickHouse Loom" lang="en" dir="ltr" weight="semibold">
<span class="brand-mark" aria-hidden="true" set:html={loomLogo} />
<span><span class="brand-publisher">ClickHouse </span><strong>Loom</strong></span>
</Link>
<Separator className="brand-divider" decorative orientation="vertical" size="sm" />
<Link className="docs-overview" href={overview.href} hrefLang={overview.hreflang} aria-current={current ? "page" : undefined} size="sm">{frameCopy[locale].docs}</Link>
</div>
<Link
className="docs-brand"
href={overview.href}
hrefLang={overview.hreflang}
lang="en"
dir="ltr"
aria-current={pathname === overview.href ? "page" : undefined}
data-docs-index={isDocumentationIndex(pathname, locale) ? "" : undefined}
weight="semibold"
>
<span class="docs-brand-mark" aria-hidden="true" set:html={loomLogo} />
<span><strong>Loom</strong> <span class="docs-brand-section">Docs</span></span>
</Link>

<style>
.docs-brand {
display: flex;
:global(.docs-brand) {
display: inline-flex;
flex: none;
align-items: center;
gap: 0.75rem;
min-width: 0;
gap: 0.5rem;
min-block-size: 2.75rem;
color: var(--blume-foreground);
font-size: clamp(1rem, 1.6vw, 1.2rem);
letter-spacing: -0.03em;
text-decoration: none;
white-space: nowrap;
}

.docs-brand :global(.brand-home), .docs-brand :global(.docs-overview) {
display: inline-flex;
align-items: center;
min-height: 2.75rem;
.docs-brand-mark, .docs-brand-mark :global(svg) {
display: block;
flex: none;
inline-size: 2rem;
block-size: 2rem;
}

.docs-brand :global(.brand-home) {
gap: 0.55rem;
min-width: 0;
color: var(--blume-foreground);
font-size: 1.1875rem;
font-weight: 600;
letter-spacing: -0.035em;
text-decoration: none;
.docs-brand-section {
color: var(--blume-muted-foreground);
font-weight: 500;
}

.docs-brand :global(.brand-home strong) { font-weight: 730; }
.docs-brand :global(.brand-home span:last-child) { overflow: hidden; text-overflow: ellipsis; }
.brand-mark, .brand-mark :global(svg) { display: block; width: 2rem; height: 2rem; }
.brand-mark, .docs-brand :global(.brand-divider), .docs-brand :global(.docs-overview) { flex-shrink: 0; }
.docs-brand :global(.brand-divider) { block-size: 1rem; }
.docs-brand :global(.docs-overview:not(:hover, [aria-current="page"])) { color: var(--click-global-color-text-muted); }
.docs-brand :global(.docs-overview[aria-current="page"]) { color: var(--click-global-color-text-default); }
@media (max-width: 35rem), (48rem <= width < 68rem) {
.brand-publisher { display: none; }
@media (max-width: 24rem) {
:global(.docs-brand) { gap: 0.375rem; }

.docs-brand-mark, .docs-brand-mark :global(svg) {
inline-size: 1.625rem;
block-size: 1.625rem;
}
}
</style>
8 changes: 7 additions & 1 deletion docs/components/DocsOutline.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Outline = mobile ? "details" : "div";
{(headings.length > 0 || (mobile && Astro.slots.has("default"))) && (
<Outline class:list={[
"docs-outline",
mobile && "group mx-auto mb-6 max-w-content rounded-blume border border-border xl:hidden",
mobile && "docs-outline-mobile group mx-auto mb-6 max-w-content rounded-blume border border-border xl:hidden",
]}>
{mobile ? (
<summary class="flex cursor-pointer list-none items-center justify-between gap-2 px-4 py-3 [&::-webkit-details-marker]:hidden">
Expand Down Expand Up @@ -50,6 +50,12 @@ const Outline = mobile ? "details" : "div";
color: var(--click-global-color-text-muted);
}

.docs-outline-mobile blume-toc {
max-block-size: min(18rem, 40dvh);
overflow-y: auto;
scrollbar-width: thin;
}

.docs-outline :global(a[aria-current="location"]) {
color: var(--click-global-color-accent-default);
font-weight: 600;
Expand Down
Loading
Loading