@nyxwire/astro 0.0.0-stage → 0.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.
@@ -0,0 +1,168 @@
1
+ # Spacing & elevation
2
+
3
+ > The 0.25rem spacing grid, radius and cut scale, control heights, surface ramp, shadows and z-index layers.
4
+
5
+ ## Spacing
6
+
7
+ Spacing tokens sit on a 0.25rem grid. Fractional steps use a hyphen: `--nw-space-0-5` is 0.125rem, `--nw-space-1-5` is 0.375rem and `--nw-space-2-5` is 0.625rem.
8
+
9
+ ```html
10
+ <div class="nw-docs-ruler">
11
+ <code>--nw-space-1</code>
12
+ <i style="--size: var(--nw-space-1)"></i>
13
+ <span>0.25rem</span>
14
+ </div>
15
+ <div class="nw-docs-ruler">
16
+ <code>--nw-space-2</code>
17
+ <i style="--size: var(--nw-space-2)"></i>
18
+ <span>0.5rem</span>
19
+ </div>
20
+ <div class="nw-docs-ruler">
21
+ <code>--nw-space-3</code>
22
+ <i style="--size: var(--nw-space-3)"></i>
23
+ <span>0.75rem</span>
24
+ </div>
25
+ <div class="nw-docs-ruler">
26
+ <code>--nw-space-4</code>
27
+ <i style="--size: var(--nw-space-4)"></i>
28
+ <span>1rem</span>
29
+ </div>
30
+ <div class="nw-docs-ruler">
31
+ <code>--nw-space-5</code>
32
+ <i style="--size: var(--nw-space-5)"></i>
33
+ <span>1.25rem</span>
34
+ </div>
35
+ <div class="nw-docs-ruler">
36
+ <code>--nw-space-6</code>
37
+ <i style="--size: var(--nw-space-6)"></i>
38
+ <span>1.5rem</span>
39
+ </div>
40
+ <div class="nw-docs-ruler">
41
+ <code>--nw-space-8</code>
42
+ <i style="--size: var(--nw-space-8)"></i>
43
+ <span>2rem</span>
44
+ </div>
45
+ <div class="nw-docs-ruler">
46
+ <code>--nw-space-10</code>
47
+ <i style="--size: var(--nw-space-10)"></i>
48
+ <span>2.5rem</span>
49
+ </div>
50
+ <div class="nw-docs-ruler">
51
+ <code>--nw-space-12</code>
52
+ <i style="--size: var(--nw-space-12)"></i>
53
+ <span>3rem</span>
54
+ </div>
55
+ <div class="nw-docs-ruler">
56
+ <code>--nw-space-16</code>
57
+ <i style="--size: var(--nw-space-16)"></i>
58
+ <span>4rem</span>
59
+ </div>
60
+ <div class="nw-docs-ruler">
61
+ <code>--nw-space-20</code>
62
+ <i style="--size: var(--nw-space-20)"></i>
63
+ <span>5rem</span>
64
+ </div>
65
+ <div class="nw-docs-ruler">
66
+ <code>--nw-space-24</code>
67
+ <i style="--size: var(--nw-space-24)"></i>
68
+ <span>6rem</span>
69
+ </div>
70
+ ```
71
+
72
+ The full set is `0`, `px` (1px), `0-5`, `1`, `1-5`, `2`, `2-5`, `3`, `4`, `5`, `6`, `8`, `10`, `12`, `16`, `20` and `24`. The Tailwind theme binds Tailwind's spacing to this grid (`--spacing: var(--nw-space-1)`), so `p-4` equals `--nw-space-4` and arbitrary values stay on the grid.
73
+
74
+ ## Radius and cut
75
+
76
+ Two corner languages coexist: radii for ordinary surfaces, and the cut chamfer for signature surfaces. Buttons and inputs use `md`, cards and dialogs `lg`; the cut chamfers the top-right and bottom-left corner only.
77
+
78
+ ```html
79
+ <div class="nw-docs-tile" style="border-radius: var(--nw-radius-xs)">
80
+ xs <code>2px</code>
81
+ </div>
82
+ <div class="nw-docs-tile" style="border-radius: var(--nw-radius-sm)">
83
+ sm <code>4px</code>
84
+ </div>
85
+ <div class="nw-docs-tile" style="border-radius: var(--nw-radius-md)">
86
+ md <code>8px</code>
87
+ </div>
88
+ <div class="nw-docs-tile" style="border-radius: var(--nw-radius-lg)">
89
+ lg <code>12px</code>
90
+ </div>
91
+ <div class="nw-docs-tile" style="border-radius: var(--nw-radius-xl)">
92
+ xl <code>16px</code>
93
+ </div>
94
+ <div class="nw-docs-tile" style="border-radius: var(--nw-radius-2xl)">
95
+ 2xl <code>24px</code>
96
+ </div>
97
+ <div class="nw-docs-tile nw-cut">
98
+ cut <code>--nw-cut 10px</code>
99
+ </div>
100
+ ```
101
+
102
+ Tokens: `--nw-radius-xs` to `--nw-radius-2xl` and `--nw-radius-full` (9999px). Tailwind: `rounded-xs` to `rounded-2xl` map to the tokens; `rounded-full` is Tailwind's own. The cut is `.nw-cut` (or the Tailwind `cut` utility), sized by `--nw-cut` (10px); opt-in component variants `.nw-btn-cut`, `.nw-card-cut` and `.nw-hud-cut` chamfer those surfaces. See [Effects & motion](effects-motion.md#cut-corners) for how the cut paints and glows.
103
+
104
+ ## Control heights
105
+
106
+ | Token | Value | Tailwind |
107
+ | ----------------- | ------- | ----------------- |
108
+ | `--nw-control-xs` | 1.75rem | `h-7` equivalents |
109
+ | `--nw-control-sm` | 2rem | `h-8` |
110
+ | `--nw-control-md` | 2.5rem | `h-10` |
111
+ | `--nw-control-lg` | 3rem | `h-12` |
112
+
113
+ Controls default to `md`; pick the size for the interaction, not the label length, and prefer `md` or larger on touch layouts. Every height clears the 24px WCAG 2.2 minimum target.
114
+
115
+ ## Surfaces
116
+
117
+ Depth comes first from tone. Each step raises the surface one level; hover and active states move one more.
118
+
119
+ ```html
120
+ <div class="nw-docs-tile" style="background-color: var(--nw-canvas-sunken)">
121
+ canvas-sunken <code>crust</code>
122
+ </div>
123
+ <div class="nw-docs-tile" style="background-color: var(--nw-canvas-subtle)">
124
+ canvas-subtle <code>mantle</code>
125
+ </div>
126
+ <div class="nw-docs-tile" style="background-color: var(--nw-canvas)">
127
+ canvas <code>base</code>
128
+ </div>
129
+ <div class="nw-docs-tile" style="background-color: var(--nw-panel)">
130
+ panel <code>surface0</code>
131
+ </div>
132
+ <div class="nw-docs-tile" style="background-color: var(--nw-panel-hover)">
133
+ panel-hover <code>surface1</code>
134
+ </div>
135
+ <div class="nw-docs-tile" style="background-color: var(--nw-panel-active)">
136
+ panel-active <code>surface2</code>
137
+ </div>
138
+ ```
139
+
140
+ ## Shadows
141
+
142
+ Shadows add separation for floating layers, tinted by `--nw-shadow-ink`: near-black on the dark flavors, the text ink at a lower strength on Lumen.
143
+
144
+ ```html
145
+ <div class="nw-docs-tile" style="box-shadow: var(--nw-shadow-sm)">
146
+ shadow-sm <code>--nw-shadow-sm</code>
147
+ </div>
148
+ <div class="nw-docs-tile" style="box-shadow: var(--nw-shadow-md)">
149
+ shadow-md <code>--nw-shadow-md</code>
150
+ </div>
151
+ <div class="nw-docs-tile" style="box-shadow: var(--nw-shadow-lg)">
152
+ shadow-lg <code>--nw-shadow-lg</code>
153
+ </div>
154
+ ```
155
+
156
+ Cards use `sm`, toasts and HUD panels `md` or `lg`, menus, popovers and dialogs `lg`. Tailwind: `shadow-sm`, `shadow-md`, `shadow-lg`, plus `shadow-glow-sm`, `shadow-glow-md`, `shadow-glow-lg` and `shadow-glow-wire` for the neon effects. The neon glow is an effect, not elevation: see [Effects & motion](effects-motion.md#glow).
157
+
158
+ ## Layers
159
+
160
+ | Token | Value | For |
161
+ | ----------------- | ----- | --------------------------- |
162
+ | `--nw-z-dropdown` | 1000 | Dropdowns and select lists |
163
+ | `--nw-z-sticky` | 1100 | Sticky headers and toolbars |
164
+ | `--nw-z-overlay` | 1300 | Backdrops |
165
+ | `--nw-z-modal` | 1400 | Dialogs and drawers |
166
+ | `--nw-z-popover` | 1500 | Popovers and menus |
167
+ | `--nw-z-toast` | 1600 | Toasts |
168
+ | `--nw-z-tooltip` | 1700 | Tooltips |
@@ -0,0 +1,80 @@
1
+ # Typography
2
+
3
+ > Three bundled variable fonts, the type scale, heading roles and the typography classes.
4
+
5
+ ## Fonts
6
+
7
+ | Role | Family | Token | Tailwind | Use |
8
+ | ------- | ---------------------- | ------------------- | -------------- | -------------------------------------------- |
9
+ | Display | Space Grotesk Variable | `--nw-font-display` | `font-display` | Headings h1 to h6, display text, stat values |
10
+ | Sans | Inter Variable | `--nw-font-sans` | `font-sans` | Body text, controls, lead |
11
+ | Mono | Martian Mono Variable | `--nw-font-mono` | `font-mono` | Code, values, eyebrows, table headers |
12
+
13
+ All three are open-licensed (OFL) variable fonts shipped as local `woff2` files, Latin and Latin Extended subsets, with `font-display: swap`. They load from `@nyxwire/css/fonts.css`, which the full CSS bundle, `@nyxwire/tailwind` and the Starlight plugin import. No request leaves your origin.
14
+
15
+ Space Grotesk leans technical and slightly wide, which is why it carries headings and numbers; Inter carries everything you read at length; Martian Mono is a wide monospace with tall x-height, tuned for short labels and code.
16
+
17
+ ## Specimen
18
+
19
+ ```html
20
+ <p class="nw-display">Signal on the wire</p>
21
+ <p class="nw-h1">Indigo tubes and quiet panels</p>
22
+ <p class="nw-h2">Cut corners, readable in every flavor</p>
23
+ <p class="nw-h3">Panels, cards and HUD frames</p>
24
+ <p class="nw-h4">Section headings in the display face</p>
25
+ <p class="nw-h5">Section label in the body face</p>
26
+ <p class="nw-h6">h6 keeps the display face here</p>
27
+ <p class="nw-eyebrow">Mono uppercase eyebrow</p>
28
+ <p class="nw-lead">Lead text opens a section at 1.25rem with normal leading and muted ink.</p>
29
+ <p>
30
+ Body copy is Inter at 1rem with 1.55 line height. It carries <strong>strong text</strong>,
31
+ <em>emphasis</em> and <code>inline code</code> without changing rhythm.
32
+ </p>
33
+ <p class="nw-mono">channel.alerts · latency 12ms · 0123456789 != =&gt;</p>
34
+ ```
35
+
36
+ ## Heading roles
37
+
38
+ Element defaults in `@nyxwire/css` base styles, mirrored by classes so any tag can take a role:
39
+
40
+ | Role | Class | Font | Size | Weight | Notes |
41
+ | ------- | ------------- | ------- | --------------------------------- | ------ | ----------------------------------------- |
42
+ | Display | `.nw-display` | display | `clamp(3rem, 2rem + 5vw, 4.5rem)` | 700 | leading 1, tracking −0.03em |
43
+ | h1 | `.nw-h1` | display | 2.25rem (`--nw-text-4xl`) | 700 | leading 1.15, tracking −0.03em |
44
+ | h2 | `.nw-h2` | display | 1.875rem (`--nw-text-3xl`) | 700 | leading 1.15, tracking −0.015em |
45
+ | h3 | `.nw-h3` | display | 1.5rem (`--nw-text-2xl`) | 600 | leading 1.3, tracking −0.015em |
46
+ | h4 | `.nw-h4` | display | 1.25rem (`--nw-text-xl`) | 600 | leading 1.3, tracking −0.015em |
47
+ | h5 | `.nw-h5` | display | 1.125rem (`--nw-text-lg`) | 600 | leading 1.3, tracking −0.015em |
48
+ | h6 | `.nw-h6` | display | 1rem (`--nw-text-base`) | 600 | leading 1.3, tracking −0.015em |
49
+ | Eyebrow | `.nw-eyebrow` | mono | 0.6875rem (`--nw-text-2xs`) | 500 | uppercase, tracking 0.18em, `primary` ink |
50
+ | Lead | `.nw-lead` | sans | 1.25rem (`--nw-text-xl`) | 400 | leading 1.55, `fg-muted` |
51
+
52
+ Headings balance their lines (`text-wrap: balance`) and paragraphs avoid orphans (`text-wrap: pretty`). Helpers: `.nw-mono` (mono font), `.nw-text-muted`, `.nw-text-subtle`, `.nw-text-faint`, `.nw-text-disabled` and `.nw-text-<intent>` for colored text. For long-form HTML, wrap it in `.nw-prose` (`.nw-prose-sm`, `.nw-prose-lg`, `.nw-prose-wide`), which styles lists, quotes, code, tables and rules at a 68ch measure.
53
+
54
+ ## Scale
55
+
56
+ | Token | Size | Tailwind |
57
+ | ---------------- | --------- | ----------- |
58
+ | `--nw-text-2xs` | 0.6875rem | `text-2xs` |
59
+ | `--nw-text-xs` | 0.75rem | `text-xs` |
60
+ | `--nw-text-sm` | 0.875rem | `text-sm` |
61
+ | `--nw-text-base` | 1rem | `text-base` |
62
+ | `--nw-text-lg` | 1.125rem | `text-lg` |
63
+ | `--nw-text-xl` | 1.25rem | `text-xl` |
64
+ | `--nw-text-2xl` | 1.5rem | `text-2xl` |
65
+ | `--nw-text-3xl` | 1.875rem | `text-3xl` |
66
+ | `--nw-text-4xl` | 2.25rem | `text-4xl` |
67
+ | `--nw-text-5xl` | 3rem | `text-5xl` |
68
+ | `--nw-text-6xl` | 3.75rem | `text-6xl` |
69
+ | `--nw-text-7xl` | 4.5rem | `text-7xl` |
70
+
71
+ The Tailwind theme re-binds Tailwind's own size names to these tokens, with leading from `snug` up. `text-base`, `text-sm` and smaller keep Tailwind's default line heights; `text-xl` and up pair with the tighter leading tokens.
72
+
73
+ | Leading | Value | Tracking | Value |
74
+ | ---------------------- | ----- | ----------------------- | -------- |
75
+ | `--nw-leading-none` | 1 | `--nw-tracking-tighter` | −0.03em |
76
+ | `--nw-leading-tight` | 1.15 | `--nw-tracking-tight` | −0.015em |
77
+ | `--nw-leading-snug` | 1.3 | `--nw-tracking-normal` | 0 |
78
+ | `--nw-leading-normal` | 1.55 | `--nw-tracking-wide` | 0.04em |
79
+ | `--nw-leading-relaxed` | 1.7 | `--nw-tracking-wider` | 0.08em |
80
+ | | | `--nw-tracking-widest` | 0.18em |
@@ -0,0 +1,61 @@
1
+ # @nyxwire/astro 0.1.0
2
+
3
+ Nyxwire for Astro: an integration, a page layout and a flavor switcher that never flashes the wrong theme.
4
+
5
+ ## Install
6
+
7
+ 1. Install the integration and the CSS it imports.
8
+
9
+ ```sh
10
+ pnpm add @nyxwire/astro @nyxwire/css
11
+ ```
12
+
13
+ 2. Register it. It injects the flavor script into every page head and imports the full CSS.
14
+
15
+ ```js title="astro.config.mjs"
16
+ import { defineConfig } from 'astro/config'
17
+ import nyxwire from '@nyxwire/astro'
18
+
19
+ export default defineConfig({
20
+ integrations: [nyxwire({ flavors: { dark: 'abyss' }, accent: 'indigo' })],
21
+ })
22
+ ```
23
+
24
+ 3. Render pages with the layout and offer a flavor picker.
25
+
26
+ ```astro title="src/pages/index.astro"
27
+ ---
28
+ import Layout from '@nyxwire/astro/components/Layout.astro'
29
+ import FlavorSelect from '@nyxwire/astro/components/FlavorSelect.astro'
30
+ ---
31
+ <Layout title="Home">
32
+ <main class="nw-container">
33
+ <h1>Signal online</h1>
34
+ <FlavorSelect />
35
+ </main>
36
+ </Layout>
37
+ ```
38
+
39
+ More in [Astro integration](integration.md).
40
+
41
+ ## Conventions
42
+
43
+ - Register `nyxwire()` from `@nyxwire/astro` in `integrations`: it injects the flavor script into every page head (no flash of the wrong flavor) and imports `@nyxwire/css`.
44
+ - Components are imported from `@nyxwire/astro/components/<Name>.astro`: `Layout`, `FlavorSelect` and `FlavorScript`. With the integration, never add `FlavorScript` yourself.
45
+ - The runtime shares the `nyxwire-flavor` storage key and the `nyxwire:flavor` event with Vue's `useFlavor`. Vue islands go inside `NwProvider`.
46
+
47
+ ## Files
48
+
49
+ Every file below documents @nyxwire/astro 0.1.0. Read the ones you need before writing code.
50
+
51
+ - [components.md](components.md): Layout, FlavorSelect and FlavorScript from @nyxwire/astro, their props, keyboard behavior, and when to use each.
52
+ - [foundations/accessibility.md](foundations/accessibility.md): The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks.
53
+ - [foundations/color-roles.md](foundations/color-roles.md): Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette.
54
+ - [foundations/effects-motion.md](foundations/effects-motion.md): Cut corners, the wire edge, neon glow, scanlines, the circuit grid, glitch, glass, and motion tokens that respect reduced motion.
55
+ - [foundations/flavors.md](foundations/flavors.md): Pick a flavor with data attributes, nest scopes, swap the accent, and persist the visitor's choice without a flash.
56
+ - [foundations/icons.md](foundations/icons.md): Lucide icons through @lucide/vue, sized by the component around them and hidden from assistive technology unless they carry meaning.
57
+ - [foundations/palette.md](foundations/palette.md): Every Nyxwire color in all four flavors, generated from @nyxwire/palette with hex, RGB, OKLCH and contrast against the flavor's base.
58
+ - [foundations/spacing-elevation.md](foundations/spacing-elevation.md): The 0.25rem spacing grid, radius and cut scale, control heights, surface ramp, shadows and z-index layers.
59
+ - [foundations/typography.md](foundations/typography.md): Three bundled variable fonts, the type scale, heading roles and the typography classes.
60
+ - [integration.md](integration.md): Add Nyxwire to an Astro 7 site with one integration that injects the flash-free flavor script and the stylesheet, and use the shared runtime API.
61
+ - [vue-islands.md](vue-islands.md): Render @nyxwire/vue components in Astro pages, hydrate them as islands, and keep them in sync with the page's flavor.
@@ -0,0 +1,137 @@
1
+ # Astro integration
2
+
3
+ > Add Nyxwire to an Astro 7 site with one integration that injects the flash-free flavor script and the stylesheet, and use the shared runtime API.
4
+
5
+ `@nyxwire/astro` themes an Astro site. Its integration does two things on every page: it inlines the flavor script in `<head>`, so the stored flavor is applied before the first paint and before any island hydrates, and it imports the Nyxwire stylesheet. The package also ships [three components](components.md) and the runtime as a library. Fonts, colors and styles are bundled locally; nothing loads from a CDN.
6
+
7
+ 1. Install the integration and the CSS it imports.
8
+
9
+ ```sh
10
+ pnpm add @nyxwire/astro @nyxwire/css
11
+ ```
12
+
13
+ 2. Register it.
14
+
15
+ ```js title="astro.config.mjs"
16
+ import { defineConfig } from 'astro/config'
17
+ import nyxwire from '@nyxwire/astro'
18
+
19
+ export default defineConfig({
20
+ integrations: [nyxwire({ flavors: { dark: 'nocturne' }, accent: 'indigo' })],
21
+ })
22
+ ```
23
+
24
+ 3. Use the `nw-*` classes, or the [Layout component](components.md#layout) for a complete document.
25
+
26
+ ```astro title="src/pages/index.astro"
27
+ ---
28
+ import Layout from '@nyxwire/astro/components/Layout.astro'
29
+ ---
30
+ <Layout title="Relay status">
31
+ <main class="nw-container nw-stack">
32
+ <h1>Relay status</h1>
33
+ <button class="nw-btn">Connect</button>
34
+ </main>
35
+ </Layout>
36
+ ```
37
+
38
+ ## Options
39
+
40
+ | Option | Values | Default |
41
+ | --------------- | ---------------------------------------------------------- | ------------ |
42
+ | `flavors.dark` | `'abyss'`, `'nocturne'`, `'twilight'` | `'nocturne'` |
43
+ | `flavors.light` | `'lumen'` | `'lumen'` |
44
+ | `defaultFlavor` | `'auto'`, `'abyss'`, `'nocturne'`, `'twilight'`, `'lumen'` | `'auto'` |
45
+ | `accent` | any of the [12 accents](foundations/color-roles.md) | none |
46
+ | `persist` | `true`, `false` | `true` |
47
+ | `styles` | `'full'`, `'tokens'`, `false` | `'full'` |
48
+ | `css` | `true`, `false` | `true` |
49
+
50
+ - `flavors.dark` and `flavors.light` are the flavors `auto` resolves to when the system prefers a dark or a light color scheme.
51
+ - `defaultFlavor` applies when the visitor has stored nothing valid. A stored choice always wins.
52
+ - `accent` is set as `data-accent` on `<html>` and re-points the primary color (links, active states, focus rings). Without it the palette default, indigo, applies.
53
+ - `persist: false` keeps the visitor's choices in memory only and ignores stored values.
54
+ - `css: false` is shorthand for `styles: false`.
55
+ - Invalid values and unknown option names throw a `NyxwireOptionsError` at startup, naming the option, the accepted values and what was received.
56
+
57
+ ## Styles
58
+
59
+ | `styles` | Imports on every page | Use when |
60
+ | ---------- | ------------------------------------------------------------- | -------------------------------------------- |
61
+ | `'full'` | `@nyxwire/css`: tokens, fonts, base, components and utilities | You use the `nw-*` classes |
62
+ | `'tokens'` | `@nyxwire/css/tokens.css` and `@nyxwire/css/fonts.css` | Your own CSS styles elements and components |
63
+ | `false` | nothing | Your global stylesheet imports what it needs |
64
+
65
+ The stylesheet is imported through Astro's `page-ssr` stage, so it is bundled with each page. With Tailwind, use `styles: false` and let the stylesheet bring the theme, fonts, tokens and base:
66
+
67
+ ```js title="astro.config.mjs"
68
+ import { defineConfig } from 'astro/config'
69
+ import nyxwire from '@nyxwire/astro'
70
+ import tailwindcss from '@tailwindcss/vite'
71
+
72
+ export default defineConfig({
73
+ integrations: [nyxwire({ styles: false })],
74
+ vite: { plugins: [tailwindcss()] },
75
+ })
76
+ ```
77
+
78
+ ```css title="src/styles/global.css"
79
+ @import 'tailwindcss';
80
+ @import '@nyxwire/tailwind';
81
+ @import '@nyxwire/vue/tailwind.css'; /* with @nyxwire/vue */
82
+ ```
83
+
84
+ Import that stylesheet in your layout. The [Vue islands](vue-islands.md) page continues this setup.
85
+
86
+ ## The flavor runtime
87
+
88
+ The inline script reads `localStorage['nyxwire-flavor']` (and the accent from `nyxwire-accent`), resolves `auto` through `prefers-color-scheme`, and sets `data-flavor`, `data-theme`, `data-nw-flavor-preference`, `data-accent` and `color-scheme` on `<html>`. It also updates every `<meta name="theme-color">` marked with `data-nyxwire-theme-color` to the active flavor's base color. Then it exposes a small controller:
89
+
90
+ ```js
91
+ window.nyxwire.getFlavor() // stored preference, 'auto' included
92
+ window.nyxwire.resolve() // flavor in use, e.g. 'nocturne'
93
+ window.nyxwire.setFlavor('twilight') // persists, applies, dispatches the event
94
+ window.nyxwire.getAccent() // 'volt', or null for the palette default
95
+ window.nyxwire.setAccent('volt') // persists and sets data-accent
96
+ window.nyxwire.setAccent(null) // removes data-accent
97
+
98
+ document.addEventListener('nyxwire:flavor', ({ detail }) => {
99
+ console.log(detail.flavor, detail.resolved, detail.theme, detail.accent)
100
+ })
101
+ ```
102
+
103
+ The event fires on start, once the DOM is ready (so theme-color metas parsed after the script are updated), after every `setFlavor` or `setAccent`, and on system color scheme changes while the preference is `auto`. `setFlavor` and `setAccent` throw a `TypeError` for an unknown value before anything changes. When storage is blocked (privacy mode, sandboxed frames), the choice still applies to the current page. To type `window.nyxwire` and the event in a client script, import the package's types:
104
+
105
+ ```ts
106
+ import type {} from '@nyxwire/astro'
107
+ ```
108
+
109
+ [Flavors & theming](foundations/flavors.md) explains the model, and Vue's `useFlavor` delegates to this runtime when it is present.
110
+
111
+ ## Library exports
112
+
113
+ | Export | Purpose |
114
+ | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
115
+ | `nyxwire(options?)` (default) | The integration |
116
+ | `buildFlavorScript(options?)` | The validated inline runtime as a string, for your own `<script is:inline>` |
117
+ | `resolveFlavor(stored, prefersLight, options?)` | Pure resolution of a stored value to a flavor |
118
+ | `flavorRuntime(config)` | The runtime function itself; `buildFlavorScript` stringifies it |
119
+ | `normalizeOptions(options?)`, `NyxwireOptionsError`, `isFlavorName`, `isFlavorPreference`, `isAccentName` | Option validation |
120
+ | `FLAVOR_STORAGE_KEY`, `ACCENT_STORAGE_KEY`, `FLAVOR_CHANGE_EVENT` (alias `FLAVOR_EVENT`) | `'nyxwire-flavor'`, `'nyxwire-accent'`, `'nyxwire:flavor'` |
121
+ | `flavorIds` (alias `FLAVOR_IDS`), `darkFlavorIds` | Flavor ids from the palette |
122
+
123
+ ```ts
124
+ import { resolveFlavor } from '@nyxwire/astro'
125
+
126
+ resolveFlavor('auto', true) // 'lumen'
127
+ resolveFlavor(null, false, { flavors: { dark: 'abyss' } }) // 'abyss'
128
+ resolveFlavor('neon', false) // 'nocturne': invalid storage falls back to defaultFlavor ('auto')
129
+ ```
130
+
131
+ Types: `NyxwireOptions`, `NyxwireConfig` (alias `FlavorConfig`), `FlavorRuntimeConfig`, `FlavorPreference`, `StyleMode`, `FlavorController`, `NyxwireRuntime`, `FlavorChangeDetail`, `FlavorName`, `DarkFlavorName` and `AccentName`.
132
+
133
+ > **Note**
134
+ >
135
+ > Starlight sites use [`@nyxwire/starlight`](https://nyxwire.dissidence.ovh/starlight/setup/) instead of this integration: the
136
+ > plugin installs the same runtime through Starlight's theme provider. A page outside Starlight in
137
+ > the same project puts [`FlavorScript`](components.md#flavorscript) in its head.
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@nyxwire/astro",
3
+ "version": "0.1.0",
4
+ "files": [
5
+ {
6
+ "path": "components.md",
7
+ "title": "Astro components",
8
+ "description": "Layout, FlavorSelect and FlavorScript from @nyxwire/astro, their props, keyboard behavior, and when to use each."
9
+ },
10
+ {
11
+ "path": "foundations/accessibility.md",
12
+ "title": "Accessibility",
13
+ "description": "The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks."
14
+ },
15
+ {
16
+ "path": "foundations/color-roles.md",
17
+ "title": "Color roles",
18
+ "description": "Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette."
19
+ },
20
+ {
21
+ "path": "foundations/effects-motion.md",
22
+ "title": "Effects & motion",
23
+ "description": "Cut corners, the wire edge, neon glow, scanlines, the circuit grid, glitch, glass, and motion tokens that respect reduced motion."
24
+ },
25
+ {
26
+ "path": "foundations/flavors.md",
27
+ "title": "Flavors & theming",
28
+ "description": "Pick a flavor with data attributes, nest scopes, swap the accent, and persist the visitor's choice without a flash."
29
+ },
30
+ {
31
+ "path": "foundations/icons.md",
32
+ "title": "Icons",
33
+ "description": "Lucide icons through @lucide/vue, sized by the component around them and hidden from assistive technology unless they carry meaning."
34
+ },
35
+ {
36
+ "path": "foundations/palette.md",
37
+ "title": "Palette",
38
+ "description": "Every Nyxwire color in all four flavors, generated from @nyxwire/palette with hex, RGB, OKLCH and contrast against the flavor's base."
39
+ },
40
+ {
41
+ "path": "foundations/spacing-elevation.md",
42
+ "title": "Spacing & elevation",
43
+ "description": "The 0.25rem spacing grid, radius and cut scale, control heights, surface ramp, shadows and z-index layers."
44
+ },
45
+ {
46
+ "path": "foundations/typography.md",
47
+ "title": "Typography",
48
+ "description": "Three bundled variable fonts, the type scale, heading roles and the typography classes."
49
+ },
50
+ {
51
+ "path": "index.md",
52
+ "title": "@nyxwire/astro 0.1.0",
53
+ "description": "Setup, conventions and the list of every doc file."
54
+ },
55
+ {
56
+ "path": "integration.md",
57
+ "title": "Astro integration",
58
+ "description": "Add Nyxwire to an Astro 7 site with one integration that injects the flash-free flavor script and the stylesheet, and use the shared runtime API."
59
+ },
60
+ {
61
+ "path": "vue-islands.md",
62
+ "title": "Vue islands",
63
+ "description": "Render @nyxwire/vue components in Astro pages, hydrate them as islands, and keep them in sync with the page's flavor."
64
+ }
65
+ ]
66
+ }