@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/MIGRATION.md +52 -0
- package/README.md +16 -72
- package/package.json +5 -22
- package/src/feed.ts +6 -38
- package/src/fonts.css +2 -34
- package/src/index.ts +2 -9
- package/src/sites.links.test.ts +7 -12
- package/src/sites.test.ts +1 -5
- package/src/sites.ts +8 -42
- package/src/tokens.css +8 -29
- package/src/astro.css +0 -90
- package/src/chrome.css +0 -59
- package/src/components/Footer.astro +0 -20
- package/src/components/Header.astro +0 -170
- package/src/components/ProjectSwitcher.astro +0 -102
- package/src/components/SiteFooter.astro +0 -190
- package/src/components/SiteShell.astro +0 -188
- package/src/components/SiteTitle.astro +0 -46
- package/src/components/SocialIcons.astro +0 -21
- package/src/components/ThemeScript.astro +0 -55
- package/src/components/ThemeSelect.astro +0 -59
- package/src/components/ThemeToggle.astro +0 -197
- package/src/env.d.ts +0 -21
- package/src/footer.css +0 -146
- package/src/starlight.css +0 -178
- package/src/starlight.ts +0 -134
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Migrating to @rxova/brand 1.0
|
|
2
|
+
|
|
3
|
+
1.0 reduces `@rxova/brand` to tokens, typefaces and project data. Everything
|
|
4
|
+
component-shaped moved to [`@rxova/astro-ui`](../astro-ui), unchanged apart from
|
|
5
|
+
its import path.
|
|
6
|
+
|
|
7
|
+
## 1. Install both
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @rxova/brand@^1 @rxova/astro-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 2. Import the Starlight preset from astro-ui
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
- import { sharedStarlightConfig } from '@rxova/brand'
|
|
17
|
+
+ import { sharedStarlightConfig } from '@rxova/astro-ui/starlight'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Its options and output are the same. The component and stylesheet paths it
|
|
21
|
+
returns now point into `@rxova/astro-ui`.
|
|
22
|
+
|
|
23
|
+
## 3. Update direct imports
|
|
24
|
+
|
|
25
|
+
| 0.x | 1.0 |
|
|
26
|
+
| -------------------------------------------------- | -------------------------------------------- |
|
|
27
|
+
| `@rxova/brand/components/<Chrome>.astro` | `@rxova/astro-ui/components/<Chrome>.astro` |
|
|
28
|
+
| `@rxova/brand/components/<Override>.astro` | `@rxova/astro-ui/starlight/<Override>.astro` |
|
|
29
|
+
| `@rxova/brand/astro.css` | `@rxova/astro-ui/styles/document.css` |
|
|
30
|
+
| `@rxova/brand/chrome.css` | `@rxova/astro-ui/styles/chrome.css` |
|
|
31
|
+
| `@rxova/brand/starlight.css` | `@rxova/astro-ui/styles/starlight.css` |
|
|
32
|
+
| `@rxova/brand/tokens.css`, `fonts.css`, `assets/*` | unchanged |
|
|
33
|
+
|
|
34
|
+
`<Chrome>` is `SiteShell`, `Header`, `SiteFooter`, `ProjectSwitcher`,
|
|
35
|
+
`ThemeToggle` or `ThemeScript`. `<Override>` is `SiteTitle`, `SocialIcons`,
|
|
36
|
+
`Footer` or `ThemeSelect`.
|
|
37
|
+
|
|
38
|
+
## 4. Rename the short token aliases
|
|
39
|
+
|
|
40
|
+
`chrome.css` no longer defines the short aliases. Use the tokens directly:
|
|
41
|
+
|
|
42
|
+
| Alias | Token |
|
|
43
|
+
| ---------------------------------------------------------------------------- | ----------------------------------- |
|
|
44
|
+
| `--bg` `--fg` `--muted` `--faint` `--rule` `--card` `--tag-bg` `--glow-tint` | `--rx-` + the same name |
|
|
45
|
+
| `--font` / `--mono` | `--rx-font-sans` / `--rx-font-mono` |
|
|
46
|
+
| `--max` | `--rx-max-wide` |
|
|
47
|
+
| `--accent` | `--rx-fg` |
|
|
48
|
+
|
|
49
|
+
## 5. Peer dependencies
|
|
50
|
+
|
|
51
|
+
`@rxova/brand` no longer peers on `astro` or `@astrojs/starlight`;
|
|
52
|
+
`@rxova/astro-ui` does, with Starlight optional.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1 align="center">@rxova/brand</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
Design tokens,
|
|
4
|
+
Design tokens, typefaces and project data for every
|
|
5
5
|
<a href="https://rxova.org">rxova.org</a> surface.
|
|
6
6
|
</p>
|
|
7
7
|
|
|
@@ -16,11 +16,11 @@ landing at `/`, plus [overlock](https://github.com/rxova/overlock),
|
|
|
16
16
|
[use-everywhere](https://github.com/rxova/use-everywhere) docs, each built in its
|
|
17
17
|
own repo and mounted as a static tree under `/packages/<name>/`.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
This package is what makes them one site: the tokens they are styled with and
|
|
20
|
+
the project list they link between. The components built on it, including the
|
|
21
|
+
Starlight preset, live in [`@rxova/astro-ui`](../astro-ui).
|
|
22
|
+
|
|
23
|
+
Upgrading from 0.x? See [MIGRATION.md](MIGRATION.md).
|
|
24
24
|
|
|
25
25
|
## Install
|
|
26
26
|
|
|
@@ -28,69 +28,14 @@ of them and owned by none.
|
|
|
28
28
|
pnpm add @rxova/brand
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Use
|
|
32
|
-
|
|
33
|
-
### In a Starlight docs site
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
// astro.config.mjs
|
|
37
|
-
import { defineConfig } from 'astro/config'
|
|
38
|
-
import starlight from '@astrojs/starlight'
|
|
39
|
-
import { sharedStarlightConfig } from '@rxova/brand'
|
|
40
|
-
|
|
41
|
-
export default defineConfig({
|
|
42
|
-
site: process.env.DOCS_URL ?? 'https://rxova.org',
|
|
43
|
-
// The aggregator mounts this build under its own path.
|
|
44
|
-
base: process.env.DOCS_BASE_URL ?? '/',
|
|
45
|
-
integrations: [
|
|
46
|
-
starlight(
|
|
47
|
-
sharedStarlightConfig({
|
|
48
|
-
project: 'use-everywhere',
|
|
49
|
-
// Note the nesting: Starlight 0.39 removed `label` + `autogenerate`
|
|
50
|
-
// as siblings, so an autogenerated group goes inside `items`.
|
|
51
|
-
sidebar: [{ label: 'Learn', items: [{ autogenerate: { directory: 'learn' } }] }],
|
|
52
|
-
}),
|
|
53
|
-
),
|
|
54
|
-
],
|
|
55
|
-
})
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
That gets you the tokens, the typefaces, the rxova mark linking back to the
|
|
59
|
-
umbrella site, the cross-project switcher, the shared four-column footer, and
|
|
60
|
-
Pagefind search.
|
|
61
|
-
|
|
62
|
-
### In a plain Astro site
|
|
63
|
-
|
|
64
|
-
```astro
|
|
65
|
-
---
|
|
66
|
-
import '@rxova/brand/fonts.css'
|
|
67
|
-
import '@rxova/brand/astro.css'
|
|
68
|
-
import SiteFooter from '@rxova/brand/components/SiteFooter.astro'
|
|
69
|
-
import { PROJECTS } from '@rxova/brand'
|
|
70
|
-
---
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
`astro.css` pulls in `chrome.css` — the tokens, the footer's styles and the
|
|
74
|
-
short aliases — and adds the reset and base element styles that Starlight gives
|
|
75
|
-
docs sites for free.
|
|
76
|
-
|
|
77
|
-
Use `chrome.css` on its own where something else already owns the document, such
|
|
78
|
-
as rxova-website's shell templates: their body is composed into a built
|
|
79
|
-
Starlight page, and the reset in `astro.css` is unlayered, so it would outrank
|
|
80
|
-
everything in `@layer starlight.*` and flatten that page.
|
|
81
|
-
|
|
82
31
|
## What's in it
|
|
83
32
|
|
|
84
|
-
| Export
|
|
85
|
-
|
|
|
86
|
-
| `@rxova/brand`
|
|
87
|
-
| `@rxova/brand/tokens.css`
|
|
88
|
-
| `@rxova/brand/
|
|
89
|
-
| `@rxova/brand/
|
|
90
|
-
| `@rxova/brand/chrome.css` | What the shared header and footer need, with nothing document-level |
|
|
91
|
-
| `@rxova/brand/fonts.css` | Self-hosted Space Grotesk + IBM Plex Mono |
|
|
92
|
-
| `@rxova/brand/components/*.astro` | `SiteTitle`, `SocialIcons`, `Footer`, `SiteFooter`, `ProjectSwitcher` |
|
|
93
|
-
| `@rxova/brand/assets/*` | The mark, logos and per-project OG images |
|
|
33
|
+
| Export | What it is |
|
|
34
|
+
| ------------------------- | ------------------------------------------------------------------------------------------ |
|
|
35
|
+
| `@rxova/brand` | `PROJECTS`, `REPOS`, `docsUrl()`, `siteUrl()`, `canonicalUrl()`, feeds |
|
|
36
|
+
| `@rxova/brand/tokens.css` | The `--rx-*` custom properties, `--rx-on-primary` included. Everything derives from these. |
|
|
37
|
+
| `@rxova/brand/fonts.css` | Self-hosted Space Grotesk + IBM Plex Mono |
|
|
38
|
+
| `@rxova/brand/assets/*` | The mark, logos and per-project OG images |
|
|
94
39
|
|
|
95
40
|
## The palette
|
|
96
41
|
|
|
@@ -117,11 +62,10 @@ pnpm run verify # audit, dedupe, format, lint, types, astro check, cards, cont
|
|
|
117
62
|
pnpm run og # re-render the social cards after a palette or tagline change
|
|
118
63
|
```
|
|
119
64
|
|
|
120
|
-
There is no build step: Astro resolves `.ts`
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
subpath resolves.
|
|
65
|
+
There is no build step: Astro resolves `.ts` straight from `node_modules`. That
|
|
66
|
+
means nothing would catch a file missing from `files` or a stale `exports` path,
|
|
67
|
+
which is what `pack:smoke` is for — it packs the real tarball and asserts every
|
|
68
|
+
declared subpath resolves.
|
|
125
69
|
|
|
126
70
|
The social cards are generated from `tokens.css` and `sites.ts`, so they cannot
|
|
127
71
|
drift from the brand — but they are committed, so a palette or tagline change
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxova/brand",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Design tokens,
|
|
5
|
+
"description": "Design tokens, typefaces and project data for rxova.org",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rxova",
|
|
8
8
|
"design-tokens",
|
|
9
|
-
"astro",
|
|
10
|
-
"starlight",
|
|
11
9
|
"theme"
|
|
12
10
|
],
|
|
13
11
|
"license": "MIT",
|
|
@@ -27,39 +25,25 @@
|
|
|
27
25
|
],
|
|
28
26
|
"files": [
|
|
29
27
|
"src",
|
|
30
|
-
"assets"
|
|
28
|
+
"assets",
|
|
29
|
+
"MIGRATION.md"
|
|
31
30
|
],
|
|
32
31
|
"exports": {
|
|
33
32
|
".": "./src/index.ts",
|
|
34
33
|
"./tokens.css": "./src/tokens.css",
|
|
35
|
-
"./astro.css": "./src/astro.css",
|
|
36
|
-
"./chrome.css": "./src/chrome.css",
|
|
37
|
-
"./starlight.css": "./src/starlight.css",
|
|
38
34
|
"./fonts.css": "./src/fonts.css",
|
|
39
|
-
"./components/*": "./src/components/*",
|
|
40
35
|
"./assets/*": "./assets/*",
|
|
41
36
|
"./package.json": "./package.json"
|
|
42
37
|
},
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"@astrojs/starlight": ">=0.36.0",
|
|
45
|
-
"astro": ">=5.6.0"
|
|
46
|
-
},
|
|
47
|
-
"peerDependenciesMeta": {
|
|
48
|
-
"@astrojs/starlight": {
|
|
49
|
-
"optional": true
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
38
|
"dependencies": {
|
|
53
39
|
"@fontsource/ibm-plex-mono": "^5.2.5",
|
|
54
40
|
"@fontsource/space-grotesk": "^5.2.5"
|
|
55
41
|
},
|
|
56
42
|
"devDependencies": {
|
|
57
|
-
"@astrojs/check": "^0.9.10",
|
|
58
|
-
"@astrojs/starlight": "^0.42.1",
|
|
59
43
|
"@resvg/resvg-js": "^2.6.2",
|
|
44
|
+
"@rxova/repo-tooling": "0.0.0",
|
|
60
45
|
"@types/node": "^26.6.1",
|
|
61
46
|
"@vitest/coverage-v8": "^5.0.1",
|
|
62
|
-
"astro": "^7.3.2",
|
|
63
47
|
"publint": "^0.3.24",
|
|
64
48
|
"satori": "^0.33.4",
|
|
65
49
|
"tsx": "^4.23.13",
|
|
@@ -68,7 +52,6 @@
|
|
|
68
52
|
},
|
|
69
53
|
"scripts": {
|
|
70
54
|
"typecheck": "tsc --noEmit",
|
|
71
|
-
"check:astro": "astro check",
|
|
72
55
|
"pack:smoke": "node --import tsx scripts/pack-smoke.ts",
|
|
73
56
|
"check:exports": "publint --strict",
|
|
74
57
|
"og": "node --import tsx scripts/generate-og.ts",
|
package/src/feed.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RSS 2.0 for the rxova.org surfaces that publish a stream.
|
|
3
|
-
*
|
|
4
|
-
* Hand-written rather than `@astrojs/rss`, for the same reason rxova-website
|
|
5
|
-
* hand-writes its sitemaps: this is a few hundred bytes of well-specified XML,
|
|
6
|
-
* both consumers are static Astro builds where the feed is one prerendered
|
|
7
|
-
* endpoint, and the dependency would be carried by two packages to save a
|
|
8
|
-
* `map()`. The escaping is the only part with teeth, and it is one function
|
|
9
|
-
* with its own tests.
|
|
10
|
-
*
|
|
11
|
-
* Deliberately in `@rxova/brand` rather than in either consumer: /blog and
|
|
12
|
-
* /updates are separate Astro projects that already share this package for
|
|
13
|
-
* their chrome, and a feed each would be the same file twice — which is how
|
|
14
|
-
* their two document shells came to differ before `SiteShell` existed.
|
|
15
|
-
*
|
|
16
|
-
* Node-only imports are avoided so this stays importable from an Astro
|
|
17
|
-
* endpoint in any runtime.
|
|
2
|
+
* Hand-written RSS 2.0 for the rxova.org surfaces that publish a stream (/blog and /updates).
|
|
3
|
+
* No Node-only imports, so it stays importable from an Astro endpoint in any runtime.
|
|
18
4
|
*/
|
|
19
5
|
|
|
20
|
-
/**
|
|
21
|
-
* Escape text for an XML text node or attribute value.
|
|
22
|
-
*
|
|
23
|
-
* `&` first, or the ampersands introduced by the later replacements get escaped
|
|
24
|
-
* a second time and `<` ships as `&lt;`.
|
|
25
|
-
*/
|
|
6
|
+
/** Escapes text for an XML node or attribute; `&` goes first so entities aren't double-escaped. */
|
|
26
7
|
export const escapeXml = (value: string): string =>
|
|
27
8
|
value
|
|
28
9
|
.replace(/&/g, '&')
|
|
@@ -54,25 +35,12 @@ export interface FeedOptions {
|
|
|
54
35
|
lastBuildDate?: Date
|
|
55
36
|
}
|
|
56
37
|
|
|
57
|
-
/**
|
|
58
|
-
* RFC 822, which is what RSS 2.0 requires — not ISO 8601.
|
|
59
|
-
*
|
|
60
|
-
* `toUTCString()` produces exactly this shape ("Sun, 09 Aug 2026 09:00:00 GMT")
|
|
61
|
-
* and is locale-independent, so it is used directly rather than assembled from
|
|
62
|
-
* day and month tables that would need their own test.
|
|
63
|
-
*/
|
|
38
|
+
/** RFC 822 date, as RSS 2.0 requires; `toUTCString()` yields exactly that, locale-independent. */
|
|
64
39
|
export const rfc822 = (date: Date): string => date.toUTCString()
|
|
65
40
|
|
|
66
41
|
/**
|
|
67
|
-
* A complete RSS 2.0 document.
|
|
68
|
-
*
|
|
69
|
-
* `dc:creator` carries bylines because RSS's own `<author>` element is specified
|
|
70
|
-
* as an email address, and publishing the maintainer's address to every
|
|
71
|
-
* aggregator that has ever scraped a feed is not worth a byline.
|
|
72
|
-
*
|
|
73
|
-
* Items are emitted in the order given; both callers hand them over newest-first
|
|
74
|
-
* already, and re-sorting here would quietly disagree with the page the feed
|
|
75
|
-
* describes.
|
|
42
|
+
* A complete RSS 2.0 document; bylines use `dc:creator` because `<author>` must be an email.
|
|
43
|
+
* Items are emitted in the order given (callers pass them newest-first).
|
|
76
44
|
*/
|
|
77
45
|
export function renderFeed({
|
|
78
46
|
title,
|
package/src/fonts.css
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Self-hosted
|
|
3
|
-
*
|
|
4
|
-
* Space Grotesk + IBM Plex Mono came from the journey docs, which was the only
|
|
5
|
-
* rxova surface with a real typographic identity. They are bundled here rather
|
|
6
|
-
* than pulled from Google Fonts at runtime: journey's original
|
|
7
|
-
* `@import url("https://fonts.googleapis.com/...")` sat inside a stylesheet, so
|
|
8
|
-
* it was a render-blocking third-party request on the critical path (bad LCP),
|
|
9
|
-
* and it leaked visitor IPs to a third party on an EU-facing site.
|
|
10
|
-
*
|
|
11
|
-
* Weights are deliberately narrow — the ones the design system actually uses.
|
|
12
|
-
* Adding a weight here costs every page on rxova.org, so add only on demand.
|
|
13
|
-
*
|
|
14
|
-
* The @font-face rules are declared here rather than `@import`ed from
|
|
15
|
-
* @fontsource's own per-weight stylesheets, for two reasons:
|
|
16
|
-
*
|
|
17
|
-
* 1. `font-display`. Fontsource hardcodes `swap`, which paints every page in
|
|
18
|
-
* the fallback face and then re-paints it in Space Grotesk — the flash of
|
|
19
|
-
* unstyled text you see on each navigation, because these are multi-page
|
|
20
|
-
* sites where every link click is a fresh document. `optional` removes it:
|
|
21
|
-
* the browser blocks invisibly for ~100ms, uses the font if it is there
|
|
22
|
-
* (which it is, from the HTTP cache, on every navigation after the first)
|
|
23
|
-
* and otherwise keeps the fallback for that page with no swap. There is no
|
|
24
|
-
* third state where text changes shape after paint.
|
|
25
|
-
* 2. Nested `@import` serialises. A consumer's stylesheet importing this file
|
|
26
|
-
* importing fontsource's meant the browser could not even discover the font
|
|
27
|
-
* URLs until two stylesheets had been fetched and parsed, which made the
|
|
28
|
-
* swap late enough to always be visible.
|
|
29
|
-
*
|
|
30
|
-
* Only woff2 is referenced — fontsource also ships woff, but every browser that
|
|
31
|
-
* runs an Astro 5 site supports woff2.
|
|
32
|
-
*
|
|
33
|
-
* These blocks are transcribed from @fontsource's own stylesheets (the
|
|
34
|
-
* unicode-ranges especially). When bumping either @fontsource dependency,
|
|
35
|
-
* re-check them against `node_modules/@fontsource/<pkg>/<weight>.css`.
|
|
2
|
+
* Self-hosted Space Grotesk + IBM Plex Mono: woff2 only, and only the weights in use.
|
|
3
|
+
* Copied from @fontsource to set `font-display: optional`; re-check them on each @fontsource bump.
|
|
36
4
|
*/
|
|
37
5
|
|
|
38
6
|
/* Space Grotesk 400 — latin */
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @rxova/brand — design tokens, Starlight theme and shared chrome for rxova.org.
|
|
3
|
-
*
|
|
4
|
-
* Stylesheets and components are reached through their own subpath exports
|
|
5
|
-
* (`@rxova/brand/tokens.css`, `@rxova/brand/components/SiteFooter.astro`) so this
|
|
6
|
-
* entry point stays importable from `astro.config.mjs` under plain Node.
|
|
7
|
-
*/
|
|
1
|
+
/** @rxova/brand — the project data behind rxova.org. Stylesheets are subpath exports (`@rxova/brand/tokens.css`). */
|
|
8
2
|
|
|
9
3
|
export {
|
|
10
4
|
RXOVA_ORIGIN,
|
|
@@ -16,11 +10,10 @@ export {
|
|
|
16
10
|
docsUrl,
|
|
17
11
|
siteUrl,
|
|
18
12
|
canonicalUrl,
|
|
13
|
+
projectFromBase,
|
|
19
14
|
type Project,
|
|
20
15
|
type ProjectId,
|
|
21
16
|
type RepoId,
|
|
22
17
|
} from './sites.ts'
|
|
23
18
|
|
|
24
|
-
export { sharedStarlightConfig, type SharedStarlightOptions } from './starlight.ts'
|
|
25
|
-
|
|
26
19
|
export { renderFeed, escapeXml, rfc822, type FeedItem, type FeedOptions } from './feed.ts'
|
package/src/sites.links.test.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Every outbound link in PROJECTS resolves.
|
|
3
|
-
*
|
|
4
|
-
* sites.test.ts checks the shape of these URLs, and a well-shaped URL can still
|
|
5
|
-
* 404: ts-extended-errors shipped with an npm link to `@rxova/ts-extended-errors`
|
|
6
|
-
* after the package had been published unscoped as `ts-extended-errors`. Only
|
|
7
|
-
* asking the network catches that, so this file does.
|
|
8
|
-
*
|
|
9
|
-
* npm is checked through the registry, not www.npmjs.com, which answers 403 to
|
|
10
|
-
* anything that is not a browser. The npm link is pinned to the first package
|
|
11
|
-
* below, so checking the packages checks the link.
|
|
2
|
+
* Every outbound link in PROJECTS resolves over the network (a well-shaped URL can still 404).
|
|
3
|
+
* npm is checked via the registry, since www.npmjs.com answers 403 to non-browsers.
|
|
12
4
|
*/
|
|
13
5
|
|
|
14
6
|
import { describe, expect, it } from 'vitest'
|
|
@@ -37,6 +29,9 @@ async function status(url: string, method: 'GET' | 'HEAD'): Promise<number> {
|
|
|
37
29
|
return last
|
|
38
30
|
}
|
|
39
31
|
|
|
32
|
+
/** Off by default, so a flaky registry cannot fail a pull request; the weekly `links` workflow sets it. */
|
|
33
|
+
const network = process.env.RX_NETWORK_TESTS === '1'
|
|
34
|
+
|
|
40
35
|
const registryUrl = (pkg: string) => `https://registry.npmjs.org/${encodeURIComponent(pkg)}`
|
|
41
36
|
|
|
42
37
|
describe.each(PROJECTS.map((p) => [p.id, p] as const))('%s links', (_, project) => {
|
|
@@ -44,7 +39,7 @@ describe.each(PROJECTS.map((p) => [p.id, p] as const))('%s links', (_, project)
|
|
|
44
39
|
expect(project.npm).toBe(`https://www.npmjs.com/package/${project.packages[0]}`)
|
|
45
40
|
})
|
|
46
41
|
|
|
47
|
-
it.each(project.packages)(
|
|
42
|
+
it.runIf(network).each(project.packages)(
|
|
48
43
|
'publishes %s on npm',
|
|
49
44
|
async (pkg) => {
|
|
50
45
|
expect(await status(registryUrl(pkg), 'GET')).toBe(200)
|
|
@@ -52,7 +47,7 @@ describe.each(PROJECTS.map((p) => [p.id, p] as const))('%s links', (_, project)
|
|
|
52
47
|
TIMEOUT * 3,
|
|
53
48
|
)
|
|
54
49
|
|
|
55
|
-
it(
|
|
50
|
+
it.runIf(network)(
|
|
56
51
|
'has a public GitHub repo',
|
|
57
52
|
async () => {
|
|
58
53
|
expect(await status(project.repo, 'HEAD')).toBe(200)
|
package/src/sites.test.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The site map: which projects and repos exist, and the URLs that reach them.
|
|
3
|
-
*
|
|
4
|
-
* Every rxova.org surface reads this — the landing, the docs switcher, and the
|
|
5
|
-
* updates feed's repo filter. It is plain data with a few lookups over it, which is
|
|
6
|
-
* exactly the kind of module that never gets tested until one of its consumers
|
|
7
|
-
* 404s in production.
|
|
3
|
+
* Every rxova.org surface reads it — the landing, the docs switcher and the updates repo filter.
|
|
8
4
|
*/
|
|
9
5
|
|
|
10
6
|
import { describe, expect, it } from 'vitest'
|
package/src/sites.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The rxova.org site map.
|
|
3
|
-
*
|
|
4
|
-
* rxova.org is an aggregator: an Astro landing at `/`, plus each project's docs
|
|
5
|
-
* built in its own repo and mounted as a static tree under `/packages/<name>/`.
|
|
6
|
-
* That means every surface lives on one origin at its own base path, so
|
|
7
|
-
* **every cross-project link must be absolute**. A relative href would resolve
|
|
8
|
-
* against the local base and produce `/packages/journey/packages/react-inputs/`.
|
|
9
|
-
*
|
|
10
|
-
* This module is imported from `astro.config.mjs` under Node, so it must never
|
|
11
|
-
* import CSS or a component.
|
|
2
|
+
* The rxova.org site map. Each surface has its own base path, so cross-project links are absolute.
|
|
3
|
+
* Imported from `astro.config.mjs` under Node, so it must never import CSS or a component.
|
|
12
4
|
*/
|
|
13
5
|
|
|
14
6
|
/** Canonical origin. Override for a staging deploy (e.g. https://web.rxova.org). */
|
|
@@ -33,11 +25,7 @@ export interface Project {
|
|
|
33
25
|
|
|
34
26
|
/**
|
|
35
27
|
* Display order, shared by the landing's project rail and the docs switcher.
|
|
36
|
-
*
|
|
37
|
-
* overlock sits last deliberately. It is the newest of these and the only one
|
|
38
|
-
* that is not a library you import — a CLI and a CI gate — so leading the list
|
|
39
|
-
* with it put the least representative project in front of every reader of
|
|
40
|
-
* every surface.
|
|
28
|
+
* overlock stays last: it is a CLI and CI gate, not a library you import.
|
|
41
29
|
*/
|
|
42
30
|
export const PROJECTS: readonly Project[] = [
|
|
43
31
|
{
|
|
@@ -105,17 +93,8 @@ export function getProject(id: ProjectId): Project {
|
|
|
105
93
|
}
|
|
106
94
|
|
|
107
95
|
/**
|
|
108
|
-
* Every rxova repo a changelog entry can be about
|
|
109
|
-
* the
|
|
110
|
-
*
|
|
111
|
-
* `PROJECTS` deliberately stays what it is: the things with docs, an npm package
|
|
112
|
-
* and a landing card. But "we rebuilt the deploy pipeline" is exactly the kind of
|
|
113
|
-
* progress `/changelog` exists to record, and it belongs to `rxova-website`, which
|
|
114
|
-
* is not a project and never will be. Validating changelog entries against
|
|
115
|
-
* `PROJECTS` would make those entries unrepresentable.
|
|
116
|
-
*
|
|
117
|
-
* Order is display order for the changelog's repo filter: projects first, then
|
|
118
|
-
* infrastructure.
|
|
96
|
+
* Every rxova repo a changelog entry can be about: the projects, then repos that ship no package.
|
|
97
|
+
* Order is the changelog repo filter's display order.
|
|
119
98
|
*/
|
|
120
99
|
export const REPOS = [
|
|
121
100
|
...PROJECTS.map((p) => ({ id: p.id, label: p.label, repo: p.repo, project: true as const })),
|
|
@@ -155,16 +134,8 @@ export function siteUrl(path = '/'): string {
|
|
|
155
134
|
}
|
|
156
135
|
|
|
157
136
|
/**
|
|
158
|
-
* Absolute canonical URL for a
|
|
159
|
-
*
|
|
160
|
-
* Trailing slash, always — which is the whole reason this is not `siteUrl`.
|
|
161
|
-
* rxova.org is published as a directory-style tree on GitHub Pages, so `/blog`
|
|
162
|
-
* answers 301 and only `/blog/` answers 200. A self-referencing canonical naming
|
|
163
|
-
* the redirecting form points a crawler at a URL that does not serve the page,
|
|
164
|
-
* which is the one thing a canonical must never do. `siteUrl` stays as it is:
|
|
165
|
-
* a nav link may follow a redirect, a canonical may not.
|
|
166
|
-
*
|
|
167
|
-
* Pages only. Assets keep their exact path and want `siteUrl`.
|
|
137
|
+
* Absolute canonical URL for a page, always with a trailing slash (GitHub Pages 301s `/blog`).
|
|
138
|
+
* Pages only; assets keep their exact path and use `siteUrl`.
|
|
168
139
|
*/
|
|
169
140
|
export function canonicalUrl(path = '/'): string {
|
|
170
141
|
const rooted = path.startsWith('/') ? path : `/${path}`
|
|
@@ -173,12 +144,7 @@ export function canonicalUrl(path = '/'): string {
|
|
|
173
144
|
|
|
174
145
|
/**
|
|
175
146
|
* Which project a page belongs to, inferred from Astro's `BASE_URL`.
|
|
176
|
-
*
|
|
177
|
-
* Component overrides can't be given props, so the shared chrome works this out
|
|
178
|
-
* for itself rather than making every repo declare it twice (once in the
|
|
179
|
-
* Starlight config, once in the override). Returns `undefined` on a standalone
|
|
180
|
-
* build where the base is `/` and there is nothing to infer from — the current
|
|
181
|
-
* marker is simply omitted, which is correct off the aggregator.
|
|
147
|
+
* Returns `undefined` on a standalone build, where the base is `/`.
|
|
182
148
|
*/
|
|
183
149
|
export function projectFromBase(base: string): ProjectId | undefined {
|
|
184
150
|
const normalised = base.endsWith('/') ? base : `${base}/`
|
package/src/tokens.css
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* rxova design tokens
|
|
3
|
-
*
|
|
4
|
-
* Seeded from the original landing page (rxova-website/site/src/styles/global.css),
|
|
5
|
-
* which was the de-facto brand before this package existed.
|
|
6
|
-
*
|
|
7
|
-
* The palette is a warm monochrome: warm near-black ink on warm paper, with the
|
|
8
|
-
* logo's blue -> violet -> magenta gradient as the ONLY chroma in the system.
|
|
9
|
-
* Resist adding a second accent hue — the restraint is the identity.
|
|
10
|
-
*
|
|
11
|
-
* Every neutral flips between light and dark, so downstream mappings (see
|
|
12
|
-
* starlight.css) can reference a token once and get both modes for free.
|
|
2
|
+
* rxova design tokens: warm near-black ink on warm paper, with the logo's gradient as the only chroma.
|
|
3
|
+
* Every neutral flips between light and dark, so a mapping references a token once for both modes.
|
|
13
4
|
*/
|
|
14
5
|
|
|
15
6
|
:root,
|
|
@@ -36,6 +27,8 @@
|
|
|
36
27
|
--rx-primary-light: #8159f3;
|
|
37
28
|
--rx-primary-lighter: #9375f5;
|
|
38
29
|
--rx-primary-lightest: #b7a3f9;
|
|
30
|
+
/* Text on a --rx-primary fill; the page colour, since white on the lightened dark-mode violet fails AA. */
|
|
31
|
+
--rx-on-primary: #ffffff;
|
|
39
32
|
|
|
40
33
|
--rx-glow-tint: rgb(107 61 240 / 0.14);
|
|
41
34
|
--rx-shadow-soft: 0 20px 60px -30px rgb(107 61 240 / 0.35);
|
|
@@ -62,29 +55,14 @@
|
|
|
62
55
|
--rx-primary-light: #b7a3f9;
|
|
63
56
|
--rx-primary-lighter: #cbbcfb;
|
|
64
57
|
--rx-primary-lightest: #e0d7fd;
|
|
58
|
+
--rx-on-primary: #100f0d;
|
|
65
59
|
|
|
66
60
|
--rx-glow-tint: rgb(244 241 234 / 0.06);
|
|
67
61
|
--rx-shadow-soft: 0 20px 60px -30px rgb(0 0 0 / 0.6);
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
/*
|
|
71
|
-
|
|
72
|
-
* The dark surfaces used to sit 2.5 L* apart (bg #100f0d, card #17150f), which
|
|
73
|
-
* is a contrast ratio of 1.05 — a card edge nobody can see. Every panel, code
|
|
74
|
-
* block and quote floated on the page with only a 1px rule to define it, and
|
|
75
|
-
* that rule was itself only 1.18 against the card. The light theme gets away
|
|
76
|
-
* with a comparable step (1.7 L*) because a dark edge on a light ground reads
|
|
77
|
-
* strongly; near black the same step disappears, and ambient glare finishes it.
|
|
78
|
-
*
|
|
79
|
-
* So the dark ramp is deliberately spaced wider than its light counterpart
|
|
80
|
-
* rather than being a mirror of it: card sits 7.2 L* above bg, and the rule
|
|
81
|
-
* 12.9 above card. Judge changes here in L*, not in contrast ratio — ratio is
|
|
82
|
-
* compressed at the dark end and will happily report a 7 L* step as "1.1" and
|
|
83
|
-
* therefore fine.
|
|
84
|
-
*
|
|
85
|
-
* Text was never the problem and is unchanged in kind: fg 15.2, muted 8.3 and
|
|
86
|
-
* faint 5.6 against card.
|
|
87
|
-
*/
|
|
64
|
+
/* The dark ramp is spaced wider than the light one (card 7.2 L* over bg, rule 12.9 over card) so edges
|
|
65
|
+
stay visible near black; judge changes here in L*, not contrast ratio. */
|
|
88
66
|
|
|
89
67
|
/* OS preference wins only when no explicit choice has been stored. */
|
|
90
68
|
@media (prefers-color-scheme: dark) {
|
|
@@ -108,6 +86,7 @@
|
|
|
108
86
|
--rx-primary-light: #b7a3f9;
|
|
109
87
|
--rx-primary-lighter: #cbbcfb;
|
|
110
88
|
--rx-primary-lightest: #e0d7fd;
|
|
89
|
+
--rx-on-primary: #100f0d;
|
|
111
90
|
|
|
112
91
|
--rx-glow-tint: rgb(244 241 234 / 0.06);
|
|
113
92
|
--rx-shadow-soft: 0 20px 60px -30px rgb(0 0 0 / 0.6);
|
package/src/astro.css
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entry point for plain Astro surfaces that own their whole document — the
|
|
3
|
-
* rxova.org landing, /blog and /updates.
|
|
4
|
-
*
|
|
5
|
-
* Starlight sites use `starlight.css` instead; it maps the same tokens onto
|
|
6
|
-
* Starlight's own variables. This file is `chrome.css` — the tokens, the footer
|
|
7
|
-
* and the short aliases — plus the two things a bare Astro page needs and
|
|
8
|
-
* Starlight already provides: a reset and base element styling.
|
|
9
|
-
*
|
|
10
|
-
* Load this only where nothing else owns the document. A surface that renders
|
|
11
|
-
* the shared chrome *into* someone else's document — rxova-website's shell
|
|
12
|
-
* templates, whose body is composed into a built Starlight page — must load
|
|
13
|
-
* `chrome.css` instead. The reset below is unlayered, so inside a Starlight
|
|
14
|
-
* document it would outrank every rule in `@layer starlight.*` and flatten the
|
|
15
|
-
* page; see chrome.css.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
@import './chrome.css';
|
|
19
|
-
|
|
20
|
-
/* --- Reset ---------------------------------------------------------------- */
|
|
21
|
-
|
|
22
|
-
*,
|
|
23
|
-
*::before,
|
|
24
|
-
*::after {
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
margin: 0;
|
|
27
|
-
padding: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
html {
|
|
31
|
-
-webkit-text-size-adjust: 100%;
|
|
32
|
-
scroll-behavior: smooth;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@media (prefers-reduced-motion: reduce) {
|
|
36
|
-
html {
|
|
37
|
-
scroll-behavior: auto;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
body {
|
|
42
|
-
position: relative;
|
|
43
|
-
background: var(--rx-bg);
|
|
44
|
-
color: var(--rx-fg);
|
|
45
|
-
font-family: var(--rx-font-sans);
|
|
46
|
-
font-size: 1.0625rem;
|
|
47
|
-
line-height: 1.65;
|
|
48
|
-
-webkit-font-smoothing: antialiased;
|
|
49
|
-
text-rendering: optimizeLegibility;
|
|
50
|
-
transition:
|
|
51
|
-
background-color 0.2s ease,
|
|
52
|
-
color 0.2s ease;
|
|
53
|
-
|
|
54
|
-
/* At least a screen tall, with `main` taking the slack, so a short page —
|
|
55
|
-
/blog with two posts — keeps its footer at the bottom of the window instead
|
|
56
|
-
of halfway up it. A column of flex items rather than a grid because the
|
|
57
|
-
number of children varies: the shell's header and footer are spliced
|
|
58
|
-
around a producer's `main` at deploy time. */
|
|
59
|
-
display: flex;
|
|
60
|
-
flex-direction: column;
|
|
61
|
-
min-height: 100dvh;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* A flex item with `margin: 0 auto` shrinks to its content instead of filling
|
|
65
|
-
the row the way a block does, so a short `main` or footer would narrow and
|
|
66
|
-
drift off the header's edges. Full width restores the block behaviour, and
|
|
67
|
-
`max-width` plus the auto margins centre it as before. `:where()` keeps both
|
|
68
|
-
rules at zero specificity, so any component's own width still wins. */
|
|
69
|
-
:where(body > *) {
|
|
70
|
-
width: 100%;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
:where(body > main) {
|
|
74
|
-
flex-grow: 1;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
a {
|
|
78
|
-
color: inherit;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
a:focus-visible {
|
|
82
|
-
outline: 2px solid var(--rx-fg);
|
|
83
|
-
outline-offset: 3px;
|
|
84
|
-
border-radius: 2px;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
img {
|
|
88
|
-
max-width: 100%;
|
|
89
|
-
height: auto;
|
|
90
|
-
}
|