@rxova/brand 0.15.1 → 1.1.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/src/chrome.css DELETED
@@ -1,59 +0,0 @@
1
- /**
2
- * Everything the shared chrome needs, and nothing that touches the document.
3
- *
4
- * `Header`, `SiteFooter` and `ThemeToggle` are rendered on two kinds of page:
5
- * plain Astro surfaces that own their whole document (the landing, /blog,
6
- * /updates — see astro.css), and rxova-website's shell templates, whose body is
7
- * composed into an already-complete Starlight document at deploy time.
8
- *
9
- * The second case is why this file exists. It carries the tokens, the footer's
10
- * styles and the short aliases the chrome's scoped CSS is written against — but
11
- * no reset and no base element styling. Those belong to whoever owns the
12
- * document, and a shell that brings its own into a Starlight page destroys that
13
- * page: Starlight puts all of its CSS in `@layer starlight.*`, and an unlayered
14
- * `* { margin: 0; padding: 0 }` arriving from the shell beats every layered rule
15
- * it has, whatever the specificity. That is not a hypothetical — it flattened
16
- * every /packages/* docs page on rxova.org.
17
- *
18
- * So: load this to render the chrome, and astro.css (which is this plus the
19
- * reset) to own a document.
20
- */
21
-
22
- @import './tokens.css';
23
- /* The shared site footer, which /blog, /updates and the landing all render. It
24
- is the one piece of chrome common to these surfaces and the Starlight ones,
25
- so its rules sit in their own file and both entry points pull them in. */
26
- @import './footer.css';
27
-
28
- /* The short token names the landing and the shared chrome were written against
29
- (`--bg`, `--fg`, `--rule`, …), aliased onto their `--rx-*` equivalents, so
30
- adopting this package did not require rewriting several hundred lines of
31
- scoped component styles in one go. New work should use `--rx-*` directly; the
32
- aliases exist to make the migration incremental, not to be a second API. */
33
- :root {
34
- --bg: var(--rx-bg);
35
- --fg: var(--rx-fg);
36
- --muted: var(--rx-muted);
37
- --faint: var(--rx-faint);
38
- --rule: var(--rx-rule);
39
- --card: var(--rx-card);
40
- --tag-bg: var(--rx-tag-bg);
41
- --glow-tint: var(--rx-glow-tint);
42
- --font: var(--rx-font-sans);
43
- --mono: var(--rx-font-mono);
44
-
45
- /* The page width: the header, the page and the footer all centre on it, so
46
- it is the wide bound rather than the prose one. It was `--rx-max` (44rem),
47
- which put /blog, /updates and /about in a narrow column under a header that
48
- spans the landing's 72rem — narrow on a large screen, and a different
49
- width from one page to the next. Running text keeps its own measure inside
50
- it (the blog's 62–68ch, the updates stream's 68ch), so widening the page
51
- does not lengthen a line of prose. */
52
- --max: var(--rx-max-wide);
53
-
54
- /* The landing's `--accent` is the foreground, not the brand violet: its
55
- design is deliberately monochrome and uses the gradient only as an accent
56
- rule. Mapping this to --rx-primary would tint every focus ring on the
57
- site. */
58
- --accent: var(--rx-fg);
59
- }
@@ -1,20 +0,0 @@
1
- ---
2
- /**
3
- * Starlight `Footer` override.
4
- *
5
- * Keeps everything Starlight puts at the bottom of a doc page — pagination,
6
- * "edit this page", last-updated — and adds the shared rxova site footer
7
- * beneath it. Replacing rather than wrapping would have cost the pagination,
8
- * which is load-bearing navigation on a docs site.
9
- */
10
- import Default from '@astrojs/starlight/components/Footer.astro'
11
- import SiteFooter from './SiteFooter.astro'
12
- import { projectFromBase } from '../sites.ts'
13
-
14
- const project = projectFromBase(import.meta.env.BASE_URL)
15
- ---
16
-
17
- <Default>
18
- <slot />
19
- </Default>
20
- <SiteFooter project={project} />
@@ -1,170 +0,0 @@
1
- ---
2
- /**
3
- * The rxova.org header — the one every plain-Astro surface renders.
4
- *
5
- * There used to be two copies of this markup and its styles: one inside
6
- * `SiteShell` (for /blog and /updates) and a hand-rolled twin in the website
7
- * repo (for the landing at `/`). They drifted — the landing missed the sticky
8
- * update the shell got — which is exactly the failure mode of a header that
9
- * lives in more than one place. This is the single copy; `SiteShell` renders it,
10
- * and the website imports it over npm and renders it too.
11
- *
12
- * It takes the menu as data rather than owning it. The two surfaces resolve their
13
- * URLs differently — the shell links absolutely through `siteUrl` because /blog
14
- * and /updates are mounted at their own base paths, while the landing sits at the
15
- * root and links relatively — and the landing's menu is derived from what is
16
- * actually deployed. So each caller passes a fully-resolved list; this owns how
17
- * the header *looks and behaves*, which is the part that was drifting.
18
- *
19
- * Not for the docs sites at /packages/*: those are Starlight and take their
20
- * chrome from `sharedStarlightConfig`, not from an Astro component.
21
- */
22
- import ThemeToggle from './ThemeToggle.astro'
23
-
24
- export interface HeaderItem {
25
- label: string
26
- /** Fully resolved by the caller — absolute or root-relative as its base needs. */
27
- href: string
28
- /** Marks the item for the surface the reader is on. */
29
- current?: boolean
30
- }
31
-
32
- interface Props {
33
- /** Where the brand mark links — the site root, resolved by the caller. */
34
- homeHref: string
35
- /** Logo `src`, resolved by the caller for its base. */
36
- logoSrc: string
37
- /** The menu, in the one fixed order every surface shows it. */
38
- items: readonly HeaderItem[]
39
- }
40
-
41
- const { homeHref, logoSrc, items } = Astro.props
42
- ---
43
-
44
- {/* Outside <main> in every shell so it can span the viewport while its contents
45
- stay on the page's measure. Sticky rather than fixed: it still takes part in
46
- layout, so nothing below needs a compensating top margin. */}
47
- <header class="site">
48
- <div class="site__inner">
49
- <a class="brand" href={homeHref}>
50
- <img src={logoSrc} alt="" width="28" height="28" />
51
- <span>Rxova</span>
52
- </a>
53
- <nav aria-label="Sections">
54
- {items.map((item) => (
55
- <a href={item.href} aria-current={item.current ? 'page' : undefined}>
56
- {item.label}
57
- </a>
58
- ))}
59
- </nav>
60
- {/* In the header, not floating over it — see ThemeToggle's `floating`. */}
61
- <ThemeToggle floating={false} />
62
- </div>
63
- </header>
64
-
65
- <style>
66
- /* Sticky, translucent, full-bleed. It was a plain in-flow row with the theme
67
- button floating over its right end, which on a phone put the button on top
68
- of the nav links and left the header behind as soon as you scrolled — a long
69
- post gave you no way back without scrolling to the top. */
70
- .site {
71
- position: sticky;
72
- top: 0;
73
- z-index: 10;
74
- border-bottom: 1px solid var(--rule);
75
- background: color-mix(in srgb, var(--bg) 88%, transparent);
76
- }
77
-
78
- /* The blur is what keeps text legible as it passes under the bar. Where it is
79
- unsupported the background falls back to nearly opaque, which is why the mix
80
- above is 88% and not 60%. */
81
- @supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
82
- .site {
83
- background: color-mix(in srgb, var(--bg) 72%, transparent);
84
- -webkit-backdrop-filter: blur(10px);
85
- backdrop-filter: blur(10px);
86
- }
87
- }
88
-
89
- .site__inner {
90
- max-width: var(--max);
91
- margin: 0 auto;
92
- padding: 0.75rem 1.5rem;
93
- display: flex;
94
- align-items: center;
95
- gap: 1rem;
96
- /* No wrapping: a two-line header would eat a phone's viewport, and the row
97
- is sized to fit at the narrowest widths we support. */
98
- min-height: 3.5rem;
99
- }
100
-
101
- .brand {
102
- display: inline-flex;
103
- align-items: center;
104
- gap: 0.55rem;
105
- color: var(--fg);
106
- text-decoration: none;
107
- font-weight: 640;
108
- letter-spacing: -0.01em;
109
- }
110
- .brand img {
111
- display: block;
112
- border-radius: 6px;
113
- }
114
-
115
- /* The nav takes the space between the brand and the toggle, and pushes itself
116
- to the right of it. */
117
- nav {
118
- margin-left: auto;
119
- display: flex;
120
- gap: 1.4rem;
121
- }
122
- nav a {
123
- color: var(--muted);
124
- text-decoration: none;
125
- font-size: 0.95rem;
126
- white-space: nowrap;
127
- }
128
- nav a:hover {
129
- color: var(--fg);
130
- }
131
- /* The current section is marked for everyone, not only for assistive tech —
132
- aria-current on its own is invisible. */
133
- nav a[aria-current='page'] {
134
- color: var(--fg);
135
- text-decoration: underline;
136
- text-underline-offset: 5px;
137
- }
138
- nav a:focus-visible {
139
- outline: 2px solid var(--accent);
140
- outline-offset: 3px;
141
- border-radius: 2px;
142
- }
143
-
144
- /* Brand mark, the links and the toggle stay on one row at the narrowest phones
145
- by dropping the wordmark — the logo carries the identity in the space left. */
146
- @media (max-width: 34rem) {
147
- .site__inner {
148
- gap: 0.75rem;
149
- padding-inline: 1rem;
150
- min-height: 3.25rem;
151
- }
152
- nav {
153
- gap: 0.9rem;
154
- }
155
- nav a {
156
- font-size: 0.875rem;
157
- }
158
- .brand span {
159
- display: none;
160
- }
161
- }
162
- </style>
163
-
164
- <!-- Global because `html` sits outside Astro's scoping. Without it a jump to an
165
- in-page anchor would land under the sticky header. -->
166
- <style is:global>
167
- html {
168
- scroll-padding-top: 4.5rem;
169
- }
170
- </style>
@@ -1,102 +0,0 @@
1
- ---
2
- /**
3
- * Cross-project navigation.
4
- *
5
- * rxova.org serves four surfaces from one origin, and before this existed there
6
- * was no way to get from one project's docs to another's without going back to
7
- * the landing. Every href is absolute — a relative one would resolve under the
8
- * current site's base path.
9
- *
10
- * Rendered as a `<details>` so it works with zero JavaScript; the current
11
- * project gets the gradient dot (see `.rx-switcher__current` in starlight.css).
12
- */
13
- import { PROJECTS, RXOVA_ORIGIN, type ProjectId } from '../sites.ts'
14
-
15
- interface Props {
16
- /** Which project this site is, so it can be marked as current. */
17
- current?: ProjectId
18
- }
19
-
20
- const { current } = Astro.props
21
- ---
22
-
23
- <details class="rx-switcher">
24
- <summary class="rx-switcher__trigger" aria-label="Switch project">
25
- Projects
26
- <svg aria-hidden="true" viewBox="0 0 16 16" width="12" height="12">
27
- <path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.75"></path>
28
- </svg>
29
- </summary>
30
- <ul class="rx-switcher__menu">
31
- <li>
32
- <a href={RXOVA_ORIGIN}>rxova.org</a>
33
- </li>
34
- {PROJECTS.map((project) => (
35
- <li>
36
- <a
37
- href={`${RXOVA_ORIGIN}${project.mount}`}
38
- class={project.id === current ? 'rx-switcher__current' : undefined}
39
- aria-current={project.id === current ? 'page' : undefined}
40
- >
41
- {project.label}
42
- </a>
43
- </li>
44
- ))}
45
- </ul>
46
- </details>
47
-
48
- <style>
49
- .rx-switcher__trigger {
50
- display: flex;
51
- align-items: center;
52
- gap: 0.3rem;
53
- padding: 0.25rem 0.5rem;
54
- border-radius: var(--rx-radius-sm);
55
- color: var(--sl-color-gray-2);
56
- font-size: var(--sl-text-sm);
57
- cursor: pointer;
58
- list-style: none;
59
- }
60
-
61
- .rx-switcher__trigger::-webkit-details-marker {
62
- display: none;
63
- }
64
-
65
- .rx-switcher__trigger:hover {
66
- color: var(--sl-color-white);
67
- background: var(--sl-color-gray-6);
68
- }
69
-
70
- .rx-switcher[open] > .rx-switcher__trigger svg {
71
- transform: rotate(180deg);
72
- }
73
-
74
- .rx-switcher__menu {
75
- position: absolute;
76
- z-index: var(--sl-z-index-navbar, 20);
77
- inset-inline-end: 0;
78
- min-width: 12rem;
79
- margin: 0.4rem 0 0;
80
- padding: 0.35rem;
81
- border: 1px solid var(--sl-color-hairline);
82
- border-radius: var(--rx-radius);
83
- background: var(--sl-color-bg-nav);
84
- box-shadow: var(--sl-shadow-md);
85
- list-style: none;
86
- }
87
-
88
- .rx-switcher__menu a {
89
- display: flex;
90
- align-items: center;
91
- padding: 0.4rem 0.6rem;
92
- border-radius: var(--rx-radius-sm);
93
- color: var(--sl-color-gray-2);
94
- font-size: var(--sl-text-sm);
95
- text-decoration: none;
96
- }
97
-
98
- .rx-switcher__menu a:hover {
99
- color: var(--sl-color-white);
100
- background: var(--sl-color-gray-6);
101
- }
102
- </style>
@@ -1,190 +0,0 @@
1
- ---
2
- /**
3
- * The rxova footer, shared by every surface.
4
- *
5
- * Before this, the landing had a single dot-separated link row and the three
6
- * docs sites had a bare copyright line (journey went further and hid its footer
7
- * links outright). The footer is the second-best place, after the switcher, to
8
- * make one origin feel like one site — so it carries the full project list on
9
- * every page.
10
- *
11
- * Shape: a brand block that says what rxova is, the link columns, then a bottom
12
- * bar with the copyright and the legal links. The legal links are down there
13
- * rather than in a column because that is where a reader looks for them, and it
14
- * keeps the columns to things someone might actually want to click.
15
- *
16
- * Styles are in `../footer.css`, imported by both `astro.css` and
17
- * `starlight.css` — see that file for why they are not scoped here.
18
- *
19
- * All cross-project hrefs are absolute; see sites.ts for why.
20
- */
21
- import { PROJECTS, RXOVA_ORIGIN, getProject, siteUrl, type ProjectId } from '../sites.ts'
22
-
23
- /** A standalone surface of rxova.org, for the "Site" column. */
24
- export interface SiteLink {
25
- label: string
26
- /** Absolute — see sites.ts. */
27
- href: string
28
- }
29
-
30
- interface Props {
31
- /** Current project, if this is a docs site. Omitted on the landing. */
32
- project?: ProjectId
33
- /** Optional per-site "Docs" column. */
34
- docs?: { label: string; href: string }[]
35
- /**
36
- * The standalone surfaces to list under "Site", below Home.
37
- *
38
- * It is a prop because only the umbrella repo knows which *mounted* surfaces
39
- * are actually deployed — `sources.json` gates the mount and the link
40
- * together — and a hardcoded list advertises a 404 for a surface whose first
41
- * build has not landed yet. Same reason `Header` takes `items`.
42
- *
43
- * The default covers the caller that cannot know: a docs site, or this
44
- * package's own shell. /about is safe to include there unconditionally
45
- * because it is a page of the landing's Astro build rather than a mount —
46
- * there is no artifact to wait for, so it exists whenever the landing does.
47
- */
48
- site?: readonly SiteLink[]
49
- /**
50
- * The projects whose docs are actually mounted.
51
- *
52
- * A prop for exactly the reason `site` is one, and it was missed: only the
53
- * umbrella repo knows which projects are deployed — `sources.json` gates the
54
- * mount and the link together — while this package knows only that a project
55
- * exists. Mapping `PROJECTS` unconditionally put a link to every project's
56
- * docs in the footer of every page on the origin, including projects whose
57
- * docs are switched off, so the whole site advertised a 404.
58
- *
59
- * The default is every project, which is right for the caller that cannot
60
- * know: a docs site is itself proof that mounts exist, and it has no view of
61
- * the registry.
62
- */
63
- projects?: readonly SiteLink[]
64
- }
65
-
66
- const { project, docs, site, projects } = Astro.props
67
- const self = project ? getProject(project) : undefined
68
- const year = new Date().getFullYear()
69
-
70
- const projectLinks: readonly SiteLink[] =
71
- projects ?? PROJECTS.map((p) => ({ label: p.label, href: `${RXOVA_ORIGIN}${p.mount}` }))
72
-
73
- const surfaces: readonly SiteLink[] = site ?? [
74
- { label: 'Blog', href: siteUrl('/blog') },
75
- { label: 'Updates', href: siteUrl('/updates') },
76
- { label: 'About', href: siteUrl('/about') },
77
- ]
78
- ---
79
-
80
- <footer class="rx-footer">
81
- <div class="rx-footer__top">
82
- <div class="rx-footer__brand">
83
- <a class="rx-footer__mark" href={RXOVA_ORIGIN}>
84
- <img src={siteUrl('/rxova-logo-256.png')} alt="" width="28" height="28" loading="lazy" />
85
- <span>Rxova</span>
86
- </a>
87
- {/* Not "React libraries": most of these ship a framework-agnostic core
88
- that runs in a worker or a plain script, journey also ships a browser
89
- extension, and overlock is a command-line tool that never sees a
90
- browser at all. React is a binding we provide, not the boundary of
91
- what these are. Same correction as the landing's hero. */}
92
- <p class="rx-footer__blurb">
93
- Small TypeScript libraries and developer tools, documented in one place. MIT licensed, built
94
- in the open.
95
- </p>
96
- </div>
97
-
98
- <div class="rx-footer__columns">
99
- {docs && docs.length > 0 && (
100
- <div>
101
- <h2 class="rx-footer__title">Docs</h2>
102
- <ul class="rx-footer__list">
103
- {docs.map((link) => (
104
- <li>
105
- <a href={link.href}>{link.label}</a>
106
- </li>
107
- ))}
108
- </ul>
109
- </div>
110
- )}
111
-
112
- {projectLinks.length > 0 && (
113
- <div>
114
- <h2 class="rx-footer__title">Projects</h2>
115
- <ul class="rx-footer__list">
116
- {projectLinks.map((link) => (
117
- <li>
118
- <a href={link.href}>{link.label}</a>
119
- </li>
120
- ))}
121
- </ul>
122
- </div>
123
- )}
124
-
125
- {self && (
126
- <div>
127
- <h2 class="rx-footer__title">Community</h2>
128
- <ul class="rx-footer__list">
129
- <li>
130
- <a href={self.repo}>GitHub</a>
131
- </li>
132
- <li>
133
- <a href={`${self.repo}/issues`}>Issues</a>
134
- </li>
135
- <li>
136
- <a href={`${self.repo}/discussions`}>Discussions</a>
137
- </li>
138
- <li>
139
- <a href={self.npm}>npm</a>
140
- </li>
141
- <li>
142
- <a href={`${self.repo}/blob/main/CONTRIBUTING.md`}>Contributing</a>
143
- </li>
144
- </ul>
145
- </div>
146
- )}
147
-
148
- {/* Blog and Updates are here on every surface, docs sites included: they
149
- were reachable only from the umbrella landing, which meant a reader
150
- who arrived on a docs page from a search result never learned the
151
- rest of the site existed. */}
152
- <div>
153
- <h2 class="rx-footer__title">Site</h2>
154
- <ul class="rx-footer__list">
155
- <li>
156
- <a href={RXOVA_ORIGIN}>Home</a>
157
- </li>
158
- {surfaces.map((s) => (
159
- <li>
160
- <a href={s.href}>{s.label}</a>
161
- </li>
162
- ))}
163
- </ul>
164
- </div>
165
-
166
- <div>
167
- <h2 class="rx-footer__title">Connect</h2>
168
- <ul class="rx-footer__list">
169
- <li>
170
- <a href="https://github.com/rxova">GitHub</a>
171
- </li>
172
- <li>
173
- <a href="https://www.npmjs.com/org/rxova">npm</a>
174
- </li>
175
- <li>
176
- <a href="mailto:rxova@proton.me">rxova@proton.me</a>
177
- </li>
178
- </ul>
179
- </div>
180
- </div>
181
- </div>
182
-
183
- <div class="rx-footer__legal">
184
- <p>© {year} Rxova · MIT licensed</p>
185
- <div class="rx-footer__legal-links">
186
- <a href={siteUrl('/privacy')}>Privacy</a>
187
- <a href={siteUrl('/terms')}>Terms</a>
188
- </div>
189
- </div>
190
- </footer>