@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.
Files changed (52) hide show
  1. package/README.md +14 -14
  2. package/package.json +11 -8
  3. package/src/components/BackLink.astro +4 -4
  4. package/src/components/CodeRecipes.astro +7 -7
  5. package/src/components/CopyButton.astro +20 -20
  6. package/src/components/CtaBand.astro +10 -10
  7. package/src/components/DataTable.astro +9 -9
  8. package/src/components/DocAccordionItem.astro +6 -6
  9. package/src/components/DocsMenu.astro +46 -0
  10. package/src/components/Header.astro +11 -11
  11. package/src/components/Icon.astro +9 -9
  12. package/src/components/ModeTabs.astro +7 -7
  13. package/src/components/PageHeader.astro +8 -8
  14. package/src/components/ProjectSwitcher.astro +10 -12
  15. package/src/components/ProofStats.astro +29 -29
  16. package/src/components/QuickStart.astro +3 -3
  17. package/src/components/ScreenshotGrid.astro +13 -13
  18. package/src/components/Section.astro +7 -7
  19. package/src/components/SectionNav.astro +8 -8
  20. package/src/components/ShowMore.astro +3 -3
  21. package/src/components/SiteFooter.astro +17 -17
  22. package/src/components/SizeTable.astro +7 -7
  23. package/src/components/ThemeScript.astro +12 -12
  24. package/src/components/ThemeToggle.astro +35 -35
  25. package/src/components/ValueGrid.astro +6 -6
  26. package/src/components/VisuallyHidden.astro +4 -4
  27. package/src/components/icons/Check.astro +3 -3
  28. package/src/components/icons/Collapse.astro +3 -3
  29. package/src/components/icons/Copy.astro +3 -3
  30. package/src/components/icons/Expand.astro +3 -3
  31. package/src/components/icons/Next.astro +3 -3
  32. package/src/components/icons/Pause.astro +3 -3
  33. package/src/components/icons/Play.astro +3 -3
  34. package/src/components/icons/Prev.astro +3 -3
  35. package/src/components/icons/Replay.astro +3 -3
  36. package/src/env.d.ts +3 -3
  37. package/src/lib/entries.ts +27 -27
  38. package/src/lib/icons.ts +7 -7
  39. package/src/scripts/show-more.ts +23 -23
  40. package/src/starlight/Footer.astro +4 -4
  41. package/src/starlight/Header.astro +75 -0
  42. package/src/starlight/MenuContent.astro +25 -0
  43. package/src/starlight/MobileMenuFooter.astro +9 -0
  44. package/src/starlight/SiteTitle.astro +5 -5
  45. package/src/starlight/SocialIcons.astro +4 -4
  46. package/src/starlight/ThemeSelect.astro +14 -14
  47. package/src/starlight/index.ts +34 -30
  48. package/src/styles/chrome.css +2 -2
  49. package/src/styles/document.css +1 -1
  50. package/src/styles/footer.css +1 -1
  51. package/src/styles/mermaid.css +2 -2
  52. package/src/styles/starlight.css +180 -45
@@ -1,9 +1,9 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
3
- import Icon from '../Icon.astro'
2
+ import type { ComponentProps } from "astro/types";
3
+ import Icon from "../Icon.astro";
4
4
 
5
5
  /** Two bars. */
6
- type Props = Omit<ComponentProps<typeof Icon>, 'solid'>
6
+ type Props = Omit<ComponentProps<typeof Icon>, "solid">;
7
7
  ---
8
8
 
9
9
  <Icon {...Astro.props}>
@@ -1,9 +1,9 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
3
- import Icon from '../Icon.astro'
2
+ import type { ComponentProps } from "astro/types";
3
+ import Icon from "../Icon.astro";
4
4
 
5
5
  /** A solid triangle. */
6
- type Props = Omit<ComponentProps<typeof Icon>, 'solid'>
6
+ type Props = Omit<ComponentProps<typeof Icon>, "solid">;
7
7
  ---
8
8
 
9
9
  <Icon {...Astro.props} solid>
@@ -1,9 +1,9 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
3
- import Icon from '../Icon.astro'
2
+ import type { ComponentProps } from "astro/types";
3
+ import Icon from "../Icon.astro";
4
4
 
