@still-void/ui 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kalleo Pinheiro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # @still-void/ui
2
+
3
+ **Still Void** design system as a framework-agnostic TypeScript library — extracted from the
4
+ `blog.kalleopinheiro.dev` prototype. Works with React, Angular, Vue, or plain HTML, with
5
+ first-class support for **Next.js Server Components**.
6
+
7
+ ## Architecture
8
+
9
+ The library is layered so the core never depends on any framework:
10
+
11
+ | Layer | Entry | Runs where | What it is |
12
+ |---|---|---|---|
13
+ | **Tokens** | `@still-void/ui` | anywhere | Typed constants: colors (hex + oklch), typography, spacing, radii, motion |
14
+ | **Theme CSS** | `@still-void/ui/theme.css` | browser | CSS vars (`--sv-*`), dark/light via `data-theme`, accents via `data-accent`, signature utilities |
15
+ | **Component CSS** | `@still-void/ui/style.css` | browser | All component classes (`sv-*`) |
16
+ | **Recipes** | `@still-void/ui` | anywhere (RSC-safe) | Pure functions returning class strings: `postCard({ dense: true })` |
17
+ | **Behaviors** | `@still-void/ui` | client | Vanilla DOM: `createThemeManager`, `createScrollSpy`, `createReadingProgress`, `copyToClipboard` |
18
+ | **React (server-safe)** | `@still-void/ui/react` | server or client | Components without hooks — render inside Server Components |
19
+ | **React (client)** | `@still-void/ui/react/client` | client | `'use client'` bundle: `ThemeProvider`, `ThemeToggle`, `CopyButton`, `TableOfContents`, `ReadingProgress`, hooks |
20
+
21
+ ## Install
22
+
23
+ ```sh
24
+ npm install @still-void/ui
25
+ ```
26
+
27
+ React is an **optional** peer dependency — non-React consumers install nothing extra.
28
+
29
+ ## Usage — Next.js (App Router, Server Components)
30
+
31
+ ```tsx
32
+ // app/layout.tsx (Server Component)
33
+ import '@still-void/ui/theme.css';
34
+ import '@still-void/ui/style.css';
35
+ import { Header, Logo, Footer } from '@still-void/ui/react';
36
+ import { ThemeProvider, ThemeToggle } from '@still-void/ui/react/client';
37
+
38
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
39
+ return (
40
+ // Server-rendered attributes = correct theme on first paint, no flash.
41
+ <html lang="en" data-theme="dark" data-accent="cyan" suppressHydrationWarning>
42
+ <body className="sv-body">
43
+ <ThemeProvider>
44
+ <Header
45
+ logo={<Logo label="still.void" />}
46
+ items={[{ label: 'Home', href: '/', active: true }]}
47
+ actions={<ThemeToggle />}
48
+ />
49
+ {children}
50
+ <Footer author="Kalleo Pinheiro" links={[{ label: 'RSS', href: '/rss' }]} />
51
+ </ThemeProvider>
52
+ </body>
53
+ </html>
54
+ );
55
+ }
56
+ ```
57
+
58
+ ```tsx
59
+ // app/page.tsx (Server Component — zero client JS for this content)
60
+ import { Hero, PostGrid, PostCard, Layout } from '@still-void/ui/react';
61
+
62
+ export default async function Home() {
63
+ const posts = await getPosts(); // fetch on the server
64
+ return (
65
+ <Layout>
66
+ <Hero eyebrow="blog" title="Calm engineering, sharp accents" />
67
+ <PostGrid>
68
+ {posts.map((post) => (
69
+ <PostCard key={post.href} post={post} />
70
+ ))}
71
+ </PostGrid>
72
+ </Layout>
73
+ );
74
+ }
75
+ ```
76
+
77
+ Everything in `@still-void/ui/react` is hook-free and browser-API-free, so it renders on the
78
+ server. Interactive pieces come from `@still-void/ui/react/client` and are composed in via
79
+ slots (`actions`, `visual`, `eyebrow`).
80
+
81
+ ```tsx
82
+ // CodeBlock stays a Server Component; only the copy button hydrates.
83
+ import { CodeBlock } from '@still-void/ui/react';
84
+ import { CopyButton } from '@still-void/ui/react/client';
85
+
86
+ <CodeBlock code={source} language="ts" actions={<CopyButton code={source} />} />;
87
+ ```
88
+
89
+ Syntax highlighting is bring-your-own (by design — the prototype tokenizer was demo-only):
90
+ render with Shiki on the server and pass the markup via `rendered`.
91
+
92
+ ## Usage — any other framework (recipes + behaviors)
93
+
94
+ ```ts
95
+ import { postCard, postCardClasses, createThemeManager } from '@still-void/ui';
96
+ ```
97
+
98
+ ```html
99
+ <!-- Angular -->
100
+ <article [class]="postCard({ dense: true })">
101
+ <h3 [class]="postCardClasses.title">{{ post.title }}</h3>
102
+ </article>
103
+ ```
104
+
105
+ Behaviors are plain DOM and return a `destroy()`:
106
+
107
+ ```ts
108
+ const theme = createThemeManager(); // drives data-theme / data-accent, persists to localStorage
109
+ theme.toggleMode();
110
+ theme.setAccent('violet');
111
+ ```
112
+
113
+ See [playground/index.html](playground/index.html) for the full catalog rendered with **zero
114
+ framework code** — open it with `npm run playground` after `npm run build`.
115
+
116
+ ## Theming
117
+
118
+ - Mode: `data-theme="dark" | "light"` on `<html>` (dark is default).
119
+ - Accent: `data-accent="cyan" | "violet" | "mint" | "amber"` — pure CSS, so it works in
120
+ Server Components with no JS.
121
+ - Everything is overridable via CSS vars (`--sv-accent`, `--sv-bg`, …). No `!important` anywhere.
122
+
123
+ ## Fidelity rules (do not regress)
124
+
125
+ - Color values (hex/oklch) are literal from the spec — never rounded.
126
+ - `.sv-gradient-border` is the visual signature; never replace with `box-shadow`.
127
+ - Cards have **no shadow**.
128
+ - `text-wrap: balance` on every display heading.
129
+ - Fonts: Sora (display) / Manrope (body) / JetBrains Mono (code). System fonts are loading
130
+ fallbacks only.
131
+ - Hover easing `cubic-bezier(.3,.7,.4,1)`; reading progress bar is linear.
132
+ - Categories are colored dots + label — never emoji.
133
+
134
+ > Note: the reference sources (`colors_and_type.css`, `ui_kits/blog/*.jsx`) were not available
135
+ > at extraction time. Colors, accents, fonts, radii, easing and component inventory come
136
+ > literally from the spec document; the numeric type/spacing scales were derived and are
137
+ > centralized in `src/tokens/` for easy correction against the originals.
138
+
139
+ ## Scripts
140
+
141
+ ```sh
142
+ npm run build # tsup (ESM + CJS + .d.ts) + CSS to dist/
143
+ npm test # vitest (31 tests)
144
+ npm run typecheck # tsc --noEmit (strict)
145
+ npm run playground # serve the framework-free catalog
146
+ npm run storybook # component catalog at localhost:6006
147
+ npm run build-storybook # static Storybook build → storybook-static/
148
+ npm run changeset # record a change for the next release
149
+ npm run version # apply pending changesets, bump version, update CHANGELOG
150
+ npm run release # build + publish to npm
151
+ ```
152
+
153
+ ## Versioning
154
+
155
+ Releases are managed with [Changesets](https://github.com/changesets/changesets). After a
156
+ change that should ship in the next version, run `npm run changeset` and describe it — the
157
+ changelog and version bump are generated from these entries, not written by hand.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Quiet Tech color tokens.
3
+ * Values ported literally from the Quiet Tech 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: "#6F6F78";
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
+ type ThemeMode = keyof typeof colors;
37
+ type AccentName = keyof typeof accents;
38
+ type ColorScheme = (typeof colors)[ThemeMode];
39
+ declare const themeModes: ThemeMode[];
40
+ declare const accentNames: AccentName[];
41
+ declare const DEFAULT_MODE: ThemeMode;
42
+ declare const DEFAULT_ACCENT: AccentName;
43
+
44
+ /**
45
+ * Blog categories from the prototype. Categories render as a colored dot + label
46
+ * (never an emoji). The pill also accepts any CSS color for whitelabel use.
47
+ */
48
+ type CategoryName = 'ia' | 'prompt' | 'dev' | 'arch' | 'ts';
49
+ declare const defaultCategoryColors: Record<CategoryName, AccentName>;
50
+ /** Resolve an accent name or raw CSS color to a CSS color value. */
51
+ declare function resolveAccentColor(color: AccentName | (string & {})): string;
52
+ /** Resolve a category name, accent name, or raw CSS color to a CSS color value. */
53
+ declare function resolveCategoryColor(color: CategoryName | AccentName | (string & {})): string;
54
+
55
+ /** Data shape consumed by PostCard / FeaturedPostCard. The library never ships mock data. */
56
+ interface PostSummary {
57
+ title: string;
58
+ href: string;
59
+ excerpt?: string;
60
+ date?: string;
61
+ readMinutes?: number;
62
+ category?: {
63
+ label: string;
64
+ /** Accent token name, known category, or any CSS color. */
65
+ color?: AccentName | CategoryName | (string & {});
66
+ };
67
+ }
68
+ interface TocItem {
69
+ id: string;
70
+ label: string;
71
+ depth?: 2 | 3;
72
+ }
73
+ interface NavItem {
74
+ label: string;
75
+ href: string;
76
+ active?: boolean;
77
+ }
78
+
79
+ /**
80
+ * Article recipes: CodeBlock, Callout, TableOfContents, ReadingProgress,
81
+ * ArticleHeader, Prose. Pure functions — Server Component safe.
82
+ */
83
+ declare function codeBlock(): string;
84
+ declare const codeBlockClasses: {
85
+ readonly header: "qt-code-block__header";
86
+ readonly pre: "qt-code-block__pre";
87
+ readonly copy: "qt-code-block__copy";
88
+ readonly copyCopied: string;
89
+ };
90
+ type CalloutKind = 'note' | 'warn' | 'aha';
91
+ declare function callout(kind: CalloutKind): string;
92
+ declare const calloutClasses: {
93
+ readonly label: "qt-callout__label";
94
+ };
95
+ declare const calloutLabels: Record<CalloutKind, string>;
96
+ declare function tableOfContents(): string;
97
+ interface TocLinkOptions {
98
+ active?: boolean;
99
+ /** Heading depth, 2 (h2) or 3 (h3). Depth 3 indents. */
100
+ depth?: 2 | 3;
101
+ }
102
+ declare function tocLink(options?: TocLinkOptions): string;
103
+ declare function readingProgress(): string;
104
+ declare const readingProgressClasses: {
105
+ readonly bar: "qt-reading-progress__bar";
106
+ };
107
+ /** CSS var read by `.qt-reading-progress__bar` (0 → 1). */
108
+ declare const READING_PROGRESS_VAR = "--qt-reading-progress";
109
+ declare function articleHeader(): string;
110
+ declare const articleHeaderClasses: {
111
+ readonly title: "qt-article-header__title";
112
+ readonly meta: "qt-article-header__meta";
113
+ readonly author: "qt-article-header__author";
114
+ };
115
+ declare function prose(): string;
116
+ declare const proseClasses: {
117
+ readonly lead: "qt-prose__lead";
118
+ };
119
+
120
+ export { type AccentName as A, type CalloutKind as C, DEFAULT_ACCENT as D, type NavItem as N, type PostSummary as P, READING_PROGRESS_VAR as R, 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, articleHeader as h, articleHeaderClasses as i, callout as j, calloutClasses as k, calloutLabels as l, codeBlock as m, codeBlockClasses as n, colors as o, defaultCategoryColors as p, prose as q, proseClasses as r, readingProgress as s, readingProgressClasses as t, resolveAccentColor as u, resolveCategoryColor as v, tableOfContents as w, themeModes as x, tocLink as y };
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Quiet Tech color tokens.
3
+ * Values ported literally from the Quiet Tech 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: "#6F6F78";
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
+ type ThemeMode = keyof typeof colors;
37
+ type AccentName = keyof typeof accents;
38
+ type ColorScheme = (typeof colors)[ThemeMode];
39
+ declare const themeModes: ThemeMode[];
40
+ declare const accentNames: AccentName[];
41
+ declare const DEFAULT_MODE: ThemeMode;
42
+ declare const DEFAULT_ACCENT: AccentName;
43
+
44
+ /**
45
+ * Blog categories from the prototype. Categories render as a colored dot + label
46
+ * (never an emoji). The pill also accepts any CSS color for whitelabel use.
47
+ */
48
+ type CategoryName = 'ia' | 'prompt' | 'dev' | 'arch' | 'ts';
49
+ declare const defaultCategoryColors: Record<CategoryName, AccentName>;
50
+ /** Resolve an accent name or raw CSS color to a CSS color value. */
51
+ declare function resolveAccentColor(color: AccentName | (string & {})): string;
52
+ /** Resolve a category name, accent name, or raw CSS color to a CSS color value. */
53
+ declare function resolveCategoryColor(color: CategoryName | AccentName | (string & {})): string;
54
+
55
+ /** Data shape consumed by PostCard / FeaturedPostCard. The library never ships mock data. */
56
+ interface PostSummary {
57
+ title: string;
58
+ href: string;
59
+ excerpt?: string;
60
+ date?: string;
61
+ readMinutes?: number;
62
+ category?: {
63
+ label: string;
64
+ /** Accent token name, known category, or any CSS color. */
65
+ color?: AccentName | CategoryName | (string & {});
66
+ };
67
+ }
68
+ interface TocItem {
69
+ id: string;
70
+ label: string;
71
+ depth?: 2 | 3;
72
+ }
73
+ interface NavItem {
74
+ label: string;
75
+ href: string;
76
+ active?: boolean;
77
+ }
78
+
79
+ /**
80
+ * Article recipes: CodeBlock, Callout, TableOfContents, ReadingProgress,
81
+ * ArticleHeader, Prose. Pure functions — Server Component safe.
82
+ */
83
+ declare function codeBlock(): string;
84
+ declare const codeBlockClasses: {
85
+ readonly header: "qt-code-block__header";
86
+ readonly pre: "qt-code-block__pre";
87
+ readonly copy: "qt-code-block__copy";
88
+ readonly copyCopied: string;
89
+ };
90
+ type CalloutKind = 'note' | 'warn' | 'aha';
91
+ declare function callout(kind: CalloutKind): string;
92
+ declare const calloutClasses: {
93
+ readonly label: "qt-callout__label";
94
+ };
95
+ declare const calloutLabels: Record<CalloutKind, string>;
96
+ declare function tableOfContents(): string;
97
+ interface TocLinkOptions {
98
+ active?: boolean;
99
+ /** Heading depth, 2 (h2) or 3 (h3). Depth 3 indents. */
100
+ depth?: 2 | 3;
101
+ }
102
+ declare function tocLink(options?: TocLinkOptions): string;
103
+ declare function readingProgress(): string;
104
+ declare const readingProgressClasses: {
105
+ readonly bar: "qt-reading-progress__bar";
106
+ };
107
+ /** CSS var read by `.qt-reading-progress__bar` (0 → 1). */
108
+ declare const READING_PROGRESS_VAR = "--qt-reading-progress";
109
+ declare function articleHeader(): string;
110
+ declare const articleHeaderClasses: {
111
+ readonly title: "qt-article-header__title";
112
+ readonly meta: "qt-article-header__meta";
113
+ readonly author: "qt-article-header__author";
114
+ };
115
+ declare function prose(): string;
116
+ declare const proseClasses: {
117
+ readonly lead: "qt-prose__lead";
118
+ };
119
+
120
+ export { type AccentName as A, type CalloutKind as C, DEFAULT_ACCENT as D, type NavItem as N, type PostSummary as P, READING_PROGRESS_VAR as R, 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, articleHeader as h, articleHeaderClasses as i, callout as j, calloutClasses as k, calloutLabels as l, codeBlock as m, codeBlockClasses as n, colors as o, defaultCategoryColors as p, prose as q, proseClasses as r, readingProgress as s, readingProgressClasses as t, resolveAccentColor as u, resolveCategoryColor as v, tableOfContents as w, themeModes as x, tocLink as y };