@rxova/astro-ui 0.3.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxova/astro-ui",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Astro components, Starlight preset and shared chrome for rxova.org",
6
6
  "keywords": [
@@ -46,13 +46,13 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@rxova/brand": "^1.1.1",
49
+ "@rxova/brand": "^1.2.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.0",
55
+ "@rxova/repo-tooling": "0.0.1",
56
56
  "@types/node": "^26.6.1",
57
57
  "@vitest/coverage-v8": "^5.0.1",
58
58
  "astro": "^7.3.2",
@@ -0,0 +1,26 @@
1
+ ---
2
+ /**
3
+ * The umbrella navigation for a docs site: the project switcher, then the rxova.org sections.
4
+ * Starlight shows it in the header bar on wide screens and in the menu on phones.
5
+ */
6
+ import { RXOVA_ORIGIN, SECTIONS, type ProjectId } from '@rxova/brand'
7
+ import ProjectSwitcher from './ProjectSwitcher.astro'
8
+
9
+ interface Props {
10
+ /** The project whose docs these are, marked in the switcher. */
11
+ current?: ProjectId
12
+ /** Prefix for the section links. '' links root-relative, for a build served on rxova.org. */
13
+ origin?: string
14
+ }
15
+
16
+ const { current, origin = RXOVA_ORIGIN } = Astro.props
17
+ ---
18
+
19
+ <nav class="rx-sections" aria-label="rxova.org">
20
+ <ProjectSwitcher current={current} />
21
+ {SECTIONS.map((section) => (
22
+ <a class="rx-sections__link" href={`${origin}${section.path}`}>
23
+ {section.label}
24
+ </a>
25
+ ))}
26
+ </nav>
@@ -3,7 +3,7 @@
3
3
  * The rxova footer on every surface: brand block, link columns, then copyright and legal links.
4
4
  * Styles live in `../styles/footer.css`. Hrefs are absolute unless `origin` is '' (on rxova.org).
5
5
  */
6
- import { PROJECTS, RXOVA_ORIGIN, getProject, type ProjectId } from '@rxova/brand'
6
+ import { PROJECTS, RXOVA_ORIGIN, SECTIONS, getProject, type ProjectId } from '@rxova/brand'
7
7
 
8
8
  /** A standalone surface of rxova.org, for the "Site" column. */
9
9
  export interface SiteLink {
@@ -38,11 +38,8 @@ const year = new Date().getFullYear()
38
38
  const projectLinks: readonly SiteLink[] =
39
39
  projects ?? PROJECTS.map((p) => ({ label: p.label, href: `${origin}${p.mount}` }))
40
40
 
41
- const surfaces: readonly SiteLink[] = site ?? [
42
- { label: 'Blog', href: `${origin}/blog/` },
43
- { label: 'Updates', href: `${origin}/updates/` },
44
- { label: 'About', href: `${origin}/about/` },
45
- ]
41
+ const surfaces: readonly SiteLink[] =
42
+ site ?? SECTIONS.map((section) => ({ label: section.label, href: `${origin}${section.path}` }))
46
43
  ---
47
44
 
48
45
  <footer class="rx-footer">
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  /**
3
- * Starlight `SocialIcons` override: the stock icons plus the project switcher, which lands just
4
- * before search and the theme toggle.
3
+ * Starlight `SocialIcons` override: the umbrella navigation, then the stock icons. Starlight
4
+ * renders this slot in the header on wide screens and in the mobile menu, so one header serves both.
5
5
  */
6
6
  import Default from '@astrojs/starlight/components/SocialIcons.astro'
7
- import ProjectSwitcher from '../components/ProjectSwitcher.astro'
7
+ import SectionNav from '../components/SectionNav.astro'
8
8
  import { projectFromBase } from '@rxova/brand'
9
9
 
10
10
  // Overrides receive no props, so the current project is inferred from the base
@@ -12,7 +12,7 @@ import { projectFromBase } from '@rxova/brand'
12
12
  const current = projectFromBase(import.meta.env.BASE_URL)
13
13
  ---
14
14
 
15
- <ProjectSwitcher current={current} />
15
+ <SectionNav current={current} />
16
16
  <Default>
17
17
  <slot />
18
18
  </Default>
@@ -16,8 +16,6 @@ export interface SharedStarlightOptions {
16
16
  components?: Record<string, string>
17
17
  /** Path under the repo root that holds the docs site, for the edit link. */
18
18
  editLinkBase?: string
19
- /** Build body-only docs for rxova-website's shell: Starlight's page UI stays, the footer goes. */
20
- pageComponent?: boolean
21
19
  }
22
20
 
23
21
  export function sharedStarlightConfig({
@@ -26,7 +24,6 @@ export function sharedStarlightConfig({
26
24
  customCss = [],
27
25
  components = {},
28
26
  editLinkBase = 'apps/docs',
29
- pageComponent = false,
30
27
  }: SharedStarlightOptions) {
31
28
  const self = getProject(project)
32
29
 
@@ -59,7 +56,7 @@ export function sharedStarlightConfig({
59
56
  SocialIcons: '@rxova/astro-ui/starlight/SocialIcons.astro',
60
57
  // Starlight's default footer (pagination, edit link, last updated) plus
61
58
  // the shared four-column site footer beneath it.
62
- ...(!pageComponent ? { Footer: '@rxova/astro-ui/starlight/Footer.astro' } : {}),
59
+ Footer: '@rxova/astro-ui/starlight/Footer.astro',
63
60
  // Starlight's own picker, plus a resync when a page is restored from the bfcache.
64
61
  ThemeSelect: '@rxova/astro-ui/starlight/ThemeSelect.astro',
65
62
  ...components,
@@ -65,46 +65,6 @@ header.header {
65
65
  background: var(--sl-color-bg-nav);
66
66
  }
67
67
 
68
- /* In a schema-2 page bundle rxova-website renders the umbrella header outside `.page`; keep
69
- Starlight's sticky docs bar below it. */
70
- html[data-rxova-shell] {
71
- --rx-shell-header-height: 3.5rem;
72
- }
73
-
74
- html[data-rxova-shell] .page > header.header {
75
- inset-block-start: var(--rx-shell-header-height);
76
- }
77
-
78
- html[data-rxova-shell] .sidebar-pane {
79
- inset-block-start: calc(var(--rx-shell-header-height) + var(--sl-nav-height));
80
- }
81
-
82
- html[data-rxova-shell] mobile-starlight-toc nav {
83
- top: calc(var(--rx-shell-header-height) + var(--sl-nav-height) - 1px);
84
- }
85
-
86
- /* Starlight 0.42 dropped the <starlight-menu-button> wrapper for a bare
87
- button.sl-menu-button; the peer range still covers the older markup. */
88
- html[data-rxova-shell] starlight-menu-button button,
89
- html[data-rxova-shell] .sl-menu-button {
90
- top: calc(
91
- var(--rx-shell-header-height) + (var(--sl-nav-height) - var(--sl-menu-button-size)) / 2
92
- );
93
- }
94
-
95
- @media (min-width: 72rem) {
96
- html[data-rxova-shell] .right-sidebar {
97
- top: var(--rx-shell-header-height);
98
- height: calc(100vh - var(--rx-shell-header-height));
99
- }
100
- }
101
-
102
- @media (max-width: 34rem) {
103
- html[data-rxova-shell] {
104
- --rx-shell-header-height: 3.25rem;
105
- }
106
- }
107
-
108
68
  /* Site title: the rxova mark sits beside the project wordmark. */
109
69
  .rx-site-title {
110
70
  display: flex;
@@ -157,6 +117,42 @@ html[data-rxova-shell] .sl-menu-button {
157
117
  background: var(--rx-gradient);
158
118
  }
159
119
 
120
+ /* Umbrella navigation: the switcher and the rxova.org sections, beside the social icons. */
121
+ .rx-sections {
122
+ display: flex;
123
+ align-items: center;
124
+ gap: 1rem;
125
+ }
126
+
127
+ .rx-sections__link {
128
+ color: var(--sl-color-gray-2);
129
+ font-size: var(--sl-text-sm);
130
+ text-decoration: none;
131
+ white-space: nowrap;
132
+ }
133
+
134
+ .rx-sections__link:hover {
135
+ color: var(--sl-color-white);
136
+ }
137
+
138
+ /* In the mobile menu the icons share a row with the theme picker; the navigation takes a row
139
+ of its own above them. */
140
+ .mobile-preferences .social-icons {
141
+ flex-wrap: wrap;
142
+ }
143
+
144
+ .mobile-preferences .rx-sections {
145
+ flex-basis: 100%;
146
+ }
147
+
148
+ /* In the phone menu the switcher sits at the left edge and at the bottom of the menu, so its
149
+ list opens rightward and upward instead of off-screen. */
150
+ .mobile-preferences .rx-switcher .rx-switcher__menu {
151
+ inset-inline: 0 auto;
152
+ inset-block-end: 100%;
153
+ margin: 0 0 0.4rem;
154
+ }
155
+
160
156
  /* --- Footer -------------------------------------------------------------- */
161
157
 
162
158
  /* Footer styles live in footer.css (imported above) because /blog and /updates need them too. */