5
5
  /** A left chevron. */
6
- type Props = Omit<ComponentProps<typeof Icon>, 'solid'>
6
+ type Props = Omit<ComponentProps<typeof Icon>, "solid">;
7
7
  ---
8
8
 
9
9
  <Icon {...Astro.props}>
@@ -1,9 +1,9 @@
1
1
  ---
2
- import type { ComponentProps } from 'astro/types'
3
- import Icon from '../Icon.astro'
2
+ import type { ComponentProps } from "astro/types";
3
+ import Icon from "../Icon.astro";
4
4
 
5
5
  /** An arrow turning back to its start. */
6
- type Props = Omit<ComponentProps<typeof Icon>, 'solid'>
6
+ type Props = Omit<ComponentProps<typeof Icon>, "solid">;
7
7
  ---
8
8
 
9
9
  <Icon {...Astro.props}>
package/src/env.d.ts CHANGED
@@ -7,9 +7,9 @@
7
7
  // Re-check against Starlight's `global.d.ts` on a major bump.
8
8
  declare global {
9
9
  interface StarlightThemeProvider {
10
- updatePickers(theme?: string): void
10
+ updatePickers(theme?: string): void;
11
11
  }
12
- var StarlightThemeProvider: StarlightThemeProvider
12
+ var StarlightThemeProvider: StarlightThemeProvider;
13
13
  }
14
14
 
15
- export {}
15
+ export {};
@@ -4,41 +4,41 @@
4
4
  export function newestFirst<T extends { id: string }>(entries: readonly T[], date: (e: T) => Date) {
5
5
  return [...entries].sort(
6
6
  (a, b) => date(b).valueOf() - date(a).valueOf() || a.id.localeCompare(b.id),
7
- )
7
+ );
8
8
  }
9
9
 
10
10
  /** "Rxova" · "Rxova and Ada" · "Rxova, Ada, and Grace" */
11
11
  export function byline(names: readonly string[]): string {
12
- if (names.length <= 1) return names[0] ?? ''
13
- if (names.length === 2) return `${names[0]} and ${names[1]}`
14
- return `${names.slice(0, -1).join(', ')}, and ${names[names.length - 1]}`
12
+ if (names.length <= 1) return names[0] ?? "";
13
+ if (names.length === 2) return `${names[0]} and ${names[1]}`;
14
+ return `${names.slice(0, -1).join(", ")}, and ${names[names.length - 1]}`;
15
15
  }
16
16
 
17
17
  /** The distinct values some entry carries, so a filter row never offers a chip that matches nothing. */
18
18
  export function usedValues<T>(entries: readonly T[], pick: (e: T) => readonly string[]): string[] {
19
- return [...new Set(entries.flatMap((e) => pick(e)))]
19
+ return [...new Set(entries.flatMap((e) => pick(e)))];
20
20
  }
21
21
 
22
- const DATE = new Intl.DateTimeFormat('en', {
23
- year: 'numeric',
24
- month: 'long',
25
- day: 'numeric',
26
- timeZone: 'UTC',
27
- })
22
+ const DATE = new Intl.DateTimeFormat("en", {
23
+ year: "numeric",
24
+ month: "long",
25
+ day: "numeric",
26
+ timeZone: "UTC",
27
+ });
28
28
 
29
29
  /** "July 27, 2026". UTC, so the rendered date matches the filename it came from. */
30
30
  export function formatDate(d: Date): string {
31
- return DATE.format(d)
31
+ return DATE.format(d);
32
32
  }
33
33
 
34
34
  /** `2026-07-27`, for `<time datetime>`. */
35
35
  export function isoDate(d: Date): string {
36
- return d.toISOString().slice(0, 10)
36
+ return d.toISOString().slice(0, 10);
37
37
  }
38
38
 
39
39
  /** The next "show more" limit: one `step` further, clamped to `total` so the control never outlives the list. */
40
40
  export function nextLimit(current: number, step: number, total: number): number {
41
- return Math.min(current + Math.max(step, 0), total)
41
+ return Math.min(current + Math.max(step, 0), total);
42
42
  }
43
43
 
