@codepom/tokens 0.1.0 → 2.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 +21 -0
- package/README.md +76 -0
- package/css/reset.css +2 -2
- package/css/tokens.css +63 -63
- package/package.json +1 -1
- package/tailwind/preset.js +5 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CodePom
|
|
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,76 @@
|
|
|
1
|
+
# @codepom/tokens
|
|
2
|
+
|
|
3
|
+
Design tokens for the CodePom design system — CSS custom properties, JavaScript constants, and a Tailwind CSS preset.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @codepom/tokens
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exports
|
|
12
|
+
|
|
13
|
+
| Import path | Contents |
|
|
14
|
+
|-------------|----------|
|
|
15
|
+
| `@codepom/tokens/css` | CSS custom properties (`--pom-*`) — colors, spacing, radius, shadows, motion, typography |
|
|
16
|
+
| `@codepom/tokens/reset` | Minimal CSS reset (box-sizing, focus-visible, sr-only) |
|
|
17
|
+
| `@codepom/tokens/js` | JavaScript token constants |
|
|
18
|
+
| `@codepom/tokens/tailwind` | Tailwind CSS preset |
|
|
19
|
+
|
|
20
|
+
## CSS custom properties
|
|
21
|
+
|
|
22
|
+
```css
|
|
23
|
+
@import '@codepom/tokens/css';
|
|
24
|
+
@import '@codepom/tokens/reset'; /* optional */
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Tokens are prefixed with `--pom-`:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
/* Colors */
|
|
31
|
+
--pom-navy-950, --pom-navy-900 ... --pom-navy-100
|
|
32
|
+
--pom-amber-400, --pom-amber-500, --pom-amber-600
|
|
33
|
+
--pom-cyan-400, --pom-cyan-500
|
|
34
|
+
--pom-ivory-50 ... --pom-ivory-200
|
|
35
|
+
|
|
36
|
+
/* Semantic */
|
|
37
|
+
--pom-background, --pom-foreground, --pom-muted, --pom-card
|
|
38
|
+
|
|
39
|
+
/* Spacing */
|
|
40
|
+
--pom-space-1 (4px) ... --pom-space-16 (64px)
|
|
41
|
+
|
|
42
|
+
/* Typography */
|
|
43
|
+
--pom-font-sans, --pom-font-mono
|
|
44
|
+
|
|
45
|
+
/* Motion */
|
|
46
|
+
--pom-duration-fast, --pom-duration-base, --pom-ease-out, --pom-ease-in-out
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## JavaScript
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import tokens from '@codepom/tokens/js'
|
|
53
|
+
// or named:
|
|
54
|
+
import { colors, semantic, spacing, radius, shadow, duration, easing, font } from '@codepom/tokens/js'
|
|
55
|
+
|
|
56
|
+
console.log(tokens.colors.navy[950]) // '#0B132B'
|
|
57
|
+
console.log(tokens.spacing[4]) // '16px'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Tailwind preset
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
// tailwind.config.js
|
|
64
|
+
import codepomPreset from '@codepom/tokens/tailwind'
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
presets: [codepomPreset],
|
|
68
|
+
content: ['./src/**/*.{ts,tsx,astro}'],
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The preset maps all tokens to Tailwind utilities: `bg-navy-900`, `text-amber-400`, `font-sans`, `duration-fast`, etc.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
package/css/reset.css
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
*, *::before, *::after { box-sizing: border-box; }
|
|
3
3
|
|
|
4
4
|
:focus-visible {
|
|
5
|
-
outline: 2px solid var(--
|
|
5
|
+
outline: 2px solid var(--pom-amber-400);
|
|
6
6
|
outline-offset: 2px;
|
|
7
7
|
border-radius: 4px;
|
|
8
8
|
}
|
|
9
9
|
:focus:not(:focus-visible) { outline: none; }
|
|
10
10
|
|
|
11
|
-
.
|
|
11
|
+
.pom-sr-only {
|
|
12
12
|
position: absolute; width: 1px; height: 1px;
|
|
13
13
|
padding: 0; margin: -1px; overflow: hidden;
|
|
14
14
|
clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
|
package/css/tokens.css
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
/* ── Brand palette ──────────────────────────────────────────────── */
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
--
|
|
3
|
+
--pom-navy-950: #08192E;
|
|
4
|
+
--pom-navy-900: #0B132B;
|
|
5
|
+
--pom-navy-800: #1C2541;
|
|
6
|
+
--pom-navy-700: #3A506B; /* borders & decorative only */
|
|
7
7
|
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
8
|
+
--pom-amber-400: #FBB040;
|
|
9
|
+
--pom-amber-500: #F59E0B;
|
|
10
|
+
--pom-amber-600: #EA580C;
|
|
11
11
|
|
|
12
|
-
--
|
|
13
|
-
--
|
|
12
|
+
--pom-cyan-400: #00DFFF;
|
|
13
|
+
--pom-cyan-500: #38BDF8;
|
|
14
14
|
|
|
15
|
-
--
|
|
16
|
-
--
|
|
15
|
+
--pom-ivory-50: #FDFCF0;
|
|
16
|
+
--pom-ivory-100: #F8FAFC;
|
|
17
17
|
|
|
18
18
|
/* ── Semantic colors ────────────────────────────────────────────── */
|
|
19
|
-
--
|
|
20
|
-
--
|
|
21
|
-
--
|
|
22
|
-
--
|
|
23
|
-
--
|
|
24
|
-
--
|
|
25
|
-
--
|
|
19
|
+
--pom-background: #0B132B;
|
|
20
|
+
--pom-foreground: #F8FAFC;
|
|
21
|
+
--pom-card: #08192E;
|
|
22
|
+
--pom-primary: #FBB040;
|
|
23
|
+
--pom-secondary: #1C2541;
|
|
24
|
+
--pom-accent: #00DFFF;
|
|
25
|
+
--pom-border: #1C2541;
|
|
26
26
|
|
|
27
27
|
/* ── Feedback ───────────────────────────────────────────────────── */
|
|
28
|
-
--
|
|
29
|
-
--
|
|
30
|
-
--
|
|
28
|
+
--pom-success: #4ADE80;
|
|
29
|
+
--pom-warning: #FB923C;
|
|
30
|
+
--pom-error: #F87171;
|
|
31
31
|
|
|
32
|
-
/* ── Accessible text scale (WCAG AA on --
|
|
33
|
-
--
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
--
|
|
32
|
+
/* ── Accessible text scale (WCAG AA on --pom-navy-900) ──────────── */
|
|
33
|
+
--pom-text-primary: #F8FAFC; /* 17.6:1 — body, headings */
|
|
34
|
+
--pom-text-secondary: #94A3B8; /* 7.2:1 — labels, captions */
|
|
35
|
+
--pom-text-tertiary: #64748B; /* 3.9:1 — large text / decorative */
|
|
36
|
+
--pom-text-on-primary: #0B132B; /* text on amber/cyan surfaces */
|
|
37
37
|
|
|
38
38
|
/* ── Typography ─────────────────────────────────────────────────── */
|
|
39
|
-
--
|
|
40
|
-
--
|
|
39
|
+
--pom-font-sans: "Space Grotesk", system-ui, sans-serif;
|
|
40
|
+
--pom-font-mono: "Space Mono", "Courier New", monospace;
|
|
41
41
|
|
|
42
42
|
/* ── Border radius ───────────────────────────────────────────────── */
|
|
43
|
-
--
|
|
44
|
-
--
|
|
45
|
-
--
|
|
46
|
-
--
|
|
47
|
-
--
|
|
43
|
+
--pom-radius-sm: 6px;
|
|
44
|
+
--pom-radius-md: 8px;
|
|
45
|
+
--pom-radius-lg: 12px;
|
|
46
|
+
--pom-radius-xl: 14px;
|
|
47
|
+
--pom-radius-full: 9999px;
|
|
48
48
|
|
|
49
49
|
/* ── Spacing — 8pt grid ──────────────────────────────────────────── */
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
--
|
|
53
|
-
--
|
|
54
|
-
--
|
|
55
|
-
--
|
|
56
|
-
--
|
|
57
|
-
--
|
|
58
|
-
--
|
|
59
|
-
--
|
|
60
|
-
--
|
|
61
|
-
--
|
|
62
|
-
--
|
|
50
|
+
--pom-space-0: 0px;
|
|
51
|
+
--pom-space-1: 4px;
|
|
52
|
+
--pom-space-2: 8px;
|
|
53
|
+
--pom-space-3: 12px;
|
|
54
|
+
--pom-space-4: 16px;
|
|
55
|
+
--pom-space-5: 20px;
|
|
56
|
+
--pom-space-6: 24px;
|
|
57
|
+
--pom-space-8: 32px;
|
|
58
|
+
--pom-space-10: 40px;
|
|
59
|
+
--pom-space-12: 48px;
|
|
60
|
+
--pom-space-16: 64px;
|
|
61
|
+
--pom-space-20: 80px;
|
|
62
|
+
--pom-space-24: 96px;
|
|
63
63
|
|
|
64
64
|
/* ── Elevation — navy-tinted shadows ────────────────────────────── */
|
|
65
|
-
--
|
|
66
|
-
--
|
|
67
|
-
--
|
|
68
|
-
--
|
|
69
|
-
--
|
|
70
|
-
--
|
|
65
|
+
--pom-shadow-0: none;
|
|
66
|
+
--pom-shadow-1: 0 1px 2px 0 rgba(5,10,24,0.4);
|
|
67
|
+
--pom-shadow-2: 0 2px 8px 0 rgba(5,10,24,0.5), 0 1px 2px 0 rgba(5,10,24,0.3);
|
|
68
|
+
--pom-shadow-3: 0 4px 16px 0 rgba(5,10,24,0.6), 0 2px 4px 0 rgba(5,10,24,0.3);
|
|
69
|
+
--pom-shadow-4: 0 8px 32px 0 rgba(5,10,24,0.7), 0 4px 8px 0 rgba(5,10,24,0.4);
|
|
70
|
+
--pom-shadow-5: 0 16px 48px 0 rgba(5,10,24,0.8), 0 8px 16px 0 rgba(5,10,24,0.5);
|
|
71
71
|
|
|
72
72
|
/* ── Motion ─────────────────────────────────────────────────────── */
|
|
73
|
-
--
|
|
74
|
-
--
|
|
75
|
-
--
|
|
76
|
-
--
|
|
77
|
-
--
|
|
78
|
-
--
|
|
73
|
+
--pom-duration-instant: 0ms;
|
|
74
|
+
--pom-duration-fast: 100ms;
|
|
75
|
+
--pom-duration-normal: 200ms;
|
|
76
|
+
--pom-duration-slow: 350ms;
|
|
77
|
+
--pom-duration-enter: 250ms;
|
|
78
|
+
--pom-duration-exit: 150ms;
|
|
79
79
|
|
|
80
|
-
--
|
|
81
|
-
--
|
|
82
|
-
--
|
|
83
|
-
--
|
|
80
|
+
--pom-ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
|
|
81
|
+
--pom-ease-in: cubic-bezier(0.4, 0.0, 1.0, 1);
|
|
82
|
+
--pom-ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
83
|
+
--pom-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
84
84
|
|
|
85
85
|
/* ── Focus ───────────────────────────────────────────────────────── */
|
|
86
|
-
--
|
|
86
|
+
--pom-focus-ring: 0 0 0 2px var(--pom-amber-400);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
@media (prefers-reduced-motion: reduce) {
|
package/package.json
CHANGED
package/tailwind/preset.js
CHANGED
|
@@ -26,11 +26,11 @@ const preset = {
|
|
|
26
26
|
sm: '6px', md: '8px', lg: '12px', xl: '14px',
|
|
27
27
|
},
|
|
28
28
|
boxShadow: {
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
29
|
+
'pom-1': '0 1px 2px 0 rgba(5,10,24,0.4)',
|
|
30
|
+
'pom-2': '0 2px 8px 0 rgba(5,10,24,0.5), 0 1px 2px 0 rgba(5,10,24,0.3)',
|
|
31
|
+
'pom-3': '0 4px 16px 0 rgba(5,10,24,0.6), 0 2px 4px 0 rgba(5,10,24,0.3)',
|
|
32
|
+
'pom-4': '0 8px 32px 0 rgba(5,10,24,0.7), 0 4px 8px 0 rgba(5,10,24,0.4)',
|
|
33
|
+
'pom-5': '0 16px 48px 0 rgba(5,10,24,0.8), 0 8px 16px 0 rgba(5,10,24,0.5)',
|
|
34
34
|
},
|
|
35
35
|
spacing: {
|
|
36
36
|
1: '4px', 2: '8px', 3: '12px', 4: '16px', 5: '20px',
|