@classic-homes/theme-styles 0.5.0 → 0.6.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 +43 -0
- package/package.json +12 -2
- package/src/accessibility.css +36 -29
- package/src/index.css +6 -3
- package/src/utilities.css +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @classic-homes/theme-styles
|
|
2
|
+
|
|
3
|
+
Base styles, accessibility helpers, and utility classes for the Classic Theme design system. Requires the design tokens from `@classic-homes/theme-tokens`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @classic-homes/theme-styles @classic-homes/theme-tokens tailwindcss
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies: `@classic-homes/theme-tokens@*`, `tailwindcss@>=3.0.0`.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Import the styles before the Tailwind directives in your app CSS:
|
|
16
|
+
|
|
17
|
+
```css
|
|
18
|
+
@import '@classic-homes/theme-styles';
|
|
19
|
+
@tailwind base;
|
|
20
|
+
@tailwind components;
|
|
21
|
+
@tailwind utilities;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The main entry defines the cascade layers, brand fonts, tokens, base, accessibility, and utility styles.
|
|
25
|
+
|
|
26
|
+
## Exports
|
|
27
|
+
|
|
28
|
+
| Import | Contents |
|
|
29
|
+
| ------------------------------------------- | ---------------------------------------------------------- |
|
|
30
|
+
| `@classic-homes/theme-styles` | All styles (fonts, tokens, base, accessibility, utilities) |
|
|
31
|
+
| `@classic-homes/theme-styles/core` | Same as the main entry, without the brand fonts |
|
|
32
|
+
| `@classic-homes/theme-styles/fonts` | Brand fonts |
|
|
33
|
+
| `@classic-homes/theme-styles/base` | Base element styles |
|
|
34
|
+
| `@classic-homes/theme-styles/accessibility` | Accessibility styles |
|
|
35
|
+
| `@classic-homes/theme-styles/utilities` | Utility classes |
|
|
36
|
+
|
|
37
|
+
Use `/core` when the app already loads brand fonts:
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
@import '@classic-homes/theme-styles/core';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The `@layer` order must come before any other `@import` in your CSS. Keep it at the top of the file.
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classic-homes/theme-styles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Base styles and utilities for the Classic Theme design system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "echo 'No build needed for styles package'"
|
|
7
|
+
"build": "echo 'No build needed for styles package'",
|
|
8
|
+
"test": "vitest run"
|
|
8
9
|
},
|
|
9
10
|
"exports": {
|
|
10
11
|
".": "./src/index.css",
|
|
@@ -38,5 +39,14 @@
|
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"@classic-homes/theme-tokens": "*",
|
|
40
41
|
"tailwindcss": ">=3.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@classic-homes/postcss-config": "*",
|
|
45
|
+
"@classic-homes/theme-tailwind-preset": "*",
|
|
46
|
+
"@classic-homes/theme-tokens": "*",
|
|
47
|
+
"postcss": "^8.4.0",
|
|
48
|
+
"postcss-import": "^16.1.1",
|
|
49
|
+
"tailwindcss": "^3.4.0",
|
|
50
|
+
"vitest": "^4.0.0"
|
|
41
51
|
}
|
|
42
52
|
}
|
package/src/accessibility.css
CHANGED
|
@@ -28,36 +28,43 @@
|
|
|
28
28
|
a:focus-visible {
|
|
29
29
|
border-radius: var(--radius, 0.5rem);
|
|
30
30
|
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* The two media blocks below stay outside @layer: nested in a layer, the
|
|
34
|
+
cascade-layers polyfill in @classic-homes/postcss-config leaves an empty
|
|
35
|
+
`@media (forced-colors)` shell at the top of the bundle, ahead of the font
|
|
36
|
+
@import, and browsers then drop the @import. */
|
|
37
|
+
|
|
38
|
+
/* ===== Reduced Motion (WCAG 2.3.3) ===== */
|
|
39
|
+
|
|
40
|
+
@media (prefers-reduced-motion: reduce) {
|
|
41
|
+
*,
|
|
42
|
+
*::before,
|
|
43
|
+
*::after {
|
|
44
|
+
animation-duration: 0.01ms !important;
|
|
45
|
+
animation-delay: 0ms !important;
|
|
46
|
+
animation-iteration-count: 1 !important;
|
|
47
|
+
transition-duration: 0.01ms !important;
|
|
48
|
+
transition-delay: 0ms !important;
|
|
49
|
+
scroll-behavior: auto !important;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* ===== High Contrast Mode Support ===== */
|
|
31
54
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/* ===== High Contrast Mode Support ===== */
|
|
46
|
-
|
|
47
|
-
@media (forced-colors: active) {
|
|
48
|
-
/* Ensure borders are visible in high contrast mode */
|
|
49
|
-
button,
|
|
50
|
-
input,
|
|
51
|
-
select,
|
|
52
|
-
textarea,
|
|
53
|
-
[role='button'] {
|
|
54
|
-
border: 1px solid ButtonText;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* Ensure focus is visible */
|
|
58
|
-
:focus-visible {
|
|
59
|
-
outline: 2px solid Highlight;
|
|
60
|
-
}
|
|
55
|
+
@media (forced-colors: active) {
|
|
56
|
+
/* Ensure borders are visible in high contrast mode */
|
|
57
|
+
button,
|
|
58
|
+
input,
|
|
59
|
+
select,
|
|
60
|
+
textarea,
|
|
61
|
+
[role='button'] {
|
|
62
|
+
border: 1px solid ButtonText;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Ensure focus is visible */
|
|
66
|
+
:focus-visible {
|
|
67
|
+
outline: 2px solid Highlight;
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
70
|
|
package/src/index.css
CHANGED
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
* @tailwind utilities;
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/* Define CSS layer order - lowest to highest specificity. Must come before
|
|
14
|
+
every @import: postcss-import (Vite, PostCSS builds) drops any @import that
|
|
15
|
+
follows a non-import statement, and an @layer statement between imports
|
|
16
|
+
counts as one - that silently removed the tokens and base styles. */
|
|
17
|
+
@layer classic-theme.tokens, classic-theme.base, classic-theme.components, classic-theme.utilities;
|
|
18
|
+
|
|
13
19
|
/* Brand fonts. Must precede every rule except @layer statements; ./core omits it. */
|
|
14
20
|
@import './fonts.css';
|
|
15
21
|
|
|
16
|
-
/* Define CSS layer order - lowest to highest specificity */
|
|
17
|
-
@layer classic-theme.tokens, classic-theme.base, classic-theme.components, classic-theme.utilities;
|
|
18
|
-
|
|
19
22
|
/* Import design tokens (CSS custom properties) */
|
|
20
23
|
@import '@classic-homes/theme-tokens/css';
|
|
21
24
|
|
package/src/utilities.css
CHANGED
|
@@ -170,7 +170,9 @@
|
|
|
170
170
|
* preset (tailwind-preset/index.js) as the single source of truth.
|
|
171
171
|
*
|
|
172
172
|
* The shimmer utility below requires custom background styling beyond
|
|
173
|
-
* what Tailwind's animation config provides, so it remains here.
|
|
173
|
+
* what Tailwind's animation config provides, so it remains here. Its
|
|
174
|
+
* `animation` comes from the preset only: Tailwind's unlayered utility
|
|
175
|
+
* always beats a declaration in this layer, so a second one here is dead.
|
|
174
176
|
*/
|
|
175
177
|
|
|
176
178
|
.animate-shimmer {
|
|
@@ -181,7 +183,6 @@
|
|
|
181
183
|
hsl(var(--muted)) 100%
|
|
182
184
|
);
|
|
183
185
|
background-size: 200% 100%;
|
|
184
|
-
animation: shimmer 2s linear infinite;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
/* ===== Print Utilities ===== */
|