44
44
  /**
@@ -50,23 +50,23 @@ export function excerpt(body: string, max: number): { text: string; truncated: b
50
50
  .split(/\n\s*\n/)
51
51
  .map((p) => p.trim())
52
52
  .filter((p) => p.length > 0 && !/^(#|!\[|>|```|\||-{3,}|\d+\.|[-*+]\s)/.test(p))
53
- .join(' ')
53
+ .join(" ");
54
54
 
55
55
  const plain = prose
56
- .replace(/!\[[^[\]]*\]\([^()]*\)/g, '')
57
- .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
58
- .replace(/`([^`]+)`/g, '$1')
59
- .replace(/(\*\*|__)(.*?)\1/g, '$2')
60
- .replace(/(\*|_)(.*?)\1/g, '$2')
61
- .replace(/\s+/g, ' ')
62
- .trim()
56
+ .replace(/!\[[^[\]]*\]\([^()]*\)/g, "")
57
+ .replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
58
+ .replace(/`([^`]+)`/g, "$1")
59
+ .replace(/(\*\*|__)(.*?)\1/g, "$2")
60
+ .replace(/(\*|_)(.*?)\1/g, "$2")
61
+ .replace(/\s+/g, " ")
62
+ .trim();
63
63
 
64
- if (plain.length <= max) return { text: plain, truncated: false }
64
+ if (plain.length <= max) return { text: plain, truncated: false };
65
65
 
66
- const cut = plain.slice(0, max)
67
- const lastSpace = cut.lastIndexOf(' ')
66
+ const cut = plain.slice(0, max);
67
+ const lastSpace = cut.lastIndexOf(" ");
68
68
  return {
69
- text: (lastSpace > 0 ? cut.slice(0, lastSpace) : cut).replace(/[,;:.—–-]+$/, ''),
69
+ text: (lastSpace > 0 ? cut.slice(0, lastSpace) : cut).replace(/[,;:.—–-]+$/, ""),
70
70
  truncated: true,
71
- }
71
+ };
72
72
  }
package/src/lib/icons.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  /** Lucide icons as inline markup, read from `lucide-static` at build time so nothing ships to the client. */
2
2
 
3
- import { readFileSync } from 'node:fs'
4
- import { createRequire } from 'node:module'
3
+ import { readFileSync } from "node:fs";
4
+ import { createRequire } from "node:module";
5
5
 
6
- const require = createRequire(import.meta.url)
6
+ const require = createRequire(import.meta.url);
7
7
 
8
8
  /** What sits inside a Lucide icon's root `<svg>`, so the caller's own element owns size and accessibility. */
9
9
  export function lucideGlyph(name: string): string {
10
- const svg = readFileSync(require.resolve(`lucide-static/icons/${name}.svg`), 'utf8')
10
+ const svg = readFileSync(require.resolve(`lucide-static/icons/${name}.svg`), "utf8");
11
11
  return svg
12
- .replace(/^[\s\S]*?<svg[^>]*>/, '')
13
- .replace(/<\/svg>[\s\S]*$/, '')
14
- .trim()
12
+ .replace(/^[\s\S]*?<svg[^>]*>/, "")
13
+ .replace(/<\/svg>[\s\S]*$/, "")
14
+ .trim();
15
15
  }
@@ -1,46 +1,46 @@
1
- import { nextLimit } from '../lib/entries.ts'
1
+ import { nextLimit } from "../lib/entries.ts";
2
2
 
3
3
  /** Shows `list`'s children `data-reveal-step` at a time, driven by a ShowMore's `controls`. */
