@rxova/astro-ui 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/package.json +11 -8
- package/src/components/BackLink.astro +4 -4
- package/src/components/CodeRecipes.astro +7 -7
- package/src/components/CopyButton.astro +20 -20
- package/src/components/CtaBand.astro +10 -10
- package/src/components/DataTable.astro +9 -9
- package/src/components/DocAccordionItem.astro +6 -6
- package/src/components/DocsMenu.astro +46 -0
- package/src/components/Header.astro +11 -11
- package/src/components/Icon.astro +9 -9
- package/src/components/ModeTabs.astro +7 -7
- package/src/components/PageHeader.astro +8 -8
- package/src/components/ProjectSwitcher.astro +10 -12
- package/src/components/ProofStats.astro +29 -29
- package/src/components/QuickStart.astro +3 -3
- package/src/components/ScreenshotGrid.astro +13 -13
- package/src/components/Section.astro +7 -7
- package/src/components/SectionNav.astro +8 -8
- package/src/components/ShowMore.astro +3 -3
- package/src/components/SiteFooter.astro +17 -17
- package/src/components/SizeTable.astro +7 -7
- package/src/components/ThemeScript.astro +12 -12
- package/src/components/ThemeToggle.astro +35 -35
- package/src/components/ValueGrid.astro +6 -6
- package/src/components/VisuallyHidden.astro +4 -4
- package/src/components/icons/Check.astro +3 -3
- package/src/components/icons/Collapse.astro +3 -3
- package/src/components/icons/Copy.astro +3 -3
- package/src/components/icons/Expand.astro +3 -3
- package/src/components/icons/Next.astro +3 -3
- package/src/components/icons/Pause.astro +3 -3
- package/src/components/icons/Play.astro +3 -3
- package/src/components/icons/Prev.astro +3 -3
- package/src/components/icons/Replay.astro +3 -3
- package/src/env.d.ts +3 -3
- package/src/lib/entries.ts +27 -27
- package/src/lib/icons.ts +7 -7
- package/src/scripts/show-more.ts +23 -23
- package/src/starlight/Footer.astro +4 -4
- package/src/starlight/Header.astro +75 -0
- package/src/starlight/MenuContent.astro +25 -0
- package/src/starlight/MobileMenuFooter.astro +9 -0
- package/src/starlight/SiteTitle.astro +5 -5
- package/src/starlight/SocialIcons.astro +4 -4
- package/src/starlight/ThemeSelect.astro +14 -14
- package/src/starlight/index.ts +34 -30
- package/src/styles/chrome.css +2 -2
- package/src/styles/document.css +1 -1
- package/src/styles/footer.css +1 -1
- package/src/styles/mermaid.css +2 -2
- package/src/styles/starlight.css +180 -45
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
Astro components, the Starlight preset and the shared chrome for every
|
|
5
|
-
<a href="https://rxova.
|
|
5
|
+
<a href="https://rxova.dev">rxova.dev</a> surface, built on
|
|
6
6
|
<a href="../brand"><code>@rxova/brand</code></a>.
|
|
7
7
|
</p>
|
|
8
8
|
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
16
|
// astro.config.mjs
|
|
17
|
-
import { defineConfig } from
|
|
18
|
-
import starlight from
|
|
19
|
-
import { sharedStarlightConfig } from
|
|
17
|
+
import { defineConfig } from "astro/config";
|
|
18
|
+
import starlight from "@astrojs/starlight";
|
|
19
|
+
import { sharedStarlightConfig } from "@rxova/astro-ui/starlight";
|
|
20
20
|
|
|
21
21
|
export default defineConfig({
|
|
22
|
-
site: process.env.DOCS_URL ??
|
|
23
|
-
base: process.env.DOCS_BASE_URL ??
|
|
22
|
+
site: process.env.DOCS_URL ?? "https://rxova.dev",
|
|
23
|
+
base: process.env.DOCS_BASE_URL ?? "/",
|
|
24
24
|
integrations: [
|
|
25
25
|
starlight(
|
|
26
26
|
sharedStarlightConfig({
|
|
27
|
-
project:
|
|
28
|
-
sidebar: [{ label:
|
|
27
|
+
project: "use-everywhere",
|
|
28
|
+
sidebar: [{ label: "Learn", items: [{ autogenerate: { directory: "learn" } }] }],
|
|
29
29
|
}),
|
|
30
30
|
),
|
|
31
31
|
],
|
|
32
|
-
})
|
|
32
|
+
});
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
That gets you the tokens, the typefaces, the rxova mark linking back to the
|
|
@@ -39,9 +39,9 @@ umbrella site, the cross-project switcher, the shared footer and Pagefind search
|
|
|
39
39
|
|
|
40
40
|
```astro
|
|
41
41
|
---
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import SiteFooter from
|
|
42
|
+
import "@rxova/brand/fonts.css";
|
|
43
|
+
import "@rxova/astro-ui/styles/document.css";
|
|
44
|
+
import SiteFooter from "@rxova/astro-ui/components/SiteFooter.astro";
|
|
45
45
|
---
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -76,8 +76,8 @@ the export checks for this package.
|
|
|
76
76
|
|
|
77
77
|
`apps/preview` also carries the gallery: one page per component under
|
|
78
78
|
`/gallery/`, each state in a `Story` frame. `pnpm --filter @rxova/preview
|
|
79
|
-
screenshots` rebuilds it and writes `screenshots/<component>.png` here, light
|
|
80
|
-
dark,
|
|
79
|
+
screenshots` rebuilds it and writes `screenshots/<component>.png` here (git-ignored), light
|
|
80
|
+
and dark, to attach to the pull request that adds or changes a component.
|
|
81
81
|
|
|
82
82
|
`apps/storybook` is the Storybook: a story file per component with its states,
|
|
83
83
|
a Docs page built from the component's frontmatter, and a light/dark toolbar.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxova/astro-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Astro components, Starlight preset and shared chrome for rxova.
|
|
5
|
+
"description": "Astro components, Starlight preset and shared chrome for rxova.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rxova",
|
|
8
8
|
"astro",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": "Jonatan Kruszewski <jonakrusze@gmail.com>",
|
|
14
|
-
"homepage": "https://rxova.
|
|
14
|
+
"homepage": "https://rxova.dev",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git+https://github.com/rxova/rxova-website.git",
|
|
@@ -46,26 +46,29 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rxova/brand": "^1.
|
|
49
|
+
"@rxova/brand": "^1.4.0",
|
|
50
50
|
"lucide-static": "^1.45.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@astrojs/check": "^0.9.10",
|
|
54
54
|
"@astrojs/starlight": "^0.42.1",
|
|
55
|
-
"@rxova/repo-tooling": "0.0.1",
|
|
56
55
|
"@types/node": "^26.6.1",
|
|
57
56
|
"@vitest/coverage-v8": "^5.0.1",
|
|
58
|
-
"astro": "^7.3.
|
|
57
|
+
"astro": "^7.3.3",
|
|
59
58
|
"happy-dom": "^20.14.5",
|
|
60
59
|
"publint": "^0.3.24",
|
|
61
|
-
"tsx": "^4.23.13",
|
|
62
60
|
"typescript": "6.0.3",
|
|
63
61
|
"vitest": "^5.0.1"
|
|
64
62
|
},
|
|
63
|
+
"repoConfig": {
|
|
64
|
+
"packSmoke": {
|
|
65
|
+
"load": "never"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
65
68
|
"scripts": {
|
|
66
69
|
"check:astro": "astro check",
|
|
67
70
|
"check:exports": "publint --strict",
|
|
68
|
-
"pack:smoke": "
|
|
71
|
+
"pack:smoke": "rxova-repo-config pack-smoke",
|
|
69
72
|
"test": "vitest run --coverage"
|
|
70
73
|
}
|
|
71
74
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { HTMLAttributes } from
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
|
|
4
4
|
/** An "← up one level" link; the caller's class sets its spacing. */
|
|
5
|
-
type Props = HTMLAttributes<
|
|
5
|
+
type Props = HTMLAttributes<"a"> & { href: string };
|
|
6
6
|
|
|
7
|
-
const { href, class: className, ...rest } = Astro.props
|
|
7
|
+
const { href, class: className, ...rest } = Astro.props;
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
<a class:list={[
|
|
10
|
+
<a class:list={["back-link", className]} href={href} {...rest}>
|
|
11
11
|
← <slot />
|
|
12
12
|
</a>
|
|
13
13
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
/** Titled source listings, one per recipe: a heading linking to the library, then the source in a code frame. */
|
|
3
3
|
export interface Recipe {
|
|
4
|
-
id: string
|
|
5
|
-
label: string
|
|
6
|
-
href: string
|
|
7
|
-
source: string
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
source: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
|
-
recipes: readonly Recipe[]
|
|
11
|
+
recipes: readonly Recipe[];
|
|
12
12
|
/** Heading ids are `<idPrefix>-<recipe.id>`, so a page can link to one recipe. */
|
|
13
|
-
idPrefix?: string
|
|
13
|
+
idPrefix?: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const { recipes, idPrefix =
|
|
16
|
+
const { recipes, idPrefix = "recipe" } = Astro.props;
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
<div class="rx-recipes">
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* An icon button that puts `text` on the clipboard and shows a tick for a moment. Drawn in
|
|
4
4
|
* `currentColor`, so it sits on any surface, a dark terminal included; the caller places it.
|
|
5
5
|
*/
|
|
6
|
-
import Check from
|
|
7
|
-
import Copy from
|
|
6
|
+
import Check from "./icons/Check.astro";
|
|
7
|
+
import Copy from "./icons/Copy.astro";
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
/** What goes on the clipboard. */
|
|
11
|
-
text: string
|
|
11
|
+
text: string;
|
|
12
12
|
/** The accessible name and tooltip; there is no visible text, so this is what a screen reader says. */
|
|
13
|
-
label?: string
|
|
13
|
+
label?: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const { text, label =
|
|
16
|
+
const { text, label = "Copy" } = Astro.props;
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
<button class="rx-copy" type="button" data-rx-copy={text} aria-label={label} title={label}>
|
|
@@ -23,24 +23,24 @@ const { text, label = 'Copy' } = Astro.props
|
|
|
23
23
|
</button>
|
|
24
24
|
|
|
25
25
|
<script>
|
|
26
|
-
for (const button of document.querySelectorAll<HTMLButtonElement>(
|
|
27
|
-
if (button.dataset.rxCopyBound) continue
|
|
28
|
-
button.dataset.rxCopyBound =
|
|
29
|
-
const status = button.querySelector<HTMLElement>(
|
|
30
|
-
button.addEventListener(
|
|
26
|
+
for (const button of document.querySelectorAll<HTMLButtonElement>("[data-rx-copy]")) {
|
|
27
|
+
if (button.dataset.rxCopyBound) continue;
|
|
28
|
+
button.dataset.rxCopyBound = "";
|
|
29
|
+
const status = button.querySelector<HTMLElement>(".rx-copy__status");
|
|
30
|
+
button.addEventListener("click", async () => {
|
|
31
31
|
try {
|
|
32
|
-
await navigator.clipboard.writeText(button.dataset.rxCopy ??
|
|
32
|
+
await navigator.clipboard.writeText(button.dataset.rxCopy ?? "");
|
|
33
33
|
} catch {
|
|
34
34
|
// Clipboard access can be denied; saying nothing beats claiming a copy that did not happen.
|
|
35
|
-
return
|
|
35
|
+
return;
|
|
36
36
|
}
|
|
37
|
-
button.dataset.state =
|
|
38
|
-
if (status) status.textContent =
|
|
37
|
+
button.dataset.state = "done";
|
|
38
|
+
if (status) status.textContent = "Copied";
|
|
39
39
|
window.setTimeout(() => {
|
|
40
|
-
delete button.dataset.state
|
|
41
|
-
if (status) status.textContent =
|
|
42
|
-
}, 1600)
|
|
43
|
-
})
|
|
40
|
+
delete button.dataset.state;
|
|
41
|
+
if (status) status.textContent = "";
|
|
42
|
+
}, 1600);
|
|
43
|
+
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
46
|
|
|
@@ -81,11 +81,11 @@ const { text, label = 'Copy' } = Astro.props
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.rx-copy :global(.rx-copy__done),
|
|
84
|
-
.rx-copy[data-state=
|
|
84
|
+
.rx-copy[data-state="done"] :global(.rx-copy__idle) {
|
|
85
85
|
visibility: hidden;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.rx-copy[data-state=
|
|
88
|
+
.rx-copy[data-state="done"] :global(.rx-copy__done) {
|
|
89
89
|
visibility: visible;
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
* base-aware; external ones get `rel="noopener"` and a visible marker.
|
|
5
5
|
*/
|
|
6
6
|
export interface CtaAction {
|
|
7
|
-
text: string
|
|
8
|
-
href: string
|
|
9
|
-
variant?:
|
|
10
|
-
external?: boolean
|
|
7
|
+
text: string;
|
|
8
|
+
href: string;
|
|
9
|
+
variant?: "primary" | "minimal";
|
|
10
|
+
external?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
|
-
title: string
|
|
15
|
-
lede: string
|
|
16
|
-
actions: readonly CtaAction[]
|
|
14
|
+
title: string;
|
|
15
|
+
lede: string;
|
|
16
|
+
actions: readonly CtaAction[];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const { title, lede, actions } = Astro.props
|
|
19
|
+
const { title, lede, actions } = Astro.props;
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
<aside class="rx-cta not-content">
|
|
@@ -25,9 +25,9 @@ const { title, lede, actions } = Astro.props
|
|
|
25
25
|
<div class="rx-cta__actions">
|
|
26
26
|
{actions.map((action) => (
|
|
27
27
|
<a
|
|
28
|
-
class:list={[
|
|
28
|
+
class:list={["rx-btn", `rx-btn--${action.variant ?? "minimal"}`]}
|
|
29
29
|
href={action.href}
|
|
30
|
-
rel={action.external ?
|
|
30
|
+
rel={action.external ? "noopener" : undefined}
|
|
31
31
|
>
|
|
32
32
|
{action.text}
|
|
33
33
|
{action.external && (
|
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* Facts a page reads from somewhere else, as a framed table: column headings, a row heading per
|
|
4
4
|
* row, cells that may render as code. Scrollable and focusable when narrow, so a keyboard can reach it.
|
|
5
5
|
*/
|
|
6
|
-
export type Cell = string | { code: string }
|
|
6
|
+
export type Cell = string | { code: string };
|
|
7
7
|
|
|
8
8
|
export interface DataRow {
|
|
9
|
-
label: string
|
|
10
|
-
cells: readonly Cell[]
|
|
9
|
+
label: string;
|
|
10
|
+
cells: readonly Cell[];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
14
|
/** The accessible name of the scrollable region: "Framework compatibility". */
|
|
15
|
-
label: string
|
|
16
|
-
columns: readonly string[]
|
|
17
|
-
rows: readonly DataRow[]
|
|
15
|
+
label: string;
|
|
16
|
+
columns: readonly string[];
|
|
17
|
+
rows: readonly DataRow[];
|
|
18
18
|
/** Where the facts come from, under the table. */
|
|
19
|
-
caption?: string
|
|
19
|
+
caption?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const { label, columns, rows, caption } = Astro.props
|
|
22
|
+
const { label, columns, rows, caption } = Astro.props;
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
<div class="rx-table" tabindex="0" role="region" aria-label={label}>
|
|
@@ -39,7 +39,7 @@ const { label, columns, rows, caption } = Astro.props
|
|
|
39
39
|
{row.label}
|
|
40
40
|
</th>
|
|
41
41
|
{row.cells.map((cell) => (
|
|
42
|
-
<td>{typeof cell ===
|
|
42
|
+
<td>{typeof cell === "string" ? cell : <code>{cell.code}</code>}</td>
|
|
43
43
|
))}
|
|
44
44
|
</tr>
|
|
45
45
|
))}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
/** One collapsible block of a `DocAccordion`: a title, an optional one-line summary, and the slot. */
|
|
3
3
|
interface Props {
|
|
4
|
-
title: string
|
|
5
|
-
summary?: string
|
|
6
|
-
defaultOpen?: boolean
|
|
4
|
+
title: string;
|
|
5
|
+
summary?: string;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const { title, summary, defaultOpen = false } = Astro.props
|
|
9
|
+
const { title, summary, defaultOpen = false } = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
<details class="doc-accordion-item" open={defaultOpen}>
|
|
@@ -46,7 +46,7 @@ const { title, summary, defaultOpen = false } = Astro.props
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
summary::after {
|
|
49
|
-
content:
|
|
49
|
+
content: "+";
|
|
50
50
|
flex: 0 0 auto;
|
|
51
51
|
font-size: 1.3rem;
|
|
52
52
|
line-height: 1;
|
|
@@ -54,7 +54,7 @@ const { title, summary, defaultOpen = false } = Astro.props
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.doc-accordion-item[open] summary::after {
|
|
57
|
-
content:
|
|
57
|
+
content: "−";
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.summary-text {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** A docs site's phone menu links: every project's docs, then the rxova.dev sections as the site
|
|
3
|
+
* header labels them. The Starlight wrappers add the social links and theme picker after it. */
|
|
4
|
+
import { PROJECTS, RXOVA_ORIGIN, SECTIONS, type ProjectId } from "@rxova/brand";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/** The project whose docs these are, marked as current. */
|
|
8
|
+
current?: ProjectId;
|
|
9
|
+
/** Prefix for every link. '' links root-relative, for a build served on rxova.dev. */
|
|
10
|
+
origin?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { current, origin = RXOVA_ORIGIN } = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<nav class="rx-docs-menu" aria-label="rxova.dev">
|
|
17
|
+
<p class="rx-docs-menu__label" aria-hidden="true">
|
|
18
|
+
Docs
|
|
19
|
+
</p>
|
|
20
|
+
<ul class="rx-docs-menu__list" aria-label="Docs">
|
|
21
|
+
{PROJECTS.map((project) => (
|
|
22
|
+
<li>
|
|
23
|
+
<a
|
|
24
|
+
class="rx-docs-menu__link"
|
|
25
|
+
href={`${origin}${project.mount}`}
|
|
26
|
+
aria-current={project.id === current ? "page" : undefined}
|
|
27
|
+
translate="no"
|
|
28
|
+
>
|
|
29
|
+
{project.label}
|
|
30
|
+
</a>
|
|
31
|
+
</li>
|
|
32
|
+
))}
|
|
33
|
+
</ul>
|
|
34
|
+
<p class="rx-docs-menu__label" aria-hidden="true">
|
|
35
|
+
rxova.dev
|
|
36
|
+
</p>
|
|
37
|
+
<ul class="rx-docs-menu__list" aria-label="Site">
|
|
38
|
+
{SECTIONS.map((section) => (
|
|
39
|
+
<li>
|
|
40
|
+
<a class="rx-docs-menu__link" href={`${origin}${section.path}`}>
|
|
41
|
+
{section.label}
|
|
42
|
+
</a>
|
|
43
|
+
</li>
|
|
44
|
+
))}
|
|
45
|
+
</ul>
|
|
46
|
+
</nav>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
/**
|
|
3
|
-
* The single rxova.
|
|
3
|
+
* The single rxova.dev header, rendered by the website's layout; callers pass
|
|
4
4
|
* the menu fully resolved. Not for the Starlight docs sites, which use `sharedStarlightConfig`.
|
|
5
5
|
*/
|
|
6
|
-
import ThemeToggle from
|
|
6
|
+
import ThemeToggle from "./ThemeToggle.astro";
|
|
7
7
|
|
|
8
8
|
export interface HeaderItem {
|
|
9
|
-
label: string
|
|
9
|
+
label: string;
|
|
10
10
|
/** Fully resolved by the caller — absolute or root-relative as its base needs. */
|
|
11
|
-
href: string
|
|
11
|
+
href: string;
|
|
12
12
|
/** Marks the item for the surface the reader is on. */
|
|
13
|
-
current?: boolean
|
|
13
|
+
current?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface Props {
|
|
17
17
|
/** Where the brand mark links — the site root, resolved by the caller. */
|
|
18
|
-
homeHref: string
|
|
18
|
+
homeHref: string;
|
|
19
19
|
/** Logo `src`, resolved by the caller for its base. */
|
|
20
|
-
logoSrc: string
|
|
20
|
+
logoSrc: string;
|
|
21
21
|
/** The menu, in the one fixed order every surface shows it. */
|
|
22
|
-
items: readonly HeaderItem[]
|
|
22
|
+
items: readonly HeaderItem[];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const { homeHref, logoSrc, items } = Astro.props
|
|
25
|
+
const { homeHref, logoSrc, items } = Astro.props;
|
|
26
26
|
---
|
|
27
27
|
|
|
28
28
|
{/* Outside <main> so it spans the viewport; sticky, not fixed, so nothing needs a top margin. */}
|
|
@@ -34,7 +34,7 @@ const { homeHref, logoSrc, items } = Astro.props
|
|
|
34
34
|
</a>
|
|
35
35
|
<nav aria-label="Sections">
|
|
36
36
|
{items.map((item) => (
|
|
37
|
-
<a href={item.href} aria-current={item.current ?
|
|
37
|
+
<a href={item.href} aria-current={item.current ? "page" : undefined}>
|
|
38
38
|
{item.label}
|
|
39
39
|
</a>
|
|
40
40
|
))}
|
|
@@ -108,7 +108,7 @@ const { homeHref, logoSrc, items } = Astro.props
|
|
|
108
108
|
}
|
|
109
109
|
/* The current section is marked for everyone, not only for assistive tech —
|
|
110
110
|
aria-current on its own is invisible. */
|
|
111
|
-
nav a[aria-current=
|
|
111
|
+
nav a[aria-current="page"] {
|
|
112
112
|
color: var(--rx-fg);
|
|
113
113
|
text-decoration: underline;
|
|
114
114
|
text-underline-offset: 5px;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { HTMLAttributes } from
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
3
|
|
|
4
4
|
/** The frame every glyph in `icons/` draws in: a 16px grid in the text colour. Decorative: label the button. */
|
|
5
|
-
type Props = HTMLAttributes<
|
|
5
|
+
type Props = HTMLAttributes<"svg"> & {
|
|
6
6
|
/** Width and height, in pixels. */
|
|
7
|
-
size?: number
|
|
7
|
+
size?: number;
|
|
8
8
|
/** Fills the shape instead of stroking it. */
|
|
9
|
-
solid?: boolean
|
|
10
|
-
}
|
|
9
|
+
solid?: boolean;
|
|
10
|
+
};
|
|
11
11
|
|
|
12
|
-
const { size = 16, solid = false, class: className, ...rest } = Astro.props
|
|
12
|
+
const { size = 16, solid = false, class: className, ...rest } = Astro.props;
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
<svg
|
|
16
|
-
class:list={[
|
|
16
|
+
class:list={["icon", className]}
|
|
17
17
|
viewBox="0 0 16 16"
|
|
18
18
|
width={size}
|
|
19
19
|
height={size}
|
|
20
|
-
fill={solid ?
|
|
21
|
-
stroke={solid ?
|
|
20
|
+
fill={solid ? "currentColor" : "none"}
|
|
21
|
+
stroke={solid ? "none" : "currentColor"}
|
|
22
22
|
stroke-width="1.6"
|
|
23
23
|
stroke-linecap="round"
|
|
24
24
|
stroke-linejoin="round"
|
|
@@ -4,23 +4,23 @@
|
|
|
4
4
|
* (one per `mode.slot`), so a page writes fenced blocks and gets the docs' Shiki highlighting.
|
|
5
5
|
*/
|
|
6
6
|
export interface Mode {
|
|
7
|
-
name: string
|
|
7
|
+
name: string;
|
|
8
8
|
/** The named slot holding this mode's code. */
|
|
9
|
-
slot: string
|
|
10
|
-
summary: string
|
|
9
|
+
slot: string;
|
|
10
|
+
summary: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
|
-
modes: readonly Mode[]
|
|
14
|
+
modes: readonly Mode[];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const { modes } = Astro.props
|
|
17
|
+
const { modes } = Astro.props;
|
|
18
18
|
const panes = await Promise.all(
|
|
19
19
|
modes.map(async (mode) => ({
|
|
20
20
|
...mode,
|
|
21
|
-
html: Astro.slots.has(mode.slot) ? await Astro.slots.render(mode.slot) :
|
|
21
|
+
html: Astro.slots.has(mode.slot) ? await Astro.slots.render(mode.slot) : "",
|
|
22
22
|
})),
|
|
23
|
-
)
|
|
23
|
+
);
|
|
24
24
|
---
|
|
25
25
|
|
|
26
26
|
<ol class="rx-modes">
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
* A page's title and lede, with an optional back link. The default slot is the lede.
|
|
4
4
|
* `detail` keeps the repo pages' heavier title, which still inherits the body's line height.
|
|
5
5
|
*/
|
|
6
|
-
import BackLink from
|
|
6
|
+
import BackLink from "./BackLink.astro";
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
|
-
title: string
|
|
10
|
-
back?: { href: string; label: string }
|
|
11
|
-
variant?:
|
|
9
|
+
title: string;
|
|
10
|
+
back?: { href: string; label: string };
|
|
11
|
+
variant?: "index" | "detail";
|
|
12
12
|
/** The lede's measure: `narrow` is 46ch, `wide` 56ch. */
|
|
13
|
-
measure?:
|
|
13
|
+
measure?: "narrow" | "wide";
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const { title, back, variant =
|
|
16
|
+
const { title, back, variant = "index", measure = "wide" } = Astro.props;
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
<header class:list={[
|
|
19
|
+
<header class:list={["head", variant]}>
|
|
20
20
|
{back && (
|
|
21
21
|
<BackLink class="back" href={back.href}>
|
|
22
22
|
{back.label}
|
|
23
23
|
</BackLink>
|
|
24
24
|
)}
|
|
25
25
|
<h1>{title}</h1>
|
|
26
|
-
<p class:list={[
|
|
26
|
+
<p class:list={["lede", measure]}>
|
|
27
27
|
<slot />
|
|
28
28
|
</p>
|
|
29
29
|
</header>
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
import { PROJECTS, RXOVA_ORIGIN, type ProjectId } from '@rxova/brand'
|
|
2
|
+
/** Cross-project navigation as a zero-JS `<details>`, labelled "Docs" so it never reads as the
|
|
3
|
+
* Projects link beside it. Every href is absolute: a relative one would resolve under the base. */
|
|
4
|
+
import { PROJECTS, RXOVA_ORIGIN, type ProjectId } from "@rxova/brand";
|
|
7
5
|
|
|
8
6
|
interface Props {
|
|
9
7
|
/** Which project this site is, so it can be marked as current. */
|
|
10
|
-
current?: ProjectId
|
|
8
|
+
current?: ProjectId;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
const { current } = Astro.props
|
|
11
|
+
const { current } = Astro.props;
|
|
14
12
|
---
|
|
15
13
|
|
|
16
14
|
<details class="rx-switcher">
|
|
17
|
-
<summary class="rx-switcher__trigger"
|
|
18
|
-
|
|
15
|
+
<summary class="rx-switcher__trigger">
|
|
16
|
+
Docs
|
|
19
17
|
<svg aria-hidden="true" viewBox="0 0 16 16" width="12" height="12">
|
|
20
18
|
<path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.75"></path>
|
|
21
19
|
</svg>
|
|
22
20
|
</summary>
|
|
23
21
|
<ul class="rx-switcher__menu">
|
|
24
22
|
<li>
|
|
25
|
-
<a href={RXOVA_ORIGIN}>rxova.
|
|
23
|
+
<a href={RXOVA_ORIGIN}>rxova.dev</a>
|
|
26
24
|
</li>
|
|
27
25
|
{PROJECTS.map((project) => (
|
|
28
26
|
<li>
|
|
29
27
|
<a
|
|
30
28
|
href={`${RXOVA_ORIGIN}${project.mount}`}
|
|
31
|
-
class={project.id === current ?
|
|
32
|
-
aria-current={project.id === current ?
|
|
29
|
+
class={project.id === current ? "rx-switcher__current" : undefined}
|
|
30
|
+
aria-current={project.id === current ? "page" : undefined}
|
|
33
31
|
>
|
|
34
32
|
{project.label}
|
|
35
33
|
</a>
|