@codepom/tokens 0.1.0 → 2.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/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(--cp-amber-400);
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
- .cp-sr-only {
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,108 @@
1
1
  :root {
2
2
  /* ── Brand palette ──────────────────────────────────────────────── */
3
- --cp-navy-950: #08192E;
4
- --cp-navy-900: #0B132B;
5
- --cp-navy-800: #1C2541;
6
- --cp-navy-700: #3A506B; /* borders & decorative only */
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
- --cp-amber-400: #FBB040;
9
- --cp-amber-500: #F59E0B;
10
- --cp-amber-600: #EA580C;
8
+ --pom-amber-400: #FBB040;
9
+ --pom-amber-500: #F59E0B;
10
+ --pom-amber-600: #EA580C;
11
11
 
12
- --cp-cyan-400: #00DFFF;
13
- --cp-cyan-500: #38BDF8;
12
+ --pom-cyan-400: #00DFFF;
13
+ --pom-cyan-500: #38BDF8;
14
14
 
15
- --cp-ivory-50: #FDFCF0;
16
- --cp-ivory-100: #F8FAFC;
15
+ --pom-ivory-50: #FDFCF0;
16
+ --pom-ivory-100: #F8FAFC;
17
17
 
18
18
  /* ── Semantic colors ────────────────────────────────────────────── */
19
- --cp-background: #0B132B;
20
- --cp-foreground: #F8FAFC;
21
- --cp-card: #08192E;
22
- --cp-primary: #FBB040;
23
- --cp-secondary: #1C2541;
24
- --cp-accent: #00DFFF;
25
- --cp-border: #1C2541;
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
- --cp-success: #4ADE80;
29
- --cp-warning: #FB923C;
30
- --cp-error: #F87171;
28
+ --pom-success: #4ADE80;
29
+ --pom-warning: #FB923C;
30
+ --pom-error: #F87171;
31
31
 
32
- /* ── Accessible text scale (WCAG AA on --cp-navy-900) ──────────── */
33
- --cp-text-primary: #F8FAFC; /* 17.6:1 — body, headings */
34
- --cp-text-secondary: #94A3B8; /* 7.2:1 — labels, captions */
35
- --cp-text-tertiary: #64748B; /* 3.9:1 — large text / decorative */
36
- --cp-text-on-primary: #0B132B; /* text on amber/cyan surfaces */
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
- --cp-font-sans: "Space Grotesk", system-ui, sans-serif;
40
- --cp-font-mono: "Space Mono", "Courier New", monospace;
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
- --cp-radius-sm: 6px;
44
- --cp-radius-md: 8px;
45
- --cp-radius-lg: 12px;
46
- --cp-radius-xl: 14px;
47
- --cp-radius-full: 9999px;
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
- --cp-space-0: 0px;
51
- --cp-space-1: 4px;
52
- --cp-space-2: 8px;
53
- --cp-space-3: 12px;
54
- --cp-space-4: 16px;
55
- --cp-space-5: 20px;
56
- --cp-space-6: 24px;
57
- --cp-space-8: 32px;
58
- --cp-space-10: 40px;
59
- --cp-space-12: 48px;
60
- --cp-space-16: 64px;
61
- --cp-space-20: 80px;
62
- --cp-space-24: 96px;
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
- --cp-shadow-0: none;
66
- --cp-shadow-1: 0 1px 2px 0 rgba(5,10,24,0.4);
67
- --cp-shadow-2: 0 2px 8px 0 rgba(5,10,24,0.5), 0 1px 2px 0 rgba(5,10,24,0.3);
68
- --cp-shadow-3: 0 4px 16px 0 rgba(5,10,24,0.6), 0 2px 4px 0 rgba(5,10,24,0.3);
69
- --cp-shadow-4: 0 8px 32px 0 rgba(5,10,24,0.7), 0 4px 8px 0 rgba(5,10,24,0.4);
70
- --cp-shadow-5: 0 16px 48px 0 rgba(5,10,24,0.8), 0 8px 16px 0 rgba(5,10,24,0.5);
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
- --cp-duration-instant: 0ms;
74
- --cp-duration-fast: 100ms;
75
- --cp-duration-normal: 200ms;
76
- --cp-duration-slow: 350ms;
77
- --cp-duration-enter: 250ms;
78
- --cp-duration-exit: 150ms;
79
-
80
- --cp-ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
81
- --cp-ease-in: cubic-bezier(0.4, 0.0, 1.0, 1);
82
- --cp-ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
83
- --cp-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
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
+
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
- --cp-focus-ring: 0 0 0 2px var(--cp-amber-400);
86
+ --pom-focus-ring: 0 0 0 2px var(--pom-amber-400);
87
+
88
+ /* ── Interaction surfaces ───────────────────────────────────────── */
89
+ --pom-border-strong: #3A506B; /* hover / emphasized borders */
90
+ --pom-surface-hover: #1C2541; /* hover fill on dark surfaces */
91
+ --pom-primary-hover: #F59E0B;
92
+ --pom-primary-tint: rgba(251,176,64,0.12);
93
+ --pom-accent-tint: rgba(0,223,255,0.12);
94
+
95
+ /* ── Component style knobs — themes override these ──────────────── */
96
+ --pom-border-style: solid; /* blueprint: dashed */
97
+ --pom-font-label: var(--pom-font-sans);/* buttons, badges, labels, nav */
98
+ --pom-label-transform: none; /* blueprint: uppercase */
99
+ --pom-label-tracking: 0; /* blueprint: 0.04em */
100
+
101
+ /* ── Layering ───────────────────────────────────────────────────── */
102
+ --pom-z-sticky: 50;
103
+ --pom-z-drawer: 100;
104
+ --pom-z-modal: 1000;
105
+ --pom-z-toast: 9999;
87
106
  }
88
107
 
89
108
  @media (prefers-reduced-motion: reduce) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codepom/tokens",
3
- "version": "0.1.0",
3
+ "version": "2.1.0",
4
4
  "description": "CodePom design tokens — CSS custom properties, JS constants, Tailwind preset",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,15 +22,19 @@ const preset = {
22
22
  sans: ['"Space Grotesk"', 'system-ui', 'sans-serif'],
23
23
  mono: ['"Space Mono"', '"Courier New"', 'monospace'],
24
24
  },
25
+ // Radii and shadows read the CSS variables so themes (e.g. blueprint)
26
+ // flow through to Tailwind utilities like `rounded-md` and `shadow-pom-3`.
25
27
  borderRadius: {
26
- sm: '6px', md: '8px', lg: '12px', xl: '14px',
28
+ sm: 'var(--pom-radius-sm, 6px)', md: 'var(--pom-radius-md, 8px)',
29
+ lg: 'var(--pom-radius-lg, 12px)', xl: 'var(--pom-radius-xl, 14px)',
30
+ // `rounded-full` stays Tailwind's 9999px: it means "circle/pill", which themes must not square off.
27
31
  },
28
32
  boxShadow: {
29
- 'cp-1': '0 1px 2px 0 rgba(5,10,24,0.4)',
30
- 'cp-2': '0 2px 8px 0 rgba(5,10,24,0.5), 0 1px 2px 0 rgba(5,10,24,0.3)',
31
- 'cp-3': '0 4px 16px 0 rgba(5,10,24,0.6), 0 2px 4px 0 rgba(5,10,24,0.3)',
32
- 'cp-4': '0 8px 32px 0 rgba(5,10,24,0.7), 0 4px 8px 0 rgba(5,10,24,0.4)',
33
- 'cp-5': '0 16px 48px 0 rgba(5,10,24,0.8), 0 8px 16px 0 rgba(5,10,24,0.5)',
33
+ 'pom-1': 'var(--pom-shadow-1, 0 1px 2px 0 rgba(5,10,24,0.4))',
34
+ 'pom-2': 'var(--pom-shadow-2, 0 2px 8px 0 rgba(5,10,24,0.5), 0 1px 2px 0 rgba(5,10,24,0.3))',
35
+ 'pom-3': 'var(--pom-shadow-3, 0 4px 16px 0 rgba(5,10,24,0.6), 0 2px 4px 0 rgba(5,10,24,0.3))',
36
+ 'pom-4': 'var(--pom-shadow-4, 0 8px 32px 0 rgba(5,10,24,0.7), 0 4px 8px 0 rgba(5,10,24,0.4))',
37
+ 'pom-5': 'var(--pom-shadow-5, 0 16px 48px 0 rgba(5,10,24,0.8), 0 8px 16px 0 rgba(5,10,24,0.5))',
34
38
  },
35
39
  spacing: {
36
40
  1: '4px', 2: '8px', 3: '12px', 4: '16px', 5: '20px',
@@ -45,4 +49,4 @@ const preset = {
45
49
  },
46
50
  };
47
51
 
48
- module.exports = preset;
52
+ export default preset;