4
4
  export function batchList(list: HTMLElement, controls: HTMLElement): void {
5
- const items = Array.from(list.children) as HTMLElement[]
6
- const moreBtn = controls.querySelector<HTMLElement>('[data-reveal-more]')
7
- const allBtn = controls.querySelector<HTMLElement>('[data-reveal-all]')
8
- const progress = controls.querySelector<HTMLElement>('[data-reveal-progress]')
5
+ const items = Array.from(list.children) as HTMLElement[];
6
+ const moreBtn = controls.querySelector<HTMLElement>("[data-reveal-more]");
7
+ const allBtn = controls.querySelector<HTMLElement>("[data-reveal-all]");
8
+ const progress = controls.querySelector<HTMLElement>("[data-reveal-progress]");
9
9
 
10
- const step = Number(list.dataset.revealStep) || items.length
11
- let limit = step
10
+ const step = Number(list.dataset.revealStep) || items.length;
11
+ let limit = step;
12
12
 
13
13
  function apply() {
14
14
  items.forEach((el, i) => {
15
- el.hidden = i >= limit
16
- })
17
- controls.hidden = limit >= items.length
15
+ el.hidden = i >= limit;
16
+ });
17
+ controls.hidden = limit >= items.length;
18
18
  if (progress) {
19
- progress.textContent = limit < items.length ? `Showing ${limit} of ${items.length}` : ''
19
+ progress.textContent = limit < items.length ? `Showing ${limit} of ${items.length}` : "";
20
20
  }
21
21
  }
22
22
 
23
23
  /** Raise the limit, then focus the first item that appeared. */
24
24
  function reveal(next: number) {
25
- const first = items[limit]
26
- limit = next
27
- apply()
28
- if (!first) return
25
+ const first = items[limit];
26
+ limit = next;
27
+ apply();
28
+ if (!first) return;
29
29
  // The new batch starts where the button was, so the viewport is already right.
30
- first.tabIndex = -1
31
- first.focus({ preventScroll: true })
30
+ first.tabIndex = -1;
31
+ first.focus({ preventScroll: true });
32
32
  }
33
33
 
34
- moreBtn?.addEventListener('click', () => reveal(nextLimit(limit, step, items.length)))
34
+ moreBtn?.addEventListener("click", () => reveal(nextLimit(limit, step, items.length)));
35
35
  // Also the way out of find-in-page missing what is batched away.
36
- allBtn?.addEventListener('click', () => reveal(items.length))
36
+ allBtn?.addEventListener("click", () => reveal(items.length));
37
37
 
38
- apply()
38
+ apply();
39
39
  }
40
40
 
41
41
  /** Batches the page's `[data-reveal-list]` behind its `[data-reveal-controls]`, when it has both. */
42
42
  export function enhanceShowMore(root: ParentNode = document): void {
43
- const list = root.querySelector<HTMLElement>('[data-reveal-list]')
44
- const controls = root.querySelector<HTMLElement>('[data-reveal-controls]')
45
- if (list && controls) batchList(list, controls)
43
+ const list = root.querySelector<HTMLElement>("[data-reveal-list]");
44
+ const controls = root.querySelector<HTMLElement>("[data-reveal-controls]");
45
+ if (list && controls) batchList(list, controls);
46
46
  }
@@ -3,11 +3,11 @@
3
3
  * Starlight `Footer` override: keeps Starlight's pagination, edit link and last-updated, and adds
4
4
  * the shared rxova site footer beneath them.
5
5
  */
6
- import Default from '@astrojs/starlight/components/Footer.astro'
7
- import SiteFooter from '../components/SiteFooter.astro'
8
- import { projectFromBase } from '@rxova/brand'
6
+ import Default from "@astrojs/starlight/components/Footer.astro";
7
+ import SiteFooter from "../components/SiteFooter.astro";
8
+ import { projectFromBase } from "@rxova/brand";
9
9
 
10
- const project = projectFromBase(import.meta.env.BASE_URL)
10
+ const project = projectFromBase(import.meta.env.BASE_URL);
11
11
  ---
12
12
 
13
13
  <Default>
