@codenhub/styles 0.0.3 → 0.0.4
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 +201 -0
- package/NOTICE +25 -0
- package/README.md +2 -0
- package/dist/components.css +1 -1
- package/dist/index.css +1 -1
- package/dist/theme.css +1 -1
- package/package.json +6 -8
- package/src/components/button.css +155 -155
- package/src/components/feedback.css +214 -214
- package/src/components/form.css +303 -296
- package/src/components/index.css +9 -9
- package/src/components/loader.css +56 -56
- package/src/components/surface.css +6 -6
- package/src/index.css +7 -7
- package/src/overrides.css +76 -76
- package/src/theme.css +98 -0
- package/src/typography.css +30 -30
- package/docs/accessibility.md +0 -53
- package/docs/classes.md +0 -198
- package/docs/index.md +0 -73
- package/docs/roadmap.md +0 -34
- package/docs/tests.md +0 -128
- package/docs/tokens.md +0 -101
package/docs/classes.md
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
# @codenhub/styles Classes
|
|
2
|
-
|
|
3
|
-
**Status:** IMPLEMENTED
|
|
4
|
-
**Last updated:** 2026-06-18
|
|
5
|
-
**Scope:** Public helper classes for `@codenhub/styles`.
|
|
6
|
-
|
|
7
|
-
Helper classes are CSS-only. They provide presentation and state styling, not semantics or behavior.
|
|
8
|
-
|
|
9
|
-
## Layout
|
|
10
|
-
|
|
11
|
-
`.stack`, `.cluster`, and `.auto-grid` are `@utility` classes. They are available in both the full stylesheet and the Tailwind source entrypoints, and participate in Tailwind's JIT pipeline.
|
|
12
|
-
|
|
13
|
-
| Class | Purpose |
|
|
14
|
-
| ------------------ | -------------------------------------------------------------- |
|
|
15
|
-
| `.stack` | Vertical flex stack using `--layout-stack-gap`. |
|
|
16
|
-
| `.stack.tight` | Smaller stack gap. |
|
|
17
|
-
| `.stack.loose` | Larger stack gap. |
|
|
18
|
-
| `.cluster` | Wrapping horizontal flex cluster using `--layout-cluster-gap`. |
|
|
19
|
-
| `.cluster.between` | Cluster with `space-between` alignment. |
|
|
20
|
-
| `.auto-grid` | Responsive auto-fit grid using `--layout-grid-min`. |
|
|
21
|
-
|
|
22
|
-
## Surfaces
|
|
23
|
-
|
|
24
|
-
| Class | Purpose |
|
|
25
|
-
| -------------- | --------------------------------------------- |
|
|
26
|
-
| `.empty-state` | Centered empty-state layout with muted color. |
|
|
27
|
-
|
|
28
|
-
## Buttons
|
|
29
|
-
|
|
30
|
-
Use `.btn` with one optional intent class, one optional presentation class, optional size class, and optional state.
|
|
31
|
-
|
|
32
|
-
Intent classes map color tokens into button tone slots. Presentation classes own how those slots become background, text, border, hover, and spinner styles.
|
|
33
|
-
|
|
34
|
-
Intent classes:
|
|
35
|
-
|
|
36
|
-
| Class | Meaning |
|
|
37
|
-
| ----------------------------------- | ------------------------------ |
|
|
38
|
-
| `.primary` | Primary action. |
|
|
39
|
-
| `.secondary` | Secondary/accent action. |
|
|
40
|
-
| `.success` | Successful or positive action. |
|
|
41
|
-
| `.warning` | Warning/caution action. |
|
|
42
|
-
| `.destructive`, `.danger`, `.error` | Destructive or error action. |
|
|
43
|
-
| `.info` | Informational action. |
|
|
44
|
-
|
|
45
|
-
Presentation and size classes:
|
|
46
|
-
|
|
47
|
-
| Class | Purpose |
|
|
48
|
-
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
49
|
-
| `.out` | Transparent button with intent readable-tone border and text. |
|
|
50
|
-
| `.ghost` | Transparent button with intent readable-tone text and soft hover. |
|
|
51
|
-
| `.soft` | Low-emphasis filled button using intent subtle surface and strong text tones. |
|
|
52
|
-
| `.pill` | Fully rounded button corners (`border-radius: 9999px`). |
|
|
53
|
-
| `.fill` with `.out` | Filled hover treatment using intent color and contrast text. |
|
|
54
|
-
| `.sm` | Smaller button. |
|
|
55
|
-
| `.lg` | Larger button. |
|
|
56
|
-
| `.icon` | Square icon button. Use an accessible name in HTML. |
|
|
57
|
-
| `.loading` | Loading state. Hides text and shows CSS activity indicator. |
|
|
58
|
-
| `.disabled`, `[disabled]`, `[aria-disabled="true"]`, `[data-disabled]` | Disabled styling. |
|
|
59
|
-
|
|
60
|
-
Examples:
|
|
61
|
-
|
|
62
|
-
```html
|
|
63
|
-
<button class="btn primary">Primary</button>
|
|
64
|
-
<button class="btn success out">Success outline</button>
|
|
65
|
-
<button class="btn warning soft">Warning soft</button>
|
|
66
|
-
<button class="btn destructive ghost">Danger ghost</button>
|
|
67
|
-
<button class="btn icon primary" aria-label="Create">+</button>
|
|
68
|
-
<button class="btn primary loading" disabled>Saving</button>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
`.loading` is a state, not a color or presentation class. Prefer combining it with disabled behavior so users cannot trigger duplicate work. Loading buttons keep only opacity and transform transitions active so spinner and surface colors stay synchronized when theme tokens change.
|
|
72
|
-
|
|
73
|
-
## Forms
|
|
74
|
-
|
|
75
|
-
| Class or Selector | Purpose |
|
|
76
|
-
| --------------------------------------------------------------------- | ----------------------------------- |
|
|
77
|
-
| `.field` | Vertical field wrapper. |
|
|
78
|
-
| `.label` | Form label text. |
|
|
79
|
-
| `.hint` | Secondary helper text. |
|
|
80
|
-
| `.error` inside `.field` except `.btn.error`, `.field-error` | Destructive helper text. |
|
|
81
|
-
| `.ipt` | Input control styling. |
|
|
82
|
-
| `.textarea` | Textarea control styling. |
|
|
83
|
-
| `.select` | Select control styling. |
|
|
84
|
-
| `input[type="checkbox"].checkbox` | Custom checkbox control styling. |
|
|
85
|
-
| `input[type="checkbox"].switch` | Custom switch control styling. |
|
|
86
|
-
| `[aria-invalid="true"]` on controls | Destructive border and focus color. |
|
|
87
|
-
| `[disabled]`, `[aria-disabled="true"]`, `[data-disabled]` on controls | Disabled styling. |
|
|
88
|
-
|
|
89
|
-
`.checkbox` and `.switch` accept the same intent classes as buttons to set the checked color:
|
|
90
|
-
|
|
91
|
-
| Class | Meaning |
|
|
92
|
-
| ----------------------------------- | ------------------ |
|
|
93
|
-
| _(default)_ | Primary color. |
|
|
94
|
-
| `.success` | Success color. |
|
|
95
|
-
| `.warning` | Warning color. |
|
|
96
|
-
| `.destructive`, `.danger`, `.error` | Destructive color. |
|
|
97
|
-
| `.info` | Info color. |
|
|
98
|
-
|
|
99
|
-
Example:
|
|
100
|
-
|
|
101
|
-
```html
|
|
102
|
-
<label class="field">
|
|
103
|
-
<span class="label">Email</span>
|
|
104
|
-
<input class="ipt" type="email" aria-invalid="true" aria-describedby="email-error" />
|
|
105
|
-
<span class="error" id="email-error">Enter a valid email.</span>
|
|
106
|
-
</label>
|
|
107
|
-
<label style="display: flex; gap: 0.5rem; align-items: center">
|
|
108
|
-
<input type="checkbox" class="checkbox success" />
|
|
109
|
-
<span>Accept terms</span>
|
|
110
|
-
</label>
|
|
111
|
-
<label style="display: flex; gap: 0.5rem; align-items: center">
|
|
112
|
-
<input type="checkbox" class="switch destructive" />
|
|
113
|
-
<span>Enable</span>
|
|
114
|
-
</label>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
`.progress` also accepts the same intent classes to color the fill bar:
|
|
118
|
-
|
|
119
|
-
## Feedback
|
|
120
|
-
|
|
121
|
-
| Class | Purpose |
|
|
122
|
-
| ----------- | ------------------------------------------------------------------- |
|
|
123
|
-
| `.alert` | Inline feedback surface. |
|
|
124
|
-
| `.icon` | Subclass of `.alert`. Adds a corresponding intent icon and padding. |
|
|
125
|
-
| `.badge` | Compact status pill. |
|
|
126
|
-
| `.ai` | Low-level activity indicator. Applies CSS masking. |
|
|
127
|
-
| `.loader` | Standalone inline loader. Composes `.ai` with visual styles. |
|
|
128
|
-
| `.skeleton` | Ambient loading placeholder. |
|
|
129
|
-
| `.progress` | Progress track. Fill element uses `--progress-value`. |
|
|
130
|
-
|
|
131
|
-
Feedback helpers accept the same intent classes as buttons: `.success`, `.warning`, `.destructive`, `.danger`, `.error`, and `.info`.
|
|
132
|
-
|
|
133
|
-
`.icon` is a subclass of `.alert`. When applied as `.alert.icon`, it increases the left padding and adds an embedded SVG icon matching the alert's intent (success, warning, error, info).
|
|
134
|
-
|
|
135
|
-
`.badge` also accepts presentation variant classes:
|
|
136
|
-
|
|
137
|
-
| Class | Purpose |
|
|
138
|
-
| -------- | ---------------------------------------------------------------------------------- |
|
|
139
|
-
| _(none)_ | Default. Tinted surface, intent-colored text, subtle intent-tinted border. |
|
|
140
|
-
| `.flat` | Filled with the intent color; uses contrast text. Border matches the intent color. |
|
|
141
|
-
| `.soft` | Tinted surface and intent-colored text with no border (border is transparent). |
|
|
142
|
-
|
|
143
|
-
Examples:
|
|
144
|
-
|
|
145
|
-
```html
|
|
146
|
-
<div class="alert success" role="status">Saved successfully.</div>
|
|
147
|
-
<div class="alert success icon" role="status">Saved successfully with icon.</div>
|
|
148
|
-
<span class="badge warning">Queued</span>
|
|
149
|
-
<span class="badge success flat">Live</span>
|
|
150
|
-
<span class="badge info soft">Draft</span>
|
|
151
|
-
<span class="loader" aria-hidden="true"></span>
|
|
152
|
-
<span class="loader dots-wave" aria-hidden="true"></span>
|
|
153
|
-
<div class="progress" aria-label="Upload progress"><span style="--progress-value: 64%"></span></div>
|
|
154
|
-
<div class="progress success" aria-label="Upload progress"><span style="--progress-value: 64%"></span></div>
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Tooltips
|
|
158
|
-
|
|
159
|
-
| Class or Attribute | Purpose |
|
|
160
|
-
| ---------------------------------- | ------------------------------------------------------------ |
|
|
161
|
-
| `.tooltip` | Tooltip host. Uses `data-tooltip` as pseudo-element content. |
|
|
162
|
-
| `.tooltip.tooltip-icon` | Circular icon-style tooltip host. |
|
|
163
|
-
| `[data-tooltip-position="top"]` | Positions tooltip above host. |
|
|
164
|
-
| `[data-tooltip-position="bottom"]` | Positions tooltip below host. |
|
|
165
|
-
| `[data-tooltip-position="left"]` | Positions tooltip left of host. |
|
|
166
|
-
| `[data-tooltip-position="right"]` | Positions tooltip right of host. |
|
|
167
|
-
| No `data-tooltip-position` | Defaults to top placement. |
|
|
168
|
-
| `[data-state="open"]` | Shows tooltip without hover. |
|
|
169
|
-
|
|
170
|
-
Example:
|
|
171
|
-
|
|
172
|
-
```html
|
|
173
|
-
<button
|
|
174
|
-
class="tooltip tooltip-icon"
|
|
175
|
-
data-tooltip="More details"
|
|
176
|
-
data-tooltip-position="right"
|
|
177
|
-
aria-label="More details"
|
|
178
|
-
>
|
|
179
|
-
?
|
|
180
|
-
</button>
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
CSS pseudo-element tooltips are presentational. They are not a complete accessible tooltip implementation by themselves.
|
|
184
|
-
|
|
185
|
-
## Typography Utilities
|
|
186
|
-
|
|
187
|
-
All typography classes and `.selection-contrast` are `@utility` classes.
|
|
188
|
-
|
|
189
|
-
| Class | Purpose |
|
|
190
|
-
| --------------------- | ------------------------------------------------------------ |
|
|
191
|
-
| `.text-display` | Large display headings. |
|
|
192
|
-
| `.text-title-lg` | Large section titles. |
|
|
193
|
-
| `.text-title` | Default section titles. |
|
|
194
|
-
| `.text-title-sm` | Smaller titles or card titles. |
|
|
195
|
-
| `.text-label-lg` | Large label text. |
|
|
196
|
-
| `.text-label` | Default label text. |
|
|
197
|
-
| `.text-body` | Default body copy. |
|
|
198
|
-
| `.selection-contrast` | Inverts `::selection` colors to primary-contrast background. |
|
package/docs/index.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# @codenhub/styles Overview
|
|
2
|
-
|
|
3
|
-
**Status:** IMPLEMENTED
|
|
4
|
-
**Last updated:** 2026-06-18
|
|
5
|
-
**Scope:** `@codenhub/styles` package.
|
|
6
|
-
|
|
7
|
-
`@codenhub/styles` is a CSS-only styling foundation for Codenhub interfaces. It provides tokens, base styles, typography utilities, layout helpers, component helper classes, and Tailwind CSS v4 source entrypoints.
|
|
8
|
-
|
|
9
|
-
The package has no JavaScript runtime. It does not create DOM nodes, attach event listeners, manage focus, validate forms, dismiss toasts, or provide framework components.
|
|
10
|
-
|
|
11
|
-
## Public Entrypoints
|
|
12
|
-
|
|
13
|
-
| Path | Contents |
|
|
14
|
-
| -------------------------------- | --------------------------------------------------------------------- |
|
|
15
|
-
| `@codenhub/styles` | Full compiled stylesheet: theme, base styles, components, typography. |
|
|
16
|
-
| `@codenhub/styles/theme` | Compiled theme tokens and dark-mode variables. |
|
|
17
|
-
| `@codenhub/styles/components` | Compiled theme tokens plus component classes. |
|
|
18
|
-
| `@codenhub/styles/tw` | Tailwind v4 source for theme, base styles, components, and utilities. |
|
|
19
|
-
| `@codenhub/styles/tw/theme` | Tailwind v4 source for theme tokens and custom dark variant. |
|
|
20
|
-
| `@codenhub/styles/tw/components` | Tailwind v4 source for theme tokens and component classes. |
|
|
21
|
-
| `@codenhub/styles/tw/surface` | Tailwind v4 source for surface styles and empty-state utility. |
|
|
22
|
-
| `@codenhub/styles/tw/button` | Tailwind v4 source for composable button utilities. |
|
|
23
|
-
| `@codenhub/styles/tw/form` | Tailwind v4 source for form, inputs, checkbox, and switch utilities. |
|
|
24
|
-
| `@codenhub/styles/tw/feedback` | Tailwind v4 source for alert, badge, skeleton, and progress. |
|
|
25
|
-
| `@codenhub/styles/tw/loader` | Tailwind v4 source for loader and activity indicator utilities. |
|
|
26
|
-
| `@codenhub/styles/tw/tooltip` | Tailwind v4 source for tooltip utility. |
|
|
27
|
-
| `@codenhub/styles/tw/utilities` | Tailwind v4 source for layout primitives and contrast utilities. |
|
|
28
|
-
|
|
29
|
-
`components` entrypoints include theme tokens because component classes depend on those variables.
|
|
30
|
-
|
|
31
|
-
## Class Model
|
|
32
|
-
|
|
33
|
-
Helper classes are designed as small composable CSS contracts:
|
|
34
|
-
|
|
35
|
-
- Intent classes define meaning, such as `.primary`, `.success`, `.warning`, `.destructive`, and `.info`.
|
|
36
|
-
- Presentation classes define treatment, such as `.out`, `.ghost`, `.soft`, `.sm`, `.lg`, and `.icon`.
|
|
37
|
-
- State classes or attributes define current state, such as `.loading`, `.disabled`, `[disabled]`, `[aria-disabled="true"]`, `[data-disabled]`, `[aria-invalid="true"]`, and `[data-state="open"]`.
|
|
38
|
-
|
|
39
|
-
Button example:
|
|
40
|
-
|
|
41
|
-
```html
|
|
42
|
-
<button class="btn success out">Success outline</button>
|
|
43
|
-
<button class="btn destructive ghost">Danger ghost</button>
|
|
44
|
-
<button class="btn primary loading" disabled>Saving</button>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
`out`, `ghost`, and `soft` are presentation choices. They consume active intent tone slots instead of carrying a fixed color intent; for example, `.btn.success.soft` uses success subtle and strong tones.
|
|
48
|
-
|
|
49
|
-
## Token Model
|
|
50
|
-
|
|
51
|
-
Component classes use public foundation tokens for shape, motion, focus, surface, and state behavior. Internal scoped variables may exist to compose class variants, but they are not the public customization contract.
|
|
52
|
-
|
|
53
|
-
Example future-ready profile shape:
|
|
54
|
-
|
|
55
|
-
```css
|
|
56
|
-
.custom-profile {
|
|
57
|
-
--radius-surface: 1.25rem;
|
|
58
|
-
--elevation-low: 0 24px 60px rgb(0 0 0 / 0.18);
|
|
59
|
-
--motion-duration-normal: 240ms;
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Aesthetic profile classes such as `.glassmorphism` or `.brutalism` are not part of v0.0.2. v0.0.2 provides the token foundation that makes them possible later.
|
|
64
|
-
|
|
65
|
-
## Documentation Map
|
|
66
|
-
|
|
67
|
-
| Document | Purpose |
|
|
68
|
-
| ----------------------------------- | --------------------------------------------------------- |
|
|
69
|
-
| [Tokens](./tokens.md) | Theme and foundation variable contracts. |
|
|
70
|
-
| [Classes](./classes.md) | Public helper class behavior and composition rules. |
|
|
71
|
-
| [Accessibility](./accessibility.md) | CSS accessibility hooks and responsibilities outside CSS. |
|
|
72
|
-
| [Tests](./tests.md) | Build and browser validation strategy. |
|
|
73
|
-
| [Roadmap](./roadmap.md) | Draft direction and durable planning context. |
|
package/docs/roadmap.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Roadmap
|
|
2
|
-
|
|
3
|
-
**Status:** APPROVED
|
|
4
|
-
**Last updated:** 2026-06-23
|
|
5
|
-
**Scope:** `@codenhub/styles` package direction.
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
This roadmap tracks durable direction for `@codenhub/styles`. It captures styling-system improvements that should guide future changes without turning this document into a release checklist.
|
|
10
|
-
|
|
11
|
-
## Recently Completed
|
|
12
|
-
|
|
13
|
-
- Published the v0.0.2 foundation: design tokens (colors, layout, radius, motion, focus, shadows, layering, dark mode), presentation/helper classes (buttons, forms, feedback, loaders, tooltips), accessibility contrast verification, and multi-path bundler visual regression tests.
|
|
14
|
-
|
|
15
|
-
## Planned
|
|
16
|
-
|
|
17
|
-
- **Aesthetic Themes**: Add aesthetic themes (e.g., glassmorphism, brutalism, glitch) to allow changing the whole look-and-feel of the UI.
|
|
18
|
-
- **Layout Helpers**: Expand layout helpers to support common page structure and flex/grid requirements.
|
|
19
|
-
- **Dynamic Tokens & Color Schemes**: Add `@codenhub/theme` as a dev dependency to enable dynamic token changes and color scheme creation.
|
|
20
|
-
- **Button Presentation Classes**: Consider adding more presentation classes for buttons (e.g., loading state enhancements) once component APIs stabilize.
|
|
21
|
-
- **Compatibility Tests**: Add more explicit compatibility tests for intent and presentation combinations when new combinations are supported.
|
|
22
|
-
|
|
23
|
-
## Not Planned
|
|
24
|
-
|
|
25
|
-
- **JS/TS Helpers**: Runtime DOM helpers (such as a typed `createElement` wrapper) are not planned for now. They will be considered further before any future package expansion, but remain out of scope for now to keep the package CSS-only.
|
|
26
|
-
- Public JavaScript behavior like toast dismissal, focus management, and app-level theme state remain outside the CSS package.
|
|
27
|
-
|
|
28
|
-
## References
|
|
29
|
-
|
|
30
|
-
- [Overview](./index.md)
|
|
31
|
-
- [Tokens](./tokens.md)
|
|
32
|
-
- [Classes](./classes.md)
|
|
33
|
-
- [Accessibility](./accessibility.md)
|
|
34
|
-
- [Tests](./tests.md)
|
package/docs/tests.md
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Styles Test Strategy
|
|
2
|
-
|
|
3
|
-
**Status:** APPROVED
|
|
4
|
-
**Last updated:** 2026-06-16
|
|
5
|
-
**Scope:** `@codenhub/styles` package test strategy.
|
|
6
|
-
|
|
7
|
-
## Goal
|
|
8
|
-
|
|
9
|
-
Validate `@codenhub/styles` before publishing changes across both supported consumer paths:
|
|
10
|
-
|
|
11
|
-
- Ready-to-import compiled CSS.
|
|
12
|
-
- Tailwind CSS build-time source CSS.
|
|
13
|
-
|
|
14
|
-
Keep tests package-local and focused on visual confidence plus build compatibility.
|
|
15
|
-
|
|
16
|
-
## Structure
|
|
17
|
-
|
|
18
|
-
```text
|
|
19
|
-
packages/styles/
|
|
20
|
-
tests/
|
|
21
|
-
preview/
|
|
22
|
-
vanilla/
|
|
23
|
-
build/
|
|
24
|
-
browser/
|
|
25
|
-
scripts/
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## `tests/preview`
|
|
29
|
-
|
|
30
|
-
Shared manual and automated preview page for both supported consumer paths.
|
|
31
|
-
|
|
32
|
-
Open with one of these URLs when running the package dev server:
|
|
33
|
-
|
|
34
|
-
```text
|
|
35
|
-
http://localhost:5173/tests/preview/index.html?env=vanilla
|
|
36
|
-
http://localhost:5173/tests/preview/index.html?env=build
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
The page loads `tests/vanilla/output.css` for `env=vanilla` and `tests/build/output.css` for `env=build`.
|
|
40
|
-
|
|
41
|
-
The floating environment toggle switches the `env` query value between `vanilla` and `build`. Its tooltip names the target environment with `See build` or `See vanilla`.
|
|
42
|
-
|
|
43
|
-
Cover:
|
|
44
|
-
|
|
45
|
-
- Tokens in light and dark mode.
|
|
46
|
-
- Typography utilities.
|
|
47
|
-
- Buttons: intent, presentation, disabled, and loading states.
|
|
48
|
-
- Layout helpers, surfaces, forms, feedback, tooltips, and sections.
|
|
49
|
-
- Selection and base styles.
|
|
50
|
-
- Tailwind token utilities, dark variants, and responsive variants.
|
|
51
|
-
|
|
52
|
-
Purpose: keep one HTML fixture while validating both real CSS outputs.
|
|
53
|
-
|
|
54
|
-
## `tests/vanilla`
|
|
55
|
-
|
|
56
|
-
Compiled CSS output for vanilla consumers.
|
|
57
|
-
|
|
58
|
-
Use built package CSS only:
|
|
59
|
-
|
|
60
|
-
```css
|
|
61
|
-
@import "../../dist/index.css";
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Purpose: confirm canonical `@codenhub/styles` output looks right with no Tailwind consumer build.
|
|
65
|
-
|
|
66
|
-
## `tests/build`
|
|
67
|
-
|
|
68
|
-
Build validation for Tailwind consumers.
|
|
69
|
-
|
|
70
|
-
Use source entrypoint:
|
|
71
|
-
|
|
72
|
-
```css
|
|
73
|
-
@import "tailwindcss";
|
|
74
|
-
@import "@codenhub/styles/tw";
|
|
75
|
-
|
|
76
|
-
@source "../preview/index.html";
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Cover:
|
|
80
|
-
|
|
81
|
-
- Tailwind can process package source.
|
|
82
|
-
- Token utilities work, such as `bg-background`, `text-text`, `font-default`.
|
|
83
|
-
- Dark variant works with `.dark`.
|
|
84
|
-
- Component classes build correctly.
|
|
85
|
-
- Responsive token variants work.
|
|
86
|
-
|
|
87
|
-
Purpose: confirm `@codenhub/styles/tw` works in consumer Tailwind builds.
|
|
88
|
-
|
|
89
|
-
## `tests/browser`
|
|
90
|
-
|
|
91
|
-
Cross-browser automation for visual and computed-style confidence.
|
|
92
|
-
|
|
93
|
-
Use Playwright by default.
|
|
94
|
-
|
|
95
|
-
Tests load the same preview page twice with different `env` query values.
|
|
96
|
-
|
|
97
|
-
Cover:
|
|
98
|
-
|
|
99
|
-
- Chromium.
|
|
100
|
-
- Firefox.
|
|
101
|
-
- WebKit.
|
|
102
|
-
- Page load assertions.
|
|
103
|
-
- Key computed style assertions.
|
|
104
|
-
- Optional screenshots for visual review.
|
|
105
|
-
|
|
106
|
-
Purpose: catch browser-specific CSS regressions before publishing changes.
|
|
107
|
-
|
|
108
|
-
## Scripts
|
|
109
|
-
|
|
110
|
-
Default package checks:
|
|
111
|
-
|
|
112
|
-
```json
|
|
113
|
-
{
|
|
114
|
-
"test": "pnpm typecheck && pnpm test:build && pnpm test:visual",
|
|
115
|
-
"test:build": "pnpm build && pnpm test:build:vanilla && pnpm test:build:tw",
|
|
116
|
-
"test:visual": "playwright test",
|
|
117
|
-
"dev": "node ./scripts/dev.js"
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
`pnpm dev` starts a local static server and watches both CSS test builds.
|
|
122
|
-
|
|
123
|
-
## Priority
|
|
124
|
-
|
|
125
|
-
1. Keep `tests/preview` as the single shared HTML fixture.
|
|
126
|
-
2. Keep `tests/vanilla` for compiled CSS output.
|
|
127
|
-
3. Keep `tests/build` for Tailwind source build validation.
|
|
128
|
-
4. Keep `tests/browser` for Playwright cross-browser validation.
|
package/docs/tokens.md
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# @codenhub/styles Tokens
|
|
2
|
-
|
|
3
|
-
**Status:** IMPLEMENTED
|
|
4
|
-
**Last updated:** 2026-06-18
|
|
5
|
-
**Scope:** Public CSS variable contract for `@codenhub/styles`.
|
|
6
|
-
|
|
7
|
-
Tokens are CSS custom properties. Default values apply by default. `.dark` may override any token value for that subtree.
|
|
8
|
-
|
|
9
|
-
```html
|
|
10
|
-
<section class="dark">
|
|
11
|
-
<article class="card">Dark token subtree</article>
|
|
12
|
-
</section>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Color Tokens
|
|
16
|
-
|
|
17
|
-
| Token | Purpose |
|
|
18
|
-
| ------------------------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
19
|
-
| `--color-primary` | Primary action/content color. |
|
|
20
|
-
| `--color-primary-contrast` | Text/icon color on primary filled surface. |
|
|
21
|
-
| `--color-primary-hover` | Primary hover state. |
|
|
22
|
-
| `--color-primary-subtle` | Low-emphasis companion tone for primary. Use as soft surface or subtle background. |
|
|
23
|
-
| `--color-primary-strong` | High-emphasis companion tone for primary. Use as readable text, icon, or border on subtle surfaces. |
|
|
24
|
-
| `--color-accent` | Secondary/accent surface. |
|
|
25
|
-
| `--color-accent-contrast` | Text/icon color on accent filled surface. |
|
|
26
|
-
| `--color-accent-hover` | Accent hover state. |
|
|
27
|
-
| `--color-accent-subtle` | Low-emphasis companion tone for accent. Use as soft surface or subtle background. |
|
|
28
|
-
| `--color-accent-strong` | High-emphasis companion tone for accent. Use as readable text, icon, or border on subtle surfaces. |
|
|
29
|
-
| `--color-border` | Default border color. |
|
|
30
|
-
| `--color-border-hover` | Interactive border color. |
|
|
31
|
-
| `--color-background` | Page and default raised surface background. |
|
|
32
|
-
| `--color-foreground` | Subtle raised foreground surface. |
|
|
33
|
-
| `--color-surface` | Nested or muted surface. |
|
|
34
|
-
| `--color-text` | Primary text color. |
|
|
35
|
-
| `--color-text-secondary` | Secondary text color. |
|
|
36
|
-
| `--color-text-contrast` | Text/icon color on text filled surface. |
|
|
37
|
-
| `--color-text-hover` | Text hover state. |
|
|
38
|
-
| `--color-text-subtle` | Low-emphasis companion tone for text. Use as soft surface or subtle background. |
|
|
39
|
-
| `--color-text-strong` | High-emphasis companion tone for text. Use as readable text, icon, or border on subtle surfaces. |
|
|
40
|
-
| `--color-success` | Success state color. |
|
|
41
|
-
| `--color-success-contrast` | Text/icon color on success filled surface. Meets 3:1 UI component contrast against `--color-success`. |
|
|
42
|
-
| `--color-success-hover` | Success hover tone. |
|
|
43
|
-
| `--color-success-subtle` | Low-emphasis companion tone for success. |
|
|
44
|
-
| `--color-success-strong` | High-emphasis companion tone for success. |
|
|
45
|
-
| `--color-warning` | Warning state color. |
|
|
46
|
-
| `--color-warning-contrast` | Text/icon color on warning filled surface. Meets 3:1 UI component contrast against `--color-warning`. |
|
|
47
|
-
| `--color-warning-hover` | Warning hover tone. |
|
|
48
|
-
| `--color-warning-subtle` | Low-emphasis companion tone for warning. |
|
|
49
|
-
| `--color-warning-strong` | High-emphasis companion tone for warning. |
|
|
50
|
-
| `--color-destructive` | Destructive/error state color. |
|
|
51
|
-
| `--color-destructive-contrast` | Text/icon color on destructive filled surface. Meets 3:1 UI component contrast against `--color-destructive`. |
|
|
52
|
-
| `--color-destructive-hover` | Destructive hover tone. |
|
|
53
|
-
| `--color-destructive-subtle` | Low-emphasis companion tone for destructive. |
|
|
54
|
-
| `--color-destructive-strong` | High-emphasis companion tone for destructive. |
|
|
55
|
-
| `--color-info` | Informational state color. |
|
|
56
|
-
| `--color-info-contrast` | Text/icon color on info filled surface. Meets 3:1 UI component contrast against `--color-info`. |
|
|
57
|
-
| `--color-info-hover` | Info hover tone. |
|
|
58
|
-
| `--color-info-subtle` | Low-emphasis companion tone for info. |
|
|
59
|
-
| `--color-info-strong` | High-emphasis companion tone for info. |
|
|
60
|
-
|
|
61
|
-
> **Intent token contract**: color intent tokens own meaning and tone variants. Components map an intent palette into scoped component slots, and presentation classes decide which slots to consume. Theme changes belong in token values such as `.dark`, not broad component-level theme checks. Component-level theme handling should exist only when a component has an internal structure that cannot be expressed through the token palette alone.
|
|
62
|
-
|
|
63
|
-
## Foundation Tokens
|
|
64
|
-
|
|
65
|
-
Foundation tokens are not aliases for one color. They define layout, shape, motion, focus, depth, and layering behavior used by helper classes.
|
|
66
|
-
|
|
67
|
-
| Token | Purpose |
|
|
68
|
-
| --------------------------- | ---------------------------------------------------------------------------- |
|
|
69
|
-
| `--font-default` | Default app font family. |
|
|
70
|
-
| `--container-narrow` | Narrow content width. |
|
|
71
|
-
| `--container-max` | Default content width. |
|
|
72
|
-
| `--container-wide` | Wide content width. |
|
|
73
|
-
| `--layout-gutter` | Responsive inline page padding. |
|
|
74
|
-
| `--layout-section-block` | Responsive section vertical padding. |
|
|
75
|
-
| `--layout-stack-gap` | Default vertical stack gap. |
|
|
76
|
-
| `--layout-cluster-gap` | Default horizontal/wrapped cluster gap. |
|
|
77
|
-
| `--layout-grid-min` | Minimum column width for `.auto-grid`. |
|
|
78
|
-
| `--radius-control` | Radius for buttons, inputs, tooltips, and compact UI. |
|
|
79
|
-
| `--radius-surface` | Radius for cards, panels, and alerts. |
|
|
80
|
-
| `--control-height` | Default minimum height for controls. |
|
|
81
|
-
| `--border-width` | Default border width. |
|
|
82
|
-
| `--elevation-low` | Elevation for surface-level components such as cards and panels. |
|
|
83
|
-
| `--elevation-mid` | Elevation for elevated components such as dropdowns and floating containers. |
|
|
84
|
-
| `--elevation-high` | Elevation for tooltips and inline overlays. |
|
|
85
|
-
| `--focus-ring` | Focus-visible ring color. |
|
|
86
|
-
| `--focus-ring-offset` | Focus-visible outline offset. |
|
|
87
|
-
| `--focus-ring-width` | Focus-visible outline/ring width. |
|
|
88
|
-
| `--motion-duration-fast` | Fast transition for buttons and input interactions (`120ms`). |
|
|
89
|
-
| `--motion-duration-normal` | Normal transition for layout and modals (`200ms`). |
|
|
90
|
-
| `--motion-duration-slow` | Slow animation for skeleton loaders and progress bars (`400ms`). |
|
|
91
|
-
| `--motion-ease` | Default easing curve. |
|
|
92
|
-
| `--z-popover` | Popover/tooltip z-index. |
|
|
93
|
-
| `--surface-hover-transform` | The transform applied on interactive card/panel hover. |
|
|
94
|
-
| `--breakpoint-xs` | Extra-small Tailwind responsive breakpoint. |
|
|
95
|
-
| `--breakpoint-2xl` | Extended large Tailwind responsive breakpoint. |
|
|
96
|
-
|
|
97
|
-
## Component Internals
|
|
98
|
-
|
|
99
|
-
Component classes may define scoped implementation variables such as `--button-*`, `--surface-*`, `--control-*`, `--feedback-*`, and `--tooltip-*`. These variables are internal wiring for class composition and are not the public token contract.
|
|
100
|
-
|
|
101
|
-
Consumers should customize broad behavior through color, foundation, motion, elevation, radius, layout, and focus tokens first. The only supported component-scoped input is `--progress-value` on the child fill element inside `.progress`, because consumers must provide a value such as `64%`.
|