@still-void/ui 1.0.0 → 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/README.md CHANGED
@@ -32,13 +32,18 @@ React is an **optional** peer dependency — non-React consumers install nothing
32
32
  // app/layout.tsx (Server Component)
33
33
  import '@still-void/ui/theme.css';
34
34
  import '@still-void/ui/style.css';
35
- import { Header, Logo, Footer } from '@still-void/ui/react';
35
+ import { Header, Logo, Footer, ThemeScript } from '@still-void/ui/react';
36
36
  import { ThemeProvider, ThemeToggle } from '@still-void/ui/react/client';
37
37
 
38
38
  export default function RootLayout({ children }: { children: React.ReactNode }) {
39
39
  return (
40
- // Server-rendered attributes = correct theme on first paint, no flash.
40
+ // Server-rendered attributes = correct theme for a first-time visitor.
41
+ // <ThemeScript /> runs before paint and re-applies a *returning* visitor's
42
+ // stored preference, so there's no flash of the wrong theme either way.
41
43
  <html lang="en" data-theme="dark" data-accent="cyan" suppressHydrationWarning>
44
+ <head>
45
+ <ThemeScript />
46
+ </head>
42
47
  <body className="sv-body">
43
48
  <ThemeProvider>
44
49
  <Header
@@ -113,6 +118,34 @@ theme.setAccent('violet');
113
118
  See [playground/index.html](playground/index.html) for the full catalog rendered with **zero
114
119
  framework code** — open it with `npm run playground` after `npm run build`.
115
120
 
121
+ ## Fonts
122
+
123
+ `theme.css` sets `--sv-font-display`/`--sv-font-body`/`--sv-font-mono` to Sora, Manrope and
124
+ JetBrains Mono, but does **not** load them — that's a render-blocking `@import` on every
125
+ consumer's critical path, and a runtime dependency on a third-party CDN. Load them yourself:
126
+
127
+ ```tsx
128
+ // app/layout.tsx — next/font self-hosts and inlines the @font-face rules, no network request
129
+ import { Sora, Manrope, JetBrains_Mono } from 'next/font/google';
130
+
131
+ const sora = Sora({ subsets: ['latin'], weight: ['400', '600', '700'], variable: '--sv-font-display' });
132
+ const manrope = Manrope({ subsets: ['latin'], weight: ['400', '500', '600', '700'], variable: '--sv-font-body' });
133
+ const mono = JetBrains_Mono({ subsets: ['latin'], weight: ['400', '500'], variable: '--sv-font-mono' });
134
+ ```
135
+
136
+ ```html
137
+ <!-- any other framework: preconnect + stylesheet -->
138
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
139
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
140
+ <link
141
+ href="https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
142
+ rel="stylesheet"
143
+ />
144
+ ```
145
+
146
+ System-font fallbacks (`ui-sans-serif`, `system-ui`, `ui-monospace`) already cover the gap
147
+ before your chosen font loads — see [Fidelity rules](#fidelity-rules-do-not-regress).
148
+
116
149
  ## Theming
117
150
 
118
151
  - Mode: `data-theme="dark" | "light"` on `<html>` (dark is default).
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Still Void color tokens.
3
+ * Values ported literally from the Still Void spec (blog.kalleopinheiro.dev).
4
+ * Do not round or "approximate" — fidelity rule.
5
+ */
6
+ declare const colors: {
7
+ readonly dark: {
8
+ readonly bg: "#0A0A0C";
9
+ readonly bgElev: "#111114";
10
+ readonly surface: "#16161B";
11
+ readonly surface2: "#1C1C22";
12
+ readonly border: "rgba(255,255,255,0.08)";
13
+ readonly borderStrong: "rgba(255,255,255,0.14)";
14
+ readonly text: "#EDEDF0";
15
+ readonly text2: "#8B8B96";
16
+ readonly text3: "#83838F";
17
+ };
18
+ readonly light: {
19
+ readonly bg: "#F7F7F5";
20
+ readonly bgElev: "#FFFFFF";
21
+ readonly surface: "#FFFFFF";
22
+ readonly surface2: "#F2F2EF";
23
+ readonly border: "rgba(0,0,0,0.08)";
24
+ readonly borderStrong: "rgba(0,0,0,0.14)";
25
+ readonly text: "#16161B";
26
+ readonly text2: "#5A5A66";
27
+ readonly text3: "#6D6D76";
28
+ };
29
+ };
30
+ declare const accents: {
31
+ readonly cyan: "oklch(0.78 0.12 210)";
32
+ readonly violet: "oklch(0.72 0.14 295)";
33
+ readonly mint: "oklch(0.78 0.10 160)";
34
+ readonly amber: "oklch(0.78 0.12 75)";
35
+ };
36
+ /**
37
+ * Text/UI-safe accent variants ("ink"). `accents` above is tuned for surface use
38
+ * (dots, gradient border, progress bar) and fails WCAG AA as text on light
39
+ * backgrounds (e.g. cyan is ~1.8:1 on white). These preserve the dark-mode
40
+ * values (already ≥6.9:1) and darken each hue for light mode to clear 4.5:1
41
+ * against both light surfaces. Used anywhere the accent colors text: prose
42
+ * links, active TOC state, callout labels, hero eyebrow, copy-success, focus ring.
43
+ */
44
+ declare const accentsInk: {
45
+ readonly dark: {
46
+ readonly cyan: "oklch(0.78 0.12 210)";
47
+ readonly violet: "oklch(0.72 0.14 295)";
48
+ readonly mint: "oklch(0.78 0.10 160)";
49
+ readonly amber: "oklch(0.78 0.12 75)";
50
+ };
51
+ readonly light: {
52
+ readonly cyan: "oklch(0.525 0.09 210)";
53
+ readonly violet: "oklch(0.545 0.14 295)";
54
+ readonly mint: "oklch(0.52 0.1 160)";
55
+ readonly amber: "oklch(0.535 0.11 75)";
56
+ };
57
+ };
58
+ /**
59
+ * Semantic state colors — independent of the switchable `accent`, so a
60
+ * consumer picking `data-accent="amber"` never collides a warning with the
61
+ * site accent. Fixed per meaning in both surface and text/UI ("ink") forms,
62
+ * same split as `accents`/`accentsInk`.
63
+ */
64
+ declare const semantic: {
65
+ readonly dark: {
66
+ readonly danger: "oklch(0.68 0.19 25)";
67
+ readonly success: "oklch(0.75 0.15 150)";
68
+ readonly info: "oklch(0.78 0.12 210)";
69
+ readonly warning: "oklch(0.78 0.12 75)";
70
+ };
71
+ readonly light: {
72
+ readonly danger: "oklch(0.68 0.19 25)";
73
+ readonly success: "oklch(0.75 0.15 150)";
74
+ readonly info: "oklch(0.78 0.12 210)";
75
+ readonly warning: "oklch(0.78 0.12 75)";
76
+ };
77
+ };
78
+ declare const semanticInk: {
79
+ readonly dark: {
80
+ readonly danger: "oklch(0.68 0.19 25)";
81
+ readonly success: "oklch(0.75 0.15 150)";
82
+ readonly info: "oklch(0.78 0.12 210)";
83
+ readonly warning: "oklch(0.78 0.12 75)";
84
+ };
85
+ readonly light: {
86
+ readonly danger: "oklch(0.555 0.19 25)";
87
+ readonly success: "oklch(0.515 0.14 150)";
88
+ readonly info: "oklch(0.525 0.09 210)";
89
+ readonly warning: "oklch(0.535 0.11 75)";
90
+ };
91
+ };
92
+ type ThemeMode = keyof typeof colors;
93
+ type AccentName = keyof typeof accents;
94
+ type ColorScheme = (typeof colors)[ThemeMode];
95
+ type SemanticName = keyof (typeof semantic)['dark'];
96
+ declare const themeModes: ThemeMode[];
97
+ declare const accentNames: AccentName[];
98
+ declare const DEFAULT_MODE: ThemeMode;
99
+ declare const DEFAULT_ACCENT: AccentName;
100
+
101
+ /**
102
+ * Blog categories from the prototype. Categories render as a colored dot + label
103
+ * (never an emoji). The pill also accepts any CSS color for whitelabel use.
104
+ */
105
+ type CategoryName = 'ia' | 'prompt' | 'dev' | 'arch' | 'ts';
106
+ declare const defaultCategoryColors: Record<CategoryName, AccentName>;
107
+ /** Resolve an accent name or raw CSS color to a CSS color value. */
108
+ declare function resolveAccentColor(color: AccentName | (string & {})): string;
109
+ /** Resolve a category name, accent name, or raw CSS color to a CSS color value. */
110
+ declare function resolveCategoryColor(color: CategoryName | AccentName | (string & {})): string;
111
+
112
+ /** Data shape consumed by PostCard / FeaturedPostCard. The library never ships mock data. */
113
+ interface PostSummary {
114
+ title: string;
115
+ href: string;
116
+ excerpt?: string;
117
+ date?: string;
118
+ readMinutes?: number;
119
+ category?: {
120
+ label: string;
121
+ /** Accent token name, known category, or any CSS color. */
122
+ color?: AccentName | CategoryName | (string & {});
123
+ };
124
+ }
125
+ interface TocItem {
126
+ id: string;
127
+ label: string;
128
+ depth?: 2 | 3;
129
+ }
130
+ interface NavItem {
131
+ label: string;
132
+ href: string;
133
+ active?: boolean;
134
+ }
135
+
136
+ /**
137
+ * Article recipes: CodeBlock, Callout, TableOfContents, ReadingProgress,
138
+ * ArticleHeader, Prose. Pure functions — Server Component safe.
139
+ */
140
+ declare function codeBlock(): string;
141
+ declare const codeBlockClasses: {
142
+ readonly header: "sv-code-block__header";
143
+ readonly pre: "sv-code-block__pre";
144
+ readonly copy: "sv-code-block__copy";
145
+ readonly copyCopied: string;
146
+ };
147
+ type CalloutKind = 'note' | 'warn' | 'aha';
148
+ declare function callout(kind: CalloutKind): string;
149
+ declare const calloutClasses: {
150
+ readonly label: "sv-callout__label";
151
+ };
152
+ declare const calloutLabels: Record<CalloutKind, string>;
153
+ declare function tableOfContents(): string;
154
+ interface TocLinkOptions {
155
+ active?: boolean;
156
+ /** Heading depth, 2 (h2) or 3 (h3). Depth 3 indents. */
157
+ depth?: 2 | 3;
158
+ }
159
+ declare function tocLink(options?: TocLinkOptions): string;
160
+ declare function readingProgress(): string;
161
+ declare const readingProgressClasses: {
162
+ readonly bar: "sv-reading-progress__bar";
163
+ };
164
+ /** CSS var read by `.sv-reading-progress__bar` (0 → 1). */
165
+ declare const READING_PROGRESS_VAR = "--sv-reading-progress";
166
+ declare function articleHeader(): string;
167
+ declare const articleHeaderClasses: {
168
+ readonly title: "sv-article-header__title";
169
+ readonly meta: "sv-article-header__meta";
170
+ readonly author: "sv-article-header__author";
171
+ };
172
+ declare function prose(): string;
173
+ declare const proseClasses: {
174
+ readonly lead: "sv-prose__lead";
175
+ };
176
+
177
+ export { type AccentName as A, themeModes as B, type CalloutKind as C, DEFAULT_ACCENT as D, tocLink as E, type NavItem as N, type PostSummary as P, READING_PROGRESS_VAR as R, type SemanticName as S, type ThemeMode as T, type CategoryName as a, type ColorScheme as b, DEFAULT_MODE as c, type TocItem as d, type TocLinkOptions as e, accentNames as f, accents as g, accentsInk as h, articleHeader as i, articleHeaderClasses as j, callout as k, calloutClasses as l, calloutLabels as m, codeBlock as n, codeBlockClasses as o, colors as p, defaultCategoryColors as q, prose as r, proseClasses as s, readingProgress as t, readingProgressClasses as u, resolveAccentColor as v, resolveCategoryColor as w, semantic as x, semanticInk as y, tableOfContents as z };
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Still Void color tokens.
3
+ * Values ported literally from the Still Void spec (blog.kalleopinheiro.dev).
4
+ * Do not round or "approximate" — fidelity rule.
5
+ */
6
+ declare const colors: {
7
+ readonly dark: {
8
+ readonly bg: "#0A0A0C";
9
+ readonly bgElev: "#111114";
10
+ readonly surface: "#16161B";
11
+ readonly surface2: "#1C1C22";
12
+ readonly border: "rgba(255,255,255,0.08)";
13
+ readonly borderStrong: "rgba(255,255,255,0.14)";
14
+ readonly text: "#EDEDF0";
15
+ readonly text2: "#8B8B96";
16
+ readonly text3: "#83838F";
17
+ };
18
+ readonly light: {
19
+ readonly bg: "#F7F7F5";
20
+ readonly bgElev: "#FFFFFF";
21
+ readonly surface: "#FFFFFF";
22
+ readonly surface2: "#F2F2EF";
23
+ readonly border: "rgba(0,0,0,0.08)";
24
+ readonly borderStrong: "rgba(0,0,0,0.14)";
25
+ readonly text: "#16161B";
26
+ readonly text2: "#5A5A66";
27
+ readonly text3: "#6D6D76";
28
+ };
29
+ };
30
+ declare const accents: {
31
+ readonly cyan: "oklch(0.78 0.12 210)";
32
+ readonly violet: "oklch(0.72 0.14 295)";
33
+ readonly mint: "oklch(0.78 0.10 160)";
34
+ readonly amber: "oklch(0.78 0.12 75)";
35
+ };
36
+ /**
37
+ * Text/UI-safe accent variants ("ink"). `accents` above is tuned for surface use
38
+ * (dots, gradient border, progress bar) and fails WCAG AA as text on light
39
+ * backgrounds (e.g. cyan is ~1.8:1 on white). These preserve the dark-mode
40
+ * values (already ≥6.9:1) and darken each hue for light mode to clear 4.5:1
41
+ * against both light surfaces. Used anywhere the accent colors text: prose
42
+ * links, active TOC state, callout labels, hero eyebrow, copy-success, focus ring.
43
+ */
44
+ declare const accentsInk: {
45
+ readonly dark: {
46
+ readonly cyan: "oklch(0.78 0.12 210)";
47
+ readonly violet: "oklch(0.72 0.14 295)";
48
+ readonly mint: "oklch(0.78 0.10 160)";
49
+ readonly amber: "oklch(0.78 0.12 75)";
50
+ };
51
+ readonly light: {
52
+ readonly cyan: "oklch(0.525 0.09 210)";
53
+ readonly violet: "oklch(0.545 0.14 295)";
54
+ readonly mint: "oklch(0.52 0.1 160)";
55
+ readonly amber: "oklch(0.535 0.11 75)";
56
+ };
57
+ };
58
+ /**
59
+ * Semantic state colors — independent of the switchable `accent`, so a
60
+ * consumer picking `data-accent="amber"` never collides a warning with the
61
+ * site accent. Fixed per meaning in both surface and text/UI ("ink") forms,
62
+ * same split as `accents`/`accentsInk`.
63
+ */
64
+ declare const semantic: {
65
+ readonly dark: {
66
+ readonly danger: "oklch(0.68 0.19 25)";
67
+ readonly success: "oklch(0.75 0.15 150)";
68
+ readonly info: "oklch(0.78 0.12 210)";
69
+ readonly warning: "oklch(0.78 0.12 75)";
70
+ };
71
+ readonly light: {
72
+ readonly danger: "oklch(0.68 0.19 25)";
73
+ readonly success: "oklch(0.75 0.15 150)";
74
+ readonly info: "oklch(0.78 0.12 210)";
75
+ readonly warning: "oklch(0.78 0.12 75)";
76
+ };
77
+ };
78
+ declare const semanticInk: {
79
+ readonly dark: {
80
+ readonly danger: "oklch(0.68 0.19 25)";
81
+ readonly success: "oklch(0.75 0.15 150)";
82
+ readonly info: "oklch(0.78 0.12 210)";
83
+ readonly warning: "oklch(0.78 0.12 75)";
84
+ };
85
+ readonly light: {
86
+ readonly danger: "oklch(0.555 0.19 25)";
87
+ readonly success: "oklch(0.515 0.14 150)";
88
+ readonly info: "oklch(0.525 0.09 210)";
89
+ readonly warning: "oklch(0.535 0.11 75)";
90
+ };
91
+ };
92
+ type ThemeMode = keyof typeof colors;
93
+ type AccentName = keyof typeof accents;
94
+ type ColorScheme = (typeof colors)[ThemeMode];
95
+ type SemanticName = keyof (typeof semantic)['dark'];
96
+ declare const themeModes: ThemeMode[];
97
+ declare const accentNames: AccentName[];
98
+ declare const DEFAULT_MODE: ThemeMode;
99
+ declare const DEFAULT_ACCENT: AccentName;
100
+
101
+ /**
102
+ * Blog categories from the prototype. Categories render as a colored dot + label
103
+ * (never an emoji). The pill also accepts any CSS color for whitelabel use.
104
+ */
105
+ type CategoryName = 'ia' | 'prompt' | 'dev' | 'arch' | 'ts';
106
+ declare const defaultCategoryColors: Record<CategoryName, AccentName>;
107
+ /** Resolve an accent name or raw CSS color to a CSS color value. */
108
+ declare function resolveAccentColor(color: AccentName | (string & {})): string;
109
+ /** Resolve a category name, accent name, or raw CSS color to a CSS color value. */
110
+ declare function resolveCategoryColor(color: CategoryName | AccentName | (string & {})): string;
111
+
112
+ /** Data shape consumed by PostCard / FeaturedPostCard. The library never ships mock data. */
113
+ interface PostSummary {
114
+ title: string;
115
+ href: string;
116
+ excerpt?: string;
117
+ date?: string;
118
+ readMinutes?: number;
119
+ category?: {
120
+ label: string;
121
+ /** Accent token name, known category, or any CSS color. */
122
+ color?: AccentName | CategoryName | (string & {});
123
+ };
124
+ }
125
+ interface TocItem {
126
+ id: string;
127
+ label: string;
128
+ depth?: 2 | 3;
129
+ }
130
+ interface NavItem {
131
+ label: string;
132
+ href: string;
133
+ active?: boolean;
134
+ }
135
+
136
+ /**
137
+ * Article recipes: CodeBlock, Callout, TableOfContents, ReadingProgress,
138
+ * ArticleHeader, Prose. Pure functions — Server Component safe.
139
+ */
140
+ declare function codeBlock(): string;
141
+ declare const codeBlockClasses: {
142
+ readonly header: "sv-code-block__header";
143
+ readonly pre: "sv-code-block__pre";
144
+ readonly copy: "sv-code-block__copy";
145
+ readonly copyCopied: string;
146
+ };
147
+ type CalloutKind = 'note' | 'warn' | 'aha';
148
+ declare function callout(kind: CalloutKind): string;
149
+ declare const calloutClasses: {
150
+ readonly label: "sv-callout__label";
151
+ };
152
+ declare const calloutLabels: Record<CalloutKind, string>;
153
+ declare function tableOfContents(): string;
154
+ interface TocLinkOptions {
155
+ active?: boolean;
156
+ /** Heading depth, 2 (h2) or 3 (h3). Depth 3 indents. */
157
+ depth?: 2 | 3;
158
+ }
159
+ declare function tocLink(options?: TocLinkOptions): string;
160
+ declare function readingProgress(): string;
161
+ declare const readingProgressClasses: {
162
+ readonly bar: "sv-reading-progress__bar";
163
+ };
164
+ /** CSS var read by `.sv-reading-progress__bar` (0 → 1). */
165
+ declare const READING_PROGRESS_VAR = "--sv-reading-progress";
166
+ declare function articleHeader(): string;
167
+ declare const articleHeaderClasses: {
168
+ readonly title: "sv-article-header__title";
169
+ readonly meta: "sv-article-header__meta";
170
+ readonly author: "sv-article-header__author";
171
+ };
172
+ declare function prose(): string;
173
+ declare const proseClasses: {
174
+ readonly lead: "sv-prose__lead";
175
+ };
176
+
177
+ export { type AccentName as A, themeModes as B, type CalloutKind as C, DEFAULT_ACCENT as D, tocLink as E, type NavItem as N, type PostSummary as P, READING_PROGRESS_VAR as R, type SemanticName as S, type ThemeMode as T, type CategoryName as a, type ColorScheme as b, DEFAULT_MODE as c, type TocItem as d, type TocLinkOptions as e, accentNames as f, accents as g, accentsInk as h, articleHeader as i, articleHeaderClasses as j, callout as k, calloutClasses as l, calloutLabels as m, codeBlock as n, codeBlockClasses as o, colors as p, defaultCategoryColors as q, prose as r, proseClasses as s, readingProgress as t, readingProgressClasses as u, resolveAccentColor as v, resolveCategoryColor as w, semantic as x, semanticInk as y, tableOfContents as z };