@@ -0,0 +1,75 @@
1
+ ---
2
+ /** Starlight `Header` override: adds a phone menu to pages without a sidebar, which Starlight gives
3
+ * none. A `<details>`, so it opens without JavaScript; the script adds Esc and outside-click closing. */
4
+ import Default from "@astrojs/starlight/components/Header.astro";
5
+ import MenuContent from "./MenuContent.astro";
6
+
7
+ // Narrowed structurally, as in SiteTitle.astro.
8
+ const { hasSidebar } = (Astro.locals as unknown as { starlightRoute: { hasSidebar: boolean } })
9
+ .starlightRoute;
10
+ ---
11
+
12
+ <Default>
13
+ <slot />
14
+ </Default>
15
+ {!hasSidebar && (
16
+ <details class="rx-menu md:sl-hidden print:hidden">
17
+ <summary class="rx-menu__toggle" aria-controls="rx-menu-panel">
18
+ <svg class="rx-menu__open" aria-hidden="true" viewBox="0 0 24 24" width="20" height="20">
19
+ <path
20
+ d="M4 7h16M4 12h16M4 17h16"
21
+ fill="none"
22
+ stroke="currentColor"
23
+ stroke-width="1.75"
24
+ stroke-linecap="round"
25
+ />
26
+ </svg>
27
+ <svg class="rx-menu__close" aria-hidden="true" viewBox="0 0 24 24" width="20" height="20">
28
+ <path
29
+ d="M6 6l12 12M18 6L6 18"
30
+ fill="none"
31
+ stroke="currentColor"
32
+ stroke-width="1.75"
33
+ stroke-linecap="round"
34
+ />
35
+ </svg>
36
+ <span class="sr-only">Menu</span>
37
+ </summary>
38
+ <div class="rx-menu__panel" id="rx-menu-panel">
39
+ <MenuContent />
40
+ </div>
41
+ </details>
42
+ )}
43
+
44
+ <script>
45
+ const menu = document.querySelector<HTMLDetailsElement>("details.rx-menu");
46
+ const toggle = menu?.querySelector<HTMLElement>(".rx-menu__toggle");
47
+
48
+ if (menu && toggle) {
49
+ const close = (refocus: boolean): void => {
50
+ if (!menu.open) return;
51
+ menu.open = false;
52
+ if (refocus) toggle.focus();
53
+ };
54
+
55
+ menu.addEventListener("keydown", (event) => {
56
+ if (event.key !== "Escape" || !menu.open) return;
57
+ // Leave an open theme picker's own Esc alone.
58
+ if (event.defaultPrevented) return;
59
+ event.preventDefault();
60
+ close(true);
61
+ });
62
+ // Outside a click, or focus moving elsewhere, the menu is no longer what the reader is using.
63
+ document.addEventListener("click", (event) => {
64
+ if (!menu.contains(event.target as Node)) close(false);
65
+ });
66
+ menu.addEventListener("focusout", (event) => {
67
+ const next = event.relatedTarget as Node | null;
68
+ if (next && !menu.contains(next)) close(false);
69
+ });
70
+ // Wider than a phone the menu is hidden; do not leave it open behind the desktop header.
71
+ matchMedia("(min-width: 50rem)").addEventListener("change", (event) => {
72
+ if (event.matches) close(false);
73
+ });
74
+ }
75
+ </script>
@@ -0,0 +1,25 @@
1
+ ---
2
+ /**
3
+ * What a docs site's phone menu holds below its own sidebar: every project's docs, the rxova.dev
4
+ * sections, then the social links and the theme picker, which the header hides on phones.
5
+ */
6
+ import DefaultSocialIcons from "@astrojs/starlight/components/SocialIcons.astro";
7
+ import LanguageSelect from "@astrojs/starlight/components/LanguageSelect.astro";
8
+ import { projectFromBase } from "@rxova/brand";
9
+ import DocsMenu from "../components/DocsMenu.astro";
10
+ import ThemeSelect from "./ThemeSelect.astro";
11
+
12
+ // Overrides receive no props, so the current project is inferred from the base path.
13
+ const current = projectFromBase(import.meta.env.BASE_URL);
14
+ ---
15
+
16
+ <div class="rx-menu-content">
17
+ <DocsMenu current={current} />
18
+ <div class="rx-menu-content__prefs">
19
+ <div class="rx-menu-content__social">
20
+ <DefaultSocialIcons />
21
+ </div>
22
+ <ThemeSelect />
23
+ <LanguageSelect />
24
+ </div>
25
+ </div>
@@ -0,0 +1,9 @@
1
+ ---
2
+ /**
3
+ * Starlight `MobileMenuFooter` override: the foot of Starlight's own phone menu (pages with a
4
+ * sidebar) carries the same links as the splash pages' menu in `Header.astro`, so no page needs two menus.
5
+ */
6
+ import MenuContent from "./MenuContent.astro";
7
+ ---
8
+
9
+ <MenuContent />
@@ -1,18 +1,18 @@
1
1
  ---
2
2
  /**
3
- * Starlight `SiteTitle` override: the mark links (absolutely) to rxova.org, the wordmark to this
3
+ * Starlight `SiteTitle` override: the mark links (absolutely) to rxova.dev, the wordmark to this
4
4
  * project's docs root via `siteTitleHref`. The image comes from @rxova/brand.
5
5
  */
6
- import mark from '@rxova/brand/assets/rxova-logo-256.png'
7
- import { RXOVA_ORIGIN } from '@rxova/brand'
6
+ import mark from "@rxova/brand/assets/rxova-logo-256.png";
7
+ import { RXOVA_ORIGIN } from "@rxova/brand";
8
8
 
9
9
  // Narrowed structurally, not via an `App.Locals` augmentation, which would collide with
10
10
  // Starlight's own in the consumer site's build.
11
11
  const { siteTitle, siteTitleHref } = (
12
12
  Astro.locals as unknown as {
13
- starlightRoute: { siteTitle: string; siteTitleHref: string }
13
+ starlightRoute: { siteTitle: string; siteTitleHref: string };
14
14
  }
15
- ).starlightRoute
15
+ ).starlightRoute;
16
16
  ---
17
17
 
18
18
  <div class="rx-site-title">
@@ -3,13 +3,13 @@
3
3
  * Starlight `SocialIcons` override: the umbrella navigation, then the stock icons. Starlight
4
4
  * renders this slot in the header on wide screens and in the mobile menu, so one header serves both.
5
5
  */
6
- import Default from '@astrojs/starlight/components/SocialIcons.astro'
7
- import SectionNav from '../components/SectionNav.astro'
8
- import { projectFromBase } from '@rxova/brand'
6
+ import Default from "@astrojs/starlight/components/SocialIcons.astro";
7
+ import SectionNav from "../components/SectionNav.astro";
8
+ import { projectFromBase } from "@rxova/brand";
9
9
 
10
10
  // Overrides receive no props, so the current project is inferred from the base
11
11
  // path the aggregator mounts this site at.
12
- const current = projectFromBase(import.meta.env.BASE_URL)
12
+ const current = projectFromBase(import.meta.env.BASE_URL);
13
13
  ---
14
14
 
15
15
  <SectionNav current={current} />
@@ -3,7 +3,7 @@
3
3
  * Wraps Starlight's theme picker and resyncs the theme on a bfcache restore, where Starlight's
4
4
  * parse-time theme code does not run again and the page would keep a stale `data-theme`.
5
5
  */
6
- import Default from '@astrojs/starlight/components/ThemeSelect.astro'
6
+ import Default from "@astrojs/starlight/components/ThemeSelect.astro";
7
7
  ---
8
8
 
9
9
  <Default>
@@ -11,32 +11,32 @@ import Default from '@astrojs/starlight/components/ThemeSelect.astro'
11
11
  </Default>
12
12
 
13
13
  <script>
14
- type Theme = 'auto' | 'dark' | 'light'
14
+ type Theme = "auto" | "dark" | "light";
15
15
 
16
16
  /** Same key and coercion Starlight uses; unknown values mean "follow the OS". */
17
- const STORAGE_KEY = 'starlight-theme'
17
+ const STORAGE_KEY = "starlight-theme";
18
18
  const parseTheme = (theme: unknown): Theme =>
19
- theme === 'auto' || theme === 'dark' || theme === 'light' ? theme : 'auto'
19
+ theme === "auto" || theme === "dark" || theme === "light" ? theme : "auto";
20
20
  const preferredColorScheme = (): Theme =>
21
- matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
21
+ matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
22
22
 
23
23
  // `pageshow` is the only notification of a bfcache restore; a normal load (`persisted: false`)
24
24
  // is left to Starlight.
25
- window.addEventListener('pageshow', (event) => {
26
- if (!event.persisted) return
25
+ window.addEventListener("pageshow", (event) => {
26
+ if (!event.persisted) return;
27
27
 
28
- let stored: string | null
28
+ let stored: string | null;
29
29
  try {
30
- stored = localStorage.getItem(STORAGE_KEY)
30
+ stored = localStorage.getItem(STORAGE_KEY);
31
31
  } catch {
32
32
  // Storage can throw outright (Safari private mode, blocked cookies).
33
33
  // Leaving the restored theme alone is the right fallback.
34
- return
34
+ return;
35
35
  }
36
36
 
37
- const theme = parseTheme(stored)
38
- document.documentElement.dataset.theme = theme === 'auto' ? preferredColorScheme() : theme
37
+ const theme = parseTheme(stored);
38
+ document.documentElement.dataset.theme = theme === "auto" ? preferredColorScheme() : theme;
39
39
  // Keeps the picker from disagreeing with the page it controls.
40
- StarlightThemeProvider.updatePickers(theme)
41
- })
40
+ StarlightThemeProvider.updatePickers(theme);
41
+ });
42
42
  </script>
@@ -3,19 +3,19 @@
3
3
  * extras. Imported under Node (no CSS or components) and typed structurally, not as Starlight's.
4
4
  */
5
5
 
6
- import { RXOVA_ORIGIN, getProject, type ProjectId } from '@rxova/brand'
6
+ import { RXOVA_ORIGIN, getProject, type ProjectId } from "@rxova/brand";
7
7
 
8
8
  export interface SharedStarlightOptions {
9
9
  /** Which project's docs this site is. */
10
- project: ProjectId
10
+ project: ProjectId;
11
11
  /** Starlight sidebar config — the one thing every site defines itself. */
12
- sidebar: unknown[]
12
+ sidebar: unknown[];
13
13
  /** Extra stylesheets, appended after the shared ones so they win. */
14
- customCss?: string[]
14
+ customCss?: string[];
15
15
  /** Extra Starlight component overrides, merged over the shared ones. */
16
- components?: Record<string, string>
16
+ components?: Record<string, string>;
17
17
  /** Path under the repo root that holds the docs site, for the edit link. */
18
- editLinkBase?: string
18
+ editLinkBase?: string;
19
19
  }
20
20
 
21
21
  export function sharedStarlightConfig({
@@ -23,22 +23,22 @@ export function sharedStarlightConfig({
23
23
  sidebar,
24
24
  customCss = [],
25
25
  components = {},
26
- editLinkBase = 'apps/docs',
26
+ editLinkBase = "apps/docs",
27
27
  }: SharedStarlightOptions) {
28
- const self = getProject(project)
28
+ const self = getProject(project);
29
29
 
30
30
  return {
31
31
  title: self.label,
32
32
  description: self.tagline,
33
33
  // One origin, one tab icon. Each site must have this file in `public/`: Starlight resolves
34
34
  // `favicon` against the site's own static directory.
35
- favicon: '/favicon.svg',
35
+ favicon: "/favicon.svg",
36
36
 
37
37
  // No `logo` on purpose: the SiteTitle override renders the mark from @rxova/brand's assets.
38
38
 
39
39
  social: [
40
- { icon: 'github' as const, label: 'GitHub', href: self.repo },
41
- { icon: 'npm' as const, label: 'npm', href: self.npm },
40
+ { icon: "github" as const, label: "GitHub", href: self.repo },
41
+ { icon: "npm" as const, label: "npm", href: self.npm },
42
42
  ],
43
43
 
44
44
  editLink: {
@@ -46,48 +46,52 @@ export function sharedStarlightConfig({
46
46
  },
47
47
 
48
48
  // Order matters: fonts, then tokens+mapping, then per-site overrides.
49
- customCss: ['@rxova/brand/fonts.css', '@rxova/astro-ui/styles/starlight.css', ...customCss],
49
+ customCss: ["@rxova/brand/fonts.css", "@rxova/astro-ui/styles/starlight.css", ...customCss],
50
50
 
51
51
  components: {
52
52
  // The rxova mark (linking back to the umbrella site) plus the project wordmark.
53
- SiteTitle: '@rxova/astro-ui/starlight/SiteTitle.astro',
53
+ SiteTitle: "@rxova/astro-ui/starlight/SiteTitle.astro",
54
54
  // Appends the cross-project switcher to the social icons. Without it the
55
55
  // three docs sites are three islands under one domain.
56
- SocialIcons: '@rxova/astro-ui/starlight/SocialIcons.astro',
56
+ SocialIcons: "@rxova/astro-ui/starlight/SocialIcons.astro",
57
57
  // Starlight's default footer (pagination, edit link, last updated) plus
58
58
  // the shared four-column site footer beneath it.
59
- Footer: '@rxova/astro-ui/starlight/Footer.astro',
59
+ Footer: "@rxova/astro-ui/starlight/Footer.astro",
60
60
  // Starlight's own picker, plus a resync when a page is restored from the bfcache.
61
- ThemeSelect: '@rxova/astro-ui/starlight/ThemeSelect.astro',
61
+ ThemeSelect: "@rxova/astro-ui/starlight/ThemeSelect.astro",
62
+ // Starlight's header, plus a phone menu on pages without a sidebar, which get none.
63
+ Header: "@rxova/astro-ui/starlight/Header.astro",
64
+ // The foot of Starlight's phone menu: the projects, the sections, the social links and theme.
65
+ MobileMenuFooter: "@rxova/astro-ui/starlight/MobileMenuFooter.astro",
62
66
  ...components,
63
67
  },
64
68
 
65
69
  head: [
66
70
  {
67
- tag: 'meta' as const,
68
- attrs: { property: 'og:image', content: `${RXOVA_ORIGIN}/og/${project}.png` },
71
+ tag: "meta" as const,
72
+ attrs: { property: "og:image", content: `${RXOVA_ORIGIN}/og/${project}.png` },
69
73
  },
70
74
  {
71
- tag: 'meta' as const,
72
- attrs: { name: 'twitter:card', content: 'summary_large_image' },
75
+ tag: "meta" as const,
76
+ attrs: { name: "twitter:card", content: "summary_large_image" },
73
77
  },
74
78
  // SoftwareSourceCode JSON-LD built from PROJECTS, on every docs page: Starlight has no
75
79
  // "site index only" hook.
76
80
  {
77
- tag: 'script' as const,
78
- attrs: { type: 'application/ld+json' },
81
+ tag: "script" as const,
82
+ attrs: { type: "application/ld+json" },
79
83
  content: JSON.stringify({
80
- '@context': 'https://schema.org',
81
- '@type': 'SoftwareSourceCode',
84
+ "@context": "https://schema.org",
85
+ "@type": "SoftwareSourceCode",
82
86
  name: self.label,
83
87
  description: self.tagline,
84
88
  url: `${RXOVA_ORIGIN}${self.mount}`,
85
89
  codeRepository: self.repo,
86
- programmingLanguage: 'TypeScript',
87
- runtimePlatform: 'Node.js',
88
- license: 'https://opensource.org/licenses/MIT',
89
- author: { '@type': 'Person', name: 'Jonatan Kruszewski' },
90
- }).replace(/</g, '\\u003c'),
90
+ programmingLanguage: "TypeScript",
91
+ runtimePlatform: "Node.js",
92
+ license: "https://opensource.org/licenses/MIT",
93
+ author: { "@type": "Person", name: "Jonatan Kruszewski" },
94
+ }).replace(/</g, "\\u003c"),
91
95
  },
92
96
  ],
93
97
 
@@ -95,5 +99,5 @@ export function sharedStarlightConfig({
95
99
  pagefind: true,
96
100
 
97
101
  sidebar,
98
- }
102
+ };
99
103
  }
@@ -3,6 +3,6 @@
3
3
  * No reset, which is document.css: unlayered, it would flatten a Starlight page this is composed into.
4
4
  */
5
5
 
6
- @import '@rxova/brand/tokens.css';
6
+ @import "@rxova/brand/tokens.css";
7
7
  /* The footer every surface renders, Starlight or not. */
8
- @import './footer.css';
8
+ @import "./footer.css";
@@ -3,7 +3,7 @@
3
3
  * element styles. Never inside a Starlight document, where the unlayered reset would flatten the page.
4
4
  */
5
5
 
6
- @import './chrome.css';
6
+ @import "./chrome.css";
7
7
 
8
8
  /* --- Reset ---------------------------------------------------------------- */
9
9